@ulb-darmstadt/shacl-form 3.0.5 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +53 -53
- package/dist/form.d.ts +0 -3
- package/dist/index.js +7 -7
- package/dist/node-template.d.ts +1 -0
- package/dist/util.d.ts +10 -0
- package/package.json +7 -7
package/dist/bundle.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),u=o((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),d=o((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),f=o((e=>{var t=u(),n=d(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,`parent`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,`offset`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return p(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return m(e,t);if(ArrayBuffer.isView(e))return g(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(ye(e,ArrayBuffer)||e&&ye(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(ye(e,SharedArrayBuffer)||e&&ye(e.buffer,SharedArrayBuffer)))return _(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=v(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function f(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return f(e,t,n)};function p(e){return l(e),o(e<0?0:y(e)|0)}s.allocUnsafe=function(e){return p(e)},s.allocUnsafeSlow=function(e){return p(e)};function m(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=x(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:y(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function g(e){if(ye(e,Uint8Array)){let t=new Uint8Array(e);return _(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function _(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function v(e){if(s.isBuffer(e)){let t=y(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||H(e.length)?o(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function y(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function b(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(ye(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),ye(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(e){switch(String(e).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}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(ye(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function x(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ye(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return me(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return _e(e).length;default:if(i)return r?-1:me(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=x;function S(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return R(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return F(this,t,n);case`latin1`:case`binary`:return I(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return z(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function C(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)C(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)C(this,t,t+3),C(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)C(this,t,t+7),C(this,t+1,t+6),C(this,t+2,t+5),C(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):S.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(ye(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:o<a?1:0};function w(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,H(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(H(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return ve(me(t,e.length-n),e,n,r)}function O(e,t,n,r){return ve(he(t),e,n,r)}function k(e,t,n,r){return ve(_e(t),e,n,r)}function A(e,t,n,r){return ve(ge(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return P(r)}var N=4096;function P(e){let t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}function F(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function I(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function R(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=be[e[r]];return i}function z(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function B(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!1,52,8)};function V(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ee(e,t,n,r,i){le(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function te(e,t,n,r,i){le(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=xe(function(e,t=0){return ee(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=xe(function(e,t=0){return te(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=xe(function(e,t=0){return ee(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=xe(function(e,t=0){return te(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ne(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function re(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return re(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return re(this,e,t,!1,n)};function ie(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return ie(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return ie(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var ae={};function oe(e,t,n){ae[e]=class extends n{constructor(){super(),Object.defineProperty(this,`message`,{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,`code`,{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}oe(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),oe(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),oe(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=se(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=se(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function se(e){let t=``,n=e.length,r=e[0]===`-`?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ce(e,t,n){ue(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&de(t,e.length-(n+1))}function le(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new ae.ERR_OUT_OF_RANGE(`value`,i,e)}ce(r,i,a)}function ue(e,t){if(typeof e!=`number`)throw new ae.ERR_INVALID_ARG_TYPE(t,`number`,e)}function de(e,t,n){throw Math.floor(e)===e?t<0?new ae.ERR_BUFFER_OUT_OF_BOUNDS:new ae.ERR_OUT_OF_RANGE(n||`offset`,`>= ${n?1:0} and <= ${t}`,e):(ue(e,n),new ae.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var fe=/[^+/0-9A-Za-z-_]/g;function pe(e){if(e=e.split(`=`)[0],e=e.trim().replace(fe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function me(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function he(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ge(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function _e(e){return t.toByteArray(pe(e))}function ve(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ye(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function H(e){return e!==e}var be=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function xe(e){return typeof BigInt>`u`?Se:e}function Se(){throw Error(`BigInt not supported`)}})),p=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,m=`http://www.w3.org/2001/XMLSchema#`,h=`http://www.w3.org/2000/10/swap/`,g={xsd:{decimal:`${m}decimal`,boolean:`${m}boolean`,double:`${m}double`,integer:`${m}integer`,string:`${m}string`},rdf:{type:`${p}type`,nil:`${p}nil`,first:`${p}first`,rest:`${p}rest`,langString:`${p}langString`},owl:{sameAs:`http://www.w3.org/2002/07/owl#sameAs`},r:{forSome:`${h}reify#forSome`,forAll:`${h}reify#forAll`},log:{implies:`${h}log#implies`,isImpliedBy:`${h}log#isImpliedBy`}},_=f(),{xsd:v}=g,y=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,b={"\\":`\\`,"'":`'`,'"':`"`,n:`
|
|
2
|
-
`,r:`\r`,t:` `,f:`\f`,b:`\b`,_:`_`,"~":`~`,".":`.`,"-":`-`,"!":`!`,$:`$`,"&":`&`,"(":`(`,")":`)`,"*":`*`,"+":`+`,",":`,`,";":`;`,"=":`=`,"/":`/`,"?":`?`,"#":`#`,"@":`@`,"%":`%`},x=/[\x00-\x20<>\\"\{\}\|\^\`]/,S={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},C=/$0^/,w=class{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e||={},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let e in this)!(e in S)&&this[e]instanceof RegExp&&(this[e]=C)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,r=n.length;for(;;){let e,o;for(;e=this._newline.exec(n);)this.comments&&(o=this._comment.exec(e[0]))&&i(`comment`,o[1],``,this._line,e[0].length),n=n.substr(e[0].length,n.length),r=n.length,this._line++;if(!e&&(e=this._whitespace.exec(n))&&(n=n.substr(e[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(o=this._comment.exec(n))&&i(`comment`,o[1],``,this._line,n.length),n=null,i(`eof`,``,``,this._line,0)),this._input=n;let s=this._line,c=n[0],l=``,u=``,d=``,f=null,p=0,m=!1;switch(c){case`^`:if(n.length<3)break;if(n[1]===`^`){if(this._previousMarker=`^^`,n=n.substr(2),n[0]!==`<`){m=!0;break}}else{this._n3Mode&&(p=1,l=`^`);break}case`<`:if(f=this._unescapedIri.exec(n))l=`IRI`,u=f[1];else if(f=this._iri.exec(n)){if(u=this._unescape(f[1]),u===null||x.test(u))return a(this);l=`IRI`}else n.length>1&&n[1]===`<`?(l=`<<`,p=2):this._n3Mode&&n.length>1&&n[1]===`=`&&(p=2,this._isImpliedBy?(l=`abbreviation`,u=`<`):(l=`inverse`,u=`>`));break;case`>`:n.length>1&&n[1]===`>`&&(l=`>>`,p=2);break;case`_`:((f=this._blank.exec(n))||t&&(f=this._blank.exec(`${n} `)))&&(l=`blank`,d=`_`,u=f[1]);break;case`"`:if(f=this._simpleQuotedString.exec(n))u=f[1];else if({value:u,matchLength:p}=this._parseLiteral(n),u===null)return a(this);(f!==null||p!==0)&&(l=`literal`,this._literalClosingPos=0);break;case`'`:if(!this._lineMode){if(f=this._simpleApostropheString.exec(n))u=f[1];else if({value:u,matchLength:p}=this._parseLiteral(n),u===null)return a(this);(f!==null||p!==0)&&(l=`literal`,this._literalClosingPos=0)}break;case`?`:this._n3Mode&&(f=this._variable.exec(n))&&(l=`var`,u=f[0]);break;case`@`:this._previousMarker===`literal`&&(f=this._langcode.exec(n))?(l=`langcode`,u=f[1]):(f=this._keyword.exec(n))&&(l=f[0]);break;case`.`:if(n.length===1?t:n[1]<`0`||n[1]>`9`){l=`.`,p=1;break}case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:case`+`:case`-`:(f=this._number.exec(n)||t&&(f=this._number.exec(`${n} `)))&&(l=`literal`,u=f[0],d=typeof f[1]==`string`?v.double:typeof f[2]==`string`?v.decimal:v.integer);break;case`B`:case`b`:case`p`:case`P`:case`G`:case`g`:(f=this._sparqlKeyword.exec(n))?l=f[0].toUpperCase():m=!0;break;case`f`:case`t`:(f=this._boolean.exec(n))?(l=`literal`,u=f[0],d=v.boolean):m=!0;break;case`a`:(f=this._shortPredicates.exec(n))?(l=`abbreviation`,u=`a`):m=!0;break;case`=`:this._n3Mode&&n.length>1&&(l=`abbreviation`,n[1]===`>`?(p=2,u=`>`):(p=1,u=`=`));break;case`!`:if(!this._n3Mode)break;case`,`:case`;`:case`[`:case`]`:case`(`:case`)`:case`}`:this._lineMode||(p=1,l=c);break;case`{`:!this._lineMode&&n.length>=2&&(n[1]===`|`?(l=`{|`,p=2):(l=c,p=1));break;case`|`:n.length>=2&&n[1]===`}`&&(l=`|}`,p=2);break;default:m=!0}if(m&&((this._previousMarker===`@prefix`||this._previousMarker===`PREFIX`)&&(f=this._prefix.exec(n))?(l=`prefix`,u=f[1]||``):((f=this._prefixed.exec(n))||t&&(f=this._prefixed.exec(`${n} `)))&&(l=`prefixed`,d=f[1]||``,u=this._unescape(f[2]))),this._previousMarker===`^^`)switch(l){case`prefixed`:l=`type`;break;case`IRI`:l=`typeIRI`;break;default:l=``}if(!l)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;let h=p||f[0].length;this.previousToken=i(l,u,d,s,h),this._previousMarker=l,n=n.substr(h,n.length)}function i(t,i,a,o,s){let c=n?r-n.length:r,l={type:t,value:i,prefix:a,line:o,start:c,end:c+s};return e(null,l),l}function a(t){e(t._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1,n=e.replace(y,(e,n,r,i)=>{if(typeof n==`string`)return String.fromCharCode(Number.parseInt(n,16));if(typeof r==`string`){let e=Number.parseInt(r,16);return e<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(e&1023))}return i in b?b[i]:(t=!0,``)});return t?null:n}_parseLiteral(e){if(e.length>=3){let t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length,r=Math.max(this._literalClosingPos,n);for(;(r=e.indexOf(t,r))>0;){let t=0;for(;e[r-t-1]===`\\`;)t++;if(t%2==0){let t=e.substring(n,r),i=t.split(/\r\n|\r|\n/).length-1,a=r+n;if(n===1&&i!==0||n===3&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:a}}r++}this._literalClosingPos=e.length-n+1}return{value:``,matchLength:0}}_syntaxError(e){this._input=null;let t=Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith(``)?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e==`string`)if(this._input=this._readStartingBom(e),typeof t==`function`)queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{let e=[],t;if(this._tokenizeToEnd((n,r)=>n?t=n:e.push(r),!0),t)throw t;return e}else this._pendingBuffer=null,typeof e.setEncoding==`function`&&e.setEncoding(`utf8`),e.on(`data`,e=>{this._input!==null&&e.length!==0&&(this._pendingBuffer&&=(e=_.Buffer.concat([this._pendingBuffer,e]),null),e[e.length-1]&128?this._pendingBuffer=e:(this._input===void 0?this._input=this._readStartingBom(typeof e==`string`?e:e.toString()):this._input+=e,this._tokenizeToEnd(t,!1)))}),e.on(`end`,()=>{typeof this._input==`string`&&this._tokenizeToEnd(t,!0)}),e.on(`error`,t)}},{rdf:T,xsd:E}=g,D,O=0,k={namedNode:z,blankNode:B,variable:ee,literal:V,defaultGraph:te,quad:ne,triple:ne,fromTerm:re,fromQuad:ie},A=class e{constructor(e){this.id=e}get value(){return this.id}equals(t){return t instanceof e?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},j=class extends A{get termType(){return`NamedNode`}},M=class e extends A{get termType(){return`Literal`}get value(){return this.id.substring(1,this.id.lastIndexOf(`"`))}get language(){let e=this.id,t=e.lastIndexOf(`"`)+1;return t<e.length&&e[t++]===`@`?e.substr(t).toLowerCase():``}get datatype(){return new j(this.datatypeString)}get datatypeString(){let e=this.id,t=e.lastIndexOf(`"`)+1,n=t<e.length?e[t]:``;return n===`^`?e.substr(t+2):n===`@`?T.langString:E.string}equals(t){return t instanceof e?this.id===t.id:!!t&&!!t.datatype&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&this.datatype.value===t.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:`NamedNode`,value:this.datatypeString}}}},N=class extends A{constructor(e){super(`_:${e}`)}get termType(){return`BlankNode`}get value(){return this.id.substr(2)}},P=class extends A{constructor(e){super(`?${e}`)}get termType(){return`Variable`}get value(){return this.id.substr(1)}};D=new class extends A{constructor(){return super(``),D||this}get termType(){return`DefaultGraph`}equals(e){return this===e||!!e&&this.termType===e.termType}};function F(e,t,n){if(t||=k,!e)return t.defaultGraph();switch(e[0]){case`?`:return t.variable(e.substr(1));case`_`:return t.blankNode(e.substr(2));case`"`:if(t===k)return new M(e);if(e[e.length-1]===`"`)return t.literal(e.substr(1,e.length-2));let r=e.lastIndexOf(`"`,e.length-1);return t.literal(e.substr(1,r-1),e[r+1]===`@`?e.substr(r+2):t.namedNode(e.substr(r+3)));case`[`:e=JSON.parse(e);break;default:if(!n||!Array.isArray(e))return t.namedNode(e)}return t.quad(F(e[0],t,!0),F(e[1],t,!0),F(e[2],t,!0),e[3]&&F(e[3],t,!0))}function I(e,t){if(typeof e==`string`)return e;if(e instanceof A&&e.termType!==`Quad`)return e.id;if(!e)return D.id;switch(e.termType){case`NamedNode`:return e.value;case`BlankNode`:return`_:${e.value}`;case`Variable`:return`?${e.value}`;case`DefaultGraph`:return``;case`Literal`:return`"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==E.string?`^^${e.datatype.value}`:``}`;case`Quad`:let n=[I(e.subject,!0),I(e.predicate,!0),I(e.object,!0)];return e.graph&&e.graph.termType!==`DefaultGraph`&&n.push(I(e.graph,!0)),t?n:JSON.stringify(n);default:throw Error(`Unexpected termType: ${e.termType}`)}}var R=class extends A{constructor(e,t,n,r){super(``),this._subject=e,this._predicate=t,this._object=n,this._graph=r||D}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(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}};function z(e){return new j(e)}function B(e){return new N(e||`n3-${O++}`)}function V(e,t){if(typeof t==`string`)return new M(`"${e}"@${t.toLowerCase()}`);let n=t?t.value:``;return n===``&&(typeof e==`boolean`?n=E.boolean:typeof e==`number`&&(Number.isFinite(e)?n=Number.isInteger(e)?E.integer:E.double:(n=E.double,Number.isNaN(e)||(e=e>0?`INF`:`-INF`)))),n===``||n===E.string?new M(`"${e}"`):new M(`"${e}"^^${n}`)}function ee(e){return new P(e)}function te(){return D}function ne(e,t,n,r){return new R(e,t,n,r)}function re(e){if(e instanceof A)return e;switch(e.termType){case`NamedNode`:return z(e.value);case`BlankNode`:return B(e.value);case`Variable`:return ee(e.value);case`DefaultGraph`:return D;case`Literal`:return V(e.value,e.language||e.datatype);case`Quad`:return ie(e);default:throw Error(`Unexpected termType: ${e.termType}`)}}function ie(e){if(e instanceof R)return e;if(e.termType!==`Quad`)throw Error(`Unexpected termType: ${e.termType}`);return ne(re(e.subject),re(e.predicate),re(e.object),re(e.graph))}var ae=0,oe=class{constructor(e){this._contextStack=[],this._graph=null,e||={},this._setBase(e.baseIRI),e.factory&&ce(this,e.factory);let t=typeof e.format==`string`?e.format.match(/\w*$/)[0].toLowerCase():``,n=/turtle/.test(t),r=/trig/.test(t),i=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),s=i||a;(this._supportsNamedGraphs=!(n||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||r||i||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===``||/star|\*$/.test(t),s&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix=typeof e.blankNodePrefix==`string`?e.blankNodePrefix.replace(/^(?!_:)/,`_:`):``,this._lexer=e.lexer||new w({lineMode:s,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){ae=0}_setBase(e){if(!e)this._base=``,this._basePath=``;else{let t=e.indexOf(`#`);t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf(`/`)<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,``),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,t,n,r,i){let a=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:r,object:i,graph:t,inverse:a?this._inversePredicate:!1,blankPrefix:a?this._prefixes._:``,quantified:a?this._quantified:null}),a&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:`.`,this._quantified=Object.create(this._quantified))}_restoreContext(e,t){let n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readInTopContext(e){switch(e.type){case`eof`:return this._graph===null?(delete this._prefixes._,this._callback(null,null,this._prefixes)):this._error(`Unclosed graph`,e);case`PREFIX`:this._sparqlStyle=!0;case`@prefix`:return this._readPrefix;case`BASE`:this._sparqlStyle=!0;case`@base`:return this._readBaseIRI;case`{`:if(this._supportsNamedGraphs)return this._graph=``,this._subject=null,this._readSubject;case`GRAPH`:if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let n;switch(e.type){case`IRI`:case`typeIRI`:let t=this._resolveIRI(e.value);if(t===null)return this._error(`Invalid IRI`,e);n=this._factory.namedNode(t);break;case`type`:case`prefixed`:let r=this._prefixes[e.prefix];if(r===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(r+e.value);break;case`blank`:n=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case`var`:n=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(e){switch(this._predicate=null,e.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`,e);case`}`:return this._readPunctuation(e);case`@forSome`:return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=`blankNode`,this._readQuantifierList):this._error(`Unexpected "@forSome"`,e);case`@forAll`:return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=`variable`,this._readQuantifierList):this._error(`Unexpected "@forAll"`,e);case`literal`:if(!this._n3Mode)return this._error(`Unexpected literal`,e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case`<<`:return this._supportsRDFStar?(this._saveContext(`<<`,this._graph,null,null,null),this._graph=null,this._readSubject):this._error(`Unexpected RDF-star syntax`,e);default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let t=e.type;switch(t){case`inverse`:this._inversePredicate=!0;case`abbreviation`:this._predicate=this.ABBREVIATIONS[e.value];break;case`.`:case`]`:case`}`:return this._predicate===null?this._error(`Unexpected ${t}`,e):(this._subject=null,t===`]`?this._readBlankNodeTail(e):this._readPunctuation(e));case`;`:return this._predicate===null?this._error(`Expected predicate but got ;`,e):this._readPredicate;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`,e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case`literal`:if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.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`,e);case`<<`:return this._supportsRDFStar?(this._saveContext(`<<`,this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error(`Unexpected RDF-star syntax`,e);default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type===`{`?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type===`{`?(this._graph=this._subject,this._subject=null,this._readSubject):this._error(`Expected graph but got ${e.type}`,e)}_readBlankNodeHead(e){return e.type===`]`?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!==`]`)return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let t=this._predicate===null;return this._restoreContext(`blank`,e),this._object===null?this._predicate===null?t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank:this._readObject:this._getContextEndReader()}_readPredicateAfterBlank(e){switch(e.type){case`.`:case`}`:return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,n=null,r=this._readListItem,i=this._subject,a=this._contextStack,o=a[a.length-1];switch(e.type){case`[`:this._saveContext(`blank`,this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),r=this._readBlankNodeHead;break;case`(`:this._saveContext(`list`,this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case`)`:if(this._restoreContext(`list`,e),a.length!==0&&a[a.length-1].type===`list`&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;n=this.RDF_NIL;break;case`literal`:e.prefix.length===0?(this._literalValue=e.value,r=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.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`,e);default:if((t=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),i===null?o.predicate===null?o.subject=n:o.object=n:this._emit(i,this.RDF_REST,n,this._graph),t!==null){if(this._n3Mode&&(e.type===`IRI`||e.type===`prefixed`))return this._saveContext(`item`,this._graph,n,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,t,this._graph)}return r}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._factory.literal(this._literalValue);switch(e.type){case`type`:case`typeIRI`:let n=this._readEntity(e);if(n===void 0)return;t=this._factory.literal(this._literalValue,n),e=null;break;case`langcode`:t=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){let n=this._completeLiteral(e);if(n)return this._object=n.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),n.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}_readFormulaTail(e){return e.type===`}`?(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext(`formula`,e),this._object===null?this._readPredicate:this._getContextEndReader()):this._readPunctuation(e)}_readPunctuation(e){let t,n=this._graph,r=this._subject,i=this._inversePredicate;switch(e.type){case`}`:if(this._graph===null)return this._error(`Unexpected graph closing`,e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case`.`:this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case`;`:t=this._readPredicate;break;case`,`:t=this._readObject;break;case`{|`:if(!this._supportsRDFStar)return this._error(`Unexpected RDF-star syntax`,e);let a=this._predicate,o=this._object;this._subject=this._factory.quad(r,a,o,this.DEFAULTGRAPH),t=this._readPredicate;break;case`|}`:if(this._subject.termType!==`Quad`)return this._error(`Unexpected asserted triple closing`,e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(n=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(r!==null){let e=this._predicate,t=this._object;i?this._emit(t,e,r,n):this._emit(r,e,t,n)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case`;`:t=this._readPredicate;break;case`,`:t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return e.type===`.`?this._readInTopContext:this._error(`Expected dot to follow quad`,e)}_readPrefix(e){return e.type===`prefix`?(this._prefix=e.value,this._readPrefixIRI):this._error(`Expected prefix to follow @prefix`,e)}_readPrefixIRI(e){if(e.type!==`IRI`)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){let t=e.type===`IRI`&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error(`Expected valid IRI to follow base declaration`,e)}_readNamedGraphLabel(e){switch(e.type){case`IRI`:case`blank`:case`prefixed`:return this._readSubject(e),this._readGraph;case`[`:return this._readNamedGraphBlankLabel;default:return this._error(`Invalid graph label`,e)}}_readNamedGraphBlankLabel(e){return e.type===`]`?(this._subject=this._factory.blankNode(),this._readGraph):this._error(`Invalid graph label`,e)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type===`.`?this._readInTopContext:this._error(`Expected declaration to end with a dot`,e)}_readQuantifierList(e){let t;switch(e.type){case`IRI`:case`prefixed`:if((t=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?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,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===`,`?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case`!`:return this._readForwardPath;case`^`:return this._readBackwardPath;default:let t=this._contextStack,n=t.length&&t[t.length-1];if(n&&n.type===`item`){let t=this._subject;this._restoreContext(`item`,e),this._emit(this._subject,this.RDF_FIRST,t,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n,r=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=r):(t=this._object,this._object=r),this._emit(t,n,r,this._graph),this._readPath}_readBackwardPath(e){let t=this._factory.blankNode(),n,r;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=t):(r=this._object,this._object=t),this._emit(t,n,r,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type===`>>`?this._readRDFStarTail(e):this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e)}_readRDFStarTail(e){if(e.type!==`>>`)return this._error(`Expected >> but got ${e.type}`,e);let t=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext(`<<`,e),this._subject===null?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case`blank`:return this._readBlankNodeTail;case`list`:return this._readListItem;case`formula`:return this._readFormulaTail;case`<<`:return this._readRDFStarTailOrGraph}}_emit(e,t,n,r){this._callback(null,this._factory.quad(e,t,n,r||this.DEFAULTGRAPH))}_error(e,t){let n=Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=se}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case`#`:return this._base+e;case`?`:return this._base.replace(/(?:\?.*)?$/,e);case`/`:return(e[1]===`/`?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let t=e.length,n=``,r=-1,i=-1,a=0,o=`/`;for(;r<t;){switch(o){case`:`:if(i<0&&e[++r]===`/`&&e[++r]===`/`)for(;(i=r+1)<t&&e[i]!==`/`;)r=i;break;case`?`:case`#`:r=t;break;case`/`:if(e[r+1]===`.`)switch(o=e[++r+1],o){case`/`:n+=e.substring(a,r-1),a=r+1;break;case void 0:case`?`:case`#`:return n+e.substring(a,r)+e.substr(r+1);case`.`:if(o=e[++r+1],o===void 0||o===`/`||o===`?`||o===`#`){if(n+=e.substring(a,r-2),(a=n.lastIndexOf(`/`))>=i&&(n=n.substr(0,a)),o!==`/`)return`${n}/${e.substr(r+1)}`;a=r+1}}}o=e[++r]}return n+e.substring(a)}parse(e,t,n){let r,i,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(r=t.onQuad,i=t.onPrefix,a=t.onComment):(r=t,i=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${ae++}_`,this._prefixCallback=i||se,this._inversePredicate=!1,this._quantified=Object.create(null),!r){let t=[],n;if(this._callback=(e,r)=>{e?n=e:r&&t.push(r)},this._lexer.tokenize(e).every(e=>this._readCallback=this._readCallback(e)),n)throw n;return t}let o=(e,t)=>{e===null?this._readCallback&&=this._readCallback(t):(this._callback(e),this._callback=se)};a&&(this._lexer.comments=!0,o=(e,t)=>{e===null?this._readCallback&&(t.type===`comment`?a(t.value):this._readCallback=this._readCallback(t)):(this._callback(e),this._callback=se)}),this._callback=r,this._lexer.tokenize(e,o)}};function se(){}function ce(e,t){e._factory=t,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=t.namedNode(g.rdf.first),e.RDF_REST=t.namedNode(g.rdf.rest),e.RDF_NIL=t.namedNode(g.rdf.nil),e.N3_FORALL=t.namedNode(g.r.forAll),e.N3_FORSOME=t.namedNode(g.r.forSome),e.ABBREVIATIONS={a:t.namedNode(g.rdf.type),"=":t.namedNode(g.owl.sameAs),">":t.namedNode(g.log.implies),"<":t.namedNode(g.log.isImpliedBy)},e.QUANTIFIERS_GRAPH=t.namedNode(`urn:n3:quantifiers`)}ce(oe.prototype,k);function le(e){return!!e&&e.termType===`DefaultGraph`}function ue(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,`\\$&`)}var de=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,fe=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,pe=`./`,me=`../`,he=`?`,ge=`#`,_e=class e{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=Array(e.length+1)}static supports(e){return!de.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!e.supports(this.base))return this._baseMatcher=/.^/;let t=/^[^:]*:\/*/.exec(this.base)[0],n=[`^`,ue(t)],r=[],i=[],a=/[^/?#]*([/?#])/y,o,s=0,c=0,l=a.lastIndex=t.length;for(;!s&&!c&&(o=a.exec(this.base));)o[1]===ge?c=a.lastIndex-1:(n.push(ue(o[0]),`(?:`),r.push(`)?`),o[1]===he?(s=l=a.lastIndex,c=this.base.indexOf(ge,s),this._pathReplacements[s]=he):i.push(l=a.lastIndex));for(let e=0;e<i.length;e++)this._pathReplacements[i[e]]=me.repeat(i.length-e-1);return this._pathReplacements[i[i.length-1]]=pe,this._baseLength=c>0?c:this.base.length,n.push(ue(this.base.substring(l,this._baseLength)),s?`(?:#|$)`:`(?:[?#]|$)`),this._baseMatcher=new RegExp([...n,...r].join(``))}toRelative(e){let t=this._getBaseMatcher().exec(e);if(!t)return e;let n=t[0].length;if(n===this._baseLength&&n===e.length)return``;let r=this._pathReplacements[n];if(r){let t=e.substring(n);return r!==he&&!fe.test(t)?e:r===pe&&/^[^?#]/.test(t)?t:r+t}return e.substring(n-1)}},ve=k.defaultGraph(),{rdf:ye,xsd:H}=g,be=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,xe=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Se={"\\":`\\\\`,'"':`\\"`," ":`\\t`,"\n":`\\n`,"\r":`\\r`,"\b":`\\b`,"\f":`\\f`},Ce=class extends A{equals(e){return e===this}},we=class{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!=`function`&&(t=e,e=null),t||={},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let e=``;this._outputStream={write(t,n,r){e+=t,r&&r()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=ve,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new _e(t.baseIRI)))}get _inDefaultGraph(){return ve.equals(this._graph)}_write(e,t){this._outputStream.write(e,`utf8`,t)}_writeQuad(e,t,n,r,i){try{r.equals(this._graph)||(this._write((this._subject===null?``:this._inDefaultGraph?`.
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),u=o((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),d=o((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),f=o((e=>{var t=u(),n=d(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=b,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,`parent`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,`offset`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return p(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return m(e,t);if(ArrayBuffer.isView(e))return g(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(ye(e,ArrayBuffer)||e&&ye(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(ye(e,SharedArrayBuffer)||e&&ye(e.buffer,SharedArrayBuffer)))return _(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);let i=v(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function f(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return f(e,t,n)};function p(e){return l(e),o(e<0?0:y(e)|0)}s.allocUnsafe=function(e){return p(e)},s.allocUnsafeSlow=function(e){return p(e)};function m(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=x(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function h(e){let t=e.length<0?0:y(e.length)|0,n=o(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function g(e){if(ye(e,Uint8Array)){let t=new Uint8Array(e);return _(t.buffer,t.byteOffset,t.byteLength)}return h(e)}function _(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,s.prototype),r}function v(e){if(s.isBuffer(e)){let t=y(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||H(e.length)?o(0):h(e);if(e.type===`Buffer`&&Array.isArray(e.data))return h(e.data)}function y(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function b(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(ye(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),ye(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},s.isEncoding=function(e){switch(String(e).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}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(ye(t,Uint8Array))i+t.length>r.length?(s.isBuffer(t)||(t=s.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(s.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function x(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ye(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return me(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return _e(e).length;default:if(i)return r?-1:me(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=x;function S(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return R(this,t,n);case`utf8`:case`utf-8`:return M(this,t,n);case`ascii`:return F(this,t,n);case`latin1`:case`binary`:return I(this,t,n);case`base64`:return j(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return z(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function C(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)C(this,t,t+1);return this},s.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)C(this,t,t+3),C(this,t+1,t+2);return this},s.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)C(this,t,t+7),C(this,t+1,t+6),C(this,t+2,t+5),C(this,t+3,t+4);return this},s.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?M(this,0,e):S.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(ye(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],o=u[e];break}return a<o?-1:+(o<a)};function w(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,H(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:T(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function T(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return w(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return w(this,e,t,n,!1)};function E(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(H(r))return o;e[n+o]=r}return o}function D(e,t,n,r){return ve(me(t,e.length-n),e,n,r)}function O(e,t,n,r){return ve(he(t),e,n,r)}function k(e,t,n,r){return ve(_e(t),e,n,r)}function A(e,t,n,r){return ve(ge(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return E(this,e,t,n);case`utf8`:case`utf-8`:return D(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return O(this,e,t,n);case`base64`:return k(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return A(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function j(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function M(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return P(r)}var N=4096;function P(e){let t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}function F(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function I(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function R(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=be[e[r]];return i}function z(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}s.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function B(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readBigUInt64LE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),s.prototype.readBigUInt64BE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||B(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readBigInt64LE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),s.prototype.readBigInt64BE=xe(function(e){e>>>=0,ue(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&de(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),s.prototype.readFloatLE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),n.read(this,e,!1,52,8)};function V(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;V(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ee(e,t,n,r,i){le(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function te(e,t,n,r,i){le(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}s.prototype.writeBigUInt64LE=xe(function(e,t=0){return ee(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeBigUInt64BE=xe(function(e,t=0){return te(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);V(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||V(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeBigInt64LE=xe(function(e,t=0){return ee(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),s.prototype.writeBigInt64BE=xe(function(e,t=0){return te(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function ne(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function re(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return re(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return re(this,e,t,!1,n)};function ie(e,t,r,i,a){return t=+t,r>>>=0,a||ne(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return ie(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return ie(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=s.isBuffer(e)?e:s.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};var ae={};function oe(e,t,n){ae[e]=class extends n{constructor(){super(),Object.defineProperty(this,`message`,{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,`code`,{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}oe(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),oe(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),oe(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=se(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=se(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function se(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ce(e,t,n){ue(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&de(t,e.length-(n+1))}function le(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new ae.ERR_OUT_OF_RANGE(`value`,i,e)}ce(r,i,a)}function ue(e,t){if(typeof e!=`number`)throw new ae.ERR_INVALID_ARG_TYPE(t,`number`,e)}function de(e,t,n){throw Math.floor(e)===e?t<0?new ae.ERR_BUFFER_OUT_OF_BOUNDS:new ae.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(ue(e,n),new ae.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}var fe=/[^+/0-9A-Za-z-_]/g;function pe(e){if(e=e.split(`=`)[0],e=e.trim().replace(fe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function me(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function he(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ge(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function _e(e){return t.toByteArray(pe(e))}function ve(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ye(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function H(e){return e!==e}var be=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function xe(e){return typeof BigInt>`u`?Se:e}function Se(){throw Error(`BigInt not supported`)}})),p=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,m=`http://www.w3.org/2001/XMLSchema#`,h=`http://www.w3.org/2000/10/swap/`,g={xsd:{decimal:`${m}decimal`,boolean:`${m}boolean`,double:`${m}double`,integer:`${m}integer`,string:`${m}string`},rdf:{type:`${p}type`,nil:`${p}nil`,first:`${p}first`,rest:`${p}rest`,langString:`${p}langString`},owl:{sameAs:`http://www.w3.org/2002/07/owl#sameAs`},r:{forSome:`${h}reify#forSome`,forAll:`${h}reify#forAll`},log:{implies:`${h}log#implies`,isImpliedBy:`${h}log#isImpliedBy`}},_=f(),{xsd:v}=g,y=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,b={"\\":`\\`,"'":`'`,'"':`"`,n:`
|
|
2
|
+
`,r:`\r`,t:` `,f:`\f`,b:`\b`,_:`_`,"~":`~`,".":`.`,"-":`-`,"!":`!`,$:`$`,"&":`&`,"(":`(`,")":`)`,"*":`*`,"+":`+`,",":`,`,";":`;`,"=":`=`,"/":`/`,"?":`?`,"#":`#`,"@":`@`,"%":`%`},x=/[\x00-\x20<>\\"\{\}\|\^\`]/,S={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},C=/$0^/,w=class{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e||={},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let e in this)!(e in S)&&this[e]instanceof RegExp&&(this[e]=C)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,r=n.length;for(;;){let e,o;for(;e=this._newline.exec(n);)this.comments&&(o=this._comment.exec(e[0]))&&i(`comment`,o[1],``,this._line,e[0].length),n=n.substr(e[0].length,n.length),r=n.length,this._line++;if(!e&&(e=this._whitespace.exec(n))&&(n=n.substr(e[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(o=this._comment.exec(n))&&i(`comment`,o[1],``,this._line,n.length),n=null,i(`eof`,``,``,this._line,0)),this._input=n;let s=this._line,c=n[0],l=``,u=``,d=``,f=null,p=0,m=!1;switch(c){case`^`:if(n.length<3)break;if(n[1]===`^`){if(this._previousMarker=`^^`,n=n.substr(2),n[0]!==`<`){m=!0;break}}else{this._n3Mode&&(p=1,l=`^`);break}case`<`:if(f=this._unescapedIri.exec(n))l=`IRI`,u=f[1];else if(f=this._iri.exec(n)){if(u=this._unescape(f[1]),u===null||x.test(u))return a(this);l=`IRI`}else n.length>1&&n[1]===`<`?(l=`<<`,p=2):this._n3Mode&&n.length>1&&n[1]===`=`&&(p=2,this._isImpliedBy?(l=`abbreviation`,u=`<`):(l=`inverse`,u=`>`));break;case`>`:n.length>1&&n[1]===`>`&&(l=`>>`,p=2);break;case`_`:((f=this._blank.exec(n))||t&&(f=this._blank.exec(`${n} `)))&&(l=`blank`,d=`_`,u=f[1]);break;case`"`:if(f=this._simpleQuotedString.exec(n))u=f[1];else if({value:u,matchLength:p}=this._parseLiteral(n),u===null)return a(this);(f!==null||p!==0)&&(l=`literal`,this._literalClosingPos=0);break;case`'`:if(!this._lineMode){if(f=this._simpleApostropheString.exec(n))u=f[1];else if({value:u,matchLength:p}=this._parseLiteral(n),u===null)return a(this);(f!==null||p!==0)&&(l=`literal`,this._literalClosingPos=0)}break;case`?`:this._n3Mode&&(f=this._variable.exec(n))&&(l=`var`,u=f[0]);break;case`@`:this._previousMarker===`literal`&&(f=this._langcode.exec(n))?(l=`langcode`,u=f[1]):(f=this._keyword.exec(n))&&(l=f[0]);break;case`.`:if(n.length===1?t:n[1]<`0`||n[1]>`9`){l=`.`,p=1;break}case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:case`+`:case`-`:(f=this._number.exec(n)||t&&(f=this._number.exec(`${n} `)))&&(l=`literal`,u=f[0],d=typeof f[1]==`string`?v.double:typeof f[2]==`string`?v.decimal:v.integer);break;case`B`:case`b`:case`p`:case`P`:case`G`:case`g`:(f=this._sparqlKeyword.exec(n))?l=f[0].toUpperCase():m=!0;break;case`f`:case`t`:(f=this._boolean.exec(n))?(l=`literal`,u=f[0],d=v.boolean):m=!0;break;case`a`:(f=this._shortPredicates.exec(n))?(l=`abbreviation`,u=`a`):m=!0;break;case`=`:this._n3Mode&&n.length>1&&(l=`abbreviation`,n[1]===`>`?(p=2,u=`>`):(p=1,u=`=`));break;case`!`:if(!this._n3Mode)break;case`,`:case`;`:case`[`:case`]`:case`(`:case`)`:case`}`:this._lineMode||(p=1,l=c);break;case`{`:!this._lineMode&&n.length>=2&&(n[1]===`|`?(l=`{|`,p=2):(l=c,p=1));break;case`|`:n.length>=2&&n[1]===`}`&&(l=`|}`,p=2);break;default:m=!0}if(m&&((this._previousMarker===`@prefix`||this._previousMarker===`PREFIX`)&&(f=this._prefix.exec(n))?(l=`prefix`,u=f[1]||``):((f=this._prefixed.exec(n))||t&&(f=this._prefixed.exec(`${n} `)))&&(l=`prefixed`,d=f[1]||``,u=this._unescape(f[2]))),this._previousMarker===`^^`)switch(l){case`prefixed`:l=`type`;break;case`IRI`:l=`typeIRI`;break;default:l=``}if(!l)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;let h=p||f[0].length,g=i(l,u,d,s,h);this.previousToken=g,this._previousMarker=l,n=n.substr(h,n.length)}function i(t,i,a,o,s){let c=n?r-n.length:r,l={type:t,value:i,prefix:a,line:o,start:c,end:c+s};return e(null,l),l}function a(t){e(t._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1,n=e.replace(y,(e,n,r,i)=>{if(typeof n==`string`)return String.fromCharCode(Number.parseInt(n,16));if(typeof r==`string`){let e=Number.parseInt(r,16);return e<=65535?String.fromCharCode(Number.parseInt(r,16)):String.fromCharCode(55296+((e-=65536)>>10),56320+(e&1023))}return i in b?b[i]:(t=!0,``)});return t?null:n}_parseLiteral(e){if(e.length>=3){let t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length,r=Math.max(this._literalClosingPos,n);for(;(r=e.indexOf(t,r))>0;){let t=0;for(;e[r-t-1]===`\\`;)t++;if(t%2==0){let t=e.substring(n,r),i=t.split(/\r\n|\r|\n/).length-1,a=r+n;if(n===1&&i!==0||n===3&&this._lineMode)break;return this._line+=i,{value:this._unescape(t),matchLength:a}}r++}this._literalClosingPos=e.length-n+1}return{value:``,matchLength:0}}_syntaxError(e){this._input=null;let t=Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith(``)?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e==`string`)if(this._input=this._readStartingBom(e),typeof t==`function`)queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{let e=[],t;if(this._tokenizeToEnd((n,r)=>n?t=n:e.push(r),!0),t)throw t;return e}else this._pendingBuffer=null,typeof e.setEncoding==`function`&&e.setEncoding(`utf8`),e.on(`data`,e=>{this._input!==null&&e.length!==0&&(this._pendingBuffer&&=(e=_.Buffer.concat([this._pendingBuffer,e]),null),e[e.length-1]&128?this._pendingBuffer=e:(this._input===void 0?this._input=this._readStartingBom(typeof e==`string`?e:e.toString()):this._input+=e,this._tokenizeToEnd(t,!1)))}),e.on(`end`,()=>{typeof this._input==`string`&&this._tokenizeToEnd(t,!0)}),e.on(`error`,t)}},{rdf:T,xsd:E}=g,D,O=0,k={namedNode:z,blankNode:B,variable:ee,literal:V,defaultGraph:te,quad:ne,triple:ne,fromTerm:re,fromQuad:ie},A=class e{constructor(e){this.id=e}get value(){return this.id}equals(t){return t instanceof e?this.id===t.id:!!t&&this.termType===t.termType&&this.value===t.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},j=class extends A{get termType(){return`NamedNode`}},M=class e extends A{get termType(){return`Literal`}get value(){return this.id.substring(1,this.id.lastIndexOf(`"`))}get language(){let e=this.id,t=e.lastIndexOf(`"`)+1;return t<e.length&&e[t++]===`@`?e.substr(t).toLowerCase():``}get datatype(){return new j(this.datatypeString)}get datatypeString(){let e=this.id,t=e.lastIndexOf(`"`)+1,n=t<e.length?e[t]:``;return n===`^`?e.substr(t+2):n===`@`?T.langString:E.string}equals(t){return t instanceof e?this.id===t.id:!!t&&!!t.datatype&&this.termType===t.termType&&this.value===t.value&&this.language===t.language&&this.datatype.value===t.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:`NamedNode`,value:this.datatypeString}}}},N=class extends A{constructor(e){super(`_:${e}`)}get termType(){return`BlankNode`}get value(){return this.id.substr(2)}},P=class extends A{constructor(e){super(`?${e}`)}get termType(){return`Variable`}get value(){return this.id.substr(1)}};D=new class extends A{constructor(){return super(``),D||this}get termType(){return`DefaultGraph`}equals(e){return this===e||!!e&&this.termType===e.termType}};function F(e,t,n){if(t||=k,!e)return t.defaultGraph();switch(e[0]){case`?`:return t.variable(e.substr(1));case`_`:return t.blankNode(e.substr(2));case`"`:if(t===k)return new M(e);if(e[e.length-1]===`"`)return t.literal(e.substr(1,e.length-2));let r=e.lastIndexOf(`"`,e.length-1);return t.literal(e.substr(1,r-1),e[r+1]===`@`?e.substr(r+2):t.namedNode(e.substr(r+3)));case`[`:e=JSON.parse(e);break;default:if(!n||!Array.isArray(e))return t.namedNode(e)}return t.quad(F(e[0],t,!0),F(e[1],t,!0),F(e[2],t,!0),e[3]&&F(e[3],t,!0))}function I(e,t){if(typeof e==`string`)return e;if(e instanceof A&&e.termType!==`Quad`)return e.id;if(!e)return D.id;switch(e.termType){case`NamedNode`:return e.value;case`BlankNode`:return`_:${e.value}`;case`Variable`:return`?${e.value}`;case`DefaultGraph`:return``;case`Literal`:return`"${e.value}"${e.language?`@${e.language}`:e.datatype&&e.datatype.value!==E.string?`^^${e.datatype.value}`:``}`;case`Quad`:let n=[I(e.subject,!0),I(e.predicate,!0),I(e.object,!0)];return e.graph&&e.graph.termType!==`DefaultGraph`&&n.push(I(e.graph,!0)),t?n:JSON.stringify(n);default:throw Error(`Unexpected termType: ${e.termType}`)}}var R=class extends A{constructor(e,t,n,r){super(``),this._subject=e,this._predicate=t,this._object=n,this._graph=r||D}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(e){return!!e&&this._subject.equals(e.subject)&&this._predicate.equals(e.predicate)&&this._object.equals(e.object)&&this._graph.equals(e.graph)}};function z(e){return new j(e)}function B(e){return new N(e||`n3-${O++}`)}function V(e,t){if(typeof t==`string`)return new M(`"${e}"@${t.toLowerCase()}`);let n=t?t.value:``;return n===``&&(typeof e==`boolean`?n=E.boolean:typeof e==`number`&&(Number.isFinite(e)?n=Number.isInteger(e)?E.integer:E.double:(n=E.double,Number.isNaN(e)||(e=e>0?`INF`:`-INF`)))),n===``||n===E.string?new M(`"${e}"`):new M(`"${e}"^^${n}`)}function ee(e){return new P(e)}function te(){return D}function ne(e,t,n,r){return new R(e,t,n,r)}function re(e){if(e instanceof A)return e;switch(e.termType){case`NamedNode`:return z(e.value);case`BlankNode`:return B(e.value);case`Variable`:return ee(e.value);case`DefaultGraph`:return D;case`Literal`:return V(e.value,e.language||e.datatype);case`Quad`:return ie(e);default:throw Error(`Unexpected termType: ${e.termType}`)}}function ie(e){if(e instanceof R)return e;if(e.termType!==`Quad`)throw Error(`Unexpected termType: ${e.termType}`);return ne(re(e.subject),re(e.predicate),re(e.object),re(e.graph))}var ae=0,oe=class{constructor(e){this._contextStack=[],this._graph=null,e||={},this._setBase(e.baseIRI),e.factory&&ce(this,e.factory);let t=typeof e.format==`string`?e.format.match(/\w*$/)[0].toLowerCase():``,n=/turtle/.test(t),r=/trig/.test(t),i=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),s=i||a;(this._supportsNamedGraphs=!(n||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||r||i||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===``||/star|\*$/.test(t),s&&(this._resolveRelativeIRI=e=>null),this._blankNodePrefix=typeof e.blankNodePrefix==`string`?e.blankNodePrefix.replace(/^(?!_:)/,`_:`):``,this._lexer=e.lexer||new w({lineMode:s,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){ae=0}_setBase(e){if(!e)this._base=``,this._basePath=``;else{let t=e.indexOf(`#`);t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf(`/`)<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,``),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,t,n,r,i){let a=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:r,object:i,graph:t,inverse:a?this._inversePredicate:!1,blankPrefix:a?this._prefixes._:``,quantified:a?this._quantified:null}),a&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:`.`,this._quantified=Object.create(this._quantified))}_restoreContext(e,t){let n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readInTopContext(e){switch(e.type){case`eof`:return this._graph===null?(delete this._prefixes._,this._callback(null,null,this._prefixes)):this._error(`Unclosed graph`,e);case`PREFIX`:this._sparqlStyle=!0;case`@prefix`:return this._readPrefix;case`BASE`:this._sparqlStyle=!0;case`@base`:return this._readBaseIRI;case`{`:if(this._supportsNamedGraphs)return this._graph=``,this._subject=null,this._readSubject;case`GRAPH`:if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let n;switch(e.type){case`IRI`:case`typeIRI`:let t=this._resolveIRI(e.value);if(t===null)return this._error(`Invalid IRI`,e);n=this._factory.namedNode(t);break;case`type`:case`prefixed`:let r=this._prefixes[e.prefix];if(r===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(r+e.value);break;case`blank`:n=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case`var`:n=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(e){switch(this._predicate=null,e.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`,e);case`}`:return this._readPunctuation(e);case`@forSome`:return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier=`blankNode`,this._readQuantifierList):this._error(`Unexpected "@forSome"`,e);case`@forAll`:return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier=`variable`,this._readQuantifierList):this._error(`Unexpected "@forAll"`,e);case`literal`:if(!this._n3Mode)return this._error(`Unexpected literal`,e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case`<<`:return this._supportsRDFStar?(this._saveContext(`<<`,this._graph,null,null,null),this._graph=null,this._readSubject):this._error(`Unexpected RDF-star syntax`,e);default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let t=e.type;switch(t){case`inverse`:this._inversePredicate=!0;case`abbreviation`:this._predicate=this.ABBREVIATIONS[e.value];break;case`.`:case`]`:case`}`:return this._predicate===null?this._error(`Unexpected ${t}`,e):(this._subject=null,t===`]`?this._readBlankNodeTail(e):this._readPunctuation(e));case`;`:return this._predicate===null?this._error(`Expected predicate but got ;`,e):this._readPredicate;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`,e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case`literal`:if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.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`,e);case`<<`:return this._supportsRDFStar?(this._saveContext(`<<`,this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error(`Unexpected RDF-star syntax`,e);default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type===`{`?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type===`{`?(this._graph=this._subject,this._subject=null,this._readSubject):this._error(`Expected graph but got ${e.type}`,e)}_readBlankNodeHead(e){return e.type===`]`?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!==`]`)return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let t=this._predicate===null;return this._restoreContext(`blank`,e),this._object===null?this._predicate===null?t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank:this._readObject:this._getContextEndReader()}_readPredicateAfterBlank(e){switch(e.type){case`.`:case`}`:return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,n=null,r=this._readListItem,i=this._subject,a=this._contextStack,o=a[a.length-1];switch(e.type){case`[`:this._saveContext(`blank`,this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),r=this._readBlankNodeHead;break;case`(`:this._saveContext(`list`,this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case`)`:if(this._restoreContext(`list`,e),a.length!==0&&a[a.length-1].type===`list`&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(r=this._readPredicate,this._subject===this.RDF_NIL)return r}else if(r=this._getContextEndReader(),this._object===this.RDF_NIL)return r;n=this.RDF_NIL;break;case`literal`:e.prefix.length===0?(this._literalValue=e.value,r=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.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`,e);default:if((t=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),i===null?o.predicate===null?o.subject=n:o.object=n:this._emit(i,this.RDF_REST,n,this._graph),t!==null){if(this._n3Mode&&(e.type===`IRI`||e.type===`prefixed`))return this._saveContext(`item`,this._graph,n,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,t,this._graph)}return r}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._factory.literal(this._literalValue);switch(e.type){case`type`:case`typeIRI`:let n=this._readEntity(e);if(n===void 0)return;t=this._factory.literal(this._literalValue,n),e=null;break;case`langcode`:t=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){let n=this._completeLiteral(e);if(n)return this._object=n.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),n.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}_readFormulaTail(e){return e.type===`}`?(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext(`formula`,e),this._object===null?this._readPredicate:this._getContextEndReader()):this._readPunctuation(e)}_readPunctuation(e){let t,n=this._graph,r=this._subject,i=this._inversePredicate;switch(e.type){case`}`:if(this._graph===null)return this._error(`Unexpected graph closing`,e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case`.`:this._subject=null,t=this._contextStack.length?this._readSubject:this._readInTopContext,i&&(this._inversePredicate=!1);break;case`;`:t=this._readPredicate;break;case`,`:t=this._readObject;break;case`{|`:if(!this._supportsRDFStar)return this._error(`Unexpected RDF-star syntax`,e);let a=this._predicate,o=this._object;this._subject=this._factory.quad(r,a,o,this.DEFAULTGRAPH),t=this._readPredicate;break;case`|}`:if(this._subject.termType!==`Quad`)return this._error(`Unexpected asserted triple closing`,e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(n=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(r!==null){let e=this._predicate,t=this._object;i?this._emit(t,e,r,n):this._emit(r,e,t,n)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case`;`:t=this._readPredicate;break;case`,`:t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return e.type===`.`?this._readInTopContext:this._error(`Expected dot to follow quad`,e)}_readPrefix(e){return e.type===`prefix`?(this._prefix=e.value,this._readPrefixIRI):this._error(`Expected prefix to follow @prefix`,e)}_readPrefixIRI(e){if(e.type!==`IRI`)return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){let t=e.type===`IRI`&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error(`Expected valid IRI to follow base declaration`,e)}_readNamedGraphLabel(e){switch(e.type){case`IRI`:case`blank`:case`prefixed`:return this._readSubject(e),this._readGraph;case`[`:return this._readNamedGraphBlankLabel;default:return this._error(`Invalid graph label`,e)}}_readNamedGraphBlankLabel(e){return e.type===`]`?(this._subject=this._factory.blankNode(),this._readGraph):this._error(`Invalid graph label`,e)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type===`.`?this._readInTopContext:this._error(`Expected declaration to end with a dot`,e)}_readQuantifierList(e){let t;switch(e.type){case`IRI`:case`prefixed`:if((t=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?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,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===`,`?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case`!`:return this._readForwardPath;case`^`:return this._readBackwardPath;default:let t=this._contextStack,n=t.length&&t[t.length-1];if(n&&n.type===`item`){let t=this._subject;this._restoreContext(`item`,e),this._emit(this._subject,this.RDF_FIRST,t,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n,r=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=r):(t=this._object,this._object=r),this._emit(t,n,r,this._graph),this._readPath}_readBackwardPath(e){let t=this._factory.blankNode(),n,r;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=t):(r=this._object,this._object=t),this._emit(t,n,r,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type===`>>`?this._readRDFStarTail(e):this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e)}_readRDFStarTail(e){if(e.type!==`>>`)return this._error(`Expected >> but got ${e.type}`,e);let t=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext(`<<`,e),this._subject===null?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case`blank`:return this._readBlankNodeTail;case`list`:return this._readListItem;case`formula`:return this._readFormulaTail;case`<<`:return this._readRDFStarTailOrGraph}}_emit(e,t,n,r){this._callback(null,this._factory.quad(e,t,n,r||this.DEFAULTGRAPH))}_error(e,t){let n=Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=se}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case`#`:return this._base+e;case`?`:return this._base.replace(/(?:\?.*)?$/,e);case`/`:return(e[1]===`/`?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let t=e.length,n=``,r=-1,i=-1,a=0,o=`/`;for(;r<t;){switch(o){case`:`:if(i<0&&e[++r]===`/`&&e[++r]===`/`)for(;(i=r+1)<t&&e[i]!==`/`;)r=i;break;case`?`:case`#`:r=t;break;case`/`:if(e[r+1]===`.`)switch(o=e[++r+1],o){case`/`:n+=e.substring(a,r-1),a=r+1;break;case void 0:case`?`:case`#`:return n+e.substring(a,r)+e.substr(r+1);case`.`:if(o=e[++r+1],o===void 0||o===`/`||o===`?`||o===`#`){if(n+=e.substring(a,r-2),(a=n.lastIndexOf(`/`))>=i&&(n=n.substr(0,a)),o!==`/`)return`${n}/${e.substr(r+1)}`;a=r+1}}}o=e[++r]}return n+e.substring(a)}parse(e,t,n){let r,i,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(r=t.onQuad,i=t.onPrefix,a=t.onComment):(r=t,i=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${ae++}_`,this._prefixCallback=i||se,this._inversePredicate=!1,this._quantified=Object.create(null),!r){let t=[],n;if(this._callback=(e,r)=>{e?n=e:r&&t.push(r)},this._lexer.tokenize(e).every(e=>this._readCallback=this._readCallback(e)),n)throw n;return t}let o=(e,t)=>{e===null?this._readCallback&&=this._readCallback(t):(this._callback(e),this._callback=se)};a&&(this._lexer.comments=!0,o=(e,t)=>{e===null?this._readCallback&&(t.type===`comment`?a(t.value):this._readCallback=this._readCallback(t)):(this._callback(e),this._callback=se)}),this._callback=r,this._lexer.tokenize(e,o)}};function se(){}function ce(e,t){e._factory=t,e.DEFAULTGRAPH=t.defaultGraph(),e.RDF_FIRST=t.namedNode(g.rdf.first),e.RDF_REST=t.namedNode(g.rdf.rest),e.RDF_NIL=t.namedNode(g.rdf.nil),e.N3_FORALL=t.namedNode(g.r.forAll),e.N3_FORSOME=t.namedNode(g.r.forSome),e.ABBREVIATIONS={a:t.namedNode(g.rdf.type),"=":t.namedNode(g.owl.sameAs),">":t.namedNode(g.log.implies),"<":t.namedNode(g.log.isImpliedBy)},e.QUANTIFIERS_GRAPH=t.namedNode(`urn:n3:quantifiers`)}ce(oe.prototype,k);function le(e){return!!e&&e.termType===`DefaultGraph`}function ue(e){return e.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,`\\$&`)}var de=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,fe=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,pe=`./`,me=`../`,he=`?`,ge=`#`,_e=class e{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=Array(e.length+1)}static supports(e){return!de.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!e.supports(this.base))return this._baseMatcher=/.^/;let t=/^[^:]*:\/*/.exec(this.base)[0],n=[`^`,ue(t)],r=[],i=[],a=/[^/?#]*([/?#])/y,o,s=0,c=0,l=a.lastIndex=t.length;for(;!s&&!c&&(o=a.exec(this.base));)o[1]===ge?c=a.lastIndex-1:(n.push(ue(o[0]),`(?:`),r.push(`)?`),o[1]===he?(s=l=a.lastIndex,c=this.base.indexOf(ge,s),this._pathReplacements[s]=he):i.push(l=a.lastIndex));for(let e=0;e<i.length;e++)this._pathReplacements[i[e]]=me.repeat(i.length-e-1);return this._pathReplacements[i[i.length-1]]=pe,this._baseLength=c>0?c:this.base.length,n.push(ue(this.base.substring(l,this._baseLength)),s?`(?:#|$)`:`(?:[?#]|$)`),this._baseMatcher=new RegExp([...n,...r].join(``))}toRelative(e){let t=this._getBaseMatcher().exec(e);if(!t)return e;let n=t[0].length;if(n===this._baseLength&&n===e.length)return``;let r=this._pathReplacements[n];if(r){let t=e.substring(n);return r!==he&&!fe.test(t)?e:r===pe&&/^[^?#]/.test(t)?t:r+t}return e.substring(n-1)}},ve=k.defaultGraph(),{rdf:ye,xsd:H}=g,be=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,xe=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Se={"\\":`\\\\`,'"':`\\"`," ":`\\t`,"\n":`\\n`,"\r":`\\r`,"\b":`\\b`,"\f":`\\f`},Ce=class extends A{equals(e){return e===this}},we=class{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!=`function`&&(t=e,e=null),t||={},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let e=``;this._outputStream={write(t,n,r){e+=t,r&&r()},end:t=>{t&&t(null,e)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=ve,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new _e(t.baseIRI)))}get _inDefaultGraph(){return ve.equals(this._graph)}_write(e,t){this._outputStream.write(e,`utf8`,t)}_writeQuad(e,t,n,r,i){try{r.equals(this._graph)||(this._write((this._subject===null?``:this._inDefaultGraph?`.
|
|
3
3
|
`:`
|
|
4
4
|
}
|
|
5
5
|
`)+(ve.equals(r)?``:`${this._encodeIriOrBlank(r)} {\n`)),this._graph=r,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,i):this._write(`;\n ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,i):this._write(`${(this._subject===null?``:`.
|
|
@@ -13,17 +13,17 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
13
13
|
`)+this._encodePredicate(r.predicate)} ${this._encodeObject(r.object)}`,e=r.predicate);return new Ce(`${t}\n]`)}}list(e){let t=e&&e.length||0,n=Array(t);for(let r=0;r<t;r++)n[r]=this._encodeObject(e[r]);return new Ce(`(${n.join(` `)})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
14
14
|
`:`
|
|
15
15
|
}
|
|
16
|
-
`),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,r)=>{t=null,e(n,r)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}};function Te(e){let t=Se[e];return t===void 0&&(e.length===1?(t=e.charCodeAt(0).toString(16),t=`\\u0000`.substr(0,6-t.length)+t):(t=((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)+9216).toString(16),t=`\\U00000000`.substr(0,10-t.length)+t)),t}var Ee=o(((e,t)=>{t.exports={AggregateError:class extends Error{constructor(e){if(!Array.isArray(e))throw TypeError(`Expected input to be an Array, got ${typeof e}`);let t=``;for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name=`AggregateError`,this.errors=e}},ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:2**53-1,NumberMIN_SAFE_INTEGER:-(2**53-1),NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,n){return Object.defineProperty(e,t,n)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,n){return e.then(t,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,n){return e.slice(t,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol(`Symbol.dispose`),SymbolAsyncDispose:Symbol.asyncDispose||Symbol(`Symbol.asyncDispose`),TypedArrayPrototypeSet(e,t,n){return e.set(t,n)},Boolean,Uint8Array}})),De=o(((e,t)=>{t.exports={format(e,...t){return e.replace(/%([sdifj])/g,function(...[e,n]){let r=t.shift();return n===`f`?r.toFixed(6):n===`j`?JSON.stringify(r):n===`s`&&typeof r==`object`?`${r.constructor===Object?``:r.constructor.name} {}`.trim():r.toString()})},inspect(e){switch(typeof e){case`string`:if(e.includes(`'`)){if(!e.includes(`"`))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case`number`:return isNaN(e)?`NaN`:Object.is(e,-0)?String(e):e;case`bigint`:return`${String(e)}n`;case`boolean`:case`undefined`:return String(e);case`object`:return`{}`}}}})),Oe=o(((e,t)=>{var{format:n,inspect:r}=De(),{AggregateError:i}=Ee(),a=globalThis.AggregateError||i,o=Symbol(`kIsNodeError`),s=[`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`],c=/^([A-Z][a-z0-9]*)+$/,l=`__node_internal_`,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function f(e){let t=``,n=e.length,r=e[0]===`-`?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function p(e,t,r){if(typeof t==`function`)return d(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);let i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:n(t,...r)}function m(e,t,n){n||=Error;class r extends n{constructor(...n){super(p(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[o]=!0,u[e]=r}function h(e){let t=l+e.name;return Object.defineProperty(e,`name`,{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let n=new a([t,e],t.message);return n.code=t.code,n}return e||t}var _=class extends Error{constructor(e=`The operation was aborted`,t=void 0){if(t!==void 0&&typeof t!=`object`)throw new u.ERR_INVALID_ARG_TYPE(`options`,`Object`,t);super(e,t),this.code=`ABORT_ERR`,this.name=`AbortError`}};m(`ERR_ASSERTION`,`%s`,Error),m(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{d(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let i=`The `;e.endsWith(` argument`)?i+=`${e} `:i+=`"${e}" ${e.includes(`.`)?`property`:`argument`} `,i+=`must be `;let a=[],o=[],l=[];for(let e of t)d(typeof e==`string`,`All expected entries have to be of type string`),s.includes(e)?a.push(e.toLowerCase()):c.test(e)?o.push(e):(d(e!==`object`,`The value "object" should be written as "Object"`),l.push(e));if(o.length>0){let e=a.indexOf(`object`);e!==-1&&(a.splice(a,e,1),o.push(`Object`))}if(a.length>0){switch(a.length){case 1:i+=`of type ${a[0]}`;break;case 2:i+=`one of type ${a[0]} or ${a[1]}`;break;default:{let e=a.pop();i+=`one of type ${a.join(`, `)}, or ${e}`}}(o.length>0||l.length>0)&&(i+=` or `)}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let e=o.pop();i+=`an instance of ${o.join(`, `)}, or ${e}`}}l.length>0&&(i+=` or `)}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(i+=`an `),i+=`${l[0]}`;break;case 2:i+=`one of ${l[0]} or ${l[1]}`;break;default:{let e=l.pop();i+=`one of ${l.join(`, `)}, or ${e}`}}if(n==null)i+=`. Received ${n}`;else if(typeof n==`function`&&n.name)i+=`. Received function ${n.name}`;else if(typeof n==`object`){var u;if((u=n.constructor)!=null&&u.name)i+=`. Received an instance of ${n.constructor.name}`;else{let e=r(n,{depth:-1});i+=`. Received ${e}`}}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i},TypeError),m(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let i=r(t);return i.length>128&&(i=i.slice(0,128)+`...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${i}`},TypeError),m(`ERR_INVALID_RETURN_VALUE`,(e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${n!=null&&(r=n.constructor)!=null&&r.name?`instance of ${n.constructor.name}`:`type ${typeof n}`}.`},TypeError),m(`ERR_MISSING_ARGS`,(...e)=>{d(e.length>0,`At least one arg needs to be specified`);let t,n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(e=>`"${e}"`).join(` or `),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let n=e.pop();t+=`The ${e.join(`, `)}, and ${n} arguments`}break}return`${t} must be specified`},TypeError),m(`ERR_OUT_OF_RANGE`,(e,t,n)=>{d(t,`Missing "range" argument`);let i;if(Number.isInteger(n)&&Math.abs(n)>2**32)i=f(String(n));else if(typeof n==`bigint`){i=String(n);let e=BigInt(2)**BigInt(32);(n>e||n<-e)&&(i=f(i)),i+=`n`}else i=r(n);return`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError),m(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`,Error),m(`ERR_METHOD_NOT_IMPLEMENTED`,`The %s method is not implemented`,Error),m(`ERR_STREAM_ALREADY_FINISHED`,`Cannot call %s after a stream was finished`,Error),m(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`,Error),m(`ERR_STREAM_DESTROYED`,`Cannot call %s after a stream was destroyed`,Error),m(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),m(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`,Error),m(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`,Error),m(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`,Error),m(`ERR_STREAM_WRITE_AFTER_END`,`write after end`,Error),m(`ERR_UNKNOWN_ENCODING`,`Unknown encoding: %s`,TypeError),t.exports={AbortError:_,aggregateTwoErrors:h(g),hideStackFrames:h,codes:u}})),ke=o(((e,t)=>{var{AbortController:n,AbortSignal:r}=typeof self<`u`?self:typeof window<`u`?window:void 0;t.exports=n,t.exports.AbortSignal=r,t.exports.default=n})),Ae=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),je=o(((e,t)=>{var n=f(),{format:r,inspect:i}=De(),{codes:{ERR_INVALID_ARG_TYPE:a}}=Oe(),{kResistStopPropagation:o,AggregateError:s,SymbolDispose:c}=Ee(),l=globalThis.AbortSignal||ke().AbortSignal,u=globalThis.AbortController||ke().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||n.Blob,m=p===void 0?function(e){return!1}:function(e){return e instanceof p},h=(e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new a(t,`AbortSignal`,e)},g=(e,t)=>{if(typeof e!=`function`)throw new a(t,`Function`,e)};t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},promisify(e){return new Promise((t,n)=>{e((e,...r)=>e?n(e):t(...r))})},debuglog(){return function(){}},format:r,inspect:i,types:{isAsyncFunction(e){return e instanceof d},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:m,deprecate(e,t){return e},addAbortListener:Ae().addAbortListener||function(e,t){if(e===void 0)throw new a(`signal`,`AbortSignal`,e);h(e,`signal`),g(t,`listener`);let n;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener(`abort`,t,{__proto__:null,once:!0,[o]:!0}),n=()=>{e.removeEventListener(`abort`,t)}),{__proto__:null,[c](){var e;(e=n)==null||e()}}},AbortSignalAny:l.any||function(e){if(e.length===1)return e[0];let t=new u,n=()=>t.abort();return e.forEach(e=>{h(e,`signals`),e.addEventListener(`abort`,n,{once:!0})}),t.signal.addEventListener(`abort`,()=>{e.forEach(e=>e.removeEventListener(`abort`,n))},{once:!0}),t.signal}},t.exports.promisify.custom=Symbol.for(`nodejs.util.promisify.custom`)})),Me=o(((e,t)=>{var{ArrayIsArray:n,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:i,ArrayPrototypeMap:a,NumberIsInteger:o,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:l,NumberParseInt:u,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:h}=Ee(),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:y,ERR_OUT_OF_RANGE:b,ERR_UNKNOWN_SIGNAL:x}}=Oe(),{normalizeEncoding:S}=je(),{isAsyncFunction:C,isArrayBufferView:w}=je().types,T={};function E(e){return e===(e|0)}function D(e){return e===e>>>0}var O=/^[0-7]+$/,k=`must be a 32-bit unsigned integer or an octal string`;function A(e,t,n){if(e===void 0&&(e=n),typeof e==`string`){if(f(O,e)===null)throw new y(t,e,k);e=u(e,8)}return N(e,t),e}var j=g((e,t,n=l,r=c)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),M=g((e,t,n=-2147483648,r=2147483647)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),N=g((e,t,n=!1)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);let r=n?1:0,i=4294967295;if(e<r||e>i)throw new b(t,`>= ${r} && <= ${i}`,e)});function P(e,t){if(typeof e!=`string`)throw new v(t,`string`,e)}function F(e,t,n=void 0,r){if(typeof e!=`number`)throw new v(t,`number`,e);if(n!=null&&e<n||r!=null&&e>r||(n!=null||r!=null)&&s(e))throw new b(t,`${n==null?``:`>= ${n}`}${n!=null&&r!=null?` && `:``}${r==null?``:`<= ${r}`}`,e)}var I=g((e,t,n)=>{if(!r(n,e))throw new y(t,e,`must be one of: `+i(a(n,e=>typeof e==`string`?`'${e}'`:p(e)),`, `))});function R(e,t){if(typeof e!=`boolean`)throw new v(t,`boolean`,e)}function z(e,t,n){return e==null||!d(e,t)?n:e[t]}var B=g((e,t,r=null)=>{let i=z(r,`allowArray`,!1),a=z(r,`allowFunction`,!1);if(!z(r,`nullable`,!1)&&e===null||!i&&n(e)||typeof e!=`object`&&(!a||typeof e!=`function`))throw new v(t,`Object`,e)}),V=g((e,t)=>{if(e!=null&&typeof e!=`object`&&typeof e!=`function`)throw new v(t,`a dictionary`,e)}),ee=g((e,t,r=0)=>{if(!n(e))throw new v(t,`Array`,e);if(e.length<r)throw new y(t,e,`must be longer than ${r}`)});function te(e,t){ee(e,t);for(let n=0;n<e.length;n++)P(e[n],`${t}[${n}]`)}function ne(e,t){ee(e,t);for(let n=0;n<e.length;n++)R(e[n],`${t}[${n}]`)}function re(e,t){ee(e,t);for(let n=0;n<e.length;n++){let r=e[n],i=`${t}[${n}]`;if(r==null)throw new v(i,`AbortSignal`,r);ce(r,i)}}function ie(e,t=`signal`){if(P(e,t),T[e]===void 0)throw T[m(e)]===void 0?new x(e):new x(e+` (signals must use all capital letters)`)}var ae=g((e,t=`buffer`)=>{if(!w(e))throw new v(t,[`Buffer`,`TypedArray`,`DataView`],e)});function oe(e,t){let n=S(t),r=e.length;if(n===`hex`&&r%2!=0)throw new y(`encoding`,t,`is invalid for data of length ${r}`)}function se(e,t=`Port`,n=!0){if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&h(e).length===0||+e!=e>>>0||e>65535||e===0&&!n)throw new _(t,e,n);return e|0}var ce=g((e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new v(t,`AbortSignal`,e)}),le=g((e,t)=>{if(typeof e!=`function`)throw new v(t,`Function`,e)}),ue=g((e,t)=>{if(typeof e!=`function`||C(e))throw new v(t,`Function`,e)}),de=g((e,t)=>{if(e!==void 0)throw new v(t,`undefined`,e)});function fe(e,t,n){if(!r(n,e))throw new v(t,`('${i(n,`|`)}')`,e)}var pe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function me(e,t){if(e===void 0||!f(pe,e))throw new y(t,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}function he(e){if(typeof e==`string`)return me(e,`hints`),e;if(n(e)){let t=e.length,n=``;if(t===0)return n;for(let r=0;r<t;r++){let i=e[r];me(i,`hints`),n+=i,r!==t-1&&(n+=`, `)}return n}throw new y(`hints`,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}t.exports={isInt32:E,isUint32:D,parseFileMode:A,validateArray:ee,validateStringArray:te,validateBooleanArray:ne,validateAbortSignalArray:re,validateBoolean:R,validateBuffer:ae,validateDictionary:V,validateEncoding:oe,validateFunction:le,validateInt32:M,validateInteger:j,validateNumber:F,validateObject:B,validateOneOf:I,validatePlainFunction:ue,validatePort:se,validateSignalName:ie,validateString:P,validateUint32:N,validateUndefined:de,validateUnion:fe,validateAbortSignal:ce,validateLinkHeaderValue:he}})),Ne=o(((e,t)=>{var n=t.exports={},r,i;function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}(function(){try{r=typeof setTimeout==`function`?setTimeout:a}catch{r=a}try{i=typeof clearTimeout==`function`?clearTimeout:o}catch{i=o}})();function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch{try{return r.call(null,e,0)}catch{return r.call(this,e,0)}}}function c(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch{try{return i.call(null,e)}catch{return i.call(this,e)}}}var l=[],u=!1,d,f=-1;function p(){!u||!d||(u=!1,d.length?l=d.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(d=l,l=[];++f<t;)d&&d[f].run();f=-1,t=l.length}d=null,u=!1,c(e)}}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),l.length===1&&!u&&s(m)};function h(e,t){this.fun=e,this.array=t}h.prototype.run=function(){this.fun.apply(null,this.array)},n.title=`browser`,n.browser=!0,n.env={},n.argv=[],n.version=``,n.versions={};function g(){}n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw Error(`process.binding is not supported`)},n.cwd=function(){return`/`},n.chdir=function(e){throw Error(`process.chdir is not supported`)},n.umask=function(){return 0}})),Pe=o(((e,t)=>{var{SymbolAsyncIterator:n,SymbolIterator:r,SymbolFor:i}=Ee(),a=i(`nodejs.stream.destroyed`),o=i(`nodejs.stream.errored`),s=i(`nodejs.stream.readable`),c=i(`nodejs.stream.writable`),l=i(`nodejs.stream.disturbed`),u=i(`nodejs.webstream.isClosedPromise`),d=i(`nodejs.webstream.controllerErrorFunction`);function f(e,t=!1){return!!(e&&typeof e.pipe==`function`&&typeof e.on==`function`&&(!t||typeof e.pause==`function`&&typeof e.resume==`function`)&&(!e._writableState||e._readableState?.readable!==!1)&&(!e._writableState||e._readableState))}function p(e){return!!(e&&typeof e.write==`function`&&typeof e.on==`function`&&(!e._readableState||e._writableState?.writable!==!1))}function m(e){return!!(e&&typeof e.pipe==`function`&&e._readableState&&typeof e.on==`function`&&typeof e.write==`function`)}function h(e){return e&&(e._readableState||e._writableState||typeof e.write==`function`&&typeof e.on==`function`||typeof e.pipe==`function`&&typeof e.on==`function`)}function g(e){return!!(e&&!h(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`&&typeof e.cancel==`function`)}function _(e){return!!(e&&!h(e)&&typeof e.getWriter==`function`&&typeof e.abort==`function`)}function v(e){return!!(e&&!h(e)&&typeof e.readable==`object`&&typeof e.writable==`object`)}function y(e){return g(e)||_(e)||v(e)}function b(e,t){return e==null?!1:t===!0?typeof e[n]==`function`:t===!1?typeof e[r]==`function`:typeof e[n]==`function`||typeof e[r]==`function`}function x(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||r!=null&&r.destroyed)}function S(e){if(!p(e))return null;if(e.writableEnded===!0)return!0;let t=e._writableState;return t!=null&&t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function C(e,t){if(!p(e))return null;if(e.writableFinished===!0)return!0;let n=e._writableState;return n!=null&&n.errored?!1:typeof n?.finished==`boolean`?!!(n.finished||t===!1&&n.ended===!0&&n.length===0):null}function w(e){if(!f(e))return null;if(e.readableEnded===!0)return!0;let t=e._readableState;return!t||t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function T(e,t){if(!f(e))return null;let n=e._readableState;return n!=null&&n.errored?!1:typeof n?.endEmitted==`boolean`?!!(n.endEmitted||t===!1&&n.ended===!0&&n.length===0):null}function E(e){return e&&e[s]!=null?e[s]:typeof e?.readable==`boolean`?x(e)?!1:f(e)&&e.readable&&!T(e):null}function D(e){return e&&e[c]!=null?e[c]:typeof e?.writable==`boolean`?x(e)?!1:p(e)&&e.writable&&!S(e):null}function O(e,t){return h(e)?x(e)?!0:!(t?.readable!==!1&&E(e)||t?.writable!==!1&&D(e)):null}function k(e){return h(e)?e.writableErrored?e.writableErrored:e._writableState?.errored??null:null}function A(e){return h(e)?e.readableErrored?e.readableErrored:e._readableState?.errored??null:null}function j(e){if(!h(e))return null;if(typeof e.closed==`boolean`)return e.closed;let t=e._writableState,n=e._readableState;return typeof t?.closed==`boolean`||typeof n?.closed==`boolean`?t?.closed||n?.closed:typeof e._closed==`boolean`&&M(e)?e._closed:null}function M(e){return typeof e._closed==`boolean`&&typeof e._defaultKeepAlive==`boolean`&&typeof e._removedConnection==`boolean`&&typeof e._removedContLen==`boolean`}function N(e){return typeof e._sent100==`boolean`&&M(e)}function P(e){return typeof e._consuming==`boolean`&&typeof e._dumped==`boolean`&&e.req?.upgradeOrConnect===void 0}function F(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!r&&N(e)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function I(e){return!!(e&&(e[l]??(e.readableDidRead||e.readableAborted)))}function R(e){return!!(e&&(e[o]??e.readableErrored??e.writableErrored??e._readableState?.errorEmitted??e._writableState?.errorEmitted??e._readableState?.errored??e._writableState?.errored))}t.exports={isDestroyed:x,kIsDestroyed:a,isDisturbed:I,kIsDisturbed:l,isErrored:R,kIsErrored:o,isReadable:E,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:d,kIsWritable:c,isClosed:j,isDuplexNodeStream:m,isFinished:O,isIterable:b,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:w,isReadableFinished:T,isReadableErrored:A,isNodeStream:h,isWebStream:y,isWritable:D,isWritableNodeStream:p,isWritableStream:_,isWritableEnded:S,isWritableFinished:C,isWritableErrored:k,isServerRequest:P,isServerResponse:N,willEmitClose:F,isTransformStream:v}})),Fe=o(((e,t)=>{var n=Ne(),{AbortError:r,codes:i}=Oe(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:o}=i,{kEmptyObject:s,once:c}=je(),{validateAbortSignal:l,validateFunction:u,validateObject:d,validateBoolean:f}=Me(),{Promise:p,PromisePrototypeThen:m,SymbolDispose:h}=Ee(),{isClosed:g,isReadable:_,isReadableNodeStream:v,isReadableStream:y,isReadableFinished:b,isReadableErrored:x,isWritable:S,isWritableNodeStream:C,isWritableStream:w,isWritableFinished:T,isWritableErrored:E,isNodeStream:D,willEmitClose:O,kIsClosedPromise:k}=Pe(),A;function j(e){return e.setHeader&&typeof e.abort==`function`}var M=()=>{};function N(e,t,i){if(arguments.length===2?(i=t,t=s):t==null?t=s:d(t,`options`),u(i,`callback`),l(t.signal,`options.signal`),i=c(i),y(e)||w(e))return P(e,t,i);if(!D(e))throw new a(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],e);let f=t.readable??v(e),p=t.writable??C(e),m=e._writableState,k=e._readableState,N=()=>{e.writable||R()},F=O(e)&&v(e)===f&&C(e)===p,I=T(e,!1),R=()=>{I=!0,e.destroyed&&(F=!1),!(F&&(!e.readable||f))&&(!f||z)&&i.call(e)},z=b(e,!1),B=()=>{z=!0,e.destroyed&&(F=!1),!(F&&(!e.writable||p))&&(!p||I)&&i.call(e)},V=t=>{i.call(e,t)},ee=g(e),te=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);if(f&&!z&&v(e,!0)&&!b(e,!1)||p&&!I&&!T(e,!1))return i.call(e,new o);i.call(e)},ne=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);i.call(e)},re=()=>{e.req.on(`finish`,R)};j(e)?(e.on(`complete`,R),F||e.on(`abort`,te),e.req?re():e.on(`request`,re)):p&&!m&&(e.on(`end`,N),e.on(`close`,N)),!F&&typeof e.aborted==`boolean`&&e.on(`aborted`,te),e.on(`end`,B),e.on(`finish`,R),t.error!==!1&&e.on(`error`,V),e.on(`close`,te),ee?n.nextTick(te):m!=null&&m.errorEmitted||k!=null&&k.errorEmitted?F||n.nextTick(ne):(!f&&(!F||_(e))&&(I||S(e)===!1)||!p&&(!F||S(e))&&(z||_(e)===!1)||k&&e.req&&e.aborted)&&n.nextTick(ne);let ie=()=>{i=M,e.removeListener(`aborted`,te),e.removeListener(`complete`,R),e.removeListener(`abort`,te),e.removeListener(`request`,re),e.req&&e.req.removeListener(`finish`,R),e.removeListener(`end`,N),e.removeListener(`close`,N),e.removeListener(`finish`,R),e.removeListener(`end`,B),e.removeListener(`error`,V),e.removeListener(`close`,te)};if(t.signal&&!ee){let a=()=>{let n=i;ie(),n.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(a);else{A||=je().addAbortListener;let n=A(t.signal,a),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}}return ie}function P(e,t,i){let a=!1,o=M;if(t.signal)if(o=()=>{a=!0,i.call(e,new r(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(o);else{A||=je().addAbortListener;let n=A(t.signal,o),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}let s=(...t)=>{a||n.nextTick(()=>i.apply(e,t))};return m(e[k].promise,s,s),M}function F(e,t){var n;let r=!1;return t===null&&(t=s),(n=t)!=null&&n.cleanup&&(f(t.cleanup,`cleanup`),r=t.cleanup),new p((n,i)=>{let a=N(e,t,e=>{r&&a(),e?i(e):n()})})}t.exports=N,t.exports.finished=F})),Ie=o(((e,t)=>{var n=Ne(),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:i},AbortError:a}=Oe(),{Symbol:o}=Ee(),{kIsDestroyed:s,isDestroyed:c,isFinished:l,isServerRequest:u}=Pe(),d=o(`kDestroy`),f=o(`kConstruct`);function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t){let n=this._readableState,i=this._writableState,a=i||n;return i!=null&&i.destroyed||n!=null&&n.destroyed?(typeof t==`function`&&t(),this):(p(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),a.constructed?h(this,e,t):this.once(d,function(n){h(this,r(n,e),t)}),this)}function h(e,t,r){let i=!1;function a(t){if(i)return;i=!0;let a=e._readableState,o=e._writableState;p(t,o,a),o&&(o.closed=!0),a&&(a.closed=!0),typeof r==`function`&&r(t),t?n.nextTick(g,e,t):n.nextTick(_,e)}try{e._destroy(t||null,a)}catch(e){a(e)}}function g(e,t){v(e,t),_(e)}function _(e){let t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&e.emit(`close`)}function v(e,t){let n=e._readableState,r=e._writableState;r!=null&&r.errorEmitted||n!=null&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit(`error`,t))}function y(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function b(e,t,r){let i=e._readableState,a=e._writableState;if(a!=null&&a.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||a!=null&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function x(e,t){if(typeof e._construct!=`function`)return;let r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),!(e.listenerCount(f)>1)&&n.nextTick(S,e)}function S(e){let t=!1;function r(r){if(t){b(e,r??new i);return}t=!0;let a=e._readableState,o=e._writableState,s=o||a;a&&(a.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(d,r):r?b(e,r,!0):n.nextTick(C,e)}try{e._construct(e=>{n.nextTick(r,e)})}catch(e){n.nextTick(r,e)}}function C(e){e.emit(f)}function w(e){return e?.setHeader&&typeof e.abort==`function`}function T(e){e.emit(`close`)}function E(e,t){e.emit(`error`,t),n.nextTick(T,e)}function D(e,t){!e||c(e)||(!t&&!l(e)&&(t=new a),u(e)?(e.socket=null,e.destroy(t)):w(e)?e.abort():w(e.req)?e.req.abort():typeof e.destroy==`function`?e.destroy(t):typeof e.close==`function`?e.close():t?n.nextTick(E,e,t):n.nextTick(T,e),e.destroyed||(e[s]=!0))}t.exports={construct:x,destroyer:D,destroy:m,undestroy:y,errorOrDestroy:b}})),Le=o(((e,t)=>{var{ArrayIsArray:n,ObjectSetPrototypeOf:r}=Ee(),{EventEmitter:i}=Ae();function a(e){i.call(this,e)}r(a.prototype,i.prototype),r(a,i),a.prototype.pipe=function(e,t){let n=this;function r(t){e.writable&&e.write(t)===!1&&n.pause&&n.pause()}n.on(`data`,r);function a(){n.readable&&n.resume&&n.resume()}e.on(`drain`,a),!e._isStdio&&(!t||t.end!==!1)&&(n.on(`end`,c),n.on(`close`,l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,typeof e.destroy==`function`&&e.destroy())}function u(e){d(),i.listenerCount(this,`error`)===0&&this.emit(`error`,e)}o(n,`error`,u),o(e,`error`,u);function d(){n.removeListener(`data`,r),e.removeListener(`drain`,a),n.removeListener(`end`,c),n.removeListener(`close`,l),n.removeListener(`error`,u),e.removeListener(`error`,u),n.removeListener(`end`,d),n.removeListener(`close`,d),e.removeListener(`close`,d)}return n.on(`end`,d),n.on(`close`,d),e.on(`close`,d),e.emit(`pipe`,n),e};function o(e,t,r){if(typeof e.prependListener==`function`)return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}t.exports={Stream:a,prependListener:o}})),Re=o(((e,t)=>{var{SymbolDispose:n}=Ee(),{AbortError:r,codes:i}=Oe(),{isNodeStream:a,isWebStream:o,kControllerErrorFunction:s}=Pe(),c=Fe(),{ERR_INVALID_ARG_TYPE:l}=i,u,d=(e,t)=>{if(typeof e!=`object`||!(`aborted`in e))throw new l(t,`AbortSignal`,e)};t.exports.addAbortSignal=function(e,n){if(d(e,`signal`),!a(n)&&!o(n))throw new l(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],n);return t.exports.addAbortSignalNoValidate(e,n)},t.exports.addAbortSignalNoValidate=function(e,t){if(typeof e!=`object`||!(`aborted`in e))return t;let i=a(t)?()=>{t.destroy(new r(void 0,{cause:e.reason}))}:()=>{t[s](new r(void 0,{cause:e.reason}))};return e.aborted?i():(u||=je().addAbortListener,c(t,u(e,i)[n])),t}})),ze=o(((e,t)=>{var{StringPrototypeSlice:n,SymbolIterator:r,TypedArrayPrototypeSet:i,Uint8Array:a}=Ee(),{Buffer:o}=f(),{inspect:s}=je();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){let t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return``;let t=this.head,n=``+t.data;for(;(t=t.next)!==null;)n+=e+t.data;return n}concat(e){if(this.length===0)return o.alloc(0);let t=o.allocUnsafe(e>>>0),n=this.head,r=0;for(;n;)i(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){let n=this.head.data;if(e<n.length){let t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[r](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t=``,r=this.head,i=0;do{let a=r.data;if(e>a.length)t+=a,e-=a.length;else{e===a.length?(t+=a,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(a,0,e),this.head=r,r.data=n(a,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){let t=o.allocUnsafe(e),n=e,r=this.head,s=0;do{let o=r.data;if(e>o.length)i(t,o,n-e),e-=o.length;else{e===o.length?(i(t,o,n-e),++s,r.next?this.head=r.next:this.head=this.tail=null):(i(t,new a(o.buffer,o.byteOffset,e),n-e),this.head=r,r.data=o.slice(e));break}++s}while((r=r.next)!==null);return this.length-=s,t}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return s(this,{...t,depth:0,customInspect:!1})}}})),Be=o(((e,t)=>{var{MathFloor:n,NumberIsInteger:r}=Ee(),{validateInteger:i}=Me(),{ERR_INVALID_ARG_VALUE:a}=Oe().codes,o=16*1024,s=16;function c(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function l(e){return e?s:o}function u(e,t){i(t,`value`,0),e?s=t:o=t}function d(e,t,i,o){let s=c(t,o,i);if(s!=null){if(!r(s)||s<0)throw new a(o?`options.${i}`:`options.highWaterMark`,s);return n(s)}return l(e.objectMode)}t.exports={getHighWaterMark:d,getDefaultHighWaterMark:l,setDefaultHighWaterMark:u}})),Ve=o(((e,t)=>{var n=f(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),He=o((e=>{var t=Ve().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function r(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),Ue=o(((e,t)=>{var n=Ne(),{PromisePrototypeThen:r,SymbolAsyncIterator:i,SymbolIterator:a}=Ee(),{Buffer:o}=f(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:c}=Oe().codes;function l(e,t,l){let u;if(typeof t==`string`||t instanceof o)return new e({objectMode:!0,...l,read(){this.push(t),this.push(null)}});let d;if(t&&t[i])d=!0,u=t[i]();else if(t&&t[a])d=!1,u=t[a]();else throw new s(`iterable`,[`Iterable`],t);let f=new e({objectMode:!0,highWaterMark:1,...l}),p=!1;f._read=function(){p||(p=!0,h())},f._destroy=function(e,t){r(m(e),()=>n.nextTick(t,e),r=>n.nextTick(t,r||e))};async function m(e){let t=e!=null,n=typeof u.throw==`function`;if(t&&n){let{value:t,done:n}=await u.throw(e);if(await t,n)return}if(typeof u.return==`function`){let{value:e}=await u.return();await e}}async function h(){for(;;){try{let{value:e,done:t}=d?await u.next():u.next();if(t)f.push(null);else{let t=e&&typeof e.then==`function`?await e:e;if(t===null)throw p=!1,new c;if(f.push(t))continue;p=!1}}catch(e){f.destroy(e)}break}}return f}t.exports=l})),We=o(((e,t)=>{var n=Ne(),{ArrayPrototypeIndexOf:r,NumberIsInteger:i,NumberIsNaN:a,NumberParseInt:o,ObjectDefineProperties:s,ObjectKeys:c,ObjectSetPrototypeOf:l,Promise:u,SafeSet:d,SymbolAsyncDispose:p,SymbolAsyncIterator:m,Symbol:h}=Ee();t.exports=H,H.ReadableState=ye;var{EventEmitter:g}=Ae(),{Stream:_,prependListener:v}=Le(),{Buffer:y}=f(),{addAbortSignal:b}=Re(),x=Fe(),S=je().debuglog(`stream`,e=>{S=e}),C=ze(),w=Ie(),{getHighWaterMark:T,getDefaultHighWaterMark:E}=Be(),{aggregateTwoErrors:D,codes:{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:A,ERR_STREAM_PUSH_AFTER_EOF:j,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:M},AbortError:N}=Oe(),{validateObject:P}=Me(),F=h(`kPaused`),{StringDecoder:I}=He(),R=Ue();l(H.prototype,_.prototype),l(H,_);var z=()=>{},{errorOrDestroy:B}=w,V=1,ee=2,te=4,ne=8,re=16,ie=32,ae=64,oe=128,se=256,ce=512,le=1024,ue=2048,de=4096,fe=8192,pe=16384,me=32768,he=65536,ge=1<<17,_e=1<<18;function ve(e){return{enumerable:!1,get(){return(this.state&e)!==0},set(t){t?this.state|=e:this.state&=~e}}}s(ye.prototype,{objectMode:ve(V),ended:ve(ee),endEmitted:ve(te),reading:ve(ne),constructed:ve(re),sync:ve(ie),needReadable:ve(ae),emittedReadable:ve(oe),readableListening:ve(se),resumeScheduled:ve(ce),errorEmitted:ve(le),emitClose:ve(ue),autoDestroy:ve(de),destroyed:ve(fe),closed:ve(pe),closeEmitted:ve(me),multiAwaitDrain:ve(he),readingMore:ve(ge),dataEmitted:ve(_e)});function ye(e,t,n){typeof n!=`boolean`&&(n=t instanceof U()),this.state=6192,e&&e.objectMode&&(this.state|=V),n&&e&&e.readableObjectMode&&(this.state|=V),this.highWaterMark=e?T(this,e,`readableHighWaterMark`,n):E(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this[F]=null,e&&e.emitClose===!1&&(this.state&=~ue),e&&e.autoDestroy===!1&&(this.state&=~de),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new I(e.encoding),this.encoding=e.encoding)}function H(e){if(!(this instanceof H))return new H(e);let t=this instanceof U();this._readableState=new ye(e,this,t),e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&!t&&b(e.signal,this)),_.call(this,e),w.construct(this,()=>{this._readableState.needReadable&&Pe(this,this._readableState)})}H.prototype.destroy=w.destroy,H.prototype._undestroy=w.undestroy,H.prototype._destroy=function(e,t){t(e)},H.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},H.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new N,this.destroy(e)),new u((t,n)=>x(this,r=>r&&r!==e?n(r):t(null)))},H.prototype.push=function(e,t){return be(this,e,t,!1)},H.prototype.unshift=function(e,t){return be(this,e,t,!0)};function be(e,t,n,r){S(`readableAddChunk`,t);let i=e._readableState,a;if((i.state&V)===0&&(typeof t==`string`?(n||=i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=y.from(t,n).toString(i.encoding):(t=y.from(t,n),n=``))):t instanceof y?n=``:_._isUint8Array(t)?(t=_._uint8ArrayToBuffer(t),n=``):t!=null&&(a=new O(`chunk`,[`string`,`Buffer`,`Uint8Array`],t))),a)B(e,a);else if(t===null)i.state&=~ne,Te(e,i);else if((i.state&V)!==0||t&&t.length>0)if(r)if((i.state&te)!==0)B(e,new M);else if(i.destroyed||i.errored)return!1;else xe(e,i,t,!0);else if(i.ended)B(e,new j);else if(i.destroyed||i.errored)return!1;else i.state&=~ne,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||t.length!==0?xe(e,i,t,!1):Pe(e,i)):xe(e,i,t,!1);else r||(i.state&=~ne,Pe(e,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function xe(e,t,n,r){t.flowing&&t.length===0&&!t.sync&&e.listenerCount(`data`)>0?((t.state&he)===0?t.awaitDrainWriters=null:t.awaitDrainWriters.clear(),t.dataEmitted=!0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),(t.state&ae)!==0&&De(e)),Pe(e,t)}H.prototype.isPaused=function(){let e=this._readableState;return e[F]===!0||e.flowing===!1},H.prototype.setEncoding=function(e){let t=new I(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let n=this._readableState.buffer,r=``;for(let e of n)r+=t.write(e);return n.clear(),r!==``&&n.push(r),this._readableState.length=r.length,this};var Se=1073741824;function Ce(e){if(e>Se)throw new A(`size`,`<= 1GiB`,e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++,e}function we(e,t){return e<=0||t.length===0&&t.ended?0:(t.state&V)===0?a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0:1}H.prototype.read=function(e){S(`read`,e),e===void 0?e=NaN:i(e)||(e=o(e,10));let t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=Ce(e)),e!==0&&(t.state&=~oe),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return S(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?$e(this):De(this),null;if(e=we(e,t),e===0&&t.ended)return t.length===0&&$e(this),null;let r=(t.state&ae)!==0;if(S(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,S(`length less than watermark`,r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,S(`reading, ended or constructing`,r);else if(r){S(`do read`),t.state|=ne|ie,t.length===0&&(t.state|=ae);try{this._read(t.highWaterMark)}catch(e){B(this,e)}t.state&=~ie,t.reading||(e=we(n,t))}let a;return a=e>0?Qe(e,t):null,a===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&$e(this)),a!==null&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit(`data`,a)),a};function Te(e,t){if(S(`onEofChunk`),!t.ended){if(t.decoder){let e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?De(e):(t.needReadable=!1,t.emittedReadable=!0,ke(e))}}function De(e){let t=e._readableState;S(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S(`emitReadable`,t.flowing),t.emittedReadable=!0,n.nextTick(ke,e))}function ke(e){let t=e._readableState;S(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Ye(e)}function Pe(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(Ve,e,t))}function Ve(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){let n=t.length;if(S(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}H.prototype._read=function(e){throw new k(`_read()`)},H.prototype.pipe=function(e,t){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new d(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S(`pipe count=%d opts=%j`,i.pipes.length,t);let a=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr?s:_;i.endEmitted?n.nextTick(a):r.once(`end`,a),e.on(`unpipe`,o);function o(e,t){S(`onunpipe`),e===r&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,u())}function s(){S(`onend`),e.end()}let c,l=!1;function u(){S(`cleanup`),e.removeListener(`close`,h),e.removeListener(`finish`,g),c&&e.removeListener(`drain`,c),e.removeListener(`error`,m),e.removeListener(`unpipe`,o),r.removeListener(`end`,s),r.removeListener(`end`,_),r.removeListener(`data`,p),l=!0,c&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&c()}function f(){l||(i.pipes.length===1&&i.pipes[0]===e?(S(`false write response, pause`,0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S(`false write response, pause`,i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),c||(c=We(r,e),e.on(`drain`,c))}r.on(`data`,p);function p(t){S(`ondata`);let n=e.write(t);S(`dest.write`,n),n===!1&&f()}function m(t){if(S(`onerror`,t),_(),e.removeListener(`error`,m),e.listenerCount(`error`)===0){let n=e._writableState||e._readableState;n&&!n.errorEmitted?B(e,t):e.emit(`error`,t)}}v(e,`error`,m);function h(){e.removeListener(`finish`,g),_()}e.once(`close`,h);function g(){S(`onfinish`),e.removeListener(`close`,h),_()}e.once(`finish`,g);function _(){S(`unpipe`),r.unpipe(e)}return e.emit(`pipe`,r),e.writableNeedDrain===!0?f():i.flowing||(S(`pipe resume`),r.resume()),e};function We(e,t){return function(){let n=e._readableState;n.awaitDrainWriters===t?(S(`pipeOnDrain`,1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(S(`pipeOnDrain`,n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&e.listenerCount(`data`)&&e.resume()}}H.prototype.unpipe=function(e){let t=this._readableState,n={hasUnpiped:!1};if(t.pipes.length===0)return this;if(!e){let e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit(`unpipe`,this,{hasUnpiped:!1});return this}let i=r(t.pipes,e);return i===-1?this:(t.pipes.splice(i,1),t.pipes.length===0&&this.pause(),e.emit(`unpipe`,this,n),this)},H.prototype.on=function(e,t){let r=_.prototype.on.call(this,e,t),i=this._readableState;return e===`data`?(i.readableListening=this.listenerCount(`readable`)>0,i.flowing!==!1&&this.resume()):e===`readable`&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S(`on readable`,i.length,i.reading),i.length?De(this):i.reading||n.nextTick(Ke,this)),r},H.prototype.addListener=H.prototype.on,H.prototype.removeListener=function(e,t){let r=_.prototype.removeListener.call(this,e,t);return e===`readable`&&n.nextTick(Ge,this),r},H.prototype.off=H.prototype.removeListener,H.prototype.removeAllListeners=function(e){let t=_.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&n.nextTick(Ge,this),t};function Ge(e){let t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&t[F]===!1?t.flowing=!0:e.listenerCount(`data`)>0?e.resume():t.readableListening||(t.flowing=null)}function Ke(e){S(`readable nexttick read 0`),e.read(0)}H.prototype.resume=function(){let e=this._readableState;return e.flowing||(S(`resume`),e.flowing=!e.readableListening,qe(this,e)),e[F]=!1,this};function qe(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(Je,e,t))}function Je(e,t){S(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),Ye(e),t.flowing&&!t.reading&&e.read(0)}H.prototype.pause=function(){return S(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(S(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState[F]=!0,this};function Ye(e){let t=e._readableState;for(S(`flow`,t.flowing);t.flowing&&e.read()!==null;);}H.prototype.wrap=function(e){let t=!1;e.on(`data`,n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on(`end`,()=>{this.push(null)}),e.on(`error`,e=>{B(this,e)}),e.on(`close`,()=>{this.destroy()}),e.on(`destroy`,()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let n=c(e);for(let t=1;t<n.length;t++){let r=n[t];this[r]===void 0&&typeof e[r]==`function`&&(this[r]=e[r].bind(e))}return this},H.prototype[m]=function(){return Xe(this)},H.prototype.iterator=function(e){return e!==void 0&&P(e,`options`),Xe(this,e)};function Xe(e,t){typeof e.read!=`function`&&(e=H.wrap(e,{objectMode:!0}));let n=Ze(e,t);return n.stream=e,n}async function*Ze(e,t){let n=z;function r(t){this===e?(n(),n=z):n=t}e.on(`readable`,r);let i,a=x(e,{writable:!1},e=>{i=e?D(i,e):null,n(),n=z});try{for(;;){let t=e.destroyed?null:e.read();if(t!==null)yield t;else if(i)throw i;else if(i===null)return;else await new u(r)}}catch(e){throw i=D(i,e),i}finally{(i||t?.destroyOnReturn!==!1)&&(i===void 0||e._readableState.autoDestroy)?w.destroyer(e,null):(e.off(`readable`,r),a())}}s(H.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!!e&&e.readable!==!1&&!e.destroyed&&!e.errorEmitted&&!e.endEmitted},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(ye.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[F]!==!1},set(e){this[F]=!!e}}}),H._fromList=Qe;function Qe(e,t){if(t.length===0)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function $e(e){let t=e._readableState;S(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(et,t,e))}function et(e,t){if(S(`endReadableNT`,e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.emit(`end`),t.writable&&t.allowHalfOpen===!1)n.nextTick(tt,t);else if(e.autoDestroy){let e=t._writableState;(!e||e.autoDestroy&&(e.finished||e.writable===!1))&&t.destroy()}}}function tt(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}H.from=function(e,t){return R(H,e,t)};var nt;function rt(){return nt===void 0&&(nt={}),nt}H.fromWeb=function(e,t){return rt().newStreamReadableFromReadableStream(e,t)},H.toWeb=function(e,t){return rt().newReadableStreamFromStreamReadable(e,t)},H.wrap=function(e,t){return new H({objectMode:e.readableObjectMode??e.objectMode??!0,...t,destroy(t,n){w.destroyer(e,t),n(t)}}).wrap(e)}})),Ge=o(((e,t)=>{var n=Ne(),{ArrayPrototypeSlice:r,Error:i,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:o,ObjectDefineProperties:s,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:l,Symbol:u,SymbolHasInstance:d}=Ee();t.exports=P,P.WritableState=M;var{EventEmitter:p}=Ae(),m=Le().Stream,{Buffer:h}=f(),g=Ie(),{addAbortSignal:_}=Re(),{getHighWaterMark:v,getDefaultHighWaterMark:y}=Be(),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_MULTIPLE_CALLBACK:S,ERR_STREAM_CANNOT_PIPE:C,ERR_STREAM_DESTROYED:w,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:E,ERR_STREAM_WRITE_AFTER_END:D,ERR_UNKNOWN_ENCODING:O}=Oe().codes,{errorOrDestroy:k}=g;c(P.prototype,m.prototype),c(P,m);function A(){}var j=u(`kOnFinished`);function M(e,t,n){typeof n!=`boolean`&&(n=t instanceof U()),this.objectMode=!!(e&&e.objectMode),n&&(this.objectMode=this.objectMode||!!(e&&e.writableObjectMode)),this.highWaterMark=e?v(this,e,`writableHighWaterMark`,n):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1,this.decodeStrings=!(e&&e.decodeStrings===!1),this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=B.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,N(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||e.emitClose!==!1,this.autoDestroy=!e||e.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[j]=[]}function N(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}M.prototype.getBuffer=function(){return r(this.buffered,this.bufferedIndex)},o(M.prototype,`bufferedRequestCount`,{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function P(e){let t=this instanceof U();if(!t&&!a(P,this))return new P(e);this._writableState=new M(e,this,t),e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&_(e.signal,this)),m.call(this,e),g.construct(this,()=>{let e=this._writableState;e.writing||ne(this,e),oe(this,e)})}o(P,d,{__proto__:null,value:function(e){return a(this,e)?!0:this===P?e&&e._writableState instanceof M:!1}}),P.prototype.pipe=function(){k(this,new C)};function F(e,t,r,i){let a=e._writableState;if(typeof r==`function`)i=r,r=a.defaultEncoding;else{if(!r)r=a.defaultEncoding;else if(r!==`buffer`&&!h.isEncoding(r))throw new O(r);typeof i!=`function`&&(i=A)}if(t===null)throw new E;if(!a.objectMode)if(typeof t==`string`)a.decodeStrings!==!1&&(t=h.from(t,r),r=`buffer`);else if(t instanceof h)r=`buffer`;else if(m._isUint8Array(t))t=m._uint8ArrayToBuffer(t),r=`buffer`;else throw new b(`chunk`,[`string`,`Buffer`,`Uint8Array`],t);let o;return a.ending?o=new D:a.destroyed&&(o=new w(`write`)),o?(n.nextTick(i,o),k(e,o,!0),o):(a.pendingcb++,I(e,a,t,r,i))}P.prototype.write=function(e,t,n){return F(this,e,t,n)===!0},P.prototype.cork=function(){this._writableState.corked++},P.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||ne(this,e))},P.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=l(e)),!h.isEncoding(e))throw new O(e);return this._writableState.defaultEncoding=e,this};function I(e,t,n,r,i){let a=t.objectMode?1:n.length;t.length+=a;let o=t.length<t.highWaterMark;return o||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&r!==`buffer`&&(t.allBuffers=!1),t.allNoop&&i!==A&&(t.allNoop=!1)):(t.writelen=a,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),o&&!t.errored&&!t.destroyed}function R(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function z(e,t,n,r){--t.pendingcb,r(n),te(t),k(e,n)}function B(e,t){let r=e._writableState,i=r.sync,a=r.writecb;if(typeof a!=`function`){k(e,new S);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||=t,e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(z,e,r,t,a):z(e,r,t,a)):(r.buffered.length>r.bufferedIndex&&ne(e,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===a?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:a,stream:e,state:r},n.nextTick(V,r.afterWriteTickInfo)):ee(e,r,1,a))}function V({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,ee(e,t,n,r)}function ee(e,t,n,r){for(!t.ending&&!e.destroyed&&t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`));n-- >0;)t.pendingcb--,r();t.destroyed&&te(t),oe(e,t)}function te(e){if(e.writing)return;for(let t=e.bufferedIndex;t<e.buffered.length;++t){let{chunk:n,callback:r}=e.buffered[t],i=e.objectMode?1:n.length;e.length-=i,r(e.errored??new w(`write`))}let t=e[j].splice(0);for(let n=0;n<t.length;n++)t[n](e.errored??new w(`end`));N(e)}function ne(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:n,bufferedIndex:i,objectMode:a}=t,o=n.length-i;if(!o)return;let s=i;if(t.bufferProcessing=!0,o>1&&e._writev){t.pendingcb-=o-1;let i=t.allNoop?A:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},a=t.allNoop&&s===0?n:r(n,s);a.allBuffers=t.allBuffers,R(e,t,!0,t.length,a,``,i),N(t)}else{do{let{chunk:r,encoding:i,callback:o}=n[s];n[s++]=null,R(e,t,!1,a?1:r.length,r,i,o)}while(s<n.length&&!t.writing);s===n.length?N(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}P.prototype._write=function(e,t,n){if(this._writev)this._writev([{chunk:e,encoding:t}],n);else throw new x(`_write()`)},P.prototype._writev=null,P.prototype.end=function(e,t,r){let a=this._writableState;typeof e==`function`?(r=e,e=null,t=null):typeof t==`function`&&(r=t,t=null);let o;if(e!=null){let n=F(this,e,t);n instanceof i&&(o=n)}return a.corked&&(a.corked=1,this.uncork()),o||(!a.errored&&!a.ending?(a.ending=!0,oe(this,a,!0),a.ended=!0):a.finished?o=new T(`end`):a.destroyed&&(o=new w(`end`))),typeof r==`function`&&(o||a.finished?n.nextTick(r,o):a[j].push(r)),this};function re(e){return e.ending&&!e.destroyed&&e.constructed&&e.length===0&&!e.errored&&e.buffered.length===0&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function ie(e,t){let r=!1;function i(i){if(r){k(e,i??S());return}if(r=!0,t.pendingcb--,i){let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e](i);k(e,i,t.sync)}else re(t)&&(t.prefinished=!0,e.emit(`prefinish`),t.pendingcb++,n.nextTick(se,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}function ae(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.finalCalled=!0,ie(e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function oe(e,t,r){re(t)&&(ae(e,t),t.pendingcb===0&&(r?(t.pendingcb++,n.nextTick((e,t)=>{re(t)?se(e,t):t.pendingcb--},e,t)):re(t)&&(t.pendingcb++,se(e,t))))}function se(e,t){t.pendingcb--,t.finished=!0;let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit(`finish`),t.autoDestroy){let t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))&&e.destroy()}}s(P.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!!e&&e.writable!==!1&&!e.destroyed&&!e.errored&&!e.ending&&!e.ended},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return e?!e.destroyed&&!e.ending&&e.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var ce=g.destroy;P.prototype.destroy=function(e,t){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[j].length)&&n.nextTick(te,r),ce.call(this,e,t),this},P.prototype._undestroy=g.undestroy,P.prototype._destroy=function(e,t){t(e)},P.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)};var le;function ue(){return le===void 0&&(le={}),le}P.fromWeb=function(e,t){return ue().newStreamWritableFromWritableStream(e,t)},P.toWeb=function(e){return ue().newWritableStreamFromStreamWritable(e)}})),Ke=o(((e,t)=>{var n=Ne(),r=f(),{isReadable:i,isWritable:a,isIterable:o,isNodeStream:s,isReadableNodeStream:c,isWritableNodeStream:l,isDuplexNodeStream:u,isReadableStream:d,isWritableStream:p}=Pe(),m=Fe(),{AbortError:h,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_}}=Oe(),{destroyer:v}=Ie(),y=U(),b=We(),x=Ge(),{createDeferredPromise:S}=je(),C=Ue(),w=globalThis.Blob||r.Blob,T=w===void 0?function(e){return!1}:function(e){return e instanceof w},E=globalThis.AbortController||ke().AbortController,{FunctionPrototypeCall:D}=Ee(),O=class extends y{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function e(t,r){if(u(t))return t;if(c(t))return A({readable:t});if(l(t))return A({writable:t});if(s(t))return A({writable:!1,readable:!1});if(d(t))return A({readable:b.fromWeb(t)});if(p(t))return A({writable:x.fromWeb(t)});if(typeof t==`function`){let{value:e,write:i,final:a,destroy:s}=k(t);if(o(e))return C(O,e,{objectMode:!0,write:i,final:a,destroy:s});let c=e?.then;if(typeof c==`function`){let t,r=D(c,e,e=>{if(e!=null)throw new _(`nully`,`body`,e)},e=>{v(t,e)});return t=new O({objectMode:!0,readable:!1,write:i,final(e){a(async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}})},destroy:s})}throw new _(`Iterable, AsyncIterable or AsyncFunction`,r,e)}if(T(t))return e(t.arrayBuffer());if(o(t))return C(O,t,{objectMode:!0,writable:!1});if(d(t?.readable)&&p(t?.writable))return O.fromWeb(t);if(typeof t?.writable==`object`||typeof t?.readable==`object`)return A({readable:t!=null&&t.readable?c(t?.readable)?t?.readable:e(t.readable):void 0,writable:t!=null&&t.writable?l(t?.writable)?t?.writable:e(t.writable):void 0});let i=t?.then;if(typeof i==`function`){let e;return D(i,t,t=>{t!=null&&e.push(t),e.push(null)},t=>{v(e,t)}),e=new O({objectMode:!0,writable:!1,read(){}})}throw new g(r,[`Blob`,`ReadableStream`,`WritableStream`,`Stream`,`Iterable`,`AsyncIterable`,`Function`,`{ readable, writable } pair`,`Promise`],t)};function k(e){let{promise:t,resolve:r}=S(),i=new E,a=i.signal;return{value:e((async function*(){for(;;){let e=t;t=null;let{chunk:i,done:o,cb:s}=await e;if(n.nextTick(s),o)return;if(a.aborted)throw new h(void 0,{cause:a.reason});({promise:t,resolve:r}=S()),yield i}})(),{signal:a}),write(e,t,n){let i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){let t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}function A(e){let t=e.readable&&typeof e.readable.read!=`function`?b.wrap(e.readable):e.readable,n=e.writable,r=!!i(t),o=!!a(n),s,c,l,u,d;function f(e){let t=u;u=null,t?t(e):e&&d.destroy(e)}return d=new O({readableObjectMode:!!(t!=null&&t.readableObjectMode),writableObjectMode:!!(n!=null&&n.writableObjectMode),readable:r,writable:o}),o&&(m(n,e=>{o=!1,e&&v(t,e),f(e)}),d._write=function(e,t,r){n.write(e,t)?r():s=r},d._final=function(e){n.end(),c=e},n.on(`drain`,function(){if(s){let e=s;s=null,e()}}),n.on(`finish`,function(){if(c){let e=c;c=null,e()}})),r&&(m(t,e=>{r=!1,e&&v(t,e),f(e)}),t.on(`readable`,function(){if(l){let e=l;l=null,e()}}),t.on(`end`,function(){d.push(null)}),d._read=function(){for(;;){let e=t.read();if(e===null){l=d._read;return}if(!d.push(e))return}}),d._destroy=function(e,r){!e&&u!==null&&(e=new h),l=null,s=null,c=null,u===null?r(e):(u=r,v(n,e),v(t,e))},d}})),U=o(((e,t)=>{var{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:i,ObjectSetPrototypeOf:a}=Ee();t.exports=c;var o=We(),s=Ge();a(c.prototype,o.prototype),a(c,o);{let e=i(s.prototype);for(let t=0;t<e.length;t++){let n=e[t];c.prototype[n]||(c.prototype[n]=s.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),e?(this.allowHalfOpen=e.allowHalfOpen!==!1,e.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(c.prototype,{writable:{__proto__:null,...r(s.prototype,`writable`)},writableHighWaterMark:{__proto__:null,...r(s.prototype,`writableHighWaterMark`)},writableObjectMode:{__proto__:null,...r(s.prototype,`writableObjectMode`)},writableBuffer:{__proto__:null,...r(s.prototype,`writableBuffer`)},writableLength:{__proto__:null,...r(s.prototype,`writableLength`)},writableFinished:{__proto__:null,...r(s.prototype,`writableFinished`)},writableCorked:{__proto__:null,...r(s.prototype,`writableCorked`)},writableEnded:{__proto__:null,...r(s.prototype,`writableEnded`)},writableNeedDrain:{__proto__:null,...r(s.prototype,`writableNeedDrain`)},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}});var l;function u(){return l===void 0&&(l={}),l}c.fromWeb=function(e,t){return u().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return u().newReadableWritablePairFromDuplex(e)};var d;c.from=function(e){return d||=Ke(),d(e,`body`)}})),qe=o(((e,t)=>{var{ObjectSetPrototypeOf:n,Symbol:r}=Ee();t.exports=c;var{ERR_METHOD_NOT_IMPLEMENTED:i}=Oe().codes,a=U(),{getHighWaterMark:o}=Be();n(c.prototype,a.prototype),n(c,a);var s=r(`kCallback`);function c(e){if(!(this instanceof c))return new c(e);let t=e?o(this,e,`readableHighWaterMark`,!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[s]=null,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function l(e){typeof this._flush==`function`&&!this.destroyed?this._flush((t,n)=>{if(t){e?e(t):this.destroy(t);return}n!=null&&this.push(n),this.push(null),e&&e()}):(this.push(null),e&&e())}function u(){this._final!==l&&l.call(this)}c.prototype._final=l,c.prototype._transform=function(e,t,n){throw new i(`_transform()`)},c.prototype._write=function(e,t,n){let r=this._readableState,i=this._writableState,a=r.length;this._transform(e,t,(e,t)=>{if(e){n(e);return}t!=null&&this.push(t),i.ended||a===r.length||r.length<r.highWaterMark?n():this[s]=n})},c.prototype._read=function(){if(this[s]){let e=this[s];this[s]=null,e()}}})),Je=o(((e,t)=>{var{ObjectSetPrototypeOf:n}=Ee();t.exports=i;var r=qe();n(i.prototype,r.prototype),n(i,r);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),Ye=o(((e,t)=>{var n=Ne(),{ArrayIsArray:r,Promise:i,SymbolAsyncIterator:a,SymbolDispose:o}=Ee(),s=Fe(),{once:c}=je(),l=Ie(),u=U(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:h,ERR_STREAM_PREMATURE_CLOSE:g},AbortError:_}=Oe(),{validateFunction:v,validateAbortSignal:y}=Me(),{isIterable:b,isReadable:x,isReadableNodeStream:S,isNodeStream:C,isTransformStream:w,isWebStream:T,isReadableStream:E,isReadableFinished:D}=Pe(),O=globalThis.AbortController||ke().AbortController,k,A,j;function M(e,t,n){let r=!1;return e.on(`close`,()=>{r=!0}),{destroy:t=>{r||(r=!0,l.destroyer(e,t||new h(`pipe`)))},cleanup:s(e,{readable:t,writable:n},e=>{r=!e})}}function N(e){return v(e[e.length-1],`streams[stream.length - 1]`),e.pop()}function P(e){if(b(e))return e;if(S(e))return F(e);throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`],e)}async function*F(e){A||=We(),yield*A.prototype[a].call(e)}async function I(e,t,n,{end:r}){let a,o=null,c=e=>{if(e&&(a=e),o){let e=o;o=null,e()}},l=()=>new i((e,t)=>{a?t(a):o=()=>{a?t(a):e()}});t.on(`drain`,c);let u=s(t,{readable:!1},c);try{t.writableNeedDrain&&await l();for await(let n of e)t.write(n)||await l();r&&(t.end(),await l()),n()}catch(e){n(a===e?e:d(a,e))}finally{u(),t.off(`drain`,c)}}async function R(e,t,n,{end:r}){w(t)&&(t=t.writable);let i=t.getWriter();try{for await(let t of e)await i.ready,i.write(t).catch(()=>{});await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function z(...e){return B(e,c(N(e)))}function B(e,t,i){if(e.length===1&&r(e[0])&&(e=e[0]),e.length<2)throw new m(`streams`);let a=new O,s=a.signal,c=i?.signal,l=[];y(c,`options.signal`);function d(){F(new _)}j||=je().addAbortListener;let h;c&&(h=j(c,d));let g,v,D=[],A=0;function N(e){F(e,--A===0)}function F(e,r){var i;if(e&&(!g||g.code===`ERR_STREAM_PREMATURE_CLOSE`)&&(g=e),!(!g&&!r)){for(;D.length;)D.shift()(g);(i=h)==null||i[o](),a.abort(),r&&(g||l.forEach(e=>e()),n.nextTick(t,g,v))}}let z;for(let t=0;t<e.length;t++){let r=e[t],a=t<e.length-1,o=t>0,c=a||i?.end!==!1,d=t===e.length-1;if(C(r)){if(c){let{destroy:e,cleanup:t}=M(r,a,o);D.push(e),x(r)&&d&&l.push(t)}function e(e){e&&e.name!==`AbortError`&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&N(e)}r.on(`error`,e),x(r)&&d&&l.push(()=>{r.removeListener(`error`,e)})}if(t===0)if(typeof r==`function`){if(z=r({signal:s}),!b(z))throw new p(`Iterable, AsyncIterable or Stream`,`source`,z)}else z=b(r)||S(r)||w(r)?r:u.from(r);else if(typeof r==`function`)if(z=w(z)?P(z?.readable):P(z),z=r(z,{signal:s}),a){if(!b(z,!0))throw new p(`AsyncIterable`,`transform[${t-1}]`,z)}else{k||=Je();let e=new k({objectMode:!0}),t=z?.then;if(typeof t==`function`)A++,t.call(z,t=>{v=t,t!=null&&e.write(t),c&&e.end(),n.nextTick(N)},t=>{e.destroy(t),n.nextTick(N,t)});else if(b(z,!0))A++,I(z,e,N,{end:c});else if(E(z)||w(z)){let t=z.readable||z;A++,I(t,e,N,{end:c})}else throw new p(`AsyncIterable or Promise`,`destination`,z);z=e;let{destroy:r,cleanup:i}=M(z,!1,!0);D.push(r),d&&l.push(i)}else if(C(r)){if(S(z)){A+=2;let e=V(z,r,N,{end:c});x(r)&&d&&l.push(e)}else if(w(z)||E(z)){let e=z.readable||z;A++,I(e,r,N,{end:c})}else if(b(z))A++,I(z,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],z);z=r}else if(T(r)){if(S(z))A++,R(P(z),r,N,{end:c});else if(E(z)||b(z))A++,R(z,r,N,{end:c});else if(w(z))A++,R(z.readable,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],z);z=r}else z=u.from(r)}return(s!=null&&s.aborted||c!=null&&c.aborted)&&n.nextTick(d),z}function V(e,t,r,{end:i}){let a=!1;if(t.on(`close`,()=>{a||r(new g)}),e.pipe(t,{end:!1}),i){function r(){a=!0,t.end()}D(e)?n.nextTick(r):e.once(`end`,r)}else r();return s(e,{readable:!0,writable:!1},t=>{let n=e._readableState;t&&t.code===`ERR_STREAM_PREMATURE_CLOSE`&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once(`end`,r).once(`error`,r):r(t)}),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:B,pipeline:z}})),Xe=o(((e,t)=>{var{pipeline:n}=Ye(),r=U(),{destroyer:i}=Ie(),{isNodeStream:a,isReadable:o,isWritable:s,isWebStream:c,isTransformStream:l,isWritableStream:u,isReadableStream:d}=Pe(),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=Oe(),h=Fe();t.exports=function(...e){if(e.length===0)throw new m(`streams`);if(e.length===1)return r.from(e[0]);let t=[...e];if(typeof e[0]==`function`&&(e[0]=r.from(e[0])),typeof e[e.length-1]==`function`){let t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(!(!a(e[n])&&!c(e[n]))){if(n<e.length-1&&!(o(e[n])||d(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be readable`);if(n>0&&!(s(e[n])||u(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be writable`)}let g,_,v,y,b;function x(e){let t=y;y=null,t?t(e):e?b.destroy(e):!T&&!w&&b.destroy()}let S=e[0],C=n(e,x),w=!!(s(S)||u(S)||l(S)),T=!!(o(C)||d(C)||l(C));if(b=new r({writableObjectMode:!!(S!=null&&S.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:w,readable:T}),w){if(a(S))b._write=function(e,t,n){S.write(e,t)?n():g=n},b._final=function(e){S.end(),_=e},S.on(`drain`,function(){if(g){let e=g;g=null,e()}});else if(c(S)){let e=(l(S)?S.writable:S).getWriter();b._write=async function(t,n,r){try{await e.ready,e.write(t).catch(()=>{}),r()}catch(e){r(e)}},b._final=async function(t){try{await e.ready,e.close().catch(()=>{}),_=t}catch(e){t(e)}}}h(l(C)?C.readable:C,()=>{if(_){let e=_;_=null,e()}})}if(T){if(a(C))C.on(`readable`,function(){if(v){let e=v;v=null,e()}}),C.on(`end`,function(){b.push(null)}),b._read=function(){for(;;){let e=C.read();if(e===null){v=b._read;return}if(!b.push(e))return}};else if(c(C)){let e=(l(C)?C.readable:C).getReader();b._read=async function(){for(;;)try{let{value:t,done:n}=await e.read();if(!b.push(t))return;if(n){b.push(null);return}}catch{return}}}}return b._destroy=function(e,t){!e&&y!==null&&(e=new f),v=null,g=null,_=null,y===null?t(e):(y=t,a(C)&&i(C,e))},b}})),Ze=o(((e,t)=>{var n=globalThis.AbortController||ke().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:o},AbortError:s}=Oe(),{validateAbortSignal:c,validateInteger:l,validateObject:u}=Me(),d=Ee().Symbol(`kWeak`),f=Ee().Symbol(`kResistStopPropagation`),{finished:p}=Fe(),m=Xe(),{addAbortSignalNoValidate:h}=Re(),{isWritable:g,isNodeStream:_}=Pe(),{deprecate:v}=je(),{ArrayPrototypePush:y,Boolean:b,MathFloor:x,Number:S,NumberIsNaN:C,Promise:w,PromiseReject:T,PromiseResolve:E,PromisePrototypeThen:D,Symbol:O}=Ee(),k=O(`kEmpty`),A=O(`kEof`);function j(e,t){if(t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),_(e)&&!g(e))throw new r(`stream`,e,`must be writable`);let n=m(this,e);return t!=null&&t.signal&&h(t.signal,n),n}function M(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`);let n=1;t?.concurrency!=null&&(n=x(t.concurrency));let r=n-1;return t?.highWaterMark!=null&&(r=x(t.highWaterMark)),l(n,`options.concurrency`,1),l(r,`options.highWaterMark`,0),r+=n,async function*(){let i=je().AbortSignalAny([t?.signal].filter(b)),a=this,o=[],c={signal:i},l,u,d=!1,f=0;function p(){d=!0,m()}function m(){--f,h()}function h(){u&&!d&&f<n&&o.length<r&&(u(),u=null)}async function g(){try{for await(let t of a){if(d)return;if(i.aborted)throw new s;try{if(t=e(t,c),t===k)continue;t=E(t)}catch(e){t=T(e)}f+=1,D(t,m,p),o.push(t),l&&=(l(),null),!d&&(o.length>=r||f>=n)&&await new w(e=>{u=e})}o.push(A)}catch(e){let t=T(e);D(t,m,p),o.push(t)}finally{d=!0,l&&=(l(),null)}}g();try{for(;;){for(;o.length>0;){let e=await o[0];if(e===A)return;if(i.aborted)throw new s;e!==k&&(yield e),o.shift(),h()}await new w(e=>{l=e})}}finally{d=!0,u&&=(u(),null)}}.call(this)}function N(e=void 0){return e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`),async function*(){let t=0;for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s({cause:e.signal.reason});yield[t++,r]}}.call(this)}async function P(e,t=void 0){for await(let n of z.call(this,e,t))return!0;return!1}async function F(e,t=void 0){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);return!await P.call(this,async(...t)=>!await e(...t),t)}async function I(e,t){for await(let n of z.call(this,e,t))return n}async function R(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n),k}for await(let e of M.call(this,n,t));}function z(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n)?t:k}return M.call(this,n,t)}var B=class extends a{constructor(){super(`reduce`),this.message=`Reduce of an empty stream requires an initial value`}};async function V(e,t,r){var a;if(typeof e!=`function`)throw new i(`reducer`,[`Function`,`AsyncFunction`],e);r!=null&&u(r,`options`),r?.signal!=null&&c(r.signal,`options.signal`);let o=arguments.length>1;if(r!=null&&(a=r.signal)!=null&&a.aborted){let e=new s(void 0,{cause:r.signal.reason});throw this.once(`error`,()=>{}),await p(this.destroy(e)),e}let l=new n,m=l.signal;if(r!=null&&r.signal){let e={once:!0,[d]:this,[f]:!0};r.signal.addEventListener(`abort`,()=>l.abort(),e)}let h=!1;try{for await(let n of this){var g;if(h=!0,r!=null&&(g=r.signal)!=null&&g.aborted)throw new s;o?t=await e(t,n,{signal:m}):(t=n,o=!0)}if(!h&&!o)throw new B}finally{l.abort()}return t}async function ee(e){e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`);let t=[];for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s(void 0,{cause:e.signal.reason});y(t,r)}return t}function te(e,t){let n=M.call(this,e,t);return async function*(){for await(let e of n)yield*e}.call(this)}function ne(e){if(e=S(e),C(e))return 0;if(e<0)throw new o(`number`,`>= 0`,e);return e}function re(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;e--<=0&&(yield n)}}.call(this)}function ie(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;if(e-- >0&&(yield n),e<=0)return}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:v(N,`readable.asIndexedPairs will be removed in a future version.`),drop:re,filter:z,flatMap:te,map:M,take:ie,compose:j},t.exports.promiseReturningOperators={every:F,forEach:R,reduce:V,toArray:ee,some:P,find:I}})),Qe=o(((e,t)=>{var{ArrayPrototypePop:n,Promise:r}=Ee(),{isIterable:i,isNodeStream:a,isWebStream:o}=Pe(),{pipelineImpl:s}=Ye(),{finished:c}=Fe();$e();function l(...e){return new r((t,r)=>{let c,l,u=e[e.length-1];if(u&&typeof u==`object`&&!a(u)&&!i(u)&&!o(u)){let t=n(e);c=t.signal,l=t.end}s(e,(e,n)=>{e?r(e):t(n)},{signal:c,end:l})})}t.exports={finished:c,pipeline:l}})),$e=o(((e,t)=>{var{Buffer:n}=f(),{ObjectDefineProperty:r,ObjectKeys:i,ReflectApply:a}=Ee(),{promisify:{custom:o}}=je(),{streamReturningOperators:s,promiseReturningOperators:c}=Ze(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:l}}=Oe(),u=Xe(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:p}=Be(),{pipeline:m}=Ye(),{destroyer:h}=Ie(),g=Fe(),_=Qe(),v=Pe(),y=t.exports=Le().Stream;y.isDestroyed=v.isDestroyed,y.isDisturbed=v.isDisturbed,y.isErrored=v.isErrored,y.isReadable=v.isReadable,y.isWritable=v.isWritable,y.Readable=We();for(let e of i(s)){let t=s[e];function n(...e){if(new.target)throw l();return y.Readable.from(a(t,this,e))}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}for(let e of i(c)){let t=c[e];function n(...e){if(new.target)throw l();return a(t,this,e)}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}y.Writable=Ge(),y.Duplex=U(),y.Transform=qe(),y.PassThrough=Je(),y.pipeline=m;var{addAbortSignal:b}=Re();y.addAbortSignal=b,y.finished=g,y.destroy=h,y.compose=u,y.setDefaultHighWaterMark=d,y.getDefaultHighWaterMark=p,r(y,`promises`,{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),r(m,o,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),r(g,o,{__proto__:null,enumerable:!0,get(){return _.finished}}),y.Stream=y,y._isUint8Array=function(e){return e instanceof Uint8Array},y._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}})),et=o(((e,t)=>{var n=$e(),r=Qe(),i=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=i,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,`promises`,{configurable:!0,enumerable:!0,get(){return r}}),t.exports.Stream=n.Stream,t.exports.default=t.exports})),tt=et(),nt=Symbol(`iter`);function rt(e,t,n=4){if(n===0)return Object.assign(e,t);for(let r in t)e[r]=rt(e[r]||Object.create(null),t[r],n-1);return e}function it(e,t,n=4){let r=!1;for(let i in e)if(i in t){let a=n===0?null:it(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}function at(e,t,n=4){let r=!1;for(let i in e)if(!(i in t))r||=Object.create(null),r[i]=n===0?null:rt({},e[i],n-1);else if(n!==0){let a=at(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}var ot=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[``]=1,this._entities=Object.create(null),this._entities[1]=``,this._blankNodeIndex=0,this._factory=e.factory||k}_termFromId(e){if(e[0]===`.`){let t=this._entities,n=e.split(`.`);return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return F(e,this._factory)}_termToNumericId(e){if(e.termType===`Quad`){let t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),r=this._termToNumericId(e.object),i;return t&&n&&r&&(le(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${n}.${r}.${i}`:`.${t}.${n}.${r}`]}return this._ids[I(e)]}_termToNewNumericId(e){let t=e&&e.termType===`Quad`?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${le(e.graph)?``:`.${this._termToNewNumericId(e.graph)}`}`:I(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+ n++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}},st=class e{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!=`function`&&(t=e,e=null),t||={},this._factory=t.factory||k,this._entityIndex=t.entityIndex||new ot({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),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let t=this._graphs,n,r;for(let i in t)for(let a in n=t[i].subjects)for(let t in r=n[a])e+=Object.keys(r[t]).length;return this._size=e}_addToIndex(e,t,n,r){let i=e[t]||(e[t]={}),a=i[n]||(i[n]={}),o=r in a;return o||(a[r]=null),!o}_removeFromIndex(e,t,n,r){let i=e[t],a=i[n];delete a[r];for(let e in a)return;delete i[n];for(let e in i)return;delete e[t]}*_findInIndex(e,t,n,r,i,a,o,s){let c,l,u,d=this._entities,f=this._termFromId(d[s]),p={subject:null,predicate:null,object:null};t&&((c=e,e={})[t]=c[t]);for(let t in e)if(l=e[t]){p[i]=this._termFromId(d[t]),n&&((c=l,l={})[n]=c[n]);for(let e in l)if(u=l[e]){p[a]=this._termFromId(d[e]);let t=r?r in u?[r]:[]:Object.keys(u);for(let e=0;e<t.length;e++)p[o]=this._termFromId(d[t[e]]),yield this._factory.quad(p.subject,p.predicate,p.object,f)}}}_loop(e,t){for(let n in e)t(n)}_loopByKey0(e,t,n){let r,i;if(r=e[t])for(i in r)n(i)}_loopByKey1(e,t,n){let r,i;for(r in e)i=e[r],i[t]&&n(r)}_loopBy2Keys(e,t,n,r){let i,a,o;if((i=e[t])&&(a=i[n]))for(o in a)r(o)}_countInIndex(e,t,n,r){let i=0,a,o,s;t&&((a=e,e={})[t]=a[t]);for(let t in e)if(o=e[t]){n&&((a=o,o={})[n]=a[n]);for(let e in o)(s=o[e])&&(r?r in s&&i++:i+=Object.keys(s).length)}return i}_getGraphs(e){return e=e===``?1:e&&(this._termToNumericId(e)||-1),typeof e==`number`?{[e]:this._graphs[e]}:this._graphs}_uniqueEntities(e){let t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r?this._termToNewNumericId(r):1;let i=this._graphs[r];return i||(i=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(i)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(i.subjects,e,t,n)?(this._addToIndex(i.predicates,t,n,e),this._addToIndex(i.objects,n,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,n,r){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:r}=e),!this.readQuads(e,t,n,r).next().done}import(e){return e.on(`data`,e=>{this.addQuad(e)}),e}removeQuad(e,t,n,r){t||({subject:e,predicate:t,object:n,graph:r}=e),r=r?this._termToNumericId(r):1;let i=this._graphs,a,o,s;if(!(e&&=this._termToNumericId(e))||!(t&&=this._termToNumericId(t))||!(n&&=this._termToNumericId(n))||!(a=i[r])||!(o=a.subjects[e])||!(s=o[t])||!(n in s))return!1;for(e in this._removeFromIndex(a.subjects,e,t,n),this._removeFromIndex(a.predicates,t,n,e),this._removeFromIndex(a.objects,n,e,t),this._size!==null&&this._size--,a.subjects)return!0;return delete i[r],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on(`data`,e=>{this.removeQuad(e)}),e}removeMatches(e,t,n,r){let i=new tt.Readable({objectMode:!0}),a=this.readQuads(e,t,n,r);return i._read=e=>{for(;--e>=0;){let{done:e,value:t}=a.next();if(e){i.push(null);return}i.push(t)}},this.remove(i)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,r){return[...this.readQuads(e,t,n,r)]}*readQuads(e,t,n,r){let i=this._getGraphs(r),a,o,s,c;if(!(e&&!(o=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n))))for(let e in i)(a=i[e])&&(o?c?yield*this._findInIndex(a.objects,c,o,s,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,o,s,null,`subject`,`predicate`,`object`,e):s?yield*this._findInIndex(a.predicates,s,c,null,`predicate`,`object`,`subject`,e):c?yield*this._findInIndex(a.objects,c,null,null,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,null,null,null,`subject`,`predicate`,`object`,e))}match(e,t,n,r){return new lt(this,e,t,n,r,{entityIndex:this._entityIndex})}countQuads(e,t,n,r){let i=this._getGraphs(r),a=0,o,s,c,l;if(e&&!(s=this._termToNumericId(e))||t&&!(c=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n)))return 0;for(let r in i)(o=i[r])&&(e?n?a+=this._countInIndex(o.objects,l,s,c):a+=this._countInIndex(o.subjects,s,c,l):t?a+=this._countInIndex(o.predicates,c,l,s):a+=this._countInIndex(o.objects,l,s,c));return a}forEach(e,t,n,r,i){this.some(t=>(e(t,this),!1),t,n,r,i)}every(e,t,n,r,i){return!this.some(t=>!e(t,this),t,n,r,i)}some(e,t,n,r,i){for(let a of this.readQuads(t,n,r,i))if(e(a,this))return!0;return!1}getSubjects(e,t,n){let r=[];return this.forSubjects(e=>{r.push(e)},e,t,n),r}forSubjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.predicates,o,s,e):this._loopByKey1(a.subjects,o,e):s?this._loopByKey0(a.objects,s,e):this._loop(a.subjects,e))}getPredicates(e,t,n){let r=[];return this.forPredicates(e=>{r.push(e)},e,t,n),r}forPredicates(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.objects,s,o,e):this._loopByKey0(a.subjects,o,e):s?this._loopByKey1(a.predicates,s,e):this._loop(a.predicates,e))}getObjects(e,t,n){let r=[];return this.forObjects(e=>{r.push(e)},e,t,n),r}forObjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.subjects,o,s,e):this._loopByKey1(a.objects,o,e):s?this._loopByKey0(a.predicates,s,e):this._loop(a.objects,e))}getGraphs(e,t,n){let r=[];return this.forGraphs(e=>{r.push(e)},e,t,n),r}forGraphs(e,t,n,r){for(let i in this._graphs)this.some(t=>(e(t.graph),!0),t,n,r,this._termFromId(this._entities[i]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){let n={},r=t?(()=>!0):((e,t)=>{throw Error(`${e.value} ${t}`)}),i=this.getQuads(null,g.rdf.rest,g.rdf.nil,null),a=e?[...i]:[];return i.forEach(t=>{let i=[],o=!1,s,c,l=t.graph,u=t.subject;for(;u&&!o;){let e=this.getQuads(null,null,u,null),t=this.getQuads(u,null,null,null),n,d=null,f=null,p=null;for(let i=0;i<t.length&&!o;i++)n=t[i],n.graph.equals(l)?s?o=r(u,`has non-list arcs out`):n.predicate.value===g.rdf.first?d?o=r(u,`has multiple rdf:first arcs`):a.push(d=n):n.predicate.value===g.rdf.rest?f?o=r(u,`has multiple rdf:rest arcs`):a.push(f=n):e.length?o=r(u,`can't be subject and object`):(s=n,c=`subject`):o=r(u,`not confined to single graph`);for(let t=0;t<e.length&&!o;++t)n=e[t],s?o=r(u,`can't have coreferences`):n.predicate.value===g.rdf.rest?p?o=r(u,`has incoming rdf:rest arcs`):p=n:(s=n,c=`object`);d?i.unshift(d.object):o=r(u,`has no list head`),u=p&&p.subject}o?e=!1:s&&(n[s[c].value]=i)}),e&&this.removeQuads(a),n}addAll(t){if(t instanceof lt&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof e&&t._entityIndex===this._entityIndex)t._size!==0&&(this._graphs=rt(this._graphs,t._graphs),this._size=null);else for(let e of t)this.add(e);return this}contains(t){if(t instanceof lt&&(t=t.filtered),t===this)return!0;if(!(t instanceof e)||this._entityIndex!==t._entityIndex)return t.every(e=>this.has(e));let n=this._graphs,r=t._graphs,i,a,o,s,c;for(let e in r){if(!(i=n[e]))return!1;i=i.subjects;for(let t in a=r[e].subjects){if(!(o=i[t]))return!1;for(let e in s=a[t]){if(!(c=o[e]))return!1;for(let t in s[e])if(!(t in c))return!1}}}return!0}deleteMatches(e,t,n,r){for(let i of this.match(e,t,n,r))this.removeQuad(i);return this}difference(t){if(t&&t instanceof lt&&(t=t.filtered),t===this)return new e({entityIndex:this._entityIndex});if(t instanceof e&&t._entityIndex===this._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=at(this._graphs,t._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>!t.has(e))}equals(e){return e instanceof lt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)t(e,this)&&n.add(e);return n}intersection(t){if(t instanceof lt&&(t=t.filtered),t===this){let t=new e({entityIndex:this._entityIndex});return t._graphs=rt(Object.create(null),this._graphs),t._size=this._size,t}else if(t instanceof e&&this._entityIndex===t._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=it(t._graphs,this._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>t.has(e))}map(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)n.add(t(e,this));return n}reduce(e,t){let n=this.readQuads(),r=t===void 0?n.next().value:t;for(let t of n)r=e(r,t,this);return r}toArray(){return this.getQuads()}toCanonical(){throw Error(`not implemented`)}toStream(){return this.match()}toString(){return new we().quadsToString(this)}union(t){let n=new e({entityIndex:this._entityIndex});return n._graphs=rt(Object.create(null),this._graphs),n._size=this._size,n.addAll(t),n}*[Symbol.iterator](){yield*this.readQuads()}};function ct(e,t,n=0){let r=t[n];if(r&&!(r in e))return!1;let i=!1;for(let a in r?{[r]:e[r]}:e){let r=n===2?null:ct(e[a],t,n+1);r!==!1&&(i||=Object.create(null),i[a]=r)}return i}var lt=class e extends tt.Readable{constructor(e,t,n,r,i,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:r,graph:i,options:a})}get filtered(){if(!this._filtered){let{n3Store:e,graph:t,object:n,predicate:r,subject:i}=this,a=this._filtered=new st({factory:e._factory,entityIndex:this.options.entityIndex}),o,s,c;if(i&&!(o=a._termToNumericId(i))||r&&!(s=a._termToNumericId(r))||n&&!(c=a._termToNumericId(n)))return a;let l=e._getGraphs(t);for(let e in l){let t,n,r,i;(i=l[e])&&(!o&&s?(n=ct(i.predicates,[s,c,o]))&&(t=ct(i.subjects,[o,s,c]),r=ct(i.objects,[c,o,s])):c?(r=ct(i.objects,[c,o,s]))&&(t=ct(i.subjects,[o,s,c]),n=ct(i.predicates,[s,c,o])):(t=ct(i.subjects,[o,s,c]))&&(n=ct(i.predicates,[s,c,o]),r=ct(i.objects,[c,o,s])),t&&(a._graphs[e]={subjects:t,predicates:n,objects:r}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[nt]&&(this[nt]=this[Symbol.iterator]());let t=this[nt];for(;--e>=0;){let{done:e,value:n}=t.next();if(e){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,r){return this.filtered.deleteMatches(e,t,n,r)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,r,i){return this.filtered.every(e,t,n,r,i)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,r,i){return this.filtered.forEach(e,t,n,r,i)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,r,i){return this.filtered.some(e,t,n,r,i)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,t){return this.filtered.reduce(e,t)}toString(){return new we().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(t,n,r,i){return new e(this.filtered,t,n,r,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}},ut=class extends tt.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let t=new oe(e),n,r,i={onQuad:(e,t)=>{e&&this.emit(`error`,e)||t&&this.push(t)},onPrefix:(e,t)=>{this.emit(`prefix`,e,t)}};e&&e.comments&&(i.onComment=e=>{this.emit(`comment`,e)}),t.parse({on:(e,t)=>{switch(e){case`data`:n=t;break;case`end`:r=t;break}}},i),this._transform=(e,t,r)=>{n(e),r()},this._flush=e=>{r(),e()}}import(e){return e.on(`data`,e=>{this.write(e)}),e.on(`end`,()=>{this.end()}),e.on(`error`,e=>{this.emit(`error`,e)}),this}},W=`http://www.w3.org/ns/shacl#`,dt=`http://datashapes.org/dash#`,ft=`http://www.w3.org/2001/XMLSchema#`,pt=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,mt=`http://www.w3.org/2000/01/rdf-schema#`,ht=`http://www.w3.org/2004/02/skos/core#`,gt=`http://www.w3.org/2002/07/owl#`,G=`http://www.w3.org/ns/oa#`,_t=`http://purl.org/dc/terms/`,vt=k.namedNode(`loaded-shapes`),yt=k.namedNode(`loaded-data`),bt=k.namedNode(pt+`type`),xt=k.namedNode(pt+`langString`),K=k.namedNode(_t+`conformsTo`),St=k.namedNode(mt+`subClassOf`),Ct=k.namedNode(gt+`imports`),wt=k.namedNode(ht+`broader`),Tt=k.namedNode(ht+`narrower`),Et=k.namedNode(W+`NodeShape`),Dt=k.namedNode(W+`IRI`),Ot=k.namedNode(W+`property`),kt=k.namedNode(W+`class`),At=k.namedNode(W+`node`),jt=k.namedNode(W+`targetClass`),Mt=k.namedNode(W+`nodeKind`),Nt=k.namedNode(ft+`string`),Pt=k.namedNode(ft+`boolean`);function Ft(e,t,n=W,r){let i=``,a=It(e,t,n,r);return a&&(i=a.value),i}function It(e,t,n=W,r){let i,a=n+t;if(r?.length){for(let t of r)for(let n of e)if(n.predicate.value===a){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf(`@`)<0?i=n.object:i||=n.object}}else for(let t of e)if(t.predicate.value===a)return t.object;return i}function Lt(e){e.querySelector(`.editor`)?.focus()}function Rt(e,t){return Ft(e,`prefLabel`,`http://www.w3.org/2004/02/skos/core#`,t)||Ft(e,`label`,`http://www.w3.org/2000/01/rdf-schema#`,t)||Ft(e,`title`,`http://purl.org/dc/terms/`,t)||Ft(e,`name`,`http://xmlns.com/foaf/0.1/`,t)}function zt(e,t,n){let r=[];for(let i of e)r.push({value:i,label:Rt(t.getQuads(i,null,null,null),n),children:[]});return r}function Bt(e,t){for(let n in t){let r=t[n];e.startsWith(r)&&(e=e.slice(r.length))}return e}function Vt(e,t,n,r,i=new Set){for(let a of t.owlImports)i.has(a.id)||(i.add(a.id),r.push(...n.getSubjects(bt,e,a)));t.parent&&Vt(e,t.parent,n,r,i)}function Ht(e,t){if(t.in){let e=t.config.lists[t.in];return zt(e?.length?e:[],t.config.store,t.config.languages)}else{let n=t.config.store.getSubjects(bt,e,vt);n.push(...t.config.store.getSubjects(bt,e,yt)),Vt(e,t,t.config.store,n);let r=new Map,i=new Map;for(let e of n)r.set(e.id,{value:e,label:Rt(t.config.store.getQuads(e,null,null,null),t.config.languages),children:[]});for(let e of n){for(let n of t.config.store.getObjects(e,wt,null))r.has(n.id)&&i.set(e.id,n.id);for(let n of t.config.store.getObjects(e,Tt,null))r.has(n.id)&&i.set(n.id,e.id);for(let n of t.config.store.getObjects(e,St,null))r.has(n.id)&&i.set(e.id,n.id)}for(let[e,t]of i.entries())r.get(t)?.children?.push(r.get(e));let a=[];for(let[e,t]of r.entries())i.has(e)||a.push(t);for(let n of t.config.store.getSubjects(St,e,null))a.push(...Ht(n,t));return a}}function Ut(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`}function q(e,t,n){if(t===void 0)return n;if(n===void 0)return t;let r=e.indexOf(t.language);if(r<0)return n;let i=e.indexOf(n.language);return i<0||i>r?t:n}function Wt(e,t){let n;for(let r of t)n=q(e,n,r);return n?n.value:``}function Gt(e){let t=new Set;for(let n of e.getObjects(null,kt,vt))t.add(n.value);for(let n of e.getObjects(null,jt,vt))t.add(n.value);return t}function Kt(e,t){return e instanceof Set?[...t].filter(t=>!e.has(t)):[...t].filter(t=>!e.includes(t))}function qt(e,{remove:t=!1,ignoreErrors:n=!1}={}){let r={},i=n?(()=>!0):((e,t)=>{throw Error(`${e.value} ${t}`)}),a=e.getQuads(null,pt+`rest`,pt+`nil`,null),o=t?[...a]:[];return a.forEach(n=>{let a=[],s=!1,c,l,u=n.graph,d=n.subject;for(;d&&!s;){let t=e.getQuads(null,null,d,null),n=e.getQuads(d,null,null,null).filter(e=>!e.predicate.equals(bt)),r,f=null,p=null,m=null;for(let e=0;e<n.length&&!s;e++)r=n[e],r.graph.equals(u)?c?s=i(d,`has non-list arcs out`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`?f?s=i(d,`has multiple rdf:first arcs`):o.push(f=r):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?p?s=i(d,`has multiple rdf:rest arcs`):o.push(p=r):t.length?s=i(d,`can't be subject and object`):(c=r,l=`subject`):s=i(d,`not confined to single graph`);for(let e=0;e<t.length&&!s;++e)r=t[e],c?s=i(d,`can't have coreferences`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?m?s=i(d,`has incoming rdf:rest arcs`):m=r:(c=r,l=`object`);f?a.unshift(f.object):s=i(d,`has no list head`),d=m&&m.subject}s?t=!1:c&&(r[c[l].value]=a)}),t&&e.removeQuads(o),r}var Jt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.removeDotSegmentsOfPath=e.removeDotSegments=e.resolve=void 0;function t(e,t){t||=``;let i=t.indexOf(`#`);if(i>0&&(t=t.substr(0,i)),!e.length){if(t.indexOf(`:`)<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);return t}if(e.startsWith(`?`)){let n=t.indexOf(`?`);return n>0&&(t=t.substr(0,n)),t+e}if(e.startsWith(`#`))return t+e;if(!t.length){let t=e.indexOf(`:`);if(t<0)throw Error(`Found invalid relative IRI '${e}' for a missing baseIRI`);return r(e,t)}let a=e.indexOf(`:`);if(a>=0)return r(e,a);let o=t.indexOf(`:`);if(o<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);let s=t.substr(0,o+1);if(e.indexOf(`//`)===0)return s+r(e,a);let c;if(t.indexOf(`//`,o)===o+1){if(c=t.indexOf(`/`,o+3),c<0)return t.length>o+3?t+`/`+r(e,a):s+r(e,a)}else if(c=t.indexOf(`/`,o+1),c<0)return s+r(e,a);if(e.indexOf(`/`)===0)return t.substr(0,c)+n(e);let l=t.substr(c),u=l.lastIndexOf(`/`);return u>=0&&u<l.length-1&&(l=l.substr(0,u+1),e[0]===`.`&&e[1]!==`.`&&e[1]!==`/`&&e[2]&&(e=e.substr(1))),e=l+e,e=n(e),t.substr(0,c)+e}e.resolve=t;function n(e){let t=[],n=0;for(;n<e.length;)switch(e[n]){case`/`:if(e[n+1]===`.`)if(e[n+2]===`.`){if(!i(e[n+3])){t.push([]),n++;break}t.pop(),e[n+3]||t.push([]),n+=3}else{if(!i(e[n+2])){t.push([]),n++;break}e[n+2]||t.push([]),n+=2}else t.push([]),n++;break;case`#`:case`?`:t.length||t.push([]),t[t.length-1].push(e.substr(n)),n=e.length;break;default:t.length||t.push([]),t[t.length-1].push(e[n]),n++;break}return`/`+t.map(e=>e.join(``)).join(`/`)}e.removeDotSegments=n;function r(e,t){let r=t+1;t>=0?e[t+1]===`/`&&e[t+2]===`/`&&(r=t+3):e[0]===`/`&&e[1]===`/`&&(r=2);let i=e.indexOf(`/`,r);return i<0?e:e.substr(0,i)+n(e.substr(i))}e.removeDotSegmentsOfPath=r;function i(e){return!e||e===`#`||e===`?`||e===`/`}})),Yt=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(Jt(),e)})),Xt=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`
|
|
16
|
+
`),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,r)=>{t=null,e(n,r)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}};function Te(e){let t=Se[e];return t===void 0&&(e.length===1?(t=e.charCodeAt(0).toString(16),t=`\\u0000`.substr(0,6-t.length)+t):(t=((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)+9216).toString(16),t=`\\U00000000`.substr(0,10-t.length)+t)),t}var Ee=o(((e,t)=>{t.exports={AggregateError:class extends Error{constructor(e){if(!Array.isArray(e))throw TypeError(`Expected input to be an Array, got ${typeof e}`);let t=``;for(let n=0;n<e.length;n++)t+=` ${e[n].stack}\n`;super(t),this.name=`AggregateError`,this.errors=e}},ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:2**53-1,NumberMIN_SAFE_INTEGER:-(2**53-1),NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,n){return Object.defineProperty(e,t,n)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,n){return e.then(t,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,n){return e.slice(t,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol(`Symbol.dispose`),SymbolAsyncDispose:Symbol.asyncDispose||Symbol(`Symbol.asyncDispose`),TypedArrayPrototypeSet(e,t,n){return e.set(t,n)},Boolean,Uint8Array}})),De=o(((e,t)=>{t.exports={format(e,...t){return e.replace(/%([sdifj])/g,function(...[e,n]){let r=t.shift();return n===`f`?r.toFixed(6):n===`j`?JSON.stringify(r):n===`s`&&typeof r==`object`?`${r.constructor===Object?``:r.constructor.name} {}`.trim():r.toString()})},inspect(e){switch(typeof e){case`string`:if(e.includes(`'`)){if(!e.includes(`"`))return`"${e}"`;if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}return`'${e}'`;case`number`:return isNaN(e)?`NaN`:Object.is(e,-0)?String(e):e;case`bigint`:return`${String(e)}n`;case`boolean`:case`undefined`:return String(e);case`object`:return`{}`}}}})),Oe=o(((e,t)=>{var{format:n,inspect:r}=De(),{AggregateError:i}=Ee(),a=globalThis.AggregateError||i,o=Symbol(`kIsNodeError`),s=[`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`],c=/^([A-Z][a-z0-9]*)+$/,l=`__node_internal_`,u={};function d(e,t){if(!e)throw new u.ERR_INTERNAL_ASSERTION(t)}function f(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function p(e,t,r){if(typeof t==`function`)return d(t.length<=r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${t.length}).`),t(...r);let i=(t.match(/%[dfijoOs]/g)||[]).length;return d(i===r.length,`Code: ${e}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?t:n(t,...r)}function m(e,t,n){n||=Error;class r extends n{constructor(...n){super(p(e,t,n))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[o]=!0,u[e]=r}function h(e){let t=l+e.name;return Object.defineProperty(e,`name`,{value:t}),e}function g(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;let n=new a([t,e],t.message);return n.code=t.code,n}return e||t}var _=class extends Error{constructor(e=`The operation was aborted`,t=void 0){if(t!==void 0&&typeof t!=`object`)throw new u.ERR_INVALID_ARG_TYPE(`options`,`Object`,t);super(e,t),this.code=`ABORT_ERR`,this.name=`AbortError`}};m(`ERR_ASSERTION`,`%s`,Error),m(`ERR_INVALID_ARG_TYPE`,(e,t,n)=>{d(typeof e==`string`,`'name' must be a string`),Array.isArray(t)||(t=[t]);let i=`The `;e.endsWith(` argument`)?i+=`${e} `:i+=`"${e}" ${e.includes(`.`)?`property`:`argument`} `,i+=`must be `;let a=[],o=[],l=[];for(let e of t)d(typeof e==`string`,`All expected entries have to be of type string`),s.includes(e)?a.push(e.toLowerCase()):c.test(e)?o.push(e):(d(e!==`object`,`The value "object" should be written as "Object"`),l.push(e));if(o.length>0){let e=a.indexOf(`object`);e!==-1&&(a.splice(a,e,1),o.push(`Object`))}if(a.length>0){switch(a.length){case 1:i+=`of type ${a[0]}`;break;case 2:i+=`one of type ${a[0]} or ${a[1]}`;break;default:{let e=a.pop();i+=`one of type ${a.join(`, `)}, or ${e}`}}(o.length>0||l.length>0)&&(i+=` or `)}if(o.length>0){switch(o.length){case 1:i+=`an instance of ${o[0]}`;break;case 2:i+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let e=o.pop();i+=`an instance of ${o.join(`, `)}, or ${e}`}}l.length>0&&(i+=` or `)}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(i+=`an `),i+=`${l[0]}`;break;case 2:i+=`one of ${l[0]} or ${l[1]}`;break;default:{let e=l.pop();i+=`one of ${l.join(`, `)}, or ${e}`}}if(n==null)i+=`. Received ${n}`;else if(typeof n==`function`&&n.name)i+=`. Received function ${n.name}`;else if(typeof n==`object`){var u;if((u=n.constructor)!=null&&u.name)i+=`. Received an instance of ${n.constructor.name}`;else{let e=r(n,{depth:-1});i+=`. Received ${e}`}}else{let e=r(n,{colors:!1});e.length>25&&(e=`${e.slice(0,25)}...`),i+=`. Received type ${typeof n} (${e})`}return i},TypeError),m(`ERR_INVALID_ARG_VALUE`,(e,t,n=`is invalid`)=>{let i=r(t);return i.length>128&&(i=i.slice(0,128)+`...`),`The ${e.includes(`.`)?`property`:`argument`} '${e}' ${n}. Received ${i}`},TypeError),m(`ERR_INVALID_RETURN_VALUE`,(e,t,n)=>{var r;return`Expected ${e} to be returned from the "${t}" function but got ${n!=null&&(r=n.constructor)!=null&&r.name?`instance of ${n.constructor.name}`:`type ${typeof n}`}.`},TypeError),m(`ERR_MISSING_ARGS`,(...e)=>{d(e.length>0,`At least one arg needs to be specified`);let t,n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(e=>`"${e}"`).join(` or `),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{let n=e.pop();t+=`The ${e.join(`, `)}, and ${n} arguments`}break}return`${t} must be specified`},TypeError),m(`ERR_OUT_OF_RANGE`,(e,t,n)=>{d(t,`Missing "range" argument`);let i;if(Number.isInteger(n)&&Math.abs(n)>2**32)i=f(String(n));else if(typeof n==`bigint`){i=String(n);let e=BigInt(2)**BigInt(32);(n>e||n<-e)&&(i=f(i)),i+=`n`}else i=r(n);return`The value of "${e}" is out of range. It must be ${t}. Received ${i}`},RangeError),m(`ERR_MULTIPLE_CALLBACK`,`Callback called multiple times`,Error),m(`ERR_METHOD_NOT_IMPLEMENTED`,`The %s method is not implemented`,Error),m(`ERR_STREAM_ALREADY_FINISHED`,`Cannot call %s after a stream was finished`,Error),m(`ERR_STREAM_CANNOT_PIPE`,`Cannot pipe, not readable`,Error),m(`ERR_STREAM_DESTROYED`,`Cannot call %s after a stream was destroyed`,Error),m(`ERR_STREAM_NULL_VALUES`,`May not write null values to stream`,TypeError),m(`ERR_STREAM_PREMATURE_CLOSE`,`Premature close`,Error),m(`ERR_STREAM_PUSH_AFTER_EOF`,`stream.push() after EOF`,Error),m(`ERR_STREAM_UNSHIFT_AFTER_END_EVENT`,`stream.unshift() after end event`,Error),m(`ERR_STREAM_WRITE_AFTER_END`,`write after end`,Error),m(`ERR_UNKNOWN_ENCODING`,`Unknown encoding: %s`,TypeError),t.exports={AbortError:_,aggregateTwoErrors:h(g),hideStackFrames:h,codes:u}})),ke=o(((e,t)=>{var{AbortController:n,AbortSignal:r}=typeof self<`u`?self:typeof window<`u`?window:void 0;t.exports=n,t.exports.AbortSignal=r,t.exports.default=n})),Ae=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),je=o(((e,t)=>{var n=f(),{format:r,inspect:i}=De(),{codes:{ERR_INVALID_ARG_TYPE:a}}=Oe(),{kResistStopPropagation:o,AggregateError:s,SymbolDispose:c}=Ee(),l=globalThis.AbortSignal||ke().AbortSignal,u=globalThis.AbortController||ke().AbortController,d=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||n.Blob,m=p===void 0?function(e){return!1}:function(e){return e instanceof p},h=(e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new a(t,`AbortSignal`,e)},g=(e,t)=>{if(typeof e!=`function`)throw new a(t,`Function`,e)};t.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(e){let t=!1;return function(...n){t||(t=!0,e.apply(this,n))}},createDeferredPromise:function(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},promisify(e){return new Promise((t,n)=>{e((e,...r)=>e?n(e):t(...r))})},debuglog(){return function(){}},format:r,inspect:i,types:{isAsyncFunction(e){return e instanceof d},isArrayBufferView(e){return ArrayBuffer.isView(e)}},isBlob:m,deprecate(e,t){return e},addAbortListener:Ae().addAbortListener||function(e,t){if(e===void 0)throw new a(`signal`,`AbortSignal`,e);h(e,`signal`),g(t,`listener`);let n;return e.aborted?queueMicrotask(()=>t()):(e.addEventListener(`abort`,t,{__proto__:null,once:!0,[o]:!0}),n=()=>{e.removeEventListener(`abort`,t)}),{__proto__:null,[c](){var e;(e=n)==null||e()}}},AbortSignalAny:l.any||function(e){if(e.length===1)return e[0];let t=new u,n=()=>t.abort();return e.forEach(e=>{h(e,`signals`),e.addEventListener(`abort`,n,{once:!0})}),t.signal.addEventListener(`abort`,()=>{e.forEach(e=>e.removeEventListener(`abort`,n))},{once:!0}),t.signal}},t.exports.promisify.custom=Symbol.for(`nodejs.util.promisify.custom`)})),Me=o(((e,t)=>{var{ArrayIsArray:n,ArrayPrototypeIncludes:r,ArrayPrototypeJoin:i,ArrayPrototypeMap:a,NumberIsInteger:o,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:c,NumberMIN_SAFE_INTEGER:l,NumberParseInt:u,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:f,String:p,StringPrototypeToUpperCase:m,StringPrototypeTrim:h}=Ee(),{hideStackFrames:g,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:y,ERR_OUT_OF_RANGE:b,ERR_UNKNOWN_SIGNAL:x}}=Oe(),{normalizeEncoding:S}=je(),{isAsyncFunction:C,isArrayBufferView:w}=je().types,T={};function E(e){return e===(e|0)}function D(e){return e===e>>>0}var O=/^[0-7]+$/,k=`must be a 32-bit unsigned integer or an octal string`;function A(e,t,n){if(e===void 0&&(e=n),typeof e==`string`){if(f(O,e)===null)throw new y(t,e,k);e=u(e,8)}return N(e,t),e}var j=g((e,t,n=l,r=c)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),M=g((e,t,n=-2147483648,r=2147483647)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);if(e<n||e>r)throw new b(t,`>= ${n} && <= ${r}`,e)}),N=g((e,t,n=!1)=>{if(typeof e!=`number`)throw new v(t,`number`,e);if(!o(e))throw new b(t,`an integer`,e);let r=+!!n,i=4294967295;if(e<r||e>i)throw new b(t,`>= ${r} && <= ${i}`,e)});function P(e,t){if(typeof e!=`string`)throw new v(t,`string`,e)}function F(e,t,n=void 0,r){if(typeof e!=`number`)throw new v(t,`number`,e);if(n!=null&&e<n||r!=null&&e>r||(n!=null||r!=null)&&s(e))throw new b(t,`${n==null?``:`>= ${n}`}${n!=null&&r!=null?` && `:``}${r==null?``:`<= ${r}`}`,e)}var I=g((e,t,n)=>{if(!r(n,e))throw new y(t,e,`must be one of: `+i(a(n,e=>typeof e==`string`?`'${e}'`:p(e)),`, `))});function R(e,t){if(typeof e!=`boolean`)throw new v(t,`boolean`,e)}function z(e,t,n){return e==null||!d(e,t)?n:e[t]}var B=g((e,t,r=null)=>{let i=z(r,`allowArray`,!1),a=z(r,`allowFunction`,!1);if(!z(r,`nullable`,!1)&&e===null||!i&&n(e)||typeof e!=`object`&&(!a||typeof e!=`function`))throw new v(t,`Object`,e)}),V=g((e,t)=>{if(e!=null&&typeof e!=`object`&&typeof e!=`function`)throw new v(t,`a dictionary`,e)}),ee=g((e,t,r=0)=>{if(!n(e))throw new v(t,`Array`,e);if(e.length<r)throw new y(t,e,`must be longer than ${r}`)});function te(e,t){ee(e,t);for(let n=0;n<e.length;n++)P(e[n],`${t}[${n}]`)}function ne(e,t){ee(e,t);for(let n=0;n<e.length;n++)R(e[n],`${t}[${n}]`)}function re(e,t){ee(e,t);for(let n=0;n<e.length;n++){let r=e[n],i=`${t}[${n}]`;if(r==null)throw new v(i,`AbortSignal`,r);ce(r,i)}}function ie(e,t=`signal`){if(P(e,t),T[e]===void 0)throw T[m(e)]===void 0?new x(e):new x(e+` (signals must use all capital letters)`)}var ae=g((e,t=`buffer`)=>{if(!w(e))throw new v(t,[`Buffer`,`TypedArray`,`DataView`],e)});function oe(e,t){let n=S(t),r=e.length;if(n===`hex`&&r%2!=0)throw new y(`encoding`,t,`is invalid for data of length ${r}`)}function se(e,t=`Port`,n=!0){if(typeof e!=`number`&&typeof e!=`string`||typeof e==`string`&&h(e).length===0||+e!=e>>>0||e>65535||e===0&&!n)throw new _(t,e,n);return e|0}var ce=g((e,t)=>{if(e!==void 0&&(typeof e!=`object`||!e||!(`aborted`in e)))throw new v(t,`AbortSignal`,e)}),le=g((e,t)=>{if(typeof e!=`function`)throw new v(t,`Function`,e)}),ue=g((e,t)=>{if(typeof e!=`function`||C(e))throw new v(t,`Function`,e)}),de=g((e,t)=>{if(e!==void 0)throw new v(t,`undefined`,e)});function fe(e,t,n){if(!r(n,e))throw new v(t,`('${i(n,`|`)}')`,e)}var pe=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function me(e,t){if(e===void 0||!f(pe,e))throw new y(t,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}function he(e){if(typeof e==`string`)return me(e,`hints`),e;if(n(e)){let t=e.length,n=``;if(t===0)return n;for(let r=0;r<t;r++){let i=e[r];me(i,`hints`),n+=i,r!==t-1&&(n+=`, `)}return n}throw new y(`hints`,e,`must be an array or string of format "</styles.css>; rel=preload; as=style"`)}t.exports={isInt32:E,isUint32:D,parseFileMode:A,validateArray:ee,validateStringArray:te,validateBooleanArray:ne,validateAbortSignalArray:re,validateBoolean:R,validateBuffer:ae,validateDictionary:V,validateEncoding:oe,validateFunction:le,validateInt32:M,validateInteger:j,validateNumber:F,validateObject:B,validateOneOf:I,validatePlainFunction:ue,validatePort:se,validateSignalName:ie,validateString:P,validateUint32:N,validateUndefined:de,validateUnion:fe,validateAbortSignal:ce,validateLinkHeaderValue:he}})),Ne=o(((e,t)=>{var n=t.exports={},r,i;function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}(function(){try{r=typeof setTimeout==`function`?setTimeout:a}catch{r=a}try{i=typeof clearTimeout==`function`?clearTimeout:o}catch{i=o}})();function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch{try{return r.call(null,e,0)}catch{return r.call(this,e,0)}}}function c(e){if(i===clearTimeout)return clearTimeout(e);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{return i(e)}catch{try{return i.call(null,e)}catch{return i.call(this,e)}}}var l=[],u=!1,d,f=-1;function p(){!u||!d||(u=!1,d.length?l=d.concat(l):f=-1,l.length&&m())}function m(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(d=l,l=[];++f<t;)d&&d[f].run();f=-1,t=l.length}d=null,u=!1,c(e)}}n.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new h(e,t)),l.length===1&&!u&&s(m)};function h(e,t){this.fun=e,this.array=t}h.prototype.run=function(){this.fun.apply(null,this.array)},n.title=`browser`,n.browser=!0,n.env={},n.argv=[],n.version=``,n.versions={};function g(){}n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(e){return[]},n.binding=function(e){throw Error(`process.binding is not supported`)},n.cwd=function(){return`/`},n.chdir=function(e){throw Error(`process.chdir is not supported`)},n.umask=function(){return 0}})),Pe=o(((e,t)=>{var{SymbolAsyncIterator:n,SymbolIterator:r,SymbolFor:i}=Ee(),a=i(`nodejs.stream.destroyed`),o=i(`nodejs.stream.errored`),s=i(`nodejs.stream.readable`),c=i(`nodejs.stream.writable`),l=i(`nodejs.stream.disturbed`),u=i(`nodejs.webstream.isClosedPromise`),d=i(`nodejs.webstream.controllerErrorFunction`);function f(e,t=!1){return!!(e&&typeof e.pipe==`function`&&typeof e.on==`function`&&(!t||typeof e.pause==`function`&&typeof e.resume==`function`)&&(!e._writableState||e._readableState?.readable!==!1)&&(!e._writableState||e._readableState))}function p(e){return!!(e&&typeof e.write==`function`&&typeof e.on==`function`&&(!e._readableState||e._writableState?.writable!==!1))}function m(e){return!!(e&&typeof e.pipe==`function`&&e._readableState&&typeof e.on==`function`&&typeof e.write==`function`)}function h(e){return e&&(e._readableState||e._writableState||typeof e.write==`function`&&typeof e.on==`function`||typeof e.pipe==`function`&&typeof e.on==`function`)}function g(e){return!!(e&&!h(e)&&typeof e.pipeThrough==`function`&&typeof e.getReader==`function`&&typeof e.cancel==`function`)}function _(e){return!!(e&&!h(e)&&typeof e.getWriter==`function`&&typeof e.abort==`function`)}function v(e){return!!(e&&!h(e)&&typeof e.readable==`object`&&typeof e.writable==`object`)}function y(e){return g(e)||_(e)||v(e)}function b(e,t){return e==null?!1:t===!0?typeof e[n]==`function`:t===!1?typeof e[r]==`function`:typeof e[n]==`function`||typeof e[r]==`function`}function x(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[a]||r!=null&&r.destroyed)}function S(e){if(!p(e))return null;if(e.writableEnded===!0)return!0;let t=e._writableState;return t!=null&&t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function C(e,t){if(!p(e))return null;if(e.writableFinished===!0)return!0;let n=e._writableState;return n!=null&&n.errored?!1:typeof n?.finished==`boolean`?!!(n.finished||t===!1&&n.ended===!0&&n.length===0):null}function w(e){if(!f(e))return null;if(e.readableEnded===!0)return!0;let t=e._readableState;return!t||t.errored?!1:typeof t?.ended==`boolean`?t.ended:null}function T(e,t){if(!f(e))return null;let n=e._readableState;return n!=null&&n.errored?!1:typeof n?.endEmitted==`boolean`?!!(n.endEmitted||t===!1&&n.ended===!0&&n.length===0):null}function E(e){return e&&e[s]!=null?e[s]:typeof e?.readable==`boolean`?x(e)?!1:f(e)&&e.readable&&!T(e):null}function D(e){return e&&e[c]!=null?e[c]:typeof e?.writable==`boolean`?x(e)?!1:p(e)&&e.writable&&!S(e):null}function O(e,t){return h(e)?x(e)?!0:!(t?.readable!==!1&&E(e)||t?.writable!==!1&&D(e)):null}function k(e){return h(e)?e.writableErrored?e.writableErrored:e._writableState?.errored??null:null}function A(e){return h(e)?e.readableErrored?e.readableErrored:e._readableState?.errored??null:null}function j(e){if(!h(e))return null;if(typeof e.closed==`boolean`)return e.closed;let t=e._writableState,n=e._readableState;return typeof t?.closed==`boolean`||typeof n?.closed==`boolean`?t?.closed||n?.closed:typeof e._closed==`boolean`&&M(e)?e._closed:null}function M(e){return typeof e._closed==`boolean`&&typeof e._defaultKeepAlive==`boolean`&&typeof e._removedConnection==`boolean`&&typeof e._removedContLen==`boolean`}function N(e){return typeof e._sent100==`boolean`&&M(e)}function P(e){return typeof e._consuming==`boolean`&&typeof e._dumped==`boolean`&&e.req?.upgradeOrConnect===void 0}function F(e){if(!h(e))return null;let t=e._writableState,n=e._readableState,r=t||n;return!r&&N(e)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function I(e){return!!(e&&(e[l]??(e.readableDidRead||e.readableAborted)))}function R(e){return!!(e&&(e[o]??e.readableErrored??e.writableErrored??e._readableState?.errorEmitted??e._writableState?.errorEmitted??e._readableState?.errored??e._writableState?.errored))}t.exports={isDestroyed:x,kIsDestroyed:a,isDisturbed:I,kIsDisturbed:l,isErrored:R,kIsErrored:o,isReadable:E,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:d,kIsWritable:c,isClosed:j,isDuplexNodeStream:m,isFinished:O,isIterable:b,isReadableNodeStream:f,isReadableStream:g,isReadableEnded:w,isReadableFinished:T,isReadableErrored:A,isNodeStream:h,isWebStream:y,isWritable:D,isWritableNodeStream:p,isWritableStream:_,isWritableEnded:S,isWritableFinished:C,isWritableErrored:k,isServerRequest:P,isServerResponse:N,willEmitClose:F,isTransformStream:v}})),Fe=o(((e,t)=>{var n=Ne(),{AbortError:r,codes:i}=Oe(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_PREMATURE_CLOSE:o}=i,{kEmptyObject:s,once:c}=je(),{validateAbortSignal:l,validateFunction:u,validateObject:d,validateBoolean:f}=Me(),{Promise:p,PromisePrototypeThen:m,SymbolDispose:h}=Ee(),{isClosed:g,isReadable:_,isReadableNodeStream:v,isReadableStream:y,isReadableFinished:b,isReadableErrored:x,isWritable:S,isWritableNodeStream:C,isWritableStream:w,isWritableFinished:T,isWritableErrored:E,isNodeStream:D,willEmitClose:O,kIsClosedPromise:k}=Pe(),A;function j(e){return e.setHeader&&typeof e.abort==`function`}var M=()=>{};function N(e,t,i){if(arguments.length===2?(i=t,t=s):t==null?t=s:d(t,`options`),u(i,`callback`),l(t.signal,`options.signal`),i=c(i),y(e)||w(e))return P(e,t,i);if(!D(e))throw new a(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],e);let f=t.readable??v(e),p=t.writable??C(e),m=e._writableState,k=e._readableState,N=()=>{e.writable||R()},F=O(e)&&v(e)===f&&C(e)===p,I=T(e,!1),R=()=>{I=!0,e.destroyed&&(F=!1),!(F&&(!e.readable||f))&&(!f||z)&&i.call(e)},z=b(e,!1),B=()=>{z=!0,e.destroyed&&(F=!1),!(F&&(!e.writable||p))&&(!p||I)&&i.call(e)},V=t=>{i.call(e,t)},ee=g(e),te=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);if(f&&!z&&v(e,!0)&&!b(e,!1)||p&&!I&&!T(e,!1))return i.call(e,new o);i.call(e)},ne=()=>{ee=!0;let t=E(e)||x(e);if(t&&typeof t!=`boolean`)return i.call(e,t);i.call(e)},re=()=>{e.req.on(`finish`,R)};j(e)?(e.on(`complete`,R),F||e.on(`abort`,te),e.req?re():e.on(`request`,re)):p&&!m&&(e.on(`end`,N),e.on(`close`,N)),!F&&typeof e.aborted==`boolean`&&e.on(`aborted`,te),e.on(`end`,B),e.on(`finish`,R),t.error!==!1&&e.on(`error`,V),e.on(`close`,te),ee?n.nextTick(te):m!=null&&m.errorEmitted||k!=null&&k.errorEmitted?F||n.nextTick(ne):(!f&&(!F||_(e))&&(I||S(e)===!1)||!p&&(!F||S(e))&&(z||_(e)===!1)||k&&e.req&&e.aborted)&&n.nextTick(ne);let ie=()=>{i=M,e.removeListener(`aborted`,te),e.removeListener(`complete`,R),e.removeListener(`abort`,te),e.removeListener(`request`,re),e.req&&e.req.removeListener(`finish`,R),e.removeListener(`end`,N),e.removeListener(`close`,N),e.removeListener(`finish`,R),e.removeListener(`end`,B),e.removeListener(`error`,V),e.removeListener(`close`,te)};if(t.signal&&!ee){let a=()=>{let n=i;ie(),n.call(e,new r(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)n.nextTick(a);else{A||=je().addAbortListener;let n=A(t.signal,a),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}}return ie}function P(e,t,i){let a=!1,o=M;if(t.signal)if(o=()=>{a=!0,i.call(e,new r(void 0,{cause:t.signal.reason}))},t.signal.aborted)n.nextTick(o);else{A||=je().addAbortListener;let n=A(t.signal,o),r=i;i=c((...t)=>{n[h](),r.apply(e,t)})}let s=(...t)=>{a||n.nextTick(()=>i.apply(e,t))};return m(e[k].promise,s,s),M}function F(e,t){var n;let r=!1;return t===null&&(t=s),(n=t)!=null&&n.cleanup&&(f(t.cleanup,`cleanup`),r=t.cleanup),new p((n,i)=>{let a=N(e,t,e=>{r&&a(),e?i(e):n()})})}t.exports=N,t.exports.finished=F})),Ie=o(((e,t)=>{var n=Ne(),{aggregateTwoErrors:r,codes:{ERR_MULTIPLE_CALLBACK:i},AbortError:a}=Oe(),{Symbol:o}=Ee(),{kIsDestroyed:s,isDestroyed:c,isFinished:l,isServerRequest:u}=Pe(),d=o(`kDestroy`),f=o(`kConstruct`);function p(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function m(e,t){let n=this._readableState,i=this._writableState,a=i||n;return i!=null&&i.destroyed||n!=null&&n.destroyed?(typeof t==`function`&&t(),this):(p(e,i,n),i&&(i.destroyed=!0),n&&(n.destroyed=!0),a.constructed?h(this,e,t):this.once(d,function(n){h(this,r(n,e),t)}),this)}function h(e,t,r){let i=!1;function a(t){if(i)return;i=!0;let a=e._readableState,o=e._writableState;p(t,o,a),o&&(o.closed=!0),a&&(a.closed=!0),typeof r==`function`&&r(t),t?n.nextTick(g,e,t):n.nextTick(_,e)}try{e._destroy(t||null,a)}catch(e){a(e)}}function g(e,t){v(e,t),_(e)}function _(e){let t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&e.emit(`close`)}function v(e,t){let n=e._readableState,r=e._writableState;r!=null&&r.errorEmitted||n!=null&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit(`error`,t))}function y(){let e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function b(e,t,r){let i=e._readableState,a=e._writableState;if(a!=null&&a.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||a!=null&&a.autoDestroy?e.destroy(t):t&&(t.stack,a&&!a.errored&&(a.errored=t),i&&!i.errored&&(i.errored=t),r?n.nextTick(v,e,t):v(e,t))}function x(e,t){if(typeof e._construct!=`function`)return;let r=e._readableState,i=e._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),e.once(f,t),!(e.listenerCount(f)>1)&&n.nextTick(S,e)}function S(e){let t=!1;function r(r){if(t){b(e,r??new i);return}t=!0;let a=e._readableState,o=e._writableState,s=o||a;a&&(a.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(d,r):r?b(e,r,!0):n.nextTick(C,e)}try{e._construct(e=>{n.nextTick(r,e)})}catch(e){n.nextTick(r,e)}}function C(e){e.emit(f)}function w(e){return e?.setHeader&&typeof e.abort==`function`}function T(e){e.emit(`close`)}function E(e,t){e.emit(`error`,t),n.nextTick(T,e)}function D(e,t){!e||c(e)||(!t&&!l(e)&&(t=new a),u(e)?(e.socket=null,e.destroy(t)):w(e)?e.abort():w(e.req)?e.req.abort():typeof e.destroy==`function`?e.destroy(t):typeof e.close==`function`?e.close():t?n.nextTick(E,e,t):n.nextTick(T,e),e.destroyed||(e[s]=!0))}t.exports={construct:x,destroyer:D,destroy:m,undestroy:y,errorOrDestroy:b}})),Le=o(((e,t)=>{var{ArrayIsArray:n,ObjectSetPrototypeOf:r}=Ee(),{EventEmitter:i}=Ae();function a(e){i.call(this,e)}r(a.prototype,i.prototype),r(a,i),a.prototype.pipe=function(e,t){let n=this;function r(t){e.writable&&e.write(t)===!1&&n.pause&&n.pause()}n.on(`data`,r);function a(){n.readable&&n.resume&&n.resume()}e.on(`drain`,a),!e._isStdio&&(!t||t.end!==!1)&&(n.on(`end`,c),n.on(`close`,l));let s=!1;function c(){s||(s=!0,e.end())}function l(){s||(s=!0,typeof e.destroy==`function`&&e.destroy())}function u(e){d(),i.listenerCount(this,`error`)===0&&this.emit(`error`,e)}o(n,`error`,u),o(e,`error`,u);function d(){n.removeListener(`data`,r),e.removeListener(`drain`,a),n.removeListener(`end`,c),n.removeListener(`close`,l),n.removeListener(`error`,u),e.removeListener(`error`,u),n.removeListener(`end`,d),n.removeListener(`close`,d),e.removeListener(`close`,d)}return n.on(`end`,d),n.on(`close`,d),e.on(`close`,d),e.emit(`pipe`,n),e};function o(e,t,r){if(typeof e.prependListener==`function`)return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):n(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}t.exports={Stream:a,prependListener:o}})),Re=o(((e,t)=>{var{SymbolDispose:n}=Ee(),{AbortError:r,codes:i}=Oe(),{isNodeStream:a,isWebStream:o,kControllerErrorFunction:s}=Pe(),c=Fe(),{ERR_INVALID_ARG_TYPE:l}=i,u,d=(e,t)=>{if(typeof e!=`object`||!(`aborted`in e))throw new l(t,`AbortSignal`,e)};t.exports.addAbortSignal=function(e,n){if(d(e,`signal`),!a(n)&&!o(n))throw new l(`stream`,[`ReadableStream`,`WritableStream`,`Stream`],n);return t.exports.addAbortSignalNoValidate(e,n)},t.exports.addAbortSignalNoValidate=function(e,t){if(typeof e!=`object`||!(`aborted`in e))return t;let i=a(t)?()=>{t.destroy(new r(void 0,{cause:e.reason}))}:()=>{t[s](new r(void 0,{cause:e.reason}))};return e.aborted?i():(u||=je().addAbortListener,c(t,u(e,i)[n])),t}})),ze=o(((e,t)=>{var{StringPrototypeSlice:n,SymbolIterator:r,TypedArrayPrototypeSet:i,Uint8Array:a}=Ee(),{Buffer:o}=f(),{inspect:s}=je();t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}unshift(e){let t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return``;let t=this.head,n=``+t.data;for(;(t=t.next)!==null;)n+=e+t.data;return n}concat(e){if(this.length===0)return o.alloc(0);let t=o.allocUnsafe(e>>>0),n=this.head,r=0;for(;n;)i(t,n.data,r),r+=n.data.length,n=n.next;return t}consume(e,t){let n=this.head.data;if(e<n.length){let t=n.slice(0,e);return this.head.data=n.slice(e),t}return e===n.length?this.shift():t?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[r](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let t=``,r=this.head,i=0;do{let a=r.data;if(e>a.length)t+=a,e-=a.length;else{e===a.length?(t+=a,++i,r.next?this.head=r.next:this.head=this.tail=null):(t+=n(a,0,e),this.head=r,r.data=n(a,e));break}++i}while((r=r.next)!==null);return this.length-=i,t}_getBuffer(e){let t=o.allocUnsafe(e),n=e,r=this.head,s=0;do{let o=r.data;if(e>o.length)i(t,o,n-e),e-=o.length;else{e===o.length?(i(t,o,n-e),++s,r.next?this.head=r.next:this.head=this.tail=null):(i(t,new a(o.buffer,o.byteOffset,e),n-e),this.head=r,r.data=o.slice(e));break}++s}while((r=r.next)!==null);return this.length-=s,t}[Symbol.for(`nodejs.util.inspect.custom`)](e,t){return s(this,{...t,depth:0,customInspect:!1})}}})),Be=o(((e,t)=>{var{MathFloor:n,NumberIsInteger:r}=Ee(),{validateInteger:i}=Me(),{ERR_INVALID_ARG_VALUE:a}=Oe().codes,o=16*1024,s=16;function c(e,t,n){return e.highWaterMark==null?t?e[n]:null:e.highWaterMark}function l(e){return e?s:o}function u(e,t){i(t,`value`,0),e?s=t:o=t}function d(e,t,i,o){let s=c(t,o,i);if(s!=null){if(!r(s)||s<0)throw new a(o?`options.${i}`:`options.highWaterMark`,s);return n(s)}return l(e.objectMode)}t.exports={getHighWaterMark:d,getDefaultHighWaterMark:l,setDefaultHighWaterMark:u}})),Ve=o(((e,t)=>{var n=f(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),He=o((e=>{var t=Ve().Buffer,n=t.isEncoding||function(e){switch(e=``+e,e&&e.toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:case`raw`:return!0;default:return!1}};function r(e){if(!e)return`utf8`;for(var t;;)switch(e){case`utf8`:case`utf-8`:return`utf8`;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return`utf16le`;case`latin1`:case`binary`:return`latin1`;case`base64`:case`ascii`:case`hex`:return e;default:if(t)return;e=(``+e).toLowerCase(),t=!0}}function i(e){var i=r(e);if(typeof i!=`string`&&(t.isEncoding===n||!n(e)))throw Error(`Unknown encoding: `+e);return i||e}e.StringDecoder=a;function a(e){this.encoding=i(e);var n;switch(this.encoding){case`utf16le`:this.text=f,this.end=p,n=4;break;case`utf8`:this.fillLast=l,n=4;break;case`base64`:this.text=m,this.end=h,n=3;break;default:this.write=g,this.end=_;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=t.allocUnsafe(n)}a.prototype.write=function(e){if(e.length===0)return``;var t,n;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return``;n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||``},a.prototype.end=d,a.prototype.text=u,a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length};function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||i===-2?0:(i=o(t[r]),i>=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function c(e,t,n){if((t[0]&192)!=128)return e.lastNeed=0,`�`;if(e.lastNeed>1&&t.length>1){if((t[1]&192)!=128)return e.lastNeed=1,`�`;if(e.lastNeed>2&&t.length>2&&(t[2]&192)!=128)return e.lastNeed=2,`�`}}function l(e){var t=this.lastTotal-this.lastNeed,n=c(this,e,t);if(n!==void 0)return n;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function u(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString(`utf8`,t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString(`utf8`,t,r)}function d(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+`�`:t}function f(e,t){if((e.length-t)%2==0){var n=e.toString(`utf16le`,t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString(`utf16le`,t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):``;if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString(`utf16le`,0,n)}return t}function m(e,t){var n=(e.length-t)%3;return n===0?e.toString(`base64`,t):(this.lastNeed=3-n,this.lastTotal=3,n===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString(`base64`,t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):``;return this.lastNeed?t+this.lastChar.toString(`base64`,0,3-this.lastNeed):t}function g(e){return e.toString(this.encoding)}function _(e){return e&&e.length?this.write(e):``}})),Ue=o(((e,t)=>{var n=Ne(),{PromisePrototypeThen:r,SymbolAsyncIterator:i,SymbolIterator:a}=Ee(),{Buffer:o}=f(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:c}=Oe().codes;function l(e,t,l){let u;if(typeof t==`string`||t instanceof o)return new e({objectMode:!0,...l,read(){this.push(t),this.push(null)}});let d;if(t&&t[i])d=!0,u=t[i]();else if(t&&t[a])d=!1,u=t[a]();else throw new s(`iterable`,[`Iterable`],t);let f=new e({objectMode:!0,highWaterMark:1,...l}),p=!1;f._read=function(){p||(p=!0,h())},f._destroy=function(e,t){r(m(e),()=>n.nextTick(t,e),r=>n.nextTick(t,r||e))};async function m(e){let t=e!=null,n=typeof u.throw==`function`;if(t&&n){let{value:t,done:n}=await u.throw(e);if(await t,n)return}if(typeof u.return==`function`){let{value:e}=await u.return();await e}}async function h(){for(;;){try{let{value:e,done:t}=d?await u.next():u.next();if(t)f.push(null);else{let t=e&&typeof e.then==`function`?await e:e;if(t===null)throw p=!1,new c;if(f.push(t))continue;p=!1}}catch(e){f.destroy(e)}break}}return f}t.exports=l})),We=o(((e,t)=>{var n=Ne(),{ArrayPrototypeIndexOf:r,NumberIsInteger:i,NumberIsNaN:a,NumberParseInt:o,ObjectDefineProperties:s,ObjectKeys:c,ObjectSetPrototypeOf:l,Promise:u,SafeSet:d,SymbolAsyncDispose:p,SymbolAsyncIterator:m,Symbol:h}=Ee();t.exports=H,H.ReadableState=ye;var{EventEmitter:g}=Ae(),{Stream:_,prependListener:v}=Le(),{Buffer:y}=f(),{addAbortSignal:b}=Re(),x=Fe(),S=je().debuglog(`stream`,e=>{S=e}),C=ze(),w=Ie(),{getHighWaterMark:T,getDefaultHighWaterMark:E}=Be(),{aggregateTwoErrors:D,codes:{ERR_INVALID_ARG_TYPE:O,ERR_METHOD_NOT_IMPLEMENTED:k,ERR_OUT_OF_RANGE:A,ERR_STREAM_PUSH_AFTER_EOF:j,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:M},AbortError:N}=Oe(),{validateObject:P}=Me(),F=h(`kPaused`),{StringDecoder:I}=He(),R=Ue();l(H.prototype,_.prototype),l(H,_);var z=()=>{},{errorOrDestroy:B}=w,V=1,ee=2,te=4,ne=8,re=16,ie=32,ae=64,oe=128,se=256,ce=512,le=1024,ue=2048,de=4096,fe=8192,pe=16384,me=32768,he=65536,ge=1<<17,_e=1<<18;function ve(e){return{enumerable:!1,get(){return(this.state&e)!==0},set(t){t?this.state|=e:this.state&=~e}}}s(ye.prototype,{objectMode:ve(V),ended:ve(ee),endEmitted:ve(te),reading:ve(ne),constructed:ve(re),sync:ve(ie),needReadable:ve(ae),emittedReadable:ve(oe),readableListening:ve(se),resumeScheduled:ve(ce),errorEmitted:ve(le),emitClose:ve(ue),autoDestroy:ve(de),destroyed:ve(fe),closed:ve(pe),closeEmitted:ve(me),multiAwaitDrain:ve(he),readingMore:ve(ge),dataEmitted:ve(_e)});function ye(e,t,n){typeof n!=`boolean`&&(n=t instanceof U()),this.state=6192,e&&e.objectMode&&(this.state|=V),n&&e&&e.readableObjectMode&&(this.state|=V),this.highWaterMark=e?T(this,e,`readableHighWaterMark`,n):E(!1),this.buffer=new C,this.length=0,this.pipes=[],this.flowing=null,this[F]=null,e&&e.emitClose===!1&&(this.state&=~ue),e&&e.autoDestroy===!1&&(this.state&=~de),this.errored=null,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,e&&e.encoding&&(this.decoder=new I(e.encoding),this.encoding=e.encoding)}function H(e){if(!(this instanceof H))return new H(e);let t=this instanceof U();this._readableState=new ye(e,this,t),e&&(typeof e.read==`function`&&(this._read=e.read),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&!t&&b(e.signal,this)),_.call(this,e),w.construct(this,()=>{this._readableState.needReadable&&Pe(this,this._readableState)})}H.prototype.destroy=w.destroy,H.prototype._undestroy=w.undestroy,H.prototype._destroy=function(e,t){t(e)},H.prototype[g.captureRejectionSymbol]=function(e){this.destroy(e)},H.prototype[p]=function(){let e;return this.destroyed||(e=this.readableEnded?null:new N,this.destroy(e)),new u((t,n)=>x(this,r=>r&&r!==e?n(r):t(null)))},H.prototype.push=function(e,t){return be(this,e,t,!1)},H.prototype.unshift=function(e,t){return be(this,e,t,!0)};function be(e,t,n,r){S(`readableAddChunk`,t);let i=e._readableState,a;if((i.state&V)===0&&(typeof t==`string`?(n||=i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?t=y.from(t,n).toString(i.encoding):(t=y.from(t,n),n=``))):t instanceof y?n=``:_._isUint8Array(t)?(t=_._uint8ArrayToBuffer(t),n=``):t!=null&&(a=new O(`chunk`,[`string`,`Buffer`,`Uint8Array`],t))),a)B(e,a);else if(t===null)i.state&=~ne,Te(e,i);else if((i.state&V)!==0||t&&t.length>0)if(r)if((i.state&te)!==0)B(e,new M);else if(i.destroyed||i.errored)return!1;else xe(e,i,t,!0);else if(i.ended)B(e,new j);else if(i.destroyed||i.errored)return!1;else i.state&=~ne,i.decoder&&!n?(t=i.decoder.write(t),i.objectMode||t.length!==0?xe(e,i,t,!1):Pe(e,i)):xe(e,i,t,!1);else r||(i.state&=~ne,Pe(e,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function xe(e,t,n,r){t.flowing&&t.length===0&&!t.sync&&e.listenerCount(`data`)>0?((t.state&he)===0?t.awaitDrainWriters=null:t.awaitDrainWriters.clear(),t.dataEmitted=!0,e.emit(`data`,n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),(t.state&ae)!==0&&De(e)),Pe(e,t)}H.prototype.isPaused=function(){let e=this._readableState;return e[F]===!0||e.flowing===!1},H.prototype.setEncoding=function(e){let t=new I(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;let n=this._readableState.buffer,r=``;for(let e of n)r+=t.write(e);return n.clear(),r!==``&&n.push(r),this._readableState.length=r.length,this};var Se=1073741824;function Ce(e){if(e>Se)throw new A(`size`,`<= 1GiB`,e);return e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++,e}function we(e,t){return e<=0||t.length===0&&t.ended?0:(t.state&V)===0?a(e)?t.flowing&&t.length?t.buffer.first().length:t.length:e<=t.length?e:t.ended?t.length:0:1}H.prototype.read=function(e){S(`read`,e),e===void 0?e=NaN:i(e)||(e=o(e,10));let t=this._readableState,n=e;if(e>t.highWaterMark&&(t.highWaterMark=Ce(e)),e!==0&&(t.state&=~oe),e===0&&t.needReadable&&((t.highWaterMark===0?t.length>0:t.length>=t.highWaterMark)||t.ended))return S(`read: emitReadable`,t.length,t.ended),t.length===0&&t.ended?$e(this):De(this),null;if(e=we(e,t),e===0&&t.ended)return t.length===0&&$e(this),null;let r=(t.state&ae)!==0;if(S(`need readable`,r),(t.length===0||t.length-e<t.highWaterMark)&&(r=!0,S(`length less than watermark`,r)),t.ended||t.reading||t.destroyed||t.errored||!t.constructed)r=!1,S(`reading, ended or constructing`,r);else if(r){S(`do read`),t.state|=ne|ie,t.length===0&&(t.state|=ae);try{this._read(t.highWaterMark)}catch(e){B(this,e)}t.state&=~ie,t.reading||(e=we(n,t))}let a;return a=e>0?Qe(e,t):null,a===null?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.multiAwaitDrain?t.awaitDrainWriters.clear():t.awaitDrainWriters=null),t.length===0&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&$e(this)),a!==null&&!t.errorEmitted&&!t.closeEmitted&&(t.dataEmitted=!0,this.emit(`data`,a)),a};function Te(e,t){if(S(`onEofChunk`),!t.ended){if(t.decoder){let e=t.decoder.end();e&&e.length&&(t.buffer.push(e),t.length+=t.objectMode?1:e.length)}t.ended=!0,t.sync?De(e):(t.needReadable=!1,t.emittedReadable=!0,ke(e))}}function De(e){let t=e._readableState;S(`emitReadable`,t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(S(`emitReadable`,t.flowing),t.emittedReadable=!0,n.nextTick(ke,e))}function ke(e){let t=e._readableState;S(`emitReadable_`,t.destroyed,t.length,t.ended),!t.destroyed&&!t.errored&&(t.length||t.ended)&&(e.emit(`readable`),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,Ye(e)}function Pe(e,t){!t.readingMore&&t.constructed&&(t.readingMore=!0,n.nextTick(Ve,e,t))}function Ve(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&t.length===0);){let n=t.length;if(S(`maybeReadMore read 0`),e.read(0),n===t.length)break}t.readingMore=!1}H.prototype._read=function(e){throw new k(`_read()`)},H.prototype.pipe=function(e,t){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new d(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(e),S(`pipe count=%d opts=%j`,i.pipes.length,t);let a=(!t||t.end!==!1)&&e!==n.stdout&&e!==n.stderr?s:_;i.endEmitted?n.nextTick(a):r.once(`end`,a),e.on(`unpipe`,o);function o(e,t){S(`onunpipe`),e===r&&t&&t.hasUnpiped===!1&&(t.hasUnpiped=!0,u())}function s(){S(`onend`),e.end()}let c,l=!1;function u(){S(`cleanup`),e.removeListener(`close`,h),e.removeListener(`finish`,g),c&&e.removeListener(`drain`,c),e.removeListener(`error`,m),e.removeListener(`unpipe`,o),r.removeListener(`end`,s),r.removeListener(`end`,_),r.removeListener(`data`,p),l=!0,c&&i.awaitDrainWriters&&(!e._writableState||e._writableState.needDrain)&&c()}function f(){l||(i.pipes.length===1&&i.pipes[0]===e?(S(`false write response, pause`,0),i.awaitDrainWriters=e,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(e)&&(S(`false write response, pause`,i.awaitDrainWriters.size),i.awaitDrainWriters.add(e)),r.pause()),c||(c=We(r,e),e.on(`drain`,c))}r.on(`data`,p);function p(t){S(`ondata`);let n=e.write(t);S(`dest.write`,n),n===!1&&f()}function m(t){if(S(`onerror`,t),_(),e.removeListener(`error`,m),e.listenerCount(`error`)===0){let n=e._writableState||e._readableState;n&&!n.errorEmitted?B(e,t):e.emit(`error`,t)}}v(e,`error`,m);function h(){e.removeListener(`finish`,g),_()}e.once(`close`,h);function g(){S(`onfinish`),e.removeListener(`close`,h),_()}e.once(`finish`,g);function _(){S(`unpipe`),r.unpipe(e)}return e.emit(`pipe`,r),e.writableNeedDrain===!0?f():i.flowing||(S(`pipe resume`),r.resume()),e};function We(e,t){return function(){let n=e._readableState;n.awaitDrainWriters===t?(S(`pipeOnDrain`,1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(S(`pipeOnDrain`,n.awaitDrainWriters.size),n.awaitDrainWriters.delete(t)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&e.listenerCount(`data`)&&e.resume()}}H.prototype.unpipe=function(e){let t=this._readableState,n={hasUnpiped:!1};if(t.pipes.length===0)return this;if(!e){let e=t.pipes;t.pipes=[],this.pause();for(let t=0;t<e.length;t++)e[t].emit(`unpipe`,this,{hasUnpiped:!1});return this}let i=r(t.pipes,e);return i===-1?this:(t.pipes.splice(i,1),t.pipes.length===0&&this.pause(),e.emit(`unpipe`,this,n),this)},H.prototype.on=function(e,t){let r=_.prototype.on.call(this,e,t),i=this._readableState;return e===`data`?(i.readableListening=this.listenerCount(`readable`)>0,i.flowing!==!1&&this.resume()):e===`readable`&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S(`on readable`,i.length,i.reading),i.length?De(this):i.reading||n.nextTick(Ke,this)),r},H.prototype.addListener=H.prototype.on,H.prototype.removeListener=function(e,t){let r=_.prototype.removeListener.call(this,e,t);return e===`readable`&&n.nextTick(Ge,this),r},H.prototype.off=H.prototype.removeListener,H.prototype.removeAllListeners=function(e){let t=_.prototype.removeAllListeners.apply(this,arguments);return(e===`readable`||e===void 0)&&n.nextTick(Ge,this),t};function Ge(e){let t=e._readableState;t.readableListening=e.listenerCount(`readable`)>0,t.resumeScheduled&&t[F]===!1?t.flowing=!0:e.listenerCount(`data`)>0?e.resume():t.readableListening||(t.flowing=null)}function Ke(e){S(`readable nexttick read 0`),e.read(0)}H.prototype.resume=function(){let e=this._readableState;return e.flowing||(S(`resume`),e.flowing=!e.readableListening,qe(this,e)),e[F]=!1,this};function qe(e,t){t.resumeScheduled||(t.resumeScheduled=!0,n.nextTick(Je,e,t))}function Je(e,t){S(`resume`,t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit(`resume`),Ye(e),t.flowing&&!t.reading&&e.read(0)}H.prototype.pause=function(){return S(`call pause flowing=%j`,this._readableState.flowing),this._readableState.flowing!==!1&&(S(`pause`),this._readableState.flowing=!1,this.emit(`pause`)),this._readableState[F]=!0,this};function Ye(e){let t=e._readableState;for(S(`flow`,t.flowing);t.flowing&&e.read()!==null;);}H.prototype.wrap=function(e){let t=!1;e.on(`data`,n=>{!this.push(n)&&e.pause&&(t=!0,e.pause())}),e.on(`end`,()=>{this.push(null)}),e.on(`error`,e=>{B(this,e)}),e.on(`close`,()=>{this.destroy()}),e.on(`destroy`,()=>{this.destroy()}),this._read=()=>{t&&e.resume&&(t=!1,e.resume())};let n=c(e);for(let t=1;t<n.length;t++){let r=n[t];this[r]===void 0&&typeof e[r]==`function`&&(this[r]=e[r].bind(e))}return this},H.prototype[m]=function(){return Xe(this)},H.prototype.iterator=function(e){return e!==void 0&&P(e,`options`),Xe(this,e)};function Xe(e,t){typeof e.read!=`function`&&(e=H.wrap(e,{objectMode:!0}));let n=Ze(e,t);return n.stream=e,n}async function*Ze(e,t){let n=z;function r(t){this===e?(n(),n=z):n=t}e.on(`readable`,r);let i,a=x(e,{writable:!1},e=>{i=e?D(i,e):null,n(),n=z});try{for(;;){let t=e.destroyed?null:e.read();if(t!==null)yield t;else if(i)throw i;else if(i===null)return;else await new u(r)}}catch(e){throw i=D(i,e),i}finally{(i||t?.destroyOnReturn!==!1)&&(i===void 0||e._readableState.autoDestroy)?w.destroyer(e,null):(e.off(`readable`,r),a())}}s(H.prototype,{readable:{__proto__:null,get(){let e=this._readableState;return!!e&&e.readable!==!1&&!e.destroyed&&!e.errorEmitted&&!e.endEmitted},set(e){this._readableState&&(this._readableState.readable=!!e)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(e){this._readableState&&(this._readableState.destroyed=e)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(ye.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[F]!==!1},set(e){this[F]=!!e}}}),H._fromList=Qe;function Qe(e,t){if(t.length===0)return null;let n;return t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(``):t.buffer.length===1?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n}function $e(e){let t=e._readableState;S(`endReadable`,t.endEmitted),t.endEmitted||(t.ended=!0,n.nextTick(et,t,e))}function et(e,t){if(S(`endReadableNT`,e.endEmitted,e.length),!e.errored&&!e.closeEmitted&&!e.endEmitted&&e.length===0){if(e.endEmitted=!0,t.emit(`end`),t.writable&&t.allowHalfOpen===!1)n.nextTick(tt,t);else if(e.autoDestroy){let e=t._writableState;(!e||e.autoDestroy&&(e.finished||e.writable===!1))&&t.destroy()}}}function tt(e){e.writable&&!e.writableEnded&&!e.destroyed&&e.end()}H.from=function(e,t){return R(H,e,t)};var nt;function rt(){return nt===void 0&&(nt={}),nt}H.fromWeb=function(e,t){return rt().newStreamReadableFromReadableStream(e,t)},H.toWeb=function(e,t){return rt().newReadableStreamFromStreamReadable(e,t)},H.wrap=function(e,t){return new H({objectMode:e.readableObjectMode??e.objectMode??!0,...t,destroy(t,n){w.destroyer(e,t),n(t)}}).wrap(e)}})),Ge=o(((e,t)=>{var n=Ne(),{ArrayPrototypeSlice:r,Error:i,FunctionPrototypeSymbolHasInstance:a,ObjectDefineProperty:o,ObjectDefineProperties:s,ObjectSetPrototypeOf:c,StringPrototypeToLowerCase:l,Symbol:u,SymbolHasInstance:d}=Ee();t.exports=P,P.WritableState=M;var{EventEmitter:p}=Ae(),m=Le().Stream,{Buffer:h}=f(),g=Ie(),{addAbortSignal:_}=Re(),{getHighWaterMark:v,getDefaultHighWaterMark:y}=Be(),{ERR_INVALID_ARG_TYPE:b,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_MULTIPLE_CALLBACK:S,ERR_STREAM_CANNOT_PIPE:C,ERR_STREAM_DESTROYED:w,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:E,ERR_STREAM_WRITE_AFTER_END:D,ERR_UNKNOWN_ENCODING:O}=Oe().codes,{errorOrDestroy:k}=g;c(P.prototype,m.prototype),c(P,m);function A(){}var j=u(`kOnFinished`);function M(e,t,n){typeof n!=`boolean`&&(n=t instanceof U()),this.objectMode=!!(e&&e.objectMode),n&&(this.objectMode=this.objectMode||!!(e&&e.writableObjectMode)),this.highWaterMark=e?v(this,e,`writableHighWaterMark`,n):y(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let r=!!(e&&e.decodeStrings===!1);this.decodeStrings=!r,this.defaultEncoding=e&&e.defaultEncoding||`utf8`,this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=B.bind(void 0,t),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,N(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!e||e.emitClose!==!1,this.autoDestroy=!e||e.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[j]=[]}function N(e){e.buffered=[],e.bufferedIndex=0,e.allBuffers=!0,e.allNoop=!0}M.prototype.getBuffer=function(){return r(this.buffered,this.bufferedIndex)},o(M.prototype,`bufferedRequestCount`,{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function P(e){let t=this instanceof U();if(!t&&!a(P,this))return new P(e);this._writableState=new M(e,this,t),e&&(typeof e.write==`function`&&(this._write=e.write),typeof e.writev==`function`&&(this._writev=e.writev),typeof e.destroy==`function`&&(this._destroy=e.destroy),typeof e.final==`function`&&(this._final=e.final),typeof e.construct==`function`&&(this._construct=e.construct),e.signal&&_(e.signal,this)),m.call(this,e),g.construct(this,()=>{let e=this._writableState;e.writing||ne(this,e),oe(this,e)})}o(P,d,{__proto__:null,value:function(e){return a(this,e)?!0:this===P?e&&e._writableState instanceof M:!1}}),P.prototype.pipe=function(){k(this,new C)};function F(e,t,r,i){let a=e._writableState;if(typeof r==`function`)i=r,r=a.defaultEncoding;else{if(!r)r=a.defaultEncoding;else if(r!==`buffer`&&!h.isEncoding(r))throw new O(r);typeof i!=`function`&&(i=A)}if(t===null)throw new E;if(!a.objectMode)if(typeof t==`string`)a.decodeStrings!==!1&&(t=h.from(t,r),r=`buffer`);else if(t instanceof h)r=`buffer`;else if(m._isUint8Array(t))t=m._uint8ArrayToBuffer(t),r=`buffer`;else throw new b(`chunk`,[`string`,`Buffer`,`Uint8Array`],t);let o;return a.ending?o=new D:a.destroyed&&(o=new w(`write`)),o?(n.nextTick(i,o),k(e,o,!0),o):(a.pendingcb++,I(e,a,t,r,i))}P.prototype.write=function(e,t,n){return F(this,e,t,n)===!0},P.prototype.cork=function(){this._writableState.corked++},P.prototype.uncork=function(){let e=this._writableState;e.corked&&(e.corked--,e.writing||ne(this,e))},P.prototype.setDefaultEncoding=function(e){if(typeof e==`string`&&(e=l(e)),!h.isEncoding(e))throw new O(e);return this._writableState.defaultEncoding=e,this};function I(e,t,n,r,i){let a=t.objectMode?1:n.length;t.length+=a;let o=t.length<t.highWaterMark;return o||(t.needDrain=!0),t.writing||t.corked||t.errored||!t.constructed?(t.buffered.push({chunk:n,encoding:r,callback:i}),t.allBuffers&&r!==`buffer`&&(t.allBuffers=!1),t.allNoop&&i!==A&&(t.allNoop=!1)):(t.writelen=a,t.writecb=i,t.writing=!0,t.sync=!0,e._write(n,r,t.onwrite),t.sync=!1),o&&!t.errored&&!t.destroyed}function R(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w(`write`)):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function z(e,t,n,r){--t.pendingcb,r(n),te(t),k(e,n)}function B(e,t){let r=e._writableState,i=r.sync,a=r.writecb;if(typeof a!=`function`){k(e,new S);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,t?(t.stack,r.errored||=t,e._readableState&&!e._readableState.errored&&(e._readableState.errored=t),i?n.nextTick(z,e,r,t,a):z(e,r,t,a)):(r.buffered.length>r.bufferedIndex&&ne(e,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===a?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:a,stream:e,state:r},n.nextTick(V,r.afterWriteTickInfo)):ee(e,r,1,a))}function V({stream:e,state:t,count:n,cb:r}){return t.afterWriteTickInfo=null,ee(e,t,n,r)}function ee(e,t,n,r){for(!t.ending&&!e.destroyed&&t.length===0&&t.needDrain&&(t.needDrain=!1,e.emit(`drain`));n-- >0;)t.pendingcb--,r();t.destroyed&&te(t),oe(e,t)}function te(e){if(e.writing)return;for(let t=e.bufferedIndex;t<e.buffered.length;++t){let{chunk:n,callback:r}=e.buffered[t],i=e.objectMode?1:n.length;e.length-=i,r(e.errored??new w(`write`))}let t=e[j].splice(0);for(let n=0;n<t.length;n++)t[n](e.errored??new w(`end`));N(e)}function ne(e,t){if(t.corked||t.bufferProcessing||t.destroyed||!t.constructed)return;let{buffered:n,bufferedIndex:i,objectMode:a}=t,o=n.length-i;if(!o)return;let s=i;if(t.bufferProcessing=!0,o>1&&e._writev){t.pendingcb-=o-1;let i=t.allNoop?A:e=>{for(let t=s;t<n.length;++t)n[t].callback(e)},a=t.allNoop&&s===0?n:r(n,s);a.allBuffers=t.allBuffers,R(e,t,!0,t.length,a,``,i),N(t)}else{do{let{chunk:r,encoding:i,callback:o}=n[s];n[s++]=null,R(e,t,!1,a?1:r.length,r,i,o)}while(s<n.length&&!t.writing);s===n.length?N(t):s>256?(n.splice(0,s),t.bufferedIndex=0):t.bufferedIndex=s}t.bufferProcessing=!1}P.prototype._write=function(e,t,n){if(this._writev)this._writev([{chunk:e,encoding:t}],n);else throw new x(`_write()`)},P.prototype._writev=null,P.prototype.end=function(e,t,r){let a=this._writableState;typeof e==`function`?(r=e,e=null,t=null):typeof t==`function`&&(r=t,t=null);let o;if(e!=null){let n=F(this,e,t);n instanceof i&&(o=n)}return a.corked&&(a.corked=1,this.uncork()),o||(!a.errored&&!a.ending?(a.ending=!0,oe(this,a,!0),a.ended=!0):a.finished?o=new T(`end`):a.destroyed&&(o=new w(`end`))),typeof r==`function`&&(o||a.finished?n.nextTick(r,o):a[j].push(r)),this};function re(e){return e.ending&&!e.destroyed&&e.constructed&&e.length===0&&!e.errored&&e.buffered.length===0&&!e.finished&&!e.writing&&!e.errorEmitted&&!e.closeEmitted}function ie(e,t){let r=!1;function i(i){if(r){k(e,i??S());return}if(r=!0,t.pendingcb--,i){let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e](i);k(e,i,t.sync)}else re(t)&&(t.prefinished=!0,e.emit(`prefinish`),t.pendingcb++,n.nextTick(se,e,t))}t.sync=!0,t.pendingcb++;try{e._final(i)}catch(e){i(e)}t.sync=!1}function ae(e,t){!t.prefinished&&!t.finalCalled&&(typeof e._final==`function`&&!t.destroyed?(t.finalCalled=!0,ie(e,t)):(t.prefinished=!0,e.emit(`prefinish`)))}function oe(e,t,r){re(t)&&(ae(e,t),t.pendingcb===0&&(r?(t.pendingcb++,n.nextTick((e,t)=>{re(t)?se(e,t):t.pendingcb--},e,t)):re(t)&&(t.pendingcb++,se(e,t))))}function se(e,t){t.pendingcb--,t.finished=!0;let n=t[j].splice(0);for(let e=0;e<n.length;e++)n[e]();if(e.emit(`finish`),t.autoDestroy){let t=e._readableState;(!t||t.autoDestroy&&(t.endEmitted||t.readable===!1))&&e.destroy()}}s(P.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(e){this._writableState&&(this._writableState.destroyed=e)}},writable:{__proto__:null,get(){let e=this._writableState;return!!e&&e.writable!==!1&&!e.destroyed&&!e.errored&&!e.ending&&!e.ended},set(e){this._writableState&&(this._writableState.writable=!!e)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let e=this._writableState;return e?!e.destroyed&&!e.ending&&e.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var ce=g.destroy;P.prototype.destroy=function(e,t){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[j].length)&&n.nextTick(te,r),ce.call(this,e,t),this},P.prototype._undestroy=g.undestroy,P.prototype._destroy=function(e,t){t(e)},P.prototype[p.captureRejectionSymbol]=function(e){this.destroy(e)};var le;function ue(){return le===void 0&&(le={}),le}P.fromWeb=function(e,t){return ue().newStreamWritableFromWritableStream(e,t)},P.toWeb=function(e){return ue().newWritableStreamFromStreamWritable(e)}})),Ke=o(((e,t)=>{var n=Ne(),r=f(),{isReadable:i,isWritable:a,isIterable:o,isNodeStream:s,isReadableNodeStream:c,isWritableNodeStream:l,isDuplexNodeStream:u,isReadableStream:d,isWritableStream:p}=Pe(),m=Fe(),{AbortError:h,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_}}=Oe(),{destroyer:v}=Ie(),y=U(),b=We(),x=Ge(),{createDeferredPromise:S}=je(),C=Ue(),w=globalThis.Blob||r.Blob,T=w===void 0?function(e){return!1}:function(e){return e instanceof w},E=globalThis.AbortController||ke().AbortController,{FunctionPrototypeCall:D}=Ee(),O=class extends y{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};t.exports=function e(t,r){if(u(t))return t;if(c(t))return A({readable:t});if(l(t))return A({writable:t});if(s(t))return A({writable:!1,readable:!1});if(d(t))return A({readable:b.fromWeb(t)});if(p(t))return A({writable:x.fromWeb(t)});if(typeof t==`function`){let{value:e,write:i,final:a,destroy:s}=k(t);if(o(e))return C(O,e,{objectMode:!0,write:i,final:a,destroy:s});let c=e?.then;if(typeof c==`function`){let t,r=D(c,e,e=>{if(e!=null)throw new _(`nully`,`body`,e)},e=>{v(t,e)});return t=new O({objectMode:!0,readable:!1,write:i,final(e){a(async()=>{try{await r,n.nextTick(e,null)}catch(t){n.nextTick(e,t)}})},destroy:s})}throw new _(`Iterable, AsyncIterable or AsyncFunction`,r,e)}if(T(t))return e(t.arrayBuffer());if(o(t))return C(O,t,{objectMode:!0,writable:!1});if(d(t?.readable)&&p(t?.writable))return O.fromWeb(t);if(typeof t?.writable==`object`||typeof t?.readable==`object`)return A({readable:t!=null&&t.readable?c(t?.readable)?t?.readable:e(t.readable):void 0,writable:t!=null&&t.writable?l(t?.writable)?t?.writable:e(t.writable):void 0});let i=t?.then;if(typeof i==`function`){let e;return D(i,t,t=>{t!=null&&e.push(t),e.push(null)},t=>{v(e,t)}),e=new O({objectMode:!0,writable:!1,read(){}})}throw new g(r,[`Blob`,`ReadableStream`,`WritableStream`,`Stream`,`Iterable`,`AsyncIterable`,`Function`,`{ readable, writable } pair`,`Promise`],t)};function k(e){let{promise:t,resolve:r}=S(),i=new E,a=i.signal;return{value:e((async function*(){for(;;){let e=t;t=null;let{chunk:i,done:o,cb:s}=await e;if(n.nextTick(s),o)return;if(a.aborted)throw new h(void 0,{cause:a.reason});({promise:t,resolve:r}=S()),yield i}})(),{signal:a}),write(e,t,n){let i=r;r=null,i({chunk:e,done:!1,cb:n})},final(e){let t=r;r=null,t({done:!0,cb:e})},destroy(e,t){i.abort(),t(e)}}}function A(e){let t=e.readable&&typeof e.readable.read!=`function`?b.wrap(e.readable):e.readable,n=e.writable,r=!!i(t),o=!!a(n),s,c,l,u,d;function f(e){let t=u;u=null,t?t(e):e&&d.destroy(e)}return d=new O({readableObjectMode:!!(t!=null&&t.readableObjectMode),writableObjectMode:!!(n!=null&&n.writableObjectMode),readable:r,writable:o}),o&&(m(n,e=>{o=!1,e&&v(t,e),f(e)}),d._write=function(e,t,r){n.write(e,t)?r():s=r},d._final=function(e){n.end(),c=e},n.on(`drain`,function(){if(s){let e=s;s=null,e()}}),n.on(`finish`,function(){if(c){let e=c;c=null,e()}})),r&&(m(t,e=>{r=!1,e&&v(t,e),f(e)}),t.on(`readable`,function(){if(l){let e=l;l=null,e()}}),t.on(`end`,function(){d.push(null)}),d._read=function(){for(;;){let e=t.read();if(e===null){l=d._read;return}if(!d.push(e))return}}),d._destroy=function(e,r){!e&&u!==null&&(e=new h),l=null,s=null,c=null,u===null?r(e):(u=r,v(n,e),v(t,e))},d}})),U=o(((e,t)=>{var{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:r,ObjectKeys:i,ObjectSetPrototypeOf:a}=Ee();t.exports=c;var o=We(),s=Ge();a(c.prototype,o.prototype),a(c,o);{let e=i(s.prototype);for(let t=0;t<e.length;t++){let n=e[t];c.prototype[n]||(c.prototype[n]=s.prototype[n])}}function c(e){if(!(this instanceof c))return new c(e);o.call(this,e),s.call(this,e),e?(this.allowHalfOpen=e.allowHalfOpen!==!1,e.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(c.prototype,{writable:{__proto__:null,...r(s.prototype,`writable`)},writableHighWaterMark:{__proto__:null,...r(s.prototype,`writableHighWaterMark`)},writableObjectMode:{__proto__:null,...r(s.prototype,`writableObjectMode`)},writableBuffer:{__proto__:null,...r(s.prototype,`writableBuffer`)},writableLength:{__proto__:null,...r(s.prototype,`writableLength`)},writableFinished:{__proto__:null,...r(s.prototype,`writableFinished`)},writableCorked:{__proto__:null,...r(s.prototype,`writableCorked`)},writableEnded:{__proto__:null,...r(s.prototype,`writableEnded`)},writableNeedDrain:{__proto__:null,...r(s.prototype,`writableNeedDrain`)},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(e){this._readableState&&this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}});var l;function u(){return l===void 0&&(l={}),l}c.fromWeb=function(e,t){return u().newStreamDuplexFromReadableWritablePair(e,t)},c.toWeb=function(e){return u().newReadableWritablePairFromDuplex(e)};var d;c.from=function(e){return d||=Ke(),d(e,`body`)}})),qe=o(((e,t)=>{var{ObjectSetPrototypeOf:n,Symbol:r}=Ee();t.exports=c;var{ERR_METHOD_NOT_IMPLEMENTED:i}=Oe().codes,a=U(),{getHighWaterMark:o}=Be();n(c.prototype,a.prototype),n(c,a);var s=r(`kCallback`);function c(e){if(!(this instanceof c))return new c(e);let t=e?o(this,e,`readableHighWaterMark`,!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),a.call(this,e),this._readableState.sync=!1,this[s]=null,e&&(typeof e.transform==`function`&&(this._transform=e.transform),typeof e.flush==`function`&&(this._flush=e.flush)),this.on(`prefinish`,u)}function l(e){typeof this._flush==`function`&&!this.destroyed?this._flush((t,n)=>{if(t){e?e(t):this.destroy(t);return}n!=null&&this.push(n),this.push(null),e&&e()}):(this.push(null),e&&e())}function u(){this._final!==l&&l.call(this)}c.prototype._final=l,c.prototype._transform=function(e,t,n){throw new i(`_transform()`)},c.prototype._write=function(e,t,n){let r=this._readableState,i=this._writableState,a=r.length;this._transform(e,t,(e,t)=>{if(e){n(e);return}t!=null&&this.push(t),i.ended||a===r.length||r.length<r.highWaterMark?n():this[s]=n})},c.prototype._read=function(){if(this[s]){let e=this[s];this[s]=null,e()}}})),Je=o(((e,t)=>{var{ObjectSetPrototypeOf:n}=Ee();t.exports=i;var r=qe();n(i.prototype,r.prototype),n(i,r);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}i.prototype._transform=function(e,t,n){n(null,e)}})),Ye=o(((e,t)=>{var n=Ne(),{ArrayIsArray:r,Promise:i,SymbolAsyncIterator:a,SymbolDispose:o}=Ee(),s=Fe(),{once:c}=je(),l=Ie(),u=U(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:m,ERR_STREAM_DESTROYED:h,ERR_STREAM_PREMATURE_CLOSE:g},AbortError:_}=Oe(),{validateFunction:v,validateAbortSignal:y}=Me(),{isIterable:b,isReadable:x,isReadableNodeStream:S,isNodeStream:C,isTransformStream:w,isWebStream:T,isReadableStream:E,isReadableFinished:D}=Pe(),O=globalThis.AbortController||ke().AbortController,k,A,j;function M(e,t,n){let r=!1;return e.on(`close`,()=>{r=!0}),{destroy:t=>{r||(r=!0,l.destroyer(e,t||new h(`pipe`)))},cleanup:s(e,{readable:t,writable:n},e=>{r=!e})}}function N(e){return v(e[e.length-1],`streams[stream.length - 1]`),e.pop()}function P(e){if(b(e))return e;if(S(e))return F(e);throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`],e)}async function*F(e){A||=We(),yield*A.prototype[a].call(e)}async function I(e,t,n,{end:r}){let a,o=null,c=e=>{if(e&&(a=e),o){let e=o;o=null,e()}},l=()=>new i((e,t)=>{a?t(a):o=()=>{a?t(a):e()}});t.on(`drain`,c);let u=s(t,{readable:!1},c);try{t.writableNeedDrain&&await l();for await(let n of e)t.write(n)||await l();r&&(t.end(),await l()),n()}catch(e){n(a===e?e:d(a,e))}finally{u(),t.off(`drain`,c)}}async function R(e,t,n,{end:r}){w(t)&&(t=t.writable);let i=t.getWriter();try{for await(let t of e)await i.ready,i.write(t).catch(()=>{});await i.ready,r&&await i.close(),n()}catch(e){try{await i.abort(e),n(e)}catch(e){n(e)}}}function z(...e){return B(e,c(N(e)))}function B(e,t,i){if(e.length===1&&r(e[0])&&(e=e[0]),e.length<2)throw new m(`streams`);let a=new O,s=a.signal,c=i?.signal,l=[];y(c,`options.signal`);function d(){F(new _)}j||=je().addAbortListener;let h;c&&(h=j(c,d));let g,v,D=[],A=0;function N(e){F(e,--A===0)}function F(e,r){var i;if(e&&(!g||g.code===`ERR_STREAM_PREMATURE_CLOSE`)&&(g=e),!(!g&&!r)){for(;D.length;)D.shift()(g);(i=h)==null||i[o](),a.abort(),r&&(g||l.forEach(e=>e()),n.nextTick(t,g,v))}}let z;for(let t=0;t<e.length;t++){let r=e[t],a=t<e.length-1,o=t>0,c=a||i?.end!==!1,d=t===e.length-1;if(C(r)){if(c){let{destroy:e,cleanup:t}=M(r,a,o);D.push(e),x(r)&&d&&l.push(t)}function e(e){e&&e.name!==`AbortError`&&e.code!==`ERR_STREAM_PREMATURE_CLOSE`&&N(e)}r.on(`error`,e),x(r)&&d&&l.push(()=>{r.removeListener(`error`,e)})}if(t===0)if(typeof r==`function`){if(z=r({signal:s}),!b(z))throw new p(`Iterable, AsyncIterable or Stream`,`source`,z)}else z=b(r)||S(r)||w(r)?r:u.from(r);else if(typeof r==`function`)if(z=w(z)?P(z?.readable):P(z),z=r(z,{signal:s}),a){if(!b(z,!0))throw new p(`AsyncIterable`,`transform[${t-1}]`,z)}else{k||=Je();let e=new k({objectMode:!0}),t=z?.then;if(typeof t==`function`)A++,t.call(z,t=>{v=t,t!=null&&e.write(t),c&&e.end(),n.nextTick(N)},t=>{e.destroy(t),n.nextTick(N,t)});else if(b(z,!0))A++,I(z,e,N,{end:c});else if(E(z)||w(z)){let t=z.readable||z;A++,I(t,e,N,{end:c})}else throw new p(`AsyncIterable or Promise`,`destination`,z);z=e;let{destroy:r,cleanup:i}=M(z,!1,!0);D.push(r),d&&l.push(i)}else if(C(r)){if(S(z)){A+=2;let e=V(z,r,N,{end:c});x(r)&&d&&l.push(e)}else if(w(z)||E(z)){let e=z.readable||z;A++,I(e,r,N,{end:c})}else if(b(z))A++,I(z,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],z);z=r}else if(T(r)){if(S(z))A++,R(P(z),r,N,{end:c});else if(E(z)||b(z))A++,R(z,r,N,{end:c});else if(w(z))A++,R(z.readable,r,N,{end:c});else throw new f(`val`,[`Readable`,`Iterable`,`AsyncIterable`,`ReadableStream`,`TransformStream`],z);z=r}else z=u.from(r)}return(s!=null&&s.aborted||c!=null&&c.aborted)&&n.nextTick(d),z}function V(e,t,r,{end:i}){let a=!1;if(t.on(`close`,()=>{a||r(new g)}),e.pipe(t,{end:!1}),i){function r(){a=!0,t.end()}D(e)?n.nextTick(r):e.once(`end`,r)}else r();return s(e,{readable:!0,writable:!1},t=>{let n=e._readableState;t&&t.code===`ERR_STREAM_PREMATURE_CLOSE`&&n&&n.ended&&!n.errored&&!n.errorEmitted?e.once(`end`,r).once(`error`,r):r(t)}),s(t,{readable:!1,writable:!0},r)}t.exports={pipelineImpl:B,pipeline:z}})),Xe=o(((e,t)=>{var{pipeline:n}=Ye(),r=U(),{destroyer:i}=Ie(),{isNodeStream:a,isReadable:o,isWritable:s,isWebStream:c,isTransformStream:l,isWritableStream:u,isReadableStream:d}=Pe(),{AbortError:f,codes:{ERR_INVALID_ARG_VALUE:p,ERR_MISSING_ARGS:m}}=Oe(),h=Fe();t.exports=function(...e){if(e.length===0)throw new m(`streams`);if(e.length===1)return r.from(e[0]);let t=[...e];if(typeof e[0]==`function`&&(e[0]=r.from(e[0])),typeof e[e.length-1]==`function`){let t=e.length-1;e[t]=r.from(e[t])}for(let n=0;n<e.length;++n)if(!(!a(e[n])&&!c(e[n]))){if(n<e.length-1&&!(o(e[n])||d(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be readable`);if(n>0&&!(s(e[n])||u(e[n])||l(e[n])))throw new p(`streams[${n}]`,t[n],`must be writable`)}let g,_,v,y,b;function x(e){let t=y;y=null,t?t(e):e?b.destroy(e):!T&&!w&&b.destroy()}let S=e[0],C=n(e,x),w=!!(s(S)||u(S)||l(S)),T=!!(o(C)||d(C)||l(C));if(b=new r({writableObjectMode:!!(S!=null&&S.writableObjectMode),readableObjectMode:!!(C!=null&&C.readableObjectMode),writable:w,readable:T}),w){if(a(S))b._write=function(e,t,n){S.write(e,t)?n():g=n},b._final=function(e){S.end(),_=e},S.on(`drain`,function(){if(g){let e=g;g=null,e()}});else if(c(S)){let e=(l(S)?S.writable:S).getWriter();b._write=async function(t,n,r){try{await e.ready,e.write(t).catch(()=>{}),r()}catch(e){r(e)}},b._final=async function(t){try{await e.ready,e.close().catch(()=>{}),_=t}catch(e){t(e)}}}h(l(C)?C.readable:C,()=>{if(_){let e=_;_=null,e()}})}if(T){if(a(C))C.on(`readable`,function(){if(v){let e=v;v=null,e()}}),C.on(`end`,function(){b.push(null)}),b._read=function(){for(;;){let e=C.read();if(e===null){v=b._read;return}if(!b.push(e))return}};else if(c(C)){let e=(l(C)?C.readable:C).getReader();b._read=async function(){for(;;)try{let{value:t,done:n}=await e.read();if(!b.push(t))return;if(n){b.push(null);return}}catch{return}}}}return b._destroy=function(e,t){!e&&y!==null&&(e=new f),v=null,g=null,_=null,y===null?t(e):(y=t,a(C)&&i(C,e))},b}})),Ze=o(((e,t)=>{var n=globalThis.AbortController||ke().AbortController,{codes:{ERR_INVALID_ARG_VALUE:r,ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:a,ERR_OUT_OF_RANGE:o},AbortError:s}=Oe(),{validateAbortSignal:c,validateInteger:l,validateObject:u}=Me(),d=Ee().Symbol(`kWeak`),f=Ee().Symbol(`kResistStopPropagation`),{finished:p}=Fe(),m=Xe(),{addAbortSignalNoValidate:h}=Re(),{isWritable:g,isNodeStream:_}=Pe(),{deprecate:v}=je(),{ArrayPrototypePush:y,Boolean:b,MathFloor:x,Number:S,NumberIsNaN:C,Promise:w,PromiseReject:T,PromiseResolve:E,PromisePrototypeThen:D,Symbol:O}=Ee(),k=O(`kEmpty`),A=O(`kEof`);function j(e,t){if(t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),_(e)&&!g(e))throw new r(`stream`,e,`must be writable`);let n=m(this,e);return t!=null&&t.signal&&h(t.signal,n),n}function M(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`);let n=1;t?.concurrency!=null&&(n=x(t.concurrency));let r=n-1;return t?.highWaterMark!=null&&(r=x(t.highWaterMark)),l(n,`options.concurrency`,1),l(r,`options.highWaterMark`,0),r+=n,async function*(){let i=je().AbortSignalAny([t?.signal].filter(b)),a=this,o=[],c={signal:i},l,u,d=!1,f=0;function p(){d=!0,m()}function m(){--f,h()}function h(){u&&!d&&f<n&&o.length<r&&(u(),u=null)}async function g(){try{for await(let t of a){if(d)return;if(i.aborted)throw new s;try{if(t=e(t,c),t===k)continue;t=E(t)}catch(e){t=T(e)}f+=1,D(t,m,p),o.push(t),l&&=(l(),null),!d&&(o.length>=r||f>=n)&&await new w(e=>{u=e})}o.push(A)}catch(e){let t=T(e);D(t,m,p),o.push(t)}finally{d=!0,l&&=(l(),null)}}g();try{for(;;){for(;o.length>0;){let e=await o[0];if(e===A)return;if(i.aborted)throw new s;e!==k&&(yield e),o.shift(),h()}await new w(e=>{l=e})}}finally{d=!0,u&&=(u(),null)}}.call(this)}function N(e=void 0){return e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`),async function*(){let t=0;for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s({cause:e.signal.reason});yield[t++,r]}}.call(this)}async function P(e,t=void 0){for await(let n of z.call(this,e,t))return!0;return!1}async function F(e,t=void 0){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);return!await P.call(this,async(...t)=>!await e(...t),t)}async function I(e,t){for await(let n of z.call(this,e,t))return n}async function R(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n),k}for await(let e of M.call(this,n,t));}function z(e,t){if(typeof e!=`function`)throw new i(`fn`,[`Function`,`AsyncFunction`],e);async function n(t,n){return await e(t,n)?t:k}return M.call(this,n,t)}var B=class extends a{constructor(){super(`reduce`),this.message=`Reduce of an empty stream requires an initial value`}};async function V(e,t,r){var a;if(typeof e!=`function`)throw new i(`reducer`,[`Function`,`AsyncFunction`],e);r!=null&&u(r,`options`),r?.signal!=null&&c(r.signal,`options.signal`);let o=arguments.length>1;if(r!=null&&(a=r.signal)!=null&&a.aborted){let e=new s(void 0,{cause:r.signal.reason});throw this.once(`error`,()=>{}),await p(this.destroy(e)),e}let l=new n,m=l.signal;if(r!=null&&r.signal){let e={once:!0,[d]:this,[f]:!0};r.signal.addEventListener(`abort`,()=>l.abort(),e)}let h=!1;try{for await(let n of this){var g;if(h=!0,r!=null&&(g=r.signal)!=null&&g.aborted)throw new s;o?t=await e(t,n,{signal:m}):(t=n,o=!0)}if(!h&&!o)throw new B}finally{l.abort()}return t}async function ee(e){e!=null&&u(e,`options`),e?.signal!=null&&c(e.signal,`options.signal`);let t=[];for await(let r of this){var n;if(e!=null&&(n=e.signal)!=null&&n.aborted)throw new s(void 0,{cause:e.signal.reason});y(t,r)}return t}function te(e,t){let n=M.call(this,e,t);return async function*(){for await(let e of n)yield*e}.call(this)}function ne(e){if(e=S(e),C(e))return 0;if(e<0)throw new o(`number`,`>= 0`,e);return e}function re(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;e--<=0&&(yield n)}}.call(this)}function ie(e,t=void 0){return t!=null&&u(t,`options`),t?.signal!=null&&c(t.signal,`options.signal`),e=ne(e),async function*(){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)throw new s;for await(let n of this){var r;if(t!=null&&(r=t.signal)!=null&&r.aborted)throw new s;if(e-- >0&&(yield n),e<=0)return}}.call(this)}t.exports.streamReturningOperators={asIndexedPairs:v(N,`readable.asIndexedPairs will be removed in a future version.`),drop:re,filter:z,flatMap:te,map:M,take:ie,compose:j},t.exports.promiseReturningOperators={every:F,forEach:R,reduce:V,toArray:ee,some:P,find:I}})),Qe=o(((e,t)=>{var{ArrayPrototypePop:n,Promise:r}=Ee(),{isIterable:i,isNodeStream:a,isWebStream:o}=Pe(),{pipelineImpl:s}=Ye(),{finished:c}=Fe();$e();function l(...e){return new r((t,r)=>{let c,l,u=e[e.length-1];if(u&&typeof u==`object`&&!a(u)&&!i(u)&&!o(u)){let t=n(e);c=t.signal,l=t.end}s(e,(e,n)=>{e?r(e):t(n)},{signal:c,end:l})})}t.exports={finished:c,pipeline:l}})),$e=o(((e,t)=>{var{Buffer:n}=f(),{ObjectDefineProperty:r,ObjectKeys:i,ReflectApply:a}=Ee(),{promisify:{custom:o}}=je(),{streamReturningOperators:s,promiseReturningOperators:c}=Ze(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:l}}=Oe(),u=Xe(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:p}=Be(),{pipeline:m}=Ye(),{destroyer:h}=Ie(),g=Fe(),_=Qe(),v=Pe(),y=t.exports=Le().Stream;y.isDestroyed=v.isDestroyed,y.isDisturbed=v.isDisturbed,y.isErrored=v.isErrored,y.isReadable=v.isReadable,y.isWritable=v.isWritable,y.Readable=We();for(let e of i(s)){let t=s[e];function n(...e){if(new.target)throw l();return y.Readable.from(a(t,this,e))}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}for(let e of i(c)){let t=c[e];function n(...e){if(new.target)throw l();return a(t,this,e)}r(n,`name`,{__proto__:null,value:t.name}),r(n,`length`,{__proto__:null,value:t.length}),r(y.Readable.prototype,e,{__proto__:null,value:n,enumerable:!1,configurable:!0,writable:!0})}y.Writable=Ge(),y.Duplex=U(),y.Transform=qe(),y.PassThrough=Je(),y.pipeline=m;var{addAbortSignal:b}=Re();y.addAbortSignal=b,y.finished=g,y.destroy=h,y.compose=u,y.setDefaultHighWaterMark=d,y.getDefaultHighWaterMark=p,r(y,`promises`,{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),r(m,o,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),r(g,o,{__proto__:null,enumerable:!0,get(){return _.finished}}),y.Stream=y,y._isUint8Array=function(e){return e instanceof Uint8Array},y._uint8ArrayToBuffer=function(e){return n.from(e.buffer,e.byteOffset,e.byteLength)}})),et=o(((e,t)=>{var n=$e(),r=Qe(),i=n.Readable.destroy;t.exports=n.Readable,t.exports._uint8ArrayToBuffer=n._uint8ArrayToBuffer,t.exports._isUint8Array=n._isUint8Array,t.exports.isDisturbed=n.isDisturbed,t.exports.isErrored=n.isErrored,t.exports.isReadable=n.isReadable,t.exports.Readable=n.Readable,t.exports.Writable=n.Writable,t.exports.Duplex=n.Duplex,t.exports.Transform=n.Transform,t.exports.PassThrough=n.PassThrough,t.exports.addAbortSignal=n.addAbortSignal,t.exports.finished=n.finished,t.exports.destroy=n.destroy,t.exports.destroy=i,t.exports.pipeline=n.pipeline,t.exports.compose=n.compose,Object.defineProperty(n,`promises`,{configurable:!0,enumerable:!0,get(){return r}}),t.exports.Stream=n.Stream,t.exports.default=t.exports})),tt=et(),nt=Symbol(`iter`);function rt(e,t,n=4){if(n===0)return Object.assign(e,t);for(let r in t)e[r]=rt(e[r]||Object.create(null),t[r],n-1);return e}function it(e,t,n=4){let r=!1;for(let i in e)if(i in t){let a=n===0?null:it(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}function at(e,t,n=4){let r=!1;for(let i in e)if(!(i in t))r||=Object.create(null),r[i]=n===0?null:rt({},e[i],n-1);else if(n!==0){let a=at(e[i],t[i],n-1);if(a!==!1)r||=Object.create(null),r[i]=a;else if(n===3)return!1}return r}var ot=class{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[``]=1,this._entities=Object.create(null),this._entities[1]=``,this._blankNodeIndex=0,this._factory=e.factory||k}_termFromId(e){if(e[0]===`.`){let t=this._entities,n=e.split(`.`);return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return F(e,this._factory)}_termToNumericId(e){if(e.termType===`Quad`){let t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),r=this._termToNumericId(e.object),i;return t&&n&&r&&(le(e.graph)||(i=this._termToNumericId(e.graph)))&&this._ids[i?`.${t}.${n}.${r}.${i}`:`.${t}.${n}.${r}`]}return this._ids[I(e)]}_termToNewNumericId(e){let t=e&&e.termType===`Quad`?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${le(e.graph)?``:`.${this._termToNewNumericId(e.graph)}`}`:I(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+ n++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}},st=class e{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!=`function`&&(t=e,e=null),t||={},this._factory=t.factory||k,this._entityIndex=t.entityIndex||new ot({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),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;let t=this._graphs,n,r;for(let i in t)for(let a in n=t[i].subjects)for(let t in r=n[a])e+=Object.keys(r[t]).length;return this._size=e}_addToIndex(e,t,n,r){let i=e[t]||(e[t]={}),a=i[n]||(i[n]={}),o=r in a;return o||(a[r]=null),!o}_removeFromIndex(e,t,n,r){let i=e[t],a=i[n];delete a[r];for(let e in a)return;delete i[n];for(let e in i)return;delete e[t]}*_findInIndex(e,t,n,r,i,a,o,s){let c,l,u,d=this._entities,f=this._termFromId(d[s]),p={subject:null,predicate:null,object:null};t&&((c=e,e={})[t]=c[t]);for(let t in e)if(l=e[t]){p[i]=this._termFromId(d[t]),n&&((c=l,l={})[n]=c[n]);for(let e in l)if(u=l[e]){p[a]=this._termFromId(d[e]);let t=r?r in u?[r]:[]:Object.keys(u);for(let e=0;e<t.length;e++)p[o]=this._termFromId(d[t[e]]),yield this._factory.quad(p.subject,p.predicate,p.object,f)}}}_loop(e,t){for(let n in e)t(n)}_loopByKey0(e,t,n){let r,i;if(r=e[t])for(i in r)n(i)}_loopByKey1(e,t,n){let r,i;for(r in e)i=e[r],i[t]&&n(r)}_loopBy2Keys(e,t,n,r){let i,a,o;if((i=e[t])&&(a=i[n]))for(o in a)r(o)}_countInIndex(e,t,n,r){let i=0,a,o,s;t&&((a=e,e={})[t]=a[t]);for(let t in e)if(o=e[t]){n&&((a=o,o={})[n]=a[n]);for(let e in o)(s=o[e])&&(r?r in s&&i++:i+=Object.keys(s).length)}return i}_getGraphs(e){return e=e===``?1:e&&(this._termToNumericId(e)||-1),typeof e==`number`?{[e]:this._graphs[e]}:this._graphs}_uniqueEntities(e){let t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,r){t||(r=e.graph,n=e.object,t=e.predicate,e=e.subject),r=r?this._termToNewNumericId(r):1;let i=this._graphs[r];return i||(i=this._graphs[r]={subjects:{},predicates:{},objects:{}},Object.freeze(i)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(i.subjects,e,t,n)?(this._addToIndex(i.predicates,t,n,e),this._addToIndex(i.objects,n,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,n,r){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:r}=e),!this.readQuads(e,t,n,r).next().done}import(e){return e.on(`data`,e=>{this.addQuad(e)}),e}removeQuad(e,t,n,r){t||({subject:e,predicate:t,object:n,graph:r}=e),r=r?this._termToNumericId(r):1;let i=this._graphs,a,o,s;if(!(e&&=this._termToNumericId(e))||!(t&&=this._termToNumericId(t))||!(n&&=this._termToNumericId(n))||!(a=i[r])||!(o=a.subjects[e])||!(s=o[t])||!(n in s))return!1;for(e in this._removeFromIndex(a.subjects,e,t,n),this._removeFromIndex(a.predicates,t,n,e),this._removeFromIndex(a.objects,n,e,t),this._size!==null&&this._size--,a.subjects)return!0;return delete i[r],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on(`data`,e=>{this.removeQuad(e)}),e}removeMatches(e,t,n,r){let i=new tt.Readable({objectMode:!0}),a=this.readQuads(e,t,n,r);return i._read=e=>{for(;--e>=0;){let{done:e,value:t}=a.next();if(e){i.push(null);return}i.push(t)}},this.remove(i)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,r){return[...this.readQuads(e,t,n,r)]}*readQuads(e,t,n,r){let i=this._getGraphs(r),a,o,s,c;if(!(e&&!(o=this._termToNumericId(e))||t&&!(s=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n))))for(let e in i)(a=i[e])&&(o?c?yield*this._findInIndex(a.objects,c,o,s,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,o,s,null,`subject`,`predicate`,`object`,e):s?yield*this._findInIndex(a.predicates,s,c,null,`predicate`,`object`,`subject`,e):c?yield*this._findInIndex(a.objects,c,null,null,`object`,`subject`,`predicate`,e):yield*this._findInIndex(a.subjects,null,null,null,`subject`,`predicate`,`object`,e))}match(e,t,n,r){return new lt(this,e,t,n,r,{entityIndex:this._entityIndex})}countQuads(e,t,n,r){let i=this._getGraphs(r),a=0,o,s,c,l;if(e&&!(s=this._termToNumericId(e))||t&&!(c=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n)))return 0;for(let r in i)(o=i[r])&&(e?n?a+=this._countInIndex(o.objects,l,s,c):a+=this._countInIndex(o.subjects,s,c,l):t?a+=this._countInIndex(o.predicates,c,l,s):a+=this._countInIndex(o.objects,l,s,c));return a}forEach(e,t,n,r,i){this.some(t=>(e(t,this),!1),t,n,r,i)}every(e,t,n,r,i){return!this.some(t=>!e(t,this),t,n,r,i)}some(e,t,n,r,i){for(let a of this.readQuads(t,n,r,i))if(e(a,this))return!0;return!1}getSubjects(e,t,n){let r=[];return this.forSubjects(e=>{r.push(e)},e,t,n),r}forSubjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.predicates,o,s,e):this._loopByKey1(a.subjects,o,e):s?this._loopByKey0(a.objects,s,e):this._loop(a.subjects,e))}getPredicates(e,t,n){let r=[];return this.forPredicates(e=>{r.push(e)},e,t,n),r}forPredicates(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.objects,s,o,e):this._loopByKey0(a.subjects,o,e):s?this._loopByKey1(a.predicates,s,e):this._loop(a.predicates,e))}getObjects(e,t,n){let r=[];return this.forObjects(e=>{r.push(e)},e,t,n),r}forObjects(e,t,n,r){let i=this._getGraphs(r),a,o,s;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(s=this._termToNumericId(n))))for(r in i)(a=i[r])&&(o?s?this._loopBy2Keys(a.subjects,o,s,e):this._loopByKey1(a.objects,o,e):s?this._loopByKey0(a.predicates,s,e):this._loop(a.objects,e))}getGraphs(e,t,n){let r=[];return this.forGraphs(e=>{r.push(e)},e,t,n),r}forGraphs(e,t,n,r){for(let i in this._graphs)this.some(t=>(e(t.graph),!0),t,n,r,this._termFromId(this._entities[i]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){let n={},r=t?(()=>!0):((e,t)=>{throw Error(`${e.value} ${t}`)}),i=this.getQuads(null,g.rdf.rest,g.rdf.nil,null),a=e?[...i]:[];return i.forEach(t=>{let i=[],o=!1,s,c,l=t.graph,u=t.subject;for(;u&&!o;){let e=this.getQuads(null,null,u,null),t=this.getQuads(u,null,null,null),n,d=null,f=null,p=null;for(let i=0;i<t.length&&!o;i++)n=t[i],n.graph.equals(l)?s?o=r(u,`has non-list arcs out`):n.predicate.value===g.rdf.first?d?o=r(u,`has multiple rdf:first arcs`):a.push(d=n):n.predicate.value===g.rdf.rest?f?o=r(u,`has multiple rdf:rest arcs`):a.push(f=n):e.length?o=r(u,`can't be subject and object`):(s=n,c=`subject`):o=r(u,`not confined to single graph`);for(let t=0;t<e.length&&!o;++t)n=e[t],s?o=r(u,`can't have coreferences`):n.predicate.value===g.rdf.rest?p?o=r(u,`has incoming rdf:rest arcs`):p=n:(s=n,c=`object`);d?i.unshift(d.object):o=r(u,`has no list head`),u=p&&p.subject}o?e=!1:s&&(n[s[c].value]=i)}),e&&this.removeQuads(a),n}addAll(t){if(t instanceof lt&&(t=t.filtered),Array.isArray(t))this.addQuads(t);else if(t instanceof e&&t._entityIndex===this._entityIndex)t._size!==0&&(this._graphs=rt(this._graphs,t._graphs),this._size=null);else for(let e of t)this.add(e);return this}contains(t){if(t instanceof lt&&(t=t.filtered),t===this)return!0;if(!(t instanceof e)||this._entityIndex!==t._entityIndex)return t.every(e=>this.has(e));let n=this._graphs,r=t._graphs,i,a,o,s,c;for(let e in r){if(!(i=n[e]))return!1;i=i.subjects;for(let t in a=r[e].subjects){if(!(o=i[t]))return!1;for(let e in s=a[t]){if(!(c=o[e]))return!1;for(let t in s[e])if(!(t in c))return!1}}}return!0}deleteMatches(e,t,n,r){for(let i of this.match(e,t,n,r))this.removeQuad(i);return this}difference(t){if(t&&t instanceof lt&&(t=t.filtered),t===this)return new e({entityIndex:this._entityIndex});if(t instanceof e&&t._entityIndex===this._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=at(this._graphs,t._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>!t.has(e))}equals(e){return e instanceof lt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)t(e,this)&&n.add(e);return n}intersection(t){if(t instanceof lt&&(t=t.filtered),t===this){let t=new e({entityIndex:this._entityIndex});return t._graphs=rt(Object.create(null),this._graphs),t._size=this._size,t}else if(t instanceof e&&this._entityIndex===t._entityIndex){let n=new e({entityIndex:this._entityIndex}),r=it(t._graphs,this._graphs);return r&&(n._graphs=r,n._size=null),n}return this.filter(e=>t.has(e))}map(t){let n=new e({entityIndex:this._entityIndex});for(let e of this)n.add(t(e,this));return n}reduce(e,t){let n=this.readQuads(),r=t===void 0?n.next().value:t;for(let t of n)r=e(r,t,this);return r}toArray(){return this.getQuads()}toCanonical(){throw Error(`not implemented`)}toStream(){return this.match()}toString(){return new we().quadsToString(this)}union(t){let n=new e({entityIndex:this._entityIndex});return n._graphs=rt(Object.create(null),this._graphs),n._size=this._size,n.addAll(t),n}*[Symbol.iterator](){yield*this.readQuads()}};function ct(e,t,n=0){let r=t[n];if(r&&!(r in e))return!1;let i=!1;for(let a in r?{[r]:e[r]}:e){let r=n===2?null:ct(e[a],t,n+1);r!==!1&&(i||=Object.create(null),i[a]=r)}return i}var lt=class e extends tt.Readable{constructor(e,t,n,r,i,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:r,graph:i,options:a})}get filtered(){if(!this._filtered){let{n3Store:e,graph:t,object:n,predicate:r,subject:i}=this,a=this._filtered=new st({factory:e._factory,entityIndex:this.options.entityIndex}),o,s,c;if(i&&!(o=a._termToNumericId(i))||r&&!(s=a._termToNumericId(r))||n&&!(c=a._termToNumericId(n)))return a;let l=e._getGraphs(t);for(let e in l){let t,n,r,i;(i=l[e])&&(!o&&s?(n=ct(i.predicates,[s,c,o]))&&(t=ct(i.subjects,[o,s,c]),r=ct(i.objects,[c,o,s])):c?(r=ct(i.objects,[c,o,s]))&&(t=ct(i.subjects,[o,s,c]),n=ct(i.predicates,[s,c,o])):(t=ct(i.subjects,[o,s,c]))&&(n=ct(i.predicates,[s,c,o]),r=ct(i.objects,[c,o,s])),t&&(a._graphs[e]={subjects:t,predicates:n,objects:r}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[nt]&&(this[nt]=this[Symbol.iterator]());let t=this[nt];for(;--e>=0;){let{done:e,value:n}=t.next();if(e){this.push(null);return}this.push(n)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,r){return this.filtered.deleteMatches(e,t,n,r)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,r,i){return this.filtered.every(e,t,n,r,i)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,r,i){return this.filtered.forEach(e,t,n,r,i)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,n,r,i){return this.filtered.some(e,t,n,r,i)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,t){return this.filtered.reduce(e,t)}toString(){return new we().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(t,n,r,i){return new e(this.filtered,t,n,r,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}},ut=class extends tt.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let t=new oe(e),n,r,i={onQuad:(e,t)=>{e&&this.emit(`error`,e)||t&&this.push(t)},onPrefix:(e,t)=>{this.emit(`prefix`,e,t)}};e&&e.comments&&(i.onComment=e=>{this.emit(`comment`,e)}),t.parse({on:(e,t)=>{switch(e){case`data`:n=t;break;case`end`:r=t;break}}},i),this._transform=(e,t,r)=>{n(e),r()},this._flush=e=>{r(),e()}}import(e){return e.on(`data`,e=>{this.write(e)}),e.on(`end`,()=>{this.end()}),e.on(`error`,e=>{this.emit(`error`,e)}),this}},W=`http://www.w3.org/ns/shacl#`,dt=`http://datashapes.org/dash#`,ft=`http://www.w3.org/2001/XMLSchema#`,pt=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,mt=`http://www.w3.org/2000/01/rdf-schema#`,ht=`http://www.w3.org/2004/02/skos/core#`,gt=`http://www.w3.org/2002/07/owl#`,G=`http://www.w3.org/ns/oa#`,_t=`http://purl.org/dc/terms/`,vt=k.namedNode(`loaded-shapes`),yt=k.namedNode(`loaded-data`),bt=k.namedNode(pt+`type`),xt=k.namedNode(pt+`langString`),K=k.namedNode(_t+`conformsTo`),St=k.namedNode(mt+`subClassOf`),Ct=k.namedNode(gt+`imports`),wt=k.namedNode(ht+`broader`),Tt=k.namedNode(ht+`narrower`),Et=k.namedNode(W+`NodeShape`),Dt=k.namedNode(W+`IRI`),Ot=k.namedNode(W+`property`),kt=k.namedNode(W+`class`),At=k.namedNode(W+`node`),jt=k.namedNode(W+`targetClass`),Mt=k.namedNode(W+`nodeKind`),Nt=k.namedNode(ft+`string`),Pt=k.namedNode(ft+`boolean`);function Ft(e,t,n=W,r){let i=``,a=It(e,t,n,r);return a&&(i=a.value),i}function It(e,t,n=W,r){let i,a=n+t;if(r?.length){for(let t of r)for(let n of e)if(n.predicate.value===a){if(n.object.id.endsWith(`@${t}`))return n.object;n.object.id.indexOf(`@`)<0?i=n.object:i||=n.object}}else for(let t of e)if(t.predicate.value===a)return t.object;return i}function Lt(e){e.querySelector(`.editor`)?.focus()}function Rt(e,t){return Ft(e,`prefLabel`,`http://www.w3.org/2004/02/skos/core#`,t)||Ft(e,`label`,`http://www.w3.org/2000/01/rdf-schema#`,t)||Ft(e,`title`,`http://purl.org/dc/terms/`,t)||Ft(e,`name`,`http://xmlns.com/foaf/0.1/`,t)}function zt(e,t,n){let r=[];for(let i of e)r.push({value:i,label:Rt(t.getQuads(i,null,null,null),n),children:[]});return r}function Bt(e,t){for(let n in t){let r=t[n];e.startsWith(r)&&(e=e.slice(r.length))}return e}function Vt(e,t,n,r,i=new Set){for(let a of t.owlImports)i.has(a.id)||(i.add(a.id),r.push(...n.getSubjects(bt,e,a)));t.parent&&Vt(e,t.parent,n,r,i)}function Ht(e,t){if(t.in){let e=t.config.lists[t.in];return zt(e?.length?e:[],t.config.store,t.config.languages)}else{let n=t.config.store.getSubjects(bt,e,vt);n.push(...t.config.store.getSubjects(bt,e,yt)),Vt(e,t,t.config.store,n);let r=new Map,i=new Map;for(let e of n)r.set(e.id,{value:e,label:Rt(t.config.store.getQuads(e,null,null,null),t.config.languages),children:[]});for(let e of n){for(let n of t.config.store.getObjects(e,wt,null))r.has(n.id)&&i.set(e.id,n.id);for(let n of t.config.store.getObjects(e,Tt,null))r.has(n.id)&&i.set(n.id,e.id);for(let n of t.config.store.getObjects(e,St,null))r.has(n.id)&&i.set(e.id,n.id)}for(let[e,t]of i.entries())r.get(t)?.children?.push(r.get(e));let a=[];for(let[e,t]of r.entries())i.has(e)||a.push(t);for(let n of t.config.store.getSubjects(St,e,null))a.push(...Ht(n,t));return a}}function Ut(e){let t;try{t=new URL(e)}catch{return!1}return t.protocol===`http:`||t.protocol===`https:`}function q(e,t,n){if(t===void 0)return n;if(n===void 0)return t;let r=e.indexOf(t.language);if(r<0)return n;let i=e.indexOf(n.language);return i<0||i>r?t:n}function Wt(e,t){let n;for(let r of t)n=q(e,n,r);return n?n.value:``}var Gt=/^(-?\d{4,}-\d{2}-\d{2})(Z|[+-]\d{2}:\d{2})?$/,Kt=/^(-?\d{4,}-\d{2}-\d{2})T(\d{2}:\d{2})(?::(\d{2})(\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/,qt=/^(-?\d{4,}-\d{2}-\d{2}T\d{2}:\d{2})(?::(\d{2})(\.\d+)?)?$/;function Jt(e){let t=e.match(Gt);if(!t){let t=e.match(Kt);return t?{value:t[1],suffix:t[5]||``}:void 0}return{value:t[1],suffix:t[2]||``}}function Yt(e){let t=e.match(Kt);if(!t){let t=e.match(Gt);return t?{value:`${t[1]}T00:00:00`,suffix:t[2]||``}:void 0}return{value:`${t[1]}T${t[2]}:${t[3]||`00`}`,suffix:t[5]||``}}function Xt(e,t=``){let n=e.match(Gt);return n?`${n[1]}${t}`:e}function Zt(e,t=``){let n=e.match(qt);return n?`${n[1]}:${n[2]||`00`}${n[3]||``}${t}`:e}function Qt(e){let t=new Set;for(let n of e.getObjects(null,kt,vt))t.add(n.value);for(let n of e.getObjects(null,jt,vt))t.add(n.value);return t}function $t(e,t){return e instanceof Set?[...t].filter(t=>!e.has(t)):[...t].filter(t=>!e.includes(t))}function en(e,{remove:t=!1,ignoreErrors:n=!1}={}){let r={},i=n?(()=>!0):((e,t)=>{throw Error(`${e.value} ${t}`)}),a=e.getQuads(null,pt+`rest`,pt+`nil`,null),o=t?[...a]:[];return a.forEach(n=>{let a=[],s=!1,c,l,u=n.graph,d=n.subject;for(;d&&!s;){let t=e.getQuads(null,null,d,null),n=e.getQuads(d,null,null,null).filter(e=>!e.predicate.equals(bt)),r,f=null,p=null,m=null;for(let e=0;e<n.length&&!s;e++)r=n[e],r.graph.equals(u)?c?s=i(d,`has non-list arcs out`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#first`?f?s=i(d,`has multiple rdf:first arcs`):o.push(f=r):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?p?s=i(d,`has multiple rdf:rest arcs`):o.push(p=r):t.length?s=i(d,`can't be subject and object`):(c=r,l=`subject`):s=i(d,`not confined to single graph`);for(let e=0;e<t.length&&!s;++e)r=t[e],c?s=i(d,`can't have coreferences`):r.predicate.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#rest`?m?s=i(d,`has incoming rdf:rest arcs`):m=r:(c=r,l=`object`);f?a.unshift(f.object):s=i(d,`has no list head`),d=m&&m.subject}s?t=!1:c&&(r[c[l].value]=a)}),t&&e.removeQuads(o),r}var tn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.removeDotSegmentsOfPath=e.removeDotSegments=e.resolve=void 0;function t(e,t){t||=``;let i=t.indexOf(`#`);if(i>0&&(t=t.substr(0,i)),!e.length){if(t.indexOf(`:`)<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);return t}if(e.startsWith(`?`)){let n=t.indexOf(`?`);return n>0&&(t=t.substr(0,n)),t+e}if(e.startsWith(`#`))return t+e;if(!t.length){let t=e.indexOf(`:`);if(t<0)throw Error(`Found invalid relative IRI '${e}' for a missing baseIRI`);return r(e,t)}let a=e.indexOf(`:`);if(a>=0)return r(e,a);let o=t.indexOf(`:`);if(o<0)throw Error(`Found invalid baseIRI '${t}' for value '${e}'`);let s=t.substr(0,o+1);if(e.indexOf(`//`)===0)return s+r(e,a);let c;if(t.indexOf(`//`,o)===o+1){if(c=t.indexOf(`/`,o+3),c<0)return t.length>o+3?t+`/`+r(e,a):s+r(e,a)}else if(c=t.indexOf(`/`,o+1),c<0)return s+r(e,a);if(e.indexOf(`/`)===0)return t.substr(0,c)+n(e);let l=t.substr(c),u=l.lastIndexOf(`/`);return u>=0&&u<l.length-1&&(l=l.substr(0,u+1),e[0]===`.`&&e[1]!==`.`&&e[1]!==`/`&&e[2]&&(e=e.substr(1))),e=l+e,e=n(e),t.substr(0,c)+e}e.resolve=t;function n(e){let t=[],n=0;for(;n<e.length;)switch(e[n]){case`/`:if(e[n+1]===`.`)if(e[n+2]===`.`){if(!i(e[n+3])){t.push([]),n++;break}t.pop(),e[n+3]||t.push([]),n+=3}else{if(!i(e[n+2])){t.push([]),n++;break}e[n+2]||t.push([]),n+=2}else t.push([]),n++;break;case`#`:case`?`:t.length||t.push([]),t[t.length-1].push(e.substr(n)),n=e.length;break;default:t.length||t.push([]),t[t.length-1].push(e[n]),n++;break}return`/`+t.map(e=>e.join(``)).join(`/`)}e.removeDotSegments=n;function r(e,t){let r=t+1;t>=0?e[t+1]===`/`&&e[t+2]===`/`&&(r=t+3):e[0]===`/`&&e[1]===`/`&&(r=2);let i=e.indexOf(`/`,r);return i<0?e:e.substr(0,i)+n(e.substr(i))}e.removeDotSegmentsOfPath=r;function i(e){return!e||e===`#`||e===`?`||e===`/`}})),nn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n),Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[n]}})}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(tn(),e)})),rn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`
|
|
17
17
|
\r --�𐀀-`,e.S=` \r
|
|
18
|
-
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),
|
|
19
|
-
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),
|
|
20
|
-
${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}break;default:}}function Je(e,t){for(let n of Object.keys(t))qe(e,n,t[n])}var Ye=e=>p.test(e),Xe=e=>l.test(e),Ze=0,Qe=1,$e=2;e.EVENTS=[`xmldecl`,`text`,`processinginstruction`,`doctype`,`comment`,`opentagstart`,`attribute`,`opentag`,`closetag`,`cdata`,`error`,`end`,`ready`];var et={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`};e.SaxesParser=class{get closed(){return this._closed}constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,t){this.nameStartCheck=d,this.nameCheck=f,this.isName=Ye,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},g);let e=this.opt.additionalNamespaces;e!=null&&(Je(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=o,this.nameCheck=s,this.isName=Xe,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var e;this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Ze,this.attribList=[];let{fragmentOpt:t}=this;this.state=t?N:b,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);n=`1.0`}this.setXMLVersion(n),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(_),(e=this.readyHandler)==null||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[et[e]]=t}off(e){this[et[e]]=void 0}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close; assign an onready handler.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===Te||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>=Ee||n===Ce)return n;switch(n){case we:return this.line++,this.column=0,this.positionAtNewLine=this.position,we;case Te:return e.charCodeAt(t+1)===we&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==Ve||n===Ce)return n;switch(n){case we:return this.line++,this.column=0,this.positionAtNewLine=this.position,we;case Te:{let n=e.charCodeAt(t+1);(n===we||n===Be)&&(this.i=t+2)}case Be:case Ve:return this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===y?we:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===y,a=i?we:r;if(a===v||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case y:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=we;break;case v:return this.text+=n.slice(t),!1;default:}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===v)return this.name+=e.slice(t),v;if(!s(n))return this.name+=e.slice(t,this.prevI),n===y?we:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===v||!i(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=a,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=x}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case Pe:if(this.state=F,this.text.length!==0)throw Error(`no-empty text at start`);break;case v:break;default:this.unget(),this.state=N,this.xmlDeclPossible=!1}}sDoctype(){var e;let t=this.captureTo(We);switch(t){case Ie:(e=this.doctypeHandler)==null||e.call(this,this.text),this.text=``,this.state=N,this.doctype=!0;break;case v:break;default:this.text+=String.fromCodePoint(t),t===Re?this.state=w:He(t)&&(this.state=C,this.q=t)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=S)}sDTD(){let e=this.captureTo(Ge);e!==v&&(this.text+=String.fromCodePoint(e),e===ze?this.state=S:e===Pe?this.state=E:He(e)&&(this.state=T,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=w,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case De:this.state=D,this.openWakaBang=``;break;case Le:this.state=j;break;default:this.state=w}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?O:w,this.openWakaBang=``)}sDTDComment(){this.captureToChar(je)&&(this.text+=`-`,this.state=k)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===je?A:O}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===Ie?this.state=w:(this.fail(`malformed comment.`),this.state=O)}sDTDPI(){this.captureToChar(Le)&&(this.text+=`?`,this.state=M)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===Ie&&(this.state=w)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;loop:for(;;)switch(this.getCode()){case y:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case Ne:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI);this.state=n;let i;r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),(n!==N||this.textHandler!==void 0)&&(this.text+=i);break loop}case v:this.entity+=t.slice(e);break loop;default:}}sOpenWaka(){let e=this.getCode();if(o(e))this.state=pe,this.unget(),this.xmlDeclPossible=!1;else switch(e){case Me:this.state=xe,this.xmlDeclPossible=!1;break;case De:this.state=I,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case Le:this.state=ne;break;default:this.fail(`disallowed character in tag name`),this.state=N,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=V,this.openWakaBang=``;break;case`--`:this.state=R,this.openWakaBang=``;break;case`DOCTYPE`:this.state=S,(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(je)&&(this.state=z)}sCommentEnding(){var e;let t=this.getCodeNorm();t===je?(this.state=B,(e=this.commentHandler)==null||e.call(this,this.text),this.text=``):(this.text+=`-${String.fromCodePoint(t)}`,this.state=R)}sCommentEnded(){let e=this.getCodeNorm();e===Ie?this.state=N:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=R)}sCData(){this.captureToChar(ze)&&(this.state=ee)}sCDataEnding(){let e=this.getCodeNorm();e===ze?this.state=te:(this.text+=`]${String.fromCodePoint(e)}`,this.state=V)}sCDataEnding2(){var e;let t=this.getCodeNorm();switch(t){case Ie:(e=this.cdataHandler)==null||e.call(this,this.text),this.text=``,this.state=N;break;case ze:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=V}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=re):e===Le||i(e)?(this.fail(`processing instruction without a target.`),this.state=e===Le?ae:ie):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=re)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===v){this.piTarget+=e.slice(t);return}if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===Le;r||i(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?fe:oe):this.state=r?ae:ie:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===Le?this.state=ae:i(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(Le)&&(this.state=ae)}sPIEnding(){var e;let t=this.getCodeNorm();if(t===Ie){let{piTarget:t}=this;t.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),(e=this.piHandler)==null||e.call(this,{target:t,body:this.text}),this.piTarget=this.text=``,this.state=N}else t===Le?this.text+=`?`:(this.text+=`?${String.fromCodePoint(t)}`,this.state=ie);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===Le){this.state=fe;return}e!==v&&(this.state=se,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(Ke);if(e===Le){this.state=fe,this.name+=this.text,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(i(e)||e===Fe){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===Fe?le:ce}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===Le){this.state=fe,this.fail(`XML declaration is incomplete.`);return}i(e)||(e!==Fe&&this.fail(`value required.`),this.state=le)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===Le){this.state=fe,this.fail(`XML declaration is incomplete.`);return}i(e)||(He(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=Ee),this.state=ue)}sXMLDeclValue(){let e=this.captureTo([this.q,Le]);if(e===Le){this.state=fe,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(e===v)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t;break;default:}this.name=``,this.state=de}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===Le){this.state=fe;return}i(e)||(this.fail(`whitespace required.`),this.unget()),this.state=oe}sXMLDeclEnding(){var e;this.getCodeNorm()===Ie?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),(e=this.xmldeclHandler)==null||e.call(this,this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=N):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){var e;let t=this.captureNameChars();if(t===v)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(e=this.openTagStartHandler)==null||e.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),t){case Ie:this.openTag();break;case Me:this.state=me;break;default:i(t)||this.fail(`disallowed character in tag name.`),this.state=he}}sOpenTagSlash(){this.getCode()===Ie?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=he)}sAttrib(){let e=this.skipSpaces();e!==v&&(o(e)?(this.unget(),this.state=ge):e===Ie?this.openTag():e===Me?this.state=me:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===Fe?this.state=ve:i(e)?this.state=_e:e===Ie?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==v&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case v:return;case Fe:this.state=ve;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===Ie?this.openTag():o(e)?(this.unget(),this.state=ge):(this.fail(`disallowed character in attribute name.`),this.state=he)}}sAttribValue(){let e=this.getCodeNorm();He(e)?(this.q=e,this.state=ye):i(e)||(this.fail(`unquoted attribute value.`),this.state=be,this.unget())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=H;return;case ke:this.text+=t.slice(n,this.prevI),this.state=P,this.entityReturnState=ye;return;case we:case y:case Ce:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case Pe:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case v:this.text+=t.slice(n);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();i(e)?this.state=he:e===Ie?this.openTag():e===Me?this.state=me:o(e)?(this.fail(`no whitespace between attributes.`),this.unget(),this.state=ge):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(U);switch(e){case ke:this.state=P,this.entityReturnState=be;break;case Pe:this.fail(`disallowed character.`);break;case v:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===Ie?this.openTag():this.state=he}}sCloseTag(){let e=this.captureNameChars();e===Ie?this.closeTag():i(e)?this.state=Se:e!==v&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case Ie:this.closeTag();break;case v:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;scanLoop:for(;;)switch(this.getCode()){case Pe:if(this.state=F,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=Ze;break scanLoop;case ke:this.state=P,this.entityReturnState=N,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=Ze;break scanLoop;case ze:switch(t){case Ze:t=Qe;break;case Qe:t=$e;break;case $e:break;default:throw Error(`impossible state`)}break;case Ie:t===$e&&this.fail(`the string "]]>" is disallowed in char data.`),t=Ze;break;case y:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=Ze;break;case v:r!==void 0&&(this.text+=n.slice(e));break scanLoop;default:t=Ze}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;outRootLoop:for(;;){let a=this.getCode();switch(a){case Pe:if(this.state=F,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break outRootLoop;case ke:this.state=P,this.entityReturnState=N,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break outRootLoop;case y:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case v:n!==void 0&&(this.text+=t.slice(e));break outRootLoop;default:i(a)||(r=!0)}}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){var n;let{prefix:r,local:i}=this.qname(e),a={name:e,prefix:r,local:i,value:t};if(this.attribList.push(a),(n=this.attributeHandler)==null||n.call(this,a),r===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[i]=e,qe(this,i,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,qe(this,``,e)}}pushAttribPlain(e,t){var n;let r={name:e,value:t};this.attribList.push(r),(n=this.attributeHandler)==null||n.call(this,r)}end(){var e,t;this.sawRoot||this.fail(`document must contain a root element.`);let{tags:n}=this;for(;n.length>0;){let e=n.pop();this.fail(`unclosed tag: ${e.name}`)}this.state!==b&&this.state!==N&&this.fail(`unexpected end.`);let{text:r}=this;return r.length!==0&&((e=this.textHandler)==null||e.call(this,r),this.text=``),this._closed=!0,(t=this.endHandler)==null||t.call(this),this._init(),this}resolve(e){var t;let n=this.topNS[e];if(n!==void 0)return n;let{tags:r}=this;for(let t=r.length-1;t>=0;t--)if(n=r[t].ns[e],n!==void 0)return n;return n=this.ns[e],n===void 0?(t=this.opt).resolvePrefix?.call(t,e):n}qname(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qname(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?h:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:t}=this,n=this.tag;n.isSelfClosing=!1,(e=this.openTagHandler)==null||e.call(this,n),t.push(n),this.state=N,this.name=``}openSelfClosingTag(){var e,t;this.processAttribs();let{tags:n}=this,r=this.tag;r.isSelfClosing=!0,(e=this.openTagHandler)==null||e.call(this,r),(t=this.closeTagHandler)==null||t.call(this,r),(this.tag=n[n.length-1]??null)===null&&(this.closedRoot=!0),this.state=N,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=N,this.name=``,t===``){this.fail(`weird empty close tag.`),this.text+=`</>`;return}let n=this.closeTagHandler,r=e.length;for(;r-- >0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}}})),en=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ParseError=void 0,e.ParseError=class extends Error{constructor(e,t){let n=e.saxParser;super(e.trackPosition?`Line ${n.line} column ${n.column+1}: ${t}`:t)}}})),tn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BlankNode=void 0,e.BlankNode=class{constructor(e){this.termType=`BlankNode`,this.value=e}equals(e){return!!e&&e.termType===`BlankNode`&&e.value===this.value}}})),nn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DefaultGraph=void 0;var t=class{constructor(){this.termType=`DefaultGraph`,this.value=``}equals(e){return!!e&&e.termType===`DefaultGraph`}};e.DefaultGraph=t,t.INSTANCE=new t})),rn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NamedNode=void 0,e.NamedNode=class{constructor(e){this.termType=`NamedNode`,this.value=e}equals(e){return!!e&&e.termType===`NamedNode`&&e.value===this.value}}})),an=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Literal=void 0;var t=rn(),n=class e{constructor(t,n){this.termType=`Literal`,this.value=t,typeof n==`string`?(this.language=n,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=``):n?`termType`in n?(this.language=``,this.datatype=n,this.direction=``):(this.language=n.language,this.datatype=n.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=n.direction||``):(this.language=``,this.datatype=e.XSD_STRING,this.direction=``)}equals(e){return!!e&&e.termType===`Literal`&&e.value===this.value&&e.language===this.language&&(e.direction===this.direction||!e.direction&&this.direction===``)&&this.datatype.equals(e.datatype)}};e.Literal=n,n.RDF_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),n.RDF_DIRECTIONAL_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),n.XSD_STRING=new t.NamedNode(`http://www.w3.org/2001/XMLSchema#string`)})),on=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Quad=void 0,e.Quad=class{constructor(e,t,n,r){this.termType=`Quad`,this.value=``,this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&(e.termType===`Quad`||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}})),sn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Variable=void 0,e.Variable=class{constructor(e){this.termType=`Variable`,this.value=e}equals(e){return!!e&&e.termType===`Variable`&&e.value===this.value}}})),cn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DataFactory=void 0;var t=tn(),n=nn(),r=an(),i=rn(),a=on(),o=sn(),s=0;e.DataFactory=class{constructor(e){this.blankNodeCounter=0,e||={},this.blankNodePrefix=e.blankNodePrefix||`df_${s++}_`}namedNode(e){return new i.NamedNode(e)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new r.Literal(e,t)}variable(e){return new o.Variable(e)}defaultGraph(){return n.DefaultGraph.INSTANCE}quad(e,t,n,r){return new a.Quad(e,t,n,r||this.defaultGraph())}fromTerm(e){switch(e.termType){case`NamedNode`:return this.namedNode(e.value);case`BlankNode`:return this.blankNode(e.value);case`Literal`:return e.language?this.literal(e.value,e.language):e.datatype.equals(r.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case`Variable`:return this.variable(e.value);case`DefaultGraph`:return this.defaultGraph();case`Quad`:return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}})),J=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(tn(),e),n(cn(),e),n(nn(),e),n(an(),e),n(rn(),e),n(on(),e),n(sn(),e)})),ln=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateIri=e.IriValidationStrategy=void 0;function t(){let e=`[!$&'()*+,;=]`,t=`%[a-fA-F0-9]{2}`,n=`([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,r=`${n}\\.${n}\\.${n}\\.${n}`,i=`[a-fA-F0-9]{1,4}`,a=`(${i}:${i}|${r})`,o=`\\[(${`((${i}:){6}${a}|::(${i}:){5}${a}|(${i})?::(${i}:){4}${a}|((${i}:){0,1}${i})?::(${i}:){3}${a}|((${i}:){0,2}${i})?::(${i}:){2}${a}|((${i}:){0,3}${i})?::${i}:${a}|((${i}:){0,4}${i})?::${a}|((${i}:){0,5}${i})?::${i}|((${i}:){0,6}${i})?::)`}|${`v[a-fA-F0-9]+\\.(${e}|${e}|":)+`})\\]`,s=`[a-zA-Z0-9\\-._~\xA0-豈-﷏ﷰ-𐀀-𠀀-𰀀------------]`,c=`(${s}|${t}|${e}|[:@])*`,l=`(${c}|[\\/?])*`,u=`(${c}|[---]|[\\/?])*`,d=`(${c})+`,f=`(${c})*`,p=`${d}(\\/${f})*`,m=`\\/(${d}(\\/${f})*)?`,h=`(\\/${f})*`,g=`(${o}|${r}|${`(${s}|${t}|${e})*`})`,_=`^[a-zA-Z][a-zA-Z0-9+\\-.]*:${`(\\/\\/${`(${`(${s}|${t}|${e}|:)*`}@)?${g}(:[0-9]*)?`}${h}|${m}|${p}|)`}(\\?${u})?(#${l})?$`;return new RegExp(_,`u`)}var n=t(),r=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u,i;(function(e){e.Strict=`strict`,e.Pragmatic=`pragmatic`,e.None=`none`})(i=e.IriValidationStrategy||={});function a(e,t=i.Strict){switch(t){case i.Strict:return n.test(e)?void 0:Error(`Invalid IRI according to RFC 3987: '${e}'`);case i.Pragmatic:return r.test(e)?void 0:Error(`Invalid IRI according to RDF Turtle: '${e}'`);case i.None:return;default:return Error(`Not supported validation strategy "${t}"`)}}e.validateIri=a})),un=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(ln(),e)})),dn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ParseType=e.RdfXmlParser=void 0;var t=Yt(),n=$t(),r=et(),i=en(),a=J(),o=un(),s=class e extends r.Transform{constructor(e){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},e&&(Object.assign(this,e),this.options=e),this.dataFactory||=new a.DataFactory,this.baseIRI||=``,this.defaultGraph||=this.dataFactory.defaultGraph(),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||=this.validateUri?o.IriValidationStrategy.Pragmatic:o.IriValidationStrategy.None,this.parseUnsupportedVersions=!!e?.parseUnsupportedVersions,this.version=e?.version,this.saxParser=new n.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){let n=new r.PassThrough({readableObjectMode:!0});t.on(`error`,e=>i.emit(`error`,e)),t.on(`data`,e=>n.push(e)),t.on(`end`,()=>n.push(null));let i=n.pipe(new e(this.options));return i}_transform(e,t,n){if(this.version){let e=this.version;if(this.version=void 0,!this.isValidVersion(e))return n(this.newParseError(`Detected unsupported version as media type parameter: ${e}`))}try{this.saxParser.write(e)}catch(e){return n(e)}n()}newParseError(e){return new i.ParseError(this,e)}valueToUri(e,n){return this.uriToNamedNode((0,t.resolve)(e,n.baseIRI))}uriToNamedNode(e){let t=(0,o.validateIri)(e,this.iriValidationStrategy);if(t instanceof Error)throw this.newParseError(t.message);return this.dataFactory.namedNode(e)}validateNcname(t){if(!e.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}createLiteral(e,t){return this.dataFactory.literal(e,t.datatype?t.datatype:t.language?{language:t.language,direction:t.rdfVersion?t.direction:void 0}:void 0)}isValidVersion(t){return this.parseUnsupportedVersions||e.SUPPORTED_VERSIONS.includes(t)}attachSaxListeners(){this.saxParser.on(`error`,e=>this.emit(`error`,e)),this.saxParser.on(`opentag`,this.onTag.bind(this)),this.saxParser.on(`text`,this.onText.bind(this)),this.saxParser.on(`cdata`,this.onText.bind(this)),this.saxParser.on(`closetag`,this.onCloseTag.bind(this)),this.saxParser.on(`doctype`,this.onDoctype.bind(this))}onTag(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null,n=c.RESOURCE;if(t&&(t.hadChildren=!0,n=t.childrenParseType),t&&t.childrenStringTags){let n=e.name,r=``;for(let{key:e,value:n}of t.namespaces||[])r+=` ${e}="${n}"`;for(let t in e.attributes)r+=` ${t}="${e.attributes[t].value}"`;let i=`<${`${n}${r}`}>`;t.childrenStringTags.push(i);let a={childrenStringTags:t.childrenStringTags};a.childrenStringEmitClosingTag=`</${n}>`,this.activeTagStack.push(a);return}let r={};t?(r.language=t.language,r.direction=t.direction,r.baseIRI=t.baseIRI,r.childrenTripleTerms=t.childrenTripleTerms,r.rdfVersion=t.rdfVersion):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),n===c.RESOURCE?this.onTagResource(e,r,t,!t):this.onTagProperty(e,r,t);for(let t in e.attributes){let n=e.attributes[t];n.prefix===`xmlns`&&(r.namespaces||=[],r.namespaces.push({key:`${n.prefix}:${n.local}`,value:n.value}))}t&&t.namespaces&&(r.namespaces=[...r.namespaces||[],...t.namespaces])}onTagResource(n,r,i,a){r.childrenParseType=c.PROPERTY;let o=!0;if(n.uri===e.RDF){if(!a&&e.FORBIDDEN_NODE_ELEMENTS.indexOf(n.local)>=0)throw this.newParseError(`Illegal node element name: ${n.local}`);switch(n.local){case`RDF`:r.childrenParseType=c.RESOURCE;case`Description`:o=!1}}let s=[],l=[],u=null,d=!1,f=!1,p=null;for(let a in n.attributes){let o=n.attributes[a];if(o.uri===e.RDF&&o.local===`version`){this.setVersion(r,o.value);continue}else if(i&&o.uri===e.RDF)switch(o.local){case`about`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
|
|
18
|
+
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),an=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`--�𐀀-`,e.RESTRICTED_CHAR=`-\b\v\f---`,e.S=` \r
|
|
19
|
+
`,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),on=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,e.NC_NAME_CHAR=`-`+e.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.NC_NAME_START_CHAR_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`]$`,`u`),e.NC_NAME_CHAR_RE=RegExp(`^[`+e.NC_NAME_CHAR+`]$`,`u`),e.NC_NAME_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`][`+e.NC_NAME_CHAR+`]*$`,`u`);function t(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNCNameStartChar=t;function n(e){return t(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNCNameChar=n})),sn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SaxesParser=e.EVENTS=void 0;var t=rn(),n=an(),r=on(),i=t.isS,a=t.isChar,o=t.isNameStartChar,s=t.isNameChar,c=t.S_LIST,l=t.NAME_RE,u=n.isChar,d=r.isNCNameStartChar,f=r.isNCNameChar,p=r.NC_NAME_RE,m=`http://www.w3.org/XML/1998/namespace`,h=`http://www.w3.org/2000/xmlns/`,g={__proto__:null,xml:m,xmlns:h},_={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},v=-1,y=-2,b=0,x=1,S=2,C=3,w=4,T=5,E=6,D=7,O=8,k=9,A=10,j=11,M=12,N=13,P=14,F=15,I=16,R=17,z=18,B=19,V=20,ee=21,te=22,ne=23,re=24,ie=25,ae=26,oe=27,se=28,ce=29,le=30,ue=31,de=32,fe=33,pe=34,me=35,he=36,ge=37,_e=38,ve=39,ye=40,H=41,be=42,xe=43,Se=44,Ce=9,we=10,Te=13,Ee=32,De=33,Oe=34,ke=38,Ae=39,je=45,Me=47,Ne=59,Pe=60,Fe=61,Ie=62,Le=63,Re=91,ze=93,Be=133,Ve=8232,He=e=>e===Oe||e===Ae,Ue=[Oe,Ae],We=[...Ue,Re,Ie],Ge=[...Ue,Pe,ze],Ke=[Fe,Le,...c],U=[...c,Ie,ke,Pe];function qe(e,t,n){switch(t){case`xml`:n!==m&&e.fail(`xml prefix must be bound to ${m}.`);break;case`xmlns`:n!==h&&e.fail(`xmlns prefix must be bound to ${h}.`);break;default:}switch(n){case h:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI \
|
|
20
|
+
${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}break;default:}}function Je(e,t){for(let n of Object.keys(t))qe(e,n,t[n])}var Ye=e=>p.test(e),Xe=e=>l.test(e),Ze=0,Qe=1,$e=2;e.EVENTS=[`xmldecl`,`text`,`processinginstruction`,`doctype`,`comment`,`opentagstart`,`attribute`,`opentag`,`closetag`,`cdata`,`error`,`end`,`ready`];var et={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`};e.SaxesParser=class{get closed(){return this._closed}constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,t){this.nameStartCheck=d,this.nameCheck=f,this.isName=Ye,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},g);let e=this.opt.additionalNamespaces;e!=null&&(Je(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=o,this.nameCheck=s,this.isName=Xe,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var e;this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Ze,this.attribList=[];let{fragmentOpt:t}=this;this.state=t?N:b,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);n=`1.0`}this.setXMLVersion(n),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(_),(e=this.readyHandler)==null||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[et[e]]=t}off(e){this[et[e]]=void 0}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close; assign an onready handler.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===Te||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>=Ee||n===Ce)return n;switch(n){case we:return this.line++,this.column=0,this.positionAtNewLine=this.position,we;case Te:return e.charCodeAt(t+1)===we&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return v;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==Ve||n===Ce)return n;switch(n){case we:return this.line++,this.column=0,this.positionAtNewLine=this.position,we;case Te:{let n=e.charCodeAt(t+1);(n===we||n===Be)&&(this.i=t+2)}case Be:case Ve:return this.line++,this.column=0,this.positionAtNewLine=this.position,y;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===y?we:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===y,a=i?we:r;if(a===v||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case y:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=we;break;case v:return this.text+=n.slice(t),!1;default:}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===v)return this.name+=e.slice(t),v;if(!s(n))return this.name+=e.slice(t,this.prevI),n===y?we:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===v||!i(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=a,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=x}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case Pe:if(this.state=F,this.text.length!==0)throw Error(`no-empty text at start`);break;case v:break;default:this.unget(),this.state=N,this.xmlDeclPossible=!1}}sDoctype(){var e;let t=this.captureTo(We);switch(t){case Ie:(e=this.doctypeHandler)==null||e.call(this,this.text),this.text=``,this.state=N,this.doctype=!0;break;case v:break;default:this.text+=String.fromCodePoint(t),t===Re?this.state=w:He(t)&&(this.state=C,this.q=t)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=S)}sDTD(){let e=this.captureTo(Ge);e!==v&&(this.text+=String.fromCodePoint(e),e===ze?this.state=S:e===Pe?this.state=E:He(e)&&(this.state=T,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=w,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case De:this.state=D,this.openWakaBang=``;break;case Le:this.state=j;break;default:this.state=w}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?O:w,this.openWakaBang=``)}sDTDComment(){this.captureToChar(je)&&(this.text+=`-`,this.state=k)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===je?A:O}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===Ie?this.state=w:(this.fail(`malformed comment.`),this.state=O)}sDTDPI(){this.captureToChar(Le)&&(this.text+=`?`,this.state=M)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===Ie&&(this.state=w)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;loop:for(;;)switch(this.getCode()){case y:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case Ne:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI);this.state=n;let i;r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),(n!==N||this.textHandler!==void 0)&&(this.text+=i);break loop}case v:this.entity+=t.slice(e);break loop;default:}}sOpenWaka(){let e=this.getCode();if(o(e))this.state=pe,this.unget(),this.xmlDeclPossible=!1;else switch(e){case Me:this.state=xe,this.xmlDeclPossible=!1;break;case De:this.state=I,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case Le:this.state=ne;break;default:this.fail(`disallowed character in tag name`),this.state=N,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=V,this.openWakaBang=``;break;case`--`:this.state=R,this.openWakaBang=``;break;case`DOCTYPE`:this.state=S,(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(je)&&(this.state=z)}sCommentEnding(){var e;let t=this.getCodeNorm();t===je?(this.state=B,(e=this.commentHandler)==null||e.call(this,this.text),this.text=``):(this.text+=`-${String.fromCodePoint(t)}`,this.state=R)}sCommentEnded(){let e=this.getCodeNorm();e===Ie?this.state=N:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=R)}sCData(){this.captureToChar(ze)&&(this.state=ee)}sCDataEnding(){let e=this.getCodeNorm();e===ze?this.state=te:(this.text+=`]${String.fromCodePoint(e)}`,this.state=V)}sCDataEnding2(){var e;let t=this.getCodeNorm();switch(t){case Ie:(e=this.cdataHandler)==null||e.call(this,this.text),this.text=``,this.state=N;break;case ze:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=V}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=re):e===Le||i(e)?(this.fail(`processing instruction without a target.`),this.state=e===Le?ae:ie):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=re)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===v){this.piTarget+=e.slice(t);return}if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===Le;r||i(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?fe:oe):this.state=r?ae:ie:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===Le?this.state=ae:i(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(Le)&&(this.state=ae)}sPIEnding(){var e;let t=this.getCodeNorm();if(t===Ie){let{piTarget:t}=this;t.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),(e=this.piHandler)==null||e.call(this,{target:t,body:this.text}),this.piTarget=this.text=``,this.state=N}else t===Le?this.text+=`?`:(this.text+=`?${String.fromCodePoint(t)}`,this.state=ie);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===Le){this.state=fe;return}e!==v&&(this.state=se,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(Ke);if(e===Le){this.state=fe,this.name+=this.text,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(i(e)||e===Fe){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===Fe?le:ce}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===Le){this.state=fe,this.fail(`XML declaration is incomplete.`);return}i(e)||(e!==Fe&&this.fail(`value required.`),this.state=le)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===Le){this.state=fe,this.fail(`XML declaration is incomplete.`);return}i(e)||(He(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=Ee),this.state=ue)}sXMLDeclValue(){let e=this.captureTo([this.q,Le]);if(e===Le){this.state=fe,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(e===v)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t;break;default:}this.name=``,this.state=de}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===Le){this.state=fe;return}i(e)||(this.fail(`whitespace required.`),this.unget()),this.state=oe}sXMLDeclEnding(){var e;this.getCodeNorm()===Ie?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),(e=this.xmldeclHandler)==null||e.call(this,this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=N):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){var e;let t=this.captureNameChars();if(t===v)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(e=this.openTagStartHandler)==null||e.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),t){case Ie:this.openTag();break;case Me:this.state=me;break;default:i(t)||this.fail(`disallowed character in tag name.`),this.state=he}}sOpenTagSlash(){this.getCode()===Ie?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=he)}sAttrib(){let e=this.skipSpaces();e!==v&&(o(e)?(this.unget(),this.state=ge):e===Ie?this.openTag():e===Me?this.state=me:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===Fe?this.state=ve:i(e)?this.state=_e:e===Ie?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==v&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case v:return;case Fe:this.state=ve;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===Ie?this.openTag():o(e)?(this.unget(),this.state=ge):(this.fail(`disallowed character in attribute name.`),this.state=he)}}sAttribValue(){let e=this.getCodeNorm();He(e)?(this.q=e,this.state=ye):i(e)||(this.fail(`unquoted attribute value.`),this.state=be,this.unget())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=H;return;case ke:this.text+=t.slice(n,this.prevI),this.state=P,this.entityReturnState=ye;return;case we:case y:case Ce:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case Pe:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case v:this.text+=t.slice(n);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();i(e)?this.state=he:e===Ie?this.openTag():e===Me?this.state=me:o(e)?(this.fail(`no whitespace between attributes.`),this.unget(),this.state=ge):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(U);switch(e){case ke:this.state=P,this.entityReturnState=be;break;case Pe:this.fail(`disallowed character.`);break;case v:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===Ie?this.openTag():this.state=he}}sCloseTag(){let e=this.captureNameChars();e===Ie?this.closeTag():i(e)?this.state=Se:e!==v&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case Ie:this.closeTag();break;case v:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;scanLoop:for(;;)switch(this.getCode()){case Pe:if(this.state=F,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=Ze;break scanLoop;case ke:this.state=P,this.entityReturnState=N,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=Ze;break scanLoop;case ze:switch(t){case Ze:t=Qe;break;case Qe:t=$e;break;case $e:break;default:throw Error(`impossible state`)}break;case Ie:t===$e&&this.fail(`the string "]]>" is disallowed in char data.`),t=Ze;break;case y:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=Ze;break;case v:r!==void 0&&(this.text+=n.slice(e));break scanLoop;default:t=Ze}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;outRootLoop:for(;;){let a=this.getCode();switch(a){case Pe:if(this.state=F,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break outRootLoop;case ke:this.state=P,this.entityReturnState=N,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break outRootLoop;case y:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case v:n!==void 0&&(this.text+=t.slice(e));break outRootLoop;default:i(a)||(r=!0)}}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){var n;let{prefix:r,local:i}=this.qname(e),a={name:e,prefix:r,local:i,value:t};if(this.attribList.push(a),(n=this.attributeHandler)==null||n.call(this,a),r===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[i]=e,qe(this,i,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,qe(this,``,e)}}pushAttribPlain(e,t){var n;let r={name:e,value:t};this.attribList.push(r),(n=this.attributeHandler)==null||n.call(this,r)}end(){var e,t;this.sawRoot||this.fail(`document must contain a root element.`);let{tags:n}=this;for(;n.length>0;){let e=n.pop();this.fail(`unclosed tag: ${e.name}`)}this.state!==b&&this.state!==N&&this.fail(`unexpected end.`);let{text:r}=this;return r.length!==0&&((e=this.textHandler)==null||e.call(this,r),this.text=``),this._closed=!0,(t=this.endHandler)==null||t.call(this),this._init(),this}resolve(e){var t;let n=this.topNS[e];if(n!==void 0)return n;let{tags:r}=this;for(let t=r.length-1;t>=0;t--)if(n=r[t].ns[e],n!==void 0)return n;return n=this.ns[e],n===void 0?(t=this.opt).resolvePrefix?.call(t,e):n}qname(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qname(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?h:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:t}=this,n=this.tag;n.isSelfClosing=!1,(e=this.openTagHandler)==null||e.call(this,n),t.push(n),this.state=N,this.name=``}openSelfClosingTag(){var e,t;this.processAttribs();let{tags:n}=this,r=this.tag;r.isSelfClosing=!0,(e=this.openTagHandler)==null||e.call(this,r),(t=this.closeTagHandler)==null||t.call(this,r),(this.tag=n[n.length-1]??null)===null&&(this.closedRoot=!0),this.state=N,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=N,this.name=``,t===``){this.fail(`weird empty close tag.`),this.text+=`</>`;return}let n=this.closeTagHandler,r=e.length;for(;r-- >0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}}})),cn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ParseError=void 0,e.ParseError=class extends Error{constructor(e,t){let n=e.saxParser;super(e.trackPosition?`Line ${n.line} column ${n.column+1}: ${t}`:t)}}})),J=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.BlankNode=void 0,e.BlankNode=class{constructor(e){this.termType=`BlankNode`,this.value=e}equals(e){return!!e&&e.termType===`BlankNode`&&e.value===this.value}}})),ln=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DefaultGraph=void 0;var t=class{constructor(){this.termType=`DefaultGraph`,this.value=``}equals(e){return!!e&&e.termType===`DefaultGraph`}};e.DefaultGraph=t,t.INSTANCE=new t})),un=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NamedNode=void 0,e.NamedNode=class{constructor(e){this.termType=`NamedNode`,this.value=e}equals(e){return!!e&&e.termType===`NamedNode`&&e.value===this.value}}})),dn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Literal=void 0;var t=un(),n=class e{constructor(t,n){this.termType=`Literal`,this.value=t,typeof n==`string`?(this.language=n,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=``):n?`termType`in n?(this.language=``,this.datatype=n,this.direction=``):(this.language=n.language,this.datatype=n.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=n.direction||``):(this.language=``,this.datatype=e.XSD_STRING,this.direction=``)}equals(e){return!!e&&e.termType===`Literal`&&e.value===this.value&&e.language===this.language&&(e.direction===this.direction||!e.direction&&this.direction===``)&&this.datatype.equals(e.datatype)}};e.Literal=n,n.RDF_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),n.RDF_DIRECTIONAL_LANGUAGE_STRING=new t.NamedNode(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),n.XSD_STRING=new t.NamedNode(`http://www.w3.org/2001/XMLSchema#string`)})),fn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Quad=void 0,e.Quad=class{constructor(e,t,n,r){this.termType=`Quad`,this.value=``,this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&(e.termType===`Quad`||!e.termType)&&this.subject.equals(e.subject)&&this.predicate.equals(e.predicate)&&this.object.equals(e.object)&&this.graph.equals(e.graph)}}})),pn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Variable=void 0,e.Variable=class{constructor(e){this.termType=`Variable`,this.value=e}equals(e){return!!e&&e.termType===`Variable`&&e.value===this.value}}})),mn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.DataFactory=void 0;var t=J(),n=ln(),r=dn(),i=un(),a=fn(),o=pn(),s=0;e.DataFactory=class{constructor(e){this.blankNodeCounter=0,e||={},this.blankNodePrefix=e.blankNodePrefix||`df_${s++}_`}namedNode(e){return new i.NamedNode(e)}blankNode(e){return new t.BlankNode(e||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(e,t){return new r.Literal(e,t)}variable(e){return new o.Variable(e)}defaultGraph(){return n.DefaultGraph.INSTANCE}quad(e,t,n,r){return new a.Quad(e,t,n,r||this.defaultGraph())}fromTerm(e){switch(e.termType){case`NamedNode`:return this.namedNode(e.value);case`BlankNode`:return this.blankNode(e.value);case`Literal`:return e.language?this.literal(e.value,e.language):e.datatype.equals(r.Literal.XSD_STRING)?this.literal(e.value):this.literal(e.value,this.fromTerm(e.datatype));case`Variable`:return this.variable(e.value);case`DefaultGraph`:return this.defaultGraph();case`Quad`:return this.quad(this.fromTerm(e.subject),this.fromTerm(e.predicate),this.fromTerm(e.object),this.fromTerm(e.graph))}}fromQuad(e){return this.fromTerm(e)}resetBlankNodeCounter(){this.blankNodeCounter=0}}})),hn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(J(),e),n(mn(),e),n(ln(),e),n(dn(),e),n(un(),e),n(fn(),e),n(pn(),e)})),gn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.validateIri=e.IriValidationStrategy=void 0;function t(){let e=`[!$&'()*+,;=]`,t=`%[a-fA-F0-9]{2}`,n=`([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])`,r=`${n}\\.${n}\\.${n}\\.${n}`,i=`[a-fA-F0-9]{1,4}`,a=`(${i}:${i}|${r})`,o=`\\[(${`((${i}:){6}${a}|::(${i}:){5}${a}|(${i})?::(${i}:){4}${a}|((${i}:){0,1}${i})?::(${i}:){3}${a}|((${i}:){0,2}${i})?::(${i}:){2}${a}|((${i}:){0,3}${i})?::${i}:${a}|((${i}:){0,4}${i})?::${a}|((${i}:){0,5}${i})?::${i}|((${i}:){0,6}${i})?::)`}|${`v[a-fA-F0-9]+\\.(${e}|${e}|":)+`})\\]`,s=`[a-zA-Z0-9\\-._~\xA0-豈-﷏ﷰ-𐀀-𠀀-𰀀------------]`,c=`(${s}|${t}|${e}|[:@])*`,l=`(${c}|[\\/?])*`,u=`(${c}|[---]|[\\/?])*`,d=`(${c})+`,f=`(${c})*`,p=`${d}(\\/${f})*`,m=`\\/(${d}(\\/${f})*)?`,h=`(\\/${f})*`,g=`(${o}|${r}|${`(${s}|${t}|${e})*`})`,_=`^[a-zA-Z][a-zA-Z0-9+\\-.]*:${`(\\/\\/${`(${`(${s}|${t}|${e}|:)*`}@)?${g}(:[0-9]*)?`}${h}|${m}|${p}|)`}(\\?${u})?(#${l})?$`;return new RegExp(_,`u`)}var n=t(),r=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u,i;(function(e){e.Strict=`strict`,e.Pragmatic=`pragmatic`,e.None=`none`})(i=e.IriValidationStrategy||={});function a(e,t=i.Strict){switch(t){case i.Strict:return n.test(e)?void 0:Error(`Invalid IRI according to RFC 3987: '${e}'`);case i.Pragmatic:return r.test(e)?void 0:Error(`Invalid IRI according to RDF Turtle: '${e}'`);case i.None:return;default:return Error(`Not supported validation strategy "${t}"`)}}e.validateIri=a})),_n=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(gn(),e)})),vn=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ParseType=e.RdfXmlParser=void 0;var t=nn(),n=sn(),r=et(),i=cn(),a=hn(),o=_n(),s=class e extends r.Transform{constructor(e){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},e&&(Object.assign(this,e),this.options=e),this.dataFactory||=new a.DataFactory,this.baseIRI||=``,this.defaultGraph||=this.dataFactory.defaultGraph(),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||=this.validateUri?o.IriValidationStrategy.Pragmatic:o.IriValidationStrategy.None,this.parseUnsupportedVersions=!!e?.parseUnsupportedVersions,this.version=e?.version,this.saxParser=new n.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(t){let n=new r.PassThrough({readableObjectMode:!0});t.on(`error`,e=>i.emit(`error`,e)),t.on(`data`,e=>n.push(e)),t.on(`end`,()=>n.push(null));let i=n.pipe(new e(this.options));return i}_transform(e,t,n){if(this.version){let e=this.version;if(this.version=void 0,!this.isValidVersion(e))return n(this.newParseError(`Detected unsupported version as media type parameter: ${e}`))}try{this.saxParser.write(e)}catch(e){return n(e)}n()}newParseError(e){return new i.ParseError(this,e)}valueToUri(e,n){return this.uriToNamedNode((0,t.resolve)(e,n.baseIRI))}uriToNamedNode(e){let t=(0,o.validateIri)(e,this.iriValidationStrategy);if(t instanceof Error)throw this.newParseError(t.message);return this.dataFactory.namedNode(e)}validateNcname(t){if(!e.NCNAME_MATCHER.test(t))throw this.newParseError(`Not a valid NCName: ${t}`)}createLiteral(e,t){return this.dataFactory.literal(e,t.datatype?t.datatype:t.language?{language:t.language,direction:t.rdfVersion?t.direction:void 0}:void 0)}isValidVersion(t){return this.parseUnsupportedVersions||e.SUPPORTED_VERSIONS.includes(t)}attachSaxListeners(){this.saxParser.on(`error`,e=>this.emit(`error`,e)),this.saxParser.on(`opentag`,this.onTag.bind(this)),this.saxParser.on(`text`,this.onText.bind(this)),this.saxParser.on(`cdata`,this.onText.bind(this)),this.saxParser.on(`closetag`,this.onCloseTag.bind(this)),this.saxParser.on(`doctype`,this.onDoctype.bind(this))}onTag(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null,n=c.RESOURCE;if(t&&(t.hadChildren=!0,n=t.childrenParseType),t&&t.childrenStringTags){let n=e.name,r=``;for(let{key:e,value:n}of t.namespaces||[])r+=` ${e}="${n}"`;for(let t in e.attributes)r+=` ${t}="${e.attributes[t].value}"`;let i=`<${`${n}${r}`}>`;t.childrenStringTags.push(i);let a={childrenStringTags:t.childrenStringTags};a.childrenStringEmitClosingTag=`</${n}>`,this.activeTagStack.push(a);return}let r={};t?(r.language=t.language,r.direction=t.direction,r.baseIRI=t.baseIRI,r.childrenTripleTerms=t.childrenTripleTerms,r.rdfVersion=t.rdfVersion):r.baseIRI=this.baseIRI,this.activeTagStack.push(r),n===c.RESOURCE?this.onTagResource(e,r,t,!t):this.onTagProperty(e,r,t);for(let t in e.attributes){let n=e.attributes[t];n.prefix===`xmlns`&&(r.namespaces||=[],r.namespaces.push({key:`${n.prefix}:${n.local}`,value:n.value}))}t&&t.namespaces&&(r.namespaces=[...r.namespaces||[],...t.namespaces])}onTagResource(n,r,i,a){r.childrenParseType=c.PROPERTY;let o=!0;if(n.uri===e.RDF){if(!a&&e.FORBIDDEN_NODE_ELEMENTS.indexOf(n.local)>=0)throw this.newParseError(`Illegal node element name: ${n.local}`);switch(n.local){case`RDF`:r.childrenParseType=c.RESOURCE;case`Description`:o=!1}}let s=[],l=[],u=null,d=!1,f=!1,p=null;for(let a in n.attributes){let o=n.attributes[a];if(o.uri===e.RDF&&o.local===`version`){this.setVersion(r,o.value);continue}else if(i&&o.uri===e.RDF)switch(o.local){case`about`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
|
|
21
21
|
while ${o.value} and ${u} where found.`);u=o.value;continue;case`ID`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
|
|
22
22
|
while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=`#`+o.value,d=!0;continue;case`nodeID`:if(u)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, \
|
|
23
|
-
while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=o.value,f=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`type`:p=o.value;continue;case`aboutEach`:throw this.newParseError(`rdf:aboutEach is not supported.`);case`aboutEachPrefix`:throw this.newParseError(`rdf:aboutEachPrefix is not supported.`);case`li`:throw this.newParseError(`rdf:li on node elements are not supported.`)}else if(o.uri===e.XML){if(o.local===`lang`){r.language=o.value===``?null:o.value.toLowerCase();continue}else if(o.local===`base`){r.baseIRI=(0,t.resolve)(o.value,r.baseIRI);continue}}else if(o.uri===e.ITS&&o.local===`dir`){this.setDirection(r,o.value);continue}o.prefix!==`xml`&&o.prefix!==`xmlns`&&(o.prefix!==``||o.local!==`xmlns`)&&o.uri&&(s.push(this.uriToNamedNode(o.uri+o.local)),l.push(o.value))}if(u!==null&&(r.subject=f?this.dataFactory.blankNode(u):this.valueToUri(u,r),d&&this.claimNodeId(r.subject)),r.subject||=this.dataFactory.blankNode(),o){let t=this.uriToNamedNode(n.uri+n.local);this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),t,i?i.reifiedStatementId:null,r.childrenTripleTerms,r.reifier)}if(i){if(i.predicate)if(i.childrenCollectionSubject){let t=this.dataFactory.blankNode(),n=this.dataFactory.namedNode(e.RDF+`rest`),a=i.childrenCollectionPredicate.equals(n);this.emitTriple(i.childrenCollectionSubject,i.childrenCollectionPredicate,t,a?null:i.reifiedStatementId,i.childrenTripleTerms,a?null:i.reifier),this.emitTriple(t,this.dataFactory.namedNode(e.RDF+`first`),r.subject,null,r.childrenTripleTerms),i.childrenCollectionSubject=t,i.childrenCollectionPredicate=n}else{i.childrenTagsToTripleTerms||(this.emitTriple(i.subject,i.predicate,r.subject,i.reifiedStatementId,i.childrenTripleTerms,i.reifier),i.predicateEmitted=!0);for(let e=0;e<i.predicateSubPredicates.length;e++)this.emitTriple(r.subject,i.predicateSubPredicates[e],i.predicateSubObjects[e],null,i.childrenTripleTerms,i.reifier);i.predicateSubPredicates=[],i.predicateSubObjects=[]}for(let e=0;e<s.length;e++){let t=this.createLiteral(l[e],r);this.emitTriple(r.subject,s[e],t,i.reifiedStatementId,i.childrenTripleTerms,i.reifier)}p&&this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),this.uriToNamedNode(p),null,r.childrenTripleTerms,r.reifier)}}onTagProperty(t,n,r){if(n.childrenParseType=c.RESOURCE,n.subject=r.subject,t.uri===e.RDF&&t.local===`li`?(r.listItemCounter||=1,n.predicate=this.uriToNamedNode(t.uri+`_`+ r.listItemCounter++)):n.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===e.RDF&&e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);n.predicateSubPredicates=[],n.predicateSubObjects=[];let i=!1,a=!1,o=null,s=!0,l=[],u=[];for(let r in t.attributes){let d=t.attributes[r];if(d.uri===e.RDF&&d.local===`version`){this.setVersion(n,d.value);continue}else if(d.uri===e.RDF)switch(d.local){case`resource`:if(o)throw this.newParseError(`Found both rdf:resource (${d.value}) and rdf:nodeID (${o}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${d.value})`);n.hadChildren=!0,o=d.value,s=!1;continue;case`datatype`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${d.value})`);n.datatype=this.valueToUri(d.value,n);continue;case`nodeID`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${d.value}).`);if(n.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${d.value})`);this.validateNcname(d.value),n.hadChildren=!0,o=d.value,s=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`parseType`:if(a)throw this.newParseError(`rdf:parseType is not allowed when non-rdf:* property attributes are present`);if(n.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${n.datatype.value})`);if(o)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${o})`);if(d.value===`Resource`){i=!0,n.childrenParseType=c.PROPERTY;let e=this.dataFactory.blankNode();this.emitTriple(n.subject,n.predicate,e,n.reifiedStatementId,n.childrenTripleTerms,n.reifier),n.subject=e,n.predicate=null}else d.value===`Collection`?(i=!0,n.hadChildren=!0,n.childrenCollectionSubject=n.subject,n.childrenCollectionPredicate=n.predicate,s=!1):d.value===`Literal`?(i=!0,n.childrenTagsToString=!0,n.childrenStringTags=[]):d.value===`Triple`&&(i=!0,n.childrenTagsToTripleTerms=!0,n.childrenTripleTerms=[]);continue;case`ID`:this.validateNcname(d.value),n.reifiedStatementId=this.valueToUri(`#`+d.value,n),this.claimNodeId(n.reifiedStatementId);continue;case`annotation`:n.reifier=this.dataFactory.namedNode(d.value);continue;case`annotationNodeID`:n.reifier=this.dataFactory.blankNode(d.value);continue}else if(d.uri===e.XML&&d.local===`lang`){n.language=d.value===``?null:d.value.toLowerCase();continue}else if(d.uri===e.ITS&&d.local===`dir`){this.setDirection(n,d.value);continue}else if(d.uri===e.ITS&&d.local===`version`)continue;if(d.prefix!==`xml`&&d.prefix!==`xmlns`&&(d.prefix!==``||d.local!==`xmlns`)&&d.uri){if(i||n.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${d.value}`);n.hadChildren=!0,a=!0,l.push(this.uriToNamedNode(d.uri+d.local)),u.push(this.createLiteral(d.value,n))}}if(o!==null){let e=n.subject;n.subject=s?this.dataFactory.blankNode(o):this.valueToUri(o,n),this.emitTriple(e,n.predicate,n.subject,n.reifiedStatementId,n.childrenTripleTerms,n.reifier);for(let e=0;e<l.length;e++)this.emitTriple(n.subject,l[e],u[e],null,n.childrenTripleTerms,n.reifier);n.predicateEmitted=!0}else s&&(n.predicateSubPredicates=l,n.predicateSubObjects=u,n.predicateEmitted=!1)}emitTriple(t,n,r,i,a,o){let s=this.dataFactory.quad(t,n,r,this.defaultGraph);a?a.push(s):this.push(s),o&&this.push(this.dataFactory.quad(o,this.dataFactory.namedNode(e.RDF+`reifies`),s)),i&&(this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`type`),this.dataFactory.namedNode(e.RDF+`Statement`),this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`subject`),t,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`predicate`),n,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`object`),r,this.defaultGraph)))}claimNodeId(e){if(!this.allowDuplicateRdfIds){if(this.nodeIds[e.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${e.value}'.`);this.nodeIds[e.value]=!0}}onText(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;t&&(t.childrenStringTags?t.childrenStringTags.push(e):t.predicate&&(t.text=e))}onCloseTag(){let t=this.activeTagStack.pop(),n=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(e.RDF+`XMLLiteral`),t.text=t.childrenStringTags.join(``),t.hadChildren=!1),t.childrenTagsToTripleTerms&&t.predicate&&t.rdfVersion){if(t.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${t.childrenTripleTerms.length}`);for(let e of t.childrenTripleTerms)this.emitTriple(t.subject,t.predicate,e,null,n.childrenTripleTerms,n.reifier);t.predicateEmitted=!0}if(t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(e.RDF+`nil`),null,t.childrenTripleTerms);else if(t.predicate){if(!t.hadChildren&&t.childrenParseType!==c.PROPERTY)this.emitTriple(t.subject,t.predicate,this.createLiteral(t.text||``,t),t.reifiedStatementId,t.childrenTripleTerms,t.reifier);else if(!t.predicateEmitted){let e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId,t.childrenTripleTerms,t.reifier);for(let n=0;n<t.predicateSubPredicates.length;n++)this.emitTriple(e,t.predicateSubPredicates[n],t.predicateSubObjects[n],null,t.childrenTripleTerms)}}}onDoctype(e){e.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(e,t,n)=>(this.saxParser.ENTITIES[t]=n,``))}setDirection(e,t){if(t){if(t!==`ltr`&&t!==`rtl`)throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${t}' was found.`);e.direction=t}else delete e.direction}setVersion(e,t){if(e.rdfVersion=t,this.emit(`version`,t),!this.isValidVersion(t))throw this.newParseError(`Detected unsupported version: ${t}`)}};e.RdfXmlParser=s,s.MIME_TYPE=`application/rdf+xml`,s.RDF=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,s.XML=`http://www.w3.org/XML/1998/namespace`,s.ITS=`http://www.w3.org/2005/11/its`,s.FORBIDDEN_NODE_ELEMENTS=[`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`li`,`aboutEach`,`aboutEachPrefix`],s.FORBIDDEN_PROPERTY_ELEMENTS=[`Description`,`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`aboutEach`,`aboutEachPrefix`],s.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,s.SUPPORTED_VERSIONS=[`1.2`,`1.2-basic`,`1.1`];var c;(function(e){e[e.RESOURCE=0]=`RESOURCE`,e[e.PROPERTY=1]=`PROPERTY`})(c||(e.ParseType=c={}))})),fn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(dn(),e)})),pn=o(((e,t)=>{t.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){let{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){let t=e&&this._existing.get(e);if(t)return t;let n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}})),mn=o((()=>{(function(e,t){if(e.setImmediate)return;var n=1,r={},i=!1,a=e.document,o;function s(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];return r[n]={callback:e,args:t},o(n),n++}function c(e){delete r[e]}function l(e){var n=e.callback,r=e.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(t,r);break}}function u(e){if(i)setTimeout(u,0,e);else{var t=r[e];if(t){i=!0;try{l(t)}finally{c(e),i=!1}}}}function d(){o=function(e){process.nextTick(function(){u(e)})}}function f(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}function p(){var t=`setImmediate$`+Math.random()+`$`,n=function(n){n.source===e&&typeof n.data==`string`&&n.data.indexOf(t)===0&&u(+n.data.slice(t.length))};e.addEventListener?e.addEventListener(`message`,n,!1):e.attachEvent(`onmessage`,n),o=function(n){e.postMessage(t+n,`*`)}}function m(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;u(t)},o=function(t){e.port2.postMessage(t)}}function h(){var e=a.documentElement;o=function(t){var n=a.createElement(`script`);n.onreadystatechange=function(){u(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function g(){o=function(e){setTimeout(u,0,e)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(e);_=_&&_.setTimeout?_:e,{}.toString.call(e.process)===`[object process]`?d():f()?p():e.MessageChannel?m():a&&`onreadystatechange`in a.createElement(`script`)?h():g(),_.setImmediate=s,_.clearImmediate=c})(typeof self>`u`?typeof global>`u`?void 0:global:self)})),hn=o((e=>{mn(),e.setImmediate=setImmediate,e.crypto=globalThis.crypto;var t=[];for(let e=0;e<=255;++e)t.push(e.toString(16).padStart(2,`0`));e.bufferToHex=function(e){let n=``,r=new Uint8Array(e);for(let e=0;e<r.length;++e)n+=t[r[e]];return n}})),gn=o(((e,t)=>{var{bufferToHex:n,crypto:r}=hn(),i=new Map([[`sha256`,`SHA-256`],[`SHA256`,`SHA-256`],[`SHA-256`,`SHA-256`],[`sha384`,`SHA-384`],[`SHA384`,`SHA-384`],[`SHA-384`,`SHA-384`],[`sha512`,`SHA-512`],[`SHA512`,`SHA-512`],[`SHA-512`,`SHA-512`]]);t.exports=class{constructor(e){if(!(r&&r.subtle))throw Error(`crypto.subtle not found.`);if(!i.has(e))throw Error(`Unsupported algorithm "${e}".`);this.algorithm=i.get(e),this._content=``}update(e){this._content+=e}async digest(){let e=new TextEncoder().encode(this._content);return n(await r.subtle.digest(this.algorithm,e))}}})),_n=o(((e,t)=>{t.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){let{current:e,dir:t}=this,n=e.slice(),r=null,i=0,a=e.length;for(let n=0;n<a;++n){let o=e[n],s=t.get(o);(r===null||o>r)&&(s&&n>0&&o>e[n-1]||!s&&n<a-1&&o>e[n+1])&&(r=o,i=n)}if(r===null)this.done=!0;else{let n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(let n of e)n>r&&t.set(n,!t.get(n))}return n}}})),vn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,r=`http://www.w3.org/2001/XMLSchema#string`,i=`NamedNode`,a=`BlankNode`,o=`Literal`,s=`DefaultGraph`,c={};(()=>{let e=`A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_`;e+``,``+e;let t='(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)';``+t;let n=`[ \\t]*`;``+t,t+``,``+t,``+t,c.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,c.empty=RegExp(`^`+n+`$`),c.quad=RegExp(`^`+n+'(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)[ \\t]+(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$')})(),t.exports=class e{static parse(e){let t=[],u={},d=e.split(c.eoln),f=0;for(let e of d){if(f++,c.empty.test(e))continue;let d=e.match(c.quad);if(d===null)throw Error(`N-Quads parse error on line `+f+`.`);let p={subject:null,predicate:null,object:null,graph:null};if(d[1]===void 0?p.subject={termType:a,value:d[2]}:p.subject={termType:i,value:y(d[1])},p.predicate={termType:i,value:y(d[3])},d[4]===void 0?d[5]===void 0?(p.object={termType:o,value:void 0,datatype:{termType:i}},d[7]===void 0?d[8]===void 0?p.object.datatype.value=r:(p.object.datatype.value=n,p.object.language=d[8]):p.object.datatype.value=y(d[7]),p.object.value=m(d[6])):p.object={termType:a,value:d[5]}:p.object={termType:i,value:y(d[4])},d[9]===void 0?d[10]===void 0?p.graph={termType:s,value:``}:p.graph={termType:a,value:d[10]}:p.graph={termType:i,value:y(d[9])},!(p.graph.value in u))u[p.graph.value]=[p],t.push(p);else{let e=!0,n=u[p.graph.value];for(let t of n)if(l(t,p)){e=!1;break}e&&(n.push(p),t.push(p))}}return t}static serialize(t){let n=[];for(let r of t)n.push(e.serializeQuad(r));return n.sort().join(``)}static serializeQuadComponents(e,t,o,s){let c=``;return e.termType===i?c+=`<${_(e.value)}>`:c+=`_:${e.value}`,t.termType===i?c+=` <${_(t.value)}> `:c+=` _:${t.value} `,o.termType===i?c+=`<${_(o.value)}>`:o.termType===a?c+=`_:${o.value}`:(c+=`"${f(o.value)}"`,o.datatype.value===n?o.language&&(c+=`@${o.language}`):o.datatype.value!==r&&(c+=`^^<${_(o.datatype.value)}>`)),s.termType===i?c+=` <${_(s.value)}>`:s.termType===a&&(c+=` _:${s.value}`),c+=` .
|
|
23
|
+
while ${o.value} and ${u} where found.`);this.validateNcname(o.value),u=o.value,f=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`type`:p=o.value;continue;case`aboutEach`:throw this.newParseError(`rdf:aboutEach is not supported.`);case`aboutEachPrefix`:throw this.newParseError(`rdf:aboutEachPrefix is not supported.`);case`li`:throw this.newParseError(`rdf:li on node elements are not supported.`)}else if(o.uri===e.XML){if(o.local===`lang`){r.language=o.value===``?null:o.value.toLowerCase();continue}else if(o.local===`base`){r.baseIRI=(0,t.resolve)(o.value,r.baseIRI);continue}}else if(o.uri===e.ITS&&o.local===`dir`){this.setDirection(r,o.value);continue}o.prefix!==`xml`&&o.prefix!==`xmlns`&&(o.prefix!==``||o.local!==`xmlns`)&&o.uri&&(s.push(this.uriToNamedNode(o.uri+o.local)),l.push(o.value))}if(u!==null&&(r.subject=f?this.dataFactory.blankNode(u):this.valueToUri(u,r),d&&this.claimNodeId(r.subject)),r.subject||=this.dataFactory.blankNode(),o){let t=this.uriToNamedNode(n.uri+n.local);this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),t,i?i.reifiedStatementId:null,r.childrenTripleTerms,r.reifier)}if(i){if(i.predicate)if(i.childrenCollectionSubject){let t=this.dataFactory.blankNode(),n=this.dataFactory.namedNode(e.RDF+`rest`),a=i.childrenCollectionPredicate.equals(n);this.emitTriple(i.childrenCollectionSubject,i.childrenCollectionPredicate,t,a?null:i.reifiedStatementId,i.childrenTripleTerms,a?null:i.reifier),this.emitTriple(t,this.dataFactory.namedNode(e.RDF+`first`),r.subject,null,r.childrenTripleTerms),i.childrenCollectionSubject=t,i.childrenCollectionPredicate=n}else{i.childrenTagsToTripleTerms||(this.emitTriple(i.subject,i.predicate,r.subject,i.reifiedStatementId,i.childrenTripleTerms,i.reifier),i.predicateEmitted=!0);for(let e=0;e<i.predicateSubPredicates.length;e++)this.emitTriple(r.subject,i.predicateSubPredicates[e],i.predicateSubObjects[e],null,i.childrenTripleTerms,i.reifier);i.predicateSubPredicates=[],i.predicateSubObjects=[]}for(let e=0;e<s.length;e++){let t=this.createLiteral(l[e],r);this.emitTriple(r.subject,s[e],t,i.reifiedStatementId,i.childrenTripleTerms,i.reifier)}p&&this.emitTriple(r.subject,this.dataFactory.namedNode(e.RDF+`type`),this.uriToNamedNode(p),null,r.childrenTripleTerms,r.reifier)}}onTagProperty(t,n,r){if(n.childrenParseType=c.RESOURCE,n.subject=r.subject,t.uri===e.RDF&&t.local===`li`?(r.listItemCounter||=1,n.predicate=this.uriToNamedNode(t.uri+`_`+ r.listItemCounter++)):n.predicate=this.uriToNamedNode(t.uri+t.local),t.uri===e.RDF&&e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(t.local)>=0)throw this.newParseError(`Illegal property element name: ${t.local}`);n.predicateSubPredicates=[],n.predicateSubObjects=[];let i=!1,a=!1,o=null,s=!0,l=[],u=[];for(let r in t.attributes){let d=t.attributes[r];if(d.uri===e.RDF&&d.local===`version`){this.setVersion(n,d.value);continue}else if(d.uri===e.RDF)switch(d.local){case`resource`:if(o)throw this.newParseError(`Found both rdf:resource (${d.value}) and rdf:nodeID (${o}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${d.value})`);n.hadChildren=!0,o=d.value,s=!1;continue;case`datatype`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${d.value})`);n.datatype=this.valueToUri(d.value,n);continue;case`nodeID`:if(a)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${d.value}).`);if(n.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${d.value}).`);if(i)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${d.value})`);this.validateNcname(d.value),n.hadChildren=!0,o=d.value,s=!0;continue;case`bagID`:throw this.newParseError(`rdf:bagID is not supported.`);case`parseType`:if(a)throw this.newParseError(`rdf:parseType is not allowed when non-rdf:* property attributes are present`);if(n.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${n.datatype.value})`);if(o)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${o})`);if(d.value===`Resource`){i=!0,n.childrenParseType=c.PROPERTY;let e=this.dataFactory.blankNode();this.emitTriple(n.subject,n.predicate,e,n.reifiedStatementId,n.childrenTripleTerms,n.reifier),n.subject=e,n.predicate=null}else d.value===`Collection`?(i=!0,n.hadChildren=!0,n.childrenCollectionSubject=n.subject,n.childrenCollectionPredicate=n.predicate,s=!1):d.value===`Literal`?(i=!0,n.childrenTagsToString=!0,n.childrenStringTags=[]):d.value===`Triple`&&(i=!0,n.childrenTagsToTripleTerms=!0,n.childrenTripleTerms=[]);continue;case`ID`:this.validateNcname(d.value),n.reifiedStatementId=this.valueToUri(`#`+d.value,n),this.claimNodeId(n.reifiedStatementId);continue;case`annotation`:n.reifier=this.dataFactory.namedNode(d.value);continue;case`annotationNodeID`:n.reifier=this.dataFactory.blankNode(d.value);continue}else if(d.uri===e.XML&&d.local===`lang`){n.language=d.value===``?null:d.value.toLowerCase();continue}else if(d.uri===e.ITS&&d.local===`dir`){this.setDirection(n,d.value);continue}else if(d.uri===e.ITS&&d.local===`version`)continue;if(d.prefix!==`xml`&&d.prefix!==`xmlns`&&(d.prefix!==``||d.local!==`xmlns`)&&d.uri){if(i||n.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${d.value}`);n.hadChildren=!0,a=!0,l.push(this.uriToNamedNode(d.uri+d.local)),u.push(this.createLiteral(d.value,n))}}if(o!==null){let e=n.subject;n.subject=s?this.dataFactory.blankNode(o):this.valueToUri(o,n),this.emitTriple(e,n.predicate,n.subject,n.reifiedStatementId,n.childrenTripleTerms,n.reifier);for(let e=0;e<l.length;e++)this.emitTriple(n.subject,l[e],u[e],null,n.childrenTripleTerms,n.reifier);n.predicateEmitted=!0}else s&&(n.predicateSubPredicates=l,n.predicateSubObjects=u,n.predicateEmitted=!1)}emitTriple(t,n,r,i,a,o){let s=this.dataFactory.quad(t,n,r,this.defaultGraph);a?a.push(s):this.push(s),o&&this.push(this.dataFactory.quad(o,this.dataFactory.namedNode(e.RDF+`reifies`),s)),i&&(this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`type`),this.dataFactory.namedNode(e.RDF+`Statement`),this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`subject`),t,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`predicate`),n,this.defaultGraph)),this.push(this.dataFactory.quad(i,this.dataFactory.namedNode(e.RDF+`object`),r,this.defaultGraph)))}claimNodeId(e){if(!this.allowDuplicateRdfIds){if(this.nodeIds[e.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${e.value}'.`);this.nodeIds[e.value]=!0}}onText(e){let t=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;t&&(t.childrenStringTags?t.childrenStringTags.push(e):t.predicate&&(t.text=e))}onCloseTag(){let t=this.activeTagStack.pop(),n=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(t.childrenStringEmitClosingTag&&t.childrenStringTags.push(t.childrenStringEmitClosingTag),t.childrenTagsToString&&(t.datatype=this.dataFactory.namedNode(e.RDF+`XMLLiteral`),t.text=t.childrenStringTags.join(``),t.hadChildren=!1),t.childrenTagsToTripleTerms&&t.predicate&&t.rdfVersion){if(t.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${t.childrenTripleTerms.length}`);for(let e of t.childrenTripleTerms)this.emitTriple(t.subject,t.predicate,e,null,n.childrenTripleTerms,n.reifier);t.predicateEmitted=!0}if(t.childrenCollectionSubject)this.emitTriple(t.childrenCollectionSubject,t.childrenCollectionPredicate,this.dataFactory.namedNode(e.RDF+`nil`),null,t.childrenTripleTerms);else if(t.predicate){if(!t.hadChildren&&t.childrenParseType!==c.PROPERTY)this.emitTriple(t.subject,t.predicate,this.createLiteral(t.text||``,t),t.reifiedStatementId,t.childrenTripleTerms,t.reifier);else if(!t.predicateEmitted){let e=this.dataFactory.blankNode();this.emitTriple(t.subject,t.predicate,e,t.reifiedStatementId,t.childrenTripleTerms,t.reifier);for(let n=0;n<t.predicateSubPredicates.length;n++)this.emitTriple(e,t.predicateSubPredicates[n],t.predicateSubObjects[n],null,t.childrenTripleTerms)}}}onDoctype(e){e.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(e,t,n)=>(this.saxParser.ENTITIES[t]=n,``))}setDirection(e,t){if(t){if(t!==`ltr`&&t!==`rtl`)throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${t}' was found.`);e.direction=t}else delete e.direction}setVersion(e,t){if(e.rdfVersion=t,this.emit(`version`,t),!this.isValidVersion(t))throw this.newParseError(`Detected unsupported version: ${t}`)}};e.RdfXmlParser=s,s.MIME_TYPE=`application/rdf+xml`,s.RDF=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,s.XML=`http://www.w3.org/XML/1998/namespace`,s.ITS=`http://www.w3.org/2005/11/its`,s.FORBIDDEN_NODE_ELEMENTS=[`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`li`,`aboutEach`,`aboutEachPrefix`],s.FORBIDDEN_PROPERTY_ELEMENTS=[`Description`,`RDF`,`ID`,`about`,`bagID`,`parseType`,`resource`,`nodeID`,`aboutEach`,`aboutEachPrefix`],s.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u,s.SUPPORTED_VERSIONS=[`1.2`,`1.2-basic`,`1.1`];var c;(function(e){e[e.RESOURCE=0]=`RESOURCE`,e[e.PROPERTY=1]=`PROPERTY`})(c||(e.ParseType=c={}))})),yn=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(vn(),e)})),bn=o(((e,t)=>{t.exports=class e{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){let{prefix:t,_existing:n,counter:r}=this;return new e(t,new Map(n),r)}getId(e){let t=e&&this._existing.get(e);if(t)return t;let n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}})),xn=o((()=>{(function(e,t){if(e.setImmediate)return;var n=1,r={},i=!1,a=e.document,o;function s(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];return r[n]={callback:e,args:t},o(n),n++}function c(e){delete r[e]}function l(e){var n=e.callback,r=e.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(t,r);break}}function u(e){if(i)setTimeout(u,0,e);else{var t=r[e];if(t){i=!0;try{l(t)}finally{c(e),i=!1}}}}function d(){o=function(e){process.nextTick(function(){u(e)})}}function f(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}function p(){var t=`setImmediate$`+Math.random()+`$`,n=function(n){n.source===e&&typeof n.data==`string`&&n.data.indexOf(t)===0&&u(+n.data.slice(t.length))};e.addEventListener?e.addEventListener(`message`,n,!1):e.attachEvent(`onmessage`,n),o=function(n){e.postMessage(t+n,`*`)}}function m(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;u(t)},o=function(t){e.port2.postMessage(t)}}function h(){var e=a.documentElement;o=function(t){var n=a.createElement(`script`);n.onreadystatechange=function(){u(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function g(){o=function(e){setTimeout(u,0,e)}}var _=Object.getPrototypeOf&&Object.getPrototypeOf(e);_=_&&_.setTimeout?_:e,{}.toString.call(e.process)===`[object process]`?d():f()?p():e.MessageChannel?m():a&&`onreadystatechange`in a.createElement(`script`)?h():g(),_.setImmediate=s,_.clearImmediate=c})(typeof self>`u`?typeof global>`u`?void 0:global:self)})),Sn=o((e=>{xn(),e.setImmediate=setImmediate,e.crypto=globalThis.crypto;var t=[];for(let e=0;e<=255;++e)t.push(e.toString(16).padStart(2,`0`));e.bufferToHex=function(e){let n=``,r=new Uint8Array(e);for(let e=0;e<r.length;++e)n+=t[r[e]];return n}})),Cn=o(((e,t)=>{var{bufferToHex:n,crypto:r}=Sn(),i=new Map([[`sha256`,`SHA-256`],[`SHA256`,`SHA-256`],[`SHA-256`,`SHA-256`],[`sha384`,`SHA-384`],[`SHA384`,`SHA-384`],[`SHA-384`,`SHA-384`],[`sha512`,`SHA-512`],[`SHA512`,`SHA-512`],[`SHA-512`,`SHA-512`]]);t.exports=class{constructor(e){if(!(r&&r.subtle))throw Error(`crypto.subtle not found.`);if(!i.has(e))throw Error(`Unsupported algorithm "${e}".`);this.algorithm=i.get(e),this._content=``}update(e){this._content+=e}async digest(){let e=new TextEncoder().encode(this._content);return n(await r.subtle.digest(this.algorithm,e))}}})),wn=o(((e,t)=>{t.exports=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){let{current:e,dir:t}=this,n=e.slice(),r=null,i=0,a=e.length;for(let n=0;n<a;++n){let o=e[n],s=t.get(o);(r===null||o>r)&&(s&&n>0&&o>e[n-1]||!s&&n<a-1&&o>e[n+1])&&(r=o,i=n)}if(r===null)this.done=!0;else{let n=t.get(r)?i-1:i+1;e[i]=e[n],e[n]=r;for(let n of e)n>r&&t.set(n,!t.get(n))}return n}}})),Tn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,r=`http://www.w3.org/2001/XMLSchema#string`,i=`NamedNode`,a=`BlankNode`,o=`Literal`,s=`DefaultGraph`,c={};(()=>{let e=`A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_`;e+``,``+e;let t='(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)';``+t;let n=`[ \\t]*`;``+t,t+``,``+t,``+t,c.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,c.empty=RegExp(`^`+n+`$`),c.quad=RegExp(`^`+n+'(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]+(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)[ \\t]+(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?)|(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:(?:\\^\\^(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>))|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?))[ \\t]*(?:\\.|(?:(?:(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)|_:((?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9])(?:(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀.])*(?:[A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�_0-9-·̀-ͯ‿-⁀]))?))[ \\t]*\\.))[ \\t]*$')})(),t.exports=class e{static parse(e){let t=[],u={},d=e.split(c.eoln),f=0;for(let e of d){if(f++,c.empty.test(e))continue;let d=e.match(c.quad);if(d===null)throw Error(`N-Quads parse error on line `+f+`.`);let p={subject:null,predicate:null,object:null,graph:null};if(d[1]===void 0?p.subject={termType:a,value:d[2]}:p.subject={termType:i,value:y(d[1])},p.predicate={termType:i,value:y(d[3])},d[4]===void 0?d[5]===void 0?(p.object={termType:o,value:void 0,datatype:{termType:i}},d[7]===void 0?d[8]===void 0?p.object.datatype.value=r:(p.object.datatype.value=n,p.object.language=d[8]):p.object.datatype.value=y(d[7]),p.object.value=m(d[6])):p.object={termType:a,value:d[5]}:p.object={termType:i,value:y(d[4])},d[9]===void 0?d[10]===void 0?p.graph={termType:s,value:``}:p.graph={termType:a,value:d[10]}:p.graph={termType:i,value:y(d[9])},!(p.graph.value in u))u[p.graph.value]=[p],t.push(p);else{let e=!0,n=u[p.graph.value];for(let t of n)if(l(t,p)){e=!1;break}e&&(n.push(p),t.push(p))}}return t}static serialize(t){let n=[];for(let r of t)n.push(e.serializeQuad(r));return n.sort().join(``)}static serializeQuadComponents(e,t,o,s){let c=``;return e.termType===i?c+=`<${_(e.value)}>`:c+=`_:${e.value}`,t.termType===i?c+=` <${_(t.value)}> `:c+=` _:${t.value} `,o.termType===i?c+=`<${_(o.value)}>`:o.termType===a?c+=`_:${o.value}`:(c+=`"${f(o.value)}"`,o.datatype.value===n?o.language&&(c+=`@${o.language}`):o.datatype.value!==r&&(c+=`^^<${_(o.datatype.value)}>`)),s.termType===i?c+=` <${_(s.value)}>`:s.termType===a&&(c+=` _:${s.value}`),c+=` .
|
|
24
24
|
`,c}static serializeQuad(t){return e.serializeQuadComponents(t.subject,t.predicate,t.object,t.graph)}};function l(e,t){return!(e.subject.termType===t.subject.termType&&e.object.termType===t.object.termType)||!(e.subject.value===t.subject.value&&e.predicate.value===t.predicate.value&&e.object.value===t.object.value)?!1:e.object.termType===o?e.object.datatype.termType===t.object.datatype.termType&&e.object.language===t.object.language&&e.object.datatype.value===t.object.datatype.value:!0}var u=/[\u0000-\u001F\u007F"\\]/g,d=[];for(let e=0;e<=127;++e)u.test(String.fromCharCode(e))&&(d[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),u.lastIndex=0);d[`\b`.codePointAt(0)]=`\\b`,d[` `.codePointAt(0)]=`\\t`,d[`
|
|
25
25
|
`.codePointAt(0)]=`\\n`,d[`\f`.codePointAt(0)]=`\\f`,d[`\r`.codePointAt(0)]=`\\r`,d[`"`.codePointAt(0)]=`\\"`,d[`\\`.codePointAt(0)]=`\\\\`;function f(e){return u.test(e)?e.replace(u,function(e){return d[e.codePointAt(0)]}):e}var p=/(?:\\([btnfr"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function m(e){return p.test(e)?e.replace(p,function(e,t,n,r){if(t)switch(t){case`b`:return`\b`;case`t`:return` `;case`n`:return`
|
|
26
|
-
`;case`f`:return`\f`;case`r`:return`\r`;case`"`:return`"`;case`'`:return`'`;case`\\`:return`\\`}if(n)return String.fromCharCode(parseInt(n,16));if(r)return String.fromCodePoint(parseInt(r,16))}):e}var h=/[\u0000-\u0020<>"{}|^`\\]/g,g=[];for(let e=0;e<=127;++e)h.test(String.fromCharCode(e))&&(g[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),h.lastIndex=0);function _(e){return h.test(e)?e.replace(h,function(e){return g[e.codePointAt(0)]}):e}var v=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function y(e){return v.test(e)?e.replace(v,function(e,t,n){if(t)return String.fromCharCode(parseInt(t,16));if(n)return String.fromCodePoint(parseInt(n,16))}):e}})),yn=o(((e,t)=>{var n=pn(),r=gn(),i=_n(),a=vn(),{setImmediate:o}=hn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,signal:s=null}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.signal=s,this.quads=null}async main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()],i=0;for(let e of r)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let o=[...t.keys()].sort(),c=[];for(let e of o){let n=t.get(e);if(n.length>1){c.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}this.maxDeepIterations<0&&(this.maxWorkFactor===0?this.maxDeepIterations=0:this.maxWorkFactor===1/0?this.maxDeepIterations=1/0:this.maxDeepIterations=c.reduce((e,t)=>e+t.length,0)**this.maxWorkFactor),this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of c){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=await this.hashNDegreeQuads(r,e);t.push(i)}t.sort(s);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let l=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));l.push(t)}return l.sort(),l.join(``)}async hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}async hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=await this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0){if(this.signal&&this.signal.aborted)throw Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=await this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads,i=0;for(let a of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:`g`,id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}async _yield(){return new Promise(e=>o(e))}};function s(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}})),bn=o(((e,t)=>{var n=pn(),r=gn(),i=_n(),a=vn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,timeout:s=0}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.timeout=s,s>0&&(this.startTime=Date.now()),this.quads=null}main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()];for(let e of r)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let i=[...t.keys()].sort(),s=[];for(let e of i){let n=t.get(e);if(n.length>1){s.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}this.maxDeepIterations<0&&(this.maxWorkFactor===0?this.maxDeepIterations=0:this.maxWorkFactor===1/0?this.maxDeepIterations=1/0:this.maxDeepIterations=s.reduce((e,t)=>e+t.length,0)**this.maxWorkFactor),this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of s){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=this.hashNDegreeQuads(r,e);t.push(i)}t.sort(o);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let c=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join(``)}hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw Error(`Canonize timeout.`);let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads;for(let i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:`g`,id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}};function o(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}})),xn=o((e=>{var t=yn(),n=bn();function r(t,n){if(n.inputFormat){if(n.inputFormat===`application/n-quads`){if(typeof t!=`string`)throw Error(`N-Quads input must be a string.`);return e.NQuads.parse(t)}throw Error(`Unknown canonicalization input format: "${n.inputFormat}".`)}return t}function i(e){if(e.format&&e.format!==`application/n-quads`)throw Error(`Unknown canonicalization output format: "${e.format}".`)}function a(){globalThis.RDF_CANONIZE_TRACE_URDNA2015&&console.trace(`[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0`)}e.NQuads=vn(),e.IdentifierIssuer=pn(),e.canonize=async function(e,n={}){let o=r(e,n);if(i(n),!(`algorithm`in n))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(n.algorithm===`RDFC-1.0`)return new t(n).main(o);if(n.algorithm===`URDNA2015`&&!n.rejectURDNA2015)return a(),new t(n).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+n.algorithm)},e._canonizeSync=function(e,t={}){let o=r(e,t);if(i(t),!(`algorithm`in t))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(t.algorithm===`RDFC-1.0`)return new n(t).main(o);if(t.algorithm===`URDNA2015`&&!t.rejectURDNA2015)return a(),new n(t).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+t.algorithm)}})),Sn=o(((e,t)=>{t.exports=xn()})),Cn=o(((e,t)=>{var n={};t.exports=n,n.isArray=Array.isArray,n.isBoolean=e=>typeof e==`boolean`||Object.prototype.toString.call(e)===`[object Boolean]`,n.isDouble=e=>n.isNumber(e)&&(String(e).indexOf(`.`)!==-1||Math.abs(e)>=1e21),n.isEmptyObject=e=>n.isObject(e)&&Object.keys(e).length===0,n.isNumber=e=>typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`,n.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),n.isObject=e=>Object.prototype.toString.call(e)===`[object Object]`,n.isString=e=>typeof e==`string`||Object.prototype.toString.call(e)===`[object String]`,n.isUndefined=e=>e===void 0})),wn=o(((e,t)=>{var n=Cn(),r={};t.exports=r,r.isSubject=e=>n.isObject(e)&&!(`@value`in e||`@set`in e||`@list`in e)?Object.keys(e).length>1||!(`@id`in e):!1,r.isSubjectReference=e=>n.isObject(e)&&Object.keys(e).length===1&&`@id`in e,r.isValue=e=>n.isObject(e)&&`@value`in e,r.isList=e=>n.isObject(e)&&`@list`in e,r.isGraph=e=>n.isObject(e)&&`@graph`in e&&Object.keys(e).filter(e=>e!==`@id`&&e!==`@index`).length===1,r.isSimpleGraph=e=>r.isGraph(e)&&!(`@id`in e),r.isBlankNode=e=>{if(n.isObject(e)){if(`@id`in e){let t=e[`@id`];return!n.isString(t)||t.indexOf(`_:`)===0}return Object.keys(e).length===0||!(`@value`in e||`@set`in e||`@list`in e)}return!1}})),Tn=o(((e,t)=>{t.exports=class extends Error{constructor(e=`An unspecified JSON-LD error occurred.`,t=`jsonld.Error`,n={}){super(e),this.name=t,this.message=e,this.details=n}}})),En=o(((e,t)=>{var n=wn(),r=Cn(),i=Sn().IdentifierIssuer,a=Tn(),o=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,c=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,l=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,d={headers:{accept:`application/ld+json, application/json`}},f={};t.exports=f,f.IdentifierIssuer=i,f.REGEX_BCP47=o,f.REGEX_KEYWORD=u,f.clone=function(e){if(e&&typeof e==`object`){let t;if(r.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=f.clone(e[n])}else if(e instanceof Map){t=new Map;for(let[n,r]of e)t.set(n,f.clone(r))}else if(e instanceof Set){t=new Set;for(let n of e)t.add(f.clone(n))}else if(r.isObject(e)){t={};for(let n in e)t[n]=f.clone(e[n])}else t=e.toString();return t}return e},f.asArray=function(e){return Array.isArray(e)?e:[e]},f.buildHeaders=(e={})=>{if(Object.keys(e).some(e=>e.toLowerCase()===`accept`))throw RangeError(`Accept header may not be specified; only "`+d.headers.accept+`" is supported.`);return Object.assign({Accept:d.headers.accept},e)},f.parseLinkHeader=e=>{let t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(c);if(!r)continue;let i={target:r[1]},a=r[2];for(;r=l.exec(a);)i[r[1]]=r[2]===void 0?r[3]:r[2];let o=i.rel||``;Array.isArray(t[o])?t[o].push(i):t.hasOwnProperty(o)?t[o]=[t[o],i]:t[o]=i}return t},f.validateTypeValue=(e,t)=>{if(!r.isString(e)&&!(r.isArray(e)&&e.every(e=>r.isString(e)))){if(t&&r.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if(`@default`in e&&f.asArray(e[`@default`]).every(e=>r.isString(e)))return}throw new a(`Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.`,`jsonld.SyntaxError`,{code:`invalid type value`,value:e})}},f.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){let n=e[t];return!r.isArray(n)||n.length>0}return!1},f.hasValue=(e,t,i)=>{if(f.hasProperty(e,t)){let a=e[t],o=n.isList(a);if(r.isArray(a)||o){o&&(a=a[`@list`]);for(let e=0;e<a.length;++e)if(f.compareValues(i,a[e]))return!0}else if(!r.isArray(i))return f.compareValues(i,a)}return!1},f.addValue=(e,t,n,i)=>{if(i||={},`propertyIsArray`in i||(i.propertyIsArray=!1),`valueIsArray`in i||(i.valueIsArray=!1),`allowDuplicate`in i||(i.allowDuplicate=!0),`prependValue`in i||(i.prependValue=!1),i.valueIsArray)e[t]=n;else if(r.isArray(n)){n.length===0&&i.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),i.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let r=0;r<n.length;++r)f.addValue(e,t,n[r],i)}else if(e.hasOwnProperty(t)){let a=!i.allowDuplicate&&f.hasValue(e,t,n);!r.isArray(e[t])&&(!a||i.propertyIsArray)&&(e[t]=[e[t]]),a||(i.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=i.propertyIsArray?[n]:n},f.getValues=(e,t)=>[].concat(e[t]||[]),f.removeProperty=(e,t)=>{delete e[t]},f.removeValue=(e,t,n,r)=>{r||={},`propertyIsArray`in r||(r.propertyIsArray=!1);let i=f.getValues(e,t).filter(e=>!f.compareValues(e,n));i.length===0?f.removeProperty(e,t):i.length===1&&!r.propertyIsArray?e[t]=i[0]:e[t]=i},f.relabelBlankNodes=(e,t)=>(t||={},p(t.issuer||new i(`_:b`),e)),f.compareValues=(e,t)=>e===t||n.isValue(e)&&n.isValue(t)&&e[`@value`]===t[`@value`]&&e[`@type`]===t[`@type`]&&e[`@language`]===t[`@language`]&&e[`@index`]===t[`@index`]?!0:r.isObject(e)&&`@id`in e&&r.isObject(t)&&`@id`in t?e[`@id`]===t[`@id`]:!1,f.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1;function p(e,t){if(r.isArray(t))for(let n=0;n<t.length;++n)t[n]=p(e,t[n]);else if(n.isList(t))t[`@list`]=p(e,t[`@list`]);else if(r.isObject(t)){n.isBlankNode(t)&&(t[`@id`]=e.getId(t[`@id`]));let r=Object.keys(t).sort();for(let n=0;n<r.length;++n){let i=r[n];i!==`@id`&&(t[i]=p(e,t[i]))}}return t}})),Dn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,r=`http://www.w3.org/2001/XMLSchema#`;t.exports={LINK_HEADER_REL:`http://www.w3.org/ns/json-ld#context`,LINK_HEADER_CONTEXT:`http://www.w3.org/ns/json-ld#context`,RDF:n,RDF_LIST:n+`List`,RDF_FIRST:n+`first`,RDF_REST:n+`rest`,RDF_NIL:n+`nil`,RDF_TYPE:n+`type`,RDF_PLAIN_LITERAL:n+`PlainLiteral`,RDF_XML_LITERAL:n+`XMLLiteral`,RDF_JSON_LITERAL:n+`JSON`,RDF_OBJECT:n+`object`,RDF_LANGSTRING:n+`langString`,XSD:r,XSD_BOOLEAN:r+`boolean`,XSD_DOUBLE:r+`double`,XSD_INTEGER:r+`integer`,XSD_STRING:r+`string`}})),On=o(((e,t)=>{t.exports=class{constructor(){this._requests={}}wrapLoader(e){let t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}})),kn=o(((e,t)=>{var n=Cn(),r={};t.exports=r,r.parsers={simple:{keys:[`href`,`scheme`,`authority`,`path`,`query`,`fragment`],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:[`href`,`protocol`,`scheme`,`authority`,`auth`,`user`,`password`,`hostname`,`port`,`path`,`directory`,`file`,`query`,`fragment`],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(e,t)=>{let n={},i=r.parsers[t||`full`],a=i.regex.exec(e),o=i.keys.length;for(;o--;)n[i.keys[o]]=a[o]===void 0?null:a[o];return(n.scheme===`https`&&n.port===`443`||n.scheme===`http`&&n.port===`80`)&&(n.href=n.href.replace(`:`+n.port,``),n.authority=n.authority.replace(`:`+n.port,``),n.port=null),n.normalizedPath=r.removeDotSegments(n.path),n},r.prependBase=(e,t)=>{if(e===null||r.isAbsolute(t))return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=r.parse(t),a={protocol:e.protocol||``};if(i.authority!==null)a.authority=i.authority,a.path=i.path,a.query=i.query;else if(a.authority=e.authority,i.path===``)a.path=e.path,i.query===null?a.query=e.query:a.query=i.query;else{if(i.path.indexOf(`/`)===0)a.path=i.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf(`/`)+1),(t.length>0||e.authority)&&t.substr(-1)!==`/`&&(t+=`/`),t+=i.path,a.path=t}a.query=i.query}i.path!==``&&(a.path=r.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+=`//`+a.authority),o+=a.path,a.query!==null&&(o+=`?`+a.query),i.fragment!==null&&(o+=`#`+i.fragment),o===``&&(o=`./`),o},r.removeBase=(e,t)=>{if(e===null)return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=``;if(e.href===``?t.indexOf(`//`)&&(i+=`//`):i+=(e.protocol||``)+`//`+(e.authority||``),t.indexOf(i)!==0)return t;let a=r.parse(t.substr(i.length)),o=e.normalizedPath.split(`/`),s=a.normalizedPath.split(`/`),c=a.fragment||a.query?0:1;for(;o.length>0&&s.length>c&&o[0]===s[0];)o.shift(),s.shift();let l=``;if(o.length>0){o.pop();for(let e=0;e<o.length;++e)l+=`../`}return l+=s.join(`/`),a.query!==null&&(l+=`?`+a.query),a.fragment!==null&&(l+=`#`+a.fragment),l===``&&(l=`./`),l},r.removeDotSegments=e=>{if(e.length===0)return``;let t=e.split(`/`),n=[];for(;t.length>0;){let e=t.shift(),r=t.length===0;if(e===`.`){r&&n.push(``);continue}if(e===`..`){n.pop(),r&&n.push(``);continue}n.push(e)}return e[0]===`/`&&n.length>0&&n[0]!==``&&n.unshift(``),n.length===1&&n[0]===``?`/`:n.join(`/`)};var i=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=e=>n.isString(e)&&i.test(e),r.isRelative=e=>n.isString(e)})),An=o(((e,t)=>{var{parseLinkHeader:n,buildHeaders:r}=En(),{LINK_HEADER_CONTEXT:i}=Dn(),a=Tn(),o=On(),{prependBase:s}=kn(),c=/(^|(\r\n))link:/i;t.exports=({secure:e,headers:t={},xhr:u}={headers:{}})=>{return t=r(t),new o().wrapLoader(d);async function d(r){if(r.indexOf(`http:`)!==0&&r.indexOf(`https:`)!==0)throw new a(`URL could not be dereferenced; only "http" and "https" URLs are supported.`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});if(e&&r.indexOf(`https`)!==0)throw new a(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});let o;try{o=await l(u,r,t)}catch(e){throw new a(`URL could not be dereferenced, an error occurred.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,cause:e})}if(o.status>=400)throw new a(`URL could not be dereferenced: `+o.statusText,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,httpStatusCode:o.status});let f={contextUrl:null,documentUrl:r,document:o.response},p=null,m=o.getResponseHeader(`Content-Type`),h;if(c.test(o.getAllResponseHeaders())&&(h=o.getResponseHeader(`Link`)),h&&m!==`application/ld+json`){let e=n(h),t=e[i];if(Array.isArray(t))throw new a(`URL could not be dereferenced, it has more than one associated HTTP Link Header.`,`jsonld.InvalidUrl`,{code:`multiple context link headers`,url:r});t&&(f.contextUrl=t.target),p=e.alternate,p&&p.type==`application/ld+json`&&!(m||``).match(/^application\/(\w*\+)?json$/)&&(f=await d(s(r,p.target)))}return f}};function l(e,t,n){e||=XMLHttpRequest;let r=new e;return new Promise((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open(`GET`,t,!0);for(let e in n)r.setRequestHeader(e,n[e]);r.send()})}})),jn=o(((e,t)=>{var n=An(),r={};t.exports=r,r.setupDocumentLoaders=function(e){typeof XMLHttpRequest<`u`&&(e.documentLoaders.xhr=n,e.useDocumentLoader(`xhr`))},r.setupGlobals=function(e){globalThis.JsonLdProcessor===void 0&&Object.defineProperty(globalThis,`JsonLdProcessor`,{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}})),Mn=o(((e,t)=>{t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}})),Nn=o(((e,t)=>{t.exports=n,n.Node=o,n.create=n;function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==`function`)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}n.prototype.removeNode=function(e){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||=e,this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t||=this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t||=this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value},n.prototype.map=function(e,t){t||=this;for(var r=new n,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t||=this;for(var r=new n,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=0;r!==null;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=this.length-1;r!==null;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(;a!==null&&i<t;i++,a=a.next)r.push(a.value);return r},n.prototype.sliceReverse=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(var o=[],i=0;a&&i<t;i++)o.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var i=0;i<n.length;i++)a=r(this,a,n[i]);return o},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function r(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||=e.tail,e.length++}function a(e,t){e.head=new o(t,null,e.head,e),e.tail||=e.head,e.length++}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{Mn()(n)}catch{}})),Pn=o(((e,t)=>{var n=Nn(),r=Symbol(`max`),i=Symbol(`length`),a=Symbol(`lengthCalculator`),o=Symbol(`allowStale`),s=Symbol(`maxAge`),c=Symbol(`dispose`),l=Symbol(`noDisposeOnSet`),u=Symbol(`lruList`),d=Symbol(`cache`),f=Symbol(`updateAgeOnGet`),p=()=>1,m=class{constructor(e){if(typeof e==`number`&&(e={max:e}),e||={},e.max&&(typeof e.max!=`number`||e.max<0))throw TypeError(`max must be a non-negative number`);this[r]=e.max||1/0;let t=e.length||p;if(this[a]=typeof t==`function`?t:p,this[o]=e.stale||!1,e.maxAge&&typeof e.maxAge!=`number`)throw TypeError(`maxAge must be a number`);this[s]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!=`number`||e<0)throw TypeError(`max must be a non-negative number`);this[r]=e||1/0,_(this)}get max(){return this[r]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=`number`)throw TypeError(`maxAge must be a non-negative number`);this[s]=e,_(this)}get maxAge(){return this[s]}set lengthCalculator(e){typeof e!=`function`&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach(e=>{e.length=this[a](e.value,e.key),this[i]+=e.length})),_(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t||=this;for(let n=this[u].tail;n!==null;){let r=n.prev;b(this,e,n,t),n=r}}forEach(e,t){t||=this;for(let n=this[u].head;n!==null;){let r=n.next;b(this,e,n,t),n=r}}keys(){return this[u].toArray().map(e=>e.key)}values(){return this[u].toArray().map(e=>e.value)}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[u]=new n,this[i]=0}dump(){return this[u].map(e=>g(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[u]}set(e,t,n){if(n||=this[s],n&&typeof n!=`number`)throw TypeError(`maxAge must be a number`);let o=n?Date.now():0,f=this[a](t,e);if(this[d].has(e)){if(f>this[r])return v(this,this[d].get(e)),!1;let a=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,a.value)),a.now=o,a.maxAge=n,a.value=t,this[i]+=f-a.length,a.length=f,this.get(e),_(this),!0}let p=new y(e,t,f,o,n);return p.length>this[r]?(this[c]&&this[c](e,t),!1):(this[i]+=p.length,this[u].unshift(p),this[d].set(e,this[u].head),_(this),!0)}has(e){if(!this[d].has(e))return!1;let t=this[d].get(e).value;return!g(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){let e=this[u].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[d].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(i===0)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>h(this,t,!1))}},h=(e,t,n)=>{let r=e[d].get(t);if(r){let t=r.value;if(g(e,t)){if(v(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[s]&&n>e[s]},_=e=>{if(e[i]>e[r])for(let t=e[u].tail;e[i]>e[r]&&t!==null;){let n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){let n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[d].delete(n.key),e[u].removeNode(t)}},y=class{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}},b=(e,t,n,r)=>{let i=n.value;g(e,i)&&(v(e,n),e[o]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};t.exports=m})),Fn=o(((e,t)=>{var n=Pn(),r=10;t.exports=class{constructor({document:e}){this.document=e,this.cache=new n({max:r})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}})),In=o(((e,t)=>{var{isArray:n,isObject:r,isString:i}=Cn(),{asArray:a}=En(),{prependBase:o}=kn(),s=Tn(),c=Fn(),l=10;t.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:o,base:s,cycles:l=new Set}){t&&r(t)&&t[`@context`]&&(t=t[`@context`]),t=a(t);let d=[];for(let a of t){if(i(a)){let t=this._get(a);t||=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:o,base:s,cycles:l}),n(t)?d.push(...t):d.push(t);continue}if(a===null){d.push(new c({document:null}));continue}r(a)||u(t);let f=JSON.stringify(a),p=this._get(f);p||(p=new c({document:a}),this._cacheResolvedContext({key:f,resolved:p,tag:`static`})),d.push(p)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){let n=this.sharedCache.get(e);n&&(t=n.get(`static`),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),n!==void 0){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=o(r,t);let{context:a,remoteDoc:s}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});r=s.documentUrl||t,d({context:a,base:r});let c=await this.resolve({activeCtx:e,context:a,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:c,tag:s.tag}),c}async _fetchContext({activeCtx:e,url:t,documentLoader:a,cycles:o}){if(o.size>l)throw new s(`Maximum number of @context URLs exceeded.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`loading remote context failed`:`context overflow`,max:l});if(o.has(t))throw new s(`Cyclical @context URLs detected.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`recursive context inclusion`:`context overflow`,url:t});o.add(t);let c,u;try{u=await a(t),c=u.document||null,i(c)&&(c=JSON.parse(c))}catch(e){throw new s(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`loading remote context failed`,url:t,cause:e})}if(!r(c))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`invalid remote context`,url:t});return c=`@context`in c?{"@context":c[`@context`]}:{"@context":{}},u.contextUrl&&(n(c[`@context`])||(c[`@context`]=[c[`@context`]]),c[`@context`].push(u.contextUrl)),{context:c,remoteDoc:u}}};function u(e){throw new s(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:e})}function d({context:e,base:t}){if(!e)return;let a=e[`@context`];if(i(a)){e[`@context`]=o(t,a);return}if(n(a)){for(let e=0;e<a.length;++e){let n=a[e];if(i(n)){a[e]=o(t,n);continue}r(n)&&d({context:{"@context":n},base:t})}return}if(r(a))for(let e in a)d({context:a[e],base:t})}})),Ln=o(((e,t)=>{t.exports=Sn().NQuads})),Rn=o(((e,t)=>{var n=Tn(),{isArray:r}=Cn(),{asArray:i}=En(),a={};t.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{let t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?i(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return t.length===0?null:t},a.handleEvent=({event:e,options:t})=>{o({event:e,handlers:t.eventHandler})};function o({event:e,handlers:t}){let i=!0;for(let a=0;i&&a<t.length;++a){i=!1;let s=t[a];if(r(s))i=o({event:e,handlers:s});else if(typeof s==`function`)s({event:e,next:()=>{i=!0}});else if(typeof s==`object`)e.code in s?s[e.code]({event:e,next:()=>{i=!0}}):i=!0;else throw new n(`Invalid event handler.`,`jsonld.InvalidEventHandler`,{event:e})}return i}var s=new Set([`empty object`,`free-floating scalar`,`invalid @language value`,`invalid property`,`null @id value`,`null @value value`,`object with only @id`,`object with only @language`,`object with only @list`,`object with only @value`,`relative @id reference`,`relative @type reference`,`relative @vocab reference`,`reserved @id value`,`reserved @reverse value`,`reserved term`,`blank node predicate`,`relative graph reference`,`relative object reference`,`relative predicate reference`,`relative subject reference`,`rdfDirection not set`]);a.safeEventHandler=function({event:e,next:t}){if(e.level===`warning`&&s.has(e.code))throw new n(`Safe mode validation error.`,`jsonld.ValidationError`,{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){e.level===`warning`&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new n(`No handler for event.`,`jsonld.UnhandledEvent`,{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?i(e):null}})),zn=o(((e,t)=>{var n=En(),r=Tn(),{isArray:i,isObject:a,isString:o,isUndefined:s}=Cn(),{isAbsolute:c,isRelative:l,prependBase:u}=kn(),{handleEvent:d}=Rn(),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:m,compareShortestLeast:h}=En(),g=new Map,_=1e4,v={};t.exports=v,v.process=async({activeCtx:e,localCtx:t,options:n,propagate:s=!0,overrideProtected:p=!1,cycles:h=new Set})=>{if(a(t)&&`@context`in t&&i(t[`@context`])&&(t=t[`@context`]),m(t).length===0)return e;let g=[],_=[({event:e,next:t})=>{g.push(e),t()}];n.eventHandler&&_.push(n.eventHandler);let b=n;n={...n,eventHandler:_};let x=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(x[0].document)&&typeof x[0].document[`@propagate`]==`boolean`&&(s=x[0].document[`@propagate`]);let S=e;!s&&!S.previousContext&&(S=S.clone(),S.previousContext=e);for(let i of x){let{document:s}=i;if(e=S,s===null){if(!p&&Object.keys(e.protected).length!==0)throw new r(`Tried to nullify a context with protected terms outside of a term definition.`,`jsonld.SyntaxError`,{code:`invalid context nullification`});S=e=v.getInitialContext(n).clone();continue}let m=i.getProcessed(e);if(m){if(b.eventHandler)for(let e of m.events)d({event:e,options:b});S=e=m.context;continue}if(a(s)&&`@context`in s&&(s=s[`@context`]),!a(s))throw new r(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:s});S=S.clone();let _=new Map;if(`@version`in s){if(s[`@version`]!==1.1)throw new r(`Unsupported JSON-LD version: `+s[`@version`],`jsonld.UnsupportedVersion`,{code:`invalid @version value`,context:s});if(e.processingMode&&e.processingMode===`json-ld-1.0`)throw new r(`@version: `+s[`@version`]+` not compatible with `+e.processingMode,`jsonld.ProcessingModeConflict`,{code:`processing mode conflict`,context:s});S.processingMode=`json-ld-1.1`,S[`@version`]=s[`@version`],_.set(`@version`,!0)}if(S.processingMode=S.processingMode||e.processingMode,`@base`in s){let e=s[`@base`];if(!(e===null||c(e)))if(l(e))e=u(S[`@base`],e);else throw new r(`Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.`,`jsonld.SyntaxError`,{code:`invalid base IRI`,context:s});S[`@base`]=e,_.set(`@base`,!0)}if(`@vocab`in s){let e=s[`@vocab`];if(e===null)delete S[`@vocab`];else if(!o(e))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else if(!c(e)&&v.processingMode(S,1))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else{let t=y(S,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`relative @vocab reference`,level:`warning`,message:`Relative @vocab reference found.`,details:{vocab:t}},options:n}),S[`@vocab`]=t}_.set(`@vocab`,!0)}if(`@language`in s){let e=s[`@language`];if(e===null)delete S[`@language`];else if(o(e))e.match(f)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:n}),S[`@language`]=e.toLowerCase();else throw new r(`Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid default language`,context:s});_.set(`@language`,!0)}if(`@direction`in s){let t=s[`@direction`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @direction not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context member`,context:s});if(t===null)delete S[`@direction`];else if(t!==`ltr`&&t!==`rtl`)throw new r(`Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:s});else S[`@direction`]=t;_.set(`@direction`,!0)}if(`@propagate`in s){let n=s[`@propagate`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @propagate not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(typeof n!=`boolean`)throw new r(`Invalid JSON-LD syntax; @propagate value must be a boolean.`,`jsonld.SyntaxError`,{code:`invalid @propagate value`,context:t});_.set(`@propagate`,!0)}if(`@import`in s){let i=s[`@import`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @import not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(!o(i))throw new r(`Invalid JSON-LD syntax; @import must be a string.`,`jsonld.SyntaxError`,{code:`invalid @import value`,context:t});let a=await n.contextResolver.resolve({activeCtx:e,context:i,documentLoader:n.documentLoader,base:n.base});if(a.length!==1)throw new r(`Invalid JSON-LD syntax; @import must reference a single context.`,`jsonld.SyntaxError`,{code:`invalid remote context`,context:t});let c=a[0].getProcessed(e);if(c)s=c;else{let n=a[0].document;if(`@import`in n)throw new r(`Invalid JSON-LD syntax: imported context must not include @import.`,`jsonld.SyntaxError`,{code:`invalid context entry`,context:t});for(let e in n)s.hasOwnProperty(e)||(s[e]=n[e]);a[0].setProcessed(e,s)}_.set(`@import`,!0)}_.set(`@protected`,s[`@protected`]||!1);for(let e in s)if(v.createTermDefinition({activeCtx:S,localCtx:s,term:e,defined:_,options:n,overrideProtected:p}),a(s[e])&&`@context`in s[e]){let t=s[e][`@context`],i=!0;if(o(t)){let e=u(n.base,t);h.has(e)?i=!1:h.add(e)}if(i)try{await v.process({activeCtx:S.clone(),localCtx:s[e][`@context`],overrideProtected:!0,options:n,cycles:h})}catch{throw new r(`Invalid JSON-LD syntax; invalid scoped context.`,`jsonld.SyntaxError`,{code:`invalid scoped context`,context:s[e][`@context`],term:e})}}i.setProcessed(e,{context:S,events:g})}return S},v.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:s,options:l,overrideProtected:u=!1})=>{if(s.has(n)){if(s.get(n))return;throw new r(`Cyclical context definition detected.`,`jsonld.CyclicalContext`,{code:`cyclic IRI mapping`,context:t,term:n})}s.set(n,!1);let f;if(t.hasOwnProperty(n)&&(f=t[n]),n===`@type`&&a(f)&&(f[`@container`]||`@set`)===`@set`&&v.processingMode(e,1.1)){let e=[`@container`,`@id`,`@protected`],i=Object.keys(f);if(i.length===0||i.some(t=>!e.includes(t)))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n})}else if(v.isKeyword(n))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n});else if(n.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved term`,level:`warning`,message:`Terms beginning with "@" are reserved for future use and dropped.`,details:{term:n}},options:l});return}else if(n===``)throw new r(`Invalid JSON-LD syntax; a term cannot be an empty string.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let m=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let h=!1;if((o(f)||f===null)&&(h=!0,f={"@id":f}),!a(f))throw new r(`Invalid JSON-LD syntax; @context term values must be strings or objects.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let g={};e.mappings.set(n,g),g.reverse=!1;let _=[`@container`,`@id`,`@language`,`@reverse`,`@type`];v.processingMode(e,1.1)&&_.push(`@context`,`@direction`,`@index`,`@nest`,`@prefix`,`@protected`);for(let e in f)if(!_.includes(e))throw new r(`Invalid JSON-LD syntax; a term definition must not contain `+e,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let x=n.indexOf(`:`);if(g._termHasColon=x>0,`@reverse`in f){if(`@id`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @id.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});if(`@nest`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});let i=f[`@reverse`];if(!o(i))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @reverse value`,level:`warning`,message:`@reverse values beginning with "@" are reserved for future use and dropped.`,details:{reverse:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}let a=y(e,i,{vocab:!0,base:!1},t,s,l);if(!c(a))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=a,g.reverse=!0}else if(`@id`in f){let i=f[`@id`];if(i&&!o(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i===null)g[`@id`]=null;else if(!v.isKeyword(i)&&i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`@id values beginning with "@" are reserved for future use and dropped.`,details:{id:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}else if(i!==n){if(i=y(e,i,{vocab:!0,base:!1},t,s,l),!c(i)&&!v.isKeyword(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(n.match(/(?::[^:])|\//)&&y(e,n,{vocab:!0,base:!1},t,new Map(s).set(n,!0),l)!==i)throw new r(`Invalid JSON-LD syntax; term in form of IRI must expand to definition.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=i,g._prefix=h&&!g._termHasColon&&i.match(/[:\/\?#\[\]@]$/)!==null}}if(!(`@id`in g))if(g._termHasColon){let r=n.substr(0,x);if(t.hasOwnProperty(r)&&v.createTermDefinition({activeCtx:e,localCtx:t,term:r,defined:s,options:l}),e.mappings.has(r)){let t=n.substr(x+1);g[`@id`]=e.mappings.get(r)[`@id`]+t}else g[`@id`]=n}else if(n===`@type`)g[`@id`]=n;else{if(!(`@vocab`in e))throw new r(`Invalid JSON-LD syntax; @context terms must define an @id.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t,term:n});g[`@id`]=e[`@vocab`]+n}if((f[`@protected`]===!0||s.get(`@protected`)===!0&&f[`@protected`]!==!1)&&(e.protected[n]=!0,g.protected=!0),s.set(n,!0),`@type`in f){let n=f[`@type`];if(!o(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be a string.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n===`@json`||n===`@none`){if(v.processingMode(e,1))throw new r(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else if(n!==`@id`&&n!==`@vocab`){if(n=y(e,n,{vocab:!0,base:!1},t,s,l),!c(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n.indexOf(`_:`)===0)throw new r(`Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}g[`@type`]=n}if(`@container`in f){let n=o(f[`@container`])?[f[`@container`]]:f[`@container`]||[],a=[`@list`,`@set`,`@index`,`@language`],s=!0,c=n.includes(`@set`);if(v.processingMode(e,1.1)){if(a.push(`@graph`,`@id`,`@type`),n.includes(`@list`)){if(n.length!==1)throw new r(`Invalid JSON-LD syntax; @context @container with @list must have no other values`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else if(n.includes(`@graph`)){if(n.some(e=>e!==`@graph`&&e!==`@id`&&e!==`@index`&&e!==`@set`))throw new r(`Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else s&=n.length<=(c?2:1);if(n.includes(`@type`)&&(g[`@type`]=g[`@type`]||`@id`,![`@id`,`@vocab`].includes(g[`@type`])))throw new r(`Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else s&=!i(f[`@container`]),s&=n.length<=1;if(s&=n.every(e=>a.includes(e)),s&=!(c&&n.includes(`@list`)),!s)throw new r(`Invalid JSON-LD syntax; @context @container value must be one of the following: `+a.join(`, `),`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t});if(g.reverse&&!n.every(e=>[`@index`,`@set`].includes(e)))throw new r(`Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});g[`@container`]=n}if(`@index`in f){if(!(`@container`in f)||!g[`@container`].includes(`@index`))throw new r(`Invalid JSON-LD syntax; @index without @index in @container: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(!o(f[`@index`])||f[`@index`].indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @index must expand to an IRI: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});g[`@index`]=f[`@index`]}if(`@context`in f&&(g[`@context`]=f[`@context`]),`@language`in f&&!(`@type`in f)){let e=f[`@language`];if(e!==null&&!o(e))throw new r(`Invalid JSON-LD syntax; @context @language value must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid language mapping`,context:t});e!==null&&(e=e.toLowerCase()),g[`@language`]=e}if(`@prefix`in f){if(n.match(/:|\//))throw new r(`Invalid JSON-LD syntax; @context @prefix used on a compact IRI term`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(v.isKeyword(g[`@id`]))throw new r(`Invalid JSON-LD syntax; keywords may not be used as prefixes`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(typeof f[`@prefix`]==`boolean`)g._prefix=f[`@prefix`]===!0;else throw new r(`Invalid JSON-LD syntax; @context value for @prefix must be boolean`,`jsonld.SyntaxError`,{code:`invalid @prefix value`,context:t})}if(`@direction`in f){let e=f[`@direction`];if(e!==null&&e!==`ltr`&&e!==`rtl`)throw new r(`Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:t});g[`@direction`]=e}if(`@nest`in f){let e=f[`@nest`];if(!o(e)||e!==`@nest`&&e.indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,context:t});g[`@nest`]=e}let S=g[`@id`];if(S===`@context`||S===`@preserve`)throw new r(`Invalid JSON-LD syntax; @context and @preserve cannot be aliased.`,`jsonld.SyntaxError`,{code:`invalid keyword alias`,context:t});if(m&&m.protected&&!u&&(e.protected[n]=!0,g.protected=!0,!b(m,g)))throw new r(`Invalid JSON-LD syntax; tried to redefine a protected term.`,`jsonld.SyntaxError`,{code:`protected term redefinition`,context:t,term:n})},v.expandIri=(e,t,n,r)=>y(e,t,n,void 0,void 0,r);function y(e,t,n,r,i,s){if(t===null||!o(t)||v.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&i.get(t)!==!0&&v.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:s}),n||={},n.vocab){let n=e.mappings.get(t);if(n===null)return null;if(a(n)&&`@id`in n)return n[`@id`]}let l=t.indexOf(`:`);if(l>0){let n=t.substr(0,l),a=t.substr(l+1);if(n===`_`||a.indexOf(`//`)===0)return t;r&&r.hasOwnProperty(n)&&v.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:s});let o=e.mappings.get(n);if(o&&o._prefix)return o[`@id`]+a;if(c(t))return t}if(n.vocab&&`@vocab`in e)t=e[`@vocab`]+t;else if(n.base){let n,r;`@base`in e?e[`@base`]?(r=u(s.base,e[`@base`]),n=u(r,t)):(r=e[`@base`],n=t):(r=s.base,n=u(s.base,t)),t=n}return t}v.getInitialContext=e=>{let t=JSON.stringify({processingMode:e.processingMode}),r=g.get(t);if(r)return r;let i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:a,clone:c,revertToPreviousContext:l,protected:{}};return g.size===_&&g.clear(),g.set(t,i),i;function a(){let e=this;if(e.inverse)return e.inverse;let t=e.inverse={},n=e.fastCurieMap={},r={},i=(e[`@language`]||`@none`).toLowerCase(),a=e[`@direction`],c=e.mappings,l=[...c.keys()].sort(h);for(let e of l){let o=c.get(e);if(o===null)continue;let l=o[`@container`]||`@none`;if(l=[].concat(l).sort().join(``),o[`@id`]===null)continue;let u=m(o[`@id`]);for(let c of u){let u=t[c],d=v.isKeyword(c);if(u)!d&&!o._termHasColon&&r[c].push(e);else if(t[c]=u={},!d&&!o._termHasColon){r[c]=[e];let t={iri:c,terms:r[c]};c[0]in n?n[c[0]].push(t):n[c[0]]=[t]}if(u[l]||(u[l]={"@language":{},"@type":{},"@any":{}}),u=u[l],s(e,u[`@any`],`@none`),o.reverse)s(e,u[`@type`],`@reverse`);else if(o[`@type`]===`@none`)s(e,u[`@any`],`@none`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`);else if(`@type`in o)s(e,u[`@type`],o[`@type`]);else if(`@language`in o&&`@direction`in o){let t=o[`@language`],n=o[`@direction`];t&&n?s(e,u[`@language`],`${t}_${n}`.toLowerCase()):t?s(e,u[`@language`],t.toLowerCase()):n?s(e,u[`@language`],`_${n}`):s(e,u[`@language`],`@null`)}else `@language`in o?s(e,u[`@language`],(o[`@language`]||`@null`).toLowerCase()):`@direction`in o?o[`@direction`]?s(e,u[`@language`],`_${o[`@direction`]}`):s(e,u[`@language`],`@none`):a?(s(e,u[`@language`],`_${a}`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`)):(s(e,u[`@language`],i),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`))}}for(let e in n)o(n,e,1);return t}function o(e,t,n){let r=e[t],i=e[t]={},a,s;for(let e of r)a=e.iri,s=n>=a.length?``:a[n],s in i?i[s].push(e):i[s]=[e];for(let e in i)e!==``&&o(i,e,n+1)}function s(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}function c(){let e={};return e.mappings=n.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=n.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,`@base`in this&&(e[`@base`]=this[`@base`]),`@language`in this&&(e[`@language`]=this[`@language`]),`@vocab`in this&&(e[`@vocab`]=this[`@vocab`]),e}function l(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(e,t,n)=>{if(t===null)return n===`@context`?void 0:null;if(e.mappings.has(t)){let r=e.mappings.get(t);if(s(n))return r;if(r.hasOwnProperty(n))return r[n]}if(n===`@language`&&n in e||n===`@direction`&&n in e)return e[n];if(n!==`@context`)return null},v.processingMode=(e,t)=>t.toString()>=`1.1`?!e.processingMode||e.processingMode>=`json-ld-`+t.toString():e.processingMode===`json-ld-1.0`,v.isKeyword=e=>{if(!o(e)||e[0]!==`@`)return!1;switch(e){case`@base`:case`@container`:case`@context`:case`@default`:case`@direction`:case`@embed`:case`@explicit`:case`@graph`:case`@id`:case`@included`:case`@index`:case`@json`:case`@language`:case`@list`:case`@nest`:case`@none`:case`@omitDefault`:case`@prefix`:case`@preserve`:case`@protected`:case`@requireAll`:case`@reverse`:case`@set`:case`@type`:case`@value`:case`@version`:case`@vocab`:return!0}return!1};function b(e,t){if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return e===t;let n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!b(e[n],t[n]))return!1;return!0}let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let n in e){let r=e[n],i=t[n];if(n===`@container`&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!b(r,i))return!1}return!0}})),Bn=o(((e,t)=>{var n=Tn(),{isArray:r,isObject:i,isEmptyObject:a,isString:o,isUndefined:s}=Cn(),{isList:c,isValue:l,isGraph:u,isSubject:d}=wn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=zn(),{isAbsolute:_}=kn(),{REGEX_BCP47:v,REGEX_KEYWORD:y,addValue:b,asArray:x,getValues:S,validateTypeValue:C}=En(),{handleEvent:w}=Rn(),T={};t.exports=T,T.expand=async({activeCtx:e,activeProperty:t=null,element:c,options:l={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:m=null})=>{if(c==null)return null;if(t===`@default`&&(l=Object.assign({},l,{isFrame:!1})),!r(c)&&!i(c))return!u&&(t===null||f(e,t,{vocab:!0},l)===`@graph`)?(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`free-floating scalar`,level:`warning`,message:`Dropping free-floating scalar not in a list.`,details:{value:c}},options:l}),null):O({activeCtx:e,activeProperty:t,value:c,options:l});if(r(c)){let n=[],i=p(e,t,`@container`)||[];u||=i.includes(`@list`);for(let i=0;i<c.length;++i){let a=await T.expand({activeCtx:e,activeProperty:t,element:c[i],options:l,insideIndex:d,typeScopedContext:m});u&&r(a)&&(a={"@list":a}),a!==null&&(r(a)?n=n.concat(a):n.push(a))}return n}let v=f(e,t,{vocab:!0},l),y=p(e,t,`@context`);m||=e.previousContext?e:null;let b=Object.keys(c).sort(),C=!d;if(C&&m&&b.length<=2&&!b.includes(`@context`))for(let t of b){let n=f(m,t,{vocab:!0},l);if(n===`@value`){C=!1,e=m;break}if(n===`@id`&&b.length===1){C=!1;break}}C&&(e=e.revertToPreviousContext()),s(y)||(e=await h({activeCtx:e,localCtx:y,propagate:!0,overrideProtected:!0,options:l})),`@context`in c&&(e=await h({activeCtx:e,localCtx:c[`@context`],options:l})),m=e;let k=null;for(let t of b)if(f(e,t,{vocab:!0},l)===`@type`){k||=t;let n=c[t],r=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(let t of r){let n=p(m,t,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,options:l,propagate:!1}))}}let A={};await D({activeCtx:e,activeProperty:t,expandedActiveProperty:v,element:c,expandedParent:A,options:l,insideList:u,typeKey:k,typeScopedContext:m}),b=Object.keys(A);let j=b.length;if(`@value`in A){if(`@type`in A&&(`@language`in A||`@direction`in A))throw new n(`Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let t=j-1;if(`@type`in A&&--t,`@index`in A&&--t,`@language`in A&&--t,`@direction`in A&&--t,t!==0)throw new n(`Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let r=A[`@value`]===null?[]:x(A[`@value`]),i=S(A,`@type`);if(!(g(e,1.1)&&i.includes(`@json`)&&i.length===1)){if(r.length===0)l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`null @value value`,level:`warning`,message:`Dropping null @value value.`,details:{value:A}},options:l}),A=null;else if(!r.every(e=>o(e)||a(e))&&`@language`in A)throw new n(`Invalid JSON-LD syntax; only strings may be language-tagged.`,`jsonld.SyntaxError`,{code:`invalid language-tagged value`,element:A});else if(!i.every(e=>_(e)&&!(o(e)&&e.indexOf(`_:`)===0)||a(e)))throw new n(`Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".`,`jsonld.SyntaxError`,{code:`invalid typed value`,element:A})}}else if(`@type`in A&&!r(A[`@type`]))A[`@type`]=[A[`@type`]];else if(`@set`in A||`@list`in A){if(j>1&&!(j===2&&`@index`in A))throw new n(`Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".`,`jsonld.SyntaxError`,{code:`invalid set or list object`,element:A});`@set`in A&&(A=A[`@set`],b=Object.keys(A),j=b.length)}else j===1&&`@language`in A&&(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`object with only @language`,level:`warning`,message:`Dropping object with only @language.`,details:{value:A}},options:l}),A=null);return i(A)&&!l.keepFreeFloatingNodes&&!u&&(t===null||v===`@graph`||(p(e,t,`@container`)||[]).includes(`@graph`))&&(A=E({value:A,count:j,options:l})),A};function E({value:e,count:t,options:n}){if(t===0||`@value`in e||`@list`in e||t===1&&`@id`in e){if(n.eventHandler){let r,i;t===0?(r=`empty object`,i=`Dropping empty object.`):`@value`in e?(r=`object with only @value`,i=`Dropping object with only @value.`):`@list`in e?(r=`object with only @list`,i=`Dropping object with only @list.`):t===1&&`@id`in e&&(r=`object with only @id`,i=`Dropping object with only @id.`),w({event:{type:[`JsonLdEvent`],code:r,level:`warning`,message:i,details:{value:e}},options:n})}return null}return e}async function D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:y,expandedParent:S,options:O={},insideList:j,typeKey:M,typeScopedContext:N}){let P=Object.keys(y).sort(),F=[],I,R=y[M]&&f(e,r(y[M])?y[M][0]:y[M],{vocab:!0},{...O,typeExpansion:!0})===`@json`;for(let D of P){let j=y[D],M;if(D===`@context`)continue;let P=f(e,D,{vocab:!0},O);if(P===null||!(_(P)||m(P))){O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid property`,level:`warning`,message:`Dropping property that did not expand into an absolute IRI or keyword.`,details:{property:D,expandedProperty:P}},options:O});continue}if(m(P)){if(u===`@reverse`)throw new n(`Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.`,`jsonld.SyntaxError`,{code:`invalid reverse property map`,value:j});if(P in S&&P!==`@included`&&P!==`@type`)throw new n(`Invalid JSON-LD syntax; colliding keywords detected.`,`jsonld.SyntaxError`,{code:`colliding keywords`,keyword:P})}if(P===`@id`){if(!o(j)){if(!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@id" value must a string.`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j});if(i(j)){if(!a(j))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else if(r(j)){if(!j.every(e=>o(e)))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}b(S,`@id`,x(j).map(t=>{if(o(t)){let n=f(e,t,{base:!0},O);return O.eventHandler&&(n===null?w(t===null?{event:{type:[`JsonLdEvent`],code:`null @id value`,level:`warning`,message:`Null @id found.`,details:{id:t}},options:O}:{event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:O}):_(n)||w({event:{type:[`JsonLdEvent`],code:`relative @id reference`,level:`warning`,message:`Relative @id reference found.`,details:{id:t,expandedId:n}},options:O})),n}return t}),{propertyIsArray:O.isFrame});continue}if(P===`@type`){i(j)&&(j=Object.fromEntries(Object.entries(j).map(([e,t])=>[f(N,e,{vocab:!0}),x(t).map(e=>f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0}))]))),C(j,O.isFrame),b(S,`@type`,x(j).map(e=>{if(o(e)){let t=f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0});return t!==`@json`&&!_(t)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`relative @type reference`,level:`warning`,message:`Relative @type reference found.`,details:{type:e}},options:O}),t}return e}),{propertyIsArray:!!O.isFrame});continue}if(P===`@included`&&g(e,1.1)){let r=x(await T.expand({activeCtx:e,activeProperty:t,element:j,options:O}));if(!r.every(e=>d(e)))throw new n(`Invalid JSON-LD syntax; values of @included must expand to node objects.`,`jsonld.SyntaxError`,{code:`invalid @included value`,value:j});b(S,`@included`,r,{propertyIsArray:!0});continue}if(P===`@graph`&&!(i(j)||r(j)))throw new n(`Invalid JSON-LD syntax; "@graph" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid @graph value`,value:j});if(P===`@value`){I=j,R&&g(e,1.1)?S[`@value`]=j:b(S,`@value`,j,{propertyIsArray:O.isFrame});continue}if(P===`@language`){if(j===null)continue;if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@language" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid language-tagged string`,value:j});j=x(j).map(e=>o(e)?e.toLowerCase():e);for(let e of j)o(e)&&!e.match(v)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:O});b(S,`@language`,j,{propertyIsArray:O.isFrame});continue}if(P===`@direction`){if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@direction" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});j=x(j);for(let e of j)if(o(e)&&e!==`ltr`&&e!==`rtl`)throw new n(`Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});b(S,`@direction`,j,{propertyIsArray:O.isFrame});continue}if(P===`@index`){if(!o(j))throw new n(`Invalid JSON-LD syntax; "@index" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid @index value`,value:j});b(S,`@index`,j);continue}if(P===`@reverse`){if(!i(j))throw new n(`Invalid JSON-LD syntax; "@reverse" value must be an object.`,`jsonld.SyntaxError`,{code:`invalid @reverse value`,value:j});if(M=await T.expand({activeCtx:e,activeProperty:`@reverse`,element:j,options:O}),`@reverse`in M)for(let e in M[`@reverse`])b(S,e,M[`@reverse`][e],{propertyIsArray:!0});let t=S[`@reverse`]||null;for(let e in M){if(e===`@reverse`)continue;t===null&&(t=S[`@reverse`]={}),b(t,e,[],{propertyIsArray:!0});let r=M[e];for(let i=0;i<r.length;++i){let a=r[i];if(l(a)||c(a))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(t,e,a,{propertyIsArray:!0})}}continue}if(P===`@nest`){F.push(D);continue}let z=e,B=p(e,D,`@context`);s(B)||(z=await h({activeCtx:e,localCtx:B,propagate:!0,overrideProtected:!0,options:O}));let V=p(e,D,`@container`)||[];if(V.includes(`@language`)&&i(j)){let e=p(z,D,`@direction`);M=k(z,j,e,O)}else if(V.includes(`@index`)&&i(j)){let t=V.includes(`@graph`),n=p(z,D,`@index`)||`@index`,r=n!==`@index`&&f(e,n,{vocab:!0},O);M=await A({activeCtx:z,options:O,activeProperty:D,value:j,asGraph:t,indexKey:n,propertyIndex:r})}else if(V.includes(`@id`)&&i(j)){let e=V.includes(`@graph`);M=await A({activeCtx:z,options:O,activeProperty:D,value:j,asGraph:e,indexKey:`@id`})}else if(V.includes(`@type`)&&i(j))M=await A({activeCtx:z.revertToPreviousContext(),options:O,activeProperty:D,value:j,asGraph:!1,indexKey:`@type`});else{let n=P===`@list`;if(n||P===`@set`){let e=t;n&&u===`@graph`&&(e=null),M=await T.expand({activeCtx:z,activeProperty:e,element:j,options:O,insideList:n})}else M=p(e,D,`@type`)===`@json`?{"@type":`@json`,"@value":j}:await T.expand({activeCtx:z,activeProperty:D,element:j,options:O,insideList:!1})}if(!(M===null&&P!==`@value`)){if(P!==`@list`&&!c(M)&&V.includes(`@list`)&&(M={"@list":x(M)}),V.includes(`@graph`)&&!V.some(e=>e===`@id`||e===`@index`)){if(M=x(M),O.isFrame||(M=M.filter(e=>{let t=Object.keys(e).length;return E({value:e,count:t,options:O})!==null})),M.length===0)continue;M=M.map(e=>({"@graph":x(e)}))}if(z.mappings.has(D)&&z.mappings.get(D).reverse){let e=S[`@reverse`]=S[`@reverse`]||{};M=x(M);for(let t=0;t<M.length;++t){let r=M[t];if(l(r)||c(r))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(e,P,r,{propertyIsArray:!0})}continue}b(S,P,M,{propertyIsArray:!0})}}if(`@value`in S&&!(S[`@type`]===`@json`&&g(e,1.1))&&(i(I)||r(I))&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@value" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid value object value`,value:I});for(let a of F){let o=r(y[a])?y[a]:[y[a]];for(let r of o){if(!i(r)||Object.keys(r).some(t=>f(e,t,{vocab:!0},O)===`@value`))throw new n(`Invalid JSON-LD syntax; nested value must be a node object.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,value:r});await D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:r,expandedParent:S,options:O,insideList:j,typeScopedContext:N,typeKey:M})}}}function O({activeCtx:e,activeProperty:t,value:n,options:r}){if(n==null)return null;let i=f(e,t,{vocab:!0},r);if(i===`@id`)return f(e,n,{base:!0},r);if(i===`@type`)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});let a=p(e,t,`@type`);if((a===`@id`||i===`@graph`)&&o(n)){let i=f(e,n,{base:!0},r);return i===null&&n.match(y)&&r.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:r}),{"@id":i}}if(a===`@vocab`&&o(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(m(i))return n;let s={};if(a&&![`@id`,`@vocab`,`@none`].includes(a))s[`@type`]=a;else if(o(n)){let n=p(e,t,`@language`);n!==null&&(s[`@language`]=n);let r=p(e,t,`@direction`);r!==null&&(s[`@direction`]=r)}return[`boolean`,`number`,`string`].includes(typeof n)||(n=n.toString()),s[`@value`]=n,s}function k(e,t,i,a){let s=[],c=Object.keys(t).sort();for(let l of c){let c=f(e,l,{vocab:!0},a),u=t[l];r(u)||(u=[u]);for(let e of u){if(e===null)continue;if(!o(e))throw new n(`Invalid JSON-LD syntax; language map values must be strings.`,`jsonld.SyntaxError`,{code:`invalid language map value`,languageMap:t});let r={"@value":e};c!==`@none`&&(l.match(v)||a.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:l}},options:a}),r[`@language`]=l.toLowerCase()),i&&(r[`@direction`]=i),s.push(r)}}return s}async function A({activeCtx:e,options:t,activeProperty:i,value:a,asGraph:o,indexKey:c,propertyIndex:d}){let m=[],g=Object.keys(a).sort(),_=c===`@type`;for(let v of g){if(_){let n=p(e,v,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g=a[v];r(g)||(g=[g]),g=await T.expand({activeCtx:e,activeProperty:i,element:g,options:t,insideList:!1,insideIndex:!0});let y;y=d?v===`@none`?`@none`:O({activeCtx:e,activeProperty:c,value:v,options:t}):f(e,v,{vocab:!0},t),c===`@id`?v=f(e,v,{base:!0},t):_&&(v=y);for(let e of g){if(o&&!u(e)&&(e={"@graph":[e]}),c===`@type`)y===`@none`||(e[`@type`]?e[`@type`]=[v].concat(e[`@type`]):e[`@type`]=[v]);else if(l(e)&&![`@language`,`@type`,`@index`].includes(c))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${c}".`,`jsonld.SyntaxError`,{code:`invalid value object`,value:e});else d?y!==`@none`&&b(e,d,y,{propertyIsArray:!0,prependValue:!0}):y!==`@none`&&!(c in e)&&(e[c]=v);m.push(e)}}return m}})),Vn=o(((e,t)=>{var{isKeyword:n}=zn(),r=wn(),i=Cn(),a=En(),o=Tn(),s={};t.exports=s,s.createMergedNodeMap=(e,t)=>{t||={};let n=t.issuer||new a.IdentifierIssuer(`_:b`),r={"@default":{}};return s.createNodeMap(e,r,`@default`,n),s.mergeNodeMaps(r)},s.createNodeMap=(e,t,c,l,u,d)=>{if(i.isArray(e)){for(let n of e)s.createNodeMap(n,t,c,l,void 0,d);return}if(!i.isObject(e)){d&&d.push(e);return}if(r.isValue(e)){if(`@type`in e){let t=e[`@type`];t.indexOf(`_:`)===0&&(e[`@type`]=t=l.getId(t))}d&&d.push(e);return}else if(d&&r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),d.push({"@list":n});return}if(`@type`in e){let t=e[`@type`];for(let e of t)e.indexOf(`_:`)===0&&l.getId(e)}i.isUndefined(u)&&(u=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`]),d&&d.push({"@id":u});let f=t[c],p=f[u]=f[u]||{};p[`@id`]=u;let m=Object.keys(e).sort();for(let i of m){if(i===`@id`)continue;if(i===`@reverse`){let n={"@id":u},i=e[`@reverse`];for(let e in i){let o=i[e];for(let i of o){let o=i[`@id`];r.isBlankNode(i)&&(o=l.getId(o)),s.createNodeMap(i,t,c,l,o),a.addValue(f[o],e,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(i===`@graph`){u in t||(t[u]={}),s.createNodeMap(e[i],t,u,l);continue}if(i===`@included`){s.createNodeMap(e[i],t,c,l);continue}if(i!==`@type`&&n(i)){if(i===`@index`&&i in p&&(e[i]!==p[i]||e[i][`@id`]!==p[i][`@id`]))throw new o(`Invalid JSON-LD syntax; conflicting @index property detected.`,`jsonld.SyntaxError`,{code:`conflicting indexes`,subject:p});p[i]=e[i];continue}let d=e[i];if(i.indexOf(`_:`)===0&&(i=l.getId(i)),d.length===0){a.addValue(p,i,[],{propertyIsArray:!0});continue}for(let e of d)if(i===`@type`&&(e=e.indexOf(`_:`)===0?l.getId(e):e),r.isSubject(e)||r.isSubjectReference(e)){if(`@id`in e&&!e[`@id`])continue;let n=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`];a.addValue(p,i,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(e,t,c,l,n)}else if(r.isValue(e))a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),e={"@list":n},a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(e,t,c,l,u),a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=e=>{let t={};for(let r of Object.keys(e).sort())for(let i of Object.keys(e[r]).sort()){let o=e[r][i];i in t||(t[i]={"@id":i});let s=t[i];for(let e of Object.keys(o).sort())if(n(e)&&e!==`@type`)s[e]=a.clone(o[e]);else for(let t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},s.mergeNodeMaps=e=>{let t=e[`@default`],n=Object.keys(e).sort();for(let i of n){if(i===`@default`)continue;let n=e[i],a=t[i];a?`@graph`in a||(a[`@graph`]=[]):t[i]=a={"@id":i,"@graph":[]};let o=a[`@graph`];for(let e of Object.keys(n).sort()){let t=n[e];r.isSubjectReference(t)||o.push(t)}}return t}})),Hn=o(((e,t)=>{var{isSubjectReference:n}=wn(),{createMergedNodeMap:r}=Vn(),i={};t.exports=i,i.flatten=e=>{let t=r(e),i=[],a=Object.keys(t).sort();for(let e=0;e<a.length;++e){let r=t[a[e]];n(r)||i.push(r)}return i}})),Un=o(((e,t)=>{var n=Tn(),r=wn(),i=Cn(),{REGEX_BCP47:a,addValue:o}=En(),{handleEvent:s}=Rn(),{RDF_LIST:c,RDF_FIRST:l,RDF_REST:u,RDF_NIL:d,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:m,XSD_DOUBLE:h,XSD_INTEGER:g,XSD_STRING:_}=Dn(),v={};t.exports=v,v.fromRDF=async(e,t)=>{let{useRdfType:a=!1,useNativeTypes:s=!1,rdfDirection:p=null}=t,m={},h={"@default":m},g={};if(p){if(p===`compound-literal`)throw new n(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p});if(p!==`i18n-datatype`)throw new n(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p})}for(let n of e){let e=n.graph.termType===`DefaultGraph`?`@default`:n.graph.value;e in h||(h[e]={}),e!==`@default`&&!(e in m)&&(m[e]={"@id":e});let r=h[e],i=b(n.subject),c=n.predicate.value,l=n.object;i in r||(r[i]={"@id":i});let u=r[i],_=b(l),v=!!_;if(v&&!(_ in r)&&(r[_]={"@id":_}),c===f&&!a&&v){o(u,`@type`,_,{propertyIsArray:!0});continue}let x=y(l,s,p,t);if(o(u,c,x,{propertyIsArray:!0}),v)if(_===d){let e=r[_];`usages`in e||(e.usages=[]),e.usages.push({node:u,property:c,value:x})}else _ in g?g[_]=!1:g[_]={node:u,property:c,value:x}}for(let e in h){let t=h[e];if(!(d in t))continue;let n=t[d];if(n.usages){for(let e of n.usages){let n=e.node,a=e.property,o=e.value,s=[],d=[],f=Object.keys(n).length;for(;a===u&&i.isObject(g[n[`@id`]])&&i.isArray(n[l])&&n[l].length===1&&i.isArray(n[u])&&n[u].length===1&&(f===3||f===4&&i.isArray(n[`@type`])&&n[`@type`].length===1&&n[`@type`][0]===c)&&(s.push(n[l][0]),d.push(n[`@id`]),e=g[n[`@id`]],n=e.node,a=e.property,o=e.value,f=Object.keys(n).length,r.isBlankNode(n)););delete o[`@id`],o[`@list`]=s.reverse();for(let e of d)delete t[e]}delete n.usages}}let _=[],v=Object.keys(m).sort();for(let e of v){let t=m[e];if(e in h){let n=t[`@graph`]=[],i=h[e],a=Object.keys(i).sort();for(let e of a){let t=i[e];r.isSubjectReference(t)||n.push(t)}}r.isSubjectReference(t)||_.push(t)}return _};function y(e,t,r,o){let c=b(e);if(c)return{"@id":c};let l={"@value":e.value};if(e.language)e.language.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e.language}},options:o}),l[`@language`]=e.language;else{let c=e.datatype.value;if(c||=_,c===p){c=`@json`;try{l[`@value`]=JSON.parse(l[`@value`])}catch(e){throw new n(`JSON literal could not be parsed.`,`jsonld.InvalidJsonLiteral`,{code:`invalid JSON literal`,value:l[`@value`],cause:e})}}if(t)if(c===m)l[`@value`]===`true`||l[`@value`]===`1`?l[`@value`]=!0:l[`@value`]===`false`||l[`@value`]===`0`?l[`@value`]=!1:l[`@type`]=c;else if(c===g)if(i.isNumeric(l[`@value`])){let e=parseInt(l[`@value`],10);e.toFixed(0)===l[`@value`]&&(l[`@value`]=e)}else l[`@type`]=c;else c===h&&i.isNumeric(l[`@value`])?l[`@value`]=parseFloat(l[`@value`]):l[`@type`]=c;else if(r===`i18n-datatype`&&c.startsWith(`https://www.w3.org/ns/i18n#`)){let[,e,t]=c.split(/[#_]/);e.length>0&&(l[`@language`]=e,e.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:o})),l[`@direction`]=t}else c!==_&&(l[`@type`]=c)}return l}function b(e){return e.termType===`NamedNode`?e.value:e.termType===`BlankNode`?`_:`+e.value:null}})),Wn=o(((e,t)=>{t.exports=function e(t){if(typeof t==`number`&&isNaN(t))throw Error(`NaN is not allowed`);if(typeof t==`number`&&!isFinite(t))throw Error(`Infinity is not allowed`);return typeof t!=`object`||!t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${r===0?``:`,`}${e(n===void 0||typeof n==`symbol`?null:n)}`,``)}]`:`{${Object.keys(t).sort().reduce((n,r)=>t[r]===void 0||typeof t[r]==`symbol`?n:`${n}${n.length===0?``:`,`}${e(r)}:${e(t[r])}`,``)}}`}})),Gn=o(((e,t)=>{var{createNodeMap:n}=Vn(),{isKeyword:r}=zn(),i=wn(),a=Wn(),o=Tn(),s=Cn(),c=En(),{handleEvent:l}=Rn(),{RDF_FIRST:u,RDF_REST:d,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:m,RDF_LANGSTRING:h,XSD_BOOLEAN:g,XSD_DOUBLE:_,XSD_INTEGER:v,XSD_STRING:y}=Dn(),{isAbsolute:b}=kn(),x={};t.exports=x,x.toRDF=(e,t)=>{let r=new c.IdentifierIssuer(`_:b`),i={"@default":{}};n(e,i,`@default`,r);let a=[],o=Object.keys(i).sort();for(let e of o){let n;if(e===`@default`)n={termType:`DefaultGraph`,value:``};else if(b(e))n=T(e);else{t.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative graph reference`,level:`warning`,message:`Relative graph reference found.`,details:{graph:e}},options:t});continue}S(a,i[e],n,r,t)}return a};function S(e,t,n,i,a){let o=Object.keys(t).sort();for(let s of o){let o=t[s],c=Object.keys(o).sort();for(let t of c){let c=o[t];if(t===`@type`)t=p;else if(r(t))continue;for(let r of c){let o=T(s);if(!b(s)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative subject reference`,level:`warning`,message:`Relative subject reference found.`,details:{subject:s}},options:a});continue}let c=T(t);if(!b(t)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative predicate reference`,level:`warning`,message:`Relative predicate reference found.`,details:{predicate:t}},options:a});continue}if(c.termType===`BlankNode`&&!a.produceGeneralizedRdf){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`blank node predicate`,level:`warning`,message:`Dropping blank node predicate.`,details:{property:i.getOldIds().find(e=>i.getId(e)===t)}},options:a});continue}let u=w(r,i,e,n,a.rdfDirection,a);u&&e.push({subject:o,predicate:c,object:u,graph:n})}}}}function C(e,t,n,r,i,a){let o={termType:`NamedNode`,value:u},s={termType:`NamedNode`,value:d},c={termType:`NamedNode`,value:f},l=e.pop(),p=l?{termType:`BlankNode`,value:t.getId().slice(2)}:c,m=p;for(let c of e){let e=w(c,t,n,r,i,a),l={termType:`BlankNode`,value:t.getId().slice(2)};n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:l,graph:r}),m=l}if(l){let e=w(l,t,n,r,i,a);n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:c,graph:r})}return p}function w(e,t,n,r,c,u){let d;if(i.isValue(e)){d={termType:`Literal`,value:void 0,datatype:{termType:`NamedNode`}};let t=e[`@value`],n=e[`@type`]||null;if(n===`@json`)d.value=a(t),d.datatype.value=m;else if(s.isBoolean(t))d.value=t.toString(),d.datatype.value=n||g;else if(s.isDouble(t)||n===_)s.isDouble(t)||(t=parseFloat(t)),d.value=t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),d.datatype.value=n||_;else if(s.isNumber(t))d.value=t.toFixed(0),d.datatype.value=n||v;else if(`@direction`in e&&c===`i18n-datatype`){let n=`https://www.w3.org/ns/i18n#${(e[`@language`]||``).toLowerCase()}_${e[`@direction`]}`;d.datatype.value=n,d.value=t}else if(`@direction`in e&&c===`compound-literal`)throw new o(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else if(`@direction`in e&&c)throw new o(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else `@language`in e?(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||h,d.language=e[`@language`]):(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||y)}else if(i.isList(e)){let i=C(e[`@list`],t,n,r,c,u);d={termType:i.termType,value:i.value}}else d=T(s.isObject(e)?e[`@id`]:e);return d.termType===`NamedNode`&&!b(d.value)?(u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative object reference`,level:`warning`,message:`Relative object reference found.`,details:{object:d.value}},options:u}),null):d}function T(e){return e.startsWith(`_:`)?{termType:`BlankNode`,value:e.slice(2)}:{termType:`NamedNode`,value:e}}})),Kn=o(((e,t)=>{var{isKeyword:n}=zn(),r=wn(),i=Cn(),a=En(),o=kn(),s=Tn(),{createNodeMap:c,mergeNodeMapGraphs:l}=Vn(),u={};t.exports=u,u.frameMergedOrDefault=(e,t,n)=>{let r={options:n,embedded:!1,graph:`@default`,graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer(`_:b`);c(e,r.graphMap,`@default`,i),n.merged&&(r.graphMap[`@merged`]=l(r.graphMap),r.graph=`@merged`),r.subjects=r.graphMap[r.graph];let o=[];return u.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter(e=>r.bnodeMap[e].length===1)),n.link={},v(o,n)},u.frame=(e,t,o,c,l=null)=>{m(o),o=o[0];let g=e.options,v={embed:p(o,g,`embed`),explicit:p(o,g,`explicit`),requireAll:p(o,g,`requireAll`)};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});let b=e.link[e.graph],S=h(e,t,o,v),C=Object.keys(S).sort();for(let m of C){let h=S[m];if(l===null?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},v.embed===`@link`&&m in b){y(c,l,b[m]);continue}let C={"@id":m};if(m.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,m,C,{propertyIsArray:!0}),b[m]=C,(v.embed===`@first`||v.embed===`@last`)&&e.is11)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:o});if(!(!e.embedded&&e.uniqueEmbeds[e.graph].hasOwnProperty(m))){if(e.embedded&&(v.embed===`@never`||f(h,e.graph,e.subjectStack))){y(c,l,C);continue}if(e.embedded&&(v.embed==`@first`||v.embed==`@once`)&&e.uniqueEmbeds[e.graph].hasOwnProperty(m)){y(c,l,C);continue}if(v.embed===`@last`&&m in e.uniqueEmbeds[e.graph]&&_(e,m),e.uniqueEmbeds[e.graph][m]={parent:c,property:l},e.subjectStack.push({subject:h,graph:e.graph}),m in e.graphMap){let t=!1,n=null;`@graph`in o?(n=o[`@graph`][0],t=!(m===`@merged`||m===`@default`),i.isObject(n)||(n={})):(t=e.graph!==`@merged`,n={}),t&&u.frame({...e,graph:m,embedded:!1},Object.keys(e.graphMap[m]).sort(),[n],C,`@graph`)}`@included`in o&&u.frame({...e,embedded:!1},t,o[`@included`],C,`@included`);for(let t of Object.keys(h).sort()){if(n(t)){if(C[t]=a.clone(h[t]),t===`@type`)for(let t of h[`@type`])t.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,t,C,{propertyIsArray:!0});continue}if(!(v.explicit&&!(t in o)))for(let n of h[t]){let i=t in o?o[t]:d(v);if(r.isList(n)){let i=o[t]&&o[t][0]&&o[t][0][`@list`]?o[t][0][`@list`]:d(v),s={"@list":[]};y(C,t,s);let c=n[`@list`];for(let t of c)r.isSubjectReference(t)?u.frame({...e,embedded:!0},[t[`@id`]],i,s,`@list`):y(s,`@list`,a.clone(t))}else r.isSubjectReference(n)?u.frame({...e,embedded:!0},[n[`@id`]],i,C,t):x(i[0],n)&&y(C,t,a.clone(n))}}for(let e of Object.keys(o).sort()){if(e===`@type`){if(!i.isObject(o[e][0])||!(`@default`in o[e][0]))continue}else if(n(e))continue;let t=o[e][0]||{};if(!p(t,g,`omitDefault`)&&!(e in C)){let n=`@null`;`@default`in t&&(n=a.clone(t[`@default`])),i.isArray(n)||(n=[n]),C[e]=[{"@preserve":n}]}}for(let t of Object.keys(o[`@reverse`]||{}).sort()){let n=o[`@reverse`][t];for(let r of Object.keys(e.subjects))a.getValues(e.subjects[r],t).some(e=>e[`@id`]===m)&&(C[`@reverse`]=C[`@reverse`]||{},a.addValue(C[`@reverse`],t,[],{propertyIsArray:!0}),u.frame({...e,embedded:!0},[r],n,C[`@reverse`][t],l))}y(c,l,C),e.subjectStack.pop()}}},u.cleanupNull=(e,t)=>{if(i.isArray(e))return e.map(e=>u.cleanupNull(e,t)).filter(e=>e);if(e===`@null`)return null;if(i.isObject(e)){if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e)e[n]=u.cleanupNull(e[n],t)}return e};function d(e){let t={};for(let n in e)e[n]!==void 0&&(t[`@`+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){let i=n[r];if(i.graph===t&&i.subject[`@id`]===e[`@id`])return!0}return!1}function p(e,t,n){let r=`@`+n,i=r in e?e[r][0]:t[n];if(n===`embed`){if(i===!0)i=`@once`;else if(i===!1)i=`@never`;else if(i!==`@always`&&i!==`@never`&&i!==`@link`&&i!==`@first`&&i!==`@last`&&i!==`@once`)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:e})}return i}function m(e){if(!i.isArray(e)||e.length!==1||!i.isObject(e[0]))throw new s(`Invalid JSON-LD syntax; a JSON-LD frame must be a single object.`,`jsonld.SyntaxError`,{frame:e});if(`@id`in e[0]){for(let t of a.asArray(e[0][`@id`]))if(!(i.isObject(t)||o.isAbsolute(t))||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @id in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}if(`@type`in e[0]){for(let t of a.asArray(e[0][`@type`]))if(!(i.isObject(t)||o.isAbsolute(t)||t===`@json`)||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @type in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}}function h(e,t,n,r){let i={};for(let a of t){let t=e.graphMap[e.graph][a];g(e,t,n,r)&&(i[a]=t)}return i}function g(e,t,o,s){let c=!0,l=!1;for(let u in o){let d=!1,f=a.getValues(t,u),p=a.getValues(o,u).length===0;if(u===`@id`){if(i.isEmptyObject(o[`@id`][0]||{})?d=!0:o[`@id`].length>=0&&(d=o[`@id`].includes(f[0])),!s.requireAll)return d}else if(u===`@type`){if(c=!1,p){if(f.length>0)return!1;d=!0}else if(o[`@type`].length===1&&i.isEmptyObject(o[`@type`][0]))d=f.length>0;else for(let e of o[`@type`])i.isObject(e)&&`@default`in e?d=!0:d||=f.some(t=>t===e);if(!s.requireAll)return d}else if(n(u))continue;else{let t=a.getValues(o,u)[0],n=!1;if(t&&(m([t]),n=`@default`in t),c=!1,f.length===0&&n)continue;if(f.length>0&&p)return!1;if(t===void 0){if(f.length>0)return!1;d=!0}else if(r.isList(t)){let n=t[`@list`][0];if(r.isList(f[0])){let t=f[0][`@list`];r.isValue(n)?d=t.some(e=>x(n,e)):(r.isSubject(n)||r.isSubjectReference(n))&&(d=t.some(t=>b(e,n,t,s)))}}else d=r.isValue(t)?f.some(e=>x(t,e)):r.isSubjectReference(t)?f.some(n=>b(e,t,n,s)):i.isObject(t)?f.length>0:!1}if(!d&&s.requireAll)return!1;l||=d}return c||l}function _(e,t){let n=e.uniqueEmbeds[e.graph],r=n[t],o=r.parent,s=r.property,c={"@id":t};if(i.isArray(o)){for(let e=0;e<o.length;++e)if(a.compareValues(o[e],c)){o[e]=c;break}}else{let e=i.isArray(o[s]);a.removeValue(o,s,c,{propertyIsArray:e}),a.addValue(o,s,c,{propertyIsArray:e})}let l=e=>{let t=Object.keys(n);for(let r of t)r in n&&i.isObject(n[r].parent)&&n[r].parent[`@id`]===e&&(delete n[r],l(r))};l(t)}function v(e,t){if(i.isArray(e))return e.map(e=>v(e,t));if(i.isObject(e)){if(`@preserve`in e)return e[`@preserve`][0];if(r.isValue(e))return e;if(r.isList(e))return e[`@list`]=v(e[`@list`],t),e;if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e){if(n===`@id`&&t.bnodesToClear.includes(e[n])){delete e[`@id`];continue}e[n]=v(e[n],t)}}return e}function y(e,t,n){i.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function b(e,t,n,r){if(!(`@id`in n))return!1;let i=e.subjects[n[`@id`]];return i&&g(e,i,t,r)}function x(e,t){let n=t[`@value`],r=t[`@type`],a=t[`@language`],o=e[`@value`]?i.isArray(e[`@value`])?e[`@value`]:[e[`@value`]]:[],s=e[`@type`]?i.isArray(e[`@type`])?e[`@type`]:[e[`@type`]]:[],c=e[`@language`]?i.isArray(e[`@language`])?e[`@language`]:[e[`@language`]]:[];return o.length===0&&s.length===0&&c.length===0?!0:!(!(o.includes(n)||i.isEmptyObject(o[0]))||!(!r&&s.length===0||s.includes(r)||r&&i.isEmptyObject(s[0]))||!(!a&&c.length===0||c.includes(a)||a&&i.isEmptyObject(c[0])))}})),qn=o(((e,t)=>{var n=Tn(),{isArray:r,isObject:i,isString:a,isUndefined:o}=Cn(),{isList:s,isValue:c,isGraph:l,isSimpleGraph:u,isSubjectReference:d}=wn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=zn(),{removeBase:_,prependBase:v}=kn(),{REGEX_KEYWORD:y,addValue:b,asArray:x,compareShortestLeast:S}=En(),C={};t.exports=C,C.compact=async({activeCtx:e,activeProperty:t=null,element:f,options:_={}})=>{if(r(f)){let n=[];for(let r=0;r<f.length;++r){let i=await C.compact({activeCtx:e,activeProperty:t,element:f[r],options:_});i!==null&&n.push(i)}return _.compactArrays&&n.length===1&&(p(e,t,`@container`)||[]).length===0&&(n=n[0]),n}let v=p(e,t,`@context`);if(o(v)||(e=await h({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:_})),i(f)){if(_.link&&`@id`in f&&_.link.hasOwnProperty(f[`@id`])){let e=_.link[f[`@id`]];for(let t=0;t<e.length;++t)if(e[t].expanded===f)return e[t].compacted}if(c(f)||d(f)){let n=C.compactValue({activeCtx:e,activeProperty:t,value:f,options:_});return _.link&&d(f)&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:n})),n}if(s(f)&&(p(e,t,`@container`)||[]).includes(`@list`))return C.compact({activeCtx:e,activeProperty:t,element:f[`@list`],options:_});let v=t===`@reverse`,y={},S=e;!c(f)&&!d(f)&&(e=e.revertToPreviousContext());let w=p(S,t,`@context`);o(w)||(e=await h({activeCtx:e,localCtx:w,propagate:!0,overrideProtected:!0,options:_})),_.link&&`@id`in f&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:y}));let E=f[`@type`]||[];E.length>1&&(E=Array.from(E).sort());let D=e;for(let t of E){let n=p(S,C.compactIri({activeCtx:D,iri:t,relativeTo:{vocab:!0}}),`@context`);o(n)||(e=await h({activeCtx:e,localCtx:n,options:_,propagate:!1}))}let O=Object.keys(f).sort();for(let o of O){let d=f[o];if(o===`@id`){let t=x(d).map(t=>C.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:_.base}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});y[n]=t;continue}if(o===`@type`){let t=x(d).map(e=>C.compactIri({activeCtx:S,iri:e,relativeTo:{vocab:!0}}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),i=(p(e,n,`@container`)||[]).includes(`@set`)&&g(e,1.1)||r(t)&&d.length===0;b(y,n,t,{propertyIsArray:i});continue}if(o===`@reverse`){let t=await C.compact({activeCtx:e,activeProperty:`@reverse`,element:d,options:_});for(let n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){let r=t[n];b(y,n,r,{propertyIsArray:(p(e,n,`@container`)||[]).includes(`@set`)||!_.compactArrays}),delete t[n]}Object.keys(t).length>0&&b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),t);continue}if(o===`@preserve`){let n=await C.compact({activeCtx:e,activeProperty:t,element:d,options:_});r(n)&&n.length===0||b(y,o,n);continue}if(o===`@index`){if((p(e,t,`@container`)||[]).includes(`@index`))continue;b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(o!==`@graph`&&o!==`@list`&&o!==`@included`&&m(o)){b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(!r(d))throw new n(`JSON-LD expansion error; expanded value must be an array.`,`jsonld.SyntaxError`);if(d.length===0){let t=C.compactIri({activeCtx:e,iri:o,value:d,relativeTo:{vocab:!0},reverse:v}),n=e.mappings.has(t)?e.mappings.get(t)[`@nest`]:null,r=y;n&&(T(e,n,_),i(y[n])||(y[n]={}),r=y[n]),b(r,t,d,{propertyIsArray:!0})}for(let t of d){let n=C.compactIri({activeCtx:e,iri:o,value:t,relativeTo:{vocab:!0},reverse:v}),d=e.mappings.has(n)?e.mappings.get(n)[`@nest`]:null,f=y;d&&(T(e,d,_),i(y[d])||(y[d]={}),f=y[d]);let m=p(e,n,`@container`)||[],h=l(t),g=s(t),S;g?S=t[`@list`]:h&&(S=t[`@graph`]);let w=await C.compact({activeCtx:e,activeProperty:n,element:g||h?S:t,options:_});if(g)if(r(w)||(w=[w]),!m.includes(`@list`))w={[C.compactIri({activeCtx:e,iri:`@list`,relativeTo:{vocab:!0}})]:w},`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]);else{b(f,n,w,{valueIsArray:!0,allowDuplicate:!0});continue}if(h)if(m.includes(`@graph`)&&(m.includes(`@id`)||m.includes(`@index`)&&u(t))){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i=(m.includes(`@id`)?t[`@id`]:t[`@index`])||C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}});b(r,i,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})}else m.includes(`@graph`)&&u(t)?(r(w)&&w.length>1&&(w={"@included":w}),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})):(r(w)&&w.length===1&&_.compactArrays&&(w=w[0]),w={[C.compactIri({activeCtx:e,iri:`@graph`,relativeTo:{vocab:!0}})]:w},`@id`in t&&(w[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]=t[`@id`]),`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)}));else if(m.includes(`@language`)||m.includes(`@index`)||m.includes(`@id`)||m.includes(`@type`)){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i;if(m.includes(`@language`))c(w)&&(w=w[`@value`]),i=t[`@language`];else if(m.includes(`@index`)){let r=p(e,n,`@index`)||`@index`,o=C.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if(r===`@index`)i=t[`@index`],delete w[o];else{let e;if([i,...e]=x(w[r]||[]),!a(i))i=null;else switch(e.length){case 0:delete w[r];break;case 1:w[r]=e[0];break;default:w[r]=e;break}}}else if(m.includes(`@id`)){let t=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});i=w[t],delete w[t]}else if(m.includes(`@type`)){let r=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),a;switch([i,...a]=x(w[r]||[]),a.length){case 0:delete w[r];break;case 1:w[r]=a[0];break;default:w[r]=a;break}Object.keys(w).length===1&&`@id`in t&&(w=await C.compact({activeCtx:e,activeProperty:n,element:{"@id":t[`@id`]},options:_}))}i||=C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}}),b(r,i,w,{propertyIsArray:m.includes(`@set`)})}else{let e=!_.compactArrays||m.includes(`@set`)||m.includes(`@list`)||r(w)&&w.length===0||o===`@list`||o===`@graph`;b(f,n,w,{propertyIsArray:e})}}}return y}return f},C.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:a={vocab:!1},reverse:o=!1,base:u=null})=>{if(t===null)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);let d=e.getInverse();if(m(t)&&t in d&&`@none`in d[t]&&`@type`in d[t][`@none`]&&`@none`in d[t][`@none`][`@type`])return d[t][`@none`][`@type`][`@none`];if(a.vocab&&t in d){let n=e[`@language`]||`@none`,a=[];i(r)&&`@index`in r&&!(`@graph`in r)&&a.push(`@index`,`@index@set`),i(r)&&`@preserve`in r&&(r=r[`@preserve`][0]),l(r)?(`@index`in r&&a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r&&a.push(`@graph@id`,`@graph@id@set`),a.push(`@graph`,`@graph@set`,`@set`),`@index`in r||a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r||a.push(`@graph@id`,`@graph@id@set`)):i(r)&&!c(r)&&a.push(`@id`,`@id@set`,`@type`,`@set@type`);let u=`@language`,d=`@null`;if(o)u=`@type`,d=`@reverse`,a.push(`@set`);else if(s(r)){`@index`in r||a.push(`@list`);let e=r[`@list`];if(e.length===0)u=`@any`,d=`@none`;else{let t=e.length===0?n:null,r=null;for(let n=0;n<e.length;++n){let i=e[n],a=`@none`,o=`@none`;if(c(i)?`@direction`in i?a=`${(i[`@language`]||``).toLowerCase()}_${i[`@direction`]}`:`@language`in i?a=i[`@language`].toLowerCase():`@type`in i?o=i[`@type`]:a=`@null`:o=`@id`,t===null?t=a:a!==t&&c(i)&&(t=`@none`),r===null?r=o:o!==r&&(r=`@none`),t===`@none`&&r===`@none`)break}t||=`@none`,r||=`@none`,r===`@none`?d=t:(u=`@type`,d=r)}}else{if(c(r))if(`@language`in r&&!(`@index`in r)){a.push(`@language`,`@language@set`),d=r[`@language`];let e=r[`@direction`];e&&(d=`${d}_${e}`)}else `@direction`in r&&!(`@index`in r)?d=`_${r[`@direction`]}`:`@type`in r&&(u=`@type`,d=r[`@type`]);else u=`@type`,d=`@id`;a.push(`@set`)}a.push(`@none`),i(r)&&!(`@index`in r)&&a.push(`@index`,`@index@set`),c(r)&&Object.keys(r).length===1&&a.push(`@language`,`@language@set`);let f=w(e,t,r,a,u,d);if(f!==null)return f}if(a.vocab&&`@vocab`in e){let n=e[`@vocab`];if(t.indexOf(n)===0&&t!==n){let r=t.substr(n.length);if(!e.mappings.has(r))return r}}let f=null,p=[],h=e.fastCurieMap,g=t.length-1;for(let e=0;e<g&&t[e]in h;++e)h=h[t[e]],``in h&&p.push(h[``][0]);for(let n=p.length-1;n>=0;--n){let i=p[n],a=i.terms;for(let n of a){let a=n+`:`+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(a)||r===null&&e.mappings.get(a)[`@id`]===t)&&(f===null||S(a,f)<0)&&(f=a)}}if(f!==null)return f;for(let[r,i]of e.mappings)if(i&&i._prefix&&t.startsWith(r+`:`))throw new n(`Absolute IRI "${t}" confused with prefix "${r}".`,`jsonld.SyntaxError`,{code:`IRI confused with prefix`,context:e});if(!a.vocab)if(`@base`in e)if(e[`@base`]){let n=_(v(u,e[`@base`]),t);return y.test(n)?`./${n}`:n}else return t;else return _(u,t);return t},C.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){let r=p(e,t,`@type`),i=p(e,t,`@language`),o=p(e,t,`@direction`),s=p(e,t,`@container`)||[],c=`@index`in n&&!s.includes(`@index`);if(!c&&r!==`@none`&&(n[`@type`]===r||`@language`in n&&n[`@language`]===i&&`@direction`in n&&n[`@direction`]===o||`@language`in n&&n[`@language`]===i||`@direction`in n&&n[`@direction`]===o))return n[`@value`];let l=Object.keys(n).length,u=l===1||l===2&&`@index`in n&&!c,d=`@language`in e,f=a(n[`@value`]),m=e.mappings.has(t)&&e.mappings.get(t)[`@language`]===null;if(u&&r!==`@none`&&(!d||!f||m))return n[`@value`];let h={};return c&&(h[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=n[`@index`]),`@type`in n?h[C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}})]=C.compactIri({activeCtx:e,iri:n[`@type`],relativeTo:{vocab:!0}}):`@language`in n&&(h[C.compactIri({activeCtx:e,iri:`@language`,relativeTo:{vocab:!0}})]=n[`@language`]),`@direction`in n&&(h[C.compactIri({activeCtx:e,iri:`@direction`,relativeTo:{vocab:!0}})]=n[`@direction`]),h[C.compactIri({activeCtx:e,iri:`@value`,relativeTo:{vocab:!0}})]=n[`@value`],h}let i=f(e,t,{vocab:!0},r),o=p(e,t,`@type`),s=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:o===`@vocab`},base:r.base});return o===`@id`||o===`@vocab`||i===`@graph`?s:{[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]:s}};function w(e,t,n,r,a,o){o===null&&(o=`@null`);let s=[];if((o===`@id`||o===`@reverse`)&&i(n)&&`@id`in n){o===`@reverse`&&s.push(`@reverse`);let t=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)[`@id`]===n[`@id`]?s.push.apply(s,[`@vocab`,`@id`]):s.push.apply(s,[`@id`,`@vocab`])}else{s.push(o);let e=s.find(e=>e.includes(`_`));e&&s.push(e.replace(/^[^_]+_/,`_`))}s.push(`@none`);let c=e.inverse[t];for(let e of r){if(!(e in c))continue;let t=c[e][a];for(let e of s)if(e in t)return t[e]}return null}function T(e,t,r){if(f(e,t,{vocab:!0},r)!==`@nest`)throw new n(`JSON-LD compact error; nested property must have an @nest value resolving to @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`})}})),Jn=o(((e,t)=>{t.exports=e=>{class t{toString(){return`[object JsonLdProcessor]`}}return Object.defineProperty(t,`prototype`,{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,`constructor`,{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(TypeError(`Could not compact, too few arguments.`)):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not expand, too few arguments.`)):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not flatten, too few arguments.`)):e.flatten(t)},t}})),Yn=o(((e,t)=>{var n=Sn(),r=jn(),i=En(),a=In(),o=i.IdentifierIssuer,s=Tn(),c=Pn(),l=Ln(),{expand:u}=Bn(),{flatten:d}=Hn(),{fromRDF:f}=Un(),{toRDF:p}=Gn(),{frameMergedOrDefault:m,cleanupNull:h}=Kn(),{isArray:g,isObject:_,isString:v}=Cn(),{isSubjectReference:y}=wn(),{expandIri:b,getInitialContext:x,process:S,processingMode:C}=zn(),{compact:w,compactIri:T}=qn(),{createNodeMap:E,createMergedNodeMap:D,mergeNodeMaps:O}=Vn(),{logEventHandler:k,logWarningEventHandler:A,safeEventHandler:j,setDefaultEventHandler:M,setupEventHandler:N,strictEventHandler:P,unhandledEventHandler:F}=Rn(),I=function(e){let t={},I=new c({max:100});e.compact=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not compact, too few arguments.`);if(n===null)throw new s(`The compaction context must not be null.`,`jsonld.CompactError`,{code:`invalid local context`});if(t===null)return null;r=R(r,{base:v(t)?t:``,compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o(`_:b`),contextResolver:new a({sharedCache:I})}),r.link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base;let c;c=r.skipExpansion?t:await e.expand(t,r);let l=await e.processContext(x(r),n,r),u=await w({activeCtx:l,element:c,options:r});r.compactArrays&&!r.graph&&g(u)?u.length===1?u=u[0]:u.length===0&&(u={}):r.graph&&_(u)&&(u=[u]),_(n)&&`@context`in n&&(n=n[`@context`]),n=i.clone(n),g(n)||(n=[n]);let d=n;n=[];for(let e=0;e<d.length;++e)(!_(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);let f=n.length>0;if(n.length===1&&(n=n[0]),g(u)){let e=T({activeCtx:l,iri:`@graph`,relativeTo:{vocab:!0}}),t=u;u={},f&&(u[`@context`]=n),u[e]=t}else if(_(u)&&f){let e=u;u={"@context":n};for(let t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw TypeError(`Could not expand, too few arguments.`);n=R(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:I})});let r={},o=[];if(`expandContext`in n){let e=i.clone(n.expandContext);_(e)&&`@context`in e?r.expandContext=e:r.expandContext={"@context":e},o.push(r.expandContext)}let s;if(!v(t))r.input=i.clone(t);else{let i=await e.get(t,n);s=i.documentUrl,r.input=i.document,i.contextUrl&&(r.remoteContext={"@context":i.contextUrl},o.push(r.remoteContext))}`base`in n||(n.base=s||``);let c=x(n);for(let e of o)c=await S({activeCtx:c,localCtx:e,options:n});let l=await u({activeCtx:c,element:r.input,options:n});return _(l)&&`@graph`in l&&Object.keys(l).length===1?l=l[`@graph`]:l===null&&(l=[]),g(l)||(l=[l]),l},e.flatten=async function(t,n,r){if(arguments.length<1)return TypeError(`Could not flatten, too few arguments.`);typeof n==`function`?n=null:n||=null,r=R(r,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})});let i=d(await e.expand(t,r));return n===null?i:(r.graph=!0,r.skipExpansion=!0,await e.compact(i,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not frame, too few arguments.`);if(r=R(r,{base:v(t)?t:``,embed:`@once`,explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:I})}),v(n)){let t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n[`@context`];e?g(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n[`@context`]=e}}let i=n&&n[`@context`]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty(`omitGraph`)||(r.omitGraph=C(o,1.1)),r.hasOwnProperty(`pruneBlankNodeIdentifiers`)||(r.pruneBlankNodeIdentifiers=C(o,1.1));let s=await e.expand(t,r),c={...r};c.isFrame=!0,c.keepFreeFloatingNodes=!0;let l=await e.expand(n,c);c.merged=!Object.keys(n).map(e=>b(o,e,{vocab:!0})).includes(`@graph`),c.is11=C(o,1.1);let u=m(s,l,c);c.graph=!r.omitGraph,c.skipExpansion=!0,c.link={},c.framing=!0;let d=await e.compact(u,i,c);return c.link={},d=h(d,c),d},e.link=async function(t,n,r){let i={};return n&&(i[`@context`]=n),i[`@embed`]=`@link`,e.frame(t,i,r)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw TypeError(`Could not canonize, too few arguments.`);r=R(r,{skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:I})});let i=Object.assign({},{algorithm:`RDFC-1.0`},r.canonizeOptions||null);if(`inputFormat`in r){if(r.inputFormat!==`application/n-quads`)throw new s(`Unknown canonicalization input format.`,`jsonld.CanonizeError`);let e=l.parse(t);return n.canonize(e,i)}let o={...r};delete o.format,delete o.canonizeOptions,o.produceGeneralizedRdf=!1;let c=await e.toRDF(t,o);return n.canonize(c,i)},e.fromRDF=async function(e,n){if(arguments.length<1)throw TypeError(`Could not convert from RDF, too few arguments.`);n=R(n,{format:v(e)?`application/n-quads`:void 0});let{format:r}=n,{rdfParser:i}=n;if(r){if(i||=t[r],!i)throw new s(`Unknown input format.`,`jsonld.UnknownFormat`,{format:r})}else i=()=>e;return f(await i(e),n)},e.toRDF=async function(t,n){if(arguments.length<1)throw TypeError(`Could not convert to RDF, too few arguments.`);n=R(n,{skipExpansion:!1,contextResolver:new a({sharedCache:I})});let r;r=n.skipExpansion?t:await e.expand(t,n);let i=p(r,n);if(n.format){if(n.format===`application/n-quads`)return l.serialize(i);throw new s(`Unknown output format.`,`jsonld.UnknownFormat`,{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw TypeError(`Could not create node map, too few arguments.`);return n=R(n,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})}),D(await e.expand(t,n),n)},e.merge=async function(t,n,r){if(arguments.length<1)throw TypeError(`Could not merge, too few arguments.`);if(!g(t))throw TypeError(`Could not merge, "docs" must be an array.`);typeof n==`function`?n=null:n||=null,r=R(r,{contextResolver:new a({sharedCache:I})});let s=await Promise.all(t.map(t=>{let n={...r};return e.expand(t,n)})),c=!0;`mergeNodes`in r&&(c=r.mergeNodes);let l=r.issuer||new o(`_:b`),u={"@default":{}};for(let e=0;e<s.length;++e){let t=i.relabelBlankNodes(s[e],{issuer:new o(`_:b`+e+`-`)}),n=c||e===0?u:{"@default":{}};if(E(t,n,`@default`,l),n!==u)for(let e in n){let t=n[e];if(!(e in u)){u[e]=t;continue}let r=u[e];for(let e in t)e in r||(r[e]=t[e])}}let d=O(u),f=[],p=Object.keys(d).sort();for(let e=0;e<p.length;++e){let t=d[p[e]];y(t)||f.push(t)}return n===null?f:(r.graph=!0,r.skipExpansion=!0,await e.compact(f,n,r))},Object.defineProperty(e,`documentLoader`,{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new s(`Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:e})},e.get=async function(t,n){let r;r=typeof n.documentLoader==`function`?n.documentLoader:e.documentLoader;let i=await r(t);try{if(!i.document)throw new s(`No remote document found at the given URL.`,`jsonld.NullRemoteDocument`);v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new s(`Could not retrieve a JSON-LD document from the URL.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=R(n,{base:``,contextResolver:new a({sharedCache:I})}),t===null?x(n):(t=i.clone(t),_(t)&&`@context`in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=zn().getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new s(`Unknown document loader type: "`+t+`"`,`jsonld.UnknownDocumentLoader`,{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser(`application/n-quads`,l.parse),e.url=kn(),e.logEventHandler=k,e.logWarningEventHandler=A,e.safeEventHandler=j,e.setDefaultEventHandler=M,e.strictEventHandler=P,e.unhandledEventHandler=F,e.util=i,Object.assign(e,i),e.promises=e,e.RequestQueue=On(),e.JsonLdProcessor=Jn()(e),r.setupGlobals(e),r.setupDocumentLoaders(e);function R(t,{documentLoader:n=e.documentLoader,...r}){if(t&&`compactionMap`in t)throw new s(`"compactionMap" not supported.`,`jsonld.OptionsError`);if(t&&`expansionMap`in t)throw new s(`"expansionMap" not supported.`,`jsonld.OptionsError`);return Object.assign({},{documentLoader:n},r,t,{eventHandler:N({options:t})})}return e},R=function(){return I(function(){return R()})};I(R),t.exports=R})),Xn=fn(),Zn=l(Yn(),1),Qn={},$n={};function er(e){let t=new Set;for(let n of e.getQuads(null,K,null,yt))n.subject.termType===`NamedNode`&&t.add(n.subject.value);if(t.size===1)return t.values().next().value}function tr(e,t){let n=k.namedNode(t);for(let t of e.getObjects(n,K,yt))if(t.termType===`NamedNode`&&e.getQuads(t,bt,Et,null).length>0)return t}async function nr(e){let t={store:new st,importedUrls:[],atts:e},n=[];if(e.shapes?n.push(rr(ar(e.shapes),t,vt)):e.shapesUrl&&n.push(rr(ir(e.shapesUrl,t.atts.proxy),t,vt)),e.values?n.push(rr(ar(e.values),t,yt)):e.valuesUrl&&n.push(rr(ir(e.valuesUrl,t.atts.proxy),t,yt)),await Promise.all(n),e.classInstanceProvider)try{let n=Gt(t.store),r=await e.classInstanceProvider(n);r&&await rr(ar(r),t,vt)}catch(e){console.error(`failed loading class instances`,e)}if(e.valuesSubject||=er(t.store)||null,e.valuesSubject&&t.store.countQuads(null,null,null,vt)===0){let n=[...t.store.getObjects(e.valuesSubject,bt,yt),...t.store.getObjects(e.valuesSubject,K,yt)],r=[];for(let e of n){let n=or(e.value);!n&&e.value.startsWith(`urn:`)&&t.atts.proxy&&(n=e.value),n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),r.push(rr(ir(n,t.atts.proxy),t,vt)))}try{await Promise.allSettled(r)}catch(e){console.warn(e)}}return t.store}async function rr(e,t,n){let r=await e,i=[];for(let e of r){let r=n;if(t.atts.valuesSubject&&yt.equals(n)&&e.graph.id&&e.graph.id!==t.atts.valuesSubject&&(r=e.graph),t.store.add(k.quad(e.subject,e.predicate,e.object,r)),t.atts.loadOwlImports&&Ct.equals(e.predicate)){let n=or(e.object.value);n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),i.push(rr(ir(n,t.atts.proxy),t,k.namedNode(n))))}}await Promise.allSettled(i)}async function ir(e,t){return e in Qn||(Qn[e]=(async()=>{let n=e;t&&(n=t+encodeURIComponent(e));let r=await fetch(n,{headers:{Accept:`text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json`}});return r.ok?ar(await r.text()):(console.warn(`failed fetching RDF from`,e),[])})()),Qn[e]}async function ar(e){if(!e.trim())return[];let t=sr(e);if(t===`json`)try{e=await Zn.default.toRDF(JSON.parse(e),{format:`application/n-quads`})}catch(e){console.error(e)}let n=[];return await new Promise((r,i)=>{let a=t===`xml`?new Xn.RdfXmlParser:new ut;a.on(`data`,e=>{n.push(k.quad(e.subject,e.predicate,e.object,e.graph))}).on(`error`,e=>{i(e)}).on(`prefix`,(e,t)=>{e&&($n[e]=t)}).on(`end`,()=>{r(null)}),a.write(e),a.end()}),n}function or(e){if(Ut(e))return e;let t=e.split(`:`);if(t.length===2){let n=$n[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),Ut(e)))return e}return null}function sr(e){return/^\s*[\\[{]/.test(e)?`json`:/^\s*<\?xml/.test(e)?`xml`:`ttl`}var cr={[`${W}name`]:(e,t)=>{let n=t;e.name=q(e.config.languages,e.name,n)},[`${W}description`]:(e,t)=>{let n=t;e.description=q(e.config.languages,e.description,n)},[`${W}path`]:(e,t)=>{e.path=t.value},[`${W}group`]:(e,t)=>{e.group=t.id},[`${W}datatype`]:(e,t)=>{e.datatype=t},[`${W}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${W}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${W}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${W}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${W}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${W}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${W}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${W}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${W}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${W}pattern`]:(e,t)=>{e.pattern=t.value},[`${W}order`]:(e,t)=>{e.order=parseInt(t.value)},[`${dt}singleLine`]:(e,t)=>{e.singleLine=t.value===`true`},[`${dt}readonly`]:(e,t)=>{e.readonly=t.value===`true`},[`${G}styleClass`]:(e,t)=>{e.cssClass=t.value},[`${W}in`]:(e,t)=>{e.in=t.value},[`${W}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=xt},[`${W}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${W}hasValue`]:(e,t)=>{e.hasValue=t},[`${W}node`]:(e,t)=>{e.node=t,e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${W}and`]:(e,t)=>{e.and=t.value;let n=e.config.lists[e.and];if(n?.length)for(let t of n)e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${W}qualifiedValueShape`]:(e,t)=>{let n=e.config.getNodeTemplate(t,e);e.qualifiedValueShape=n,e.nodeShapes.add(n)},[`${W}qualifiedMinCount`]:(e,t)=>{e.qualifiedMinCount=parseInt(t.value)},[`${W}qualifiedMaxCount`]:(e,t)=>{e.qualifiedMaxCount=parseInt(t.value)},[Ct.id]:(e,t)=>{e.owlImports.add(t)},[kt.id]:(e,t)=>{e.class=t;let n=e.config.store.getSubjects(jt,t,null);n.length>0&&(e.node=n[0])},[`${W}or`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.or=n:console.error(`list for sh:or not found:`,t.value,`existing lists:`,e.config.lists)},[`${W}xone`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.xone=n:console.error(`list for sh:xone not found:`,t.value,`existing lists:`,e.config.lists)}},lr=class{constructor(e,t){this.label=``,this.nodeShapes=new Set,this.owlImports=new Set,this.id=e,this.parent=t,this.config=t.config,this.config.registerPropertyTemplate(this),pr(this,this.config.store.getQuads(e,null,null,null))}};function ur(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}function dr(e){return Math.min(e.maxCount??2**53-1,e.qualifiedMaxCount??2**53-1)}function fr(e){let t=Object.assign({},e);return t.nodeShapes=new Set(e.nodeShapes),t.owlImports=new Set(e.owlImports),e.languageIn&&(t.languageIn=[...e.languageIn]),e.or&&(t.or=[...e.or]),e.xone&&(t.xone=[...e.xone]),t}function pr(e,t){for(let n of t)cr[n.predicate.id]?.call(e,e,n.object);return e.label=e.name?.value||Rt(t,e.config.languages),e.label||=e.path?Bt(e.path,$n):`unknown`,e}function mr(e,t){let n=t,r=e;for(let e in t)if(e!==`parent`&&e!==`config`&&e!==`id`){let t=n[e];if(t!==void 0&&t!==``)if(Array.isArray(t)){let n=r[e];Array.isArray(n)?n.push(...t):r[e]=[...t]}else if(t instanceof Set&&t.size){let n=r[e];r[e]=new Set([...n instanceof Set?n:[],...t])}else r[e]=t}}function hr(e,t,n){let r=document.createElement(`div`);r.classList.add(`shacl-or-constraint`),r.setAttribute(`part`,`constraint`);let i=[];if(t instanceof ls){let a=[],o=!1;e.length&&(o=n.store.countQuads(e[0],Ot,null,null)>0);for(let r=0;r<e.length;r++)if(o){let o=n.store.getObjects(e[r],Ot,null),s=[],c=``;for(let e of o){let r=new Xo(n.getPropertyTemplate(e,t.template),t);s.push(r),c+=(c.length>0?` / `:``)+r.template.label}a.push(s),i.push({label:c,value:r.toString()})}else{let o=e[r],s=new Xo(n.getPropertyTemplate(o,t.template),t);a.push([s]),i.push({label:s.template.label,value:r.toString()})}let s=n.theme.createListEditor(`Please choose`,null,!1,i);s.setAttribute(`part`,`constraint-editor`);let c=s.querySelector(`.editor`);c.onchange=()=>{if(c.value){let e=a[parseInt(c.value)],t;e.length&&(t=e[0],r.replaceWith(e[0]),t.updateControls());for(let n=1;n<e.length;n++)t.after(e[n]),t=e[n],t.updateControls()}},r.appendChild(s)}else{let a=[];for(let t=0;t<e.length;t++){let r=n.store.getQuads(e[t],null,null,null);if(r.length){a.push(r);let e=Rt(r,n.languages);for(let t of r)t.predicate.equals(At)&&(e=Rt(n.store.getQuads(t.object,null,null,null),n.languages));i.push({label:e||Bt(r[0].predicate.value,$n)+` = `+Bt(r[0].object.value,$n),value:t.toString()})}}let o=n.theme.createListEditor(t.template.label+`?`,null,!1,i,t.template);o.setAttribute(`part`,`constraint-editor`);let s=o.querySelector(`.editor`);s.onchange=async()=>{if(s.value){let e=await Zo(pr(fr(t.template),a[parseInt(s.value)]),void 0,!0),n=e.querySelector(`:scope > label`);n&&n.classList.add(`persistent`),r.replaceWith(e)}},r.appendChild(o)}return r}function gr(e,t,n){if(t.termType===`Literal`){let r=t.datatype;for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(t.predicate.value===`http://www.w3.org/ns/shacl#datatype`&&t.object.equals(r))return e}}else{let r=n.store.getObjects(t,bt,null);for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(r.length>0){if(t.predicate.value===`http://www.w3.org/ns/shacl#node`){for(let i of r)if(n.store.getQuads(t.object,jt,i,null).length>0)return e}if(t.predicate.equals(kt)){for(let n of r)if(t.object.equals(n))return e}}else if(t.predicate.equals(Mt)&&t.object.equals(Dt))return e}}return console.error(`couldn't resolve sh:or/sh:xone on property for value`,t),[]}function _r(e,t,n){for(let r of e){let e=!1,i=n.store.getObjects(r,Ot,null);for(let r of i){let i=n.store.getObjects(r,`${W}path`,null);for(let r of i)if(e=n.store.countQuads(t,r,null,null)>0,e)break}if(e)return i}return console.error(`couldn't resolve sh:or/sh:xone on node for value`,t),[]}var vr=`:host {
|
|
26
|
+
`;case`f`:return`\f`;case`r`:return`\r`;case`"`:return`"`;case`'`:return`'`;case`\\`:return`\\`}if(n)return String.fromCharCode(parseInt(n,16));if(r)return String.fromCodePoint(parseInt(r,16))}):e}var h=/[\u0000-\u0020<>"{}|^`\\]/g,g=[];for(let e=0;e<=127;++e)h.test(String.fromCharCode(e))&&(g[e]=`\\u`+e.toString(16).toUpperCase().padStart(4,`0`),h.lastIndex=0);function _(e){return h.test(e)?e.replace(h,function(e){return g[e.codePointAt(0)]}):e}var v=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function y(e){return v.test(e)?e.replace(v,function(e,t,n){if(t)return String.fromCharCode(parseInt(t,16));if(n)return String.fromCodePoint(parseInt(n,16))}):e}})),En=o(((e,t)=>{var n=bn(),r=Cn(),i=wn(),a=Tn(),{setImmediate:o}=Sn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,signal:s=null}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.signal=s,this.quads=null}async main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()],i=0;for(let e of r)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let o=[...t.keys()].sort(),c=[];for(let e of o){let n=t.get(e);if(n.length>1){c.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=c.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of c){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=await this.hashNDegreeQuads(r,e);t.push(i)}t.sort(s);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let l=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));l.push(t)}return l.sort(),l.join(``)}async hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=await i.digest(),n.hash}async hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}async hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=await this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0){if(this.signal&&this.signal.aborted)throw Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=await this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:await n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads,i=0;for(let a of r)++i%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:`g`,id:e,issuer:t,hashToRelated:n})]);return n}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=await this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=await this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}async _yield(){return new Promise(e=>o(e))}};function s(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),Dn=o(((e,t)=>{var n=bn(),r=Cn(),i=wn(),a=Tn();t.exports=class{constructor({createMessageDigest:e=null,messageDigestAlgorithm:t=`sha256`,canonicalIdMap:i=new Map,maxWorkFactor:a=1,maxDeepIterations:o=-1,timeout:s=0}={}){this.name=`RDFC-1.0`,this.blankNodeInfo=new Map,this.canonicalIssuer=new n(`c14n`,i),this.createMessageDigest=e||(()=>new r(t)),this.maxWorkFactor=a,this.maxDeepIterations=o,this.remainingDeepIterations=0,this.timeout=s,s>0&&(this.startTime=Date.now()),this.quads=null}main(e){this.quads=e;for(let t of e)this._addBlankNodeQuadInfo({quad:t,component:t.subject}),this._addBlankNodeQuadInfo({quad:t,component:t.object}),this._addBlankNodeQuadInfo({quad:t,component:t.graph});let t=new Map,r=[...this.blankNodeInfo.keys()];for(let e of r)this._hashAndTrackBlankNode({id:e,hashToBlankNodes:t});let i=[...t.keys()].sort(),s=[];for(let e of i){let n=t.get(e);if(n.length>1){s.push(n);continue}let r=n[0];this.canonicalIssuer.getId(r)}if(this.maxDeepIterations<0)if(this.maxWorkFactor===0)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{let e=s.reduce((e,t)=>e+t.length,0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>2**53-1&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(let e of s){let t=[];for(let r of e){if(this.canonicalIssuer.hasId(r))continue;let e=new n(`b`);e.getId(r);let i=this.hashNDegreeQuads(r,e);t.push(i)}t.sort(o);for(let e of t){let t=e.issuer.getOldIds();for(let e of t)this.canonicalIssuer.getId(e)}}let c=[];for(let e of this.quads){let t=a.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));c.push(t)}return c.sort(),c.join(``)}hashFirstDegreeQuads(e){let t=[],n=this.blankNodeInfo.get(e),r=n.quads;for(let n of r)t.push(a.serializeQuadComponents(this.modifyFirstDegreeComponent(e,n.subject,`subject`),n.predicate,this.modifyFirstDegreeComponent(e,n.object,`object`),this.modifyFirstDegreeComponent(e,n.graph,`graph`)));t.sort();let i=this.createMessageDigest();for(let e of t)i.update(e);return n.hash=i.digest(),n.hash}hashRelatedBlankNode(e,t,n,r){let i=this.createMessageDigest();i.update(r),r!==`g`&&i.update(this.getRelatedPredicate(t));let a;return a=this.canonicalIssuer.hasId(e)?`_:`+this.canonicalIssuer.getId(e):n.hasId(e)?`_:`+n.getId(e):this.blankNodeInfo.get(e).hash,i.update(a),i.digest()}hashNDegreeQuads(e,t){if(this.remainingDeepIterations===0)throw Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;let n=this.createMessageDigest(),r=this.createHashToRelated(e,t),a=[...r.keys()].sort();for(let e of a){n.update(e);let a=``,o,s=new i(r.get(e)),c=0;for(;s.hasNext();){let e=s.next();if(++c%3==0&&this.timeout>0&&Date.now()-this.startTime>this.timeout)throw Error(`Canonize timeout.`);let n=t.clone(),r=``,i=[],l=!1;for(let t of e)if(this.canonicalIssuer.hasId(t)?r+=`_:`+this.canonicalIssuer.getId(t):(n.hasId(t)||i.push(t),r+=`_:`+n.getId(t)),a.length!==0&&r>a){l=!0;break}if(!l){for(let e of i){let t=this.hashNDegreeQuads(e,n);if(r+=`_:`+n.getId(e),r+=`<${t.hash}>`,n=t.issuer,a.length!==0&&r>a){l=!0;break}}l||(a.length===0||r<a)&&(a=r,o=n)}}n.update(a),t=o}return{hash:n.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return t.termType===`BlankNode`?{termType:`BlankNode`,value:t.value===e?`a`:`z`}:t}getRelatedPredicate(e){return`<${e.predicate.value}>`}createHashToRelated(e,t){let n=new Map,r=this.blankNodeInfo.get(e).quads;for(let i of r)this._addRelatedBlankNodeHash({quad:i,component:i.subject,position:`s`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.object,position:`o`,id:e,issuer:t,hashToRelated:n}),this._addRelatedBlankNodeHash({quad:i,component:i.graph,position:`g`,id:e,issuer:t,hashToRelated:n});return n}_hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){let n=this.hashFirstDegreeQuads(e),r=t.get(n);r?r.push(e):t.set(n,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if(t.termType!==`BlankNode`)return;let n=t.value,r=this.blankNodeInfo.get(n);r?r.quads.add(e):this.blankNodeInfo.set(n,{quads:new Set([e]),hash:null})}_addRelatedBlankNodeHash({quad:e,component:t,position:n,id:r,issuer:i,hashToRelated:a}){if(!(t.termType===`BlankNode`&&t.value!==r))return;let o=t.value,s=this.hashRelatedBlankNode(o,e,i,n),c=a.get(s);c?c.push(o):a.set(s,[o])}_componentWithCanonicalId(e){return e.termType===`BlankNode`&&!e.value.startsWith(this.canonicalIssuer.prefix)?{termType:`BlankNode`,value:this.canonicalIssuer.getId(e.value)}:e}};function o(e,t){return e.hash<t.hash?-1:+(e.hash>t.hash)}})),On=o((e=>{var t=En(),n=Dn();function r(t,n){if(n.inputFormat){if(n.inputFormat===`application/n-quads`){if(typeof t!=`string`)throw Error(`N-Quads input must be a string.`);return e.NQuads.parse(t)}throw Error(`Unknown canonicalization input format: "${n.inputFormat}".`)}return t}function i(e){if(e.format&&e.format!==`application/n-quads`)throw Error(`Unknown canonicalization output format: "${e.format}".`)}function a(){globalThis.RDF_CANONIZE_TRACE_URDNA2015&&console.trace(`[rdf-canonize] URDNA2015 is deprecated, use RDFC-1.0`)}e.NQuads=Tn(),e.IdentifierIssuer=bn(),e.canonize=async function(e,n={}){let o=r(e,n);if(i(n),!(`algorithm`in n))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(n.algorithm===`RDFC-1.0`)return new t(n).main(o);if(n.algorithm===`URDNA2015`&&!n.rejectURDNA2015)return a(),new t(n).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+n.algorithm)},e._canonizeSync=function(e,t={}){let o=r(e,t);if(i(t),!(`algorithm`in t))throw Error(`No RDF Dataset Canonicalization algorithm specified.`);if(t.algorithm===`RDFC-1.0`)return new n(t).main(o);if(t.algorithm===`URDNA2015`&&!t.rejectURDNA2015)return a(),new n(t).main(o);throw Error(`Invalid RDF Dataset Canonicalization algorithm: `+t.algorithm)}})),kn=o(((e,t)=>{t.exports=On()})),An=o(((e,t)=>{var n={};t.exports=n,n.isArray=Array.isArray,n.isBoolean=e=>typeof e==`boolean`||Object.prototype.toString.call(e)===`[object Boolean]`,n.isDouble=e=>n.isNumber(e)&&(String(e).indexOf(`.`)!==-1||Math.abs(e)>=1e21),n.isEmptyObject=e=>n.isObject(e)&&Object.keys(e).length===0,n.isNumber=e=>typeof e==`number`||Object.prototype.toString.call(e)===`[object Number]`,n.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),n.isObject=e=>Object.prototype.toString.call(e)===`[object Object]`,n.isString=e=>typeof e==`string`||Object.prototype.toString.call(e)===`[object String]`,n.isUndefined=e=>e===void 0})),jn=o(((e,t)=>{var n=An(),r={};t.exports=r,r.isSubject=e=>n.isObject(e)&&!(`@value`in e||`@set`in e||`@list`in e)?Object.keys(e).length>1||!(`@id`in e):!1,r.isSubjectReference=e=>n.isObject(e)&&Object.keys(e).length===1&&`@id`in e,r.isValue=e=>n.isObject(e)&&`@value`in e,r.isList=e=>n.isObject(e)&&`@list`in e,r.isGraph=e=>n.isObject(e)&&`@graph`in e&&Object.keys(e).filter(e=>e!==`@id`&&e!==`@index`).length===1,r.isSimpleGraph=e=>r.isGraph(e)&&!(`@id`in e),r.isBlankNode=e=>{if(n.isObject(e)){if(`@id`in e){let t=e[`@id`];return!n.isString(t)||t.indexOf(`_:`)===0}return Object.keys(e).length===0||!(`@value`in e||`@set`in e||`@list`in e)}return!1}})),Mn=o(((e,t)=>{t.exports=class extends Error{constructor(e=`An unspecified JSON-LD error occurred.`,t=`jsonld.Error`,n={}){super(e),this.name=t,this.message=e,this.details=n}}})),Nn=o(((e,t)=>{var n=jn(),r=An(),i=kn().IdentifierIssuer,a=Mn(),o=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,c=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,l=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,d={headers:{accept:`application/ld+json, application/json`}},f={};t.exports=f,f.IdentifierIssuer=i,f.REGEX_BCP47=o,f.REGEX_KEYWORD=u,f.clone=function(e){if(e&&typeof e==`object`){let t;if(r.isArray(e)){t=[];for(let n=0;n<e.length;++n)t[n]=f.clone(e[n])}else if(e instanceof Map){t=new Map;for(let[n,r]of e)t.set(n,f.clone(r))}else if(e instanceof Set){t=new Set;for(let n of e)t.add(f.clone(n))}else if(r.isObject(e)){t={};for(let n in e)t[n]=f.clone(e[n])}else t=e.toString();return t}return e},f.asArray=function(e){return Array.isArray(e)?e:[e]},f.buildHeaders=(e={})=>{if(Object.keys(e).some(e=>e.toLowerCase()===`accept`))throw RangeError(`Accept header may not be specified; only "`+d.headers.accept+`" is supported.`);return Object.assign({Accept:d.headers.accept},e)},f.parseLinkHeader=e=>{let t={},n=e.match(s);for(let e=0;e<n.length;++e){let r=n[e].match(c);if(!r)continue;let i={target:r[1]},a=r[2];for(;r=l.exec(a);)i[r[1]]=r[2]===void 0?r[3]:r[2];let o=i.rel||``;Array.isArray(t[o])?t[o].push(i):t.hasOwnProperty(o)?t[o]=[t[o],i]:t[o]=i}return t},f.validateTypeValue=(e,t)=>{if(!r.isString(e)&&!(r.isArray(e)&&e.every(e=>r.isString(e)))){if(t&&r.isObject(e))switch(Object.keys(e).length){case 0:return;case 1:if(`@default`in e&&f.asArray(e[`@default`]).every(e=>r.isString(e)))return}throw new a(`Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.`,`jsonld.SyntaxError`,{code:`invalid type value`,value:e})}},f.hasProperty=(e,t)=>{if(e.hasOwnProperty(t)){let n=e[t];return!r.isArray(n)||n.length>0}return!1},f.hasValue=(e,t,i)=>{if(f.hasProperty(e,t)){let a=e[t],o=n.isList(a);if(r.isArray(a)||o){o&&(a=a[`@list`]);for(let e=0;e<a.length;++e)if(f.compareValues(i,a[e]))return!0}else if(!r.isArray(i))return f.compareValues(i,a)}return!1},f.addValue=(e,t,n,i)=>{if(i||={},`propertyIsArray`in i||(i.propertyIsArray=!1),`valueIsArray`in i||(i.valueIsArray=!1),`allowDuplicate`in i||(i.allowDuplicate=!0),`prependValue`in i||(i.prependValue=!1),i.valueIsArray)e[t]=n;else if(r.isArray(n)){n.length===0&&i.propertyIsArray&&!e.hasOwnProperty(t)&&(e[t]=[]),i.prependValue&&(n=n.concat(e[t]),e[t]=[]);for(let r=0;r<n.length;++r)f.addValue(e,t,n[r],i)}else if(e.hasOwnProperty(t)){let a=!i.allowDuplicate&&f.hasValue(e,t,n);!r.isArray(e[t])&&(!a||i.propertyIsArray)&&(e[t]=[e[t]]),a||(i.prependValue?e[t].unshift(n):e[t].push(n))}else e[t]=i.propertyIsArray?[n]:n},f.getValues=(e,t)=>[].concat(e[t]||[]),f.removeProperty=(e,t)=>{delete e[t]},f.removeValue=(e,t,n,r)=>{r||={},`propertyIsArray`in r||(r.propertyIsArray=!1);let i=f.getValues(e,t).filter(e=>!f.compareValues(e,n));i.length===0?f.removeProperty(e,t):i.length===1&&!r.propertyIsArray?e[t]=i[0]:e[t]=i},f.relabelBlankNodes=(e,t)=>(t||={},p(t.issuer||new i(`_:b`),e)),f.compareValues=(e,t)=>e===t||n.isValue(e)&&n.isValue(t)&&e[`@value`]===t[`@value`]&&e[`@type`]===t[`@type`]&&e[`@language`]===t[`@language`]&&e[`@index`]===t[`@index`]?!0:r.isObject(e)&&`@id`in e&&r.isObject(t)&&`@id`in t?e[`@id`]===t[`@id`]:!1,f.compareShortestLeast=(e,t)=>e.length<t.length?-1:t.length<e.length?1:e===t?0:e<t?-1:1;function p(e,t){if(r.isArray(t))for(let n=0;n<t.length;++n)t[n]=p(e,t[n]);else if(n.isList(t))t[`@list`]=p(e,t[`@list`]);else if(r.isObject(t)){n.isBlankNode(t)&&(t[`@id`]=e.getId(t[`@id`]));let r=Object.keys(t).sort();for(let n=0;n<r.length;++n){let i=r[n];i!==`@id`&&(t[i]=p(e,t[i]))}}return t}})),Pn=o(((e,t)=>{var n=`http://www.w3.org/1999/02/22-rdf-syntax-ns#`,r=`http://www.w3.org/2001/XMLSchema#`;t.exports={LINK_HEADER_REL:`http://www.w3.org/ns/json-ld#context`,LINK_HEADER_CONTEXT:`http://www.w3.org/ns/json-ld#context`,RDF:n,RDF_LIST:n+`List`,RDF_FIRST:n+`first`,RDF_REST:n+`rest`,RDF_NIL:n+`nil`,RDF_TYPE:n+`type`,RDF_PLAIN_LITERAL:n+`PlainLiteral`,RDF_XML_LITERAL:n+`XMLLiteral`,RDF_JSON_LITERAL:n+`JSON`,RDF_OBJECT:n+`object`,RDF_LANGSTRING:n+`langString`,XSD:r,XSD_BOOLEAN:r+`boolean`,XSD_DOUBLE:r+`double`,XSD_INTEGER:r+`integer`,XSD_STRING:r+`string`}})),Fn=o(((e,t)=>{t.exports=class{constructor(){this._requests={}}wrapLoader(e){let t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}})),In=o(((e,t)=>{var n=An(),r={};t.exports=r,r.parsers={simple:{keys:[`href`,`scheme`,`authority`,`path`,`query`,`fragment`],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:[`href`,`protocol`,`scheme`,`authority`,`auth`,`user`,`password`,`hostname`,`port`,`path`,`directory`,`file`,`query`,`fragment`],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},r.parse=(e,t)=>{let n={},i=r.parsers[t||`full`],a=i.regex.exec(e),o=i.keys.length;for(;o--;)n[i.keys[o]]=a[o]===void 0?null:a[o];return(n.scheme===`https`&&n.port===`443`||n.scheme===`http`&&n.port===`80`)&&(n.href=n.href.replace(`:`+n.port,``),n.authority=n.authority.replace(`:`+n.port,``),n.port=null),n.normalizedPath=r.removeDotSegments(n.path),n},r.prependBase=(e,t)=>{if(e===null||r.isAbsolute(t))return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=r.parse(t),a={protocol:e.protocol||``};if(i.authority!==null)a.authority=i.authority,a.path=i.path,a.query=i.query;else if(a.authority=e.authority,i.path===``)a.path=e.path,i.query===null?a.query=e.query:a.query=i.query;else{if(i.path.indexOf(`/`)===0)a.path=i.path;else{let t=e.path;t=t.substr(0,t.lastIndexOf(`/`)+1),(t.length>0||e.authority)&&t.substr(-1)!==`/`&&(t+=`/`),t+=i.path,a.path=t}a.query=i.query}i.path!==``&&(a.path=r.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+=`//`+a.authority),o+=a.path,a.query!==null&&(o+=`?`+a.query),i.fragment!==null&&(o+=`#`+i.fragment),o===``&&(o=`./`),o},r.removeBase=(e,t)=>{if(e===null)return t;(!e||n.isString(e))&&(e=r.parse(e||``));let i=``;if(e.href===``?t.indexOf(`//`)&&(i+=`//`):i+=(e.protocol||``)+`//`+(e.authority||``),t.indexOf(i)!==0)return t;let a=r.parse(t.substr(i.length)),o=e.normalizedPath.split(`/`),s=a.normalizedPath.split(`/`),c=a.fragment||a.query?0:1;for(;o.length>0&&s.length>c&&o[0]===s[0];)o.shift(),s.shift();let l=``;if(o.length>0){o.pop();for(let e=0;e<o.length;++e)l+=`../`}return l+=s.join(`/`),a.query!==null&&(l+=`?`+a.query),a.fragment!==null&&(l+=`#`+a.fragment),l===``&&(l=`./`),l},r.removeDotSegments=e=>{if(e.length===0)return``;let t=e.split(`/`),n=[];for(;t.length>0;){let e=t.shift(),r=t.length===0;if(e===`.`){r&&n.push(``);continue}if(e===`..`){n.pop(),r&&n.push(``);continue}n.push(e)}return e[0]===`/`&&n.length>0&&n[0]!==``&&n.unshift(``),n.length===1&&n[0]===``?`/`:n.join(`/`)};var i=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;r.isAbsolute=e=>n.isString(e)&&i.test(e),r.isRelative=e=>n.isString(e)})),Ln=o(((e,t)=>{var{parseLinkHeader:n,buildHeaders:r}=Nn(),{LINK_HEADER_CONTEXT:i}=Pn(),a=Mn(),o=Fn(),{prependBase:s}=In(),c=/(^|(\r\n))link:/i;t.exports=({secure:e,headers:t={},xhr:u}={headers:{}})=>{return t=r(t),new o().wrapLoader(d);async function d(r){if(r.indexOf(`http:`)!==0&&r.indexOf(`https:`)!==0)throw new a(`URL could not be dereferenced; only "http" and "https" URLs are supported.`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});if(e&&r.indexOf(`https`)!==0)throw new a(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,`jsonld.InvalidUrl`,{code:`loading document failed`,url:r});let o;try{o=await l(u,r,t)}catch(e){throw new a(`URL could not be dereferenced, an error occurred.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,cause:e})}if(o.status>=400)throw new a(`URL could not be dereferenced: `+o.statusText,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:r,httpStatusCode:o.status});let f={contextUrl:null,documentUrl:r,document:o.response},p=null,m=o.getResponseHeader(`Content-Type`),h;if(c.test(o.getAllResponseHeaders())&&(h=o.getResponseHeader(`Link`)),h&&m!==`application/ld+json`){let e=n(h),t=e[i];if(Array.isArray(t))throw new a(`URL could not be dereferenced, it has more than one associated HTTP Link Header.`,`jsonld.InvalidUrl`,{code:`multiple context link headers`,url:r});t&&(f.contextUrl=t.target),p=e.alternate,p&&p.type==`application/ld+json`&&!(m||``).match(/^application\/(\w*\+)?json$/)&&(f=await d(s(r,p.target)))}return f}};function l(e,t,n){e||=XMLHttpRequest;let r=new e;return new Promise((e,i)=>{r.onload=()=>e(r),r.onerror=e=>i(e),r.open(`GET`,t,!0);for(let e in n)r.setRequestHeader(e,n[e]);r.send()})}})),Rn=o(((e,t)=>{var n=Ln(),r={};t.exports=r,r.setupDocumentLoaders=function(e){typeof XMLHttpRequest<`u`&&(e.documentLoaders.xhr=n,e.useDocumentLoader(`xhr`))},r.setupGlobals=function(e){globalThis.JsonLdProcessor===void 0&&Object.defineProperty(globalThis,`JsonLdProcessor`,{writable:!0,enumerable:!1,configurable:!0,value:e.JsonLdProcessor})}})),zn=o(((e,t)=>{t.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}})),Bn=o(((e,t)=>{t.exports=n,n.Node=o,n.create=n;function n(e){var t=this;if(t instanceof n||(t=new n),t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==`function`)e.forEach(function(e){t.push(e)});else if(arguments.length>0)for(var r=0,i=arguments.length;r<i;r++)t.push(arguments[r]);return t}n.prototype.removeNode=function(e){if(e.list!==this)throw Error(`removing node which does not belong to this list`);var t=e.next,n=e.prev;return t&&(t.prev=n),n&&(n.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=n),e.list.length--,e.next=null,e.prev=null,e.list=null,t},n.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||=e,this.length++}},n.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||=e,this.length++}},n.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)i(this,arguments[e]);return this.length},n.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)a(this,arguments[e]);return this.length},n.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},n.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},n.prototype.forEach=function(e,t){t||=this;for(var n=this.head,r=0;n!==null;r++)e.call(t,n.value,r,this),n=n.next},n.prototype.forEachReverse=function(e,t){t||=this;for(var n=this.tail,r=this.length-1;n!==null;r--)e.call(t,n.value,r,this),n=n.prev},n.prototype.get=function(e){for(var t=0,n=this.head;n!==null&&t<e;t++)n=n.next;if(t===e&&n!==null)return n.value},n.prototype.getReverse=function(e){for(var t=0,n=this.tail;n!==null&&t<e;t++)n=n.prev;if(t===e&&n!==null)return n.value},n.prototype.map=function(e,t){t||=this;for(var r=new n,i=this.head;i!==null;)r.push(e.call(t,i.value,this)),i=i.next;return r},n.prototype.mapReverse=function(e,t){t||=this;for(var r=new n,i=this.tail;i!==null;)r.push(e.call(t,i.value,this)),i=i.prev;return r},n.prototype.reduce=function(e,t){var n,r=this.head;if(arguments.length>1)n=t;else if(this.head)r=this.head.next,n=this.head.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=0;r!==null;i++)n=e(n,r.value,i),r=r.next;return n},n.prototype.reduceReverse=function(e,t){var n,r=this.tail;if(arguments.length>1)n=t;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw TypeError(`Reduce of empty list with no initial value`);for(var i=this.length-1;r!==null;i--)n=e(n,r.value,i),r=r.prev;return n},n.prototype.toArray=function(){for(var e=Array(this.length),t=0,n=this.head;n!==null;t++)e[t]=n.value,n=n.next;return e},n.prototype.toArrayReverse=function(){for(var e=Array(this.length),t=0,n=this.tail;n!==null;t++)e[t]=n.value,n=n.prev;return e},n.prototype.slice=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(;a!==null&&i<t;i++,a=a.next)r.push(a.value);return r},n.prototype.sliceReverse=function(e,t){t||=this.length,t<0&&(t+=this.length),e||=0,e<0&&(e+=this.length);var r=new n;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var i=this.length,a=this.tail;a!==null&&i>t;i--)a=a.prev;for(;a!==null&&i>e;i--,a=a.prev)r.push(a.value);return r},n.prototype.splice=function(e,t,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,a=this.head;a!==null&&i<e;i++)a=a.next;for(var o=[],i=0;a&&i<t;i++)o.push(a.value),a=this.removeNode(a);a===null&&(a=this.tail),a!==this.head&&a!==this.tail&&(a=a.prev);for(var i=0;i<n.length;i++)a=r(this,a,n[i]);return o},n.prototype.reverse=function(){for(var e=this.head,t=this.tail,n=e;n!==null;n=n.prev){var r=n.prev;n.prev=n.next,n.next=r}return this.head=t,this.tail=e,this};function r(e,t,n){var r=t===e.head?new o(n,null,t,e):new o(n,t,t.next,e);return r.next===null&&(e.tail=r),r.prev===null&&(e.head=r),e.length++,r}function i(e,t){e.tail=new o(t,e.tail,null,e),e.head||=e.tail,e.length++}function a(e,t){e.head=new o(t,null,e.head,e),e.tail||=e.head,e.length++}function o(e,t,n,r){if(!(this instanceof o))return new o(e,t,n,r);this.list=r,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,n?(n.prev=this,this.next=n):this.next=null}try{zn()(n)}catch{}})),Vn=o(((e,t)=>{var n=Bn(),r=Symbol(`max`),i=Symbol(`length`),a=Symbol(`lengthCalculator`),o=Symbol(`allowStale`),s=Symbol(`maxAge`),c=Symbol(`dispose`),l=Symbol(`noDisposeOnSet`),u=Symbol(`lruList`),d=Symbol(`cache`),f=Symbol(`updateAgeOnGet`),p=()=>1,m=class{constructor(e){if(typeof e==`number`&&(e={max:e}),e||={},e.max&&(typeof e.max!=`number`||e.max<0))throw TypeError(`max must be a non-negative number`);this[r]=e.max||1/0;let t=e.length||p;if(this[a]=typeof t==`function`?t:p,this[o]=e.stale||!1,e.maxAge&&typeof e.maxAge!=`number`)throw TypeError(`maxAge must be a number`);this[s]=e.maxAge||0,this[c]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!=`number`||e<0)throw TypeError(`max must be a non-negative number`);this[r]=e||1/0,_(this)}get max(){return this[r]}set allowStale(e){this[o]=!!e}get allowStale(){return this[o]}set maxAge(e){if(typeof e!=`number`)throw TypeError(`maxAge must be a non-negative number`);this[s]=e,_(this)}get maxAge(){return this[s]}set lengthCalculator(e){typeof e!=`function`&&(e=p),e!==this[a]&&(this[a]=e,this[i]=0,this[u].forEach(e=>{e.length=this[a](e.value,e.key),this[i]+=e.length})),_(this)}get lengthCalculator(){return this[a]}get length(){return this[i]}get itemCount(){return this[u].length}rforEach(e,t){t||=this;for(let n=this[u].tail;n!==null;){let r=n.prev;b(this,e,n,t),n=r}}forEach(e,t){t||=this;for(let n=this[u].head;n!==null;){let r=n.next;b(this,e,n,t),n=r}}keys(){return this[u].toArray().map(e=>e.key)}values(){return this[u].toArray().map(e=>e.value)}reset(){this[c]&&this[u]&&this[u].length&&this[u].forEach(e=>this[c](e.key,e.value)),this[d]=new Map,this[u]=new n,this[i]=0}dump(){return this[u].map(e=>g(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[u]}set(e,t,n){if(n||=this[s],n&&typeof n!=`number`)throw TypeError(`maxAge must be a number`);let o=n?Date.now():0,f=this[a](t,e);if(this[d].has(e)){if(f>this[r])return v(this,this[d].get(e)),!1;let a=this[d].get(e).value;return this[c]&&(this[l]||this[c](e,a.value)),a.now=o,a.maxAge=n,a.value=t,this[i]+=f-a.length,a.length=f,this.get(e),_(this),!0}let p=new y(e,t,f,o,n);return p.length>this[r]?(this[c]&&this[c](e,t),!1):(this[i]+=p.length,this[u].unshift(p),this[d].set(e,this[u].head),_(this),!0)}has(e){if(!this[d].has(e))return!1;let t=this[d].get(e).value;return!g(this,t)}get(e){return h(this,e,!0)}peek(e){return h(this,e,!1)}pop(){let e=this[u].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[d].get(e))}load(e){this.reset();let t=Date.now();for(let n=e.length-1;n>=0;n--){let r=e[n],i=r.e||0;if(i===0)this.set(r.k,r.v);else{let e=i-t;e>0&&this.set(r.k,r.v,e)}}}prune(){this[d].forEach((e,t)=>h(this,t,!1))}},h=(e,t,n)=>{let r=e[d].get(t);if(r){let t=r.value;if(g(e,t)){if(v(e,r),!e[o])return}else n&&(e[f]&&(r.value.now=Date.now()),e[u].unshiftNode(r));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[s])return!1;let n=Date.now()-t.now;return t.maxAge?n>t.maxAge:e[s]&&n>e[s]},_=e=>{if(e[i]>e[r])for(let t=e[u].tail;e[i]>e[r]&&t!==null;){let n=t.prev;v(e,t),t=n}},v=(e,t)=>{if(t){let n=t.value;e[c]&&e[c](n.key,n.value),e[i]-=n.length,e[d].delete(n.key),e[u].removeNode(t)}},y=class{constructor(e,t,n,r,i){this.key=e,this.value=t,this.length=n,this.now=r,this.maxAge=i||0}},b=(e,t,n,r)=>{let i=n.value;g(e,i)&&(v(e,n),e[o]||(i=void 0)),i&&t.call(r,i.value,i.key,e)};t.exports=m})),Hn=o(((e,t)=>{var n=Vn(),r=10;t.exports=class{constructor({document:e}){this.document=e,this.cache=new n({max:r})}getProcessed(e){return this.cache.get(e)}setProcessed(e,t){this.cache.set(e,t)}}})),Un=o(((e,t)=>{var{isArray:n,isObject:r,isString:i}=An(),{asArray:a}=Nn(),{prependBase:o}=In(),s=Mn(),c=Hn(),l=10;t.exports=class{constructor({sharedCache:e}){this.perOpCache=new Map,this.sharedCache=e}async resolve({activeCtx:e,context:t,documentLoader:o,base:s,cycles:l=new Set}){t&&r(t)&&t[`@context`]&&(t=t[`@context`]),t=a(t);let d=[];for(let a of t){if(i(a)){let t=this._get(a);t||=await this._resolveRemoteContext({activeCtx:e,url:a,documentLoader:o,base:s,cycles:l}),n(t)?d.push(...t):d.push(t);continue}if(a===null){d.push(new c({document:null}));continue}r(a)||u(t);let f=JSON.stringify(a),p=this._get(f);p||(p=new c({document:a}),this._cacheResolvedContext({key:f,resolved:p,tag:`static`})),d.push(p)}return d}_get(e){let t=this.perOpCache.get(e);if(!t){let n=this.sharedCache.get(e);n&&(t=n.get(`static`),t&&this.perOpCache.set(e,t))}return t}_cacheResolvedContext({key:e,resolved:t,tag:n}){if(this.perOpCache.set(e,t),n!==void 0){let r=this.sharedCache.get(e);r||(r=new Map,this.sharedCache.set(e,r)),r.set(n,t)}return t}async _resolveRemoteContext({activeCtx:e,url:t,documentLoader:n,base:r,cycles:i}){t=o(r,t);let{context:a,remoteDoc:s}=await this._fetchContext({activeCtx:e,url:t,documentLoader:n,cycles:i});r=s.documentUrl||t,d({context:a,base:r});let c=await this.resolve({activeCtx:e,context:a,documentLoader:n,base:r,cycles:i});return this._cacheResolvedContext({key:t,resolved:c,tag:s.tag}),c}async _fetchContext({activeCtx:e,url:t,documentLoader:a,cycles:o}){if(o.size>l)throw new s(`Maximum number of @context URLs exceeded.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`loading remote context failed`:`context overflow`,max:l});if(o.has(t))throw new s(`Cyclical @context URLs detected.`,`jsonld.ContextUrlError`,{code:e.processingMode===`json-ld-1.0`?`recursive context inclusion`:`context overflow`,url:t});o.add(t);let c,u;try{u=await a(t),c=u.document||null,i(c)&&(c=JSON.parse(c))}catch(e){throw new s(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`loading remote context failed`,url:t,cause:e})}if(!r(c))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${t}".`,`jsonld.InvalidUrl`,{code:`invalid remote context`,url:t});return c=`@context`in c?{"@context":c[`@context`]}:{"@context":{}},u.contextUrl&&(n(c[`@context`])||(c[`@context`]=[c[`@context`]]),c[`@context`].push(u.contextUrl)),{context:c,remoteDoc:u}}};function u(e){throw new s(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:e})}function d({context:e,base:t}){if(!e)return;let a=e[`@context`];if(i(a)){e[`@context`]=o(t,a);return}if(n(a)){for(let e=0;e<a.length;++e){let n=a[e];if(i(n)){a[e]=o(t,n);continue}r(n)&&d({context:{"@context":n},base:t})}return}if(r(a))for(let e in a)d({context:a[e],base:t})}})),Wn=o(((e,t)=>{t.exports=kn().NQuads})),Gn=o(((e,t)=>{var n=Mn(),{isArray:r}=An(),{asArray:i}=Nn(),a={};t.exports=a,a.defaultEventHandler=null,a.setupEventHandler=({options:e={}})=>{let t=[].concat(e.safe?a.safeEventHandler:[],e.eventHandler?i(e.eventHandler):[],a.defaultEventHandler?a.defaultEventHandler:[]);return t.length===0?null:t},a.handleEvent=({event:e,options:t})=>{o({event:e,handlers:t.eventHandler})};function o({event:e,handlers:t}){let i=!0;for(let a=0;i&&a<t.length;++a){i=!1;let s=t[a];if(r(s))i=o({event:e,handlers:s});else if(typeof s==`function`)s({event:e,next:()=>{i=!0}});else if(typeof s==`object`)e.code in s?s[e.code]({event:e,next:()=>{i=!0}}):i=!0;else throw new n(`Invalid event handler.`,`jsonld.InvalidEventHandler`,{event:e})}return i}var s=new Set([`empty object`,`free-floating scalar`,`invalid @language value`,`invalid property`,`null @id value`,`null @value value`,`object with only @id`,`object with only @language`,`object with only @list`,`object with only @value`,`relative @id reference`,`relative @type reference`,`relative @vocab reference`,`reserved @id value`,`reserved @reverse value`,`reserved term`,`blank node predicate`,`relative graph reference`,`relative object reference`,`relative predicate reference`,`relative subject reference`,`rdfDirection not set`]);a.safeEventHandler=function({event:e,next:t}){if(e.level===`warning`&&s.has(e.code))throw new n(`Safe mode validation error.`,`jsonld.ValidationError`,{event:e});t()},a.logEventHandler=function({event:e,next:t}){console.log(`EVENT: ${e.message}`,{event:e}),t()},a.logWarningEventHandler=function({event:e,next:t}){e.level===`warning`&&console.warn(`WARNING: ${e.message}`,{event:e}),t()},a.unhandledEventHandler=function({event:e}){throw new n(`No handler for event.`,`jsonld.UnhandledEvent`,{event:e})},a.setDefaultEventHandler=function({eventHandler:e}={}){a.defaultEventHandler=e?i(e):null}})),Kn=o(((e,t)=>{var n=Nn(),r=Mn(),{isArray:i,isObject:a,isString:o,isUndefined:s}=An(),{isAbsolute:c,isRelative:l,prependBase:u}=In(),{handleEvent:d}=Gn(),{REGEX_BCP47:f,REGEX_KEYWORD:p,asArray:m,compareShortestLeast:h}=Nn(),g=new Map,_=1e4,v={};t.exports=v,v.process=async({activeCtx:e,localCtx:t,options:n,propagate:s=!0,overrideProtected:p=!1,cycles:h=new Set})=>{if(a(t)&&`@context`in t&&i(t[`@context`])&&(t=t[`@context`]),m(t).length===0)return e;let g=[],_=[({event:e,next:t})=>{g.push(e),t()}];n.eventHandler&&_.push(n.eventHandler);let b=n;n={...n,eventHandler:_};let x=await n.contextResolver.resolve({activeCtx:e,context:t,documentLoader:n.documentLoader,base:n.base});a(x[0].document)&&typeof x[0].document[`@propagate`]==`boolean`&&(s=x[0].document[`@propagate`]);let S=e;!s&&!S.previousContext&&(S=S.clone(),S.previousContext=e);for(let i of x){let{document:s}=i;if(e=S,s===null){if(!p&&Object.keys(e.protected).length!==0)throw new r(`Tried to nullify a context with protected terms outside of a term definition.`,`jsonld.SyntaxError`,{code:`invalid context nullification`});S=e=v.getInitialContext(n).clone();continue}let m=i.getProcessed(e);if(m){if(b.eventHandler)for(let e of m.events)d({event:e,options:b});S=e=m.context;continue}if(a(s)&&`@context`in s&&(s=s[`@context`]),!a(s))throw new r(`Invalid JSON-LD syntax; @context must be an object.`,`jsonld.SyntaxError`,{code:`invalid local context`,context:s});S=S.clone();let _=new Map;if(`@version`in s){if(s[`@version`]!==1.1)throw new r(`Unsupported JSON-LD version: `+s[`@version`],`jsonld.UnsupportedVersion`,{code:`invalid @version value`,context:s});if(e.processingMode&&e.processingMode===`json-ld-1.0`)throw new r(`@version: `+s[`@version`]+` not compatible with `+e.processingMode,`jsonld.ProcessingModeConflict`,{code:`processing mode conflict`,context:s});S.processingMode=`json-ld-1.1`,S[`@version`]=s[`@version`],_.set(`@version`,!0)}if(S.processingMode=S.processingMode||e.processingMode,`@base`in s){let e=s[`@base`];if(!(e===null||c(e)))if(l(e))e=u(S[`@base`],e);else throw new r(`Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.`,`jsonld.SyntaxError`,{code:`invalid base IRI`,context:s});S[`@base`]=e,_.set(`@base`,!0)}if(`@vocab`in s){let e=s[`@vocab`];if(e===null)delete S[`@vocab`];else if(!o(e))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else if(!c(e)&&v.processingMode(S,1))throw new r(`Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid vocab mapping`,context:s});else{let t=y(S,e,{vocab:!0,base:!0},void 0,void 0,n);c(t)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`relative @vocab reference`,level:`warning`,message:`Relative @vocab reference found.`,details:{vocab:t}},options:n}),S[`@vocab`]=t}_.set(`@vocab`,!0)}if(`@language`in s){let e=s[`@language`];if(e===null)delete S[`@language`];else if(o(e))e.match(f)||n.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:n}),S[`@language`]=e.toLowerCase();else throw new r(`Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid default language`,context:s});_.set(`@language`,!0)}if(`@direction`in s){let t=s[`@direction`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @direction not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context member`,context:s});if(t===null)delete S[`@direction`];else if(t!==`ltr`&&t!==`rtl`)throw new r(`Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:s});else S[`@direction`]=t;_.set(`@direction`,!0)}if(`@propagate`in s){let n=s[`@propagate`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @propagate not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(typeof n!=`boolean`)throw new r(`Invalid JSON-LD syntax; @propagate value must be a boolean.`,`jsonld.SyntaxError`,{code:`invalid @propagate value`,context:t});_.set(`@propagate`,!0)}if(`@import`in s){let i=s[`@import`];if(e.processingMode===`json-ld-1.0`)throw new r(`Invalid JSON-LD syntax; @import not compatible with `+e.processingMode,`jsonld.SyntaxError`,{code:`invalid context entry`,context:s});if(!o(i))throw new r(`Invalid JSON-LD syntax; @import must be a string.`,`jsonld.SyntaxError`,{code:`invalid @import value`,context:t});let a=await n.contextResolver.resolve({activeCtx:e,context:i,documentLoader:n.documentLoader,base:n.base});if(a.length!==1)throw new r(`Invalid JSON-LD syntax; @import must reference a single context.`,`jsonld.SyntaxError`,{code:`invalid remote context`,context:t});let c=a[0].getProcessed(e);if(c)s=c;else{let n=a[0].document;if(`@import`in n)throw new r(`Invalid JSON-LD syntax: imported context must not include @import.`,`jsonld.SyntaxError`,{code:`invalid context entry`,context:t});for(let e in n)s.hasOwnProperty(e)||(s[e]=n[e]);a[0].setProcessed(e,s)}_.set(`@import`,!0)}_.set(`@protected`,s[`@protected`]||!1);for(let e in s)if(v.createTermDefinition({activeCtx:S,localCtx:s,term:e,defined:_,options:n,overrideProtected:p}),a(s[e])&&`@context`in s[e]){let t=s[e][`@context`],i=!0;if(o(t)){let e=u(n.base,t);h.has(e)?i=!1:h.add(e)}if(i)try{await v.process({activeCtx:S.clone(),localCtx:s[e][`@context`],overrideProtected:!0,options:n,cycles:h})}catch{throw new r(`Invalid JSON-LD syntax; invalid scoped context.`,`jsonld.SyntaxError`,{code:`invalid scoped context`,context:s[e][`@context`],term:e})}}i.setProcessed(e,{context:S,events:g})}return S},v.createTermDefinition=({activeCtx:e,localCtx:t,term:n,defined:s,options:l,overrideProtected:u=!1})=>{if(s.has(n)){if(s.get(n))return;throw new r(`Cyclical context definition detected.`,`jsonld.CyclicalContext`,{code:`cyclic IRI mapping`,context:t,term:n})}s.set(n,!1);let f;if(t.hasOwnProperty(n)&&(f=t[n]),n===`@type`&&a(f)&&(f[`@container`]||`@set`)===`@set`&&v.processingMode(e,1.1)){let e=[`@container`,`@id`,`@protected`],i=Object.keys(f);if(i.length===0||i.some(t=>!e.includes(t)))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n})}else if(v.isKeyword(n))throw new r(`Invalid JSON-LD syntax; keywords cannot be overridden.`,`jsonld.SyntaxError`,{code:`keyword redefinition`,context:t,term:n});else if(n.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved term`,level:`warning`,message:`Terms beginning with "@" are reserved for future use and dropped.`,details:{term:n}},options:l});return}else if(n===``)throw new r(`Invalid JSON-LD syntax; a term cannot be an empty string.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let m=e.mappings.get(n);e.mappings.has(n)&&e.mappings.delete(n);let h=!1;if((o(f)||f===null)&&(h=!0,f={"@id":f}),!a(f))throw new r(`Invalid JSON-LD syntax; @context term values must be strings or objects.`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let g={};e.mappings.set(n,g),g.reverse=!1;let _=[`@container`,`@id`,`@language`,`@reverse`,`@type`];v.processingMode(e,1.1)&&_.push(`@context`,`@direction`,`@index`,`@nest`,`@prefix`,`@protected`);for(let e in f)if(!_.includes(e))throw new r(`Invalid JSON-LD syntax; a term definition must not contain `+e,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});let x=n.indexOf(`:`);if(g._termHasColon=x>0,`@reverse`in f){if(`@id`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @id.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});if(`@nest`in f)throw new r(`Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});let i=f[`@reverse`];if(!o(i))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @reverse value`,level:`warning`,message:`@reverse values beginning with "@" are reserved for future use and dropped.`,details:{reverse:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}let a=y(e,i,{vocab:!0,base:!1},t,s,l);if(!c(a))throw new r(`Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=a,g.reverse=!0}else if(`@id`in f){let i=f[`@id`];if(i&&!o(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(i===null)g[`@id`]=null;else if(!v.isKeyword(i)&&i.match(p)){l.eventHandler&&d({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`@id values beginning with "@" are reserved for future use and dropped.`,details:{id:i}},options:l}),m?e.mappings.set(n,m):e.mappings.delete(n);return}else if(i!==n){if(i=y(e,i,{vocab:!0,base:!1},t,s,l),!c(i)&&!v.isKeyword(i))throw new r(`Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});if(n.match(/(?::[^:])|\//)&&y(e,n,{vocab:!0,base:!1},t,new Map(s).set(n,!0),l)!==i)throw new r(`Invalid JSON-LD syntax; term in form of IRI must expand to definition.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t});g[`@id`]=i,g._prefix=h&&!g._termHasColon&&i.match(/[:\/\?#\[\]@]$/)!==null}}if(!(`@id`in g))if(g._termHasColon){let r=n.substr(0,x);if(t.hasOwnProperty(r)&&v.createTermDefinition({activeCtx:e,localCtx:t,term:r,defined:s,options:l}),e.mappings.has(r)){let t=n.substr(x+1);g[`@id`]=e.mappings.get(r)[`@id`]+t}else g[`@id`]=n}else if(n===`@type`)g[`@id`]=n;else{if(!(`@vocab`in e))throw new r(`Invalid JSON-LD syntax; @context terms must define an @id.`,`jsonld.SyntaxError`,{code:`invalid IRI mapping`,context:t,term:n});g[`@id`]=e[`@vocab`]+n}if((f[`@protected`]===!0||s.get(`@protected`)===!0&&f[`@protected`]!==!1)&&(e.protected[n]=!0,g.protected=!0),s.set(n,!0),`@type`in f){let n=f[`@type`];if(!o(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be a string.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n===`@json`||n===`@none`){if(v.processingMode(e,1))throw new r(`Invalid JSON-LD syntax; an @context @type value must not be "${n}" in JSON-LD 1.0 mode.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else if(n!==`@id`&&n!==`@vocab`){if(n=y(e,n,{vocab:!0,base:!1},t,s,l),!c(n))throw new r(`Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t});if(n.indexOf(`_:`)===0)throw new r(`Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}g[`@type`]=n}if(`@container`in f){let n=o(f[`@container`])?[f[`@container`]]:f[`@container`]||[],a=[`@list`,`@set`,`@index`,`@language`],s=!0,c=n.includes(`@set`);if(v.processingMode(e,1.1)){if(a.push(`@graph`,`@id`,`@type`),n.includes(`@list`)){if(n.length!==1)throw new r(`Invalid JSON-LD syntax; @context @container with @list must have no other values`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else if(n.includes(`@graph`)){if(n.some(e=>e!==`@graph`&&e!==`@id`&&e!==`@index`&&e!==`@set`))throw new r(`Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set`,`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t})}else s&=n.length<=(c?2:1);if(n.includes(`@type`)&&(g[`@type`]=g[`@type`]||`@id`,![`@id`,`@vocab`].includes(g[`@type`])))throw new r(`Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.`,`jsonld.SyntaxError`,{code:`invalid type mapping`,context:t})}else s&=!i(f[`@container`]),s&=n.length<=1;if(s&=n.every(e=>a.includes(e)),s&=!(c&&n.includes(`@list`)),!s)throw new r(`Invalid JSON-LD syntax; @context @container value must be one of the following: `+a.join(`, `),`jsonld.SyntaxError`,{code:`invalid container mapping`,context:t});if(g.reverse&&!n.every(e=>[`@index`,`@set`].includes(e)))throw new r(`Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.`,`jsonld.SyntaxError`,{code:`invalid reverse property`,context:t});g[`@container`]=n}if(`@index`in f){if(!(`@container`in f)||!g[`@container`].includes(`@index`))throw new r(`Invalid JSON-LD syntax; @index without @index in @container: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(!o(f[`@index`])||f[`@index`].indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @index must expand to an IRI: "${f[`@index`]}" on term "${n}".`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});g[`@index`]=f[`@index`]}if(`@context`in f&&(g[`@context`]=f[`@context`]),`@language`in f&&!(`@type`in f)){let e=f[`@language`];if(e!==null&&!o(e))throw new r(`Invalid JSON-LD syntax; @context @language value must be a string or null.`,`jsonld.SyntaxError`,{code:`invalid language mapping`,context:t});e!==null&&(e=e.toLowerCase()),g[`@language`]=e}if(`@prefix`in f){if(n.match(/:|\//))throw new r(`Invalid JSON-LD syntax; @context @prefix used on a compact IRI term`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(v.isKeyword(g[`@id`]))throw new r(`Invalid JSON-LD syntax; keywords may not be used as prefixes`,`jsonld.SyntaxError`,{code:`invalid term definition`,context:t});if(typeof f[`@prefix`]==`boolean`)g._prefix=f[`@prefix`]===!0;else throw new r(`Invalid JSON-LD syntax; @context value for @prefix must be boolean`,`jsonld.SyntaxError`,{code:`invalid @prefix value`,context:t})}if(`@direction`in f){let e=f[`@direction`];if(e!==null&&e!==`ltr`&&e!==`rtl`)throw new r(`Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,context:t});g[`@direction`]=e}if(`@nest`in f){let e=f[`@nest`];if(!o(e)||e!==`@nest`&&e.indexOf(`@`)===0)throw new r(`Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,context:t});g[`@nest`]=e}let S=g[`@id`];if(S===`@context`||S===`@preserve`)throw new r(`Invalid JSON-LD syntax; @context and @preserve cannot be aliased.`,`jsonld.SyntaxError`,{code:`invalid keyword alias`,context:t});if(m&&m.protected&&!u&&(e.protected[n]=!0,g.protected=!0,!b(m,g)))throw new r(`Invalid JSON-LD syntax; tried to redefine a protected term.`,`jsonld.SyntaxError`,{code:`protected term redefinition`,context:t,term:n})},v.expandIri=(e,t,n,r)=>y(e,t,n,void 0,void 0,r);function y(e,t,n,r,i,s){if(t===null||!o(t)||v.isKeyword(t))return t;if(t.match(p))return null;if(r&&r.hasOwnProperty(t)&&i.get(t)!==!0&&v.createTermDefinition({activeCtx:e,localCtx:r,term:t,defined:i,options:s}),n||={},n.vocab){let n=e.mappings.get(t);if(n===null)return null;if(a(n)&&`@id`in n)return n[`@id`]}let l=t.indexOf(`:`);if(l>0){let n=t.substr(0,l),a=t.substr(l+1);if(n===`_`||a.indexOf(`//`)===0)return t;r&&r.hasOwnProperty(n)&&v.createTermDefinition({activeCtx:e,localCtx:r,term:n,defined:i,options:s});let o=e.mappings.get(n);if(o&&o._prefix)return o[`@id`]+a;if(c(t))return t}if(n.vocab&&`@vocab`in e)t=e[`@vocab`]+t;else if(n.base){let n,r;`@base`in e?e[`@base`]?(r=u(s.base,e[`@base`]),n=u(r,t)):(r=e[`@base`],n=t):(r=s.base,n=u(s.base,t)),t=n}return t}v.getInitialContext=e=>{let t=JSON.stringify({processingMode:e.processingMode}),r=g.get(t);if(r)return r;let i={processingMode:e.processingMode,mappings:new Map,inverse:null,getInverse:a,clone:c,revertToPreviousContext:l,protected:{}};return g.size===_&&g.clear(),g.set(t,i),i;function a(){let e=this;if(e.inverse)return e.inverse;let t=e.inverse={},n=e.fastCurieMap={},r={},i=(e[`@language`]||`@none`).toLowerCase(),a=e[`@direction`],c=e.mappings,l=[...c.keys()].sort(h);for(let e of l){let o=c.get(e);if(o===null)continue;let l=o[`@container`]||`@none`;if(l=[].concat(l).sort().join(``),o[`@id`]===null)continue;let u=m(o[`@id`]);for(let c of u){let u=t[c],d=v.isKeyword(c);if(u)!d&&!o._termHasColon&&r[c].push(e);else if(t[c]=u={},!d&&!o._termHasColon){r[c]=[e];let t={iri:c,terms:r[c]};c[0]in n?n[c[0]].push(t):n[c[0]]=[t]}if(u[l]||(u[l]={"@language":{},"@type":{},"@any":{}}),u=u[l],s(e,u[`@any`],`@none`),o.reverse)s(e,u[`@type`],`@reverse`);else if(o[`@type`]===`@none`)s(e,u[`@any`],`@none`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`);else if(`@type`in o)s(e,u[`@type`],o[`@type`]);else if(`@language`in o&&`@direction`in o){let t=o[`@language`],n=o[`@direction`];t&&n?s(e,u[`@language`],`${t}_${n}`.toLowerCase()):t?s(e,u[`@language`],t.toLowerCase()):n?s(e,u[`@language`],`_${n}`):s(e,u[`@language`],`@null`)}else `@language`in o?s(e,u[`@language`],(o[`@language`]||`@null`).toLowerCase()):`@direction`in o?o[`@direction`]?s(e,u[`@language`],`_${o[`@direction`]}`):s(e,u[`@language`],`@none`):a?(s(e,u[`@language`],`_${a}`),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`)):(s(e,u[`@language`],i),s(e,u[`@language`],`@none`),s(e,u[`@type`],`@none`))}}for(let e in n)o(n,e,1);return t}function o(e,t,n){let r=e[t],i=e[t]={},a,s;for(let e of r)a=e.iri,s=n>=a.length?``:a[n],s in i?i[s].push(e):i[s]=[e];for(let e in i)e!==``&&o(i,e,n+1)}function s(e,t,n){t.hasOwnProperty(n)||(t[n]=e)}function c(){let e={};return e.mappings=n.clone(this.mappings),e.clone=this.clone,e.inverse=null,e.getInverse=this.getInverse,e.protected=n.clone(this.protected),this.previousContext&&(e.previousContext=this.previousContext.clone()),e.revertToPreviousContext=this.revertToPreviousContext,`@base`in this&&(e[`@base`]=this[`@base`]),`@language`in this&&(e[`@language`]=this[`@language`]),`@vocab`in this&&(e[`@vocab`]=this[`@vocab`]),e}function l(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(e,t,n)=>{if(t===null)return n===`@context`?void 0:null;if(e.mappings.has(t)){let r=e.mappings.get(t);if(s(n))return r;if(r.hasOwnProperty(n))return r[n]}if(n===`@language`&&n in e||n===`@direction`&&n in e)return e[n];if(n!==`@context`)return null},v.processingMode=(e,t)=>t.toString()>=`1.1`?!e.processingMode||e.processingMode>=`json-ld-`+t.toString():e.processingMode===`json-ld-1.0`,v.isKeyword=e=>{if(!o(e)||e[0]!==`@`)return!1;switch(e){case`@base`:case`@container`:case`@context`:case`@default`:case`@direction`:case`@embed`:case`@explicit`:case`@graph`:case`@id`:case`@included`:case`@index`:case`@json`:case`@language`:case`@list`:case`@nest`:case`@none`:case`@omitDefault`:case`@prefix`:case`@preserve`:case`@protected`:case`@requireAll`:case`@reverse`:case`@set`:case`@type`:case`@value`:case`@version`:case`@vocab`:return!0}return!1};function b(e,t){if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return e===t;let n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(!b(e[n],t[n]))return!1;return!0}let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let n in e){let r=e[n],i=t[n];if(n===`@container`&&Array.isArray(r)&&Array.isArray(i)&&(r=r.slice().sort(),i=i.slice().sort()),!b(r,i))return!1}return!0}})),qn=o(((e,t)=>{var n=Mn(),{isArray:r,isObject:i,isEmptyObject:a,isString:o,isUndefined:s}=An(),{isList:c,isValue:l,isGraph:u,isSubject:d}=jn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=Kn(),{isAbsolute:_}=In(),{REGEX_BCP47:v,REGEX_KEYWORD:y,addValue:b,asArray:x,getValues:S,validateTypeValue:C}=Nn(),{handleEvent:w}=Gn(),T={};t.exports=T,T.expand=async({activeCtx:e,activeProperty:t=null,element:c,options:l={},insideList:u=!1,insideIndex:d=!1,typeScopedContext:m=null})=>{if(c==null)return null;if(t===`@default`&&(l=Object.assign({},l,{isFrame:!1})),!r(c)&&!i(c))return!u&&(t===null||f(e,t,{vocab:!0},l)===`@graph`)?(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`free-floating scalar`,level:`warning`,message:`Dropping free-floating scalar not in a list.`,details:{value:c}},options:l}),null):O({activeCtx:e,activeProperty:t,value:c,options:l});if(r(c)){let n=[],i=p(e,t,`@container`)||[];u||=i.includes(`@list`);for(let i=0;i<c.length;++i){let a=await T.expand({activeCtx:e,activeProperty:t,element:c[i],options:l,insideIndex:d,typeScopedContext:m});u&&r(a)&&(a={"@list":a}),a!==null&&(r(a)?n=n.concat(a):n.push(a))}return n}let v=f(e,t,{vocab:!0},l),y=p(e,t,`@context`);m||=e.previousContext?e:null;let b=Object.keys(c).sort(),C=!d;if(C&&m&&b.length<=2&&!b.includes(`@context`))for(let t of b){let n=f(m,t,{vocab:!0},l);if(n===`@value`){C=!1,e=m;break}if(n===`@id`&&b.length===1){C=!1;break}}C&&(e=e.revertToPreviousContext()),s(y)||(e=await h({activeCtx:e,localCtx:y,propagate:!0,overrideProtected:!0,options:l})),`@context`in c&&(e=await h({activeCtx:e,localCtx:c[`@context`],options:l})),m=e;let k=null;for(let t of b)if(f(e,t,{vocab:!0},l)===`@type`){k||=t;let n=c[t],r=Array.isArray(n)?n.length>1?n.slice().sort():n:[n];for(let t of r){let n=p(m,t,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,options:l,propagate:!1}))}}let A={};await D({activeCtx:e,activeProperty:t,expandedActiveProperty:v,element:c,expandedParent:A,options:l,insideList:u,typeKey:k,typeScopedContext:m}),b=Object.keys(A);let j=b.length;if(`@value`in A){if(`@type`in A&&(`@language`in A||`@direction`in A))throw new n(`Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let t=j-1;if(`@type`in A&&--t,`@index`in A&&--t,`@language`in A&&--t,`@direction`in A&&--t,t!==0)throw new n(`Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".`,`jsonld.SyntaxError`,{code:`invalid value object`,element:A});let r=A[`@value`]===null?[]:x(A[`@value`]),i=S(A,`@type`);if(!(g(e,1.1)&&i.includes(`@json`)&&i.length===1)){if(r.length===0)l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`null @value value`,level:`warning`,message:`Dropping null @value value.`,details:{value:A}},options:l}),A=null;else if(!r.every(e=>o(e)||a(e))&&`@language`in A)throw new n(`Invalid JSON-LD syntax; only strings may be language-tagged.`,`jsonld.SyntaxError`,{code:`invalid language-tagged value`,element:A});else if(!i.every(e=>_(e)&&!(o(e)&&e.indexOf(`_:`)===0)||a(e)))throw new n(`Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".`,`jsonld.SyntaxError`,{code:`invalid typed value`,element:A})}}else if(`@type`in A&&!r(A[`@type`]))A[`@type`]=[A[`@type`]];else if(`@set`in A||`@list`in A){if(j>1&&!(j===2&&`@index`in A))throw new n(`Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".`,`jsonld.SyntaxError`,{code:`invalid set or list object`,element:A});`@set`in A&&(A=A[`@set`],b=Object.keys(A),j=b.length)}else j===1&&`@language`in A&&(l.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`object with only @language`,level:`warning`,message:`Dropping object with only @language.`,details:{value:A}},options:l}),A=null);return i(A)&&!l.keepFreeFloatingNodes&&!u&&(t===null||v===`@graph`||(p(e,t,`@container`)||[]).includes(`@graph`))&&(A=E({value:A,count:j,options:l})),A};function E({value:e,count:t,options:n}){if(t===0||`@value`in e||`@list`in e||t===1&&`@id`in e){if(n.eventHandler){let r,i;t===0?(r=`empty object`,i=`Dropping empty object.`):`@value`in e?(r=`object with only @value`,i=`Dropping object with only @value.`):`@list`in e?(r=`object with only @list`,i=`Dropping object with only @list.`):t===1&&`@id`in e&&(r=`object with only @id`,i=`Dropping object with only @id.`),w({event:{type:[`JsonLdEvent`],code:r,level:`warning`,message:i,details:{value:e}},options:n})}return null}return e}async function D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:y,expandedParent:S,options:O={},insideList:j,typeKey:M,typeScopedContext:N}){let P=Object.keys(y).sort(),F=[],I,R=y[M]&&f(e,r(y[M])?y[M][0]:y[M],{vocab:!0},{...O,typeExpansion:!0})===`@json`;for(let D of P){let j=y[D],M;if(D===`@context`)continue;let P=f(e,D,{vocab:!0},O);if(P===null||!(_(P)||m(P))){O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid property`,level:`warning`,message:`Dropping property that did not expand into an absolute IRI or keyword.`,details:{property:D,expandedProperty:P}},options:O});continue}if(m(P)){if(u===`@reverse`)throw new n(`Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.`,`jsonld.SyntaxError`,{code:`invalid reverse property map`,value:j});if(P in S&&P!==`@included`&&P!==`@type`)throw new n(`Invalid JSON-LD syntax; colliding keywords detected.`,`jsonld.SyntaxError`,{code:`colliding keywords`,keyword:P})}if(P===`@id`){if(!o(j)){if(!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@id" value must a string.`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j});if(i(j)){if(!a(j))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else if(r(j)){if(!j.every(e=>o(e)))throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}else throw new n(`Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing`,`jsonld.SyntaxError`,{code:`invalid @id value`,value:j})}b(S,`@id`,x(j).map(t=>{if(o(t)){let n=f(e,t,{base:!0},O);return O.eventHandler&&(n===null?w(t===null?{event:{type:[`JsonLdEvent`],code:`null @id value`,level:`warning`,message:`Null @id found.`,details:{id:t}},options:O}:{event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:O}):_(n)||w({event:{type:[`JsonLdEvent`],code:`relative @id reference`,level:`warning`,message:`Relative @id reference found.`,details:{id:t,expandedId:n}},options:O})),n}return t}),{propertyIsArray:O.isFrame});continue}if(P===`@type`){i(j)&&(j=Object.fromEntries(Object.entries(j).map(([e,t])=>[f(N,e,{vocab:!0}),x(t).map(e=>f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0}))]))),C(j,O.isFrame),b(S,`@type`,x(j).map(e=>{if(o(e)){let t=f(N,e,{base:!0,vocab:!0},{...O,typeExpansion:!0});return t!==`@json`&&!_(t)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`relative @type reference`,level:`warning`,message:`Relative @type reference found.`,details:{type:e}},options:O}),t}return e}),{propertyIsArray:!!O.isFrame});continue}if(P===`@included`&&g(e,1.1)){let r=x(await T.expand({activeCtx:e,activeProperty:t,element:j,options:O}));if(!r.every(e=>d(e)))throw new n(`Invalid JSON-LD syntax; values of @included must expand to node objects.`,`jsonld.SyntaxError`,{code:`invalid @included value`,value:j});b(S,`@included`,r,{propertyIsArray:!0});continue}if(P===`@graph`&&!(i(j)||r(j)))throw new n(`Invalid JSON-LD syntax; "@graph" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid @graph value`,value:j});if(P===`@value`){I=j,R&&g(e,1.1)?S[`@value`]=j:b(S,`@value`,j,{propertyIsArray:O.isFrame});continue}if(P===`@language`){if(j===null)continue;if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@language" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid language-tagged string`,value:j});j=x(j).map(e=>o(e)?e.toLowerCase():e);for(let e of j)o(e)&&!e.match(v)&&O.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:O});b(S,`@language`,j,{propertyIsArray:O.isFrame});continue}if(P===`@direction`){if(!o(j)&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@direction" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});j=x(j);for(let e of j)if(o(e)&&e!==`ltr`&&e!==`rtl`)throw new n(`Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".`,`jsonld.SyntaxError`,{code:`invalid base direction`,value:j});b(S,`@direction`,j,{propertyIsArray:O.isFrame});continue}if(P===`@index`){if(!o(j))throw new n(`Invalid JSON-LD syntax; "@index" value must be a string.`,`jsonld.SyntaxError`,{code:`invalid @index value`,value:j});b(S,`@index`,j);continue}if(P===`@reverse`){if(!i(j))throw new n(`Invalid JSON-LD syntax; "@reverse" value must be an object.`,`jsonld.SyntaxError`,{code:`invalid @reverse value`,value:j});if(M=await T.expand({activeCtx:e,activeProperty:`@reverse`,element:j,options:O}),`@reverse`in M)for(let e in M[`@reverse`])b(S,e,M[`@reverse`][e],{propertyIsArray:!0});let t=S[`@reverse`]||null;for(let e in M){if(e===`@reverse`)continue;t===null&&(t=S[`@reverse`]={}),b(t,e,[],{propertyIsArray:!0});let r=M[e];for(let i=0;i<r.length;++i){let a=r[i];if(l(a)||c(a))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(t,e,a,{propertyIsArray:!0})}}continue}if(P===`@nest`){F.push(D);continue}let z=e,B=p(e,D,`@context`);s(B)||(z=await h({activeCtx:e,localCtx:B,propagate:!0,overrideProtected:!0,options:O}));let V=p(e,D,`@container`)||[];if(V.includes(`@language`)&&i(j)){let e=p(z,D,`@direction`);M=k(z,j,e,O)}else if(V.includes(`@index`)&&i(j)){let t=V.includes(`@graph`),n=p(z,D,`@index`)||`@index`,r=n!==`@index`&&f(e,n,{vocab:!0},O);M=await A({activeCtx:z,options:O,activeProperty:D,value:j,asGraph:t,indexKey:n,propertyIndex:r})}else if(V.includes(`@id`)&&i(j)){let e=V.includes(`@graph`);M=await A({activeCtx:z,options:O,activeProperty:D,value:j,asGraph:e,indexKey:`@id`})}else if(V.includes(`@type`)&&i(j))M=await A({activeCtx:z.revertToPreviousContext(),options:O,activeProperty:D,value:j,asGraph:!1,indexKey:`@type`});else{let n=P===`@list`;if(n||P===`@set`){let e=t;n&&u===`@graph`&&(e=null),M=await T.expand({activeCtx:z,activeProperty:e,element:j,options:O,insideList:n})}else M=p(e,D,`@type`)===`@json`?{"@type":`@json`,"@value":j}:await T.expand({activeCtx:z,activeProperty:D,element:j,options:O,insideList:!1})}if(!(M===null&&P!==`@value`)){if(P!==`@list`&&!c(M)&&V.includes(`@list`)&&(M={"@list":x(M)}),V.includes(`@graph`)&&!V.some(e=>e===`@id`||e===`@index`)){if(M=x(M),O.isFrame||(M=M.filter(e=>{let t=Object.keys(e).length;return E({value:e,count:t,options:O})!==null})),M.length===0)continue;M=M.map(e=>({"@graph":x(e)}))}if(z.mappings.has(D)&&z.mappings.get(D).reverse){let e=S[`@reverse`]=S[`@reverse`]||{};M=x(M);for(let t=0;t<M.length;++t){let r=M[t];if(l(r)||c(r))throw new n(`Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.`,`jsonld.SyntaxError`,{code:`invalid reverse property value`,value:M});b(e,P,r,{propertyIsArray:!0})}continue}b(S,P,M,{propertyIsArray:!0})}}if(`@value`in S&&!(S[`@type`]===`@json`&&g(e,1.1))&&(i(I)||r(I))&&!O.isFrame)throw new n(`Invalid JSON-LD syntax; "@value" value must not be an object or an array.`,`jsonld.SyntaxError`,{code:`invalid value object value`,value:I});for(let a of F){let o=r(y[a])?y[a]:[y[a]];for(let r of o){if(!i(r)||Object.keys(r).some(t=>f(e,t,{vocab:!0},O)===`@value`))throw new n(`Invalid JSON-LD syntax; nested value must be a node object.`,`jsonld.SyntaxError`,{code:`invalid @nest value`,value:r});await D({activeCtx:e,activeProperty:t,expandedActiveProperty:u,element:r,expandedParent:S,options:O,insideList:j,typeScopedContext:N,typeKey:M})}}}function O({activeCtx:e,activeProperty:t,value:n,options:r}){if(n==null)return null;let i=f(e,t,{vocab:!0},r);if(i===`@id`)return f(e,n,{base:!0},r);if(i===`@type`)return f(e,n,{vocab:!0,base:!0},{...r,typeExpansion:!0});let a=p(e,t,`@type`);if((a===`@id`||i===`@graph`)&&o(n)){let i=f(e,n,{base:!0},r);return i===null&&n.match(y)&&r.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`reserved @id value`,level:`warning`,message:`Reserved @id found.`,details:{id:t}},options:r}),{"@id":i}}if(a===`@vocab`&&o(n))return{"@id":f(e,n,{vocab:!0,base:!0},r)};if(m(i))return n;let s={};if(a&&![`@id`,`@vocab`,`@none`].includes(a))s[`@type`]=a;else if(o(n)){let n=p(e,t,`@language`);n!==null&&(s[`@language`]=n);let r=p(e,t,`@direction`);r!==null&&(s[`@direction`]=r)}return[`boolean`,`number`,`string`].includes(typeof n)||(n=n.toString()),s[`@value`]=n,s}function k(e,t,i,a){let s=[],c=Object.keys(t).sort();for(let l of c){let c=f(e,l,{vocab:!0},a),u=t[l];r(u)||(u=[u]);for(let e of u){if(e===null)continue;if(!o(e))throw new n(`Invalid JSON-LD syntax; language map values must be strings.`,`jsonld.SyntaxError`,{code:`invalid language map value`,languageMap:t});let r={"@value":e};c!==`@none`&&(l.match(v)||a.eventHandler&&w({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:l}},options:a}),r[`@language`]=l.toLowerCase()),i&&(r[`@direction`]=i),s.push(r)}}return s}async function A({activeCtx:e,options:t,activeProperty:i,value:a,asGraph:o,indexKey:c,propertyIndex:d}){let m=[],g=Object.keys(a).sort(),_=c===`@type`;for(let v of g){if(_){let n=p(e,v,`@context`);s(n)||(e=await h({activeCtx:e,localCtx:n,propagate:!1,options:t}))}let g=a[v];r(g)||(g=[g]),g=await T.expand({activeCtx:e,activeProperty:i,element:g,options:t,insideList:!1,insideIndex:!0});let y;y=d?v===`@none`?`@none`:O({activeCtx:e,activeProperty:c,value:v,options:t}):f(e,v,{vocab:!0},t),c===`@id`?v=f(e,v,{base:!0},t):_&&(v=y);for(let e of g){if(o&&!u(e)&&(e={"@graph":[e]}),c===`@type`)y===`@none`||(e[`@type`]?e[`@type`]=[v].concat(e[`@type`]):e[`@type`]=[v]);else if(l(e)&&![`@language`,`@type`,`@index`].includes(c))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${c}".`,`jsonld.SyntaxError`,{code:`invalid value object`,value:e});else d?y!==`@none`&&b(e,d,y,{propertyIsArray:!0,prependValue:!0}):y!==`@none`&&!(c in e)&&(e[c]=v);m.push(e)}}return m}})),Jn=o(((e,t)=>{var{isKeyword:n}=Kn(),r=jn(),i=An(),a=Nn(),o=Mn(),s={};t.exports=s,s.createMergedNodeMap=(e,t)=>{t||={};let n=t.issuer||new a.IdentifierIssuer(`_:b`),r={"@default":{}};return s.createNodeMap(e,r,`@default`,n),s.mergeNodeMaps(r)},s.createNodeMap=(e,t,c,l,u,d)=>{if(i.isArray(e)){for(let n of e)s.createNodeMap(n,t,c,l,void 0,d);return}if(!i.isObject(e)){d&&d.push(e);return}if(r.isValue(e)){if(`@type`in e){let t=e[`@type`];t.indexOf(`_:`)===0&&(e[`@type`]=t=l.getId(t))}d&&d.push(e);return}else if(d&&r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),d.push({"@list":n});return}if(`@type`in e){let t=e[`@type`];for(let e of t)e.indexOf(`_:`)===0&&l.getId(e)}i.isUndefined(u)&&(u=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`]),d&&d.push({"@id":u});let f=t[c],p=f[u]=f[u]||{};p[`@id`]=u;let m=Object.keys(e).sort();for(let i of m){if(i===`@id`)continue;if(i===`@reverse`){let n={"@id":u},i=e[`@reverse`];for(let e in i){let o=i[e];for(let i of o){let o=i[`@id`];r.isBlankNode(i)&&(o=l.getId(o)),s.createNodeMap(i,t,c,l,o),a.addValue(f[o],e,n,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(i===`@graph`){u in t||(t[u]={}),s.createNodeMap(e[i],t,u,l);continue}if(i===`@included`){s.createNodeMap(e[i],t,c,l);continue}if(i!==`@type`&&n(i)){if(i===`@index`&&i in p&&(e[i]!==p[i]||e[i][`@id`]!==p[i][`@id`]))throw new o(`Invalid JSON-LD syntax; conflicting @index property detected.`,`jsonld.SyntaxError`,{code:`conflicting indexes`,subject:p});p[i]=e[i];continue}let d=e[i];if(i.indexOf(`_:`)===0&&(i=l.getId(i)),d.length===0){a.addValue(p,i,[],{propertyIsArray:!0});continue}for(let e of d)if(i===`@type`&&(e=e.indexOf(`_:`)===0?l.getId(e):e),r.isSubject(e)||r.isSubjectReference(e)){if(`@id`in e&&!e[`@id`])continue;let n=r.isBlankNode(e)?l.getId(e[`@id`]):e[`@id`];a.addValue(p,i,{"@id":n},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(e,t,c,l,n)}else if(r.isValue(e))a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1});else if(r.isList(e)){let n=[];s.createNodeMap(e[`@list`],t,c,l,u,n),e={"@list":n},a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(e,t,c,l,u),a.addValue(p,i,e,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=e=>{let t={};for(let r of Object.keys(e).sort())for(let i of Object.keys(e[r]).sort()){let o=e[r][i];i in t||(t[i]={"@id":i});let s=t[i];for(let e of Object.keys(o).sort())if(n(e)&&e!==`@type`)s[e]=a.clone(o[e]);else for(let t of o[e])a.addValue(s,e,a.clone(t),{propertyIsArray:!0,allowDuplicate:!1})}return t},s.mergeNodeMaps=e=>{let t=e[`@default`],n=Object.keys(e).sort();for(let i of n){if(i===`@default`)continue;let n=e[i],a=t[i];a?`@graph`in a||(a[`@graph`]=[]):t[i]=a={"@id":i,"@graph":[]};let o=a[`@graph`];for(let e of Object.keys(n).sort()){let t=n[e];r.isSubjectReference(t)||o.push(t)}}return t}})),Yn=o(((e,t)=>{var{isSubjectReference:n}=jn(),{createMergedNodeMap:r}=Jn(),i={};t.exports=i,i.flatten=e=>{let t=r(e),i=[],a=Object.keys(t).sort();for(let e=0;e<a.length;++e){let r=t[a[e]];n(r)||i.push(r)}return i}})),Xn=o(((e,t)=>{var n=Mn(),r=jn(),i=An(),{REGEX_BCP47:a,addValue:o}=Nn(),{handleEvent:s}=Gn(),{RDF_LIST:c,RDF_FIRST:l,RDF_REST:u,RDF_NIL:d,RDF_TYPE:f,RDF_JSON_LITERAL:p,XSD_BOOLEAN:m,XSD_DOUBLE:h,XSD_INTEGER:g,XSD_STRING:_}=Pn(),v={};t.exports=v,v.fromRDF=async(e,t)=>{let{useRdfType:a=!1,useNativeTypes:s=!1,rdfDirection:p=null}=t,m={},h={"@default":m},g={};if(p){if(p===`compound-literal`)throw new n(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p});if(p!==`i18n-datatype`)throw new n(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:p})}for(let n of e){let e=n.graph.termType===`DefaultGraph`?`@default`:n.graph.value;e in h||(h[e]={}),e!==`@default`&&!(e in m)&&(m[e]={"@id":e});let r=h[e],i=b(n.subject),c=n.predicate.value,l=n.object;i in r||(r[i]={"@id":i});let u=r[i],_=b(l),v=!!_;if(v&&!(_ in r)&&(r[_]={"@id":_}),c===f&&!a&&v){o(u,`@type`,_,{propertyIsArray:!0});continue}let x=y(l,s,p,t);if(o(u,c,x,{propertyIsArray:!0}),v)if(_===d){let e=r[_];`usages`in e||(e.usages=[]),e.usages.push({node:u,property:c,value:x})}else _ in g?g[_]=!1:g[_]={node:u,property:c,value:x}}for(let e in h){let t=h[e];if(!(d in t))continue;let n=t[d];if(n.usages){for(let e of n.usages){let n=e.node,a=e.property,o=e.value,s=[],d=[],f=Object.keys(n).length;for(;a===u&&i.isObject(g[n[`@id`]])&&i.isArray(n[l])&&n[l].length===1&&i.isArray(n[u])&&n[u].length===1&&(f===3||f===4&&i.isArray(n[`@type`])&&n[`@type`].length===1&&n[`@type`][0]===c)&&(s.push(n[l][0]),d.push(n[`@id`]),e=g[n[`@id`]],n=e.node,a=e.property,o=e.value,f=Object.keys(n).length,r.isBlankNode(n)););delete o[`@id`],o[`@list`]=s.reverse();for(let e of d)delete t[e]}delete n.usages}}let _=[],v=Object.keys(m).sort();for(let e of v){let t=m[e];if(e in h){let n=t[`@graph`]=[],i=h[e],a=Object.keys(i).sort();for(let e of a){let t=i[e];r.isSubjectReference(t)||n.push(t)}}r.isSubjectReference(t)||_.push(t)}return _};function y(e,t,r,o){let c=b(e);if(c)return{"@id":c};let l={"@value":e.value};if(e.language)e.language.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e.language}},options:o}),l[`@language`]=e.language;else{let c=e.datatype.value;if(c||=_,c===p){c=`@json`;try{l[`@value`]=JSON.parse(l[`@value`])}catch(e){throw new n(`JSON literal could not be parsed.`,`jsonld.InvalidJsonLiteral`,{code:`invalid JSON literal`,value:l[`@value`],cause:e})}}if(t)if(c===m)l[`@value`]===`true`||l[`@value`]===`1`?l[`@value`]=!0:l[`@value`]===`false`||l[`@value`]===`0`?l[`@value`]=!1:l[`@type`]=c;else if(c===g)if(i.isNumeric(l[`@value`])){let e=parseInt(l[`@value`],10);e.toFixed(0)===l[`@value`]&&(l[`@value`]=e)}else l[`@type`]=c;else c===h&&i.isNumeric(l[`@value`])?l[`@value`]=parseFloat(l[`@value`]):l[`@type`]=c;else if(r===`i18n-datatype`&&c.startsWith(`https://www.w3.org/ns/i18n#`)){let[,e,t]=c.split(/[#_]/);e.length>0&&(l[`@language`]=e,e.match(a)||o.eventHandler&&s({event:{type:[`JsonLdEvent`],code:`invalid @language value`,level:`warning`,message:`@language value must be valid BCP47.`,details:{language:e}},options:o})),l[`@direction`]=t}else c!==_&&(l[`@type`]=c)}return l}function b(e){return e.termType===`NamedNode`?e.value:e.termType===`BlankNode`?`_:`+e.value:null}})),Zn=o(((e,t)=>{t.exports=function e(t){if(typeof t==`number`&&isNaN(t))throw Error(`NaN is not allowed`);if(typeof t==`number`&&!isFinite(t))throw Error(`Infinity is not allowed`);return typeof t!=`object`||!t?JSON.stringify(t):t.toJSON instanceof Function?e(t.toJSON()):Array.isArray(t)?`[${t.reduce((t,n,r)=>`${t}${r===0?``:`,`}${e(n===void 0||typeof n==`symbol`?null:n)}`,``)}]`:`{${Object.keys(t).sort().reduce((n,r)=>t[r]===void 0||typeof t[r]==`symbol`?n:`${n}${n.length===0?``:`,`}${e(r)}:${e(t[r])}`,``)}}`}})),Qn=o(((e,t)=>{var{createNodeMap:n}=Jn(),{isKeyword:r}=Kn(),i=jn(),a=Zn(),o=Mn(),s=An(),c=Nn(),{handleEvent:l}=Gn(),{RDF_FIRST:u,RDF_REST:d,RDF_NIL:f,RDF_TYPE:p,RDF_JSON_LITERAL:m,RDF_LANGSTRING:h,XSD_BOOLEAN:g,XSD_DOUBLE:_,XSD_INTEGER:v,XSD_STRING:y}=Pn(),{isAbsolute:b}=In(),x={};t.exports=x,x.toRDF=(e,t)=>{let r=new c.IdentifierIssuer(`_:b`),i={"@default":{}};n(e,i,`@default`,r);let a=[],o=Object.keys(i).sort();for(let e of o){let n;if(e===`@default`)n={termType:`DefaultGraph`,value:``};else if(b(e))n=T(e);else{t.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative graph reference`,level:`warning`,message:`Relative graph reference found.`,details:{graph:e}},options:t});continue}S(a,i[e],n,r,t)}return a};function S(e,t,n,i,a){let o=Object.keys(t).sort();for(let s of o){let o=t[s],c=Object.keys(o).sort();for(let t of c){let c=o[t];if(t===`@type`)t=p;else if(r(t))continue;for(let r of c){let o=T(s);if(!b(s)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative subject reference`,level:`warning`,message:`Relative subject reference found.`,details:{subject:s}},options:a});continue}let c=T(t);if(!b(t)){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative predicate reference`,level:`warning`,message:`Relative predicate reference found.`,details:{predicate:t}},options:a});continue}if(c.termType===`BlankNode`&&!a.produceGeneralizedRdf){a.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`blank node predicate`,level:`warning`,message:`Dropping blank node predicate.`,details:{property:i.getOldIds().find(e=>i.getId(e)===t)}},options:a});continue}let u=w(r,i,e,n,a.rdfDirection,a);u&&e.push({subject:o,predicate:c,object:u,graph:n})}}}}function C(e,t,n,r,i,a){let o={termType:`NamedNode`,value:u},s={termType:`NamedNode`,value:d},c={termType:`NamedNode`,value:f},l=e.pop(),p=l?{termType:`BlankNode`,value:t.getId().slice(2)}:c,m=p;for(let c of e){let e=w(c,t,n,r,i,a),l={termType:`BlankNode`,value:t.getId().slice(2)};n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:l,graph:r}),m=l}if(l){let e=w(l,t,n,r,i,a);n.push({subject:m,predicate:o,object:e,graph:r}),n.push({subject:m,predicate:s,object:c,graph:r})}return p}function w(e,t,n,r,c,u){let d;if(i.isValue(e)){d={termType:`Literal`,value:void 0,datatype:{termType:`NamedNode`}};let t=e[`@value`],n=e[`@type`]||null;if(n===`@json`)d.value=a(t),d.datatype.value=m;else if(s.isBoolean(t))d.value=t.toString(),d.datatype.value=n||g;else if(s.isDouble(t)||n===_)s.isDouble(t)||(t=parseFloat(t)),d.value=t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),d.datatype.value=n||_;else if(s.isNumber(t))d.value=t.toFixed(0),d.datatype.value=n||v;else if(`@direction`in e&&c===`i18n-datatype`){let n=`https://www.w3.org/ns/i18n#${(e[`@language`]||``).toLowerCase()}_${e[`@direction`]}`;d.datatype.value=n,d.value=t}else if(`@direction`in e&&c===`compound-literal`)throw new o(`Unsupported rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else if(`@direction`in e&&c)throw new o(`Unknown rdfDirection value.`,`jsonld.InvalidRdfDirection`,{value:c});else `@language`in e?(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||h,d.language=e[`@language`]):(`@direction`in e&&!c&&u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`rdfDirection not set`,level:`warning`,message:`rdfDirection not set for @direction.`,details:{object:d.value}},options:u}),d.value=t,d.datatype.value=n||y)}else if(i.isList(e)){let i=C(e[`@list`],t,n,r,c,u);d={termType:i.termType,value:i.value}}else d=T(s.isObject(e)?e[`@id`]:e);return d.termType===`NamedNode`&&!b(d.value)?(u.eventHandler&&l({event:{type:[`JsonLdEvent`],code:`relative object reference`,level:`warning`,message:`Relative object reference found.`,details:{object:d.value}},options:u}),null):d}function T(e){return e.startsWith(`_:`)?{termType:`BlankNode`,value:e.slice(2)}:{termType:`NamedNode`,value:e}}})),$n=o(((e,t)=>{var{isKeyword:n}=Kn(),r=jn(),i=An(),a=Nn(),o=In(),s=Mn(),{createNodeMap:c,mergeNodeMapGraphs:l}=Jn(),u={};t.exports=u,u.frameMergedOrDefault=(e,t,n)=>{let r={options:n,embedded:!1,graph:`@default`,graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},i=new a.IdentifierIssuer(`_:b`);c(e,r.graphMap,`@default`,i),n.merged&&(r.graphMap[`@merged`]=l(r.graphMap),r.graph=`@merged`),r.subjects=r.graphMap[r.graph];let o=[];return u.frame(r,Object.keys(r.subjects).sort(),t,o),n.pruneBlankNodeIdentifiers&&(n.bnodesToClear=Object.keys(r.bnodeMap).filter(e=>r.bnodeMap[e].length===1)),n.link={},v(o,n)},u.frame=(e,t,o,c,l=null)=>{m(o),o=o[0];let g=e.options,v={embed:p(o,g,`embed`),explicit:p(o,g,`explicit`),requireAll:p(o,g,`requireAll`)};e.link.hasOwnProperty(e.graph)||(e.link[e.graph]={});let b=e.link[e.graph],S=h(e,t,o,v),C=Object.keys(S).sort();for(let m of C){let h=S[m];if(l===null?e.uniqueEmbeds={[e.graph]:{}}:e.uniqueEmbeds[e.graph]=e.uniqueEmbeds[e.graph]||{},v.embed===`@link`&&m in b){y(c,l,b[m]);continue}let C={"@id":m};if(m.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,m,C,{propertyIsArray:!0}),b[m]=C,(v.embed===`@first`||v.embed===`@last`)&&e.is11)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:o});if(!(!e.embedded&&e.uniqueEmbeds[e.graph].hasOwnProperty(m))){if(e.embedded&&(v.embed===`@never`||f(h,e.graph,e.subjectStack))){y(c,l,C);continue}if(e.embedded&&(v.embed==`@first`||v.embed==`@once`)&&e.uniqueEmbeds[e.graph].hasOwnProperty(m)){y(c,l,C);continue}if(v.embed===`@last`&&m in e.uniqueEmbeds[e.graph]&&_(e,m),e.uniqueEmbeds[e.graph][m]={parent:c,property:l},e.subjectStack.push({subject:h,graph:e.graph}),m in e.graphMap){let t=!1,n=null;`@graph`in o?(n=o[`@graph`][0],t=!(m===`@merged`||m===`@default`),i.isObject(n)||(n={})):(t=e.graph!==`@merged`,n={}),t&&u.frame({...e,graph:m,embedded:!1},Object.keys(e.graphMap[m]).sort(),[n],C,`@graph`)}`@included`in o&&u.frame({...e,embedded:!1},t,o[`@included`],C,`@included`);for(let t of Object.keys(h).sort()){if(n(t)){if(C[t]=a.clone(h[t]),t===`@type`)for(let t of h[`@type`])t.indexOf(`_:`)===0&&a.addValue(e.bnodeMap,t,C,{propertyIsArray:!0});continue}if(!(v.explicit&&!(t in o)))for(let n of h[t]){let i=t in o?o[t]:d(v);if(r.isList(n)){let i=o[t]&&o[t][0]&&o[t][0][`@list`]?o[t][0][`@list`]:d(v),s={"@list":[]};y(C,t,s);let c=n[`@list`];for(let t of c)r.isSubjectReference(t)?u.frame({...e,embedded:!0},[t[`@id`]],i,s,`@list`):y(s,`@list`,a.clone(t))}else r.isSubjectReference(n)?u.frame({...e,embedded:!0},[n[`@id`]],i,C,t):x(i[0],n)&&y(C,t,a.clone(n))}}for(let e of Object.keys(o).sort()){if(e===`@type`){if(!i.isObject(o[e][0])||!(`@default`in o[e][0]))continue}else if(n(e))continue;let t=o[e][0]||{};if(!p(t,g,`omitDefault`)&&!(e in C)){let n=`@null`;`@default`in t&&(n=a.clone(t[`@default`])),i.isArray(n)||(n=[n]),C[e]=[{"@preserve":n}]}}for(let t of Object.keys(o[`@reverse`]||{}).sort()){let n=o[`@reverse`][t];for(let r of Object.keys(e.subjects))a.getValues(e.subjects[r],t).some(e=>e[`@id`]===m)&&(C[`@reverse`]=C[`@reverse`]||{},a.addValue(C[`@reverse`],t,[],{propertyIsArray:!0}),u.frame({...e,embedded:!0},[r],n,C[`@reverse`][t],l))}y(c,l,C),e.subjectStack.pop()}}},u.cleanupNull=(e,t)=>{if(i.isArray(e))return e.map(e=>u.cleanupNull(e,t)).filter(e=>e);if(e===`@null`)return null;if(i.isObject(e)){if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e)e[n]=u.cleanupNull(e[n],t)}return e};function d(e){let t={};for(let n in e)e[n]!==void 0&&(t[`@`+n]=[e[n]]);return[t]}function f(e,t,n){for(let r=n.length-1;r>=0;--r){let i=n[r];if(i.graph===t&&i.subject[`@id`]===e[`@id`])return!0}return!1}function p(e,t,n){let r=`@`+n,i=r in e?e[r][0]:t[n];if(n===`embed`){if(i===!0)i=`@once`;else if(i===!1)i=`@never`;else if(i!==`@always`&&i!==`@never`&&i!==`@link`&&i!==`@first`&&i!==`@last`&&i!==`@once`)throw new s(`Invalid JSON-LD syntax; invalid value of @embed.`,`jsonld.SyntaxError`,{code:`invalid @embed value`,frame:e})}return i}function m(e){if(!i.isArray(e)||e.length!==1||!i.isObject(e[0]))throw new s(`Invalid JSON-LD syntax; a JSON-LD frame must be a single object.`,`jsonld.SyntaxError`,{frame:e});if(`@id`in e[0]){for(let t of a.asArray(e[0][`@id`]))if(!(i.isObject(t)||o.isAbsolute(t))||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @id in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}if(`@type`in e[0]){for(let t of a.asArray(e[0][`@type`]))if(!(i.isObject(t)||o.isAbsolute(t)||t===`@json`)||i.isString(t)&&t.indexOf(`_:`)===0)throw new s(`Invalid JSON-LD syntax; invalid @type in frame.`,`jsonld.SyntaxError`,{code:`invalid frame`,frame:e})}}function h(e,t,n,r){let i={};for(let a of t){let t=e.graphMap[e.graph][a];g(e,t,n,r)&&(i[a]=t)}return i}function g(e,t,o,s){let c=!0,l=!1;for(let u in o){let d=!1,f=a.getValues(t,u),p=a.getValues(o,u).length===0;if(u===`@id`){if(i.isEmptyObject(o[`@id`][0]||{})?d=!0:o[`@id`].length>=0&&(d=o[`@id`].includes(f[0])),!s.requireAll)return d}else if(u===`@type`){if(c=!1,p){if(f.length>0)return!1;d=!0}else if(o[`@type`].length===1&&i.isEmptyObject(o[`@type`][0]))d=f.length>0;else for(let e of o[`@type`])i.isObject(e)&&`@default`in e?d=!0:d||=f.some(t=>t===e);if(!s.requireAll)return d}else if(n(u))continue;else{let t=a.getValues(o,u)[0],n=!1;if(t&&(m([t]),n=`@default`in t),c=!1,f.length===0&&n)continue;if(f.length>0&&p)return!1;if(t===void 0){if(f.length>0)return!1;d=!0}else if(r.isList(t)){let n=t[`@list`][0];if(r.isList(f[0])){let t=f[0][`@list`];r.isValue(n)?d=t.some(e=>x(n,e)):(r.isSubject(n)||r.isSubjectReference(n))&&(d=t.some(t=>b(e,n,t,s)))}}else d=r.isValue(t)?f.some(e=>x(t,e)):r.isSubjectReference(t)?f.some(n=>b(e,t,n,s)):i.isObject(t)?f.length>0:!1}if(!d&&s.requireAll)return!1;l||=d}return c||l}function _(e,t){let n=e.uniqueEmbeds[e.graph],r=n[t],o=r.parent,s=r.property,c={"@id":t};if(i.isArray(o)){for(let e=0;e<o.length;++e)if(a.compareValues(o[e],c)){o[e]=c;break}}else{let e=i.isArray(o[s]);a.removeValue(o,s,c,{propertyIsArray:e}),a.addValue(o,s,c,{propertyIsArray:e})}let l=e=>{let t=Object.keys(n);for(let r of t)r in n&&i.isObject(n[r].parent)&&n[r].parent[`@id`]===e&&(delete n[r],l(r))};l(t)}function v(e,t){if(i.isArray(e))return e.map(e=>v(e,t));if(i.isObject(e)){if(`@preserve`in e)return e[`@preserve`][0];if(r.isValue(e))return e;if(r.isList(e))return e[`@list`]=v(e[`@list`],t),e;if(`@id`in e){let n=e[`@id`];if(t.link.hasOwnProperty(n)){let r=t.link[n].indexOf(e);if(r!==-1)return t.link[n][r];t.link[n].push(e)}else t.link[n]=[e]}for(let n in e){if(n===`@id`&&t.bnodesToClear.includes(e[n])){delete e[`@id`];continue}e[n]=v(e[n],t)}}return e}function y(e,t,n){i.isObject(e)?a.addValue(e,t,n,{propertyIsArray:!0}):e.push(n)}function b(e,t,n,r){if(!(`@id`in n))return!1;let i=e.subjects[n[`@id`]];return i&&g(e,i,t,r)}function x(e,t){let n=t[`@value`],r=t[`@type`],a=t[`@language`],o=e[`@value`]?i.isArray(e[`@value`])?e[`@value`]:[e[`@value`]]:[],s=e[`@type`]?i.isArray(e[`@type`])?e[`@type`]:[e[`@type`]]:[],c=e[`@language`]?i.isArray(e[`@language`])?e[`@language`]:[e[`@language`]]:[];return o.length===0&&s.length===0&&c.length===0?!0:!(!(o.includes(n)||i.isEmptyObject(o[0]))||!(!r&&s.length===0||s.includes(r)||r&&i.isEmptyObject(s[0]))||!(!a&&c.length===0||c.includes(a)||a&&i.isEmptyObject(c[0])))}})),er=o(((e,t)=>{var n=Mn(),{isArray:r,isObject:i,isString:a,isUndefined:o}=An(),{isList:s,isValue:c,isGraph:l,isSimpleGraph:u,isSubjectReference:d}=jn(),{expandIri:f,getContextValue:p,isKeyword:m,process:h,processingMode:g}=Kn(),{removeBase:_,prependBase:v}=In(),{REGEX_KEYWORD:y,addValue:b,asArray:x,compareShortestLeast:S}=Nn(),C={};t.exports=C,C.compact=async({activeCtx:e,activeProperty:t=null,element:f,options:_={}})=>{if(r(f)){let n=[];for(let r=0;r<f.length;++r){let i=await C.compact({activeCtx:e,activeProperty:t,element:f[r],options:_});i!==null&&n.push(i)}return _.compactArrays&&n.length===1&&(p(e,t,`@container`)||[]).length===0&&(n=n[0]),n}let v=p(e,t,`@context`);if(o(v)||(e=await h({activeCtx:e,localCtx:v,propagate:!0,overrideProtected:!0,options:_})),i(f)){if(_.link&&`@id`in f&&_.link.hasOwnProperty(f[`@id`])){let e=_.link[f[`@id`]];for(let t=0;t<e.length;++t)if(e[t].expanded===f)return e[t].compacted}if(c(f)||d(f)){let n=C.compactValue({activeCtx:e,activeProperty:t,value:f,options:_});return _.link&&d(f)&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:n})),n}if(s(f)&&(p(e,t,`@container`)||[]).includes(`@list`))return C.compact({activeCtx:e,activeProperty:t,element:f[`@list`],options:_});let v=t===`@reverse`,y={},S=e;!c(f)&&!d(f)&&(e=e.revertToPreviousContext());let w=p(S,t,`@context`);o(w)||(e=await h({activeCtx:e,localCtx:w,propagate:!0,overrideProtected:!0,options:_})),_.link&&`@id`in f&&(_.link.hasOwnProperty(f[`@id`])||(_.link[f[`@id`]]=[]),_.link[f[`@id`]].push({expanded:f,compacted:y}));let E=f[`@type`]||[];E.length>1&&(E=Array.from(E).sort());let D=e;for(let t of E){let n=p(S,C.compactIri({activeCtx:D,iri:t,relativeTo:{vocab:!0}}),`@context`);o(n)||(e=await h({activeCtx:e,localCtx:n,options:_,propagate:!1}))}let O=Object.keys(f).sort();for(let o of O){let d=f[o];if(o===`@id`){let t=x(d).map(t=>C.compactIri({activeCtx:e,iri:t,relativeTo:{vocab:!1},base:_.base}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});y[n]=t;continue}if(o===`@type`){let t=x(d).map(e=>C.compactIri({activeCtx:S,iri:e,relativeTo:{vocab:!0}}));t.length===1&&(t=t[0]);let n=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),i=(p(e,n,`@container`)||[]).includes(`@set`)&&g(e,1.1)||r(t)&&d.length===0;b(y,n,t,{propertyIsArray:i});continue}if(o===`@reverse`){let t=await C.compact({activeCtx:e,activeProperty:`@reverse`,element:d,options:_});for(let n in t)if(e.mappings.has(n)&&e.mappings.get(n).reverse){let r=t[n];b(y,n,r,{propertyIsArray:(p(e,n,`@container`)||[]).includes(`@set`)||!_.compactArrays}),delete t[n]}Object.keys(t).length>0&&b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),t);continue}if(o===`@preserve`){let n=await C.compact({activeCtx:e,activeProperty:t,element:d,options:_});r(n)&&n.length===0||b(y,o,n);continue}if(o===`@index`){if((p(e,t,`@container`)||[]).includes(`@index`))continue;b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(o!==`@graph`&&o!==`@list`&&o!==`@included`&&m(o)){b(y,C.compactIri({activeCtx:e,iri:o,relativeTo:{vocab:!0}}),d);continue}if(!r(d))throw new n(`JSON-LD expansion error; expanded value must be an array.`,`jsonld.SyntaxError`);if(d.length===0){let t=C.compactIri({activeCtx:e,iri:o,value:d,relativeTo:{vocab:!0},reverse:v}),n=e.mappings.has(t)?e.mappings.get(t)[`@nest`]:null,r=y;n&&(T(e,n,_),i(y[n])||(y[n]={}),r=y[n]),b(r,t,d,{propertyIsArray:!0})}for(let t of d){let n=C.compactIri({activeCtx:e,iri:o,value:t,relativeTo:{vocab:!0},reverse:v}),d=e.mappings.has(n)?e.mappings.get(n)[`@nest`]:null,f=y;d&&(T(e,d,_),i(y[d])||(y[d]={}),f=y[d]);let m=p(e,n,`@container`)||[],h=l(t),g=s(t),S;g?S=t[`@list`]:h&&(S=t[`@graph`]);let w=await C.compact({activeCtx:e,activeProperty:n,element:g||h?S:t,options:_});if(g)if(r(w)||(w=[w]),!m.includes(`@list`))w={[C.compactIri({activeCtx:e,iri:`@list`,relativeTo:{vocab:!0}})]:w},`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]);else{b(f,n,w,{valueIsArray:!0,allowDuplicate:!0});continue}if(h)if(m.includes(`@graph`)&&(m.includes(`@id`)||m.includes(`@index`)&&u(t))){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i=(m.includes(`@id`)?t[`@id`]:t[`@index`])||C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}});b(r,i,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})}else m.includes(`@graph`)&&u(t)?(r(w)&&w.length>1&&(w={"@included":w}),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)})):(r(w)&&w.length===1&&_.compactArrays&&(w=w[0]),w={[C.compactIri({activeCtx:e,iri:`@graph`,relativeTo:{vocab:!0}})]:w},`@id`in t&&(w[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]=t[`@id`]),`@index`in t&&(w[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=t[`@index`]),b(f,n,w,{propertyIsArray:!_.compactArrays||m.includes(`@set`)}));else if(m.includes(`@language`)||m.includes(`@index`)||m.includes(`@id`)||m.includes(`@type`)){let r;f.hasOwnProperty(n)?r=f[n]:f[n]=r={};let i;if(m.includes(`@language`))c(w)&&(w=w[`@value`]),i=t[`@language`];else if(m.includes(`@index`)){let r=p(e,n,`@index`)||`@index`,o=C.compactIri({activeCtx:e,iri:r,relativeTo:{vocab:!0}});if(r===`@index`)i=t[`@index`],delete w[o];else{let e;if([i,...e]=x(w[r]||[]),!a(i))i=null;else switch(e.length){case 0:delete w[r];break;case 1:w[r]=e[0];break;default:w[r]=e;break}}}else if(m.includes(`@id`)){let t=C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}});i=w[t],delete w[t]}else if(m.includes(`@type`)){let r=C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}}),a;switch([i,...a]=x(w[r]||[]),a.length){case 0:delete w[r];break;case 1:w[r]=a[0];break;default:w[r]=a;break}Object.keys(w).length===1&&`@id`in t&&(w=await C.compact({activeCtx:e,activeProperty:n,element:{"@id":t[`@id`]},options:_}))}i||=C.compactIri({activeCtx:e,iri:`@none`,relativeTo:{vocab:!0}}),b(r,i,w,{propertyIsArray:m.includes(`@set`)})}else{let e=!_.compactArrays||m.includes(`@set`)||m.includes(`@list`)||r(w)&&w.length===0||o===`@list`||o===`@graph`;b(f,n,w,{propertyIsArray:e})}}}return y}return f},C.compactIri=({activeCtx:e,iri:t,value:r=null,relativeTo:a={vocab:!1},reverse:o=!1,base:u=null})=>{if(t===null)return t;e.isPropertyTermScoped&&e.previousContext&&(e=e.previousContext);let d=e.getInverse();if(m(t)&&t in d&&`@none`in d[t]&&`@type`in d[t][`@none`]&&`@none`in d[t][`@none`][`@type`])return d[t][`@none`][`@type`][`@none`];if(a.vocab&&t in d){let n=e[`@language`]||`@none`,a=[];i(r)&&`@index`in r&&!(`@graph`in r)&&a.push(`@index`,`@index@set`),i(r)&&`@preserve`in r&&(r=r[`@preserve`][0]),l(r)?(`@index`in r&&a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r&&a.push(`@graph@id`,`@graph@id@set`),a.push(`@graph`,`@graph@set`,`@set`),`@index`in r||a.push(`@graph@index`,`@graph@index@set`,`@index`,`@index@set`),`@id`in r||a.push(`@graph@id`,`@graph@id@set`)):i(r)&&!c(r)&&a.push(`@id`,`@id@set`,`@type`,`@set@type`);let u=`@language`,d=`@null`;if(o)u=`@type`,d=`@reverse`,a.push(`@set`);else if(s(r)){`@index`in r||a.push(`@list`);let e=r[`@list`];if(e.length===0)u=`@any`,d=`@none`;else{let t=e.length===0?n:null,r=null;for(let n=0;n<e.length;++n){let i=e[n],a=`@none`,o=`@none`;if(c(i)?`@direction`in i?a=`${(i[`@language`]||``).toLowerCase()}_${i[`@direction`]}`:`@language`in i?a=i[`@language`].toLowerCase():`@type`in i?o=i[`@type`]:a=`@null`:o=`@id`,t===null?t=a:a!==t&&c(i)&&(t=`@none`),r===null?r=o:o!==r&&(r=`@none`),t===`@none`&&r===`@none`)break}t||=`@none`,r||=`@none`,r===`@none`?d=t:(u=`@type`,d=r)}}else{if(c(r))if(`@language`in r&&!(`@index`in r)){a.push(`@language`,`@language@set`),d=r[`@language`];let e=r[`@direction`];e&&(d=`${d}_${e}`)}else `@direction`in r&&!(`@index`in r)?d=`_${r[`@direction`]}`:`@type`in r&&(u=`@type`,d=r[`@type`]);else u=`@type`,d=`@id`;a.push(`@set`)}a.push(`@none`),i(r)&&!(`@index`in r)&&a.push(`@index`,`@index@set`),c(r)&&Object.keys(r).length===1&&a.push(`@language`,`@language@set`);let f=w(e,t,r,a,u,d);if(f!==null)return f}if(a.vocab&&`@vocab`in e){let n=e[`@vocab`];if(t.indexOf(n)===0&&t!==n){let r=t.substr(n.length);if(!e.mappings.has(r))return r}}let f=null,p=[],h=e.fastCurieMap,g=t.length-1;for(let e=0;e<g&&t[e]in h;++e)h=h[t[e]],``in h&&p.push(h[``][0]);for(let n=p.length-1;n>=0;--n){let i=p[n],a=i.terms;for(let n of a){let a=n+`:`+t.substr(i.iri.length);e.mappings.get(n)._prefix&&(!e.mappings.has(a)||r===null&&e.mappings.get(a)[`@id`]===t)&&(f===null||S(a,f)<0)&&(f=a)}}if(f!==null)return f;for(let[r,i]of e.mappings)if(i&&i._prefix&&t.startsWith(r+`:`))throw new n(`Absolute IRI "${t}" confused with prefix "${r}".`,`jsonld.SyntaxError`,{code:`IRI confused with prefix`,context:e});if(!a.vocab)if(`@base`in e)if(e[`@base`]){let n=_(v(u,e[`@base`]),t);return y.test(n)?`./${n}`:n}else return t;else return _(u,t);return t},C.compactValue=({activeCtx:e,activeProperty:t,value:n,options:r})=>{if(c(n)){let r=p(e,t,`@type`),i=p(e,t,`@language`),o=p(e,t,`@direction`),s=p(e,t,`@container`)||[],c=`@index`in n&&!s.includes(`@index`);if(!c&&r!==`@none`&&(n[`@type`]===r||`@language`in n&&n[`@language`]===i&&`@direction`in n&&n[`@direction`]===o||`@language`in n&&n[`@language`]===i||`@direction`in n&&n[`@direction`]===o))return n[`@value`];let l=Object.keys(n).length,u=l===1||l===2&&`@index`in n&&!c,d=`@language`in e,f=a(n[`@value`]),m=e.mappings.has(t)&&e.mappings.get(t)[`@language`]===null;if(u&&r!==`@none`&&(!d||!f||m))return n[`@value`];let h={};return c&&(h[C.compactIri({activeCtx:e,iri:`@index`,relativeTo:{vocab:!0}})]=n[`@index`]),`@type`in n?h[C.compactIri({activeCtx:e,iri:`@type`,relativeTo:{vocab:!0}})]=C.compactIri({activeCtx:e,iri:n[`@type`],relativeTo:{vocab:!0}}):`@language`in n&&(h[C.compactIri({activeCtx:e,iri:`@language`,relativeTo:{vocab:!0}})]=n[`@language`]),`@direction`in n&&(h[C.compactIri({activeCtx:e,iri:`@direction`,relativeTo:{vocab:!0}})]=n[`@direction`]),h[C.compactIri({activeCtx:e,iri:`@value`,relativeTo:{vocab:!0}})]=n[`@value`],h}let i=f(e,t,{vocab:!0},r),o=p(e,t,`@type`),s=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:o===`@vocab`},base:r.base});return o===`@id`||o===`@vocab`||i===`@graph`?s:{[C.compactIri({activeCtx:e,iri:`@id`,relativeTo:{vocab:!0}})]:s}};function w(e,t,n,r,a,o){o===null&&(o=`@null`);let s=[];if((o===`@id`||o===`@reverse`)&&i(n)&&`@id`in n){o===`@reverse`&&s.push(`@reverse`);let t=C.compactIri({activeCtx:e,iri:n[`@id`],relativeTo:{vocab:!0}});e.mappings.has(t)&&e.mappings.get(t)&&e.mappings.get(t)[`@id`]===n[`@id`]?s.push.apply(s,[`@vocab`,`@id`]):s.push.apply(s,[`@id`,`@vocab`])}else{s.push(o);let e=s.find(e=>e.includes(`_`));e&&s.push(e.replace(/^[^_]+_/,`_`))}s.push(`@none`);let c=e.inverse[t];for(let e of r){if(!(e in c))continue;let t=c[e][a];for(let e of s)if(e in t)return t[e]}return null}function T(e,t,r){if(f(e,t,{vocab:!0},r)!==`@nest`)throw new n(`JSON-LD compact error; nested property must have an @nest value resolving to @nest.`,`jsonld.SyntaxError`,{code:`invalid @nest value`})}})),tr=o(((e,t)=>{t.exports=e=>{class t{toString(){return`[object JsonLdProcessor]`}}return Object.defineProperty(t,`prototype`,{writable:!1,enumerable:!1}),Object.defineProperty(t.prototype,`constructor`,{writable:!0,enumerable:!1,configurable:!0,value:t}),t.compact=function(t,n){return arguments.length<2?Promise.reject(TypeError(`Could not compact, too few arguments.`)):e.compact(t,n)},t.expand=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not expand, too few arguments.`)):e.expand(t)},t.flatten=function(t){return arguments.length<1?Promise.reject(TypeError(`Could not flatten, too few arguments.`)):e.flatten(t)},t}})),nr=o(((e,t)=>{var n=kn(),r=Rn(),i=Nn(),a=Un(),o=i.IdentifierIssuer,s=Mn(),c=Vn(),l=Wn(),{expand:u}=qn(),{flatten:d}=Yn(),{fromRDF:f}=Xn(),{toRDF:p}=Qn(),{frameMergedOrDefault:m,cleanupNull:h}=$n(),{isArray:g,isObject:_,isString:v}=An(),{isSubjectReference:y}=jn(),{expandIri:b,getInitialContext:x,process:S,processingMode:C}=Kn(),{compact:w,compactIri:T}=er(),{createNodeMap:E,createMergedNodeMap:D,mergeNodeMaps:O}=Jn(),{logEventHandler:k,logWarningEventHandler:A,safeEventHandler:j,setDefaultEventHandler:M,setupEventHandler:N,strictEventHandler:P,unhandledEventHandler:F}=Gn(),I=function(e){let t={},I=new c({max:100});e.compact=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not compact, too few arguments.`);if(n===null)throw new s(`The compaction context must not be null.`,`jsonld.CompactError`,{code:`invalid local context`});if(t===null)return null;r=R(r,{base:v(t)?t:``,compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new o(`_:b`),contextResolver:new a({sharedCache:I})}),r.link&&(r.skipExpansion=!0),r.compactToRelative||delete r.base;let c;c=r.skipExpansion?t:await e.expand(t,r);let l=await e.processContext(x(r),n,r),u=await w({activeCtx:l,element:c,options:r});r.compactArrays&&!r.graph&&g(u)?u.length===1?u=u[0]:u.length===0&&(u={}):r.graph&&_(u)&&(u=[u]),_(n)&&`@context`in n&&(n=n[`@context`]),n=i.clone(n),g(n)||(n=[n]);let d=n;n=[];for(let e=0;e<d.length;++e)(!_(d[e])||Object.keys(d[e]).length>0)&&n.push(d[e]);let f=n.length>0;if(n.length===1&&(n=n[0]),g(u)){let e=T({activeCtx:l,iri:`@graph`,relativeTo:{vocab:!0}}),t=u;u={},f&&(u[`@context`]=n),u[e]=t}else if(_(u)&&f){let e=u;u={"@context":n};for(let t in e)u[t]=e[t]}return u},e.expand=async function(t,n){if(arguments.length<1)throw TypeError(`Could not expand, too few arguments.`);n=R(n,{keepFreeFloatingNodes:!1,contextResolver:new a({sharedCache:I})});let r={},o=[];if(`expandContext`in n){let e=i.clone(n.expandContext);_(e)&&`@context`in e?r.expandContext=e:r.expandContext={"@context":e},o.push(r.expandContext)}let s;if(!v(t))r.input=i.clone(t);else{let i=await e.get(t,n);s=i.documentUrl,r.input=i.document,i.contextUrl&&(r.remoteContext={"@context":i.contextUrl},o.push(r.remoteContext))}`base`in n||(n.base=s||``);let c=x(n);for(let e of o)c=await S({activeCtx:c,localCtx:e,options:n});let l=await u({activeCtx:c,element:r.input,options:n});return _(l)&&`@graph`in l&&Object.keys(l).length===1?l=l[`@graph`]:l===null&&(l=[]),g(l)||(l=[l]),l},e.flatten=async function(t,n,r){if(arguments.length<1)return TypeError(`Could not flatten, too few arguments.`);typeof n==`function`?n=null:n||=null,r=R(r,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})});let i=d(await e.expand(t,r));return n===null?i:(r.graph=!0,r.skipExpansion=!0,await e.compact(i,n,r))},e.frame=async function(t,n,r){if(arguments.length<2)throw TypeError(`Could not frame, too few arguments.`);if(r=R(r,{base:v(t)?t:``,embed:`@once`,explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new a({sharedCache:I})}),v(n)){let t=await e.get(n,r);if(n=t.document,t.contextUrl){let e=n[`@context`];e?g(e)?e.push(t.contextUrl):e=[e,t.contextUrl]:e=t.contextUrl,n[`@context`]=e}}let i=n&&n[`@context`]||{},o=await e.processContext(x(r),i,r);r.hasOwnProperty(`omitGraph`)||(r.omitGraph=C(o,1.1)),r.hasOwnProperty(`pruneBlankNodeIdentifiers`)||(r.pruneBlankNodeIdentifiers=C(o,1.1));let s=await e.expand(t,r),c={...r};c.isFrame=!0,c.keepFreeFloatingNodes=!0;let l=await e.expand(n,c);c.merged=!Object.keys(n).map(e=>b(o,e,{vocab:!0})).includes(`@graph`),c.is11=C(o,1.1);let u=m(s,l,c);c.graph=!r.omitGraph,c.skipExpansion=!0,c.link={},c.framing=!0;let d=await e.compact(u,i,c);return c.link={},d=h(d,c),d},e.link=async function(t,n,r){let i={};return n&&(i[`@context`]=n),i[`@embed`]=`@link`,e.frame(t,i,r)},e.normalize=e.canonize=async function(t,r){if(arguments.length<1)throw TypeError(`Could not canonize, too few arguments.`);r=R(r,{skipExpansion:!1,safe:!0,contextResolver:new a({sharedCache:I})});let i=Object.assign({},{algorithm:`RDFC-1.0`},r.canonizeOptions||null);if(`inputFormat`in r){if(r.inputFormat!==`application/n-quads`)throw new s(`Unknown canonicalization input format.`,`jsonld.CanonizeError`);let e=l.parse(t);return n.canonize(e,i)}let o={...r};delete o.format,delete o.canonizeOptions,o.produceGeneralizedRdf=!1;let c=await e.toRDF(t,o);return n.canonize(c,i)},e.fromRDF=async function(e,n){if(arguments.length<1)throw TypeError(`Could not convert from RDF, too few arguments.`);n=R(n,{format:v(e)?`application/n-quads`:void 0});let{format:r}=n,{rdfParser:i}=n;if(r){if(i||=t[r],!i)throw new s(`Unknown input format.`,`jsonld.UnknownFormat`,{format:r})}else i=()=>e;return f(await i(e),n)},e.toRDF=async function(t,n){if(arguments.length<1)throw TypeError(`Could not convert to RDF, too few arguments.`);n=R(n,{skipExpansion:!1,contextResolver:new a({sharedCache:I})});let r;r=n.skipExpansion?t:await e.expand(t,n);let i=p(r,n);if(n.format){if(n.format===`application/n-quads`)return l.serialize(i);throw new s(`Unknown output format.`,`jsonld.UnknownFormat`,{format:n.format})}return i},e.createNodeMap=async function(t,n){if(arguments.length<1)throw TypeError(`Could not create node map, too few arguments.`);return n=R(n,{base:v(t)?t:``,contextResolver:new a({sharedCache:I})}),D(await e.expand(t,n),n)},e.merge=async function(t,n,r){if(arguments.length<1)throw TypeError(`Could not merge, too few arguments.`);if(!g(t))throw TypeError(`Could not merge, "docs" must be an array.`);typeof n==`function`?n=null:n||=null,r=R(r,{contextResolver:new a({sharedCache:I})});let s=await Promise.all(t.map(t=>{let n={...r};return e.expand(t,n)})),c=!0;`mergeNodes`in r&&(c=r.mergeNodes);let l=r.issuer||new o(`_:b`),u={"@default":{}};for(let e=0;e<s.length;++e){let t=i.relabelBlankNodes(s[e],{issuer:new o(`_:b`+e+`-`)}),n=c||e===0?u:{"@default":{}};if(E(t,n,`@default`,l),n!==u)for(let e in n){let t=n[e];if(!(e in u)){u[e]=t;continue}let r=u[e];for(let e in t)e in r||(r[e]=t[e])}}let d=O(u),f=[],p=Object.keys(d).sort();for(let e=0;e<p.length;++e){let t=d[p[e]];y(t)||f.push(t)}return n===null?f:(r.graph=!0,r.skipExpansion=!0,await e.compact(f,n,r))},Object.defineProperty(e,`documentLoader`,{get:()=>e._documentLoader,set:t=>e._documentLoader=t}),e.documentLoader=async e=>{throw new s(`Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,url:e})},e.get=async function(t,n){let r;r=typeof n.documentLoader==`function`?n.documentLoader:e.documentLoader;let i=await r(t);try{if(!i.document)throw new s(`No remote document found at the given URL.`,`jsonld.NullRemoteDocument`);v(i.document)&&(i.document=JSON.parse(i.document))}catch(e){throw new s(`Could not retrieve a JSON-LD document from the URL.`,`jsonld.LoadDocumentError`,{code:`loading document failed`,cause:e,remoteDoc:i})}return i},e.processContext=async function(e,t,n){return n=R(n,{base:``,contextResolver:new a({sharedCache:I})}),t===null?x(n):(t=i.clone(t),_(t)&&`@context`in t||(t={"@context":t}),S({activeCtx:e,localCtx:t,options:n}))},e.getContextValue=Kn().getContextValue,e.documentLoaders={},e.useDocumentLoader=function(t){if(!(t in e.documentLoaders))throw new s(`Unknown document loader type: "`+t+`"`,`jsonld.UnknownDocumentLoader`,{type:t});e.documentLoader=e.documentLoaders[t].apply(e,Array.prototype.slice.call(arguments,1))},e.registerRDFParser=function(e,n){t[e]=n},e.unregisterRDFParser=function(e){delete t[e]},e.registerRDFParser(`application/n-quads`,l.parse),e.url=In(),e.logEventHandler=k,e.logWarningEventHandler=A,e.safeEventHandler=j,e.setDefaultEventHandler=M,e.strictEventHandler=P,e.unhandledEventHandler=F,e.util=i,Object.assign(e,i),e.promises=e,e.RequestQueue=Fn(),e.JsonLdProcessor=tr()(e),r.setupGlobals(e),r.setupDocumentLoaders(e);function R(t,{documentLoader:n=e.documentLoader,...r}){if(t&&`compactionMap`in t)throw new s(`"compactionMap" not supported.`,`jsonld.OptionsError`);if(t&&`expansionMap`in t)throw new s(`"expansionMap" not supported.`,`jsonld.OptionsError`);return Object.assign({},{documentLoader:n},r,t,{eventHandler:N({options:t})})}return e},R=function(){return I(function(){return R()})};I(R),t.exports=R})),rr=yn(),ir=l(nr(),1),ar={},or={};function sr(e){let t=new Set;for(let n of e.getQuads(null,K,null,yt))n.subject.termType===`NamedNode`&&t.add(n.subject.value);if(t.size===1)return t.values().next().value}function cr(e,t){let n=k.namedNode(t);for(let t of e.getObjects(n,K,yt))if(t.termType===`NamedNode`&&e.getQuads(t,bt,Et,null).length>0)return t}async function lr(e){let t={store:new st,importedUrls:[],atts:e},n=[];if(e.shapes?n.push(ur(fr(e.shapes),t,vt)):e.shapesUrl&&n.push(ur(dr(e.shapesUrl,t.atts.proxy),t,vt)),e.values?n.push(ur(fr(e.values),t,yt)):e.valuesUrl&&n.push(ur(dr(e.valuesUrl,t.atts.proxy),t,yt)),await Promise.all(n),e.classInstanceProvider)try{let n=Qt(t.store),r=await e.classInstanceProvider(n);r&&await ur(fr(r),t,vt)}catch(e){console.error(`failed loading class instances`,e)}if(e.valuesSubject||=sr(t.store)||null,e.valuesSubject&&t.store.countQuads(null,null,null,vt)===0){let n=[...t.store.getObjects(e.valuesSubject,bt,yt),...t.store.getObjects(e.valuesSubject,K,yt)],r=[];for(let e of n){let n=pr(e.value);!n&&e.value.startsWith(`urn:`)&&t.atts.proxy&&(n=e.value),n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),r.push(ur(dr(n,t.atts.proxy),t,vt)))}try{await Promise.allSettled(r)}catch(e){console.warn(e)}}return t.store}async function ur(e,t,n){let r=await e,i=[];for(let e of r){let r=n;if(t.atts.valuesSubject&&yt.equals(n)&&e.graph.id&&e.graph.id!==t.atts.valuesSubject&&(r=e.graph),t.store.add(k.quad(e.subject,e.predicate,e.object,r)),t.atts.loadOwlImports&&Ct.equals(e.predicate)){let n=pr(e.object.value);n&&t.importedUrls.indexOf(n)<0&&(t.importedUrls.push(n),i.push(ur(dr(n,t.atts.proxy),t,k.namedNode(n))))}}await Promise.allSettled(i)}async function dr(e,t){return e in ar||(ar[e]=(async()=>{let n=e;t&&(n=t+encodeURIComponent(e));let r=await fetch(n,{headers:{Accept:`text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json`}});return r.ok?fr(await r.text()):(console.warn(`failed fetching RDF from`,e),[])})()),ar[e]}async function fr(e){if(!e.trim())return[];let t=mr(e);if(t===`json`)try{e=await ir.default.toRDF(JSON.parse(e),{format:`application/n-quads`})}catch(e){console.error(e)}let n=[];return await new Promise((r,i)=>{let a=t===`xml`?new rr.RdfXmlParser:new ut;a.on(`data`,e=>{n.push(k.quad(e.subject,e.predicate,e.object,e.graph))}).on(`error`,e=>{i(e)}).on(`prefix`,(e,t)=>{e&&(or[e]=t)}).on(`end`,()=>{r(null)}),a.write(e),a.end()}),n}function pr(e){if(Ut(e))return e;let t=e.split(`:`);if(t.length===2){let n=or[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),Ut(e)))return e}return null}function mr(e){return/^\s*[\\[{]/.test(e)?`json`:/^\s*<\?xml/.test(e)?`xml`:`ttl`}var hr={[`${W}name`]:(e,t)=>{let n=t;e.name=q(e.config.languages,e.name,n)},[`${W}description`]:(e,t)=>{let n=t;e.description=q(e.config.languages,e.description,n)},[`${W}path`]:(e,t)=>{e.path=t.value},[`${W}group`]:(e,t)=>{e.group=t.id},[`${W}datatype`]:(e,t)=>{e.datatype=t},[`${W}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${W}minCount`]:(e,t)=>{e.minCount=parseInt(t.value)},[`${W}maxCount`]:(e,t)=>{e.maxCount=parseInt(t.value)},[`${W}minLength`]:(e,t)=>{e.minLength=parseInt(t.value)},[`${W}maxLength`]:(e,t)=>{e.maxLength=parseInt(t.value)},[`${W}minInclusive`]:(e,t)=>{e.minInclusive=parseInt(t.value)},[`${W}maxInclusive`]:(e,t)=>{e.maxInclusive=parseInt(t.value)},[`${W}minExclusive`]:(e,t)=>{e.minExclusive=parseInt(t.value)},[`${W}maxExclusive`]:(e,t)=>{e.maxExclusive=parseInt(t.value)},[`${W}pattern`]:(e,t)=>{e.pattern=t.value},[`${W}order`]:(e,t)=>{e.order=parseInt(t.value)},[`${dt}singleLine`]:(e,t)=>{e.singleLine=t.value===`true`},[`${dt}readonly`]:(e,t)=>{e.readonly=t.value===`true`},[`${G}styleClass`]:(e,t)=>{e.cssClass=t.value},[`${W}in`]:(e,t)=>{e.in=t.value},[`${W}languageIn`]:(e,t)=>{e.languageIn=e.config.lists[t.value],e.datatype=xt},[`${W}defaultValue`]:(e,t)=>{e.defaultValue=t},[`${W}hasValue`]:(e,t)=>{e.hasValue=t},[`${W}node`]:(e,t)=>{e.node=t,e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${W}and`]:(e,t)=>{e.and=t.value;let n=e.config.lists[e.and];if(n?.length)for(let t of n)e.nodeShapes.add(e.config.getNodeTemplate(t,e))},[`${W}qualifiedValueShape`]:(e,t)=>{let n=e.config.getNodeTemplate(t,e);e.qualifiedValueShape=n,e.nodeShapes.add(n)},[`${W}qualifiedMinCount`]:(e,t)=>{e.qualifiedMinCount=parseInt(t.value)},[`${W}qualifiedMaxCount`]:(e,t)=>{e.qualifiedMaxCount=parseInt(t.value)},[Ct.id]:(e,t)=>{e.owlImports.add(t)},[kt.id]:(e,t)=>{e.class=t;let n=e.config.store.getSubjects(jt,t,null);n.length>0&&(e.node=n[0])},[`${W}or`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.or=n:console.error(`list for sh:or not found:`,t.value,`existing lists:`,e.config.lists)},[`${W}xone`]:(e,t)=>{let n=e.config.lists[t.value];n?.length?e.xone=n:console.error(`list for sh:xone not found:`,t.value,`existing lists:`,e.config.lists)}},gr=class{constructor(e,t){this.label=``,this.nodeShapes=new Set,this.owlImports=new Set,this.id=e,this.parent=t,this.config=t.config,this.config.registerPropertyTemplate(this),br(this,this.config.store.getQuads(e,null,null,null))}};function _r(e){return Math.max(e.minCount??0,e.qualifiedMinCount??0)}function vr(e){return Math.min(e.maxCount??2**53-1,e.qualifiedMaxCount??2**53-1)}function yr(e){let t=Object.assign({},e);return t.nodeShapes=new Set(e.nodeShapes),t.owlImports=new Set(e.owlImports),e.languageIn&&(t.languageIn=[...e.languageIn]),e.or&&(t.or=[...e.or]),e.xone&&(t.xone=[...e.xone]),t}function br(e,t){for(let n of t)hr[n.predicate.id]?.call(e,e,n.object);return e.label=e.name?.value||Rt(t,e.config.languages),e.label||=e.path?Bt(e.path,or):`unknown`,e}function xr(e,t){let n=t,r=e;for(let e in t)if(e!==`parent`&&e!==`config`&&e!==`id`){let t=n[e];if(t!==void 0&&t!==``)if(Array.isArray(t)){let n=r[e];Array.isArray(n)?n.push(...t):r[e]=[...t]}else if(t instanceof Set&&t.size){let n=r[e];r[e]=new Set([...n instanceof Set?n:[],...t])}else r[e]=t}}function Sr(e,t,n){let r=document.createElement(`div`);r.classList.add(`shacl-or-constraint`),r.setAttribute(`part`,`constraint`);let i=[];if(t instanceof xs){let a=[],o=!1;e.length&&(o=n.store.countQuads(e[0],Ot,null,null)>0);for(let r=0;r<e.length;r++)if(o){let o=n.store.getObjects(e[r],Ot,null),s=[],c=``;for(let e of o){let r=new rs(n.getPropertyTemplate(e,t.template),t);s.push(r),c+=(c.length>0?` / `:``)+r.template.label}a.push(s),i.push({label:c,value:r.toString()})}else{let o=e[r],s=new rs(n.getPropertyTemplate(o,t.template),t);a.push([s]),i.push({label:s.template.label,value:r.toString()})}let s=n.theme.createListEditor(`Please choose`,null,!1,i);s.setAttribute(`part`,`constraint-editor`);let c=s.querySelector(`.editor`);c.onchange=async()=>{if(c.value){let e=a[parseInt(c.value)],n;if(e.length){for(let n of e)await n.bindValues(t.nodeId,!1);n=e[0],r.replaceWith(e[0]),n.updateControls()}for(let t=1;t<e.length;t++)n.after(e[t]),n=e[t],n.updateControls()}},r.appendChild(s)}else{let a=[];for(let t=0;t<e.length;t++){let r=n.store.getQuads(e[t],null,null,null);if(r.length){a.push(r);let e=Rt(r,n.languages);for(let t of r)t.predicate.equals(At)&&(e=Rt(n.store.getQuads(t.object,null,null,null),n.languages));i.push({label:e||Bt(r[0].predicate.value,or)+` = `+Bt(r[0].object.value,or),value:t.toString()})}}let o=n.theme.createListEditor(t.template.label+`?`,null,!1,i,t.template);o.setAttribute(`part`,`constraint-editor`);let s=o.querySelector(`.editor`);s.onchange=async()=>{if(s.value){let e=await is(br(yr(t.template),a[parseInt(s.value)]),void 0,!0),n=e.querySelector(`:scope > label`);n&&n.classList.add(`persistent`),r.replaceWith(e)}},r.appendChild(o)}return r}function Cr(e,t,n){if(t.termType===`Literal`){let r=t.datatype;for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(t.predicate.value===`http://www.w3.org/ns/shacl#datatype`&&t.object.equals(r))return e}}else{let r=n.store.getObjects(t,bt,null);for(let t of e){let e=n.store.getQuads(t,null,null,null);for(let t of e)if(r.length>0){if(t.predicate.value===`http://www.w3.org/ns/shacl#node`){for(let i of r)if(n.store.getQuads(t.object,jt,i,null).length>0)return e}if(t.predicate.equals(kt)){for(let n of r)if(t.object.equals(n))return e}}else if(t.predicate.equals(Mt)&&t.object.equals(Dt))return e}}return console.error(`couldn't resolve sh:or/sh:xone on property for value`,t),[]}function wr(e,t,n){for(let r of e){let e=!1,i=n.store.getObjects(r,Ot,null);for(let r of i){let i=n.store.getObjects(r,`${W}path`,null);for(let r of i)if(e=n.store.countQuads(t,r,null,null)>0,e)break}if(e)return i}return console.error(`couldn't resolve sh:or/sh:xone on node for value`,t),[]}var Tr=`:host {
|
|
27
27
|
--shacl-font-family: inherit;
|
|
28
28
|
--shacl-font-size: 14px;
|
|
29
29
|
--shacl-text-color: #333;
|
|
@@ -104,9 +104,9 @@ h3 { margin-top: 0; }
|
|
|
104
104
|
.link-option { padding: 10px; }
|
|
105
105
|
.link-option:hover { background-color: #F5F5F5; cursor: pointer; }
|
|
106
106
|
rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: min(90vw, 600px); }
|
|
107
|
-
`,
|
|
108
|
-
`+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}setDense(e){this.dense=e}createViewer(e,t,n){let r=document.createElement(`div`),i=document.createElement(`label`);i.textContent=`${e}:`,n.description&&i.setAttribute(`title`,n.description.value),r.appendChild(i);let a=t.value,o=null;if(t instanceof j){let e=n.config.store.getQuads(a,null,null,null);if(e.length){let t=Rt(e,n.config.languages);t&&(a=t)}}else t instanceof M&&(t.language?(o=document.createElement(`span`),o.classList.add(`lang`),o.innerText=`@${t.language}`):t.datatype.value===`http://www.w3.org/2001/XMLSchema#date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`http://www.w3.org/2001/XMLSchema#dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let s;return Ut(t.value)?(s=document.createElement(`a`),s.setAttribute(`href`,t.value)):s=document.createElement(`div`),s.classList.add(`d-flex`),s.innerText=a,o&&s.appendChild(o),r.appendChild(s),r}};function br(e,t,n){if(n){let n=ur(e)>0;if(e.class&&!e.hasValue)return e.config.theme.createListEditor(e.label,t,n,Ht(e.class,e),e);if(e.in){let r=e.config.lists[e.in];if(r?.length){let i=zt(r,e.config.store,e.config.languages);return e.config.theme.createListEditor(e.label,t,n,i,e)}else console.error(`list not found:`,e.in,`existing lists:`,e.config.lists)}if(e.datatype?.equals(xt)||e.languageIn?.length||e.datatype===void 0&&t instanceof M&&t.language)return e.config.theme.createLangStringEditor(e.label,t,n,e);switch(e.datatype?.value.replace(ft,``)){case`integer`:case`float`:case`double`:case`decimal`:return e.config.theme.createNumberEditor(e.label,t,n,e);case`date`:case`dateTime`:return e.config.theme.createDateEditor(e.label,t,n,e);case`boolean`:return e.config.theme.createBooleanEditor(e.label,t,n,e);case`base64Binary`:return e.config.theme.createFileEditor(e.label,t,n,e)}return e.config.theme.createTextEditor(e.label,t,n,e)}else return t?e.config.theme.createViewer(e.label,t,e):document.createElement(`div`)}function xr(e,t,n){if(t===`application/ld+json`)return Sr(e);{let r=new we({format:t,prefixes:n});r.addQuads(e);let i=``;return r.end((e,t)=>{e&&console.error(e),i=t}),i}}function Sr(e){let t=[];for(let n of e){let e={"@id":n.subject.id};if(n.predicate===bt)e[`@type`]=n.object.id;else{let t=n.object.value;n.object instanceof M?n.object.language?t={"@language":n.object.language,"@value":n.object.value}:n.object.datatype&&n.object.datatype.value!==`http://www.w3.org/2001/XMLSchema##string`&&(t={"@type":n.object.datatype.value,"@value":n.object.value}):t={"@id":n.object.id},e[n.predicate.value]=t}t.push(e)}return JSON.stringify(t)}function Cr(e){let t=e.shaclDatatype,n=e.dataset.value||e.value;if(e.type===`checkbox`||e.getAttribute(`type`)===`checkbox`){if(e.checked||parseInt(e.dataset.minCount||`0`)>0)return k.literal(e.checked?`true`:`false`,t)}else if(n){if(n.startsWith(`<`)&&n.endsWith(`>`)&&n.indexOf(`:`)>-1)return k.namedNode(n.substring(1,n.length-1));if(e.dataset.class||e.dataset.nodeKind===`http://www.w3.org/ns/shacl#IRI`)return k.namedNode(n);if(e.dataset.link)return JSON.parse(e.dataset.link);if(e.dataset.lang?t=e.dataset.lang:e.type===`number`?n=parseFloat(n):e.type===`file`&&e.binaryData?n=e.binaryData:e.type===`datetime-local`&&(n=new Date(n).toISOString().slice(0,19)),(!t||t instanceof j&&Nt.equals(t))&&typeof n==`string`){let e=n.split(`^^`);e.length===2&&e[0].startsWith(`"`)&&e[0].endsWith(`"`)&&e[1].split(`:`).length===2?(n=e[0].substring(1,e[0].length-1),t=k.namedNode(e[1])):(e=n.split(`@`),e.length===2&&e[0].startsWith(`"`)&&e[0].endsWith(`"`)?(n=e[0].substring(1,e[0].length-1),t=e[1]):n.startsWith(`"`)&&n.endsWith(`"`)&&(n=n.substring(1,n.length-1)))}return k.literal(n,t)}}var wr={};function Tr(e){e.predicate===void 0&&e.datatype===void 0?console.warn(`not registering plugin because it does neither define "predicate" nor "datatype"`,e):wr[`${e.predicate}^${e.datatype}`]=e}function Er(){return Object.entries(wr).map(e=>e[1])}function Dr(e,t){let n=wr[`${e}^${t}`];return n||(n=wr[`${e}^undefined`],n)?n:wr[`undefined^${t}`]}var Or=class{constructor(e,t){this.predicate=e.predicate,this.datatype=e.datatype,t&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t))}createViewer(e,t){return e.config.theme.createViewer(e.label,t,e)}},kr=globalThis,Ar=kr.ShadowRoot&&(kr.ShadyCSS===void 0||kr.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,jr=Symbol(),Mr=new WeakMap,Nr=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==jr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Ar&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Mr.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Mr.set(t,e))}return e}toString(){return this.cssText}},Pr=e=>new Nr(typeof e==`string`?e:e+``,void 0,jr),Fr=(e,...t)=>new Nr(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,jr),Ir=(e,t)=>{if(Ar)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=kr.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},Lr=Ar?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return Pr(t)})(e):e,{is:Rr,defineProperty:zr,getOwnPropertyDescriptor:Br,getOwnPropertyNames:Vr,getOwnPropertySymbols:Hr,getPrototypeOf:Ur}=Object,Wr=globalThis,Gr=Wr.trustedTypes,Kr=Gr?Gr.emptyScript:``,qr=Wr.reactiveElementPolyfillSupport,Jr=(e,t)=>e,Yr={toAttribute(e,t){switch(t){case Boolean:e=e?Kr:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},Xr=(e,t)=>!Rr(e,t),Zr={attribute:!0,type:String,converter:Yr,reflect:!1,useDefault:!1,hasChanged:Xr};Symbol.metadata??=Symbol(`metadata`),Wr.litPropertyMetadata??=new WeakMap;var Qr=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Zr){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&zr(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=Br(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Zr}static _$Ei(){if(this.hasOwnProperty(Jr(`elementProperties`)))return;let e=Ur(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Jr(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Jr(`properties`))){let e=this.properties,t=[...Vr(e),...Hr(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(Lr(e))}else e!==void 0&&t.push(Lr(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ir(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?Yr:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?Yr:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??Xr)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};Qr.elementStyles=[],Qr.shadowRootOptions={mode:`open`},Qr[Jr(`elementProperties`)]=new Map,Qr[Jr(`finalized`)]=new Map,qr?.({ReactiveElement:Qr}),(Wr.reactiveElementVersions??=[]).push(`2.1.2`);var $r=globalThis,ei=e=>e,ti=$r.trustedTypes,ni=ti?ti.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ri=`$lit$`,ii=`lit$${Math.random().toFixed(9).slice(2)}$`,ai=`?`+ii,oi=`<${ai}>`,si=document,ci=()=>si.createComment(``),li=e=>e===null||typeof e!=`object`&&typeof e!=`function`,ui=Array.isArray,di=e=>ui(e)||typeof e?.[Symbol.iterator]==`function`,fi=`[
|
|
109
|
-
\f\r]`,
|
|
107
|
+
`,Er=class{constructor(e){this.dense=!0;let t=Tr;e&&(t+=`
|
|
108
|
+
`+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}setDense(e){this.dense=e}createViewer(e,t,n){let r=document.createElement(`div`),i=document.createElement(`label`);i.textContent=`${e}:`,n.description&&i.setAttribute(`title`,n.description.value),r.appendChild(i);let a=t.value,o=null;if(t instanceof j){let e=n.config.store.getQuads(a,null,null,null);if(e.length){let t=Rt(e,n.config.languages);t&&(a=t)}}else t instanceof M&&(t.language?(o=document.createElement(`span`),o.classList.add(`lang`),o.innerText=`@${t.language}`):t.datatype.value===`http://www.w3.org/2001/XMLSchema#date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`http://www.w3.org/2001/XMLSchema#dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let s;return Ut(t.value)?(s=document.createElement(`a`),s.setAttribute(`href`,t.value)):s=document.createElement(`div`),s.classList.add(`d-flex`),s.innerText=a,o&&s.appendChild(o),r.appendChild(s),r}};function Dr(e,t,n){if(n){let n=_r(e)>0;if(e.class&&!e.hasValue)return e.config.theme.createListEditor(e.label,t,n,Ht(e.class,e),e);if(e.in){let r=e.config.lists[e.in];if(r?.length){let i=zt(r,e.config.store,e.config.languages);return e.config.theme.createListEditor(e.label,t,n,i,e)}else console.error(`list not found:`,e.in,`existing lists:`,e.config.lists)}if(e.datatype?.equals(xt)||e.languageIn?.length||e.datatype===void 0&&t instanceof M&&t.language)return e.config.theme.createLangStringEditor(e.label,t,n,e);switch(e.datatype?.value.replace(ft,``)){case`integer`:case`float`:case`double`:case`decimal`:return e.config.theme.createNumberEditor(e.label,t,n,e);case`date`:case`dateTime`:return e.config.theme.createDateEditor(e.label,t,n,e);case`boolean`:return e.config.theme.createBooleanEditor(e.label,t,n,e);case`base64Binary`:return e.config.theme.createFileEditor(e.label,t,n,e)}return e.config.theme.createTextEditor(e.label,t,n,e)}else return t?e.config.theme.createViewer(e.label,t,e):document.createElement(`div`)}function Or(e,t,n){if(t===`application/ld+json`)return kr(e);{let r=new we({format:t,prefixes:n});r.addQuads(e);let i=``;return r.end((e,t)=>{e&&console.error(e),i=t}),i}}function kr(e){let t=[];for(let n of e){let e={"@id":n.subject.id};if(n.predicate===bt)e[`@type`]=n.object.id;else{let t=n.object.value;n.object instanceof M?n.object.language?t={"@language":n.object.language,"@value":n.object.value}:n.object.datatype&&n.object.datatype.value!==`http://www.w3.org/2001/XMLSchema##string`&&(t={"@type":n.object.datatype.value,"@value":n.object.value}):t={"@id":n.object.id},e[n.predicate.value]=t}t.push(e)}return JSON.stringify(t)}function Ar(e){let t=e.shaclDatatype,n=e.dataset.value||e.value;if((e.type===`file`||e.getAttribute(`type`)===`file`)&&e.binaryData)n=e.binaryData;else if((e.type===`checkbox`||e.getAttribute(`type`)===`checkbox`)&&(e.checked||parseInt(e.dataset.minCount||`0`)>0))return k.literal(e.checked?`true`:`false`,t);if(n){if(n.startsWith(`<`)&&n.endsWith(`>`)&&n.indexOf(`:`)>-1)return k.namedNode(n.substring(1,n.length-1));if(e.dataset.class||e.dataset.nodeKind===`http://www.w3.org/ns/shacl#IRI`)return k.namedNode(n);if(e.dataset.link)return JSON.parse(e.dataset.link);if(e.dataset.lang?t=e.dataset.lang:e.type===`number`?n=parseFloat(n):e.type===`datetime-local`?n=Zt(n,e.dataset.xsdTemporalSuffix):e.type===`date`&&t instanceof j&&t.value===`http://www.w3.org/2001/XMLSchema#date`&&(n=Xt(n,e.dataset.xsdTemporalSuffix)),(!t||t instanceof j&&Nt.equals(t))&&typeof n==`string`){let e=n.split(`^^`);e.length===2&&e[0].startsWith(`"`)&&e[0].endsWith(`"`)&&e[1].split(`:`).length===2?(n=e[0].substring(1,e[0].length-1),t=k.namedNode(e[1])):(e=n.split(`@`),e.length===2&&e[0].startsWith(`"`)&&e[0].endsWith(`"`)?(n=e[0].substring(1,e[0].length-1),t=e[1]):n.startsWith(`"`)&&n.endsWith(`"`)&&(n=n.substring(1,n.length-1)))}return k.literal(n,t)}}var jr={};function Mr(e){e.predicate===void 0&&e.datatype===void 0?console.warn(`not registering plugin because it does neither define "predicate" nor "datatype"`,e):jr[`${e.predicate}^${e.datatype}`]=e}function Nr(){return Object.entries(jr).map(e=>e[1])}function Pr(e,t){let n=jr[`${e}^${t}`];return n||(n=jr[`${e}^undefined`],n)?n:jr[`undefined^${t}`]}var Fr=class{constructor(e,t){this.predicate=e.predicate,this.datatype=e.datatype,t&&(this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t))}createViewer(e,t){return e.config.theme.createViewer(e.label,t,e)}},Ir=globalThis,Lr=Ir.ShadowRoot&&(Ir.ShadyCSS===void 0||Ir.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,Rr=Symbol(),zr=new WeakMap,Br=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Rr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Lr&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=zr.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&zr.set(t,e))}return e}toString(){return this.cssText}},Vr=e=>new Br(typeof e==`string`?e:e+``,void 0,Rr),Hr=(e,...t)=>new Br(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,Rr),Ur=(e,t)=>{if(Lr)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let n of t){let t=document.createElement(`style`),r=Ir.litNonce;r!==void 0&&t.setAttribute(`nonce`,r),t.textContent=n.cssText,e.appendChild(t)}},Wr=Lr?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return Vr(t)})(e):e,{is:Gr,defineProperty:Kr,getOwnPropertyDescriptor:qr,getOwnPropertyNames:Jr,getOwnPropertySymbols:Yr,getPrototypeOf:Xr}=Object,Zr=globalThis,Qr=Zr.trustedTypes,$r=Qr?Qr.emptyScript:``,ei=Zr.reactiveElementPolyfillSupport,ti=(e,t)=>e,ni={toAttribute(e,t){switch(t){case Boolean:e=e?$r:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},ri=(e,t)=>!Gr(e,t),ii={attribute:!0,type:String,converter:ni,reflect:!1,useDefault:!1,hasChanged:ri};Symbol.metadata??=Symbol(`metadata`),Zr.litPropertyMetadata??=new WeakMap;var ai=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ii){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&Kr(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=qr(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ii}static _$Ei(){if(this.hasOwnProperty(ti(`elementProperties`)))return;let e=Xr(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(ti(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ti(`properties`))){let e=this.properties,t=[...Jr(e),...Yr(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(Wr(e))}else e!==void 0&&t.push(Wr(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ur(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?ni:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?ni:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??ri)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};ai.elementStyles=[],ai.shadowRootOptions={mode:`open`},ai[ti(`elementProperties`)]=new Map,ai[ti(`finalized`)]=new Map,ei?.({ReactiveElement:ai}),(Zr.reactiveElementVersions??=[]).push(`2.1.2`);var oi=globalThis,si=e=>e,ci=oi.trustedTypes,li=ci?ci.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,ui=`$lit$`,di=`lit$${Math.random().toFixed(9).slice(2)}$`,fi=`?`+di,pi=`<${fi}>`,mi=document,hi=()=>mi.createComment(``),gi=e=>e===null||typeof e!=`object`&&typeof e!=`function`,_i=Array.isArray,vi=e=>_i(e)||typeof e?.[Symbol.iterator]==`function`,yi=`[
|
|
109
|
+
\f\r]`,bi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,xi=/-->/g,Si=/>/g,Ci=RegExp(`>|${yi}(?:([^\\s"'>=/]+)(${yi}*=${yi}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),wi=/'/g,Ti=/"/g,Ei=/^(?:script|style|textarea|title)$/i,Di=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),Oi=Symbol.for(`lit-noChange`),ki=Symbol.for(`lit-nothing`),Ai=new WeakMap,ji=mi.createTreeWalker(mi,129);function Mi(e,t){if(!_i(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return li===void 0?t:li.createHTML(t)}var Ni=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=bi;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===bi?c[1]===`!--`?o=xi:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=Ci):(Ei.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=Ci):o=Si:o===Ci?c[0]===`>`?(o=i??bi,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?Ci:c[3]===`"`?Ti:wi):o===Ti||o===wi?o=Ci:o===xi||o===Si?o=bi:(o=Ci,i=void 0);let d=o===Ci&&e[t+1].startsWith(`/>`)?` `:``;a+=o===bi?n+pi:l>=0?(r.push(s),n.slice(0,l)+ui+n.slice(l)+di+d):n+di+(l===-2?t:d)}return[Mi(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]},Pi=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Ni(t,n);if(this.el=e.createElement(l,r),ji.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=ji.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(ui)){let t=u[o++],n=i.getAttribute(e).split(di),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?zi:r[1]===`?`?Bi:r[1]===`@`?Vi:Ri}),i.removeAttribute(e)}else e.startsWith(di)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Ei.test(i.tagName)){let e=i.textContent.split(di),t=e.length-1;if(t>0){i.textContent=ci?ci.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],hi()),ji.nextNode(),c.push({type:2,index:++a});i.append(e[t],hi())}}}else if(i.nodeType===8)if(i.data===fi)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(di,e+1))!==-1;)c.push({type:7,index:a}),e+=di.length-1}a++}}static createElement(e,t){let n=mi.createElement(`template`);return n.innerHTML=e,n}};function Fi(e,t,n=e,r){if(t===Oi)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=gi(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=Fi(e,i._$AS(e,t.values),i,r)),t}var Ii=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??mi).importNode(t,!0);ji.currentNode=r;let i=ji.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new Li(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Hi(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=ji.nextNode(),a++)}return ji.currentNode=mi,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},Li=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=ki,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Fi(this,e,t),gi(e)?e===ki||e==null||e===``?(this._$AH!==ki&&this._$AR(),this._$AH=ki):e!==this._$AH&&e!==Oi&&this._(e):e._$litType$===void 0?e.nodeType===void 0?vi(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ki&&gi(this._$AH)?this._$AA.nextSibling.data=e:this.T(mi.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Pi.createElement(Mi(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new Ii(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Ai.get(e.strings);return t===void 0&&Ai.set(e.strings,t=new Pi(e)),t}k(t){_i(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(hi()),this.O(hi()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=si(e).nextSibling;si(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},Ri=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=ki,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=ki}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=Fi(this,e,t,0),a=!gi(e)||e!==this._$AH&&e!==Oi,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=Fi(this,r[n+o],t,o),s===Oi&&(s=this._$AH[o]),a||=!gi(s)||s!==this._$AH[o],s===ki?e=ki:e!==ki&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===ki?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},zi=class extends Ri{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ki?void 0:e}},Bi=class extends Ri{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ki)}},Vi=class extends Ri{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=Fi(this,e,t,0)??ki)===Oi)return;let n=this._$AH,r=e===ki&&n!==ki||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==ki&&(n===ki||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Hi=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Fi(this,e)}},Ui=oi.litHtmlPolyfillSupport;Ui?.(Pi,Li),(oi.litHtmlVersions??=[]).push(`3.3.2`);var Wi=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new Li(t.insertBefore(hi(),e),e,void 0,n??{})}return i._$AI(e),i},Gi=globalThis,Ki=class extends ai{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Wi(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Oi}};Ki._$litElement$=!0,Ki.finalized=!0,Gi.litElementHydrateSupport?.({LitElement:Ki});var qi=Gi.litElementPolyfillSupport;qi?.({LitElement:Ki}),(Gi.litElementVersions??=[]).push(`4.2.2`);var Ji=e=>(t,n)=>{n===void 0?customElements.define(e,t):n.addInitializer(()=>{customElements.define(e,t)})},Yi={attribute:!0,type:String,converter:ni,reflect:!1,hasChanged:ri},Xi=(e=Yi,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function Y(e){return(t,n)=>typeof n==`object`?Xi(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}function Zi(e){return Y({...e,state:!0,attribute:!1})}var Qi=(e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&typeof t!=`object`&&Object.defineProperty(e,t,n),n);function $i(e,t){return(n,r,i)=>{let a=t=>t.renderRoot?.querySelector(e)??null;if(t){let{get:e,set:t}=typeof r==`object`?n:i??(()=>{let e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return Qi(n,r,{get(){let n=e.call(this);return n===void 0&&(n=a(this),(n!==null||this.hasUpdated)&&t.call(this,n)),n}})}return Qi(n,r,{get(){return a(this)}})}}var ea=e=>{throw TypeError(e)},ta=(e,t,n)=>t.has(e)||ea(`Cannot `+n),na=(e,t,n)=>(ta(e,t,`read from private field`),n?n.call(e):t.get(e)),ra=(e,t,n)=>t.has(e)?ea(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),ia=(e,t,n,r)=>(ta(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),aa=Object.defineProperty,oa=(e,t,n,r)=>{for(var i=void 0,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(t,n,i)||i);return i&&aa(t,n,i),i},sa=class extends Ki{constructor(){super(...arguments),this.dense=!1}};sa.shadowRootOptions={...Ki.shadowRootOptions,delegatesFocus:!0},sa.styles=[Hr`
|
|
110
110
|
:host {
|
|
111
111
|
--rokit-primary-color-inner: var(--rokit-primary-color, #008877);
|
|
112
112
|
--rokit-primary-color-transparent-inner: color-mix(in srgb, var(--rokit-primary-color-inner) 40%, transparent);
|
|
@@ -137,11 +137,11 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
137
137
|
0% { transform: rotate(0deg); }
|
|
138
138
|
100% { transform: rotate(360deg); }
|
|
139
139
|
}
|
|
140
|
-
`];var
|
|
140
|
+
`];var ca=sa;oa([Y({type:Boolean,reflect:!0})],ca.prototype,`dense`);var la,ua=class extends ca{constructor(){super(),ra(this,la),this.value=``,this.clearable=!1,this.required=!1,this.disabled=!1,ia(this,la,this.attachInternals())}checkValidity(){return na(this,la).checkValidity()}reportValidity(){let e=na(this,la).reportValidity();return this.classList.toggle(`invalid`,!e),e}get validity(){return na(this,la).validity}get validationMessage(){return na(this,la).validationMessage}setCustomValidity(e,t){e?na(this,la).setValidity({customError:!0},e,t):na(this,la).setValidity({})}updateValidity(e,t,n){na(this,la).setValidity(e,t,n)}setFormValue(e,t){na(this,la).setFormValue(e,t)}};la=new WeakMap,ua.formAssociated=!0,ua.styles=[...ca.styles,Hr`
|
|
141
141
|
:host { align-items: center; padding: 6px 8px; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); box-sizing: border-box; }
|
|
142
142
|
:host(:focus) { border-color: var(--rokit-primary-color-inner); }
|
|
143
143
|
:host(.invalid) { border-color: var(--rokit-error-color-inner); }
|
|
144
|
-
`];var
|
|
144
|
+
`];var da=ua;oa([Y()],da.prototype,`name`),oa([Y()],da.prototype,`value`),oa([Y({type:Boolean})],da.prototype,`clearable`),oa([Y({type:Boolean})],da.prototype,`required`),oa([Y({type:Boolean})],da.prototype,`disabled`),oa([Y()],da.prototype,`label`),oa([Y()],da.prototype,`placeholder`);function fa(e){let t=e.trim();if(t.endsWith(`ms`)){let e=Number(t.slice(0,-2));return Number.isFinite(e)?e:0}if(t.endsWith(`s`)){let e=Number(t.slice(0,-1));return Number.isFinite(e)?e*1e3:0}return 0}var pa=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,ha=(e,t,n,r)=>{for(var i=r>1?void 0:r?ma(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&pa(t,n,i),i},ga=class extends ca{constructor(){super(...arguments),this.icon=!1,this.disabled=!1,this.href=``}render(){return this.href&&!this.disabled?Di`<a part="button loader" class="button" href="${this.href}"><slot></slot></a>`:Di`<button part="button loader" class="button" type="button" ?disabled="${this.disabled}"><slot></slot></button>`}};ga.styles=[...ca.styles,Hr`
|
|
145
145
|
:host { display: inline-flex; align-items: center; }
|
|
146
146
|
:host([disabled]) { pointer-events: none; opacity: 0.5; }
|
|
147
147
|
:host([rounded]) .button { border-radius: 200px; }
|
|
@@ -186,7 +186,7 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
186
186
|
border-radius: 3px;
|
|
187
187
|
}
|
|
188
188
|
.button:hover { filter: brightness(102%); }
|
|
189
|
-
`],
|
|
189
|
+
`],ha([Y({type:Boolean,reflect:!0})],ga.prototype,`icon`,2),ha([Y({type:Boolean,reflect:!0})],ga.prototype,`disabled`,2),ha([Y()],ga.prototype,`href`,2),ga=ha([Ji(`rokit-button`)],ga);var _a=Object.defineProperty,va=Object.getOwnPropertyDescriptor,ya=e=>{throw TypeError(e)},ba=(e,t,n,r)=>{for(var i=r>1?void 0:r?va(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&_a(t,n,i),i},xa=(e,t,n)=>t.has(e)||ya(`Cannot `+n),Sa=(e,t,n)=>(xa(e,t,`read from private field`),n?n.call(e):t.get(e)),Ca=(e,t,n)=>t.has(e)?ya(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),wa=(e,t,n)=>(xa(e,t,`access private method`),n),Ta,Ea,Da,Oa,ka,Aa=class extends ca{constructor(){super(...arguments),Ca(this,Da),this.open=!1,this.disabled=!1,this.headerInactive=!1,this.transitioning=!1,this.closedBeforeTransition=!1,Ca(this,Ta,new MutationObserver(()=>this.updateContentHeight())),Ca(this,Ea,new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.updateContentHeight()})),this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClickToggles=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this),this.onClickOpens=(()=>{this.toggle(!0,!0)}).bind(this)}firstUpdated(){this.transitionDuration=fa(getComputedStyle(this).getPropertyValue(`--rokit-transition-duration-inner`)),Sa(this,Ea).observe(this),wa(this,Da,ka).call(this)}disconnectedCallback(){super.disconnectedCallback(),Sa(this,Ta).disconnect(),Sa(this,Ea).disconnect(),wa(this,Da,Oa).call(this)}updated(e){e.has(`transitioning`)&&this.classList.toggle(`transitioning`,this.transitioning),(e.has(`disabled`)||e.has(`headerInactive`))&&(this.toggleButton.disabled=this.disabled,wa(this,Da,ka).call(this)),e.has(`open`)&&!this.transitioning&&!this.disabled&&this.toggle(this.open)}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight===void 0?this.content.scrollHeight:Math.min(this.maxHeight,this.content.scrollHeight))+`px`,this.classList.toggle(`has-content`,this.content.style.maxHeight!==`0px`)})}onSlotChange(){let e=this.shadowRoot.querySelector(`#content > slot`).assignedElements({flatten:!0});Sa(this,Ta).disconnect();for(let t of e)Sa(this,Ta).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0});this.updateContentHeight()}toggle(e=!this.open,t=!1){this.disabled||(this.transitioning=this.open!==e,this.open=e,this.toggleButton.classList.toggle(`down`,e),setTimeout(()=>{this.transitioning=!1,this.open&&t&&this.content.scrollIntoView({block:`nearest`})},this.transitionDuration))}render(){return Di`
|
|
190
190
|
<header part="header">
|
|
191
191
|
<slot name="prefix" part="prefix"></slot>
|
|
192
192
|
<span class="label"><slot name="label" part="label">${this.label}</slot></span>
|
|
@@ -197,7 +197,7 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
197
197
|
<div id="content" part="content">
|
|
198
198
|
<slot @slotchange=${this.onSlotChange}></slot>
|
|
199
199
|
</div>
|
|
200
|
-
`}};
|
|
200
|
+
`}};Ta=new WeakMap,Ea=new WeakMap,Da=new WeakSet,Oa=function(){this.header.removeEventListener(`mousedown`,this.onMouseDown),this.header.removeEventListener(`click`,this.onClickToggles),this.header.removeEventListener(`click`,this.onClickOpens),this.toggleButton.removeEventListener(`mousedown`,this.onMouseDown),this.toggleButton.removeEventListener(`click`,this.onClickToggles)},ka=function(){if(wa(this,Da,Oa).call(this),!this.disabled){if(this.headerInactive){this.toggleButton.addEventListener(`mousedown`,this.onMouseDown),this.toggleButton.addEventListener(`click`,this.onClickToggles),this.header.addEventListener(`click`,this.onClickOpens);return}this.header.addEventListener(`mousedown`,this.onMouseDown),this.header.addEventListener(`click`,this.onClickToggles)}},Aa.styles=[...ca.styles,Hr`
|
|
201
201
|
:host { display: flex; flex-direction: column; align-items: stretch; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); }
|
|
202
202
|
:host header { cursor: pointer; }
|
|
203
203
|
:host([dense]) header { padding: 2px 4px; }
|
|
@@ -209,20 +209,20 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
209
209
|
.label { flex-grow: 1; overflow: hidden; }
|
|
210
210
|
#content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
|
|
211
211
|
#toggle { margin-left: 3px; }
|
|
212
|
-
`],
|
|
212
|
+
`],ba([Y({type:Boolean,reflect:!0})],Aa.prototype,`open`,2),ba([Y()],Aa.prototype,`label`,2),ba([Y({reflect:!0})],Aa.prototype,`maxHeight`,2),ba([Y({type:Boolean})],Aa.prototype,`disabled`,2),ba([Y({type:Boolean})],Aa.prototype,`headerInactive`,2),ba([$i(`#content`)],Aa.prototype,`content`,2),ba([$i(`#toggle`)],Aa.prototype,`toggleButton`,2),ba([$i(`header`)],Aa.prototype,`header`,2),ba([Zi()],Aa.prototype,`transitioning`,2),Aa=ba([Ji(`rokit-collapsible`)],Aa);var ja=Object.defineProperty,Ma=Object.getOwnPropertyDescriptor,Na=e=>{throw TypeError(e)},Pa=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ma(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ja(t,n,i),i},Fa=(e,t,n)=>t.has(e)||Na(`Cannot `+n),Ia=(e,t,n)=>(Fa(e,t,`read from private field`),n?n.call(e):t.get(e)),La=(e,t,n)=>t.has(e)?Na(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Ra=(e,t,n,r)=>(Fa(e,t,`write to private field`),t.set(e,n),n),za,Ba,Va=class extends da{constructor(){super(),this.type=`text`,this.readonly=!1,this.sticky=!1,this.minWidth=80,this.autoGrowLabelWidth=!1,La(this,za,``),La(this,Ba),this.addEventListener(`keydown`,e=>{e.code===`Escape`&&this.blur()}),this.addEventListener(`focus`,()=>{this.classList.add(`has-focus`)}),this.addEventListener(`blur`,()=>{this.inputElement.scrollLeft=0,this.classList.remove(`has-focus`)})}firstUpdated(){Ra(this,za,this.value),this.inputElement.addEventListener(`input`,()=>{this.value=this.inputElement.value,this.updateValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement),this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0}))}),this.inputElement.addEventListener(`change`,()=>{this.value=this.inputElement.value,this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))}),this.autoGrowLabelWidth&&(Ra(this,Ba,new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.updateMinWidth()})),Ia(this,Ba).observe(this))}disconnectedCallback(){Ia(this,Ba)?.disconnect(),Ra(this,Ba,void 0),super.disconnectedCallback()}updateMinWidth(){let e=this.shadowRoot.querySelector(`.wrapper`);if(e){let t=this.shadowRoot?.querySelector(`label`)?.scrollWidth||0,n=this.minWidth>t?this.minWidth:t;e.style.minWidth=n>0?n+`px`:``}}updated(e){e.has(`label`)&&(this.classList.toggle(`has-label`,this.label!==void 0&&this.label!==``),this.autoGrowLabelWidth&&this.updateMinWidth()),e.has(`min`)&&(this.inputElement.min=this.min||``),e.has(`max`)&&(this.inputElement.max=this.max||``),e.has(`step`)&&(this.inputElement.step=this.step||``),e.has(`placeholder`)&&(this.inputElement.placeholder=this.placeholder||``),e.has(`pattern`)&&(this.inputElement.pattern=this.pattern||``),e.has(`minLength`)&&(this.inputElement.minLength=this.minLength===void 0?-1:this.minLength),e.has(`maxLength`)&&(this.inputElement.maxLength=this.maxLength===void 0?-1:this.maxLength),e.has(`value`)&&(this.classList.toggle(`has-value`,this.value!==``),this.setFormValue(this.value),this.updateValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement),this.value!==Ia(this,za)&&Ra(this,za,this.value))}clear(){this.disabled||(this.inputElement.value=``,this.value=``,this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,composed:!0})),this.blur())}renderInput(){return Di`<input id="input" part="input" size="1" name="${this.name}" type="${this.type}" autocomplete="off" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.type===`file`?``:this.value}">`}render(){return Di`
|
|
213
213
|
<slot name="prefix" part="prefix"></slot>
|
|
214
214
|
<div class="wrapper">
|
|
215
215
|
<label for="input" part="label">${this.label}</label>
|
|
216
216
|
${this.renderInput()}
|
|
217
|
-
${this.clearable?
|
|
217
|
+
${this.clearable?Di`
|
|
218
218
|
<rokit-button class="clear" icon ?dense="${this.dense}" @mousedown="${e=>{e.preventDefault()}}" @click="${e=>{e.stopPropagation(),this.clear()}}" title="Clear"></rokit-button>
|
|
219
|
-
`:
|
|
219
|
+
`:ki}
|
|
220
220
|
</div>
|
|
221
221
|
<slot name="suffix" part="suffix loader"></slot>
|
|
222
222
|
<div class="supporting-text" part="supportingText">
|
|
223
223
|
<slot name="supportingText">${this.supportingText}</slot>
|
|
224
224
|
</div>
|
|
225
|
-
`}};
|
|
225
|
+
`}};za=new WeakMap,Ba=new WeakMap,Va.styles=[...da.styles,Hr`
|
|
226
226
|
:host { background-color: var(--rokit-light-background-color-inner); user-select: none; flex-wrap: wrap; }
|
|
227
227
|
:host([dense]) { padding: 2px 4px; }
|
|
228
228
|
:host(.has-focus:not([readonly])) label, :host(.has-value) label, :host([sticky]) label { font-size: 0.75em; top: 0.5em; font-weight: 600; }
|
|
@@ -237,7 +237,7 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
237
237
|
:host(.has-label:not(.has-focus):not(.has-value):not([sticky])) #input { clip-path: polygon(0 0, 0 0, 0 0, 0 0); }
|
|
238
238
|
:host(:not(.has-value)) .clear { visibility: hidden; }
|
|
239
239
|
.supporting-text { width: 100%; font-size: 0.8em; }
|
|
240
|
-
`],
|
|
240
|
+
`],Pa([Y()],Va.prototype,`type`,2),Pa([Y({type:Boolean,reflect:!0})],Va.prototype,`readonly`,2),Pa([Y({type:Boolean,reflect:!0})],Va.prototype,`sticky`,2),Pa([Y()],Va.prototype,`pattern`,2),Pa([Y()],Va.prototype,`minLength`,2),Pa([Y()],Va.prototype,`maxLength`,2),Pa([Y()],Va.prototype,`min`,2),Pa([Y()],Va.prototype,`max`,2),Pa([Y()],Va.prototype,`step`,2),Pa([Y()],Va.prototype,`minWidth`,2),Pa([Y({type:Boolean})],Va.prototype,`autoGrowLabelWidth`,2),Pa([Y()],Va.prototype,`supportingText`,2),Pa([$i(`#input`)],Va.prototype,`inputElement`,2),Va=Pa([Ji(`rokit-input`)],Va);var Ha=Object.defineProperty,Ua=Object.getOwnPropertyDescriptor,Wa=e=>{throw TypeError(e)},Ga=(e,t,n,r)=>{for(var i=r>1?void 0:r?Ua(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Ha(t,n,i),i},Ka=(e,t,n)=>t.has(e)||Wa(`Cannot `+n),qa=(e,t,n)=>(Ka(e,t,`read from private field`),n?n.call(e):t.get(e)),Ja=(e,t,n)=>t.has(e)?Wa(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),Ya=(e,t,n,r)=>(Ka(e,t,`write to private field`),t.set(e,n),n),Xa,Za,Qa,$a,eo,to,no=class extends da{constructor(){super(),this.emptyMessage=`Nothing to select`,this.collapsibleOrientationLeft=`0`,this.collapsibleOrientationRight=`0`,this.collapsibleWidth=``,this.autoGrowLabelWidth=!1,this.fixedOpen=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,this.toggleOnHeaderClick=!0,Ja(this,Xa,``),Ja(this,Za,``),Ja(this,Qa,new MutationObserver(()=>this.onSlotChange())),Ja(this,$a,()=>{this.collapsible?.toggle(!0)}),Ja(this,eo,e=>{let t=e.relatedTarget;t&&(t===this||this.shadowRoot?.contains(t))||(this.checkInputValue(),this.collapsible?.toggle(!1))}),Ja(this,to,()=>{this.collapsible?.toggle(!0)}),this.addEventListener(`focusin`,qa(this,$a)),this.addEventListener(`focusout`,qa(this,eo)),this.addEventListener(`input`,qa(this,to))}disconnectedCallback(){qa(this,Qa).disconnect(),this.removeEventListener(`focusin`,qa(this,$a)),this.removeEventListener(`focusout`,qa(this,eo)),this.removeEventListener(`input`,qa(this,to)),super.disconnectedCallback()}firstUpdated(){Ya(this,Xa,this.value),Ya(this,Za,getComputedStyle(this).getPropertyValue(`--rokit-list-indent-inner`)),this.input.placeholder=this.placeholder===void 0?`Type to filter list...`:this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight===void 0?getComputedStyle(this).getPropertyValue(`--rokit-list-max-height-inner`):this.collapsibleMaxHeight),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(e){if(e.has(`selectedItem`)){let e=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):``,this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.title||(this.input.title=this.input.value),this.classList.toggle(`has-value`,this.value!==``),this.setFormValue(this.value),this.required&&this.value===``?this.updateValidity({valueMissing:!0},`Please select a value`,this.listContainer):this.updateValidity(),e!==this.value&&this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0}))}e.has(`value`)&&this.selectItem(this.findItem(this.value)),e.has(`disabled`)&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled),e.has(`supportingText`)&&(this.input.supportingText=this.supportingText),(e.has(`filterableThreshold`)||e.has(`itemCount`))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold,this.toggleOnHeaderClick=this.input.readonly),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?`none`:``),e.has(`fixedOpen`)&&(this.collapsible.open=this.fixedOpen,this.collapsible.disabled=this.fixedOpen)}checkInputValue(e=!0){if(this.input.value){if(this.selectedItem&&this.itemText(this.selectedItem)===this.input.value)return;let e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}e&&(this.input.value=``,this.input.title=``,Ya(this,Xa,``),this.selectItem(null,!1))}filter(e){e=e.toLowerCase();let t=!0;for(let n of this.listContainer.querySelectorAll(`li`))if(n.id!==`noresult`){let r=this.itemText(n).toLowerCase().indexOf(e)==-1&&(!n.dataset.value||n.dataset.value.toLowerCase().indexOf(e)==-1);n.classList.toggle(`hidden`,r),this.collapse&&(n.classList.remove(`open`),n.querySelector(`ul`)?.classList.remove(`open`)),r||(t=!1)}for(let n of this.listContainer.querySelectorAll(`li:has(li:not(.hidden))`))n.classList.remove(`hidden`),e&&this.collapse&&(n.classList.add(`open`),n.querySelector(`ul`)?.classList.add(`open`)),t=!1;this.highlightItem(null),this.listContainer.querySelector(`#noresult`)?.classList.toggle(`hidden`,!t)}selectItem(e,t=!0,n=!1){e?.getAttribute(`disabled`)!==null&&(e=null),this.selectedItem=e,this.filter(``),this.highlightItem(e,!1),t&&this.value&&Ya(this,Xa,this.value),n&&setTimeout(()=>this.blur())}findItem(e){let t=null;if(e)for(let n of this.listContainer.querySelectorAll(`li`)){if(n.dataset.value===e)return n;this.itemText(n)===e&&(t=n)}return t}highlightItem(e,t=!0){if(this.listContainer.querySelector(`li.active`)?.classList.remove(`active`),e){if(t&&this.listContainer.focus(),e.classList.add(`active`),this.collapse)for(let t=e.closest(`ul`);t;t=t.parentElement.closest(`ul`))t.classList.add(`open`),t.closest(`li`)?.classList.add(`open`);this.collapsible.open&&e.scrollIntoView({block:`nearest`})}}highlightNextItem(){let e=this.listContainer.querySelector(`li.active`),t=e,n=this.listContainer.querySelectorAll(`ul.open > li:not([disabled]):not(.hidden):not(.divider)`);if(e){for(let r=0;r<n.length;r++)if(n[r]===e&&r<n.length-1){t=n[r+1];break}}else n.length>0&&(t=n[0]);this.highlightItem(t)}highlightPreviousItem(){let e=this.listContainer.querySelector(`li.active`),t=null;if(e){let n=this.listContainer.querySelectorAll(`ul.open > li:not([disabled]):not(.hidden):not(.divider)`);for(let r=0;r<n.length;r++)if(n[r]===e&&r>0){t=n[r-1];break}}this.highlightItem(t),t||this.input.focus()}itemValue(e){return e.dataset.value||this.itemText(e)||``}itemText(e){return e.querySelector(`div > div`)?.innerText||``}elementText(e){let t=``;for(let n of e.childNodes)n.nodeType==3&&(t+=n.nodeValue?.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let e=null,t=this.shadowRoot.querySelector(`#list-container-slot`).assignedElements();if(t?.length===1&&(e=Array.prototype.slice.call(t[0].querySelectorAll(`:scope > li`)),this.copyItems(e,this.listContainer),qa(this,Qa).disconnect(),qa(this,Qa).observe(t[0],{subtree:!0,childList:!0,characterData:!0,attributes:!0})),this.emptyMessage){let t=document.createElement(`li`);t.id=`noresult`,t.setAttribute(`disabled`,``),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),e&&e.length>0&&t.classList.add(`hidden`)}this.value=this.value||qa(this,Xa),this.selectItem(this.findItem(this.value))}copyItems(e,t,n=0){if(this.sort!==void 0){let t=this.sort||`asc`;e=e.sort((e,n)=>t===`desc`?(this.elementText(n)||this.itemValue(n)).localeCompare(this.elementText(e)||this.itemValue(e)):(this.elementText(e)||this.itemValue(e)).localeCompare(this.elementText(n)||this.itemValue(n)))}let r=``;n>0&&(r=`calc(0.3em + ${n}*${qa(this,Za)})`);for(let i of e){let e=i.cloneNode();e.replaceChildren();let a=document.createElement(`div`);r&&(a.style.paddingLeft=r);let o=document.createElement(`div`);a.appendChild(o);for(let e of i.childNodes)if(e.nodeName!==`UL`){let t=e.cloneNode(!0);t.nodeType===3&&t.nodeValue&&(t.nodeValue=t.nodeValue.trim()),o.appendChild(t)}e.appendChild(a),e.title=e.title||this.itemText(e);let s=i.querySelector(`ul`);if(s?.childElementCount){let t=document.createElement(`ul`);if(e.appendChild(t),this.copyItems(Array.prototype.slice.call(s.children),t,n+1),this.collapse){let n=new ga;n.dense=!0,n.icon=!0,n.classList.add(`toggle-node`,`caret`),n.addEventListener(`click`,n=>{n.stopPropagation(),e.classList.toggle(`open`),t.classList.toggle(`open`),this.collapsible.updateContentHeight()}),a.prepend(n)}else t.classList.add(`open`)}t.appendChild(e),this.itemCount++}}render(){return Di`
|
|
241
241
|
<rokit-collapsible ?dense="${this.dense}" part="collapsible" ?headerInactive="${!this.toggleOnHeaderClick}">
|
|
242
242
|
<slot name="prefix" part="prefix" slot="prefix"></slot>
|
|
243
243
|
<slot name="suffix" part="suffix loader" slot="suffix"></slot>
|
|
@@ -256,7 +256,7 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
256
256
|
</ul>
|
|
257
257
|
<slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
|
|
258
258
|
</rokit-collapsible>
|
|
259
|
-
`}};
|
|
259
|
+
`}};Xa=new WeakMap,Za=new WeakMap,Qa=new WeakMap,$a=new WeakMap,eo=new WeakMap,to=new WeakMap,no.styles=[...da.styles,Hr`
|
|
260
260
|
:host { background-color: var(--rokit-light-background-color-inner); user-select: none; padding: 0; }
|
|
261
261
|
:host([dense]) {
|
|
262
262
|
li > div { padding: 4px 2px; }
|
|
@@ -287,37 +287,37 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
287
287
|
:host([collapse]) li > div > div { padding-left: 1.8em; }
|
|
288
288
|
:host([collapse]) ul:not(.open) { display: none; }
|
|
289
289
|
:host([collapse]) li:not(.open) > div > .toggle-node::part(button):before { transform: translate(0, 0) rotate(-45deg); }
|
|
290
|
-
`],
|
|
290
|
+
`],Ga([Y()],no.prototype,`emptyMessage`,2),Ga([Y()],no.prototype,`sort`,2),Ga([Y()],no.prototype,`collapsibleMaxHeight`,2),Ga([Y()],no.prototype,`collapsibleOrientationLeft`,2),Ga([Y()],no.prototype,`collapsibleOrientationRight`,2),Ga([Y()],no.prototype,`collapsibleWidth`,2),Ga([Y({type:Boolean})],no.prototype,`autoGrowLabelWidth`,2),Ga([Y({type:Boolean,reflect:!0})],no.prototype,`fixedOpen`,2),Ga([Y()],no.prototype,`inputMinWidth`,2),Ga([Y({type:Boolean,reflect:!0})],no.prototype,`collapse`,2),Ga([Y()],no.prototype,`filterableThreshold`,2),Ga([Y()],no.prototype,`supportingText`,2),Ga([$i(`rokit-collapsible`)],no.prototype,`collapsible`,2),Ga([$i(`#input`)],no.prototype,`input`,2),Ga([$i(`#list-container`)],no.prototype,`listContainer`,2),Ga([Zi()],no.prototype,`selectedItem`,2),Ga([Zi()],no.prototype,`itemCount`,2),Ga([Zi()],no.prototype,`toggleOnHeaderClick`,2),no=Ga([Ji(`rokit-select`)],no);var ro=Object.defineProperty,io=Object.getOwnPropertyDescriptor,ao=e=>{throw TypeError(e)},oo=(e,t,n,r)=>{for(var i=r>1?void 0:r?io(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ro(t,n,i),i},so=(e,t,n)=>t.has(e)||ao(`Cannot `+n),co=(e,t,n)=>(so(e,t,`read from private field`),n?n.call(e):t.get(e)),lo=(e,t,n)=>t.has(e)?ao(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),uo=(e,t,n,r)=>(so(e,t,`write to private field`),t.set(e,n),n),fo,po,mo=class extends Va{constructor(){super(...arguments),this.resize=`none`,this.rows=3,lo(this,fo),lo(this,po,()=>this.autoResize())}firstUpdated(){super.firstUpdated(),this.applyDimensions(),this.applyResizeBehavior()}updated(e){super.updated(e),(e.has(`rows`)||e.has(`cols`))&&this.applyDimensions(),e.has(`resize`)&&this.applyResizeBehavior(),this.resize===`auto`&&e.has(`value`)&&this.autoResize()}disconnectedCallback(){this.inputElement?.removeEventListener(`input`,co(this,po)),co(this,fo)?.disconnect(),uo(this,fo,void 0),super.disconnectedCallback()}applyDimensions(){this.inputElement.rows=this.rows,this.inputElement.cols=this.cols===void 0?20:this.cols}applyResizeBehavior(){if(this.inputElement.removeEventListener(`input`,co(this,po)),co(this,fo)?.disconnect(),uo(this,fo,void 0),this.resize===`auto`){this.inputElement.style.resize=`none`,this.inputElement.addEventListener(`input`,co(this,po)),uo(this,fo,new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.autoResize()})),co(this,fo).observe(this),this.autoResize();return}this.inputElement.style.resize=this.resize,this.inputElement.style.height=``}autoResize(){this.inputElement.style.height=``,this.inputElement.style.height=this.inputElement.scrollHeight+`px`}onSlotChange(){let e=this.shadowRoot.querySelector(`#content`).assignedNodes().map(e=>e.textContent).join(``);e.trim()!==``&&(this.value=e)}renderInput(){return Di`
|
|
291
291
|
<textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
|
|
292
292
|
<slot id="content" @slotchange=${this.onSlotChange}></slot>
|
|
293
|
-
`}};
|
|
293
|
+
`}};fo=new WeakMap,po=new WeakMap,mo.styles=[...Va.styles,Hr`
|
|
294
294
|
:host, .wrapper { align-items: flex-start; }
|
|
295
295
|
#input { height: initial; }
|
|
296
296
|
#content { display: none; }
|
|
297
|
-
`]
|
|
297
|
+
`],oo([Y()],mo.prototype,`resize`,2),oo([Y({type:Number})],mo.prototype,`rows`,2),oo([Y({type:Number})],mo.prototype,`cols`,2),mo=oo([Ji(`rokit-textarea`)],mo);var ho=Object.defineProperty,go=Object.getOwnPropertyDescriptor,_o=e=>{throw TypeError(e)},vo=(e,t,n,r)=>{for(var i=r>1?void 0:r?go(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ho(t,n,i),i},yo=(e,t,n)=>t.has(e)||_o(`Cannot `+n),X=(e,t,n)=>(yo(e,t,`read from private field`),n?n.call(e):t.get(e)),bo=(e,t,n)=>t.has(e)?_o(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),xo=(e,t,n,r)=>(yo(e,t,`write to private field`),t.set(e,n),n),Z,So,Co,wo=18,To=class extends Va{constructor(){super(...arguments),this.labelFormatter=e=>String(Math.round(e*1e3)/1e3),bo(this,Z,[0,1]),bo(this,So,[X(this,Z)[0],X(this,Z)[1]]),bo(this,Co)}firstUpdated(){super.firstUpdated(),this.sliderElement.addEventListener(`mousedown`,e=>this.onKnobDrag(e)),this.sliderElement.addEventListener(`touchstart`,e=>this.onKnobDrag(e)),new ResizeObserver(()=>{this.updateKnobPositions()}).observe(this.sliderElement)}updated(e){if(super.updated(e),e.has(`min`)&&(X(this,Z)[0]=parseFloat(this.min||`0`),X(this,Z)[1]=Math.max(X(this,Z)[0],X(this,Z)[1])),e.has(`max`)&&(X(this,Z)[1]=parseFloat(this.max||`1`),X(this,Z)[0]=Math.min(X(this,Z)[0],X(this,Z)[1])),e.has(`step`)&&xo(this,Co,this.step?parseFloat(this.step):void 0),e.has(`value`)||e.has(`min`)||e.has(`max`)||e.has(`step`))if(this.value!==void 0&&this.value!==``)if(this.range!==void 0)try{let e=JSON.parse(this.value);Array.isArray(e)&&e.length===2&&Number.isFinite(e[0])&&Number.isFinite(e[1])?xo(this,So,[this.applyConstraints(Number(e[0])),this.applyConstraints(Number(e[1]))]):xo(this,So,[X(this,Z)[0],X(this,Z)[1]])}catch{xo(this,So,[X(this,Z)[0],X(this,Z)[1]])}else{let e=parseFloat(this.value);xo(this,So,[this.applyConstraints(Number.isFinite(e)?e:X(this,Z)[0])])}else xo(this,So,this.range===void 0?[X(this,Z)[0]]:[X(this,Z)[0],X(this,Z)[1]]);this.updateKnobPositions()}updateValidity(e,t){super.updateValidity(e,t,this.sliderElement)}chooseKnob(e){if(!this.endKnob)return this.startKnob;let t=Math.abs(e-this.startKnob.offsetLeft)<Math.abs(e-this.endKnob.offsetLeft)?this.startKnob:this.endKnob;return this.startKnob.value===this.endKnob.value&&(t.id===`start`&&t.value===X(this,Z)[0]?t=this.endKnob:t.id===`end`&&t.value===X(this,Z)[1]&&(t=this.startKnob)),t}toScreenSpace(e){let t=this.track.offsetWidth,n=X(this,Z)[1]-X(this,Z)[0];return t<=0||n<=0?0:(e-X(this,Z)[0])/n*t}toValueSpace(e){let t=this.track.offsetWidth,n=X(this,Z)[1]-X(this,Z)[0];return t<=0||n<=0?X(this,Z)[0]:e/t*n+X(this,Z)[0]}applyConstraints(e,t){let n=Math.min(Math.max(e,X(this,Z)[0]),X(this,Z)[1]);return X(this,Co)&&(n=X(this,Z)[0]+Math.round((n-X(this,Z)[0])/X(this,Co))*X(this,Co)),t!==void 0&&this.endKnob&&(n=t?Math.min(n,this.endKnob.value):Math.max(n,this.startKnob.value)),n}updateKnob(e,t){e.id===`start`?X(this,So)[0]=t:X(this,So)[1]=t,e.value=t,e.offset=this.toScreenSpace(t),e.label=this.labelFormatter(t),this.endKnob&&(e.id===`start`?this.track.style.borderLeftWidth=e.offset+`px`:this.track.style.borderRightWidth=this.track.offsetWidth-e.offset+`px`)}updateKnobPositions(){this.updateKnob(this.startKnob,X(this,So)[0]),this.endKnob&&this.updateKnob(this.endKnob,X(this,So)[1])}onKnobDrag(e){if(e.target instanceof Eo||this.classList.contains(`has-value`)||this.classList.contains(`has-focus`)){let t=this.value,n,r=e=>{let t=0;t=e.type===`touchmove`||e.type===`touchstart`?e.touches[0].clientX:e.clientX,t-=this.track.getBoundingClientRect().left,n||(n=this.chooseKnob(t),n.classList.add(`focus`)),this.updateKnob(n,this.applyConstraints(this.toValueSpace(t),n.id===`start`));let r=this.range===void 0?String(X(this,So)[0]):JSON.stringify([X(this,So)[0],X(this,So)[1]]);this.value!==r&&(this.value=r,this.dispatchEvent(new Event(`input`,{bubbles:!0,composed:!0})))},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`touchmove`,r),document.removeEventListener(`mouseup`,i),document.removeEventListener(`touchend`,i),n&&(n.classList.remove(`focus`),this.value!==t&&this.dispatchEvent(new Event(`change`,{bubbles:!0,composed:!0}))),n=void 0};this.sliderElement.focus(),document.addEventListener(`mousemove`,r),document.addEventListener(`touchmove`,r),document.addEventListener(`mouseup`,i),document.addEventListener(`touchend`,i),r(e)}}renderInput(){return Di`
|
|
298
298
|
${super.renderInput()}
|
|
299
299
|
<div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
|
|
300
300
|
<div id="track"></div>
|
|
301
301
|
<rokit-slider-knob id="start"></rokit-slider-knob>
|
|
302
|
-
${this.range===void 0?
|
|
302
|
+
${this.range===void 0?ki:Di`
|
|
303
303
|
<rokit-slider-knob id="end"></rokit-slider-knob>
|
|
304
304
|
`}
|
|
305
305
|
</div>
|
|
306
|
-
`}};Z=new WeakMap,
|
|
306
|
+
`}};Z=new WeakMap,So=new WeakMap,Co=new WeakMap,To.styles=[...Va.styles,Hr`
|
|
307
307
|
:host(.has-label:not(:focus):not(.has-value):not([sticky])) #slider > * { visibility: hidden; }
|
|
308
308
|
:host(.has-label) .wrapper { padding-top: 1em; }
|
|
309
|
-
:host([sticky]) #slider { margin-top: ${.25*
|
|
309
|
+
:host([sticky]) #slider { margin-top: ${.25*wo+22}px; }
|
|
310
310
|
#input { display: none; }
|
|
311
|
-
#slider { display: flex; position: relative; align-items: center; width: 100%; height: ${
|
|
311
|
+
#slider { display: flex; position: relative; align-items: center; width: 100%; height: ${wo}px; padding: 0 ${wo/2}px; outline: 0; }
|
|
312
312
|
:host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
|
|
313
313
|
#track { height: 2px; flex-grow: 1; background-color: #CCC; }
|
|
314
314
|
#slider[range] #track { background-color: color-mix(in srgb, var(--rokit-primary-color-inner) 60%, transparent); border-width: 0; border-color: #CCC; border-style: solid; }
|
|
315
|
-
`],
|
|
316
|
-
:host { position: absolute; width: ${
|
|
317
|
-
:host(.focus), :host(:hover) { box-shadow: 0 0 0 ${
|
|
315
|
+
`],vo([Y()],To.prototype,`range`,2),vo([Y()],To.prototype,`labelFormatter`,2),vo([$i(`#slider`)],To.prototype,`sliderElement`,2),vo([$i(`#track`)],To.prototype,`track`,2),vo([$i(`#start`)],To.prototype,`startKnob`,2),vo([$i(`#end`)],To.prototype,`endKnob`,2),To=vo([Ji(`rokit-slider`)],To);var Eo=class extends Ki{constructor(){super(...arguments),this.offset=0,this.label=``,this.value=0}updated(e){e.has(`offset`)&&(this.style.left=this.offset+`px`)}render(){return Di`<label part="label">${this.label}</label>`}};Eo.styles=[Hr`
|
|
316
|
+
:host { position: absolute; width: ${wo}px; height: ${wo}px; border-radius: ${wo}px; background-color: var(--rokit-primary-color-inner); }
|
|
317
|
+
:host(.focus), :host(:hover) { box-shadow: 0 0 0 ${wo/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
|
|
318
318
|
label {
|
|
319
319
|
position: absolute;
|
|
320
|
-
top: calc(-2em - ${
|
|
320
|
+
top: calc(-2em - ${wo/4}px);
|
|
321
321
|
left: 50%;
|
|
322
322
|
transform: translate(-50%, 0);
|
|
323
323
|
white-space: nowrap;
|
|
@@ -342,28 +342,28 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
342
342
|
background-color: inherit;
|
|
343
343
|
clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
|
|
344
344
|
}
|
|
345
|
-
`],
|
|
345
|
+
`],vo([Y()],Eo.prototype,`offset`,2),vo([Y()],Eo.prototype,`label`,2),Eo=vo([Ji(`rokit-slider-knob`)],Eo);var Do=Object.defineProperty,Oo=Object.getOwnPropertyDescriptor,ko=(e,t,n,r)=>{for(var i=r>1?void 0:r?Oo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Do(t,n,i),i},Ao=class extends ca{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.title=``,this.previousBodyOverflow=``,this.layoutLocked=!1,this.onDialogClose=()=>{this.unlockLayout(),this.open=!1,this.dispatchEvent(new Event(`close`))}}lockLayout(){this.layoutLocked||(this.layoutLocked=!0,this.previousBodyOverflow=document.body.style.overflow,document.body.classList.add(`dialog-open`),document.body.style.overflow=`hidden`)}unlockLayout(){this.layoutLocked&&(this.layoutLocked=!1,document.body.classList.remove(`dialog-open`),document.body.style.overflow=this.previousBodyOverflow,this.previousBodyOverflow=``)}firstUpdated(){this.dialogElement.addEventListener(`close`,this.onDialogClose)}disconnectedCallback(){this.dialogElement?.removeEventListener(`close`,this.onDialogClose),this.unlockLayout(),super.disconnectedCallback()}updated(e){if(e.has(`open`)){if(this.open){this.lockLayout(),this.dialogElement.open||this.dialogElement.showModal();return}this.unlockLayout(),this.dialogElement.open&&this.dialogElement.close()}}render(){return Di`
|
|
346
346
|
<dialog id="dialog" part="dialog">
|
|
347
347
|
<header>
|
|
348
348
|
<div class="title" part="title">
|
|
349
349
|
<slot name="header">${this.title}</slot>
|
|
350
350
|
</div>
|
|
351
|
-
${this.closable?
|
|
351
|
+
${this.closable?Di`
|
|
352
352
|
<rokit-button class="clear" icon ?dense="${this.dense}" @click="${()=>{this.open=!1}}" title="Close"></rokit-button>
|
|
353
|
-
`:
|
|
353
|
+
`:ki}
|
|
354
354
|
</header>
|
|
355
355
|
<main part="main">
|
|
356
356
|
<slot></slot>
|
|
357
357
|
</main>
|
|
358
358
|
</dialog>
|
|
359
|
-
`}};
|
|
359
|
+
`}};Ao.styles=[...ca.styles,Hr`
|
|
360
360
|
dialog[open] { display: flex; flex-direction: column; width: 100%; max-width: 90vw; max-height: 90vh; margin: auto; outline: 0; border: 0; border-radius: 1em; padding: 0; }
|
|
361
361
|
dialog::backdrop { background-color: #0007; }
|
|
362
362
|
header { display: flex; align-items: center; padding: 14px; }
|
|
363
363
|
.title { font-weight: 600; flex-grow: 1; text-align: center; }
|
|
364
364
|
.clear { justify-self: flex-end; }
|
|
365
365
|
main { flex-grow: 1; overflow: auto; display: flex; flex-direction: column; padding: 0 16px 14px 16px; }
|
|
366
|
-
`],
|
|
366
|
+
`],ko([Y({type:Boolean,reflect:!0})],Ao.prototype,`open`,2),ko([Y({type:Boolean})],Ao.prototype,`closable`,2),ko([Y()],Ao.prototype,`title`,2),ko([$i(`#dialog`)],Ao.prototype,`dialogElement`,2),Ao=ko([Ji(`rokit-dialog`)],Ao);var jo=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,No=(e,t,n,r)=>{for(var i=r>1?void 0:r?Mo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&jo(t,n,i),i},Po=class extends ca{updated(e){if(e.has(`percent`)){let e=Number(this.percent);if(Number.isFinite(e)){let t=Math.min(100,Math.max(0,e));this.bar.style.width=`${t}%`}else this.bar.style.width=``}}render(){return Di`<div part="bar" class="bar ${Number.isFinite(Number(this.percent))?``:`indeterminate`}"></div>`}};Po.styles=[...ca.styles,Hr`
|
|
367
367
|
:host { display: flex; background-color: var(--rokit-primary-color-transparent-inner); color: var(--rokit-primary-color-inner); }
|
|
368
368
|
.bar { height: 3px; background-color: var(--rokit-primary-color-inner); }
|
|
369
369
|
.bar.indeterminate { width: 100%; --c: no-repeat linear-gradient(currentColor 0 0); background: var(--c), var(--c); background-size: 60% 100%; animation: indeterminate 3s infinite; }
|
|
@@ -372,21 +372,21 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
372
372
|
66% { background-position: 250% 0,-150% 0 }
|
|
373
373
|
100% { background-position: 250% 0, 250% 0 }
|
|
374
374
|
}
|
|
375
|
-
`],
|
|
375
|
+
`],No([Y({type:Number})],Po.prototype,`percent`,2),No([$i(`.bar`)],Po.prototype,`bar`,2),Po=No([Ji(`rokit-progressbar`)],Po);var Fo=Object.getOwnPropertyDescriptor,Io=(e,t,n,r)=>{for(var i=r>1?void 0:r?Fo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=o(i)||i);return i},Lo=`RokitSnackbarEvent`,Ro=`0.2s`,zo=fa(Ro),Bo=3e3,Vo=class extends Ki{constructor(){super(),this.listener=e=>{e.stopImmediatePropagation(),Ho(e.detail,this)},this.container=document.createElement(`div`),this.container.classList.add(`snackbar`),this.container.setAttribute(`part`,`snackbar`)}connectedCallback(){super.connectedCallback(),this.shadowRoot.appendChild(this.container),document.addEventListener(Lo,this.listener)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(Lo,this.listener)}};Vo.styles=Hr`
|
|
376
376
|
:host { display: flex; justify-content: center; width: 100%; position: fixed; bottom: 10px; pointer-events: none; }
|
|
377
377
|
:host(.left) { right: auto; left: 10px; width: auto; }
|
|
378
378
|
:host(.right) { right: 10px; left: auto; width: auto; }
|
|
379
379
|
:host(.top) { top: 10px; bottom: auto; }
|
|
380
380
|
:host(.top) .snackbar { flex-direction: column-reverse; }
|
|
381
381
|
.snackbar { display: flex; flex-direction: column; width: 300px; }
|
|
382
|
-
.message { max-height: 0; margin-bottom: 0; overflow: hidden; background-color: #333; color: #FFF; border-radius: 4px; transition: all ${
|
|
382
|
+
.message { max-height: 0; margin-bottom: 0; overflow: hidden; background-color: #333; color: #FFF; border-radius: 4px; transition: all ${Vr(Ro)} ease-in-out; font-weight: 500; pointer-events: auto; }
|
|
383
383
|
.message.error { background-color: #C22; }
|
|
384
384
|
.message.success { background-color: #0a8f0a; }
|
|
385
385
|
.message:not(.closable) .text { text-align: center; }
|
|
386
386
|
.inner { display: flex; padding: 10px; }
|
|
387
387
|
.text { flex-grow: 1; word-break: break-all; }
|
|
388
388
|
.text a { color: inherit; }
|
|
389
|
-
`,
|
|
389
|
+
`,Vo=Io([Ji(`rokit-snackbar`)],Vo);function Ho(e,t){t||(t=document.querySelector(`rokit-snackbar`)||void 0,t||(t=new Vo,document.body.appendChild(t)));let n=document.createElement(`div`);n.classList.add(`message`);let r=document.createElement(`div`);r.classList.add(`inner`);let i=document.createElement(`div`);if(i.classList.add(`text`),i.innerHTML=e.message,r.appendChild(i),n.appendChild(r),e.closable===void 0?e.ttl===0:e.closable){n.classList.add(`closable`);let e=new ga;e.setAttribute(`icon`,``),e.setAttribute(`dense`,``),e.classList.add(`clear`),e.title=`Dismiss`,e.addEventListener(`click`,()=>{a(n)}),r.append(e)}e.cssStyle&&(n.style.cssText=e.cssStyle),e.cssClass&&n.classList.add(e.cssClass),t.container.appendChild(n),setTimeout(()=>{n.style.maxHeight=n.scrollHeight+`px`,n.style.marginBottom=`10px`}),e.ttl!==0&&setTimeout(()=>{a(n)},e.ttl||Bo);let a=e=>{e.style.maxHeight=``,e.style.marginBottom=``,setTimeout(()=>{e.remove()},zo)}}var Uo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,Go=(e,t,n,r)=>{for(var i=r>1?void 0:r?Wo(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&Uo(t,n,i),i},Ko=class extends ca{constructor(){super(...arguments),this.pos=`50%`,this.minPos=10,this.maxPos=90,this.dir=`horizontal`,this.sep=`4px`,this.dragging=!1,this.storageKey=``,this._restoredKey=``,this._activePointerId=null,this.posFromPointer=e=>{let t=this.getBoundingClientRect(),n=this.dir===`horizontal`?e.clientX-t.left:e.clientY-t.top,r=this.dir===`horizontal`?t.width:t.height,i=r>0?n/r*100:50;return`${Math.min(this.maxPos,Math.max(this.minPos,i))}%`},this.startDrag=e=>{e.button==0&&(this.dragging=!0,this._activePointerId=e.pointerId,e.currentTarget.setPointerCapture(e.pointerId),this.pos=this.posFromPointer(e))},this.drag=e=>{this.dragging&&this._activePointerId==e.pointerId&&(this.pos=this.posFromPointer(e))},this.endDrag=e=>{this._activePointerId==e.pointerId&&(this.dragging=!1,this._activePointerId=null)}}updated(e){if(this.storageKey||=`rokit-splitpane:${this.id||`default`}`,this.storageKey&&this.storageKey!==this._restoredKey){try{let e=localStorage.getItem(this.storageKey);e&&(this.pos=e)}catch{}this._restoredKey=this.storageKey}if(e.has(`minPos`)&&(this.minPos=Math.max(0,Math.min(100,this.minPos))),e.has(`maxPos`)&&(this.maxPos=Math.max(0,Math.min(100,this.maxPos))),this.minPos>this.maxPos&&([this.minPos,this.maxPos]=[this.maxPos,this.minPos]),(e.has(`pos`)||e.has(`dir`))&&(this.dir===`horizontal`?(this.style.gridTemplateColumns=this.template(),this.style.gridTemplateRows=``):(this.style.gridTemplateRows=this.template(),this.style.gridTemplateColumns=``),this.storageKey))try{localStorage.setItem(this.storageKey,this.pos)}catch{}}template(){return`${this.pos} ${this.sep} 1fr`}render(){return Di`
|
|
390
390
|
<div><slot name="pane1"></slot></div>
|
|
391
391
|
<div
|
|
392
392
|
id="separator"
|
|
@@ -399,7 +399,7 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
399
399
|
@pointercancel="${this.endDrag}">
|
|
400
400
|
</div>
|
|
401
401
|
<div><slot name="pane2"></slot></div>
|
|
402
|
-
`}};
|
|
402
|
+
`}};Ko.styles=[...ca.styles,Hr`
|
|
403
403
|
:host { display: grid; }
|
|
404
404
|
:host([dragging]) { user-select: none; }
|
|
405
405
|
:host([dragging][dir="horizontal"]) { cursor: col-resize; }
|
|
@@ -411,23 +411,23 @@ rokit-dialog.link-chooser::part(dialog) { min-height: min(434px, 90vh); width: m
|
|
|
411
411
|
#separator { cursor: row-resize; }
|
|
412
412
|
}
|
|
413
413
|
#separator { background-color: var(--rokit-light-background-darker-color-inner); }
|
|
414
|
-
`],Ro([Y()],zo.prototype,`pos`,2),Ro([Y()],zo.prototype,`minPos`,2),Ro([Y()],zo.prototype,`maxPos`,2),Ro([Y({reflect:!0})],zo.prototype,`dir`,2),Ro([Y()],zo.prototype,`sep`,2),Ro([Y({reflect:!0,type:Boolean})],zo.prototype,`dragging`,2),Ro([Y()],zo.prototype,`storageKey`,2),zo=Ro([Vi(`rokit-splitpane`)],zo);async function Bo(e){if(e.template.nodeShapes.size===0)return;let t=e.template.config.resourceLinkProvider;if((!t||t&&!t.lazyLoad)&&(await Wo(e.template),Ho(e).length===0))return;let n=e.template.config.theme.createButton(e.template.label,!1);n.title=`Link existing `+e.template.label,n.classList.add(`link-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}link-button`),n.addEventListener(`click`,async()=>{t?.lazyLoad&&(n.classList.add(`loading`),await Wo(e.template),n.classList.remove(`loading`));let r=Ho(e);if(r.length===0)n.innerText=`No linkable resources found`,n.setAttribute(`disabled`,``),setTimeout(()=>n.remove(),2e3);else{let t=e.template.config.form.querySelector(`#dialog`);t||(t=new Co,t.classList.add(`link-chooser`),t.closable=!0,e.template.config.form.appendChild(t)),t.title=`Link existing `+e.template.label,Vo(t,e,r),t.open=!0}}),n}function Vo(e,t,n){let r=document.createElement(`div`);for(let i of n){let n=document.createElement(`div`);n.classList.add(`link-option`),n.title=`Link this resource`,n.innerText=i.label||i.value,n.addEventListener(`click`,()=>{Uo(i.value,t),e.open=!1}),r.appendChild(n)}e.replaceChildren(r)}function Ho(e){let t=[];if(e.template.config.resourceLinkProvider){for(let n of e.template.nodeShapes)if(e.template.config.providedConformingResourceIds[n.id.value])for(let r of e.template.config.providedConformingResourceIds[n.id.value])e.querySelector(`:scope > .property-instance > shacl-node[data-node-id='${r}'], :scope > .collapsible > .property-instance > shacl-node[data-node-id='${r}']`)===null&&t.push({value:r,label:Rt(e.template.config.store.getQuads(k.namedNode(r),null,null,null),e.template.config.languages),children:[]})}return t}async function Uo(e,t){let n=k.namedNode(e);if(qo(n,t.template.config.store)){if(t.template.config.providedResources[e]?.length>0){let n={store:t.template.config.store,importedUrls:[],atts:{loadOwlImports:!1}};await rr(ar(t.template.config.providedResources[e]),n,vt),t.template.config.providedResources[e]=``}let r=await Zo(t.template,n,!0,!0);t.container.insertBefore(r,t.querySelector(`:scope > .add-button-wrapper`)),await t.updateControls()}}async function Wo(e){let t=e.config.resourceLinkProvider;if(!t)return;let n=new Set(Array.from(e.nodeShapes).map(e=>e.id.value));if(n.size===0)return;let r=Kt(Object.keys(e.config.providedConformingResourceIds),n);if(r.length!==0)try{let n=await t.listConformingResources(r,e);if(n){for(let t of Object.keys(n)){let r=new Set(n[t]);e.config.providedConformingResourceIds[t]=r,await Go(r,!1,e.config)}for(let t of r)e.config.providedConformingResourceIds[t]||(e.config.providedConformingResourceIds[t]=new Set)}}catch(e){console.error(`failed loading conforming resources`,e)}}async function Go(e,t,n){if(n.resourceLinkProvider&&e.size>0){let r=[];for(let t of e)n.providedResources[t]||r.push(t);if(r.length===0)return[];try{let e=await n.resourceLinkProvider.loadResources(r);if(e){let r={store:n.store,importedUrls:[],atts:{loadOwlImports:!1}};for(let i of e)n.providedResources[i.resourceId]=i.resourceRDF,t&&await rr(ar(i.resourceRDF),r,vt);return e}for(let e of r)n.providedResources[e]||(n.providedResources[e]=``)}catch(e){console.error(`failed loading resources`,e)}}return[]}async function Ko(e){let t=new Set;for(let n of e.store.getQuads(null,null,null,yt))qo(n.object,e.store)&&t.add(n.object.value);await Go(t,!0,e)}function qo(e,t){return e.termType===`NamedNode`&&t.countQuads(e,null,null,null)===0}var Jo=`:scope > .add-button-wrapper, :scope > .collapsible > .add-button-wrapper`,Yo=`:scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node, :scope > .collapsible > .property-instance`,Xo=class extends HTMLElement{constructor(e,t){if(super(),this.template=e,this.parent=t,this.container=this,this.setAttribute(`part`,`property`),this.template.nodeShapes.size&&this.template.config.attributes.collapse!==null&&(this.template.maxCount===void 0||this.template.maxCount>1)){let t=new Ca;t.classList.add(`collapsible`,`shacl-group`),t.open=e.config.attributes.collapse===`open`,t.label=this.template.label,t.setAttribute(`part`,`collapsible`),this.container=t,this.appendChild(this.container)}this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),e.config.editMode&&!t.linked&&this.addEventListener(`change`,async()=>{await this.updateControls()})}async bindValues(e,t){if(this.template.path){let n=!1;if(e){let r=this.template.config.store.getQuads(e,this.template.path,null,this.parent.linked?null:yt);t&&(r=await this.filterValidValues(r,e));for(let e of r)this.parent.linked||this.template.config.store.delete(e),await this.addPropertyInstance(e.object,!yt.equals(e.graph)||this.template.config.providedResources[e.object.value]!==void 0,this.template.config.providedResources[e.object.value]!==void 0),this.template.hasValue&&e.object.equals(this.template.hasValue)&&(n=!0)}this.template.config.editMode&&this.template.hasValue&&!n&&!this.parent.linked&&await this.addPropertyInstance(this.template.hasValue)}}async addPropertyInstance(e,t,n=!1){let r;if(this.template.or?.length||this.template.xone?.length){let t=this.template.or?.length?this.template.or:this.template.xone,n=!1;if(e){let i=gr(t,e,this.template.config);i.length&&(r=await Zo(pr(fr(this.template),i),e,!this.parent.linked,this.parent.linked,this.parent),n=!0)}!n&&this.template.config.editMode&&(r=hr(t,this,this.template.config),Qo(r,``,this.template.config.theme.dense,this.template.config.hierarchyColorsStyleSheet!==void 0))}else r=await Zo(this.template,e,n,t||this.parent.linked,this.parent);return r&&this.container.insertBefore(r,this.querySelector(Jo)),r}async updateControls(){this.template.config.editMode&&!this.parent.linked&&!this.querySelector(Jo)&&this.container.appendChild(await this.createAddControls());let e=ur(this.template),t=this.template.nodeShapes.size===0,n=this.querySelector(`:scope > .add-button-wrapper > .link-button, :scope > .collapsible > .add-button-wrapper > .link-button`)===null,r=t||!this.hasRecursiveNodeShape(),i=this.instanceCount();i===0&&r&&(t||n&&e>0)&&(await this.addPropertyInstance(),i=1),t||this.querySelector(Jo)?.classList.toggle(`required`,i<e);let a;a=e>0?i>e:!t||i>1;let o=i<dr(this.template);this.classList.toggle(`may-remove`,a),this.classList.toggle(`may-add`,o)}instanceCount(){return this.querySelectorAll(Yo).length}hasRecursiveNodeShape(){let e=new Set;this.parent.ancestorShapeIds.forEach(t=>e.add(t)),e.add(this.parent.template.id.value);for(let t of this.template.nodeShapes)if(e.has(t.id.value))return!0;return!1}toRDF(e,t){let n=k.namedNode(this.template.path);for(let r of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`))if(r.firstChild instanceof ls){let i=r.firstChild.toRDF(e);e.addQuad(t,n,i,this.template.config.valuesGraphId)}else if(this.template.config.editMode)for(let i of r.querySelectorAll(`:scope > .editor`)){let r=Cr(i);r&&e.addQuad(t,n,r,this.template.config.valuesGraphId)}else{let i=Cr(r);i&&e.addQuad(t,n,i,this.template.config.valuesGraphId)}}async filterValidValues(e,t){let n=this.template.id,r=[t];if(this.template.qualifiedValueShape){n=this.template.qualifiedValueShape.id,r=[];for(let t of e)r.push(t.object)}let i=await this.template.config.validator.validate({dataset:this.template.config.store,terms:r},[{terms:[n]}]),a=new Set;for(let e of i.results){let t=this.template.qualifiedValueShape?e.focusNode:e.value;t?.ptrs?.length&&a.add(t.ptrs[0]._term.id)}return e.filter(e=>!a.has(e.object.id))}async createAddControls(){let e=document.createElement(`div`);e.classList.add(`add-button-wrapper`),e.setAttribute(`part`,`add-controls`);let t=await Bo(this);t&&e.appendChild(t);let n=this.template.config.theme.createButton(this.template.label,!1);n.title=`Add `+this.template.label,n.classList.add(`add-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}add-button`),n.addEventListener(`click`,async()=>{let e=await this.addPropertyInstance();e&&(e.classList.add(`fadeIn`),await this.updateControls(),setTimeout(()=>{Lt(e),e.classList.remove(`fadeIn`)},200))}),e.appendChild(n),e}};async function Zo(e,t,n=!1,r=!1,i){let a;if(e.nodeShapes.size){a=document.createElement(`div`),a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`);let n=new Set(i?.ancestorShapeIds??[]);i&&n.add(i.template.id.value);for(let i of e.nodeShapes){let o=new ls(i,t,e.nodeKind,e.label,r,n);a.appendChild(o),await o.ready}}else{let n=Dr(e.path,e.datatype?.value);a=n?e.config.editMode&&!r?n.createEditor(e,t):n.createViewer(e,t):br(e,t||null,e.config.editMode&&!r),a.childNodes.length>0&&(a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`)),r&&a.classList.add(`linked`)}return e.config.editMode&&(!r||n)?Qo(a,e.label,e.config.theme.dense,e.config.hierarchyColorsStyleSheet!==void 0,n):e.config.hierarchyColorsStyleSheet!==void 0&&a.appendChild($o(!0)),t&&!e.config.editMode&&(t instanceof M?(a.dataset.value=t.value,t.language.length>0?a.dataset.lang=t.language:a.shaclDatatype=t.datatype):a.dataset.value=`<`+t.value+`>`),a.dataset.path=e.path,a}function Qo(e,t,n,r,i=!1){let a=$o(r),o=new la;o.classList.add(`remove-button`,`clear`),o.title=`Remove `+t,o.dense=n,o.icon=!0;let s=o.getAttribute(`part`);o.setAttribute(`part`,`${s?s+` `:``}remove-button`),o.addEventListener(`click`,()=>{e.classList.remove(`fadeIn`),e.classList.add(`fadeOut`),setTimeout(()=>{let t=e.parentElement;e.remove(),t?.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}))},200)}),i&&o.classList.add(`persistent`),a.appendChild(o),e.appendChild(a)}function $o(e){let t=document.createElement(`div`);return t.className=`remove-button-wrapper`,t.setAttribute(`part`,`remove-controls`),e&&t.classList.add(`colorize`),t}window.customElements.define(`shacl-property`,Xo);function es(e,t){let n=e,r=t.store.getQuads(e,null,null,null),i=Ft(r,`label`,mt,t.languages);i&&(n=i);let a;if(t.attributes.collapse!==null)a=new Ca,a.classList.add(`collapsible`),a.open=t.attributes.collapse===`open`,a.label=n,a.setAttribute(`part`,`group collapsible`);else{a=document.createElement(`div`);let e=document.createElement(`h1`);e.innerText=n,e.setAttribute(`part`,`group-title`),a.appendChild(e),a.setAttribute(`part`,`group`)}a.dataset.subject=e,a.classList.add(`shacl-group`);let o=Ft(r,`order`);return o&&(a.style.order=o),a}var ts=[];for(let e=0;e<256;++e)ts.push((e+256).toString(16).slice(1));function ns(e,t=0){return(ts[e[t+0]]+ts[e[t+1]]+ts[e[t+2]]+ts[e[t+3]]+`-`+ts[e[t+4]]+ts[e[t+5]]+`-`+ts[e[t+6]]+ts[e[t+7]]+`-`+ts[e[t+8]]+ts[e[t+9]]+`-`+ts[e[t+10]]+ts[e[t+11]]+ts[e[t+12]]+ts[e[t+13]]+ts[e[t+14]]+ts[e[t+15]]).toLowerCase()}var rs,is=new Uint8Array(16);function as(){if(!rs){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);rs=crypto.getRandomValues.bind(crypto)}return rs(is)}var os={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ss(e,t,n){e||={};let r=e.random??e.rng?.()??as();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return ns(r)}function cs(e,t,n){return os.randomUUID&&!t&&!e?os.randomUUID():ss(e,t,n)}var ls=class e extends HTMLElement{constructor(t,n,r,i,a,o=new Set){super(),this.template=t,this.linked=a??!1,this.ancestorShapeIds=o,this.setAttribute(`part`,`node`);let s=n;s||=(!r&&t.nodeKind&&(r=t.nodeKind),r===void 0&&t.config.attributes.valuesNamespace||r?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(t.config.attributes.valuesNamespace+cs()):k.blankNode(cs())),this.nodeId=s;let c=JSON.stringify([t.id,n]);if(n&&t.config.renderedNodes.has(c)){i||=`Link`;let e=document.createElement(`label`);e.innerText=i,e.classList.add(`linked`),this.appendChild(e);let t=this.getAttribute(`part`);this.setAttribute(`part`,`${t?t+` `:``}linked-node`);let r=document.createElement(`a`),a=n.termType===`BlankNode`?`_:`+n.value:n.value;r.innerText=a,r.classList.add(`ref-link`),r.onclick=()=>{this.template.config.form.querySelector(`shacl-node[data-node-id='${a}']`)?.scrollIntoView()},this.appendChild(r),this.style.flexDirection=`row`,this.ready=Promise.resolve()}else{n&&t.config.renderedNodes.add(c);let r=this.ancestorShapeIds,o=this.template.id.value;if(this.dataset.nodeId=this.nodeId.id,this.template.config.attributes.showNodeIds!==null){let e=document.createElement(`div`);e.innerText=`id: ${this.nodeId.id}`,e.classList.add(`node-id-display`),this.appendChild(e)}this.ready=(async()=>{let s=new Set(r);s.add(o);for(let[e,r]of Object.entries(t.properties))for(let e of r)await this.addPropertyInstance(e,n,r.length>1);for(let r of t.extendedShapes){let t=new e(r,n,void 0,void 0,a,s);this.prepend(t),await t.ready}if(t.or?.length&&await this.tryResolve(t.or,n,t.config),t.xone?.length&&await this.tryResolve(t.xone,n,t.config),i){let e=document.createElement(`h1`);e.innerText=i,e.setAttribute(`part`,`node-title`),this.prepend(e)}})()}}toRDF(e,t,n=``){if(t||=this.nodeId,!this.linked){for(let n of this.querySelectorAll(`:scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property`))n.toRDF(e,t);this.template.targetClass&&e.addQuad(t,bt,this.template.targetClass,this.template.config.valuesGraphId),n&&e.addQuad(t,k.namedNode(n),this.template.id,this.template.config.valuesGraphId)}return t}async addPropertyInstance(e,t,n){let r=null;if(e.group)if(e.config.groups.indexOf(e.group)>-1){let t=this.querySelector(`:scope > .shacl-group[data-subject='${e.group}']`);t||(t=es(e.group,e.config),this.appendChild(t)),r=t}else console.warn(`ignoring unknown group reference`,e.group,`existing groups:`,e.config.groups);let i=new Xo(e,this);await i.bindValues(t,n),(e.config.editMode||i.instanceCount()>0)&&(r?r.appendChild(i):this.appendChild(i),await i.updateControls())}async tryResolve(e,t,n){let r=!1;if(t){let i=_r(e,t,n);if(i.length){for(let e of i)await this.addPropertyInstance(n.getPropertyTemplate(e,this.template),t);r=!0}}r||this.appendChild(hr(e,this,n))}};window.customElements.define(`shacl-node`,ls);var us=`
|
|
414
|
+
`],Go([Y()],Ko.prototype,`pos`,2),Go([Y()],Ko.prototype,`minPos`,2),Go([Y()],Ko.prototype,`maxPos`,2),Go([Y({reflect:!0})],Ko.prototype,`dir`,2),Go([Y()],Ko.prototype,`sep`,2),Go([Y({reflect:!0,type:Boolean})],Ko.prototype,`dragging`,2),Go([Y()],Ko.prototype,`storageKey`,2),Ko=Go([Ji(`rokit-splitpane`)],Ko);async function qo(e){if(e.template.nodeShapes.size===0)return;let t=e.template.config.resourceLinkProvider;if((!t||t&&!t.lazyLoad)&&(await Zo(e.template),Yo(e).length===0))return;let n=e.template.config.theme.createButton(e.template.label,!1);n.title=`Link existing `+e.template.label,n.classList.add(`link-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}link-button`),n.addEventListener(`click`,async()=>{t?.lazyLoad&&(n.classList.add(`loading`),await Zo(e.template),n.classList.remove(`loading`));let r=Yo(e);if(r.length===0)n.innerText=`No linkable resources found`,n.setAttribute(`disabled`,``),setTimeout(()=>n.remove(),2e3);else{let t=e.template.config.form.querySelector(`#dialog`);t||(t=new Ao,t.classList.add(`link-chooser`),t.closable=!0,e.template.config.form.appendChild(t)),t.title=`Link existing `+e.template.label,Jo(t,e,r),t.open=!0}}),n}function Jo(e,t,n){let r=document.createElement(`div`);for(let i of n){let n=document.createElement(`div`);n.classList.add(`link-option`),n.title=`Link this resource`,n.innerText=i.label||i.value,n.addEventListener(`click`,()=>{Xo(i.value,t),e.open=!1}),r.appendChild(n)}e.replaceChildren(r)}function Yo(e){let t=[];if(e.template.config.resourceLinkProvider){for(let n of e.template.nodeShapes)if(e.template.config.providedConformingResourceIds[n.id.value])for(let r of e.template.config.providedConformingResourceIds[n.id.value])e.querySelector(`:scope > .property-instance > shacl-node[data-node-id='${r}'], :scope > .collapsible > .property-instance > shacl-node[data-node-id='${r}']`)===null&&t.push({value:r,label:Rt(e.template.config.store.getQuads(k.namedNode(r),null,null,null),e.template.config.languages),children:[]})}return t}async function Xo(e,t){let n=k.namedNode(e);if(es(n,t.template.config.store)){if(t.template.config.providedResources[e]?.length>0){let n={store:t.template.config.store,importedUrls:[],atts:{loadOwlImports:!1}};await ur(fr(t.template.config.providedResources[e]),n,vt),t.template.config.providedResources[e]=``}let r=await is(t.template,n,!0,!0);t.container.insertBefore(r,t.querySelector(`:scope > .add-button-wrapper`)),await t.updateControls()}}async function Zo(e){let t=e.config.resourceLinkProvider;if(!t)return;let n=new Set(Array.from(e.nodeShapes).map(e=>e.id.value));if(n.size===0)return;let r=$t(Object.keys(e.config.providedConformingResourceIds),n);if(r.length!==0)try{let n=await t.listConformingResources(r,e);if(n){for(let t of Object.keys(n)){let r=new Set(n[t]);e.config.providedConformingResourceIds[t]=r,await Qo(r,!1,e.config)}for(let t of r)e.config.providedConformingResourceIds[t]||(e.config.providedConformingResourceIds[t]=new Set)}}catch(e){console.error(`failed loading conforming resources`,e)}}async function Qo(e,t,n){if(n.resourceLinkProvider&&e.size>0){let r=[];for(let t of e)n.providedResources[t]||r.push(t);if(r.length===0)return[];try{let e=await n.resourceLinkProvider.loadResources(r);if(e){let r={store:n.store,importedUrls:[],atts:{loadOwlImports:!1}};for(let i of e)n.providedResources[i.resourceId]=i.resourceRDF,t&&await ur(fr(i.resourceRDF),r,vt);return e}for(let e of r)n.providedResources[e]||(n.providedResources[e]=``)}catch(e){console.error(`failed loading resources`,e)}}return[]}async function $o(e){let t=new Set;for(let n of e.store.getQuads(null,null,null,yt))es(n.object,e.store)&&t.add(n.object.value);await Qo(t,!0,e)}function es(e,t){return e.termType===`NamedNode`&&t.countQuads(e,null,null,null)===0}var ts=`:scope > .add-button-wrapper, :scope > .collapsible > .add-button-wrapper`,ns=`:scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node, :scope > .collapsible > .property-instance`,rs=class extends HTMLElement{constructor(e,t){if(super(),this.template=e,this.parent=t,this.container=this,this.setAttribute(`part`,`property`),this.template.nodeShapes.size&&this.template.config.attributes.collapse!==null&&(this.template.maxCount===void 0||this.template.maxCount>1)){let t=new Aa;t.classList.add(`collapsible`,`shacl-group`),t.open=e.config.attributes.collapse===`open`,t.label=this.template.label,t.setAttribute(`part`,`collapsible`),this.container=t,this.appendChild(this.container)}this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),e.config.editMode&&!t.linked&&this.addEventListener(`change`,async()=>{await this.updateControls()})}async bindValues(e,t){if(this.template.path){let n=!1;if(e){let r=this.template.config.store.getQuads(e,this.template.path,null,this.parent.linked?null:yt);t&&(r=await this.filterValidValues(r,e));for(let e of r)this.parent.linked||this.template.config.store.delete(e),await this.addPropertyInstance(e.object,!yt.equals(e.graph)||this.template.config.providedResources[e.object.value]!==void 0,this.template.config.providedResources[e.object.value]!==void 0),this.template.hasValue&&e.object.equals(this.template.hasValue)&&(n=!0)}this.template.config.editMode&&this.template.hasValue&&!n&&!this.parent.linked&&await this.addPropertyInstance(this.template.hasValue)}}async addPropertyInstance(e,t,n=!1){let r;if(this.template.or?.length||this.template.xone?.length){let t=this.template.or?.length?this.template.or:this.template.xone,n=!1;if(e){let i=Cr(t,e,this.template.config);i.length&&(r=await is(br(yr(this.template),i),e,!this.parent.linked,this.parent.linked,this.parent),n=!0)}!n&&this.template.config.editMode&&(r=Sr(t,this,this.template.config),as(r,``,this.template.config.theme.dense,this.template.config.hierarchyColorsStyleSheet!==void 0))}else r=await is(this.template,e,n,t||this.parent.linked,this.parent);return r&&this.container.insertBefore(r,this.querySelector(ts)),r}async updateControls(){this.template.config.editMode&&!this.parent.linked&&!this.querySelector(ts)&&this.container.appendChild(await this.createAddControls());let e=_r(this.template),t=this.template.nodeShapes.size===0,n=this.querySelector(`:scope > .add-button-wrapper > .link-button, :scope > .collapsible > .add-button-wrapper > .link-button`)===null,r=t||!this.hasRecursiveNodeShape(),i=this.instanceCount();i===0&&r&&(t||n&&e>0)&&(await this.addPropertyInstance(),i=1),t||this.querySelector(ts)?.classList.toggle(`required`,i<e);let a;a=e>0?i>e:!t||i>1;let o=i<vr(this.template);this.classList.toggle(`may-remove`,a),this.classList.toggle(`may-add`,o)}instanceCount(){return this.querySelectorAll(ns).length}hasRecursiveNodeShape(){let e=new Set;this.parent.ancestorShapeIds.forEach(t=>e.add(t)),e.add(this.parent.template.id.value);for(let t of this.template.nodeShapes)if(e.has(t.id.value))return!0;return!1}toRDF(e,t){let n=k.namedNode(this.template.path);for(let r of this.querySelectorAll(`:scope > .property-instance, :scope > .collapsible > .property-instance`))if(r.firstChild instanceof xs){let i=r.firstChild.toRDF(e);e.addQuad(t,n,i,this.template.config.valuesGraphId)}else if(this.template.config.editMode)for(let i of r.querySelectorAll(`:scope > .editor`)){let r=Ar(i);r&&e.addQuad(t,n,r,this.template.config.valuesGraphId)}else{let i=Ar(r);i&&e.addQuad(t,n,i,this.template.config.valuesGraphId)}}async filterValidValues(e,t){let n=this.template.id,r=[t];if(this.template.qualifiedValueShape){n=this.template.qualifiedValueShape.id,r=[];for(let t of e)r.push(t.object)}let i=await this.template.config.validator.validate({dataset:this.template.config.store,terms:r},[{terms:[n]}]),a=new Set;for(let e of i.results){let t=this.template.qualifiedValueShape?e.focusNode:e.value;t?.ptrs?.length&&a.add(t.ptrs[0]._term.id)}return e.filter(e=>!a.has(e.object.id))}async createAddControls(){let e=document.createElement(`div`);e.classList.add(`add-button-wrapper`),e.setAttribute(`part`,`add-controls`);let t=await qo(this);t&&e.appendChild(t);let n=this.template.config.theme.createButton(this.template.label,!1);n.title=`Add `+this.template.label,n.classList.add(`add-button`),n.setAttribute(`text`,``);let r=n.getAttribute(`part`);return n.setAttribute(`part`,`${r?r+` `:``}add-button`),n.addEventListener(`click`,async()=>{let e=await this.addPropertyInstance();e&&(e.classList.add(`fadeIn`),await this.updateControls(),setTimeout(()=>{Lt(e),e.classList.remove(`fadeIn`)},200))}),e.appendChild(n),e}};async function is(e,t,n=!1,r=!1,i){let a;if(e.nodeShapes.size){a=document.createElement(`div`),a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`);let n=new Set(i?.ancestorShapeIds??[]);i&&n.add(i.template.id.value);for(let i of e.nodeShapes){let o=new xs(i,t,e.nodeKind,e.label,r,n);a.appendChild(o),await o.ready}}else{let n=Pr(e.path,e.datatype?.value);a=n?e.config.editMode&&!r?n.createEditor(e,t):n.createViewer(e,t):Dr(e,t||null,e.config.editMode&&!r),a.childNodes.length>0&&(a.classList.add(`property-instance`),a.setAttribute(`part`,`property-instance`)),r&&a.classList.add(`linked`)}return e.config.editMode&&(!r||n)?as(a,e.label,e.config.theme.dense,e.config.hierarchyColorsStyleSheet!==void 0,n):e.config.hierarchyColorsStyleSheet!==void 0&&a.appendChild(os(!0)),t&&!e.config.editMode&&(t instanceof M?(a.dataset.value=t.value,t.language.length>0?a.dataset.lang=t.language:a.shaclDatatype=t.datatype):a.dataset.value=`<`+t.value+`>`),a.dataset.path=e.path,a}function as(e,t,n,r,i=!1){let a=os(r),o=new ga;o.classList.add(`remove-button`,`clear`),o.title=`Remove `+t,o.dense=n,o.icon=!0;let s=o.getAttribute(`part`);o.setAttribute(`part`,`${s?s+` `:``}remove-button`),o.addEventListener(`click`,()=>{e.classList.remove(`fadeIn`),e.classList.add(`fadeOut`),setTimeout(()=>{let t=e.parentElement;e.remove(),t?.dispatchEvent(new Event(`change`,{bubbles:!0,cancelable:!0}))},200)}),i&&o.classList.add(`persistent`),a.appendChild(o),e.appendChild(a)}function os(e){let t=document.createElement(`div`);return t.className=`remove-button-wrapper`,t.setAttribute(`part`,`remove-controls`),e&&t.classList.add(`colorize`),t}window.customElements.define(`shacl-property`,rs);function ss(e,t){let n=e,r=t.store.getQuads(e,null,null,null),i=Ft(r,`label`,mt,t.languages);i&&(n=i);let a;if(t.attributes.collapse!==null)a=new Aa,a.classList.add(`collapsible`),a.open=t.attributes.collapse===`open`,a.label=n,a.setAttribute(`part`,`group collapsible`);else{a=document.createElement(`div`);let e=document.createElement(`h1`);e.innerText=n,e.setAttribute(`part`,`group-title`),a.appendChild(e),a.setAttribute(`part`,`group`)}a.dataset.subject=e,a.classList.add(`shacl-group`);let o=Ft(r,`order`);return o&&(a.style.order=o),a}var cs=[];for(let e=0;e<256;++e)cs.push((e+256).toString(16).slice(1));function ls(e,t=0){return(cs[e[t+0]]+cs[e[t+1]]+cs[e[t+2]]+cs[e[t+3]]+`-`+cs[e[t+4]]+cs[e[t+5]]+`-`+cs[e[t+6]]+cs[e[t+7]]+`-`+cs[e[t+8]]+cs[e[t+9]]+`-`+cs[e[t+10]]+cs[e[t+11]]+cs[e[t+12]]+cs[e[t+13]]+cs[e[t+14]]+cs[e[t+15]]).toLowerCase()}var us,ds=new Uint8Array(16);function fs(){if(!us){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);us=crypto.getRandomValues.bind(crypto)}return us(ds)}var ps={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ms(e,t,n){e||={};let r=e.random??e.rng?.()??fs();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return ls(r)}function hs(e,t,n){return ps.randomUUID&&!t&&!e?ps.randomUUID():ms(e,t,n)}var gs={[`${W}node`]:(e,t)=>{e.extendedShapes.add(new _s(t,e.config,e))},[`${W}and`]:(e,t)=>{for(let n of e.config.lists[t.value])e.extendedShapes.add(new _s(n,e.config,e))},[`${W}property`]:(e,t)=>{let n=e.config.getPropertyTemplate(t,e);if(n.path){let t=e.properties[n.path];if(t||(t=[],e.properties[n.path]=t),n.qualifiedValueShape)t.push(n);else{let r;for(let t=0;t<e.properties[n.path].length&&!r;t++)e.properties[n.path][t].qualifiedValueShape||(r=e.properties[n.path][t]);r?xr(r,n):t.push(n)}}},[`${W}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${W}targetClass`]:(e,t)=>{e.targetClass=t},[`${W}or`]:(e,t)=>{e.or=e.config.lists[t.value]},[`${W}xone`]:(e,t)=>{e.xone=e.config.lists[t.value]},[Ct.id]:(e,t)=>{e.owlImports.add(t)},[`${_t}title`]:(e,t)=>{let n=t;e.label=q(e.config.languages,e.label,n)},[`${mt}label`]:(e,t)=>{let n=t;e.label=q(e.config.languages,e.label,n)}},_s=class{constructor(e,t,n){this.extendedShapes=new Set,this.properties={},this.owlImports=new Set,this.merged=!1,this.id=e,this.config=t,this.parent=n,t.registerNodeTemplate(this),vs(this,this.config.store.getQuads(e,null,null,null))}};function vs(e,t){for(let n of t)gs[n.predicate.id]?.call(e,e,n.object);return e}function ys(e){if(!e.merged){e.merged=!0;for(let t of Object.values(e.properties))for(let n of t){let[t,r]=bs(e,n.path);if(t.length>1&&r){let e=t[t.length-1];for(let n=t.length-2;n>=0;n--){let r=t[n];delete r.parent.properties[r.path],xr(e,r)}}}}}function bs(e,t,n=new Set,r=[],i=!1){if(!n.has(e.id.value)){n.add(e.id.value);let a=e.properties[t];if(a?.length===1){r.push(a[0]),i||=a[0].maxCount===1;for(let e of a[0].nodeShapes){let[a,o]=bs(e,t,n,r,i);i||=o}}for(let a of e.extendedShapes){let[e,o]=bs(a,t,n,r,i);i||=o}}return[r,i]}var xs=class e extends HTMLElement{constructor(t,n,r,i,a,o=new Set){super(),this.template=t,this.linked=a??!1,this.ancestorShapeIds=o,this.setAttribute(`part`,`node`);let s=n;s||=(!r&&t.nodeKind&&(r=t.nodeKind),r===void 0&&t.config.attributes.valuesNamespace||r?.value===`http://www.w3.org/ns/shacl#IRI`?k.namedNode(t.config.attributes.valuesNamespace+hs()):k.blankNode(hs())),this.nodeId=s;let c=JSON.stringify([t.id,n]);if(n&&t.config.renderedNodes.has(c)){i||=`Link`;let e=document.createElement(`label`);e.innerText=i,e.classList.add(`linked`),this.appendChild(e);let t=this.getAttribute(`part`);this.setAttribute(`part`,`${t?t+` `:``}linked-node`);let r=document.createElement(`a`),a=n.termType===`BlankNode`?`_:`+n.value:n.value;r.innerText=a,r.classList.add(`ref-link`),r.onclick=()=>{this.template.config.form.querySelector(`shacl-node[data-node-id='${a}']`)?.scrollIntoView()},this.appendChild(r),this.style.flexDirection=`row`,this.ready=Promise.resolve()}else{n&&t.config.renderedNodes.add(c);let r=this.ancestorShapeIds,o=this.template.id.value;if(this.dataset.nodeId=this.nodeId.id,this.template.config.attributes.showNodeIds!==null){let e=document.createElement(`div`);e.innerText=`id: ${this.nodeId.id}`,e.classList.add(`node-id-display`),this.appendChild(e)}ys(t),this.ready=(async()=>{let s=new Set(r);s.add(o);for(let[e,r]of Object.entries(t.properties))for(let e of r)await this.addPropertyInstance(e,n,r.length>1);for(let r of t.extendedShapes){let t=new e(r,n,void 0,void 0,a,s);this.prepend(t),await t.ready}if(t.or?.length&&await this.tryResolve(t.or,n,t.config),t.xone?.length&&await this.tryResolve(t.xone,n,t.config),i){let e=document.createElement(`h1`);e.innerText=i,e.setAttribute(`part`,`node-title`),this.prepend(e)}})()}}toRDF(e,t,n=``){if(t||=this.nodeId,!this.linked){for(let n of this.querySelectorAll(`:scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property`))n.toRDF(e,t);this.template.targetClass&&e.addQuad(t,bt,this.template.targetClass,this.template.config.valuesGraphId),n&&e.addQuad(t,k.namedNode(n),this.template.id,this.template.config.valuesGraphId)}return t}async addPropertyInstance(e,t,n){let r=null;if(e.group)if(e.config.groups.indexOf(e.group)>-1){let t=this.querySelector(`:scope > .shacl-group[data-subject='${e.group}']`);t||(t=ss(e.group,e.config),this.appendChild(t)),r=t}else console.warn(`ignoring unknown group reference`,e.group,`existing groups:`,e.config.groups);let i=new rs(e,this);await i.bindValues(t,n),(e.config.editMode||i.instanceCount()>0)&&(r?r.appendChild(i):this.appendChild(i),await i.updateControls())}async tryResolve(e,t,n){let r=!1;if(t){let i=wr(e,t,n);if(i.length){for(let e of i)await this.addPropertyInstance(n.getPropertyTemplate(e,this.template),t);r=!0}}r||this.appendChild(Sr(e,this,n))}};window.customElements.define(`shacl-node`,xs);var Ss=`
|
|
415
415
|
.editor:not([type='checkbox']) { border: 1px solid var(--shacl-border-color, #DDD); }
|
|
416
416
|
.property-instance label { display: inline-flex; word-break: break-word; line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }
|
|
417
417
|
.property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
|
|
418
418
|
.mode-edit .property-instance label { width: var(--label-width); }
|
|
419
|
-
`,
|
|
419
|
+
`,Cs=class extends Er{constructor(e){super(e||Ss),this.idCtr=0}createDefaultTemplate(e,t,n,r,i){if(r.id=`e${this.idCtr++}`,r.classList.add(`editor`),r.setAttribute(`part`,`editor`),i?.datatype?r.shaclDatatype=i.datatype:t instanceof M&&(r.shaclDatatype=t.datatype),i&&_r(i)>0&&(r.dataset.minCount=String(_r(i))),i?.class&&(r.dataset.class=i.class.value),i?.nodeKind)r.dataset.nodeKind=i.nodeKind.value;else if(t&&(t instanceof j||i?.nodeKind?.equals(Dt))&&(r.dataset.nodeKind=W+`IRI`,i)){let e=Rt(i.config.store.getQuads(t,null,null,null),i.config.languages);e&&(r.dataset.value=`<`+t.value+`>`,t=k.literal(e))}(i?.hasValue&&t||i?.readonly)&&(r.disabled=!0);let a=t?.value||i?.defaultValue?.value||``;i?.datatype?.equals(Pt)?r.checked=t?.value===`true`||i?.defaultValue?.value===`true`:r.type===`file`?r.binaryData=a||void 0:r.value=a;let o=document.createElement(`label`);o.htmlFor=r.id,o.innerText=e,o.setAttribute(`part`,`label`),i?.description&&o.setAttribute(`title`,i.description.value);let s=i?.description?i.description.value:i?.pattern?i.pattern:null;s&&r.setAttribute(`placeholder`,s),n&&(r.setAttribute(`required`,`true`),o.classList.add(`required`));let c=document.createElement(`div`);return c.setAttribute(`part`,`field`),c.appendChild(o),c.appendChild(r),c}createDateEditor(e,t,n,r){let i=new Va;r.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?(i.type=`datetime-local`,i.setAttribute(`step`,`1`)):i.type=`date`,i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let a=this.createDefaultTemplate(e,null,n,i,r);if(t){let e=r.datatype?.value===`http://www.w3.org/2001/XMLSchema#dateTime`?Yt(t.value):Jt(t.value);e?(i.value=e.value,e.suffix&&(i.dataset.xsdTemporalSuffix=e.suffix)):console.error(`unable to parse xsd date literal`,t)}return a}createTextEditor(e,t,n,r){let i;return r.singleLine===!1?(i=new mo,i.resize=`auto`):i=new Va,i.dense=this.dense,r.pattern&&(i.pattern=r.pattern),r.minLength&&(i.minLength=r.minLength),r.maxLength&&(i.maxLength=r.maxLength),this.createDefaultTemplate(e,t,n,i,r)}createLangStringEditor(e,t,n,r){let i=this.createTextEditor(e,t,n,r),a=i.querySelector(`:scope .editor`),o;if(r.languageIn?.length){o=document.createElement(`select`);for(let e of r.languageIn){let t=document.createElement(`option`);t.innerText=e.value,o.appendChild(t)}}else o=document.createElement(`input`),o.maxLength=5,o.size=5,o.placeholder=`lang?`;return o.title=`Language of the text`,o.classList.add(`lang-chooser`),o.setAttribute(`part`,`lang-chooser`),o.slot=`suffix`,a.addEventListener(`change`,()=>{o.required=a.value!==``}),o.addEventListener(`change`,e=>{e.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event(`change`,{bubbles:!0})))}),t instanceof M&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),i}createBooleanEditor(e,t,n,r){let i=document.createElement(`input`);i.type=`checkbox`,i.classList.add(`ml-0`);let a=this.createDefaultTemplate(e,null,n,i,r);return i.removeAttribute(`required`),a.querySelector(`:scope label`)?.classList.remove(`required`),t instanceof M&&(i.checked=t.value===`true`),a}createFileEditor(e,t,n,r){let i=document.createElement(`input`);return i.type=`file`,i.addEventListener(`change`,e=>{if(i.files?.length){e.stopPropagation();let t=new FileReader;t.readAsDataURL(i.files[0]),t.onload=()=>{i.binaryData=btoa(t.result),i.parentElement?.dispatchEvent(new Event(`change`,{bubbles:!0}))}}else i.binaryData=void 0}),this.createDefaultTemplate(e,t,n,i,r)}createNumberEditor(e,t,n,r){let i=new Va;i.type=`number`,i.clearable=!0,i.dense=this.dense,i.classList.add(`pr-0`);let a=r.minInclusive===void 0?r.minExclusive===void 0?void 0:r.minExclusive+1:r.minInclusive,o=r.maxInclusive===void 0?r.maxExclusive===void 0?void 0:r.maxExclusive-1:r.maxInclusive;return a!==void 0&&(i.min=String(a)),o!==void 0&&(i.max=String(o)),r.datatype?.value!==`http://www.w3.org/2001/XMLSchema#integer`&&(i.step=`any`),this.createDefaultTemplate(e,t,n,i,r)}createListEditor(e,t,n,r,i){let a=new no;a.clearable=!0,a.dense=this.dense;let o=this.createDefaultTemplate(e,null,n,a,i),s=document.createElement(`ul`),c=!0,l=(e,t)=>{let n=document.createElement(`li`);if(typeof e.value==`string`?(n.dataset.value=e.value,n.innerText=e.label?e.label:e.value):(n.dataset.value=e.value.id,e.value instanceof j&&(n.dataset.value=`<`+n.dataset.value+`>`),n.innerText=e.label?e.label:e.value.value),t.appendChild(n),e.children?.length){c=!1;let t=document.createElement(`ul`);n.appendChild(t);for(let n of e.children)l(n,t)}};for(let e of r)l(e,s);return c||(a.collapse=!0),a.appendChild(s),t=t??i?.defaultValue??null,t&&(a.value=t.id,t instanceof j&&(a.value=`<`+a.value+`>`)),o}createButton(e,t){let n=new ga;return n.dense=this.dense,n.innerHTML=e,t?(n.setAttribute(`primary`,``),n.setAttribute(`part`,`button primary`)):n.setAttribute(`part`,`button`),n}};function ws(e){return`_:`+e.value}function Ts(e,t){return[...e].map(e=>t(e)).join(`
|
|
420
420
|
`)+`
|
|
421
|
-
`}function ms(){return``}function hs(e){return`<`+e.value+`>`}var gs=/["\\\\\n\r]/,_s=/["\\\\\n\r]/g,vs={'"':`\\"`,"\\":`\\\\`,"\n":`\\n`,"\r":`\\r`};function ys(e){return vs[e]}function bs(e){return gs.test(e)?e.replace(_s,ys):e}function xs(e){let t=bs(e.value);return e.datatype.value===`http://www.w3.org/2001/XMLSchema#string`?`"`+t+`"`:e.datatype.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`?`"`+t+`"@`+e.language:`"`+t+`"^^`+hs(e.datatype)}function Ss(e,t){let n=t(e.subject),r=t(e.predicate),i=t(e.object),a=t(e.graph);return`${n} ${r} ${i} ${a?a+` `:``}.`}function Cs(e){return`?`+e.value}function ws(e){if(!e)return null;if(e.termType===`BlankNode`)return fs(e);if(e.termType===`DefaultGraph`)return ms();if(e.termType===`Literal`)return xs(e);if(e.termType===`NamedNode`)return hs(e);if(e.termType===`Quad`||e.subject&&e.predicate&&e.object&&e.graph)return Ss(e,ws);if(e.termType===`Variable`)return Cs(e);if(e[Symbol.iterator])return ps(e,ws);throw Error(`unknown termType ${e.termType}`)}var Ts=class{constructor(e){if(this.index=new Map,e)for(let[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(ws(e))}*entries(){for(let[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(let n of this.entries())e.call(t,n[1],n[0],this)}get(e){let t=this.index.get(ws(e));return t&&t.value}has(e){return this.index.has(ws(e))}*keys(){for(let[,{term:e}]of this.index)yield e}set(e,t){let n=ws(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(let[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}},Es=class{constructor({dataset:e,end:t,quad:n,start:r}){this.dataset=e,this.end=t,this.quad=n,this.start=r}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}};function Ds(e){try{return ws(e)}catch{return null}}var Os=class{constructor(e){if(this.index=new Map,e)for(let t of e)this.add(t)}get size(){return this.index.size}add(e){let t=ws(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(Ds(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(Ds(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}},ks=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};ks.prototype.termType=`BlankNode`;var As=class{equals(e){return!!e&&e.termType===this.termType}};As.prototype.termType=`DefaultGraph`,As.prototype.value=``;function js(e,t){if(!t)return null;if(t.termType===`BlankNode`)return e.blankNode(t.value);if(t.termType===`DefaultGraph`)return e.defaultGraph();if(t.termType===`Literal`)return e.literal(t.value,t.language||e.namedNode(t.datatype.value));if(t.termType===`NamedNode`)return e.namedNode(t.value);if(t.termType===`Quad`){let n=e.fromTerm(t.subject),r=e.fromTerm(t.predicate),i=e.fromTerm(t.object),a=e.fromTerm(t.graph);return e.quad(n,r,i,a)}if(t.termType===`Variable`)return e.variable(t.value);throw Error(`unknown termType ${t.termType}`)}var Ms=class{constructor(e,t,n,r=``){this.value=e,this.language=t,this.datatype=n,this.direction=r}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)&&(e.direction||``)===this.direction}};Ms.prototype.termType=`Literal`;var Ns=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Ns.prototype.termType=`NamedNode`;var Ps=class{constructor(e,t,n,r){this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&(e.termType===`Quad`||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}};Ps.prototype.termType=`Quad`,Ps.prototype.value=``;var Fs=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Fs.prototype.termType=`Variable`;var Is=new Ns(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),Ls=new Ns(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),Rs=new Ns(`http://www.w3.org/2001/XMLSchema#string`),zs=class{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new As}}namedNode(e){return new Ns(e)}blankNode(e){return e||=`b`+ ++this._data.blankNodeCounter,new ks(e)}literal(e,t){return typeof t==`string`?new Ms(e,t,Ls):typeof t?.language==`string`?new Ms(e,t.language,t.direction?Is:Ls,t.direction):new Ms(e,``,t||Rs)}variable(e){return new Fs(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,r=this.defaultGraph()){return new Ps(e,t,n,r)}fromTerm(e){return js(this,e)}fromQuad(e){return js(this,e)}};zs.exports=[`blankNode`,`defaultGraph`,`fromQuad`,`fromTerm`,`literal`,`namedNode`,`quad`,`variable`];var Bs=new zs,Vs={apply:(e,t,n)=>e(n[0]),get:(e,t)=>e(t)};function Hs(e,{factory:t=Bs}={}){let n=(n=``)=>t.namedNode(`${e}${n.raw||n}`);return typeof Proxy>`u`?n:new Proxy(n,Vs)}Hs(`http://www.w3.org/2001/XMLSchema#`);var Us=Hs(`http://www.w3.org/1999/02/22-rdf-syntax-ns#`);Hs(`http://www.w3.org/2000/01/rdf-schema#`);var Ws=class e{static add({ptr:e,start:t,end:n,subjects:r=[null],predicates:i=[null],objects:a=[null],graphs:o,callback:s}={}){if(!e.factory)throw Error(`add operation requires a factory`);let c=()=>{};s&&(c=r=>{s(new Es({dataset:e.dataset,start:t,end:n,quad:r}))});for(let n of r)for(let r of i)for(let i of a)for(let a of o){let o={subject:n,predicate:r,object:i,graph:a};o[t]=e.term;let s=e.factory.quad(o.subject,o.predicate,o.object,o.graph);e.dataset.add(s),c(s)}return e}static addList({ptr:e,predicates:t,items:n,graphs:r}){if(e.isAny())throw Error(`can't attach a list to an any ptr`);for(let i of t)for(let t of r){let r=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,i,r[0]||Us.nil,t));for(let i=0;i<r.length;i++)e.dataset.add(e.factory.quad(r[i],Us.first,n[i],t)),e.dataset.add(e.factory.quad(r[i],Us.rest,r[i+1]||Us.nil,t))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:r=[null],objects:i=[null]}){for(let a of n)for(let n of r)for(let r of i){let i={subject:a,predicate:n,object:r};i[t]=e.term;let o=e.dataset.match(i.subject,i.predicate,i.object);for(let t of o)e.dataset.delete(t)}return e}static deleteList({ptr:e,predicates:t}){let n=[];for(let r of t)for(let t of e.dataset.match(e.term,r)){let r=t.object;for(n.push(t);!Us.nil.equals(r);){r=n[n.length-1].object;let t=e.dataset.match(r);if(t.size===0)break;for(let e of t)n.push(e)}}for(let t of n)e.dataset.delete(t);return e}static execute({ptr:t,operation:n=`traverse`,quantifier:r,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l,items:u,callback:d}={}){if(n===`add`)return e.add({ptr:t,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l,callback:d});if(n===`addList`)return e.addList({ptr:t,predicates:s,items:u,graphs:l});if(n===`delete`)return e.delete({ptr:t,start:i,subjects:o,predicates:s,objects:c});if(n===`deleteList`)return e.deleteList({ptr:t,predicates:s});if(n===`isList`)return e.isList({ptr:t});if(n===`list`)return e.list({ptr:t});if(n===`traverse`)return e.traverse({ptr:t,quantifier:r,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l});throw Error(`unknown operation ${n}`)}static isList({ptr:t}){return t.isAny()?!1:!!(Us.nil.equals(t.term)||e.traverse({ptr:t,predicates:[Us.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(Us.nil);){let t=e.out([Us.first]);if(t.length!==1)throw Error(`Invalid list: rdf:first count not equals one on ${e.value}`);let n=e.out([Us.rest]);if(n.length!==1)throw Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:t,quantifier:n=`one`,start:r=`subject`,end:i=`object`,subjects:a=[null],predicates:o=[null],objects:s=[null],graphs:c=[null],callback:l}){if(n===`one`)return e.traverseOne({ptr:t,start:r,end:i,subjects:a,predicates:o,objects:s,graphs:c,callback:l});if(n===`oneOrMore`){let n=e.traverse({ptr:t,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l});return e.traverseMore({ptrs:n,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l})}if(n===`zeroOrMore`)return e.traverseMore({ptrs:[t],end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l});if(n===`zeroOrOne`)return[t,...e.traverse({ptr:t,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l})];throw Error(`unknown quantifier ${n}`)}static traverseMore({ptrs:t,end:n,start:r,subjects:i,predicates:a,objects:o,graphs:s,callback:c}={}){let l=[...t],u,d;do{u=[];for(let l of t)u=[...u,...e.traverseOne({ptr:l,end:n,start:r,subjects:i,predicates:a,objects:o,graphs:s,callback:c})];d&&(u=u.filter(e=>!d.has(e.term))),t=u,l=[...l,...u],d=new Os(l.map(e=>e.term))}while(u.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:r,predicates:i,objects:a,graphs:o,callback:s=(e,t)=>t.extend(e)}={}){let c=[];for(let l of r)for(let r of i)for(let i of a)for(let a of o){let o={subject:l,predicate:r,object:i,graph:a};o[t]=e.term;for(let r of e.dataset.match(o.subject,o.predicate,o.object,o.graph))c.push(s(new Es({dataset:e.dataset,end:n,quad:r,start:t}),e))}return c}};function Gs(e,t){return t?n=>t(e.extend(n)):()=>{}}var Ks=class{constructor({dataset:e,edges:t=[],factory:n,graph:r,term:i}){if(!e&&t.length===0)throw Error(`dataset or edges is required`);if(t.length===0&&i===void 0||t.length>0&&i)throw Error(`edges or term must be given`);this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=r,t.length===0&&(this._term=i)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph==`object`?this._graph:this.edge&&this.edge.graph}get length(){return this._term===void 0?this.edges.length+1:1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term===void 0?this.edge.term:this._term}get value(){let e=this.term;return e===null?void 0:e.value}addIn(e,t,n){return Ws.add({ptr:this,start:`object`,end:`subject`,subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:Gs(this,n)})}addList(e,t){return Ws.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Ws.add({ptr:this,start:`subject`,end:`object`,predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:Gs(this,n)})}deleteIn(e,t){return Ws.delete({ptr:this,start:`object`,subjects:t,predicates:e})}deleteList(e){return Ws.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Ws.delete({ptr:this,start:`subject`,predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:a,objects:o,graphs:s,items:c,callback:l}){return Ws.execute({ptr:this,operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:a,objects:o,graphs:s,items:c,callback:l})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Ws.traverse({ptr:this,start:`object`,end:`object`,subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Ws.traverse({ptr:this,start:`subject`,end:`subject`,predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Ws.traverse({ptr:this,start:`object`,end:`subject`,subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Ws.isList({ptr:this})}list(){return Ws.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term===void 0?this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term}):yield{dataset:this.dataset,term:this._term}}out(e,t){return Ws.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(let{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}};function qs(e,t){return e?e.equals(t):e===t}function Js(e,t){return!(e.dataset!==t.dataset||!qs(e.graph,t.graph)||!qs(e.term,t.term))}function Ys(e,t){return t?n=>t(new e.constructor({factory:e.factory,ptrs:[n]})):()=>{}}var Xs=class{constructor({dataset:e,factory:t,ptrs:n,terms:r,graphs:i}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(let n of r||[null])for(let r of i||[null])this.ptrs.push(new Ks({dataset:e,factory:t,graph:r,term:n}))}}get dataset(){let e=new Set(this.datasets);return e.size===1?e[Symbol.iterator]().next().value:null}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){let e=new Os(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){return this.term?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,n){let r=Ys(this,n);for(let n of this.ptrs)n.addIn(e,t,r);return this}addList(e,t){if(this.isAny())throw Error(`can't attach a list to an any ptr`);for(let n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){let r=Ys(this,n);for(let n of this.ptrs)n.addOut(e,t,r);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(let n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(let t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(let n of this.ptrs)n.deleteOut(e,t);return this}distinct(){let e=this.ptrs.reduce((e,t)=>(e.some(e=>Js(e,t))||e.push(t.trim()),e),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(let n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(e=>e.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length===1?this.ptrs[0].isList():!1}list(){if(!this.isList())return;let e=this.ptrs[0].list(),t=this;return(function*(){for(let n of e)yield t.clone({ptrs:[n]})})()}map(e){return[...this].map(e)}node(e){let t=this.dataset,n=[...e].map(e=>new Ks({dataset:t,factory:this.factory,term:e}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.out(e,t))})}*quads(){for(let{edges:e}of this.ptrs)for(let{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(let e of this.ptrs)yield this.clone({ptrs:[e]})}};Hs(`http://www.w3.org/2002/07/owl#`);var Zs=Hs(`http://www.w3.org/1999/02/22-rdf-syntax-ns#`),Qs=Hs(`http://www.w3.org/2000/01/rdf-schema#`),Q=Hs(`http://www.w3.org/ns/shacl#`),$s=Hs(`https://schemas.link/shacl-next#`),ec=Hs(`http://www.w3.org/2001/XMLSchema#`);function tc(e){return e?`{${[...e.quads()].map(e=>ws(e)).join(` `)}}`:`{}`}function nc(e){return e?`{${e.map(e=>tc(e)).join(` `)}}`:`{}`}var rc=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),ic=o(((e,t)=>{var n=rc(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),ac=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),oc=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),sc=o(((e,t)=>{var n=oc(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),cc=o(((e,t)=>{t.exports=sc().Symbol})),lc=o(((e,t)=>{var n=cc(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),uc=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),dc=o(((e,t)=>{var n=cc(),r=lc(),i=uc(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),fc=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),pc=o(((e,t)=>{var n=dc(),r=fc(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),mc=o(((e,t)=>{var n=ic(),r=ac(),i=pc(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),hc=o(((e,t)=>{var n=mc(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),gc=o(((e,t)=>{var n=hc();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),_c=o(((e,t)=>{var n=gc(),r=`Expected a function`;function i(e,t){var i;if(typeof t!=`function`)throw TypeError(r);return e=n(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=void 0),i}}t.exports=i})),vc=l(o(((e,t)=>{var n=_c();function r(e){return n(2,e)}t.exports=r}))(),1),yc=class{constructor({details:e,factory:t,options:n,results:r=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=r,this._conforms=(0,vc.default)(()=>!this.results.some(e=>e.severity.equals(Q.Info)||e.severity.equals(Q.Violation)||e.severity.equals(Q.Warning))),this._ptr=(0,vc.default)(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){let e=new Xs({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Zs.type],[Q.ValidationReport]).addOut([Q.conforms],[this.factory.literal(this.conforms.toString(),ec.boolean)]);for(let t of this.results)e.addOut([Q.result],[this.factory.blankNode()],e=>{t.build(e,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function bc(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&n.termType&&(n=ws(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n)),e)}var xc=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:r,message:i=[],path:a,results:o=[],severity:s,shape:c,source:l=[],value:u,valuePaths:d=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=r,this.path=a||c.path,this.results=o,this.severity=s,this.shape=c,this.source=l,this.value=u,this.valuePaths=d,this._message=(0,vc.default)(()=>(this.shape.message.length>0&&(i=this.shape.message),i.length===0&&(i=this.shape.ptr.node([this.constraintComponent]).out([Q.message]).terms),i.map(t=>n.literal(bc(t.value,e,n),t.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Zs.type],[Q.ValidationResult]).addOut([Q.focusNode],this.focusNode.terms).addOut([Q.resultSeverity],[this.severity]).addOut([Q.sourceConstraint],this.source).addOut([Q.sourceConstraintComponent],[this.constraintComponent]).addOut([Q.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([Q.resultMessage],this.message);let n=t=>{if(t.quantifier===`one`)return t.predicates.length>1?e.node([this.factory.blankNode()]).addList([Q.alternativePath],t.predicates):t.start===`object`?e.node([this.factory.blankNode()]).addOut([Q.inversePath],[t.predicates[0]]):e.node([t.predicates[0]]);if(t.quantifier===`oneOrMore`)return e.node([this.factory.blankNode()]).addOut([Q.oneOrMorePath],[t.predicates[0]]);if(t.quantifier===`zeroOrMore`)return e.node([this.factory.blankNode()]).addOut([Q.zeroOrMorePath],[t.predicates[0]]);if(t.quantifier===`zeroOrOne`)return e.node([this.factory.blankNode()]).addOut([Q.zeroOrOnePath],[t.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([Q.resultPath],n(this.path[0]).terms):e.addList([Q.resultPath],this.path.map(e=>n(e).term))),this.value!==void 0&&e.addOut([Q.value],this.value.terms),t)for(let n of this.results)e.addOut([Q.detail],[this.factory.blankNode()],e=>{n.build(e,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}},Sc=class e{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:r=new Set,report:i=new yc({factory:e,options:n}),results:a=new Map,shape:o,value:s,valueOrNode:c,valuePaths:l,values:u}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=r,this.report=i,this.results=a,this.shape=o,this.value=s,this.valuePaths=l,this.valueOrNode=c,this.values=u}create({child:t,focusNode:n=this.focusNode,shape:r=this.shape,value:i=this.value,valueOrNode:a=this.valueOrNode,valuePaths:o=this.valuePaths,values:s=this.values}={}){return new e({factory:this.factory,focusNode:n,options:this.options,processed:this.processed,report:t?new yc({factory:this.factory,options:this.options}):this.report,results:this.results,shape:r,value:i,valueOrNode:a,valuePaths:o,values:s})}id({shape:e=this.shape}={}){return`${ws(e.ptr.term)} - ${ws(this.focusNode.term)} - ${nc(this.valuePaths)}`}result(e){let t=new xc({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),n=this.id();this.results.has(n)?this.results.get(n).add(t):this.results.set(n,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:$s.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:$s.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||Q.Violation,...t})}};function Cc(){return{generic:wc()}}function wc(){return e=>{e.trace($s.TraversalConstraintComponent,{args:{},message:[e.factory.literal(`Traversal`)],value:e.valueOrNode})}}var Tc=class{constructor(e){this.validations=new Ts(e)}compile(e){let t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1,r=new Set;for(let t of e.ptr.execute({start:`subject`,end:`predicate`})){let e=this.validations.get(t.term);e&&(r.add(e),t.term.equals(Q.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&r.add(Cc),[...r].map(t=>t(e)).filter(Boolean)}},Ec=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Translator=void 0,e.Translator=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(e){throw Error(`Invalid RDF ${e.datatype.value} value: '${e.value}'`)}registerHandler(e,t,n){for(let n of t)this.supportedRdfDatatypes.push(n),this.fromRdfHandlers[n.value]=e;for(let t of n){let n=this.toRdfHandlers[t];n||(this.toRdfHandlers[t]=n=[]),n.push(e)}}fromRdf(e,t){let n=this.fromRdfHandlers[e.datatype.value];return n?n.fromRdf(e,t):e.value}toRdf(e,t){let n=this.toRdfHandlers[typeof e];if(n)for(let r of n){let n=r.toRdf(e,t);if(n)return n}throw Error(`Invalid JavaScript value: '${e}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}}})),Dc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerBoolean=void 0;var t=Ec(),n=class e{fromRdf(e,n){switch(e.value){case`true`:return!0;case`false`:return!1;case`1`:return!0;case`0`:return!1}return n&&t.Translator.incorrectRdfDataType(e),!1}toRdf(t,{datatype:n,dataFactory:r}){return r.literal(t?`true`:`false`,n||r.namedNode(e.TYPE))}};e.TypeHandlerBoolean=n,n.TYPE=`http://www.w3.org/2001/XMLSchema#boolean`})),Oc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerDate=void 0;var t=Ec(),n=class e{fromRdf(n,r){switch(r&&!n.value.match(e.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&t.Translator.incorrectRdfDataType(n),n.datatype.value){case`http://www.w3.org/2001/XMLSchema#gDay`:return new Date(0,0,parseInt(n.value,10));case`http://www.w3.org/2001/XMLSchema#gMonthDay`:let e=n.value.split(`-`);return new Date(0,parseInt(e[0],10)-1,parseInt(e[1],10));case`http://www.w3.org/2001/XMLSchema#gYear`:return new Date(n.value+`-01-01`);case`http://www.w3.org/2001/XMLSchema#gYearMonth`:return new Date(n.value+`-01`);default:return new Date(n.value)}}toRdf(t,{datatype:n,dataFactory:r}){if(n||=r.namedNode(e.TYPES[0]),!(t instanceof Date))return null;let i=t,a;switch(n.value){case`http://www.w3.org/2001/XMLSchema#gDay`:a=String(i.getUTCDate());break;case`http://www.w3.org/2001/XMLSchema#gMonthDay`:a=i.getUTCMonth()+1+`-`+i.getUTCDate();break;case`http://www.w3.org/2001/XMLSchema#gYear`:a=String(i.getUTCFullYear());break;case`http://www.w3.org/2001/XMLSchema#gYearMonth`:a=i.getUTCFullYear()+`-`+(i.getUTCMonth()+1);break;case`http://www.w3.org/2001/XMLSchema#date`:a=i.toISOString().replace(/T.*$/,``);break;default:a=i.toISOString()}return r.literal(a,n)}};e.TypeHandlerDate=n,n.TYPES=[`http://www.w3.org/2001/XMLSchema#dateTime`,`http://www.w3.org/2001/XMLSchema#date`,`http://www.w3.org/2001/XMLSchema#gDay`,`http://www.w3.org/2001/XMLSchema#gMonthDay`,`http://www.w3.org/2001/XMLSchema#gYear`,`http://www.w3.org/2001/XMLSchema#gYearMonth`],n.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/}})),kc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerNumberDouble=void 0;var t=Ec(),n=class e{fromRdf(e,n){let r=parseFloat(e.value);return n&&isNaN(r)&&t.Translator.incorrectRdfDataType(e),r}toRdf(t,{datatype:n,dataFactory:r}){return n||=r.namedNode(e.TYPES[0]),isNaN(t)?r.literal(`NaN`,n):isFinite(t)?t%1==0?null:r.literal(t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),n):r.literal(t>0?`INF`:`-INF`,n)}};e.TypeHandlerNumberDouble=n,n.TYPES=[`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`,`http://www.w3.org/2001/XMLSchema#float`]})),Ac=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerNumberInteger=void 0;var t=Ec(),n=class e{fromRdf(e,n){let r=parseInt(e.value,10);return n&&(isNaN(r)||e.value.indexOf(`.`)>=0)&&t.Translator.incorrectRdfDataType(e),r}toRdf(t,{datatype:n,dataFactory:r}){return r.literal(String(t),n||(t<=e.MAX_INT&&t>=e.MIN_INT?r.namedNode(e.TYPES[0]):r.namedNode(e.TYPES[1])))}};e.TypeHandlerNumberInteger=n,n.TYPES=[`http://www.w3.org/2001/XMLSchema#integer`,`http://www.w3.org/2001/XMLSchema#long`,`http://www.w3.org/2001/XMLSchema#int`,`http://www.w3.org/2001/XMLSchema#byte`,`http://www.w3.org/2001/XMLSchema#short`,`http://www.w3.org/2001/XMLSchema#negativeInteger`,`http://www.w3.org/2001/XMLSchema#nonNegativeInteger`,`http://www.w3.org/2001/XMLSchema#nonPositiveInteger`,`http://www.w3.org/2001/XMLSchema#positiveInteger`,`http://www.w3.org/2001/XMLSchema#unsignedByte`,`http://www.w3.org/2001/XMLSchema#unsignedInt`,`http://www.w3.org/2001/XMLSchema#unsignedLong`,`http://www.w3.org/2001/XMLSchema#unsignedShort`],n.MAX_INT=2147483647,n.MIN_INT=-2147483648})),jc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerString=void 0;var t=class{fromRdf(e){return e.value}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(e,t)}};e.TypeHandlerString=t,t.TYPES=[`http://www.w3.org/2001/XMLSchema#string`,`http://www.w3.org/2001/XMLSchema#normalizedString`,`http://www.w3.org/2001/XMLSchema#anyURI`,`http://www.w3.org/2001/XMLSchema#base64Binary`,`http://www.w3.org/2001/XMLSchema#language`,`http://www.w3.org/2001/XMLSchema#Name`,`http://www.w3.org/2001/XMLSchema#NCName`,`http://www.w3.org/2001/XMLSchema#NMTOKEN`,`http://www.w3.org/2001/XMLSchema#token`,`http://www.w3.org/2001/XMLSchema#hexBinary`,`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`,`http://www.w3.org/2001/XMLSchema#time`,`http://www.w3.org/2001/XMLSchema#duration`]})),Mc=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(Dc(),e),n(Oc(),e),n(kc(),e),n(Ac(),e),n(jc(),e)})),Nc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),Pc=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.fromRdf=c,e.toRdf=l,e.getTermRaw=u,e.getSupportedRdfDatatypes=d,e.getSupportedJavaScriptPrimitives=f;var r=J(),i=Mc(),a=Ec();n(Mc(),e),n(Nc(),e),n(Ec(),e);var o=new r.DataFactory,s=new a.Translator;s.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(e=>o.namedNode(e)),[`string`]),s.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(e=>o.namedNode(e)),[`boolean`]),s.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(e=>o.namedNode(e)),[`number`]),s.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(e=>o.namedNode(e)),[`number`]),s.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(e=>o.namedNode(e)),[`object`]);function c(e,t){return s.fromRdf(e,t)}function l(e,t){return t&&`namedNode`in t&&(t={dataFactory:t}),t||={},t&&!t.dataFactory&&(t.dataFactory=o),s.toRdf(e,t)}function u(e,t){return e.termType===`Literal`?c(e,t):e.value}function d(){return s.getSupportedRdfDatatypes()}function f(){return s.getSupportedJavaScriptPrimitives()}}))();function Fc(e){if(e.term.termType!==`BlankNode`)return{quantifier:`one`,start:`subject`,end:`object`,predicates:[e.term]};let t=e.out([Q.alternativePath]);if(t.ptrs.length===1&&t.ptrs[0].isList())return{quantifier:`one`,start:`subject`,end:`object`,predicates:[...t.list()].map(e=>e.term)};let n=e.out([Q.inversePath]);if(n.term)return{quantifier:`one`,start:`object`,end:`subject`,predicates:[n.term]};let r=e.out([Q.oneOrMorePath]);if(r.term)return{quantifier:`oneOrMore`,start:`subject`,end:`object`,predicates:[r.term]};let i=e.out([Q.zeroOrMorePath]);if(i.term)return{quantifier:`zeroOrMore`,start:`subject`,end:`object`,predicates:[i.term]};let a=e.out([Q.zeroOrOnePath]);if(a.term)return{quantifier:`zeroOrOne`,start:`subject`,end:`object`,predicates:[a.term]}}function Ic(e){return e.terms.length===0?null:e.ptrs[0].isList()?[...e.list()].map(e=>Fc(e)):[Fc(e)]}var Lc=class{constructor(e){this.shape=e,this._compiled=(0,vc.default)(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){let t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(let e of this.compiled)e.node&&await e.node(t),e.generic&&await e.generic(t)}async validateProperty(e){let t;t=this.shape.isSparqlShape?e.focusNode:e.focusNode.executeAll(this.shape.path);let n=t.node(new Os(t.terms)),r=[...t].reduce((e,n)=>{let r=n.term,i=t.node([r]);return e.has(r)||e.set(r,{value:i,valuePaths:[]}),e.get(r).valuePaths.push(n),e},new Ts).values(),i=e.create({shape:this.shape,values:n});for(let e of this.compiled)e.property&&await e.property(i);for(let{value:t,valuePaths:n}of r){let r=e.create({shape:this.shape,value:t,valueOrNode:t,valuePaths:n});for(let e of this.compiled)e.generic&&await e.generic(r)}}};function Rc(e){let t=new Os,n=new Xs({dataset:e.dataset,terms:e.terms}).execute({quantifier:`zeroOrMore`,start:`object`,end:`subject`,predicates:[Qs.subClassOf]});for(let e of n.ptrs)for(let{term:n}of e.nodes())t.add(n);return t}var zc=class{constructor(e,{registry:t}){this.registry=t,this.targetClass=new Os([...Rc(e.hasOut([Zs.type],[Q.NodeShape])),...Rc(e.out([Q.targetClass]))]),this.targetNode=e.out([Q.targetNode]).terms,this.targetObjectsOf=e.out([Q.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([Q.targetSubjectsOf]).terms,this.targets=[...e.out([Q.target])]}async resolve(e){let t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([Zs.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:`object`,end:`object`,predicates:this.targetObjectsOf}).ptrs,...t.execute({start:`subject`,end:`subject`,predicates:this.targetSubjectsOf}).ptrs];for(let t of this.targets)for(let[,r]of this.registry.targetResolvers){let i=await r(t,e);n.push(...e.focusNode.node(i).ptrs)}let r=e.focusNode.clone({ptrs:n});return r.node([...new Os(r.terms)])}},Bc=class{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=(0,vc.default)(()=>{let e=this.ptr.out([Q.deactivated]).term;return e&&(0,Pc.fromRdf)(e)}),this._message=(0,vc.default)(()=>this.ptr.out([Q.message]).terms),this._path=(0,vc.default)(()=>Ic(this.ptr.out([Q.path]))),this._severity=(0,vc.default)(()=>this.ptr.out([Q.severity]).term),this._shapeValidator=(0,vc.default)(()=>new Lc(this)),this._sparql=(0,vc.default)(()=>this.ptr.out([Q.sparql])),this._targetResolver=(0,vc.default)(()=>new zc(this.ptr,{registry:this.validator.targetResolverRegistry}))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!this.path}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}async resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){let t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(let n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}},Vc=class{constructor(e){this.targetResolvers=new Ts(e)}};function Hc(e){return{property:Uc(parseInt(e.ptr.out([Q.maxCount]).value))}}function Uc(e){return t=>{t.test(t.values.terms.length<=e,Q.MaxCountConstraintComponent,{args:{maxCount:e},message:[t.factory.literal(`More than {$maxCount} values`)]})}}function Wc(e){return{property:Gc(parseInt(e.ptr.out([Q.minCount]).value))}}function Gc(e){return t=>{t.test(t.values.terms.length>=e,Q.MinCountConstraintComponent,{args:{minCount:e},message:[t.factory.literal(`Less than {$minCount} values`)]})}}async function Kc(e,t){for(let n of e)if(!await t(n))return!1;return!0}async function qc(e,t){return(await Promise.all(e.map(e=>t(e)))).filter(Boolean)}async function Jc(e,t){return Promise.all(e.map(t))}async function Yc(e,t){for(let n of e)if(await t(n))return!0;return!1}function Xc(e){return{generic:Zc([...e.ptr.out([Q.and])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function Zc(e){return async t=>{let n=await Jc(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report),r=n.every(e=>e.conforms);t.test(r,Q.AndConstraintComponent,{results:n.flatMap(e=>e.results),value:t.valueOrNode})}}function Qc(e){return{generic:$c(e.validator.shape(e.ptr.out([Q.not])))}}function $c(e){return async t=>{let n=(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report,r=!n.conforms;t.test(r,Q.NotConstraintComponent,{args:{not:e.ptr.term},message:[t.factory.literal(`Value does have shape {$not}`)],results:n.results,value:t.valueOrNode})}}function el(e){return{generic:tl([...e.ptr.out([Q.or])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function tl(e){return async t=>{let n=[],r;if(t.options.debug||t.options.details){let i=await Jc(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report);n=i.flatMap(e=>e.results),r=i.some(e=>e.conforms)}else r=await Yc(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report.conforms);t.test(r,Q.OrConstraintComponent,{results:n,value:t.valueOrNode})}}function nl(e){return{generic:rl([...e.ptr.out([Q.xone])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function rl(e){return async t=>{let n=await Jc(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report),r=n.filter(e=>e.conforms).length===1;t.test(r,Q.XoneConstraintComponent,{results:n.flatMap(e=>e.results),value:t.valueOrNode})}}function il(e){return(0,Pc.fromRdf)(e.ptr.out([Q.closed]).term)?{node:al(new Os(e.ptr.out([Q.property]).map(t=>e.validator.shape(t)).filter(e=>!e.deactivated).map(e=>e.path[0].predicates[0])),new Os([...e.ptr.out([Q.ignoredProperties]).list()||[]].map(e=>e.term)))}:null}function al(e,t){return n=>{let r=n.focusNode.execute({start:`subject`,end:`predicate`}).filter(n=>t.has(n.term)?!1:!e.has(n.term));if(r.ptrs.length>0)for(let e of r)n.violation(Q.ClosedConstraintComponent,{message:[n.factory.literal(`Predicate is not allowed (closed shape)`)],path:[{quantifier:`one`,start:`subject`,end:`object`,predicates:[e.term]}],value:n.focusNode.node([[...e.quads()][0].object])});else n.debug(Q.ClosedConstraintComponent)}}function ol(e){let t=e.ptr.out([Q.hasValue]).term;return{node:sl(t),property:cl(t)}}function sl(e){return t=>{t.test(e.equals(t.valueOrNode.term),Q.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal(`Value must be {$hasValue}`)]})}}function cl(e){return t=>{let n=[...t.values].some(t=>e.equals(t.term));t.test(n,Q.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal(`Missing expected value {$hasValue}`)]})}}function ll(e){return{generic:ul(new Os([...e.ptr.out([Q.in]).list()].map(e=>e.term)))}}function ul(e){return t=>{t.test(e.has(t.valueOrNode.term),Q.InConstraintComponent,{args:{in:[...e].map(e=>e.value).join(`, `)},message:[t.factory.literal(`Value is not in {$in}`)],value:t.valueOrNode})}}function dl(e,t){if(!e||e.termType!==`Literal`||!t||t.termType!==`Literal`||fl(e)!==fl(t))return null;let n=(0,Pc.fromRdf)(e),r=(0,Pc.fromRdf)(t);return typeof n==typeof r?typeof n==`string`?n.localeCompare(r):n-r:null}function fl(e){return ec.dateTime.equals(e.datatype)&&/^.*(((\+|-)\d{2}:\d{2})|Z)$/.test(e.value)}function pl(e){let t=e.ptr.out([Q.disjoint]).term;return{generic:ml(t)}}function ml(e){return t=>{let n=t.focusNode.dataset.match(t.focusNode.term,e,t.valueOrNode.term);t.test(n.size===0,Q.DisjointConstraintComponent,{args:{disjoint:e},message:[t.factory.literal(`Value node must not also be one of the values of {$disjoint}`)],value:t.valueOrNode})}}function hl(e){let t=e.ptr.out([Q.equals]).term;return{node:gl(t),property:_l(t)}}function gl(e){return t=>{let n=t.focusNode.out([e]),r=n.filter(e=>!e.term.equals(t.focusNode.term)),i=n.terms.length!==0&&r.terms.length===0;t.test(i,Q.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)],value:r.terms[0]&&t.focusNode.node([r.terms[0]])||t.focusNode})}}function _l(e){return t=>{let n=new Os(t.focusNode.out([e]).terms),r=new Os(t.values.terms),i=[...r].filter(e=>!n.has(e)),a=[...n].filter(e=>!r.has(e)),o=[...i,...a];for(let n of o)t.violation(Q.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)],value:t.focusNode.node([n])});o.length===0&&t.debug(Q.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)]})}}function vl(e){let t=e.ptr.out([Q.lessThan]).term;return{property:yl(t)}}function yl(e){return t=>{let n=t.focusNode.out([e]).terms;for(let r of t.values)for(let i of n){let n=dl(r.term,i);n===null||n>=0?t.violation(Q.LessThanConstraintComponent,{args:{lessThan:e},message:[t.factory.literal(`Value is not less than value of {$lessThan}`)],value:r}):t.debug(Q.LessThanConstraintComponent,{args:{lessThan:e},message:[t.factory.literal(`Value is not less than value of {$lessThan}`)],value:r})}}}function bl(e){let t=e.ptr.out([Q.lessThanOrEquals]).term;return{property:xl(t)}}function xl(e){return t=>{let n=t.focusNode.out([e]).terms;for(let r of t.values)for(let i of n){let n=dl(r.term,i);n===null||n>0?t.violation(Q.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:e},message:[t.factory.literal(`Value is not less than or equal to value of {$lessThanOrEquals}`)],value:r}):t.debug(Q.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:e},message:[t.factory.literal(`Value is not less than or equal to value of {$lessThanOrEquals}`)],value:r})}}}function Sl(e){let t=e.ptr.out([Q.maxExclusive]).term;return{generic:Cl(t)}}function Cl(e){return t=>{let n=dl(t.valueOrNode.term,e);t.test(n!==null&&n<0,Q.MaxExclusiveConstraintComponent,{args:{maxExclusive:e},message:[t.factory.literal(`Value is not less than {$maxExclusive}`)],value:t.valueOrNode})}}function wl(e){let t=e.ptr.out([Q.maxInclusive]).term;return{generic:Tl(t)}}function Tl(e){return t=>{let n=dl(t.valueOrNode.term,e);t.test(n!==null&&n<=0,Q.MaxInclusiveConstraintComponent,{args:{maxInclusive:e},message:[t.factory.literal(`Value is not less than or equal to {$maxInclusive}`)],value:t.valueOrNode})}}function El(e){let t=e.ptr.out([Q.minExclusive]).term;return{generic:Dl(t)}}function Dl(e){return t=>{let n=dl(t.valueOrNode.term,e);t.test(n!==null&&n>0,Q.MinExclusiveConstraintComponent,{args:{minExclusive:e},message:[t.factory.literal(`Value is not greater than {$minExclusive}`)],value:t.valueOrNode})}}function Ol(e){let t=e.ptr.out([Q.minInclusive]).term;return{generic:kl(t)}}function kl(e){return t=>{let n=dl(t.valueOrNode.term,e);t.test(n!==null&&n>=0,Q.MinInclusiveConstraintComponent,{args:{minInclusive:e},message:[t.factory.literal(`Value is not greater than or equal to {$minInclusive}`)],value:t.valueOrNode})}}function Al(e){return{generic:jl([...e.ptr.out([Q.node])].map(t=>e.validator.shape(t)))}}function jl(e){return async t=>{for(let n of e){let e=await n.validate(t.create({child:!0,focusNode:t.valueOrNode}));t.test(e.report.conforms,Q.NodeConstraintComponent,{args:{node:n.ptr.term},message:[t.factory.literal(`Value does not have shape {$node}`)],results:e.report.results,value:t.valueOrNode})}}}function Ml(e){return{generic:Nl([...e.ptr.out([Q.property])].map(t=>e.validator.shape(t)))}}function Nl(e){return async t=>{let n=t.create({focusNode:t.valueOrNode});for(let t of e)await t.validate(n)}}function Pl(e){let t=e.validator.shape(e.ptr.out([Q.qualifiedValueShape])),n=e.ptr.out([Q.qualifiedValueShapesDisjoint]).term,r=n?(0,Pc.fromRdf)(n):!1,i=e.ptr.out([Q.qualifiedMaxCount]).term,a=i?parseInt(i.value):null,o=e.ptr.out([Q.qualifiedMinCount]).term;return{property:Fl(t,r,a,o?parseInt(o.value):null)}}function Fl(e,t,n,r){return async i=>{let a=[],o=[];t&&(o=new Set(i.shape.ptr.in([Q.property]).out([Q.property]).out([Q.qualifiedValueShape]).filter(t=>!t.term.equals(e.ptr.term)).map(e=>i.shape.validator.shape(e))));let s=(await qc(i.values,async t=>{let n=(await e.validate(i.create({child:!0,focusNode:t}))).report;if(a.push(n.results),!n.conforms)return!1;if(o.length===0)return!0;if(i.options.debug||i.options.details){let e=await Jc([...o],async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report);return a.push(e.flatMap(e=>e.results)),!e.every(e=>e.conforms)}else return!await Kc([...o],async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report.conforms)})).length;n!==null&&i.test(s<=n,Q.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:n,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal(`More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}`)],results:a.flat()}),r!==null&&i.test(s>=r,Q.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal(`Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}`)],results:a.flat()})}}function Il(e,t){return t?t.slice(0,e.length)===e:!1}function Ll(e){return{generic:Rl([...new Set([...e.ptr.out([Q.languageIn]).list()].map(e=>e.value))])}}function Rl(e){return t=>{let n=e.some(e=>Il(e,t.valueOrNode.term.language));t.test(n,Q.LanguageInConstraintComponent,{args:{languageIn:e.join(`, `)},message:[t.factory.literal(`Language does not match any of {$languageIn}`)],value:t.valueOrNode})}}function zl(e){return{generic:Bl(parseInt(e.ptr.out([Q.maxLength]).value))}}function Bl(e){return t=>{let n=t.valueOrNode.term.termType!==`BlankNode`&&t.valueOrNode.value.length<=e;t.test(n,Q.MaxLengthConstraintComponent,{args:{maxLength:e},message:[t.factory.literal(`Value has more than {$maxLength} characters`)],value:t.valueOrNode})}}function Vl(e){return{generic:Hl(parseInt(e.ptr.out([Q.minLength]).value))}}function Hl(e){return t=>{let n=t.valueOrNode.term.termType!==`BlankNode`&&t.valueOrNode.value.length>=e;t.test(n,Q.MinLengthConstraintComponent,{args:{minLength:e},message:[t.factory.literal(`Value has less than {$minLength} characters`)],value:t.valueOrNode})}}function Ul(e){let t=e.ptr.out([Q.pattern]).value,n=e.ptr.out([Q.flags]).value;return{generic:Wl(t,n,new RegExp(t,n))}}function Wl(e,t,n){return r=>{r.test(n.test(r.valueOrNode.term.value),Q.PatternConstraintComponent,{args:{flags:t,pattern:e},message:[r.factory.literal(`Value does not match pattern "{$pattern}"`)],value:r.valueOrNode})}}function Gl(e){let t=e.ptr.out([Q.uniqueLang]).term;return t.value===`true`&&ec.boolean.equals(t.datatype)?{property:Kl()}:null}function Kl(){return e=>{let t=Object.entries(e.values.terms.reduce((e,t)=>(t.language&&(e[t.language]=(e[t.language]||0)+1),e),{})).filter(([,e])=>e>1);for(let[n]of t)e.violation(Q.UniqueLangConstraintComponent,{args:{lang:n},message:[e.factory.literal(`Language "{?lang}" used more than once`)]});t.length===0&&e.debug(Q.UniqueLangConstraintComponent)}}var ql=Hs(`http://www.w3.org/ns/shacl#`),Jl=Hs(`https://schemas.link/shacl-next#`),Yl=class{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(ql.Info)||e.severity.equals(ql.Violation)||e.severity.equals(ql.Warning))}};function Xl(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&n.termType&&(n=ws(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n)),e)}var Zl=class{constructor({args:e={},factory:t,message:n=[],severity:r=ql.Violation}={}){this.severity=r,this.message=n.map(n=>t.literal(Xl(n.value,e),n.language||null))}},Ql=class e{constructor({factory:e=Bs}={}){this.factory=e}clone({factory:t}={}){return new e({factory:t||this.factory})}validate(){return new Yl}validateSimple(){return!0}},$l=class e extends Ql{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(let t of Array.isArray(e)?e:[e])t&&this.datatypes.push(this.factory.fromTerm(t))}clone({factory:t}={}){return new e({datatypes:this.datatypes,factory:t||this.factory})}},eu=class{constructor({factory:e=Bs,validations:t}={}){if(this.factory=e,this.validations=new Ts,t)for(let e of Object.values(t)){let t=e.clone({factory:this.factory});for(let e of t.datatypes)this.validations.set(e,t)}}validate(e){let t=this.validations.get(e.datatype);return t?t.validate(e):new Yl}validateSimple(e){let t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}},tu=class e extends $l{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal(`term value {$this} matches pattern {$pattern}`)],this.patterns=Array.isArray(e)?e:[e]}clone({factory:t}={}){return new e(this.patterns,this.datatypes,{factory:t||this.factory})}validate(e){return new Yl({results:this.patterns.map(t=>{let n;return t.test(e.value)&&(n=Jl.Debug),new Zl({args:{pattern:this.factory.literal(t.toString()),this:e},factory:this.factory,message:this.message,severity:n})})})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}},nu=/^([-+]?[0-9]+)$/,ru=class e extends tu{constructor(e=null,t=null,n,{factory:r}={}){super(nu,n,{factory:r}),this.maxInclusive=null,this.minInclusive=null,typeof t==`string`&&(this.maxInclusive=BigInt(t)),typeof e==`string`&&(this.minInclusive=BigInt(e))}clone({factory:t}={}){return new e(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:t||this.factory})}validate(e){let t=super.validate(e).results;if(!Jl.Debug.equals(t[0].severity))return new Yl({results:t});let n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){let n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new Zl({factory:this.factory,message:r}))}if(this.maxInclusive!==null&&n>this.maxInclusive){let n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new Zl({factory:this.factory,message:r}))}return new Yl({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;let t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}},iu=class e extends $l{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:t}={}){return new e(this.values,this.datatypes,{factory:t||this.factory})}validate(e){let t=[];if(!this.values.has(e.value)){let n=`term value "${e.value}" is not included in the list: ${[...this.values].join(`,`)}`,r=[this.factory.literal(n)];t.push(new Zl({factory:this.factory,message:r}))}return new Yl({results:t})}validateSimple(e){return this.values.has(e.value)}},au=s({anyAtomicType:()=>su,anySimpleType:()=>ou,anyURI:()=>Ru,base64Binary:()=>Lu,boolean:()=>Cu,byte:()=>ed,date:()=>Au,dateTime:()=>Ou,dateTimeStamp:()=>ld,dayTimeDuration:()=>cd,decimal:()=>wu,double:()=>Eu,duration:()=>Du,float:()=>Tu,gDay:()=>Pu,gMonth:()=>Fu,gMonthDay:()=>Nu,gYear:()=>Mu,gYearMonth:()=>ju,hexBinary:()=>Iu,int:()=>Qu,integer:()=>Ju,language:()=>qu,long:()=>Zu,negativeInteger:()=>Xu,nonNegativeInteger:()=>td,nonPositiveInteger:()=>Yu,normalizedString:()=>Gu,positiveInteger:()=>od,short:()=>$u,string:()=>Su,time:()=>ku,token:()=>Ku,unsignedByte:()=>ad,unsignedInt:()=>rd,unsignedLong:()=>nd,unsignedShort:()=>id,yearMonthDuration:()=>sd}),$={xsd:Hs(`http://www.w3.org/2001/XMLSchema#`)},ou=new $l({datatypes:$.xsd.anySimpleType}),su=new $l({datatypes:$.xsd.anyAtomicType}),cu=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,lu=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,uu=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,du=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,fu=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,pu=/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,mu=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,hu=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,gu=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,_u=/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,vu=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,yu=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,bu=/^(([0-9a-fA-F]{2})*)$/,xu=/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,Su=new tu(cu,$.xsd.string),Cu=new iu([`1`,`true`,`0`,`false`],$.xsd.boolean),wu=new tu(lu,$.xsd.decimal),Tu=new tu(uu,$.xsd.float),Eu=new tu(uu,$.xsd.double),Du=new tu(du,$.xsd.duration),Ou=new tu(fu,$.xsd.dateTime),ku=new tu(pu,$.xsd.time),Au=new tu(mu,$.xsd.date),ju=new tu(hu,$.xsd.gYearMonth),Mu=new tu(gu,$.xsd.gYear),Nu=new tu(_u,$.xsd.gMonthDay),Pu=new tu(vu,$.xsd.gDay),Fu=new tu(yu,$.xsd.gMonth),Iu=new tu(bu,$.xsd.hexBinary),Lu=new tu(xu,$.xsd.base64Binary),Ru=new tu(cu,$.xsd.anyURI),zu=/^([^\u000d\u000a\u0009]*)$/,Bu=/^([^ ]+( [^ ]+)*)*$/,Vu=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Hu=/^([^DT]*)$/,Uu=/^([^YM]*[DT].*)$/,Wu=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Gu=new tu([cu,zu],$.xsd.normalizedString),Ku=new tu([cu,zu,Bu],$.xsd.token),qu=new tu(Vu,$.xsd.language),Ju=new ru(null,null,$.xsd.integer),Yu=new ru(null,`0`,$.xsd.nonPositiveInteger),Xu=new ru(null,`-1`,$.xsd.negativeInteger),Zu=new ru(`-9223372036854775808`,`9223372036854775807`,$.xsd.long),Qu=new ru(`-2147483648`,`2147483647`,$.xsd.int),$u=new ru(`-32768`,`32767`,$.xsd.short),ed=new ru(`-128`,`127`,$.xsd.byte),td=new ru(`0`,null,$.xsd.nonNegativeInteger),nd=new ru(`0`,`18446744073709551615`,$.xsd.unsignedLong),rd=new ru(`0`,`4294967295`,$.xsd.unsignedInt),id=new ru(`0`,`65535`,$.xsd.unsignedShort),ad=new ru(`0`,`255`,$.xsd.unsignedByte),od=new ru(`1`,null,$.xsd.positiveInteger),sd=new tu([du,Hu],$.xsd.yearMonthDuration),cd=new tu([du,Uu],$.xsd.dayTimeDuration),ld=new tu([fu,Wu],$.xsd.dateTimeStamp),ud=class extends eu{constructor({factory:e}={}){super({factory:e,validations:{...au}})}},dd=new Ts([[Q.BlankNode,new Set([`BlankNode`])],[Q.BlankNodeOrIRI,new Set([`BlankNode`,`NamedNode`])],[Q.BlankNodeOrLiteral,new Set([`BlankNode`,`Literal`])],[Q.IRI,new Set([`NamedNode`])],[Q.IRIOrLiteral,new Set([`NamedNode`,`Literal`])],[Q.Literal,new Set([`Literal`])]]);function fd(e){return{generic:pd(e.ptr.out([Q.class]).map(e=>Rc(e)))}}function pd(e){return t=>{let n=new Os(t.valueOrNode.out([Zs.type]).terms);for(let r of e){let e=[...n].some(e=>r.has(e));t.test(e,Q.ClassConstraintComponent,{value:t.valueOrNode})}}}function md(e){let t=e.ptr.out([Q.datatype]).term;return{generic:hd(t,new ud)}}function hd(e,t){return n=>{let r=e.equals(n.valueOrNode.term.datatype)&&t.validateSimple(n.valueOrNode.term);n.test(r,Q.DatatypeConstraintComponent,{args:{datatype:e},message:[n.factory.literal(`Value does not have datatype {$datatype}`)],value:n.valueOrNode})}}function gd(e){let t=e.ptr.out([Q.nodeKind]).term;return{generic:_d(t,dd.get(t))}}function _d(e,t){return n=>{n.test(t.has(n.valueOrNode.term.termType),Q.NodeKindConstraintComponent,{args:{nodeKind:e},message:[n.factory.literal(`Value does not have node kind {$nodeKind}`)],value:n.valueOrNode})}}var vd=new Ts([[Q.maxCount,Hc],[Q.minCount,Wc],[Q.and,Xc],[Q.not,Qc],[Q.or,el],[Q.xone,nl],[Q.closed,il],[Q.hasValue,ol],[Q.in,ll],[Q.disjoint,pl],[Q.equals,hl],[Q.lessThan,vl],[Q.lessThanOrEquals,bl],[Q.maxExclusive,Sl],[Q.maxInclusive,wl],[Q.minExclusive,El],[Q.minInclusive,Ol],[Q.node,Al],[Q.property,Ml],[Q.qualifiedValueShape,Pl],[Q.languageIn,Ll],[Q.maxLength,zl],[Q.minLength,Vl],[Q.pattern,Ul],[Q.uniqueLang,Gl],[Q.class,fd],[Q.datatype,md],[Q.nodeKind,gd]]),yd=class{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Tc(vd),this.targetResolverRegistry=new Vc(this.options.targetResolvers||[]),this.shapesPtr=new Xs({dataset:e,factory:t}),this.shapes=new Ts,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(let[e,t]of this.options.validations)this.registry.validations.set(e,t);let r=[...this.shapesPtr.hasOut([Q.targetClass]),...this.shapesPtr.hasOut([Q.targetNode]),...this.shapesPtr.hasOut([Q.targetObjectsOf]),...this.shapesPtr.hasOut([Q.targetSubjectsOf]),...this.shapesPtr.hasOut([Q.target]),...this.shapesPtr.hasOut([Zs.type],[Q.NodeShape]),...this.shapesPtr.hasOut([Zs.type],[Q.PropertyShape])];for(let e of r)this.shape(e)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Bc(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){let n=new Xs({...e,factory:this.factory}),r=new Sc({factory:this.factory,focusNode:n,options:this.options,validator:this});t=t?t.map(e=>this.shape(this.shapesPtr.node(e.terms))):this.shapes.values();for(let e of t){let t=r.create({shape:e}),i;i=n.isAny()?await e.resolveTargets(t):n;for(let n of i)await e.validate(t.create({focusNode:n}))}return r.report}},bd={[`${W}node`]:(e,t)=>{e.extendedShapes.add(new xd(t,e.config,e))},[`${W}and`]:(e,t)=>{for(let n of e.config.lists[t.value])e.extendedShapes.add(new xd(n,e.config,e))},[`${W}property`]:(e,t)=>{let n=e.config.getPropertyTemplate(t,e);if(n.path){let t=e.properties[n.path];if(t||(t=[],e.properties[n.path]=t),n.qualifiedValueShape)t.push(n);else{let r;for(let t=0;t<e.properties[n.path].length&&!r;t++)e.properties[n.path][t].qualifiedValueShape||(r=e.properties[n.path][t]);r?mr(r,n):t.push(n)}}},[`${W}nodeKind`]:(e,t)=>{e.nodeKind=t},[`${W}targetClass`]:(e,t)=>{e.targetClass=t},[`${W}or`]:(e,t)=>{e.or=e.config.lists[t.value]},[`${W}xone`]:(e,t)=>{e.xone=e.config.lists[t.value]},[Ct.id]:(e,t)=>{e.owlImports.add(t)},[`${_t}title`]:(e,t)=>{let n=t;e.label=q(e.config.languages,e.label,n)},[`${mt}label`]:(e,t)=>{let n=t;e.label=q(e.config.languages,e.label,n)}},xd=class{constructor(e,t,n){this.extendedShapes=new Set,this.properties={},this.owlImports=new Set,this.id=e,this.config=t,this.parent=n,t.registerNodeTemplate(this),Sd(this,this.config.store.getQuads(e,null,null,null))}};function Sd(e,t){for(let n of t)bd[n.predicate.id]?.call(e,e,n.object);return e}function Cd(e){for(let t of Object.values(e.properties))for(let n of t){let[t,r]=wd(e,n.path);if(t.length>1&&r){let e=t[t.length-1];for(let n=t.length-2;n>=0;n--){let r=t[n];delete r.parent.properties[r.path],mr(e,r)}}}}function wd(e,t,n=new Set,r=[],i=!1){if(!n.has(e.id.value)){n.add(e.id.value);let a=e.properties[t];if(a?.length===1){r.push(a[0]),i||=a[0].maxCount===1;for(let e of a[0].nodeShapes){let[a,o]=wd(e,t,n,r,i);i||=o}}for(let a of e.extendedShapes){let[e,o]=wd(a,t,n,r,i);i||=o}}return[r,i]}var Td=class{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace=``,this.valuesGraph=null,this.view=null,this.language=null,this.loading=`Loading…`,this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.hierarchyColors=null,this.submitButton=null,this.generateNodeShapeReference=K.value,this.showNodeIds=null,this.showRootShapeLabel=null,this.dense=`true`,this.useShadowRoot=`true`}},Ed=`#4c93d785, #f85e9a85, #00327385, #87001f85`,Dd=class{constructor(e){this.attributes=new Td,this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new st,this._nodeTemplates={},this._propertyTemplates={},this.validator=new yd(this._store,{details:!0,factory:k}),this.providedConformingResourceIds={},this.providedResources={},this.form=e,this._theme=new ds,this.languages=[...new Set(navigator.languages.flatMap(e=>e.length>2?[e.toLocaleLowerCase(),e.substring(0,2)]:e)),``]}reset(){this.lists={},this.groups=[],this.renderedNodes.clear(),this.providedConformingResourceIds={},this.providedResources={},this._nodeTemplates={},this._propertyTemplates={}}updateAttributes(e){let t=new Td;if(Object.keys(t).forEach(n=>{let r=e.dataset[n];r!==void 0&&(t[n]=r)}),this.editMode=t.view===null,this.theme.setDense(t.dense===`true`),this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){let e=this.languages.indexOf(t.language);e>-1&&this.languages.splice(e,1),this.languages.unshift(t.language)}if(t.valuesGraph&&(this.valuesGraphId=k.namedNode(t.valuesGraph)),t.hierarchyColors!=null){let e=t.hierarchyColors.length?t.hierarchyColors:Ed,n=`:host { --hierarchy-colors: ${e}; --hierarchy-colors-length: ${e.split(`,`).length} }`;for(let e=8;e>=0;e--){let t=`shacl-property { --hierarchy-level: ${e} }`;for(let n=0;n<e;n++)t=`shacl-property `+t;n=n+`
|
|
422
|
-
`+t}this.hierarchyColorsStyleSheet=new CSSStyleSheet,this.hierarchyColorsStyleSheet.replaceSync(n)}}static dataAttributes(){let e=new
|
|
421
|
+
`}function Es(){return``}function Ds(e){return`<`+e.value+`>`}var Os=/["\\\\\n\r]/,ks=/["\\\\\n\r]/g,As={'"':`\\"`,"\\":`\\\\`,"\n":`\\n`,"\r":`\\r`};function js(e){return As[e]}function Ms(e){return Os.test(e)?e.replace(ks,js):e}function Ns(e){let t=Ms(e.value);return e.datatype.value===`http://www.w3.org/2001/XMLSchema#string`?`"`+t+`"`:e.datatype.value===`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`?`"`+t+`"@`+e.language:`"`+t+`"^^`+Ds(e.datatype)}function Ps(e,t){let n=t(e.subject),r=t(e.predicate),i=t(e.object),a=t(e.graph);return`${n} ${r} ${i} ${a?a+` `:``}.`}function Fs(e){return`?`+e.value}function Is(e){if(!e)return null;if(e.termType===`BlankNode`)return ws(e);if(e.termType===`DefaultGraph`)return Es();if(e.termType===`Literal`)return Ns(e);if(e.termType===`NamedNode`)return Ds(e);if(e.termType===`Quad`||e.subject&&e.predicate&&e.object&&e.graph)return Ps(e,Is);if(e.termType===`Variable`)return Fs(e);if(e[Symbol.iterator])return Ts(e,Is);throw Error(`unknown termType ${e.termType}`)}var Ls=class{constructor(e){if(this.index=new Map,e)for(let[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(Is(e))}*entries(){for(let[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(let n of this.entries())e.call(t,n[1],n[0],this)}get(e){let t=this.index.get(Is(e));return t&&t.value}has(e){return this.index.has(Is(e))}*keys(){for(let[,{term:e}]of this.index)yield e}set(e,t){let n=Is(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(let[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}},Rs=class{constructor({dataset:e,end:t,quad:n,start:r}){this.dataset=e,this.end=t,this.quad=n,this.start=r}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}};function zs(e){try{return Is(e)}catch{return null}}var Bs=class{constructor(e){if(this.index=new Map,e)for(let t of e)this.add(t)}get size(){return this.index.size}add(e){let t=Is(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(zs(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(zs(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}},Vs=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Vs.prototype.termType=`BlankNode`;var Hs=class{equals(e){return!!e&&e.termType===this.termType}};Hs.prototype.termType=`DefaultGraph`,Hs.prototype.value=``;function Us(e,t){if(!t)return null;if(t.termType===`BlankNode`)return e.blankNode(t.value);if(t.termType===`DefaultGraph`)return e.defaultGraph();if(t.termType===`Literal`)return e.literal(t.value,t.language||e.namedNode(t.datatype.value));if(t.termType===`NamedNode`)return e.namedNode(t.value);if(t.termType===`Quad`){let n=e.fromTerm(t.subject),r=e.fromTerm(t.predicate),i=e.fromTerm(t.object),a=e.fromTerm(t.graph);return e.quad(n,r,i,a)}if(t.termType===`Variable`)return e.variable(t.value);throw Error(`unknown termType ${t.termType}`)}var Ws=class{constructor(e,t,n,r=``){this.value=e,this.language=t,this.datatype=n,this.direction=r}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value&&e.language===this.language&&e.datatype.equals(this.datatype)&&(e.direction||``)===this.direction}};Ws.prototype.termType=`Literal`;var Gs=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Gs.prototype.termType=`NamedNode`;var Ks=class{constructor(e,t,n,r){this.subject=e,this.predicate=t,this.object=n,this.graph=r}equals(e){return!!e&&(e.termType===`Quad`||!e.termType)&&e.subject.equals(this.subject)&&e.predicate.equals(this.predicate)&&e.object.equals(this.object)&&e.graph.equals(this.graph)}};Ks.prototype.termType=`Quad`,Ks.prototype.value=``;var qs=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};qs.prototype.termType=`Variable`;var Js=new Gs(`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`),Ys=new Gs(`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`),Xs=new Gs(`http://www.w3.org/2001/XMLSchema#string`),Zs=class{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Hs}}namedNode(e){return new Gs(e)}blankNode(e){return e||=`b`+ ++this._data.blankNodeCounter,new Vs(e)}literal(e,t){return typeof t==`string`?new Ws(e,t,Ys):typeof t?.language==`string`?new Ws(e,t.language,t.direction?Js:Ys,t.direction):new Ws(e,``,t||Xs)}variable(e){return new qs(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,r=this.defaultGraph()){return new Ks(e,t,n,r)}fromTerm(e){return Us(this,e)}fromQuad(e){return Us(this,e)}};Zs.exports=[`blankNode`,`defaultGraph`,`fromQuad`,`fromTerm`,`literal`,`namedNode`,`quad`,`variable`];var Qs=new Zs,$s={apply:(e,t,n)=>e(n[0]),get:(e,t)=>e(t)};function ec(e,{factory:t=Qs}={}){let n=(n=``)=>t.namedNode(`${e}${n.raw||n}`);return typeof Proxy>`u`?n:new Proxy(n,$s)}ec(`http://www.w3.org/2001/XMLSchema#`);var tc=ec(`http://www.w3.org/1999/02/22-rdf-syntax-ns#`);ec(`http://www.w3.org/2000/01/rdf-schema#`);var nc=class e{static add({ptr:e,start:t,end:n,subjects:r=[null],predicates:i=[null],objects:a=[null],graphs:o,callback:s}={}){if(!e.factory)throw Error(`add operation requires a factory`);let c=()=>{};s&&(c=r=>{s(new Rs({dataset:e.dataset,start:t,end:n,quad:r}))});for(let n of r)for(let r of i)for(let i of a)for(let a of o){let o={subject:n,predicate:r,object:i,graph:a};o[t]=e.term;let s=e.factory.quad(o.subject,o.predicate,o.object,o.graph);e.dataset.add(s),c(s)}return e}static addList({ptr:e,predicates:t,items:n,graphs:r}){if(e.isAny())throw Error(`can't attach a list to an any ptr`);for(let i of t)for(let t of r){let r=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,i,r[0]||tc.nil,t));for(let i=0;i<r.length;i++)e.dataset.add(e.factory.quad(r[i],tc.first,n[i],t)),e.dataset.add(e.factory.quad(r[i],tc.rest,r[i+1]||tc.nil,t))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:r=[null],objects:i=[null]}){for(let a of n)for(let n of r)for(let r of i){let i={subject:a,predicate:n,object:r};i[t]=e.term;let o=e.dataset.match(i.subject,i.predicate,i.object);for(let t of o)e.dataset.delete(t)}return e}static deleteList({ptr:e,predicates:t}){let n=[];for(let r of t)for(let t of e.dataset.match(e.term,r)){let r=t.object;for(n.push(t);!tc.nil.equals(r);){r=n[n.length-1].object;let t=e.dataset.match(r);if(t.size===0)break;for(let e of t)n.push(e)}}for(let t of n)e.dataset.delete(t);return e}static execute({ptr:t,operation:n=`traverse`,quantifier:r,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l,items:u,callback:d}={}){if(n===`add`)return e.add({ptr:t,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l,callback:d});if(n===`addList`)return e.addList({ptr:t,predicates:s,items:u,graphs:l});if(n===`delete`)return e.delete({ptr:t,start:i,subjects:o,predicates:s,objects:c});if(n===`deleteList`)return e.deleteList({ptr:t,predicates:s});if(n===`isList`)return e.isList({ptr:t});if(n===`list`)return e.list({ptr:t});if(n===`traverse`)return e.traverse({ptr:t,quantifier:r,start:i,end:a,subjects:o,predicates:s,objects:c,graphs:l});throw Error(`unknown operation ${n}`)}static isList({ptr:t}){return t.isAny()?!1:!!(tc.nil.equals(t.term)||e.traverse({ptr:t,predicates:[tc.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(tc.nil);){let t=e.out([tc.first]);if(t.length!==1)throw Error(`Invalid list: rdf:first count not equals one on ${e.value}`);let n=e.out([tc.rest]);if(n.length!==1)throw Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:t,quantifier:n=`one`,start:r=`subject`,end:i=`object`,subjects:a=[null],predicates:o=[null],objects:s=[null],graphs:c=[null],callback:l}){if(n===`one`)return e.traverseOne({ptr:t,start:r,end:i,subjects:a,predicates:o,objects:s,graphs:c,callback:l});if(n===`oneOrMore`){let n=e.traverse({ptr:t,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l});return e.traverseMore({ptrs:n,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l})}if(n===`zeroOrMore`)return e.traverseMore({ptrs:[t],end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l});if(n===`zeroOrOne`)return[t,...e.traverse({ptr:t,end:i,start:r,subjects:a,predicates:o,objects:s,graphs:c,callback:l})];throw Error(`unknown quantifier ${n}`)}static traverseMore({ptrs:t,end:n,start:r,subjects:i,predicates:a,objects:o,graphs:s,callback:c}={}){let l=[...t],u,d;do{u=[];for(let l of t)u=[...u,...e.traverseOne({ptr:l,end:n,start:r,subjects:i,predicates:a,objects:o,graphs:s,callback:c})];d&&(u=u.filter(e=>!d.has(e.term))),t=u,l=[...l,...u],d=new Bs(l.map(e=>e.term))}while(u.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:r,predicates:i,objects:a,graphs:o,callback:s=(e,t)=>t.extend(e)}={}){let c=[];for(let l of r)for(let r of i)for(let i of a)for(let a of o){let o={subject:l,predicate:r,object:i,graph:a};o[t]=e.term;for(let r of e.dataset.match(o.subject,o.predicate,o.object,o.graph))c.push(s(new Rs({dataset:e.dataset,end:n,quad:r,start:t}),e))}return c}};function rc(e,t){return t?n=>t(e.extend(n)):()=>{}}var ic=class{constructor({dataset:e,edges:t=[],factory:n,graph:r,term:i}){if(!e&&t.length===0)throw Error(`dataset or edges is required`);if(t.length===0&&i===void 0||t.length>0&&i)throw Error(`edges or term must be given`);this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=r,t.length===0&&(this._term=i)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph==`object`?this._graph:this.edge&&this.edge.graph}get length(){return this._term===void 0?this.edges.length+1:1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term===void 0?this.edge.term:this._term}get value(){let e=this.term;return e===null?void 0:e.value}addIn(e,t,n){return nc.add({ptr:this,start:`object`,end:`subject`,subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:rc(this,n)})}addList(e,t){return nc.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return nc.add({ptr:this,start:`subject`,end:`object`,predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:rc(this,n)})}deleteIn(e,t){return nc.delete({ptr:this,start:`object`,subjects:t,predicates:e})}deleteList(e){return nc.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return nc.delete({ptr:this,start:`subject`,predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:a,objects:o,graphs:s,items:c,callback:l}){return nc.execute({ptr:this,operation:e,quantifier:t,start:n,end:r,subjects:i,predicates:a,objects:o,graphs:s,items:c,callback:l})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return nc.traverse({ptr:this,start:`object`,end:`object`,subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return nc.traverse({ptr:this,start:`subject`,end:`subject`,predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return nc.traverse({ptr:this,start:`object`,end:`subject`,subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return nc.isList({ptr:this})}list(){return nc.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term===void 0?this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term}):yield{dataset:this.dataset,term:this._term}}out(e,t){return nc.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(let{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}};function ac(e,t){return e?e.equals(t):e===t}function oc(e,t){return!(e.dataset!==t.dataset||!ac(e.graph,t.graph)||!ac(e.term,t.term))}function sc(e,t){return t?n=>t(new e.constructor({factory:e.factory,ptrs:[n]})):()=>{}}var cc=class{constructor({dataset:e,factory:t,ptrs:n,terms:r,graphs:i}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(let n of r||[null])for(let r of i||[null])this.ptrs.push(new ic({dataset:e,factory:t,graph:r,term:n}))}}get dataset(){let e=new Set(this.datasets);return e.size===1?e[Symbol.iterator]().next().value:null}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){let e=new Bs(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){return this.term?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,n){let r=sc(this,n);for(let n of this.ptrs)n.addIn(e,t,r);return this}addList(e,t){if(this.isAny())throw Error(`can't attach a list to an any ptr`);for(let n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){let r=sc(this,n);for(let n of this.ptrs)n.addOut(e,t,r);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(let n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(let t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(let n of this.ptrs)n.deleteOut(e,t);return this}distinct(){let e=this.ptrs.reduce((e,t)=>(e.some(e=>oc(e,t))||e.push(t.trim()),e),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(let n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(e=>e.ptrs[0])})}hasIn(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return this.ptrs.length===1?this.ptrs[0].isList():!1}list(){if(!this.isList())return;let e=this.ptrs[0].list(),t=this;return(function*(){for(let n of e)yield t.clone({ptrs:[n]})})()}map(e){return[...this].map(e)}node(e){let t=this.dataset,n=[...e].map(e=>new ic({dataset:t,factory:this.factory,term:e}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.out(e,t))})}*quads(){for(let{edges:e}of this.ptrs)for(let{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(let e of this.ptrs)yield this.clone({ptrs:[e]})}};ec(`http://www.w3.org/2002/07/owl#`);var lc=ec(`http://www.w3.org/1999/02/22-rdf-syntax-ns#`),uc=ec(`http://www.w3.org/2000/01/rdf-schema#`),Q=ec(`http://www.w3.org/ns/shacl#`),dc=ec(`https://schemas.link/shacl-next#`),fc=ec(`http://www.w3.org/2001/XMLSchema#`);function pc(e){return e?`{${[...e.quads()].map(e=>Is(e)).join(` `)}}`:`{}`}function mc(e){return e?`{${e.map(e=>pc(e)).join(` `)}}`:`{}`}var hc=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),gc=o(((e,t)=>{var n=hc(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),_c=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),vc=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),yc=o(((e,t)=>{var n=vc(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),bc=o(((e,t)=>{t.exports=yc().Symbol})),xc=o(((e,t)=>{var n=bc(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),Sc=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),Cc=o(((e,t)=>{var n=bc(),r=xc(),i=Sc(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),wc=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),Tc=o(((e,t)=>{var n=Cc(),r=wc(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),Ec=o(((e,t)=>{var n=gc(),r=_c(),i=Tc(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),Dc=o(((e,t)=>{var n=Ec(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),Oc=o(((e,t)=>{var n=Dc();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),kc=o(((e,t)=>{var n=Oc(),r=`Expected a function`;function i(e,t){var i;if(typeof t!=`function`)throw TypeError(r);return e=n(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=void 0),i}}t.exports=i})),Ac=l(o(((e,t)=>{var n=kc();function r(e){return n(2,e)}t.exports=r}))(),1),jc=class{constructor({details:e,factory:t,options:n,results:r=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=r,this._conforms=(0,Ac.default)(()=>!this.results.some(e=>e.severity.equals(Q.Info)||e.severity.equals(Q.Violation)||e.severity.equals(Q.Warning))),this._ptr=(0,Ac.default)(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){let e=new cc({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([lc.type],[Q.ValidationReport]).addOut([Q.conforms],[this.factory.literal(this.conforms.toString(),fc.boolean)]);for(let t of this.results)e.addOut([Q.result],[this.factory.blankNode()],e=>{t.build(e,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Mc(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&n.termType&&(n=Is(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n)),e)}var Nc=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:r,message:i=[],path:a,results:o=[],severity:s,shape:c,source:l=[],value:u,valuePaths:d=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=r,this.path=a||c.path,this.results=o,this.severity=s,this.shape=c,this.source=l,this.value=u,this.valuePaths=d,this._message=(0,Ac.default)(()=>(this.shape.message.length>0&&(i=this.shape.message),i.length===0&&(i=this.shape.ptr.node([this.constraintComponent]).out([Q.message]).terms),i.map(t=>n.literal(Mc(t.value,e,n),t.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([lc.type],[Q.ValidationResult]).addOut([Q.focusNode],this.focusNode.terms).addOut([Q.resultSeverity],[this.severity]).addOut([Q.sourceConstraint],this.source).addOut([Q.sourceConstraintComponent],[this.constraintComponent]).addOut([Q.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([Q.resultMessage],this.message);let n=t=>{if(t.quantifier===`one`)return t.predicates.length>1?e.node([this.factory.blankNode()]).addList([Q.alternativePath],t.predicates):t.start===`object`?e.node([this.factory.blankNode()]).addOut([Q.inversePath],[t.predicates[0]]):e.node([t.predicates[0]]);if(t.quantifier===`oneOrMore`)return e.node([this.factory.blankNode()]).addOut([Q.oneOrMorePath],[t.predicates[0]]);if(t.quantifier===`zeroOrMore`)return e.node([this.factory.blankNode()]).addOut([Q.zeroOrMorePath],[t.predicates[0]]);if(t.quantifier===`zeroOrOne`)return e.node([this.factory.blankNode()]).addOut([Q.zeroOrOnePath],[t.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([Q.resultPath],n(this.path[0]).terms):e.addList([Q.resultPath],this.path.map(e=>n(e).term))),this.value!==void 0&&e.addOut([Q.value],this.value.terms),t)for(let n of this.results)e.addOut([Q.detail],[this.factory.blankNode()],e=>{n.build(e,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}},Pc=class e{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:r=new Set,report:i=new jc({factory:e,options:n}),results:a=new Map,shape:o,value:s,valueOrNode:c,valuePaths:l,values:u}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=r,this.report=i,this.results=a,this.shape=o,this.value=s,this.valuePaths=l,this.valueOrNode=c,this.values=u}create({child:t,focusNode:n=this.focusNode,shape:r=this.shape,value:i=this.value,valueOrNode:a=this.valueOrNode,valuePaths:o=this.valuePaths,values:s=this.values}={}){return new e({factory:this.factory,focusNode:n,options:this.options,processed:this.processed,report:t?new jc({factory:this.factory,options:this.options}):this.report,results:this.results,shape:r,value:i,valueOrNode:a,valuePaths:o,values:s})}id({shape:e=this.shape}={}){return`${Is(e.ptr.term)} - ${Is(this.focusNode.term)} - ${mc(this.valuePaths)}`}result(e){let t=new Nc({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),n=this.id();this.results.has(n)?this.results.get(n).add(t):this.results.set(n,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:dc.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:dc.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||Q.Violation,...t})}};function Fc(){return{generic:Ic()}}function Ic(){return e=>{e.trace(dc.TraversalConstraintComponent,{args:{},message:[e.factory.literal(`Traversal`)],value:e.valueOrNode})}}var Lc=class{constructor(e){this.validations=new Ls(e)}compile(e){let t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1,r=new Set;for(let t of e.ptr.execute({start:`subject`,end:`predicate`})){let e=this.validations.get(t.term);e&&(r.add(e),t.term.equals(Q.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&r.add(Fc),[...r].map(t=>t(e)).filter(Boolean)}},Rc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Translator=void 0,e.Translator=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(e){throw Error(`Invalid RDF ${e.datatype.value} value: '${e.value}'`)}registerHandler(e,t,n){for(let n of t)this.supportedRdfDatatypes.push(n),this.fromRdfHandlers[n.value]=e;for(let t of n){let n=this.toRdfHandlers[t];n||(this.toRdfHandlers[t]=n=[]),n.push(e)}}fromRdf(e,t){let n=this.fromRdfHandlers[e.datatype.value];return n?n.fromRdf(e,t):e.value}toRdf(e,t){let n=this.toRdfHandlers[typeof e];if(n)for(let r of n){let n=r.toRdf(e,t);if(n)return n}throw Error(`Invalid JavaScript value: '${e}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}}})),zc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerBoolean=void 0;var t=Rc(),n=class e{fromRdf(e,n){switch(e.value){case`true`:return!0;case`false`:return!1;case`1`:return!0;case`0`:return!1}return n&&t.Translator.incorrectRdfDataType(e),!1}toRdf(t,{datatype:n,dataFactory:r}){return r.literal(t?`true`:`false`,n||r.namedNode(e.TYPE))}};e.TypeHandlerBoolean=n,n.TYPE=`http://www.w3.org/2001/XMLSchema#boolean`})),Bc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerDate=void 0;var t=Rc(),n=class e{fromRdf(n,r){switch(r&&!n.value.match(e.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&t.Translator.incorrectRdfDataType(n),n.datatype.value){case`http://www.w3.org/2001/XMLSchema#gDay`:return new Date(0,0,parseInt(n.value,10));case`http://www.w3.org/2001/XMLSchema#gMonthDay`:let e=n.value.split(`-`);return new Date(0,parseInt(e[0],10)-1,parseInt(e[1],10));case`http://www.w3.org/2001/XMLSchema#gYear`:return new Date(n.value+`-01-01`);case`http://www.w3.org/2001/XMLSchema#gYearMonth`:return new Date(n.value+`-01`);default:return new Date(n.value)}}toRdf(t,{datatype:n,dataFactory:r}){if(n||=r.namedNode(e.TYPES[0]),!(t instanceof Date))return null;let i=t,a;switch(n.value){case`http://www.w3.org/2001/XMLSchema#gDay`:a=String(i.getUTCDate());break;case`http://www.w3.org/2001/XMLSchema#gMonthDay`:a=i.getUTCMonth()+1+`-`+i.getUTCDate();break;case`http://www.w3.org/2001/XMLSchema#gYear`:a=String(i.getUTCFullYear());break;case`http://www.w3.org/2001/XMLSchema#gYearMonth`:a=i.getUTCFullYear()+`-`+(i.getUTCMonth()+1);break;case`http://www.w3.org/2001/XMLSchema#date`:a=i.toISOString().replace(/T.*$/,``);break;default:a=i.toISOString()}return r.literal(a,n)}};e.TypeHandlerDate=n,n.TYPES=[`http://www.w3.org/2001/XMLSchema#dateTime`,`http://www.w3.org/2001/XMLSchema#date`,`http://www.w3.org/2001/XMLSchema#gDay`,`http://www.w3.org/2001/XMLSchema#gMonthDay`,`http://www.w3.org/2001/XMLSchema#gYear`,`http://www.w3.org/2001/XMLSchema#gYearMonth`],n.VALIDATORS={date:/^[0-9]+-[0-9][0-9]-[0-9][0-9]Z?$/,dateTime:/^[0-9]+-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9](\.[0-9][0-9][0-9])?((Z?)|([\+-][0-9][0-9]:[0-9][0-9]))$/,gDay:/^[0-9]+$/,gMonthDay:/^[0-9]+-[0-9][0-9]$/,gYear:/^[0-9]+$/,gYearMonth:/^[0-9]+-[0-9][0-9]$/}})),Vc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerNumberDouble=void 0;var t=Rc(),n=class e{fromRdf(e,n){let r=parseFloat(e.value);return n&&isNaN(r)&&t.Translator.incorrectRdfDataType(e),r}toRdf(t,{datatype:n,dataFactory:r}){return n||=r.namedNode(e.TYPES[0]),isNaN(t)?r.literal(`NaN`,n):isFinite(t)?t%1==0?null:r.literal(t.toExponential(15).replace(/(\d)0*e\+?/,`$1E`),n):r.literal(t>0?`INF`:`-INF`,n)}};e.TypeHandlerNumberDouble=n,n.TYPES=[`http://www.w3.org/2001/XMLSchema#double`,`http://www.w3.org/2001/XMLSchema#decimal`,`http://www.w3.org/2001/XMLSchema#float`]})),Hc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerNumberInteger=void 0;var t=Rc(),n=class e{fromRdf(e,n){let r=parseInt(e.value,10);return n&&(isNaN(r)||e.value.indexOf(`.`)>=0)&&t.Translator.incorrectRdfDataType(e),r}toRdf(t,{datatype:n,dataFactory:r}){return r.literal(String(t),n||(t<=e.MAX_INT&&t>=e.MIN_INT?r.namedNode(e.TYPES[0]):r.namedNode(e.TYPES[1])))}};e.TypeHandlerNumberInteger=n,n.TYPES=[`http://www.w3.org/2001/XMLSchema#integer`,`http://www.w3.org/2001/XMLSchema#long`,`http://www.w3.org/2001/XMLSchema#int`,`http://www.w3.org/2001/XMLSchema#byte`,`http://www.w3.org/2001/XMLSchema#short`,`http://www.w3.org/2001/XMLSchema#negativeInteger`,`http://www.w3.org/2001/XMLSchema#nonNegativeInteger`,`http://www.w3.org/2001/XMLSchema#nonPositiveInteger`,`http://www.w3.org/2001/XMLSchema#positiveInteger`,`http://www.w3.org/2001/XMLSchema#unsignedByte`,`http://www.w3.org/2001/XMLSchema#unsignedInt`,`http://www.w3.org/2001/XMLSchema#unsignedLong`,`http://www.w3.org/2001/XMLSchema#unsignedShort`],n.MAX_INT=2147483647,n.MIN_INT=-2147483648})),Uc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.TypeHandlerString=void 0;var t=class{fromRdf(e){return e.value}toRdf(e,{datatype:t,dataFactory:n}){return n.literal(e,t)}};e.TypeHandlerString=t,t.TYPES=[`http://www.w3.org/2001/XMLSchema#string`,`http://www.w3.org/2001/XMLSchema#normalizedString`,`http://www.w3.org/2001/XMLSchema#anyURI`,`http://www.w3.org/2001/XMLSchema#base64Binary`,`http://www.w3.org/2001/XMLSchema#language`,`http://www.w3.org/2001/XMLSchema#Name`,`http://www.w3.org/2001/XMLSchema#NCName`,`http://www.w3.org/2001/XMLSchema#NMTOKEN`,`http://www.w3.org/2001/XMLSchema#token`,`http://www.w3.org/2001/XMLSchema#hexBinary`,`http://www.w3.org/1999/02/22-rdf-syntax-ns#langString`,`http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString`,`http://www.w3.org/2001/XMLSchema#time`,`http://www.w3.org/2001/XMLSchema#duration`]})),Wc=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(zc(),e),n(Bc(),e),n(Vc(),e),n(Hc(),e),n(Uc(),e)})),Gc=o((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),Kc=o((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.fromRdf=c,e.toRdf=l,e.getTermRaw=u,e.getSupportedRdfDatatypes=d,e.getSupportedJavaScriptPrimitives=f;var r=hn(),i=Wc(),a=Rc();n(Wc(),e),n(Gc(),e),n(Rc(),e);var o=new r.DataFactory,s=new a.Translator;s.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(e=>o.namedNode(e)),[`string`]),s.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(e=>o.namedNode(e)),[`boolean`]),s.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(e=>o.namedNode(e)),[`number`]),s.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(e=>o.namedNode(e)),[`number`]),s.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(e=>o.namedNode(e)),[`object`]);function c(e,t){return s.fromRdf(e,t)}function l(e,t){return t&&`namedNode`in t&&(t={dataFactory:t}),t||={},t&&!t.dataFactory&&(t.dataFactory=o),s.toRdf(e,t)}function u(e,t){return e.termType===`Literal`?c(e,t):e.value}function d(){return s.getSupportedRdfDatatypes()}function f(){return s.getSupportedJavaScriptPrimitives()}}))();function qc(e){if(e.term.termType!==`BlankNode`)return{quantifier:`one`,start:`subject`,end:`object`,predicates:[e.term]};let t=e.out([Q.alternativePath]);if(t.ptrs.length===1&&t.ptrs[0].isList())return{quantifier:`one`,start:`subject`,end:`object`,predicates:[...t.list()].map(e=>e.term)};let n=e.out([Q.inversePath]);if(n.term)return{quantifier:`one`,start:`object`,end:`subject`,predicates:[n.term]};let r=e.out([Q.oneOrMorePath]);if(r.term)return{quantifier:`oneOrMore`,start:`subject`,end:`object`,predicates:[r.term]};let i=e.out([Q.zeroOrMorePath]);if(i.term)return{quantifier:`zeroOrMore`,start:`subject`,end:`object`,predicates:[i.term]};let a=e.out([Q.zeroOrOnePath]);if(a.term)return{quantifier:`zeroOrOne`,start:`subject`,end:`object`,predicates:[a.term]}}function Jc(e){return e.terms.length===0?null:e.ptrs[0].isList()?[...e.list()].map(e=>qc(e)):[qc(e)]}var Yc=class{constructor(e){this.shape=e,this._compiled=(0,Ac.default)(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){let t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(let e of this.compiled)e.node&&await e.node(t),e.generic&&await e.generic(t)}async validateProperty(e){let t;t=this.shape.isSparqlShape?e.focusNode:e.focusNode.executeAll(this.shape.path);let n=t.node(new Bs(t.terms)),r=[...t].reduce((e,n)=>{let r=n.term,i=t.node([r]);return e.has(r)||e.set(r,{value:i,valuePaths:[]}),e.get(r).valuePaths.push(n),e},new Ls).values(),i=e.create({shape:this.shape,values:n});for(let e of this.compiled)e.property&&await e.property(i);for(let{value:t,valuePaths:n}of r){let r=e.create({shape:this.shape,value:t,valueOrNode:t,valuePaths:n});for(let e of this.compiled)e.generic&&await e.generic(r)}}};function Xc(e){let t=new Bs,n=new cc({dataset:e.dataset,terms:e.terms}).execute({quantifier:`zeroOrMore`,start:`object`,end:`subject`,predicates:[uc.subClassOf]});for(let e of n.ptrs)for(let{term:n}of e.nodes())t.add(n);return t}var Zc=class{constructor(e,{registry:t}){this.registry=t,this.targetClass=new Bs([...Xc(e.hasOut([lc.type],[Q.NodeShape])),...Xc(e.out([Q.targetClass]))]),this.targetNode=e.out([Q.targetNode]).terms,this.targetObjectsOf=e.out([Q.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([Q.targetSubjectsOf]).terms,this.targets=[...e.out([Q.target])]}async resolve(e){let t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([lc.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:`object`,end:`object`,predicates:this.targetObjectsOf}).ptrs,...t.execute({start:`subject`,end:`subject`,predicates:this.targetSubjectsOf}).ptrs];for(let t of this.targets)for(let[,r]of this.registry.targetResolvers){let i=await r(t,e);n.push(...e.focusNode.node(i).ptrs)}let r=e.focusNode.clone({ptrs:n});return r.node([...new Bs(r.terms)])}},Qc=class{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=(0,Ac.default)(()=>{let e=this.ptr.out([Q.deactivated]).term;return e&&(0,Kc.fromRdf)(e)}),this._message=(0,Ac.default)(()=>this.ptr.out([Q.message]).terms),this._path=(0,Ac.default)(()=>Jc(this.ptr.out([Q.path]))),this._severity=(0,Ac.default)(()=>this.ptr.out([Q.severity]).term),this._shapeValidator=(0,Ac.default)(()=>new Yc(this)),this._sparql=(0,Ac.default)(()=>this.ptr.out([Q.sparql])),this._targetResolver=(0,Ac.default)(()=>new Zc(this.ptr,{registry:this.validator.targetResolverRegistry}))}get deactivated(){return this._deactivated()}get isPropertyShape(){return!!this.path}get isSparqlShape(){return this.sparql.terms.length>0}get path(){return this._path()}get targetResolver(){return this._targetResolver()}get message(){return this._message()}get severity(){return this._severity()}get shapeValidator(){return this._shapeValidator()}get sparql(){return this._sparql()}async resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){let t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(let n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}},$c=class{constructor(e){this.targetResolvers=new Ls(e)}};function el(e){return{property:tl(parseInt(e.ptr.out([Q.maxCount]).value))}}function tl(e){return t=>{t.test(t.values.terms.length<=e,Q.MaxCountConstraintComponent,{args:{maxCount:e},message:[t.factory.literal(`More than {$maxCount} values`)]})}}function nl(e){return{property:rl(parseInt(e.ptr.out([Q.minCount]).value))}}function rl(e){return t=>{t.test(t.values.terms.length>=e,Q.MinCountConstraintComponent,{args:{minCount:e},message:[t.factory.literal(`Less than {$minCount} values`)]})}}async function il(e,t){for(let n of e)if(!await t(n))return!1;return!0}async function al(e,t){return(await Promise.all(e.map(e=>t(e)))).filter(Boolean)}async function ol(e,t){return Promise.all(e.map(t))}async function sl(e,t){for(let n of e)if(await t(n))return!0;return!1}function cl(e){return{generic:ll([...e.ptr.out([Q.and])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function ll(e){return async t=>{let n=await ol(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report),r=n.every(e=>e.conforms);t.test(r,Q.AndConstraintComponent,{results:n.flatMap(e=>e.results),value:t.valueOrNode})}}function ul(e){return{generic:dl(e.validator.shape(e.ptr.out([Q.not])))}}function dl(e){return async t=>{let n=(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report,r=!n.conforms;t.test(r,Q.NotConstraintComponent,{args:{not:e.ptr.term},message:[t.factory.literal(`Value does have shape {$not}`)],results:n.results,value:t.valueOrNode})}}function fl(e){return{generic:pl([...e.ptr.out([Q.or])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function pl(e){return async t=>{let n=[],r;if(t.options.debug||t.options.details){let i=await ol(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report);n=i.flatMap(e=>e.results),r=i.some(e=>e.conforms)}else r=await sl(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report.conforms);t.test(r,Q.OrConstraintComponent,{results:n,value:t.valueOrNode})}}function ml(e){return{generic:hl([...e.ptr.out([Q.xone])].flatMap(e=>[...e.list()]).map(t=>e.validator.shape(t)))}}function hl(e){return async t=>{let n=await ol(e,async e=>(await e.validate(t.create({child:!0,focusNode:t.valueOrNode}))).report),r=n.filter(e=>e.conforms).length===1;t.test(r,Q.XoneConstraintComponent,{results:n.flatMap(e=>e.results),value:t.valueOrNode})}}function gl(e){return(0,Kc.fromRdf)(e.ptr.out([Q.closed]).term)?{node:_l(new Bs(e.ptr.out([Q.property]).map(t=>e.validator.shape(t)).filter(e=>!e.deactivated).map(e=>e.path[0].predicates[0])),new Bs([...e.ptr.out([Q.ignoredProperties]).list()||[]].map(e=>e.term)))}:null}function _l(e,t){return n=>{let r=n.focusNode.execute({start:`subject`,end:`predicate`}).filter(n=>t.has(n.term)?!1:!e.has(n.term));if(r.ptrs.length>0)for(let e of r)n.violation(Q.ClosedConstraintComponent,{message:[n.factory.literal(`Predicate is not allowed (closed shape)`)],path:[{quantifier:`one`,start:`subject`,end:`object`,predicates:[e.term]}],value:n.focusNode.node([[...e.quads()][0].object])});else n.debug(Q.ClosedConstraintComponent)}}function vl(e){let t=e.ptr.out([Q.hasValue]).term;return{node:yl(t),property:bl(t)}}function yl(e){return t=>{t.test(e.equals(t.valueOrNode.term),Q.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal(`Value must be {$hasValue}`)]})}}function bl(e){return t=>{let n=[...t.values].some(t=>e.equals(t.term));t.test(n,Q.HasValueConstraintComponent,{args:{hasValue:e},message:[t.factory.literal(`Missing expected value {$hasValue}`)]})}}function xl(e){return{generic:Sl(new Bs([...e.ptr.out([Q.in]).list()].map(e=>e.term)))}}function Sl(e){return t=>{t.test(e.has(t.valueOrNode.term),Q.InConstraintComponent,{args:{in:[...e].map(e=>e.value).join(`, `)},message:[t.factory.literal(`Value is not in {$in}`)],value:t.valueOrNode})}}function Cl(e,t){if(!e||e.termType!==`Literal`||!t||t.termType!==`Literal`||wl(e)!==wl(t))return null;let n=(0,Kc.fromRdf)(e),r=(0,Kc.fromRdf)(t);return typeof n==typeof r?typeof n==`string`?n.localeCompare(r):n-r:null}function wl(e){return fc.dateTime.equals(e.datatype)&&/^.*(((\+|-)\d{2}:\d{2})|Z)$/.test(e.value)}function Tl(e){let t=e.ptr.out([Q.disjoint]).term;return{generic:El(t)}}function El(e){return t=>{let n=t.focusNode.dataset.match(t.focusNode.term,e,t.valueOrNode.term);t.test(n.size===0,Q.DisjointConstraintComponent,{args:{disjoint:e},message:[t.factory.literal(`Value node must not also be one of the values of {$disjoint}`)],value:t.valueOrNode})}}function Dl(e){let t=e.ptr.out([Q.equals]).term;return{node:Ol(t),property:kl(t)}}function Ol(e){return t=>{let n=t.focusNode.out([e]),r=n.filter(e=>!e.term.equals(t.focusNode.term)),i=n.terms.length!==0&&r.terms.length===0;t.test(i,Q.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)],value:r.terms[0]&&t.focusNode.node([r.terms[0]])||t.focusNode})}}function kl(e){return t=>{let n=new Bs(t.focusNode.out([e]).terms),r=new Bs(t.values.terms),i=[...r].filter(e=>!n.has(e)),a=[...n].filter(e=>!r.has(e)),o=[...i,...a];for(let n of o)t.violation(Q.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)],value:t.focusNode.node([n])});o.length===0&&t.debug(Q.EqualsConstraintComponent,{args:{equals:e},message:[t.factory.literal(`Must have same values as {$equals}`)]})}}function Al(e){let t=e.ptr.out([Q.lessThan]).term;return{property:jl(t)}}function jl(e){return t=>{let n=t.focusNode.out([e]).terms;for(let r of t.values)for(let i of n){let n=Cl(r.term,i);n===null||n>=0?t.violation(Q.LessThanConstraintComponent,{args:{lessThan:e},message:[t.factory.literal(`Value is not less than value of {$lessThan}`)],value:r}):t.debug(Q.LessThanConstraintComponent,{args:{lessThan:e},message:[t.factory.literal(`Value is not less than value of {$lessThan}`)],value:r})}}}function Ml(e){let t=e.ptr.out([Q.lessThanOrEquals]).term;return{property:Nl(t)}}function Nl(e){return t=>{let n=t.focusNode.out([e]).terms;for(let r of t.values)for(let i of n){let n=Cl(r.term,i);n===null||n>0?t.violation(Q.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:e},message:[t.factory.literal(`Value is not less than or equal to value of {$lessThanOrEquals}`)],value:r}):t.debug(Q.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:e},message:[t.factory.literal(`Value is not less than or equal to value of {$lessThanOrEquals}`)],value:r})}}}function Pl(e){let t=e.ptr.out([Q.maxExclusive]).term;return{generic:Fl(t)}}function Fl(e){return t=>{let n=Cl(t.valueOrNode.term,e);t.test(n!==null&&n<0,Q.MaxExclusiveConstraintComponent,{args:{maxExclusive:e},message:[t.factory.literal(`Value is not less than {$maxExclusive}`)],value:t.valueOrNode})}}function Il(e){let t=e.ptr.out([Q.maxInclusive]).term;return{generic:Ll(t)}}function Ll(e){return t=>{let n=Cl(t.valueOrNode.term,e);t.test(n!==null&&n<=0,Q.MaxInclusiveConstraintComponent,{args:{maxInclusive:e},message:[t.factory.literal(`Value is not less than or equal to {$maxInclusive}`)],value:t.valueOrNode})}}function Rl(e){let t=e.ptr.out([Q.minExclusive]).term;return{generic:zl(t)}}function zl(e){return t=>{let n=Cl(t.valueOrNode.term,e);t.test(n!==null&&n>0,Q.MinExclusiveConstraintComponent,{args:{minExclusive:e},message:[t.factory.literal(`Value is not greater than {$minExclusive}`)],value:t.valueOrNode})}}function Bl(e){let t=e.ptr.out([Q.minInclusive]).term;return{generic:Vl(t)}}function Vl(e){return t=>{let n=Cl(t.valueOrNode.term,e);t.test(n!==null&&n>=0,Q.MinInclusiveConstraintComponent,{args:{minInclusive:e},message:[t.factory.literal(`Value is not greater than or equal to {$minInclusive}`)],value:t.valueOrNode})}}function Hl(e){return{generic:Ul([...e.ptr.out([Q.node])].map(t=>e.validator.shape(t)))}}function Ul(e){return async t=>{for(let n of e){let e=await n.validate(t.create({child:!0,focusNode:t.valueOrNode}));t.test(e.report.conforms,Q.NodeConstraintComponent,{args:{node:n.ptr.term},message:[t.factory.literal(`Value does not have shape {$node}`)],results:e.report.results,value:t.valueOrNode})}}}function Wl(e){return{generic:Gl([...e.ptr.out([Q.property])].map(t=>e.validator.shape(t)))}}function Gl(e){return async t=>{let n=t.create({focusNode:t.valueOrNode});for(let t of e)await t.validate(n)}}function Kl(e){let t=e.validator.shape(e.ptr.out([Q.qualifiedValueShape])),n=e.ptr.out([Q.qualifiedValueShapesDisjoint]).term,r=n?(0,Kc.fromRdf)(n):!1,i=e.ptr.out([Q.qualifiedMaxCount]).term,a=i?parseInt(i.value):null,o=e.ptr.out([Q.qualifiedMinCount]).term;return{property:ql(t,r,a,o?parseInt(o.value):null)}}function ql(e,t,n,r){return async i=>{let a=[],o=[];t&&(o=new Set(i.shape.ptr.in([Q.property]).out([Q.property]).out([Q.qualifiedValueShape]).filter(t=>!t.term.equals(e.ptr.term)).map(e=>i.shape.validator.shape(e))));let s=(await al(i.values,async t=>{let n=(await e.validate(i.create({child:!0,focusNode:t}))).report;if(a.push(n.results),!n.conforms)return!1;if(o.length===0)return!0;if(i.options.debug||i.options.details){let e=await ol([...o],async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report);return a.push(e.flatMap(e=>e.results)),!e.every(e=>e.conforms)}else return!await il([...o],async e=>(await e.validate(i.create({child:!0,focusNode:t}))).report.conforms)})).length;n!==null&&i.test(s<=n,Q.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:n,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal(`More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}`)],results:a.flat()}),r!==null&&i.test(s>=r,Q.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:e.ptr.term,qualifiedValueShapesDisjoint:t},message:[i.factory.literal(`Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}`)],results:a.flat()})}}function Jl(e,t){return t?t.slice(0,e.length)===e:!1}function Yl(e){return{generic:Xl([...new Set([...e.ptr.out([Q.languageIn]).list()].map(e=>e.value))])}}function Xl(e){return t=>{let n=e.some(e=>Jl(e,t.valueOrNode.term.language));t.test(n,Q.LanguageInConstraintComponent,{args:{languageIn:e.join(`, `)},message:[t.factory.literal(`Language does not match any of {$languageIn}`)],value:t.valueOrNode})}}function Zl(e){return{generic:Ql(parseInt(e.ptr.out([Q.maxLength]).value))}}function Ql(e){return t=>{let n=t.valueOrNode.term.termType!==`BlankNode`&&t.valueOrNode.value.length<=e;t.test(n,Q.MaxLengthConstraintComponent,{args:{maxLength:e},message:[t.factory.literal(`Value has more than {$maxLength} characters`)],value:t.valueOrNode})}}function $l(e){return{generic:eu(parseInt(e.ptr.out([Q.minLength]).value))}}function eu(e){return t=>{let n=t.valueOrNode.term.termType!==`BlankNode`&&t.valueOrNode.value.length>=e;t.test(n,Q.MinLengthConstraintComponent,{args:{minLength:e},message:[t.factory.literal(`Value has less than {$minLength} characters`)],value:t.valueOrNode})}}function tu(e){let t=e.ptr.out([Q.pattern]).value,n=e.ptr.out([Q.flags]).value;return{generic:nu(t,n,new RegExp(t,n))}}function nu(e,t,n){return r=>{r.test(n.test(r.valueOrNode.term.value),Q.PatternConstraintComponent,{args:{flags:t,pattern:e},message:[r.factory.literal(`Value does not match pattern "{$pattern}"`)],value:r.valueOrNode})}}function ru(e){let t=e.ptr.out([Q.uniqueLang]).term;return t.value===`true`&&fc.boolean.equals(t.datatype)?{property:iu()}:null}function iu(){return e=>{let t=Object.entries(e.values.terms.reduce((e,t)=>(t.language&&(e[t.language]=(e[t.language]||0)+1),e),{})).filter(([,e])=>e>1);for(let[n]of t)e.violation(Q.UniqueLangConstraintComponent,{args:{lang:n},message:[e.factory.literal(`Language "{?lang}" used more than once`)]});t.length===0&&e.debug(Q.UniqueLangConstraintComponent)}}var au=ec(`http://www.w3.org/ns/shacl#`),ou=ec(`https://schemas.link/shacl-next#`),su=class{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(au.Info)||e.severity.equals(au.Violation)||e.severity.equals(au.Warning))}};function cu(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&n.termType&&(n=Is(n)),e.replace(`{$${t}}`,n).replace(`{?${t}}`,n)),e)}var lu=class{constructor({args:e={},factory:t,message:n=[],severity:r=au.Violation}={}){this.severity=r,this.message=n.map(n=>t.literal(cu(n.value,e),n.language||null))}},uu=class e{constructor({factory:e=Qs}={}){this.factory=e}clone({factory:t}={}){return new e({factory:t||this.factory})}validate(){return new su}validateSimple(){return!0}},du=class e extends uu{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(let t of Array.isArray(e)?e:[e])t&&this.datatypes.push(this.factory.fromTerm(t))}clone({factory:t}={}){return new e({datatypes:this.datatypes,factory:t||this.factory})}},fu=class{constructor({factory:e=Qs,validations:t}={}){if(this.factory=e,this.validations=new Ls,t)for(let e of Object.values(t)){let t=e.clone({factory:this.factory});for(let e of t.datatypes)this.validations.set(e,t)}}validate(e){let t=this.validations.get(e.datatype);return t?t.validate(e):new su}validateSimple(e){let t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}},pu=class e extends du{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal(`term value {$this} matches pattern {$pattern}`)],this.patterns=Array.isArray(e)?e:[e]}clone({factory:t}={}){return new e(this.patterns,this.datatypes,{factory:t||this.factory})}validate(e){return new su({results:this.patterns.map(t=>{let n;return t.test(e.value)&&(n=ou.Debug),new lu({args:{pattern:this.factory.literal(t.toString()),this:e},factory:this.factory,message:this.message,severity:n})})})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}},mu=/^([-+]?[0-9]+)$/,hu=class e extends pu{constructor(e=null,t=null,n,{factory:r}={}){super(mu,n,{factory:r}),this.maxInclusive=null,this.minInclusive=null,typeof t==`string`&&(this.maxInclusive=BigInt(t)),typeof e==`string`&&(this.minInclusive=BigInt(e))}clone({factory:t}={}){return new e(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:t||this.factory})}validate(e){let t=super.validate(e).results;if(!ou.Debug.equals(t[0].severity))return new su({results:t});let n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){let n=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new lu({factory:this.factory,message:r}))}if(this.maxInclusive!==null&&n>this.maxInclusive){let n=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,r=[this.factory.literal(n)];t.push(new lu({factory:this.factory,message:r}))}return new su({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;let t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}},gu=class e extends du{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:t}={}){return new e(this.values,this.datatypes,{factory:t||this.factory})}validate(e){let t=[];if(!this.values.has(e.value)){let n=`term value "${e.value}" is not included in the list: ${[...this.values].join(`,`)}`,r=[this.factory.literal(n)];t.push(new lu({factory:this.factory,message:r}))}return new su({results:t})}validateSimple(e){return this.values.has(e.value)}},_u=s({anyAtomicType:()=>yu,anySimpleType:()=>vu,anyURI:()=>Xu,base64Binary:()=>Yu,boolean:()=>Fu,byte:()=>fd,date:()=>Hu,dateTime:()=>Bu,dateTimeStamp:()=>xd,dayTimeDuration:()=>bd,decimal:()=>Iu,double:()=>Ru,duration:()=>zu,float:()=>Lu,gDay:()=>Ku,gMonth:()=>qu,gMonthDay:()=>Gu,gYear:()=>Wu,gYearMonth:()=>Uu,hexBinary:()=>Ju,int:()=>ud,integer:()=>od,language:()=>ad,long:()=>ld,negativeInteger:()=>cd,nonNegativeInteger:()=>pd,nonPositiveInteger:()=>sd,normalizedString:()=>rd,positiveInteger:()=>vd,short:()=>dd,string:()=>Pu,time:()=>Vu,token:()=>id,unsignedByte:()=>_d,unsignedInt:()=>hd,unsignedLong:()=>md,unsignedShort:()=>gd,yearMonthDuration:()=>yd}),$={xsd:ec(`http://www.w3.org/2001/XMLSchema#`)},vu=new du({datatypes:$.xsd.anySimpleType}),yu=new du({datatypes:$.xsd.anyAtomicType}),bu=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,xu=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Su=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Cu=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,wu=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T(([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Tu=/^((([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\.[0-9]+)?|(24:00:00(\.0+)?))(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Eu=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Du=/^(-?([1-9][0-9]{3,}|0[0-9]{3})-(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Ou=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,ku=/^(--(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Au=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,ju=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,Mu=/^(([0-9a-fA-F]{2})*)$/,Nu=/^(((([A-Za-z0-9+/] ?){4})*(([A-Za-z0-9+/] ?){3}[A-Za-z0-9+/]|([A-Za-z0-9+/] ?){2}[AEIMQUYcgkosw048] ?=|[A-Za-z0-9+/] ?[AQgw] ?= ?=))?)$/,Pu=new pu(bu,$.xsd.string),Fu=new gu([`1`,`true`,`0`,`false`],$.xsd.boolean),Iu=new pu(xu,$.xsd.decimal),Lu=new pu(Su,$.xsd.float),Ru=new pu(Su,$.xsd.double),zu=new pu(Cu,$.xsd.duration),Bu=new pu(wu,$.xsd.dateTime),Vu=new pu(Tu,$.xsd.time),Hu=new pu(Eu,$.xsd.date),Uu=new pu(Du,$.xsd.gYearMonth),Wu=new pu(Ou,$.xsd.gYear),Gu=new pu(ku,$.xsd.gMonthDay),Ku=new pu(Au,$.xsd.gDay),qu=new pu(ju,$.xsd.gMonth),Ju=new pu(Mu,$.xsd.hexBinary),Yu=new pu(Nu,$.xsd.base64Binary),Xu=new pu(bu,$.xsd.anyURI),Zu=/^([^\u000d\u000a\u0009]*)$/,Qu=/^([^ ]+( [^ ]+)*)*$/,$u=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,ed=/^([^DT]*)$/,td=/^([^YM]*[DT].*)$/,nd=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,rd=new pu([bu,Zu],$.xsd.normalizedString),id=new pu([bu,Zu,Qu],$.xsd.token),ad=new pu($u,$.xsd.language),od=new hu(null,null,$.xsd.integer),sd=new hu(null,`0`,$.xsd.nonPositiveInteger),cd=new hu(null,`-1`,$.xsd.negativeInteger),ld=new hu(`-9223372036854775808`,`9223372036854775807`,$.xsd.long),ud=new hu(`-2147483648`,`2147483647`,$.xsd.int),dd=new hu(`-32768`,`32767`,$.xsd.short),fd=new hu(`-128`,`127`,$.xsd.byte),pd=new hu(`0`,null,$.xsd.nonNegativeInteger),md=new hu(`0`,`18446744073709551615`,$.xsd.unsignedLong),hd=new hu(`0`,`4294967295`,$.xsd.unsignedInt),gd=new hu(`0`,`65535`,$.xsd.unsignedShort),_d=new hu(`0`,`255`,$.xsd.unsignedByte),vd=new hu(`1`,null,$.xsd.positiveInteger),yd=new pu([Cu,ed],$.xsd.yearMonthDuration),bd=new pu([Cu,td],$.xsd.dayTimeDuration),xd=new pu([wu,nd],$.xsd.dateTimeStamp),Sd=class extends fu{constructor({factory:e}={}){super({factory:e,validations:{..._u}})}},Cd=new Ls([[Q.BlankNode,new Set([`BlankNode`])],[Q.BlankNodeOrIRI,new Set([`BlankNode`,`NamedNode`])],[Q.BlankNodeOrLiteral,new Set([`BlankNode`,`Literal`])],[Q.IRI,new Set([`NamedNode`])],[Q.IRIOrLiteral,new Set([`NamedNode`,`Literal`])],[Q.Literal,new Set([`Literal`])]]);function wd(e){return{generic:Td(e.ptr.out([Q.class]).map(e=>Xc(e)))}}function Td(e){return t=>{let n=new Bs(t.valueOrNode.out([lc.type]).terms);for(let r of e){let e=[...n].some(e=>r.has(e));t.test(e,Q.ClassConstraintComponent,{value:t.valueOrNode})}}}function Ed(e){let t=e.ptr.out([Q.datatype]).term;return{generic:Dd(t,new Sd)}}function Dd(e,t){return n=>{let r=e.equals(n.valueOrNode.term.datatype)&&t.validateSimple(n.valueOrNode.term);n.test(r,Q.DatatypeConstraintComponent,{args:{datatype:e},message:[n.factory.literal(`Value does not have datatype {$datatype}`)],value:n.valueOrNode})}}function Od(e){let t=e.ptr.out([Q.nodeKind]).term;return{generic:kd(t,Cd.get(t))}}function kd(e,t){return n=>{n.test(t.has(n.valueOrNode.term.termType),Q.NodeKindConstraintComponent,{args:{nodeKind:e},message:[n.factory.literal(`Value does not have node kind {$nodeKind}`)],value:n.valueOrNode})}}var Ad=new Ls([[Q.maxCount,el],[Q.minCount,nl],[Q.and,cl],[Q.not,ul],[Q.or,fl],[Q.xone,ml],[Q.closed,gl],[Q.hasValue,vl],[Q.in,xl],[Q.disjoint,Tl],[Q.equals,Dl],[Q.lessThan,Al],[Q.lessThanOrEquals,Ml],[Q.maxExclusive,Pl],[Q.maxInclusive,Il],[Q.minExclusive,Rl],[Q.minInclusive,Bl],[Q.node,Hl],[Q.property,Wl],[Q.qualifiedValueShape,Kl],[Q.languageIn,Yl],[Q.maxLength,Zl],[Q.minLength,$l],[Q.pattern,tu],[Q.uniqueLang,ru],[Q.class,wd],[Q.datatype,Ed],[Q.nodeKind,Od]]),jd=class{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Lc(Ad),this.targetResolverRegistry=new $c(this.options.targetResolvers||[]),this.shapesPtr=new cc({dataset:e,factory:t}),this.shapes=new Ls,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(let[e,t]of this.options.validations)this.registry.validations.set(e,t);let r=[...this.shapesPtr.hasOut([Q.targetClass]),...this.shapesPtr.hasOut([Q.targetNode]),...this.shapesPtr.hasOut([Q.targetObjectsOf]),...this.shapesPtr.hasOut([Q.targetSubjectsOf]),...this.shapesPtr.hasOut([Q.target]),...this.shapesPtr.hasOut([lc.type],[Q.NodeShape]),...this.shapesPtr.hasOut([lc.type],[Q.PropertyShape])];for(let e of r)this.shape(e)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Qc(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){let n=new cc({...e,factory:this.factory}),r=new Pc({factory:this.factory,focusNode:n,options:this.options,validator:this});t=t?t.map(e=>this.shape(this.shapesPtr.node(e.terms))):this.shapes.values();for(let e of t){let t=r.create({shape:e}),i;i=n.isAny()?await e.resolveTargets(t):n;for(let n of i)await e.validate(t.create({focusNode:n}))}return r.report}},Md=class{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace=``,this.valuesGraph=null,this.view=null,this.language=null,this.loading=`Loading…`,this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.hierarchyColors=null,this.submitButton=null,this.generateNodeShapeReference=K.value,this.showNodeIds=null,this.showRootShapeLabel=null,this.dense=`true`,this.useShadowRoot=`true`}},Nd=`#4c93d785, #f85e9a85, #00327385, #87001f85`,Pd=class{constructor(e){this.attributes=new Md,this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new st,this._nodeTemplates={},this._propertyTemplates={},this.validator=new jd(this._store,{details:!0,factory:k}),this.providedConformingResourceIds={},this.providedResources={},this.form=e,this._theme=new Cs,this.languages=[...new Set(navigator.languages.flatMap(e=>e.length>2?[e.toLocaleLowerCase(),e.substring(0,2)]:e)),``]}reset(){this.lists={},this.groups=[],this.renderedNodes.clear(),this.providedConformingResourceIds={},this.providedResources={},this._nodeTemplates={},this._propertyTemplates={}}updateAttributes(e){let t=new Md;if(Object.keys(t).forEach(n=>{let r=e.dataset[n];r!==void 0&&(t[n]=r)}),this.editMode=t.view===null,this.theme.setDense(t.dense===`true`),this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){let e=this.languages.indexOf(t.language);e>-1&&this.languages.splice(e,1),this.languages.unshift(t.language)}if(t.valuesGraph&&(this.valuesGraphId=k.namedNode(t.valuesGraph)),t.hierarchyColors!=null){let e=t.hierarchyColors.length?t.hierarchyColors:Nd,n=`:host { --hierarchy-colors: ${e}; --hierarchy-colors-length: ${e.split(`,`).length} }`;for(let e=8;e>=0;e--){let t=`shacl-property { --hierarchy-level: ${e} }`;for(let n=0;n<e;n++)t=`shacl-property `+t;n=n+`
|
|
422
|
+
`+t}this.hierarchyColorsStyleSheet=new CSSStyleSheet,this.hierarchyColorsStyleSheet.replaceSync(n)}}static dataAttributes(){let e=new Md;return Object.keys(e).map(e=>(e=e.replace(/[A-Z]/g,e=>`-`+e.toLowerCase()),`data-`+e))}buildTemplateKey(e,t){let n=e.value;return t&&(t instanceof gr?n+=`*`+t.id.value:n+=`*`+this.buildTemplateKey(t.id,t.parent)),n}registerNodeTemplate(e){this._nodeTemplates[this.buildTemplateKey(e.id,e.parent)]=e}registerPropertyTemplate(e){this._propertyTemplates[this.buildTemplateKey(e.id,e.parent)]=e}getNodeTemplateIds(){let e=new Set;for(let t of Object.values(this._nodeTemplates))e.add(t.id.value);return e}getNodeTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._nodeTemplates[n];return r||=new _s(e,this,t),r}getPropertyTemplate(e,t){let n=this.buildTemplateKey(e,t),r=this._propertyTemplates[n];return r||=new gr(e,t),r}get nodeTemplates(){return Object.values(this._nodeTemplates)}get theme(){return this._theme}set theme(e){this._theme=e,e.setDense(this.attributes.dense===`true`)}get store(){return this._store}set store(e){this._store=e,this.lists=en(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(e=>{this.groups.push(e.id)},bt,`${W}PropertyGroup`,null),this.validator=new jd(e,{details:!0,factory:k})}},Fd=200,Id=class extends HTMLElement{static get observedAttributes(){return Pd.dataAttributes()}constructor(){super(),this.shape=null,this.styleElement=null,this.form=document.createElement(`form`),this.form.setAttribute(`part`,`form`),this.config=new Pd(this.form),this.form.addEventListener(`change`,e=>{e.stopPropagation(),this.config.editMode&&this.validate(!0).then(e=>{this.dispatchEvent(new CustomEvent(`change`,{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:e.conforms,report:e}}))}).catch(e=>{console.warn(e)})})}connectedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}attributeChangedCallback(){this.config.updateAttributes(this),this.ensureRenderRoot(),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.setAttribute(`loading`,``),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading)),this.initDebounceTimeout=setTimeout(async()=>{try{this.config.reset(),this.config.store=await lr({shapes:this.config.attributes.shapes,shapesUrl:this.config.attributes.shapesUrl,values:this.config.attributes.values,valuesUrl:this.config.attributes.valuesUrl,valuesSubject:this.config.attributes.valuesSubject,loadOwlImports:this.config.attributes.ignoreOwlImports===null,classInstanceProvider:this.config.classInstanceProvider,proxy:this.config.attributes.proxy}),this.config.resourceLinkProvider&&await $o(this.config),this.config.attributes.valuesSubject||(this.config.attributes.valuesSubject=sr(this.config.store)||null),this.form.replaceChildren();let e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(e=>{this.form.classList.remove(e)}),this.form.classList.toggle(`mode-edit`,this.config.editMode),this.form.classList.toggle(`mode-view`,!this.config.editMode),this.config.theme.apply(this.form);let t=[this.config.theme.stylesheet];this.config.hierarchyColorsStyleSheet&&t.push(this.config.hierarchyColorsStyleSheet);for(let e of Nr())e.stylesheet&&t.push(e.stylesheet);this.applyStyles(t);let n=new _s(e,this.config);for(let e of this.config.nodeTemplates)ys(e);if(this.shape=new xs(n,this.config.attributes.valuesSubject?k.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.attributes.showRootShapeLabel!==null&&n.label){let e=document.createElement(`h3`);e.innerText=n.label.value,this.form.prepend(e)}if(this.config.editMode){if(this.config.attributes.submitButton!==null){let e=this.config.theme.createButton(this.config.attributes.submitButton||`Submit`,!0);e.classList.add(`submit-button`);let t=e.getAttribute(`part`);e.setAttribute(`part`,`${t?t+` `:``}submit-button`),e.addEventListener(`click`,e=>{e.preventDefault(),this.form.reportValidity()&&this.validate().then(e=>{if(e?.conforms)this.dispatchEvent(new Event(`submit`,{bubbles:!0,cancelable:!0}));else{let e=this.form.querySelector(`:scope .invalid > .editor`);e?e.focus():this.form.querySelector(`:scope .invalid`)?.scrollIntoView()}})}),this.form.appendChild(e)}(async()=>{await this.shape?.ready,this.config.attributes.valuesSubject&&this.removeFromDataGraph(k.namedNode(this.config.attributes.valuesSubject)),this.validate(!0)})()}}else if(this.config.store.countQuads(null,null,null,vt)>0)throw Error(`shacl root node shape not found`)}catch(e){console.error(e);let t=document.createElement(`div`);t.innerText=String(e),this.form.replaceChildren(t)}this.removeAttribute(`loading`),await this.shape?.ready,this.dispatchEvent(new Event(`ready`))},200)}ensureRenderRoot(){this.config.attributes.useShadowRoot===`false`?(this.shadowRoot?.contains(this.form)&&this.shadowRoot.removeChild(this.form),this.contains(this.form)||this.prepend(this.form)):(this.shadowRoot||this.attachShadow({mode:`open`}),this.shadowRoot.contains(this.form)||this.shadowRoot.prepend(this.form))}applyStyles(e){if(this.config.attributes.useShadowRoot!==`false`&&this.shadowRoot){this.shadowRoot.adoptedStyleSheets=e,this.styleElement&&=(this.styleElement.remove(),null);return}let t=e.map(e=>Array.from(e.cssRules).map(e=>e.cssText).join(`
|
|
423
423
|
`).replace(/:host\b/g,`shacl-form`)).join(`
|
|
424
|
-
`);this.styleElement||(this.styleElement=document.createElement(`style`),this.prepend(this.styleElement)),this.styleElement.textContent=t}serialize(e=`text/turtle`,t=this.toRDF()){return
|
|
424
|
+
`);this.styleElement||(this.styleElement=document.createElement(`style`),this.prepend(this.styleElement)),this.styleElement.textContent=t}serialize(e=`text/turtle`,t=this.toRDF()){return Or(t.getQuads(null,null,null,null),e,or)}toRDF(e=new st){return this.shape?.toRDF(e,void 0,this.config.attributes.generateNodeShapeReference),e}registerPlugin(e){Mr(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}setResourceLinkProvider(e){this.config.resourceLinkProvider=e,this.initialize()}async validate(e=!1){for(let e of this.form.querySelectorAll(`:scope .validation-error`))e.remove();for(let e of this.form.querySelectorAll(`:scope .property-instance`))e.classList.remove(`invalid`),e.querySelector(`:scope > .editor`)?.value?e.classList.add(`valid`):e.classList.remove(`valid`);for(let e of this.form.querySelectorAll(`.add-button-wrapper`))e.classList.remove(`invalid`,`validation-error`);if(!this.shape)return{conforms:!0,results:[]};if(!e){let e=this.form.querySelectorAll(`.add-button-wrapper.required`);for(let t of e)t.classList.add(`invalid`),t.after(this.createValidationErrorDisplay(`Value is required`,`node`));if(e.length>0)return{conforms:!1,results:[]}}let t=this.shape;return new Promise(n=>{this.config.store.deleteGraph(this.config.valuesGraphId||``).on(`end`,async()=>{t.toRDF(this.config.store,void 0,this.config.attributes.generateNodeShapeReference);try{let r=await this.config.validator.validate({dataset:this.config.store,terms:[t.nodeId]},[{terms:[t.template.id]}]);for(let t of r.results)if(t.focusNode?.ptrs?.length)for(let n of t.focusNode.ptrs){let r=n._term;if(t.path?.length){let n=t.path[0].predicates[0],i=this.form.querySelectorAll(`
|
|
425
425
|
:scope shacl-node[data-node-id='${r.id}'] > shacl-property > .property-instance[data-path='${n.id}'] > .editor,
|
|
426
426
|
:scope shacl-node[data-node-id='${r.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${n.id}'] > .editor,
|
|
427
427
|
:scope shacl-node[data-node-id='${r.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${n.id}'] > .editor,
|
|
428
428
|
:scope shacl-node[data-node-id='${r.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${n.id}'] > .editor`);i.length===0&&(i=this.form.querySelectorAll(`
|
|
429
429
|
:scope [data-node-id='${r.id}'] > shacl-property > .property-instance[data-path='${n.id}'],
|
|
430
|
-
:scope [data-node-id='${r.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${n.id}']`));for(let n of i)if(n.classList.contains(`editor`)){if(!e||n.value){let e=n.parentElement;e.classList.add(`invalid`),e.classList.remove(`valid`),e.appendChild(this.createValidationErrorDisplay(t));do e instanceof Ca&&(e.open=!0),e=e.parentElement;while(e)}}else e||(n.classList.add(`invalid`),n.classList.remove(`valid`),n.appendChild(this.createValidationErrorDisplay(t,`node`)))}else e||this.form.querySelector(`:scope [data-node-id='${r.id}']`)?.prepend(this.createValidationErrorDisplay(t,`node`))}n(r)}catch(e){console.error(e),n({conforms:!1,results:[]})}})})}createValidationErrorDisplay(e,t){let n=document.createElement(`span`);n.classList.add(`validation-error`),t&&n.classList.add(t);let r=typeof e==`object`&&e?e:null;return r?r.message?.length?n.title+=Wt(this.config.languages,r.message):r.sourceConstraintComponent?.value&&(n.title=r.sourceConstraintComponent.value):typeof e==`string`&&(n.title=e),n}findRootShaclShapeSubject(){if(this.config.attributes.shapeSubject){let e=k.namedNode(this.config.attributes.shapeSubject);if(this.config.store.getQuads(e,bt,Et,null).length===0){console.warn(`shapes graph does not contain requested node shape ${this.config.attributes.shapeSubject}`);return}else return e}else{if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,yt)>0){let e=k.namedNode(this.config.attributes.valuesSubject),t=tr(this.config.store,this.config.attributes.valuesSubject),n=this.config.store.getQuads(e,bt,null,yt);if(n.length===0&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${bt.id} nor ${K.id} statement`),t)return t;for(let e of n)if(this.config.store.getQuads(e.object,bt,Et,null).length>0)return e.object;let r=this.config.store.getObjects(e,bt,yt);for(let e of r)for(let t of this.config.store.getQuads(null,jt,e,null))return t.subject}let e=this.config.store.getQuads(null,bt,Et,null);if(e.length==0){console.warn(`shapes graph does not contain any node shapes`);return}return e.length>1&&(console.warn(`shapes graph contains`,e.length,`node shapes. choosing first found which is`,e[0].subject.value),console.info(`hint: set the node shape to use with element attribute "data-shape-subject"`)),e[0].subject}}removeFromDataGraph(e){for(let t of this.config.store.getQuads(e,null,null,yt))this.config.store.delete(t),(t.object.termType===`NamedNode`||t.object.termType===`BlankNode`)&&this.removeFromDataGraph(t.object)}};window.customElements.define(`shacl-form`,kd);var Ad=class extends Or{constructor(e,t,n){super(e),this.onChange=t,this.fileType=n}createEditor(e){let t=ur(e)>0,n=e.config.theme.createFileEditor(e.label,null,t,e);return n.addEventListener(`change`,e=>{e.stopPropagation(),this.onChange(e)}),this.fileType&&n.querySelector(`input[type="file"]`)?.setAttribute(`accept`,this.fileType),n}},jd=o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.leaflet={}))})(e,(function(e){var t=`1.9.4`;function n(e){var t,n,r,i;for(n=1,r=arguments.length;n<r;n++)for(t in i=arguments[n],i)e[t]=i[t];return e}var r=Object.create||(function(){function e(){}return function(t){return e.prototype=t,new e}})();function i(e,t){var n=Array.prototype.slice;if(e.bind)return e.bind.apply(e,n.call(arguments,1));var r=n.call(arguments,2);return function(){return e.apply(t,r.length?r.concat(n.call(arguments)):arguments)}}var a=0;function o(e){return`_leaflet_id`in e||(e._leaflet_id=++a),e._leaflet_id}function s(e,t,n){var r,i,a,o=function(){r=!1,i&&=(a.apply(n,i),!1)};return a=function(){r?i=arguments:(e.apply(n,arguments),setTimeout(o,t),r=!0)},a}function c(e,t,n){var r=t[1],i=t[0],a=r-i;return e===r&&n?e:((e-i)%a+a)%a+i}function l(){return!1}function u(e,t){if(t===!1)return e;var n=10**(t===void 0?6:t);return Math.round(e*n)/n}function d(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function f(e){return d(e).split(/\s+/)}function p(e,t){for(var n in Object.prototype.hasOwnProperty.call(e,`options`)||(e.options=e.options?r(e.options):{}),t)e.options[n]=t[n];return e.options}function m(e,t,n){var r=[];for(var i in e)r.push(encodeURIComponent(n?i.toUpperCase():i)+`=`+encodeURIComponent(e[i]));return(!t||t.indexOf(`?`)===-1?`?`:`&`)+r.join(`&`)}var h=/\{ *([\w_ -]+) *\}/g;function g(e,t){return e.replace(h,function(e,n){var r=t[n];if(r===void 0)throw Error(`No value provided for variable `+e);return typeof r==`function`&&(r=r(t)),r})}var _=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`};function v(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}var y=`data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=`;function b(e){return window[`webkit`+e]||window[`moz`+e]||window[`ms`+e]}var x=0;function S(e){var t=+new Date,n=Math.max(0,16-(t-x));return x=t+n,window.setTimeout(e,n)}var C=window.requestAnimationFrame||b(`RequestAnimationFrame`)||S,w=window.cancelAnimationFrame||b(`CancelAnimationFrame`)||b(`CancelRequestAnimationFrame`)||function(e){window.clearTimeout(e)};function T(e,t,n){if(n&&C===S)e.call(t);else return C.call(window,i(e,t))}function E(e){e&&w.call(window,e)}var D={__proto__:null,extend:n,create:r,bind:i,get lastId(){return a},stamp:o,throttle:s,wrapNum:c,falseFn:l,formatNum:u,trim:d,splitWords:f,setOptions:p,getParamString:m,template:g,isArray:_,indexOf:v,emptyImageUrl:y,requestFn:C,cancelFn:w,requestAnimFrame:T,cancelAnimFrame:E};function O(){}O.extend=function(e){var t=function(){p(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=t.__super__=this.prototype,a=r(i);for(var o in a.constructor=t,t.prototype=a,this)Object.prototype.hasOwnProperty.call(this,o)&&o!==`prototype`&&o!==`__super__`&&(t[o]=this[o]);return e.statics&&n(t,e.statics),e.includes&&(k(e.includes),n.apply(null,[a].concat(e.includes))),n(a,e),delete a.statics,delete a.includes,a.options&&(a.options=i.options?r(i.options):{},n(a.options,e.options)),a._initHooks=[],a.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var e=0,t=a._initHooks.length;e<t;e++)a._initHooks[e].call(this)}},t},O.include=function(e){var t=this.prototype.options;return n(this.prototype,e),e.options&&(this.prototype.options=t,this.mergeOptions(e.options)),this},O.mergeOptions=function(e){return n(this.prototype.options,e),this},O.addInitHook=function(e){var t=Array.prototype.slice.call(arguments,1),n=typeof e==`function`?e:function(){this[e].apply(this,t)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};function k(e){if(!(typeof L>`u`||!L||!L.Mixin)){e=_(e)?e:[e];for(var t=0;t<e.length;t++)e[t]===L.Mixin.Events&&console.warn(`Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.`,Error().stack)}}var A={on:function(e,t,n){if(typeof e==`object`)for(var r in e)this._on(r,e[r],t);else{e=f(e);for(var i=0,a=e.length;i<a;i++)this._on(e[i],t,n)}return this},off:function(e,t,n){if(!arguments.length)delete this._events;else if(typeof e==`object`)for(var r in e)this._off(r,e[r],t);else{e=f(e);for(var i=arguments.length===1,a=0,o=e.length;a<o;a++)i?this._off(e[a]):this._off(e[a],t,n)}return this},_on:function(e,t,n,r){if(typeof t!=`function`){console.warn(`wrong listener type: `+typeof t);return}if(this._listens(e,t,n)===!1){n===this&&(n=void 0);var i={fn:t,ctx:n};r&&(i.once=!0),this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(i)}},_off:function(e,t,n){var r,i,a;if(this._events&&(r=this._events[e],r)){if(arguments.length===1){if(this._firingCount)for(i=0,a=r.length;i<a;i++)r[i].fn=l;delete this._events[e];return}if(typeof t!=`function`){console.warn(`wrong listener type: `+typeof t);return}var o=this._listens(e,t,n);if(o!==!1){var s=r[o];this._firingCount&&(s.fn=l,this._events[e]=r=r.slice()),r.splice(o,1)}}},fire:function(e,t,r){if(!this.listens(e,r))return this;var i=n({},t,{type:e,target:this,sourceTarget:t&&t.sourceTarget||this});if(this._events){var a=this._events[e];if(a){this._firingCount=this._firingCount+1||1;for(var o=0,s=a.length;o<s;o++){var c=a[o],l=c.fn;c.once&&this.off(e,l,c.ctx),l.call(c.ctx||this,i)}this._firingCount--}}return r&&this._propagateEvent(i),this},listens:function(e,t,n,r){typeof e!=`string`&&console.warn(`"string" type argument expected`);var i=t;typeof t!=`function`&&(r=!!t,i=void 0,n=void 0);var a=this._events&&this._events[e];if(a&&a.length&&this._listens(e,i,n)!==!1)return!0;if(r){for(var o in this._eventParents)if(this._eventParents[o].listens(e,t,n,r))return!0}return!1},_listens:function(e,t,n){if(!this._events)return!1;var r=this._events[e]||[];if(!t)return!!r.length;n===this&&(n=void 0);for(var i=0,a=r.length;i<a;i++)if(r[i].fn===t&&r[i].ctx===n)return i;return!1},once:function(e,t,n){if(typeof e==`object`)for(var r in e)this._on(r,e[r],t,!0);else{e=f(e);for(var i=0,a=e.length;i<a;i++)this._on(e[i],t,n,!0)}return this},addEventParent:function(e){return this._eventParents=this._eventParents||{},this._eventParents[o(e)]=e,this},removeEventParent:function(e){return this._eventParents&&delete this._eventParents[o(e)],this},_propagateEvent:function(e){for(var t in this._eventParents)this._eventParents[t].fire(e.type,n({layer:e.target,propagatedFrom:e.target},e),!0)}};A.addEventListener=A.on,A.removeEventListener=A.clearAllEventListeners=A.off,A.addOneTimeEventListener=A.once,A.fireEvent=A.fire,A.hasEventListeners=A.listens;var j=O.extend(A);function M(e,t,n){this.x=n?Math.round(e):e,this.y=n?Math.round(t):t}var N=Math.trunc||function(e){return e>0?Math.floor(e):Math.ceil(e)};M.prototype={clone:function(){return new M(this.x,this.y)},add:function(e){return this.clone()._add(P(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(P(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new M(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new M(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=N(this.x),this.y=N(this.y),this},distanceTo:function(e){e=P(e);var t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)},equals:function(e){return e=P(e),e.x===this.x&&e.y===this.y},contains:function(e){return e=P(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return`Point(`+u(this.x)+`, `+u(this.y)+`)`}};function P(e,t,n){return e instanceof M?e:_(e)?new M(e[0],e[1]):e==null?e:typeof e==`object`&&`x`in e&&`y`in e?new M(e.x,e.y):new M(e,t,n)}function F(e,t){if(e)for(var n=t?[e,t]:e,r=0,i=n.length;r<i;r++)this.extend(n[r])}F.prototype={extend:function(e){var t,n;if(!e)return this;if(e instanceof M||typeof e[0]==`number`||`x`in e)t=n=P(e);else if(e=I(e),t=e.min,n=e.max,!t||!n)return this;return!this.min&&!this.max?(this.min=t.clone(),this.max=n.clone()):(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(n.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(n.y,this.max.y)),this},getCenter:function(e){return P((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,e)},getBottomLeft:function(){return P(this.min.x,this.max.y)},getTopRight:function(){return P(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(e){var t,n;return e=typeof e[0]==`number`||e instanceof M?P(e):I(e),e instanceof F?(t=e.min,n=e.max):t=n=e,t.x>=this.min.x&&n.x<=this.max.x&&t.y>=this.min.y&&n.y<=this.max.y},intersects:function(e){e=I(e);var t=this.min,n=this.max,r=e.min,i=e.max,a=i.x>=t.x&&r.x<=n.x,o=i.y>=t.y&&r.y<=n.y;return a&&o},overlaps:function(e){e=I(e);var t=this.min,n=this.max,r=e.min,i=e.max,a=i.x>t.x&&r.x<n.x,o=i.y>t.y&&r.y<n.y;return a&&o},isValid:function(){return!!(this.min&&this.max)},pad:function(e){var t=this.min,n=this.max,r=Math.abs(t.x-n.x)*e,i=Math.abs(t.y-n.y)*e;return I(P(t.x-r,t.y-i),P(n.x+r,n.y+i))},equals:function(e){return e?(e=I(e),this.min.equals(e.getTopLeft())&&this.max.equals(e.getBottomRight())):!1}};function I(e,t){return!e||e instanceof F?e:new F(e,t)}function R(e,t){if(e)for(var n=t?[e,t]:e,r=0,i=n.length;r<i;r++)this.extend(n[r])}R.prototype={extend:function(e){var t=this._southWest,n=this._northEast,r,i;if(e instanceof B)r=e,i=e;else if(e instanceof R){if(r=e._southWest,i=e._northEast,!r||!i)return this}else return e?this.extend(V(e)||z(e)):this;return!t&&!n?(this._southWest=new B(r.lat,r.lng),this._northEast=new B(i.lat,i.lng)):(t.lat=Math.min(r.lat,t.lat),t.lng=Math.min(r.lng,t.lng),n.lat=Math.max(i.lat,n.lat),n.lng=Math.max(i.lng,n.lng)),this},pad:function(e){var t=this._southWest,n=this._northEast,r=Math.abs(t.lat-n.lat)*e,i=Math.abs(t.lng-n.lng)*e;return new R(new B(t.lat-r,t.lng-i),new B(n.lat+r,n.lng+i))},getCenter:function(){return new B((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new B(this.getNorth(),this.getWest())},getSouthEast:function(){return new B(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(e){e=typeof e[0]==`number`||e instanceof B||`lat`in e?V(e):z(e);var t=this._southWest,n=this._northEast,r,i;return e instanceof R?(r=e.getSouthWest(),i=e.getNorthEast()):r=i=e,r.lat>=t.lat&&i.lat<=n.lat&&r.lng>=t.lng&&i.lng<=n.lng},intersects:function(e){e=z(e);var t=this._southWest,n=this._northEast,r=e.getSouthWest(),i=e.getNorthEast(),a=i.lat>=t.lat&&r.lat<=n.lat,o=i.lng>=t.lng&&r.lng<=n.lng;return a&&o},overlaps:function(e){e=z(e);var t=this._southWest,n=this._northEast,r=e.getSouthWest(),i=e.getNorthEast(),a=i.lat>t.lat&&r.lat<n.lat,o=i.lng>t.lng&&r.lng<n.lng;return a&&o},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(`,`)},equals:function(e,t){return e?(e=z(e),this._southWest.equals(e.getSouthWest(),t)&&this._northEast.equals(e.getNorthEast(),t)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function z(e,t){return e instanceof R?e:new R(e,t)}function B(e,t,n){if(isNaN(e)||isNaN(t))throw Error(`Invalid LatLng object: (`+e+`, `+t+`)`);this.lat=+e,this.lng=+t,n!==void 0&&(this.alt=+n)}B.prototype={equals:function(e,t){return e?(e=V(e),Math.max(Math.abs(this.lat-e.lat),Math.abs(this.lng-e.lng))<=(t===void 0?1e-9:t)):!1},toString:function(e){return`LatLng(`+u(this.lat,e)+`, `+u(this.lng,e)+`)`},distanceTo:function(e){return te.distance(this,V(e))},wrap:function(){return te.wrapLatLng(this)},toBounds:function(e){var t=180*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return z([this.lat-t,this.lng-n],[this.lat+t,this.lng+n])},clone:function(){return new B(this.lat,this.lng,this.alt)}};function V(e,t,n){return e instanceof B?e:_(e)&&typeof e[0]!=`object`?e.length===3?new B(e[0],e[1],e[2]):e.length===2?new B(e[0],e[1]):null:e==null?e:typeof e==`object`&&`lat`in e?new B(e.lat,`lng`in e?e.lng:e.lon,e.alt):t===void 0?null:new B(e,t,n)}var ee={latLngToPoint:function(e,t){var n=this.projection.project(e),r=this.scale(t);return this.transformation._transform(n,r)},pointToLatLng:function(e,t){var n=this.scale(t),r=this.transformation.untransform(e,n);return this.projection.unproject(r)},project:function(e){return this.projection.project(e)},unproject:function(e){return this.projection.unproject(e)},scale:function(e){return 256*2**e},zoom:function(e){return Math.log(e/256)/Math.LN2},getProjectedBounds:function(e){if(this.infinite)return null;var t=this.projection.bounds,n=this.scale(e);return new F(this.transformation.transform(t.min,n),this.transformation.transform(t.max,n))},infinite:!1,wrapLatLng:function(e){var t=this.wrapLng?c(e.lng,this.wrapLng,!0):e.lng,n=this.wrapLat?c(e.lat,this.wrapLat,!0):e.lat,r=e.alt;return new B(n,t,r)},wrapLatLngBounds:function(e){var t=e.getCenter(),n=this.wrapLatLng(t),r=t.lat-n.lat,i=t.lng-n.lng;if(r===0&&i===0)return e;var a=e.getSouthWest(),o=e.getNorthEast();return new R(new B(a.lat-r,a.lng-i),new B(o.lat-r,o.lng-i))}},te=n({},ee,{wrapLng:[-180,180],R:6371e3,distance:function(e,t){var n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=Math.sin((t.lat-e.lat)*n/2),o=Math.sin((t.lng-e.lng)*n/2),s=a*a+Math.cos(r)*Math.cos(i)*o*o,c=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return this.R*c}}),ne=6378137,re={R:ne,MAX_LATITUDE:85.0511287798,project:function(e){var t=Math.PI/180,n=this.MAX_LATITUDE,r=Math.max(Math.min(n,e.lat),-n),i=Math.sin(r*t);return new M(this.R*e.lng*t,this.R*Math.log((1+i)/(1-i))/2)},unproject:function(e){var t=180/Math.PI;return new B((2*Math.atan(Math.exp(e.y/this.R))-Math.PI/2)*t,e.x*t/this.R)},bounds:(function(){var e=ne*Math.PI;return new F([-e,-e],[e,e])})()};function ie(e,t,n,r){if(_(e)){this._a=e[0],this._b=e[1],this._c=e[2],this._d=e[3];return}this._a=e,this._b=t,this._c=n,this._d=r}ie.prototype={transform:function(e,t){return this._transform(e.clone(),t)},_transform:function(e,t){return t||=1,e.x=t*(this._a*e.x+this._b),e.y=t*(this._c*e.y+this._d),e},untransform:function(e,t){return t||=1,new M((e.x/t-this._b)/this._a,(e.y/t-this._d)/this._c)}};function ae(e,t,n,r){return new ie(e,t,n,r)}var oe=n({},te,{code:`EPSG:3857`,projection:re,transformation:function(){var e=.5/(Math.PI*re.R);return ae(e,.5,-e,.5)}()}),se=n({},oe,{code:`EPSG:900913`});function ce(e){return document.createElementNS(`http://www.w3.org/2000/svg`,e)}function le(e,t){var n=``,r,i,a,o,s,c;for(r=0,a=e.length;r<a;r++){for(s=e[r],i=0,o=s.length;i<o;i++)c=s[i],n+=(i?`L`:`M`)+c.x+` `+c.y;n+=t?U.svg?`z`:`x`:``}return n||`M0 0`}var ue=document.documentElement.style,de=`ActiveXObject`in window,fe=de&&!document.addEventListener,pe=`msLaunchUri`in navigator&&!(`documentMode`in document),me=Ke(`webkit`),he=Ke(`android`),ge=Ke(`android 2`)||Ke(`android 3`),_e=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ve=he&&Ke(`Google`)&&_e<537&&!(`AudioNode`in window),ye=!!window.opera,H=!pe&&Ke(`chrome`),be=Ke(`gecko`)&&!me&&!ye&&!de,xe=!H&&Ke(`safari`),Se=Ke(`phantom`),Ce=`OTransition`in ue,we=navigator.platform.indexOf(`Win`)===0,Te=de&&`transition`in ue,Ee=`WebKitCSSMatrix`in window&&`m11`in new window.WebKitCSSMatrix&&!ge,De=`MozPerspective`in ue,Oe=!window.L_DISABLE_3D&&(Te||Ee||De)&&!Ce&&!Se,ke=typeof orientation<`u`||Ke(`mobile`),Ae=ke&&me,je=ke&&Ee,Me=!window.PointerEvent&&window.MSPointerEvent,Ne=!!(window.PointerEvent||Me),Pe=`ontouchstart`in window||!!window.TouchEvent,Fe=!window.L_NO_TOUCH&&(Pe||Ne),Ie=ke&&ye,Le=ke&&be,Re=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ze=function(){var e=!1;try{var t=Object.defineProperty({},`passive`,{get:function(){e=!0}});window.addEventListener(`testPassiveEventSupport`,l,t),window.removeEventListener(`testPassiveEventSupport`,l,t)}catch{}return e}(),Be=function(){return!!document.createElement(`canvas`).getContext}(),Ve=!!(document.createElementNS&&ce(`svg`).createSVGRect),He=!!Ve&&(function(){var e=document.createElement(`div`);return e.innerHTML=`<svg/>`,(e.firstChild&&e.firstChild.namespaceURI)===`http://www.w3.org/2000/svg`})(),Ue=!Ve&&function(){try{var e=document.createElement(`div`);e.innerHTML=`<v:shape adj="1"/>`;var t=e.firstChild;return t.style.behavior=`url(#default#VML)`,t&&typeof t.adj==`object`}catch{return!1}}(),We=navigator.platform.indexOf(`Mac`)===0,Ge=navigator.platform.indexOf(`Linux`)===0;function Ke(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var U={ie:de,ielt9:fe,edge:pe,webkit:me,android:he,android23:ge,androidStock:ve,opera:ye,chrome:H,gecko:be,safari:xe,phantom:Se,opera12:Ce,win:we,ie3d:Te,webkit3d:Ee,gecko3d:De,any3d:Oe,mobile:ke,mobileWebkit:Ae,mobileWebkit3d:je,msPointer:Me,pointer:Ne,touch:Fe,touchNative:Pe,mobileOpera:Ie,mobileGecko:Le,retina:Re,passiveEvents:ze,canvas:Be,svg:Ve,vml:Ue,inlineSvg:He,mac:We,linux:Ge},qe=U.msPointer?`MSPointerDown`:`pointerdown`,Je=U.msPointer?`MSPointerMove`:`pointermove`,Ye=U.msPointer?`MSPointerUp`:`pointerup`,Xe=U.msPointer?`MSPointerCancel`:`pointercancel`,Ze={touchstart:qe,touchmove:Je,touchend:Ye,touchcancel:Xe},Qe={touchstart:ct,touchmove:st,touchend:st,touchcancel:st},$e={},et=!1;function tt(e,t,n){return t===`touchstart`&&ot(),Qe[t]?(n=Qe[t].bind(this,n),e.addEventListener(Ze[t],n,!1),n):(console.warn(`wrong event specified:`,t),l)}function nt(e,t,n){if(!Ze[t]){console.warn(`wrong event specified:`,t);return}e.removeEventListener(Ze[t],n,!1)}function rt(e){$e[e.pointerId]=e}function it(e){$e[e.pointerId]&&($e[e.pointerId]=e)}function at(e){delete $e[e.pointerId]}function ot(){et||=(document.addEventListener(qe,rt,!0),document.addEventListener(Je,it,!0),document.addEventListener(Ye,at,!0),document.addEventListener(Xe,at,!0),!0)}function st(e,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||`mouse`)){for(var n in t.touches=[],$e)t.touches.push($e[n]);t.changedTouches=[t],e(t)}}function ct(e,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&$t(t),st(e,t)}function lt(e){var t={},n,r;for(r in e)n=e[r],t[r]=n&&n.bind?n.bind(e):n;return e=t,t.type=`dblclick`,t.detail=2,t.isTrusted=!1,t._simulated=!0,t}var ut=200;function W(e,t){e.addEventListener(`dblclick`,t);var n=0,r;function i(e){if(e.detail!==1){r=e.detail;return}if(!(e.pointerType===`mouse`||e.sourceCapabilities&&!e.sourceCapabilities.firesTouchEvents)){var i=tn(e);if(!(i.some(function(e){return e instanceof HTMLLabelElement&&e.attributes.for})&&!i.some(function(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement}))){var a=Date.now();a-n<=ut?(r++,r===2&&t(lt(e))):r=1,n=a}}}return e.addEventListener(`click`,i),{dblclick:t,simDblclick:i}}function dt(e,t){e.removeEventListener(`dblclick`,t.dblclick),e.removeEventListener(`click`,t.simDblclick)}var ft=Dt([`transform`,`webkitTransform`,`OTransform`,`MozTransform`,`msTransform`]),pt=Dt([`webkitTransition`,`transition`,`OTransition`,`MozTransition`,`msTransition`]),mt=pt===`webkitTransition`||pt===`OTransition`?pt+`End`:`transitionend`;function ht(e){return typeof e==`string`?document.getElementById(e):e}function gt(e,t){var n=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!n||n===`auto`)&&document.defaultView){var r=document.defaultView.getComputedStyle(e,null);n=r?r[t]:null}return n===`auto`?null:n}function G(e,t,n){var r=document.createElement(e);return r.className=t||``,n&&n.appendChild(r),r}function _t(e){var t=e.parentNode;t&&t.removeChild(e)}function vt(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function yt(e){var t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)}function bt(e){var t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)}function xt(e,t){if(e.classList!==void 0)return e.classList.contains(t);var n=wt(e);return n.length>0&&RegExp(`(^|\\s)`+t+`(\\s|$)`).test(n)}function K(e,t){if(e.classList!==void 0)for(var n=f(t),r=0,i=n.length;r<i;r++)e.classList.add(n[r]);else if(!xt(e,t)){var a=wt(e);Ct(e,(a?a+` `:``)+t)}}function St(e,t){e.classList===void 0?Ct(e,d((` `+wt(e)+` `).replace(` `+t+` `,` `))):e.classList.remove(t)}function Ct(e,t){e.className.baseVal===void 0?e.className=t:e.className.baseVal=t}function wt(e){return e.correspondingElement&&(e=e.correspondingElement),e.className.baseVal===void 0?e.className:e.className.baseVal}function Tt(e,t){`opacity`in e.style?e.style.opacity=t:`filter`in e.style&&Et(e,t)}function Et(e,t){var n=!1,r=`DXImageTransform.Microsoft.Alpha`;try{n=e.filters.item(r)}catch{if(t===1)return}t=Math.round(t*100),n?(n.Enabled=t!==100,n.Opacity=t):e.style.filter+=` progid:`+r+`(opacity=`+t+`)`}function Dt(e){for(var t=document.documentElement.style,n=0;n<e.length;n++)if(e[n]in t)return e[n];return!1}function Ot(e,t,n){var r=t||new M(0,0);e.style[ft]=(U.ie3d?`translate(`+r.x+`px,`+r.y+`px)`:`translate3d(`+r.x+`px,`+r.y+`px,0)`)+(n?` scale(`+n+`)`:``)}function kt(e,t){e._leaflet_pos=t,U.any3d?Ot(e,t):(e.style.left=t.x+`px`,e.style.top=t.y+`px`)}function At(e){return e._leaflet_pos||new M(0,0)}var jt,Mt,Nt;if(`onselectstart`in document)jt=function(){q(window,`selectstart`,$t)},Mt=function(){Gt(window,`selectstart`,$t)};else{var Pt=Dt([`userSelect`,`WebkitUserSelect`,`OUserSelect`,`MozUserSelect`,`msUserSelect`]);jt=function(){if(Pt){var e=document.documentElement.style;Nt=e[Pt],e[Pt]=`none`}},Mt=function(){Pt&&(document.documentElement.style[Pt]=Nt,Nt=void 0)}}function Ft(){q(window,`dragstart`,$t)}function It(){Gt(window,`dragstart`,$t)}var Lt,Rt;function zt(e){for(;e.tabIndex===-1;)e=e.parentNode;e.style&&(Bt(),Lt=e,Rt=e.style.outlineStyle,e.style.outlineStyle=`none`,q(window,`keydown`,Bt))}function Bt(){Lt&&(Lt.style.outlineStyle=Rt,Lt=void 0,Rt=void 0,Gt(window,`keydown`,Bt))}function Vt(e){do e=e.parentNode;while((!e.offsetWidth||!e.offsetHeight)&&e!==document.body);return e}function Ht(e){var t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}var Ut={__proto__:null,TRANSFORM:ft,TRANSITION:pt,TRANSITION_END:mt,get:ht,getStyle:gt,create:G,remove:_t,empty:vt,toFront:yt,toBack:bt,hasClass:xt,addClass:K,removeClass:St,setClass:Ct,getClass:wt,setOpacity:Tt,testProp:Dt,setTransform:Ot,setPosition:kt,getPosition:At,get disableTextSelection(){return jt},get enableTextSelection(){return Mt},disableImageDrag:Ft,enableImageDrag:It,preventOutline:zt,restoreOutline:Bt,getSizedParentNode:Vt,getScale:Ht};function q(e,t,n,r){if(t&&typeof t==`object`)for(var i in t)Jt(e,i,t[i],n);else{t=f(t);for(var a=0,o=t.length;a<o;a++)Jt(e,t[a],n,r)}return this}var Wt=`_leaflet_events`;function Gt(e,t,n,r){if(arguments.length===1)Kt(e),delete e[Wt];else if(t&&typeof t==`object`)for(var i in t)Yt(e,i,t[i],n);else if(t=f(t),arguments.length===2)Kt(e,function(e){return v(t,e)!==-1});else for(var a=0,o=t.length;a<o;a++)Yt(e,t[a],n,r);return this}function Kt(e,t){for(var n in e[Wt]){var r=n.split(/\d/)[0];(!t||t(r))&&Yt(e,r,null,null,n)}}var qt={mouseenter:`mouseover`,mouseleave:`mouseout`,wheel:!(`onwheel`in window)&&`mousewheel`};function Jt(e,t,n,r){var i=t+o(n)+(r?`_`+o(r):``);if(e[Wt]&&e[Wt][i])return this;var a=function(t){return n.call(r||e,t||window.event)},s=a;!U.touchNative&&U.pointer&&t.indexOf(`touch`)===0?a=tt(e,t,a):U.touch&&t===`dblclick`?a=W(e,a):`addEventListener`in e?t===`touchstart`||t===`touchmove`||t===`wheel`||t===`mousewheel`?e.addEventListener(qt[t]||t,a,U.passiveEvents?{passive:!1}:!1):t===`mouseenter`||t===`mouseleave`?(a=function(t){t||=window.event,on(e,t)&&s(t)},e.addEventListener(qt[t],a,!1)):e.addEventListener(t,s,!1):e.attachEvent(`on`+t,a),e[Wt]=e[Wt]||{},e[Wt][i]=a}function Yt(e,t,n,r,i){i||=t+o(n)+(r?`_`+o(r):``);var a=e[Wt]&&e[Wt][i];if(!a)return this;!U.touchNative&&U.pointer&&t.indexOf(`touch`)===0?nt(e,t,a):U.touch&&t===`dblclick`?dt(e,a):`removeEventListener`in e?e.removeEventListener(qt[t]||t,a,!1):e.detachEvent(`on`+t,a),e[Wt][i]=null}function Xt(e){return e.stopPropagation?e.stopPropagation():e.originalEvent?e.originalEvent._stopped=!0:e.cancelBubble=!0,this}function Zt(e){return Jt(e,`wheel`,Xt),this}function Qt(e){return q(e,`mousedown touchstart dblclick contextmenu`,Xt),e._leaflet_disable_click=!0,this}function $t(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this}function en(e){return $t(e),Xt(e),this}function tn(e){if(e.composedPath)return e.composedPath();for(var t=[],n=e.target;n;)t.push(n),n=n.parentNode;return t}function nn(e,t){if(!t)return new M(e.clientX,e.clientY);var n=Ht(t),r=n.boundingClientRect;return new M((e.clientX-r.left)/n.x-t.clientLeft,(e.clientY-r.top)/n.y-t.clientTop)}var rn=U.linux&&U.chrome?window.devicePixelRatio:U.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function an(e){return U.edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/rn:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}function on(e,t){var n=t.relatedTarget;if(!n)return!0;try{for(;n&&n!==e;)n=n.parentNode}catch{return!1}return n!==e}var sn={__proto__:null,on:q,off:Gt,stopPropagation:Xt,disableScrollPropagation:Zt,disableClickPropagation:Qt,preventDefault:$t,stop:en,getPropagationPath:tn,getMousePosition:nn,getWheelDelta:an,isExternalTarget:on,addListener:q,removeListener:Gt},cn=j.extend({run:function(e,t,n,r){this.stop(),this._el=e,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(r||.5,.2),this._startPos=At(e),this._offset=t.subtract(this._startPos),this._startTime=+new Date,this.fire(`start`),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=T(this._animate,this),this._step()},_step:function(e){var t=+new Date-this._startTime,n=this._duration*1e3;t<n?this._runFrame(this._easeOut(t/n),e):(this._runFrame(1),this._complete())},_runFrame:function(e,t){var n=this._startPos.add(this._offset.multiplyBy(e));t&&n._round(),kt(this._el,n),this.fire(`step`)},_complete:function(){E(this._animId),this._inProgress=!1,this.fire(`end`)},_easeOut:function(e){return 1-(1-e)**this._easeOutPower}}),J=j.extend({options:{crs:oe,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(e,t){t=p(this,t),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(e),this._initLayout(),this._onResize=i(this._onResize,this),this._initEvents(),t.maxBounds&&this.setMaxBounds(t.maxBounds),t.zoom!==void 0&&(this._zoom=this._limitZoom(t.zoom)),t.center&&t.zoom!==void 0&&this.setView(V(t.center),t.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=pt&&U.any3d&&!U.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),q(this._proxy,mt,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(e,t,r){return t=t===void 0?this._zoom:this._limitZoom(t),e=this._limitCenter(V(e),t,this.options.maxBounds),r||={},this._stop(),this._loaded&&!r.reset&&r!==!0&&(r.animate!==void 0&&(r.zoom=n({animate:r.animate},r.zoom),r.pan=n({animate:r.animate,duration:r.duration},r.pan)),this._zoom===t?this._tryAnimatedPan(e,r.pan):this._tryAnimatedZoom&&this._tryAnimatedZoom(e,t,r.zoom))?(clearTimeout(this._sizeTimer),this):(this._resetView(e,t,r.pan&&r.pan.noMoveStart),this)},setZoom:function(e,t){return this._loaded?this.setView(this.getCenter(),e,{zoom:t}):(this._zoom=e,this)},zoomIn:function(e,t){return e||=U.any3d?this.options.zoomDelta:1,this.setZoom(this._zoom+e,t)},zoomOut:function(e,t){return e||=U.any3d?this.options.zoomDelta:1,this.setZoom(this._zoom-e,t)},setZoomAround:function(e,t,n){var r=this.getZoomScale(t),i=this.getSize().divideBy(2),a=(e instanceof M?e:this.latLngToContainerPoint(e)).subtract(i).multiplyBy(1-1/r),o=this.containerPointToLatLng(i.add(a));return this.setView(o,t,{zoom:n})},_getBoundsCenterZoom:function(e,t){t||={},e=e.getBounds?e.getBounds():z(e);var n=P(t.paddingTopLeft||t.padding||[0,0]),r=P(t.paddingBottomRight||t.padding||[0,0]),i=this.getBoundsZoom(e,!1,n.add(r));if(i=typeof t.maxZoom==`number`?Math.min(t.maxZoom,i):i,i===1/0)return{center:e.getCenter(),zoom:i};var a=r.subtract(n).divideBy(2),o=this.project(e.getSouthWest(),i),s=this.project(e.getNorthEast(),i);return{center:this.unproject(o.add(s).divideBy(2).add(a),i),zoom:i}},fitBounds:function(e,t){if(e=z(e),!e.isValid())throw Error(`Bounds are not valid.`);var n=this._getBoundsCenterZoom(e,t);return this.setView(n.center,n.zoom,t)},fitWorld:function(e){return this.fitBounds([[-90,-180],[90,180]],e)},panTo:function(e,t){return this.setView(e,this._zoom,{pan:t})},panBy:function(e,t){if(e=P(e).round(),t||={},!e.x&&!e.y)return this.fire(`moveend`);if(t.animate!==!0&&!this.getSize().contains(e))return this._resetView(this.unproject(this.project(this.getCenter()).add(e)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new cn,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),t.noMoveStart||this.fire(`movestart`),t.animate!==!1){K(this._mapPane,`leaflet-pan-anim`);var n=this._getMapPanePos().subtract(e).round();this._panAnim.run(this._mapPane,n,t.duration||.25,t.easeLinearity)}else this._rawPanBy(e),this.fire(`move`).fire(`moveend`);return this},flyTo:function(e,t,n){if(n||={},n.animate===!1||!U.any3d)return this.setView(e,t,n);this._stop();var r=this.project(this.getCenter()),i=this.project(e),a=this.getSize(),o=this._zoom;e=V(e),t=t===void 0?o:t;var s=Math.max(a.x,a.y),c=s*this.getZoomScale(o,t),l=i.distanceTo(r)||1,u=1.42,d=u*u;function f(e){var t=e?-1:1,n=e?c:s,r=(c*c-s*s+t*d*d*l*l)/(2*n*d*l),i=Math.sqrt(r*r+1)-r;return i<1e-9?-18:Math.log(i)}function p(e){return(Math.exp(e)-Math.exp(-e))/2}function m(e){return(Math.exp(e)+Math.exp(-e))/2}function h(e){return p(e)/m(e)}var g=f(0);function _(e){return s*(m(g)/m(g+u*e))}function v(e){return s*(m(g)*h(g+u*e)-p(g))/d}function y(e){return 1-(1-e)**1.5}var b=Date.now(),x=(f(1)-g)/u,S=n.duration?1e3*n.duration:1e3*x*.8;function C(){var n=(Date.now()-b)/S,a=y(n)*x;n<=1?(this._flyToFrame=T(C,this),this._move(this.unproject(r.add(i.subtract(r).multiplyBy(v(a)/l)),o),this.getScaleZoom(s/_(a),o),{flyTo:!0})):this._move(e,t)._moveEnd(!0)}return this._moveStart(!0,n.noMoveStart),C.call(this),this},flyToBounds:function(e,t){var n=this._getBoundsCenterZoom(e,t);return this.flyTo(n.center,n.zoom,t)},setMaxBounds:function(e){return e=z(e),this.listens(`moveend`,this._panInsideMaxBounds)&&this.off(`moveend`,this._panInsideMaxBounds),e.isValid()?(this.options.maxBounds=e,this._loaded&&this._panInsideMaxBounds(),this.on(`moveend`,this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(e){var t=this.options.minZoom;return this.options.minZoom=e,this._loaded&&t!==e&&(this.fire(`zoomlevelschange`),this.getZoom()<this.options.minZoom)?this.setZoom(e):this},setMaxZoom:function(e){var t=this.options.maxZoom;return this.options.maxZoom=e,this._loaded&&t!==e&&(this.fire(`zoomlevelschange`),this.getZoom()>this.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,t){this._enforcingBounds=!0;var n=this.getCenter(),r=this._limitCenter(n,this._zoom,z(e));return n.equals(r)||this.panTo(r,t),this._enforcingBounds=!1,this},panInside:function(e,t){t||={};var n=P(t.paddingTopLeft||t.padding||[0,0]),r=P(t.paddingBottomRight||t.padding||[0,0]),i=this.project(this.getCenter()),a=this.project(e),o=this.getPixelBounds(),s=I([o.min.add(n),o.max.subtract(r)]),c=s.getSize();if(!s.contains(a)){this._enforcingBounds=!0;var l=a.subtract(s.getCenter()),u=s.extend(a).getSize().subtract(c);i.x+=l.x<0?-u.x:u.x,i.y+=l.y<0?-u.y:u.y,this.panTo(this.unproject(i),t),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=n({animate:!1,pan:!0},e===!0?{animate:!0}:e);var t=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var r=this.getSize(),a=t.divideBy(2).round(),o=r.divideBy(2).round(),s=a.subtract(o);return!s.x&&!s.y?this:(e.animate&&e.pan?this.panBy(s):(e.pan&&this._rawPanBy(s),this.fire(`move`),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(i(this.fire,this,`moveend`),200)):this.fire(`moveend`)),this.fire(`resize`,{oldSize:t,newSize:r}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire(`viewreset`),this._stop()},locate:function(e){if(e=this._locateOptions=n({timeout:1e4,watch:!1},e),!(`geolocation`in navigator))return this._handleGeolocationError({code:0,message:`Geolocation not supported.`}),this;var t=i(this._handleGeolocationResponse,this),r=i(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,r,e):navigator.geolocation.getCurrentPosition(t,r,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var t=e.code,n=e.message||(t===1?`permission denied`:t===2?`position unavailable`:`timeout`);this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire(`locationerror`,{code:t,message:`Geolocation error: `+n+`.`})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var t=e.coords.latitude,n=e.coords.longitude,r=new B(t,n),i=r.toBounds(e.coords.accuracy*2),a=this._locateOptions;if(a.setView){var o=this.getBoundsZoom(i);this.setView(r,a.maxZoom?Math.min(o,a.maxZoom):o)}var s={latlng:r,bounds:i,timestamp:e.timestamp};for(var c in e.coords)typeof e.coords[c]==`number`&&(s[c]=e.coords[c]);this.fire(`locationfound`,s)}},addHandler:function(e,t){if(!t)return this;var n=this[e]=new t(this);return this._handlers.push(n),this.options[e]&&n.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off(`moveend`,this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw Error(`Map container is being reused by another instance`);try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}for(var e in this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),_t(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&=(E(this._resizeRequest),null),this._clearHandlers(),this._loaded&&this.fire(`unload`),this._layers)this._layers[e].remove();for(e in this._panes)_t(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,t){var n=G(`div`,`leaflet-pane`+(e?` leaflet-`+e.replace(`Pane`,``)+`-pane`:``),t||this._mapPane);return e&&(this._panes[e]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds();return new R(this.unproject(e.getBottomLeft()),this.unproject(e.getTopRight()))},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,n){e=z(e),n=P(n||[0,0]);var r=this.getZoom()||0,i=this.getMinZoom(),a=this.getMaxZoom(),o=e.getNorthWest(),s=e.getSouthEast(),c=this.getSize().subtract(n),l=I(this.project(s,r),this.project(o,r)).getSize(),u=U.any3d?this.options.zoomSnap:1,d=c.x/l.x,f=c.y/l.y,p=t?Math.max(d,f):Math.min(d,f);return r=this.getScaleZoom(p,r),u&&(r=Math.round(r/(u/100))*(u/100),r=t?Math.ceil(r/u)*u:Math.floor(r/u)*u),Math.max(i,Math.min(a,r))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new M(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,t){var n=this._getTopLeftPoint(e,t);return new F(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(e===void 0?this.getZoom():e)},getPane:function(e){return typeof e==`string`?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,t){var n=this.options.crs;return t=t===void 0?this._zoom:t,n.scale(e)/n.scale(t)},getScaleZoom:function(e,t){var n=this.options.crs;t=t===void 0?this._zoom:t;var r=n.zoom(e*n.scale(t));return isNaN(r)?1/0:r},project:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.latLngToPoint(V(e),t)},unproject:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.pointToLatLng(P(e),t)},layerPointToLatLng:function(e){var t=P(e).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(e){return this.project(V(e))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(V(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(z(e))},distance:function(e,t){return this.options.crs.distance(V(e),V(t))},containerPointToLayerPoint:function(e){return P(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return P(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(P(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(V(e)))},mouseEventToContainerPoint:function(e){return nn(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=ht(e);if(!t)throw Error(`Map container not found.`);if(t._leaflet_id)throw Error(`Map container is already initialized.`);q(t,`scroll`,this._onScroll,this),this._containerId=o(t)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&U.any3d,K(e,`leaflet-container`+(U.touch?` leaflet-touch`:``)+(U.retina?` leaflet-retina`:``)+(U.ielt9?` leaflet-oldie`:``)+(U.safari?` leaflet-safari`:``)+(this._fadeAnimated?` leaflet-fade-anim`:``));var t=gt(e,`position`);t!==`absolute`&&t!==`relative`&&t!==`fixed`&&t!==`sticky`&&(e.style.position=`relative`),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane(`mapPane`,this._container),kt(this._mapPane,new M(0,0)),this.createPane(`tilePane`),this.createPane(`overlayPane`),this.createPane(`shadowPane`),this.createPane(`markerPane`),this.createPane(`tooltipPane`),this.createPane(`popupPane`),this.options.markerZoomAnimation||(K(e.markerPane,`leaflet-zoom-hide`),K(e.shadowPane,`leaflet-zoom-hide`))},_resetView:function(e,t,n){kt(this._mapPane,new M(0,0));var r=!this._loaded;this._loaded=!0,t=this._limitZoom(t),this.fire(`viewprereset`);var i=this._zoom!==t;this._moveStart(i,n)._move(e,t)._moveEnd(i),this.fire(`viewreset`),r&&this.fire(`load`)},_moveStart:function(e,t){return e&&this.fire(`zoomstart`),t||this.fire(`movestart`),this},_move:function(e,t,n,r){t===void 0&&(t=this._zoom);var i=this._zoom!==t;return this._zoom=t,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),r?n&&n.pinch&&this.fire(`zoom`,n):((i||n&&n.pinch)&&this.fire(`zoom`,n),this.fire(`move`,n)),this},_moveEnd:function(e){return e&&this.fire(`zoomend`),this.fire(`moveend`)},_stop:function(){return E(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){kt(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw Error(`Set map center and zoom first.`)},_initEvents:function(e){this._targets={},this._targets[o(this._container)]=this;var t=e?Gt:q;t(this._container,`click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup`,this._handleDOMEvent,this),this.options.trackResize&&t(window,`resize`,this._onResize,this),U.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,`moveend`,this._onMoveEnd)},_onResize:function(){E(this._resizeRequest),this._resizeRequest=T(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,t){for(var n=[],r,i=t===`mouseout`||t===`mouseover`,a=e.target||e.srcElement,s=!1;a;){if(r=this._targets[o(a)],r&&(t===`click`||t===`preclick`)&&this._draggableMoved(r)){s=!0;break}if(r&&r.listens(t,!0)&&(i&&!on(a,e)||(n.push(r),i))||a===this._container)break;a=a.parentNode}return!n.length&&!s&&!i&&this.listens(t,!0)&&(n=[this]),n},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var t=e.target||e.srcElement;if(!(!this._loaded||t._leaflet_disable_events||e.type===`click`&&this._isClickDisabled(t))){var n=e.type;n===`mousedown`&&zt(t),this._fireDOMEvent(e,n)}},_mouseEvents:[`click`,`dblclick`,`mouseover`,`mouseout`,`contextmenu`],_fireDOMEvent:function(e,t,r){if(e.type===`click`){var i=n({},e);i.type=`preclick`,this._fireDOMEvent(i,i.type,r)}var a=this._findEventTargets(e,t);if(r){for(var o=[],s=0;s<r.length;s++)r[s].listens(t,!0)&&o.push(r[s]);a=o.concat(a)}if(a.length){t===`contextmenu`&&$t(e);var c=a[0],l={originalEvent:e};if(e.type!==`keypress`&&e.type!==`keydown`&&e.type!==`keyup`){var u=c.getLatLng&&(!c._radius||c._radius<=10);l.containerPoint=u?this.latLngToContainerPoint(c.getLatLng()):this.mouseEventToContainerPoint(e),l.layerPoint=this.containerPointToLayerPoint(l.containerPoint),l.latlng=u?c.getLatLng():this.layerPointToLatLng(l.layerPoint)}for(s=0;s<a.length;s++)if(a[s].fire(t,l,!0),l.originalEvent._stopped||a[s].options.bubblingMouseEvents===!1&&v(this._mouseEvents,t)!==-1)return}},_draggableMoved:function(e){return e=e.dragging&&e.dragging.enabled()?e:this,e.dragging&&e.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var e=0,t=this._handlers.length;e<t;e++)this._handlers[e].disable()},whenReady:function(e,t){return this._loaded?e.call(t||this,{target:this}):this.on(`load`,e,t),this},_getMapPanePos:function(){return At(this._mapPane)||new M(0,0)},_moved:function(){var e=this._getMapPanePos();return e&&!e.equals([0,0])},_getTopLeftPoint:function(e,t){return(e&&t!==void 0?this._getNewPixelOrigin(e,t):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(e,t){var n=this.getSize()._divideBy(2);return this.project(e,t)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(e,t,n){var r=this._getNewPixelOrigin(n,t);return this.project(e,t)._subtract(r)},_latLngBoundsToNewLayerBounds:function(e,t,n){var r=this._getNewPixelOrigin(n,t);return I([this.project(e.getSouthWest(),t)._subtract(r),this.project(e.getNorthWest(),t)._subtract(r),this.project(e.getSouthEast(),t)._subtract(r),this.project(e.getNorthEast(),t)._subtract(r)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(e){return this.latLngToLayerPoint(e).subtract(this._getCenterLayerPoint())},_limitCenter:function(e,t,n){if(!n)return e;var r=this.project(e,t),i=this.getSize().divideBy(2),a=new F(r.subtract(i),r.add(i)),o=this._getBoundsOffset(a,n,t);return Math.abs(o.x)<=1&&Math.abs(o.y)<=1?e:this.unproject(r.add(o),t)},_limitOffset:function(e,t){if(!t)return e;var n=this.getPixelBounds(),r=new F(n.min.add(e),n.max.add(e));return e.add(this._getBoundsOffset(r,t))},_getBoundsOffset:function(e,t,n){var r=I(this.project(t.getNorthEast(),n),this.project(t.getSouthWest(),n)),i=r.min.subtract(e.min),a=r.max.subtract(e.max);return new M(this._rebound(i.x,-a.x),this._rebound(i.y,-a.y))},_rebound:function(e,t){return e+t>0?Math.round(e-t)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(t))},_limitZoom:function(e){var t=this.getMinZoom(),n=this.getMaxZoom(),r=U.any3d?this.options.zoomSnap:1;return r&&(e=Math.round(e/r)*r),Math.max(t,Math.min(n,e))},_onPanTransitionStep:function(){this.fire(`move`)},_onPanTransitionEnd:function(){St(this._mapPane,`leaflet-pan-anim`),this.fire(`moveend`)},_tryAnimatedPan:function(e,t){var n=this._getCenterOffset(e)._trunc();return(t&&t.animate)!==!0&&!this.getSize().contains(n)?!1:(this.panBy(n,t),!0)},_createAnimProxy:function(){var e=this._proxy=G(`div`,`leaflet-proxy leaflet-zoom-animated`);this._panes.mapPane.appendChild(e),this.on(`zoomanim`,function(e){var t=ft,n=this._proxy.style[t];Ot(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[t]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on(`load moveend`,this._animMoveEnd,this),this._on(`unload`,this._destroyAnimProxy,this)},_destroyAnimProxy:function(){_t(this._proxy),this.off(`load moveend`,this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),t=this.getZoom();Ot(this._proxy,this.project(e,t),this.getZoomScale(t,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf(`transform`)>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName(`leaflet-zoom-animated`).length},_tryAnimatedZoom:function(e,t,n){if(this._animatingZoom)return!0;if(n||={},!this._zoomAnimated||n.animate===!1||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(t),i=this._getCenterOffset(e)._divideBy(1-1/r);return n.animate!==!0&&!this.getSize().contains(i)?!1:(T(function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(e,t,!0)},this),!0)},_animateZoom:function(e,t,n,r){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=t,K(this._mapPane,`leaflet-zoom-anim`)),this.fire(`zoomanim`,{center:e,zoom:t,noUpdate:r}),this._tempFireZoomEvent||=this._zoom!==this._animateToZoom,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(i(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&St(this._mapPane,`leaflet-zoom-anim`),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire(`zoom`),delete this._tempFireZoomEvent,this.fire(`move`),this._moveEnd(!0))}});function ln(e,t){return new J(e,t)}var un=O.extend({options:{position:`topright`},initialize:function(e){p(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var t=this._map;return t&&t.removeControl(this),this.options.position=e,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var t=this._container=this.onAdd(e),n=this.getPosition(),r=e._controlCorners[n];return K(t,`leaflet-control`),n.indexOf(`bottom`)===-1?r.appendChild(t):r.insertBefore(t,r.firstChild),this._map.on(`unload`,this.remove,this),this},remove:function(){return this._map?(_t(this._container),this.onRemove&&this.onRemove(this._map),this._map.off(`unload`,this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),dn=function(e){return new un(e)};J.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},t=`leaflet-`,n=this._controlContainer=G(`div`,t+`control-container`,this._container);function r(r,i){var a=t+r+` `+t+i;e[r+i]=G(`div`,a,n)}r(`top`,`left`),r(`top`,`right`),r(`bottom`,`left`),r(`bottom`,`right`)},_clearControlPos:function(){for(var e in this._controlCorners)_t(this._controlCorners[e]);_t(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var fn=un.extend({options:{collapsed:!0,position:`topright`,autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,t,n,r){return n<r?-1:r<n?1:0}},initialize:function(e,t,n){for(var r in p(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,e)this._addLayer(e[r],r);for(r in t)this._addLayer(t[r],r,!0)},onAdd:function(e){this._initLayout(),this._update(),this._map=e,e.on(`zoomend`,this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.on(`add remove`,this._onLayerChange,this);return this._container},addTo:function(e){return un.prototype.addTo.call(this,e),this._expandIfNotCollapsed()},onRemove:function(){this._map.off(`zoomend`,this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off(`add remove`,this._onLayerChange,this)},addBaseLayer:function(e,t){return this._addLayer(e,t),this._map?this._update():this},addOverlay:function(e,t){return this._addLayer(e,t,!0),this._map?this._update():this},removeLayer:function(e){e.off(`add remove`,this._onLayerChange,this);var t=this._getLayer(o(e));return t&&this._layers.splice(this._layers.indexOf(t),1),this._map?this._update():this},expand:function(){K(this._container,`leaflet-control-layers-expanded`),this._section.style.height=null;var e=this._map.getSize().y-(this._container.offsetTop+50);return e<this._section.clientHeight?(K(this._section,`leaflet-control-layers-scrollbar`),this._section.style.height=e+`px`):St(this._section,`leaflet-control-layers-scrollbar`),this._checkDisabledLayers(),this},collapse:function(){return St(this._container,`leaflet-control-layers-expanded`),this},_initLayout:function(){var e=`leaflet-control-layers`,t=this._container=G(`div`,e),n=this.options.collapsed;t.setAttribute(`aria-haspopup`,!0),Qt(t),Zt(t);var r=this._section=G(`section`,e+`-list`);n&&(this._map.on(`click`,this.collapse,this),q(t,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var i=this._layersLink=G(`a`,e+`-toggle`,t);i.href=`#`,i.title=`Layers`,i.setAttribute(`role`,`button`),q(i,{keydown:function(e){e.keyCode===13&&this._expandSafely()},click:function(e){$t(e),this._expandSafely()}},this),n||this.expand(),this._baseLayersList=G(`div`,e+`-base`,r),this._separator=G(`div`,e+`-separator`,r),this._overlaysList=G(`div`,e+`-overlays`,r),t.appendChild(r)},_getLayer:function(e){for(var t=0;t<this._layers.length;t++)if(this._layers[t]&&o(this._layers[t].layer)===e)return this._layers[t]},_addLayer:function(e,t,n){this._map&&e.on(`add remove`,this._onLayerChange,this),this._layers.push({layer:e,name:t,overlay:n}),this.options.sortLayers&&this._layers.sort(i(function(e,t){return this.options.sortFunction(e.layer,t.layer,e.name,t.name)},this)),this.options.autoZIndex&&e.setZIndex&&(this._lastZIndex++,e.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;vt(this._baseLayersList),vt(this._overlaysList),this._layerControlInputs=[];var e,t,n,r,i=0;for(n=0;n<this._layers.length;n++)r=this._layers[n],this._addItem(r),t||=r.overlay,e||=!r.overlay,i+=r.overlay?0:1;return this.options.hideSingleBase&&(e&&=i>1,this._baseLayersList.style.display=e?``:`none`),this._separator.style.display=t&&e?``:`none`,this},_onLayerChange:function(e){this._handlingClick||this._update();var t=this._getLayer(o(e.target)),n=t.overlay?e.type===`add`?`overlayadd`:`overlayremove`:e.type===`add`?`baselayerchange`:null;n&&this._map.fire(n,t)},_createRadioElement:function(e,t){var n=`<input type="radio" class="leaflet-control-layers-selector" name="`+e+`"`+(t?` checked="checked"`:``)+`/>`,r=document.createElement(`div`);return r.innerHTML=n,r.firstChild},_addItem:function(e){var t=document.createElement(`label`),n=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement(`input`),r.type=`checkbox`,r.className=`leaflet-control-layers-selector`,r.defaultChecked=n):r=this._createRadioElement(`leaflet-base-layers_`+o(this),n),this._layerControlInputs.push(r),r.layerId=o(e.layer),q(r,`click`,this._onInputClick,this);var i=document.createElement(`span`);i.innerHTML=` `+e.name;var a=document.createElement(`span`);return t.appendChild(a),a.appendChild(r),a.appendChild(i),(e.overlay?this._overlaysList:this._baseLayersList).appendChild(t),this._checkDisabledLayers(),t},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,t,n,r=[],i=[];this._handlingClick=!0;for(var a=e.length-1;a>=0;a--)t=e[a],n=this._getLayer(t.layerId).layer,t.checked?r.push(n):t.checked||i.push(n);for(a=0;a<i.length;a++)this._map.hasLayer(i[a])&&this._map.removeLayer(i[a]);for(a=0;a<r.length;a++)this._map.hasLayer(r[a])||this._map.addLayer(r[a]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var e=this._layerControlInputs,t,n,r=this._map.getZoom(),i=e.length-1;i>=0;i--)t=e[i],n=this._getLayer(t.layerId).layer,t.disabled=n.options.minZoom!==void 0&&r<n.options.minZoom||n.options.maxZoom!==void 0&&r>n.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,q(e,`click`,$t),this.expand();var t=this;setTimeout(function(){Gt(e,`click`,$t),t._preventClick=!1})}}),pn=function(e,t,n){return new fn(e,t,n)},mn=un.extend({options:{position:`topleft`,zoomInText:`<span aria-hidden="true">+</span>`,zoomInTitle:`Zoom in`,zoomOutText:`<span aria-hidden="true">−</span>`,zoomOutTitle:`Zoom out`},onAdd:function(e){var t=`leaflet-control-zoom`,n=G(`div`,t+` leaflet-bar`),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,t+`-in`,n,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,t+`-out`,n,this._zoomOut),this._updateDisabled(),e.on(`zoomend zoomlevelschange`,this._updateDisabled,this),n},onRemove:function(e){e.off(`zoomend zoomlevelschange`,this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(e.shiftKey?3:1))},_zoomOut:function(e){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,n,r,i){var a=G(`a`,n,r);return a.innerHTML=e,a.href=`#`,a.title=t,a.setAttribute(`role`,`button`),a.setAttribute(`aria-label`,t),Qt(a),q(a,`click`,en),q(a,`click`,i,this),q(a,`click`,this._refocusOnMap,this),a},_updateDisabled:function(){var e=this._map,t=`leaflet-disabled`;St(this._zoomInButton,t),St(this._zoomOutButton,t),this._zoomInButton.setAttribute(`aria-disabled`,`false`),this._zoomOutButton.setAttribute(`aria-disabled`,`false`),(this._disabled||e._zoom===e.getMinZoom())&&(K(this._zoomOutButton,t),this._zoomOutButton.setAttribute(`aria-disabled`,`true`)),(this._disabled||e._zoom===e.getMaxZoom())&&(K(this._zoomInButton,t),this._zoomInButton.setAttribute(`aria-disabled`,`true`))}});J.mergeOptions({zoomControl:!0}),J.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new mn,this.addControl(this.zoomControl))});var hn=function(e){return new mn(e)},gn=un.extend({options:{position:`bottomleft`,maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t=`leaflet-control-scale`,n=G(`div`,t),r=this.options;return this._addScales(r,t+`-line`,n),e.on(r.updateWhenIdle?`moveend`:`move`,this._update,this),e.whenReady(this._update,this),n},onRemove:function(e){e.off(this.options.updateWhenIdle?`moveend`:`move`,this._update,this)},_addScales:function(e,t,n){e.metric&&(this._mScale=G(`div`,t,n)),e.imperial&&(this._iScale=G(`div`,t,n))},_update:function(){var e=this._map,t=e.getSize().y/2,n=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(n)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),n=t<1e3?t+` m`:t/1e3+` km`;this._updateScale(this._mScale,n,t/e)},_updateImperial:function(e){var t=e*3.2808399,n,r,i;t>5280?(n=t/5280,r=this._getRoundNum(n),this._updateScale(this._iScale,r+` mi`,r/n)):(i=this._getRoundNum(t),this._updateScale(this._iScale,i+` ft`,i/t))},_updateScale:function(e,t,n){e.style.width=Math.round(this.options.maxWidth*n)+`px`,e.innerHTML=t},_getRoundNum:function(e){var t=10**((Math.floor(e)+``).length-1),n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1,t*n}}),_n=function(e){return new gn(e)},vn=un.extend({options:{position:`bottomright`,prefix:`<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">`+(U.inlineSvg?`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg> `:``)+`Leaflet</a>`},initialize:function(e){p(this,e),this._attributions={}},onAdd:function(e){for(var t in e.attributionControl=this,this._container=G(`div`,`leaflet-control-attribution`),Qt(this._container),e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on(`layeradd`,this._addAttribution,this),this._container},onRemove:function(e){e.off(`layeradd`,this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once(`remove`,function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e&&this._attributions[e]&&(this._attributions[e]--,this._update()),this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var n=[];this.options.prefix&&n.push(this.options.prefix),e.length&&n.push(e.join(`, `)),this._container.innerHTML=n.join(` <span aria-hidden="true">|</span> `)}}});J.mergeOptions({attributionControl:!0}),J.addInitHook(function(){this.options.attributionControl&&new vn().addTo(this)}),un.Layers=fn,un.Zoom=mn,un.Scale=gn,un.Attribution=vn,dn.layers=pn,dn.zoom=hn,dn.scale=_n,dn.attribution=function(e){return new vn(e)};var yn=O.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});yn.addTo=function(e,t){return e.addHandler(t,this),this};var bn={Events:A},xn=U.touch?`touchstart mousedown`:`mousedown`,Sn=j.extend({options:{clickTolerance:3},initialize:function(e,t,n,r){p(this,r),this._element=e,this._dragStartTarget=t||e,this._preventOutline=n},enable:function(){this._enabled||=(q(this._dragStartTarget,xn,this._onDown,this),!0)},disable:function(){this._enabled&&(Sn._dragging===this&&this.finishDrag(!0),Gt(this._dragStartTarget,xn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!xt(this._element,`leaflet-zoom-anim`))){if(e.touches&&e.touches.length!==1){Sn._dragging===this&&this.finishDrag();return}if(!(Sn._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(Sn._dragging=this,this._preventOutline&&zt(this._element),Ft(),jt(),!this._moving)){this.fire(`down`);var t=e.touches?e.touches[0]:e,n=Vt(this._element);this._startPoint=new M(t.clientX,t.clientY),this._startPos=At(this._element),this._parentScale=Ht(n);var r=e.type===`mousedown`;q(document,r?`mousemove`:`touchmove`,this._onMove,this),q(document,r?`mouseup`:`touchend touchcancel`,this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var t=e.touches&&e.touches.length===1?e.touches[0]:e,n=new M(t.clientX,t.clientY)._subtract(this._startPoint);!n.x&&!n.y||Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,$t(e),this._moved||(this.fire(`dragstart`),this._moved=!0,K(document.body,`leaflet-dragging`),this._lastTarget=e.target||e.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),K(this._lastTarget,`leaflet-drag-target`)),this._newPos=this._startPos.add(n),this._moving=!0,this._lastEvent=e,this._updatePosition())}},_updatePosition:function(){var e={originalEvent:this._lastEvent};this.fire(`predrag`,e),kt(this._element,this._newPos),this.fire(`drag`,e)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(e){St(document.body,`leaflet-dragging`),this._lastTarget&&=(St(this._lastTarget,`leaflet-drag-target`),null),Gt(document,`mousemove touchmove`,this._onMove,this),Gt(document,`mouseup touchend touchcancel`,this._onUp,this),It(),Mt();var t=this._moved&&this._moving;this._moving=!1,Sn._dragging=!1,t&&this.fire(`dragend`,{noInertia:e,distance:this._newPos.distanceTo(this._startPos)})}});function Cn(e,t,n){var r,i=[1,4,2,8],a,o,s,c,l,u,d,f;for(a=0,u=e.length;a<u;a++)e[a]._code=In(e[a],t);for(s=0;s<4;s++){for(d=i[s],r=[],a=0,u=e.length,o=u-1;a<u;o=a++)c=e[a],l=e[o],c._code&d?l._code&d||(f=Fn(l,c,d,t,n),f._code=In(f,t),r.push(f)):(l._code&d&&(f=Fn(l,c,d,t,n),f._code=In(f,t),r.push(f)),r.push(c));e=r}return e}function wn(e,t){var n,r,i,a,o,s,c,l,u;if(!e||e.length===0)throw Error(`latlngs not passed`);zn(e)||(console.warn(`latlngs are not flat! Only the first ring will be used`),e=e[0]);var d=V([0,0]),f=z(e);f.getNorthWest().distanceTo(f.getSouthWest())*f.getNorthEast().distanceTo(f.getNorthWest())<1700&&(d=Tn(e));var p=e.length,m=[];for(n=0;n<p;n++){var h=V(e[n]);m.push(t.project(V([h.lat-d.lat,h.lng-d.lng])))}for(s=c=l=0,n=0,r=p-1;n<p;r=n++)i=m[n],a=m[r],o=i.y*a.x-a.y*i.x,c+=(i.x+a.x)*o,l+=(i.y+a.y)*o,s+=o*3;u=s===0?m[0]:[c/s,l/s];var g=t.unproject(P(u));return V([g.lat+d.lat,g.lng+d.lng])}function Tn(e){for(var t=0,n=0,r=0,i=0;i<e.length;i++){var a=V(e[i]);t+=a.lat,n+=a.lng,r++}return V([t/r,n/r])}var En={__proto__:null,clipPolygon:Cn,polygonCenter:wn,centroid:Tn};function Dn(e,t){if(!t||!e.length)return e.slice();var n=t*t;return e=Mn(e,n),e=An(e,n),e}function On(e,t,n){return Math.sqrt(Rn(e,t,n,!0))}function kn(e,t,n){return Rn(e,t,n)}function An(e,t){var n=e.length,r=new(typeof Uint8Array<`u`?Uint8Array:Array)(n);r[0]=r[n-1]=1,jn(e,r,t,0,n-1);var i,a=[];for(i=0;i<n;i++)r[i]&&a.push(e[i]);return a}function jn(e,t,n,r,i){var a=0,o,s,c;for(s=r+1;s<=i-1;s++)c=Rn(e[s],e[r],e[i],!0),c>a&&(o=s,a=c);a>n&&(t[o]=1,jn(e,t,n,r,o),jn(e,t,n,o,i))}function Mn(e,t){for(var n=[e[0]],r=1,i=0,a=e.length;r<a;r++)Ln(e[r],e[i])>t&&(n.push(e[r]),i=r);return i<a-1&&n.push(e[a-1]),n}var Nn;function Pn(e,t,n,r,i){var a=r?Nn:In(e,n),o=In(t,n),s,c,l;for(Nn=o;;){if(!(a|o))return[e,t];if(a&o)return!1;s=a||o,c=Fn(e,t,s,n,i),l=In(c,n),s===a?(e=c,a=l):(t=c,o=l)}}function Fn(e,t,n,r,i){var a=t.x-e.x,o=t.y-e.y,s=r.min,c=r.max,l,u;return n&8?(l=e.x+a*(c.y-e.y)/o,u=c.y):n&4?(l=e.x+a*(s.y-e.y)/o,u=s.y):n&2?(l=c.x,u=e.y+o*(c.x-e.x)/a):n&1&&(l=s.x,u=e.y+o*(s.x-e.x)/a),new M(l,u,i)}function In(e,t){var n=0;return e.x<t.min.x?n|=1:e.x>t.max.x&&(n|=2),e.y<t.min.y?n|=4:e.y>t.max.y&&(n|=8),n}function Ln(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function Rn(e,t,n,r){var i=t.x,a=t.y,o=n.x-i,s=n.y-a,c=o*o+s*s,l;return c>0&&(l=((e.x-i)*o+(e.y-a)*s)/c,l>1?(i=n.x,a=n.y):l>0&&(i+=o*l,a+=s*l)),o=e.x-i,s=e.y-a,r?o*o+s*s:new M(i,a)}function zn(e){return!_(e[0])||typeof e[0][0]!=`object`&&e[0][0]!==void 0}function Bn(e){return console.warn(`Deprecated use of _flat, please use L.LineUtil.isFlat instead.`),zn(e)}function Vn(e,t){var n,r,i,a,o,s,c,l;if(!e||e.length===0)throw Error(`latlngs not passed`);zn(e)||(console.warn(`latlngs are not flat! Only the first ring will be used`),e=e[0]);var u=V([0,0]),d=z(e);d.getNorthWest().distanceTo(d.getSouthWest())*d.getNorthEast().distanceTo(d.getNorthWest())<1700&&(u=Tn(e));var f=e.length,p=[];for(n=0;n<f;n++){var m=V(e[n]);p.push(t.project(V([m.lat-u.lat,m.lng-u.lng])))}for(n=0,r=0;n<f-1;n++)r+=p[n].distanceTo(p[n+1])/2;if(r===0)l=p[0];else for(n=0,a=0;n<f-1;n++)if(o=p[n],s=p[n+1],i=o.distanceTo(s),a+=i,a>r){c=(a-r)/i,l=[s.x-c*(s.x-o.x),s.y-c*(s.y-o.y)];break}var h=t.unproject(P(l));return V([h.lat+u.lat,h.lng+u.lng])}var Hn={__proto__:null,simplify:Dn,pointToSegmentDistance:On,closestPointOnSegment:kn,clipSegment:Pn,_getEdgeIntersection:Fn,_getBitCode:In,_sqClosestPointOnSegment:Rn,isFlat:zn,_flat:Bn,polylineCenter:Vn},Un={project:function(e){return new M(e.lng,e.lat)},unproject:function(e){return new B(e.y,e.x)},bounds:new F([-180,-90],[180,90])},Wn={R:6378137,R_MINOR:6356752.314245179,bounds:new F([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(e){var t=Math.PI/180,n=this.R,r=e.lat*t,i=this.R_MINOR/n,a=Math.sqrt(1-i*i),o=a*Math.sin(r),s=Math.tan(Math.PI/4-r/2)/((1-o)/(1+o))**(a/2);return r=-n*Math.log(Math.max(s,1e-10)),new M(e.lng*t*n,r)},unproject:function(e){for(var t=180/Math.PI,n=this.R,r=this.R_MINOR/n,i=Math.sqrt(1-r*r),a=Math.exp(-e.y/n),o=Math.PI/2-2*Math.atan(a),s=0,c=.1,l;s<15&&Math.abs(c)>1e-7;s++)l=i*Math.sin(o),l=((1-l)/(1+l))**(i/2),c=Math.PI/2-2*Math.atan(a*l)-o,o+=c;return new B(o*t,e.x*t/n)}},Gn={__proto__:null,LonLat:Un,Mercator:Wn,SphericalMercator:re},Kn=n({},te,{code:`EPSG:3395`,projection:Wn,transformation:function(){var e=.5/(Math.PI*Wn.R);return ae(e,.5,-e,.5)}()}),qn=n({},te,{code:`EPSG:4326`,projection:Un,transformation:ae(1/180,1,-1/180,.5)}),Jn=n({},ee,{projection:Un,transformation:ae(1,0,-1,0),scale:function(e){return 2**e},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var n=t.lng-e.lng,r=t.lat-e.lat;return Math.sqrt(n*n+r*r)},infinite:!0});ee.Earth=te,ee.EPSG3395=Kn,ee.EPSG3857=oe,ee.EPSG900913=se,ee.EPSG4326=qn,ee.Simple=Jn;var Yn=j.extend({options:{pane:`overlayPane`,attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[o(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[o(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var n=this.getEvents();t.on(n,this),this.once(`remove`,function(){t.off(n,this)},this)}this.onAdd(t),this.fire(`add`),t.fire(`layeradd`,{layer:this})}}});J.include({addLayer:function(e){if(!e._layerAdd)throw Error(`The provided object is not a Layer.`);var t=o(e);return this._layers[t]?this:(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var t=o(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire(`layerremove`,{layer:e}),e.fire(`remove`)),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return o(e)in this._layers},eachLayer:function(e,t){for(var n in this._layers)e.call(t,this._layers[n]);return this},_addLayers:function(e){e=e?_(e)?e:[e]:[];for(var t=0,n=e.length;t<n;t++)this.addLayer(e[t])},_addZoomLimit:function(e){(!isNaN(e.options.maxZoom)||!isNaN(e.options.minZoom))&&(this._zoomBoundLayers[o(e)]=e,this._updateZoomLevels())},_removeZoomLimit:function(e){var t=o(e);this._zoomBoundLayers[t]&&(delete this._zoomBoundLayers[t],this._updateZoomLevels())},_updateZoomLevels:function(){var e=1/0,t=-1/0,n=this._getZoomSpan();for(var r in this._zoomBoundLayers){var i=this._zoomBoundLayers[r].options;e=i.minZoom===void 0?e:Math.min(e,i.minZoom),t=i.maxZoom===void 0?t:Math.max(t,i.maxZoom)}this._layersMaxZoom=t===-1/0?void 0:t,this._layersMinZoom=e===1/0?void 0:e,n!==this._getZoomSpan()&&this.fire(`zoomlevelschange`),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Xn=Yn.extend({initialize:function(e,t){p(this,t),this._layers={};var n,r;if(e)for(n=0,r=e.length;n<r;n++)this.addLayer(e[n])},addLayer:function(e){var t=this.getLayerId(e);return this._layers[t]=e,this._map&&this._map.addLayer(e),this},removeLayer:function(e){var t=e in this._layers?e:this.getLayerId(e);return this._map&&this._layers[t]&&this._map.removeLayer(this._layers[t]),delete this._layers[t],this},hasLayer:function(e){return(typeof e==`number`?e:this.getLayerId(e))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(e){var t=Array.prototype.slice.call(arguments,1),n,r;for(n in this._layers)r=this._layers[n],r[e]&&r[e].apply(r,t);return this},onAdd:function(e){this.eachLayer(e.addLayer,e)},onRemove:function(e){this.eachLayer(e.removeLayer,e)},eachLayer:function(e,t){for(var n in this._layers)e.call(t,this._layers[n]);return this},getLayer:function(e){return this._layers[e]},getLayers:function(){var e=[];return this.eachLayer(e.push,e),e},setZIndex:function(e){return this.invoke(`setZIndex`,e)},getLayerId:function(e){return o(e)}}),Zn=function(e,t){return new Xn(e,t)},Qn=Xn.extend({addLayer:function(e){return this.hasLayer(e)?this:(e.addEventParent(this),Xn.prototype.addLayer.call(this,e),this.fire(`layeradd`,{layer:e}))},removeLayer:function(e){return this.hasLayer(e)?(e in this._layers&&(e=this._layers[e]),e.removeEventParent(this),Xn.prototype.removeLayer.call(this,e),this.fire(`layerremove`,{layer:e})):this},setStyle:function(e){return this.invoke(`setStyle`,e)},bringToFront:function(){return this.invoke(`bringToFront`)},bringToBack:function(){return this.invoke(`bringToBack`)},getBounds:function(){var e=new R;for(var t in this._layers){var n=this._layers[t];e.extend(n.getBounds?n.getBounds():n.getLatLng())}return e}}),$n=function(e,t){return new Qn(e,t)},er=O.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(e){p(this,e)},createIcon:function(e){return this._createIcon(`icon`,e)},createShadow:function(e){return this._createIcon(`shadow`,e)},_createIcon:function(e,t){var n=this._getIconUrl(e);if(!n){if(e===`icon`)throw Error(`iconUrl not set in Icon options (see the docs).`);return null}var r=this._createImg(n,t&&t.tagName===`IMG`?t:null);return this._setIconStyles(r,e),(this.options.crossOrigin||this.options.crossOrigin===``)&&(r.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),r},_setIconStyles:function(e,t){var n=this.options,r=n[t+`Size`];typeof r==`number`&&(r=[r,r]);var i=P(r),a=P(t===`shadow`&&n.shadowAnchor||n.iconAnchor||i&&i.divideBy(2,!0));e.className=`leaflet-marker-`+t+` `+(n.className||``),a&&(e.style.marginLeft=-a.x+`px`,e.style.marginTop=-a.y+`px`),i&&(e.style.width=i.x+`px`,e.style.height=i.y+`px`)},_createImg:function(e,t){return t||=document.createElement(`img`),t.src=e,t},_getIconUrl:function(e){return U.retina&&this.options[e+`RetinaUrl`]||this.options[e+`Url`]}});function tr(e){return new er(e)}var nr=er.extend({options:{iconUrl:`marker-icon.png`,iconRetinaUrl:`marker-icon-2x.png`,shadowUrl:`marker-shadow.png`,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(e){return typeof nr.imagePath!=`string`&&(nr.imagePath=this._detectIconPath()),(this.options.imagePath||nr.imagePath)+er.prototype._getIconUrl.call(this,e)},_stripUrl:function(e){var t=function(e,t,n){var r=t.exec(e);return r&&r[n]};return e=t(e,/^url\((['"])?(.+)\1\)$/,2),e&&t(e,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var e=G(`div`,`leaflet-default-icon-path`,document.body),t=gt(e,`background-image`)||gt(e,`backgroundImage`);if(document.body.removeChild(e),t=this._stripUrl(t),t)return t;var n=document.querySelector(`link[href$="leaflet.css"]`);return n?n.href.substring(0,n.href.length-11-1):``}}),rr=yn.extend({initialize:function(e){this._marker=e},addHooks:function(){var e=this._marker._icon;this._draggable||=new Sn(e,e,!0),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),K(e,`leaflet-marker-draggable`)},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&St(this._marker._icon,`leaflet-marker-draggable`)},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(e){var t=this._marker,n=t._map,r=this._marker.options.autoPanSpeed,i=this._marker.options.autoPanPadding,a=At(t._icon),o=n.getPixelBounds(),s=n.getPixelOrigin(),c=I(o.min._subtract(s).add(i),o.max._subtract(s).subtract(i));if(!c.contains(a)){var l=P((Math.max(c.max.x,a.x)-c.max.x)/(o.max.x-c.max.x)-(Math.min(c.min.x,a.x)-c.min.x)/(o.min.x-c.min.x),(Math.max(c.max.y,a.y)-c.max.y)/(o.max.y-c.max.y)-(Math.min(c.min.y,a.y)-c.min.y)/(o.min.y-c.min.y)).multiplyBy(r);n.panBy(l,{animate:!1}),this._draggable._newPos._add(l),this._draggable._startPos._add(l),kt(t._icon,this._draggable._newPos),this._onDrag(e),this._panRequest=T(this._adjustPan.bind(this,e))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire(`movestart`).fire(`dragstart`)},_onPreDrag:function(e){this._marker.options.autoPan&&(E(this._panRequest),this._panRequest=T(this._adjustPan.bind(this,e)))},_onDrag:function(e){var t=this._marker,n=t._shadow,r=At(t._icon),i=t._map.layerPointToLatLng(r);n&&kt(n,r),t._latlng=i,e.latlng=i,e.oldLatLng=this._oldLatLng,t.fire(`move`,e).fire(`drag`,e)},_onDragEnd:function(e){E(this._panRequest),delete this._oldLatLng,this._marker.fire(`moveend`).fire(`dragend`,e)}}),ir=Yn.extend({options:{icon:new nr,interactive:!0,keyboard:!0,title:``,alt:`Marker`,zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:`markerPane`,shadowPane:`shadowPane`,bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(e,t){p(this,t),this._latlng=V(e)},onAdd:function(e){this._zoomAnimated=this._zoomAnimated&&e.options.markerZoomAnimation,this._zoomAnimated&&e.on(`zoomanim`,this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(e){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&e.off(`zoomanim`,this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(e){var t=this._latlng;return this._latlng=V(e),this.update(),this.fire(`move`,{oldLatLng:t,latlng:this._latlng})},setZIndexOffset:function(e){return this.options.zIndexOffset=e,this.update()},getIcon:function(){return this.options.icon},setIcon:function(e){return this.options.icon=e,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var e=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(e)}return this},_initIcon:function(){var e=this.options,t=`leaflet-zoom-`+(this._zoomAnimated?`animated`:`hide`),n=e.icon.createIcon(this._icon),r=!1;n!==this._icon&&(this._icon&&this._removeIcon(),r=!0,e.title&&(n.title=e.title),n.tagName===`IMG`&&(n.alt=e.alt||``)),K(n,t),e.keyboard&&(n.tabIndex=`0`,n.setAttribute(`role`,`button`)),this._icon=n,e.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&q(n,`focus`,this._panOnFocus,this);var i=e.icon.createShadow(this._shadow),a=!1;i!==this._shadow&&(this._removeShadow(),a=!0),i&&(K(i,t),i.alt=``),this._shadow=i,e.opacity<1&&this._updateOpacity(),r&&this.getPane().appendChild(this._icon),this._initInteraction(),i&&a&&this.getPane(e.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Gt(this._icon,`focus`,this._panOnFocus,this),_t(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&_t(this._shadow),this._shadow=null},_setPos:function(e){this._icon&&kt(this._icon,e),this._shadow&&kt(this._shadow,e),this._zIndex=e.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(e){this._icon&&(this._icon.style.zIndex=this._zIndex+e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center).round();this._setPos(t)},_initInteraction:function(){if(this.options.interactive&&(K(this._icon,`leaflet-interactive`),this.addInteractiveTarget(this._icon),rr)){var e=this.options.draggable;this.dragging&&(e=this.dragging.enabled(),this.dragging.disable()),this.dragging=new rr(this),e&&this.dragging.enable()}},setOpacity:function(e){return this.options.opacity=e,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var e=this.options.opacity;this._icon&&Tt(this._icon,e),this._shadow&&Tt(this._shadow,e)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var e=this._map;if(e){var t=this.options.icon.options,n=t.iconSize?P(t.iconSize):P(0,0),r=t.iconAnchor?P(t.iconAnchor):P(0,0);e.panInside(this._latlng,{paddingTopLeft:r,paddingBottomRight:n.subtract(r)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function ar(e,t){return new ir(e,t)}var or=Yn.extend({options:{stroke:!0,color:`#3388ff`,weight:3,opacity:1,lineCap:`round`,lineJoin:`round`,dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:`evenodd`,interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(e){this._renderer=e.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(e){return p(this,e),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&e&&Object.prototype.hasOwnProperty.call(e,`weight`)&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),sr=or.extend({options:{fill:!0,radius:10},initialize:function(e,t){p(this,t),this._latlng=V(e),this._radius=this.options.radius},setLatLng:function(e){var t=this._latlng;return this._latlng=V(e),this.redraw(),this.fire(`move`,{oldLatLng:t,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(e){return this.options.radius=this._radius=e,this.redraw()},getRadius:function(){return this._radius},setStyle:function(e){var t=e&&e.radius||this._radius;return or.prototype.setStyle.call(this,e),this.setRadius(t),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var e=this._radius,t=this._radiusY||e,n=this._clickTolerance(),r=[e+n,t+n];this._pxBounds=new F(this._point.subtract(r),this._point.add(r))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(e){return e.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function cr(e,t){return new sr(e,t)}var lr=sr.extend({initialize:function(e,t,r){if(typeof t==`number`&&(t=n({},r,{radius:t})),p(this,t),this._latlng=V(e),isNaN(this.options.radius))throw Error(`Circle radius cannot be NaN`);this._mRadius=this.options.radius},setRadius:function(e){return this._mRadius=e,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var e=[this._radius,this._radiusY||this._radius];return new R(this._map.layerPointToLatLng(this._point.subtract(e)),this._map.layerPointToLatLng(this._point.add(e)))},setStyle:or.prototype.setStyle,_project:function(){var e=this._latlng.lng,t=this._latlng.lat,n=this._map,r=n.options.crs;if(r.distance===te.distance){var i=Math.PI/180,a=this._mRadius/te.R/i,o=n.project([t+a,e]),s=n.project([t-a,e]),c=o.add(s).divideBy(2),l=n.unproject(c).lat,u=Math.acos((Math.cos(a*i)-Math.sin(t*i)*Math.sin(l*i))/(Math.cos(t*i)*Math.cos(l*i)))/i;(isNaN(u)||u===0)&&(u=a/Math.cos(Math.PI/180*t)),this._point=c.subtract(n.getPixelOrigin()),this._radius=isNaN(u)?0:c.x-n.project([l,e-u]).x,this._radiusY=c.y-o.y}else{var d=r.unproject(r.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(d).x}this._updateBounds()}});function ur(e,t,n){return new lr(e,t,n)}var dr=or.extend({options:{smoothFactor:1,noClip:!1},initialize:function(e,t){p(this,t),this._setLatLngs(e)},getLatLngs:function(){return this._latlngs},setLatLngs:function(e){return this._setLatLngs(e),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(e){for(var t=1/0,n=null,r=Rn,i,a,o=0,s=this._parts.length;o<s;o++)for(var c=this._parts[o],l=1,u=c.length;l<u;l++){i=c[l-1],a=c[l];var d=r(e,i,a,!0);d<t&&(t=d,n=r(e,i,a))}return n&&(n.distance=Math.sqrt(t)),n},getCenter:function(){if(!this._map)throw Error(`Must add layer to map before using getCenter()`);return Vn(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(e,t){return t||=this._defaultShape(),e=V(e),t.push(e),this._bounds.extend(e),this.redraw()},_setLatLngs:function(e){this._bounds=new R,this._latlngs=this._convertLatLngs(e)},_defaultShape:function(){return zn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(e){for(var t=[],n=zn(e),r=0,i=e.length;r<i;r++)n?(t[r]=V(e[r]),this._bounds.extend(t[r])):t[r]=this._convertLatLngs(e[r]);return t},_project:function(){var e=new F;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,e),this._bounds.isValid()&&e.isValid()&&(this._rawPxBounds=e,this._updateBounds())},_updateBounds:function(){var e=this._clickTolerance(),t=new M(e,e);this._rawPxBounds&&(this._pxBounds=new F([this._rawPxBounds.min.subtract(t),this._rawPxBounds.max.add(t)]))},_projectLatlngs:function(e,t,n){var r=e[0]instanceof B,i=e.length,a,o;if(r){for(o=[],a=0;a<i;a++)o[a]=this._map.latLngToLayerPoint(e[a]),n.extend(o[a]);t.push(o)}else for(a=0;a<i;a++)this._projectLatlngs(e[a],t,n)},_clipPoints:function(){var e=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}var t=this._parts,n,r,i,a,o,s,c;for(n=0,i=0,a=this._rings.length;n<a;n++)for(c=this._rings[n],r=0,o=c.length;r<o-1;r++)s=Pn(c[r],c[r+1],e,r,!0),s&&(t[i]=t[i]||[],t[i].push(s[0]),(s[1]!==c[r+1]||r===o-2)&&(t[i].push(s[1]),i++))}},_simplifyPoints:function(){for(var e=this._parts,t=this.options.smoothFactor,n=0,r=e.length;n<r;n++)e[n]=Dn(e[n],t)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(e,t){var n,r,i,a,o,s,c=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(n=0,a=this._parts.length;n<a;n++)for(s=this._parts[n],r=0,o=s.length,i=o-1;r<o;i=r++)if(!(!t&&r===0)&&On(e,s[i],s[r])<=c)return!0;return!1}});function fr(e,t){return new dr(e,t)}dr._flat=Bn;var pr=dr.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw Error(`Must add layer to map before using getCenter()`);return wn(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(e){var t=dr.prototype._convertLatLngs.call(this,e),n=t.length;return n>=2&&t[0]instanceof B&&t[0].equals(t[n-1])&&t.pop(),t},_setLatLngs:function(e){dr.prototype._setLatLngs.call(this,e),zn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return zn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,n=new M(t,t);if(e=new F(e.min.subtract(n),e.max.add(n)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,i=this._rings.length,a;r<i;r++)a=Cn(this._rings[r],e,!0),a.length&&this._parts.push(a)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(e){var t=!1,n,r,i,a,o,s,c,l;if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(a=0,c=this._parts.length;a<c;a++)for(n=this._parts[a],o=0,l=n.length,s=l-1;o<l;s=o++)r=n[o],i=n[s],r.y>e.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(t=!t);return t||dr.prototype._containsPoint.call(this,e,!0)}});function mr(e,t){return new pr(e,t)}var hr=Qn.extend({initialize:function(e,t){p(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t=_(e)?e:e.features,n,r,i;if(t){for(n=0,r=t.length;n<r;n++)i=t[n],(i.geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var a=this.options;if(a.filter&&!a.filter(e))return this;var o=gr(e,a);return o?(o.feature=Cr(e),o.defaultOptions=o.options,this.resetStyle(o),a.onEachFeature&&a.onEachFeature(e,o),this.addLayer(o)):this},resetStyle:function(e){return e===void 0?this.eachLayer(this.resetStyle,this):(e.options=n({},e.defaultOptions),this._setLayerStyle(e,this.options.style),this)},setStyle:function(e){return this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(e,t){e.setStyle&&(typeof t==`function`&&(t=t(e.feature)),e.setStyle(t))}});function gr(e,t){var n=e.type===`Feature`?e.geometry:e,r=n?n.coordinates:null,i=[],a=t&&t.pointToLayer,o=t&&t.coordsToLatLng||vr,s,c,l,u;if(!r&&!n)return null;switch(n.type){case`Point`:return s=o(r),_r(a,e,s,t);case`MultiPoint`:for(l=0,u=r.length;l<u;l++)s=o(r[l]),i.push(_r(a,e,s,t));return new Qn(i);case`LineString`:case`MultiLineString`:return c=yr(r,n.type===`LineString`?0:1,o),new dr(c,t);case`Polygon`:case`MultiPolygon`:return c=yr(r,n.type===`Polygon`?1:2,o),new pr(c,t);case`GeometryCollection`:for(l=0,u=n.geometries.length;l<u;l++){var d=gr({geometry:n.geometries[l],type:`Feature`,properties:e.properties},t);d&&i.push(d)}return new Qn(i);case`FeatureCollection`:for(l=0,u=n.features.length;l<u;l++){var f=gr(n.features[l],t);f&&i.push(f)}return new Qn(i);default:throw Error(`Invalid GeoJSON object.`)}}function _r(e,t,n,r){return e?e(t,n):new ir(n,r&&r.markersInheritOptions&&r)}function vr(e){return new B(e[1],e[0],e[2])}function yr(e,t,n){for(var r=[],i=0,a=e.length,o;i<a;i++)o=t?yr(e[i],t-1,n):(n||vr)(e[i]),r.push(o);return r}function br(e,t){return e=V(e),e.alt===void 0?[u(e.lng,t),u(e.lat,t)]:[u(e.lng,t),u(e.lat,t),u(e.alt,t)]}function xr(e,t,n,r){for(var i=[],a=0,o=e.length;a<o;a++)i.push(t?xr(e[a],zn(e[a])?0:t-1,n,r):br(e[a],r));return!t&&n&&i.length>0&&i.push(i[0].slice()),i}function Sr(e,t){return e.feature?n({},e.feature,{geometry:t}):Cr(t)}function Cr(e){return e.type===`Feature`||e.type===`FeatureCollection`?e:{type:`Feature`,properties:{},geometry:e}}var wr={toGeoJSON:function(e){return Sr(this,{type:`Point`,coordinates:br(this.getLatLng(),e)})}};ir.include(wr),lr.include(wr),sr.include(wr),dr.include({toGeoJSON:function(e){var t=!zn(this._latlngs),n=xr(this._latlngs,t?1:0,!1,e);return Sr(this,{type:(t?`Multi`:``)+`LineString`,coordinates:n})}}),pr.include({toGeoJSON:function(e){var t=!zn(this._latlngs),n=t&&!zn(this._latlngs[0]),r=xr(this._latlngs,n?2:t?1:0,!0,e);return t||(r=[r]),Sr(this,{type:(n?`Multi`:``)+`Polygon`,coordinates:r})}}),Xn.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(n){t.push(n.toGeoJSON(e).geometry.coordinates)}),Sr(this,{type:`MultiPoint`,coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(t===`MultiPoint`)return this.toMultiPoint(e);var n=t===`GeometryCollection`,r=[];return this.eachLayer(function(t){if(t.toGeoJSON){var i=t.toGeoJSON(e);if(n)r.push(i.geometry);else{var a=Cr(i);a.type===`FeatureCollection`?r.push.apply(r,a.features):r.push(a)}}}),n?Sr(this,{geometries:r,type:`GeometryCollection`}):{type:`FeatureCollection`,features:r}}});function Tr(e,t){return new hr(e,t)}var Er=Tr,Dr=Yn.extend({options:{opacity:1,alt:``,interactive:!1,crossOrigin:!1,errorOverlayUrl:``,zIndex:1,className:``},initialize:function(e,t,n){this._url=e,this._bounds=z(t),p(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(K(this._image,`leaflet-interactive`),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){_t(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&&yt(this._image),this},bringToBack:function(){return this._map&&bt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=z(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName===`IMG`,t=this._image=e?this._url:G(`img`);if(K(t,`leaflet-image-layer`),this._zoomAnimated&&K(t,`leaflet-zoom-animated`),this.options.className&&K(t,this.options.className),t.onselectstart=l,t.onmousemove=l,t.onload=i(this.fire,this,`load`),t.onerror=i(this._overlayOnError,this,`error`),(this.options.crossOrigin||this.options.crossOrigin===``)&&(t.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=t.src;return}t.src=this._url,t.alt=this.options.alt},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Ot(this._image,n,t)},_reset:function(){var e=this._image,t=new F(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=t.getSize();kt(e,t.min),e.style.width=n.x+`px`,e.style.height=n.y+`px`},_updateOpacity:function(){Tt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire(`error`);var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),Or=function(e,t,n){return new Dr(e,t,n)},kr=Dr.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName===`VIDEO`,t=this._image=e?this._url:G(`video`);if(K(t,`leaflet-image-layer`),this._zoomAnimated&&K(t,`leaflet-zoom-animated`),this.options.className&&K(t,this.options.className),t.onselectstart=l,t.onmousemove=l,t.onloadeddata=i(this.fire,this,`load`),e){for(var n=t.getElementsByTagName(`source`),r=[],a=0;a<n.length;a++)r.push(n[a].src);this._url=n.length>0?r:[t.src];return}_(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,`objectFit`)&&(t.style.objectFit=`fill`),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var o=0;o<this._url.length;o++){var s=G(`source`);s.src=this._url[o],t.appendChild(s)}}});function Ar(e,t,n){return new kr(e,t,n)}var jr=Dr.extend({_initImage:function(){var e=this._image=this._url;K(e,`leaflet-image-layer`),this._zoomAnimated&&K(e,`leaflet-zoom-animated`),this.options.className&&K(e,this.options.className),e.onselectstart=l,e.onmousemove=l}});function Mr(e,t,n){return new jr(e,t,n)}var Nr=Yn.extend({options:{interactive:!1,offset:[0,0],className:``,pane:void 0,content:``},initialize:function(e,t){e&&(e instanceof B||_(e))?(this._latlng=V(e),p(this,t)):(p(this,e),this._source=t),this.options.content&&(this._content=this.options.content)},openOn:function(e){return e=arguments.length?e:this._source._map,e.hasLayer(this)||e.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(e){return this._map?this.close():(arguments.length?this._source=e:e=this._source,this._prepareOpen(),this.openOn(e._map)),this},onAdd:function(e){this._zoomAnimated=e._zoomAnimated,this._container||this._initLayout(),e._fadeAnimated&&Tt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),e._fadeAnimated&&Tt(this._container,1),this.bringToFront(),this.options.interactive&&(K(this._container,`leaflet-interactive`),this.addInteractiveTarget(this._container))},onRemove:function(e){e._fadeAnimated?(Tt(this._container,0),this._removeTimeout=setTimeout(i(_t,void 0,this._container),200)):_t(this._container),this.options.interactive&&(St(this._container,`leaflet-interactive`),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(e){return this._latlng=V(e),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(e){return this._content=e,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility=`hidden`,this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility=``,this._adjustPan())},getEvents:function(){var e={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&yt(this._container),this},bringToBack:function(){return this._map&&bt(this._container),this},_prepareOpen:function(e){var t=this._source;if(!t._map)return!1;if(t instanceof Qn){t=null;var n=this._source._layers;for(var r in n)if(n[r]._map){t=n[r];break}if(!t)return!1;this._source=t}if(!e)if(t.getCenter)e=t.getCenter();else if(t.getLatLng)e=t.getLatLng();else if(t.getBounds)e=t.getBounds().getCenter();else throw Error(`Unable to get source layer LatLng.`);return this.setLatLng(e),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var e=this._contentNode,t=typeof this._content==`function`?this._content(this._source||this):this._content;if(typeof t==`string`)e.innerHTML=t;else{for(;e.hasChildNodes();)e.removeChild(e.firstChild);e.appendChild(t)}this.fire(`contentupdate`)}},_updatePosition:function(){if(this._map){var e=this._map.latLngToLayerPoint(this._latlng),t=P(this.options.offset),n=this._getAnchor();this._zoomAnimated?kt(this._container,e.add(n)):t=t.add(e).add(n);var r=this._containerBottom=-t.y,i=this._containerLeft=-Math.round(this._containerWidth/2)+t.x;this._container.style.bottom=r+`px`,this._container.style.left=i+`px`}},_getAnchor:function(){return[0,0]}});J.include({_initOverlay:function(e,t,n,r){var i=t;return i instanceof e||(i=new e(r).setContent(t)),n&&i.setLatLng(n),i}}),Yn.include({_initOverlay:function(e,t,n,r){var i=n;return i instanceof e?(p(i,r),i._source=this):(i=t&&!r?t:new e(r,this),i.setContent(n)),i}});var Pr=Nr.extend({options:{pane:`popupPane`,offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:``},openOn:function(e){return e=arguments.length?e:this._source._map,!e.hasLayer(this)&&e._popup&&e._popup.options.autoClose&&e.removeLayer(e._popup),e._popup=this,Nr.prototype.openOn.call(this,e)},onAdd:function(e){Nr.prototype.onAdd.call(this,e),e.fire(`popupopen`,{popup:this}),this._source&&(this._source.fire(`popupopen`,{popup:this},!0),this._source instanceof or||this._source.on(`preclick`,Xt))},onRemove:function(e){Nr.prototype.onRemove.call(this,e),e.fire(`popupclose`,{popup:this}),this._source&&(this._source.fire(`popupclose`,{popup:this},!0),this._source instanceof or||this._source.off(`preclick`,Xt))},getEvents:function(){var e=Nr.prototype.getEvents.call(this);return(this.options.closeOnClick===void 0?this._map.options.closePopupOnClick:this.options.closeOnClick)&&(e.preclick=this.close),this.options.keepInView&&(e.moveend=this._adjustPan),e},_initLayout:function(){var e=`leaflet-popup`,t=this._container=G(`div`,e+` `+(this.options.className||``)+` leaflet-zoom-animated`),n=this._wrapper=G(`div`,e+`-content-wrapper`,t);if(this._contentNode=G(`div`,e+`-content`,n),Qt(t),Zt(this._contentNode),q(t,`contextmenu`,Xt),this._tipContainer=G(`div`,e+`-tip-container`,t),this._tip=G(`div`,e+`-tip`,this._tipContainer),this.options.closeButton){var r=this._closeButton=G(`a`,e+`-close-button`,t);r.setAttribute(`role`,`button`),r.setAttribute(`aria-label`,`Close popup`),r.href=`#close`,r.innerHTML=`<span aria-hidden="true">×</span>`,q(r,`click`,function(e){$t(e),this.close()},this)}},_updateLayout:function(){var e=this._contentNode,t=e.style;t.width=``,t.whiteSpace=`nowrap`;var n=e.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),t.width=n+1+`px`,t.whiteSpace=``,t.height=``;var r=e.offsetHeight,i=this.options.maxHeight,a=`leaflet-popup-scrolled`;i&&r>i?(t.height=i+`px`,K(e,a)):St(e,a),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),n=this._getAnchor();kt(this._container,t.add(n))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,t=parseInt(gt(this._container,`marginBottom`),10)||0,n=this._container.offsetHeight+t,r=this._containerWidth,i=new M(this._containerLeft,-n-this._containerBottom);i._add(At(this._container));var a=e.layerPointToContainerPoint(i),o=P(this.options.autoPanPadding),s=P(this.options.autoPanPaddingTopLeft||o),c=P(this.options.autoPanPaddingBottomRight||o),l=e.getSize(),u=0,d=0;a.x+r+c.x>l.x&&(u=a.x+r-l.x+c.x),a.x-u-s.x<0&&(u=a.x-s.x),a.y+n+c.y>l.y&&(d=a.y+n-l.y+c.y),a.y-d-s.y<0&&(d=a.y-s.y),(u||d)&&(this.options.keepInView&&(this._autopanning=!0),e.fire(`autopanstart`).panBy([u,d]))}},_getAnchor:function(){return P(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Fr=function(e,t){return new Pr(e,t)};J.mergeOptions({closePopupOnClick:!0}),J.include({openPopup:function(e,t,n){return this._initOverlay(Pr,e,t,n).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),Yn.include({bindPopup:function(e,t){return this._popup=this._initOverlay(Pr,this._popup,e,t),this._popupHandlersAdded||=(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),!0),this},unbindPopup:function(){return this._popup&&=(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,null),this},openPopup:function(e){return this._popup&&(this instanceof Qn||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){en(e);var t=e.layer||e.target;if(this._popup._source===t&&!(t instanceof or)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=t,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var Ir=Nr.extend({options:{pane:`tooltipPane`,offset:[0,0],direction:`auto`,permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Nr.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire(`tooltipopen`,{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire(`tooltipopen`,{tooltip:this},!0))},onRemove:function(e){Nr.prototype.onRemove.call(this,e),e.fire(`tooltipclose`,{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire(`tooltipclose`,{tooltip:this},!0))},getEvents:function(){var e=Nr.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){this._contentNode=this._container=G(`div`,`leaflet-tooltip `+(this.options.className||``)+` leaflet-zoom-`+(this._zoomAnimated?`animated`:`hide`)),this._container.setAttribute(`role`,`tooltip`),this._container.setAttribute(`id`,`leaflet-tooltip-`+o(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,n,r=this._map,i=this._container,a=r.latLngToContainerPoint(r.getCenter()),o=r.layerPointToContainerPoint(e),s=this.options.direction,c=i.offsetWidth,l=i.offsetHeight,u=P(this.options.offset),d=this._getAnchor();s===`top`?(t=c/2,n=l):s===`bottom`?(t=c/2,n=0):s===`center`?(t=c/2,n=l/2):s===`right`?(t=0,n=l/2):s===`left`?(t=c,n=l/2):o.x<a.x?(s=`right`,t=0,n=l/2):(s=`left`,t=c+(u.x+d.x)*2,n=l/2),e=e.subtract(P(t,n,!0)).add(u).add(d),St(i,`leaflet-tooltip-right`),St(i,`leaflet-tooltip-left`),St(i,`leaflet-tooltip-top`),St(i,`leaflet-tooltip-bottom`),K(i,`leaflet-tooltip-`+s),kt(i,e)},_updatePosition:function(){var e=this._map.latLngToLayerPoint(this._latlng);this._setPosition(e)},setOpacity:function(e){this.options.opacity=e,this._container&&Tt(this._container,e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);this._setPosition(t)},_getAnchor:function(){return P(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Lr=function(e,t){return new Ir(e,t)};J.include({openTooltip:function(e,t,n){return this._initOverlay(Ir,e,t,n).openOn(this),this},closeTooltip:function(e){return e.close(),this}}),Yn.include({bindTooltip:function(e,t){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Ir,this._tooltip,e,t),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&=(this._initTooltipInteractions(!0),this.closeTooltip(),null),this},_initTooltipInteractions:function(e){if(!(!e&&this._tooltipHandlersAdded)){var t=e?`off`:`on`,n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,n.click=this._openTooltip,this._map?this._addFocusListeners():n.add=this._addFocusListeners),this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),this[t](n),this._tooltipHandlersAdded=!e}},openTooltip:function(e){return this._tooltip&&(this instanceof Qn||(this._tooltip._source=this),this._tooltip._prepareOpen(e)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(e){return this._tooltip&&this._tooltip.setContent(e),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(e){var t=typeof e.getElement==`function`&&e.getElement();t&&(q(t,`focus`,function(){this._tooltip._source=e,this.openTooltip()},this),q(t,`blur`,this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(e){var t=typeof e.getElement==`function`&&e.getElement();t&&t.setAttribute(`aria-describedby`,this._tooltip._container.id)},_openTooltip:function(e){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var t=this;this._map.once(`moveend`,function(){t._openOnceFlag=!1,t._openTooltip(e)});return}this._tooltip._source=e.layer||e.target,this.openTooltip(this._tooltip.options.sticky?e.latlng:void 0)}},_moveTooltip:function(e){var t=e.latlng,n,r;this._tooltip.options.sticky&&e.originalEvent&&(n=this._map.mouseEventToContainerPoint(e.originalEvent),r=this._map.containerPointToLayerPoint(n),t=this._map.layerPointToLatLng(r)),this._tooltip.setLatLng(t)}});var Rr=er.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:`leaflet-div-icon`},createIcon:function(e){var t=e&&e.tagName===`DIV`?e:document.createElement(`div`),n=this.options;if(n.html instanceof Element?(vt(t),t.appendChild(n.html)):t.innerHTML=n.html===!1?``:n.html,n.bgPos){var r=P(n.bgPos);t.style.backgroundPosition=-r.x+`px `+-r.y+`px`}return this._setIconStyles(t,`icon`),t},createShadow:function(){return null}});function zr(e){return new Rr(e)}er.Default=nr;var Br=Yn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:U.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:`tilePane`,className:``,keepBuffer:2},initialize:function(e){p(this,e)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(e){e._addZoomLimit(this)},onRemove:function(e){this._removeAllTiles(),_t(this._container),e._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(yt(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(bt(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(e){return this.options.opacity=e,this._updateOpacity(),this},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var e=this._clampZoom(this._map.getZoom());e!==this._tileZoom&&(this._tileZoom=e,this._updateLevels()),this._update()}return this},getEvents:function(){var e={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||=s(this._onMoveEnd,this.options.updateInterval,this),e.move=this._onMove),this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},createTile:function(){return document.createElement(`div`)},getTileSize:function(){var e=this.options.tileSize;return e instanceof M?e:new M(e,e)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(e){for(var t=this.getPane().children,n=-e(-1/0,1/0),r=0,i=t.length,a;r<i;r++)a=t[r].style.zIndex,t[r]!==this._container&&a&&(n=e(n,+a));isFinite(n)&&(this.options.zIndex=n+e(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!U.ielt9){Tt(this._container,this.options.opacity);var e=+new Date,t=!1,n=!1;for(var r in this._tiles){var i=this._tiles[r];if(!(!i.current||!i.loaded)){var a=Math.min(1,(e-i.loaded)/200);Tt(i.el,a),a<1?t=!0:(i.active?n=!0:this._onOpaqueTile(i),i.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),t&&(E(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this))}},_onOpaqueTile:l,_initContainer:function(){this._container||(this._container=G(`div`,`leaflet-layer `+(this.options.className||``)),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var e=this._tileZoom,t=this.options.maxZoom;if(e!==void 0){for(var n in this._levels)n=Number(n),this._levels[n].el.children.length||n===e?(this._levels[n].el.style.zIndex=t-Math.abs(e-n),this._onUpdateLevel(n)):(_t(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var r=this._levels[e],i=this._map;return r||(r=this._levels[e]={},r.el=G(`div`,`leaflet-tile-container leaflet-zoom-animated`,this._container),r.el.style.zIndex=t,r.origin=i.project(i.unproject(i.getPixelOrigin()),e).round(),r.zoom=e,this._setZoomTransform(r,i.getCenter(),i.getZoom()),r.el.offsetWidth,this._onCreateLevel(r)),this._level=r,r}},_onUpdateLevel:l,_onRemoveLevel:l,_onCreateLevel:l,_pruneTiles:function(){if(this._map){var e,t,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom){this._removeAllTiles();return}for(e in this._tiles)t=this._tiles[e],t.retain=t.current;for(e in this._tiles)if(t=this._tiles[e],t.current&&!t.active){var r=t.coords;this._retainParent(r.x,r.y,r.z,r.z-5)||this._retainChildren(r.x,r.y,r.z,r.z+2)}for(e in this._tiles)this._tiles[e].retain||this._removeTile(e)}},_removeTilesAtZoom:function(e){for(var t in this._tiles)this._tiles[t].coords.z===e&&this._removeTile(t)},_removeAllTiles:function(){for(var e in this._tiles)this._removeTile(e)},_invalidateAll:function(){for(var e in this._levels)_t(this._levels[e].el),this._onRemoveLevel(Number(e)),delete this._levels[e];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(e,t,n,r){var i=Math.floor(e/2),a=Math.floor(t/2),o=n-1,s=new M(+i,+a);s.z=+o;var c=this._tileCoordsToKey(s),l=this._tiles[c];return l&&l.active?(l.retain=!0,!0):(l&&l.loaded&&(l.retain=!0),o>r?this._retainParent(i,a,o,r):!1)},_retainChildren:function(e,t,n,r){for(var i=2*e;i<2*e+2;i++)for(var a=2*t;a<2*t+2;a++){var o=new M(i,a);o.z=n+1;var s=this._tileCoordsToKey(o),c=this._tiles[s];if(c&&c.active){c.retain=!0;continue}else c&&c.loaded&&(c.retain=!0);n+1<r&&this._retainChildren(i,a,n+1,r)}},_resetView:function(e){var t=e&&(e.pinch||e.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),t,t)},_animateZoom:function(e){this._setView(e.center,e.zoom,!0,e.noUpdate)},_clampZoom:function(e){var t=this.options;return t.minNativeZoom!==void 0&&e<t.minNativeZoom?t.minNativeZoom:t.maxNativeZoom!==void 0&&t.maxNativeZoom<e?t.maxNativeZoom:e},_setView:function(e,t,n,r){var i=Math.round(t);i=this.options.maxZoom!==void 0&&i>this.options.maxZoom||this.options.minZoom!==void 0&&i<this.options.minZoom?void 0:this._clampZoom(i);var a=this.options.updateWhenZooming&&i!==this._tileZoom;(!r||a)&&(this._tileZoom=i,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),i!==void 0&&this._update(e),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(e,t)},_setZoomTransforms:function(e,t){for(var n in this._levels)this._setZoomTransform(this._levels[n],e,t)},_setZoomTransform:function(e,t,n){var r=this._map.getZoomScale(n,e.zoom),i=e.origin.multiplyBy(r).subtract(this._map._getNewPixelOrigin(t,n)).round();U.any3d?Ot(e.el,i,r):kt(e.el,i)},_resetGrid:function(){var e=this._map,t=e.options.crs,n=this._tileSize=this.getTileSize(),r=this._tileZoom,i=this._map.getPixelWorldBounds(this._tileZoom);i&&(this._globalTileRange=this._pxBoundsToTileRange(i)),this._wrapX=t.wrapLng&&!this.options.noWrap&&[Math.floor(e.project([0,t.wrapLng[0]],r).x/n.x),Math.ceil(e.project([0,t.wrapLng[1]],r).x/n.y)],this._wrapY=t.wrapLat&&!this.options.noWrap&&[Math.floor(e.project([t.wrapLat[0],0],r).y/n.x),Math.ceil(e.project([t.wrapLat[1],0],r).y/n.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(e){var t=this._map,n=t._animatingZoom?Math.max(t._animateToZoom,t.getZoom()):t.getZoom(),r=t.getZoomScale(n,this._tileZoom),i=t.project(e,this._tileZoom).floor(),a=t.getSize().divideBy(r*2);return new F(i.subtract(a),i.add(a))},_update:function(e){var t=this._map;if(t){var n=this._clampZoom(t.getZoom());if(e===void 0&&(e=t.getCenter()),this._tileZoom!==void 0){var r=this._getTiledPixelBounds(e),i=this._pxBoundsToTileRange(r),a=i.getCenter(),o=[],s=this.options.keepBuffer,c=new F(i.getBottomLeft().subtract([s,-s]),i.getTopRight().add([s,-s]));if(!(isFinite(i.min.x)&&isFinite(i.min.y)&&isFinite(i.max.x)&&isFinite(i.max.y)))throw Error(`Attempted to load an infinite number of tiles`);for(var l in this._tiles){var u=this._tiles[l].coords;(u.z!==this._tileZoom||!c.contains(new M(u.x,u.y)))&&(this._tiles[l].current=!1)}if(Math.abs(n-this._tileZoom)>1){this._setView(e,n);return}for(var d=i.min.y;d<=i.max.y;d++)for(var f=i.min.x;f<=i.max.x;f++){var p=new M(f,d);if(p.z=this._tileZoom,this._isValidTile(p)){var m=this._tiles[this._tileCoordsToKey(p)];m?m.current=!0:o.push(p)}}if(o.sort(function(e,t){return e.distanceTo(a)-t.distanceTo(a)}),o.length!==0){this._loading||(this._loading=!0,this.fire(`loading`));var h=document.createDocumentFragment();for(f=0;f<o.length;f++)this._addTile(o[f],h);this._level.el.appendChild(h)}}}},_isValidTile:function(e){var t=this._map.options.crs;if(!t.infinite){var n=this._globalTileRange;if(!t.wrapLng&&(e.x<n.min.x||e.x>n.max.x)||!t.wrapLat&&(e.y<n.min.y||e.y>n.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return z(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,n=this.getTileSize(),r=e.scaleBy(n),i=r.add(n);return[t.unproject(r,e.z),t.unproject(i,e.z)]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),n=new R(t[0],t[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(e){return e.x+`:`+e.y+`:`+e.z},_keyToTileCoords:function(e){var t=e.split(`:`),n=new M(+t[0],+t[1]);return n.z=+t[2],n},_removeTile:function(e){var t=this._tiles[e];t&&(_t(t.el),delete this._tiles[e],this.fire(`tileunload`,{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){K(e,`leaflet-tile`);var t=this.getTileSize();e.style.width=t.x+`px`,e.style.height=t.y+`px`,e.onselectstart=l,e.onmousemove=l,U.ielt9&&this.options.opacity<1&&Tt(e,this.options.opacity)},_addTile:function(e,t){var n=this._getTilePos(e),r=this._tileCoordsToKey(e),a=this.createTile(this._wrapCoords(e),i(this._tileReady,this,e));this._initTile(a),this.createTile.length<2&&T(i(this._tileReady,this,e,null,a)),kt(a,n),this._tiles[r]={el:a,coords:e,current:!0},t.appendChild(a),this.fire(`tileloadstart`,{tile:a,coords:e})},_tileReady:function(e,t,n){t&&this.fire(`tileerror`,{error:t,tile:n,coords:e});var r=this._tileCoordsToKey(e);n=this._tiles[r],n&&(n.loaded=+new Date,this._map._fadeAnimated?(Tt(n.el,0),E(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),t||(K(n.el,`leaflet-tile-loaded`),this.fire(`tileload`,{tile:n.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire(`load`),U.ielt9||!this._map._fadeAnimated?T(this._pruneTiles,this):setTimeout(i(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new M(this._wrapX?c(e.x,this._wrapX):e.x,this._wrapY?c(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new F(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function Vr(e){return new Br(e)}var Hr=Br.extend({options:{minZoom:0,maxZoom:18,subdomains:`abc`,errorTileUrl:``,zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,t=p(this,t),t.detectRetina&&U.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),typeof t.subdomains==`string`&&(t.subdomains=t.subdomains.split(``)),this.on(`tileunload`,this._onTileRemove)},setUrl:function(e,t){return this._url===e&&t===void 0&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var n=document.createElement(`img`);return q(n,`load`,i(this._tileOnLoad,this,t,n)),q(n,`error`,i(this._tileOnError,this,t,n)),(this.options.crossOrigin||this.options.crossOrigin===``)&&(n.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),typeof this.options.referrerPolicy==`string`&&(n.referrerPolicy=this.options.referrerPolicy),n.alt=``,n.src=this.getTileUrl(e),n},getTileUrl:function(e){var t={r:U.retina?`@2x`:``,s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var r=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=r),t[`-y`]=r}return g(this._url,n(t,this.options))},_tileOnLoad:function(e,t){U.ielt9?setTimeout(i(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,n){var r=this.options.errorTileUrl;r&&t.getAttribute(`src`)!==r&&(t.src=r),e(n,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom,n=this.options.zoomReverse,r=this.options.zoomOffset;return n&&(e=t-e),e+r},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(t=this._tiles[e].el,t.onload=l,t.onerror=l,!t.complete)){t.src=y;var n=this._tiles[e].coords;_t(t),delete this._tiles[e],this.fire(`tileabort`,{tile:t,coords:n})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute(`src`,y),Br.prototype._removeTile.call(this,e)},_tileReady:function(e,t,n){if(!(!this._map||n&&n.getAttribute(`src`)===y))return Br.prototype._tileReady.call(this,e,t,n)}});function Ur(e,t){return new Hr(e,t)}var Wr=Hr.extend({defaultWmsParams:{service:`WMS`,request:`GetMap`,layers:``,styles:``,format:`image/jpeg`,transparent:!1,version:`1.1.1`},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var r=n({},this.defaultWmsParams);for(var i in t)i in this.options||(r[i]=t[i]);t=p(this,t);var a=t.detectRetina&&U.retina?2:1,o=this.getTileSize();r.width=o.x*a,r.height=o.y*a,this.wmsParams=r},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?`crs`:`srs`;this.wmsParams[t]=this._crs.code,Hr.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),n=this._crs,r=I(n.project(t[0]),n.project(t[1])),i=r.min,a=r.max,o=(this._wmsVersion>=1.3&&this._crs===qn?[i.y,i.x,a.y,a.x]:[i.x,i.y,a.x,a.y]).join(`,`),s=Hr.prototype.getTileUrl.call(this,e);return s+m(this.wmsParams,s,this.options.uppercase)+(this.options.uppercase?`&BBOX=`:`&bbox=`)+o},setParams:function(e,t){return n(this.wmsParams,e),t||this.redraw(),this}});function Gr(e,t){return new Wr(e,t)}Hr.WMS=Wr,Ur.wms=Gr;var Kr=Yn.extend({options:{padding:.1},initialize:function(e){p(this,e),o(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),K(this._container,`leaflet-zoom-animated`)),this.getPane().appendChild(this._container),this._update(),this.on(`update`,this._updatePaths,this)},onRemove:function(){this.off(`update`,this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var n=this._map.getZoomScale(t,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),i=this._map.project(this._center,t),a=r.multiplyBy(-n).add(i).subtract(this._map._getNewPixelOrigin(e,t));U.any3d?Ot(this._container,a,n):kt(this._container,a)},_reset:function(){for(var e in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),n=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new F(n,n.add(t.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),qr=Kr.extend({options:{tolerance:0},getEvents:function(){var e=Kr.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Kr.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement(`canvas`);q(e,`mousemove`,this._onMouseMove,this),q(e,`click dblclick mousedown mouseup contextmenu`,this._onClick,this),q(e,`mouseout`,this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext(`2d`)},_destroyContainer:function(){E(this._redrawRequest),delete this._ctx,_t(this._container),Gt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;for(var t in this._redrawBounds=null,this._layers)e=this._layers[t],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Kr.prototype._update.call(this);var e=this._bounds,t=this._container,n=e.getSize(),r=U.retina?2:1;kt(t,e.min),t.width=r*n.x,t.height=r*n.y,t.style.width=n.x+`px`,t.style.height=n.y+`px`,U.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire(`update`)}},_reset:function(){Kr.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[o(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,n=t.next,r=t.prev;n?n.prev=r:this._drawLast=r,r?r.next=n:this._drawFirst=n,delete e._order,delete this._layers[o(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray==`string`){var t=e.options.dashArray.split(/[, ]+/),n=[],r,i;for(i=0;i<t.length;i++){if(r=Number(t[i]),isNaN(r))return;n.push(r)}e.options._dashArray=n}else e.options._dashArray=e.options.dashArray},_requestRedraw:function(e){this._map&&(this._extendRedrawBounds(e),this._redrawRequest=this._redrawRequest||T(this._redraw,this))},_extendRedrawBounds:function(e){if(e._pxBounds){var t=(e.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new F,this._redrawBounds.extend(e._pxBounds.min.subtract([t,t])),this._redrawBounds.extend(e._pxBounds.max.add([t,t]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var e=this._redrawBounds;if(e){var t=e.getSize();this._ctx.clearRect(e.min.x,e.min.y,t.x,t.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var e,t=this._redrawBounds;if(this._ctx.save(),t){var n=t.getSize();this._ctx.beginPath(),this._ctx.rect(t.min.x,t.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var r=this._drawFirst;r;r=r.next)e=r.layer,(!t||e._pxBounds&&e._pxBounds.intersects(t))&&e._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(e,t){if(this._drawing){var n,r,i,a,o=e._parts,s=o.length,c=this._ctx;if(s){for(c.beginPath(),n=0;n<s;n++){for(r=0,i=o[n].length;r<i;r++)a=o[n][r],c[r?`lineTo`:`moveTo`](a.x,a.y);t&&c.closePath()}this._fillStroke(c,e)}}},_updateCircle:function(e){if(!(!this._drawing||e._empty())){var t=e._point,n=this._ctx,r=Math.max(Math.round(e._radius),1),i=(Math.max(Math.round(e._radiusY),1)||r)/r;i!==1&&(n.save(),n.scale(1,i)),n.beginPath(),n.arc(t.x,t.y/i,r,0,Math.PI*2,!1),i!==1&&n.restore(),this._fillStroke(n,e)}},_fillStroke:function(e,t){var n=t.options;n.fill&&(e.globalAlpha=n.fillOpacity,e.fillStyle=n.fillColor||n.color,e.fill(n.fillRule||`evenodd`)),n.stroke&&n.weight!==0&&(e.setLineDash&&e.setLineDash(t.options&&t.options._dashArray||[]),e.globalAlpha=n.opacity,e.lineWidth=n.weight,e.strokeStyle=n.color,e.lineCap=n.lineCap,e.lineJoin=n.lineJoin,e.stroke())},_onClick:function(e){for(var t=this._map.mouseEventToLayerPoint(e),n,r,i=this._drawFirst;i;i=i.next)n=i.layer,n.options.interactive&&n._containsPoint(t)&&(!(e.type===`click`||e.type===`preclick`)||!this._map._draggableMoved(n))&&(r=n);this._fireEvent(r?[r]:!1,e)},_onMouseMove:function(e){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var t=this._map.mouseEventToLayerPoint(e);this._handleMouseHover(e,t)}},_handleMouseOut:function(e){var t=this._hoveredLayer;t&&(St(this._container,`leaflet-interactive`),this._fireEvent([t],e,`mouseout`),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(e,t){if(!this._mouseHoverThrottled){for(var n,r,a=this._drawFirst;a;a=a.next)n=a.layer,n.options.interactive&&n._containsPoint(t)&&(r=n);r!==this._hoveredLayer&&(this._handleMouseOut(e),r&&(K(this._container,`leaflet-interactive`),this._fireEvent([r],e,`mouseover`),this._hoveredLayer=r)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,e),this._mouseHoverThrottled=!0,setTimeout(i(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(e,t,n){this._map._fireDOMEvent(t,n||t.type,e)},_bringToFront:function(e){var t=e._order;if(t){var n=t.next,r=t.prev;if(n)n.prev=r;else return;r?r.next=n:n&&(this._drawFirst=n),t.prev=this._drawLast,this._drawLast.next=t,t.next=null,this._drawLast=t,this._requestRedraw(e)}},_bringToBack:function(e){var t=e._order;if(t){var n=t.next,r=t.prev;if(r)r.next=n;else return;n?n.prev=r:r&&(this._drawLast=r),t.prev=null,t.next=this._drawFirst,this._drawFirst.prev=t,this._drawFirst=t,this._requestRedraw(e)}}});function Jr(e){return U.canvas?new qr(e):null}var Yr=(function(){try{return document.namespaces.add(`lvml`,`urn:schemas-microsoft-com:vml`),function(e){return document.createElement(`<lvml:`+e+` class="lvml">`)}}catch{}return function(e){return document.createElement(`<`+e+` xmlns="urn:schemas-microsoft.com:vml" class="lvml">`)}})(),Xr={_initContainer:function(){this._container=G(`div`,`leaflet-vml-container`)},_update:function(){this._map._animatingZoom||(Kr.prototype._update.call(this),this.fire(`update`))},_initPath:function(e){var t=e._container=Yr(`shape`);K(t,`leaflet-vml-shape `+(this.options.className||``)),t.coordsize=`1 1`,e._path=Yr(`path`),t.appendChild(e._path),this._updateStyle(e),this._layers[o(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;_t(t),e.removeInteractiveTarget(t),delete this._layers[o(e)]},_updateStyle:function(e){var t=e._stroke,n=e._fill,r=e.options,i=e._container;i.stroked=!!r.stroke,i.filled=!!r.fill,r.stroke?(t||=e._stroke=Yr(`stroke`),i.appendChild(t),t.weight=r.weight+`px`,t.color=r.color,t.opacity=r.opacity,r.dashArray?t.dashStyle=_(r.dashArray)?r.dashArray.join(` `):r.dashArray.replace(/( *, *)/g,` `):t.dashStyle=``,t.endcap=r.lineCap.replace(`butt`,`flat`),t.joinstyle=r.lineJoin):t&&(i.removeChild(t),e._stroke=null),r.fill?(n||=e._fill=Yr(`fill`),i.appendChild(n),n.color=r.fillColor||r.color,n.opacity=r.fillOpacity):n&&(i.removeChild(n),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),n=Math.round(e._radius),r=Math.round(e._radiusY||n);this._setPath(e,e._empty()?`M0 0`:`AL `+t.x+`,`+t.y+` `+n+`,`+r+` 0,23592600`)},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){yt(e._container)},_bringToBack:function(e){bt(e._container)}},Zr=U.vml?Yr:ce,Qr=Kr.extend({_initContainer:function(){this._container=Zr(`svg`),this._container.setAttribute(`pointer-events`,`none`),this._rootGroup=Zr(`g`),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){_t(this._container),Gt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Kr.prototype._update.call(this);var e=this._bounds,t=e.getSize(),n=this._container;(!this._svgSize||!this._svgSize.equals(t))&&(this._svgSize=t,n.setAttribute(`width`,t.x),n.setAttribute(`height`,t.y)),kt(n,e.min),n.setAttribute(`viewBox`,[e.min.x,e.min.y,t.x,t.y].join(` `)),this.fire(`update`)}},_initPath:function(e){var t=e._path=Zr(`path`);e.options.className&&K(t,e.options.className),e.options.interactive&&K(t,`leaflet-interactive`),this._updateStyle(e),this._layers[o(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){_t(e._path),e.removeInteractiveTarget(e._path),delete this._layers[o(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,n=e.options;t&&(n.stroke?(t.setAttribute(`stroke`,n.color),t.setAttribute(`stroke-opacity`,n.opacity),t.setAttribute(`stroke-width`,n.weight),t.setAttribute(`stroke-linecap`,n.lineCap),t.setAttribute(`stroke-linejoin`,n.lineJoin),n.dashArray?t.setAttribute(`stroke-dasharray`,n.dashArray):t.removeAttribute(`stroke-dasharray`),n.dashOffset?t.setAttribute(`stroke-dashoffset`,n.dashOffset):t.removeAttribute(`stroke-dashoffset`)):t.setAttribute(`stroke`,`none`),n.fill?(t.setAttribute(`fill`,n.fillColor||n.color),t.setAttribute(`fill-opacity`,n.fillOpacity),t.setAttribute(`fill-rule`,n.fillRule||`evenodd`)):t.setAttribute(`fill`,`none`))},_updatePoly:function(e,t){this._setPath(e,le(e._parts,t))},_updateCircle:function(e){var t=e._point,n=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||n,i=`a`+n+`,`+r+` 0 1,0 `,a=e._empty()?`M0 0`:`M`+(t.x-n)+`,`+t.y+i+n*2+`,0 `+i+-n*2+`,0 `;this._setPath(e,a)},_setPath:function(e,t){e._path.setAttribute(`d`,t)},_bringToFront:function(e){yt(e._path)},_bringToBack:function(e){bt(e._path)}});U.vml&&Qr.include(Xr);function $r(e){return U.svg||U.vml?new Qr(e):null}J.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||=this._renderer=this._createRenderer(),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if(e===`overlayPane`||e===void 0)return!1;var t=this._paneRenderers[e];return t===void 0&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&Jr(e)||$r(e)}});var ei=pr.extend({initialize:function(e,t){pr.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=z(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function ti(e,t){return new ei(e,t)}Qr.create=Zr,Qr.pointsToPath=le,hr.geometryToLayer=gr,hr.coordsToLatLng=vr,hr.coordsToLatLngs=yr,hr.latLngToCoords=br,hr.latLngsToCoords=xr,hr.getFeature=Sr,hr.asFeature=Cr,J.mergeOptions({boxZoom:!0});var ni=yn.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on(`unload`,this._destroy,this)},addHooks:function(){q(this._container,`mousedown`,this._onMouseDown,this)},removeHooks:function(){Gt(this._container,`mousedown`,this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){_t(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),jt(),Ft(),this._startPoint=this._map.mouseEventToContainerPoint(e),q(document,{contextmenu:en,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=G(`div`,`leaflet-zoom-box`,this._container),K(this._container,`leaflet-crosshair`),this._map.fire(`boxzoomstart`)),this._point=this._map.mouseEventToContainerPoint(e);var t=new F(this._point,this._startPoint),n=t.getSize();kt(this._box,t.min),this._box.style.width=n.x+`px`,this._box.style.height=n.y+`px`},_finish:function(){this._moved&&(_t(this._box),St(this._container,`leaflet-crosshair`)),Mt(),It(),Gt(document,{contextmenu:en,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(i(this._resetState,this),0);var t=new R(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire(`boxzoomend`,{boxZoomBounds:t})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});J.addInitHook(`addHandler`,`boxZoom`,ni),J.mergeOptions({doubleClickZoom:!0});var ri=yn.extend({addHooks:function(){this._map.on(`dblclick`,this._onDoubleClick,this)},removeHooks:function(){this._map.off(`dblclick`,this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,n=t.getZoom(),r=t.options.zoomDelta,i=e.originalEvent.shiftKey?n-r:n+r;t.options.doubleClickZoom===`center`?t.setZoom(i):t.setZoomAround(e.containerPoint,i)}});J.addInitHook(`addHandler`,`doubleClickZoom`,ri),J.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var ii=yn.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new Sn(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on(`predrag`,this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on(`predrag`,this._onPreDragWrap,this),e.on(`zoomend`,this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}K(this._map._container,`leaflet-grab leaflet-touch-drag`),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){St(this._map._container,`leaflet-grab`),St(this._map._container,`leaflet-touch-drag`),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=z(this._map.options.maxBounds);this._offsetLimit=I(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire(`movestart`).fire(`dragstart`),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(t),this._prunePositions(t)}this._map.fire(`move`,e).fire(`drag`,e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2);this._initialWorldOffset=this._map.latLngToLayerPoint([0,0]).subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.x<t.min.x&&(e.x=this._viscousLimit(e.x,t.min.x)),e.y<t.min.y&&(e.y=this._viscousLimit(e.y,t.min.y)),e.x>t.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),n=this._initialWorldOffset,r=this._draggable._newPos.x,i=(r-t+n)%e+t-n,a=(r+t+n)%e-t-n,o=Math.abs(i+n)<Math.abs(a+n)?i:a;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=o},_onDragEnd:function(e){var t=this._map,n=t.options,r=!n.inertia||e.noInertia||this._times.length<2;if(t.fire(`dragend`,e),r)t.fire(`moveend`);else{this._prunePositions(+new Date);var i=this._lastPos.subtract(this._positions[0]),a=(this._lastTime-this._times[0])/1e3,o=n.easeLinearity,s=i.multiplyBy(o/a),c=s.distanceTo([0,0]),l=Math.min(n.inertiaMaxSpeed,c),u=s.multiplyBy(l/c),d=l/(n.inertiaDeceleration*o),f=u.multiplyBy(-d/2).round();!f.x&&!f.y?t.fire(`moveend`):(f=t._limitOffset(f,t.options.maxBounds),T(function(){t.panBy(f,{duration:d,easeLinearity:o,noMoveStart:!0,animate:!0})}))}}});J.addInitHook(`addHandler`,`dragging`,ii),J.mergeOptions({keyboard:!0,keyboardPanDelta:80});var ai=yn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(e){this._map=e,this._setPanDelta(e.options.keyboardPanDelta),this._setZoomDelta(e.options.zoomDelta)},addHooks:function(){var e=this._map._container;e.tabIndex<=0&&(e.tabIndex=`0`),q(e,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Gt(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var e=document.body,t=document.documentElement,n=e.scrollTop||t.scrollTop,r=e.scrollLeft||t.scrollLeft;this._map._container.focus(),window.scrollTo(r,n)}},_onFocus:function(){this._focused=!0,this._map.fire(`focus`)},_onBlur:function(){this._focused=!1,this._map.fire(`blur`)},_setPanDelta:function(e){var t=this._panKeys={},n=this.keyCodes,r,i;for(r=0,i=n.left.length;r<i;r++)t[n.left[r]]=[-1*e,0];for(r=0,i=n.right.length;r<i;r++)t[n.right[r]]=[e,0];for(r=0,i=n.down.length;r<i;r++)t[n.down[r]]=[0,e];for(r=0,i=n.up.length;r<i;r++)t[n.up[r]]=[0,-1*e]},_setZoomDelta:function(e){var t=this._zoomKeys={},n=this.keyCodes,r,i;for(r=0,i=n.zoomIn.length;r<i;r++)t[n.zoomIn[r]]=e;for(r=0,i=n.zoomOut.length;r<i;r++)t[n.zoomOut[r]]=-e},_addHooks:function(){q(document,`keydown`,this._onKeyDown,this)},_removeHooks:function(){Gt(document,`keydown`,this._onKeyDown,this)},_onKeyDown:function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var t=e.keyCode,n=this._map,r;if(t in this._panKeys){if(!n._panAnim||!n._panAnim._inProgress)if(r=this._panKeys[t],e.shiftKey&&(r=P(r).multiplyBy(3)),n.options.maxBounds&&(r=n._limitOffset(P(r),n.options.maxBounds)),n.options.worldCopyJump){var i=n.wrapLatLng(n.unproject(n.project(n.getCenter()).add(r)));n.panTo(i)}else n.panBy(r)}else if(t in this._zoomKeys)n.setZoom(n.getZoom()+(e.shiftKey?3:1)*this._zoomKeys[t]);else if(t===27&&n._popup&&n._popup.options.closeOnEscapeKey)n.closePopup();else return;en(e)}}});J.addInitHook(`addHandler`,`keyboard`,ai),J.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var oi=yn.extend({addHooks:function(){q(this._map._container,`wheel`,this._onWheelScroll,this),this._delta=0},removeHooks:function(){Gt(this._map._container,`wheel`,this._onWheelScroll,this)},_onWheelScroll:function(e){var t=an(e),n=this._map.options.wheelDebounceTime;this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._startTime||=+new Date;var r=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(i(this._performZoom,this),r),en(e)},_performZoom:function(){var e=this._map,t=e.getZoom(),n=this._map.options.zoomSnap||0;e._stop();var r=this._delta/(this._map.options.wheelPxPerZoomLevel*4),i=4*Math.log(2/(1+Math.exp(-Math.abs(r))))/Math.LN2,a=n?Math.ceil(i/n)*n:i,o=e._limitZoom(t+(this._delta>0?a:-a))-t;this._delta=0,this._startTime=null,o&&(e.options.scrollWheelZoom===`center`?e.setZoom(t+o):e.setZoomAround(this._lastMousePos,t+o))}});J.addInitHook(`addHandler`,`scrollWheelZoom`,oi);var si=600;J.mergeOptions({tapHold:U.touchNative&&U.safari&&U.mobile,tapTolerance:15});var ci=yn.extend({addHooks:function(){q(this._map._container,`touchstart`,this._onDown,this)},removeHooks:function(){Gt(this._map._container,`touchstart`,this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var t=e.touches[0];this._startPos=this._newPos=new M(t.clientX,t.clientY),this._holdTimeout=setTimeout(i(function(){this._cancel(),this._isTapValid()&&(q(document,`touchend`,$t),q(document,`touchend touchcancel`,this._cancelClickPrevent),this._simulateEvent(`contextmenu`,t))},this),si),q(document,`touchend touchcancel contextmenu`,this._cancel,this),q(document,`touchmove`,this._onMove,this)}},_cancelClickPrevent:function e(){Gt(document,`touchend`,$t),Gt(document,`touchend touchcancel`,e)},_cancel:function(){clearTimeout(this._holdTimeout),Gt(document,`touchend touchcancel contextmenu`,this._cancel,this),Gt(document,`touchmove`,this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new M(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var n=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});n._simulated=!0,t.target.dispatchEvent(n)}});J.addInitHook(`addHandler`,`tapHold`,ci),J.mergeOptions({touchZoom:U.touch,bounceAtZoomLimits:!0});var li=yn.extend({addHooks:function(){K(this._map._container,`leaflet-touch-zoom`),q(this._map._container,`touchstart`,this._onTouchStart,this)},removeHooks:function(){St(this._map._container,`leaflet-touch-zoom`),Gt(this._map._container,`touchstart`,this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(!(!e.touches||e.touches.length!==2||t._animatingZoom||this._zooming)){var n=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),t.options.touchZoom!==`center`&&(this._pinchStartLatLng=t.containerPointToLatLng(n.add(r)._divideBy(2))),this._startDist=n.distanceTo(r),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),q(document,`touchmove`,this._onTouchMove,this),q(document,`touchend touchcancel`,this._onTouchEnd,this),$t(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var t=this._map,n=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]),a=n.distanceTo(r)/this._startDist;if(this._zoom=t.getScaleZoom(a,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoom<t.getMinZoom()&&a<1||this._zoom>t.getMaxZoom()&&a>1)&&(this._zoom=t._limitZoom(this._zoom)),t.options.touchZoom===`center`){if(this._center=this._startLatLng,a===1)return}else{var o=n._add(r)._divideBy(2)._subtract(this._centerPoint);if(a===1&&o.x===0&&o.y===0)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(o),this._zoom)}this._moved||=(t._moveStart(!0,!1),!0),E(this._animRequest),this._animRequest=T(i(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0),this,!0),$t(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,E(this._animRequest),Gt(document,`touchmove`,this._onTouchMove,this),Gt(document,`touchend touchcancel`,this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});J.addInitHook(`addHandler`,`touchZoom`,li),J.BoxZoom=ni,J.DoubleClickZoom=ri,J.Drag=ii,J.Keyboard=ai,J.ScrollWheelZoom=oi,J.TapHold=ci,J.TouchZoom=li,e.Bounds=F,e.Browser=U,e.CRS=ee,e.Canvas=qr,e.Circle=lr,e.CircleMarker=sr,e.Class=O,e.Control=un,e.DivIcon=Rr,e.DivOverlay=Nr,e.DomEvent=sn,e.DomUtil=Ut,e.Draggable=Sn,e.Evented=j,e.FeatureGroup=Qn,e.GeoJSON=hr,e.GridLayer=Br,e.Handler=yn,e.Icon=er,e.ImageOverlay=Dr,e.LatLng=B,e.LatLngBounds=R,e.Layer=Yn,e.LayerGroup=Xn,e.LineUtil=Hn,e.Map=J,e.Marker=ir,e.Mixin=bn,e.Path=or,e.Point=M,e.PolyUtil=En,e.Polygon=pr,e.Polyline=dr,e.Popup=Pr,e.PosAnimation=cn,e.Projection=Gn,e.Rectangle=ei,e.Renderer=Kr,e.SVG=Qr,e.SVGOverlay=jr,e.TileLayer=Hr,e.Tooltip=Ir,e.Transformation=ie,e.Util=D,e.VideoOverlay=kr,e.bind=i,e.bounds=I,e.canvas=Jr,e.circle=ur,e.circleMarker=cr,e.control=dn,e.divIcon=zr,e.extend=n,e.featureGroup=$n,e.geoJSON=Tr,e.geoJson=Er,e.gridLayer=Vr,e.icon=tr,e.imageOverlay=Or,e.latLng=V,e.latLngBounds=z,e.layerGroup=Zn,e.map=ln,e.marker=ar,e.point=P,e.polygon=mr,e.polyline=fr,e.popup=Fr,e.rectangle=ti,e.setOptions=p,e.stamp=o,e.svg=$r,e.svgOverlay=Mr,e.tileLayer=Ur,e.tooltip=Lr,e.transformation=ae,e.version=t,e.videoOverlay=Ar;var ui=window.L;e.noConflict=function(){return window.L=ui,this},window.L=e}))})),Md=o(((e,t)=>{((n,r)=>{typeof define==`function`&&define.amd?define([`leaflet`],n):typeof e==`object`&&(t.exports=n(jd())),r!==void 0&&r.L&&n(r.L)})(e=>{e.Editable=e.Evented.extend({statics:{FORWARD:1,BACKWARD:-1},options:{zIndex:1e3,polygonClass:e.Polygon,polylineClass:e.Polyline,markerClass:e.Marker,circleMarkerClass:e.CircleMarker,rectangleClass:e.Rectangle,circleClass:e.Circle,drawingCSSClass:`leaflet-editable-drawing`,drawingCursor:`crosshair`,editLayer:void 0,featuresLayer:void 0,polylineEditorClass:void 0,polygonEditorClass:void 0,markerEditorClass:void 0,circleMarkerEditorClass:void 0,rectangleEditorClass:void 0,circleEditorClass:void 0,lineGuideOptions:{},skipMiddleMarkers:!1},initialize:function(t,n){e.setOptions(this,n),this._lastZIndex=this.options.zIndex,this.map=t,this.editLayer=this.createEditLayer(),this.featuresLayer=this.createFeaturesLayer(),this.forwardLineGuide=this.createLineGuide(),this.backwardLineGuide=this.createLineGuide()},fireAndForward:function(e,t){t||={},t.editTools=this,this.fire(e,t),this.map.fire(e,t)},createLineGuide:function(){let t=e.extend({dashArray:`5,10`,weight:1,interactive:!1},this.options.lineGuideOptions);return e.polyline([],t)},createVertexIcon:t=>e.Browser.mobile&&e.Browser.touch?new e.Editable.TouchVertexIcon(t):new e.Editable.VertexIcon(t),createEditLayer:function(){return this.options.editLayer||new e.LayerGroup().addTo(this.map)},createFeaturesLayer:function(){return this.options.featuresLayer||new e.LayerGroup().addTo(this.map)},moveForwardLineGuide:function(e){this.forwardLineGuide._latlngs.length&&(this.forwardLineGuide._latlngs[1]=e,this.forwardLineGuide._bounds.extend(e),this.forwardLineGuide.redraw())},moveBackwardLineGuide:function(e){this.backwardLineGuide._latlngs.length&&(this.backwardLineGuide._latlngs[1]=e,this.backwardLineGuide._bounds.extend(e),this.backwardLineGuide.redraw())},anchorForwardLineGuide:function(e){this.forwardLineGuide._latlngs[0]=e,this.forwardLineGuide._bounds.extend(e),this.forwardLineGuide.redraw()},anchorBackwardLineGuide:function(e){this.backwardLineGuide._latlngs[0]=e,this.backwardLineGuide._bounds.extend(e),this.backwardLineGuide.redraw()},attachForwardLineGuide:function(){this.editLayer.addLayer(this.forwardLineGuide)},attachBackwardLineGuide:function(){this.editLayer.addLayer(this.backwardLineGuide)},detachForwardLineGuide:function(){this.forwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.forwardLineGuide)},detachBackwardLineGuide:function(){this.backwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.backwardLineGuide)},blockEvents:function(){this._oldTargets||(this._oldTargets=this.map._targets,this.map._targets={})},unblockEvents:function(){this._oldTargets&&(this.map._targets=e.extend(this.map._targets,this._oldTargets),delete this._oldTargets)},registerForDrawing:function(t){this._drawingEditor&&this.unregisterForDrawing(this._drawingEditor),this.blockEvents(),t.reset(),this._drawingEditor=t,this.map.on(`mousemove touchmove`,t.onDrawingMouseMove,t),this.map.on(`mousedown`,this.onMousedown,this),this.map.on(`mouseup`,this.onMouseup,this),e.DomUtil.addClass(this.map._container,this.options.drawingCSSClass),this.defaultMapCursor=this.map._container.style.cursor,this.map._container.style.cursor=this.options.drawingCursor},unregisterForDrawing:function(t){this.unblockEvents(),e.DomUtil.removeClass(this.map._container,this.options.drawingCSSClass),this.map._container.style.cursor=this.defaultMapCursor,t||=this._drawingEditor,t&&(this.map.off(`mousemove touchmove`,t.onDrawingMouseMove,t),this.map.off(`mousedown`,this.onMousedown,this),this.map.off(`mouseup`,this.onMouseup,this),t===this._drawingEditor&&(delete this._drawingEditor,t._drawing&&t.cancelDrawing()))},onMousedown:function(e){e.originalEvent.which==1&&(this._mouseDown=e,this._drawingEditor.onDrawingMouseDown(e))},onMouseup:function(t){if(this._mouseDown){let n=this._drawingEditor,r=this._mouseDown;if(this._mouseDown=null,n.onDrawingMouseUp(t),this._drawingEditor!==n)return;let i=e.point(r.originalEvent.clientX,r.originalEvent.clientY),a=e.point(t.originalEvent.clientX,t.originalEvent.clientY).distanceTo(i);Math.abs(a)<9*(window.devicePixelRatio||1)&&this._drawingEditor.onDrawingClick(t)}},drawing:function(){return this._drawingEditor?.drawing()},stopDrawing:function(){this.unregisterForDrawing()},commitDrawing:function(e){this._drawingEditor&&this._drawingEditor.commitDrawing(e)},connectCreatedToMap:function(e){return this.featuresLayer.addLayer(e)},startPolyline:function(e,t){let n=this.createPolyline([],t);return n.enableEdit(this.map).newShape(e),n},startPolygon:function(e,t){let n=this.createPolygon([],t);return n.enableEdit(this.map).newShape(e),n},startMarker:function(e,t){e||=this.map.getCenter().clone();let n=this.createMarker(e,t);return n.enableEdit(this.map).startDrawing(),n},startCircleMarker:function(e,t){e||=this.map.getCenter().clone();let n=this.createCircleMarker(e,t);return n.enableEdit(this.map).startDrawing(),n},startRectangle:function(t,n){let r=t||e.latLng([0,0]),i=new e.LatLngBounds(r,r),a=this.createRectangle(i,n);return a.enableEdit(this.map).startDrawing(),a},startCircle:function(e,t){e||=this.map.getCenter().clone();let n=this.createCircle(e,t);return n.enableEdit(this.map).startDrawing(),n},startHole:(e,t)=>{e.newHole(t)},createLayer:function(t,n,r){r=e.Util.extend({editOptions:{editTools:this}},r);let i=new t(n,r);return this.fireAndForward(`editable:created`,{layer:i}),i},createPolyline:function(e,t){return this.createLayer(t?.polylineClass||this.options.polylineClass,e,t)},createPolygon:function(e,t){return this.createLayer(t?.polygonClass||this.options.polygonClass,e,t)},createMarker:function(e,t){return this.createLayer(t?.markerClass||this.options.markerClass,e,t)},createCircleMarker:function(e,t){return this.createLayer(t?.circleMarkerClass||this.options.circleMarkerClass,e,t)},createRectangle:function(e,t){return this.createLayer(t?.rectangleClass||this.options.rectangleClass,e,t)},createCircle:function(e,t){return this.createLayer(t?.circleClass||this.options.circleClass,e,t)}}),e.extend(e.Editable,{makeCancellable:e=>{e.cancel=()=>{e._cancelled=!0}}}),e.Map.mergeOptions({editToolsClass:e.Editable,editable:!1,editOptions:{}}),e.Map.addInitHook(function(){this.whenReady(function(){this.options.editable&&(this.editTools=new this.options.editToolsClass(this,this.options.editOptions))})}),e.Editable.VertexIcon=e.DivIcon.extend({options:{iconSize:new e.Point(8,8)}}),e.Editable.TouchVertexIcon=e.Editable.VertexIcon.extend({options:{iconSize:new e.Point(20,20)}}),e.Editable.VertexMarker=e.Marker.extend({options:{draggable:!0,className:`leaflet-div-icon leaflet-vertex-icon`},initialize:function(t,n,r,i){this.latlng=t,this.latlngs=n,this.editor=r,e.Marker.prototype.initialize.call(this,t,i),this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.latlng.__vertex=this,this.connect(),this.setZIndexOffset(r.tools._lastZIndex+1)},connect:function(){this.editor.editLayer.addLayer(this)},onAdd:function(t){e.Marker.prototype.onAdd.call(this,t),this.on(`drag`,this.onDrag),this.on(`dragstart`,this.onDragStart),this.on(`dragend`,this.onDragEnd),this.on(`mouseup`,this.onMouseup),this.on(`click`,this.onClick),this.on(`contextmenu`,this.onContextMenu),this.on(`mousedown touchstart`,this.onMouseDown),this.on(`mouseover`,this.onMouseOver),this.on(`mouseout`,this.onMouseOut),this.addMiddleMarkers()},onRemove:function(t){this.middleMarker&&this.middleMarker.delete(),delete this.latlng.__vertex,this.off(`drag`,this.onDrag),this.off(`dragstart`,this.onDragStart),this.off(`dragend`,this.onDragEnd),this.off(`mouseup`,this.onMouseup),this.off(`click`,this.onClick),this.off(`contextmenu`,this.onContextMenu),this.off(`mousedown touchstart`,this.onMouseDown),this.off(`mouseover`,this.onMouseOver),this.off(`mouseout`,this.onMouseOut),e.Marker.prototype.onRemove.call(this,t)},onDrag:function(t){t.vertex=this,this.editor.onVertexMarkerDrag(t);let n=e.DomUtil.getPosition(this._icon),r=this._map.layerPointToLatLng(n);this.latlng.update(r),this._latlng=this.latlng,this.editor.refresh(),this.middleMarker&&this.middleMarker.updateLatLng();let i=this.getNext();i?.middleMarker&&i.middleMarker.updateLatLng()},onDragStart:function(e){e.vertex=this,this.editor.onVertexMarkerDragStart(e)},onDragEnd:function(e){e.vertex=this,this.editor.onVertexMarkerDragEnd(e)},onClick:function(e){e.vertex=this,this.editor.onVertexMarkerClick(e)},onMouseup:function(t){e.DomEvent.stop(t),t.vertex=this,this.editor.map.fire(`mouseup`,t)},onContextMenu:function(e){e.vertex=this,this.editor.onVertexMarkerContextMenu(e)},onMouseDown:function(e){e.vertex=this,this.editor.onVertexMarkerMouseDown(e)},onMouseOver:function(e){e.vertex=this,this.editor.onVertexMarkerMouseOver(e)},onMouseOut:function(e){e.vertex=this,this.editor.onVertexMarkerMouseOut(e)},delete:function(){let e=this.getNext();this.latlngs.splice(this.getIndex(),1),this.editor.editLayer.removeLayer(this),this.editor.onVertexDeleted({latlng:this.latlng,vertex:this}),this.latlngs.length||this.editor.deleteShape(this.latlngs),e&&e.resetMiddleMarker(),this.editor.refresh()},getIndex:function(){return this.latlngs.indexOf(this.latlng)},getLastIndex:function(){return this.latlngs.length-1},getPrevious:function(){if(this.latlngs.length<2)return;let e=this.getIndex(),t=e-1;e===0&&this.editor.CLOSED&&(t=this.getLastIndex());let n=this.latlngs[t];if(n)return n.__vertex},getNext:function(){if(this.latlngs.length<2)return;let e=this.getIndex(),t=e+1;e===this.getLastIndex()&&this.editor.CLOSED&&(t=0);let n=this.latlngs[t];if(n)return n.__vertex},addMiddleMarker:function(e){this.editor.hasMiddleMarkers()&&(e||=this.getPrevious(),e&&!this.middleMarker&&(this.middleMarker=this.editor.addMiddleMarker(e,this,this.latlngs,this.editor)))},addMiddleMarkers:function(){if(!this.editor.hasMiddleMarkers())return;let e=this.getPrevious();e&&this.addMiddleMarker(e);let t=this.getNext();t&&t.resetMiddleMarker()},resetMiddleMarker:function(){this.middleMarker&&this.middleMarker.delete(),this.addMiddleMarker()},split:function(){this.editor.splitShape&&this.editor.splitShape(this.latlngs,this.getIndex())},continue:function(){if(!this.editor.continueBackward)return;let e=this.getIndex();e===0?this.editor.continueBackward(this.latlngs):e===this.getLastIndex()&&this.editor.continueForward(this.latlngs)}}),e.Editable.mergeOptions({vertexMarkerClass:e.Editable.VertexMarker}),e.Editable.MiddleMarker=e.Marker.extend({options:{opacity:.5,className:`leaflet-div-icon leaflet-middle-icon`,draggable:!0},initialize:function(t,n,r,i,a){this.left=t,this.right=n,this.editor=i,this.latlngs=r,e.Marker.prototype.initialize.call(this,this.computeLatLng(),a),this._opacity=this.options.opacity,this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.editor.editLayer.addLayer(this),this.setVisibility()},setVisibility:function(){let t=this._map.latLngToContainerPoint(this.left.latlng),n=this._map.latLngToContainerPoint(this.right.latlng),r=e.point(this.options.icon.options.iconSize);t.distanceTo(n)<r.x*3?this.hide():this.show()},show:function(){this.setOpacity(this._opacity)},hide:function(){this.setOpacity(0)},updateLatLng:function(){this.setLatLng(this.computeLatLng()),this.setVisibility()},computeLatLng:function(){let e=this.editor.map.latLngToContainerPoint(this.left.latlng),t=this.editor.map.latLngToContainerPoint(this.right.latlng),n=(e.y+t.y)/2,r=(e.x+t.x)/2;return this.editor.map.containerPointToLatLng([r,n])},onAdd:function(t){e.Marker.prototype.onAdd.call(this,t),e.DomEvent.on(this._icon,`mousedown touchstart`,this.onMouseDown,this),t.on(`zoomend`,this.setVisibility,this)},onRemove:function(t){delete this.right.middleMarker,e.DomEvent.off(this._icon,`mousedown touchstart`,this.onMouseDown,this),t.off(`zoomend`,this.setVisibility,this),e.Marker.prototype.onRemove.call(this,t)},onMouseDown:function(t){let n=e.DomUtil.getPosition(this._icon),r=this.editor.map.layerPointToLatLng(n);if(t={originalEvent:t,latlng:r},this.options.opacity===0||(e.Editable.makeCancellable(t),this.editor.onMiddleMarkerMouseDown(t),t._cancelled))return;this.latlngs.splice(this.index(),0,t.latlng),this.editor.refresh();let i=this._icon,a=this.editor.addVertexMarker(t.latlng,this.latlngs);this.editor.onNewVertex(a);let o=a._icon.parentNode;o.removeChild(a._icon),a._icon=i,o.appendChild(a._icon),a._initIcon(),a._initInteraction(),a.setOpacity(1),e.Draggable._dragging=!1,a.dragging._draggable._onDown(t.originalEvent),this.delete()},delete:function(){this.editor.editLayer.removeLayer(this)},index:function(){return this.latlngs.indexOf(this.right.latlng)}}),e.Editable.mergeOptions({middleMarkerClass:e.Editable.MiddleMarker}),e.Editable.BaseEditor=e.Handler.extend({initialize:function(t,n,r){e.setOptions(this,r),this.map=t,this.feature=n,this.feature.editor=this,this.editLayer=new e.LayerGroup,this.tools=this.options.editTools||t.editTools},addHooks:function(){this.isConnected()?this.onFeatureAdd():this.feature.once(`add`,this.onFeatureAdd,this),this.onEnable(),this.feature.on(this._getEvents(),this)},removeHooks:function(){this.feature.off(this._getEvents(),this),this.feature.dragging&&this.feature.dragging.disable(),this.editLayer.clearLayers(),this.tools.editLayer.removeLayer(this.editLayer),this.onDisable(),this._drawing&&this.cancelDrawing()},drawing:function(){return!!this._drawing},reset:()=>{},onFeatureAdd:function(){this.tools.editLayer.addLayer(this.editLayer),this.feature.dragging&&this.options.draggable!=0&&this.feature.dragging.enable()},hasMiddleMarkers:function(){return!this.options.skipMiddleMarkers&&!this.tools.options.skipMiddleMarkers},fireAndForward:function(e,t){t||={},t.layer=this.feature,this.feature.fire(e,t),this.tools.fireAndForward(e,t)},onEnable:function(){this.fireAndForward(`editable:enable`)},onDisable:function(){this.fireAndForward(`editable:disable`)},onEditing:function(){this.fireAndForward(`editable:editing`)},onEdited:function(){this.fireAndForward(`editable:edited`)},onStartDrawing:function(){this.fireAndForward(`editable:drawing:start`)},onEndDrawing:function(){this.fireAndForward(`editable:drawing:end`)},onCancelDrawing:function(){this.fireAndForward(`editable:drawing:cancel`)},onCommitDrawing:function(e){this.fireAndForward(`editable:drawing:commit`,e),this.onEdited()},onDrawingMouseDown:function(e){this.fireAndForward(`editable:drawing:mousedown`,e)},onDrawingMouseUp:function(e){this.fireAndForward(`editable:drawing:mouseup`,e)},startDrawing:function(){this._drawing||=e.Editable.FORWARD,this.tools.registerForDrawing(this),this.onStartDrawing()},commitDrawing:function(e){this.onCommitDrawing(e),this.endDrawing()},cancelDrawing:function(){e.Draggable._dragging=!1,this.onCancelDrawing(),this.endDrawing()},endDrawing:function(){this._drawing=!1,this.tools.unregisterForDrawing(this),this.onEndDrawing()},onDrawingClick:function(t){this.drawing()&&(e.Editable.makeCancellable(t),this.fireAndForward(`editable:drawing:click`,t),!t._cancelled&&(this.isConnected()||this.connect(t),this.processDrawingClick(t)))},isConnected:function(){return this.map.hasLayer(this.feature)},connect:function(){this.tools.connectCreatedToMap(this.feature),this.tools.editLayer.addLayer(this.editLayer)},onMove:function(e){this.fireAndForward(`editable:drawing:move`,e)},onDrawingMouseMove:function(e){this.onMove(e)},_getEvents:function(){return{dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd,remove:this.disable}},onDragStart:function(e){this.onEditing(),this.fireAndForward(`editable:dragstart`,e)},onDrag:function(e){this.onMove(e),this.fireAndForward(`editable:drag`,e)},onDragEnd:function(e){this.fireAndForward(`editable:dragend`,e),this.onEdited()}}),e.Editable.MarkerEditor=e.Editable.BaseEditor.extend({onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&this.feature.setLatLng(t.latlng)},processDrawingClick:function(e){this.fireAndForward(`editable:drawing:clicked`,e),this.commitDrawing(e)},connect:function(t){t&&(this.feature._latlng=t.latlng),e.Editable.BaseEditor.prototype.connect.call(this,t)}}),e.Editable.CircleMarkerEditor=e.Editable.BaseEditor.extend({onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&this.feature.setLatLng(t.latlng)},processDrawingClick:function(e){this.fireAndForward(`editable:drawing:clicked`,e),this.commitDrawing(e)},connect:function(t){t&&(this.feature._latlng=t.latlng),e.Editable.BaseEditor.prototype.connect.call(this,t)}}),e.Editable.PathEditor=e.Editable.BaseEditor.extend({CLOSED:!1,MIN_VERTEX:2,addHooks:function(){return e.Editable.BaseEditor.prototype.addHooks.call(this),this.feature&&(this.initVertexMarkers(),this.map.on(`moveend`,this.onMoveEnd,this)),this},removeHooks:function(){e.Editable.BaseEditor.prototype.removeHooks.call(this),this.feature&&this.map.off(`moveend`,this.onMoveEnd,this)},onMoveEnd:function(){this.initVertexMarkers()},initVertexMarkers:function(e){if(this.enabled())if(e||=this.getLatLngs(),l(e))this.addVertexMarkers(e);else for(let t of e)this.initVertexMarkers(t)},getLatLngs:function(){return this.feature.getLatLngs()},reset:function(){this.editLayer.clearLayers(),this.initVertexMarkers()},addVertexMarker:function(e,t){return e.__vertex?(e.__vertex.connect(),e.__vertex):new this.tools.options.vertexMarkerClass(e,t,this)},onNewVertex:function(e){this.fireAndForward(`editable:vertex:new`,{latlng:e.latlng,vertex:e})},addVertexMarkers:function(e){let t=this.map.getBounds();for(let n of e)t.contains(n)&&this.addVertexMarker(n,e)},refreshVertexMarkers:function(e){e||=this.getDefaultLatLngs();for(let t of e)t.__vertex.update()},addMiddleMarker:function(e,t,n){return new this.tools.options.middleMarkerClass(e,t,n,this)},onVertexMarkerClick:function(t){if(e.Editable.makeCancellable(t),this.fireAndForward(`editable:vertex:click`,t),t._cancelled||this.tools.drawing()&&this.tools._drawingEditor!==this)return;let n=t.vertex.getIndex(),r;t.originalEvent.ctrlKey?this.onVertexMarkerCtrlClick(t):t.originalEvent.altKey?this.onVertexMarkerAltClick(t):t.originalEvent.shiftKey?this.onVertexMarkerShiftClick(t):t.originalEvent.metaKey?this.onVertexMarkerMetaKeyClick(t):n===t.vertex.getLastIndex()&&this._drawing===e.Editable.FORWARD?n>=this.MIN_VERTEX-1&&(r=!0):n===0&&this._drawing===e.Editable.BACKWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX||n===0&&this._drawing===e.Editable.FORWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX&&this.CLOSED?r=!0:this.onVertexRawMarkerClick(t),this.fireAndForward(`editable:vertex:clicked`,t),r&&this.commitDrawing(t)},onVertexRawMarkerClick:function(e){this.fireAndForward(`editable:vertex:rawclick`,e),!e._cancelled&&this.vertexCanBeDeleted(e.vertex)&&e.vertex.delete()},vertexCanBeDeleted:function(e){return e.latlngs.length>this.MIN_VERTEX},onVertexDeleted:function(e){this.fireAndForward(`editable:vertex:deleted`,e),this.onEdited()},onVertexMarkerCtrlClick:function(e){this.fireAndForward(`editable:vertex:ctrlclick`,e)},onVertexMarkerShiftClick:function(e){this.fireAndForward(`editable:vertex:shiftclick`,e)},onVertexMarkerMetaKeyClick:function(e){this.fireAndForward(`editable:vertex:metakeyclick`,e)},onVertexMarkerAltClick:function(e){this.fireAndForward(`editable:vertex:altclick`,e)},onVertexMarkerContextMenu:function(e){this.fireAndForward(`editable:vertex:contextmenu`,e)},onVertexMarkerMouseDown:function(e){this.fireAndForward(`editable:vertex:mousedown`,e)},onVertexMarkerMouseOver:function(e){this.fireAndForward(`editable:vertex:mouseover`,e)},onVertexMarkerMouseOut:function(e){this.fireAndForward(`editable:vertex:mouseout`,e)},onMiddleMarkerMouseDown:function(e){this.fireAndForward(`editable:middlemarker:mousedown`,e)},onVertexMarkerDrag:function(e){this.onMove(e),this.feature._bounds&&this.extendBounds(e),this.fireAndForward(`editable:vertex:drag`,e)},onVertexMarkerDragStart:function(e){this.fireAndForward(`editable:vertex:dragstart`,e)},onVertexMarkerDragEnd:function(e){this.fireAndForward(`editable:vertex:dragend`,e),this.onEdited()},setDrawnLatLngs:function(e){this._drawnLatLngs=e||this.getDefaultLatLngs()},startDrawing:function(){this._drawnLatLngs||this.setDrawnLatLngs(),e.Editable.BaseEditor.prototype.startDrawing.call(this)},startDrawingForward:function(){this.startDrawing()},endDrawing:function(){this.tools.detachForwardLineGuide(),this.tools.detachBackwardLineGuide(),this._drawnLatLngs&&this._drawnLatLngs.length<this.MIN_VERTEX&&this.deleteShape(this._drawnLatLngs),e.Editable.BaseEditor.prototype.endDrawing.call(this),delete this._drawnLatLngs},addLatLng:function(t){this._drawing===e.Editable.FORWARD?this._drawnLatLngs.push(t):this._drawnLatLngs.unshift(t),this.feature._bounds.extend(t);let n=this.addVertexMarker(t,this._drawnLatLngs);this.onNewVertex(n),this.refresh()},newPointForward:function(e){this.addLatLng(e),this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(e)},newPointBackward:function(e){this.addLatLng(e),this.tools.anchorBackwardLineGuide(e)},push:function(t){if(!t)return console.error(`L.Editable.PathEditor.push expect a valid latlng as parameter`);this._drawing===e.Editable.FORWARD?this.newPointForward(t):this.newPointBackward(t)},removeLatLng:function(e){e.__vertex.delete(),this.refresh()},pop:function(){if(this._drawnLatLngs.length<=1)return;let t;return t=this._drawing===e.Editable.FORWARD?this._drawnLatLngs[this._drawnLatLngs.length-1]:this._drawnLatLngs[0],this.removeLatLng(t),this._drawing===e.Editable.FORWARD?this.tools.anchorForwardLineGuide(this._drawnLatLngs[this._drawnLatLngs.length-1]):this.tools.anchorForwardLineGuide(this._drawnLatLngs[0]),t},processDrawingClick:function(t){t.vertex&&t.vertex.editor===this||(this._drawing===e.Editable.FORWARD?this.newPointForward(t.latlng):this.newPointBackward(t.latlng),this.fireAndForward(`editable:drawing:clicked`,t))},onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&(this.tools.moveForwardLineGuide(t.latlng),this.tools.moveBackwardLineGuide(t.latlng))},refresh:function(){this.feature.redraw(),this.onEditing()},newShape:function(e){let t=this.addNewEmptyShape();t&&(this.setDrawnLatLngs(t[0]||t),this.startDrawingForward(),this.fireAndForward(`editable:shape:new`,{shape:t}),e&&this.newPointForward(e))},deleteShape:function(t,n){let r={shape:t};if(e.Editable.makeCancellable(r),this.fireAndForward(`editable:shape:delete`,r),!r._cancelled)return t=this._deleteShape(t,n),this.ensureNotFlat&&this.ensureNotFlat(),this.feature.setLatLngs(this.getLatLngs()),this.refresh(),this.reset(),this.fireAndForward(`editable:shape:deleted`,{shape:t}),this.onEdited(),t},_deleteShape:function(e,t){if(t||=this.getLatLngs(),!t.length)return;let n=(e,t)=>e.splice(0,Number.MAX_VALUE),r=(e,t)=>(e.splice(e.indexOf(t),1),e.length||this._deleteShape(e),t);if(t===e)return n(t,e);for(let n of t){if(n===e)return r(t,e);if(n.indexOf(e)!==-1)return r(n,e)}},deleteShapeAt:function(e){let t=this.feature.shapeAt(e);if(t)return this.deleteShape(t)},appendShape:function(e){this.insertShape(e)},prependShape:function(e){this.insertShape(e,0)},insertShape:function(e,t){this.ensureMulti(),e=this.formatShape(e),t===void 0&&(t=this.feature._latlngs.length),this.feature._latlngs.splice(t,0,e),this.feature.redraw(),this._enabled&&this.reset()},extendBounds:function(e){this.feature._bounds.extend(e.vertex.latlng)},onDragStart:function(t){this.editLayer.clearLayers(),e.Editable.BaseEditor.prototype.onDragStart.call(this,t)},onDragEnd:function(t){this.initVertexMarkers(),e.Editable.BaseEditor.prototype.onDragEnd.call(this,t)}}),e.Editable.PolylineEditor=e.Editable.PathEditor.extend({startDrawingBackward:function(){this._drawing=e.Editable.BACKWARD,this.startDrawing()},continueBackward:function(e){this.drawing()||(e||=this.getDefaultLatLngs(),this.setDrawnLatLngs(e),e.length>0&&(this.tools.attachBackwardLineGuide(),this.tools.anchorBackwardLineGuide(e[0])),this.startDrawingBackward())},continueForward:function(e){this.drawing()||(e||=this.getDefaultLatLngs(),this.setDrawnLatLngs(e),e.length>0&&(this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(e[e.length-1])),this.startDrawingForward())},getDefaultLatLngs:function(t){return t||=this.feature._latlngs,!t.length||t[0]instanceof e.LatLng?t:this.getDefaultLatLngs(t[0])},ensureMulti:function(){this.feature._latlngs.length&&l(this.feature._latlngs)&&(this.feature._latlngs=[this.feature._latlngs])},addNewEmptyShape:function(){if(this.feature._latlngs.length){let e=[];return this.appendShape(e),e}return this.feature._latlngs},formatShape:function(e){if(l(e))return e;if(e[0])return this.formatShape(e[0])},splitShape:function(t,n){if(!n||n>=t.length-1)return;this.ensureMulti();let r=this.feature._latlngs.indexOf(t);if(r===-1)return;let i=t.slice(0,n+1),a=t.slice(n);a[0]=e.latLng(a[0].lat,a[0].lng,a[0].alt),this.feature._latlngs.splice(r,1,i,a),this.refresh(),this.reset(),this.onEdited()}}),e.Editable.PolygonEditor=e.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:3,newPointForward:function(t){e.Editable.PathEditor.prototype.newPointForward.call(this,t),this.tools.backwardLineGuide._latlngs.length||this.tools.anchorBackwardLineGuide(t),this._drawnLatLngs.length===2&&this.tools.attachBackwardLineGuide()},addNewEmptyHole:function(e){this.ensureNotFlat();let t=this.feature.shapeAt(e);if(!t)return;let n=[];return t.push(n),n},newHole:function(e){let t=this.addNewEmptyHole(e);t&&(this.setDrawnLatLngs(t),this.startDrawingForward(),e&&this.newPointForward(e))},addNewEmptyShape:function(){if(this.feature._latlngs.length&&this.feature._latlngs[0].length){let e=[];return this.appendShape(e),e}return this.feature._latlngs},ensureMulti:function(){this.feature._latlngs.length&&l(this.feature._latlngs[0])&&(this.feature._latlngs=[this.feature._latlngs])},ensureNotFlat:function(){(!this.feature._latlngs.length||l(this.feature._latlngs))&&(this.feature._latlngs=[this.feature._latlngs])},vertexCanBeDeleted:function(t){let n=this.feature.parentShape(t.latlngs);return e.Util.indexOf(n,t.latlngs)>0?!0:e.Editable.PathEditor.prototype.vertexCanBeDeleted.call(this,t)},getDefaultLatLngs:function(){return this.feature._latlngs.length||this.feature._latlngs.push([]),this.feature._latlngs[0]},formatShape:e=>l(e)&&(!e[0]||e[0].length!==0)?[e]:e}),e.Editable.RectangleEditor=e.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:4,options:{skipMiddleMarkers:!0},extendBounds:function(t){let n=t.vertex.getIndex(),r=t.vertex.getNext(),i=t.vertex.getPrevious(),a=(n+2)%4,o=t.vertex.latlngs[a],s=new e.LatLngBounds(t.latlng,o);i.latlng.update([t.latlng.lat,o.lng]),r.latlng.update([o.lat,t.latlng.lng]),this.updateBounds(s),this.refreshVertexMarkers()},onDrawingMouseDown:function(t){e.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this.connect();let n=this.getDefaultLatLngs();n.length===3&&n.push(t.latlng);let r=new e.LatLngBounds(t.latlng,t.latlng);this.updateBounds(r),this.updateLatLngs(r),this.refresh(),this.reset(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),n[3].__vertex.dragging._draggable._onDown(t.originalEvent)},onDrawingMouseUp:function(t){this.commitDrawing(t),t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,t)},onDrawingMouseMove:function(t){t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,t)},getDefaultLatLngs:function(e){return e||this.feature._latlngs[0]},updateBounds:function(e){this.feature._bounds=e},updateLatLngs:function(e){let t=this.getDefaultLatLngs(),n=this.feature._boundsToLatLngs(e);for(let e=0;e<t.length;e++)t[e].update(n[e])}}),e.Editable.CircleEditor=e.Editable.PathEditor.extend({MIN_VERTEX:2,options:{skipMiddleMarkers:!0},initialize:function(t,n,r){e.Editable.PathEditor.prototype.initialize.call(this,t,n,r),this._resizeLatLng=this.computeResizeLatLng()},computeResizeLatLng:function(){let e=(this.feature._radius||this.feature._mRadius)*Math.cos(Math.PI/4),t=this.map.project(this.feature._latlng);return this.map.unproject([t.x+e,t.y-e])},updateResizeLatLng:function(){this._resizeLatLng.update(this.computeResizeLatLng()),this._resizeLatLng.__vertex.update()},getLatLngs:function(){return[this.feature._latlng,this._resizeLatLng]},getDefaultLatLngs:function(){return this.getLatLngs()},onVertexMarkerDrag:function(t){t.vertex.getIndex()===1?this.resize(t):this.updateResizeLatLng(t),e.Editable.PathEditor.prototype.onVertexMarkerDrag.call(this,t)},resize:function(e){let t;t=this.map.options.crs?this.map.options.crs.distance(this.feature._latlng,e.latlng):this.feature._latlng.distanceTo(e.latlng),this.feature.setRadius(t)},onDrawingMouseDown:function(t){e.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this._resizeLatLng.update(t.latlng),this.feature._latlng.update(t.latlng),this.connect(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),this._resizeLatLng.__vertex.dragging._draggable._onDown(t.originalEvent)},onDrawingMouseUp:function(t){this.commitDrawing(t),t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,t)},onDrawingMouseMove:function(t){t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,t)},onDrag:function(t){e.Editable.PathEditor.prototype.onDrag.call(this,t),this.feature.dragging.updateLatLng(this._resizeLatLng)}});let t={createEditor:function(e){e||=this._map;let t=this.options.editOptions?.editTools||e.editTools;if(!t)throw Error(`Unable to detect Editable instance.`);return new(this.options.editorClass||(this.getEditorClass(t)))(e,this,this.options.editOptions)},enableEdit:function(e){return this.editor||this.createEditor(e),this.editor.enable(),this.editor},editEnabled:function(){return this.editor?.enabled()},disableEdit:function(){this.editor&&(this.editor.disable(),delete this.editor)},toggleEdit:function(){this.editEnabled()?this.disableEdit():this.enableEdit()},_onEditableAdd:function(){this.editor&&this.enableEdit()}},n={getEditorClass:t=>t?.options?.polylineEditorClass||e.Editable.PolylineEditor,shapeAt:function(e,t){let n=null;if(t||=this._latlngs,!t.length)return n;if(l(t)&&this.isInLatLngs(e,t))n=t;else for(let n of t)if(this.isInLatLngs(e,n))return n;return n},isInLatLngs:function(t,n){if(!n)return!1;let r,i,a,o=[],s,c=this._clickTolerance();if(this._projectLatlngs(n,o,this._pxBounds),o=o[0],s=this._map.latLngToLayerPoint(t),!this._pxBounds.contains(s))return!1;for(r=1,a=o.length,i=0;r<a;i=r++)if(e.LineUtil.pointToSegmentDistance(s,o[i],o[r])<=c)return!0;return!1}},r={getEditorClass:t=>t?.options?.polygonEditorClass||e.Editable.PolygonEditor,shapeAt:function(e,t){let n=null;if(t||=this._latlngs,!t.length)return n;if(l(t)&&this.isInLatLngs(e,t)&&(n=t),l(t[0])&&this.isInLatLngs(e,t[0]))n=t;else for(let n of t)if(this.isInLatLngs(e,n[0]))return n;return n},isInLatLngs:(e,t)=>{let n=!1,r,i,a,o,s;for(a=0,s=t.length,o=s-1;a<s;o=a++)r=t[a],i=t[o],r.lat>e.lat!=i.lat>e.lat&&e.lng<(i.lng-r.lng)*(e.lat-r.lat)/(i.lat-r.lat)+r.lng&&(n=!n);return n},parentShape:function(t,n){if(n||=this._latlngs,!n)return;let r=e.Util.indexOf(n,t);if(r!==-1)return n;for(let i of n)if(r=e.Util.indexOf(i,t),r!==-1)return i}},i={getEditorClass:t=>t?.options?.markerEditorClass||e.Editable.MarkerEditor},a={getEditorClass:t=>t?.options?.circleMarkerEditorClass||e.Editable.CircleMarkerEditor},o={getEditorClass:t=>t?.options?.rectangleEditorClass||e.Editable.RectangleEditor},s={getEditorClass:t=>t?.options?.circleEditorClass||e.Editable.CircleEditor},c=function(){this.on(`add`,this._onEditableAdd)},l=e.LineUtil.isFlat||e.LineUtil._flat||e.Polyline._flat;e.Polyline&&(e.Polyline.include(t),e.Polyline.include(n),e.Polyline.addInitHook(c)),e.Polygon&&(e.Polygon.include(t),e.Polygon.include(r)),e.Marker&&(e.Marker.include(t),e.Marker.include(i),e.Marker.addInitHook(c)),e.CircleMarker&&(e.CircleMarker.include(t),e.CircleMarker.include(a),e.CircleMarker.addInitHook(c)),e.Rectangle&&(e.Rectangle.include(t),e.Rectangle.include(o)),e.Circle&&(e.Circle.include(t),e.Circle.include(s)),e.LatLng.prototype.update=function(t){t=e.latLng(t),this.lat=t.lat,this.lng=t.lng}},window)})),Nd=l(jd(),1);Md();var Pd=`/* required styles */\r
|
|
430
|
+
:scope [data-node-id='${r.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${n.id}']`));for(let n of i)if(n.classList.contains(`editor`)){if(!e||n.value){let e=n.parentElement;e.classList.add(`invalid`),e.classList.remove(`valid`),e.appendChild(this.createValidationErrorDisplay(t));do e instanceof Aa&&(e.open=!0),e=e.parentElement;while(e)}}else e||(n.classList.add(`invalid`),n.classList.remove(`valid`),n.appendChild(this.createValidationErrorDisplay(t,`node`)))}else e||this.form.querySelector(`:scope [data-node-id='${r.id}']`)?.prepend(this.createValidationErrorDisplay(t,`node`))}n(r)}catch(e){console.error(e),n({conforms:!1,results:[]})}})})}createValidationErrorDisplay(e,t){let n=document.createElement(`span`);n.classList.add(`validation-error`),t&&n.classList.add(t);let r=typeof e==`object`&&e?e:null;return r?r.message?.length?n.title+=Wt(this.config.languages,r.message):r.sourceConstraintComponent?.value&&(n.title=r.sourceConstraintComponent.value):typeof e==`string`&&(n.title=e),n}findRootShaclShapeSubject(){if(this.config.attributes.shapeSubject){let e=k.namedNode(this.config.attributes.shapeSubject);if(this.config.store.getQuads(e,bt,Et,null).length===0){console.warn(`shapes graph does not contain requested node shape ${this.config.attributes.shapeSubject}`);return}else return e}else{if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,yt)>0){let e=k.namedNode(this.config.attributes.valuesSubject),t=cr(this.config.store,this.config.attributes.valuesSubject),n=this.config.store.getQuads(e,bt,null,yt);if(n.length===0&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${bt.id} nor ${K.id} statement`),t)return t;for(let e of n)if(this.config.store.getQuads(e.object,bt,Et,null).length>0)return e.object;let r=this.config.store.getObjects(e,bt,yt);for(let e of r)for(let t of this.config.store.getQuads(null,jt,e,null))return t.subject}let e=this.config.store.getQuads(null,bt,Et,null);if(e.length==0){console.warn(`shapes graph does not contain any node shapes`);return}return e.length>1&&(console.warn(`shapes graph contains`,e.length,`node shapes. choosing first found which is`,e[0].subject.value),console.info(`hint: set the node shape to use with element attribute "data-shape-subject"`)),e[0].subject}}removeFromDataGraph(e){for(let t of this.config.store.getQuads(e,null,null,yt))this.config.store.delete(t),(t.object.termType===`NamedNode`||t.object.termType===`BlankNode`)&&this.removeFromDataGraph(t.object)}};window.customElements.define(`shacl-form`,Id);var Ld=class extends Fr{constructor(e,t,n){super(e),this.onChange=t,this.fileType=n}createEditor(e){let t=_r(e)>0,n=e.config.theme.createFileEditor(e.label,null,t,e);return n.addEventListener(`change`,e=>{e.stopPropagation(),this.onChange(e)}),this.fileType&&n.querySelector(`input[type="file"]`)?.setAttribute(`accept`,this.fileType),n}},Rd=o(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):(n=typeof globalThis<`u`?globalThis:n||self,r(n.leaflet={}))})(e,(function(e){var t=`1.9.4`;function n(e){var t,n,r,i;for(n=1,r=arguments.length;n<r;n++)for(t in i=arguments[n],i)e[t]=i[t];return e}var r=Object.create||(function(){function e(){}return function(t){return e.prototype=t,new e}})();function i(e,t){var n=Array.prototype.slice;if(e.bind)return e.bind.apply(e,n.call(arguments,1));var r=n.call(arguments,2);return function(){return e.apply(t,r.length?r.concat(n.call(arguments)):arguments)}}var a=0;function o(e){return`_leaflet_id`in e||(e._leaflet_id=++a),e._leaflet_id}function s(e,t,n){var r,i,a,o=function(){r=!1,i&&=(a.apply(n,i),!1)};return a=function(){r?i=arguments:(e.apply(n,arguments),setTimeout(o,t),r=!0)},a}function c(e,t,n){var r=t[1],i=t[0],a=r-i;return e===r&&n?e:((e-i)%a+a)%a+i}function l(){return!1}function u(e,t){if(t===!1)return e;var n=10**(t===void 0?6:t);return Math.round(e*n)/n}function d(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function f(e){return d(e).split(/\s+/)}function p(e,t){for(var n in Object.prototype.hasOwnProperty.call(e,`options`)||(e.options=e.options?r(e.options):{}),t)e.options[n]=t[n];return e.options}function m(e,t,n){var r=[];for(var i in e)r.push(encodeURIComponent(n?i.toUpperCase():i)+`=`+encodeURIComponent(e[i]));return(!t||t.indexOf(`?`)===-1?`?`:`&`)+r.join(`&`)}var h=/\{ *([\w_ -]+) *\}/g;function g(e,t){return e.replace(h,function(e,n){var r=t[n];if(r===void 0)throw Error(`No value provided for variable `+e);return typeof r==`function`&&(r=r(t)),r})}var _=Array.isArray||function(e){return Object.prototype.toString.call(e)===`[object Array]`};function v(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}var y=`data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=`;function b(e){return window[`webkit`+e]||window[`moz`+e]||window[`ms`+e]}var x=0;function S(e){var t=+new Date,n=Math.max(0,16-(t-x));return x=t+n,window.setTimeout(e,n)}var C=window.requestAnimationFrame||b(`RequestAnimationFrame`)||S,w=window.cancelAnimationFrame||b(`CancelAnimationFrame`)||b(`CancelRequestAnimationFrame`)||function(e){window.clearTimeout(e)};function T(e,t,n){if(n&&C===S)e.call(t);else return C.call(window,i(e,t))}function E(e){e&&w.call(window,e)}var D={__proto__:null,extend:n,create:r,bind:i,get lastId(){return a},stamp:o,throttle:s,wrapNum:c,falseFn:l,formatNum:u,trim:d,splitWords:f,setOptions:p,getParamString:m,template:g,isArray:_,indexOf:v,emptyImageUrl:y,requestFn:C,cancelFn:w,requestAnimFrame:T,cancelAnimFrame:E};function O(){}O.extend=function(e){var t=function(){p(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},i=t.__super__=this.prototype,a=r(i);for(var o in a.constructor=t,t.prototype=a,this)Object.prototype.hasOwnProperty.call(this,o)&&o!==`prototype`&&o!==`__super__`&&(t[o]=this[o]);return e.statics&&n(t,e.statics),e.includes&&(k(e.includes),n.apply(null,[a].concat(e.includes))),n(a,e),delete a.statics,delete a.includes,a.options&&(a.options=i.options?r(i.options):{},n(a.options,e.options)),a._initHooks=[],a.callInitHooks=function(){if(!this._initHooksCalled){i.callInitHooks&&i.callInitHooks.call(this),this._initHooksCalled=!0;for(var e=0,t=a._initHooks.length;e<t;e++)a._initHooks[e].call(this)}},t},O.include=function(e){var t=this.prototype.options;return n(this.prototype,e),e.options&&(this.prototype.options=t,this.mergeOptions(e.options)),this},O.mergeOptions=function(e){return n(this.prototype.options,e),this},O.addInitHook=function(e){var t=Array.prototype.slice.call(arguments,1),n=typeof e==`function`?e:function(){this[e].apply(this,t)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(n),this};function k(e){if(!(typeof L>`u`||!L||!L.Mixin)){e=_(e)?e:[e];for(var t=0;t<e.length;t++)e[t]===L.Mixin.Events&&console.warn(`Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.`,Error().stack)}}var A={on:function(e,t,n){if(typeof e==`object`)for(var r in e)this._on(r,e[r],t);else{e=f(e);for(var i=0,a=e.length;i<a;i++)this._on(e[i],t,n)}return this},off:function(e,t,n){if(!arguments.length)delete this._events;else if(typeof e==`object`)for(var r in e)this._off(r,e[r],t);else{e=f(e);for(var i=arguments.length===1,a=0,o=e.length;a<o;a++)i?this._off(e[a]):this._off(e[a],t,n)}return this},_on:function(e,t,n,r){if(typeof t!=`function`){console.warn(`wrong listener type: `+typeof t);return}if(this._listens(e,t,n)===!1){n===this&&(n=void 0);var i={fn:t,ctx:n};r&&(i.once=!0),this._events=this._events||{},this._events[e]=this._events[e]||[],this._events[e].push(i)}},_off:function(e,t,n){var r,i,a;if(this._events&&(r=this._events[e],r)){if(arguments.length===1){if(this._firingCount)for(i=0,a=r.length;i<a;i++)r[i].fn=l;delete this._events[e];return}if(typeof t!=`function`){console.warn(`wrong listener type: `+typeof t);return}var o=this._listens(e,t,n);if(o!==!1){var s=r[o];this._firingCount&&(s.fn=l,this._events[e]=r=r.slice()),r.splice(o,1)}}},fire:function(e,t,r){if(!this.listens(e,r))return this;var i=n({},t,{type:e,target:this,sourceTarget:t&&t.sourceTarget||this});if(this._events){var a=this._events[e];if(a){this._firingCount=this._firingCount+1||1;for(var o=0,s=a.length;o<s;o++){var c=a[o],l=c.fn;c.once&&this.off(e,l,c.ctx),l.call(c.ctx||this,i)}this._firingCount--}}return r&&this._propagateEvent(i),this},listens:function(e,t,n,r){typeof e!=`string`&&console.warn(`"string" type argument expected`);var i=t;typeof t!=`function`&&(r=!!t,i=void 0,n=void 0);var a=this._events&&this._events[e];if(a&&a.length&&this._listens(e,i,n)!==!1)return!0;if(r){for(var o in this._eventParents)if(this._eventParents[o].listens(e,t,n,r))return!0}return!1},_listens:function(e,t,n){if(!this._events)return!1;var r=this._events[e]||[];if(!t)return!!r.length;n===this&&(n=void 0);for(var i=0,a=r.length;i<a;i++)if(r[i].fn===t&&r[i].ctx===n)return i;return!1},once:function(e,t,n){if(typeof e==`object`)for(var r in e)this._on(r,e[r],t,!0);else{e=f(e);for(var i=0,a=e.length;i<a;i++)this._on(e[i],t,n,!0)}return this},addEventParent:function(e){return this._eventParents=this._eventParents||{},this._eventParents[o(e)]=e,this},removeEventParent:function(e){return this._eventParents&&delete this._eventParents[o(e)],this},_propagateEvent:function(e){for(var t in this._eventParents)this._eventParents[t].fire(e.type,n({layer:e.target,propagatedFrom:e.target},e),!0)}};A.addEventListener=A.on,A.removeEventListener=A.clearAllEventListeners=A.off,A.addOneTimeEventListener=A.once,A.fireEvent=A.fire,A.hasEventListeners=A.listens;var j=O.extend(A);function M(e,t,n){this.x=n?Math.round(e):e,this.y=n?Math.round(t):t}var N=Math.trunc||function(e){return e>0?Math.floor(e):Math.ceil(e)};M.prototype={clone:function(){return new M(this.x,this.y)},add:function(e){return this.clone()._add(P(e))},_add:function(e){return this.x+=e.x,this.y+=e.y,this},subtract:function(e){return this.clone()._subtract(P(e))},_subtract:function(e){return this.x-=e.x,this.y-=e.y,this},divideBy:function(e){return this.clone()._divideBy(e)},_divideBy:function(e){return this.x/=e,this.y/=e,this},multiplyBy:function(e){return this.clone()._multiplyBy(e)},_multiplyBy:function(e){return this.x*=e,this.y*=e,this},scaleBy:function(e){return new M(this.x*e.x,this.y*e.y)},unscaleBy:function(e){return new M(this.x/e.x,this.y/e.y)},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.clone()._ceil()},_ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},trunc:function(){return this.clone()._trunc()},_trunc:function(){return this.x=N(this.x),this.y=N(this.y),this},distanceTo:function(e){e=P(e);var t=e.x-this.x,n=e.y-this.y;return Math.sqrt(t*t+n*n)},equals:function(e){return e=P(e),e.x===this.x&&e.y===this.y},contains:function(e){return e=P(e),Math.abs(e.x)<=Math.abs(this.x)&&Math.abs(e.y)<=Math.abs(this.y)},toString:function(){return`Point(`+u(this.x)+`, `+u(this.y)+`)`}};function P(e,t,n){return e instanceof M?e:_(e)?new M(e[0],e[1]):e==null?e:typeof e==`object`&&`x`in e&&`y`in e?new M(e.x,e.y):new M(e,t,n)}function F(e,t){if(e)for(var n=t?[e,t]:e,r=0,i=n.length;r<i;r++)this.extend(n[r])}F.prototype={extend:function(e){var t,n;if(!e)return this;if(e instanceof M||typeof e[0]==`number`||`x`in e)t=n=P(e);else if(e=I(e),t=e.min,n=e.max,!t||!n)return this;return!this.min&&!this.max?(this.min=t.clone(),this.max=n.clone()):(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(n.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(n.y,this.max.y)),this},getCenter:function(e){return P((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,e)},getBottomLeft:function(){return P(this.min.x,this.max.y)},getTopRight:function(){return P(this.max.x,this.min.y)},getTopLeft:function(){return this.min},getBottomRight:function(){return this.max},getSize:function(){return this.max.subtract(this.min)},contains:function(e){var t,n;return e=typeof e[0]==`number`||e instanceof M?P(e):I(e),e instanceof F?(t=e.min,n=e.max):t=n=e,t.x>=this.min.x&&n.x<=this.max.x&&t.y>=this.min.y&&n.y<=this.max.y},intersects:function(e){e=I(e);var t=this.min,n=this.max,r=e.min,i=e.max,a=i.x>=t.x&&r.x<=n.x,o=i.y>=t.y&&r.y<=n.y;return a&&o},overlaps:function(e){e=I(e);var t=this.min,n=this.max,r=e.min,i=e.max,a=i.x>t.x&&r.x<n.x,o=i.y>t.y&&r.y<n.y;return a&&o},isValid:function(){return!!(this.min&&this.max)},pad:function(e){var t=this.min,n=this.max,r=Math.abs(t.x-n.x)*e,i=Math.abs(t.y-n.y)*e;return I(P(t.x-r,t.y-i),P(n.x+r,n.y+i))},equals:function(e){return e?(e=I(e),this.min.equals(e.getTopLeft())&&this.max.equals(e.getBottomRight())):!1}};function I(e,t){return!e||e instanceof F?e:new F(e,t)}function R(e,t){if(e)for(var n=t?[e,t]:e,r=0,i=n.length;r<i;r++)this.extend(n[r])}R.prototype={extend:function(e){var t=this._southWest,n=this._northEast,r,i;if(e instanceof B)r=e,i=e;else if(e instanceof R){if(r=e._southWest,i=e._northEast,!r||!i)return this}else return e?this.extend(V(e)||z(e)):this;return!t&&!n?(this._southWest=new B(r.lat,r.lng),this._northEast=new B(i.lat,i.lng)):(t.lat=Math.min(r.lat,t.lat),t.lng=Math.min(r.lng,t.lng),n.lat=Math.max(i.lat,n.lat),n.lng=Math.max(i.lng,n.lng)),this},pad:function(e){var t=this._southWest,n=this._northEast,r=Math.abs(t.lat-n.lat)*e,i=Math.abs(t.lng-n.lng)*e;return new R(new B(t.lat-r,t.lng-i),new B(n.lat+r,n.lng+i))},getCenter:function(){return new B((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new B(this.getNorth(),this.getWest())},getSouthEast:function(){return new B(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(e){e=typeof e[0]==`number`||e instanceof B||`lat`in e?V(e):z(e);var t=this._southWest,n=this._northEast,r,i;return e instanceof R?(r=e.getSouthWest(),i=e.getNorthEast()):r=i=e,r.lat>=t.lat&&i.lat<=n.lat&&r.lng>=t.lng&&i.lng<=n.lng},intersects:function(e){e=z(e);var t=this._southWest,n=this._northEast,r=e.getSouthWest(),i=e.getNorthEast(),a=i.lat>=t.lat&&r.lat<=n.lat,o=i.lng>=t.lng&&r.lng<=n.lng;return a&&o},overlaps:function(e){e=z(e);var t=this._southWest,n=this._northEast,r=e.getSouthWest(),i=e.getNorthEast(),a=i.lat>t.lat&&r.lat<n.lat,o=i.lng>t.lng&&r.lng<n.lng;return a&&o},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(`,`)},equals:function(e,t){return e?(e=z(e),this._southWest.equals(e.getSouthWest(),t)&&this._northEast.equals(e.getNorthEast(),t)):!1},isValid:function(){return!!(this._southWest&&this._northEast)}};function z(e,t){return e instanceof R?e:new R(e,t)}function B(e,t,n){if(isNaN(e)||isNaN(t))throw Error(`Invalid LatLng object: (`+e+`, `+t+`)`);this.lat=+e,this.lng=+t,n!==void 0&&(this.alt=+n)}B.prototype={equals:function(e,t){return e?(e=V(e),Math.max(Math.abs(this.lat-e.lat),Math.abs(this.lng-e.lng))<=(t===void 0?1e-9:t)):!1},toString:function(e){return`LatLng(`+u(this.lat,e)+`, `+u(this.lng,e)+`)`},distanceTo:function(e){return te.distance(this,V(e))},wrap:function(){return te.wrapLatLng(this)},toBounds:function(e){var t=180*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return z([this.lat-t,this.lng-n],[this.lat+t,this.lng+n])},clone:function(){return new B(this.lat,this.lng,this.alt)}};function V(e,t,n){return e instanceof B?e:_(e)&&typeof e[0]!=`object`?e.length===3?new B(e[0],e[1],e[2]):e.length===2?new B(e[0],e[1]):null:e==null?e:typeof e==`object`&&`lat`in e?new B(e.lat,`lng`in e?e.lng:e.lon,e.alt):t===void 0?null:new B(e,t,n)}var ee={latLngToPoint:function(e,t){var n=this.projection.project(e),r=this.scale(t);return this.transformation._transform(n,r)},pointToLatLng:function(e,t){var n=this.scale(t),r=this.transformation.untransform(e,n);return this.projection.unproject(r)},project:function(e){return this.projection.project(e)},unproject:function(e){return this.projection.unproject(e)},scale:function(e){return 256*2**e},zoom:function(e){return Math.log(e/256)/Math.LN2},getProjectedBounds:function(e){if(this.infinite)return null;var t=this.projection.bounds,n=this.scale(e);return new F(this.transformation.transform(t.min,n),this.transformation.transform(t.max,n))},infinite:!1,wrapLatLng:function(e){var t=this.wrapLng?c(e.lng,this.wrapLng,!0):e.lng,n=this.wrapLat?c(e.lat,this.wrapLat,!0):e.lat,r=e.alt;return new B(n,t,r)},wrapLatLngBounds:function(e){var t=e.getCenter(),n=this.wrapLatLng(t),r=t.lat-n.lat,i=t.lng-n.lng;if(r===0&&i===0)return e;var a=e.getSouthWest(),o=e.getNorthEast();return new R(new B(a.lat-r,a.lng-i),new B(o.lat-r,o.lng-i))}},te=n({},ee,{wrapLng:[-180,180],R:6371e3,distance:function(e,t){var n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=Math.sin((t.lat-e.lat)*n/2),o=Math.sin((t.lng-e.lng)*n/2),s=a*a+Math.cos(r)*Math.cos(i)*o*o,c=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return this.R*c}}),ne=6378137,re={R:ne,MAX_LATITUDE:85.0511287798,project:function(e){var t=Math.PI/180,n=this.MAX_LATITUDE,r=Math.max(Math.min(n,e.lat),-n),i=Math.sin(r*t);return new M(this.R*e.lng*t,this.R*Math.log((1+i)/(1-i))/2)},unproject:function(e){var t=180/Math.PI;return new B((2*Math.atan(Math.exp(e.y/this.R))-Math.PI/2)*t,e.x*t/this.R)},bounds:(function(){var e=ne*Math.PI;return new F([-e,-e],[e,e])})()};function ie(e,t,n,r){if(_(e)){this._a=e[0],this._b=e[1],this._c=e[2],this._d=e[3];return}this._a=e,this._b=t,this._c=n,this._d=r}ie.prototype={transform:function(e,t){return this._transform(e.clone(),t)},_transform:function(e,t){return t||=1,e.x=t*(this._a*e.x+this._b),e.y=t*(this._c*e.y+this._d),e},untransform:function(e,t){return t||=1,new M((e.x/t-this._b)/this._a,(e.y/t-this._d)/this._c)}};function ae(e,t,n,r){return new ie(e,t,n,r)}var oe=n({},te,{code:`EPSG:3857`,projection:re,transformation:function(){var e=.5/(Math.PI*re.R);return ae(e,.5,-e,.5)}()}),se=n({},oe,{code:`EPSG:900913`});function ce(e){return document.createElementNS(`http://www.w3.org/2000/svg`,e)}function le(e,t){var n=``,r,i,a,o,s,c;for(r=0,a=e.length;r<a;r++){for(s=e[r],i=0,o=s.length;i<o;i++)c=s[i],n+=(i?`L`:`M`)+c.x+` `+c.y;n+=t?U.svg?`z`:`x`:``}return n||`M0 0`}var ue=document.documentElement.style,de=`ActiveXObject`in window,fe=de&&!document.addEventListener,pe=`msLaunchUri`in navigator&&!(`documentMode`in document),me=Ke(`webkit`),he=Ke(`android`),ge=Ke(`android 2`)||Ke(`android 3`),_e=parseInt(/WebKit\/([0-9]+)|$/.exec(navigator.userAgent)[1],10),ve=he&&Ke(`Google`)&&_e<537&&!(`AudioNode`in window),ye=!!window.opera,H=!pe&&Ke(`chrome`),be=Ke(`gecko`)&&!me&&!ye&&!de,xe=!H&&Ke(`safari`),Se=Ke(`phantom`),Ce=`OTransition`in ue,we=navigator.platform.indexOf(`Win`)===0,Te=de&&`transition`in ue,Ee=`WebKitCSSMatrix`in window&&`m11`in new window.WebKitCSSMatrix&&!ge,De=`MozPerspective`in ue,Oe=!window.L_DISABLE_3D&&(Te||Ee||De)&&!Ce&&!Se,ke=typeof orientation<`u`||Ke(`mobile`),Ae=ke&&me,je=ke&&Ee,Me=!window.PointerEvent&&window.MSPointerEvent,Ne=!!(window.PointerEvent||Me),Pe=`ontouchstart`in window||!!window.TouchEvent,Fe=!window.L_NO_TOUCH&&(Pe||Ne),Ie=ke&&ye,Le=ke&&be,Re=(window.devicePixelRatio||window.screen.deviceXDPI/window.screen.logicalXDPI)>1,ze=function(){var e=!1;try{var t=Object.defineProperty({},`passive`,{get:function(){e=!0}});window.addEventListener(`testPassiveEventSupport`,l,t),window.removeEventListener(`testPassiveEventSupport`,l,t)}catch{}return e}(),Be=function(){return!!document.createElement(`canvas`).getContext}(),Ve=!!(document.createElementNS&&ce(`svg`).createSVGRect),He=!!Ve&&(function(){var e=document.createElement(`div`);return e.innerHTML=`<svg/>`,(e.firstChild&&e.firstChild.namespaceURI)===`http://www.w3.org/2000/svg`})(),Ue=!Ve&&function(){try{var e=document.createElement(`div`);e.innerHTML=`<v:shape adj="1"/>`;var t=e.firstChild;return t.style.behavior=`url(#default#VML)`,t&&typeof t.adj==`object`}catch{return!1}}(),We=navigator.platform.indexOf(`Mac`)===0,Ge=navigator.platform.indexOf(`Linux`)===0;function Ke(e){return navigator.userAgent.toLowerCase().indexOf(e)>=0}var U={ie:de,ielt9:fe,edge:pe,webkit:me,android:he,android23:ge,androidStock:ve,opera:ye,chrome:H,gecko:be,safari:xe,phantom:Se,opera12:Ce,win:we,ie3d:Te,webkit3d:Ee,gecko3d:De,any3d:Oe,mobile:ke,mobileWebkit:Ae,mobileWebkit3d:je,msPointer:Me,pointer:Ne,touch:Fe,touchNative:Pe,mobileOpera:Ie,mobileGecko:Le,retina:Re,passiveEvents:ze,canvas:Be,svg:Ve,vml:Ue,inlineSvg:He,mac:We,linux:Ge},qe=U.msPointer?`MSPointerDown`:`pointerdown`,Je=U.msPointer?`MSPointerMove`:`pointermove`,Ye=U.msPointer?`MSPointerUp`:`pointerup`,Xe=U.msPointer?`MSPointerCancel`:`pointercancel`,Ze={touchstart:qe,touchmove:Je,touchend:Ye,touchcancel:Xe},Qe={touchstart:ct,touchmove:st,touchend:st,touchcancel:st},$e={},et=!1;function tt(e,t,n){return t===`touchstart`&&ot(),Qe[t]?(n=Qe[t].bind(this,n),e.addEventListener(Ze[t],n,!1),n):(console.warn(`wrong event specified:`,t),l)}function nt(e,t,n){if(!Ze[t]){console.warn(`wrong event specified:`,t);return}e.removeEventListener(Ze[t],n,!1)}function rt(e){$e[e.pointerId]=e}function it(e){$e[e.pointerId]&&($e[e.pointerId]=e)}function at(e){delete $e[e.pointerId]}function ot(){et||=(document.addEventListener(qe,rt,!0),document.addEventListener(Je,it,!0),document.addEventListener(Ye,at,!0),document.addEventListener(Xe,at,!0),!0)}function st(e,t){if(t.pointerType!==(t.MSPOINTER_TYPE_MOUSE||`mouse`)){for(var n in t.touches=[],$e)t.touches.push($e[n]);t.changedTouches=[t],e(t)}}function ct(e,t){t.MSPOINTER_TYPE_TOUCH&&t.pointerType===t.MSPOINTER_TYPE_TOUCH&&$t(t),st(e,t)}function lt(e){var t={},n,r;for(r in e)n=e[r],t[r]=n&&n.bind?n.bind(e):n;return e=t,t.type=`dblclick`,t.detail=2,t.isTrusted=!1,t._simulated=!0,t}var ut=200;function W(e,t){e.addEventListener(`dblclick`,t);var n=0,r;function i(e){if(e.detail!==1){r=e.detail;return}if(!(e.pointerType===`mouse`||e.sourceCapabilities&&!e.sourceCapabilities.firesTouchEvents)){var i=tn(e);if(!(i.some(function(e){return e instanceof HTMLLabelElement&&e.attributes.for})&&!i.some(function(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement}))){var a=Date.now();a-n<=ut?(r++,r===2&&t(lt(e))):r=1,n=a}}}return e.addEventListener(`click`,i),{dblclick:t,simDblclick:i}}function dt(e,t){e.removeEventListener(`dblclick`,t.dblclick),e.removeEventListener(`click`,t.simDblclick)}var ft=Dt([`transform`,`webkitTransform`,`OTransform`,`MozTransform`,`msTransform`]),pt=Dt([`webkitTransition`,`transition`,`OTransition`,`MozTransition`,`msTransition`]),mt=pt===`webkitTransition`||pt===`OTransition`?pt+`End`:`transitionend`;function ht(e){return typeof e==`string`?document.getElementById(e):e}function gt(e,t){var n=e.style[t]||e.currentStyle&&e.currentStyle[t];if((!n||n===`auto`)&&document.defaultView){var r=document.defaultView.getComputedStyle(e,null);n=r?r[t]:null}return n===`auto`?null:n}function G(e,t,n){var r=document.createElement(e);return r.className=t||``,n&&n.appendChild(r),r}function _t(e){var t=e.parentNode;t&&t.removeChild(e)}function vt(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function yt(e){var t=e.parentNode;t&&t.lastChild!==e&&t.appendChild(e)}function bt(e){var t=e.parentNode;t&&t.firstChild!==e&&t.insertBefore(e,t.firstChild)}function xt(e,t){if(e.classList!==void 0)return e.classList.contains(t);var n=wt(e);return n.length>0&&RegExp(`(^|\\s)`+t+`(\\s|$)`).test(n)}function K(e,t){if(e.classList!==void 0)for(var n=f(t),r=0,i=n.length;r<i;r++)e.classList.add(n[r]);else if(!xt(e,t)){var a=wt(e);Ct(e,(a?a+` `:``)+t)}}function St(e,t){e.classList===void 0?Ct(e,d((` `+wt(e)+` `).replace(` `+t+` `,` `))):e.classList.remove(t)}function Ct(e,t){e.className.baseVal===void 0?e.className=t:e.className.baseVal=t}function wt(e){return e.correspondingElement&&(e=e.correspondingElement),e.className.baseVal===void 0?e.className:e.className.baseVal}function Tt(e,t){`opacity`in e.style?e.style.opacity=t:`filter`in e.style&&Et(e,t)}function Et(e,t){var n=!1,r=`DXImageTransform.Microsoft.Alpha`;try{n=e.filters.item(r)}catch{if(t===1)return}t=Math.round(t*100),n?(n.Enabled=t!==100,n.Opacity=t):e.style.filter+=` progid:`+r+`(opacity=`+t+`)`}function Dt(e){for(var t=document.documentElement.style,n=0;n<e.length;n++)if(e[n]in t)return e[n];return!1}function Ot(e,t,n){var r=t||new M(0,0);e.style[ft]=(U.ie3d?`translate(`+r.x+`px,`+r.y+`px)`:`translate3d(`+r.x+`px,`+r.y+`px,0)`)+(n?` scale(`+n+`)`:``)}function kt(e,t){e._leaflet_pos=t,U.any3d?Ot(e,t):(e.style.left=t.x+`px`,e.style.top=t.y+`px`)}function At(e){return e._leaflet_pos||new M(0,0)}var jt,Mt,Nt;if(`onselectstart`in document)jt=function(){q(window,`selectstart`,$t)},Mt=function(){Gt(window,`selectstart`,$t)};else{var Pt=Dt([`userSelect`,`WebkitUserSelect`,`OUserSelect`,`MozUserSelect`,`msUserSelect`]);jt=function(){if(Pt){var e=document.documentElement.style;Nt=e[Pt],e[Pt]=`none`}},Mt=function(){Pt&&(document.documentElement.style[Pt]=Nt,Nt=void 0)}}function Ft(){q(window,`dragstart`,$t)}function It(){Gt(window,`dragstart`,$t)}var Lt,Rt;function zt(e){for(;e.tabIndex===-1;)e=e.parentNode;e.style&&(Bt(),Lt=e,Rt=e.style.outlineStyle,e.style.outlineStyle=`none`,q(window,`keydown`,Bt))}function Bt(){Lt&&(Lt.style.outlineStyle=Rt,Lt=void 0,Rt=void 0,Gt(window,`keydown`,Bt))}function Vt(e){do e=e.parentNode;while((!e.offsetWidth||!e.offsetHeight)&&e!==document.body);return e}function Ht(e){var t=e.getBoundingClientRect();return{x:t.width/e.offsetWidth||1,y:t.height/e.offsetHeight||1,boundingClientRect:t}}var Ut={__proto__:null,TRANSFORM:ft,TRANSITION:pt,TRANSITION_END:mt,get:ht,getStyle:gt,create:G,remove:_t,empty:vt,toFront:yt,toBack:bt,hasClass:xt,addClass:K,removeClass:St,setClass:Ct,getClass:wt,setOpacity:Tt,testProp:Dt,setTransform:Ot,setPosition:kt,getPosition:At,get disableTextSelection(){return jt},get enableTextSelection(){return Mt},disableImageDrag:Ft,enableImageDrag:It,preventOutline:zt,restoreOutline:Bt,getSizedParentNode:Vt,getScale:Ht};function q(e,t,n,r){if(t&&typeof t==`object`)for(var i in t)Jt(e,i,t[i],n);else{t=f(t);for(var a=0,o=t.length;a<o;a++)Jt(e,t[a],n,r)}return this}var Wt=`_leaflet_events`;function Gt(e,t,n,r){if(arguments.length===1)Kt(e),delete e[Wt];else if(t&&typeof t==`object`)for(var i in t)Yt(e,i,t[i],n);else if(t=f(t),arguments.length===2)Kt(e,function(e){return v(t,e)!==-1});else for(var a=0,o=t.length;a<o;a++)Yt(e,t[a],n,r);return this}function Kt(e,t){for(var n in e[Wt]){var r=n.split(/\d/)[0];(!t||t(r))&&Yt(e,r,null,null,n)}}var qt={mouseenter:`mouseover`,mouseleave:`mouseout`,wheel:!(`onwheel`in window)&&`mousewheel`};function Jt(e,t,n,r){var i=t+o(n)+(r?`_`+o(r):``);if(e[Wt]&&e[Wt][i])return this;var a=function(t){return n.call(r||e,t||window.event)},s=a;!U.touchNative&&U.pointer&&t.indexOf(`touch`)===0?a=tt(e,t,a):U.touch&&t===`dblclick`?a=W(e,a):`addEventListener`in e?t===`touchstart`||t===`touchmove`||t===`wheel`||t===`mousewheel`?e.addEventListener(qt[t]||t,a,U.passiveEvents?{passive:!1}:!1):t===`mouseenter`||t===`mouseleave`?(a=function(t){t||=window.event,on(e,t)&&s(t)},e.addEventListener(qt[t],a,!1)):e.addEventListener(t,s,!1):e.attachEvent(`on`+t,a),e[Wt]=e[Wt]||{},e[Wt][i]=a}function Yt(e,t,n,r,i){i||=t+o(n)+(r?`_`+o(r):``);var a=e[Wt]&&e[Wt][i];if(!a)return this;!U.touchNative&&U.pointer&&t.indexOf(`touch`)===0?nt(e,t,a):U.touch&&t===`dblclick`?dt(e,a):`removeEventListener`in e?e.removeEventListener(qt[t]||t,a,!1):e.detachEvent(`on`+t,a),e[Wt][i]=null}function Xt(e){return e.stopPropagation?e.stopPropagation():e.originalEvent?e.originalEvent._stopped=!0:e.cancelBubble=!0,this}function Zt(e){return Jt(e,`wheel`,Xt),this}function Qt(e){return q(e,`mousedown touchstart dblclick contextmenu`,Xt),e._leaflet_disable_click=!0,this}function $t(e){return e.preventDefault?e.preventDefault():e.returnValue=!1,this}function en(e){return $t(e),Xt(e),this}function tn(e){if(e.composedPath)return e.composedPath();for(var t=[],n=e.target;n;)t.push(n),n=n.parentNode;return t}function nn(e,t){if(!t)return new M(e.clientX,e.clientY);var n=Ht(t),r=n.boundingClientRect;return new M((e.clientX-r.left)/n.x-t.clientLeft,(e.clientY-r.top)/n.y-t.clientTop)}var rn=U.linux&&U.chrome?window.devicePixelRatio:U.mac?window.devicePixelRatio*3:window.devicePixelRatio>0?2*window.devicePixelRatio:1;function an(e){return U.edge?e.wheelDeltaY/2:e.deltaY&&e.deltaMode===0?-e.deltaY/rn:e.deltaY&&e.deltaMode===1?-e.deltaY*20:e.deltaY&&e.deltaMode===2?-e.deltaY*60:e.deltaX||e.deltaZ?0:e.wheelDelta?(e.wheelDeltaY||e.wheelDelta)/2:e.detail&&Math.abs(e.detail)<32765?-e.detail*20:e.detail?e.detail/-32765*60:0}function on(e,t){var n=t.relatedTarget;if(!n)return!0;try{for(;n&&n!==e;)n=n.parentNode}catch{return!1}return n!==e}var sn={__proto__:null,on:q,off:Gt,stopPropagation:Xt,disableScrollPropagation:Zt,disableClickPropagation:Qt,preventDefault:$t,stop:en,getPropagationPath:tn,getMousePosition:nn,getWheelDelta:an,isExternalTarget:on,addListener:q,removeListener:Gt},cn=j.extend({run:function(e,t,n,r){this.stop(),this._el=e,this._inProgress=!0,this._duration=n||.25,this._easeOutPower=1/Math.max(r||.5,.2),this._startPos=At(e),this._offset=t.subtract(this._startPos),this._startTime=+new Date,this.fire(`start`),this._animate()},stop:function(){this._inProgress&&(this._step(!0),this._complete())},_animate:function(){this._animId=T(this._animate,this),this._step()},_step:function(e){var t=+new Date-this._startTime,n=this._duration*1e3;t<n?this._runFrame(this._easeOut(t/n),e):(this._runFrame(1),this._complete())},_runFrame:function(e,t){var n=this._startPos.add(this._offset.multiplyBy(e));t&&n._round(),kt(this._el,n),this.fire(`step`)},_complete:function(){E(this._animId),this._inProgress=!1,this.fire(`end`)},_easeOut:function(e){return 1-(1-e)**this._easeOutPower}}),J=j.extend({options:{crs:oe,center:void 0,zoom:void 0,minZoom:void 0,maxZoom:void 0,layers:[],maxBounds:void 0,renderer:void 0,zoomAnimation:!0,zoomAnimationThreshold:4,fadeAnimation:!0,markerZoomAnimation:!0,transform3DLimit:8388608,zoomSnap:1,zoomDelta:1,trackResize:!0},initialize:function(e,t){t=p(this,t),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._sizeChanged=!0,this._initContainer(e),this._initLayout(),this._onResize=i(this._onResize,this),this._initEvents(),t.maxBounds&&this.setMaxBounds(t.maxBounds),t.zoom!==void 0&&(this._zoom=this._limitZoom(t.zoom)),t.center&&t.zoom!==void 0&&this.setView(V(t.center),t.zoom,{reset:!0}),this.callInitHooks(),this._zoomAnimated=pt&&U.any3d&&!U.mobileOpera&&this.options.zoomAnimation,this._zoomAnimated&&(this._createAnimProxy(),q(this._proxy,mt,this._catchTransitionEnd,this)),this._addLayers(this.options.layers)},setView:function(e,t,r){return t=t===void 0?this._zoom:this._limitZoom(t),e=this._limitCenter(V(e),t,this.options.maxBounds),r||={},this._stop(),this._loaded&&!r.reset&&r!==!0&&(r.animate!==void 0&&(r.zoom=n({animate:r.animate},r.zoom),r.pan=n({animate:r.animate,duration:r.duration},r.pan)),this._zoom===t?this._tryAnimatedPan(e,r.pan):this._tryAnimatedZoom&&this._tryAnimatedZoom(e,t,r.zoom))?(clearTimeout(this._sizeTimer),this):(this._resetView(e,t,r.pan&&r.pan.noMoveStart),this)},setZoom:function(e,t){return this._loaded?this.setView(this.getCenter(),e,{zoom:t}):(this._zoom=e,this)},zoomIn:function(e,t){return e||=U.any3d?this.options.zoomDelta:1,this.setZoom(this._zoom+e,t)},zoomOut:function(e,t){return e||=U.any3d?this.options.zoomDelta:1,this.setZoom(this._zoom-e,t)},setZoomAround:function(e,t,n){var r=this.getZoomScale(t),i=this.getSize().divideBy(2),a=(e instanceof M?e:this.latLngToContainerPoint(e)).subtract(i).multiplyBy(1-1/r),o=this.containerPointToLatLng(i.add(a));return this.setView(o,t,{zoom:n})},_getBoundsCenterZoom:function(e,t){t||={},e=e.getBounds?e.getBounds():z(e);var n=P(t.paddingTopLeft||t.padding||[0,0]),r=P(t.paddingBottomRight||t.padding||[0,0]),i=this.getBoundsZoom(e,!1,n.add(r));if(i=typeof t.maxZoom==`number`?Math.min(t.maxZoom,i):i,i===1/0)return{center:e.getCenter(),zoom:i};var a=r.subtract(n).divideBy(2),o=this.project(e.getSouthWest(),i),s=this.project(e.getNorthEast(),i);return{center:this.unproject(o.add(s).divideBy(2).add(a),i),zoom:i}},fitBounds:function(e,t){if(e=z(e),!e.isValid())throw Error(`Bounds are not valid.`);var n=this._getBoundsCenterZoom(e,t);return this.setView(n.center,n.zoom,t)},fitWorld:function(e){return this.fitBounds([[-90,-180],[90,180]],e)},panTo:function(e,t){return this.setView(e,this._zoom,{pan:t})},panBy:function(e,t){if(e=P(e).round(),t||={},!e.x&&!e.y)return this.fire(`moveend`);if(t.animate!==!0&&!this.getSize().contains(e))return this._resetView(this.unproject(this.project(this.getCenter()).add(e)),this.getZoom()),this;if(this._panAnim||(this._panAnim=new cn,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),t.noMoveStart||this.fire(`movestart`),t.animate!==!1){K(this._mapPane,`leaflet-pan-anim`);var n=this._getMapPanePos().subtract(e).round();this._panAnim.run(this._mapPane,n,t.duration||.25,t.easeLinearity)}else this._rawPanBy(e),this.fire(`move`).fire(`moveend`);return this},flyTo:function(e,t,n){if(n||={},n.animate===!1||!U.any3d)return this.setView(e,t,n);this._stop();var r=this.project(this.getCenter()),i=this.project(e),a=this.getSize(),o=this._zoom;e=V(e),t=t===void 0?o:t;var s=Math.max(a.x,a.y),c=s*this.getZoomScale(o,t),l=i.distanceTo(r)||1,u=1.42,d=u*u;function f(e){var t=e?-1:1,n=e?c:s,r=(c*c-s*s+t*d*d*l*l)/(2*n*d*l),i=Math.sqrt(r*r+1)-r;return i<1e-9?-18:Math.log(i)}function p(e){return(Math.exp(e)-Math.exp(-e))/2}function m(e){return(Math.exp(e)+Math.exp(-e))/2}function h(e){return p(e)/m(e)}var g=f(0);function _(e){return s*(m(g)/m(g+u*e))}function v(e){return s*(m(g)*h(g+u*e)-p(g))/d}function y(e){return 1-(1-e)**1.5}var b=Date.now(),x=(f(1)-g)/u,S=n.duration?1e3*n.duration:1e3*x*.8;function C(){var n=(Date.now()-b)/S,a=y(n)*x;n<=1?(this._flyToFrame=T(C,this),this._move(this.unproject(r.add(i.subtract(r).multiplyBy(v(a)/l)),o),this.getScaleZoom(s/_(a),o),{flyTo:!0})):this._move(e,t)._moveEnd(!0)}return this._moveStart(!0,n.noMoveStart),C.call(this),this},flyToBounds:function(e,t){var n=this._getBoundsCenterZoom(e,t);return this.flyTo(n.center,n.zoom,t)},setMaxBounds:function(e){return e=z(e),this.listens(`moveend`,this._panInsideMaxBounds)&&this.off(`moveend`,this._panInsideMaxBounds),e.isValid()?(this.options.maxBounds=e,this._loaded&&this._panInsideMaxBounds(),this.on(`moveend`,this._panInsideMaxBounds)):(this.options.maxBounds=null,this)},setMinZoom:function(e){var t=this.options.minZoom;return this.options.minZoom=e,this._loaded&&t!==e&&(this.fire(`zoomlevelschange`),this.getZoom()<this.options.minZoom)?this.setZoom(e):this},setMaxZoom:function(e){var t=this.options.maxZoom;return this.options.maxZoom=e,this._loaded&&t!==e&&(this.fire(`zoomlevelschange`),this.getZoom()>this.options.maxZoom)?this.setZoom(e):this},panInsideBounds:function(e,t){this._enforcingBounds=!0;var n=this.getCenter(),r=this._limitCenter(n,this._zoom,z(e));return n.equals(r)||this.panTo(r,t),this._enforcingBounds=!1,this},panInside:function(e,t){t||={};var n=P(t.paddingTopLeft||t.padding||[0,0]),r=P(t.paddingBottomRight||t.padding||[0,0]),i=this.project(this.getCenter()),a=this.project(e),o=this.getPixelBounds(),s=I([o.min.add(n),o.max.subtract(r)]),c=s.getSize();if(!s.contains(a)){this._enforcingBounds=!0;var l=a.subtract(s.getCenter()),u=s.extend(a).getSize().subtract(c);i.x+=l.x<0?-u.x:u.x,i.y+=l.y<0?-u.y:u.y,this.panTo(this.unproject(i),t),this._enforcingBounds=!1}return this},invalidateSize:function(e){if(!this._loaded)return this;e=n({animate:!1,pan:!0},e===!0?{animate:!0}:e);var t=this.getSize();this._sizeChanged=!0,this._lastCenter=null;var r=this.getSize(),a=t.divideBy(2).round(),o=r.divideBy(2).round(),s=a.subtract(o);return!s.x&&!s.y?this:(e.animate&&e.pan?this.panBy(s):(e.pan&&this._rawPanBy(s),this.fire(`move`),e.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(i(this.fire,this,`moveend`),200)):this.fire(`moveend`)),this.fire(`resize`,{oldSize:t,newSize:r}))},stop:function(){return this.setZoom(this._limitZoom(this._zoom)),this.options.zoomSnap||this.fire(`viewreset`),this._stop()},locate:function(e){if(e=this._locateOptions=n({timeout:1e4,watch:!1},e),!(`geolocation`in navigator))return this._handleGeolocationError({code:0,message:`Geolocation not supported.`}),this;var t=i(this._handleGeolocationResponse,this),r=i(this._handleGeolocationError,this);return e.watch?this._locationWatchId=navigator.geolocation.watchPosition(t,r,e):navigator.geolocation.getCurrentPosition(t,r,e),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(e){if(this._container._leaflet_id){var t=e.code,n=e.message||(t===1?`permission denied`:t===2?`position unavailable`:`timeout`);this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire(`locationerror`,{code:t,message:`Geolocation error: `+n+`.`})}},_handleGeolocationResponse:function(e){if(this._container._leaflet_id){var t=e.coords.latitude,n=e.coords.longitude,r=new B(t,n),i=r.toBounds(e.coords.accuracy*2),a=this._locateOptions;if(a.setView){var o=this.getBoundsZoom(i);this.setView(r,a.maxZoom?Math.min(o,a.maxZoom):o)}var s={latlng:r,bounds:i,timestamp:e.timestamp};for(var c in e.coords)typeof e.coords[c]==`number`&&(s[c]=e.coords[c]);this.fire(`locationfound`,s)}},addHandler:function(e,t){if(!t)return this;var n=this[e]=new t(this);return this._handlers.push(n),this.options[e]&&n.enable(),this},remove:function(){if(this._initEvents(!0),this.options.maxBounds&&this.off(`moveend`,this._panInsideMaxBounds),this._containerId!==this._container._leaflet_id)throw Error(`Map container is being reused by another instance`);try{delete this._container._leaflet_id,delete this._containerId}catch{this._container._leaflet_id=void 0,this._containerId=void 0}for(var e in this._locationWatchId!==void 0&&this.stopLocate(),this._stop(),_t(this._mapPane),this._clearControlPos&&this._clearControlPos(),this._resizeRequest&&=(E(this._resizeRequest),null),this._clearHandlers(),this._loaded&&this.fire(`unload`),this._layers)this._layers[e].remove();for(e in this._panes)_t(this._panes[e]);return this._layers=[],this._panes=[],delete this._mapPane,delete this._renderer,this},createPane:function(e,t){var n=G(`div`,`leaflet-pane`+(e?` leaflet-`+e.replace(`Pane`,``)+`-pane`:``),t||this._mapPane);return e&&(this._panes[e]=n),n},getCenter:function(){return this._checkIfLoaded(),this._lastCenter&&!this._moved()?this._lastCenter.clone():this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var e=this.getPixelBounds();return new R(this.unproject(e.getBottomLeft()),this.unproject(e.getTopRight()))},getMinZoom:function(){return this.options.minZoom===void 0?this._layersMinZoom||0:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===void 0?this._layersMaxZoom===void 0?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(e,t,n){e=z(e),n=P(n||[0,0]);var r=this.getZoom()||0,i=this.getMinZoom(),a=this.getMaxZoom(),o=e.getNorthWest(),s=e.getSouthEast(),c=this.getSize().subtract(n),l=I(this.project(s,r),this.project(o,r)).getSize(),u=U.any3d?this.options.zoomSnap:1,d=c.x/l.x,f=c.y/l.y,p=t?Math.max(d,f):Math.min(d,f);return r=this.getScaleZoom(p,r),u&&(r=Math.round(r/(u/100))*(u/100),r=t?Math.ceil(r/u)*u:Math.floor(r/u)*u),Math.max(i,Math.min(a,r))},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new M(this._container.clientWidth||0,this._container.clientHeight||0),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(e,t){var n=this._getTopLeftPoint(e,t);return new F(n,n.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._pixelOrigin},getPixelWorldBounds:function(e){return this.options.crs.getProjectedBounds(e===void 0?this.getZoom():e)},getPane:function(e){return typeof e==`string`?this._panes[e]:e},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(e,t){var n=this.options.crs;return t=t===void 0?this._zoom:t,n.scale(e)/n.scale(t)},getScaleZoom:function(e,t){var n=this.options.crs;t=t===void 0?this._zoom:t;var r=n.zoom(e*n.scale(t));return isNaN(r)?1/0:r},project:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.latLngToPoint(V(e),t)},unproject:function(e,t){return t=t===void 0?this._zoom:t,this.options.crs.pointToLatLng(P(e),t)},layerPointToLatLng:function(e){var t=P(e).add(this.getPixelOrigin());return this.unproject(t)},latLngToLayerPoint:function(e){return this.project(V(e))._round()._subtract(this.getPixelOrigin())},wrapLatLng:function(e){return this.options.crs.wrapLatLng(V(e))},wrapLatLngBounds:function(e){return this.options.crs.wrapLatLngBounds(z(e))},distance:function(e,t){return this.options.crs.distance(V(e),V(t))},containerPointToLayerPoint:function(e){return P(e).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(e){return P(e).add(this._getMapPanePos())},containerPointToLatLng:function(e){var t=this.containerPointToLayerPoint(P(e));return this.layerPointToLatLng(t)},latLngToContainerPoint:function(e){return this.layerPointToContainerPoint(this.latLngToLayerPoint(V(e)))},mouseEventToContainerPoint:function(e){return nn(e,this._container)},mouseEventToLayerPoint:function(e){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(e))},mouseEventToLatLng:function(e){return this.layerPointToLatLng(this.mouseEventToLayerPoint(e))},_initContainer:function(e){var t=this._container=ht(e);if(!t)throw Error(`Map container not found.`);if(t._leaflet_id)throw Error(`Map container is already initialized.`);q(t,`scroll`,this._onScroll,this),this._containerId=o(t)},_initLayout:function(){var e=this._container;this._fadeAnimated=this.options.fadeAnimation&&U.any3d,K(e,`leaflet-container`+(U.touch?` leaflet-touch`:``)+(U.retina?` leaflet-retina`:``)+(U.ielt9?` leaflet-oldie`:``)+(U.safari?` leaflet-safari`:``)+(this._fadeAnimated?` leaflet-fade-anim`:``));var t=gt(e,`position`);t!==`absolute`&&t!==`relative`&&t!==`fixed`&&t!==`sticky`&&(e.style.position=`relative`),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var e=this._panes={};this._paneRenderers={},this._mapPane=this.createPane(`mapPane`,this._container),kt(this._mapPane,new M(0,0)),this.createPane(`tilePane`),this.createPane(`overlayPane`),this.createPane(`shadowPane`),this.createPane(`markerPane`),this.createPane(`tooltipPane`),this.createPane(`popupPane`),this.options.markerZoomAnimation||(K(e.markerPane,`leaflet-zoom-hide`),K(e.shadowPane,`leaflet-zoom-hide`))},_resetView:function(e,t,n){kt(this._mapPane,new M(0,0));var r=!this._loaded;this._loaded=!0,t=this._limitZoom(t),this.fire(`viewprereset`);var i=this._zoom!==t;this._moveStart(i,n)._move(e,t)._moveEnd(i),this.fire(`viewreset`),r&&this.fire(`load`)},_moveStart:function(e,t){return e&&this.fire(`zoomstart`),t||this.fire(`movestart`),this},_move:function(e,t,n,r){t===void 0&&(t=this._zoom);var i=this._zoom!==t;return this._zoom=t,this._lastCenter=e,this._pixelOrigin=this._getNewPixelOrigin(e),r?n&&n.pinch&&this.fire(`zoom`,n):((i||n&&n.pinch)&&this.fire(`zoom`,n),this.fire(`move`,n)),this},_moveEnd:function(e){return e&&this.fire(`zoomend`),this.fire(`moveend`)},_stop:function(){return E(this._flyToFrame),this._panAnim&&this._panAnim.stop(),this},_rawPanBy:function(e){kt(this._mapPane,this._getMapPanePos().subtract(e))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_panInsideMaxBounds:function(){this._enforcingBounds||this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw Error(`Set map center and zoom first.`)},_initEvents:function(e){this._targets={},this._targets[o(this._container)]=this;var t=e?Gt:q;t(this._container,`click dblclick mousedown mouseup mouseover mouseout mousemove contextmenu keypress keydown keyup`,this._handleDOMEvent,this),this.options.trackResize&&t(window,`resize`,this._onResize,this),U.any3d&&this.options.transform3DLimit&&(e?this.off:this.on).call(this,`moveend`,this._onMoveEnd)},_onResize:function(){E(this._resizeRequest),this._resizeRequest=T(function(){this.invalidateSize({debounceMoveend:!0})},this)},_onScroll:function(){this._container.scrollTop=0,this._container.scrollLeft=0},_onMoveEnd:function(){var e=this._getMapPanePos();Math.max(Math.abs(e.x),Math.abs(e.y))>=this.options.transform3DLimit&&this._resetView(this.getCenter(),this.getZoom())},_findEventTargets:function(e,t){for(var n=[],r,i=t===`mouseout`||t===`mouseover`,a=e.target||e.srcElement,s=!1;a;){if(r=this._targets[o(a)],r&&(t===`click`||t===`preclick`)&&this._draggableMoved(r)){s=!0;break}if(r&&r.listens(t,!0)&&(i&&!on(a,e)||(n.push(r),i))||a===this._container)break;a=a.parentNode}return!n.length&&!s&&!i&&this.listens(t,!0)&&(n=[this]),n},_isClickDisabled:function(e){for(;e&&e!==this._container;){if(e._leaflet_disable_click)return!0;e=e.parentNode}},_handleDOMEvent:function(e){var t=e.target||e.srcElement;if(!(!this._loaded||t._leaflet_disable_events||e.type===`click`&&this._isClickDisabled(t))){var n=e.type;n===`mousedown`&&zt(t),this._fireDOMEvent(e,n)}},_mouseEvents:[`click`,`dblclick`,`mouseover`,`mouseout`,`contextmenu`],_fireDOMEvent:function(e,t,r){if(e.type===`click`){var i=n({},e);i.type=`preclick`,this._fireDOMEvent(i,i.type,r)}var a=this._findEventTargets(e,t);if(r){for(var o=[],s=0;s<r.length;s++)r[s].listens(t,!0)&&o.push(r[s]);a=o.concat(a)}if(a.length){t===`contextmenu`&&$t(e);var c=a[0],l={originalEvent:e};if(e.type!==`keypress`&&e.type!==`keydown`&&e.type!==`keyup`){var u=c.getLatLng&&(!c._radius||c._radius<=10);l.containerPoint=u?this.latLngToContainerPoint(c.getLatLng()):this.mouseEventToContainerPoint(e),l.layerPoint=this.containerPointToLayerPoint(l.containerPoint),l.latlng=u?c.getLatLng():this.layerPointToLatLng(l.layerPoint)}for(s=0;s<a.length;s++)if(a[s].fire(t,l,!0),l.originalEvent._stopped||a[s].options.bubblingMouseEvents===!1&&v(this._mouseEvents,t)!==-1)return}},_draggableMoved:function(e){return e=e.dragging&&e.dragging.enabled()?e:this,e.dragging&&e.dragging.moved()||this.boxZoom&&this.boxZoom.moved()},_clearHandlers:function(){for(var e=0,t=this._handlers.length;e<t;e++)this._handlers[e].disable()},whenReady:function(e,t){return this._loaded?e.call(t||this,{target:this}):this.on(`load`,e,t),this},_getMapPanePos:function(){return At(this._mapPane)||new M(0,0)},_moved:function(){var e=this._getMapPanePos();return e&&!e.equals([0,0])},_getTopLeftPoint:function(e,t){return(e&&t!==void 0?this._getNewPixelOrigin(e,t):this.getPixelOrigin()).subtract(this._getMapPanePos())},_getNewPixelOrigin:function(e,t){var n=this.getSize()._divideBy(2);return this.project(e,t)._subtract(n)._add(this._getMapPanePos())._round()},_latLngToNewLayerPoint:function(e,t,n){var r=this._getNewPixelOrigin(n,t);return this.project(e,t)._subtract(r)},_latLngBoundsToNewLayerBounds:function(e,t,n){var r=this._getNewPixelOrigin(n,t);return I([this.project(e.getSouthWest(),t)._subtract(r),this.project(e.getNorthWest(),t)._subtract(r),this.project(e.getSouthEast(),t)._subtract(r),this.project(e.getNorthEast(),t)._subtract(r)])},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(e){return this.latLngToLayerPoint(e).subtract(this._getCenterLayerPoint())},_limitCenter:function(e,t,n){if(!n)return e;var r=this.project(e,t),i=this.getSize().divideBy(2),a=new F(r.subtract(i),r.add(i)),o=this._getBoundsOffset(a,n,t);return Math.abs(o.x)<=1&&Math.abs(o.y)<=1?e:this.unproject(r.add(o),t)},_limitOffset:function(e,t){if(!t)return e;var n=this.getPixelBounds(),r=new F(n.min.add(e),n.max.add(e));return e.add(this._getBoundsOffset(r,t))},_getBoundsOffset:function(e,t,n){var r=I(this.project(t.getNorthEast(),n),this.project(t.getSouthWest(),n)),i=r.min.subtract(e.min),a=r.max.subtract(e.max);return new M(this._rebound(i.x,-a.x),this._rebound(i.y,-a.y))},_rebound:function(e,t){return e+t>0?Math.round(e-t)/2:Math.max(0,Math.ceil(e))-Math.max(0,Math.floor(t))},_limitZoom:function(e){var t=this.getMinZoom(),n=this.getMaxZoom(),r=U.any3d?this.options.zoomSnap:1;return r&&(e=Math.round(e/r)*r),Math.max(t,Math.min(n,e))},_onPanTransitionStep:function(){this.fire(`move`)},_onPanTransitionEnd:function(){St(this._mapPane,`leaflet-pan-anim`),this.fire(`moveend`)},_tryAnimatedPan:function(e,t){var n=this._getCenterOffset(e)._trunc();return(t&&t.animate)!==!0&&!this.getSize().contains(n)?!1:(this.panBy(n,t),!0)},_createAnimProxy:function(){var e=this._proxy=G(`div`,`leaflet-proxy leaflet-zoom-animated`);this._panes.mapPane.appendChild(e),this.on(`zoomanim`,function(e){var t=ft,n=this._proxy.style[t];Ot(this._proxy,this.project(e.center,e.zoom),this.getZoomScale(e.zoom,1)),n===this._proxy.style[t]&&this._animatingZoom&&this._onZoomTransitionEnd()},this),this.on(`load moveend`,this._animMoveEnd,this),this._on(`unload`,this._destroyAnimProxy,this)},_destroyAnimProxy:function(){_t(this._proxy),this.off(`load moveend`,this._animMoveEnd,this),delete this._proxy},_animMoveEnd:function(){var e=this.getCenter(),t=this.getZoom();Ot(this._proxy,this.project(e,t),this.getZoomScale(t,1))},_catchTransitionEnd:function(e){this._animatingZoom&&e.propertyName.indexOf(`transform`)>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName(`leaflet-zoom-animated`).length},_tryAnimatedZoom:function(e,t,n){if(this._animatingZoom)return!0;if(n||={},!this._zoomAnimated||n.animate===!1||this._nothingToAnimate()||Math.abs(t-this._zoom)>this.options.zoomAnimationThreshold)return!1;var r=this.getZoomScale(t),i=this._getCenterOffset(e)._divideBy(1-1/r);return n.animate!==!0&&!this.getSize().contains(i)?!1:(T(function(){this._moveStart(!0,n.noMoveStart||!1)._animateZoom(e,t,!0)},this),!0)},_animateZoom:function(e,t,n,r){this._mapPane&&(n&&(this._animatingZoom=!0,this._animateToCenter=e,this._animateToZoom=t,K(this._mapPane,`leaflet-zoom-anim`)),this.fire(`zoomanim`,{center:e,zoom:t,noUpdate:r}),this._tempFireZoomEvent||=this._zoom!==this._animateToZoom,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),setTimeout(i(this._onZoomTransitionEnd,this),250))},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._mapPane&&St(this._mapPane,`leaflet-zoom-anim`),this._animatingZoom=!1,this._move(this._animateToCenter,this._animateToZoom,void 0,!0),this._tempFireZoomEvent&&this.fire(`zoom`),delete this._tempFireZoomEvent,this.fire(`move`),this._moveEnd(!0))}});function ln(e,t){return new J(e,t)}var un=O.extend({options:{position:`topright`},initialize:function(e){p(this,e)},getPosition:function(){return this.options.position},setPosition:function(e){var t=this._map;return t&&t.removeControl(this),this.options.position=e,t&&t.addControl(this),this},getContainer:function(){return this._container},addTo:function(e){this.remove(),this._map=e;var t=this._container=this.onAdd(e),n=this.getPosition(),r=e._controlCorners[n];return K(t,`leaflet-control`),n.indexOf(`bottom`)===-1?r.appendChild(t):r.insertBefore(t,r.firstChild),this._map.on(`unload`,this.remove,this),this},remove:function(){return this._map?(_t(this._container),this.onRemove&&this.onRemove(this._map),this._map.off(`unload`,this.remove,this),this._map=null,this):this},_refocusOnMap:function(e){this._map&&e&&e.screenX>0&&e.screenY>0&&this._map.getContainer().focus()}}),dn=function(e){return new un(e)};J.include({addControl:function(e){return e.addTo(this),this},removeControl:function(e){return e.remove(),this},_initControlPos:function(){var e=this._controlCorners={},t=`leaflet-`,n=this._controlContainer=G(`div`,t+`control-container`,this._container);function r(r,i){var a=t+r+` `+t+i;e[r+i]=G(`div`,a,n)}r(`top`,`left`),r(`top`,`right`),r(`bottom`,`left`),r(`bottom`,`right`)},_clearControlPos:function(){for(var e in this._controlCorners)_t(this._controlCorners[e]);_t(this._controlContainer),delete this._controlCorners,delete this._controlContainer}});var fn=un.extend({options:{collapsed:!0,position:`topright`,autoZIndex:!0,hideSingleBase:!1,sortLayers:!1,sortFunction:function(e,t,n,r){return n<r?-1:+(r<n)}},initialize:function(e,t,n){for(var r in p(this,n),this._layerControlInputs=[],this._layers=[],this._lastZIndex=0,this._handlingClick=!1,this._preventClick=!1,e)this._addLayer(e[r],r);for(r in t)this._addLayer(t[r],r,!0)},onAdd:function(e){this._initLayout(),this._update(),this._map=e,e.on(`zoomend`,this._checkDisabledLayers,this);for(var t=0;t<this._layers.length;t++)this._layers[t].layer.on(`add remove`,this._onLayerChange,this);return this._container},addTo:function(e){return un.prototype.addTo.call(this,e),this._expandIfNotCollapsed()},onRemove:function(){this._map.off(`zoomend`,this._checkDisabledLayers,this);for(var e=0;e<this._layers.length;e++)this._layers[e].layer.off(`add remove`,this._onLayerChange,this)},addBaseLayer:function(e,t){return this._addLayer(e,t),this._map?this._update():this},addOverlay:function(e,t){return this._addLayer(e,t,!0),this._map?this._update():this},removeLayer:function(e){e.off(`add remove`,this._onLayerChange,this);var t=this._getLayer(o(e));return t&&this._layers.splice(this._layers.indexOf(t),1),this._map?this._update():this},expand:function(){K(this._container,`leaflet-control-layers-expanded`),this._section.style.height=null;var e=this._map.getSize().y-(this._container.offsetTop+50);return e<this._section.clientHeight?(K(this._section,`leaflet-control-layers-scrollbar`),this._section.style.height=e+`px`):St(this._section,`leaflet-control-layers-scrollbar`),this._checkDisabledLayers(),this},collapse:function(){return St(this._container,`leaflet-control-layers-expanded`),this},_initLayout:function(){var e=`leaflet-control-layers`,t=this._container=G(`div`,e),n=this.options.collapsed;t.setAttribute(`aria-haspopup`,!0),Qt(t),Zt(t);var r=this._section=G(`section`,e+`-list`);n&&(this._map.on(`click`,this.collapse,this),q(t,{mouseenter:this._expandSafely,mouseleave:this.collapse},this));var i=this._layersLink=G(`a`,e+`-toggle`,t);i.href=`#`,i.title=`Layers`,i.setAttribute(`role`,`button`),q(i,{keydown:function(e){e.keyCode===13&&this._expandSafely()},click:function(e){$t(e),this._expandSafely()}},this),n||this.expand(),this._baseLayersList=G(`div`,e+`-base`,r),this._separator=G(`div`,e+`-separator`,r),this._overlaysList=G(`div`,e+`-overlays`,r),t.appendChild(r)},_getLayer:function(e){for(var t=0;t<this._layers.length;t++)if(this._layers[t]&&o(this._layers[t].layer)===e)return this._layers[t]},_addLayer:function(e,t,n){this._map&&e.on(`add remove`,this._onLayerChange,this),this._layers.push({layer:e,name:t,overlay:n}),this.options.sortLayers&&this._layers.sort(i(function(e,t){return this.options.sortFunction(e.layer,t.layer,e.name,t.name)},this)),this.options.autoZIndex&&e.setZIndex&&(this._lastZIndex++,e.setZIndex(this._lastZIndex)),this._expandIfNotCollapsed()},_update:function(){if(!this._container)return this;vt(this._baseLayersList),vt(this._overlaysList),this._layerControlInputs=[];var e,t,n,r,i=0;for(n=0;n<this._layers.length;n++)r=this._layers[n],this._addItem(r),t||=r.overlay,e||=!r.overlay,i+=+!r.overlay;return this.options.hideSingleBase&&(e&&=i>1,this._baseLayersList.style.display=e?``:`none`),this._separator.style.display=t&&e?``:`none`,this},_onLayerChange:function(e){this._handlingClick||this._update();var t=this._getLayer(o(e.target)),n=t.overlay?e.type===`add`?`overlayadd`:`overlayremove`:e.type===`add`?`baselayerchange`:null;n&&this._map.fire(n,t)},_createRadioElement:function(e,t){var n=`<input type="radio" class="leaflet-control-layers-selector" name="`+e+`"`+(t?` checked="checked"`:``)+`/>`,r=document.createElement(`div`);return r.innerHTML=n,r.firstChild},_addItem:function(e){var t=document.createElement(`label`),n=this._map.hasLayer(e.layer),r;e.overlay?(r=document.createElement(`input`),r.type=`checkbox`,r.className=`leaflet-control-layers-selector`,r.defaultChecked=n):r=this._createRadioElement(`leaflet-base-layers_`+o(this),n),this._layerControlInputs.push(r),r.layerId=o(e.layer),q(r,`click`,this._onInputClick,this);var i=document.createElement(`span`);i.innerHTML=` `+e.name;var a=document.createElement(`span`);return t.appendChild(a),a.appendChild(r),a.appendChild(i),(e.overlay?this._overlaysList:this._baseLayersList).appendChild(t),this._checkDisabledLayers(),t},_onInputClick:function(){if(!this._preventClick){var e=this._layerControlInputs,t,n,r=[],i=[];this._handlingClick=!0;for(var a=e.length-1;a>=0;a--)t=e[a],n=this._getLayer(t.layerId).layer,t.checked?r.push(n):t.checked||i.push(n);for(a=0;a<i.length;a++)this._map.hasLayer(i[a])&&this._map.removeLayer(i[a]);for(a=0;a<r.length;a++)this._map.hasLayer(r[a])||this._map.addLayer(r[a]);this._handlingClick=!1,this._refocusOnMap()}},_checkDisabledLayers:function(){for(var e=this._layerControlInputs,t,n,r=this._map.getZoom(),i=e.length-1;i>=0;i--)t=e[i],n=this._getLayer(t.layerId).layer,t.disabled=n.options.minZoom!==void 0&&r<n.options.minZoom||n.options.maxZoom!==void 0&&r>n.options.maxZoom},_expandIfNotCollapsed:function(){return this._map&&!this.options.collapsed&&this.expand(),this},_expandSafely:function(){var e=this._section;this._preventClick=!0,q(e,`click`,$t),this.expand();var t=this;setTimeout(function(){Gt(e,`click`,$t),t._preventClick=!1})}}),pn=function(e,t,n){return new fn(e,t,n)},mn=un.extend({options:{position:`topleft`,zoomInText:`<span aria-hidden="true">+</span>`,zoomInTitle:`Zoom in`,zoomOutText:`<span aria-hidden="true">−</span>`,zoomOutTitle:`Zoom out`},onAdd:function(e){var t=`leaflet-control-zoom`,n=G(`div`,t+` leaflet-bar`),r=this.options;return this._zoomInButton=this._createButton(r.zoomInText,r.zoomInTitle,t+`-in`,n,this._zoomIn),this._zoomOutButton=this._createButton(r.zoomOutText,r.zoomOutTitle,t+`-out`,n,this._zoomOut),this._updateDisabled(),e.on(`zoomend zoomlevelschange`,this._updateDisabled,this),n},onRemove:function(e){e.off(`zoomend zoomlevelschange`,this._updateDisabled,this)},disable:function(){return this._disabled=!0,this._updateDisabled(),this},enable:function(){return this._disabled=!1,this._updateDisabled(),this},_zoomIn:function(e){!this._disabled&&this._map._zoom<this._map.getMaxZoom()&&this._map.zoomIn(this._map.options.zoomDelta*(e.shiftKey?3:1))},_zoomOut:function(e){!this._disabled&&this._map._zoom>this._map.getMinZoom()&&this._map.zoomOut(this._map.options.zoomDelta*(e.shiftKey?3:1))},_createButton:function(e,t,n,r,i){var a=G(`a`,n,r);return a.innerHTML=e,a.href=`#`,a.title=t,a.setAttribute(`role`,`button`),a.setAttribute(`aria-label`,t),Qt(a),q(a,`click`,en),q(a,`click`,i,this),q(a,`click`,this._refocusOnMap,this),a},_updateDisabled:function(){var e=this._map,t=`leaflet-disabled`;St(this._zoomInButton,t),St(this._zoomOutButton,t),this._zoomInButton.setAttribute(`aria-disabled`,`false`),this._zoomOutButton.setAttribute(`aria-disabled`,`false`),(this._disabled||e._zoom===e.getMinZoom())&&(K(this._zoomOutButton,t),this._zoomOutButton.setAttribute(`aria-disabled`,`true`)),(this._disabled||e._zoom===e.getMaxZoom())&&(K(this._zoomInButton,t),this._zoomInButton.setAttribute(`aria-disabled`,`true`))}});J.mergeOptions({zoomControl:!0}),J.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new mn,this.addControl(this.zoomControl))});var hn=function(e){return new mn(e)},gn=un.extend({options:{position:`bottomleft`,maxWidth:100,metric:!0,imperial:!0},onAdd:function(e){var t=`leaflet-control-scale`,n=G(`div`,t),r=this.options;return this._addScales(r,t+`-line`,n),e.on(r.updateWhenIdle?`moveend`:`move`,this._update,this),e.whenReady(this._update,this),n},onRemove:function(e){e.off(this.options.updateWhenIdle?`moveend`:`move`,this._update,this)},_addScales:function(e,t,n){e.metric&&(this._mScale=G(`div`,t,n)),e.imperial&&(this._iScale=G(`div`,t,n))},_update:function(){var e=this._map,t=e.getSize().y/2,n=e.distance(e.containerPointToLatLng([0,t]),e.containerPointToLatLng([this.options.maxWidth,t]));this._updateScales(n)},_updateScales:function(e){this.options.metric&&e&&this._updateMetric(e),this.options.imperial&&e&&this._updateImperial(e)},_updateMetric:function(e){var t=this._getRoundNum(e),n=t<1e3?t+` m`:t/1e3+` km`;this._updateScale(this._mScale,n,t/e)},_updateImperial:function(e){var t=e*3.2808399,n,r,i;t>5280?(n=t/5280,r=this._getRoundNum(n),this._updateScale(this._iScale,r+` mi`,r/n)):(i=this._getRoundNum(t),this._updateScale(this._iScale,i+` ft`,i/t))},_updateScale:function(e,t,n){e.style.width=Math.round(this.options.maxWidth*n)+`px`,e.innerHTML=t},_getRoundNum:function(e){var t=10**((Math.floor(e)+``).length-1),n=e/t;return n=n>=10?10:n>=5?5:n>=3?3:n>=2?2:1,t*n}}),_n=function(e){return new gn(e)},vn=un.extend({options:{position:`bottomright`,prefix:`<a href="https://leafletjs.com" title="A JavaScript library for interactive maps">`+(U.inlineSvg?`<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8" class="leaflet-attribution-flag"><path fill="#4C7BE1" d="M0 0h12v4H0z"/><path fill="#FFD500" d="M0 4h12v3H0z"/><path fill="#E0BC00" d="M0 7h12v1H0z"/></svg> `:``)+`Leaflet</a>`},initialize:function(e){p(this,e),this._attributions={}},onAdd:function(e){for(var t in e.attributionControl=this,this._container=G(`div`,`leaflet-control-attribution`),Qt(this._container),e._layers)e._layers[t].getAttribution&&this.addAttribution(e._layers[t].getAttribution());return this._update(),e.on(`layeradd`,this._addAttribution,this),this._container},onRemove:function(e){e.off(`layeradd`,this._addAttribution,this)},_addAttribution:function(e){e.layer.getAttribution&&(this.addAttribution(e.layer.getAttribution()),e.layer.once(`remove`,function(){this.removeAttribution(e.layer.getAttribution())},this))},setPrefix:function(e){return this.options.prefix=e,this._update(),this},addAttribution:function(e){return e?(this._attributions[e]||(this._attributions[e]=0),this._attributions[e]++,this._update(),this):this},removeAttribution:function(e){return e&&this._attributions[e]&&(this._attributions[e]--,this._update()),this},_update:function(){if(this._map){var e=[];for(var t in this._attributions)this._attributions[t]&&e.push(t);var n=[];this.options.prefix&&n.push(this.options.prefix),e.length&&n.push(e.join(`, `)),this._container.innerHTML=n.join(` <span aria-hidden="true">|</span> `)}}});J.mergeOptions({attributionControl:!0}),J.addInitHook(function(){this.options.attributionControl&&new vn().addTo(this)}),un.Layers=fn,un.Zoom=mn,un.Scale=gn,un.Attribution=vn,dn.layers=pn,dn.zoom=hn,dn.scale=_n,dn.attribution=function(e){return new vn(e)};var yn=O.extend({initialize:function(e){this._map=e},enable:function(){return this._enabled?this:(this._enabled=!0,this.addHooks(),this)},disable:function(){return this._enabled?(this._enabled=!1,this.removeHooks(),this):this},enabled:function(){return!!this._enabled}});yn.addTo=function(e,t){return e.addHandler(t,this),this};var bn={Events:A},xn=U.touch?`touchstart mousedown`:`mousedown`,Sn=j.extend({options:{clickTolerance:3},initialize:function(e,t,n,r){p(this,r),this._element=e,this._dragStartTarget=t||e,this._preventOutline=n},enable:function(){this._enabled||=(q(this._dragStartTarget,xn,this._onDown,this),!0)},disable:function(){this._enabled&&(Sn._dragging===this&&this.finishDrag(!0),Gt(this._dragStartTarget,xn,this._onDown,this),this._enabled=!1,this._moved=!1)},_onDown:function(e){if(this._enabled&&(this._moved=!1,!xt(this._element,`leaflet-zoom-anim`))){if(e.touches&&e.touches.length!==1){Sn._dragging===this&&this.finishDrag();return}if(!(Sn._dragging||e.shiftKey||e.which!==1&&e.button!==1&&!e.touches)&&(Sn._dragging=this,this._preventOutline&&zt(this._element),Ft(),jt(),!this._moving)){this.fire(`down`);var t=e.touches?e.touches[0]:e,n=Vt(this._element);this._startPoint=new M(t.clientX,t.clientY),this._startPos=At(this._element),this._parentScale=Ht(n);var r=e.type===`mousedown`;q(document,r?`mousemove`:`touchmove`,this._onMove,this),q(document,r?`mouseup`:`touchend touchcancel`,this._onUp,this)}}},_onMove:function(e){if(this._enabled){if(e.touches&&e.touches.length>1){this._moved=!0;return}var t=e.touches&&e.touches.length===1?e.touches[0]:e,n=new M(t.clientX,t.clientY)._subtract(this._startPoint);!n.x&&!n.y||Math.abs(n.x)+Math.abs(n.y)<this.options.clickTolerance||(n.x/=this._parentScale.x,n.y/=this._parentScale.y,$t(e),this._moved||(this.fire(`dragstart`),this._moved=!0,K(document.body,`leaflet-dragging`),this._lastTarget=e.target||e.srcElement,window.SVGElementInstance&&this._lastTarget instanceof window.SVGElementInstance&&(this._lastTarget=this._lastTarget.correspondingUseElement),K(this._lastTarget,`leaflet-drag-target`)),this._newPos=this._startPos.add(n),this._moving=!0,this._lastEvent=e,this._updatePosition())}},_updatePosition:function(){var e={originalEvent:this._lastEvent};this.fire(`predrag`,e),kt(this._element,this._newPos),this.fire(`drag`,e)},_onUp:function(){this._enabled&&this.finishDrag()},finishDrag:function(e){St(document.body,`leaflet-dragging`),this._lastTarget&&=(St(this._lastTarget,`leaflet-drag-target`),null),Gt(document,`mousemove touchmove`,this._onMove,this),Gt(document,`mouseup touchend touchcancel`,this._onUp,this),It(),Mt();var t=this._moved&&this._moving;this._moving=!1,Sn._dragging=!1,t&&this.fire(`dragend`,{noInertia:e,distance:this._newPos.distanceTo(this._startPos)})}});function Cn(e,t,n){var r,i=[1,4,2,8],a,o,s,c,l,u,d,f;for(a=0,u=e.length;a<u;a++)e[a]._code=In(e[a],t);for(s=0;s<4;s++){for(d=i[s],r=[],a=0,u=e.length,o=u-1;a<u;o=a++)c=e[a],l=e[o],c._code&d?l._code&d||(f=Fn(l,c,d,t,n),f._code=In(f,t),r.push(f)):(l._code&d&&(f=Fn(l,c,d,t,n),f._code=In(f,t),r.push(f)),r.push(c));e=r}return e}function wn(e,t){var n,r,i,a,o,s,c,l,u;if(!e||e.length===0)throw Error(`latlngs not passed`);zn(e)||(console.warn(`latlngs are not flat! Only the first ring will be used`),e=e[0]);var d=V([0,0]),f=z(e);f.getNorthWest().distanceTo(f.getSouthWest())*f.getNorthEast().distanceTo(f.getNorthWest())<1700&&(d=Tn(e));var p=e.length,m=[];for(n=0;n<p;n++){var h=V(e[n]);m.push(t.project(V([h.lat-d.lat,h.lng-d.lng])))}for(s=c=l=0,n=0,r=p-1;n<p;r=n++)i=m[n],a=m[r],o=i.y*a.x-a.y*i.x,c+=(i.x+a.x)*o,l+=(i.y+a.y)*o,s+=o*3;u=s===0?m[0]:[c/s,l/s];var g=t.unproject(P(u));return V([g.lat+d.lat,g.lng+d.lng])}function Tn(e){for(var t=0,n=0,r=0,i=0;i<e.length;i++){var a=V(e[i]);t+=a.lat,n+=a.lng,r++}return V([t/r,n/r])}var En={__proto__:null,clipPolygon:Cn,polygonCenter:wn,centroid:Tn};function Dn(e,t){if(!t||!e.length)return e.slice();var n=t*t;return e=Mn(e,n),e=An(e,n),e}function On(e,t,n){return Math.sqrt(Rn(e,t,n,!0))}function kn(e,t,n){return Rn(e,t,n)}function An(e,t){var n=e.length,r=new(typeof Uint8Array<`u`?Uint8Array:Array)(n);r[0]=r[n-1]=1,jn(e,r,t,0,n-1);var i,a=[];for(i=0;i<n;i++)r[i]&&a.push(e[i]);return a}function jn(e,t,n,r,i){var a=0,o,s,c;for(s=r+1;s<=i-1;s++)c=Rn(e[s],e[r],e[i],!0),c>a&&(o=s,a=c);a>n&&(t[o]=1,jn(e,t,n,r,o),jn(e,t,n,o,i))}function Mn(e,t){for(var n=[e[0]],r=1,i=0,a=e.length;r<a;r++)Ln(e[r],e[i])>t&&(n.push(e[r]),i=r);return i<a-1&&n.push(e[a-1]),n}var Nn;function Pn(e,t,n,r,i){var a=r?Nn:In(e,n),o=In(t,n),s,c,l;for(Nn=o;;){if(!(a|o))return[e,t];if(a&o)return!1;s=a||o,c=Fn(e,t,s,n,i),l=In(c,n),s===a?(e=c,a=l):(t=c,o=l)}}function Fn(e,t,n,r,i){var a=t.x-e.x,o=t.y-e.y,s=r.min,c=r.max,l,u;return n&8?(l=e.x+a*(c.y-e.y)/o,u=c.y):n&4?(l=e.x+a*(s.y-e.y)/o,u=s.y):n&2?(l=c.x,u=e.y+o*(c.x-e.x)/a):n&1&&(l=s.x,u=e.y+o*(s.x-e.x)/a),new M(l,u,i)}function In(e,t){var n=0;return e.x<t.min.x?n|=1:e.x>t.max.x&&(n|=2),e.y<t.min.y?n|=4:e.y>t.max.y&&(n|=8),n}function Ln(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r}function Rn(e,t,n,r){var i=t.x,a=t.y,o=n.x-i,s=n.y-a,c=o*o+s*s,l;return c>0&&(l=((e.x-i)*o+(e.y-a)*s)/c,l>1?(i=n.x,a=n.y):l>0&&(i+=o*l,a+=s*l)),o=e.x-i,s=e.y-a,r?o*o+s*s:new M(i,a)}function zn(e){return!_(e[0])||typeof e[0][0]!=`object`&&e[0][0]!==void 0}function Bn(e){return console.warn(`Deprecated use of _flat, please use L.LineUtil.isFlat instead.`),zn(e)}function Vn(e,t){var n,r,i,a,o,s,c,l;if(!e||e.length===0)throw Error(`latlngs not passed`);zn(e)||(console.warn(`latlngs are not flat! Only the first ring will be used`),e=e[0]);var u=V([0,0]),d=z(e);d.getNorthWest().distanceTo(d.getSouthWest())*d.getNorthEast().distanceTo(d.getNorthWest())<1700&&(u=Tn(e));var f=e.length,p=[];for(n=0;n<f;n++){var m=V(e[n]);p.push(t.project(V([m.lat-u.lat,m.lng-u.lng])))}for(n=0,r=0;n<f-1;n++)r+=p[n].distanceTo(p[n+1])/2;if(r===0)l=p[0];else for(n=0,a=0;n<f-1;n++)if(o=p[n],s=p[n+1],i=o.distanceTo(s),a+=i,a>r){c=(a-r)/i,l=[s.x-c*(s.x-o.x),s.y-c*(s.y-o.y)];break}var h=t.unproject(P(l));return V([h.lat+u.lat,h.lng+u.lng])}var Hn={__proto__:null,simplify:Dn,pointToSegmentDistance:On,closestPointOnSegment:kn,clipSegment:Pn,_getEdgeIntersection:Fn,_getBitCode:In,_sqClosestPointOnSegment:Rn,isFlat:zn,_flat:Bn,polylineCenter:Vn},Un={project:function(e){return new M(e.lng,e.lat)},unproject:function(e){return new B(e.y,e.x)},bounds:new F([-180,-90],[180,90])},Wn={R:6378137,R_MINOR:6356752.314245179,bounds:new F([-20037508.34279,-15496570.73972],[20037508.34279,18764656.23138]),project:function(e){var t=Math.PI/180,n=this.R,r=e.lat*t,i=this.R_MINOR/n,a=Math.sqrt(1-i*i),o=a*Math.sin(r),s=Math.tan(Math.PI/4-r/2)/((1-o)/(1+o))**(a/2);return r=-n*Math.log(Math.max(s,1e-10)),new M(e.lng*t*n,r)},unproject:function(e){for(var t=180/Math.PI,n=this.R,r=this.R_MINOR/n,i=Math.sqrt(1-r*r),a=Math.exp(-e.y/n),o=Math.PI/2-2*Math.atan(a),s=0,c=.1,l;s<15&&Math.abs(c)>1e-7;s++)l=i*Math.sin(o),l=((1-l)/(1+l))**(i/2),c=Math.PI/2-2*Math.atan(a*l)-o,o+=c;return new B(o*t,e.x*t/n)}},Gn={__proto__:null,LonLat:Un,Mercator:Wn,SphericalMercator:re},Kn=n({},te,{code:`EPSG:3395`,projection:Wn,transformation:function(){var e=.5/(Math.PI*Wn.R);return ae(e,.5,-e,.5)}()}),qn=n({},te,{code:`EPSG:4326`,projection:Un,transformation:ae(1/180,1,-1/180,.5)}),Jn=n({},ee,{projection:Un,transformation:ae(1,0,-1,0),scale:function(e){return 2**e},zoom:function(e){return Math.log(e)/Math.LN2},distance:function(e,t){var n=t.lng-e.lng,r=t.lat-e.lat;return Math.sqrt(n*n+r*r)},infinite:!0});ee.Earth=te,ee.EPSG3395=Kn,ee.EPSG3857=oe,ee.EPSG900913=se,ee.EPSG4326=qn,ee.Simple=Jn;var Yn=j.extend({options:{pane:`overlayPane`,attribution:null,bubblingMouseEvents:!0},addTo:function(e){return e.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(e){return e&&e.removeLayer(this),this},getPane:function(e){return this._map.getPane(e?this.options[e]||e:this.options.pane)},addInteractiveTarget:function(e){return this._map._targets[o(e)]=this,this},removeInteractiveTarget:function(e){return delete this._map._targets[o(e)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(e){var t=e.target;if(t.hasLayer(this)){if(this._map=t,this._zoomAnimated=t._zoomAnimated,this.getEvents){var n=this.getEvents();t.on(n,this),this.once(`remove`,function(){t.off(n,this)},this)}this.onAdd(t),this.fire(`add`),t.fire(`layeradd`,{layer:this})}}});J.include({addLayer:function(e){if(!e._layerAdd)throw Error(`The provided object is not a Layer.`);var t=o(e);return this._layers[t]?this:(this._layers[t]=e,e._mapToAdd=this,e.beforeAdd&&e.beforeAdd(this),this.whenReady(e._layerAdd,e),this)},removeLayer:function(e){var t=o(e);return this._layers[t]?(this._loaded&&e.onRemove(this),delete this._layers[t],this._loaded&&(this.fire(`layerremove`,{layer:e}),e.fire(`remove`)),e._map=e._mapToAdd=null,this):this},hasLayer:function(e){return o(e)in this._layers},eachLayer:function(e,t){for(var n in this._layers)e.call(t,this._layers[n]);return this},_addLayers:function(e){e=e?_(e)?e:[e]:[];for(var t=0,n=e.length;t<n;t++)this.addLayer(e[t])},_addZoomLimit:function(e){(!isNaN(e.options.maxZoom)||!isNaN(e.options.minZoom))&&(this._zoomBoundLayers[o(e)]=e,this._updateZoomLevels())},_removeZoomLimit:function(e){var t=o(e);this._zoomBoundLayers[t]&&(delete this._zoomBoundLayers[t],this._updateZoomLevels())},_updateZoomLevels:function(){var e=1/0,t=-1/0,n=this._getZoomSpan();for(var r in this._zoomBoundLayers){var i=this._zoomBoundLayers[r].options;e=i.minZoom===void 0?e:Math.min(e,i.minZoom),t=i.maxZoom===void 0?t:Math.max(t,i.maxZoom)}this._layersMaxZoom=t===-1/0?void 0:t,this._layersMinZoom=e===1/0?void 0:e,n!==this._getZoomSpan()&&this.fire(`zoomlevelschange`),this.options.maxZoom===void 0&&this._layersMaxZoom&&this.getZoom()>this._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()<this._layersMinZoom&&this.setZoom(this._layersMinZoom)}});var Xn=Yn.extend({initialize:function(e,t){p(this,t),this._layers={};var n,r;if(e)for(n=0,r=e.length;n<r;n++)this.addLayer(e[n])},addLayer:function(e){var t=this.getLayerId(e);return this._layers[t]=e,this._map&&this._map.addLayer(e),this},removeLayer:function(e){var t=e in this._layers?e:this.getLayerId(e);return this._map&&this._layers[t]&&this._map.removeLayer(this._layers[t]),delete this._layers[t],this},hasLayer:function(e){return(typeof e==`number`?e:this.getLayerId(e))in this._layers},clearLayers:function(){return this.eachLayer(this.removeLayer,this)},invoke:function(e){var t=Array.prototype.slice.call(arguments,1),n,r;for(n in this._layers)r=this._layers[n],r[e]&&r[e].apply(r,t);return this},onAdd:function(e){this.eachLayer(e.addLayer,e)},onRemove:function(e){this.eachLayer(e.removeLayer,e)},eachLayer:function(e,t){for(var n in this._layers)e.call(t,this._layers[n]);return this},getLayer:function(e){return this._layers[e]},getLayers:function(){var e=[];return this.eachLayer(e.push,e),e},setZIndex:function(e){return this.invoke(`setZIndex`,e)},getLayerId:function(e){return o(e)}}),Zn=function(e,t){return new Xn(e,t)},Qn=Xn.extend({addLayer:function(e){return this.hasLayer(e)?this:(e.addEventParent(this),Xn.prototype.addLayer.call(this,e),this.fire(`layeradd`,{layer:e}))},removeLayer:function(e){return this.hasLayer(e)?(e in this._layers&&(e=this._layers[e]),e.removeEventParent(this),Xn.prototype.removeLayer.call(this,e),this.fire(`layerremove`,{layer:e})):this},setStyle:function(e){return this.invoke(`setStyle`,e)},bringToFront:function(){return this.invoke(`bringToFront`)},bringToBack:function(){return this.invoke(`bringToBack`)},getBounds:function(){var e=new R;for(var t in this._layers){var n=this._layers[t];e.extend(n.getBounds?n.getBounds():n.getLatLng())}return e}}),$n=function(e,t){return new Qn(e,t)},er=O.extend({options:{popupAnchor:[0,0],tooltipAnchor:[0,0],crossOrigin:!1},initialize:function(e){p(this,e)},createIcon:function(e){return this._createIcon(`icon`,e)},createShadow:function(e){return this._createIcon(`shadow`,e)},_createIcon:function(e,t){var n=this._getIconUrl(e);if(!n){if(e===`icon`)throw Error(`iconUrl not set in Icon options (see the docs).`);return null}var r=this._createImg(n,t&&t.tagName===`IMG`?t:null);return this._setIconStyles(r,e),(this.options.crossOrigin||this.options.crossOrigin===``)&&(r.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),r},_setIconStyles:function(e,t){var n=this.options,r=n[t+`Size`];typeof r==`number`&&(r=[r,r]);var i=P(r),a=P(t===`shadow`&&n.shadowAnchor||n.iconAnchor||i&&i.divideBy(2,!0));e.className=`leaflet-marker-`+t+` `+(n.className||``),a&&(e.style.marginLeft=-a.x+`px`,e.style.marginTop=-a.y+`px`),i&&(e.style.width=i.x+`px`,e.style.height=i.y+`px`)},_createImg:function(e,t){return t||=document.createElement(`img`),t.src=e,t},_getIconUrl:function(e){return U.retina&&this.options[e+`RetinaUrl`]||this.options[e+`Url`]}});function tr(e){return new er(e)}var nr=er.extend({options:{iconUrl:`marker-icon.png`,iconRetinaUrl:`marker-icon-2x.png`,shadowUrl:`marker-shadow.png`,iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],tooltipAnchor:[16,-28],shadowSize:[41,41]},_getIconUrl:function(e){return typeof nr.imagePath!=`string`&&(nr.imagePath=this._detectIconPath()),(this.options.imagePath||nr.imagePath)+er.prototype._getIconUrl.call(this,e)},_stripUrl:function(e){var t=function(e,t,n){var r=t.exec(e);return r&&r[n]};return e=t(e,/^url\((['"])?(.+)\1\)$/,2),e&&t(e,/^(.*)marker-icon\.png$/,1)},_detectIconPath:function(){var e=G(`div`,`leaflet-default-icon-path`,document.body),t=gt(e,`background-image`)||gt(e,`backgroundImage`);if(document.body.removeChild(e),t=this._stripUrl(t),t)return t;var n=document.querySelector(`link[href$="leaflet.css"]`);return n?n.href.substring(0,n.href.length-11-1):``}}),rr=yn.extend({initialize:function(e){this._marker=e},addHooks:function(){var e=this._marker._icon;this._draggable||=new Sn(e,e,!0),this._draggable.on({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).enable(),K(e,`leaflet-marker-draggable`)},removeHooks:function(){this._draggable.off({dragstart:this._onDragStart,predrag:this._onPreDrag,drag:this._onDrag,dragend:this._onDragEnd},this).disable(),this._marker._icon&&St(this._marker._icon,`leaflet-marker-draggable`)},moved:function(){return this._draggable&&this._draggable._moved},_adjustPan:function(e){var t=this._marker,n=t._map,r=this._marker.options.autoPanSpeed,i=this._marker.options.autoPanPadding,a=At(t._icon),o=n.getPixelBounds(),s=n.getPixelOrigin(),c=I(o.min._subtract(s).add(i),o.max._subtract(s).subtract(i));if(!c.contains(a)){var l=P((Math.max(c.max.x,a.x)-c.max.x)/(o.max.x-c.max.x)-(Math.min(c.min.x,a.x)-c.min.x)/(o.min.x-c.min.x),(Math.max(c.max.y,a.y)-c.max.y)/(o.max.y-c.max.y)-(Math.min(c.min.y,a.y)-c.min.y)/(o.min.y-c.min.y)).multiplyBy(r);n.panBy(l,{animate:!1}),this._draggable._newPos._add(l),this._draggable._startPos._add(l),kt(t._icon,this._draggable._newPos),this._onDrag(e),this._panRequest=T(this._adjustPan.bind(this,e))}},_onDragStart:function(){this._oldLatLng=this._marker.getLatLng(),this._marker.closePopup&&this._marker.closePopup(),this._marker.fire(`movestart`).fire(`dragstart`)},_onPreDrag:function(e){this._marker.options.autoPan&&(E(this._panRequest),this._panRequest=T(this._adjustPan.bind(this,e)))},_onDrag:function(e){var t=this._marker,n=t._shadow,r=At(t._icon),i=t._map.layerPointToLatLng(r);n&&kt(n,r),t._latlng=i,e.latlng=i,e.oldLatLng=this._oldLatLng,t.fire(`move`,e).fire(`drag`,e)},_onDragEnd:function(e){E(this._panRequest),delete this._oldLatLng,this._marker.fire(`moveend`).fire(`dragend`,e)}}),ir=Yn.extend({options:{icon:new nr,interactive:!0,keyboard:!0,title:``,alt:`Marker`,zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250,pane:`markerPane`,shadowPane:`shadowPane`,bubblingMouseEvents:!1,autoPanOnFocus:!0,draggable:!1,autoPan:!1,autoPanPadding:[50,50],autoPanSpeed:10},initialize:function(e,t){p(this,t),this._latlng=V(e)},onAdd:function(e){this._zoomAnimated=this._zoomAnimated&&e.options.markerZoomAnimation,this._zoomAnimated&&e.on(`zoomanim`,this._animateZoom,this),this._initIcon(),this.update()},onRemove:function(e){this.dragging&&this.dragging.enabled()&&(this.options.draggable=!0,this.dragging.removeHooks()),delete this.dragging,this._zoomAnimated&&e.off(`zoomanim`,this._animateZoom,this),this._removeIcon(),this._removeShadow()},getEvents:function(){return{zoom:this.update,viewreset:this.update}},getLatLng:function(){return this._latlng},setLatLng:function(e){var t=this._latlng;return this._latlng=V(e),this.update(),this.fire(`move`,{oldLatLng:t,latlng:this._latlng})},setZIndexOffset:function(e){return this.options.zIndexOffset=e,this.update()},getIcon:function(){return this.options.icon},setIcon:function(e){return this.options.icon=e,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup,this._popup.options),this},getElement:function(){return this._icon},update:function(){if(this._icon&&this._map){var e=this._map.latLngToLayerPoint(this._latlng).round();this._setPos(e)}return this},_initIcon:function(){var e=this.options,t=`leaflet-zoom-`+(this._zoomAnimated?`animated`:`hide`),n=e.icon.createIcon(this._icon),r=!1;n!==this._icon&&(this._icon&&this._removeIcon(),r=!0,e.title&&(n.title=e.title),n.tagName===`IMG`&&(n.alt=e.alt||``)),K(n,t),e.keyboard&&(n.tabIndex=`0`,n.setAttribute(`role`,`button`)),this._icon=n,e.riseOnHover&&this.on({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&q(n,`focus`,this._panOnFocus,this);var i=e.icon.createShadow(this._shadow),a=!1;i!==this._shadow&&(this._removeShadow(),a=!0),i&&(K(i,t),i.alt=``),this._shadow=i,e.opacity<1&&this._updateOpacity(),r&&this.getPane().appendChild(this._icon),this._initInteraction(),i&&a&&this.getPane(e.shadowPane).appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&this.off({mouseover:this._bringToFront,mouseout:this._resetZIndex}),this.options.autoPanOnFocus&&Gt(this._icon,`focus`,this._panOnFocus,this),_t(this._icon),this.removeInteractiveTarget(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&_t(this._shadow),this._shadow=null},_setPos:function(e){this._icon&&kt(this._icon,e),this._shadow&&kt(this._shadow,e),this._zIndex=e.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(e){this._icon&&(this._icon.style.zIndex=this._zIndex+e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center).round();this._setPos(t)},_initInteraction:function(){if(this.options.interactive&&(K(this._icon,`leaflet-interactive`),this.addInteractiveTarget(this._icon),rr)){var e=this.options.draggable;this.dragging&&(e=this.dragging.enabled(),this.dragging.disable()),this.dragging=new rr(this),e&&this.dragging.enable()}},setOpacity:function(e){return this.options.opacity=e,this._map&&this._updateOpacity(),this},_updateOpacity:function(){var e=this.options.opacity;this._icon&&Tt(this._icon,e),this._shadow&&Tt(this._shadow,e)},_bringToFront:function(){this._updateZIndex(this.options.riseOffset)},_resetZIndex:function(){this._updateZIndex(0)},_panOnFocus:function(){var e=this._map;if(e){var t=this.options.icon.options,n=t.iconSize?P(t.iconSize):P(0,0),r=t.iconAnchor?P(t.iconAnchor):P(0,0);e.panInside(this._latlng,{paddingTopLeft:r,paddingBottomRight:n.subtract(r)})}},_getPopupAnchor:function(){return this.options.icon.options.popupAnchor},_getTooltipAnchor:function(){return this.options.icon.options.tooltipAnchor}});function ar(e,t){return new ir(e,t)}var or=Yn.extend({options:{stroke:!0,color:`#3388ff`,weight:3,opacity:1,lineCap:`round`,lineJoin:`round`,dashArray:null,dashOffset:null,fill:!1,fillColor:null,fillOpacity:.2,fillRule:`evenodd`,interactive:!0,bubblingMouseEvents:!0},beforeAdd:function(e){this._renderer=e.getRenderer(this)},onAdd:function(){this._renderer._initPath(this),this._reset(),this._renderer._addPath(this)},onRemove:function(){this._renderer._removePath(this)},redraw:function(){return this._map&&this._renderer._updatePath(this),this},setStyle:function(e){return p(this,e),this._renderer&&(this._renderer._updateStyle(this),this.options.stroke&&e&&Object.prototype.hasOwnProperty.call(e,`weight`)&&this._updateBounds()),this},bringToFront:function(){return this._renderer&&this._renderer._bringToFront(this),this},bringToBack:function(){return this._renderer&&this._renderer._bringToBack(this),this},getElement:function(){return this._path},_reset:function(){this._project(),this._update()},_clickTolerance:function(){return(this.options.stroke?this.options.weight/2:0)+(this._renderer.options.tolerance||0)}}),sr=or.extend({options:{fill:!0,radius:10},initialize:function(e,t){p(this,t),this._latlng=V(e),this._radius=this.options.radius},setLatLng:function(e){var t=this._latlng;return this._latlng=V(e),this.redraw(),this.fire(`move`,{oldLatLng:t,latlng:this._latlng})},getLatLng:function(){return this._latlng},setRadius:function(e){return this.options.radius=this._radius=e,this.redraw()},getRadius:function(){return this._radius},setStyle:function(e){var t=e&&e.radius||this._radius;return or.prototype.setStyle.call(this,e),this.setRadius(t),this},_project:function(){this._point=this._map.latLngToLayerPoint(this._latlng),this._updateBounds()},_updateBounds:function(){var e=this._radius,t=this._radiusY||e,n=this._clickTolerance(),r=[e+n,t+n];this._pxBounds=new F(this._point.subtract(r),this._point.add(r))},_update:function(){this._map&&this._updatePath()},_updatePath:function(){this._renderer._updateCircle(this)},_empty:function(){return this._radius&&!this._renderer._bounds.intersects(this._pxBounds)},_containsPoint:function(e){return e.distanceTo(this._point)<=this._radius+this._clickTolerance()}});function cr(e,t){return new sr(e,t)}var lr=sr.extend({initialize:function(e,t,r){if(typeof t==`number`&&(t=n({},r,{radius:t})),p(this,t),this._latlng=V(e),isNaN(this.options.radius))throw Error(`Circle radius cannot be NaN`);this._mRadius=this.options.radius},setRadius:function(e){return this._mRadius=e,this.redraw()},getRadius:function(){return this._mRadius},getBounds:function(){var e=[this._radius,this._radiusY||this._radius];return new R(this._map.layerPointToLatLng(this._point.subtract(e)),this._map.layerPointToLatLng(this._point.add(e)))},setStyle:or.prototype.setStyle,_project:function(){var e=this._latlng.lng,t=this._latlng.lat,n=this._map,r=n.options.crs;if(r.distance===te.distance){var i=Math.PI/180,a=this._mRadius/te.R/i,o=n.project([t+a,e]),s=n.project([t-a,e]),c=o.add(s).divideBy(2),l=n.unproject(c).lat,u=Math.acos((Math.cos(a*i)-Math.sin(t*i)*Math.sin(l*i))/(Math.cos(t*i)*Math.cos(l*i)))/i;(isNaN(u)||u===0)&&(u=a/Math.cos(Math.PI/180*t)),this._point=c.subtract(n.getPixelOrigin()),this._radius=isNaN(u)?0:c.x-n.project([l,e-u]).x,this._radiusY=c.y-o.y}else{var d=r.unproject(r.project(this._latlng).subtract([this._mRadius,0]));this._point=n.latLngToLayerPoint(this._latlng),this._radius=this._point.x-n.latLngToLayerPoint(d).x}this._updateBounds()}});function ur(e,t,n){return new lr(e,t,n)}var dr=or.extend({options:{smoothFactor:1,noClip:!1},initialize:function(e,t){p(this,t),this._setLatLngs(e)},getLatLngs:function(){return this._latlngs},setLatLngs:function(e){return this._setLatLngs(e),this.redraw()},isEmpty:function(){return!this._latlngs.length},closestLayerPoint:function(e){for(var t=1/0,n=null,r=Rn,i,a,o=0,s=this._parts.length;o<s;o++)for(var c=this._parts[o],l=1,u=c.length;l<u;l++){i=c[l-1],a=c[l];var d=r(e,i,a,!0);d<t&&(t=d,n=r(e,i,a))}return n&&(n.distance=Math.sqrt(t)),n},getCenter:function(){if(!this._map)throw Error(`Must add layer to map before using getCenter()`);return Vn(this._defaultShape(),this._map.options.crs)},getBounds:function(){return this._bounds},addLatLng:function(e,t){return t||=this._defaultShape(),e=V(e),t.push(e),this._bounds.extend(e),this.redraw()},_setLatLngs:function(e){this._bounds=new R,this._latlngs=this._convertLatLngs(e)},_defaultShape:function(){return zn(this._latlngs)?this._latlngs:this._latlngs[0]},_convertLatLngs:function(e){for(var t=[],n=zn(e),r=0,i=e.length;r<i;r++)n?(t[r]=V(e[r]),this._bounds.extend(t[r])):t[r]=this._convertLatLngs(e[r]);return t},_project:function(){var e=new F;this._rings=[],this._projectLatlngs(this._latlngs,this._rings,e),this._bounds.isValid()&&e.isValid()&&(this._rawPxBounds=e,this._updateBounds())},_updateBounds:function(){var e=this._clickTolerance(),t=new M(e,e);this._rawPxBounds&&(this._pxBounds=new F([this._rawPxBounds.min.subtract(t),this._rawPxBounds.max.add(t)]))},_projectLatlngs:function(e,t,n){var r=e[0]instanceof B,i=e.length,a,o;if(r){for(o=[],a=0;a<i;a++)o[a]=this._map.latLngToLayerPoint(e[a]),n.extend(o[a]);t.push(o)}else for(a=0;a<i;a++)this._projectLatlngs(e[a],t,n)},_clipPoints:function(){var e=this._renderer._bounds;if(this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}var t=this._parts,n,r,i,a,o,s,c;for(n=0,i=0,a=this._rings.length;n<a;n++)for(c=this._rings[n],r=0,o=c.length;r<o-1;r++)s=Pn(c[r],c[r+1],e,r,!0),s&&(t[i]=t[i]||[],t[i].push(s[0]),(s[1]!==c[r+1]||r===o-2)&&(t[i].push(s[1]),i++))}},_simplifyPoints:function(){for(var e=this._parts,t=this.options.smoothFactor,n=0,r=e.length;n<r;n++)e[n]=Dn(e[n],t)},_update:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),this._updatePath())},_updatePath:function(){this._renderer._updatePoly(this)},_containsPoint:function(e,t){var n,r,i,a,o,s,c=this._clickTolerance();if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(n=0,a=this._parts.length;n<a;n++)for(s=this._parts[n],r=0,o=s.length,i=o-1;r<o;i=r++)if(!(!t&&r===0)&&On(e,s[i],s[r])<=c)return!0;return!1}});function fr(e,t){return new dr(e,t)}dr._flat=Bn;var pr=dr.extend({options:{fill:!0},isEmpty:function(){return!this._latlngs.length||!this._latlngs[0].length},getCenter:function(){if(!this._map)throw Error(`Must add layer to map before using getCenter()`);return wn(this._defaultShape(),this._map.options.crs)},_convertLatLngs:function(e){var t=dr.prototype._convertLatLngs.call(this,e),n=t.length;return n>=2&&t[0]instanceof B&&t[0].equals(t[n-1])&&t.pop(),t},_setLatLngs:function(e){dr.prototype._setLatLngs.call(this,e),zn(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return zn(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var e=this._renderer._bounds,t=this.options.weight,n=new M(t,t);if(e=new F(e.min.subtract(n),e.max.add(n)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(e))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,i=this._rings.length,a;r<i;r++)a=Cn(this._rings[r],e,!0),a.length&&this._parts.push(a)}},_updatePath:function(){this._renderer._updatePoly(this,!0)},_containsPoint:function(e){var t=!1,n,r,i,a,o,s,c,l;if(!this._pxBounds||!this._pxBounds.contains(e))return!1;for(a=0,c=this._parts.length;a<c;a++)for(n=this._parts[a],o=0,l=n.length,s=l-1;o<l;s=o++)r=n[o],i=n[s],r.y>e.y!=i.y>e.y&&e.x<(i.x-r.x)*(e.y-r.y)/(i.y-r.y)+r.x&&(t=!t);return t||dr.prototype._containsPoint.call(this,e,!0)}});function mr(e,t){return new pr(e,t)}var hr=Qn.extend({initialize:function(e,t){p(this,t),this._layers={},e&&this.addData(e)},addData:function(e){var t=_(e)?e:e.features,n,r,i;if(t){for(n=0,r=t.length;n<r;n++)i=t[n],(i.geometries||i.geometry||i.features||i.coordinates)&&this.addData(i);return this}var a=this.options;if(a.filter&&!a.filter(e))return this;var o=gr(e,a);return o?(o.feature=Cr(e),o.defaultOptions=o.options,this.resetStyle(o),a.onEachFeature&&a.onEachFeature(e,o),this.addLayer(o)):this},resetStyle:function(e){return e===void 0?this.eachLayer(this.resetStyle,this):(e.options=n({},e.defaultOptions),this._setLayerStyle(e,this.options.style),this)},setStyle:function(e){return this.eachLayer(function(t){this._setLayerStyle(t,e)},this)},_setLayerStyle:function(e,t){e.setStyle&&(typeof t==`function`&&(t=t(e.feature)),e.setStyle(t))}});function gr(e,t){var n=e.type===`Feature`?e.geometry:e,r=n?n.coordinates:null,i=[],a=t&&t.pointToLayer,o=t&&t.coordsToLatLng||vr,s,c,l,u;if(!r&&!n)return null;switch(n.type){case`Point`:return s=o(r),_r(a,e,s,t);case`MultiPoint`:for(l=0,u=r.length;l<u;l++)s=o(r[l]),i.push(_r(a,e,s,t));return new Qn(i);case`LineString`:case`MultiLineString`:return c=yr(r,n.type===`LineString`?0:1,o),new dr(c,t);case`Polygon`:case`MultiPolygon`:return c=yr(r,n.type===`Polygon`?1:2,o),new pr(c,t);case`GeometryCollection`:for(l=0,u=n.geometries.length;l<u;l++){var d=gr({geometry:n.geometries[l],type:`Feature`,properties:e.properties},t);d&&i.push(d)}return new Qn(i);case`FeatureCollection`:for(l=0,u=n.features.length;l<u;l++){var f=gr(n.features[l],t);f&&i.push(f)}return new Qn(i);default:throw Error(`Invalid GeoJSON object.`)}}function _r(e,t,n,r){return e?e(t,n):new ir(n,r&&r.markersInheritOptions&&r)}function vr(e){return new B(e[1],e[0],e[2])}function yr(e,t,n){for(var r=[],i=0,a=e.length,o;i<a;i++)o=t?yr(e[i],t-1,n):(n||vr)(e[i]),r.push(o);return r}function br(e,t){return e=V(e),e.alt===void 0?[u(e.lng,t),u(e.lat,t)]:[u(e.lng,t),u(e.lat,t),u(e.alt,t)]}function xr(e,t,n,r){for(var i=[],a=0,o=e.length;a<o;a++)i.push(t?xr(e[a],zn(e[a])?0:t-1,n,r):br(e[a],r));return!t&&n&&i.length>0&&i.push(i[0].slice()),i}function Sr(e,t){return e.feature?n({},e.feature,{geometry:t}):Cr(t)}function Cr(e){return e.type===`Feature`||e.type===`FeatureCollection`?e:{type:`Feature`,properties:{},geometry:e}}var wr={toGeoJSON:function(e){return Sr(this,{type:`Point`,coordinates:br(this.getLatLng(),e)})}};ir.include(wr),lr.include(wr),sr.include(wr),dr.include({toGeoJSON:function(e){var t=!zn(this._latlngs),n=xr(this._latlngs,+!!t,!1,e);return Sr(this,{type:(t?`Multi`:``)+`LineString`,coordinates:n})}}),pr.include({toGeoJSON:function(e){var t=!zn(this._latlngs),n=t&&!zn(this._latlngs[0]),r=xr(this._latlngs,n?2:+!!t,!0,e);return t||(r=[r]),Sr(this,{type:(n?`Multi`:``)+`Polygon`,coordinates:r})}}),Xn.include({toMultiPoint:function(e){var t=[];return this.eachLayer(function(n){t.push(n.toGeoJSON(e).geometry.coordinates)}),Sr(this,{type:`MultiPoint`,coordinates:t})},toGeoJSON:function(e){var t=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(t===`MultiPoint`)return this.toMultiPoint(e);var n=t===`GeometryCollection`,r=[];return this.eachLayer(function(t){if(t.toGeoJSON){var i=t.toGeoJSON(e);if(n)r.push(i.geometry);else{var a=Cr(i);a.type===`FeatureCollection`?r.push.apply(r,a.features):r.push(a)}}}),n?Sr(this,{geometries:r,type:`GeometryCollection`}):{type:`FeatureCollection`,features:r}}});function Tr(e,t){return new hr(e,t)}var Er=Tr,Dr=Yn.extend({options:{opacity:1,alt:``,interactive:!1,crossOrigin:!1,errorOverlayUrl:``,zIndex:1,className:``},initialize:function(e,t,n){this._url=e,this._bounds=z(t),p(this,n)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(K(this._image,`leaflet-interactive`),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){_t(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(e){return this.options.opacity=e,this._image&&this._updateOpacity(),this},setStyle:function(e){return e.opacity&&this.setOpacity(e.opacity),this},bringToFront:function(){return this._map&&yt(this._image),this},bringToBack:function(){return this._map&&bt(this._image),this},setUrl:function(e){return this._url=e,this._image&&(this._image.src=e),this},setBounds:function(e){return this._bounds=z(e),this._map&&this._reset(),this},getEvents:function(){var e={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var e=this._url.tagName===`IMG`,t=this._image=e?this._url:G(`img`);if(K(t,`leaflet-image-layer`),this._zoomAnimated&&K(t,`leaflet-zoom-animated`),this.options.className&&K(t,this.options.className),t.onselectstart=l,t.onmousemove=l,t.onload=i(this.fire,this,`load`),t.onerror=i(this._overlayOnError,this,`error`),(this.options.crossOrigin||this.options.crossOrigin===``)&&(t.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),e){this._url=t.src;return}t.src=this._url,t.alt=this.options.alt},_animateZoom:function(e){var t=this._map.getZoomScale(e.zoom),n=this._map._latLngBoundsToNewLayerBounds(this._bounds,e.zoom,e.center).min;Ot(this._image,n,t)},_reset:function(){var e=this._image,t=new F(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),n=t.getSize();kt(e,t.min),e.style.width=n.x+`px`,e.style.height=n.y+`px`},_updateOpacity:function(){Tt(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire(`error`);var e=this.options.errorOverlayUrl;e&&this._url!==e&&(this._url=e,this._image.src=e)},getCenter:function(){return this._bounds.getCenter()}}),Or=function(e,t,n){return new Dr(e,t,n)},kr=Dr.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var e=this._url.tagName===`VIDEO`,t=this._image=e?this._url:G(`video`);if(K(t,`leaflet-image-layer`),this._zoomAnimated&&K(t,`leaflet-zoom-animated`),this.options.className&&K(t,this.options.className),t.onselectstart=l,t.onmousemove=l,t.onloadeddata=i(this.fire,this,`load`),e){for(var n=t.getElementsByTagName(`source`),r=[],a=0;a<n.length;a++)r.push(n[a].src);this._url=n.length>0?r:[t.src];return}_(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(t.style,`objectFit`)&&(t.style.objectFit=`fill`),t.autoplay=!!this.options.autoplay,t.loop=!!this.options.loop,t.muted=!!this.options.muted,t.playsInline=!!this.options.playsInline;for(var o=0;o<this._url.length;o++){var s=G(`source`);s.src=this._url[o],t.appendChild(s)}}});function Ar(e,t,n){return new kr(e,t,n)}var jr=Dr.extend({_initImage:function(){var e=this._image=this._url;K(e,`leaflet-image-layer`),this._zoomAnimated&&K(e,`leaflet-zoom-animated`),this.options.className&&K(e,this.options.className),e.onselectstart=l,e.onmousemove=l}});function Mr(e,t,n){return new jr(e,t,n)}var Nr=Yn.extend({options:{interactive:!1,offset:[0,0],className:``,pane:void 0,content:``},initialize:function(e,t){e&&(e instanceof B||_(e))?(this._latlng=V(e),p(this,t)):(p(this,e),this._source=t),this.options.content&&(this._content=this.options.content)},openOn:function(e){return e=arguments.length?e:this._source._map,e.hasLayer(this)||e.addLayer(this),this},close:function(){return this._map&&this._map.removeLayer(this),this},toggle:function(e){return this._map?this.close():(arguments.length?this._source=e:e=this._source,this._prepareOpen(),this.openOn(e._map)),this},onAdd:function(e){this._zoomAnimated=e._zoomAnimated,this._container||this._initLayout(),e._fadeAnimated&&Tt(this._container,0),clearTimeout(this._removeTimeout),this.getPane().appendChild(this._container),this.update(),e._fadeAnimated&&Tt(this._container,1),this.bringToFront(),this.options.interactive&&(K(this._container,`leaflet-interactive`),this.addInteractiveTarget(this._container))},onRemove:function(e){e._fadeAnimated?(Tt(this._container,0),this._removeTimeout=setTimeout(i(_t,void 0,this._container),200)):_t(this._container),this.options.interactive&&(St(this._container,`leaflet-interactive`),this.removeInteractiveTarget(this._container))},getLatLng:function(){return this._latlng},setLatLng:function(e){return this._latlng=V(e),this._map&&(this._updatePosition(),this._adjustPan()),this},getContent:function(){return this._content},setContent:function(e){return this._content=e,this.update(),this},getElement:function(){return this._container},update:function(){this._map&&(this._container.style.visibility=`hidden`,this._updateContent(),this._updateLayout(),this._updatePosition(),this._container.style.visibility=``,this._adjustPan())},getEvents:function(){var e={zoom:this._updatePosition,viewreset:this._updatePosition};return this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},isOpen:function(){return!!this._map&&this._map.hasLayer(this)},bringToFront:function(){return this._map&&yt(this._container),this},bringToBack:function(){return this._map&&bt(this._container),this},_prepareOpen:function(e){var t=this._source;if(!t._map)return!1;if(t instanceof Qn){t=null;var n=this._source._layers;for(var r in n)if(n[r]._map){t=n[r];break}if(!t)return!1;this._source=t}if(!e)if(t.getCenter)e=t.getCenter();else if(t.getLatLng)e=t.getLatLng();else if(t.getBounds)e=t.getBounds().getCenter();else throw Error(`Unable to get source layer LatLng.`);return this.setLatLng(e),this._map&&this.update(),!0},_updateContent:function(){if(this._content){var e=this._contentNode,t=typeof this._content==`function`?this._content(this._source||this):this._content;if(typeof t==`string`)e.innerHTML=t;else{for(;e.hasChildNodes();)e.removeChild(e.firstChild);e.appendChild(t)}this.fire(`contentupdate`)}},_updatePosition:function(){if(this._map){var e=this._map.latLngToLayerPoint(this._latlng),t=P(this.options.offset),n=this._getAnchor();this._zoomAnimated?kt(this._container,e.add(n)):t=t.add(e).add(n);var r=this._containerBottom=-t.y,i=this._containerLeft=-Math.round(this._containerWidth/2)+t.x;this._container.style.bottom=r+`px`,this._container.style.left=i+`px`}},_getAnchor:function(){return[0,0]}});J.include({_initOverlay:function(e,t,n,r){var i=t;return i instanceof e||(i=new e(r).setContent(t)),n&&i.setLatLng(n),i}}),Yn.include({_initOverlay:function(e,t,n,r){var i=n;return i instanceof e?(p(i,r),i._source=this):(i=t&&!r?t:new e(r,this),i.setContent(n)),i}});var Pr=Nr.extend({options:{pane:`popupPane`,offset:[0,7],maxWidth:300,minWidth:50,maxHeight:null,autoPan:!0,autoPanPaddingTopLeft:null,autoPanPaddingBottomRight:null,autoPanPadding:[5,5],keepInView:!1,closeButton:!0,autoClose:!0,closeOnEscapeKey:!0,className:``},openOn:function(e){return e=arguments.length?e:this._source._map,!e.hasLayer(this)&&e._popup&&e._popup.options.autoClose&&e.removeLayer(e._popup),e._popup=this,Nr.prototype.openOn.call(this,e)},onAdd:function(e){Nr.prototype.onAdd.call(this,e),e.fire(`popupopen`,{popup:this}),this._source&&(this._source.fire(`popupopen`,{popup:this},!0),this._source instanceof or||this._source.on(`preclick`,Xt))},onRemove:function(e){Nr.prototype.onRemove.call(this,e),e.fire(`popupclose`,{popup:this}),this._source&&(this._source.fire(`popupclose`,{popup:this},!0),this._source instanceof or||this._source.off(`preclick`,Xt))},getEvents:function(){var e=Nr.prototype.getEvents.call(this);return(this.options.closeOnClick===void 0?this._map.options.closePopupOnClick:this.options.closeOnClick)&&(e.preclick=this.close),this.options.keepInView&&(e.moveend=this._adjustPan),e},_initLayout:function(){var e=`leaflet-popup`,t=this._container=G(`div`,e+` `+(this.options.className||``)+` leaflet-zoom-animated`),n=this._wrapper=G(`div`,e+`-content-wrapper`,t);if(this._contentNode=G(`div`,e+`-content`,n),Qt(t),Zt(this._contentNode),q(t,`contextmenu`,Xt),this._tipContainer=G(`div`,e+`-tip-container`,t),this._tip=G(`div`,e+`-tip`,this._tipContainer),this.options.closeButton){var r=this._closeButton=G(`a`,e+`-close-button`,t);r.setAttribute(`role`,`button`),r.setAttribute(`aria-label`,`Close popup`),r.href=`#close`,r.innerHTML=`<span aria-hidden="true">×</span>`,q(r,`click`,function(e){$t(e),this.close()},this)}},_updateLayout:function(){var e=this._contentNode,t=e.style;t.width=``,t.whiteSpace=`nowrap`;var n=e.offsetWidth;n=Math.min(n,this.options.maxWidth),n=Math.max(n,this.options.minWidth),t.width=n+1+`px`,t.whiteSpace=``,t.height=``;var r=e.offsetHeight,i=this.options.maxHeight,a=`leaflet-popup-scrolled`;i&&r>i?(t.height=i+`px`,K(e,a)):St(e,a),this._containerWidth=this._container.offsetWidth},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),n=this._getAnchor();kt(this._container,t.add(n))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var e=this._map,t=parseInt(gt(this._container,`marginBottom`),10)||0,n=this._container.offsetHeight+t,r=this._containerWidth,i=new M(this._containerLeft,-n-this._containerBottom);i._add(At(this._container));var a=e.layerPointToContainerPoint(i),o=P(this.options.autoPanPadding),s=P(this.options.autoPanPaddingTopLeft||o),c=P(this.options.autoPanPaddingBottomRight||o),l=e.getSize(),u=0,d=0;a.x+r+c.x>l.x&&(u=a.x+r-l.x+c.x),a.x-u-s.x<0&&(u=a.x-s.x),a.y+n+c.y>l.y&&(d=a.y+n-l.y+c.y),a.y-d-s.y<0&&(d=a.y-s.y),(u||d)&&(this.options.keepInView&&(this._autopanning=!0),e.fire(`autopanstart`).panBy([u,d]))}},_getAnchor:function(){return P(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Fr=function(e,t){return new Pr(e,t)};J.mergeOptions({closePopupOnClick:!0}),J.include({openPopup:function(e,t,n){return this._initOverlay(Pr,e,t,n).openOn(this),this},closePopup:function(e){return e=arguments.length?e:this._popup,e&&e.close(),this}}),Yn.include({bindPopup:function(e,t){return this._popup=this._initOverlay(Pr,this._popup,e,t),this._popupHandlersAdded||=(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),!0),this},unbindPopup:function(){return this._popup&&=(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,null),this},openPopup:function(e){return this._popup&&(this instanceof Qn||(this._popup._source=this),this._popup._prepareOpen(e||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(e){return this._popup&&this._popup.setContent(e),this},getPopup:function(){return this._popup},_openPopup:function(e){if(!(!this._popup||!this._map)){en(e);var t=e.layer||e.target;if(this._popup._source===t&&!(t instanceof or)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(e.latlng);return}this._popup._source=t,this.openPopup(e.latlng)}},_movePopup:function(e){this._popup.setLatLng(e.latlng)},_onKeyPress:function(e){e.originalEvent.keyCode===13&&this._openPopup(e)}});var Ir=Nr.extend({options:{pane:`tooltipPane`,offset:[0,0],direction:`auto`,permanent:!1,sticky:!1,opacity:.9},onAdd:function(e){Nr.prototype.onAdd.call(this,e),this.setOpacity(this.options.opacity),e.fire(`tooltipopen`,{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire(`tooltipopen`,{tooltip:this},!0))},onRemove:function(e){Nr.prototype.onRemove.call(this,e),e.fire(`tooltipclose`,{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire(`tooltipclose`,{tooltip:this},!0))},getEvents:function(){var e=Nr.prototype.getEvents.call(this);return this.options.permanent||(e.preclick=this.close),e},_initLayout:function(){var e=`leaflet-tooltip `+(this.options.className||``)+` leaflet-zoom-`+(this._zoomAnimated?`animated`:`hide`);this._contentNode=this._container=G(`div`,e),this._container.setAttribute(`role`,`tooltip`),this._container.setAttribute(`id`,`leaflet-tooltip-`+o(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(e){var t,n,r=this._map,i=this._container,a=r.latLngToContainerPoint(r.getCenter()),o=r.layerPointToContainerPoint(e),s=this.options.direction,c=i.offsetWidth,l=i.offsetHeight,u=P(this.options.offset),d=this._getAnchor();s===`top`?(t=c/2,n=l):s===`bottom`?(t=c/2,n=0):s===`center`?(t=c/2,n=l/2):s===`right`?(t=0,n=l/2):s===`left`?(t=c,n=l/2):o.x<a.x?(s=`right`,t=0,n=l/2):(s=`left`,t=c+(u.x+d.x)*2,n=l/2),e=e.subtract(P(t,n,!0)).add(u).add(d),St(i,`leaflet-tooltip-right`),St(i,`leaflet-tooltip-left`),St(i,`leaflet-tooltip-top`),St(i,`leaflet-tooltip-bottom`),K(i,`leaflet-tooltip-`+s),kt(i,e)},_updatePosition:function(){var e=this._map.latLngToLayerPoint(this._latlng);this._setPosition(e)},setOpacity:function(e){this.options.opacity=e,this._container&&Tt(this._container,e)},_animateZoom:function(e){var t=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);this._setPosition(t)},_getAnchor:function(){return P(this._source&&this._source._getTooltipAnchor&&!this.options.sticky?this._source._getTooltipAnchor():[0,0])}}),Lr=function(e,t){return new Ir(e,t)};J.include({openTooltip:function(e,t,n){return this._initOverlay(Ir,e,t,n).openOn(this),this},closeTooltip:function(e){return e.close(),this}}),Yn.include({bindTooltip:function(e,t){return this._tooltip&&this.isTooltipOpen()&&this.unbindTooltip(),this._tooltip=this._initOverlay(Ir,this._tooltip,e,t),this._initTooltipInteractions(),this._tooltip.options.permanent&&this._map&&this._map.hasLayer(this)&&this.openTooltip(),this},unbindTooltip:function(){return this._tooltip&&=(this._initTooltipInteractions(!0),this.closeTooltip(),null),this},_initTooltipInteractions:function(e){if(!(!e&&this._tooltipHandlersAdded)){var t=e?`off`:`on`,n={remove:this.closeTooltip,move:this._moveTooltip};this._tooltip.options.permanent?n.add=this._openTooltip:(n.mouseover=this._openTooltip,n.mouseout=this.closeTooltip,n.click=this._openTooltip,this._map?this._addFocusListeners():n.add=this._addFocusListeners),this._tooltip.options.sticky&&(n.mousemove=this._moveTooltip),this[t](n),this._tooltipHandlersAdded=!e}},openTooltip:function(e){return this._tooltip&&(this instanceof Qn||(this._tooltip._source=this),this._tooltip._prepareOpen(e)&&(this._tooltip.openOn(this._map),this.getElement?this._setAriaDescribedByOnLayer(this):this.eachLayer&&this.eachLayer(this._setAriaDescribedByOnLayer,this))),this},closeTooltip:function(){if(this._tooltip)return this._tooltip.close()},toggleTooltip:function(){return this._tooltip&&this._tooltip.toggle(this),this},isTooltipOpen:function(){return this._tooltip.isOpen()},setTooltipContent:function(e){return this._tooltip&&this._tooltip.setContent(e),this},getTooltip:function(){return this._tooltip},_addFocusListeners:function(){this.getElement?this._addFocusListenersOnLayer(this):this.eachLayer&&this.eachLayer(this._addFocusListenersOnLayer,this)},_addFocusListenersOnLayer:function(e){var t=typeof e.getElement==`function`&&e.getElement();t&&(q(t,`focus`,function(){this._tooltip._source=e,this.openTooltip()},this),q(t,`blur`,this.closeTooltip,this))},_setAriaDescribedByOnLayer:function(e){var t=typeof e.getElement==`function`&&e.getElement();t&&t.setAttribute(`aria-describedby`,this._tooltip._container.id)},_openTooltip:function(e){if(!(!this._tooltip||!this._map)){if(this._map.dragging&&this._map.dragging.moving()&&!this._openOnceFlag){this._openOnceFlag=!0;var t=this;this._map.once(`moveend`,function(){t._openOnceFlag=!1,t._openTooltip(e)});return}this._tooltip._source=e.layer||e.target,this.openTooltip(this._tooltip.options.sticky?e.latlng:void 0)}},_moveTooltip:function(e){var t=e.latlng,n,r;this._tooltip.options.sticky&&e.originalEvent&&(n=this._map.mouseEventToContainerPoint(e.originalEvent),r=this._map.containerPointToLayerPoint(n),t=this._map.layerPointToLatLng(r)),this._tooltip.setLatLng(t)}});var Rr=er.extend({options:{iconSize:[12,12],html:!1,bgPos:null,className:`leaflet-div-icon`},createIcon:function(e){var t=e&&e.tagName===`DIV`?e:document.createElement(`div`),n=this.options;if(n.html instanceof Element?(vt(t),t.appendChild(n.html)):t.innerHTML=n.html===!1?``:n.html,n.bgPos){var r=P(n.bgPos);t.style.backgroundPosition=-r.x+`px `+-r.y+`px`}return this._setIconStyles(t,`icon`),t},createShadow:function(){return null}});function zr(e){return new Rr(e)}er.Default=nr;var Br=Yn.extend({options:{tileSize:256,opacity:1,updateWhenIdle:U.mobile,updateWhenZooming:!0,updateInterval:200,zIndex:1,bounds:null,minZoom:0,maxZoom:void 0,maxNativeZoom:void 0,minNativeZoom:void 0,noWrap:!1,pane:`tilePane`,className:``,keepBuffer:2},initialize:function(e){p(this,e)},onAdd:function(){this._initContainer(),this._levels={},this._tiles={},this._resetView()},beforeAdd:function(e){e._addZoomLimit(this)},onRemove:function(e){this._removeAllTiles(),_t(this._container),e._removeZoomLimit(this),this._container=null,this._tileZoom=void 0},bringToFront:function(){return this._map&&(yt(this._container),this._setAutoZIndex(Math.max)),this},bringToBack:function(){return this._map&&(bt(this._container),this._setAutoZIndex(Math.min)),this},getContainer:function(){return this._container},setOpacity:function(e){return this.options.opacity=e,this._updateOpacity(),this},setZIndex:function(e){return this.options.zIndex=e,this._updateZIndex(),this},isLoading:function(){return this._loading},redraw:function(){if(this._map){this._removeAllTiles();var e=this._clampZoom(this._map.getZoom());e!==this._tileZoom&&(this._tileZoom=e,this._updateLevels()),this._update()}return this},getEvents:function(){var e={viewprereset:this._invalidateAll,viewreset:this._resetView,zoom:this._resetView,moveend:this._onMoveEnd};return this.options.updateWhenIdle||(this._onMove||=s(this._onMoveEnd,this.options.updateInterval,this),e.move=this._onMove),this._zoomAnimated&&(e.zoomanim=this._animateZoom),e},createTile:function(){return document.createElement(`div`)},getTileSize:function(){var e=this.options.tileSize;return e instanceof M?e:new M(e,e)},_updateZIndex:function(){this._container&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(e){for(var t=this.getPane().children,n=-e(-1/0,1/0),r=0,i=t.length,a;r<i;r++)a=t[r].style.zIndex,t[r]!==this._container&&a&&(n=e(n,+a));isFinite(n)&&(this.options.zIndex=n+e(-1,1),this._updateZIndex())},_updateOpacity:function(){if(this._map&&!U.ielt9){Tt(this._container,this.options.opacity);var e=+new Date,t=!1,n=!1;for(var r in this._tiles){var i=this._tiles[r];if(!(!i.current||!i.loaded)){var a=Math.min(1,(e-i.loaded)/200);Tt(i.el,a),a<1?t=!0:(i.active?n=!0:this._onOpaqueTile(i),i.active=!0)}}n&&!this._noPrune&&this._pruneTiles(),t&&(E(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this))}},_onOpaqueTile:l,_initContainer:function(){this._container||(this._container=G(`div`,`leaflet-layer `+(this.options.className||``)),this._updateZIndex(),this.options.opacity<1&&this._updateOpacity(),this.getPane().appendChild(this._container))},_updateLevels:function(){var e=this._tileZoom,t=this.options.maxZoom;if(e!==void 0){for(var n in this._levels)n=Number(n),this._levels[n].el.children.length||n===e?(this._levels[n].el.style.zIndex=t-Math.abs(e-n),this._onUpdateLevel(n)):(_t(this._levels[n].el),this._removeTilesAtZoom(n),this._onRemoveLevel(n),delete this._levels[n]);var r=this._levels[e],i=this._map;return r||(r=this._levels[e]={},r.el=G(`div`,`leaflet-tile-container leaflet-zoom-animated`,this._container),r.el.style.zIndex=t,r.origin=i.project(i.unproject(i.getPixelOrigin()),e).round(),r.zoom=e,this._setZoomTransform(r,i.getCenter(),i.getZoom()),r.el.offsetWidth,this._onCreateLevel(r)),this._level=r,r}},_onUpdateLevel:l,_onRemoveLevel:l,_onCreateLevel:l,_pruneTiles:function(){if(this._map){var e,t,n=this._map.getZoom();if(n>this.options.maxZoom||n<this.options.minZoom){this._removeAllTiles();return}for(e in this._tiles)t=this._tiles[e],t.retain=t.current;for(e in this._tiles)if(t=this._tiles[e],t.current&&!t.active){var r=t.coords;this._retainParent(r.x,r.y,r.z,r.z-5)||this._retainChildren(r.x,r.y,r.z,r.z+2)}for(e in this._tiles)this._tiles[e].retain||this._removeTile(e)}},_removeTilesAtZoom:function(e){for(var t in this._tiles)this._tiles[t].coords.z===e&&this._removeTile(t)},_removeAllTiles:function(){for(var e in this._tiles)this._removeTile(e)},_invalidateAll:function(){for(var e in this._levels)_t(this._levels[e].el),this._onRemoveLevel(Number(e)),delete this._levels[e];this._removeAllTiles(),this._tileZoom=void 0},_retainParent:function(e,t,n,r){var i=Math.floor(e/2),a=Math.floor(t/2),o=n-1,s=new M(+i,+a);s.z=+o;var c=this._tileCoordsToKey(s),l=this._tiles[c];return l&&l.active?(l.retain=!0,!0):(l&&l.loaded&&(l.retain=!0),o>r?this._retainParent(i,a,o,r):!1)},_retainChildren:function(e,t,n,r){for(var i=2*e;i<2*e+2;i++)for(var a=2*t;a<2*t+2;a++){var o=new M(i,a);o.z=n+1;var s=this._tileCoordsToKey(o),c=this._tiles[s];if(c&&c.active){c.retain=!0;continue}else c&&c.loaded&&(c.retain=!0);n+1<r&&this._retainChildren(i,a,n+1,r)}},_resetView:function(e){var t=e&&(e.pinch||e.flyTo);this._setView(this._map.getCenter(),this._map.getZoom(),t,t)},_animateZoom:function(e){this._setView(e.center,e.zoom,!0,e.noUpdate)},_clampZoom:function(e){var t=this.options;return t.minNativeZoom!==void 0&&e<t.minNativeZoom?t.minNativeZoom:t.maxNativeZoom!==void 0&&t.maxNativeZoom<e?t.maxNativeZoom:e},_setView:function(e,t,n,r){var i=Math.round(t);i=this.options.maxZoom!==void 0&&i>this.options.maxZoom||this.options.minZoom!==void 0&&i<this.options.minZoom?void 0:this._clampZoom(i);var a=this.options.updateWhenZooming&&i!==this._tileZoom;(!r||a)&&(this._tileZoom=i,this._abortLoading&&this._abortLoading(),this._updateLevels(),this._resetGrid(),i!==void 0&&this._update(e),n||this._pruneTiles(),this._noPrune=!!n),this._setZoomTransforms(e,t)},_setZoomTransforms:function(e,t){for(var n in this._levels)this._setZoomTransform(this._levels[n],e,t)},_setZoomTransform:function(e,t,n){var r=this._map.getZoomScale(n,e.zoom),i=e.origin.multiplyBy(r).subtract(this._map._getNewPixelOrigin(t,n)).round();U.any3d?Ot(e.el,i,r):kt(e.el,i)},_resetGrid:function(){var e=this._map,t=e.options.crs,n=this._tileSize=this.getTileSize(),r=this._tileZoom,i=this._map.getPixelWorldBounds(this._tileZoom);i&&(this._globalTileRange=this._pxBoundsToTileRange(i)),this._wrapX=t.wrapLng&&!this.options.noWrap&&[Math.floor(e.project([0,t.wrapLng[0]],r).x/n.x),Math.ceil(e.project([0,t.wrapLng[1]],r).x/n.y)],this._wrapY=t.wrapLat&&!this.options.noWrap&&[Math.floor(e.project([t.wrapLat[0],0],r).y/n.x),Math.ceil(e.project([t.wrapLat[1],0],r).y/n.y)]},_onMoveEnd:function(){!this._map||this._map._animatingZoom||this._update()},_getTiledPixelBounds:function(e){var t=this._map,n=t._animatingZoom?Math.max(t._animateToZoom,t.getZoom()):t.getZoom(),r=t.getZoomScale(n,this._tileZoom),i=t.project(e,this._tileZoom).floor(),a=t.getSize().divideBy(r*2);return new F(i.subtract(a),i.add(a))},_update:function(e){var t=this._map;if(t){var n=this._clampZoom(t.getZoom());if(e===void 0&&(e=t.getCenter()),this._tileZoom!==void 0){var r=this._getTiledPixelBounds(e),i=this._pxBoundsToTileRange(r),a=i.getCenter(),o=[],s=this.options.keepBuffer,c=new F(i.getBottomLeft().subtract([s,-s]),i.getTopRight().add([s,-s]));if(!(isFinite(i.min.x)&&isFinite(i.min.y)&&isFinite(i.max.x)&&isFinite(i.max.y)))throw Error(`Attempted to load an infinite number of tiles`);for(var l in this._tiles){var u=this._tiles[l].coords;(u.z!==this._tileZoom||!c.contains(new M(u.x,u.y)))&&(this._tiles[l].current=!1)}if(Math.abs(n-this._tileZoom)>1){this._setView(e,n);return}for(var d=i.min.y;d<=i.max.y;d++)for(var f=i.min.x;f<=i.max.x;f++){var p=new M(f,d);if(p.z=this._tileZoom,this._isValidTile(p)){var m=this._tiles[this._tileCoordsToKey(p)];m?m.current=!0:o.push(p)}}if(o.sort(function(e,t){return e.distanceTo(a)-t.distanceTo(a)}),o.length!==0){this._loading||(this._loading=!0,this.fire(`loading`));var h=document.createDocumentFragment();for(f=0;f<o.length;f++)this._addTile(o[f],h);this._level.el.appendChild(h)}}}},_isValidTile:function(e){var t=this._map.options.crs;if(!t.infinite){var n=this._globalTileRange;if(!t.wrapLng&&(e.x<n.min.x||e.x>n.max.x)||!t.wrapLat&&(e.y<n.min.y||e.y>n.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(e);return z(this.options.bounds).overlaps(r)},_keyToBounds:function(e){return this._tileCoordsToBounds(this._keyToTileCoords(e))},_tileCoordsToNwSe:function(e){var t=this._map,n=this.getTileSize(),r=e.scaleBy(n),i=r.add(n);return[t.unproject(r,e.z),t.unproject(i,e.z)]},_tileCoordsToBounds:function(e){var t=this._tileCoordsToNwSe(e),n=new R(t[0],t[1]);return this.options.noWrap||(n=this._map.wrapLatLngBounds(n)),n},_tileCoordsToKey:function(e){return e.x+`:`+e.y+`:`+e.z},_keyToTileCoords:function(e){var t=e.split(`:`),n=new M(+t[0],+t[1]);return n.z=+t[2],n},_removeTile:function(e){var t=this._tiles[e];t&&(_t(t.el),delete this._tiles[e],this.fire(`tileunload`,{tile:t.el,coords:this._keyToTileCoords(e)}))},_initTile:function(e){K(e,`leaflet-tile`);var t=this.getTileSize();e.style.width=t.x+`px`,e.style.height=t.y+`px`,e.onselectstart=l,e.onmousemove=l,U.ielt9&&this.options.opacity<1&&Tt(e,this.options.opacity)},_addTile:function(e,t){var n=this._getTilePos(e),r=this._tileCoordsToKey(e),a=this.createTile(this._wrapCoords(e),i(this._tileReady,this,e));this._initTile(a),this.createTile.length<2&&T(i(this._tileReady,this,e,null,a)),kt(a,n),this._tiles[r]={el:a,coords:e,current:!0},t.appendChild(a),this.fire(`tileloadstart`,{tile:a,coords:e})},_tileReady:function(e,t,n){t&&this.fire(`tileerror`,{error:t,tile:n,coords:e});var r=this._tileCoordsToKey(e);n=this._tiles[r],n&&(n.loaded=+new Date,this._map._fadeAnimated?(Tt(n.el,0),E(this._fadeFrame),this._fadeFrame=T(this._updateOpacity,this)):(n.active=!0,this._pruneTiles()),t||(K(n.el,`leaflet-tile-loaded`),this.fire(`tileload`,{tile:n.el,coords:e})),this._noTilesToLoad()&&(this._loading=!1,this.fire(`load`),U.ielt9||!this._map._fadeAnimated?T(this._pruneTiles,this):setTimeout(i(this._pruneTiles,this),250)))},_getTilePos:function(e){return e.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(e){var t=new M(this._wrapX?c(e.x,this._wrapX):e.x,this._wrapY?c(e.y,this._wrapY):e.y);return t.z=e.z,t},_pxBoundsToTileRange:function(e){var t=this.getTileSize();return new F(e.min.unscaleBy(t).floor(),e.max.unscaleBy(t).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var e in this._tiles)if(!this._tiles[e].loaded)return!1;return!0}});function Vr(e){return new Br(e)}var Hr=Br.extend({options:{minZoom:0,maxZoom:18,subdomains:`abc`,errorTileUrl:``,zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(e,t){this._url=e,t=p(this,t),t.detectRetina&&U.retina&&t.maxZoom>0?(t.tileSize=Math.floor(t.tileSize/2),t.zoomReverse?(t.zoomOffset--,t.minZoom=Math.min(t.maxZoom,t.minZoom+1)):(t.zoomOffset++,t.maxZoom=Math.max(t.minZoom,t.maxZoom-1)),t.minZoom=Math.max(0,t.minZoom)):t.zoomReverse?t.minZoom=Math.min(t.maxZoom,t.minZoom):t.maxZoom=Math.max(t.minZoom,t.maxZoom),typeof t.subdomains==`string`&&(t.subdomains=t.subdomains.split(``)),this.on(`tileunload`,this._onTileRemove)},setUrl:function(e,t){return this._url===e&&t===void 0&&(t=!0),this._url=e,t||this.redraw(),this},createTile:function(e,t){var n=document.createElement(`img`);return q(n,`load`,i(this._tileOnLoad,this,t,n)),q(n,`error`,i(this._tileOnError,this,t,n)),(this.options.crossOrigin||this.options.crossOrigin===``)&&(n.crossOrigin=this.options.crossOrigin===!0?``:this.options.crossOrigin),typeof this.options.referrerPolicy==`string`&&(n.referrerPolicy=this.options.referrerPolicy),n.alt=``,n.src=this.getTileUrl(e),n},getTileUrl:function(e){var t={r:U.retina?`@2x`:``,s:this._getSubdomain(e),x:e.x,y:e.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var r=this._globalTileRange.max.y-e.y;this.options.tms&&(t.y=r),t[`-y`]=r}return g(this._url,n(t,this.options))},_tileOnLoad:function(e,t){U.ielt9?setTimeout(i(e,this,null,t),0):e(null,t)},_tileOnError:function(e,t,n){var r=this.options.errorTileUrl;r&&t.getAttribute(`src`)!==r&&(t.src=r),e(n,t)},_onTileRemove:function(e){e.tile.onload=null},_getZoomForUrl:function(){var e=this._tileZoom,t=this.options.maxZoom,n=this.options.zoomReverse,r=this.options.zoomOffset;return n&&(e=t-e),e+r},_getSubdomain:function(e){var t=Math.abs(e.x+e.y)%this.options.subdomains.length;return this.options.subdomains[t]},_abortLoading:function(){var e,t;for(e in this._tiles)if(this._tiles[e].coords.z!==this._tileZoom&&(t=this._tiles[e].el,t.onload=l,t.onerror=l,!t.complete)){t.src=y;var n=this._tiles[e].coords;_t(t),delete this._tiles[e],this.fire(`tileabort`,{tile:t,coords:n})}},_removeTile:function(e){var t=this._tiles[e];if(t)return t.el.setAttribute(`src`,y),Br.prototype._removeTile.call(this,e)},_tileReady:function(e,t,n){if(!(!this._map||n&&n.getAttribute(`src`)===y))return Br.prototype._tileReady.call(this,e,t,n)}});function Ur(e,t){return new Hr(e,t)}var Wr=Hr.extend({defaultWmsParams:{service:`WMS`,request:`GetMap`,layers:``,styles:``,format:`image/jpeg`,transparent:!1,version:`1.1.1`},options:{crs:null,uppercase:!1},initialize:function(e,t){this._url=e;var r=n({},this.defaultWmsParams);for(var i in t)i in this.options||(r[i]=t[i]);t=p(this,t);var a=t.detectRetina&&U.retina?2:1,o=this.getTileSize();r.width=o.x*a,r.height=o.y*a,this.wmsParams=r},onAdd:function(e){this._crs=this.options.crs||e.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var t=this._wmsVersion>=1.3?`crs`:`srs`;this.wmsParams[t]=this._crs.code,Hr.prototype.onAdd.call(this,e)},getTileUrl:function(e){var t=this._tileCoordsToNwSe(e),n=this._crs,r=I(n.project(t[0]),n.project(t[1])),i=r.min,a=r.max,o=(this._wmsVersion>=1.3&&this._crs===qn?[i.y,i.x,a.y,a.x]:[i.x,i.y,a.x,a.y]).join(`,`),s=Hr.prototype.getTileUrl.call(this,e);return s+m(this.wmsParams,s,this.options.uppercase)+(this.options.uppercase?`&BBOX=`:`&bbox=`)+o},setParams:function(e,t){return n(this.wmsParams,e),t||this.redraw(),this}});function Gr(e,t){return new Wr(e,t)}Hr.WMS=Wr,Ur.wms=Gr;var Kr=Yn.extend({options:{padding:.1},initialize:function(e){p(this,e),o(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),K(this._container,`leaflet-zoom-animated`)),this.getPane().appendChild(this._container),this._update(),this.on(`update`,this._updatePaths,this)},onRemove:function(){this.off(`update`,this._updatePaths,this),this._destroyContainer()},getEvents:function(){var e={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(e.zoomanim=this._onAnimZoom),e},_onAnimZoom:function(e){this._updateTransform(e.center,e.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(e,t){var n=this._map.getZoomScale(t,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),i=this._map.project(this._center,t),a=r.multiplyBy(-n).add(i).subtract(this._map._getNewPixelOrigin(e,t));U.any3d?Ot(this._container,a,n):kt(this._container,a)},_reset:function(){for(var e in this._update(),this._updateTransform(this._center,this._zoom),this._layers)this._layers[e]._reset()},_onZoomEnd:function(){for(var e in this._layers)this._layers[e]._project()},_updatePaths:function(){for(var e in this._layers)this._layers[e]._update()},_update:function(){var e=this.options.padding,t=this._map.getSize(),n=this._map.containerPointToLayerPoint(t.multiplyBy(-e)).round();this._bounds=new F(n,n.add(t.multiplyBy(1+e*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),qr=Kr.extend({options:{tolerance:0},getEvents:function(){var e=Kr.prototype.getEvents.call(this);return e.viewprereset=this._onViewPreReset,e},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){Kr.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var e=this._container=document.createElement(`canvas`);q(e,`mousemove`,this._onMouseMove,this),q(e,`click dblclick mousedown mouseup contextmenu`,this._onClick,this),q(e,`mouseout`,this._handleMouseOut,this),e._leaflet_disable_events=!0,this._ctx=e.getContext(`2d`)},_destroyContainer:function(){E(this._redrawRequest),delete this._ctx,_t(this._container),Gt(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var e;for(var t in this._redrawBounds=null,this._layers)e=this._layers[t],e._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Kr.prototype._update.call(this);var e=this._bounds,t=this._container,n=e.getSize(),r=U.retina?2:1;kt(t,e.min),t.width=r*n.x,t.height=r*n.y,t.style.width=n.x+`px`,t.style.height=n.y+`px`,U.retina&&this._ctx.scale(2,2),this._ctx.translate(-e.min.x,-e.min.y),this.fire(`update`)}},_reset:function(){Kr.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(e){this._updateDashArray(e),this._layers[o(e)]=e;var t=e._order={layer:e,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=t),this._drawLast=t,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(e){this._requestRedraw(e)},_removePath:function(e){var t=e._order,n=t.next,r=t.prev;n?n.prev=r:this._drawLast=r,r?r.next=n:this._drawFirst=n,delete e._order,delete this._layers[o(e)],this._requestRedraw(e)},_updatePath:function(e){this._extendRedrawBounds(e),e._project(),e._update(),this._requestRedraw(e)},_updateStyle:function(e){this._updateDashArray(e),this._requestRedraw(e)},_updateDashArray:function(e){if(typeof e.options.dashArray==`string`){var t=e.options.dashArray.split(/[, ]+/),n=[],r,i;for(i=0;i<t.length;i++){if(r=Number(t[i]),isNaN(r))return;n.push(r)}e.options._dashArray=n}else e.options._dashArray=e.options.dashArray},_requestRedraw:function(e){this._map&&(this._extendRedrawBounds(e),this._redrawRequest=this._redrawRequest||T(this._redraw,this))},_extendRedrawBounds:function(e){if(e._pxBounds){var t=(e.options.weight||0)+1;this._redrawBounds=this._redrawBounds||new F,this._redrawBounds.extend(e._pxBounds.min.subtract([t,t])),this._redrawBounds.extend(e._pxBounds.max.add([t,t]))}},_redraw:function(){this._redrawRequest=null,this._redrawBounds&&(this._redrawBounds.min._floor(),this._redrawBounds.max._ceil()),this._clear(),this._draw(),this._redrawBounds=null},_clear:function(){var e=this._redrawBounds;if(e){var t=e.getSize();this._ctx.clearRect(e.min.x,e.min.y,t.x,t.y)}else this._ctx.save(),this._ctx.setTransform(1,0,0,1,0,0),this._ctx.clearRect(0,0,this._container.width,this._container.height),this._ctx.restore()},_draw:function(){var e,t=this._redrawBounds;if(this._ctx.save(),t){var n=t.getSize();this._ctx.beginPath(),this._ctx.rect(t.min.x,t.min.y,n.x,n.y),this._ctx.clip()}this._drawing=!0;for(var r=this._drawFirst;r;r=r.next)e=r.layer,(!t||e._pxBounds&&e._pxBounds.intersects(t))&&e._updatePath();this._drawing=!1,this._ctx.restore()},_updatePoly:function(e,t){if(this._drawing){var n,r,i,a,o=e._parts,s=o.length,c=this._ctx;if(s){for(c.beginPath(),n=0;n<s;n++){for(r=0,i=o[n].length;r<i;r++)a=o[n][r],c[r?`lineTo`:`moveTo`](a.x,a.y);t&&c.closePath()}this._fillStroke(c,e)}}},_updateCircle:function(e){if(!(!this._drawing||e._empty())){var t=e._point,n=this._ctx,r=Math.max(Math.round(e._radius),1),i=(Math.max(Math.round(e._radiusY),1)||r)/r;i!==1&&(n.save(),n.scale(1,i)),n.beginPath(),n.arc(t.x,t.y/i,r,0,Math.PI*2,!1),i!==1&&n.restore(),this._fillStroke(n,e)}},_fillStroke:function(e,t){var n=t.options;n.fill&&(e.globalAlpha=n.fillOpacity,e.fillStyle=n.fillColor||n.color,e.fill(n.fillRule||`evenodd`)),n.stroke&&n.weight!==0&&(e.setLineDash&&e.setLineDash(t.options&&t.options._dashArray||[]),e.globalAlpha=n.opacity,e.lineWidth=n.weight,e.strokeStyle=n.color,e.lineCap=n.lineCap,e.lineJoin=n.lineJoin,e.stroke())},_onClick:function(e){for(var t=this._map.mouseEventToLayerPoint(e),n,r,i=this._drawFirst;i;i=i.next)n=i.layer,n.options.interactive&&n._containsPoint(t)&&(!(e.type===`click`||e.type===`preclick`)||!this._map._draggableMoved(n))&&(r=n);this._fireEvent(r?[r]:!1,e)},_onMouseMove:function(e){if(!(!this._map||this._map.dragging.moving()||this._map._animatingZoom)){var t=this._map.mouseEventToLayerPoint(e);this._handleMouseHover(e,t)}},_handleMouseOut:function(e){var t=this._hoveredLayer;t&&(St(this._container,`leaflet-interactive`),this._fireEvent([t],e,`mouseout`),this._hoveredLayer=null,this._mouseHoverThrottled=!1)},_handleMouseHover:function(e,t){if(!this._mouseHoverThrottled){for(var n,r,a=this._drawFirst;a;a=a.next)n=a.layer,n.options.interactive&&n._containsPoint(t)&&(r=n);r!==this._hoveredLayer&&(this._handleMouseOut(e),r&&(K(this._container,`leaflet-interactive`),this._fireEvent([r],e,`mouseover`),this._hoveredLayer=r)),this._fireEvent(this._hoveredLayer?[this._hoveredLayer]:!1,e),this._mouseHoverThrottled=!0,setTimeout(i(function(){this._mouseHoverThrottled=!1},this),32)}},_fireEvent:function(e,t,n){this._map._fireDOMEvent(t,n||t.type,e)},_bringToFront:function(e){var t=e._order;if(t){var n=t.next,r=t.prev;if(n)n.prev=r;else return;r?r.next=n:n&&(this._drawFirst=n),t.prev=this._drawLast,this._drawLast.next=t,t.next=null,this._drawLast=t,this._requestRedraw(e)}},_bringToBack:function(e){var t=e._order;if(t){var n=t.next,r=t.prev;if(r)r.next=n;else return;n?n.prev=r:r&&(this._drawLast=r),t.prev=null,t.next=this._drawFirst,this._drawFirst.prev=t,this._drawFirst=t,this._requestRedraw(e)}}});function Jr(e){return U.canvas?new qr(e):null}var Yr=(function(){try{return document.namespaces.add(`lvml`,`urn:schemas-microsoft-com:vml`),function(e){return document.createElement(`<lvml:`+e+` class="lvml">`)}}catch{}return function(e){return document.createElement(`<`+e+` xmlns="urn:schemas-microsoft.com:vml" class="lvml">`)}})(),Xr={_initContainer:function(){this._container=G(`div`,`leaflet-vml-container`)},_update:function(){this._map._animatingZoom||(Kr.prototype._update.call(this),this.fire(`update`))},_initPath:function(e){var t=e._container=Yr(`shape`);K(t,`leaflet-vml-shape `+(this.options.className||``)),t.coordsize=`1 1`,e._path=Yr(`path`),t.appendChild(e._path),this._updateStyle(e),this._layers[o(e)]=e},_addPath:function(e){var t=e._container;this._container.appendChild(t),e.options.interactive&&e.addInteractiveTarget(t)},_removePath:function(e){var t=e._container;_t(t),e.removeInteractiveTarget(t),delete this._layers[o(e)]},_updateStyle:function(e){var t=e._stroke,n=e._fill,r=e.options,i=e._container;i.stroked=!!r.stroke,i.filled=!!r.fill,r.stroke?(t||=e._stroke=Yr(`stroke`),i.appendChild(t),t.weight=r.weight+`px`,t.color=r.color,t.opacity=r.opacity,r.dashArray?t.dashStyle=_(r.dashArray)?r.dashArray.join(` `):r.dashArray.replace(/( *, *)/g,` `):t.dashStyle=``,t.endcap=r.lineCap.replace(`butt`,`flat`),t.joinstyle=r.lineJoin):t&&(i.removeChild(t),e._stroke=null),r.fill?(n||=e._fill=Yr(`fill`),i.appendChild(n),n.color=r.fillColor||r.color,n.opacity=r.fillOpacity):n&&(i.removeChild(n),e._fill=null)},_updateCircle:function(e){var t=e._point.round(),n=Math.round(e._radius),r=Math.round(e._radiusY||n);this._setPath(e,e._empty()?`M0 0`:`AL `+t.x+`,`+t.y+` `+n+`,`+r+` 0,23592600`)},_setPath:function(e,t){e._path.v=t},_bringToFront:function(e){yt(e._container)},_bringToBack:function(e){bt(e._container)}},Zr=U.vml?Yr:ce,Qr=Kr.extend({_initContainer:function(){this._container=Zr(`svg`),this._container.setAttribute(`pointer-events`,`none`),this._rootGroup=Zr(`g`),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){_t(this._container),Gt(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){Kr.prototype._update.call(this);var e=this._bounds,t=e.getSize(),n=this._container;(!this._svgSize||!this._svgSize.equals(t))&&(this._svgSize=t,n.setAttribute(`width`,t.x),n.setAttribute(`height`,t.y)),kt(n,e.min),n.setAttribute(`viewBox`,[e.min.x,e.min.y,t.x,t.y].join(` `)),this.fire(`update`)}},_initPath:function(e){var t=e._path=Zr(`path`);e.options.className&&K(t,e.options.className),e.options.interactive&&K(t,`leaflet-interactive`),this._updateStyle(e),this._layers[o(e)]=e},_addPath:function(e){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(e._path),e.addInteractiveTarget(e._path)},_removePath:function(e){_t(e._path),e.removeInteractiveTarget(e._path),delete this._layers[o(e)]},_updatePath:function(e){e._project(),e._update()},_updateStyle:function(e){var t=e._path,n=e.options;t&&(n.stroke?(t.setAttribute(`stroke`,n.color),t.setAttribute(`stroke-opacity`,n.opacity),t.setAttribute(`stroke-width`,n.weight),t.setAttribute(`stroke-linecap`,n.lineCap),t.setAttribute(`stroke-linejoin`,n.lineJoin),n.dashArray?t.setAttribute(`stroke-dasharray`,n.dashArray):t.removeAttribute(`stroke-dasharray`),n.dashOffset?t.setAttribute(`stroke-dashoffset`,n.dashOffset):t.removeAttribute(`stroke-dashoffset`)):t.setAttribute(`stroke`,`none`),n.fill?(t.setAttribute(`fill`,n.fillColor||n.color),t.setAttribute(`fill-opacity`,n.fillOpacity),t.setAttribute(`fill-rule`,n.fillRule||`evenodd`)):t.setAttribute(`fill`,`none`))},_updatePoly:function(e,t){this._setPath(e,le(e._parts,t))},_updateCircle:function(e){var t=e._point,n=Math.max(Math.round(e._radius),1),r=Math.max(Math.round(e._radiusY),1)||n,i=`a`+n+`,`+r+` 0 1,0 `,a=e._empty()?`M0 0`:`M`+(t.x-n)+`,`+t.y+i+n*2+`,0 `+i+-n*2+`,0 `;this._setPath(e,a)},_setPath:function(e,t){e._path.setAttribute(`d`,t)},_bringToFront:function(e){yt(e._path)},_bringToBack:function(e){bt(e._path)}});U.vml&&Qr.include(Xr);function $r(e){return U.svg||U.vml?new Qr(e):null}J.include({getRenderer:function(e){var t=e.options.renderer||this._getPaneRenderer(e.options.pane)||this.options.renderer||this._renderer;return t||=this._renderer=this._createRenderer(),this.hasLayer(t)||this.addLayer(t),t},_getPaneRenderer:function(e){if(e===`overlayPane`||e===void 0)return!1;var t=this._paneRenderers[e];return t===void 0&&(t=this._createRenderer({pane:e}),this._paneRenderers[e]=t),t},_createRenderer:function(e){return this.options.preferCanvas&&Jr(e)||$r(e)}});var ei=pr.extend({initialize:function(e,t){pr.prototype.initialize.call(this,this._boundsToLatLngs(e),t)},setBounds:function(e){return this.setLatLngs(this._boundsToLatLngs(e))},_boundsToLatLngs:function(e){return e=z(e),[e.getSouthWest(),e.getNorthWest(),e.getNorthEast(),e.getSouthEast()]}});function ti(e,t){return new ei(e,t)}Qr.create=Zr,Qr.pointsToPath=le,hr.geometryToLayer=gr,hr.coordsToLatLng=vr,hr.coordsToLatLngs=yr,hr.latLngToCoords=br,hr.latLngsToCoords=xr,hr.getFeature=Sr,hr.asFeature=Cr,J.mergeOptions({boxZoom:!0});var ni=yn.extend({initialize:function(e){this._map=e,this._container=e._container,this._pane=e._panes.overlayPane,this._resetStateTimeout=0,e.on(`unload`,this._destroy,this)},addHooks:function(){q(this._container,`mousedown`,this._onMouseDown,this)},removeHooks:function(){Gt(this._container,`mousedown`,this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){_t(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(e){if(!e.shiftKey||e.which!==1&&e.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),jt(),Ft(),this._startPoint=this._map.mouseEventToContainerPoint(e),q(document,{contextmenu:en,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(e){this._moved||(this._moved=!0,this._box=G(`div`,`leaflet-zoom-box`,this._container),K(this._container,`leaflet-crosshair`),this._map.fire(`boxzoomstart`)),this._point=this._map.mouseEventToContainerPoint(e);var t=new F(this._point,this._startPoint),n=t.getSize();kt(this._box,t.min),this._box.style.width=n.x+`px`,this._box.style.height=n.y+`px`},_finish:function(){this._moved&&(_t(this._box),St(this._container,`leaflet-crosshair`)),Mt(),It(),Gt(document,{contextmenu:en,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(e){if(!(e.which!==1&&e.button!==1)&&(this._finish(),this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(i(this._resetState,this),0);var t=new R(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(t).fire(`boxzoomend`,{boxZoomBounds:t})}},_onKeyDown:function(e){e.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});J.addInitHook(`addHandler`,`boxZoom`,ni),J.mergeOptions({doubleClickZoom:!0});var ri=yn.extend({addHooks:function(){this._map.on(`dblclick`,this._onDoubleClick,this)},removeHooks:function(){this._map.off(`dblclick`,this._onDoubleClick,this)},_onDoubleClick:function(e){var t=this._map,n=t.getZoom(),r=t.options.zoomDelta,i=e.originalEvent.shiftKey?n-r:n+r;t.options.doubleClickZoom===`center`?t.setZoom(i):t.setZoomAround(e.containerPoint,i)}});J.addInitHook(`addHandler`,`doubleClickZoom`,ri),J.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var ii=yn.extend({addHooks:function(){if(!this._draggable){var e=this._map;this._draggable=new Sn(e._mapPane,e._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on(`predrag`,this._onPreDragLimit,this),e.options.worldCopyJump&&(this._draggable.on(`predrag`,this._onPreDragWrap,this),e.on(`zoomend`,this._onZoomEnd,this),e.whenReady(this._onZoomEnd,this))}K(this._map._container,`leaflet-grab leaflet-touch-drag`),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){St(this._map._container,`leaflet-grab`),St(this._map._container,`leaflet-touch-drag`),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var e=this._map;if(e._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var t=z(this._map.options.maxBounds);this._offsetLimit=I(this._map.latLngToContainerPoint(t.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(t.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;e.fire(`movestart`).fire(`dragstart`),e.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(e){if(this._map.options.inertia){var t=this._lastTime=+new Date,n=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(n),this._times.push(t),this._prunePositions(t)}this._map.fire(`move`,e).fire(`drag`,e)},_prunePositions:function(e){for(;this._positions.length>1&&e-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var e=this._map.getSize().divideBy(2),t=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=t.subtract(e).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(e,t){return e-(e-t)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var e=this._draggable._newPos.subtract(this._draggable._startPos),t=this._offsetLimit;e.x<t.min.x&&(e.x=this._viscousLimit(e.x,t.min.x)),e.y<t.min.y&&(e.y=this._viscousLimit(e.y,t.min.y)),e.x>t.max.x&&(e.x=this._viscousLimit(e.x,t.max.x)),e.y>t.max.y&&(e.y=this._viscousLimit(e.y,t.max.y)),this._draggable._newPos=this._draggable._startPos.add(e)}},_onPreDragWrap:function(){var e=this._worldWidth,t=Math.round(e/2),n=this._initialWorldOffset,r=this._draggable._newPos.x,i=(r-t+n)%e+t-n,a=(r+t+n)%e-t-n,o=Math.abs(i+n)<Math.abs(a+n)?i:a;this._draggable._absPos=this._draggable._newPos.clone(),this._draggable._newPos.x=o},_onDragEnd:function(e){var t=this._map,n=t.options,r=!n.inertia||e.noInertia||this._times.length<2;if(t.fire(`dragend`,e),r)t.fire(`moveend`);else{this._prunePositions(+new Date);var i=this._lastPos.subtract(this._positions[0]),a=(this._lastTime-this._times[0])/1e3,o=n.easeLinearity,s=i.multiplyBy(o/a),c=s.distanceTo([0,0]),l=Math.min(n.inertiaMaxSpeed,c),u=s.multiplyBy(l/c),d=l/(n.inertiaDeceleration*o),f=u.multiplyBy(-d/2).round();!f.x&&!f.y?t.fire(`moveend`):(f=t._limitOffset(f,t.options.maxBounds),T(function(){t.panBy(f,{duration:d,easeLinearity:o,noMoveStart:!0,animate:!0})}))}}});J.addInitHook(`addHandler`,`dragging`,ii),J.mergeOptions({keyboard:!0,keyboardPanDelta:80});var ai=yn.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,54,173]},initialize:function(e){this._map=e,this._setPanDelta(e.options.keyboardPanDelta),this._setZoomDelta(e.options.zoomDelta)},addHooks:function(){var e=this._map._container;e.tabIndex<=0&&(e.tabIndex=`0`),q(e,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.on({focus:this._addHooks,blur:this._removeHooks},this)},removeHooks:function(){this._removeHooks(),Gt(this._map._container,{focus:this._onFocus,blur:this._onBlur,mousedown:this._onMouseDown},this),this._map.off({focus:this._addHooks,blur:this._removeHooks},this)},_onMouseDown:function(){if(!this._focused){var e=document.body,t=document.documentElement,n=e.scrollTop||t.scrollTop,r=e.scrollLeft||t.scrollLeft;this._map._container.focus(),window.scrollTo(r,n)}},_onFocus:function(){this._focused=!0,this._map.fire(`focus`)},_onBlur:function(){this._focused=!1,this._map.fire(`blur`)},_setPanDelta:function(e){var t=this._panKeys={},n=this.keyCodes,r,i;for(r=0,i=n.left.length;r<i;r++)t[n.left[r]]=[-1*e,0];for(r=0,i=n.right.length;r<i;r++)t[n.right[r]]=[e,0];for(r=0,i=n.down.length;r<i;r++)t[n.down[r]]=[0,e];for(r=0,i=n.up.length;r<i;r++)t[n.up[r]]=[0,-1*e]},_setZoomDelta:function(e){var t=this._zoomKeys={},n=this.keyCodes,r,i;for(r=0,i=n.zoomIn.length;r<i;r++)t[n.zoomIn[r]]=e;for(r=0,i=n.zoomOut.length;r<i;r++)t[n.zoomOut[r]]=-e},_addHooks:function(){q(document,`keydown`,this._onKeyDown,this)},_removeHooks:function(){Gt(document,`keydown`,this._onKeyDown,this)},_onKeyDown:function(e){if(!(e.altKey||e.ctrlKey||e.metaKey)){var t=e.keyCode,n=this._map,r;if(t in this._panKeys){if(!n._panAnim||!n._panAnim._inProgress)if(r=this._panKeys[t],e.shiftKey&&(r=P(r).multiplyBy(3)),n.options.maxBounds&&(r=n._limitOffset(P(r),n.options.maxBounds)),n.options.worldCopyJump){var i=n.wrapLatLng(n.unproject(n.project(n.getCenter()).add(r)));n.panTo(i)}else n.panBy(r)}else if(t in this._zoomKeys)n.setZoom(n.getZoom()+(e.shiftKey?3:1)*this._zoomKeys[t]);else if(t===27&&n._popup&&n._popup.options.closeOnEscapeKey)n.closePopup();else return;en(e)}}});J.addInitHook(`addHandler`,`keyboard`,ai),J.mergeOptions({scrollWheelZoom:!0,wheelDebounceTime:40,wheelPxPerZoomLevel:60});var oi=yn.extend({addHooks:function(){q(this._map._container,`wheel`,this._onWheelScroll,this),this._delta=0},removeHooks:function(){Gt(this._map._container,`wheel`,this._onWheelScroll,this)},_onWheelScroll:function(e){var t=an(e),n=this._map.options.wheelDebounceTime;this._delta+=t,this._lastMousePos=this._map.mouseEventToContainerPoint(e),this._startTime||=+new Date;var r=Math.max(n-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(i(this._performZoom,this),r),en(e)},_performZoom:function(){var e=this._map,t=e.getZoom(),n=this._map.options.zoomSnap||0;e._stop();var r=this._delta/(this._map.options.wheelPxPerZoomLevel*4),i=4*Math.log(2/(1+Math.exp(-Math.abs(r))))/Math.LN2,a=n?Math.ceil(i/n)*n:i,o=e._limitZoom(t+(this._delta>0?a:-a))-t;this._delta=0,this._startTime=null,o&&(e.options.scrollWheelZoom===`center`?e.setZoom(t+o):e.setZoomAround(this._lastMousePos,t+o))}});J.addInitHook(`addHandler`,`scrollWheelZoom`,oi);var si=600;J.mergeOptions({tapHold:U.touchNative&&U.safari&&U.mobile,tapTolerance:15});var ci=yn.extend({addHooks:function(){q(this._map._container,`touchstart`,this._onDown,this)},removeHooks:function(){Gt(this._map._container,`touchstart`,this._onDown,this)},_onDown:function(e){if(clearTimeout(this._holdTimeout),e.touches.length===1){var t=e.touches[0];this._startPos=this._newPos=new M(t.clientX,t.clientY),this._holdTimeout=setTimeout(i(function(){this._cancel(),this._isTapValid()&&(q(document,`touchend`,$t),q(document,`touchend touchcancel`,this._cancelClickPrevent),this._simulateEvent(`contextmenu`,t))},this),si),q(document,`touchend touchcancel contextmenu`,this._cancel,this),q(document,`touchmove`,this._onMove,this)}},_cancelClickPrevent:function e(){Gt(document,`touchend`,$t),Gt(document,`touchend touchcancel`,e)},_cancel:function(){clearTimeout(this._holdTimeout),Gt(document,`touchend touchcancel contextmenu`,this._cancel,this),Gt(document,`touchmove`,this._onMove,this)},_onMove:function(e){var t=e.touches[0];this._newPos=new M(t.clientX,t.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(e,t){var n=new MouseEvent(e,{bubbles:!0,cancelable:!0,view:window,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY});n._simulated=!0,t.target.dispatchEvent(n)}});J.addInitHook(`addHandler`,`tapHold`,ci),J.mergeOptions({touchZoom:U.touch,bounceAtZoomLimits:!0});var li=yn.extend({addHooks:function(){K(this._map._container,`leaflet-touch-zoom`),q(this._map._container,`touchstart`,this._onTouchStart,this)},removeHooks:function(){St(this._map._container,`leaflet-touch-zoom`),Gt(this._map._container,`touchstart`,this._onTouchStart,this)},_onTouchStart:function(e){var t=this._map;if(!(!e.touches||e.touches.length!==2||t._animatingZoom||this._zooming)){var n=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]);this._centerPoint=t.getSize()._divideBy(2),this._startLatLng=t.containerPointToLatLng(this._centerPoint),t.options.touchZoom!==`center`&&(this._pinchStartLatLng=t.containerPointToLatLng(n.add(r)._divideBy(2))),this._startDist=n.distanceTo(r),this._startZoom=t.getZoom(),this._moved=!1,this._zooming=!0,t._stop(),q(document,`touchmove`,this._onTouchMove,this),q(document,`touchend touchcancel`,this._onTouchEnd,this),$t(e)}},_onTouchMove:function(e){if(!(!e.touches||e.touches.length!==2||!this._zooming)){var t=this._map,n=t.mouseEventToContainerPoint(e.touches[0]),r=t.mouseEventToContainerPoint(e.touches[1]),a=n.distanceTo(r)/this._startDist;if(this._zoom=t.getScaleZoom(a,this._startZoom),!t.options.bounceAtZoomLimits&&(this._zoom<t.getMinZoom()&&a<1||this._zoom>t.getMaxZoom()&&a>1)&&(this._zoom=t._limitZoom(this._zoom)),t.options.touchZoom===`center`){if(this._center=this._startLatLng,a===1)return}else{var o=n._add(r)._divideBy(2)._subtract(this._centerPoint);if(a===1&&o.x===0&&o.y===0)return;this._center=t.unproject(t.project(this._pinchStartLatLng,this._zoom).subtract(o),this._zoom)}this._moved||=(t._moveStart(!0,!1),!0),E(this._animRequest);var s=i(t._move,t,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=T(s,this,!0),$t(e)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,E(this._animRequest),Gt(document,`touchmove`,this._onTouchMove,this),Gt(document,`touchend touchcancel`,this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});J.addInitHook(`addHandler`,`touchZoom`,li),J.BoxZoom=ni,J.DoubleClickZoom=ri,J.Drag=ii,J.Keyboard=ai,J.ScrollWheelZoom=oi,J.TapHold=ci,J.TouchZoom=li,e.Bounds=F,e.Browser=U,e.CRS=ee,e.Canvas=qr,e.Circle=lr,e.CircleMarker=sr,e.Class=O,e.Control=un,e.DivIcon=Rr,e.DivOverlay=Nr,e.DomEvent=sn,e.DomUtil=Ut,e.Draggable=Sn,e.Evented=j,e.FeatureGroup=Qn,e.GeoJSON=hr,e.GridLayer=Br,e.Handler=yn,e.Icon=er,e.ImageOverlay=Dr,e.LatLng=B,e.LatLngBounds=R,e.Layer=Yn,e.LayerGroup=Xn,e.LineUtil=Hn,e.Map=J,e.Marker=ir,e.Mixin=bn,e.Path=or,e.Point=M,e.PolyUtil=En,e.Polygon=pr,e.Polyline=dr,e.Popup=Pr,e.PosAnimation=cn,e.Projection=Gn,e.Rectangle=ei,e.Renderer=Kr,e.SVG=Qr,e.SVGOverlay=jr,e.TileLayer=Hr,e.Tooltip=Ir,e.Transformation=ie,e.Util=D,e.VideoOverlay=kr,e.bind=i,e.bounds=I,e.canvas=Jr,e.circle=ur,e.circleMarker=cr,e.control=dn,e.divIcon=zr,e.extend=n,e.featureGroup=$n,e.geoJSON=Tr,e.geoJson=Er,e.gridLayer=Vr,e.icon=tr,e.imageOverlay=Or,e.latLng=V,e.latLngBounds=z,e.layerGroup=Zn,e.map=ln,e.marker=ar,e.point=P,e.polygon=mr,e.polyline=fr,e.popup=Fr,e.rectangle=ti,e.setOptions=p,e.stamp=o,e.svg=$r,e.svgOverlay=Mr,e.tileLayer=Ur,e.tooltip=Lr,e.transformation=ae,e.version=t,e.videoOverlay=Ar;var ui=window.L;e.noConflict=function(){return window.L=ui,this},window.L=e}))})),zd=o(((e,t)=>{((n,r)=>{typeof define==`function`&&define.amd?define([`leaflet`],n):typeof e==`object`&&(t.exports=n(Rd())),r!==void 0&&r.L&&n(r.L)})(e=>{e.Editable=e.Evented.extend({statics:{FORWARD:1,BACKWARD:-1},options:{zIndex:1e3,polygonClass:e.Polygon,polylineClass:e.Polyline,markerClass:e.Marker,circleMarkerClass:e.CircleMarker,rectangleClass:e.Rectangle,circleClass:e.Circle,drawingCSSClass:`leaflet-editable-drawing`,drawingCursor:`crosshair`,editLayer:void 0,featuresLayer:void 0,polylineEditorClass:void 0,polygonEditorClass:void 0,markerEditorClass:void 0,circleMarkerEditorClass:void 0,rectangleEditorClass:void 0,circleEditorClass:void 0,lineGuideOptions:{},skipMiddleMarkers:!1},initialize:function(t,n){e.setOptions(this,n),this._lastZIndex=this.options.zIndex,this.map=t,this.editLayer=this.createEditLayer(),this.featuresLayer=this.createFeaturesLayer(),this.forwardLineGuide=this.createLineGuide(),this.backwardLineGuide=this.createLineGuide()},fireAndForward:function(e,t){t||={},t.editTools=this,this.fire(e,t),this.map.fire(e,t)},createLineGuide:function(){let t=e.extend({dashArray:`5,10`,weight:1,interactive:!1},this.options.lineGuideOptions);return e.polyline([],t)},createVertexIcon:t=>e.Browser.mobile&&e.Browser.touch?new e.Editable.TouchVertexIcon(t):new e.Editable.VertexIcon(t),createEditLayer:function(){return this.options.editLayer||new e.LayerGroup().addTo(this.map)},createFeaturesLayer:function(){return this.options.featuresLayer||new e.LayerGroup().addTo(this.map)},moveForwardLineGuide:function(e){this.forwardLineGuide._latlngs.length&&(this.forwardLineGuide._latlngs[1]=e,this.forwardLineGuide._bounds.extend(e),this.forwardLineGuide.redraw())},moveBackwardLineGuide:function(e){this.backwardLineGuide._latlngs.length&&(this.backwardLineGuide._latlngs[1]=e,this.backwardLineGuide._bounds.extend(e),this.backwardLineGuide.redraw())},anchorForwardLineGuide:function(e){this.forwardLineGuide._latlngs[0]=e,this.forwardLineGuide._bounds.extend(e),this.forwardLineGuide.redraw()},anchorBackwardLineGuide:function(e){this.backwardLineGuide._latlngs[0]=e,this.backwardLineGuide._bounds.extend(e),this.backwardLineGuide.redraw()},attachForwardLineGuide:function(){this.editLayer.addLayer(this.forwardLineGuide)},attachBackwardLineGuide:function(){this.editLayer.addLayer(this.backwardLineGuide)},detachForwardLineGuide:function(){this.forwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.forwardLineGuide)},detachBackwardLineGuide:function(){this.backwardLineGuide.setLatLngs([]),this.editLayer.removeLayer(this.backwardLineGuide)},blockEvents:function(){this._oldTargets||(this._oldTargets=this.map._targets,this.map._targets={})},unblockEvents:function(){this._oldTargets&&(this.map._targets=e.extend(this.map._targets,this._oldTargets),delete this._oldTargets)},registerForDrawing:function(t){this._drawingEditor&&this.unregisterForDrawing(this._drawingEditor),this.blockEvents(),t.reset(),this._drawingEditor=t,this.map.on(`mousemove touchmove`,t.onDrawingMouseMove,t),this.map.on(`mousedown`,this.onMousedown,this),this.map.on(`mouseup`,this.onMouseup,this),e.DomUtil.addClass(this.map._container,this.options.drawingCSSClass),this.defaultMapCursor=this.map._container.style.cursor,this.map._container.style.cursor=this.options.drawingCursor},unregisterForDrawing:function(t){this.unblockEvents(),e.DomUtil.removeClass(this.map._container,this.options.drawingCSSClass),this.map._container.style.cursor=this.defaultMapCursor,t||=this._drawingEditor,t&&(this.map.off(`mousemove touchmove`,t.onDrawingMouseMove,t),this.map.off(`mousedown`,this.onMousedown,this),this.map.off(`mouseup`,this.onMouseup,this),t===this._drawingEditor&&(delete this._drawingEditor,t._drawing&&t.cancelDrawing()))},onMousedown:function(e){e.originalEvent.which==1&&(this._mouseDown=e,this._drawingEditor.onDrawingMouseDown(e))},onMouseup:function(t){if(this._mouseDown){let n=this._drawingEditor,r=this._mouseDown;if(this._mouseDown=null,n.onDrawingMouseUp(t),this._drawingEditor!==n)return;let i=e.point(r.originalEvent.clientX,r.originalEvent.clientY),a=e.point(t.originalEvent.clientX,t.originalEvent.clientY).distanceTo(i);Math.abs(a)<9*(window.devicePixelRatio||1)&&this._drawingEditor.onDrawingClick(t)}},drawing:function(){return this._drawingEditor?.drawing()},stopDrawing:function(){this.unregisterForDrawing()},commitDrawing:function(e){this._drawingEditor&&this._drawingEditor.commitDrawing(e)},connectCreatedToMap:function(e){return this.featuresLayer.addLayer(e)},startPolyline:function(e,t){let n=this.createPolyline([],t);return n.enableEdit(this.map).newShape(e),n},startPolygon:function(e,t){let n=this.createPolygon([],t);return n.enableEdit(this.map).newShape(e),n},startMarker:function(e,t){e||=this.map.getCenter().clone();let n=this.createMarker(e,t);return n.enableEdit(this.map).startDrawing(),n},startCircleMarker:function(e,t){e||=this.map.getCenter().clone();let n=this.createCircleMarker(e,t);return n.enableEdit(this.map).startDrawing(),n},startRectangle:function(t,n){let r=t||e.latLng([0,0]),i=new e.LatLngBounds(r,r),a=this.createRectangle(i,n);return a.enableEdit(this.map).startDrawing(),a},startCircle:function(e,t){e||=this.map.getCenter().clone();let n=this.createCircle(e,t);return n.enableEdit(this.map).startDrawing(),n},startHole:(e,t)=>{e.newHole(t)},createLayer:function(t,n,r){r=e.Util.extend({editOptions:{editTools:this}},r);let i=new t(n,r);return this.fireAndForward(`editable:created`,{layer:i}),i},createPolyline:function(e,t){return this.createLayer(t?.polylineClass||this.options.polylineClass,e,t)},createPolygon:function(e,t){return this.createLayer(t?.polygonClass||this.options.polygonClass,e,t)},createMarker:function(e,t){return this.createLayer(t?.markerClass||this.options.markerClass,e,t)},createCircleMarker:function(e,t){return this.createLayer(t?.circleMarkerClass||this.options.circleMarkerClass,e,t)},createRectangle:function(e,t){return this.createLayer(t?.rectangleClass||this.options.rectangleClass,e,t)},createCircle:function(e,t){return this.createLayer(t?.circleClass||this.options.circleClass,e,t)}}),e.extend(e.Editable,{makeCancellable:e=>{e.cancel=()=>{e._cancelled=!0}}}),e.Map.mergeOptions({editToolsClass:e.Editable,editable:!1,editOptions:{}}),e.Map.addInitHook(function(){this.whenReady(function(){this.options.editable&&(this.editTools=new this.options.editToolsClass(this,this.options.editOptions))})}),e.Editable.VertexIcon=e.DivIcon.extend({options:{iconSize:new e.Point(8,8)}}),e.Editable.TouchVertexIcon=e.Editable.VertexIcon.extend({options:{iconSize:new e.Point(20,20)}}),e.Editable.VertexMarker=e.Marker.extend({options:{draggable:!0,className:`leaflet-div-icon leaflet-vertex-icon`},initialize:function(t,n,r,i){this.latlng=t,this.latlngs=n,this.editor=r,e.Marker.prototype.initialize.call(this,t,i),this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.latlng.__vertex=this,this.connect(),this.setZIndexOffset(r.tools._lastZIndex+1)},connect:function(){this.editor.editLayer.addLayer(this)},onAdd:function(t){e.Marker.prototype.onAdd.call(this,t),this.on(`drag`,this.onDrag),this.on(`dragstart`,this.onDragStart),this.on(`dragend`,this.onDragEnd),this.on(`mouseup`,this.onMouseup),this.on(`click`,this.onClick),this.on(`contextmenu`,this.onContextMenu),this.on(`mousedown touchstart`,this.onMouseDown),this.on(`mouseover`,this.onMouseOver),this.on(`mouseout`,this.onMouseOut),this.addMiddleMarkers()},onRemove:function(t){this.middleMarker&&this.middleMarker.delete(),delete this.latlng.__vertex,this.off(`drag`,this.onDrag),this.off(`dragstart`,this.onDragStart),this.off(`dragend`,this.onDragEnd),this.off(`mouseup`,this.onMouseup),this.off(`click`,this.onClick),this.off(`contextmenu`,this.onContextMenu),this.off(`mousedown touchstart`,this.onMouseDown),this.off(`mouseover`,this.onMouseOver),this.off(`mouseout`,this.onMouseOut),e.Marker.prototype.onRemove.call(this,t)},onDrag:function(t){t.vertex=this,this.editor.onVertexMarkerDrag(t);let n=e.DomUtil.getPosition(this._icon),r=this._map.layerPointToLatLng(n);this.latlng.update(r),this._latlng=this.latlng,this.editor.refresh(),this.middleMarker&&this.middleMarker.updateLatLng();let i=this.getNext();i?.middleMarker&&i.middleMarker.updateLatLng()},onDragStart:function(e){e.vertex=this,this.editor.onVertexMarkerDragStart(e)},onDragEnd:function(e){e.vertex=this,this.editor.onVertexMarkerDragEnd(e)},onClick:function(e){e.vertex=this,this.editor.onVertexMarkerClick(e)},onMouseup:function(t){e.DomEvent.stop(t),t.vertex=this,this.editor.map.fire(`mouseup`,t)},onContextMenu:function(e){e.vertex=this,this.editor.onVertexMarkerContextMenu(e)},onMouseDown:function(e){e.vertex=this,this.editor.onVertexMarkerMouseDown(e)},onMouseOver:function(e){e.vertex=this,this.editor.onVertexMarkerMouseOver(e)},onMouseOut:function(e){e.vertex=this,this.editor.onVertexMarkerMouseOut(e)},delete:function(){let e=this.getNext();this.latlngs.splice(this.getIndex(),1),this.editor.editLayer.removeLayer(this),this.editor.onVertexDeleted({latlng:this.latlng,vertex:this}),this.latlngs.length||this.editor.deleteShape(this.latlngs),e&&e.resetMiddleMarker(),this.editor.refresh()},getIndex:function(){return this.latlngs.indexOf(this.latlng)},getLastIndex:function(){return this.latlngs.length-1},getPrevious:function(){if(this.latlngs.length<2)return;let e=this.getIndex(),t=e-1;e===0&&this.editor.CLOSED&&(t=this.getLastIndex());let n=this.latlngs[t];if(n)return n.__vertex},getNext:function(){if(this.latlngs.length<2)return;let e=this.getIndex(),t=e+1;e===this.getLastIndex()&&this.editor.CLOSED&&(t=0);let n=this.latlngs[t];if(n)return n.__vertex},addMiddleMarker:function(e){this.editor.hasMiddleMarkers()&&(e||=this.getPrevious(),e&&!this.middleMarker&&(this.middleMarker=this.editor.addMiddleMarker(e,this,this.latlngs,this.editor)))},addMiddleMarkers:function(){if(!this.editor.hasMiddleMarkers())return;let e=this.getPrevious();e&&this.addMiddleMarker(e);let t=this.getNext();t&&t.resetMiddleMarker()},resetMiddleMarker:function(){this.middleMarker&&this.middleMarker.delete(),this.addMiddleMarker()},split:function(){this.editor.splitShape&&this.editor.splitShape(this.latlngs,this.getIndex())},continue:function(){if(!this.editor.continueBackward)return;let e=this.getIndex();e===0?this.editor.continueBackward(this.latlngs):e===this.getLastIndex()&&this.editor.continueForward(this.latlngs)}}),e.Editable.mergeOptions({vertexMarkerClass:e.Editable.VertexMarker}),e.Editable.MiddleMarker=e.Marker.extend({options:{opacity:.5,className:`leaflet-div-icon leaflet-middle-icon`,draggable:!0},initialize:function(t,n,r,i,a){this.left=t,this.right=n,this.editor=i,this.latlngs=r,e.Marker.prototype.initialize.call(this,this.computeLatLng(),a),this._opacity=this.options.opacity,this.options.icon=this.editor.tools.createVertexIcon({className:this.options.className}),this.editor.editLayer.addLayer(this),this.setVisibility()},setVisibility:function(){let t=this._map.latLngToContainerPoint(this.left.latlng),n=this._map.latLngToContainerPoint(this.right.latlng),r=e.point(this.options.icon.options.iconSize);t.distanceTo(n)<r.x*3?this.hide():this.show()},show:function(){this.setOpacity(this._opacity)},hide:function(){this.setOpacity(0)},updateLatLng:function(){this.setLatLng(this.computeLatLng()),this.setVisibility()},computeLatLng:function(){let e=this.editor.map.latLngToContainerPoint(this.left.latlng),t=this.editor.map.latLngToContainerPoint(this.right.latlng),n=(e.y+t.y)/2,r=(e.x+t.x)/2;return this.editor.map.containerPointToLatLng([r,n])},onAdd:function(t){e.Marker.prototype.onAdd.call(this,t),e.DomEvent.on(this._icon,`mousedown touchstart`,this.onMouseDown,this),t.on(`zoomend`,this.setVisibility,this)},onRemove:function(t){delete this.right.middleMarker,e.DomEvent.off(this._icon,`mousedown touchstart`,this.onMouseDown,this),t.off(`zoomend`,this.setVisibility,this),e.Marker.prototype.onRemove.call(this,t)},onMouseDown:function(t){let n=e.DomUtil.getPosition(this._icon),r=this.editor.map.layerPointToLatLng(n);if(t={originalEvent:t,latlng:r},this.options.opacity===0||(e.Editable.makeCancellable(t),this.editor.onMiddleMarkerMouseDown(t),t._cancelled))return;this.latlngs.splice(this.index(),0,t.latlng),this.editor.refresh();let i=this._icon,a=this.editor.addVertexMarker(t.latlng,this.latlngs);this.editor.onNewVertex(a);let o=a._icon.parentNode;o.removeChild(a._icon),a._icon=i,o.appendChild(a._icon),a._initIcon(),a._initInteraction(),a.setOpacity(1),e.Draggable._dragging=!1,a.dragging._draggable._onDown(t.originalEvent),this.delete()},delete:function(){this.editor.editLayer.removeLayer(this)},index:function(){return this.latlngs.indexOf(this.right.latlng)}}),e.Editable.mergeOptions({middleMarkerClass:e.Editable.MiddleMarker}),e.Editable.BaseEditor=e.Handler.extend({initialize:function(t,n,r){e.setOptions(this,r),this.map=t,this.feature=n,this.feature.editor=this,this.editLayer=new e.LayerGroup,this.tools=this.options.editTools||t.editTools},addHooks:function(){this.isConnected()?this.onFeatureAdd():this.feature.once(`add`,this.onFeatureAdd,this),this.onEnable(),this.feature.on(this._getEvents(),this)},removeHooks:function(){this.feature.off(this._getEvents(),this),this.feature.dragging&&this.feature.dragging.disable(),this.editLayer.clearLayers(),this.tools.editLayer.removeLayer(this.editLayer),this.onDisable(),this._drawing&&this.cancelDrawing()},drawing:function(){return!!this._drawing},reset:()=>{},onFeatureAdd:function(){this.tools.editLayer.addLayer(this.editLayer),this.feature.dragging&&this.options.draggable!=0&&this.feature.dragging.enable()},hasMiddleMarkers:function(){return!this.options.skipMiddleMarkers&&!this.tools.options.skipMiddleMarkers},fireAndForward:function(e,t){t||={},t.layer=this.feature,this.feature.fire(e,t),this.tools.fireAndForward(e,t)},onEnable:function(){this.fireAndForward(`editable:enable`)},onDisable:function(){this.fireAndForward(`editable:disable`)},onEditing:function(){this.fireAndForward(`editable:editing`)},onEdited:function(){this.fireAndForward(`editable:edited`)},onStartDrawing:function(){this.fireAndForward(`editable:drawing:start`)},onEndDrawing:function(){this.fireAndForward(`editable:drawing:end`)},onCancelDrawing:function(){this.fireAndForward(`editable:drawing:cancel`)},onCommitDrawing:function(e){this.fireAndForward(`editable:drawing:commit`,e),this.onEdited()},onDrawingMouseDown:function(e){this.fireAndForward(`editable:drawing:mousedown`,e)},onDrawingMouseUp:function(e){this.fireAndForward(`editable:drawing:mouseup`,e)},startDrawing:function(){this._drawing||=e.Editable.FORWARD,this.tools.registerForDrawing(this),this.onStartDrawing()},commitDrawing:function(e){this.onCommitDrawing(e),this.endDrawing()},cancelDrawing:function(){e.Draggable._dragging=!1,this.onCancelDrawing(),this.endDrawing()},endDrawing:function(){this._drawing=!1,this.tools.unregisterForDrawing(this),this.onEndDrawing()},onDrawingClick:function(t){this.drawing()&&(e.Editable.makeCancellable(t),this.fireAndForward(`editable:drawing:click`,t),!t._cancelled&&(this.isConnected()||this.connect(t),this.processDrawingClick(t)))},isConnected:function(){return this.map.hasLayer(this.feature)},connect:function(){this.tools.connectCreatedToMap(this.feature),this.tools.editLayer.addLayer(this.editLayer)},onMove:function(e){this.fireAndForward(`editable:drawing:move`,e)},onDrawingMouseMove:function(e){this.onMove(e)},_getEvents:function(){return{dragstart:this.onDragStart,drag:this.onDrag,dragend:this.onDragEnd,remove:this.disable}},onDragStart:function(e){this.onEditing(),this.fireAndForward(`editable:dragstart`,e)},onDrag:function(e){this.onMove(e),this.fireAndForward(`editable:drag`,e)},onDragEnd:function(e){this.fireAndForward(`editable:dragend`,e),this.onEdited()}}),e.Editable.MarkerEditor=e.Editable.BaseEditor.extend({onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&this.feature.setLatLng(t.latlng)},processDrawingClick:function(e){this.fireAndForward(`editable:drawing:clicked`,e),this.commitDrawing(e)},connect:function(t){t&&(this.feature._latlng=t.latlng),e.Editable.BaseEditor.prototype.connect.call(this,t)}}),e.Editable.CircleMarkerEditor=e.Editable.BaseEditor.extend({onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&this.feature.setLatLng(t.latlng)},processDrawingClick:function(e){this.fireAndForward(`editable:drawing:clicked`,e),this.commitDrawing(e)},connect:function(t){t&&(this.feature._latlng=t.latlng),e.Editable.BaseEditor.prototype.connect.call(this,t)}}),e.Editable.PathEditor=e.Editable.BaseEditor.extend({CLOSED:!1,MIN_VERTEX:2,addHooks:function(){return e.Editable.BaseEditor.prototype.addHooks.call(this),this.feature&&(this.initVertexMarkers(),this.map.on(`moveend`,this.onMoveEnd,this)),this},removeHooks:function(){e.Editable.BaseEditor.prototype.removeHooks.call(this),this.feature&&this.map.off(`moveend`,this.onMoveEnd,this)},onMoveEnd:function(){this.initVertexMarkers()},initVertexMarkers:function(e){if(this.enabled())if(e||=this.getLatLngs(),l(e))this.addVertexMarkers(e);else for(let t of e)this.initVertexMarkers(t)},getLatLngs:function(){return this.feature.getLatLngs()},reset:function(){this.editLayer.clearLayers(),this.initVertexMarkers()},addVertexMarker:function(e,t){return e.__vertex?(e.__vertex.connect(),e.__vertex):new this.tools.options.vertexMarkerClass(e,t,this)},onNewVertex:function(e){this.fireAndForward(`editable:vertex:new`,{latlng:e.latlng,vertex:e})},addVertexMarkers:function(e){let t=this.map.getBounds();for(let n of e)t.contains(n)&&this.addVertexMarker(n,e)},refreshVertexMarkers:function(e){e||=this.getDefaultLatLngs();for(let t of e)t.__vertex.update()},addMiddleMarker:function(e,t,n){return new this.tools.options.middleMarkerClass(e,t,n,this)},onVertexMarkerClick:function(t){if(e.Editable.makeCancellable(t),this.fireAndForward(`editable:vertex:click`,t),t._cancelled||this.tools.drawing()&&this.tools._drawingEditor!==this)return;let n=t.vertex.getIndex(),r;t.originalEvent.ctrlKey?this.onVertexMarkerCtrlClick(t):t.originalEvent.altKey?this.onVertexMarkerAltClick(t):t.originalEvent.shiftKey?this.onVertexMarkerShiftClick(t):t.originalEvent.metaKey?this.onVertexMarkerMetaKeyClick(t):n===t.vertex.getLastIndex()&&this._drawing===e.Editable.FORWARD?n>=this.MIN_VERTEX-1&&(r=!0):n===0&&this._drawing===e.Editable.BACKWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX||n===0&&this._drawing===e.Editable.FORWARD&&this._drawnLatLngs.length>=this.MIN_VERTEX&&this.CLOSED?r=!0:this.onVertexRawMarkerClick(t),this.fireAndForward(`editable:vertex:clicked`,t),r&&this.commitDrawing(t)},onVertexRawMarkerClick:function(e){this.fireAndForward(`editable:vertex:rawclick`,e),!e._cancelled&&this.vertexCanBeDeleted(e.vertex)&&e.vertex.delete()},vertexCanBeDeleted:function(e){return e.latlngs.length>this.MIN_VERTEX},onVertexDeleted:function(e){this.fireAndForward(`editable:vertex:deleted`,e),this.onEdited()},onVertexMarkerCtrlClick:function(e){this.fireAndForward(`editable:vertex:ctrlclick`,e)},onVertexMarkerShiftClick:function(e){this.fireAndForward(`editable:vertex:shiftclick`,e)},onVertexMarkerMetaKeyClick:function(e){this.fireAndForward(`editable:vertex:metakeyclick`,e)},onVertexMarkerAltClick:function(e){this.fireAndForward(`editable:vertex:altclick`,e)},onVertexMarkerContextMenu:function(e){this.fireAndForward(`editable:vertex:contextmenu`,e)},onVertexMarkerMouseDown:function(e){this.fireAndForward(`editable:vertex:mousedown`,e)},onVertexMarkerMouseOver:function(e){this.fireAndForward(`editable:vertex:mouseover`,e)},onVertexMarkerMouseOut:function(e){this.fireAndForward(`editable:vertex:mouseout`,e)},onMiddleMarkerMouseDown:function(e){this.fireAndForward(`editable:middlemarker:mousedown`,e)},onVertexMarkerDrag:function(e){this.onMove(e),this.feature._bounds&&this.extendBounds(e),this.fireAndForward(`editable:vertex:drag`,e)},onVertexMarkerDragStart:function(e){this.fireAndForward(`editable:vertex:dragstart`,e)},onVertexMarkerDragEnd:function(e){this.fireAndForward(`editable:vertex:dragend`,e),this.onEdited()},setDrawnLatLngs:function(e){this._drawnLatLngs=e||this.getDefaultLatLngs()},startDrawing:function(){this._drawnLatLngs||this.setDrawnLatLngs(),e.Editable.BaseEditor.prototype.startDrawing.call(this)},startDrawingForward:function(){this.startDrawing()},endDrawing:function(){this.tools.detachForwardLineGuide(),this.tools.detachBackwardLineGuide(),this._drawnLatLngs&&this._drawnLatLngs.length<this.MIN_VERTEX&&this.deleteShape(this._drawnLatLngs),e.Editable.BaseEditor.prototype.endDrawing.call(this),delete this._drawnLatLngs},addLatLng:function(t){this._drawing===e.Editable.FORWARD?this._drawnLatLngs.push(t):this._drawnLatLngs.unshift(t),this.feature._bounds.extend(t);let n=this.addVertexMarker(t,this._drawnLatLngs);this.onNewVertex(n),this.refresh()},newPointForward:function(e){this.addLatLng(e),this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(e)},newPointBackward:function(e){this.addLatLng(e),this.tools.anchorBackwardLineGuide(e)},push:function(t){if(!t)return console.error(`L.Editable.PathEditor.push expect a valid latlng as parameter`);this._drawing===e.Editable.FORWARD?this.newPointForward(t):this.newPointBackward(t)},removeLatLng:function(e){e.__vertex.delete(),this.refresh()},pop:function(){if(this._drawnLatLngs.length<=1)return;let t;return t=this._drawing===e.Editable.FORWARD?this._drawnLatLngs[this._drawnLatLngs.length-1]:this._drawnLatLngs[0],this.removeLatLng(t),this._drawing===e.Editable.FORWARD?this.tools.anchorForwardLineGuide(this._drawnLatLngs[this._drawnLatLngs.length-1]):this.tools.anchorForwardLineGuide(this._drawnLatLngs[0]),t},processDrawingClick:function(t){t.vertex&&t.vertex.editor===this||(this._drawing===e.Editable.FORWARD?this.newPointForward(t.latlng):this.newPointBackward(t.latlng),this.fireAndForward(`editable:drawing:clicked`,t))},onDrawingMouseMove:function(t){e.Editable.BaseEditor.prototype.onDrawingMouseMove.call(this,t),this._drawing&&(this.tools.moveForwardLineGuide(t.latlng),this.tools.moveBackwardLineGuide(t.latlng))},refresh:function(){this.feature.redraw(),this.onEditing()},newShape:function(e){let t=this.addNewEmptyShape();t&&(this.setDrawnLatLngs(t[0]||t),this.startDrawingForward(),this.fireAndForward(`editable:shape:new`,{shape:t}),e&&this.newPointForward(e))},deleteShape:function(t,n){let r={shape:t};if(e.Editable.makeCancellable(r),this.fireAndForward(`editable:shape:delete`,r),!r._cancelled)return t=this._deleteShape(t,n),this.ensureNotFlat&&this.ensureNotFlat(),this.feature.setLatLngs(this.getLatLngs()),this.refresh(),this.reset(),this.fireAndForward(`editable:shape:deleted`,{shape:t}),this.onEdited(),t},_deleteShape:function(e,t){if(t||=this.getLatLngs(),!t.length)return;let n=(e,t)=>e.splice(0,Number.MAX_VALUE),r=(e,t)=>(e.splice(e.indexOf(t),1),e.length||this._deleteShape(e),t);if(t===e)return n(t,e);for(let n of t){if(n===e)return r(t,e);if(n.indexOf(e)!==-1)return r(n,e)}},deleteShapeAt:function(e){let t=this.feature.shapeAt(e);if(t)return this.deleteShape(t)},appendShape:function(e){this.insertShape(e)},prependShape:function(e){this.insertShape(e,0)},insertShape:function(e,t){this.ensureMulti(),e=this.formatShape(e),t===void 0&&(t=this.feature._latlngs.length),this.feature._latlngs.splice(t,0,e),this.feature.redraw(),this._enabled&&this.reset()},extendBounds:function(e){this.feature._bounds.extend(e.vertex.latlng)},onDragStart:function(t){this.editLayer.clearLayers(),e.Editable.BaseEditor.prototype.onDragStart.call(this,t)},onDragEnd:function(t){this.initVertexMarkers(),e.Editable.BaseEditor.prototype.onDragEnd.call(this,t)}}),e.Editable.PolylineEditor=e.Editable.PathEditor.extend({startDrawingBackward:function(){this._drawing=e.Editable.BACKWARD,this.startDrawing()},continueBackward:function(e){this.drawing()||(e||=this.getDefaultLatLngs(),this.setDrawnLatLngs(e),e.length>0&&(this.tools.attachBackwardLineGuide(),this.tools.anchorBackwardLineGuide(e[0])),this.startDrawingBackward())},continueForward:function(e){this.drawing()||(e||=this.getDefaultLatLngs(),this.setDrawnLatLngs(e),e.length>0&&(this.tools.attachForwardLineGuide(),this.tools.anchorForwardLineGuide(e[e.length-1])),this.startDrawingForward())},getDefaultLatLngs:function(t){return t||=this.feature._latlngs,!t.length||t[0]instanceof e.LatLng?t:this.getDefaultLatLngs(t[0])},ensureMulti:function(){this.feature._latlngs.length&&l(this.feature._latlngs)&&(this.feature._latlngs=[this.feature._latlngs])},addNewEmptyShape:function(){if(this.feature._latlngs.length){let e=[];return this.appendShape(e),e}return this.feature._latlngs},formatShape:function(e){if(l(e))return e;if(e[0])return this.formatShape(e[0])},splitShape:function(t,n){if(!n||n>=t.length-1)return;this.ensureMulti();let r=this.feature._latlngs.indexOf(t);if(r===-1)return;let i=t.slice(0,n+1),a=t.slice(n);a[0]=e.latLng(a[0].lat,a[0].lng,a[0].alt),this.feature._latlngs.splice(r,1,i,a),this.refresh(),this.reset(),this.onEdited()}}),e.Editable.PolygonEditor=e.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:3,newPointForward:function(t){e.Editable.PathEditor.prototype.newPointForward.call(this,t),this.tools.backwardLineGuide._latlngs.length||this.tools.anchorBackwardLineGuide(t),this._drawnLatLngs.length===2&&this.tools.attachBackwardLineGuide()},addNewEmptyHole:function(e){this.ensureNotFlat();let t=this.feature.shapeAt(e);if(!t)return;let n=[];return t.push(n),n},newHole:function(e){let t=this.addNewEmptyHole(e);t&&(this.setDrawnLatLngs(t),this.startDrawingForward(),e&&this.newPointForward(e))},addNewEmptyShape:function(){if(this.feature._latlngs.length&&this.feature._latlngs[0].length){let e=[];return this.appendShape(e),e}return this.feature._latlngs},ensureMulti:function(){this.feature._latlngs.length&&l(this.feature._latlngs[0])&&(this.feature._latlngs=[this.feature._latlngs])},ensureNotFlat:function(){(!this.feature._latlngs.length||l(this.feature._latlngs))&&(this.feature._latlngs=[this.feature._latlngs])},vertexCanBeDeleted:function(t){let n=this.feature.parentShape(t.latlngs);return e.Util.indexOf(n,t.latlngs)>0?!0:e.Editable.PathEditor.prototype.vertexCanBeDeleted.call(this,t)},getDefaultLatLngs:function(){return this.feature._latlngs.length||this.feature._latlngs.push([]),this.feature._latlngs[0]},formatShape:e=>l(e)&&(!e[0]||e[0].length!==0)?[e]:e}),e.Editable.RectangleEditor=e.Editable.PathEditor.extend({CLOSED:!0,MIN_VERTEX:4,options:{skipMiddleMarkers:!0},extendBounds:function(t){let n=t.vertex.getIndex(),r=t.vertex.getNext(),i=t.vertex.getPrevious(),a=(n+2)%4,o=t.vertex.latlngs[a],s=new e.LatLngBounds(t.latlng,o);i.latlng.update([t.latlng.lat,o.lng]),r.latlng.update([o.lat,t.latlng.lng]),this.updateBounds(s),this.refreshVertexMarkers()},onDrawingMouseDown:function(t){e.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this.connect();let n=this.getDefaultLatLngs();n.length===3&&n.push(t.latlng);let r=new e.LatLngBounds(t.latlng,t.latlng);this.updateBounds(r),this.updateLatLngs(r),this.refresh(),this.reset(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),n[3].__vertex.dragging._draggable._onDown(t.originalEvent)},onDrawingMouseUp:function(t){this.commitDrawing(t),t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,t)},onDrawingMouseMove:function(t){t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,t)},getDefaultLatLngs:function(e){return e||this.feature._latlngs[0]},updateBounds:function(e){this.feature._bounds=e},updateLatLngs:function(e){let t=this.getDefaultLatLngs(),n=this.feature._boundsToLatLngs(e);for(let e=0;e<t.length;e++)t[e].update(n[e])}}),e.Editable.CircleEditor=e.Editable.PathEditor.extend({MIN_VERTEX:2,options:{skipMiddleMarkers:!0},initialize:function(t,n,r){e.Editable.PathEditor.prototype.initialize.call(this,t,n,r),this._resizeLatLng=this.computeResizeLatLng()},computeResizeLatLng:function(){let e=(this.feature._radius||this.feature._mRadius)*Math.cos(Math.PI/4),t=this.map.project(this.feature._latlng);return this.map.unproject([t.x+e,t.y-e])},updateResizeLatLng:function(){this._resizeLatLng.update(this.computeResizeLatLng()),this._resizeLatLng.__vertex.update()},getLatLngs:function(){return[this.feature._latlng,this._resizeLatLng]},getDefaultLatLngs:function(){return this.getLatLngs()},onVertexMarkerDrag:function(t){t.vertex.getIndex()===1?this.resize(t):this.updateResizeLatLng(t),e.Editable.PathEditor.prototype.onVertexMarkerDrag.call(this,t)},resize:function(e){let t;t=this.map.options.crs?this.map.options.crs.distance(this.feature._latlng,e.latlng):this.feature._latlng.distanceTo(e.latlng),this.feature.setRadius(t)},onDrawingMouseDown:function(t){e.Editable.PathEditor.prototype.onDrawingMouseDown.call(this,t),this._resizeLatLng.update(t.latlng),this.feature._latlng.update(t.latlng),this.connect(),t.originalEvent._simulated=!1,this.map.dragging._draggable._onUp(t.originalEvent),this._resizeLatLng.__vertex.dragging._draggable._onDown(t.originalEvent)},onDrawingMouseUp:function(t){this.commitDrawing(t),t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseUp.call(this,t)},onDrawingMouseMove:function(t){t.originalEvent._simulated=!1,e.Editable.PathEditor.prototype.onDrawingMouseMove.call(this,t)},onDrag:function(t){e.Editable.PathEditor.prototype.onDrag.call(this,t),this.feature.dragging.updateLatLng(this._resizeLatLng)}});let t={createEditor:function(e){e||=this._map;let t=this.options.editOptions?.editTools||e.editTools;if(!t)throw Error(`Unable to detect Editable instance.`);return new(this.options.editorClass||(this.getEditorClass(t)))(e,this,this.options.editOptions)},enableEdit:function(e){return this.editor||this.createEditor(e),this.editor.enable(),this.editor},editEnabled:function(){return this.editor?.enabled()},disableEdit:function(){this.editor&&(this.editor.disable(),delete this.editor)},toggleEdit:function(){this.editEnabled()?this.disableEdit():this.enableEdit()},_onEditableAdd:function(){this.editor&&this.enableEdit()}},n={getEditorClass:t=>t?.options?.polylineEditorClass||e.Editable.PolylineEditor,shapeAt:function(e,t){let n=null;if(t||=this._latlngs,!t.length)return n;if(l(t)&&this.isInLatLngs(e,t))n=t;else for(let n of t)if(this.isInLatLngs(e,n))return n;return n},isInLatLngs:function(t,n){if(!n)return!1;let r,i,a,o=[],s,c=this._clickTolerance();if(this._projectLatlngs(n,o,this._pxBounds),o=o[0],s=this._map.latLngToLayerPoint(t),!this._pxBounds.contains(s))return!1;for(r=1,a=o.length,i=0;r<a;i=r++)if(e.LineUtil.pointToSegmentDistance(s,o[i],o[r])<=c)return!0;return!1}},r={getEditorClass:t=>t?.options?.polygonEditorClass||e.Editable.PolygonEditor,shapeAt:function(e,t){let n=null;if(t||=this._latlngs,!t.length)return n;if(l(t)&&this.isInLatLngs(e,t)&&(n=t),l(t[0])&&this.isInLatLngs(e,t[0]))n=t;else for(let n of t)if(this.isInLatLngs(e,n[0]))return n;return n},isInLatLngs:(e,t)=>{let n=!1,r,i,a,o,s;for(a=0,s=t.length,o=s-1;a<s;o=a++)r=t[a],i=t[o],r.lat>e.lat!=i.lat>e.lat&&e.lng<(i.lng-r.lng)*(e.lat-r.lat)/(i.lat-r.lat)+r.lng&&(n=!n);return n},parentShape:function(t,n){if(n||=this._latlngs,!n)return;let r=e.Util.indexOf(n,t);if(r!==-1)return n;for(let i of n)if(r=e.Util.indexOf(i,t),r!==-1)return i}},i={getEditorClass:t=>t?.options?.markerEditorClass||e.Editable.MarkerEditor},a={getEditorClass:t=>t?.options?.circleMarkerEditorClass||e.Editable.CircleMarkerEditor},o={getEditorClass:t=>t?.options?.rectangleEditorClass||e.Editable.RectangleEditor},s={getEditorClass:t=>t?.options?.circleEditorClass||e.Editable.CircleEditor},c=function(){this.on(`add`,this._onEditableAdd)},l=e.LineUtil.isFlat||e.LineUtil._flat||e.Polyline._flat;e.Polyline&&(e.Polyline.include(t),e.Polyline.include(n),e.Polyline.addInitHook(c)),e.Polygon&&(e.Polygon.include(t),e.Polygon.include(r)),e.Marker&&(e.Marker.include(t),e.Marker.include(i),e.Marker.addInitHook(c)),e.CircleMarker&&(e.CircleMarker.include(t),e.CircleMarker.include(a),e.CircleMarker.addInitHook(c)),e.Rectangle&&(e.Rectangle.include(t),e.Rectangle.include(o)),e.Circle&&(e.Circle.include(t),e.Circle.include(s)),e.LatLng.prototype.update=function(t){t=e.latLng(t),this.lat=t.lat,this.lng=t.lng}},window)})),Bd=l(Rd(),1);zd();var Vd=`/* required styles */\r
|
|
431
431
|
\r
|
|
432
432
|
.leaflet-pane,\r
|
|
433
433
|
.leaflet-tile,\r
|
|
@@ -1088,7 +1088,7 @@ svg.leaflet-image-layer.leaflet-interactive path {\r
|
|
|
1088
1088
|
print-color-adjust: exact;\r
|
|
1089
1089
|
}\r
|
|
1090
1090
|
}\r
|
|
1091
|
-
`,
|
|
1091
|
+
`,Hd=`.leaflet-fullscreen-icon {
|
|
1092
1092
|
background-image: url('icon-fullscreen.svg');
|
|
1093
1093
|
background-size: 26px 52px;
|
|
1094
1094
|
}
|
|
@@ -1127,7 +1127,7 @@ svg.leaflet-image-layer.leaflet-interactive path {\r
|
|
|
1127
1127
|
left: 0 !important;
|
|
1128
1128
|
z-index: 99999;
|
|
1129
1129
|
}
|
|
1130
|
-
`;o(((e,t)=>{(function(e,n){typeof define==`function`&&define.amd?define(`leafletFullScreen`,[`leaflet`],n):typeof t==`object`&&t.exports?t.exports=n(
|
|
1130
|
+
`;o(((e,t)=>{(function(e,n){typeof define==`function`&&define.amd?define(`leafletFullScreen`,[`leaflet`],n):typeof t==`object`&&t.exports?t.exports=n(Rd()):n(e.L)})(typeof self<`u`?self:e,e=>{if(typeof document>`u`)return console.warn(`"window.document" is undefined; leaflet.fullscreen requires this object to access the DOM`),!1;let t=(()=>{let e=[[`requestFullscreen`,`exitFullscreen`,`fullscreenElement`,`fullscreenEnabled`,`fullscreenchange`,`fullscreenerror`],[`webkitRequestFullscreen`,`webkitExitFullscreen`,`webkitFullscreenElement`,`webkitFullscreenEnabled`,`webkitfullscreenchange`,`webkitfullscreenerror`]],t=e[0],n={};for(let r of e)if(r[1]in document){for(let e=0;e<r.length;e++)n[t[e]]=r[e];return n}return!1})(),n={change:t.fullscreenchange,error:t.fullscreenerror},r={request(e,n){return new Promise((r,i)=>{let a=function(){this.off(`change`,a),r()}.bind(this);this.on(`change`,a),e||=document.documentElement;let o=e[t.requestFullscreen](n);o instanceof Promise&&o.then(a).catch(i)})},exit(){return new Promise((e,n)=>{if(!this.isFullscreen){e();return}let r=function(){this.off(`change`,r),e()}.bind(this);this.on(`change`,r);let i=document[t.exitFullscreen]();i instanceof Promise&&i.then(r).catch(n)})},on(e,t){let r=n[e];r&&document.addEventListener(r,t,!1)},off(e,t){let r=n[e];r&&document.removeEventListener(r,t,!1)},nativeAPI:t};return Object.defineProperties(r,{isFullscreen:{get(){return!!document[t.fullscreenElement]}},isEnabled:{enumerable:!0,get(){return!!document[t.fullscreenEnabled]}}}),e.Control.FullScreen=e.Control.extend({options:{position:`topleft`,title:`Full Screen`,titleCancel:`Exit Full Screen`,forceSeparateButton:!1,forcePseudoFullscreen:!1,fullscreenElement:!1},_screenfull:r,onAdd(t){let n=`leaflet-control-zoom-fullscreen`,r,i=``;return r=t.zoomControl&&!this.options.forceSeparateButton?t.zoomControl._container:e.DomUtil.create(`div`,`leaflet-bar`),this.options.content?i=this.options.content:n+=` leaflet-fullscreen-icon`,this._createButton(this.options.title,n,i,r,this.toggleFullScreen,this),this._map.fullscreenControl=this,this._map.on(`enterFullscreen exitFullscreen`,this._toggleState,this),r},onRemove(){e.DomEvent.off(this.link,`click`,e.DomEvent.stop).off(this.link,`click`,this.toggleFullScreen,this),this._screenfull.isEnabled&&(e.DomEvent.off(this._container,this._screenfull.nativeAPI.fullscreenchange,e.DomEvent.stop).off(this._container,this._screenfull.nativeAPI.fullscreenchange,this._handleFullscreenChange,this),e.DomEvent.off(document,this._screenfull.nativeAPI.fullscreenchange,e.DomEvent.stop).off(document,this._screenfull.nativeAPI.fullscreenchange,this._handleFullscreenChange,this))},_createButton(t,n,r,i,a,o){return this.link=e.DomUtil.create(`a`,n,i),this.link.href=`#`,this.link.title=t,this.link.innerHTML=r,this.link.setAttribute(`role`,`button`),this.link.setAttribute(`aria-label`,t),L.DomEvent.disableClickPropagation(i),e.DomEvent.on(this.link,`click`,e.DomEvent.stop).on(this.link,`click`,a,o),this._screenfull.isEnabled&&(e.DomEvent.on(i,this._screenfull.nativeAPI.fullscreenchange,e.DomEvent.stop).on(i,this._screenfull.nativeAPI.fullscreenchange,this._handleFullscreenChange,o),e.DomEvent.on(document,this._screenfull.nativeAPI.fullscreenchange,e.DomEvent.stop).on(document,this._screenfull.nativeAPI.fullscreenchange,this._handleFullscreenChange,o)),this.link},toggleFullScreen(){let t=this._map;t._exitFired=!1,t._isFullscreen?(this._screenfull.isEnabled&&!this.options.forcePseudoFullscreen?this._screenfull.exit().then(()=>t.invalidateSize()):(e.DomUtil.removeClass(this.options.fullscreenElement?this.options.fullscreenElement:t._container,`leaflet-pseudo-fullscreen`),t.invalidateSize()),t.fire(`exitFullscreen`),t._exitFired=!0,t._isFullscreen=!1):(this._screenfull.isEnabled&&!this.options.forcePseudoFullscreen?this._screenfull.request(this.options.fullscreenElement?this.options.fullscreenElement:t._container).then(()=>t.invalidateSize()):(e.DomUtil.addClass(this.options.fullscreenElement?this.options.fullscreenElement:t._container,`leaflet-pseudo-fullscreen`),t.invalidateSize()),t.fire(`enterFullscreen`),t._isFullscreen=!0)},_toggleState(){this.link.title=this._map._isFullscreen?this.options.title:this.options.titleCancel,this._map._isFullscreen?L.DomUtil.removeClass(this.link,`leaflet-fullscreen-on`):L.DomUtil.addClass(this.link,`leaflet-fullscreen-on`)},_handleFullscreenChange(e){let t=this._map;e.target===t.getContainer()&&!this._screenfull.isFullscreen&&!t._exitFired&&(this._screenfull.exit().then(()=>t.invalidateSize()),t.fire(`exitFullscreen`),t._exitFired=!0,t._isFullscreen=!1)}}),e.Map.include({toggleFullscreen(){this.fullscreenControl.toggleFullScreen()}}),e.Map.addInitHook(function(){this.options.fullscreenControl&&this.addControl(e.control.fullscreen(this.options.fullscreenControlOptions))}),e.control.fullscreen=function(t){return new e.Control.FullScreen(t)},{leaflet:e}})}))();var Ud=`
|
|
1131
1131
|
#shaclMapDialog .closeButton { position: absolute; right: 0; top: 0; z-index: 1; padding: 6px 8px; cursor: pointer; border: 0; background-color: #FFFA; font-size: 24px; z-index: 1000; }
|
|
1132
1132
|
#shaclMapDialog { padding: 0; width:90vw; height: 90vh; margin: auto; }
|
|
1133
1133
|
#shaclMapDialog::backdrop { background-color: #0007; }
|
|
@@ -1136,11 +1136,11 @@ svg.leaflet-image-layer.leaflet-interactive path {\r
|
|
|
1136
1136
|
.leaflet-container { min-height: 300px; }
|
|
1137
1137
|
.fullscreen-icon { background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjYgNTIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIwLjYgMzYuN0gxNmEuOS45IDAgMCAxLS44LS44di00LjVjMC0uMi4yLS40LjQtLjRoMS40Yy4zIDAgLjUuMi41LjR2M2gzYy4yIDAgLjQuMi40LjV2MS40YzAgLjItLjIuNC0uNC40em0tOS45LS44di00LjVjMC0uMi0uMi0uNC0uNC0uNEg4LjljLS4zIDAtLjUuMi0uNS40djNoLTNjLS4yIDAtLjQuMi0uNC41djEuNGMwIC4yLjIuNC40LjRIMTBjLjQgMCAuOC0uNC44LS44em0wIDEwLjdWNDJjMC0uNC0uNC0uOC0uOC0uOEg1LjRjLS4yIDAtLjQuMi0uNC40djEuNGMwIC4zLjIuNS40LjVoM3YzYzAgLjIuMi40LjUuNGgxLjRjLjIgMCAuNC0uMi40LS40em02LjkgMHYtM2gzYy4yIDAgLjQtLjIuNC0uNXYtMS40YzAtLjItLjItLjQtLjQtLjRIMTZjLS40IDAtLjguNC0uOC44djQuNWMwIC4yLjIuNC40LjRoMS40Yy4zIDAgLjUtLjIuNS0uNHpNNSAxMC4zVjUuOWMwLS41LjQtLjkuOS0uOWg0LjRjLjIgMCAuNC4yLjQuNFY3YzAgLjItLjIuNC0uNC40aC0zdjNjMCAuMi0uMi40LS40LjRINS40YS40LjQgMCAwIDEtLjQtLjR6bTEwLjMtNC45VjdjMCAuMi4yLjQuNC40aDN2M2MwIC4yLjIuNC40LjRoMS41Yy4yIDAgLjQtLjIuNC0uNFY1LjljMC0uNS0uNC0uOS0uOS0uOWgtNC40Yy0uMiAwLS40LjItLjQuNHptNS4zIDkuOUgxOWMtLjIgMC0uNC4yLS40LjR2M2gtM2MtLjIgMC0uNC4yLS40LjR2MS41YzAgLjIuMi40LjQuNGg0LjRjLjUgMCAuOS0uNC45LS45di00LjRjMC0uMi0uMi0uNC0uNC0uNHptLTkuOSA1LjNWMTljMC0uMi0uMi0uNC0uNC0uNGgtM3YtM2MwLS4yLS4yLS40LS40LS40SDUuNGMtLjIgMC0uNC4yLS40LjR2NC40YzAgLjUuNC45LjkuOWg0LjRjLjIgMCAuNC0uMi40LS40eiIgZmlsbD0iY3VycmVudENvbG9yIi8+PC9zdmc+); }
|
|
1138
1138
|
#shaclMapDialogContainer { width:100%; height: 100%; }
|
|
1139
|
-
`,
|
|
1139
|
+
`,Wd=`
|
|
1140
1140
|
<dialog id="shaclMapDialog" onclick="event.target==this && this.close()">
|
|
1141
1141
|
<div id="shaclMapDialogContainer"></div>
|
|
1142
1142
|
<div class="hint">ⓘ Draw a polygon or marker, then close dialog</div>
|
|
1143
1143
|
<button class="closeButton" type="button" onclick="this.parentElement.close()">✕</button>
|
|
1144
|
-
</dialog>`,
|
|
1145
|
-
`+
|
|
1146
|
-
`+
|
|
1144
|
+
</dialog>`,Gd={lng:8.657238961696038,lat:49.87627570549512},Kd=`© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>`,qd=`https://tile.openstreetmap.de/{z}/{x}/{y}.png`,Jd=Bd.icon({iconUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAApCAYAAADAk4LOAAAFgUlEQVR4Aa1XA5BjWRTN2oW17d3YaZtr2962HUzbDNpjszW24mRt28p47v7zq/bXZtrp/lWnXr337j3nPCe85NcypgSFdugCpW5YoDAMRaIMqRi6aKq5E3YqDQO3qAwjVWrD8Ncq/RBpykd8oZUb/kaJutow8r1aP9II0WmLKLIsJyv1w/kqw9Ch2MYdB++12Onxee/QMwvf4/Dk/Lfp/i4nxTXtOoQ4pW5Aj7wpici1A9erdAN2OH64x8OSP9j3Ft3b7aWkTg/Fm91siTra0f9on5sQr9INejH6CUUUpavjFNq1B+Oadhxmnfa8RfEmN8VNAsQhPqF55xHkMzz3jSmChWU6f7/XZKNH+9+hBLOHYozuKQPxyMPUKkrX/K0uWnfFaJGS1QPRtZsOPtr3NsW0uyh6NNCOkU3Yz+bXbT3I8G3xE5EXLXtCXbbqwCO9zPQYPRTZ5vIDXD7U+w7rFDEoUUf7ibHIR4y6bLVPXrz8JVZEql13trxwue/uDivd3fkWRbS6/IA2bID4uk0UpF1N8qLlbBlXs4Ee7HLTfV1j54APvODnSfOWBqtKVvjgLKzF5YdEk5ewRkGlK0i33Eofffc7HT56jD7/6U+qH3Cx7SBLNntH5YIPvODnyfIXZYRVDPqgHtLs5ABHD3YzLuespb7t79FY34DjMwrVrcTuwlT55YMPvOBnRrJ4VXTdNnYug5ucHLBjEpt30701A3Ts+HEa73u6dT3FNWwflY86eMHPk+Yu+i6pzUpRrW7SNDg5JHR4KapmM5Wv2E8Tfcb1HoqqHMHU+uWDD7zg54mz5/2BSnizi9T1Dg4QQXLToGNCkb6tb1NU+QAlGr1++eADrzhn/u8Q2YZhQVlZ5+CAOtqfbhmaUCS1ezNFVm2imDbPmPng5wmz+gwh+oHDce0eUtQ6OGDIyR0uUhUsoO3vfDmmgOezH0mZN59x7MBi++WDL1g/eEiU3avlidO671bkLfwbw5XV2P8Pzo0ydy4t2/0eu33xYSOMOD8hTf4CrBtGMSoXfPLchX+J0ruSePw3LZeK0juPJbYzrhkH0io7B3k164hiGvawhOKMLkrQLyVpZg8rHFW7E2uHOL888IBPlNZ1FPzstSJM694fWr6RwpvcJK60+0HCILTBzZLFNdtAzJaohze60T8qBzyh5ZuOg5e7uwQppofEmf2++DYvmySqGBuKaicF1blQjhuHdvCIMvp8whTTfZzI7RldpwtSzL+F1+wkdZ2TBOW2gIF88PBTzD/gpeREAMEbxnJcaJHNHrpzji0gQCS6hdkEeYt9DF/2qPcEC8RM28Hwmr3sdNyht00byAut2k3gufWNtgtOEOFGUwcXWNDbdNbpgBGxEvKkOQsxivJx33iow0Vw5S6SVTrpVq11ysA2Rp7gTfPfktc6zhtXBBC+adRLshf6sG2RfHPZ5EAc4sVZ83yCN00Fk/4kggu40ZTvIEm5g24qtU4KjBrx/BTTH8ifVASAG7gKrnWxJDcU7x8X6Ecczhm3o6YicvsLXWfh3Ch1W0k8x0nXF+0fFxgt4phz8QvypiwCCFKMqXCnqXExjq10beH+UUA7+nG6mdG/Pu0f3LgFcGrl2s0kNNjpmoJ9o4B29CMO8dMT4Q5ox8uitF6fqsrJOr8qnwNbRzv6hSnG5wP+64C7h9lp30hKNtKdWjtdkbuPA19nJ7Tz3zR/ibgARbhb4AlhavcBebmTHcFl2fvYEnW0ox9xMxKBS8btJ+KiEbq9zA4RthQXDhPa0T9TEe69gWupwc6uBUphquXgf+/FrIjweHQS4/pduMe5ERUMHUd9xv8ZR98CxkS4F2n3EUrUZ10EYNw7BWm9x1GiPssi3GgiGRDKWRYZfXlON+dfNbM+GgIwYdwAAAAASUVORK5CYII=`,shadowUrl:`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACkAAAApCAQAAAACach9AAACMUlEQVR4Ae3ShY7jQBAE0Aoz/f9/HTMzhg1zrdKUrJbdx+Kd2nD8VNudfsL/Th///dyQN2TH6f3y/BGpC379rV+S+qqetBOxImNQXL8JCAr2V4iMQXHGNJxeCfZXhSRBcQMfvkOWUdtfzlLgAENmZDcmo2TVmt8OSM2eXxBp3DjHSMFutqS7SbmemzBiR+xpKCNUIRkdkkYxhAkyGoBvyQFEJEefwSmmvBfJuJ6aKqKWnAkvGZOaZXTUgFqYULWNSHUckZuR1HIIimUExutRxwzOLROIG4vKmCKQt364mIlhSyzAf1m9lHZHJZrlAOMMztRRiKimp/rpdJDc9Awry5xTZCte7FHtuS8wJgeYGrex28xNTd086Dik7vUMscQOa8y4DoGtCCSkAKlNwpgNtphjrC6MIHUkR6YWxxs6Sc5xqn222mmCRFzIt8lEdKx+ikCtg91qS2WpwVfBelJCiQJwvzixfI9cxZQWgiSJelKnwBElKYtDOb2MFbhmUigbReQBV0Cg4+qMXSxXSyGUn4UbF8l+7qdSGnTC0XLCmahIgUHLhLOhpVCtw4CzYXvLQWQbJNmxoCsOKAxSgBJno75avolkRw8iIAFcsdc02e9iyCd8tHwmeSSoKTowIgvscSGZUOA7PuCN5b2BX9mQM7S0wYhMNU74zgsPBj3HU7wguAfnxxjFQGBE6pwN+GjME9zHY7zGp8wVxMShYX9NXvEWD3HbwJf4giO4CFIQxXScH1/TM+04kkBiAAAAAElFTkSuQmCC`,iconSize:[25,41],shadowSize:[41,41],iconAnchor:[12,41],shadowAnchor:[14,41],popupAnchor:[-3,-76]}),Yd=class extends Fr{constructor(e){super(e,Vd+`
|
|
1145
|
+
`+Hd+`
|
|
1146
|
+
`+Ud)}initEditMode(e){e.insertAdjacentHTML(`beforeend`,Wd);let t=e.querySelector(`#shaclMapDialogContainer`);this.map=Bd.map(t,{fullscreenControl:!0,editable:!0,layers:[Bd.tileLayer(qd)],zoom:5,maxBounds:Xd,center:Gd}),this.map.attributionControl.addAttribution(Kd);let n=Bd.Control.extend({options:{position:`topleft`,callback:null,kind:``,html:``},onAdd:function(e){let t=Bd.DomUtil.create(`div`,`leaflet-control leaflet-bar`),n=Bd.DomUtil.create(`a`,``,t);return n.href=`#`,n.title=`Create a new `+this.options.kind,n.innerHTML=this.options.html,Bd.DomEvent.on(n,`click`,Bd.DomEvent.stop).on(n,`click`,()=>{window.LAYER=this.options.callback.call(e.editTools)},this),t}});this.map.addControl(new(n.extend({options:{callback:()=>{this.displayedShape?.remove(),this.displayedShape=this.map?.editTools.startPolygon()},kind:`polygon`,html:`▰`}}))),this.map.addControl(new(n.extend({options:{callback:()=>{this.displayedShape?.remove(),this.displayedShape=this.map?.editTools.startMarker(void 0,{icon:Jd})},kind:`marker`,html:`•`}}))),this.map.on(`editable:drawing:end`,()=>{this.saveChanges()}),this.map.on(`editable:vertex:dragend`,()=>{this.saveChanges()});let r=e.querySelector(`#shaclMapDialog`);return r.addEventListener(`close`,()=>{let e=document.body.style.top;document.body.style.position=``,document.body.style.top=``,window.scrollTo(0,parseInt(e||`0`)*-1),this.currentEditor&&this.createdGeometry&&(this.currentEditor.value=Qd(this.createdGeometry),this.currentEditor.dispatchEvent(new Event(`change`,{bubbles:!0})))}),r}createEditor(e,t){let n=e.config.form.querySelector(`#shaclMapDialog`);n||=this.initEditMode(e.config.form);let r=e.config.theme.createButton(`Open map...`,!1);r.style.marginLeft=`5px`,r.classList.add(`open-map-button`),r.onclick=()=>{this.currentEditor=i.querySelector(`.editor`),this.createdGeometry=void 0,this.displayedShape?.remove(),this.drawAndZoomToGeometry(Zd(this.currentEditor.value||``),this.map),document.body.style.top=`-${window.scrollY}px`,document.body.style.position=`fixed`,n.showModal()};let i=Dr(e,t||null,!0);return i.appendChild(r),i}createViewer(e,t){let n=document.createElement(`div`),r=Zd(t.value);if(r?.coordinates?.length){let e=Bd.map(n,{fullscreenControl:!0,layers:[Bd.tileLayer(qd)],zoom:5,center:Gd,maxBounds:Xd});e.attributionControl.addAttribution(Kd),this.drawAndZoomToGeometry(r,e)}return n}drawAndZoomToGeometry(e,t){if(setTimeout(()=>{t.invalidateSize()}),e?.type===`Point`){let n={lng:e.coordinates[0],lat:e.coordinates[1]};this.displayedShape=Bd.marker(n,{icon:Jd}).addTo(t),t.setView(n,15,{animate:!1})}else if(e?.type===`Polygon`){let n=e.coordinates[0].map(e=>({lng:e[0],lat:e[1]})),r=Bd.polygon(n).addTo(t);this.displayedShape=r,t.fitBounds(r.getBounds(),{animate:!1}),setTimeout(()=>{t.fitBounds(r.getBounds(),{animate:!1}),t.setView(r.getCenter(),void 0,{animate:!1})},1)}else t.setZoom(5)}saveChanges(){if(this.displayedShape instanceof Bd.Marker){let e=this.displayedShape.getLatLng();this.createdGeometry={type:`Point`,coordinates:[e.lng,e.lat]}}else if(this.displayedShape instanceof Bd.Polygon){let e=this.displayedShape.getLatLngs();e[0][0].equals(e[0][e[0].length-1])||e[0].push(e[0][0]),this.createdGeometry={type:`Polygon`,coordinates:[e[0].map(e=>[e.lng,e.lat])]}}else this.createdGeometry=void 0}},Xd=[[-90,-180],[90,180]];function Zd(e){let t=e.match(/^POINT\((.*)\)$/);if(t?.length==2){let e=t[1].split(` `);if(e.length===2)return{type:`Point`,coordinates:[parseFloat(e[0]),parseFloat(e[1])]}}let n=e.match(/^POLYGON[(]{2}(.*)[)]{2}$/);if(n?.length==2){let e=n[1].split(`,`);if(e.length>2){let t=[],n=[];t.push(n);for(let t of e){let e=t.split(` `);e.length===2&&n.push([parseFloat(e[0]),parseFloat(e[1])])}return{type:`Polygon`,coordinates:t}}}}function Qd(e){return e.type===`Point`?`POINT(${e.coordinates.join(` `)})`:e.type===`Polygon`?`POLYGON((${e.coordinates[0].map(e=>e.join(` `)).join(`,`)}))`:``}export{Pd as Config,Cs as DefaultTheme,Ld as FileUploadPlugin,Yd as LeafletPlugin,Fr as Plugin,Id as ShaclForm,gr as ShaclPropertyTemplate,Er as Theme,dr as fetchRDF,cr as findConformsToShapeSubject,sr as findConformsToValuesSubject,Rt as findLabel,Qd as geometryToWkt,ur as importRDF,Fd as initTimeout,lr as loadGraphs,fr as parseRDF,or as prefixes,hr as propertyMappers,ar as rdfCache,Mr as registerPlugin,Zd as wktToGeometry,Xd as worldBounds};
|