@ulb-darmstadt/shacl-form 1.10.2 → 1.10.3

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.
@@ -1,10 +1,10 @@
1
- var Sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function td(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function rd(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function n(){var i=!1;try{i=this instanceof n}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var bi={},Ur={},Qa;function nd(){if(Qa)return Ur;Qa=1,Ur.byteLength=o,Ur.toByteArray=l,Ur.fromByteArray=b;for(var r=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=n.length;i<s;++i)r[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function a(y){var _=y.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=_);var v=E===_?0:4-E%4;return[E,v]}function o(y){var _=a(y),E=_[0],v=_[1];return(E+v)*3/4-v}function u(y,_,E){return(_+E)*3/4-E}function l(y){var _,E=a(y),v=E[0],x=E[1],S=new t(u(y,v,x)),m=0,h=x>0?v-4:v,g;for(g=0;g<h;g+=4)_=e[y.charCodeAt(g)]<<18|e[y.charCodeAt(g+1)]<<12|e[y.charCodeAt(g+2)]<<6|e[y.charCodeAt(g+3)],S[m++]=_>>16&255,S[m++]=_>>8&255,S[m++]=_&255;return x===2&&(_=e[y.charCodeAt(g)]<<2|e[y.charCodeAt(g+1)]>>4,S[m++]=_&255),x===1&&(_=e[y.charCodeAt(g)]<<10|e[y.charCodeAt(g+1)]<<4|e[y.charCodeAt(g+2)]>>2,S[m++]=_>>8&255,S[m++]=_&255),S}function c(y){return r[y>>18&63]+r[y>>12&63]+r[y>>6&63]+r[y&63]}function d(y,_,E){for(var v,x=[],S=_;S<E;S+=3)v=(y[S]<<16&16711680)+(y[S+1]<<8&65280)+(y[S+2]&255),x.push(c(v));return x.join("")}function b(y){for(var _,E=y.length,v=E%3,x=[],S=16383,m=0,h=E-v;m<h;m+=S)x.push(d(y,m,m+S>h?h:m+S));return v===1?(_=y[E-1],x.push(r[_>>2]+r[_<<4&63]+"==")):v===2&&(_=(y[E-2]<<8)+y[E-1],x.push(r[_>>10]+r[_>>4&63]+r[_<<2&63]+"=")),x.join("")}return Ur}var jn={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Xa;function id(){return Xa||(Xa=1,jn.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,u=(1<<o)-1,l=u>>1,c=-7,d=t?i-1:0,b=t?-1:1,y=r[e+d];for(d+=b,s=y&(1<<-c)-1,y>>=-c,c+=o;c>0;s=s*256+r[e+d],d+=b,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=a*256+r[e+d],d+=b,c-=8);if(s===0)s=1-l;else{if(s===u)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-l}return(y?-1:1)*a*Math.pow(2,s-n)},jn.write=function(r,e,t,n,i,s){var a,o,u,l=s*8-i-1,c=(1<<l)-1,d=c>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,_=n?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=b/u:e+=b*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(o=0,a=c):a+d>=1?(o=(e*u-1)*Math.pow(2,i),a=a+d):(o=e*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;r[t+y]=o&255,y+=_,o/=256,i-=8);for(a=a<<i|o,l+=i;l>0;r[t+y]=a&255,y+=_,a/=256,l-=8);r[t+y-_]|=E*128}),jn}/*!
1
+ var Sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function sd(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ad(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var e=r.default;if(typeof e=="function"){var t=function n(){var i=!1;try{i=this instanceof n}catch{}return i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return r[n]}})}),t}var vi={},Ur={},Ya;function od(){if(Ya)return Ur;Ya=1,Ur.byteLength=o,Ur.toByteArray=l,Ur.fromByteArray=b;for(var r=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=n.length;i<s;++i)r[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function a(y){var _=y.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=_);var v=E===_?0:4-E%4;return[E,v]}function o(y){var _=a(y),E=_[0],v=_[1];return(E+v)*3/4-v}function u(y,_,E){return(_+E)*3/4-E}function l(y){var _,E=a(y),v=E[0],x=E[1],S=new t(u(y,v,x)),m=0,d=x>0?v-4:v,g;for(g=0;g<d;g+=4)_=e[y.charCodeAt(g)]<<18|e[y.charCodeAt(g+1)]<<12|e[y.charCodeAt(g+2)]<<6|e[y.charCodeAt(g+3)],S[m++]=_>>16&255,S[m++]=_>>8&255,S[m++]=_&255;return x===2&&(_=e[y.charCodeAt(g)]<<2|e[y.charCodeAt(g+1)]>>4,S[m++]=_&255),x===1&&(_=e[y.charCodeAt(g)]<<10|e[y.charCodeAt(g+1)]<<4|e[y.charCodeAt(g+2)]>>2,S[m++]=_>>8&255,S[m++]=_&255),S}function c(y){return r[y>>18&63]+r[y>>12&63]+r[y>>6&63]+r[y&63]}function h(y,_,E){for(var v,x=[],S=_;S<E;S+=3)v=(y[S]<<16&16711680)+(y[S+1]<<8&65280)+(y[S+2]&255),x.push(c(v));return x.join("")}function b(y){for(var _,E=y.length,v=E%3,x=[],S=16383,m=0,d=E-v;m<d;m+=S)x.push(h(y,m,m+S>d?d:m+S));return v===1?(_=y[E-1],x.push(r[_>>2]+r[_<<4&63]+"==")):v===2&&(_=(y[E-2]<<8)+y[E-1],x.push(r[_>>10]+r[_>>4&63]+r[_<<2&63]+"=")),x.join("")}return Ur}var Cn={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Za;function ld(){return Za||(Za=1,Cn.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,u=(1<<o)-1,l=u>>1,c=-7,h=t?i-1:0,b=t?-1:1,y=r[e+h];for(h+=b,s=y&(1<<-c)-1,y>>=-c,c+=o;c>0;s=s*256+r[e+h],h+=b,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=a*256+r[e+h],h+=b,c-=8);if(s===0)s=1-l;else{if(s===u)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-l}return(y?-1:1)*a*Math.pow(2,s-n)},Cn.write=function(r,e,t,n,i,s){var a,o,u,l=s*8-i-1,c=(1<<l)-1,h=c>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,_=n?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+h>=1?e+=b/u:e+=b*Math.pow(2,1-h),e*u>=2&&(a++,u/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(e*u-1)*Math.pow(2,i),a=a+h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;r[t+y]=o&255,y+=_,o/=256,i-=8);for(a=a<<i|o,l+=i;l>0;r[t+y]=a&255,y+=_,a/=256,l-=8);r[t+y-_]|=E*128}),Cn}/*!
2
2
  * The buffer module from node.js, for the browser.
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
5
5
  * @license MIT
6
- */var Ja;function Ct(){return Ja||(Ja=1,function(r){const e=nd(),t=id(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=o,r.SlowBuffer=S,r.INSPECT_MAX_BYTES=50;const i=2147483647;r.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!o.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 s(){try{const I=new Uint8Array(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,Uint8Array.prototype),Object.setPrototypeOf(I,f),I.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function a(I){if(I>i)throw new RangeError('The value "'+I+'" is invalid for option "size"');const f=new Uint8Array(I);return Object.setPrototypeOf(f,o.prototype),f}function o(I,f,p){if(typeof I=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(I)}return u(I,f,p)}o.poolSize=8192;function u(I,f,p){if(typeof I=="string")return b(I,f);if(ArrayBuffer.isView(I))return _(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(le(I,ArrayBuffer)||I&&le(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(I,SharedArrayBuffer)||I&&le(I.buffer,SharedArrayBuffer)))return E(I,f,p);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=I.valueOf&&I.valueOf();if($!=null&&$!==I)return o.from($,f,p);const X=v(I);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return o.from(I[Symbol.toPrimitive]("string"),f,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}o.from=function(I,f,p){return u(I,f,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function c(I,f,p){return l(I),I<=0?a(I):f!==void 0?typeof p=="string"?a(I).fill(f,p):a(I).fill(f):a(I)}o.alloc=function(I,f,p){return c(I,f,p)};function d(I){return l(I),a(I<0?0:x(I)|0)}o.allocUnsafe=function(I){return d(I)},o.allocUnsafeSlow=function(I){return d(I)};function b(I,f){if((typeof f!="string"||f==="")&&(f="utf8"),!o.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const p=m(I,f)|0;let $=a(p);const X=$.write(I,f);return X!==p&&($=$.slice(0,X)),$}function y(I){const f=I.length<0?0:x(I.length)|0,p=a(f);for(let $=0;$<f;$+=1)p[$]=I[$]&255;return p}function _(I){if(le(I,Uint8Array)){const f=new Uint8Array(I);return E(f.buffer,f.byteOffset,f.byteLength)}return y(I)}function E(I,f,p){if(f<0||I.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<f+(p||0))throw new RangeError('"length" is outside of buffer bounds');let $;return f===void 0&&p===void 0?$=new Uint8Array(I):p===void 0?$=new Uint8Array(I,f):$=new Uint8Array(I,f,p),Object.setPrototypeOf($,o.prototype),$}function v(I){if(o.isBuffer(I)){const f=x(I.length)|0,p=a(f);return p.length===0||I.copy(p,0,0,f),p}if(I.length!==void 0)return typeof I.length!="number"||Re(I.length)?a(0):y(I);if(I.type==="Buffer"&&Array.isArray(I.data))return y(I.data)}function x(I){if(I>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return I|0}function S(I){return+I!=I&&(I=0),o.alloc(+I)}o.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==o.prototype},o.compare=function(f,p){if(le(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),le(p,Uint8Array)&&(p=o.from(p,p.offset,p.byteLength)),!o.isBuffer(f)||!o.isBuffer(p))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===p)return 0;let $=f.length,X=p.length;for(let oe=0,de=Math.min($,X);oe<de;++oe)if(f[oe]!==p[oe]){$=f[oe],X=p[oe];break}return $<X?-1:X<$?1:0},o.isEncoding=function(f){switch(String(f).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}},o.concat=function(f,p){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return o.alloc(0);let $;if(p===void 0)for(p=0,$=0;$<f.length;++$)p+=f[$].length;const X=o.allocUnsafe(p);let oe=0;for($=0;$<f.length;++$){let de=f[$];if(le(de,Uint8Array))oe+de.length>X.length?(o.isBuffer(de)||(de=o.from(de)),de.copy(X,oe)):Uint8Array.prototype.set.call(X,de,oe);else if(o.isBuffer(de))de.copy(X,oe);else throw new TypeError('"list" argument must be an Array of Buffers');oe+=de.length}return X};function m(I,f){if(o.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||le(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);const p=I.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&p===0)return 0;let X=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return pe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ce(I).length;default:if(X)return $?-1:pe(I).length;f=(""+f).toLowerCase(),X=!0}}o.byteLength=m;function h(I,f,p){let $=!1;if((f===void 0||f<0)&&(f=0),f>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,f>>>=0,p<=f))return"";for(I||(I="utf8");;)switch(I){case"hex":return Y(this,f,p);case"utf8":case"utf-8":return L(this,f,p);case"ascii":return Z(this,f,p);case"latin1":case"binary":return k(this,f,p);case"base64":return D(this,f,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,f,p);default:if($)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),$=!0}}o.prototype._isBuffer=!0;function g(I,f,p){const $=I[f];I[f]=I[p],I[p]=$}o.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let p=0;p<f;p+=2)g(this,p,p+1);return this},o.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let p=0;p<f;p+=4)g(this,p,p+3),g(this,p+1,p+2);return this},o.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let p=0;p<f;p+=8)g(this,p,p+7),g(this,p+1,p+6),g(this,p+2,p+5),g(this,p+3,p+4);return this},o.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?L(this,0,f):h.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(f){if(!o.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:o.compare(this,f)===0},o.prototype.inspect=function(){let f="";const p=r.INSPECT_MAX_BYTES;return f=this.toString("hex",0,p).replace(/(.{2})/g,"$1 ").trim(),this.length>p&&(f+=" ... "),"<Buffer "+f+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(f,p,$,X,oe){if(le(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),!o.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(p===void 0&&(p=0),$===void 0&&($=f?f.length:0),X===void 0&&(X=0),oe===void 0&&(oe=this.length),p<0||$>f.length||X<0||oe>this.length)throw new RangeError("out of range index");if(X>=oe&&p>=$)return 0;if(X>=oe)return-1;if(p>=$)return 1;if(p>>>=0,$>>>=0,X>>>=0,oe>>>=0,this===f)return 0;let de=oe-X,Ee=$-p;const ke=Math.min(de,Ee),Le=this.slice(X,oe),Oe=f.slice(p,$);for(let De=0;De<ke;++De)if(Le[De]!==Oe[De]){de=Le[De],Ee=Oe[De];break}return de<Ee?-1:Ee<de?1:0};function N(I,f,p,$,X){if(I.length===0)return-1;if(typeof p=="string"?($=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,Re(p)&&(p=X?0:I.length-1),p<0&&(p=I.length+p),p>=I.length){if(X)return-1;p=I.length-1}else if(p<0)if(X)p=0;else return-1;if(typeof f=="string"&&(f=o.from(f,$)),o.isBuffer(f))return f.length===0?-1:C(I,f,p,$,X);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(I,f,p):Uint8Array.prototype.lastIndexOf.call(I,f,p):C(I,[f],p,$,X);throw new TypeError("val must be string, number or Buffer")}function C(I,f,p,$,X){let oe=1,de=I.length,Ee=f.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(I.length<2||f.length<2)return-1;oe=2,de/=2,Ee/=2,p/=2}function ke(Oe,De){return oe===1?Oe[De]:Oe.readUInt16BE(De*oe)}let Le;if(X){let Oe=-1;for(Le=p;Le<de;Le++)if(ke(I,Le)===ke(f,Oe===-1?0:Le-Oe)){if(Oe===-1&&(Oe=Le),Le-Oe+1===Ee)return Oe*oe}else Oe!==-1&&(Le-=Le-Oe),Oe=-1}else for(p+Ee>de&&(p=de-Ee),Le=p;Le>=0;Le--){let Oe=!0;for(let De=0;De<Ee;De++)if(ke(I,Le+De)!==ke(f,De)){Oe=!1;break}if(Oe)return Le}return-1}o.prototype.includes=function(f,p,$){return this.indexOf(f,p,$)!==-1},o.prototype.indexOf=function(f,p,$){return N(this,f,p,$,!0)},o.prototype.lastIndexOf=function(f,p,$){return N(this,f,p,$,!1)};function A(I,f,p,$){p=Number(p)||0;const X=I.length-p;$?($=Number($),$>X&&($=X)):$=X;const oe=f.length;$>oe/2&&($=oe/2);let de;for(de=0;de<$;++de){const Ee=parseInt(f.substr(de*2,2),16);if(Re(Ee))return de;I[p+de]=Ee}return de}function B(I,f,p,$){return ye(pe(f,I.length-p),I,p,$)}function R(I,f,p,$){return ye(me(f),I,p,$)}function F(I,f,p,$){return ye(ce(f),I,p,$)}function q(I,f,p,$){return ye(J(f,I.length-p),I,p,$)}o.prototype.write=function(f,p,$,X){if(p===void 0)X="utf8",$=this.length,p=0;else if($===void 0&&typeof p=="string")X=p,$=this.length,p=0;else if(isFinite(p))p=p>>>0,isFinite($)?($=$>>>0,X===void 0&&(X="utf8")):(X=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const oe=this.length-p;if(($===void 0||$>oe)&&($=oe),f.length>0&&($<0||p<0)||p>this.length)throw new RangeError("Attempt to write outside buffer bounds");X||(X="utf8");let de=!1;for(;;)switch(X){case"hex":return A(this,f,p,$);case"utf8":case"utf-8":return B(this,f,p,$);case"ascii":case"latin1":case"binary":return R(this,f,p,$);case"base64":return F(this,f,p,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,f,p,$);default:if(de)throw new TypeError("Unknown encoding: "+X);X=(""+X).toLowerCase(),de=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function D(I,f,p){return f===0&&p===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(f,p))}function L(I,f,p){p=Math.min(I.length,p);const $=[];let X=f;for(;X<p;){const oe=I[X];let de=null,Ee=oe>239?4:oe>223?3:oe>191?2:1;if(X+Ee<=p){let ke,Le,Oe,De;switch(Ee){case 1:oe<128&&(de=oe);break;case 2:ke=I[X+1],(ke&192)===128&&(De=(oe&31)<<6|ke&63,De>127&&(de=De));break;case 3:ke=I[X+1],Le=I[X+2],(ke&192)===128&&(Le&192)===128&&(De=(oe&15)<<12|(ke&63)<<6|Le&63,De>2047&&(De<55296||De>57343)&&(de=De));break;case 4:ke=I[X+1],Le=I[X+2],Oe=I[X+3],(ke&192)===128&&(Le&192)===128&&(Oe&192)===128&&(De=(oe&15)<<18|(ke&63)<<12|(Le&63)<<6|Oe&63,De>65535&&De<1114112&&(de=De))}}de===null?(de=65533,Ee=1):de>65535&&(de-=65536,$.push(de>>>10&1023|55296),de=56320|de&1023),$.push(de),X+=Ee}return T($)}const te=4096;function T(I){const f=I.length;if(f<=te)return String.fromCharCode.apply(String,I);let p="",$=0;for(;$<f;)p+=String.fromCharCode.apply(String,I.slice($,$+=te));return p}function Z(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]&127);return $}function k(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]);return $}function Y(I,f,p){const $=I.length;(!f||f<0)&&(f=0),(!p||p<0||p>$)&&(p=$);let X="";for(let oe=f;oe<p;++oe)X+=ze[I[oe]];return X}function w(I,f,p){const $=I.slice(f,p);let X="";for(let oe=0;oe<$.length-1;oe+=2)X+=String.fromCharCode($[oe]+$[oe+1]*256);return X}o.prototype.slice=function(f,p){const $=this.length;f=~~f,p=p===void 0?$:~~p,f<0?(f+=$,f<0&&(f=0)):f>$&&(f=$),p<0?(p+=$,p<0&&(p=0)):p>$&&(p=$),p<f&&(p=f);const X=this.subarray(f,p);return Object.setPrototypeOf(X,o.prototype),X};function H(I,f,p){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+f>p)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return X},o.prototype.readUintBE=o.prototype.readUIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f+--p],oe=1;for(;p>0&&(oe*=256);)X+=this[f+--p]*oe;return X},o.prototype.readUint8=o.prototype.readUInt8=function(f,p){return f=f>>>0,p||H(f,1,this.length),this[f]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(f,p){return f=f>>>0,p||H(f,2,this.length),this[f]|this[f+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(f,p){return f=f>>>0,p||H(f,2,this.length),this[f]<<8|this[f+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(f,p){return f=f>>>0,p||H(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},o.prototype.readBigUInt64LE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,oe=this[++f]+this[++f]*2**8+this[++f]*2**16+$*2**24;return BigInt(X)+(BigInt(oe)<<BigInt(32))}),o.prototype.readBigUInt64BE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=p*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],oe=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+$;return(BigInt(X)<<BigInt(32))+BigInt(oe)}),o.prototype.readIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return oe*=128,X>=oe&&(X-=Math.pow(2,8*p)),X},o.prototype.readIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=p,oe=1,de=this[f+--X];for(;X>0&&(oe*=256);)de+=this[f+--X]*oe;return oe*=128,de>=oe&&(de-=Math.pow(2,8*p)),de},o.prototype.readInt8=function(f,p){return f=f>>>0,p||H(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},o.prototype.readInt16LE=function(f,p){f=f>>>0,p||H(f,2,this.length);const $=this[f]|this[f+1]<<8;return $&32768?$|4294901760:$},o.prototype.readInt16BE=function(f,p){f=f>>>0,p||H(f,2,this.length);const $=this[f+1]|this[f]<<8;return $&32768?$|4294901760:$},o.prototype.readInt32LE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},o.prototype.readInt32BE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},o.prototype.readBigInt64LE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+($<<24);return(BigInt(X)<<BigInt(32))+BigInt(p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),o.prototype.readBigInt64BE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=(p<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(X)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+$)}),o.prototype.readFloatLE=function(f,p){return f=f>>>0,p||H(f,4,this.length),t.read(this,f,!0,23,4)},o.prototype.readFloatBE=function(f,p){return f=f>>>0,p||H(f,4,this.length),t.read(this,f,!1,23,4)},o.prototype.readDoubleLE=function(f,p){return f=f>>>0,p||H(f,8,this.length),t.read(this,f,!0,52,8)},o.prototype.readDoubleBE=function(f,p){return f=f>>>0,p||H(f,8,this.length),t.read(this,f,!1,52,8)};function K(I,f,p,$,X,oe){if(!o.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>X||f<oe)throw new RangeError('"value" argument is out of bounds');if(p+$>I.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){const Ee=Math.pow(2,8*$)-1;K(this,f,p,$,Ee,0)}let oe=1,de=0;for(this[p]=f&255;++de<$&&(oe*=256);)this[p+de]=f/oe&255;return p+$},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(f,p,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){const Ee=Math.pow(2,8*$)-1;K(this,f,p,$,Ee,0)}let oe=$-1,de=1;for(this[p+oe]=f&255;--oe>=0&&(de*=256);)this[p+oe]=f/de&255;return p+$},o.prototype.writeUint8=o.prototype.writeUInt8=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,1,255,0),this[p]=f&255,p+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,65535,0),this[p]=f&255,this[p+1]=f>>>8,p+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,65535,0),this[p]=f>>>8,this[p+1]=f&255,p+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,4294967295,0),this[p+3]=f>>>24,this[p+2]=f>>>16,this[p+1]=f>>>8,this[p]=f&255,p+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,4294967295,0),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4};function Q(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,p}function ue(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p+7]=oe,oe=oe>>8,I[p+6]=oe,oe=oe>>8,I[p+5]=oe,oe=oe>>8,I[p+4]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p+3]=de,de=de>>8,I[p+2]=de,de=de>>8,I[p+1]=de,de=de>>8,I[p]=de,p+8}o.prototype.writeBigUInt64LE=Ie(function(f,p=0){return Q(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Ie(function(f,p=0){return ue(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,!X){const ke=Math.pow(2,8*$-1);K(this,f,p,$,ke-1,-ke)}let oe=0,de=1,Ee=0;for(this[p]=f&255;++oe<$&&(de*=256);)f<0&&Ee===0&&this[p+oe-1]!==0&&(Ee=1),this[p+oe]=(f/de>>0)-Ee&255;return p+$},o.prototype.writeIntBE=function(f,p,$,X){if(f=+f,p=p>>>0,!X){const ke=Math.pow(2,8*$-1);K(this,f,p,$,ke-1,-ke)}let oe=$-1,de=1,Ee=0;for(this[p+oe]=f&255;--oe>=0&&(de*=256);)f<0&&Ee===0&&this[p+oe+1]!==0&&(Ee=1),this[p+oe]=(f/de>>0)-Ee&255;return p+$},o.prototype.writeInt8=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,1,127,-128),f<0&&(f=255+f+1),this[p]=f&255,p+1},o.prototype.writeInt16LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,32767,-32768),this[p]=f&255,this[p+1]=f>>>8,p+2},o.prototype.writeInt16BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,32767,-32768),this[p]=f>>>8,this[p+1]=f&255,p+2},o.prototype.writeInt32LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,2147483647,-2147483648),this[p]=f&255,this[p+1]=f>>>8,this[p+2]=f>>>16,this[p+3]=f>>>24,p+4},o.prototype.writeInt32BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4},o.prototype.writeBigInt64LE=Ie(function(f,p=0){return Q(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Ie(function(f,p=0){return ue(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function V(I,f,p,$,X,oe){if(p+$>I.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function G(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,4),t.write(I,f,p,$,23,4),p+4}o.prototype.writeFloatLE=function(f,p,$){return G(this,f,p,!0,$)},o.prototype.writeFloatBE=function(f,p,$){return G(this,f,p,!1,$)};function z(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,8),t.write(I,f,p,$,52,8),p+8}o.prototype.writeDoubleLE=function(f,p,$){return z(this,f,p,!0,$)},o.prototype.writeDoubleBE=function(f,p,$){return z(this,f,p,!1,$)},o.prototype.copy=function(f,p,$,X){if(!o.isBuffer(f))throw new TypeError("argument should be a Buffer");if($||($=0),!X&&X!==0&&(X=this.length),p>=f.length&&(p=f.length),p||(p=0),X>0&&X<$&&(X=$),X===$||f.length===0||this.length===0)return 0;if(p<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),f.length-p<X-$&&(X=f.length-p+$);const oe=X-$;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(p,$,X):Uint8Array.prototype.set.call(f,this.subarray($,X),p),oe},o.prototype.fill=function(f,p,$,X){if(typeof f=="string"){if(typeof p=="string"?(X=p,p=0,$=this.length):typeof $=="string"&&(X=$,$=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!o.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(f.length===1){const de=f.charCodeAt(0);(X==="utf8"&&de<128||X==="latin1")&&(f=de)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(p<0||this.length<p||this.length<$)throw new RangeError("Out of range index");if($<=p)return this;p=p>>>0,$=$===void 0?this.length:$>>>0,f||(f=0);let oe;if(typeof f=="number")for(oe=p;oe<$;++oe)this[oe]=f;else{const de=o.isBuffer(f)?f:o.from(f,X),Ee=de.length;if(Ee===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(oe=0;oe<$-p;++oe)this[oe+p]=de[oe%Ee]}return this};const U={};function ee(I,f,p){U[I]=class extends p{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}ee("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ee("ERR_INVALID_ARG_TYPE",function(I,f){return`The "${I}" argument must be of type number. Received type ${typeof f}`},TypeError),ee("ERR_OUT_OF_RANGE",function(I,f,p){let $=`The value of "${I}" is out of range.`,X=p;return Number.isInteger(p)&&Math.abs(p)>2**32?X=re(String(p)):typeof p=="bigint"&&(X=String(p),(p>BigInt(2)**BigInt(32)||p<-(BigInt(2)**BigInt(32)))&&(X=re(X)),X+="n"),$+=` It must be ${f}. Received ${X}`,$},RangeError);function re(I){let f="",p=I.length;const $=I[0]==="-"?1:0;for(;p>=$+4;p-=3)f=`_${I.slice(p-3,p)}${f}`;return`${I.slice(0,p)}${f}`}function fe(I,f,p){j(f,"offset"),(I[f]===void 0||I[f+p]===void 0)&&W(f,I.length-(p+1))}function ge(I,f,p,$,X,oe){if(I>p||I<f){const de=typeof f=="bigint"?"n":"";let Ee;throw f===0||f===BigInt(0)?Ee=`>= 0${de} and < 2${de} ** ${(oe+1)*8}${de}`:Ee=`>= -(2${de} ** ${(oe+1)*8-1}${de}) and < 2 ** ${(oe+1)*8-1}${de}`,new U.ERR_OUT_OF_RANGE("value",Ee,I)}fe($,X,oe)}function j(I,f){if(typeof I!="number")throw new U.ERR_INVALID_ARG_TYPE(f,"number",I)}function W(I,f,p){throw Math.floor(I)!==I?(j(I,p),new U.ERR_OUT_OF_RANGE("offset","an integer",I)):f<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,I)}const se=/[^+/0-9A-Za-z-_]/g;function he(I){if(I=I.split("=")[0],I=I.trim().replace(se,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function pe(I,f){f=f||1/0;let p;const $=I.length;let X=null;const oe=[];for(let de=0;de<$;++de){if(p=I.charCodeAt(de),p>55295&&p<57344){if(!X){if(p>56319){(f-=3)>-1&&oe.push(239,191,189);continue}else if(de+1===$){(f-=3)>-1&&oe.push(239,191,189);continue}X=p;continue}if(p<56320){(f-=3)>-1&&oe.push(239,191,189),X=p;continue}p=(X-55296<<10|p-56320)+65536}else X&&(f-=3)>-1&&oe.push(239,191,189);if(X=null,p<128){if((f-=1)<0)break;oe.push(p)}else if(p<2048){if((f-=2)<0)break;oe.push(p>>6|192,p&63|128)}else if(p<65536){if((f-=3)<0)break;oe.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((f-=4)<0)break;oe.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return oe}function me(I){const f=[];for(let p=0;p<I.length;++p)f.push(I.charCodeAt(p)&255);return f}function J(I,f){let p,$,X;const oe=[];for(let de=0;de<I.length&&!((f-=2)<0);++de)p=I.charCodeAt(de),$=p>>8,X=p%256,oe.push(X),oe.push($);return oe}function ce(I){return e.toByteArray(he(I))}function ye(I,f,p,$){let X;for(X=0;X<$&&!(X+p>=f.length||X>=I.length);++X)f[X+p]=I[X];return X}function le(I,f){return I instanceof f||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===f.name}function Re(I){return I!==I}const ze=function(){const I="0123456789abcdef",f=new Array(256);for(let p=0;p<16;++p){const $=p*16;for(let X=0;X<16;++X)f[$+X]=I[p]+I[X]}return f}();function Ie(I){return typeof BigInt>"u"?Xe:I}function Xe(){throw new Error("BigInt not supported")}}(bi)),bi}var sd=Ct();const Hr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Vr="http://www.w3.org/2001/XMLSchema#",$n="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Vr}decimal`,boolean:`${Vr}boolean`,double:`${Vr}double`,integer:`${Vr}integer`,string:`${Vr}string`},rdf:{type:`${Hr}type`,nil:`${Hr}nil`,first:`${Hr}first`,rest:`${Hr}rest`,langString:`${Hr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${$n}reify#forSome`,forAll:`${$n}reify#forAll`},log:{implies:`${$n}log#implies`,isImpliedBy:`${$n}log#isImpliedBy`}},{xsd:Fn}=Ke,ad=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ka={"\\":"\\","'":"'",'"':'"',n:`
7
- `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},od=/[\x00-\x20<>\\"\{\}\|\^\`]/,ld={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},ud=/$0^/;class cd{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const t in this)!(t in ld)&&this[t]instanceof RegExp&&(this[t]=ud)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,i=n.length;for(;;){let o,u;for(;o=this._newline.exec(n);)this.comments&&(u=this._comment.exec(o[0]))&&s("comment",u[1],"",this._line,o[0].length),n=n.substr(o[0].length,n.length),i=n.length,this._line++;if(!o&&(o=this._whitespace.exec(n))&&(n=n.substr(o[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(u=this._comment.exec(n))&&s("comment",u[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;const l=this._line,c=n[0];let d="",b="",y="",_=null,E=0,v=!1;switch(c){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){v=!0;break}}else{this._n3Mode&&(E=1,d="^");break}case"<":if(_=this._unescapedIri.exec(n))d="IRI",b=_[1];else if(_=this._iri.exec(n)){if(b=this._unescape(_[1]),b===null||od.test(b))return a(this);d="IRI"}else n.length>1&&n[1]==="<"?(d="<<",E=2):this._n3Mode&&n.length>1&&n[1]==="="&&(E=2,this._isImpliedBy?(d="abbreviation",b="<"):(d="inverse",b=">"));break;case">":n.length>1&&n[1]===">"&&(d=">>",E=2);break;case"_":((_=this._blank.exec(n))||t&&(_=this._blank.exec(`${n} `)))&&(d="blank",y="_",b=_[1]);break;case'"':if(_=this._simpleQuotedString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=this._simpleApostropheString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(d="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=this._variable.exec(n))&&(d="var",b=_[0]);break;case"@":this._previousMarker==="literal"&&(_=this._langcode.exec(n))?(d="langcode",b=_[1]):(_=this._keyword.exec(n))&&(d=_[0]);break;case".":if(n.length===1?t:n[1]<"0"||n[1]>"9"){d=".",E=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(_=this._number.exec(n)||t&&(_=this._number.exec(`${n} `)))&&(d="literal",b=_[0],y=typeof _[1]=="string"?Fn.double:typeof _[2]=="string"?Fn.decimal:Fn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(_=this._sparqlKeyword.exec(n))?d=_[0].toUpperCase():v=!0;break;case"f":case"t":(_=this._boolean.exec(n))?(d="literal",b=_[0],y=Fn.boolean):v=!0;break;case"a":(_=this._shortPredicates.exec(n))?(d="abbreviation",b="a"):v=!0;break;case"=":this._n3Mode&&n.length>1&&(d="abbreviation",n[1]!==">"?(E=1,b="="):(E=2,b=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(E=1,d=c);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(d="{|",E=2):(d=c,E=1));break;case"|":n.length>=2&&n[1]==="}"&&(d="|}",E=2);break;default:v=!0}if(v&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=this._prefix.exec(n))?(d="prefix",b=_[1]||""):((_=this._prefixed.exec(n))||t&&(_=this._prefixed.exec(`${n} `)))&&(d="prefixed",y=_[1]||"",b=this._unescape(_[2]))),this._previousMarker==="^^")switch(d){case"prefixed":d="type";break;case"IRI":d="typeIRI";break;default:d=""}if(!d)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;const x=E||_[0].length,S=s(d,b,y,l,x);this.previousToken=S,this._previousMarker=d,n=n.substr(x,n.length)}function s(o,u,l,c,d){const b=n?i-n.length:i,y=b+d,_={type:o,value:u,prefix:l,line:c,start:b,end:y};return e(null,_),_}function a(o){e(o._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(ad,(i,s,a,o)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof a=="string"){let u=Number.parseInt(a,16);return u<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((u-=65536)>>10),56320+(u&1023))}return o in Ka?Ka[o]:(t=!0,"")});return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(t,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){const a=e.substring(n,i),o=a.split(/\r\n|\r|\n/).length-1,u=i+n;if(n===1&&o!==0||n===3&&this._lineMode)break;return this._line+=o,{value:this._unescape(a),matchLength:u}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const n=[];let i;if(this._tokenizeToEnd((s,a)=>s?i=s:n.push(a),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=sd.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input>"u"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}}const{rdf:dd,xsd:ar}=Ke;let Cr,hd=0;const Ne={namedNode:Wu,blankNode:zu,variable:Xu,literal:Qu,defaultGraph:md,quad:na,triple:na,fromTerm:hn,fromQuad:Ju};class wt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof wt?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let vn=class extends wt{get termType(){return"NamedNode"}},ct=class Gu extends wt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&e[t++]==="@"?e.substr(t).toLowerCase():""}get datatype(){return new vn(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,n=t<e.length?e[t]:"";return n==="^"?e.substr(t+2):n!=="@"?ar.string:dd.langString}equals(e){return e instanceof Gu?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},fd=class extends wt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},pd=class extends wt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},gd=class extends wt{constructor(){return super(""),Cr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Cr=new gd;function dn(r,e,t){if(e=e||Ne,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Ne)return new ct(r);if(r[r.length-1]==='"')return e.literal(r.substr(1,r.length-2));const n=r.lastIndexOf('"',r.length-1);return e.literal(r.substr(1,n-1),r[n+1]==="@"?r.substr(n+2):e.namedNode(r.substr(n+3)));case"[":r=JSON.parse(r);break;default:if(!t||!Array.isArray(r))return e.namedNode(r)}return e.quad(dn(r[0],e,!0),dn(r[1],e,!0),dn(r[2],e,!0),r[3]&&dn(r[3],e,!0))}function Ir(r,e){if(typeof r=="string")return r;if(r instanceof wt&&r.termType!=="Quad")return r.id;if(!r)return Cr.id;switch(r.termType){case"NamedNode":return r.value;case"BlankNode":return`_:${r.value}`;case"Variable":return`?${r.value}`;case"DefaultGraph":return"";case"Literal":return`"${r.value}"${r.language?`@${r.language}`:r.datatype&&r.datatype.value!==ar.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Ir(r.subject,!0),Ir(r.predicate,!0),Ir(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Ir(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let si=class extends wt{constructor(e,t,n,i){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=i||Cr}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 Wu(r){return new vn(r)}function zu(r){return new fd(r||`n3-${hd++}`)}function Qu(r,e){if(typeof e=="string")return new ct(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=ar.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?ar.integer:ar.double:(t=ar.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===ar.string?new ct(`"${r}"`):new ct(`"${r}"^^${t}`)}function Xu(r){return new pd(r)}function md(){return Cr}function na(r,e,t,n){return new si(r,e,t,n)}function hn(r){if(r instanceof wt)return r;switch(r.termType){case"NamedNode":return Wu(r.value);case"BlankNode":return zu(r.value);case"Variable":return Xu(r.value);case"DefaultGraph":return Cr;case"Literal":return Qu(r.value,r.language||r.datatype);case"Quad":return Ju(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function Ju(r){if(r instanceof si)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return na(hn(r.subject),hn(r.predicate),hn(r.object),hn(r.graph))}let Ya=0;class Ku{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Yu(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(t),i=/trig/.test(t),s=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),u=s||a;(this._supportsNamedGraphs=!(n||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||s||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),u&&(this._resolveRelativeIRI=l=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new cd({lineMode:u,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Ya=0}_setBase(e){if(!e)this._base="",this._basePath="";else{const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,t,n,i,s){const a=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:i,object:s,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){const 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?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let n;switch(e.type){case"IRI":case"typeIRI":const i=this._resolveIRI(e.value);if(i===null)return this._error("Invalid IRI",e);n=this._factory.namedNode(i);break;case"type":case"prefixed":const s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(s+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){const 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._readPredicate:this._error("Expected predicate but got ;",e);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._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return e.type==="]"?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,n=null,i=this._readListItem;const s=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()),i=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(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;n=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,i=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=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()),s===null?o.predicate===null?o.subject=n:o.object=n:this._emit(s,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 i}_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":const 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){const 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._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,n=this._graph;const i=this._subject,s=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,s&&(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);const a=this._predicate,o=this._object;this._subject=this._factory.quad(i,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(i!==null){const a=this._predicate,o=this._object;s?this._emit(o,a,i,n):this._emit(i,a,o,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._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t=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._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if((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:const t=this._contextStack,n=t.length&&t[t.length-1];if(n&&n.type==="item"){const i=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,i,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n;const i=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=i):(t=this._object,this._object=i),this._emit(t,n,i,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let n,i;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=t):(i=this._object,this._object=t),this._emit(t,n,i,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);const t=this._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(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,n,i){this._callback(null,this._factory.quad(e,t,n,i||this.DEFAULTGRAPH))}_error(e,t){const n=new Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=kn}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let n="",i=-1,s=-1,a=0,o="/";for(;i<t;){switch(o){case":":if(s<0&&e[++i]==="/"&&e[++i]==="/")for(;(s=i+1)<t&&e[s]!=="/";)i=s;break;case"?":case"#":i=t;break;case"/":if(e[i+1]===".")switch(o=e[++i+1],o){case"/":n+=e.substring(a,i-1),a=i+1;break;case void 0:case"?":case"#":return n+e.substring(a,i)+e.substr(i+1);case".":if(o=e[++i+1],o===void 0||o==="/"||o==="?"||o==="#"){if(n+=e.substring(a,i-2),(a=n.lastIndexOf("/"))>=s&&(n=n.substr(0,a)),o!=="/")return`${n}/${e.substr(i+1)}`;a=i+1}}}o=e[++i]}return n+e.substring(a)}parse(e,t,n){let i,s,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(i=t.onQuad,s=t.onPrefix,a=t.onComment):(i=t,s=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Ya++}_`,this._prefixCallback=s||kn,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const u=[];let l;if(this._callback=(c,d)=>{c?l=c:d&&u.push(d)},this._lexer.tokenize(e).every(c=>this._readCallback=this._readCallback(c)),l)throw l;return u}let o=(u,l)=>{u!==null?(this._callback(u),this._callback=kn):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,o=(u,l)=>{u!==null?(this._callback(u),this._callback=kn):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=i,this._lexer.tokenize(e,o)}}function kn(){}function Yu(r,e){r._factory=e,r.DEFAULTGRAPH=e.defaultGraph(),r.RDF_FIRST=e.namedNode(Ke.rdf.first),r.RDF_REST=e.namedNode(Ke.rdf.rest),r.RDF_NIL=e.namedNode(Ke.rdf.nil),r.N3_FORALL=e.namedNode(Ke.r.forAll),r.N3_FORSOME=e.namedNode(Ke.r.forSome),r.ABBREVIATIONS={a:e.namedNode(Ke.rdf.type),"=":e.namedNode(Ke.owl.sameAs),">":e.namedNode(Ke.log.implies),"<":e.namedNode(Ke.log.isImpliedBy)},r.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Yu(Ku.prototype,Ne);function ia(r){return!!r&&r.termType==="DefaultGraph"}function Gn(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const yd=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,bd=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Za="./",_d="../",_i="?",eo="#";class ga{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!yd.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!ga.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",Gn(e)],n=[],i=[],s=/[^/?#]*([/?#])/y;let a,o=0,u=0,l=s.lastIndex=e.length;for(;!o&&!u&&(a=s.exec(this.base));)a[1]===eo?u=s.lastIndex-1:(t.push(Gn(a[0]),"(?:"),n.push(")?"),a[1]!==_i?i.push(l=s.lastIndex):(o=l=s.lastIndex,u=this.base.indexOf(eo,o),this._pathReplacements[o]=_i));for(let c=0;c<i.length;c++)this._pathReplacements[i[c]]=_d.repeat(i.length-c-1);return this._pathReplacements[i[i.length-1]]=Za,this._baseLength=u>0?u:this.base.length,t.push(Gn(this.base.substring(l,this._baseLength)),o?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...n].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const n=t[0].length;if(n===this._baseLength&&n===e.length)return"";const i=this._pathReplacements[n];if(i){const s=e.substring(n);return i!==_i&&!bd.test(s)?e:i===Za&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const Gr=Ne.defaultGraph(),{rdf:wd,xsd:wr}=Ke,to=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ro=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,vd={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class Wr extends wt{equals(e){return e===this}}class ma{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let n="";this._outputStream={write(i,s,a){n+=i,a&&a()},end:i=>{i&&i(null,n)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Gr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new ga(t.baseIRI)))}get _inDefaultGraph(){return Gr.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,n,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
6
+ */var eo;function Ct(){return eo||(eo=1,function(r){const e=od(),t=ld(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=o,r.SlowBuffer=S,r.INSPECT_MAX_BYTES=50;const i=2147483647;r.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!o.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 s(){try{const I=new Uint8Array(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,Uint8Array.prototype),Object.setPrototypeOf(I,f),I.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function a(I){if(I>i)throw new RangeError('The value "'+I+'" is invalid for option "size"');const f=new Uint8Array(I);return Object.setPrototypeOf(f,o.prototype),f}function o(I,f,p){if(typeof I=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return h(I)}return u(I,f,p)}o.poolSize=8192;function u(I,f,p){if(typeof I=="string")return b(I,f);if(ArrayBuffer.isView(I))return _(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(le(I,ArrayBuffer)||I&&le(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(I,SharedArrayBuffer)||I&&le(I.buffer,SharedArrayBuffer)))return E(I,f,p);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=I.valueOf&&I.valueOf();if($!=null&&$!==I)return o.from($,f,p);const X=v(I);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return o.from(I[Symbol.toPrimitive]("string"),f,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}o.from=function(I,f,p){return u(I,f,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function c(I,f,p){return l(I),I<=0?a(I):f!==void 0?typeof p=="string"?a(I).fill(f,p):a(I).fill(f):a(I)}o.alloc=function(I,f,p){return c(I,f,p)};function h(I){return l(I),a(I<0?0:x(I)|0)}o.allocUnsafe=function(I){return h(I)},o.allocUnsafeSlow=function(I){return h(I)};function b(I,f){if((typeof f!="string"||f==="")&&(f="utf8"),!o.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const p=m(I,f)|0;let $=a(p);const X=$.write(I,f);return X!==p&&($=$.slice(0,X)),$}function y(I){const f=I.length<0?0:x(I.length)|0,p=a(f);for(let $=0;$<f;$+=1)p[$]=I[$]&255;return p}function _(I){if(le(I,Uint8Array)){const f=new Uint8Array(I);return E(f.buffer,f.byteOffset,f.byteLength)}return y(I)}function E(I,f,p){if(f<0||I.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<f+(p||0))throw new RangeError('"length" is outside of buffer bounds');let $;return f===void 0&&p===void 0?$=new Uint8Array(I):p===void 0?$=new Uint8Array(I,f):$=new Uint8Array(I,f,p),Object.setPrototypeOf($,o.prototype),$}function v(I){if(o.isBuffer(I)){const f=x(I.length)|0,p=a(f);return p.length===0||I.copy(p,0,0,f),p}if(I.length!==void 0)return typeof I.length!="number"||Re(I.length)?a(0):y(I);if(I.type==="Buffer"&&Array.isArray(I.data))return y(I.data)}function x(I){if(I>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return I|0}function S(I){return+I!=I&&(I=0),o.alloc(+I)}o.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==o.prototype},o.compare=function(f,p){if(le(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),le(p,Uint8Array)&&(p=o.from(p,p.offset,p.byteLength)),!o.isBuffer(f)||!o.isBuffer(p))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===p)return 0;let $=f.length,X=p.length;for(let oe=0,de=Math.min($,X);oe<de;++oe)if(f[oe]!==p[oe]){$=f[oe],X=p[oe];break}return $<X?-1:X<$?1:0},o.isEncoding=function(f){switch(String(f).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}},o.concat=function(f,p){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return o.alloc(0);let $;if(p===void 0)for(p=0,$=0;$<f.length;++$)p+=f[$].length;const X=o.allocUnsafe(p);let oe=0;for($=0;$<f.length;++$){let de=f[$];if(le(de,Uint8Array))oe+de.length>X.length?(o.isBuffer(de)||(de=o.from(de)),de.copy(X,oe)):Uint8Array.prototype.set.call(X,de,oe);else if(o.isBuffer(de))de.copy(X,oe);else throw new TypeError('"list" argument must be an Array of Buffers');oe+=de.length}return X};function m(I,f){if(o.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||le(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);const p=I.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&p===0)return 0;let X=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return pe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ce(I).length;default:if(X)return $?-1:pe(I).length;f=(""+f).toLowerCase(),X=!0}}o.byteLength=m;function d(I,f,p){let $=!1;if((f===void 0||f<0)&&(f=0),f>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,f>>>=0,p<=f))return"";for(I||(I="utf8");;)switch(I){case"hex":return Y(this,f,p);case"utf8":case"utf-8":return L(this,f,p);case"ascii":return Z(this,f,p);case"latin1":case"binary":return k(this,f,p);case"base64":return D(this,f,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,f,p);default:if($)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),$=!0}}o.prototype._isBuffer=!0;function g(I,f,p){const $=I[f];I[f]=I[p],I[p]=$}o.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let p=0;p<f;p+=2)g(this,p,p+1);return this},o.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let p=0;p<f;p+=4)g(this,p,p+3),g(this,p+1,p+2);return this},o.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let p=0;p<f;p+=8)g(this,p,p+7),g(this,p+1,p+6),g(this,p+2,p+5),g(this,p+3,p+4);return this},o.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?L(this,0,f):d.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(f){if(!o.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:o.compare(this,f)===0},o.prototype.inspect=function(){let f="";const p=r.INSPECT_MAX_BYTES;return f=this.toString("hex",0,p).replace(/(.{2})/g,"$1 ").trim(),this.length>p&&(f+=" ... "),"<Buffer "+f+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(f,p,$,X,oe){if(le(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),!o.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(p===void 0&&(p=0),$===void 0&&($=f?f.length:0),X===void 0&&(X=0),oe===void 0&&(oe=this.length),p<0||$>f.length||X<0||oe>this.length)throw new RangeError("out of range index");if(X>=oe&&p>=$)return 0;if(X>=oe)return-1;if(p>=$)return 1;if(p>>>=0,$>>>=0,X>>>=0,oe>>>=0,this===f)return 0;let de=oe-X,Ee=$-p;const ke=Math.min(de,Ee),Le=this.slice(X,oe),Oe=f.slice(p,$);for(let De=0;De<ke;++De)if(Le[De]!==Oe[De]){de=Le[De],Ee=Oe[De];break}return de<Ee?-1:Ee<de?1:0};function N(I,f,p,$,X){if(I.length===0)return-1;if(typeof p=="string"?($=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,Re(p)&&(p=X?0:I.length-1),p<0&&(p=I.length+p),p>=I.length){if(X)return-1;p=I.length-1}else if(p<0)if(X)p=0;else return-1;if(typeof f=="string"&&(f=o.from(f,$)),o.isBuffer(f))return f.length===0?-1:C(I,f,p,$,X);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(I,f,p):Uint8Array.prototype.lastIndexOf.call(I,f,p):C(I,[f],p,$,X);throw new TypeError("val must be string, number or Buffer")}function C(I,f,p,$,X){let oe=1,de=I.length,Ee=f.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(I.length<2||f.length<2)return-1;oe=2,de/=2,Ee/=2,p/=2}function ke(Oe,De){return oe===1?Oe[De]:Oe.readUInt16BE(De*oe)}let Le;if(X){let Oe=-1;for(Le=p;Le<de;Le++)if(ke(I,Le)===ke(f,Oe===-1?0:Le-Oe)){if(Oe===-1&&(Oe=Le),Le-Oe+1===Ee)return Oe*oe}else Oe!==-1&&(Le-=Le-Oe),Oe=-1}else for(p+Ee>de&&(p=de-Ee),Le=p;Le>=0;Le--){let Oe=!0;for(let De=0;De<Ee;De++)if(ke(I,Le+De)!==ke(f,De)){Oe=!1;break}if(Oe)return Le}return-1}o.prototype.includes=function(f,p,$){return this.indexOf(f,p,$)!==-1},o.prototype.indexOf=function(f,p,$){return N(this,f,p,$,!0)},o.prototype.lastIndexOf=function(f,p,$){return N(this,f,p,$,!1)};function A(I,f,p,$){p=Number(p)||0;const X=I.length-p;$?($=Number($),$>X&&($=X)):$=X;const oe=f.length;$>oe/2&&($=oe/2);let de;for(de=0;de<$;++de){const Ee=parseInt(f.substr(de*2,2),16);if(Re(Ee))return de;I[p+de]=Ee}return de}function B(I,f,p,$){return ye(pe(f,I.length-p),I,p,$)}function R(I,f,p,$){return ye(me(f),I,p,$)}function F(I,f,p,$){return ye(ce(f),I,p,$)}function q(I,f,p,$){return ye(J(f,I.length-p),I,p,$)}o.prototype.write=function(f,p,$,X){if(p===void 0)X="utf8",$=this.length,p=0;else if($===void 0&&typeof p=="string")X=p,$=this.length,p=0;else if(isFinite(p))p=p>>>0,isFinite($)?($=$>>>0,X===void 0&&(X="utf8")):(X=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const oe=this.length-p;if(($===void 0||$>oe)&&($=oe),f.length>0&&($<0||p<0)||p>this.length)throw new RangeError("Attempt to write outside buffer bounds");X||(X="utf8");let de=!1;for(;;)switch(X){case"hex":return A(this,f,p,$);case"utf8":case"utf-8":return B(this,f,p,$);case"ascii":case"latin1":case"binary":return R(this,f,p,$);case"base64":return F(this,f,p,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,f,p,$);default:if(de)throw new TypeError("Unknown encoding: "+X);X=(""+X).toLowerCase(),de=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function D(I,f,p){return f===0&&p===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(f,p))}function L(I,f,p){p=Math.min(I.length,p);const $=[];let X=f;for(;X<p;){const oe=I[X];let de=null,Ee=oe>239?4:oe>223?3:oe>191?2:1;if(X+Ee<=p){let ke,Le,Oe,De;switch(Ee){case 1:oe<128&&(de=oe);break;case 2:ke=I[X+1],(ke&192)===128&&(De=(oe&31)<<6|ke&63,De>127&&(de=De));break;case 3:ke=I[X+1],Le=I[X+2],(ke&192)===128&&(Le&192)===128&&(De=(oe&15)<<12|(ke&63)<<6|Le&63,De>2047&&(De<55296||De>57343)&&(de=De));break;case 4:ke=I[X+1],Le=I[X+2],Oe=I[X+3],(ke&192)===128&&(Le&192)===128&&(Oe&192)===128&&(De=(oe&15)<<18|(ke&63)<<12|(Le&63)<<6|Oe&63,De>65535&&De<1114112&&(de=De))}}de===null?(de=65533,Ee=1):de>65535&&(de-=65536,$.push(de>>>10&1023|55296),de=56320|de&1023),$.push(de),X+=Ee}return T($)}const te=4096;function T(I){const f=I.length;if(f<=te)return String.fromCharCode.apply(String,I);let p="",$=0;for(;$<f;)p+=String.fromCharCode.apply(String,I.slice($,$+=te));return p}function Z(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]&127);return $}function k(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]);return $}function Y(I,f,p){const $=I.length;(!f||f<0)&&(f=0),(!p||p<0||p>$)&&(p=$);let X="";for(let oe=f;oe<p;++oe)X+=ze[I[oe]];return X}function w(I,f,p){const $=I.slice(f,p);let X="";for(let oe=0;oe<$.length-1;oe+=2)X+=String.fromCharCode($[oe]+$[oe+1]*256);return X}o.prototype.slice=function(f,p){const $=this.length;f=~~f,p=p===void 0?$:~~p,f<0?(f+=$,f<0&&(f=0)):f>$&&(f=$),p<0?(p+=$,p<0&&(p=0)):p>$&&(p=$),p<f&&(p=f);const X=this.subarray(f,p);return Object.setPrototypeOf(X,o.prototype),X};function H(I,f,p){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+f>p)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return X},o.prototype.readUintBE=o.prototype.readUIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f+--p],oe=1;for(;p>0&&(oe*=256);)X+=this[f+--p]*oe;return X},o.prototype.readUint8=o.prototype.readUInt8=function(f,p){return f=f>>>0,p||H(f,1,this.length),this[f]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(f,p){return f=f>>>0,p||H(f,2,this.length),this[f]|this[f+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(f,p){return f=f>>>0,p||H(f,2,this.length),this[f]<<8|this[f+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(f,p){return f=f>>>0,p||H(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},o.prototype.readBigUInt64LE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,oe=this[++f]+this[++f]*2**8+this[++f]*2**16+$*2**24;return BigInt(X)+(BigInt(oe)<<BigInt(32))}),o.prototype.readBigUInt64BE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=p*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],oe=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+$;return(BigInt(X)<<BigInt(32))+BigInt(oe)}),o.prototype.readIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return oe*=128,X>=oe&&(X-=Math.pow(2,8*p)),X},o.prototype.readIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=p,oe=1,de=this[f+--X];for(;X>0&&(oe*=256);)de+=this[f+--X]*oe;return oe*=128,de>=oe&&(de-=Math.pow(2,8*p)),de},o.prototype.readInt8=function(f,p){return f=f>>>0,p||H(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},o.prototype.readInt16LE=function(f,p){f=f>>>0,p||H(f,2,this.length);const $=this[f]|this[f+1]<<8;return $&32768?$|4294901760:$},o.prototype.readInt16BE=function(f,p){f=f>>>0,p||H(f,2,this.length);const $=this[f+1]|this[f]<<8;return $&32768?$|4294901760:$},o.prototype.readInt32LE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},o.prototype.readInt32BE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},o.prototype.readBigInt64LE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+($<<24);return(BigInt(X)<<BigInt(32))+BigInt(p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),o.prototype.readBigInt64BE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=(p<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(X)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+$)}),o.prototype.readFloatLE=function(f,p){return f=f>>>0,p||H(f,4,this.length),t.read(this,f,!0,23,4)},o.prototype.readFloatBE=function(f,p){return f=f>>>0,p||H(f,4,this.length),t.read(this,f,!1,23,4)},o.prototype.readDoubleLE=function(f,p){return f=f>>>0,p||H(f,8,this.length),t.read(this,f,!0,52,8)},o.prototype.readDoubleBE=function(f,p){return f=f>>>0,p||H(f,8,this.length),t.read(this,f,!1,52,8)};function K(I,f,p,$,X,oe){if(!o.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>X||f<oe)throw new RangeError('"value" argument is out of bounds');if(p+$>I.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){const Ee=Math.pow(2,8*$)-1;K(this,f,p,$,Ee,0)}let oe=1,de=0;for(this[p]=f&255;++de<$&&(oe*=256);)this[p+de]=f/oe&255;return p+$},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(f,p,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){const Ee=Math.pow(2,8*$)-1;K(this,f,p,$,Ee,0)}let oe=$-1,de=1;for(this[p+oe]=f&255;--oe>=0&&(de*=256);)this[p+oe]=f/de&255;return p+$},o.prototype.writeUint8=o.prototype.writeUInt8=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,1,255,0),this[p]=f&255,p+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,65535,0),this[p]=f&255,this[p+1]=f>>>8,p+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,65535,0),this[p]=f>>>8,this[p+1]=f&255,p+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,4294967295,0),this[p+3]=f>>>24,this[p+2]=f>>>16,this[p+1]=f>>>8,this[p]=f&255,p+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,4294967295,0),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4};function Q(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,p}function ue(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p+7]=oe,oe=oe>>8,I[p+6]=oe,oe=oe>>8,I[p+5]=oe,oe=oe>>8,I[p+4]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p+3]=de,de=de>>8,I[p+2]=de,de=de>>8,I[p+1]=de,de=de>>8,I[p]=de,p+8}o.prototype.writeBigUInt64LE=Ie(function(f,p=0){return Q(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Ie(function(f,p=0){return ue(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,!X){const ke=Math.pow(2,8*$-1);K(this,f,p,$,ke-1,-ke)}let oe=0,de=1,Ee=0;for(this[p]=f&255;++oe<$&&(de*=256);)f<0&&Ee===0&&this[p+oe-1]!==0&&(Ee=1),this[p+oe]=(f/de>>0)-Ee&255;return p+$},o.prototype.writeIntBE=function(f,p,$,X){if(f=+f,p=p>>>0,!X){const ke=Math.pow(2,8*$-1);K(this,f,p,$,ke-1,-ke)}let oe=$-1,de=1,Ee=0;for(this[p+oe]=f&255;--oe>=0&&(de*=256);)f<0&&Ee===0&&this[p+oe+1]!==0&&(Ee=1),this[p+oe]=(f/de>>0)-Ee&255;return p+$},o.prototype.writeInt8=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,1,127,-128),f<0&&(f=255+f+1),this[p]=f&255,p+1},o.prototype.writeInt16LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,32767,-32768),this[p]=f&255,this[p+1]=f>>>8,p+2},o.prototype.writeInt16BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,32767,-32768),this[p]=f>>>8,this[p+1]=f&255,p+2},o.prototype.writeInt32LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,2147483647,-2147483648),this[p]=f&255,this[p+1]=f>>>8,this[p+2]=f>>>16,this[p+3]=f>>>24,p+4},o.prototype.writeInt32BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4},o.prototype.writeBigInt64LE=Ie(function(f,p=0){return Q(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Ie(function(f,p=0){return ue(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function V(I,f,p,$,X,oe){if(p+$>I.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function G(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,4),t.write(I,f,p,$,23,4),p+4}o.prototype.writeFloatLE=function(f,p,$){return G(this,f,p,!0,$)},o.prototype.writeFloatBE=function(f,p,$){return G(this,f,p,!1,$)};function z(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,8),t.write(I,f,p,$,52,8),p+8}o.prototype.writeDoubleLE=function(f,p,$){return z(this,f,p,!0,$)},o.prototype.writeDoubleBE=function(f,p,$){return z(this,f,p,!1,$)},o.prototype.copy=function(f,p,$,X){if(!o.isBuffer(f))throw new TypeError("argument should be a Buffer");if($||($=0),!X&&X!==0&&(X=this.length),p>=f.length&&(p=f.length),p||(p=0),X>0&&X<$&&(X=$),X===$||f.length===0||this.length===0)return 0;if(p<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),f.length-p<X-$&&(X=f.length-p+$);const oe=X-$;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(p,$,X):Uint8Array.prototype.set.call(f,this.subarray($,X),p),oe},o.prototype.fill=function(f,p,$,X){if(typeof f=="string"){if(typeof p=="string"?(X=p,p=0,$=this.length):typeof $=="string"&&(X=$,$=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!o.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(f.length===1){const de=f.charCodeAt(0);(X==="utf8"&&de<128||X==="latin1")&&(f=de)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(p<0||this.length<p||this.length<$)throw new RangeError("Out of range index");if($<=p)return this;p=p>>>0,$=$===void 0?this.length:$>>>0,f||(f=0);let oe;if(typeof f=="number")for(oe=p;oe<$;++oe)this[oe]=f;else{const de=o.isBuffer(f)?f:o.from(f,X),Ee=de.length;if(Ee===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(oe=0;oe<$-p;++oe)this[oe+p]=de[oe%Ee]}return this};const U={};function ee(I,f,p){U[I]=class extends p{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}ee("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ee("ERR_INVALID_ARG_TYPE",function(I,f){return`The "${I}" argument must be of type number. Received type ${typeof f}`},TypeError),ee("ERR_OUT_OF_RANGE",function(I,f,p){let $=`The value of "${I}" is out of range.`,X=p;return Number.isInteger(p)&&Math.abs(p)>2**32?X=re(String(p)):typeof p=="bigint"&&(X=String(p),(p>BigInt(2)**BigInt(32)||p<-(BigInt(2)**BigInt(32)))&&(X=re(X)),X+="n"),$+=` It must be ${f}. Received ${X}`,$},RangeError);function re(I){let f="",p=I.length;const $=I[0]==="-"?1:0;for(;p>=$+4;p-=3)f=`_${I.slice(p-3,p)}${f}`;return`${I.slice(0,p)}${f}`}function fe(I,f,p){j(f,"offset"),(I[f]===void 0||I[f+p]===void 0)&&W(f,I.length-(p+1))}function ge(I,f,p,$,X,oe){if(I>p||I<f){const de=typeof f=="bigint"?"n":"";let Ee;throw f===0||f===BigInt(0)?Ee=`>= 0${de} and < 2${de} ** ${(oe+1)*8}${de}`:Ee=`>= -(2${de} ** ${(oe+1)*8-1}${de}) and < 2 ** ${(oe+1)*8-1}${de}`,new U.ERR_OUT_OF_RANGE("value",Ee,I)}fe($,X,oe)}function j(I,f){if(typeof I!="number")throw new U.ERR_INVALID_ARG_TYPE(f,"number",I)}function W(I,f,p){throw Math.floor(I)!==I?(j(I,p),new U.ERR_OUT_OF_RANGE("offset","an integer",I)):f<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,I)}const se=/[^+/0-9A-Za-z-_]/g;function he(I){if(I=I.split("=")[0],I=I.trim().replace(se,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function pe(I,f){f=f||1/0;let p;const $=I.length;let X=null;const oe=[];for(let de=0;de<$;++de){if(p=I.charCodeAt(de),p>55295&&p<57344){if(!X){if(p>56319){(f-=3)>-1&&oe.push(239,191,189);continue}else if(de+1===$){(f-=3)>-1&&oe.push(239,191,189);continue}X=p;continue}if(p<56320){(f-=3)>-1&&oe.push(239,191,189),X=p;continue}p=(X-55296<<10|p-56320)+65536}else X&&(f-=3)>-1&&oe.push(239,191,189);if(X=null,p<128){if((f-=1)<0)break;oe.push(p)}else if(p<2048){if((f-=2)<0)break;oe.push(p>>6|192,p&63|128)}else if(p<65536){if((f-=3)<0)break;oe.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((f-=4)<0)break;oe.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return oe}function me(I){const f=[];for(let p=0;p<I.length;++p)f.push(I.charCodeAt(p)&255);return f}function J(I,f){let p,$,X;const oe=[];for(let de=0;de<I.length&&!((f-=2)<0);++de)p=I.charCodeAt(de),$=p>>8,X=p%256,oe.push(X),oe.push($);return oe}function ce(I){return e.toByteArray(he(I))}function ye(I,f,p,$){let X;for(X=0;X<$&&!(X+p>=f.length||X>=I.length);++X)f[X+p]=I[X];return X}function le(I,f){return I instanceof f||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===f.name}function Re(I){return I!==I}const ze=function(){const I="0123456789abcdef",f=new Array(256);for(let p=0;p<16;++p){const $=p*16;for(let X=0;X<16;++X)f[$+X]=I[p]+I[X]}return f}();function Ie(I){return typeof BigInt>"u"?Xe:I}function Xe(){throw new Error("BigInt not supported")}}(vi)),vi}var ud=Ct();const Hr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Vr="http://www.w3.org/2001/XMLSchema#",jn="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Vr}decimal`,boolean:`${Vr}boolean`,double:`${Vr}double`,integer:`${Vr}integer`,string:`${Vr}string`},rdf:{type:`${Hr}type`,nil:`${Hr}nil`,first:`${Hr}first`,rest:`${Hr}rest`,langString:`${Hr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${jn}reify#forSome`,forAll:`${jn}reify#forAll`},log:{implies:`${jn}log#implies`,isImpliedBy:`${jn}log#isImpliedBy`}},{xsd:$n}=Ke,cd=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,to={"\\":"\\","'":"'",'"':'"',n:`
7
+ `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},dd=/[\x00-\x20<>\\"\{\}\|\^\`]/,hd={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},fd=/$0^/;class pd{constructor(e){if(this._iri=/^<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/,this._unescapedIri=/^<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/,this._simpleQuotedString=/^"([^"\\\r\n]*)"(?=[^"])/,this._simpleApostropheString=/^'([^'\\\r\n]*)'(?=[^'])/,this._langcode=/^@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9\-])/i,this._prefix=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:(?=[#\s<])/,this._prefixed=/^((?:[A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)?:((?:(?:[0-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(const t in this)!(t in hd)&&this[t]instanceof RegExp&&(this[t]=fd)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,i=n.length;for(;;){let o,u;for(;o=this._newline.exec(n);)this.comments&&(u=this._comment.exec(o[0]))&&s("comment",u[1],"",this._line,o[0].length),n=n.substr(o[0].length,n.length),i=n.length,this._line++;if(!o&&(o=this._whitespace.exec(n))&&(n=n.substr(o[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(u=this._comment.exec(n))&&s("comment",u[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;const l=this._line,c=n[0];let h="",b="",y="",_=null,E=0,v=!1;switch(c){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){v=!0;break}}else{this._n3Mode&&(E=1,h="^");break}case"<":if(_=this._unescapedIri.exec(n))h="IRI",b=_[1];else if(_=this._iri.exec(n)){if(b=this._unescape(_[1]),b===null||dd.test(b))return a(this);h="IRI"}else n.length>1&&n[1]==="<"?(h="<<",E=2):this._n3Mode&&n.length>1&&n[1]==="="&&(E=2,this._isImpliedBy?(h="abbreviation",b="<"):(h="inverse",b=">"));break;case">":n.length>1&&n[1]===">"&&(h=">>",E=2);break;case"_":((_=this._blank.exec(n))||t&&(_=this._blank.exec(`${n} `)))&&(h="blank",y="_",b=_[1]);break;case'"':if(_=this._simpleQuotedString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(h="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=this._simpleApostropheString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(h="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=this._variable.exec(n))&&(h="var",b=_[0]);break;case"@":this._previousMarker==="literal"&&(_=this._langcode.exec(n))?(h="langcode",b=_[1]):(_=this._keyword.exec(n))&&(h=_[0]);break;case".":if(n.length===1?t:n[1]<"0"||n[1]>"9"){h=".",E=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(_=this._number.exec(n)||t&&(_=this._number.exec(`${n} `)))&&(h="literal",b=_[0],y=typeof _[1]=="string"?$n.double:typeof _[2]=="string"?$n.decimal:$n.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(_=this._sparqlKeyword.exec(n))?h=_[0].toUpperCase():v=!0;break;case"f":case"t":(_=this._boolean.exec(n))?(h="literal",b=_[0],y=$n.boolean):v=!0;break;case"a":(_=this._shortPredicates.exec(n))?(h="abbreviation",b="a"):v=!0;break;case"=":this._n3Mode&&n.length>1&&(h="abbreviation",n[1]!==">"?(E=1,b="="):(E=2,b=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(E=1,h=c);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(h="{|",E=2):(h=c,E=1));break;case"|":n.length>=2&&n[1]==="}"&&(h="|}",E=2);break;default:v=!0}if(v&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=this._prefix.exec(n))?(h="prefix",b=_[1]||""):((_=this._prefixed.exec(n))||t&&(_=this._prefixed.exec(`${n} `)))&&(h="prefixed",y=_[1]||"",b=this._unescape(_[2]))),this._previousMarker==="^^")switch(h){case"prefixed":h="type";break;case"IRI":h="typeIRI";break;default:h=""}if(!h)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;const x=E||_[0].length,S=s(h,b,y,l,x);this.previousToken=S,this._previousMarker=h,n=n.substr(x,n.length)}function s(o,u,l,c,h){const b=n?i-n.length:i,y=b+h,_={type:o,value:u,prefix:l,line:c,start:b,end:y};return e(null,_),_}function a(o){e(o._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(cd,(i,s,a,o)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof a=="string"){let u=Number.parseInt(a,16);return u<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((u-=65536)>>10),56320+(u&1023))}return o in to?to[o]:(t=!0,"")});return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(t,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){const a=e.substring(n,i),o=a.split(/\r\n|\r|\n/).length-1,u=i+n;if(n===1&&o!==0||n===3&&this._lineMode)break;return this._line+=o,{value:this._unescape(a),matchLength:u}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const n=[];let i;if(this._tokenizeToEnd((s,a)=>s?i=s:n.push(a),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=ud.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input>"u"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}}const{rdf:gd,xsd:ar}=Ke;let Cr,md=0;const Ne={namedNode:Xu,blankNode:Ju,variable:Yu,literal:Ku,defaultGraph:wd,quad:oa,triple:oa,fromTerm:hn,fromQuad:Zu};class wt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof wt?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let oi=class extends wt{get termType(){return"NamedNode"}},_t=class Qu extends wt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&e[t++]==="@"?e.substr(t).toLowerCase():""}get datatype(){return new oi(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,n=t<e.length?e[t]:"";return n==="^"?e.substr(t+2):n!=="@"?ar.string:gd.langString}equals(e){return e instanceof Qu?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},yd=class extends wt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},bd=class extends wt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},_d=class extends wt{constructor(){return super(""),Cr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Cr=new _d;function dn(r,e,t){if(e=e||Ne,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Ne)return new _t(r);if(r[r.length-1]==='"')return e.literal(r.substr(1,r.length-2));const n=r.lastIndexOf('"',r.length-1);return e.literal(r.substr(1,n-1),r[n+1]==="@"?r.substr(n+2):e.namedNode(r.substr(n+3)));case"[":r=JSON.parse(r);break;default:if(!t||!Array.isArray(r))return e.namedNode(r)}return e.quad(dn(r[0],e,!0),dn(r[1],e,!0),dn(r[2],e,!0),r[3]&&dn(r[3],e,!0))}function Ir(r,e){if(typeof r=="string")return r;if(r instanceof wt&&r.termType!=="Quad")return r.id;if(!r)return Cr.id;switch(r.termType){case"NamedNode":return r.value;case"BlankNode":return`_:${r.value}`;case"Variable":return`?${r.value}`;case"DefaultGraph":return"";case"Literal":return`"${r.value}"${r.language?`@${r.language}`:r.datatype&&r.datatype.value!==ar.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Ir(r.subject,!0),Ir(r.predicate,!0),Ir(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Ir(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let li=class extends wt{constructor(e,t,n,i){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=i||Cr}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 Xu(r){return new oi(r)}function Ju(r){return new yd(r||`n3-${md++}`)}function Ku(r,e){if(typeof e=="string")return new _t(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=ar.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?ar.integer:ar.double:(t=ar.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===ar.string?new _t(`"${r}"`):new _t(`"${r}"^^${t}`)}function Yu(r){return new bd(r)}function wd(){return Cr}function oa(r,e,t,n){return new li(r,e,t,n)}function hn(r){if(r instanceof wt)return r;switch(r.termType){case"NamedNode":return Xu(r.value);case"BlankNode":return Ju(r.value);case"Variable":return Yu(r.value);case"DefaultGraph":return Cr;case"Literal":return Ku(r.value,r.language||r.datatype);case"Quad":return Zu(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function Zu(r){if(r instanceof li)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return oa(hn(r.subject),hn(r.predicate),hn(r.object),hn(r.graph))}let ro=0;class ec{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&tc(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(t),i=/trig/.test(t),s=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),u=s||a;(this._supportsNamedGraphs=!(n||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||s||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),u&&(this._resolveRelativeIRI=l=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new pd({lineMode:u,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){ro=0}_setBase(e){if(!e)this._base="",this._basePath="";else{const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,t,n,i,s){const a=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:i,object:s,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){const 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?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let n;switch(e.type){case"IRI":case"typeIRI":const i=this._resolveIRI(e.value);if(i===null)return this._error("Invalid IRI",e);n=this._factory.namedNode(i);break;case"type":case"prefixed":const s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(s+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){const 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._readPredicate:this._error("Expected predicate but got ;",e);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._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return e.type==="]"?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,n=null,i=this._readListItem;const s=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()),i=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(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;n=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,i=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=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()),s===null?o.predicate===null?o.subject=n:o.object=n:this._emit(s,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 i}_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":const 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){const 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._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,n=this._graph;const i=this._subject,s=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,s&&(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);const a=this._predicate,o=this._object;this._subject=this._factory.quad(i,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(i!==null){const a=this._predicate,o=this._object;s?this._emit(o,a,i,n):this._emit(i,a,o,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._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t=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._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if((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:const t=this._contextStack,n=t.length&&t[t.length-1];if(n&&n.type==="item"){const i=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,i,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,n;const i=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=i):(t=this._object,this._object=i),this._emit(t,n,i,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let n,i;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=t):(i=this._object,this._object=t),this._emit(t,n,i,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);const t=this._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(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,n,i){this._callback(null,this._factory.quad(e,t,n,i||this.DEFAULTGRAPH))}_error(e,t){const n=new Error(`${e} on line ${t.line}.`);n.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=Fn}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let n="",i=-1,s=-1,a=0,o="/";for(;i<t;){switch(o){case":":if(s<0&&e[++i]==="/"&&e[++i]==="/")for(;(s=i+1)<t&&e[s]!=="/";)i=s;break;case"?":case"#":i=t;break;case"/":if(e[i+1]===".")switch(o=e[++i+1],o){case"/":n+=e.substring(a,i-1),a=i+1;break;case void 0:case"?":case"#":return n+e.substring(a,i)+e.substr(i+1);case".":if(o=e[++i+1],o===void 0||o==="/"||o==="?"||o==="#"){if(n+=e.substring(a,i-2),(a=n.lastIndexOf("/"))>=s&&(n=n.substr(0,a)),o!=="/")return`${n}/${e.substr(i+1)}`;a=i+1}}}o=e[++i]}return n+e.substring(a)}parse(e,t,n){let i,s,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(i=t.onQuad,s=t.onPrefix,a=t.onComment):(i=t,s=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${ro++}_`,this._prefixCallback=s||Fn,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const u=[];let l;if(this._callback=(c,h)=>{c?l=c:h&&u.push(h)},this._lexer.tokenize(e).every(c=>this._readCallback=this._readCallback(c)),l)throw l;return u}let o=(u,l)=>{u!==null?(this._callback(u),this._callback=Fn):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,o=(u,l)=>{u!==null?(this._callback(u),this._callback=Fn):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=i,this._lexer.tokenize(e,o)}}function Fn(){}function tc(r,e){r._factory=e,r.DEFAULTGRAPH=e.defaultGraph(),r.RDF_FIRST=e.namedNode(Ke.rdf.first),r.RDF_REST=e.namedNode(Ke.rdf.rest),r.RDF_NIL=e.namedNode(Ke.rdf.nil),r.N3_FORALL=e.namedNode(Ke.r.forAll),r.N3_FORSOME=e.namedNode(Ke.r.forSome),r.ABBREVIATIONS={a:e.namedNode(Ke.rdf.type),"=":e.namedNode(Ke.owl.sameAs),">":e.namedNode(Ke.log.implies),"<":e.namedNode(Ke.log.isImpliedBy)},r.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}tc(ec.prototype,Ne);function la(r){return!!r&&r.termType==="DefaultGraph"}function Gn(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const vd=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,xd=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,no="./",Ed="../",xi="?",io="#";class _a{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!vd.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!_a.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",Gn(e)],n=[],i=[],s=/[^/?#]*([/?#])/y;let a,o=0,u=0,l=s.lastIndex=e.length;for(;!o&&!u&&(a=s.exec(this.base));)a[1]===io?u=s.lastIndex-1:(t.push(Gn(a[0]),"(?:"),n.push(")?"),a[1]!==xi?i.push(l=s.lastIndex):(o=l=s.lastIndex,u=this.base.indexOf(io,o),this._pathReplacements[o]=xi));for(let c=0;c<i.length;c++)this._pathReplacements[i[c]]=Ed.repeat(i.length-c-1);return this._pathReplacements[i[i.length-1]]=no,this._baseLength=u>0?u:this.base.length,t.push(Gn(this.base.substring(l,this._baseLength)),o?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...n].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const n=t[0].length;if(n===this._baseLength&&n===e.length)return"";const i=this._pathReplacements[n];if(i){const s=e.substring(n);return i!==xi&&!xd.test(s)?e:i===no&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const Gr=Ne.defaultGraph(),{rdf:Sd,xsd:wr}=Ke,so=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ao=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Id={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class Wr extends wt{equals(e){return e===this}}class wa{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let n="";this._outputStream={write(i,s,a){n+=i,a&&a()},end:i=>{i&&i(null,n)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Gr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new _a(t.baseIRI)))}get _inDefaultGraph(){return Gr.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,n,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
8
8
  `:`
9
9
  }
10
10
  `)+(Gr.equals(i)?"":`${this._encodeIriOrBlank(i)} {
@@ -12,7 +12,7 @@ var Sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"
12
12
  ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s):this._write(`${(this._subject===null?"":`.
13
13
  `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s)}catch(a){s&&s(a)}}_writeQuadLine(e,t,n,i,s){delete this._prefixMatch,this._write(this.quadToString(e,t,n,i),s)}quadToString(e,t,n,i){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(n)}${i&&i.value?` ${this._encodeIriOrBlank(i)} .
14
14
  `:` .
15
- `}`}quadsToString(e){let t="";for(const n of e)t+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return t}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseIri&&(t=this._baseIri.toRelative(t)),to.test(t)&&(t=t.replace(ro,no));const n=this._prefixRegex.exec(t);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(to.test(t)&&(t=t.replace(ro,no)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===wr.string)return`"${t}"`}else switch(e.datatype.value){case wr.string:return`"${t}"`;case wr.boolean:if(t==="true"||t==="false")return t;break;case wr.integer:if(/^[+-]?\d+$/.test(t))return t;break;case wr.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case wr.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===wd.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:n,graph:i}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(n)}${ia(i)?"":` ${this._encodeIriOrBlank(i)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,n,i,s){n===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof i=="function"?this._writeQuad(e,t,n,Gr,i):this._writeQuad(e,t,n,i||Gr,s)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,n){const i={};i[e]=t,this.addPrefixes(i,n)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let n=!1;for(let i in e){let s=e[i];typeof s!="string"&&(s=s.value),n=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
15
+ `}`}quadsToString(e){let t="";for(const n of e)t+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return t}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseIri&&(t=this._baseIri.toRelative(t)),so.test(t)&&(t=t.replace(ao,oo));const n=this._prefixRegex.exec(t);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(so.test(t)&&(t=t.replace(ao,oo)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===wr.string)return`"${t}"`}else switch(e.datatype.value){case wr.string:return`"${t}"`;case wr.boolean:if(t==="true"||t==="false")return t;break;case wr.integer:if(/^[+-]?\d+$/.test(t))return t;break;case wr.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case wr.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Sd.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:n,graph:i}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(n)}${la(i)?"":` ${this._encodeIriOrBlank(i)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,n,i,s){n===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof i=="function"?this._writeQuad(e,t,n,Gr,i):this._writeQuad(e,t,n,i||Gr,s)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,n){const i={};i[e]=t,this.addPrefixes(i,n)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let n=!1;for(let i in e){let s=e[i];typeof s!="string"&&(s=s.value),n=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
16
16
  `:`
17
17
  }
18
18
  `),this._subject=null,this._graph=""),this._prefixIRIs[s]=i+=":",this._write(`@prefix ${i} <${s}>.
@@ -23,8 +23,8 @@ var Sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"
23
23
  ]`)}}list(e){const t=e&&e.length||0,n=new Array(t);for(let i=0;i<t;i++)n[i]=this._encodeObject(e[i]);return new Wr(`(${n.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
24
24
  `:`
25
25
  }
26
- `),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,i)=>{t=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function no(r){let e=vd[r];return e===void 0&&(r.length===1?(e=r.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var wi={exports:{}},vi={exports:{}},xi,io;function Be(){if(io)return xi;io=1;class r extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let n="";for(let i=0;i<t.length;i++)n+=` ${t[i].stack}
27
- `;super(n),this.name="AggregateError",this.errors=t}}return xi={AggregateError:r,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:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,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},xi}var Ei={exports:{}},Si,so;function Zu(){return so||(so=1,Si={format(r,...e){return r.replace(/%([sdifj])/g,function(...[t,n]){const i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(r){switch(typeof r){case"string":if(r.includes("'"))if(r.includes('"')){if(!r.includes("`")&&!r.includes("${"))return`\`${r}\``}else return`"${r}"`;return`'${r}'`;case"number":return isNaN(r)?"NaN":Object.is(r,-0)?String(r):r;case"bigint":return`${String(r)}n`;case"boolean":case"undefined":return String(r);case"object":return"{}"}}}),Si}var Ii,ao;function it(){if(ao)return Ii;ao=1;const{format:r,inspect:e}=Zu(),{AggregateError:t}=Be(),n=globalThis.AggregateError||t,i=Symbol("kIsNodeError"),s=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,o="__node_internal_",u={};function l(v,x){if(!v)throw new u.ERR_INTERNAL_ASSERTION(x)}function c(v){let x="",S=v.length;const m=v[0]==="-"?1:0;for(;S>=m+4;S-=3)x=`_${v.slice(S-3,S)}${x}`;return`${v.slice(0,S)}${x}`}function d(v,x,S){if(typeof x=="function")return l(x.length<=S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${x.length}).`),x(...S);const m=(x.match(/%[dfijoOs]/g)||[]).length;return l(m===S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${m}).`),S.length===0?x:r(x,...S)}function b(v,x,S){S||(S=Error);class m extends S{constructor(...g){super(d(v,x,g))}toString(){return`${this.name} [${v}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:S.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${v}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=v,m.prototype[i]=!0,u[v]=m}function y(v){const x=o+v.name;return Object.defineProperty(v,"name",{value:x}),v}function _(v,x){if(v&&x&&v!==x){if(Array.isArray(x.errors))return x.errors.push(v),x;const S=new n([x,v],x.message);return S.code=x.code,S}return v||x}class E extends Error{constructor(x="The operation was aborted",S=void 0){if(S!==void 0&&typeof S!="object")throw new u.ERR_INVALID_ARG_TYPE("options","Object",S);super(x,S),this.code="ABORT_ERR",this.name="AbortError"}}return b("ERR_ASSERTION","%s",Error),b("ERR_INVALID_ARG_TYPE",(v,x,S)=>{l(typeof v=="string","'name' must be a string"),Array.isArray(x)||(x=[x]);let m="The ";v.endsWith(" argument")?m+=`${v} `:m+=`"${v}" ${v.includes(".")?"property":"argument"} `,m+="must be ";const h=[],g=[],N=[];for(const A of x)l(typeof A=="string","All expected entries have to be of type string"),s.includes(A)?h.push(A.toLowerCase()):a.test(A)?g.push(A):(l(A!=="object",'The value "object" should be written as "Object"'),N.push(A));if(g.length>0){const A=h.indexOf("object");A!==-1&&(h.splice(h,A,1),g.push("Object"))}if(h.length>0){switch(h.length){case 1:m+=`of type ${h[0]}`;break;case 2:m+=`one of type ${h[0]} or ${h[1]}`;break;default:{const A=h.pop();m+=`one of type ${h.join(", ")}, or ${A}`}}(g.length>0||N.length>0)&&(m+=" or ")}if(g.length>0){switch(g.length){case 1:m+=`an instance of ${g[0]}`;break;case 2:m+=`an instance of ${g[0]} or ${g[1]}`;break;default:{const A=g.pop();m+=`an instance of ${g.join(", ")}, or ${A}`}}N.length>0&&(m+=" or ")}switch(N.length){case 0:break;case 1:N[0].toLowerCase()!==N[0]&&(m+="an "),m+=`${N[0]}`;break;case 2:m+=`one of ${N[0]} or ${N[1]}`;break;default:{const A=N.pop();m+=`one of ${N.join(", ")}, or ${A}`}}if(S==null)m+=`. Received ${S}`;else if(typeof S=="function"&&S.name)m+=`. Received function ${S.name}`;else if(typeof S=="object"){var C;if((C=S.constructor)!==null&&C!==void 0&&C.name)m+=`. Received an instance of ${S.constructor.name}`;else{const A=e(S,{depth:-1});m+=`. Received ${A}`}}else{let A=e(S,{colors:!1});A.length>25&&(A=`${A.slice(0,25)}...`),m+=`. Received type ${typeof S} (${A})`}return m},TypeError),b("ERR_INVALID_ARG_VALUE",(v,x,S="is invalid")=>{let m=e(x);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${v.includes(".")?"property":"argument"} '${v}' ${S}. Received ${m}`},TypeError),b("ERR_INVALID_RETURN_VALUE",(v,x,S)=>{var m;const h=S!=null&&(m=S.constructor)!==null&&m!==void 0&&m.name?`instance of ${S.constructor.name}`:`type ${typeof S}`;return`Expected ${v} to be returned from the "${x}" function but got ${h}.`},TypeError),b("ERR_MISSING_ARGS",(...v)=>{l(v.length>0,"At least one arg needs to be specified");let x;const S=v.length;switch(v=(Array.isArray(v)?v:[v]).map(m=>`"${m}"`).join(" or "),S){case 1:x+=`The ${v[0]} argument`;break;case 2:x+=`The ${v[0]} and ${v[1]} arguments`;break;default:{const m=v.pop();x+=`The ${v.join(", ")}, and ${m} arguments`}break}return`${x} must be specified`},TypeError),b("ERR_OUT_OF_RANGE",(v,x,S)=>{l(x,'Missing "range" argument');let m;if(Number.isInteger(S)&&Math.abs(S)>2**32)m=c(String(S));else if(typeof S=="bigint"){m=String(S);const h=BigInt(2)**BigInt(32);(S>h||S<-h)&&(m=c(m)),m+="n"}else m=e(S);return`The value of "${v}" is out of range. It must be ${x}. Received ${m}`},RangeError),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),b("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),b("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),b("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),b("ERR_STREAM_WRITE_AFTER_END","write after end",Error),b("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Ii={AbortError:E,aggregateTwoErrors:y(_),hideStackFrames:y,codes:u},Ii}var zr={exports:{}},oo;function xn(){if(oo)return zr.exports;oo=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return zr.exports=r,zr.exports.AbortSignal=e,zr.exports.default=r,zr.exports}var Pn={exports:{}},lo;function ai(){if(lo)return Pn.exports;lo=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(g,N,C){return Function.prototype.apply.call(g,N,C)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:t=function(g){return Object.getOwnPropertyNames(g)};function n(h){console&&console.warn&&console.warn(h)}var i=Number.isNaN||function(g){return g!==g};function s(){s.init.call(this)}Pn.exports=s,Pn.exports.once=x,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(h){if(typeof h!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof h)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(h){if(typeof h!="number"||h<0||i(h))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+h+".");a=h}}),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(g){if(typeof g!="number"||g<0||i(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function u(h){return h._maxListeners===void 0?s.defaultMaxListeners:h._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(g){for(var N=[],C=1;C<arguments.length;C++)N.push(arguments[C]);var A=g==="error",B=this._events;if(B!==void 0)A=A&&B.error===void 0;else if(!A)return!1;if(A){var R;if(N.length>0&&(R=N[0]),R instanceof Error)throw R;var F=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw F.context=R,F}var q=B[g];if(q===void 0)return!1;if(typeof q=="function")e(q,this,N);else for(var D=q.length,L=_(q,D),C=0;C<D;++C)e(L[C],this,N);return!0};function l(h,g,N,C){var A,B,R;if(o(N),B=h._events,B===void 0?(B=h._events=Object.create(null),h._eventsCount=0):(B.newListener!==void 0&&(h.emit("newListener",g,N.listener?N.listener:N),B=h._events),R=B[g]),R===void 0)R=B[g]=N,++h._eventsCount;else if(typeof R=="function"?R=B[g]=C?[N,R]:[R,N]:C?R.unshift(N):R.push(N),A=u(h),A>0&&R.length>A&&!R.warned){R.warned=!0;var F=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");F.name="MaxListenersExceededWarning",F.emitter=h,F.type=g,F.count=R.length,n(F)}return h}s.prototype.addListener=function(g,N){return l(this,g,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(g,N){return l(this,g,N,!0)};function c(){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 d(h,g,N){var C={fired:!1,wrapFn:void 0,target:h,type:g,listener:N},A=c.bind(C);return A.listener=N,C.wrapFn=A,A}s.prototype.once=function(g,N){return o(N),this.on(g,d(this,g,N)),this},s.prototype.prependOnceListener=function(g,N){return o(N),this.prependListener(g,d(this,g,N)),this},s.prototype.removeListener=function(g,N){var C,A,B,R,F;if(o(N),A=this._events,A===void 0)return this;if(C=A[g],C===void 0)return this;if(C===N||C.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete A[g],A.removeListener&&this.emit("removeListener",g,C.listener||N));else if(typeof C!="function"){for(B=-1,R=C.length-1;R>=0;R--)if(C[R]===N||C[R].listener===N){F=C[R].listener,B=R;break}if(B<0)return this;B===0?C.shift():E(C,B),C.length===1&&(A[g]=C[0]),A.removeListener!==void 0&&this.emit("removeListener",g,F||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(g){var N,C,A;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[g]),this;if(arguments.length===0){var B=Object.keys(C),R;for(A=0;A<B.length;++A)R=B[A],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=C[g],typeof N=="function")this.removeListener(g,N);else if(N!==void 0)for(A=N.length-1;A>=0;A--)this.removeListener(g,N[A]);return this};function b(h,g,N){var C=h._events;if(C===void 0)return[];var A=C[g];return A===void 0?[]:typeof A=="function"?N?[A.listener||A]:[A]:N?v(A):_(A,A.length)}s.prototype.listeners=function(g){return b(this,g,!0)},s.prototype.rawListeners=function(g){return b(this,g,!1)},s.listenerCount=function(h,g){return typeof h.listenerCount=="function"?h.listenerCount(g):y.call(h,g)},s.prototype.listenerCount=y;function y(h){var g=this._events;if(g!==void 0){var N=g[h];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function _(h,g){for(var N=new Array(g),C=0;C<g;++C)N[C]=h[C];return N}function E(h,g){for(;g+1<h.length;g++)h[g]=h[g+1];h.pop()}function v(h){for(var g=new Array(h.length),N=0;N<g.length;++N)g[N]=h[N].listener||h[N];return g}function x(h,g){return new Promise(function(N,C){function A(R){h.removeListener(g,B),C(R)}function B(){typeof h.removeListener=="function"&&h.removeListener("error",A),N([].slice.call(arguments))}m(h,g,B,{once:!0}),g!=="error"&&S(h,A,{once:!0})})}function S(h,g,N){typeof h.on=="function"&&m(h,"error",g,N)}function m(h,g,N,C){if(typeof h.on=="function")C.once?h.once(g,N):h.on(g,N);else if(typeof h.addEventListener=="function")h.addEventListener(g,function A(B){C.once&&h.removeEventListener(g,A),N(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof h)}return Pn.exports}var uo;function at(){return uo||(uo=1,function(r){const e=Ct(),{format:t,inspect:n}=Zu(),{codes:{ERR_INVALID_ARG_TYPE:i}}=it(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=Be(),u=globalThis.AbortSignal||xn().AbortSignal,l=globalThis.AbortController||xn().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,d=globalThis.Blob||e.Blob,b=typeof d<"u"?function(v){return v instanceof d}:function(v){return!1},y=(E,v)=>{if(E!==void 0&&(E===null||typeof E!="object"||!("aborted"in E)))throw new i(v,"AbortSignal",E)},_=(E,v)=>{if(typeof E!="function")throw new i(v,"Function",E)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(E){let v=!1;return function(...x){v||(v=!0,E.apply(this,x))}},createDeferredPromise:function(){let E,v;return{promise:new Promise((S,m)=>{E=S,v=m}),resolve:E,reject:v}},promisify(E){return new Promise((v,x)=>{E((S,...m)=>S?x(S):v(...m))})},debuglog(){return function(){}},format:t,inspect:n,types:{isAsyncFunction(E){return E instanceof c},isArrayBufferView(E){return ArrayBuffer.isView(E)}},isBlob:b,deprecate(E,v){return E},addAbortListener:ai().addAbortListener||function(v,x){if(v===void 0)throw new i("signal","AbortSignal",v);y(v,"signal"),_(x,"listener");let S;return v.aborted?queueMicrotask(()=>x()):(v.addEventListener("abort",x,{__proto__:null,once:!0,[s]:!0}),S=()=>{v.removeEventListener("abort",x)}),{__proto__:null,[o](){var m;(m=S)===null||m===void 0||m()}}},AbortSignalAny:u.any||function(v){if(v.length===1)return v[0];const x=new l,S=()=>x.abort();return v.forEach(m=>{y(m,"signals"),m.addEventListener("abort",S,{once:!0})}),x.signal.addEventListener("abort",()=>{v.forEach(m=>m.removeEventListener("abort",S))},{once:!0}),x.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(Ei)),Ei.exports}var Mn={},Ni,co;function Nn(){if(co)return Ni;co=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:n,NumberIsInteger:i,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:o,NumberParseInt:u,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:c,String:d,StringPrototypeToUpperCase:b,StringPrototypeTrim:y}=Be(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:E,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:S,ERR_UNKNOWN_SIGNAL:m}}=it(),{normalizeEncoding:h}=at(),{isAsyncFunction:g,isArrayBufferView:N}=at().types,C={};function A(J){return J===(J|0)}function B(J){return J===J>>>0}const R=/^[0-7]+$/,F="must be a 32-bit unsigned integer or an octal string";function q(J,ce,ye){if(typeof J>"u"&&(J=ye),typeof J=="string"){if(c(R,J)===null)throw new x(ce,J,F);J=u(J,8)}return te(J,ce),J}const D=_((J,ce,ye=o,le=a)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);if(J<ye||J>le)throw new S(ce,`>= ${ye} && <= ${le}`,J)}),L=_((J,ce,ye=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);if(J<ye||J>le)throw new S(ce,`>= ${ye} && <= ${le}`,J)}),te=_((J,ce,ye=!1)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);const le=ye?1:0,Re=4294967295;if(J<le||J>Re)throw new S(ce,`>= ${le} && <= ${Re}`,J)});function T(J,ce){if(typeof J!="string")throw new v(ce,"string",J)}function Z(J,ce,ye=void 0,le){if(typeof J!="number")throw new v(ce,"number",J);if(ye!=null&&J<ye||le!=null&&J>le||(ye!=null||le!=null)&&s(J))throw new S(ce,`${ye!=null?`>= ${ye}`:""}${ye!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,J)}const k=_((J,ce,ye)=>{if(!e(ye,J)){const Re="must be one of: "+t(n(ye,ze=>typeof ze=="string"?`'${ze}'`:d(ze)),", ");throw new x(ce,J,Re)}});function Y(J,ce){if(typeof J!="boolean")throw new v(ce,"boolean",J)}function w(J,ce,ye){return J==null||!l(J,ce)?ye:J[ce]}const H=_((J,ce,ye=null)=>{const le=w(ye,"allowArray",!1),Re=w(ye,"allowFunction",!1);if(!w(ye,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Re||typeof J!="function"))throw new v(ce,"Object",J)}),K=_((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new v(ce,"a dictionary",J)}),Q=_((J,ce,ye=0)=>{if(!r(J))throw new v(ce,"Array",J);if(J.length<ye){const le=`must be longer than ${ye}`;throw new x(ce,J,le)}});function ue(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)T(J[ye],`${ce}[${ye}]`)}function V(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)Y(J[ye],`${ce}[${ye}]`)}function G(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++){const le=J[ye],Re=`${ce}[${ye}]`;if(le==null)throw new v(Re,"AbortSignal",le);fe(le,Re)}}function z(J,ce="signal"){if(T(J,ce),C[J]===void 0)throw C[b(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const U=_((J,ce="buffer")=>{if(!N(J))throw new v(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ye=h(ce),le=J.length;if(ye==="hex"&&le%2!==0)throw new x("encoding",ce,`is invalid for data of length ${le}`)}function re(J,ce="Port",ye=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&y(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ye)throw new E(ce,J,ye);return J|0}const fe=_((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new v(ce,"AbortSignal",J)}),ge=_((J,ce)=>{if(typeof J!="function")throw new v(ce,"Function",J)}),j=_((J,ce)=>{if(typeof J!="function"||g(J))throw new v(ce,"Function",J)}),W=_((J,ce)=>{if(J!==void 0)throw new v(ce,"undefined",J)});function se(J,ce,ye){if(!e(ye,J))throw new v(ce,`('${t(ye,"|")}')`,J)}const he=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(J,ce){if(typeof J>"u"||!c(he,J))throw new x(ce,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me(J){if(typeof J=="string")return pe(J,"hints"),J;if(r(J)){const ce=J.length;let ye="";if(ce===0)return ye;for(let le=0;le<ce;le++){const Re=J[le];pe(Re,"hints"),ye+=Re,le!==ce-1&&(ye+=", ")}return ye}throw new x("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Ni={isInt32:A,isUint32:B,parseFileMode:q,validateArray:Q,validateStringArray:ue,validateBooleanArray:V,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:U,validateDictionary:K,validateEncoding:ee,validateFunction:ge,validateInt32:L,validateInteger:D,validateNumber:Z,validateObject:H,validateOneOf:k,validatePlainFunction:j,validatePort:re,validateSignalName:z,validateString:T,validateUint32:te,validateUndefined:W,validateUnion:se,validateAbortSignal:fe,validateLinkHeaderValue:me},Ni}var Bn={exports:{}},Ri={exports:{}},ho;function pr(){if(ho)return Ri.exports;ho=1;var r=Ri.exports={},e,t;function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=n}catch{e=n}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function s(E){if(e===setTimeout)return setTimeout(E,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(E,0);try{return e(E,0)}catch{try{return e.call(null,E,0)}catch{return e.call(this,E,0)}}}function a(E){if(t===clearTimeout)return clearTimeout(E);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(E);try{return t(E)}catch{try{return t.call(null,E)}catch{return t.call(this,E)}}}var o=[],u=!1,l,c=-1;function d(){!u||!l||(u=!1,l.length?o=l.concat(o):c=-1,o.length&&b())}function b(){if(!u){var E=s(d);u=!0;for(var v=o.length;v;){for(l=o,o=[];++c<v;)l&&l[c].run();c=-1,v=o.length}l=null,u=!1,a(E)}}r.nextTick=function(E){var v=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];o.push(new y(E,v)),o.length===1&&!u&&s(b)};function y(E,v){this.fun=E,this.array=v}y.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function _(){}return r.on=_,r.addListener=_,r.once=_,r.off=_,r.removeListener=_,r.removeAllListeners=_,r.emit=_,r.prependListener=_,r.prependOnceListener=_,r.listeners=function(E){return[]},r.binding=function(E){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(E){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Ri.exports}var Ti,fo;function jt(){if(fo)return Ti;fo=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=Be(),n=t("nodejs.stream.destroyed"),i=t("nodejs.stream.errored"),s=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),o=t("nodejs.stream.disturbed"),u=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function c(w,H=!1){var K;return!!(w&&typeof w.pipe=="function"&&typeof w.on=="function"&&(!H||typeof w.pause=="function"&&typeof w.resume=="function")&&(!w._writableState||((K=w._readableState)===null||K===void 0?void 0:K.readable)!==!1)&&(!w._writableState||w._readableState))}function d(w){var H;return!!(w&&typeof w.write=="function"&&typeof w.on=="function"&&(!w._readableState||((H=w._writableState)===null||H===void 0?void 0:H.writable)!==!1))}function b(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function y(w){return w&&(w._readableState||w._writableState||typeof w.write=="function"&&typeof w.on=="function"||typeof w.pipe=="function"&&typeof w.on=="function")}function _(w){return!!(w&&!y(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function E(w){return!!(w&&!y(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function v(w){return!!(w&&!y(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function x(w){return _(w)||E(w)||v(w)}function S(w,H){return w==null?!1:H===!0?typeof w[r]=="function":H===!1?typeof w[e]=="function":typeof w[r]=="function"||typeof w[e]=="function"}function m(w){if(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!!(w.destroyed||w[n]||Q!=null&&Q.destroyed)}function h(w){if(!d(w))return null;if(w.writableEnded===!0)return!0;const H=w._writableState;return H!=null&&H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function g(w,H){if(!d(w))return null;if(w.writableFinished===!0)return!0;const K=w._writableState;return K!=null&&K.errored?!1:typeof K?.finished!="boolean"?null:!!(K.finished||H===!1&&K.ended===!0&&K.length===0)}function N(w){if(!c(w))return null;if(w.readableEnded===!0)return!0;const H=w._readableState;return!H||H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function C(w,H){if(!c(w))return null;const K=w._readableState;return K!=null&&K.errored?!1:typeof K?.endEmitted!="boolean"?null:!!(K.endEmitted||H===!1&&K.ended===!0&&K.length===0)}function A(w){return w&&w[s]!=null?w[s]:typeof w?.readable!="boolean"?null:m(w)?!1:c(w)&&w.readable&&!C(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:d(w)&&w.writable&&!h(w)}function R(w,H){return y(w)?m(w)?!0:!(H?.readable!==!1&&A(w)||H?.writable!==!1&&B(w)):null}function F(w){var H,K;return y(w)?w.writableErrored?w.writableErrored:(H=(K=w._writableState)===null||K===void 0?void 0:K.errored)!==null&&H!==void 0?H:null:null}function q(w){var H,K;return y(w)?w.readableErrored?w.readableErrored:(H=(K=w._readableState)===null||K===void 0?void 0:K.errored)!==null&&H!==void 0?H:null:null}function D(w){if(!y(w))return null;if(typeof w.closed=="boolean")return w.closed;const H=w._writableState,K=w._readableState;return typeof H?.closed=="boolean"||typeof K?.closed=="boolean"?H?.closed||K?.closed:typeof w._closed=="boolean"&&L(w)?w._closed:null}function L(w){return typeof w._closed=="boolean"&&typeof w._defaultKeepAlive=="boolean"&&typeof w._removedConnection=="boolean"&&typeof w._removedContLen=="boolean"}function te(w){return typeof w._sent100=="boolean"&&L(w)}function T(w){var H;return typeof w._consuming=="boolean"&&typeof w._dumped=="boolean"&&((H=w.req)===null||H===void 0?void 0:H.upgradeOrConnect)===void 0}function Z(w){if(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!Q&&te(w)||!!(Q&&Q.autoDestroy&&Q.emitClose&&Q.closed===!1)}function k(w){var H;return!!(w&&((H=w[o])!==null&&H!==void 0?H:w.readableDidRead||w.readableAborted))}function Y(w){var H,K,Q,ue,V,G,z,U,ee,re;return!!(w&&((H=(K=(Q=(ue=(V=(G=w[i])!==null&&G!==void 0?G:w.readableErrored)!==null&&V!==void 0?V:w.writableErrored)!==null&&ue!==void 0?ue:(z=w._readableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&Q!==void 0?Q:(U=w._writableState)===null||U===void 0?void 0:U.errorEmitted)!==null&&K!==void 0?K:(ee=w._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&H!==void 0?H:!((re=w._writableState)===null||re===void 0)&&re.errored))}return Ti={isDestroyed:m,kIsDestroyed:n,isDisturbed:k,kIsDisturbed:o,isErrored:Y,kIsErrored:i,isReadable:A,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:l,kIsWritable:a,isClosed:D,isDuplexNodeStream:b,isFinished:R,isIterable:S,isReadableNodeStream:c,isReadableStream:_,isReadableEnded:N,isReadableFinished:C,isReadableErrored:q,isNodeStream:y,isWebStream:x,isWritable:B,isWritableNodeStream:d,isWritableStream:E,isWritableEnded:h,isWritableFinished:g,isWritableErrored:F,isServerRequest:T,isServerResponse:te,willEmitClose:Z,isTransformStream:v},Ti}var po;function zt(){if(po)return Bn.exports;po=1;const r=pr(),{AbortError:e,codes:t}=it(),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=at(),{validateAbortSignal:o,validateFunction:u,validateObject:l,validateBoolean:c}=Nn(),{Promise:d,PromisePrototypeThen:b,SymbolDispose:y}=Be(),{isClosed:_,isReadable:E,isReadableNodeStream:v,isReadableStream:x,isReadableFinished:S,isReadableErrored:m,isWritable:h,isWritableNodeStream:g,isWritableStream:N,isWritableFinished:C,isWritableErrored:A,isNodeStream:B,willEmitClose:R,kIsClosedPromise:F}=jt();let q;function D(k){return k.setHeader&&typeof k.abort=="function"}const L=()=>{};function te(k,Y,w){var H,K;if(arguments.length===2?(w=Y,Y=s):Y==null?Y=s:l(Y,"options"),u(w,"callback"),o(Y.signal,"options.signal"),w=a(w),x(k)||N(k))return T(k,Y,w);if(!B(k))throw new n("stream",["ReadableStream","WritableStream","Stream"],k);const Q=(H=Y.readable)!==null&&H!==void 0?H:v(k),ue=(K=Y.writable)!==null&&K!==void 0?K:g(k),V=k._writableState,G=k._readableState,z=()=>{k.writable||re()};let U=R(k)&&v(k)===Q&&g(k)===ue,ee=C(k,!1);const re=()=>{ee=!0,k.destroyed&&(U=!1),!(U&&(!k.readable||Q))&&(!Q||fe)&&w.call(k)};let fe=S(k,!1);const ge=()=>{fe=!0,k.destroyed&&(U=!1),!(U&&(!k.writable||ue))&&(!ue||ee)&&w.call(k)},j=J=>{w.call(k,J)};let W=_(k);const se=()=>{W=!0;const J=A(k)||m(k);if(J&&typeof J!="boolean")return w.call(k,J);if(Q&&!fe&&v(k,!0)&&!S(k,!1))return w.call(k,new i);if(ue&&!ee&&!C(k,!1))return w.call(k,new i);w.call(k)},he=()=>{W=!0;const J=A(k)||m(k);if(J&&typeof J!="boolean")return w.call(k,J);w.call(k)},pe=()=>{k.req.on("finish",re)};D(k)?(k.on("complete",re),U||k.on("abort",se),k.req?pe():k.on("request",pe)):ue&&!V&&(k.on("end",z),k.on("close",z)),!U&&typeof k.aborted=="boolean"&&k.on("aborted",se),k.on("end",ge),k.on("finish",re),Y.error!==!1&&k.on("error",j),k.on("close",se),W?r.nextTick(se):V!=null&&V.errorEmitted||G!=null&&G.errorEmitted?U||r.nextTick(he):(!Q&&(!U||E(k))&&(ee||h(k)===!1)||!ue&&(!U||h(k))&&(fe||E(k)===!1)||G&&k.req&&k.aborted)&&r.nextTick(he);const me=()=>{w=L,k.removeListener("aborted",se),k.removeListener("complete",re),k.removeListener("abort",se),k.removeListener("request",pe),k.req&&k.req.removeListener("finish",re),k.removeListener("end",z),k.removeListener("close",z),k.removeListener("finish",re),k.removeListener("end",ge),k.removeListener("error",j),k.removeListener("close",se)};if(Y.signal&&!W){const J=()=>{const ce=w;me(),ce.call(k,new e(void 0,{cause:Y.signal.reason}))};if(Y.signal.aborted)r.nextTick(J);else{q=q||at().addAbortListener;const ce=q(Y.signal,J),ye=w;w=a((...le)=>{ce[y](),ye.apply(k,le)})}}return me}function T(k,Y,w){let H=!1,K=L;if(Y.signal)if(K=()=>{H=!0,w.call(k,new e(void 0,{cause:Y.signal.reason}))},Y.signal.aborted)r.nextTick(K);else{q=q||at().addAbortListener;const ue=q(Y.signal,K),V=w;w=a((...G)=>{ue[y](),V.apply(k,G)})}const Q=(...ue)=>{H||r.nextTick(()=>w.apply(k,ue))};return b(k[F].promise,Q,Q),L}function Z(k,Y){var w;let H=!1;return Y===null&&(Y=s),(w=Y)!==null&&w!==void 0&&w.cleanup&&(c(Y.cleanup,"cleanup"),H=Y.cleanup),new d((K,Q)=>{const ue=te(k,Y,V=>{H&&ue(),V?Q(V):K()})})}return Bn.exports=te,Bn.exports.finished=Z,Bn.exports}var Ai,go;function jr(){if(go)return Ai;go=1;const r=pr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:n}=it(),{Symbol:i}=Be(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:u}=jt(),l=i("kDestroy"),c=i("kConstruct");function d(R,F,q){R&&(R.stack,F&&!F.errored&&(F.errored=R),q&&!q.errored&&(q.errored=R))}function b(R,F){const q=this._readableState,D=this._writableState,L=D||q;return D!=null&&D.destroyed||q!=null&&q.destroyed?(typeof F=="function"&&F(),this):(d(R,D,q),D&&(D.destroyed=!0),q&&(q.destroyed=!0),L.constructed?y(this,R,F):this.once(l,function(te){y(this,e(te,R),F)}),this)}function y(R,F,q){let D=!1;function L(te){if(D)return;D=!0;const T=R._readableState,Z=R._writableState;d(te,Z,T),Z&&(Z.closed=!0),T&&(T.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(_,R,te):r.nextTick(E,R)}try{R._destroy(F||null,L)}catch(te){L(te)}}function _(R,F){v(R,F),E(R)}function E(R){const F=R._readableState,q=R._writableState;q&&(q.closeEmitted=!0),F&&(F.closeEmitted=!0),(q!=null&&q.emitClose||F!=null&&F.emitClose)&&R.emit("close")}function v(R,F){const q=R._readableState,D=R._writableState;D!=null&&D.errorEmitted||q!=null&&q.errorEmitted||(D&&(D.errorEmitted=!0),q&&(q.errorEmitted=!0),R.emit("error",F))}function x(){const R=this._readableState,F=this._writableState;R&&(R.constructed=!0,R.closed=!1,R.closeEmitted=!1,R.destroyed=!1,R.errored=null,R.errorEmitted=!1,R.reading=!1,R.ended=R.readable===!1,R.endEmitted=R.readable===!1),F&&(F.constructed=!0,F.destroyed=!1,F.closed=!1,F.closeEmitted=!1,F.errored=null,F.errorEmitted=!1,F.finalCalled=!1,F.prefinished=!1,F.ended=F.writable===!1,F.ending=F.writable===!1,F.finished=F.writable===!1)}function S(R,F,q){const D=R._readableState,L=R._writableState;if(L!=null&&L.destroyed||D!=null&&D.destroyed)return this;D!=null&&D.autoDestroy||L!=null&&L.autoDestroy?R.destroy(F):F&&(F.stack,L&&!L.errored&&(L.errored=F),D&&!D.errored&&(D.errored=F),q?r.nextTick(v,R,F):v(R,F))}function m(R,F){if(typeof R._construct!="function")return;const q=R._readableState,D=R._writableState;q&&(q.constructed=!1),D&&(D.constructed=!1),R.once(c,F),!(R.listenerCount(c)>1)&&r.nextTick(h,R)}function h(R){let F=!1;function q(D){if(F){S(R,D??new t);return}F=!0;const L=R._readableState,te=R._writableState,T=te||L;L&&(L.constructed=!0),te&&(te.constructed=!0),T.destroyed?R.emit(l,D):D?S(R,D,!0):r.nextTick(g,R)}try{R._construct(D=>{r.nextTick(q,D)})}catch(D){r.nextTick(q,D)}}function g(R){R.emit(c)}function N(R){return R?.setHeader&&typeof R.abort=="function"}function C(R){R.emit("close")}function A(R,F){R.emit("error",F),r.nextTick(C,R)}function B(R,F){!R||a(R)||(!F&&!o(R)&&(F=new n),u(R)?(R.socket=null,R.destroy(F)):N(R)?R.abort():N(R.req)?R.req.abort():typeof R.destroy=="function"?R.destroy(F):typeof R.close=="function"?R.close():F?r.nextTick(A,R,F):r.nextTick(C,R),R.destroyed||(R[s]=!0))}return Ai={construct:m,destroyer:B,destroy:b,undestroy:x,errorOrDestroy:S},Ai}var Di,mo;function ya(){if(mo)return Di;mo=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=ai();function n(s){t.call(this,s)}e(n.prototype,t.prototype),e(n,t),n.prototype.pipe=function(s,a){const o=this;function u(E){s.writable&&s.write(E)===!1&&o.pause&&o.pause()}o.on("data",u);function l(){o.readable&&o.resume&&o.resume()}s.on("drain",l),!s._isStdio&&(!a||a.end!==!1)&&(o.on("end",d),o.on("close",b));let c=!1;function d(){c||(c=!0,s.end())}function b(){c||(c=!0,typeof s.destroy=="function"&&s.destroy())}function y(E){_(),t.listenerCount(this,"error")===0&&this.emit("error",E)}i(o,"error",y),i(s,"error",y);function _(){o.removeListener("data",u),s.removeListener("drain",l),o.removeListener("end",d),o.removeListener("close",b),o.removeListener("error",y),s.removeListener("error",y),o.removeListener("end",_),o.removeListener("close",_),s.removeListener("close",_)}return o.on("end",_),o.on("close",_),s.on("close",_),s.emit("pipe",o),s};function i(s,a,o){if(typeof s.prependListener=="function")return s.prependListener(a,o);!s._events||!s._events[a]?s.on(a,o):r(s._events[a])?s._events[a].unshift(o):s._events[a]=[o,s._events[a]]}return Di={Stream:n,prependListener:i},Di}var Li={exports:{}},yo;function oi(){return yo||(yo=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:n}=it(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=jt(),o=zt(),{ERR_INVALID_ARG_TYPE:u}=n;let l;const c=(d,b)=>{if(typeof d!="object"||!("aborted"in d))throw new u(b,"AbortSignal",d)};r.exports.addAbortSignal=function(b,y){if(c(b,"signal"),!i(y)&&!s(y))throw new u("stream",["ReadableStream","WritableStream","Stream"],y);return r.exports.addAbortSignalNoValidate(b,y)},r.exports.addAbortSignalNoValidate=function(d,b){if(typeof d!="object"||!("aborted"in d))return b;const y=i(b)?()=>{b.destroy(new t(void 0,{cause:d.reason}))}:()=>{b[a](new t(void 0,{cause:d.reason}))};if(d.aborted)y();else{l=l||at().addAbortListener;const _=l(d,y);o(b,_[e])}return b}}(Li)),Li.exports}var Oi,bo;function xd(){if(bo)return Oi;bo=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:n}=Be(),{Buffer:i}=Ct(),{inspect:s}=at();return Oi=class{constructor(){this.head=null,this.tail=null,this.length=0}push(o){const u={data:o,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}unshift(o){const u={data:o,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}shift(){if(this.length===0)return;const o=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,o}clear(){this.head=this.tail=null,this.length=0}join(o){if(this.length===0)return"";let u=this.head,l=""+u.data;for(;(u=u.next)!==null;)l+=o+u.data;return l}concat(o){if(this.length===0)return i.alloc(0);const u=i.allocUnsafe(o>>>0);let l=this.head,c=0;for(;l;)t(u,l.data,c),c+=l.data.length,l=l.next;return u}consume(o,u){const l=this.head.data;if(o<l.length){const c=l.slice(0,o);return this.head.data=l.slice(o),c}return o===l.length?this.shift():u?this._getString(o):this._getBuffer(o)}first(){return this.head.data}*[e](){for(let o=this.head;o;o=o.next)yield o.data}_getString(o){let u="",l=this.head,c=0;do{const d=l.data;if(o>d.length)u+=d,o-=d.length;else{o===d.length?(u+=d,++c,l.next?this.head=l.next:this.head=this.tail=null):(u+=r(d,0,o),this.head=l,l.data=r(d,o));break}++c}while((l=l.next)!==null);return this.length-=c,u}_getBuffer(o){const u=i.allocUnsafe(o),l=o;let c=this.head,d=0;do{const b=c.data;if(o>b.length)t(u,b,l-o),o-=b.length;else{o===b.length?(t(u,b,l-o),++d,c.next?this.head=c.next:this.head=this.tail=null):(t(u,new n(b.buffer,b.byteOffset,o),l-o),this.head=c,c.data=b.slice(o));break}++d}while((c=c.next)!==null);return this.length-=d,u}[Symbol.for("nodejs.util.inspect.custom")](o,u){return s(this,{...u,depth:0,customInspect:!1})}},Oi}var Ci,_o;function li(){if(_o)return Ci;_o=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=Nn(),{ERR_INVALID_ARG_VALUE:n}=it().codes;let i=16*1024,s=16;function a(c,d,b){return c.highWaterMark!=null?c.highWaterMark:d?c[b]:null}function o(c){return c?s:i}function u(c,d){t(d,"value",0),c?s=d:i=d}function l(c,d,b,y){const _=a(d,y,b);if(_!=null){if(!e(_)||_<0){const E=y?`options.${b}`:"options.highWaterMark";throw new n(E,_)}return r(_)}return o(c.objectMode)}return Ci={getHighWaterMark:l,getDefaultHighWaterMark:o,setDefaultHighWaterMark:u},Ci}var ji={},qn={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var wo;function Ed(){return wo||(wo=1,function(r,e){var t=Ct(),n=t.Buffer;function i(a,o){for(var u in a)o[u]=a[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=t:(i(t,e),e.Buffer=s);function s(a,o,u){return n(a,o,u)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,o,u){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,o,u)},s.alloc=function(a,o,u){if(typeof a!="number")throw new TypeError("Argument must be a number");var l=n(a);return o!==void 0?typeof u=="string"?l.fill(o,u):l.fill(o):l.fill(0),l},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(qn,qn.exports)),qn.exports}var vo;function Sd(){if(vo)return ji;vo=1;var r=Ed().Buffer,e=r.isEncoding||function(x){switch(x=""+x,x&&x.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 t(x){if(!x)return"utf8";for(var S;;)switch(x){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 x;default:if(S)return;x=(""+x).toLowerCase(),S=!0}}function n(x){var S=t(x);if(typeof S!="string"&&(r.isEncoding===e||!e(x)))throw new Error("Unknown encoding: "+x);return S||x}ji.StringDecoder=i;function i(x){this.encoding=n(x);var S;switch(this.encoding){case"utf16le":this.text=d,this.end=b,S=4;break;case"utf8":this.fillLast=u,S=4;break;case"base64":this.text=y,this.end=_,S=3;break;default:this.write=E,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(S)}i.prototype.write=function(x){if(x.length===0)return"";var S,m;if(this.lastNeed){if(S=this.fillLast(x),S===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<x.length?S?S+this.text(x,m):this.text(x,m):S||""},i.prototype.end=c,i.prototype.text=l,i.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function s(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function a(x,S,m){var h=S.length-1;if(h<m)return 0;var g=s(S[h]);return g>=0?(g>0&&(x.lastNeed=g-1),g):--h<m||g===-2?0:(g=s(S[h]),g>=0?(g>0&&(x.lastNeed=g-2),g):--h<m||g===-2?0:(g=s(S[h]),g>=0?(g>0&&(g===2?g=0:x.lastNeed=g-3),g):0))}function o(x,S,m){if((S[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return x.lastNeed=2,"�"}}function u(x){var S=this.lastTotal-this.lastNeed,m=o(this,x);if(m!==void 0)return m;if(this.lastNeed<=x.length)return x.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,S,0,x.length),this.lastNeed-=x.length}function l(x,S){var m=a(this,x,S);if(!this.lastNeed)return x.toString("utf8",S);this.lastTotal=m;var h=x.length-(m-this.lastNeed);return x.copy(this.lastChar,0,h),x.toString("utf8",S,h)}function c(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+"�":S}function d(x,S){if((x.length-S)%2===0){var m=x.toString("utf16le",S);if(m){var h=m.charCodeAt(m.length-1);if(h>=55296&&h<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",S,x.length-1)}function b(x){var S=x&&x.length?this.write(x):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,m)}return S}function y(x,S){var m=(x.length-S)%3;return m===0?x.toString("base64",S):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",S,x.length-m))}function _(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function E(x){return x.toString(this.encoding)}function v(x){return x&&x.length?this.write(x):""}return ji}var $i,xo;function ec(){if(xo)return $i;xo=1;const r=pr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:n}=Be(),{Buffer:i}=Ct(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=it().codes;function o(u,l,c){let d;if(typeof l=="string"||l instanceof i)return new u({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let b;if(l&&l[t])b=!0,d=l[t]();else if(l&&l[n])b=!1,d=l[n]();else throw new s("iterable",["Iterable"],l);const y=new u({objectMode:!0,highWaterMark:1,...c});let _=!1;y._read=function(){_||(_=!0,v())},y._destroy=function(x,S){e(E(x),()=>r.nextTick(S,x),m=>r.nextTick(S,m||x))};async function E(x){const S=x!=null,m=typeof d.throw=="function";if(S&&m){const{value:h,done:g}=await d.throw(x);if(await h,g)return}if(typeof d.return=="function"){const{value:h}=await d.return();await h}}async function v(){for(;;){try{const{value:x,done:S}=b?await d.next():d.next();if(S)y.push(null);else{const m=x&&typeof x.then=="function"?await x:x;if(m===null)throw _=!1,new a;if(y.push(m))continue;_=!1}}catch(x){y.destroy(x)}break}}return y}return $i=o,$i}var Fi,Eo;function ui(){if(Eo)return Fi;Eo=1;const r=pr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:u,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:d,Symbol:b}=Be();Fi=le,le.ReadableState=ye;const{EventEmitter:y}=ai(),{Stream:_,prependListener:E}=ya(),{Buffer:v}=Ct(),{addAbortSignal:x}=oi(),S=zt();let m=at().debuglog("stream",O=>{m=O});const h=xd(),g=jr(),{getHighWaterMark:N,getDefaultHighWaterMark:C}=li(),{aggregateTwoErrors:A,codes:{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:F,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:D},AbortError:L}=it(),{validateObject:te}=Nn(),T=b("kPaused"),{StringDecoder:Z}=Sd(),k=ec();o(le.prototype,_.prototype),o(le,_);const Y=()=>{},{errorOrDestroy:w}=g,H=1,K=2,Q=4,ue=8,V=16,G=32,z=64,U=128,ee=256,re=512,fe=1024,ge=2048,j=4096,W=8192,se=16384,he=32768,pe=65536,me=1<<17,J=1<<18;function ce(O){return{enumerable:!1,get(){return(this.state&O)!==0},set(M){M?this.state|=O:this.state&=~O}}}s(ye.prototype,{objectMode:ce(H),ended:ce(K),endEmitted:ce(Q),reading:ce(ue),constructed:ce(V),sync:ce(G),needReadable:ce(z),emittedReadable:ce(U),readableListening:ce(ee),resumeScheduled:ce(re),errorEmitted:ce(fe),emitClose:ce(ge),autoDestroy:ce(j),destroyed:ce(W),closed:ce(se),closeEmitted:ce(he),multiAwaitDrain:ce(pe),readingMore:ce(me),dataEmitted:ce(J)});function ye(O,M,be){typeof be!="boolean"&&(be=M instanceof Lt()),this.state=ge|j|V|G,O&&O.objectMode&&(this.state|=H),be&&O&&O.readableObjectMode&&(this.state|=H),this.highWaterMark=O?N(this,O,"readableHighWaterMark",be):C(!1),this.buffer=new h,this.length=0,this.pipes=[],this.flowing=null,this[T]=null,O&&O.emitClose===!1&&(this.state&=~ge),O&&O.autoDestroy===!1&&(this.state&=~j),this.errored=null,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,O&&O.encoding&&(this.decoder=new Z(O.encoding),this.encoding=O.encoding)}function le(O){if(!(this instanceof le))return new le(O);const M=this instanceof Lt();this._readableState=new ye(O,this,M),O&&(typeof O.read=="function"&&(this._read=O.read),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&!M&&x(O.signal,this)),_.call(this,O),g.construct(this,()=>{this._readableState.needReadable&&X(this,this._readableState)})}le.prototype.destroy=g.destroy,le.prototype._undestroy=g.undestroy,le.prototype._destroy=function(O,M){M(O)},le.prototype[y.captureRejectionSymbol]=function(O){this.destroy(O)},le.prototype[c]=function(){let O;return this.destroyed||(O=this.readableEnded?null:new L,this.destroy(O)),new u((M,be)=>S(this,_e=>_e&&_e!==O?be(_e):M(null)))},le.prototype.push=function(O,M){return Re(this,O,M,!1)},le.prototype.unshift=function(O,M){return Re(this,O,M,!0)};function Re(O,M,be,_e){m("readableAddChunk",M);const ve=O._readableState;let Qe;if((ve.state&H)===0&&(typeof M=="string"?(be=be||ve.defaultEncoding,ve.encoding!==be&&(_e&&ve.encoding?M=v.from(M,be).toString(ve.encoding):(M=v.from(M,be),be=""))):M instanceof v?be="":_._isUint8Array(M)?(M=_._uint8ArrayToBuffer(M),be=""):M!=null&&(Qe=new B("chunk",["string","Buffer","Uint8Array"],M))),Qe)w(O,Qe);else if(M===null)ve.state&=~ue,f(O,ve);else if((ve.state&H)!==0||M&&M.length>0)if(_e)if((ve.state&Q)!==0)w(O,new D);else{if(ve.destroyed||ve.errored)return!1;ze(O,ve,M,!0)}else if(ve.ended)w(O,new q);else{if(ve.destroyed||ve.errored)return!1;ve.state&=~ue,ve.decoder&&!be?(M=ve.decoder.write(M),ve.objectMode||M.length!==0?ze(O,ve,M,!1):X(O,ve)):ze(O,ve,M,!1)}else _e||(ve.state&=~ue,X(O,ve));return!ve.ended&&(ve.length<ve.highWaterMark||ve.length===0)}function ze(O,M,be,_e){M.flowing&&M.length===0&&!M.sync&&O.listenerCount("data")>0?((M.state&pe)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,O.emit("data",be)):(M.length+=M.objectMode?1:be.length,_e?M.buffer.unshift(be):M.buffer.push(be),(M.state&z)!==0&&p(O)),X(O,M)}le.prototype.isPaused=function(){const O=this._readableState;return O[T]===!0||O.flowing===!1},le.prototype.setEncoding=function(O){const M=new Z(O);this._readableState.decoder=M,this._readableState.encoding=this._readableState.decoder.encoding;const be=this._readableState.buffer;let _e="";for(const ve of be)_e+=M.write(ve);return be.clear(),_e!==""&&be.push(_e),this._readableState.length=_e.length,this};const Ie=1073741824;function Xe(O){if(O>Ie)throw new F("size","<= 1GiB",O);return O--,O|=O>>>1,O|=O>>>2,O|=O>>>4,O|=O>>>8,O|=O>>>16,O++,O}function I(O,M){return O<=0||M.length===0&&M.ended?0:(M.state&H)!==0?1:n(O)?M.flowing&&M.length?M.buffer.first().length:M.length:O<=M.length?O:M.ended?M.length:0}le.prototype.read=function(O){m("read",O),O===void 0?O=NaN:t(O)||(O=i(O,10));const M=this._readableState,be=O;if(O>M.highWaterMark&&(M.highWaterMark=Xe(O)),O!==0&&(M.state&=~U),O===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?He(this):p(this),null;if(O=I(O,M),O===0&&M.ended)return M.length===0&&He(this),null;let _e=(M.state&z)!==0;if(m("need readable",_e),(M.length===0||M.length-O<M.highWaterMark)&&(_e=!0,m("length less than watermark",_e)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)_e=!1,m("reading, ended or constructing",_e);else if(_e){m("do read"),M.state|=ue|G,M.length===0&&(M.state|=z);try{this._read(M.highWaterMark)}catch(Qe){w(this,Qe)}M.state&=~G,M.reading||(O=I(be,M))}let ve;return O>0?ve=qe(O,M):ve=null,ve===null?(M.needReadable=M.length<=M.highWaterMark,O=0):(M.length-=O,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),be!==O&&M.ended&&He(this)),ve!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",ve)),ve};function f(O,M){if(m("onEofChunk"),!M.ended){if(M.decoder){const be=M.decoder.end();be&&be.length&&(M.buffer.push(be),M.length+=M.objectMode?1:be.length)}M.ended=!0,M.sync?p(O):(M.needReadable=!1,M.emittedReadable=!0,$(O))}}function p(O){const M=O._readableState;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick($,O))}function $(O){const M=O._readableState;m("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(O.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,De(O)}function X(O,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(oe,O,M))}function oe(O,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const be=M.length;if(m("maybeReadMore read 0"),O.read(0),be===M.length)break}M.readingMore=!1}le.prototype._read=function(O){throw new R("_read()")},le.prototype.pipe=function(O,M){const be=this,_e=this._readableState;_e.pipes.length===1&&(_e.multiAwaitDrain||(_e.multiAwaitDrain=!0,_e.awaitDrainWriters=new l(_e.awaitDrainWriters?[_e.awaitDrainWriters]:[]))),_e.pipes.push(O),m("pipe count=%d opts=%j",_e.pipes.length,M);const Qe=(!M||M.end!==!1)&&O!==r.stdout&&O!==r.stderr?On:P;_e.endEmitted?r.nextTick(Qe):be.once("end",Qe),O.on("unpipe",Ye);function Ye(ne,ie){m("onunpipe"),ne===be&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,Rt())}function On(){m("onend"),O.end()}let Nt,Cn=!1;function Rt(){m("cleanup"),O.removeListener("close",Br),O.removeListener("finish",We),Nt&&O.removeListener("drain",Nt),O.removeListener("error",yr),O.removeListener("unpipe",Ye),be.removeListener("end",On),be.removeListener("end",P),be.removeListener("data",mr),Cn=!0,Nt&&_e.awaitDrainWriters&&(!O._writableState||O._writableState.needDrain)&&Nt()}function Mr(){Cn||(_e.pipes.length===1&&_e.pipes[0]===O?(m("false write response, pause",0),_e.awaitDrainWriters=O,_e.multiAwaitDrain=!1):_e.pipes.length>1&&_e.pipes.includes(O)&&(m("false write response, pause",_e.awaitDrainWriters.size),_e.awaitDrainWriters.add(O)),be.pause()),Nt||(Nt=de(be,O),O.on("drain",Nt))}be.on("data",mr);function mr(ne){m("ondata");const ie=O.write(ne);m("dest.write",ie),ie===!1&&Mr()}function yr(ne){if(m("onerror",ne),P(),O.removeListener("error",yr),O.listenerCount("error")===0){const ie=O._writableState||O._readableState;ie&&!ie.errorEmitted?w(O,ne):O.emit("error",ne)}}E(O,"error",yr);function Br(){O.removeListener("finish",We),P()}O.once("close",Br);function We(){m("onfinish"),O.removeListener("close",Br),P()}O.once("finish",We);function P(){m("unpipe"),be.unpipe(O)}return O.emit("pipe",be),O.writableNeedDrain===!0?Mr():_e.flowing||(m("pipe resume"),be.resume()),O};function de(O,M){return function(){const _e=O._readableState;_e.awaitDrainWriters===M?(m("pipeOnDrain",1),_e.awaitDrainWriters=null):_e.multiAwaitDrain&&(m("pipeOnDrain",_e.awaitDrainWriters.size),_e.awaitDrainWriters.delete(M)),(!_e.awaitDrainWriters||_e.awaitDrainWriters.size===0)&&O.listenerCount("data")&&O.resume()}}le.prototype.unpipe=function(O){const M=this._readableState,be={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!O){const ve=M.pipes;M.pipes=[],this.pause();for(let Qe=0;Qe<ve.length;Qe++)ve[Qe].emit("unpipe",this,{hasUnpiped:!1});return this}const _e=e(M.pipes,O);return _e===-1?this:(M.pipes.splice(_e,1),M.pipes.length===0&&this.pause(),O.emit("unpipe",this,be),this)},le.prototype.on=function(O,M){const be=_.prototype.on.call(this,O,M),_e=this._readableState;return O==="data"?(_e.readableListening=this.listenerCount("readable")>0,_e.flowing!==!1&&this.resume()):O==="readable"&&!_e.endEmitted&&!_e.readableListening&&(_e.readableListening=_e.needReadable=!0,_e.flowing=!1,_e.emittedReadable=!1,m("on readable",_e.length,_e.reading),_e.length?p(this):_e.reading||r.nextTick(ke,this)),be},le.prototype.addListener=le.prototype.on,le.prototype.removeListener=function(O,M){const be=_.prototype.removeListener.call(this,O,M);return O==="readable"&&r.nextTick(Ee,this),be},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(O){const M=_.prototype.removeAllListeners.apply(this,arguments);return(O==="readable"||O===void 0)&&r.nextTick(Ee,this),M};function Ee(O){const M=O._readableState;M.readableListening=O.listenerCount("readable")>0,M.resumeScheduled&&M[T]===!1?M.flowing=!0:O.listenerCount("data")>0?O.resume():M.readableListening||(M.flowing=null)}function ke(O){m("readable nexttick read 0"),O.read(0)}le.prototype.resume=function(){const O=this._readableState;return O.flowing||(m("resume"),O.flowing=!O.readableListening,Le(this,O)),O[T]=!1,this};function Le(O,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(Oe,O,M))}function Oe(O,M){m("resume",M.reading),M.reading||O.read(0),M.resumeScheduled=!1,O.emit("resume"),De(O),M.flowing&&!M.reading&&O.read(0)}le.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[T]=!0,this};function De(O){const M=O._readableState;for(m("flow",M.flowing);M.flowing&&O.read()!==null;);}le.prototype.wrap=function(O){let M=!1;O.on("data",_e=>{!this.push(_e)&&O.pause&&(M=!0,O.pause())}),O.on("end",()=>{this.push(null)}),O.on("error",_e=>{w(this,_e)}),O.on("close",()=>{this.destroy()}),O.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&O.resume&&(M=!1,O.resume())};const be=a(O);for(let _e=1;_e<be.length;_e++){const ve=be[_e];this[ve]===void 0&&typeof O[ve]=="function"&&(this[ve]=O[ve].bind(O))}return this},le.prototype[d]=function(){return yt(this)},le.prototype.iterator=function(O){return O!==void 0&&te(O,"options"),yt(this,O)};function yt(O,M){typeof O.read!="function"&&(O=le.wrap(O,{objectMode:!0}));const be=Pt(O,M);return be.stream=O,be}async function*Pt(O,M){let be=Y;function _e(Ye){this===O?(be(),be=Y):be=Ye}O.on("readable",_e);let ve;const Qe=S(O,{writable:!1},Ye=>{ve=Ye?A(ve,Ye):null,be(),be=Y});try{for(;;){const Ye=O.destroyed?null:O.read();if(Ye!==null)yield Ye;else{if(ve)throw ve;if(ve===null)return;await new u(_e)}}}catch(Ye){throw ve=A(ve,Ye),ve}finally{(ve||M?.destroyOnReturn!==!1)&&(ve===void 0||O._readableState.autoDestroy)?g.destroyer(O,null):(O.off("readable",_e),Qe())}}s(le.prototype,{readable:{__proto__:null,get(){const O=this._readableState;return!!O&&O.readable!==!1&&!O.destroyed&&!O.errorEmitted&&!O.endEmitted},set(O){this._readableState&&(this._readableState.readable=!!O)}},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(O){this._readableState&&(this._readableState.flowing=O)}},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(O){this._readableState&&(this._readableState.destroyed=O)}},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[T]!==!1},set(O){this[T]=!!O}}}),le._fromList=qe;function qe(O,M){if(M.length===0)return null;let be;return M.objectMode?be=M.buffer.shift():!O||O>=M.length?(M.decoder?be=M.buffer.join(""):M.buffer.length===1?be=M.buffer.first():be=M.buffer.concat(M.length),M.buffer.clear()):be=M.buffer.consume(O,M.decoder),be}function He(O){const M=O._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Ln,M,O))}function Ln(O,M){if(m("endReadableNT",O.endEmitted,O.length),!O.errored&&!O.closeEmitted&&!O.endEmitted&&O.length===0){if(O.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(Mt,M);else if(O.autoDestroy){const be=M._writableState;(!be||be.autoDestroy&&(be.finished||be.writable===!1))&&M.destroy()}}}function Mt(O){O.writable&&!O.writableEnded&&!O.destroyed&&O.end()}le.from=function(O,M){return k(le,O,M)};let gr;function Pr(){return gr===void 0&&(gr={}),gr}return le.fromWeb=function(O,M){return Pr().newStreamReadableFromReadableStream(O,M)},le.toWeb=function(O,M){return Pr().newReadableStreamFromStreamReadable(O,M)},le.wrap=function(O,M){var be,_e;return new le({objectMode:(be=(_e=O.readableObjectMode)!==null&&_e!==void 0?_e:O.objectMode)!==null&&be!==void 0?be:!0,...M,destroy(ve,Qe){g.destroyer(O,ve),Qe(ve)}}).wrap(O)},Fi}var ki,So;function ba(){if(So)return ki;So=1;const r=pr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:u,SymbolHasInstance:l}=Be();ki=te,te.WritableState=D;const{EventEmitter:c}=ai(),d=ya().Stream,{Buffer:b}=Ct(),y=jr(),{addAbortSignal:_}=oi(),{getHighWaterMark:E,getDefaultHighWaterMark:v}=li(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:h,ERR_STREAM_DESTROYED:g,ERR_STREAM_ALREADY_FINISHED:N,ERR_STREAM_NULL_VALUES:C,ERR_STREAM_WRITE_AFTER_END:A,ERR_UNKNOWN_ENCODING:B}=it().codes,{errorOrDestroy:R}=y;a(te.prototype,d.prototype),a(te,d);function F(){}const q=u("kOnFinished");function D(j,W,se){typeof se!="boolean"&&(se=W instanceof Lt()),this.objectMode=!!(j&&j.objectMode),se&&(this.objectMode=this.objectMode||!!(j&&j.writableObjectMode)),this.highWaterMark=j?E(this,j,"writableHighWaterMark",se):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const he=!!(j&&j.decodeStrings===!1);this.decodeStrings=!he,this.defaultEncoding=j&&j.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=w.bind(void 0,W),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,L(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!j||j.emitClose!==!1,this.autoDestroy=!j||j.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function L(j){j.buffered=[],j.bufferedIndex=0,j.allBuffers=!0,j.allNoop=!0}D.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(D.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function te(j){const W=this instanceof Lt();if(!W&&!n(te,this))return new te(j);this._writableState=new D(j,this,W),j&&(typeof j.write=="function"&&(this._write=j.write),typeof j.writev=="function"&&(this._writev=j.writev),typeof j.destroy=="function"&&(this._destroy=j.destroy),typeof j.final=="function"&&(this._final=j.final),typeof j.construct=="function"&&(this._construct=j.construct),j.signal&&_(j.signal,this)),d.call(this,j),y.construct(this,()=>{const se=this._writableState;se.writing||ue(this,se),U(this,se)})}i(te,l,{__proto__:null,value:function(j){return n(this,j)?!0:this!==te?!1:j&&j._writableState instanceof D}}),te.prototype.pipe=function(){R(this,new h)};function T(j,W,se,he){const pe=j._writableState;if(typeof se=="function")he=se,se=pe.defaultEncoding;else{if(!se)se=pe.defaultEncoding;else if(se!=="buffer"&&!b.isEncoding(se))throw new B(se);typeof he!="function"&&(he=F)}if(W===null)throw new C;if(!pe.objectMode)if(typeof W=="string")pe.decodeStrings!==!1&&(W=b.from(W,se),se="buffer");else if(W instanceof b)se="buffer";else if(d._isUint8Array(W))W=d._uint8ArrayToBuffer(W),se="buffer";else throw new x("chunk",["string","Buffer","Uint8Array"],W);let me;return pe.ending?me=new A:pe.destroyed&&(me=new g("write")),me?(r.nextTick(he,me),R(j,me,!0),me):(pe.pendingcb++,Z(j,pe,W,se,he))}te.prototype.write=function(j,W,se){return T(this,j,W,se)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const j=this._writableState;j.corked&&(j.corked--,j.writing||ue(this,j))},te.prototype.setDefaultEncoding=function(W){if(typeof W=="string"&&(W=o(W)),!b.isEncoding(W))throw new B(W);return this._writableState.defaultEncoding=W,this};function Z(j,W,se,he,pe){const me=W.objectMode?1:se.length;W.length+=me;const J=W.length<W.highWaterMark;return J||(W.needDrain=!0),W.writing||W.corked||W.errored||!W.constructed?(W.buffered.push({chunk:se,encoding:he,callback:pe}),W.allBuffers&&he!=="buffer"&&(W.allBuffers=!1),W.allNoop&&pe!==F&&(W.allNoop=!1)):(W.writelen=me,W.writecb=pe,W.writing=!0,W.sync=!0,j._write(se,he,W.onwrite),W.sync=!1),J&&!W.errored&&!W.destroyed}function k(j,W,se,he,pe,me,J){W.writelen=he,W.writecb=J,W.writing=!0,W.sync=!0,W.destroyed?W.onwrite(new g("write")):se?j._writev(pe,W.onwrite):j._write(pe,me,W.onwrite),W.sync=!1}function Y(j,W,se,he){--W.pendingcb,he(se),Q(W),R(j,se)}function w(j,W){const se=j._writableState,he=se.sync,pe=se.writecb;if(typeof pe!="function"){R(j,new m);return}se.writing=!1,se.writecb=null,se.length-=se.writelen,se.writelen=0,W?(W.stack,se.errored||(se.errored=W),j._readableState&&!j._readableState.errored&&(j._readableState.errored=W),he?r.nextTick(Y,j,se,W,pe):Y(j,se,W,pe)):(se.buffered.length>se.bufferedIndex&&ue(j,se),he?se.afterWriteTickInfo!==null&&se.afterWriteTickInfo.cb===pe?se.afterWriteTickInfo.count++:(se.afterWriteTickInfo={count:1,cb:pe,stream:j,state:se},r.nextTick(H,se.afterWriteTickInfo)):K(j,se,1,pe))}function H({stream:j,state:W,count:se,cb:he}){return W.afterWriteTickInfo=null,K(j,W,se,he)}function K(j,W,se,he){for(!W.ending&&!j.destroyed&&W.length===0&&W.needDrain&&(W.needDrain=!1,j.emit("drain"));se-- >0;)W.pendingcb--,he();W.destroyed&&Q(W),U(j,W)}function Q(j){if(j.writing)return;for(let pe=j.bufferedIndex;pe<j.buffered.length;++pe){var W;const{chunk:me,callback:J}=j.buffered[pe],ce=j.objectMode?1:me.length;j.length-=ce,J((W=j.errored)!==null&&W!==void 0?W:new g("write"))}const se=j[q].splice(0);for(let pe=0;pe<se.length;pe++){var he;se[pe]((he=j.errored)!==null&&he!==void 0?he:new g("end"))}L(j)}function ue(j,W){if(W.corked||W.bufferProcessing||W.destroyed||!W.constructed)return;const{buffered:se,bufferedIndex:he,objectMode:pe}=W,me=se.length-he;if(!me)return;let J=he;if(W.bufferProcessing=!0,me>1&&j._writev){W.pendingcb-=me-1;const ce=W.allNoop?F:le=>{for(let Re=J;Re<se.length;++Re)se[Re].callback(le)},ye=W.allNoop&&J===0?se:e(se,J);ye.allBuffers=W.allBuffers,k(j,W,!0,W.length,ye,"",ce),L(W)}else{do{const{chunk:ce,encoding:ye,callback:le}=se[J];se[J++]=null;const Re=pe?1:ce.length;k(j,W,!1,Re,ce,ye,le)}while(J<se.length&&!W.writing);J===se.length?L(W):J>256?(se.splice(0,J),W.bufferedIndex=0):W.bufferedIndex=J}W.bufferProcessing=!1}te.prototype._write=function(j,W,se){if(this._writev)this._writev([{chunk:j,encoding:W}],se);else throw new S("_write()")},te.prototype._writev=null,te.prototype.end=function(j,W,se){const he=this._writableState;typeof j=="function"?(se=j,j=null,W=null):typeof W=="function"&&(se=W,W=null);let pe;if(j!=null){const me=T(this,j,W);me instanceof t&&(pe=me)}return he.corked&&(he.corked=1,this.uncork()),pe||(!he.errored&&!he.ending?(he.ending=!0,U(this,he,!0),he.ended=!0):he.finished?pe=new N("end"):he.destroyed&&(pe=new g("end"))),typeof se=="function"&&(pe||he.finished?r.nextTick(se,pe):he[q].push(se)),this};function V(j){return j.ending&&!j.destroyed&&j.constructed&&j.length===0&&!j.errored&&j.buffered.length===0&&!j.finished&&!j.writing&&!j.errorEmitted&&!j.closeEmitted}function G(j,W){let se=!1;function he(pe){if(se){R(j,pe??m());return}if(se=!0,W.pendingcb--,pe){const me=W[q].splice(0);for(let J=0;J<me.length;J++)me[J](pe);R(j,pe,W.sync)}else V(W)&&(W.prefinished=!0,j.emit("prefinish"),W.pendingcb++,r.nextTick(ee,j,W))}W.sync=!0,W.pendingcb++;try{j._final(he)}catch(pe){he(pe)}W.sync=!1}function z(j,W){!W.prefinished&&!W.finalCalled&&(typeof j._final=="function"&&!W.destroyed?(W.finalCalled=!0,G(j,W)):(W.prefinished=!0,j.emit("prefinish")))}function U(j,W,se){V(W)&&(z(j,W),W.pendingcb===0&&(se?(W.pendingcb++,r.nextTick((he,pe)=>{V(pe)?ee(he,pe):pe.pendingcb--},j,W)):V(W)&&(W.pendingcb++,ee(j,W))))}function ee(j,W){W.pendingcb--,W.finished=!0;const se=W[q].splice(0);for(let he=0;he<se.length;he++)se[he]();if(j.emit("finish"),W.autoDestroy){const he=j._readableState;(!he||he.autoDestroy&&(he.endEmitted||he.readable===!1))&&j.destroy()}}s(te.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(j){this._writableState&&(this._writableState.destroyed=j)}},writable:{__proto__:null,get(){const j=this._writableState;return!!j&&j.writable!==!1&&!j.destroyed&&!j.errored&&!j.ending&&!j.ended},set(j){this._writableState&&(this._writableState.writable=!!j)}},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(){const j=this._writableState;return j?!j.destroyed&&!j.ending&&j.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)}}});const re=y.destroy;te.prototype.destroy=function(j,W){const se=this._writableState;return!se.destroyed&&(se.bufferedIndex<se.buffered.length||se[q].length)&&r.nextTick(Q,se),re.call(this,j,W),this},te.prototype._undestroy=y.undestroy,te.prototype._destroy=function(j,W){W(j)},te.prototype[c.captureRejectionSymbol]=function(j){this.destroy(j)};let fe;function ge(){return fe===void 0&&(fe={}),fe}return te.fromWeb=function(j,W){return ge().newStreamWritableFromWritableStream(j,W)},te.toWeb=function(j){return ge().newWritableStreamFromStreamWritable(j)},ki}var Pi,Io;function Id(){if(Io)return Pi;Io=1;const r=pr(),e=Ct(),{isReadable:t,isWritable:n,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:u,isReadableStream:l,isWritableStream:c}=jt(),d=zt(),{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:y,ERR_INVALID_RETURN_VALUE:_}}=it(),{destroyer:E}=jr(),v=Lt(),x=ui(),S=ba(),{createDeferredPromise:m}=at(),h=ec(),g=globalThis.Blob||e.Blob,N=typeof g<"u"?function(D){return D instanceof g}:function(D){return!1},C=globalThis.AbortController||xn().AbortController,{FunctionPrototypeCall:A}=Be();class B extends v{constructor(D){super(D),D?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),D?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Pi=function q(D,L){if(u(D))return D;if(a(D))return F({readable:D});if(o(D))return F({writable:D});if(s(D))return F({writable:!1,readable:!1});if(l(D))return F({readable:x.fromWeb(D)});if(c(D))return F({writable:S.fromWeb(D)});if(typeof D=="function"){const{value:T,write:Z,final:k,destroy:Y}=R(D);if(i(T))return h(B,T,{objectMode:!0,write:Z,final:k,destroy:Y});const w=T?.then;if(typeof w=="function"){let H;const K=A(w,T,Q=>{if(Q!=null)throw new _("nully","body",Q)},Q=>{E(H,Q)});return H=new B({objectMode:!0,readable:!1,write:Z,final(Q){k(async()=>{try{await K,r.nextTick(Q,null)}catch(ue){r.nextTick(Q,ue)}})},destroy:Y})}throw new _("Iterable, AsyncIterable or AsyncFunction",L,T)}if(N(D))return q(D.arrayBuffer());if(i(D))return h(B,D,{objectMode:!0,writable:!1});if(l(D?.readable)&&c(D?.writable))return B.fromWeb(D);if(typeof D?.writable=="object"||typeof D?.readable=="object"){const T=D!=null&&D.readable?a(D?.readable)?D?.readable:q(D.readable):void 0,Z=D!=null&&D.writable?o(D?.writable)?D?.writable:q(D.writable):void 0;return F({readable:T,writable:Z})}const te=D?.then;if(typeof te=="function"){let T;return A(te,D,Z=>{Z!=null&&T.push(Z),T.push(null)},Z=>{E(T,Z)}),T=new B({objectMode:!0,writable:!1,read(){}})}throw new y(L,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],D)};function R(q){let{promise:D,resolve:L}=m();const te=new C,T=te.signal;return{value:q(async function*(){for(;;){const k=D;D=null;const{chunk:Y,done:w,cb:H}=await k;if(r.nextTick(H),w)return;if(T.aborted)throw new b(void 0,{cause:T.reason});({promise:D,resolve:L}=m()),yield Y}}(),{signal:T}),write(k,Y,w){const H=L;L=null,H({chunk:k,done:!1,cb:w})},final(k){const Y=L;L=null,Y({done:!0,cb:k})},destroy(k,Y){te.abort(),Y(k)}}}function F(q){const D=q.readable&&typeof q.readable.read!="function"?x.wrap(q.readable):q.readable,L=q.writable;let te=!!t(D),T=!!n(L),Z,k,Y,w,H;function K(Q){const ue=w;w=null,ue?ue(Q):Q&&H.destroy(Q)}return H=new B({readableObjectMode:!!(D!=null&&D.readableObjectMode),writableObjectMode:!!(L!=null&&L.writableObjectMode),readable:te,writable:T}),T&&(d(L,Q=>{T=!1,Q&&E(D,Q),K(Q)}),H._write=function(Q,ue,V){L.write(Q,ue)?V():Z=V},H._final=function(Q){L.end(),k=Q},L.on("drain",function(){if(Z){const Q=Z;Z=null,Q()}}),L.on("finish",function(){if(k){const Q=k;k=null,Q()}})),te&&(d(D,Q=>{te=!1,Q&&E(D,Q),K(Q)}),D.on("readable",function(){if(Y){const Q=Y;Y=null,Q()}}),D.on("end",function(){H.push(null)}),H._read=function(){for(;;){const Q=D.read();if(Q===null){Y=H._read;return}if(!H.push(Q))return}}),H._destroy=function(Q,ue){!Q&&w!==null&&(Q=new b),Y=null,Z=null,k=null,w===null?ue(Q):(w=ue,E(L,Q),E(D,Q))},H}return Pi}var Mi,No;function Lt(){if(No)return Mi;No=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=Be();Mi=a;const i=ui(),s=ba();n(a.prototype,i.prototype),n(a,i);{const c=t(s.prototype);for(let d=0;d<c.length;d++){const b=c[d];a.prototype[b]||(a.prototype[b]=s.prototype[b])}}function a(c){if(!(this instanceof a))return new a(c);i.call(this,c),s.call(this,c),c?(this.allowHalfOpen=c.allowHalfOpen!==!1,c.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),c.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(a.prototype,{writable:{__proto__:null,...e(s.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(s.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(s.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(s.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(s.prototype,"writableLength")},writableFinished:{__proto__:null,...e(s.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(s.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(s.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(s.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(c){this._readableState&&this._writableState&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}});let o;function u(){return o===void 0&&(o={}),o}a.fromWeb=function(c,d){return u().newStreamDuplexFromReadableWritablePair(c,d)},a.toWeb=function(c){return u().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Id()),l(c,"body")},Mi}var Bi,Ro;function tc(){if(Ro)return Bi;Ro=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Bi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=it().codes,n=Lt(),{getHighWaterMark:i}=li();r(a.prototype,n.prototype),r(a,n);const s=e("kCallback");function a(l){if(!(this instanceof a))return new a(l);const c=l?i(this,l,"readableHighWaterMark",!0):null;c===0&&(l={...l,highWaterMark:null,readableHighWaterMark:c,writableHighWaterMark:l.writableHighWaterMark||0}),n.call(this,l),this._readableState.sync=!1,this[s]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",u)}function o(l){typeof this._flush=="function"&&!this.destroyed?this._flush((c,d)=>{if(c){l?l(c):this.destroy(c);return}d!=null&&this.push(d),this.push(null),l&&l()}):(this.push(null),l&&l())}function u(){this._final!==o&&o.call(this)}return a.prototype._final=o,a.prototype._transform=function(l,c,d){throw new t("_transform()")},a.prototype._write=function(l,c,d){const b=this._readableState,y=this._writableState,_=b.length;this._transform(l,c,(E,v)=>{if(E){d(E);return}v!=null&&this.push(v),y.ended||_===b.length||b.length<b.highWaterMark?d():this[s]=d})},a.prototype._read=function(){if(this[s]){const l=this[s];this[s]=null,l()}},Bi}var qi,To;function rc(){if(To)return qi;To=1;const{ObjectSetPrototypeOf:r}=Be();qi=t;const e=tc();r(t.prototype,e.prototype),r(t,e);function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return t.prototype._transform=function(n,i,s){s(null,n)},qi}var Ui,Ao;function _a(){if(Ao)return Ui;Ao=1;const r=pr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=Be(),s=zt(),{once:a}=at(),o=jr(),u=Lt(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:d,ERR_MISSING_ARGS:b,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:E}=it(),{validateFunction:v,validateAbortSignal:x}=Nn(),{isIterable:S,isReadable:m,isReadableNodeStream:h,isNodeStream:g,isTransformStream:N,isWebStream:C,isReadableStream:A,isReadableFinished:B}=jt(),R=globalThis.AbortController||xn().AbortController;let F,q,D;function L(Q,ue,V){let G=!1;Q.on("close",()=>{G=!0});const z=s(Q,{readable:ue,writable:V},U=>{G=!U});return{destroy:U=>{G||(G=!0,o.destroyer(Q,U||new y("pipe")))},cleanup:z}}function te(Q){return v(Q[Q.length-1],"streams[stream.length - 1]"),Q.pop()}function T(Q){if(S(Q))return Q;if(h(Q))return Z(Q);throw new c("val",["Readable","Iterable","AsyncIterable"],Q)}async function*Z(Q){q||(q=ui()),yield*q.prototype[n].call(Q)}async function k(Q,ue,V,{end:G}){let z,U=null;const ee=ge=>{if(ge&&(z=ge),U){const j=U;U=null,j()}},re=()=>new t((ge,j)=>{z?j(z):U=()=>{z?j(z):ge()}});ue.on("drain",ee);const fe=s(ue,{readable:!1},ee);try{ue.writableNeedDrain&&await re();for await(const ge of Q)ue.write(ge)||await re();G&&(ue.end(),await re()),V()}catch(ge){V(z!==ge?l(z,ge):ge)}finally{fe(),ue.off("drain",ee)}}async function Y(Q,ue,V,{end:G}){N(ue)&&(ue=ue.writable);const z=ue.getWriter();try{for await(const U of Q)await z.ready,z.write(U).catch(()=>{});await z.ready,G&&await z.close(),V()}catch(U){try{await z.abort(U),V(U)}catch(ee){V(ee)}}}function w(...Q){return H(Q,a(te(Q)))}function H(Q,ue,V){if(Q.length===1&&e(Q[0])&&(Q=Q[0]),Q.length<2)throw new b("streams");const G=new R,z=G.signal,U=V?.signal,ee=[];x(U,"options.signal");function re(){pe(new E)}D=D||at().addAbortListener;let fe;U&&(fe=D(U,re));let ge,j;const W=[];let se=0;function he(ye){pe(ye,--se===0)}function pe(ye,le){var Re;if(ye&&(!ge||ge.code==="ERR_STREAM_PREMATURE_CLOSE")&&(ge=ye),!(!ge&&!le)){for(;W.length;)W.shift()(ge);(Re=fe)===null||Re===void 0||Re[i](),G.abort(),le&&(ge||ee.forEach(ze=>ze()),r.nextTick(ue,ge,j))}}let me;for(let ye=0;ye<Q.length;ye++){const le=Q[ye],Re=ye<Q.length-1,ze=ye>0,Ie=Re||V?.end!==!1,Xe=ye===Q.length-1;if(g(le)){let I=function(f){f&&f.name!=="AbortError"&&f.code!=="ERR_STREAM_PREMATURE_CLOSE"&&he(f)};if(Ie){const{destroy:f,cleanup:p}=L(le,Re,ze);W.push(f),m(le)&&Xe&&ee.push(p)}le.on("error",I),m(le)&&Xe&&ee.push(()=>{le.removeListener("error",I)})}if(ye===0)if(typeof le=="function"){if(me=le({signal:z}),!S(me))throw new d("Iterable, AsyncIterable or Stream","source",me)}else S(le)||h(le)||N(le)?me=le:me=u.from(le);else if(typeof le=="function"){if(N(me)){var J;me=T((J=me)===null||J===void 0?void 0:J.readable)}else me=T(me);if(me=le(me,{signal:z}),Re){if(!S(me,!0))throw new d("AsyncIterable",`transform[${ye-1}]`,me)}else{var ce;F||(F=rc());const I=new F({objectMode:!0}),f=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof f=="function")se++,f.call(me,X=>{j=X,X!=null&&I.write(X),Ie&&I.end(),r.nextTick(he)},X=>{I.destroy(X),r.nextTick(he,X)});else if(S(me,!0))se++,k(me,I,he,{end:Ie});else if(A(me)||N(me)){const X=me.readable||me;se++,k(X,I,he,{end:Ie})}else throw new d("AsyncIterable or Promise","destination",me);me=I;const{destroy:p,cleanup:$}=L(me,!1,!0);W.push(p),Xe&&ee.push($)}}else if(g(le)){if(h(me)){se+=2;const I=K(me,le,he,{end:Ie});m(le)&&Xe&&ee.push(I)}else if(N(me)||A(me)){const I=me.readable||me;se++,k(I,le,he,{end:Ie})}else if(S(me))se++,k(me,le,he,{end:Ie});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(C(le)){if(h(me))se++,Y(T(me),le,he,{end:Ie});else if(A(me)||S(me))se++,Y(me,le,he,{end:Ie});else if(N(me))se++,Y(me.readable,le,he,{end:Ie});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else me=u.from(le)}return(z!=null&&z.aborted||U!=null&&U.aborted)&&r.nextTick(re),me}function K(Q,ue,V,{end:G}){let z=!1;if(ue.on("close",()=>{z||V(new _)}),Q.pipe(ue,{end:!1}),G){let U=function(){z=!0,ue.end()};B(Q)?r.nextTick(U):Q.once("end",U)}else V();return s(Q,{readable:!0,writable:!1},U=>{const ee=Q._readableState;U&&U.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?Q.once("end",V).once("error",V):V(U)}),s(ue,{readable:!1,writable:!0},V)}return Ui={pipelineImpl:H,pipeline:w},Ui}var Hi,Do;function nc(){if(Do)return Hi;Do=1;const{pipeline:r}=_a(),e=Lt(),{destroyer:t}=jr(),{isNodeStream:n,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:u,isReadableStream:l}=jt(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:d,ERR_MISSING_ARGS:b}}=it(),y=zt();return Hi=function(...E){if(E.length===0)throw new b("streams");if(E.length===1)return e.from(E[0]);const v=[...E];if(typeof E[0]=="function"&&(E[0]=e.from(E[0])),typeof E[E.length-1]=="function"){const F=E.length-1;E[F]=e.from(E[F])}for(let F=0;F<E.length;++F)if(!(!n(E[F])&&!a(E[F]))){if(F<E.length-1&&!(i(E[F])||l(E[F])||o(E[F])))throw new d(`streams[${F}]`,v[F],"must be readable");if(F>0&&!(s(E[F])||u(E[F])||o(E[F])))throw new d(`streams[${F}]`,v[F],"must be writable")}let x,S,m,h,g;function N(F){const q=h;h=null,q?q(F):F?g.destroy(F):!R&&!B&&g.destroy()}const C=E[0],A=r(E,N),B=!!(s(C)||u(C)||o(C)),R=!!(i(A)||l(A)||o(A));if(g=new e({writableObjectMode:!!(C!=null&&C.writableObjectMode),readableObjectMode:!!(A!=null&&A.readableObjectMode),writable:B,readable:R}),B){if(n(C))g._write=function(q,D,L){C.write(q,D)?L():x=L},g._final=function(q){C.end(),S=q},C.on("drain",function(){if(x){const q=x;x=null,q()}});else if(a(C)){const D=(o(C)?C.writable:C).getWriter();g._write=async function(L,te,T){try{await D.ready,D.write(L).catch(()=>{}),T()}catch(Z){T(Z)}},g._final=async function(L){try{await D.ready,D.close().catch(()=>{}),S=L}catch(te){L(te)}}}const F=o(A)?A.readable:A;y(F,()=>{if(S){const q=S;S=null,q()}})}if(R){if(n(A))A.on("readable",function(){if(m){const F=m;m=null,F()}}),A.on("end",function(){g.push(null)}),g._read=function(){for(;;){const F=A.read();if(F===null){m=g._read;return}if(!g.push(F))return}};else if(a(A)){const q=(o(A)?A.readable:A).getReader();g._read=async function(){for(;;)try{const{value:D,done:L}=await q.read();if(!g.push(D))return;if(L){g.push(null);return}}catch{return}}}}return g._destroy=function(F,q){!F&&h!==null&&(F=new c),m=null,x=null,S=null,h===null?q(F):(h=q,n(A)&&t(A,F))},g},Hi}var Lo;function Nd(){if(Lo)return Mn;Lo=1;const r=globalThis.AbortController||xn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:n,ERR_OUT_OF_RANGE:i},AbortError:s}=it(),{validateAbortSignal:a,validateInteger:o,validateObject:u}=Nn(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:d}=zt(),b=nc(),{addAbortSignalNoValidate:y}=oi(),{isWritable:_,isNodeStream:E}=jt(),{deprecate:v}=at(),{ArrayPrototypePush:x,Boolean:S,MathFloor:m,Number:h,NumberIsNaN:g,Promise:N,PromiseReject:C,PromiseResolve:A,PromisePrototypeThen:B,Symbol:R}=Be(),F=R("kEmpty"),q=R("kEof");function D(U,ee){if(ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),E(U)&&!_(U))throw new e("stream",U,"must be writable");const re=b(this,U);return ee!=null&&ee.signal&&y(ee.signal,re),re}function L(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal");let re=1;ee?.concurrency!=null&&(re=m(ee.concurrency));let fe=re-1;return ee?.highWaterMark!=null&&(fe=m(ee.highWaterMark)),o(re,"options.concurrency",1),o(fe,"options.highWaterMark",0),fe+=re,(async function*(){const j=at().AbortSignalAny([ee?.signal].filter(S)),W=this,se=[],he={signal:j};let pe,me,J=!1,ce=0;function ye(){J=!0,le()}function le(){ce-=1,Re()}function Re(){me&&!J&&ce<re&&se.length<fe&&(me(),me=null)}async function ze(){try{for await(let Ie of W){if(J)return;if(j.aborted)throw new s;try{if(Ie=U(Ie,he),Ie===F)continue;Ie=A(Ie)}catch(Xe){Ie=C(Xe)}ce+=1,B(Ie,le,ye),se.push(Ie),pe&&(pe(),pe=null),!J&&(se.length>=fe||ce>=re)&&await new N(Xe=>{me=Xe})}se.push(q)}catch(Ie){const Xe=C(Ie);B(Xe,le,ye),se.push(Xe)}finally{J=!0,pe&&(pe(),pe=null)}}ze();try{for(;;){for(;se.length>0;){const Ie=await se[0];if(Ie===q)return;if(j.aborted)throw new s;Ie!==F&&(yield Ie),se.shift(),Re()}await new N(Ie=>{pe=Ie})}}finally{J=!0,me&&(me(),me=null)}}).call(this)}function te(U=void 0){return U!=null&&u(U,"options"),U?.signal!=null&&a(U.signal,"options.signal"),(async function*(){let re=0;for await(const ge of this){var fe;if(U!=null&&(fe=U.signal)!==null&&fe!==void 0&&fe.aborted)throw new s({cause:U.signal.reason});yield[re++,ge]}}).call(this)}async function T(U,ee=void 0){for await(const re of w.call(this,U,ee))return!0;return!1}async function Z(U,ee=void 0){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);return!await T.call(this,async(...re)=>!await U(...re),ee)}async function k(U,ee){for await(const re of w.call(this,U,ee))return re}async function Y(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);async function re(fe,ge){return await U(fe,ge),F}for await(const fe of L.call(this,re,ee));}function w(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);async function re(fe,ge){return await U(fe,ge)?fe:F}return L.call(this,re,ee)}class H extends n{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function K(U,ee,re){var fe;if(typeof U!="function")throw new t("reducer",["Function","AsyncFunction"],U);re!=null&&u(re,"options"),re?.signal!=null&&a(re.signal,"options.signal");let ge=arguments.length>1;if(re!=null&&(fe=re.signal)!==null&&fe!==void 0&&fe.aborted){const pe=new s(void 0,{cause:re.signal.reason});throw this.once("error",()=>{}),await d(this.destroy(pe)),pe}const j=new r,W=j.signal;if(re!=null&&re.signal){const pe={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>j.abort(),pe)}let se=!1;try{for await(const pe of this){var he;if(se=!0,re!=null&&(he=re.signal)!==null&&he!==void 0&&he.aborted)throw new s;ge?ee=await U(ee,pe,{signal:W}):(ee=pe,ge=!0)}if(!se&&!ge)throw new H}finally{j.abort()}return ee}async function Q(U){U!=null&&u(U,"options"),U?.signal!=null&&a(U.signal,"options.signal");const ee=[];for await(const fe of this){var re;if(U!=null&&(re=U.signal)!==null&&re!==void 0&&re.aborted)throw new s(void 0,{cause:U.signal.reason});x(ee,fe)}return ee}function ue(U,ee){const re=L.call(this,U,ee);return(async function*(){for await(const ge of re)yield*ge}).call(this)}function V(U){if(U=h(U),g(U))return 0;if(U<0)throw new i("number",">= 0",U);return U}function G(U,ee=void 0){return ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),U=V(U),(async function*(){var fe;if(ee!=null&&(fe=ee.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;for await(const j of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;U--<=0&&(yield j)}}).call(this)}function z(U,ee=void 0){return ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),U=V(U),(async function*(){var fe;if(ee!=null&&(fe=ee.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;for await(const j of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;if(U-- >0&&(yield j),U<=0)return}}).call(this)}return Mn.streamReturningOperators={asIndexedPairs:v(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:ue,map:L,take:z,compose:D},Mn.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:Q,some:T,find:k},Mn}var Vi,Oo;function ic(){if(Oo)return Vi;Oo=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:n,isWebStream:i}=jt(),{pipelineImpl:s}=_a(),{finished:a}=zt();sc();function o(...u){return new e((l,c)=>{let d,b;const y=u[u.length-1];if(y&&typeof y=="object"&&!n(y)&&!t(y)&&!i(y)){const _=r(u);d=_.signal,b=_.end}s(u,(_,E)=>{_?c(_):l(E)},{signal:d,end:b})})}return Vi={finished:a,pipeline:o},Vi}var Co;function sc(){if(Co)return vi.exports;Co=1;const{Buffer:r}=Ct(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=Be(),{promisify:{custom:i}}=at(),{streamReturningOperators:s,promiseReturningOperators:a}=Nd(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=it(),u=nc(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=li(),{pipeline:d}=_a(),{destroyer:b}=jr(),y=zt(),_=ic(),E=jt(),v=vi.exports=ya().Stream;v.isDestroyed=E.isDestroyed,v.isDisturbed=E.isDisturbed,v.isErrored=E.isErrored,v.isReadable=E.isReadable,v.isWritable=E.isWritable,v.Readable=ui();for(const S of t(s)){let h=function(...g){if(new.target)throw o();return v.Readable.from(n(m,this,g))};const m=s[S];e(h,"name",{__proto__:null,value:m.name}),e(h,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}for(const S of t(a)){let h=function(...g){if(new.target)throw o();return n(m,this,g)};const m=a[S];e(h,"name",{__proto__:null,value:m.name}),e(h,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}v.Writable=ba(),v.Duplex=Lt(),v.Transform=tc(),v.PassThrough=rc(),v.pipeline=d;const{addAbortSignal:x}=oi();return v.addAbortSignal=x,v.finished=y,v.destroy=b,v.compose=u,v.setDefaultHighWaterMark=l,v.getDefaultHighWaterMark=c,e(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),e(d,i,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),e(y,i,{__proto__:null,enumerable:!0,get(){return _.finished}}),v.Stream=v,v._isUint8Array=function(m){return m instanceof Uint8Array},v._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},vi.exports}var jo;function ac(){return jo||(jo=1,function(r){const e=sc(),t=ic(),n=e.Readable.destroy;r.exports=e.Readable,r.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,r.exports._isUint8Array=e._isUint8Array,r.exports.isDisturbed=e.isDisturbed,r.exports.isErrored=e.isErrored,r.exports.isReadable=e.isReadable,r.exports.Readable=e.Readable,r.exports.Writable=e.Writable,r.exports.Duplex=e.Duplex,r.exports.Transform=e.Transform,r.exports.PassThrough=e.PassThrough,r.exports.addAbortSignal=e.addAbortSignal,r.exports.finished=e.finished,r.exports.destroy=e.destroy,r.exports.destroy=n,r.exports.pipeline=e.pipeline,r.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),r.exports.Stream=e.Stream,r.exports.default=r.exports}(wi)),wi.exports}var wa=ac();const Gi=Symbol("iter");function gn(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=gn(r[n]||Object.create(null),e[n],t-1);return r}function oc(r,e,t=4){let n=!1;for(const i in r)if(i in e){const s=t===0?null:oc(r[i],e[i],t-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(t===3)return!1}return n}function lc(r,e,t=4){let n=!1;for(const i in r)if(!(i in e))n=n||Object.create(null),n[i]=t===0?null:gn({},r[i],t-1);else if(t!==0){const s=lc(r[i],e[i],t-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(t===3)return!1}return n}class Rd{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||Ne}_termFromId(e){if(e[0]==="."){const 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 dn(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object);let s;return t&&n&&i&&(ia(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${n}.${i}.${s}`:`.${t}.${n}.${i}`]}return this._ids[Ir(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ia(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ir(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))}}class et{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||Ne,this._entityIndex=t.entityIndex||new Rd({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;const t=this._graphs;let n,i;for(const s in t)for(const a in n=t[s].subjects)for(const o in i=n[a])e+=Object.keys(i[o]).length;return this._size=e}_addToIndex(e,t,n,i){const s=e[t]||(e[t]={}),a=s[n]||(s[n]={}),o=i in a;return o||(a[i]=null),!o}_removeFromIndex(e,t,n,i){const s=e[t],a=s[n];delete a[i];for(const o in a)return;delete s[n];for(const o in s)return;delete e[t]}*_findInIndex(e,t,n,i,s,a,o,u){let l,c,d;const b=this._entities,y=this._termFromId(b[u]),_={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const E in e)if(c=e[E]){_[s]=this._termFromId(b[E]),n&&((l=c,c={})[n]=l[n]);for(const v in c)if(d=c[v]){_[a]=this._termFromId(b[v]);const x=i?i in d?[i]:[]:Object.keys(d);for(let S=0;S<x.length;S++)_[o]=this._termFromId(b[x[S]]),yield this._factory.quad(_.subject,_.predicate,_.object,y)}}}_loop(e,t){for(const n in e)t(n)}_loopByKey0(e,t,n){let i,s;if(i=e[t])for(s in i)n(s)}_loopByKey1(e,t,n){let i,s;for(i in e)s=e[i],s[t]&&n(i)}_loopBy2Keys(e,t,n,i){let s,a,o;if((s=e[t])&&(a=s[n]))for(o in a)i(o)}_countInIndex(e,t,n,i){let s=0,a,o,u;t&&((a=e,e={})[t]=a[t]);for(const l in e)if(o=e[l]){n&&((a=o,o={})[n]=a[n]);for(const c in o)(u=o[c])&&(i?i in u&&s++:s+=Object.keys(u).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const 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,i){t||(i=e.graph,n=e.object,t=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,t,n)?(this._addToIndex(s.predicates,t,n,e),this._addToIndex(s.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,i){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:i}=e),!this.readQuads(e,t,n,i).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,n,i){t||({subject:e,predicate:t,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;const s=this._graphs;let a,o,u;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(n=n&&this._termToNumericId(n))||!(a=s[i])||!(o=a.subjects[e])||!(u=o[t])||!(n in u))return!1;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--;for(e in a.subjects)return!0;return delete s[i],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,n,i){const s=new wa.Readable({objectMode:!0}),a=this.readQuads(e,t,n,i);return s._read=o=>{for(;--o>=0;){const{done:u,value:l}=a.next();if(u){s.push(null);return}s.push(l)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,i){return[...this.readQuads(e,t,n,i)]}*readQuads(e,t,n,i){const s=this._getGraphs(i);let a,o,u,l;if(!(e&&!(o=this._termToNumericId(e))||t&&!(u=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(const c in s)(a=s[c])&&(o?l?yield*this._findInIndex(a.objects,l,o,u,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,o,u,null,"subject","predicate","object",c):u?yield*this._findInIndex(a.predicates,u,l,null,"predicate","object","subject",c):l?yield*this._findInIndex(a.objects,l,null,null,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",c))}match(e,t,n,i){return new qt(this,e,t,n,i,{entityIndex:this._entityIndex})}countQuads(e,t,n,i){const s=this._getGraphs(i);let a=0,o,u,l,c;if(e&&!(u=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n)))return 0;for(const d in s)(o=s[d])&&(e?n?a+=this._countInIndex(o.objects,c,u,l):a+=this._countInIndex(o.subjects,u,l,c):t?a+=this._countInIndex(o.predicates,l,c,u):a+=this._countInIndex(o.objects,c,u,l));return a}forEach(e,t,n,i,s){this.some(a=>(e(a,this),!1),t,n,i,s)}every(e,t,n,i,s){return!this.some(a=>!e(a,this),t,n,i,s)}some(e,t,n,i,s){for(const a of this.readQuads(t,n,i,s))if(e(a,this))return!0;return!1}getSubjects(e,t,n){const i=[];return this.forSubjects(s=>{i.push(s)},e,t,n),i}forSubjects(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.predicates,o,u,e):this._loopByKey1(a.subjects,o,e):u?this._loopByKey0(a.objects,u,e):this._loop(a.subjects,e))}getPredicates(e,t,n){const i=[];return this.forPredicates(s=>{i.push(s)},e,t,n),i}forPredicates(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.objects,u,o,e):this._loopByKey0(a.subjects,o,e):u?this._loopByKey1(a.predicates,u,e):this._loop(a.predicates,e))}getObjects(e,t,n){const i=[];return this.forObjects(s=>{i.push(s)},e,t,n),i}forObjects(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.subjects,o,u,e):this._loopByKey1(a.objects,o,e):u?this._loopByKey0(a.predicates,u,e):this._loop(a.objects,e))}getGraphs(e,t,n){const i=[];return this.forGraphs(s=>{i.push(s)},e,t,n),i}forGraphs(e,t,n,i){for(const s in this._graphs)this.some(a=>(e(a.graph),!0),t,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?()=>!0:(o,u)=>{throw new Error(`${o.value} ${u}`)},s=this.getQuads(null,Ke.rdf.rest,Ke.rdf.nil,null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,d;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=this.getQuads(null,null,y,null),E=this.getQuads(y,null,null,null);let v,x=null,S=null,m=null;for(let h=0;h<E.length&&!l;h++)v=E[h],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ke.rdf.first?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ke.rdf.rest?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,d="subject"):l=i(y,"not confined to single graph");for(let h=0;h<_.length&&!l;++h)v=_[h],c?l=i(y,"can't have coreferences"):v.predicate.value===Ke.rdf.rest?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,d="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[d].value]=u)}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof qt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=gn(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof qt&&(e=e.filtered),e===this)return!0;if(!(e instanceof et)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,n=e._graphs;let i,s,a,o,u;for(const l in n){if(!(i=t[l]))return!1;i=i.subjects;for(const c in s=n[l].subjects){if(!(a=i[c]))return!1;for(const d in o=s[c]){if(!(u=a[d]))return!1;for(const b in o[d])if(!(b in u))return!1}}}return!0}deleteMatches(e,t,n,i){for(const s of this.match(e,t,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof qt&&(e=e.filtered),e===this)return new et({entityIndex:this._entityIndex});if(e instanceof et&&e._entityIndex===this._entityIndex){const t=new et({entityIndex:this._entityIndex}),n=lc(this._graphs,e._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof qt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new et({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e instanceof qt&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=gn(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof et&&this._entityIndex===e._entityIndex){const t=new et({entityIndex:this._entityIndex}),n=oc(e._graphs,this._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new et({entityIndex:this._entityIndex});for(const n of this)t.add(e(n,this));return t}reduce(e,t){const n=this.readQuads();let i=t===void 0?n.next().value:t;for(const s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new ma().quadsToString(this)}union(e){const t=new et({entityIndex:this._entityIndex});return t._graphs=gn(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function Et(r,e,t=0){const n=e[t];if(n&&!(n in r))return!1;let i=!1;for(const s in n?{[n]:r[n]}:r){const a=t===2?null:Et(r[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class qt extends wa.Readable{constructor(e,t,n,i,s,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:i,graph:s,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:n,predicate:i,subject:s}=this,a=this._filtered=new et({factory:e._factory,entityIndex:this.options.entityIndex});let o,u,l;if(s&&!(o=a._termToNumericId(s))||i&&!(u=a._termToNumericId(i))||n&&!(l=a._termToNumericId(n)))return a;const c=e._getGraphs(t);for(const d in c){let b,y,_,E;(E=c[d])&&(!o&&u?(y=Et(E.predicates,[u,l,o]))&&(b=Et(E.subjects,[o,u,l]),_=Et(E.objects,[l,o,u])):l?(_=Et(E.objects,[l,o,u]))&&(b=Et(E.subjects,[o,u,l]),y=Et(E.predicates,[u,l,o])):(b=Et(E.subjects,[o,u,l]))&&(y=Et(E.predicates,[u,l,o]),_=Et(E.objects,[l,o,u])),b&&(a._graphs[d]={subjects:b,predicates:y,objects:_}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Gi]&&(this[Gi]=this[Symbol.iterator]());const t=this[Gi];for(;--e>=0;){const{done:n,value:i}=t.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,i){return this.filtered.deleteMatches(e,t,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,i,s){return this.filtered.every(e,t,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,i,s){return this.filtered.forEach(e,t,n,i,s)}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,i,s){return this.filtered.some(e,t,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(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 ma().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,n,i){return new qt(this.filtered,e,t,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Td extends wa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new Ku(e);let n,i;const s={onQuad:(a,o)=>{a&&this.emit("error",a)||o&&this.push(o)},onPrefix:(a,o)=>{this.emit("prefix",a,o)}};e&&e.comments&&(s.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,o)=>{switch(a){case"data":n=o;break;case"end":i=o;break}}},s),this._transform=(a,o,u)=>{n(a),u()},this._flush=a=>{i(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const xe="http://www.w3.org/ns/shacl#",$o="http://datashapes.org/dash#",Gt="http://www.w3.org/2001/XMLSchema#",Ut="http://www.w3.org/1999/02/22-rdf-syntax-ns#",va="http://www.w3.org/2000/01/rdf-schema#",xa="http://www.w3.org/2004/02/skos/core#",Ad="http://www.w3.org/2002/07/owl#",Dd="http://www.w3.org/ns/oa#",Ld="http://purl.org/dc/terms/",Od="http://xmlns.com/foaf/0.1/",mn=Ne.namedNode("loaded-shapes"),Dt=Ne.namedNode("loaded-data"),tt=Ne.namedNode(Ut+"type"),sa=Ne.namedNode(Ld+"conformsTo"),Fo=Ne.namedNode(va+"subClassOf"),Ea=Ne.namedNode(Ad+"imports"),Cd=Ne.namedNode(xa+"broader"),jd=Ne.namedNode(xa+"narrower"),Un=Ne.namedNode(xe+"NodeShape"),$d=Ne.namedNode(xe+"IRI"),Zn=Ne.namedNode(xe+"property"),Sa=Ne.namedNode(xe+"class"),Fd=Ne.namedNode(xe+"node"),Nr=Ne.namedNode(xe+"targetClass"),kd=Ne.namedNode(xe+"nodeKind"),Pd=Ne.namedNode(Gt+"string");function yn(r,e,t=xe,n){let i="";const s=Md(r,e,t,n);return s&&(i=s.value),i}function Md(r,e,t=xe,n){let i;const s=t+e;if(n?.length){for(const a of n)for(const o of r)if(o.predicate.value===s){if(o.object.id.endsWith(`@${a}`))return o.object;o.object.id.indexOf("@")<0?i=o.object:i||(i=o.object)}}else for(const a of r)if(a.predicate.value===s)return a.object;return i}function Bd(r){r.querySelector(".editor")?.focus()}function Rn(r,e){return yn(r,"prefLabel",xa,e)||yn(r,"label",va,e)||yn(r,"name",Od,e)}function uc(r,e,t){const n=[];for(const i of r)n.push({value:i,label:Rn(e.getQuads(i,null,null,null),t),children:[]});return n}function aa(r,e){for(const t in e)r=r.replace(e[t],"");return r}function cc(r,e,t,n,i=new Set){for(const s of e.owlImports)i.has(s.id)||(i.add(s.id),n.push(...t.getSubjects(tt,r,s)));e.parent&&cc(r,e.parent,t,n,i)}function Ia(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return uc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(tt,r,mn);t.push(...e.config.store.getSubjects(tt,r,Dt)),cc(r,e,e.config.store,t);const n=new Map,i=new Map;for(const a of t)n.set(a.id,{value:a,label:Rn(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t){for(const o of e.config.store.getObjects(a,Cd,null))n.has(o.id)&&i.set(a.id,o.id);for(const o of e.config.store.getObjects(a,jd,null))n.has(o.id)&&i.set(o.id,a.id);for(const o of e.config.store.getObjects(a,Fo,null))n.has(o.id)&&i.set(a.id,o.id)}for(const[a,o]of i.entries())n.get(o)?.children?.push(n.get(a));const s=[];for(const[a,o]of n.entries())i.has(a)||s.push(o);for(const a of e.config.store.getSubjects(Fo,r,null))s.push(...Ia(a,e));return s}}function oa(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function ko(r,e,t){if(e===void 0)return t;if(t===void 0)return e;const n=r.indexOf(e.language);if(n<0)return t;const i=r.indexOf(t.language);return i<0||i>n?e:t}function qd(r,{remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?()=>!0:(o,u)=>{throw new Error(`${o.value} ${u}`)},s=r.getQuads(null,Ut+"rest",Ut+"nil",null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,d;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=r.getQuads(null,null,y,null),E=r.getQuads(y,null,null,null).filter(h=>!h.predicate.equals(tt));let v,x=null,S=null,m=null;for(let h=0;h<E.length&&!l;h++)v=E[h],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ut+"first"?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ut+"rest"?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,d="subject"):l=i(y,"not confined to single graph");for(let h=0;h<_.length&&!l;++h)v=_[h],c?l=i(y,"can't have coreferences"):v.predicate.value===Ut+"rest"?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,d="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[d].value]=u)}),e&&r.removeQuads(a),n}function dc(r,e,t){const n=document.createElement("div");n.classList.add("shacl-or-constraint");const i=[];if(e instanceof Wt){const s=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],Zn,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],Zn,null),d=[];let b="";for(const y of c){const _=new ri(y,e,t);d.push(_),b+=(b.length>1?" / ":"")+_.template.label}s.push(d),i.push({label:b,value:l.toString()})}else{const c=new ri(r[l],e,t);s.push([c]),i.push({label:c.template.label,value:l.toString()})}const o=t.theme.createListEditor("Please choose",null,!1,i),u=o.querySelector(".editor");u.onchange=()=>{if(u.value){const l=s[parseInt(u.value)];let c;l.length&&(c=l[0],n.replaceWith(l[0]));for(let d=1;d<l.length;d++)c.after(l[d]),c=l[d]}},n.appendChild(o)}else{const s=[];for(let u=0;u<r.length;u++){const l=t.store.getQuads(r[u],null,null,null);l.length&&(s.push(l),i.push({label:Rn(l,t.languages)||aa(l[0].predicate.value,t.prefixes)+" = "+aa(l[0].object.value,t.prefixes),value:u.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,i,e.template),o=a.querySelector(".editor");o.onchange=()=>{o.value&&n.replaceWith(Xn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function Ud(r,e,t){if(e instanceof ct){const n=e.datatype;for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(a.predicate.value===`${xe}datatype`&&a.object.equals(n))return s}}else{const n=t.store.getObjects(e,tt,null);for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(n.length>0){if(a.predicate.value===`${xe}node`){for(const o of n)if(t.store.getQuads(a.object,Nr,o,null).length>0)return s}if(a.predicate.equals(Sa)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(kd)&&a.object.equals($d))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Hd(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,Zn,null);for(const a of s){const o=t.store.getObjects(a,`${xe}path`,null);for(const u of o)if(i=t.store.countQuads(e,u,null,null)>0,i)break}if(i)return s}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const Vd={[`${xe}name`]:(r,e)=>{const t=e;r.name=ko(r.config.languages,r.name,t)},[`${xe}description`]:(r,e)=>{const t=e;r.description=ko(r.config.languages,r.description,t)},[`${xe}path`]:(r,e)=>{r.path=e.value},[`${xe}node`]:(r,e)=>{r.node=e},[`${xe}datatype`]:(r,e)=>{r.datatype=e},[`${xe}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${xe}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${xe}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${xe}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${xe}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${xe}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${xe}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${xe}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${xe}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${xe}pattern`]:(r,e)=>{r.pattern=e.value},[`${xe}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${$o}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${$o}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Dd}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${xe}and`]:(r,e)=>{r.shaclAnd=e.value},[`${xe}in`]:(r,e)=>{r.shaclIn=e.value},[`${xe}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=Ne.namedNode(Ut+"langString")},[`${xe}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${xe}hasValue`]:(r,e)=>{r.hasValue=e},[`${xe}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${xe}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${xe}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[Ea.id]:(r,e)=>{r.owlImports.push(e)},[Sa.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Nr,e,null);t.length>0&&(r.node=t[0])},[`${xe}or`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",r.config.lists)},[`${xe}xone`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",r.config.lists)}};class Gd{constructor(e,t,n){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=n,this.merge(e),this.qualifiedValueShape&&this.merge(n.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)Vd[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Rn(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?aa(this.path,this.config.prefixes):"unknown"),this.node&&this.extendedShapes.push(this.node),this.shaclAnd){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const n of t)this.extendedShapes.push(n)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const Wd=`form { display:block; --label-width: 8em; --caret-size: 10px; }
26
+ `),this._subject=null),this._write=this._blockedWrite;let t=e&&((n,i)=>{t=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function oo(r){let e=Id[r];return e===void 0&&(r.length===1?(e=r.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Ei={exports:{}},Si={exports:{}},Ii,lo;function Be(){if(lo)return Ii;lo=1;class r extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let n="";for(let i=0;i<t.length;i++)n+=` ${t[i].stack}
27
+ `;super(n),this.name="AggregateError",this.errors=t}}return Ii={AggregateError:r,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:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,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},Ii}var Ni={exports:{}},Ri,uo;function rc(){return uo||(uo=1,Ri={format(r,...e){return r.replace(/%([sdifj])/g,function(...[t,n]){const i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(r){switch(typeof r){case"string":if(r.includes("'"))if(r.includes('"')){if(!r.includes("`")&&!r.includes("${"))return`\`${r}\``}else return`"${r}"`;return`'${r}'`;case"number":return isNaN(r)?"NaN":Object.is(r,-0)?String(r):r;case"bigint":return`${String(r)}n`;case"boolean":case"undefined":return String(r);case"object":return"{}"}}}),Ri}var Ti,co;function it(){if(co)return Ti;co=1;const{format:r,inspect:e}=rc(),{AggregateError:t}=Be(),n=globalThis.AggregateError||t,i=Symbol("kIsNodeError"),s=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,o="__node_internal_",u={};function l(v,x){if(!v)throw new u.ERR_INTERNAL_ASSERTION(x)}function c(v){let x="",S=v.length;const m=v[0]==="-"?1:0;for(;S>=m+4;S-=3)x=`_${v.slice(S-3,S)}${x}`;return`${v.slice(0,S)}${x}`}function h(v,x,S){if(typeof x=="function")return l(x.length<=S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${x.length}).`),x(...S);const m=(x.match(/%[dfijoOs]/g)||[]).length;return l(m===S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${m}).`),S.length===0?x:r(x,...S)}function b(v,x,S){S||(S=Error);class m extends S{constructor(...g){super(h(v,x,g))}toString(){return`${this.name} [${v}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:S.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${v}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=v,m.prototype[i]=!0,u[v]=m}function y(v){const x=o+v.name;return Object.defineProperty(v,"name",{value:x}),v}function _(v,x){if(v&&x&&v!==x){if(Array.isArray(x.errors))return x.errors.push(v),x;const S=new n([x,v],x.message);return S.code=x.code,S}return v||x}class E extends Error{constructor(x="The operation was aborted",S=void 0){if(S!==void 0&&typeof S!="object")throw new u.ERR_INVALID_ARG_TYPE("options","Object",S);super(x,S),this.code="ABORT_ERR",this.name="AbortError"}}return b("ERR_ASSERTION","%s",Error),b("ERR_INVALID_ARG_TYPE",(v,x,S)=>{l(typeof v=="string","'name' must be a string"),Array.isArray(x)||(x=[x]);let m="The ";v.endsWith(" argument")?m+=`${v} `:m+=`"${v}" ${v.includes(".")?"property":"argument"} `,m+="must be ";const d=[],g=[],N=[];for(const A of x)l(typeof A=="string","All expected entries have to be of type string"),s.includes(A)?d.push(A.toLowerCase()):a.test(A)?g.push(A):(l(A!=="object",'The value "object" should be written as "Object"'),N.push(A));if(g.length>0){const A=d.indexOf("object");A!==-1&&(d.splice(d,A,1),g.push("Object"))}if(d.length>0){switch(d.length){case 1:m+=`of type ${d[0]}`;break;case 2:m+=`one of type ${d[0]} or ${d[1]}`;break;default:{const A=d.pop();m+=`one of type ${d.join(", ")}, or ${A}`}}(g.length>0||N.length>0)&&(m+=" or ")}if(g.length>0){switch(g.length){case 1:m+=`an instance of ${g[0]}`;break;case 2:m+=`an instance of ${g[0]} or ${g[1]}`;break;default:{const A=g.pop();m+=`an instance of ${g.join(", ")}, or ${A}`}}N.length>0&&(m+=" or ")}switch(N.length){case 0:break;case 1:N[0].toLowerCase()!==N[0]&&(m+="an "),m+=`${N[0]}`;break;case 2:m+=`one of ${N[0]} or ${N[1]}`;break;default:{const A=N.pop();m+=`one of ${N.join(", ")}, or ${A}`}}if(S==null)m+=`. Received ${S}`;else if(typeof S=="function"&&S.name)m+=`. Received function ${S.name}`;else if(typeof S=="object"){var C;if((C=S.constructor)!==null&&C!==void 0&&C.name)m+=`. Received an instance of ${S.constructor.name}`;else{const A=e(S,{depth:-1});m+=`. Received ${A}`}}else{let A=e(S,{colors:!1});A.length>25&&(A=`${A.slice(0,25)}...`),m+=`. Received type ${typeof S} (${A})`}return m},TypeError),b("ERR_INVALID_ARG_VALUE",(v,x,S="is invalid")=>{let m=e(x);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${v.includes(".")?"property":"argument"} '${v}' ${S}. Received ${m}`},TypeError),b("ERR_INVALID_RETURN_VALUE",(v,x,S)=>{var m;const d=S!=null&&(m=S.constructor)!==null&&m!==void 0&&m.name?`instance of ${S.constructor.name}`:`type ${typeof S}`;return`Expected ${v} to be returned from the "${x}" function but got ${d}.`},TypeError),b("ERR_MISSING_ARGS",(...v)=>{l(v.length>0,"At least one arg needs to be specified");let x;const S=v.length;switch(v=(Array.isArray(v)?v:[v]).map(m=>`"${m}"`).join(" or "),S){case 1:x+=`The ${v[0]} argument`;break;case 2:x+=`The ${v[0]} and ${v[1]} arguments`;break;default:{const m=v.pop();x+=`The ${v.join(", ")}, and ${m} arguments`}break}return`${x} must be specified`},TypeError),b("ERR_OUT_OF_RANGE",(v,x,S)=>{l(x,'Missing "range" argument');let m;if(Number.isInteger(S)&&Math.abs(S)>2**32)m=c(String(S));else if(typeof S=="bigint"){m=String(S);const d=BigInt(2)**BigInt(32);(S>d||S<-d)&&(m=c(m)),m+="n"}else m=e(S);return`The value of "${v}" is out of range. It must be ${x}. Received ${m}`},RangeError),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),b("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),b("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),b("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),b("ERR_STREAM_WRITE_AFTER_END","write after end",Error),b("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Ti={AbortError:E,aggregateTwoErrors:y(_),hideStackFrames:y,codes:u},Ti}var zr={exports:{}},ho;function vn(){if(ho)return zr.exports;ho=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return zr.exports=r,zr.exports.AbortSignal=e,zr.exports.default=r,zr.exports}var kn={exports:{}},fo;function ui(){if(fo)return kn.exports;fo=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(g,N,C){return Function.prototype.apply.call(g,N,C)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:t=function(g){return Object.getOwnPropertyNames(g)};function n(d){console&&console.warn&&console.warn(d)}var i=Number.isNaN||function(g){return g!==g};function s(){s.init.call(this)}kn.exports=s,kn.exports.once=x,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(d){if(typeof d!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof d)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(d){if(typeof d!="number"||d<0||i(d))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+d+".");a=d}}),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(g){if(typeof g!="number"||g<0||i(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function u(d){return d._maxListeners===void 0?s.defaultMaxListeners:d._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(g){for(var N=[],C=1;C<arguments.length;C++)N.push(arguments[C]);var A=g==="error",B=this._events;if(B!==void 0)A=A&&B.error===void 0;else if(!A)return!1;if(A){var R;if(N.length>0&&(R=N[0]),R instanceof Error)throw R;var F=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw F.context=R,F}var q=B[g];if(q===void 0)return!1;if(typeof q=="function")e(q,this,N);else for(var D=q.length,L=_(q,D),C=0;C<D;++C)e(L[C],this,N);return!0};function l(d,g,N,C){var A,B,R;if(o(N),B=d._events,B===void 0?(B=d._events=Object.create(null),d._eventsCount=0):(B.newListener!==void 0&&(d.emit("newListener",g,N.listener?N.listener:N),B=d._events),R=B[g]),R===void 0)R=B[g]=N,++d._eventsCount;else if(typeof R=="function"?R=B[g]=C?[N,R]:[R,N]:C?R.unshift(N):R.push(N),A=u(d),A>0&&R.length>A&&!R.warned){R.warned=!0;var F=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");F.name="MaxListenersExceededWarning",F.emitter=d,F.type=g,F.count=R.length,n(F)}return d}s.prototype.addListener=function(g,N){return l(this,g,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(g,N){return l(this,g,N,!0)};function c(){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 h(d,g,N){var C={fired:!1,wrapFn:void 0,target:d,type:g,listener:N},A=c.bind(C);return A.listener=N,C.wrapFn=A,A}s.prototype.once=function(g,N){return o(N),this.on(g,h(this,g,N)),this},s.prototype.prependOnceListener=function(g,N){return o(N),this.prependListener(g,h(this,g,N)),this},s.prototype.removeListener=function(g,N){var C,A,B,R,F;if(o(N),A=this._events,A===void 0)return this;if(C=A[g],C===void 0)return this;if(C===N||C.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete A[g],A.removeListener&&this.emit("removeListener",g,C.listener||N));else if(typeof C!="function"){for(B=-1,R=C.length-1;R>=0;R--)if(C[R]===N||C[R].listener===N){F=C[R].listener,B=R;break}if(B<0)return this;B===0?C.shift():E(C,B),C.length===1&&(A[g]=C[0]),A.removeListener!==void 0&&this.emit("removeListener",g,F||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(g){var N,C,A;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[g]),this;if(arguments.length===0){var B=Object.keys(C),R;for(A=0;A<B.length;++A)R=B[A],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=C[g],typeof N=="function")this.removeListener(g,N);else if(N!==void 0)for(A=N.length-1;A>=0;A--)this.removeListener(g,N[A]);return this};function b(d,g,N){var C=d._events;if(C===void 0)return[];var A=C[g];return A===void 0?[]:typeof A=="function"?N?[A.listener||A]:[A]:N?v(A):_(A,A.length)}s.prototype.listeners=function(g){return b(this,g,!0)},s.prototype.rawListeners=function(g){return b(this,g,!1)},s.listenerCount=function(d,g){return typeof d.listenerCount=="function"?d.listenerCount(g):y.call(d,g)},s.prototype.listenerCount=y;function y(d){var g=this._events;if(g!==void 0){var N=g[d];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function _(d,g){for(var N=new Array(g),C=0;C<g;++C)N[C]=d[C];return N}function E(d,g){for(;g+1<d.length;g++)d[g]=d[g+1];d.pop()}function v(d){for(var g=new Array(d.length),N=0;N<g.length;++N)g[N]=d[N].listener||d[N];return g}function x(d,g){return new Promise(function(N,C){function A(R){d.removeListener(g,B),C(R)}function B(){typeof d.removeListener=="function"&&d.removeListener("error",A),N([].slice.call(arguments))}m(d,g,B,{once:!0}),g!=="error"&&S(d,A,{once:!0})})}function S(d,g,N){typeof d.on=="function"&&m(d,"error",g,N)}function m(d,g,N,C){if(typeof d.on=="function")C.once?d.once(g,N):d.on(g,N);else if(typeof d.addEventListener=="function")d.addEventListener(g,function A(B){C.once&&d.removeEventListener(g,A),N(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof d)}return kn.exports}var po;function at(){return po||(po=1,function(r){const e=Ct(),{format:t,inspect:n}=rc(),{codes:{ERR_INVALID_ARG_TYPE:i}}=it(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=Be(),u=globalThis.AbortSignal||vn().AbortSignal,l=globalThis.AbortController||vn().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,h=globalThis.Blob||e.Blob,b=typeof h<"u"?function(v){return v instanceof h}:function(v){return!1},y=(E,v)=>{if(E!==void 0&&(E===null||typeof E!="object"||!("aborted"in E)))throw new i(v,"AbortSignal",E)},_=(E,v)=>{if(typeof E!="function")throw new i(v,"Function",E)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(E){let v=!1;return function(...x){v||(v=!0,E.apply(this,x))}},createDeferredPromise:function(){let E,v;return{promise:new Promise((S,m)=>{E=S,v=m}),resolve:E,reject:v}},promisify(E){return new Promise((v,x)=>{E((S,...m)=>S?x(S):v(...m))})},debuglog(){return function(){}},format:t,inspect:n,types:{isAsyncFunction(E){return E instanceof c},isArrayBufferView(E){return ArrayBuffer.isView(E)}},isBlob:b,deprecate(E,v){return E},addAbortListener:ui().addAbortListener||function(v,x){if(v===void 0)throw new i("signal","AbortSignal",v);y(v,"signal"),_(x,"listener");let S;return v.aborted?queueMicrotask(()=>x()):(v.addEventListener("abort",x,{__proto__:null,once:!0,[s]:!0}),S=()=>{v.removeEventListener("abort",x)}),{__proto__:null,[o](){var m;(m=S)===null||m===void 0||m()}}},AbortSignalAny:u.any||function(v){if(v.length===1)return v[0];const x=new l,S=()=>x.abort();return v.forEach(m=>{y(m,"signals"),m.addEventListener("abort",S,{once:!0})}),x.signal.addEventListener("abort",()=>{v.forEach(m=>m.removeEventListener("abort",S))},{once:!0}),x.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(Ni)),Ni.exports}var Pn={},Ai,go;function In(){if(go)return Ai;go=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:n,NumberIsInteger:i,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:o,NumberParseInt:u,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:c,String:h,StringPrototypeToUpperCase:b,StringPrototypeTrim:y}=Be(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:E,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:S,ERR_UNKNOWN_SIGNAL:m}}=it(),{normalizeEncoding:d}=at(),{isAsyncFunction:g,isArrayBufferView:N}=at().types,C={};function A(J){return J===(J|0)}function B(J){return J===J>>>0}const R=/^[0-7]+$/,F="must be a 32-bit unsigned integer or an octal string";function q(J,ce,ye){if(typeof J>"u"&&(J=ye),typeof J=="string"){if(c(R,J)===null)throw new x(ce,J,F);J=u(J,8)}return te(J,ce),J}const D=_((J,ce,ye=o,le=a)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);if(J<ye||J>le)throw new S(ce,`>= ${ye} && <= ${le}`,J)}),L=_((J,ce,ye=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);if(J<ye||J>le)throw new S(ce,`>= ${ye} && <= ${le}`,J)}),te=_((J,ce,ye=!1)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);const le=ye?1:0,Re=4294967295;if(J<le||J>Re)throw new S(ce,`>= ${le} && <= ${Re}`,J)});function T(J,ce){if(typeof J!="string")throw new v(ce,"string",J)}function Z(J,ce,ye=void 0,le){if(typeof J!="number")throw new v(ce,"number",J);if(ye!=null&&J<ye||le!=null&&J>le||(ye!=null||le!=null)&&s(J))throw new S(ce,`${ye!=null?`>= ${ye}`:""}${ye!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,J)}const k=_((J,ce,ye)=>{if(!e(ye,J)){const Re="must be one of: "+t(n(ye,ze=>typeof ze=="string"?`'${ze}'`:h(ze)),", ");throw new x(ce,J,Re)}});function Y(J,ce){if(typeof J!="boolean")throw new v(ce,"boolean",J)}function w(J,ce,ye){return J==null||!l(J,ce)?ye:J[ce]}const H=_((J,ce,ye=null)=>{const le=w(ye,"allowArray",!1),Re=w(ye,"allowFunction",!1);if(!w(ye,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Re||typeof J!="function"))throw new v(ce,"Object",J)}),K=_((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new v(ce,"a dictionary",J)}),Q=_((J,ce,ye=0)=>{if(!r(J))throw new v(ce,"Array",J);if(J.length<ye){const le=`must be longer than ${ye}`;throw new x(ce,J,le)}});function ue(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)T(J[ye],`${ce}[${ye}]`)}function V(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)Y(J[ye],`${ce}[${ye}]`)}function G(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++){const le=J[ye],Re=`${ce}[${ye}]`;if(le==null)throw new v(Re,"AbortSignal",le);fe(le,Re)}}function z(J,ce="signal"){if(T(J,ce),C[J]===void 0)throw C[b(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const U=_((J,ce="buffer")=>{if(!N(J))throw new v(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ye=d(ce),le=J.length;if(ye==="hex"&&le%2!==0)throw new x("encoding",ce,`is invalid for data of length ${le}`)}function re(J,ce="Port",ye=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&y(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ye)throw new E(ce,J,ye);return J|0}const fe=_((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new v(ce,"AbortSignal",J)}),ge=_((J,ce)=>{if(typeof J!="function")throw new v(ce,"Function",J)}),j=_((J,ce)=>{if(typeof J!="function"||g(J))throw new v(ce,"Function",J)}),W=_((J,ce)=>{if(J!==void 0)throw new v(ce,"undefined",J)});function se(J,ce,ye){if(!e(ye,J))throw new v(ce,`('${t(ye,"|")}')`,J)}const he=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(J,ce){if(typeof J>"u"||!c(he,J))throw new x(ce,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me(J){if(typeof J=="string")return pe(J,"hints"),J;if(r(J)){const ce=J.length;let ye="";if(ce===0)return ye;for(let le=0;le<ce;le++){const Re=J[le];pe(Re,"hints"),ye+=Re,le!==ce-1&&(ye+=", ")}return ye}throw new x("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Ai={isInt32:A,isUint32:B,parseFileMode:q,validateArray:Q,validateStringArray:ue,validateBooleanArray:V,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:U,validateDictionary:K,validateEncoding:ee,validateFunction:ge,validateInt32:L,validateInteger:D,validateNumber:Z,validateObject:H,validateOneOf:k,validatePlainFunction:j,validatePort:re,validateSignalName:z,validateString:T,validateUint32:te,validateUndefined:W,validateUnion:se,validateAbortSignal:fe,validateLinkHeaderValue:me},Ai}var Mn={exports:{}},Di={exports:{}},mo;function pr(){if(mo)return Di.exports;mo=1;var r=Di.exports={},e,t;function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=n}catch{e=n}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function s(E){if(e===setTimeout)return setTimeout(E,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(E,0);try{return e(E,0)}catch{try{return e.call(null,E,0)}catch{return e.call(this,E,0)}}}function a(E){if(t===clearTimeout)return clearTimeout(E);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(E);try{return t(E)}catch{try{return t.call(null,E)}catch{return t.call(this,E)}}}var o=[],u=!1,l,c=-1;function h(){!u||!l||(u=!1,l.length?o=l.concat(o):c=-1,o.length&&b())}function b(){if(!u){var E=s(h);u=!0;for(var v=o.length;v;){for(l=o,o=[];++c<v;)l&&l[c].run();c=-1,v=o.length}l=null,u=!1,a(E)}}r.nextTick=function(E){var v=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];o.push(new y(E,v)),o.length===1&&!u&&s(b)};function y(E,v){this.fun=E,this.array=v}y.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function _(){}return r.on=_,r.addListener=_,r.once=_,r.off=_,r.removeListener=_,r.removeAllListeners=_,r.emit=_,r.prependListener=_,r.prependOnceListener=_,r.listeners=function(E){return[]},r.binding=function(E){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(E){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Di.exports}var Li,yo;function jt(){if(yo)return Li;yo=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=Be(),n=t("nodejs.stream.destroyed"),i=t("nodejs.stream.errored"),s=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),o=t("nodejs.stream.disturbed"),u=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function c(w,H=!1){var K;return!!(w&&typeof w.pipe=="function"&&typeof w.on=="function"&&(!H||typeof w.pause=="function"&&typeof w.resume=="function")&&(!w._writableState||((K=w._readableState)===null||K===void 0?void 0:K.readable)!==!1)&&(!w._writableState||w._readableState))}function h(w){var H;return!!(w&&typeof w.write=="function"&&typeof w.on=="function"&&(!w._readableState||((H=w._writableState)===null||H===void 0?void 0:H.writable)!==!1))}function b(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function y(w){return w&&(w._readableState||w._writableState||typeof w.write=="function"&&typeof w.on=="function"||typeof w.pipe=="function"&&typeof w.on=="function")}function _(w){return!!(w&&!y(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function E(w){return!!(w&&!y(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function v(w){return!!(w&&!y(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function x(w){return _(w)||E(w)||v(w)}function S(w,H){return w==null?!1:H===!0?typeof w[r]=="function":H===!1?typeof w[e]=="function":typeof w[r]=="function"||typeof w[e]=="function"}function m(w){if(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!!(w.destroyed||w[n]||Q!=null&&Q.destroyed)}function d(w){if(!h(w))return null;if(w.writableEnded===!0)return!0;const H=w._writableState;return H!=null&&H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function g(w,H){if(!h(w))return null;if(w.writableFinished===!0)return!0;const K=w._writableState;return K!=null&&K.errored?!1:typeof K?.finished!="boolean"?null:!!(K.finished||H===!1&&K.ended===!0&&K.length===0)}function N(w){if(!c(w))return null;if(w.readableEnded===!0)return!0;const H=w._readableState;return!H||H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function C(w,H){if(!c(w))return null;const K=w._readableState;return K!=null&&K.errored?!1:typeof K?.endEmitted!="boolean"?null:!!(K.endEmitted||H===!1&&K.ended===!0&&K.length===0)}function A(w){return w&&w[s]!=null?w[s]:typeof w?.readable!="boolean"?null:m(w)?!1:c(w)&&w.readable&&!C(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:h(w)&&w.writable&&!d(w)}function R(w,H){return y(w)?m(w)?!0:!(H?.readable!==!1&&A(w)||H?.writable!==!1&&B(w)):null}function F(w){var H,K;return y(w)?w.writableErrored?w.writableErrored:(H=(K=w._writableState)===null||K===void 0?void 0:K.errored)!==null&&H!==void 0?H:null:null}function q(w){var H,K;return y(w)?w.readableErrored?w.readableErrored:(H=(K=w._readableState)===null||K===void 0?void 0:K.errored)!==null&&H!==void 0?H:null:null}function D(w){if(!y(w))return null;if(typeof w.closed=="boolean")return w.closed;const H=w._writableState,K=w._readableState;return typeof H?.closed=="boolean"||typeof K?.closed=="boolean"?H?.closed||K?.closed:typeof w._closed=="boolean"&&L(w)?w._closed:null}function L(w){return typeof w._closed=="boolean"&&typeof w._defaultKeepAlive=="boolean"&&typeof w._removedConnection=="boolean"&&typeof w._removedContLen=="boolean"}function te(w){return typeof w._sent100=="boolean"&&L(w)}function T(w){var H;return typeof w._consuming=="boolean"&&typeof w._dumped=="boolean"&&((H=w.req)===null||H===void 0?void 0:H.upgradeOrConnect)===void 0}function Z(w){if(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!Q&&te(w)||!!(Q&&Q.autoDestroy&&Q.emitClose&&Q.closed===!1)}function k(w){var H;return!!(w&&((H=w[o])!==null&&H!==void 0?H:w.readableDidRead||w.readableAborted))}function Y(w){var H,K,Q,ue,V,G,z,U,ee,re;return!!(w&&((H=(K=(Q=(ue=(V=(G=w[i])!==null&&G!==void 0?G:w.readableErrored)!==null&&V!==void 0?V:w.writableErrored)!==null&&ue!==void 0?ue:(z=w._readableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&Q!==void 0?Q:(U=w._writableState)===null||U===void 0?void 0:U.errorEmitted)!==null&&K!==void 0?K:(ee=w._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&H!==void 0?H:!((re=w._writableState)===null||re===void 0)&&re.errored))}return Li={isDestroyed:m,kIsDestroyed:n,isDisturbed:k,kIsDisturbed:o,isErrored:Y,kIsErrored:i,isReadable:A,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:l,kIsWritable:a,isClosed:D,isDuplexNodeStream:b,isFinished:R,isIterable:S,isReadableNodeStream:c,isReadableStream:_,isReadableEnded:N,isReadableFinished:C,isReadableErrored:q,isNodeStream:y,isWebStream:x,isWritable:B,isWritableNodeStream:h,isWritableStream:E,isWritableEnded:d,isWritableFinished:g,isWritableErrored:F,isServerRequest:T,isServerResponse:te,willEmitClose:Z,isTransformStream:v},Li}var bo;function zt(){if(bo)return Mn.exports;bo=1;const r=pr(),{AbortError:e,codes:t}=it(),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=at(),{validateAbortSignal:o,validateFunction:u,validateObject:l,validateBoolean:c}=In(),{Promise:h,PromisePrototypeThen:b,SymbolDispose:y}=Be(),{isClosed:_,isReadable:E,isReadableNodeStream:v,isReadableStream:x,isReadableFinished:S,isReadableErrored:m,isWritable:d,isWritableNodeStream:g,isWritableStream:N,isWritableFinished:C,isWritableErrored:A,isNodeStream:B,willEmitClose:R,kIsClosedPromise:F}=jt();let q;function D(k){return k.setHeader&&typeof k.abort=="function"}const L=()=>{};function te(k,Y,w){var H,K;if(arguments.length===2?(w=Y,Y=s):Y==null?Y=s:l(Y,"options"),u(w,"callback"),o(Y.signal,"options.signal"),w=a(w),x(k)||N(k))return T(k,Y,w);if(!B(k))throw new n("stream",["ReadableStream","WritableStream","Stream"],k);const Q=(H=Y.readable)!==null&&H!==void 0?H:v(k),ue=(K=Y.writable)!==null&&K!==void 0?K:g(k),V=k._writableState,G=k._readableState,z=()=>{k.writable||re()};let U=R(k)&&v(k)===Q&&g(k)===ue,ee=C(k,!1);const re=()=>{ee=!0,k.destroyed&&(U=!1),!(U&&(!k.readable||Q))&&(!Q||fe)&&w.call(k)};let fe=S(k,!1);const ge=()=>{fe=!0,k.destroyed&&(U=!1),!(U&&(!k.writable||ue))&&(!ue||ee)&&w.call(k)},j=J=>{w.call(k,J)};let W=_(k);const se=()=>{W=!0;const J=A(k)||m(k);if(J&&typeof J!="boolean")return w.call(k,J);if(Q&&!fe&&v(k,!0)&&!S(k,!1))return w.call(k,new i);if(ue&&!ee&&!C(k,!1))return w.call(k,new i);w.call(k)},he=()=>{W=!0;const J=A(k)||m(k);if(J&&typeof J!="boolean")return w.call(k,J);w.call(k)},pe=()=>{k.req.on("finish",re)};D(k)?(k.on("complete",re),U||k.on("abort",se),k.req?pe():k.on("request",pe)):ue&&!V&&(k.on("end",z),k.on("close",z)),!U&&typeof k.aborted=="boolean"&&k.on("aborted",se),k.on("end",ge),k.on("finish",re),Y.error!==!1&&k.on("error",j),k.on("close",se),W?r.nextTick(se):V!=null&&V.errorEmitted||G!=null&&G.errorEmitted?U||r.nextTick(he):(!Q&&(!U||E(k))&&(ee||d(k)===!1)||!ue&&(!U||d(k))&&(fe||E(k)===!1)||G&&k.req&&k.aborted)&&r.nextTick(he);const me=()=>{w=L,k.removeListener("aborted",se),k.removeListener("complete",re),k.removeListener("abort",se),k.removeListener("request",pe),k.req&&k.req.removeListener("finish",re),k.removeListener("end",z),k.removeListener("close",z),k.removeListener("finish",re),k.removeListener("end",ge),k.removeListener("error",j),k.removeListener("close",se)};if(Y.signal&&!W){const J=()=>{const ce=w;me(),ce.call(k,new e(void 0,{cause:Y.signal.reason}))};if(Y.signal.aborted)r.nextTick(J);else{q=q||at().addAbortListener;const ce=q(Y.signal,J),ye=w;w=a((...le)=>{ce[y](),ye.apply(k,le)})}}return me}function T(k,Y,w){let H=!1,K=L;if(Y.signal)if(K=()=>{H=!0,w.call(k,new e(void 0,{cause:Y.signal.reason}))},Y.signal.aborted)r.nextTick(K);else{q=q||at().addAbortListener;const ue=q(Y.signal,K),V=w;w=a((...G)=>{ue[y](),V.apply(k,G)})}const Q=(...ue)=>{H||r.nextTick(()=>w.apply(k,ue))};return b(k[F].promise,Q,Q),L}function Z(k,Y){var w;let H=!1;return Y===null&&(Y=s),(w=Y)!==null&&w!==void 0&&w.cleanup&&(c(Y.cleanup,"cleanup"),H=Y.cleanup),new h((K,Q)=>{const ue=te(k,Y,V=>{H&&ue(),V?Q(V):K()})})}return Mn.exports=te,Mn.exports.finished=Z,Mn.exports}var Oi,_o;function jr(){if(_o)return Oi;_o=1;const r=pr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:n}=it(),{Symbol:i}=Be(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:u}=jt(),l=i("kDestroy"),c=i("kConstruct");function h(R,F,q){R&&(R.stack,F&&!F.errored&&(F.errored=R),q&&!q.errored&&(q.errored=R))}function b(R,F){const q=this._readableState,D=this._writableState,L=D||q;return D!=null&&D.destroyed||q!=null&&q.destroyed?(typeof F=="function"&&F(),this):(h(R,D,q),D&&(D.destroyed=!0),q&&(q.destroyed=!0),L.constructed?y(this,R,F):this.once(l,function(te){y(this,e(te,R),F)}),this)}function y(R,F,q){let D=!1;function L(te){if(D)return;D=!0;const T=R._readableState,Z=R._writableState;h(te,Z,T),Z&&(Z.closed=!0),T&&(T.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(_,R,te):r.nextTick(E,R)}try{R._destroy(F||null,L)}catch(te){L(te)}}function _(R,F){v(R,F),E(R)}function E(R){const F=R._readableState,q=R._writableState;q&&(q.closeEmitted=!0),F&&(F.closeEmitted=!0),(q!=null&&q.emitClose||F!=null&&F.emitClose)&&R.emit("close")}function v(R,F){const q=R._readableState,D=R._writableState;D!=null&&D.errorEmitted||q!=null&&q.errorEmitted||(D&&(D.errorEmitted=!0),q&&(q.errorEmitted=!0),R.emit("error",F))}function x(){const R=this._readableState,F=this._writableState;R&&(R.constructed=!0,R.closed=!1,R.closeEmitted=!1,R.destroyed=!1,R.errored=null,R.errorEmitted=!1,R.reading=!1,R.ended=R.readable===!1,R.endEmitted=R.readable===!1),F&&(F.constructed=!0,F.destroyed=!1,F.closed=!1,F.closeEmitted=!1,F.errored=null,F.errorEmitted=!1,F.finalCalled=!1,F.prefinished=!1,F.ended=F.writable===!1,F.ending=F.writable===!1,F.finished=F.writable===!1)}function S(R,F,q){const D=R._readableState,L=R._writableState;if(L!=null&&L.destroyed||D!=null&&D.destroyed)return this;D!=null&&D.autoDestroy||L!=null&&L.autoDestroy?R.destroy(F):F&&(F.stack,L&&!L.errored&&(L.errored=F),D&&!D.errored&&(D.errored=F),q?r.nextTick(v,R,F):v(R,F))}function m(R,F){if(typeof R._construct!="function")return;const q=R._readableState,D=R._writableState;q&&(q.constructed=!1),D&&(D.constructed=!1),R.once(c,F),!(R.listenerCount(c)>1)&&r.nextTick(d,R)}function d(R){let F=!1;function q(D){if(F){S(R,D??new t);return}F=!0;const L=R._readableState,te=R._writableState,T=te||L;L&&(L.constructed=!0),te&&(te.constructed=!0),T.destroyed?R.emit(l,D):D?S(R,D,!0):r.nextTick(g,R)}try{R._construct(D=>{r.nextTick(q,D)})}catch(D){r.nextTick(q,D)}}function g(R){R.emit(c)}function N(R){return R?.setHeader&&typeof R.abort=="function"}function C(R){R.emit("close")}function A(R,F){R.emit("error",F),r.nextTick(C,R)}function B(R,F){!R||a(R)||(!F&&!o(R)&&(F=new n),u(R)?(R.socket=null,R.destroy(F)):N(R)?R.abort():N(R.req)?R.req.abort():typeof R.destroy=="function"?R.destroy(F):typeof R.close=="function"?R.close():F?r.nextTick(A,R,F):r.nextTick(C,R),R.destroyed||(R[s]=!0))}return Oi={construct:m,destroyer:B,destroy:b,undestroy:x,errorOrDestroy:S},Oi}var Ci,wo;function va(){if(wo)return Ci;wo=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=ui();function n(s){t.call(this,s)}e(n.prototype,t.prototype),e(n,t),n.prototype.pipe=function(s,a){const o=this;function u(E){s.writable&&s.write(E)===!1&&o.pause&&o.pause()}o.on("data",u);function l(){o.readable&&o.resume&&o.resume()}s.on("drain",l),!s._isStdio&&(!a||a.end!==!1)&&(o.on("end",h),o.on("close",b));let c=!1;function h(){c||(c=!0,s.end())}function b(){c||(c=!0,typeof s.destroy=="function"&&s.destroy())}function y(E){_(),t.listenerCount(this,"error")===0&&this.emit("error",E)}i(o,"error",y),i(s,"error",y);function _(){o.removeListener("data",u),s.removeListener("drain",l),o.removeListener("end",h),o.removeListener("close",b),o.removeListener("error",y),s.removeListener("error",y),o.removeListener("end",_),o.removeListener("close",_),s.removeListener("close",_)}return o.on("end",_),o.on("close",_),s.on("close",_),s.emit("pipe",o),s};function i(s,a,o){if(typeof s.prependListener=="function")return s.prependListener(a,o);!s._events||!s._events[a]?s.on(a,o):r(s._events[a])?s._events[a].unshift(o):s._events[a]=[o,s._events[a]]}return Ci={Stream:n,prependListener:i},Ci}var ji={exports:{}},vo;function ci(){return vo||(vo=1,function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:n}=it(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=jt(),o=zt(),{ERR_INVALID_ARG_TYPE:u}=n;let l;const c=(h,b)=>{if(typeof h!="object"||!("aborted"in h))throw new u(b,"AbortSignal",h)};r.exports.addAbortSignal=function(b,y){if(c(b,"signal"),!i(y)&&!s(y))throw new u("stream",["ReadableStream","WritableStream","Stream"],y);return r.exports.addAbortSignalNoValidate(b,y)},r.exports.addAbortSignalNoValidate=function(h,b){if(typeof h!="object"||!("aborted"in h))return b;const y=i(b)?()=>{b.destroy(new t(void 0,{cause:h.reason}))}:()=>{b[a](new t(void 0,{cause:h.reason}))};if(h.aborted)y();else{l=l||at().addAbortListener;const _=l(h,y);o(b,_[e])}return b}}(ji)),ji.exports}var $i,xo;function Nd(){if(xo)return $i;xo=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:n}=Be(),{Buffer:i}=Ct(),{inspect:s}=at();return $i=class{constructor(){this.head=null,this.tail=null,this.length=0}push(o){const u={data:o,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}unshift(o){const u={data:o,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}shift(){if(this.length===0)return;const o=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,o}clear(){this.head=this.tail=null,this.length=0}join(o){if(this.length===0)return"";let u=this.head,l=""+u.data;for(;(u=u.next)!==null;)l+=o+u.data;return l}concat(o){if(this.length===0)return i.alloc(0);const u=i.allocUnsafe(o>>>0);let l=this.head,c=0;for(;l;)t(u,l.data,c),c+=l.data.length,l=l.next;return u}consume(o,u){const l=this.head.data;if(o<l.length){const c=l.slice(0,o);return this.head.data=l.slice(o),c}return o===l.length?this.shift():u?this._getString(o):this._getBuffer(o)}first(){return this.head.data}*[e](){for(let o=this.head;o;o=o.next)yield o.data}_getString(o){let u="",l=this.head,c=0;do{const h=l.data;if(o>h.length)u+=h,o-=h.length;else{o===h.length?(u+=h,++c,l.next?this.head=l.next:this.head=this.tail=null):(u+=r(h,0,o),this.head=l,l.data=r(h,o));break}++c}while((l=l.next)!==null);return this.length-=c,u}_getBuffer(o){const u=i.allocUnsafe(o),l=o;let c=this.head,h=0;do{const b=c.data;if(o>b.length)t(u,b,l-o),o-=b.length;else{o===b.length?(t(u,b,l-o),++h,c.next?this.head=c.next:this.head=this.tail=null):(t(u,new n(b.buffer,b.byteOffset,o),l-o),this.head=c,c.data=b.slice(o));break}++h}while((c=c.next)!==null);return this.length-=h,u}[Symbol.for("nodejs.util.inspect.custom")](o,u){return s(this,{...u,depth:0,customInspect:!1})}},$i}var Fi,Eo;function di(){if(Eo)return Fi;Eo=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=In(),{ERR_INVALID_ARG_VALUE:n}=it().codes;let i=16*1024,s=16;function a(c,h,b){return c.highWaterMark!=null?c.highWaterMark:h?c[b]:null}function o(c){return c?s:i}function u(c,h){t(h,"value",0),c?s=h:i=h}function l(c,h,b,y){const _=a(h,y,b);if(_!=null){if(!e(_)||_<0){const E=y?`options.${b}`:"options.highWaterMark";throw new n(E,_)}return r(_)}return o(c.objectMode)}return Fi={getHighWaterMark:l,getDefaultHighWaterMark:o,setDefaultHighWaterMark:u},Fi}var ki={},Bn={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var So;function Rd(){return So||(So=1,function(r,e){var t=Ct(),n=t.Buffer;function i(a,o){for(var u in a)o[u]=a[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=t:(i(t,e),e.Buffer=s);function s(a,o,u){return n(a,o,u)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,o,u){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,o,u)},s.alloc=function(a,o,u){if(typeof a!="number")throw new TypeError("Argument must be a number");var l=n(a);return o!==void 0?typeof u=="string"?l.fill(o,u):l.fill(o):l.fill(0),l},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(Bn,Bn.exports)),Bn.exports}var Io;function Td(){if(Io)return ki;Io=1;var r=Rd().Buffer,e=r.isEncoding||function(x){switch(x=""+x,x&&x.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 t(x){if(!x)return"utf8";for(var S;;)switch(x){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 x;default:if(S)return;x=(""+x).toLowerCase(),S=!0}}function n(x){var S=t(x);if(typeof S!="string"&&(r.isEncoding===e||!e(x)))throw new Error("Unknown encoding: "+x);return S||x}ki.StringDecoder=i;function i(x){this.encoding=n(x);var S;switch(this.encoding){case"utf16le":this.text=h,this.end=b,S=4;break;case"utf8":this.fillLast=u,S=4;break;case"base64":this.text=y,this.end=_,S=3;break;default:this.write=E,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(S)}i.prototype.write=function(x){if(x.length===0)return"";var S,m;if(this.lastNeed){if(S=this.fillLast(x),S===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<x.length?S?S+this.text(x,m):this.text(x,m):S||""},i.prototype.end=c,i.prototype.text=l,i.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function s(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function a(x,S,m){var d=S.length-1;if(d<m)return 0;var g=s(S[d]);return g>=0?(g>0&&(x.lastNeed=g-1),g):--d<m||g===-2?0:(g=s(S[d]),g>=0?(g>0&&(x.lastNeed=g-2),g):--d<m||g===-2?0:(g=s(S[d]),g>=0?(g>0&&(g===2?g=0:x.lastNeed=g-3),g):0))}function o(x,S,m){if((S[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return x.lastNeed=2,"�"}}function u(x){var S=this.lastTotal-this.lastNeed,m=o(this,x);if(m!==void 0)return m;if(this.lastNeed<=x.length)return x.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,S,0,x.length),this.lastNeed-=x.length}function l(x,S){var m=a(this,x,S);if(!this.lastNeed)return x.toString("utf8",S);this.lastTotal=m;var d=x.length-(m-this.lastNeed);return x.copy(this.lastChar,0,d),x.toString("utf8",S,d)}function c(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+"�":S}function h(x,S){if((x.length-S)%2===0){var m=x.toString("utf16le",S);if(m){var d=m.charCodeAt(m.length-1);if(d>=55296&&d<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",S,x.length-1)}function b(x){var S=x&&x.length?this.write(x):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,m)}return S}function y(x,S){var m=(x.length-S)%3;return m===0?x.toString("base64",S):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",S,x.length-m))}function _(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function E(x){return x.toString(this.encoding)}function v(x){return x&&x.length?this.write(x):""}return ki}var Pi,No;function nc(){if(No)return Pi;No=1;const r=pr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:n}=Be(),{Buffer:i}=Ct(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=it().codes;function o(u,l,c){let h;if(typeof l=="string"||l instanceof i)return new u({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let b;if(l&&l[t])b=!0,h=l[t]();else if(l&&l[n])b=!1,h=l[n]();else throw new s("iterable",["Iterable"],l);const y=new u({objectMode:!0,highWaterMark:1,...c});let _=!1;y._read=function(){_||(_=!0,v())},y._destroy=function(x,S){e(E(x),()=>r.nextTick(S,x),m=>r.nextTick(S,m||x))};async function E(x){const S=x!=null,m=typeof h.throw=="function";if(S&&m){const{value:d,done:g}=await h.throw(x);if(await d,g)return}if(typeof h.return=="function"){const{value:d}=await h.return();await d}}async function v(){for(;;){try{const{value:x,done:S}=b?await h.next():h.next();if(S)y.push(null);else{const m=x&&typeof x.then=="function"?await x:x;if(m===null)throw _=!1,new a;if(y.push(m))continue;_=!1}}catch(x){y.destroy(x)}break}}return y}return Pi=o,Pi}var Mi,Ro;function hi(){if(Ro)return Mi;Ro=1;const r=pr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:u,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:h,Symbol:b}=Be();Mi=le,le.ReadableState=ye;const{EventEmitter:y}=ui(),{Stream:_,prependListener:E}=va(),{Buffer:v}=Ct(),{addAbortSignal:x}=ci(),S=zt();let m=at().debuglog("stream",O=>{m=O});const d=Nd(),g=jr(),{getHighWaterMark:N,getDefaultHighWaterMark:C}=di(),{aggregateTwoErrors:A,codes:{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:F,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:D},AbortError:L}=it(),{validateObject:te}=In(),T=b("kPaused"),{StringDecoder:Z}=Td(),k=nc();o(le.prototype,_.prototype),o(le,_);const Y=()=>{},{errorOrDestroy:w}=g,H=1,K=2,Q=4,ue=8,V=16,G=32,z=64,U=128,ee=256,re=512,fe=1024,ge=2048,j=4096,W=8192,se=16384,he=32768,pe=65536,me=1<<17,J=1<<18;function ce(O){return{enumerable:!1,get(){return(this.state&O)!==0},set(M){M?this.state|=O:this.state&=~O}}}s(ye.prototype,{objectMode:ce(H),ended:ce(K),endEmitted:ce(Q),reading:ce(ue),constructed:ce(V),sync:ce(G),needReadable:ce(z),emittedReadable:ce(U),readableListening:ce(ee),resumeScheduled:ce(re),errorEmitted:ce(fe),emitClose:ce(ge),autoDestroy:ce(j),destroyed:ce(W),closed:ce(se),closeEmitted:ce(he),multiAwaitDrain:ce(pe),readingMore:ce(me),dataEmitted:ce(J)});function ye(O,M,be){typeof be!="boolean"&&(be=M instanceof Lt()),this.state=ge|j|V|G,O&&O.objectMode&&(this.state|=H),be&&O&&O.readableObjectMode&&(this.state|=H),this.highWaterMark=O?N(this,O,"readableHighWaterMark",be):C(!1),this.buffer=new d,this.length=0,this.pipes=[],this.flowing=null,this[T]=null,O&&O.emitClose===!1&&(this.state&=~ge),O&&O.autoDestroy===!1&&(this.state&=~j),this.errored=null,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,O&&O.encoding&&(this.decoder=new Z(O.encoding),this.encoding=O.encoding)}function le(O){if(!(this instanceof le))return new le(O);const M=this instanceof Lt();this._readableState=new ye(O,this,M),O&&(typeof O.read=="function"&&(this._read=O.read),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&!M&&x(O.signal,this)),_.call(this,O),g.construct(this,()=>{this._readableState.needReadable&&X(this,this._readableState)})}le.prototype.destroy=g.destroy,le.prototype._undestroy=g.undestroy,le.prototype._destroy=function(O,M){M(O)},le.prototype[y.captureRejectionSymbol]=function(O){this.destroy(O)},le.prototype[c]=function(){let O;return this.destroyed||(O=this.readableEnded?null:new L,this.destroy(O)),new u((M,be)=>S(this,_e=>_e&&_e!==O?be(_e):M(null)))},le.prototype.push=function(O,M){return Re(this,O,M,!1)},le.prototype.unshift=function(O,M){return Re(this,O,M,!0)};function Re(O,M,be,_e){m("readableAddChunk",M);const ve=O._readableState;let Qe;if((ve.state&H)===0&&(typeof M=="string"?(be=be||ve.defaultEncoding,ve.encoding!==be&&(_e&&ve.encoding?M=v.from(M,be).toString(ve.encoding):(M=v.from(M,be),be=""))):M instanceof v?be="":_._isUint8Array(M)?(M=_._uint8ArrayToBuffer(M),be=""):M!=null&&(Qe=new B("chunk",["string","Buffer","Uint8Array"],M))),Qe)w(O,Qe);else if(M===null)ve.state&=~ue,f(O,ve);else if((ve.state&H)!==0||M&&M.length>0)if(_e)if((ve.state&Q)!==0)w(O,new D);else{if(ve.destroyed||ve.errored)return!1;ze(O,ve,M,!0)}else if(ve.ended)w(O,new q);else{if(ve.destroyed||ve.errored)return!1;ve.state&=~ue,ve.decoder&&!be?(M=ve.decoder.write(M),ve.objectMode||M.length!==0?ze(O,ve,M,!1):X(O,ve)):ze(O,ve,M,!1)}else _e||(ve.state&=~ue,X(O,ve));return!ve.ended&&(ve.length<ve.highWaterMark||ve.length===0)}function ze(O,M,be,_e){M.flowing&&M.length===0&&!M.sync&&O.listenerCount("data")>0?((M.state&pe)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,O.emit("data",be)):(M.length+=M.objectMode?1:be.length,_e?M.buffer.unshift(be):M.buffer.push(be),(M.state&z)!==0&&p(O)),X(O,M)}le.prototype.isPaused=function(){const O=this._readableState;return O[T]===!0||O.flowing===!1},le.prototype.setEncoding=function(O){const M=new Z(O);this._readableState.decoder=M,this._readableState.encoding=this._readableState.decoder.encoding;const be=this._readableState.buffer;let _e="";for(const ve of be)_e+=M.write(ve);return be.clear(),_e!==""&&be.push(_e),this._readableState.length=_e.length,this};const Ie=1073741824;function Xe(O){if(O>Ie)throw new F("size","<= 1GiB",O);return O--,O|=O>>>1,O|=O>>>2,O|=O>>>4,O|=O>>>8,O|=O>>>16,O++,O}function I(O,M){return O<=0||M.length===0&&M.ended?0:(M.state&H)!==0?1:n(O)?M.flowing&&M.length?M.buffer.first().length:M.length:O<=M.length?O:M.ended?M.length:0}le.prototype.read=function(O){m("read",O),O===void 0?O=NaN:t(O)||(O=i(O,10));const M=this._readableState,be=O;if(O>M.highWaterMark&&(M.highWaterMark=Xe(O)),O!==0&&(M.state&=~U),O===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?He(this):p(this),null;if(O=I(O,M),O===0&&M.ended)return M.length===0&&He(this),null;let _e=(M.state&z)!==0;if(m("need readable",_e),(M.length===0||M.length-O<M.highWaterMark)&&(_e=!0,m("length less than watermark",_e)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)_e=!1,m("reading, ended or constructing",_e);else if(_e){m("do read"),M.state|=ue|G,M.length===0&&(M.state|=z);try{this._read(M.highWaterMark)}catch(Qe){w(this,Qe)}M.state&=~G,M.reading||(O=I(be,M))}let ve;return O>0?ve=qe(O,M):ve=null,ve===null?(M.needReadable=M.length<=M.highWaterMark,O=0):(M.length-=O,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),be!==O&&M.ended&&He(this)),ve!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",ve)),ve};function f(O,M){if(m("onEofChunk"),!M.ended){if(M.decoder){const be=M.decoder.end();be&&be.length&&(M.buffer.push(be),M.length+=M.objectMode?1:be.length)}M.ended=!0,M.sync?p(O):(M.needReadable=!1,M.emittedReadable=!0,$(O))}}function p(O){const M=O._readableState;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick($,O))}function $(O){const M=O._readableState;m("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(O.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,De(O)}function X(O,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(oe,O,M))}function oe(O,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const be=M.length;if(m("maybeReadMore read 0"),O.read(0),be===M.length)break}M.readingMore=!1}le.prototype._read=function(O){throw new R("_read()")},le.prototype.pipe=function(O,M){const be=this,_e=this._readableState;_e.pipes.length===1&&(_e.multiAwaitDrain||(_e.multiAwaitDrain=!0,_e.awaitDrainWriters=new l(_e.awaitDrainWriters?[_e.awaitDrainWriters]:[]))),_e.pipes.push(O),m("pipe count=%d opts=%j",_e.pipes.length,M);const Qe=(!M||M.end!==!1)&&O!==r.stdout&&O!==r.stderr?Ln:P;_e.endEmitted?r.nextTick(Qe):be.once("end",Qe),O.on("unpipe",Ye);function Ye(ne,ie){m("onunpipe"),ne===be&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,Rt())}function Ln(){m("onend"),O.end()}let Nt,On=!1;function Rt(){m("cleanup"),O.removeListener("close",Br),O.removeListener("finish",We),Nt&&O.removeListener("drain",Nt),O.removeListener("error",yr),O.removeListener("unpipe",Ye),be.removeListener("end",Ln),be.removeListener("end",P),be.removeListener("data",mr),On=!0,Nt&&_e.awaitDrainWriters&&(!O._writableState||O._writableState.needDrain)&&Nt()}function Mr(){On||(_e.pipes.length===1&&_e.pipes[0]===O?(m("false write response, pause",0),_e.awaitDrainWriters=O,_e.multiAwaitDrain=!1):_e.pipes.length>1&&_e.pipes.includes(O)&&(m("false write response, pause",_e.awaitDrainWriters.size),_e.awaitDrainWriters.add(O)),be.pause()),Nt||(Nt=de(be,O),O.on("drain",Nt))}be.on("data",mr);function mr(ne){m("ondata");const ie=O.write(ne);m("dest.write",ie),ie===!1&&Mr()}function yr(ne){if(m("onerror",ne),P(),O.removeListener("error",yr),O.listenerCount("error")===0){const ie=O._writableState||O._readableState;ie&&!ie.errorEmitted?w(O,ne):O.emit("error",ne)}}E(O,"error",yr);function Br(){O.removeListener("finish",We),P()}O.once("close",Br);function We(){m("onfinish"),O.removeListener("close",Br),P()}O.once("finish",We);function P(){m("unpipe"),be.unpipe(O)}return O.emit("pipe",be),O.writableNeedDrain===!0?Mr():_e.flowing||(m("pipe resume"),be.resume()),O};function de(O,M){return function(){const _e=O._readableState;_e.awaitDrainWriters===M?(m("pipeOnDrain",1),_e.awaitDrainWriters=null):_e.multiAwaitDrain&&(m("pipeOnDrain",_e.awaitDrainWriters.size),_e.awaitDrainWriters.delete(M)),(!_e.awaitDrainWriters||_e.awaitDrainWriters.size===0)&&O.listenerCount("data")&&O.resume()}}le.prototype.unpipe=function(O){const M=this._readableState,be={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!O){const ve=M.pipes;M.pipes=[],this.pause();for(let Qe=0;Qe<ve.length;Qe++)ve[Qe].emit("unpipe",this,{hasUnpiped:!1});return this}const _e=e(M.pipes,O);return _e===-1?this:(M.pipes.splice(_e,1),M.pipes.length===0&&this.pause(),O.emit("unpipe",this,be),this)},le.prototype.on=function(O,M){const be=_.prototype.on.call(this,O,M),_e=this._readableState;return O==="data"?(_e.readableListening=this.listenerCount("readable")>0,_e.flowing!==!1&&this.resume()):O==="readable"&&!_e.endEmitted&&!_e.readableListening&&(_e.readableListening=_e.needReadable=!0,_e.flowing=!1,_e.emittedReadable=!1,m("on readable",_e.length,_e.reading),_e.length?p(this):_e.reading||r.nextTick(ke,this)),be},le.prototype.addListener=le.prototype.on,le.prototype.removeListener=function(O,M){const be=_.prototype.removeListener.call(this,O,M);return O==="readable"&&r.nextTick(Ee,this),be},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(O){const M=_.prototype.removeAllListeners.apply(this,arguments);return(O==="readable"||O===void 0)&&r.nextTick(Ee,this),M};function Ee(O){const M=O._readableState;M.readableListening=O.listenerCount("readable")>0,M.resumeScheduled&&M[T]===!1?M.flowing=!0:O.listenerCount("data")>0?O.resume():M.readableListening||(M.flowing=null)}function ke(O){m("readable nexttick read 0"),O.read(0)}le.prototype.resume=function(){const O=this._readableState;return O.flowing||(m("resume"),O.flowing=!O.readableListening,Le(this,O)),O[T]=!1,this};function Le(O,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(Oe,O,M))}function Oe(O,M){m("resume",M.reading),M.reading||O.read(0),M.resumeScheduled=!1,O.emit("resume"),De(O),M.flowing&&!M.reading&&O.read(0)}le.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[T]=!0,this};function De(O){const M=O._readableState;for(m("flow",M.flowing);M.flowing&&O.read()!==null;);}le.prototype.wrap=function(O){let M=!1;O.on("data",_e=>{!this.push(_e)&&O.pause&&(M=!0,O.pause())}),O.on("end",()=>{this.push(null)}),O.on("error",_e=>{w(this,_e)}),O.on("close",()=>{this.destroy()}),O.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&O.resume&&(M=!1,O.resume())};const be=a(O);for(let _e=1;_e<be.length;_e++){const ve=be[_e];this[ve]===void 0&&typeof O[ve]=="function"&&(this[ve]=O[ve].bind(O))}return this},le.prototype[h]=function(){return mt(this)},le.prototype.iterator=function(O){return O!==void 0&&te(O,"options"),mt(this,O)};function mt(O,M){typeof O.read!="function"&&(O=le.wrap(O,{objectMode:!0}));const be=Pt(O,M);return be.stream=O,be}async function*Pt(O,M){let be=Y;function _e(Ye){this===O?(be(),be=Y):be=Ye}O.on("readable",_e);let ve;const Qe=S(O,{writable:!1},Ye=>{ve=Ye?A(ve,Ye):null,be(),be=Y});try{for(;;){const Ye=O.destroyed?null:O.read();if(Ye!==null)yield Ye;else{if(ve)throw ve;if(ve===null)return;await new u(_e)}}}catch(Ye){throw ve=A(ve,Ye),ve}finally{(ve||M?.destroyOnReturn!==!1)&&(ve===void 0||O._readableState.autoDestroy)?g.destroyer(O,null):(O.off("readable",_e),Qe())}}s(le.prototype,{readable:{__proto__:null,get(){const O=this._readableState;return!!O&&O.readable!==!1&&!O.destroyed&&!O.errorEmitted&&!O.endEmitted},set(O){this._readableState&&(this._readableState.readable=!!O)}},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(O){this._readableState&&(this._readableState.flowing=O)}},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(O){this._readableState&&(this._readableState.destroyed=O)}},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[T]!==!1},set(O){this[T]=!!O}}}),le._fromList=qe;function qe(O,M){if(M.length===0)return null;let be;return M.objectMode?be=M.buffer.shift():!O||O>=M.length?(M.decoder?be=M.buffer.join(""):M.buffer.length===1?be=M.buffer.first():be=M.buffer.concat(M.length),M.buffer.clear()):be=M.buffer.consume(O,M.decoder),be}function He(O){const M=O._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(Dn,M,O))}function Dn(O,M){if(m("endReadableNT",O.endEmitted,O.length),!O.errored&&!O.closeEmitted&&!O.endEmitted&&O.length===0){if(O.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(Mt,M);else if(O.autoDestroy){const be=M._writableState;(!be||be.autoDestroy&&(be.finished||be.writable===!1))&&M.destroy()}}}function Mt(O){O.writable&&!O.writableEnded&&!O.destroyed&&O.end()}le.from=function(O,M){return k(le,O,M)};let gr;function Pr(){return gr===void 0&&(gr={}),gr}return le.fromWeb=function(O,M){return Pr().newStreamReadableFromReadableStream(O,M)},le.toWeb=function(O,M){return Pr().newReadableStreamFromStreamReadable(O,M)},le.wrap=function(O,M){var be,_e;return new le({objectMode:(be=(_e=O.readableObjectMode)!==null&&_e!==void 0?_e:O.objectMode)!==null&&be!==void 0?be:!0,...M,destroy(ve,Qe){g.destroyer(O,ve),Qe(ve)}}).wrap(O)},Mi}var Bi,To;function xa(){if(To)return Bi;To=1;const r=pr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:u,SymbolHasInstance:l}=Be();Bi=te,te.WritableState=D;const{EventEmitter:c}=ui(),h=va().Stream,{Buffer:b}=Ct(),y=jr(),{addAbortSignal:_}=ci(),{getHighWaterMark:E,getDefaultHighWaterMark:v}=di(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:d,ERR_STREAM_DESTROYED:g,ERR_STREAM_ALREADY_FINISHED:N,ERR_STREAM_NULL_VALUES:C,ERR_STREAM_WRITE_AFTER_END:A,ERR_UNKNOWN_ENCODING:B}=it().codes,{errorOrDestroy:R}=y;a(te.prototype,h.prototype),a(te,h);function F(){}const q=u("kOnFinished");function D(j,W,se){typeof se!="boolean"&&(se=W instanceof Lt()),this.objectMode=!!(j&&j.objectMode),se&&(this.objectMode=this.objectMode||!!(j&&j.writableObjectMode)),this.highWaterMark=j?E(this,j,"writableHighWaterMark",se):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const he=!!(j&&j.decodeStrings===!1);this.decodeStrings=!he,this.defaultEncoding=j&&j.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=w.bind(void 0,W),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,L(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!j||j.emitClose!==!1,this.autoDestroy=!j||j.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function L(j){j.buffered=[],j.bufferedIndex=0,j.allBuffers=!0,j.allNoop=!0}D.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(D.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function te(j){const W=this instanceof Lt();if(!W&&!n(te,this))return new te(j);this._writableState=new D(j,this,W),j&&(typeof j.write=="function"&&(this._write=j.write),typeof j.writev=="function"&&(this._writev=j.writev),typeof j.destroy=="function"&&(this._destroy=j.destroy),typeof j.final=="function"&&(this._final=j.final),typeof j.construct=="function"&&(this._construct=j.construct),j.signal&&_(j.signal,this)),h.call(this,j),y.construct(this,()=>{const se=this._writableState;se.writing||ue(this,se),U(this,se)})}i(te,l,{__proto__:null,value:function(j){return n(this,j)?!0:this!==te?!1:j&&j._writableState instanceof D}}),te.prototype.pipe=function(){R(this,new d)};function T(j,W,se,he){const pe=j._writableState;if(typeof se=="function")he=se,se=pe.defaultEncoding;else{if(!se)se=pe.defaultEncoding;else if(se!=="buffer"&&!b.isEncoding(se))throw new B(se);typeof he!="function"&&(he=F)}if(W===null)throw new C;if(!pe.objectMode)if(typeof W=="string")pe.decodeStrings!==!1&&(W=b.from(W,se),se="buffer");else if(W instanceof b)se="buffer";else if(h._isUint8Array(W))W=h._uint8ArrayToBuffer(W),se="buffer";else throw new x("chunk",["string","Buffer","Uint8Array"],W);let me;return pe.ending?me=new A:pe.destroyed&&(me=new g("write")),me?(r.nextTick(he,me),R(j,me,!0),me):(pe.pendingcb++,Z(j,pe,W,se,he))}te.prototype.write=function(j,W,se){return T(this,j,W,se)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const j=this._writableState;j.corked&&(j.corked--,j.writing||ue(this,j))},te.prototype.setDefaultEncoding=function(W){if(typeof W=="string"&&(W=o(W)),!b.isEncoding(W))throw new B(W);return this._writableState.defaultEncoding=W,this};function Z(j,W,se,he,pe){const me=W.objectMode?1:se.length;W.length+=me;const J=W.length<W.highWaterMark;return J||(W.needDrain=!0),W.writing||W.corked||W.errored||!W.constructed?(W.buffered.push({chunk:se,encoding:he,callback:pe}),W.allBuffers&&he!=="buffer"&&(W.allBuffers=!1),W.allNoop&&pe!==F&&(W.allNoop=!1)):(W.writelen=me,W.writecb=pe,W.writing=!0,W.sync=!0,j._write(se,he,W.onwrite),W.sync=!1),J&&!W.errored&&!W.destroyed}function k(j,W,se,he,pe,me,J){W.writelen=he,W.writecb=J,W.writing=!0,W.sync=!0,W.destroyed?W.onwrite(new g("write")):se?j._writev(pe,W.onwrite):j._write(pe,me,W.onwrite),W.sync=!1}function Y(j,W,se,he){--W.pendingcb,he(se),Q(W),R(j,se)}function w(j,W){const se=j._writableState,he=se.sync,pe=se.writecb;if(typeof pe!="function"){R(j,new m);return}se.writing=!1,se.writecb=null,se.length-=se.writelen,se.writelen=0,W?(W.stack,se.errored||(se.errored=W),j._readableState&&!j._readableState.errored&&(j._readableState.errored=W),he?r.nextTick(Y,j,se,W,pe):Y(j,se,W,pe)):(se.buffered.length>se.bufferedIndex&&ue(j,se),he?se.afterWriteTickInfo!==null&&se.afterWriteTickInfo.cb===pe?se.afterWriteTickInfo.count++:(se.afterWriteTickInfo={count:1,cb:pe,stream:j,state:se},r.nextTick(H,se.afterWriteTickInfo)):K(j,se,1,pe))}function H({stream:j,state:W,count:se,cb:he}){return W.afterWriteTickInfo=null,K(j,W,se,he)}function K(j,W,se,he){for(!W.ending&&!j.destroyed&&W.length===0&&W.needDrain&&(W.needDrain=!1,j.emit("drain"));se-- >0;)W.pendingcb--,he();W.destroyed&&Q(W),U(j,W)}function Q(j){if(j.writing)return;for(let pe=j.bufferedIndex;pe<j.buffered.length;++pe){var W;const{chunk:me,callback:J}=j.buffered[pe],ce=j.objectMode?1:me.length;j.length-=ce,J((W=j.errored)!==null&&W!==void 0?W:new g("write"))}const se=j[q].splice(0);for(let pe=0;pe<se.length;pe++){var he;se[pe]((he=j.errored)!==null&&he!==void 0?he:new g("end"))}L(j)}function ue(j,W){if(W.corked||W.bufferProcessing||W.destroyed||!W.constructed)return;const{buffered:se,bufferedIndex:he,objectMode:pe}=W,me=se.length-he;if(!me)return;let J=he;if(W.bufferProcessing=!0,me>1&&j._writev){W.pendingcb-=me-1;const ce=W.allNoop?F:le=>{for(let Re=J;Re<se.length;++Re)se[Re].callback(le)},ye=W.allNoop&&J===0?se:e(se,J);ye.allBuffers=W.allBuffers,k(j,W,!0,W.length,ye,"",ce),L(W)}else{do{const{chunk:ce,encoding:ye,callback:le}=se[J];se[J++]=null;const Re=pe?1:ce.length;k(j,W,!1,Re,ce,ye,le)}while(J<se.length&&!W.writing);J===se.length?L(W):J>256?(se.splice(0,J),W.bufferedIndex=0):W.bufferedIndex=J}W.bufferProcessing=!1}te.prototype._write=function(j,W,se){if(this._writev)this._writev([{chunk:j,encoding:W}],se);else throw new S("_write()")},te.prototype._writev=null,te.prototype.end=function(j,W,se){const he=this._writableState;typeof j=="function"?(se=j,j=null,W=null):typeof W=="function"&&(se=W,W=null);let pe;if(j!=null){const me=T(this,j,W);me instanceof t&&(pe=me)}return he.corked&&(he.corked=1,this.uncork()),pe||(!he.errored&&!he.ending?(he.ending=!0,U(this,he,!0),he.ended=!0):he.finished?pe=new N("end"):he.destroyed&&(pe=new g("end"))),typeof se=="function"&&(pe||he.finished?r.nextTick(se,pe):he[q].push(se)),this};function V(j){return j.ending&&!j.destroyed&&j.constructed&&j.length===0&&!j.errored&&j.buffered.length===0&&!j.finished&&!j.writing&&!j.errorEmitted&&!j.closeEmitted}function G(j,W){let se=!1;function he(pe){if(se){R(j,pe??m());return}if(se=!0,W.pendingcb--,pe){const me=W[q].splice(0);for(let J=0;J<me.length;J++)me[J](pe);R(j,pe,W.sync)}else V(W)&&(W.prefinished=!0,j.emit("prefinish"),W.pendingcb++,r.nextTick(ee,j,W))}W.sync=!0,W.pendingcb++;try{j._final(he)}catch(pe){he(pe)}W.sync=!1}function z(j,W){!W.prefinished&&!W.finalCalled&&(typeof j._final=="function"&&!W.destroyed?(W.finalCalled=!0,G(j,W)):(W.prefinished=!0,j.emit("prefinish")))}function U(j,W,se){V(W)&&(z(j,W),W.pendingcb===0&&(se?(W.pendingcb++,r.nextTick((he,pe)=>{V(pe)?ee(he,pe):pe.pendingcb--},j,W)):V(W)&&(W.pendingcb++,ee(j,W))))}function ee(j,W){W.pendingcb--,W.finished=!0;const se=W[q].splice(0);for(let he=0;he<se.length;he++)se[he]();if(j.emit("finish"),W.autoDestroy){const he=j._readableState;(!he||he.autoDestroy&&(he.endEmitted||he.readable===!1))&&j.destroy()}}s(te.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(j){this._writableState&&(this._writableState.destroyed=j)}},writable:{__proto__:null,get(){const j=this._writableState;return!!j&&j.writable!==!1&&!j.destroyed&&!j.errored&&!j.ending&&!j.ended},set(j){this._writableState&&(this._writableState.writable=!!j)}},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(){const j=this._writableState;return j?!j.destroyed&&!j.ending&&j.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)}}});const re=y.destroy;te.prototype.destroy=function(j,W){const se=this._writableState;return!se.destroyed&&(se.bufferedIndex<se.buffered.length||se[q].length)&&r.nextTick(Q,se),re.call(this,j,W),this},te.prototype._undestroy=y.undestroy,te.prototype._destroy=function(j,W){W(j)},te.prototype[c.captureRejectionSymbol]=function(j){this.destroy(j)};let fe;function ge(){return fe===void 0&&(fe={}),fe}return te.fromWeb=function(j,W){return ge().newStreamWritableFromWritableStream(j,W)},te.toWeb=function(j){return ge().newWritableStreamFromStreamWritable(j)},Bi}var qi,Ao;function Ad(){if(Ao)return qi;Ao=1;const r=pr(),e=Ct(),{isReadable:t,isWritable:n,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:u,isReadableStream:l,isWritableStream:c}=jt(),h=zt(),{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:y,ERR_INVALID_RETURN_VALUE:_}}=it(),{destroyer:E}=jr(),v=Lt(),x=hi(),S=xa(),{createDeferredPromise:m}=at(),d=nc(),g=globalThis.Blob||e.Blob,N=typeof g<"u"?function(D){return D instanceof g}:function(D){return!1},C=globalThis.AbortController||vn().AbortController,{FunctionPrototypeCall:A}=Be();class B extends v{constructor(D){super(D),D?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),D?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}qi=function q(D,L){if(u(D))return D;if(a(D))return F({readable:D});if(o(D))return F({writable:D});if(s(D))return F({writable:!1,readable:!1});if(l(D))return F({readable:x.fromWeb(D)});if(c(D))return F({writable:S.fromWeb(D)});if(typeof D=="function"){const{value:T,write:Z,final:k,destroy:Y}=R(D);if(i(T))return d(B,T,{objectMode:!0,write:Z,final:k,destroy:Y});const w=T?.then;if(typeof w=="function"){let H;const K=A(w,T,Q=>{if(Q!=null)throw new _("nully","body",Q)},Q=>{E(H,Q)});return H=new B({objectMode:!0,readable:!1,write:Z,final(Q){k(async()=>{try{await K,r.nextTick(Q,null)}catch(ue){r.nextTick(Q,ue)}})},destroy:Y})}throw new _("Iterable, AsyncIterable or AsyncFunction",L,T)}if(N(D))return q(D.arrayBuffer());if(i(D))return d(B,D,{objectMode:!0,writable:!1});if(l(D?.readable)&&c(D?.writable))return B.fromWeb(D);if(typeof D?.writable=="object"||typeof D?.readable=="object"){const T=D!=null&&D.readable?a(D?.readable)?D?.readable:q(D.readable):void 0,Z=D!=null&&D.writable?o(D?.writable)?D?.writable:q(D.writable):void 0;return F({readable:T,writable:Z})}const te=D?.then;if(typeof te=="function"){let T;return A(te,D,Z=>{Z!=null&&T.push(Z),T.push(null)},Z=>{E(T,Z)}),T=new B({objectMode:!0,writable:!1,read(){}})}throw new y(L,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],D)};function R(q){let{promise:D,resolve:L}=m();const te=new C,T=te.signal;return{value:q(async function*(){for(;;){const k=D;D=null;const{chunk:Y,done:w,cb:H}=await k;if(r.nextTick(H),w)return;if(T.aborted)throw new b(void 0,{cause:T.reason});({promise:D,resolve:L}=m()),yield Y}}(),{signal:T}),write(k,Y,w){const H=L;L=null,H({chunk:k,done:!1,cb:w})},final(k){const Y=L;L=null,Y({done:!0,cb:k})},destroy(k,Y){te.abort(),Y(k)}}}function F(q){const D=q.readable&&typeof q.readable.read!="function"?x.wrap(q.readable):q.readable,L=q.writable;let te=!!t(D),T=!!n(L),Z,k,Y,w,H;function K(Q){const ue=w;w=null,ue?ue(Q):Q&&H.destroy(Q)}return H=new B({readableObjectMode:!!(D!=null&&D.readableObjectMode),writableObjectMode:!!(L!=null&&L.writableObjectMode),readable:te,writable:T}),T&&(h(L,Q=>{T=!1,Q&&E(D,Q),K(Q)}),H._write=function(Q,ue,V){L.write(Q,ue)?V():Z=V},H._final=function(Q){L.end(),k=Q},L.on("drain",function(){if(Z){const Q=Z;Z=null,Q()}}),L.on("finish",function(){if(k){const Q=k;k=null,Q()}})),te&&(h(D,Q=>{te=!1,Q&&E(D,Q),K(Q)}),D.on("readable",function(){if(Y){const Q=Y;Y=null,Q()}}),D.on("end",function(){H.push(null)}),H._read=function(){for(;;){const Q=D.read();if(Q===null){Y=H._read;return}if(!H.push(Q))return}}),H._destroy=function(Q,ue){!Q&&w!==null&&(Q=new b),Y=null,Z=null,k=null,w===null?ue(Q):(w=ue,E(L,Q),E(D,Q))},H}return qi}var Ui,Do;function Lt(){if(Do)return Ui;Do=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=Be();Ui=a;const i=hi(),s=xa();n(a.prototype,i.prototype),n(a,i);{const c=t(s.prototype);for(let h=0;h<c.length;h++){const b=c[h];a.prototype[b]||(a.prototype[b]=s.prototype[b])}}function a(c){if(!(this instanceof a))return new a(c);i.call(this,c),s.call(this,c),c?(this.allowHalfOpen=c.allowHalfOpen!==!1,c.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),c.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(a.prototype,{writable:{__proto__:null,...e(s.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(s.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(s.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(s.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(s.prototype,"writableLength")},writableFinished:{__proto__:null,...e(s.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(s.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(s.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(s.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(c){this._readableState&&this._writableState&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}});let o;function u(){return o===void 0&&(o={}),o}a.fromWeb=function(c,h){return u().newStreamDuplexFromReadableWritablePair(c,h)},a.toWeb=function(c){return u().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Ad()),l(c,"body")},Ui}var Hi,Lo;function ic(){if(Lo)return Hi;Lo=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Hi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=it().codes,n=Lt(),{getHighWaterMark:i}=di();r(a.prototype,n.prototype),r(a,n);const s=e("kCallback");function a(l){if(!(this instanceof a))return new a(l);const c=l?i(this,l,"readableHighWaterMark",!0):null;c===0&&(l={...l,highWaterMark:null,readableHighWaterMark:c,writableHighWaterMark:l.writableHighWaterMark||0}),n.call(this,l),this._readableState.sync=!1,this[s]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",u)}function o(l){typeof this._flush=="function"&&!this.destroyed?this._flush((c,h)=>{if(c){l?l(c):this.destroy(c);return}h!=null&&this.push(h),this.push(null),l&&l()}):(this.push(null),l&&l())}function u(){this._final!==o&&o.call(this)}return a.prototype._final=o,a.prototype._transform=function(l,c,h){throw new t("_transform()")},a.prototype._write=function(l,c,h){const b=this._readableState,y=this._writableState,_=b.length;this._transform(l,c,(E,v)=>{if(E){h(E);return}v!=null&&this.push(v),y.ended||_===b.length||b.length<b.highWaterMark?h():this[s]=h})},a.prototype._read=function(){if(this[s]){const l=this[s];this[s]=null,l()}},Hi}var Vi,Oo;function sc(){if(Oo)return Vi;Oo=1;const{ObjectSetPrototypeOf:r}=Be();Vi=t;const e=ic();r(t.prototype,e.prototype),r(t,e);function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return t.prototype._transform=function(n,i,s){s(null,n)},Vi}var Gi,Co;function Ea(){if(Co)return Gi;Co=1;const r=pr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=Be(),s=zt(),{once:a}=at(),o=jr(),u=Lt(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:h,ERR_MISSING_ARGS:b,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:E}=it(),{validateFunction:v,validateAbortSignal:x}=In(),{isIterable:S,isReadable:m,isReadableNodeStream:d,isNodeStream:g,isTransformStream:N,isWebStream:C,isReadableStream:A,isReadableFinished:B}=jt(),R=globalThis.AbortController||vn().AbortController;let F,q,D;function L(Q,ue,V){let G=!1;Q.on("close",()=>{G=!0});const z=s(Q,{readable:ue,writable:V},U=>{G=!U});return{destroy:U=>{G||(G=!0,o.destroyer(Q,U||new y("pipe")))},cleanup:z}}function te(Q){return v(Q[Q.length-1],"streams[stream.length - 1]"),Q.pop()}function T(Q){if(S(Q))return Q;if(d(Q))return Z(Q);throw new c("val",["Readable","Iterable","AsyncIterable"],Q)}async function*Z(Q){q||(q=hi()),yield*q.prototype[n].call(Q)}async function k(Q,ue,V,{end:G}){let z,U=null;const ee=ge=>{if(ge&&(z=ge),U){const j=U;U=null,j()}},re=()=>new t((ge,j)=>{z?j(z):U=()=>{z?j(z):ge()}});ue.on("drain",ee);const fe=s(ue,{readable:!1},ee);try{ue.writableNeedDrain&&await re();for await(const ge of Q)ue.write(ge)||await re();G&&(ue.end(),await re()),V()}catch(ge){V(z!==ge?l(z,ge):ge)}finally{fe(),ue.off("drain",ee)}}async function Y(Q,ue,V,{end:G}){N(ue)&&(ue=ue.writable);const z=ue.getWriter();try{for await(const U of Q)await z.ready,z.write(U).catch(()=>{});await z.ready,G&&await z.close(),V()}catch(U){try{await z.abort(U),V(U)}catch(ee){V(ee)}}}function w(...Q){return H(Q,a(te(Q)))}function H(Q,ue,V){if(Q.length===1&&e(Q[0])&&(Q=Q[0]),Q.length<2)throw new b("streams");const G=new R,z=G.signal,U=V?.signal,ee=[];x(U,"options.signal");function re(){pe(new E)}D=D||at().addAbortListener;let fe;U&&(fe=D(U,re));let ge,j;const W=[];let se=0;function he(ye){pe(ye,--se===0)}function pe(ye,le){var Re;if(ye&&(!ge||ge.code==="ERR_STREAM_PREMATURE_CLOSE")&&(ge=ye),!(!ge&&!le)){for(;W.length;)W.shift()(ge);(Re=fe)===null||Re===void 0||Re[i](),G.abort(),le&&(ge||ee.forEach(ze=>ze()),r.nextTick(ue,ge,j))}}let me;for(let ye=0;ye<Q.length;ye++){const le=Q[ye],Re=ye<Q.length-1,ze=ye>0,Ie=Re||V?.end!==!1,Xe=ye===Q.length-1;if(g(le)){let I=function(f){f&&f.name!=="AbortError"&&f.code!=="ERR_STREAM_PREMATURE_CLOSE"&&he(f)};if(Ie){const{destroy:f,cleanup:p}=L(le,Re,ze);W.push(f),m(le)&&Xe&&ee.push(p)}le.on("error",I),m(le)&&Xe&&ee.push(()=>{le.removeListener("error",I)})}if(ye===0)if(typeof le=="function"){if(me=le({signal:z}),!S(me))throw new h("Iterable, AsyncIterable or Stream","source",me)}else S(le)||d(le)||N(le)?me=le:me=u.from(le);else if(typeof le=="function"){if(N(me)){var J;me=T((J=me)===null||J===void 0?void 0:J.readable)}else me=T(me);if(me=le(me,{signal:z}),Re){if(!S(me,!0))throw new h("AsyncIterable",`transform[${ye-1}]`,me)}else{var ce;F||(F=sc());const I=new F({objectMode:!0}),f=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof f=="function")se++,f.call(me,X=>{j=X,X!=null&&I.write(X),Ie&&I.end(),r.nextTick(he)},X=>{I.destroy(X),r.nextTick(he,X)});else if(S(me,!0))se++,k(me,I,he,{end:Ie});else if(A(me)||N(me)){const X=me.readable||me;se++,k(X,I,he,{end:Ie})}else throw new h("AsyncIterable or Promise","destination",me);me=I;const{destroy:p,cleanup:$}=L(me,!1,!0);W.push(p),Xe&&ee.push($)}}else if(g(le)){if(d(me)){se+=2;const I=K(me,le,he,{end:Ie});m(le)&&Xe&&ee.push(I)}else if(N(me)||A(me)){const I=me.readable||me;se++,k(I,le,he,{end:Ie})}else if(S(me))se++,k(me,le,he,{end:Ie});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(C(le)){if(d(me))se++,Y(T(me),le,he,{end:Ie});else if(A(me)||S(me))se++,Y(me,le,he,{end:Ie});else if(N(me))se++,Y(me.readable,le,he,{end:Ie});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else me=u.from(le)}return(z!=null&&z.aborted||U!=null&&U.aborted)&&r.nextTick(re),me}function K(Q,ue,V,{end:G}){let z=!1;if(ue.on("close",()=>{z||V(new _)}),Q.pipe(ue,{end:!1}),G){let U=function(){z=!0,ue.end()};B(Q)?r.nextTick(U):Q.once("end",U)}else V();return s(Q,{readable:!0,writable:!1},U=>{const ee=Q._readableState;U&&U.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?Q.once("end",V).once("error",V):V(U)}),s(ue,{readable:!1,writable:!0},V)}return Gi={pipelineImpl:H,pipeline:w},Gi}var Wi,jo;function ac(){if(jo)return Wi;jo=1;const{pipeline:r}=Ea(),e=Lt(),{destroyer:t}=jr(),{isNodeStream:n,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:u,isReadableStream:l}=jt(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:h,ERR_MISSING_ARGS:b}}=it(),y=zt();return Wi=function(...E){if(E.length===0)throw new b("streams");if(E.length===1)return e.from(E[0]);const v=[...E];if(typeof E[0]=="function"&&(E[0]=e.from(E[0])),typeof E[E.length-1]=="function"){const F=E.length-1;E[F]=e.from(E[F])}for(let F=0;F<E.length;++F)if(!(!n(E[F])&&!a(E[F]))){if(F<E.length-1&&!(i(E[F])||l(E[F])||o(E[F])))throw new h(`streams[${F}]`,v[F],"must be readable");if(F>0&&!(s(E[F])||u(E[F])||o(E[F])))throw new h(`streams[${F}]`,v[F],"must be writable")}let x,S,m,d,g;function N(F){const q=d;d=null,q?q(F):F?g.destroy(F):!R&&!B&&g.destroy()}const C=E[0],A=r(E,N),B=!!(s(C)||u(C)||o(C)),R=!!(i(A)||l(A)||o(A));if(g=new e({writableObjectMode:!!(C!=null&&C.writableObjectMode),readableObjectMode:!!(A!=null&&A.readableObjectMode),writable:B,readable:R}),B){if(n(C))g._write=function(q,D,L){C.write(q,D)?L():x=L},g._final=function(q){C.end(),S=q},C.on("drain",function(){if(x){const q=x;x=null,q()}});else if(a(C)){const D=(o(C)?C.writable:C).getWriter();g._write=async function(L,te,T){try{await D.ready,D.write(L).catch(()=>{}),T()}catch(Z){T(Z)}},g._final=async function(L){try{await D.ready,D.close().catch(()=>{}),S=L}catch(te){L(te)}}}const F=o(A)?A.readable:A;y(F,()=>{if(S){const q=S;S=null,q()}})}if(R){if(n(A))A.on("readable",function(){if(m){const F=m;m=null,F()}}),A.on("end",function(){g.push(null)}),g._read=function(){for(;;){const F=A.read();if(F===null){m=g._read;return}if(!g.push(F))return}};else if(a(A)){const q=(o(A)?A.readable:A).getReader();g._read=async function(){for(;;)try{const{value:D,done:L}=await q.read();if(!g.push(D))return;if(L){g.push(null);return}}catch{return}}}}return g._destroy=function(F,q){!F&&d!==null&&(F=new c),m=null,x=null,S=null,d===null?q(F):(d=q,n(A)&&t(A,F))},g},Wi}var $o;function Dd(){if($o)return Pn;$o=1;const r=globalThis.AbortController||vn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:n,ERR_OUT_OF_RANGE:i},AbortError:s}=it(),{validateAbortSignal:a,validateInteger:o,validateObject:u}=In(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:h}=zt(),b=ac(),{addAbortSignalNoValidate:y}=ci(),{isWritable:_,isNodeStream:E}=jt(),{deprecate:v}=at(),{ArrayPrototypePush:x,Boolean:S,MathFloor:m,Number:d,NumberIsNaN:g,Promise:N,PromiseReject:C,PromiseResolve:A,PromisePrototypeThen:B,Symbol:R}=Be(),F=R("kEmpty"),q=R("kEof");function D(U,ee){if(ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),E(U)&&!_(U))throw new e("stream",U,"must be writable");const re=b(this,U);return ee!=null&&ee.signal&&y(ee.signal,re),re}function L(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal");let re=1;ee?.concurrency!=null&&(re=m(ee.concurrency));let fe=re-1;return ee?.highWaterMark!=null&&(fe=m(ee.highWaterMark)),o(re,"options.concurrency",1),o(fe,"options.highWaterMark",0),fe+=re,(async function*(){const j=at().AbortSignalAny([ee?.signal].filter(S)),W=this,se=[],he={signal:j};let pe,me,J=!1,ce=0;function ye(){J=!0,le()}function le(){ce-=1,Re()}function Re(){me&&!J&&ce<re&&se.length<fe&&(me(),me=null)}async function ze(){try{for await(let Ie of W){if(J)return;if(j.aborted)throw new s;try{if(Ie=U(Ie,he),Ie===F)continue;Ie=A(Ie)}catch(Xe){Ie=C(Xe)}ce+=1,B(Ie,le,ye),se.push(Ie),pe&&(pe(),pe=null),!J&&(se.length>=fe||ce>=re)&&await new N(Xe=>{me=Xe})}se.push(q)}catch(Ie){const Xe=C(Ie);B(Xe,le,ye),se.push(Xe)}finally{J=!0,pe&&(pe(),pe=null)}}ze();try{for(;;){for(;se.length>0;){const Ie=await se[0];if(Ie===q)return;if(j.aborted)throw new s;Ie!==F&&(yield Ie),se.shift(),Re()}await new N(Ie=>{pe=Ie})}}finally{J=!0,me&&(me(),me=null)}}).call(this)}function te(U=void 0){return U!=null&&u(U,"options"),U?.signal!=null&&a(U.signal,"options.signal"),(async function*(){let re=0;for await(const ge of this){var fe;if(U!=null&&(fe=U.signal)!==null&&fe!==void 0&&fe.aborted)throw new s({cause:U.signal.reason});yield[re++,ge]}}).call(this)}async function T(U,ee=void 0){for await(const re of w.call(this,U,ee))return!0;return!1}async function Z(U,ee=void 0){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);return!await T.call(this,async(...re)=>!await U(...re),ee)}async function k(U,ee){for await(const re of w.call(this,U,ee))return re}async function Y(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);async function re(fe,ge){return await U(fe,ge),F}for await(const fe of L.call(this,re,ee));}function w(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);async function re(fe,ge){return await U(fe,ge)?fe:F}return L.call(this,re,ee)}class H extends n{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function K(U,ee,re){var fe;if(typeof U!="function")throw new t("reducer",["Function","AsyncFunction"],U);re!=null&&u(re,"options"),re?.signal!=null&&a(re.signal,"options.signal");let ge=arguments.length>1;if(re!=null&&(fe=re.signal)!==null&&fe!==void 0&&fe.aborted){const pe=new s(void 0,{cause:re.signal.reason});throw this.once("error",()=>{}),await h(this.destroy(pe)),pe}const j=new r,W=j.signal;if(re!=null&&re.signal){const pe={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>j.abort(),pe)}let se=!1;try{for await(const pe of this){var he;if(se=!0,re!=null&&(he=re.signal)!==null&&he!==void 0&&he.aborted)throw new s;ge?ee=await U(ee,pe,{signal:W}):(ee=pe,ge=!0)}if(!se&&!ge)throw new H}finally{j.abort()}return ee}async function Q(U){U!=null&&u(U,"options"),U?.signal!=null&&a(U.signal,"options.signal");const ee=[];for await(const fe of this){var re;if(U!=null&&(re=U.signal)!==null&&re!==void 0&&re.aborted)throw new s(void 0,{cause:U.signal.reason});x(ee,fe)}return ee}function ue(U,ee){const re=L.call(this,U,ee);return(async function*(){for await(const ge of re)yield*ge}).call(this)}function V(U){if(U=d(U),g(U))return 0;if(U<0)throw new i("number",">= 0",U);return U}function G(U,ee=void 0){return ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),U=V(U),(async function*(){var fe;if(ee!=null&&(fe=ee.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;for await(const j of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;U--<=0&&(yield j)}}).call(this)}function z(U,ee=void 0){return ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),U=V(U),(async function*(){var fe;if(ee!=null&&(fe=ee.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;for await(const j of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;if(U-- >0&&(yield j),U<=0)return}}).call(this)}return Pn.streamReturningOperators={asIndexedPairs:v(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:ue,map:L,take:z,compose:D},Pn.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:Q,some:T,find:k},Pn}var zi,Fo;function oc(){if(Fo)return zi;Fo=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:n,isWebStream:i}=jt(),{pipelineImpl:s}=Ea(),{finished:a}=zt();lc();function o(...u){return new e((l,c)=>{let h,b;const y=u[u.length-1];if(y&&typeof y=="object"&&!n(y)&&!t(y)&&!i(y)){const _=r(u);h=_.signal,b=_.end}s(u,(_,E)=>{_?c(_):l(E)},{signal:h,end:b})})}return zi={finished:a,pipeline:o},zi}var ko;function lc(){if(ko)return Si.exports;ko=1;const{Buffer:r}=Ct(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=Be(),{promisify:{custom:i}}=at(),{streamReturningOperators:s,promiseReturningOperators:a}=Dd(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=it(),u=ac(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=di(),{pipeline:h}=Ea(),{destroyer:b}=jr(),y=zt(),_=oc(),E=jt(),v=Si.exports=va().Stream;v.isDestroyed=E.isDestroyed,v.isDisturbed=E.isDisturbed,v.isErrored=E.isErrored,v.isReadable=E.isReadable,v.isWritable=E.isWritable,v.Readable=hi();for(const S of t(s)){let d=function(...g){if(new.target)throw o();return v.Readable.from(n(m,this,g))};const m=s[S];e(d,"name",{__proto__:null,value:m.name}),e(d,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:d,enumerable:!1,configurable:!0,writable:!0})}for(const S of t(a)){let d=function(...g){if(new.target)throw o();return n(m,this,g)};const m=a[S];e(d,"name",{__proto__:null,value:m.name}),e(d,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:d,enumerable:!1,configurable:!0,writable:!0})}v.Writable=xa(),v.Duplex=Lt(),v.Transform=ic(),v.PassThrough=sc(),v.pipeline=h;const{addAbortSignal:x}=ci();return v.addAbortSignal=x,v.finished=y,v.destroy=b,v.compose=u,v.setDefaultHighWaterMark=l,v.getDefaultHighWaterMark=c,e(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),e(h,i,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),e(y,i,{__proto__:null,enumerable:!0,get(){return _.finished}}),v.Stream=v,v._isUint8Array=function(m){return m instanceof Uint8Array},v._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},Si.exports}var Po;function uc(){return Po||(Po=1,function(r){const e=lc(),t=oc(),n=e.Readable.destroy;r.exports=e.Readable,r.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,r.exports._isUint8Array=e._isUint8Array,r.exports.isDisturbed=e.isDisturbed,r.exports.isErrored=e.isErrored,r.exports.isReadable=e.isReadable,r.exports.Readable=e.Readable,r.exports.Writable=e.Writable,r.exports.Duplex=e.Duplex,r.exports.Transform=e.Transform,r.exports.PassThrough=e.PassThrough,r.exports.addAbortSignal=e.addAbortSignal,r.exports.finished=e.finished,r.exports.destroy=e.destroy,r.exports.destroy=n,r.exports.pipeline=e.pipeline,r.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),r.exports.Stream=e.Stream,r.exports.default=r.exports}(Ei)),Ei.exports}var Sa=uc();const Qi=Symbol("iter");function gn(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=gn(r[n]||Object.create(null),e[n],t-1);return r}function cc(r,e,t=4){let n=!1;for(const i in r)if(i in e){const s=t===0?null:cc(r[i],e[i],t-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(t===3)return!1}return n}function dc(r,e,t=4){let n=!1;for(const i in r)if(!(i in e))n=n||Object.create(null),n[i]=t===0?null:gn({},r[i],t-1);else if(t!==0){const s=dc(r[i],e[i],t-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(t===3)return!1}return n}class Ld{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||Ne}_termFromId(e){if(e[0]==="."){const 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 dn(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object);let s;return t&&n&&i&&(la(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${n}.${i}.${s}`:`.${t}.${n}.${i}`]}return this._ids[Ir(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${la(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ir(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))}}class et{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||Ne,this._entityIndex=t.entityIndex||new Ld({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;const t=this._graphs;let n,i;for(const s in t)for(const a in n=t[s].subjects)for(const o in i=n[a])e+=Object.keys(i[o]).length;return this._size=e}_addToIndex(e,t,n,i){const s=e[t]||(e[t]={}),a=s[n]||(s[n]={}),o=i in a;return o||(a[i]=null),!o}_removeFromIndex(e,t,n,i){const s=e[t],a=s[n];delete a[i];for(const o in a)return;delete s[n];for(const o in s)return;delete e[t]}*_findInIndex(e,t,n,i,s,a,o,u){let l,c,h;const b=this._entities,y=this._termFromId(b[u]),_={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const E in e)if(c=e[E]){_[s]=this._termFromId(b[E]),n&&((l=c,c={})[n]=l[n]);for(const v in c)if(h=c[v]){_[a]=this._termFromId(b[v]);const x=i?i in h?[i]:[]:Object.keys(h);for(let S=0;S<x.length;S++)_[o]=this._termFromId(b[x[S]]),yield this._factory.quad(_.subject,_.predicate,_.object,y)}}}_loop(e,t){for(const n in e)t(n)}_loopByKey0(e,t,n){let i,s;if(i=e[t])for(s in i)n(s)}_loopByKey1(e,t,n){let i,s;for(i in e)s=e[i],s[t]&&n(i)}_loopBy2Keys(e,t,n,i){let s,a,o;if((s=e[t])&&(a=s[n]))for(o in a)i(o)}_countInIndex(e,t,n,i){let s=0,a,o,u;t&&((a=e,e={})[t]=a[t]);for(const l in e)if(o=e[l]){n&&((a=o,o={})[n]=a[n]);for(const c in o)(u=o[c])&&(i?i in u&&s++:s+=Object.keys(u).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const 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,i){t||(i=e.graph,n=e.object,t=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,t,n)?(this._addToIndex(s.predicates,t,n,e),this._addToIndex(s.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,i){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:i}=e),!this.readQuads(e,t,n,i).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,n,i){t||({subject:e,predicate:t,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;const s=this._graphs;let a,o,u;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(n=n&&this._termToNumericId(n))||!(a=s[i])||!(o=a.subjects[e])||!(u=o[t])||!(n in u))return!1;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--;for(e in a.subjects)return!0;return delete s[i],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,n,i){const s=new Sa.Readable({objectMode:!0}),a=this.readQuads(e,t,n,i);return s._read=o=>{for(;--o>=0;){const{done:u,value:l}=a.next();if(u){s.push(null);return}s.push(l)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,i){return[...this.readQuads(e,t,n,i)]}*readQuads(e,t,n,i){const s=this._getGraphs(i);let a,o,u,l;if(!(e&&!(o=this._termToNumericId(e))||t&&!(u=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(const c in s)(a=s[c])&&(o?l?yield*this._findInIndex(a.objects,l,o,u,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,o,u,null,"subject","predicate","object",c):u?yield*this._findInIndex(a.predicates,u,l,null,"predicate","object","subject",c):l?yield*this._findInIndex(a.objects,l,null,null,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",c))}match(e,t,n,i){return new qt(this,e,t,n,i,{entityIndex:this._entityIndex})}countQuads(e,t,n,i){const s=this._getGraphs(i);let a=0,o,u,l,c;if(e&&!(u=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n)))return 0;for(const h in s)(o=s[h])&&(e?n?a+=this._countInIndex(o.objects,c,u,l):a+=this._countInIndex(o.subjects,u,l,c):t?a+=this._countInIndex(o.predicates,l,c,u):a+=this._countInIndex(o.objects,c,u,l));return a}forEach(e,t,n,i,s){this.some(a=>(e(a,this),!1),t,n,i,s)}every(e,t,n,i,s){return!this.some(a=>!e(a,this),t,n,i,s)}some(e,t,n,i,s){for(const a of this.readQuads(t,n,i,s))if(e(a,this))return!0;return!1}getSubjects(e,t,n){const i=[];return this.forSubjects(s=>{i.push(s)},e,t,n),i}forSubjects(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.predicates,o,u,e):this._loopByKey1(a.subjects,o,e):u?this._loopByKey0(a.objects,u,e):this._loop(a.subjects,e))}getPredicates(e,t,n){const i=[];return this.forPredicates(s=>{i.push(s)},e,t,n),i}forPredicates(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.objects,u,o,e):this._loopByKey0(a.subjects,o,e):u?this._loopByKey1(a.predicates,u,e):this._loop(a.predicates,e))}getObjects(e,t,n){const i=[];return this.forObjects(s=>{i.push(s)},e,t,n),i}forObjects(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.subjects,o,u,e):this._loopByKey1(a.objects,o,e):u?this._loopByKey0(a.predicates,u,e):this._loop(a.objects,e))}getGraphs(e,t,n){const i=[];return this.forGraphs(s=>{i.push(s)},e,t,n),i}forGraphs(e,t,n,i){for(const s in this._graphs)this.some(a=>(e(a.graph),!0),t,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?()=>!0:(o,u)=>{throw new Error(`${o.value} ${u}`)},s=this.getQuads(null,Ke.rdf.rest,Ke.rdf.nil,null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,h;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=this.getQuads(null,null,y,null),E=this.getQuads(y,null,null,null);let v,x=null,S=null,m=null;for(let d=0;d<E.length&&!l;d++)v=E[d],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ke.rdf.first?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ke.rdf.rest?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,h="subject"):l=i(y,"not confined to single graph");for(let d=0;d<_.length&&!l;++d)v=_[d],c?l=i(y,"can't have coreferences"):v.predicate.value===Ke.rdf.rest?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,h="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[h].value]=u)}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof qt&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=gn(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof qt&&(e=e.filtered),e===this)return!0;if(!(e instanceof et)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,n=e._graphs;let i,s,a,o,u;for(const l in n){if(!(i=t[l]))return!1;i=i.subjects;for(const c in s=n[l].subjects){if(!(a=i[c]))return!1;for(const h in o=s[c]){if(!(u=a[h]))return!1;for(const b in o[h])if(!(b in u))return!1}}}return!0}deleteMatches(e,t,n,i){for(const s of this.match(e,t,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof qt&&(e=e.filtered),e===this)return new et({entityIndex:this._entityIndex});if(e instanceof et&&e._entityIndex===this._entityIndex){const t=new et({entityIndex:this._entityIndex}),n=dc(this._graphs,e._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof qt&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new et({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e instanceof qt&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=gn(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof et&&this._entityIndex===e._entityIndex){const t=new et({entityIndex:this._entityIndex}),n=cc(e._graphs,this._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new et({entityIndex:this._entityIndex});for(const n of this)t.add(e(n,this));return t}reduce(e,t){const n=this.readQuads();let i=t===void 0?n.next().value:t;for(const s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new wa().quadsToString(this)}union(e){const t=new et({entityIndex:this._entityIndex});return t._graphs=gn(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function Et(r,e,t=0){const n=e[t];if(n&&!(n in r))return!1;let i=!1;for(const s in n?{[n]:r[n]}:r){const a=t===2?null:Et(r[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class qt extends Sa.Readable{constructor(e,t,n,i,s,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:i,graph:s,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:n,predicate:i,subject:s}=this,a=this._filtered=new et({factory:e._factory,entityIndex:this.options.entityIndex});let o,u,l;if(s&&!(o=a._termToNumericId(s))||i&&!(u=a._termToNumericId(i))||n&&!(l=a._termToNumericId(n)))return a;const c=e._getGraphs(t);for(const h in c){let b,y,_,E;(E=c[h])&&(!o&&u?(y=Et(E.predicates,[u,l,o]))&&(b=Et(E.subjects,[o,u,l]),_=Et(E.objects,[l,o,u])):l?(_=Et(E.objects,[l,o,u]))&&(b=Et(E.subjects,[o,u,l]),y=Et(E.predicates,[u,l,o])):(b=Et(E.subjects,[o,u,l]))&&(y=Et(E.predicates,[u,l,o]),_=Et(E.objects,[l,o,u])),b&&(a._graphs[h]={subjects:b,predicates:y,objects:_}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Qi]&&(this[Qi]=this[Symbol.iterator]());const t=this[Qi];for(;--e>=0;){const{done:n,value:i}=t.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,n,i){return this.filtered.deleteMatches(e,t,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,n,i,s){return this.filtered.every(e,t,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,t,n,i,s){return this.filtered.forEach(e,t,n,i,s)}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,i,s){return this.filtered.some(e,t,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(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 wa().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,n,i){return new qt(this.filtered,e,t,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class Od extends Sa.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new ec(e);let n,i;const s={onQuad:(a,o)=>{a&&this.emit("error",a)||o&&this.push(o)},onPrefix:(a,o)=>{this.emit("prefix",a,o)}};e&&e.comments&&(s.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,o)=>{switch(a){case"data":n=o;break;case"end":i=o;break}}},s),this._transform=(a,o,u)=>{n(a),u()},this._flush=a=>{i(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const xe="http://www.w3.org/ns/shacl#",Mo="http://datashapes.org/dash#",Gt="http://www.w3.org/2001/XMLSchema#",Ut="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Ia="http://www.w3.org/2000/01/rdf-schema#",Na="http://www.w3.org/2004/02/skos/core#",Cd="http://www.w3.org/2002/07/owl#",jd="http://www.w3.org/ns/oa#",$d="http://purl.org/dc/terms/",Fd="http://xmlns.com/foaf/0.1/",mn=Ne.namedNode("loaded-shapes"),Dt=Ne.namedNode("loaded-data"),tt=Ne.namedNode(Ut+"type"),ua=Ne.namedNode($d+"conformsTo"),Bo=Ne.namedNode(Ia+"subClassOf"),Ra=Ne.namedNode(Cd+"imports"),kd=Ne.namedNode(Na+"broader"),Pd=Ne.namedNode(Na+"narrower"),qn=Ne.namedNode(xe+"NodeShape"),Md=Ne.namedNode(xe+"IRI"),ti=Ne.namedNode(xe+"property"),Ta=Ne.namedNode(xe+"class"),Bd=Ne.namedNode(xe+"node"),Nr=Ne.namedNode(xe+"targetClass"),qd=Ne.namedNode(xe+"nodeKind");Ne.namedNode(Gt+"string");function yn(r,e,t=xe,n){let i="";const s=Ud(r,e,t,n);return s&&(i=s.value),i}function Ud(r,e,t=xe,n){let i;const s=t+e;if(n?.length){for(const a of n)for(const o of r)if(o.predicate.value===s){if(o.object.id.endsWith(`@${a}`))return o.object;o.object.id.indexOf("@")<0?i=o.object:i||(i=o.object)}}else for(const a of r)if(a.predicate.value===s)return a.object;return i}function Hd(r){r.querySelector(".editor")?.focus()}function Nn(r,e){return yn(r,"prefLabel",Na,e)||yn(r,"label",Ia,e)||yn(r,"name",Fd,e)}function hc(r,e,t){const n=[];for(const i of r)n.push({value:i,label:Nn(e.getQuads(i,null,null,null),t),children:[]});return n}function ca(r,e){for(const t in e)r=r.replace(e[t],"");return r}function fc(r,e,t,n,i=new Set){for(const s of e.owlImports)i.has(s.id)||(i.add(s.id),n.push(...t.getSubjects(tt,r,s)));e.parent&&fc(r,e.parent,t,n,i)}function Aa(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return hc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(tt,r,mn);t.push(...e.config.store.getSubjects(tt,r,Dt)),fc(r,e,e.config.store,t);const n=new Map,i=new Map;for(const a of t)n.set(a.id,{value:a,label:Nn(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t){for(const o of e.config.store.getObjects(a,kd,null))n.has(o.id)&&i.set(a.id,o.id);for(const o of e.config.store.getObjects(a,Pd,null))n.has(o.id)&&i.set(o.id,a.id);for(const o of e.config.store.getObjects(a,Bo,null))n.has(o.id)&&i.set(a.id,o.id)}for(const[a,o]of i.entries())n.get(o)?.children?.push(n.get(a));const s=[];for(const[a,o]of n.entries())i.has(a)||s.push(o);for(const a of e.config.store.getSubjects(Bo,r,null))s.push(...Aa(a,e));return s}}function da(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function qo(r,e,t){if(e===void 0)return t;if(t===void 0)return e;const n=r.indexOf(e.language);if(n<0)return t;const i=r.indexOf(t.language);return i<0||i>n?e:t}function Vd(r,{remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?()=>!0:(o,u)=>{throw new Error(`${o.value} ${u}`)},s=r.getQuads(null,Ut+"rest",Ut+"nil",null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,h;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=r.getQuads(null,null,y,null),E=r.getQuads(y,null,null,null).filter(d=>!d.predicate.equals(tt));let v,x=null,S=null,m=null;for(let d=0;d<E.length&&!l;d++)v=E[d],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ut+"first"?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ut+"rest"?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,h="subject"):l=i(y,"not confined to single graph");for(let d=0;d<_.length&&!l;++d)v=_[d],c?l=i(y,"can't have coreferences"):v.predicate.value===Ut+"rest"?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,h="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[h].value]=u)}),e&&r.removeQuads(a),n}function pc(r,e,t){const n=document.createElement("div");n.classList.add("shacl-or-constraint");const i=[];if(e instanceof Wt){const s=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],ti,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],ti,null),h=[];let b="";for(const y of c){const _=new ii(y,e,t);h.push(_),b+=(b.length>1?" / ":"")+_.template.label}s.push(h),i.push({label:b,value:l.toString()})}else{const c=new ii(r[l],e,t);s.push([c]),i.push({label:c.template.label,value:l.toString()})}const o=t.theme.createListEditor("Please choose",null,!1,i),u=o.querySelector(".editor");u.onchange=()=>{if(u.value){const l=s[parseInt(u.value)];let c;l.length&&(c=l[0],n.replaceWith(l[0]));for(let h=1;h<l.length;h++)c.after(l[h]),c=l[h]}},n.appendChild(o)}else{const s=[];for(let u=0;u<r.length;u++){const l=t.store.getQuads(r[u],null,null,null);l.length&&(s.push(l),i.push({label:Nn(l,t.languages)||ca(l[0].predicate.value,t.prefixes)+" = "+ca(l[0].object.value,t.prefixes),value:u.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,i,e.template),o=a.querySelector(".editor");o.onchange=()=>{o.value&&n.replaceWith(Kn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function Gd(r,e,t){if(e instanceof _t){const n=e.datatype;for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(a.predicate.value===`${xe}datatype`&&a.object.equals(n))return s}}else{const n=t.store.getObjects(e,tt,null);for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(n.length>0){if(a.predicate.value===`${xe}node`){for(const o of n)if(t.store.getQuads(a.object,Nr,o,null).length>0)return s}if(a.predicate.equals(Ta)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(qd)&&a.object.equals(Md))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Wd(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,ti,null);for(const a of s){const o=t.store.getObjects(a,`${xe}path`,null);for(const u of o)if(i=t.store.countQuads(e,u,null,null)>0,i)break}if(i)return s}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const zd={[`${xe}name`]:(r,e)=>{const t=e;r.name=qo(r.config.languages,r.name,t)},[`${xe}description`]:(r,e)=>{const t=e;r.description=qo(r.config.languages,r.description,t)},[`${xe}path`]:(r,e)=>{r.path=e.value},[`${xe}node`]:(r,e)=>{r.node=e},[`${xe}datatype`]:(r,e)=>{r.datatype=e},[`${xe}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${xe}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${xe}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${xe}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${xe}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${xe}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${xe}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${xe}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${xe}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${xe}pattern`]:(r,e)=>{r.pattern=e.value},[`${xe}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${Mo}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${Mo}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${jd}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${xe}and`]:(r,e)=>{r.shaclAnd=e.value},[`${xe}in`]:(r,e)=>{r.shaclIn=e.value},[`${xe}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=Ne.namedNode(Ut+"langString")},[`${xe}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${xe}hasValue`]:(r,e)=>{r.hasValue=e},[`${xe}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${xe}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${xe}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[Ra.id]:(r,e)=>{r.owlImports.push(e)},[Ta.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Nr,e,null);t.length>0&&(r.node=t[0])},[`${xe}or`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",r.config.lists)},[`${xe}xone`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",r.config.lists)}};class Qd{constructor(e,t,n){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=n,this.merge(e),this.qualifiedValueShape&&this.merge(n.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)zd[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Nn(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?ca(this.path,this.config.prefixes):"unknown"),this.node&&this.extendedShapes.push(this.node),this.shaclAnd){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const n of t)this.extendedShapes.push(n)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const Xd=`form { display:block; --label-width: 8em; --caret-size: 10px; }
28
28
  form.mode-edit { padding-left: 1em; }
29
29
  form, form * { box-sizing: border-box; }
30
30
  shacl-node, .collapsible::part(content) { display: flex; flex-direction: column; width: 100%; position: relative; }
@@ -72,26 +72,26 @@ a, a:visited { color: inherit; }
72
72
  .collapsible > .property-instance > shacl-node > h1 { display: none; }
73
73
  .ref-link { cursor: pointer; }
74
74
  .ref-link:hover { text-decoration: underline; }
75
- .node-id-display { color: #999; font-size: 11px; }`;class zd{constructor(e){let t=Wd;e&&(t+=`
76
- `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,n){const i=document.createElement("div"),s=document.createElement("label");s.innerHTML=e+":",n.description&&s.setAttribute("title",n.description.value),i.appendChild(s);let a=t.value,o=null;if(t instanceof vn){const l=n.config.store.getQuads(a,null,null,null);if(l.length){const c=Rn(l,n.config.languages);c&&(a=c)}}else t instanceof ct&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Gt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Gt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let u;return oa(t.value)?(u=document.createElement("a"),u.setAttribute("href",t.value)):u=document.createElement("div"),u.classList.add("d-flex"),u.innerText=a,o&&u.appendChild(o),i.appendChild(u),i}}function Qd(r,e,t){if(t){const n=r.minCount!==void 0&&r.minCount>0;if(r.class)return r.config.theme.createListEditor(r.label,e,n,Ia(r.class,r),r);if(r.shaclIn){const i=r.config.lists[r.shaclIn];if(i?.length){const s=uc(i,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,e,n,s,r)}else console.error("list not found:",r.shaclIn,"existing lists:",r.config.lists)}if(r.datatype?.value===`${Ut}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Gt,"")){case"integer":case"float":case"double":case"decimal":return r.config.theme.createNumberEditor(r.label,e,n,r);case"date":case"dateTime":return r.config.theme.createDateEditor(r.label,e,n,r);case"boolean":return r.config.theme.createBooleanEditor(r.label,e,n,r);case"base64Binary":return r.config.theme.createFileEditor(r.label,e,n,r)}return r.config.theme.createTextEditor(r.label,e,n,r)}else{if(e)return r.config.theme.createViewer(r.label,e,r);const n=document.createElement("div");return n.innerHTML="No value",n}}function Xd(r,e,t){if(e==="application/ld+json")return Jd(r);{const n=new ma({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function Jd(r){const e=[];for(const t of r){const n={"@id":t.subject.id};if(t.predicate===tt)n["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof ct?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Gt}#string`&&(i={"@type":t.object.datatype.value,"@value":t.object.value}):i={"@id":t.object.id},n[t.predicate.value]=i}e.push(n)}return JSON.stringify(e)}function Kd(r){let e=r.shaclDatatype,t=r.value;if(t){if(t.startsWith("<")&&t.endsWith(">")&&t.indexOf(":")>-1)return Ne.namedNode(t.substring(1,t.length-1));if(r.dataset.class||r.dataset.nodeKind===xe+"IRI")return Ne.namedNode(t);if(r.dataset.link)return JSON.parse(r.dataset.link);if(r.dataset.lang?e=r.dataset.lang:r.type==="number"?t=parseFloat(t):r.type==="file"&&r.binaryData?t=r.binaryData:r.type==="datetime-local"&&(t=new Date(t).toISOString().slice(0,19)),!e&&typeof t=="string"){const n=t.split("^^");n.length===2&&(n[0].startsWith('"')&&n[0].endsWith('"')||n[0].startsWith("'")&&n[0].endsWith("'"))&&n[1].split(":").length===2&&(t=n[0].substring(1,n[0].length-1),e=Ne.namedNode(n[1]))}return Ne.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Ne.literal(r.checked?"true":"false",e)}const bn={};function Yd(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):bn[`${r.predicate}^${r.datatype}`]=r}function Zd(){return Object.entries(bn).map(r=>r[1])}function eh(r,e){let t=bn[`${r}^${e}`];return t||(t=bn[`${r}^undefined`],t)?t:bn[`undefined^${e}`]}class gy{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)}}/**
75
+ .node-id-display { color: #999; font-size: 11px; }`;class Jd{constructor(e){let t=Xd;e&&(t+=`
76
+ `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,n){const i=document.createElement("div"),s=document.createElement("label");s.innerHTML=e+":",n.description&&s.setAttribute("title",n.description.value),i.appendChild(s);let a=t.value,o=null;if(t instanceof oi){const l=n.config.store.getQuads(a,null,null,null);if(l.length){const c=Nn(l,n.config.languages);c&&(a=c)}}else t instanceof _t&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Gt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Gt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let u;return da(t.value)?(u=document.createElement("a"),u.setAttribute("href",t.value)):u=document.createElement("div"),u.classList.add("d-flex"),u.innerText=a,o&&u.appendChild(o),i.appendChild(u),i}}function Kd(r,e,t){if(t){const n=r.minCount!==void 0&&r.minCount>0;if(r.class)return r.config.theme.createListEditor(r.label,e,n,Aa(r.class,r),r);if(r.shaclIn){const i=r.config.lists[r.shaclIn];if(i?.length){const s=hc(i,r.config.store,r.config.languages);return r.config.theme.createListEditor(r.label,e,n,s,r)}else console.error("list not found:",r.shaclIn,"existing lists:",r.config.lists)}if(r.datatype?.value===`${Ut}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Gt,"")){case"integer":case"float":case"double":case"decimal":return r.config.theme.createNumberEditor(r.label,e,n,r);case"date":case"dateTime":return r.config.theme.createDateEditor(r.label,e,n,r);case"boolean":return r.config.theme.createBooleanEditor(r.label,e,n,r);case"base64Binary":return r.config.theme.createFileEditor(r.label,e,n,r)}return r.config.theme.createTextEditor(r.label,e,n,r)}else{if(e)return r.config.theme.createViewer(r.label,e,r);const n=document.createElement("div");return n.innerHTML="No value",n}}function Yd(r,e,t){if(e==="application/ld+json")return Zd(r);{const n=new wa({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function Zd(r){const e=[];for(const t of r){const n={"@id":t.subject.id};if(t.predicate===tt)n["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof _t?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Gt}#string`&&(i={"@type":t.object.datatype.value,"@value":t.object.value}):i={"@id":t.object.id},n[t.predicate.value]=i}e.push(n)}return JSON.stringify(e)}function eh(r){let e=r.shaclDatatype,t=r.value;if(t){if(t.startsWith("<")&&t.endsWith(">")&&t.indexOf(":")>-1)return Ne.namedNode(t.substring(1,t.length-1));if(r.dataset.class||r.dataset.nodeKind===xe+"IRI")return Ne.namedNode(t);if(r.dataset.link)return JSON.parse(r.dataset.link);if(r.dataset.lang?e=r.dataset.lang:r.type==="number"?t=parseFloat(t):r.type==="file"&&r.binaryData?t=r.binaryData:r.type==="datetime-local"&&(t=new Date(t).toISOString().slice(0,19)),!e&&typeof t=="string"){let n=t.split("^^");n.length===2&&n[0].startsWith('"')&&n[0].endsWith('"')&&n[1].split(":").length===2?(t=n[0].substring(1,n[0].length-1),e=Ne.namedNode(n[1])):(n=t.split("@"),n.length===2&&n[0].startsWith('"')&&n[0].endsWith('"')&&(t=n[0].substring(1,n[0].length-1),e=n[1]))}return Ne.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Ne.literal(r.checked?"true":"false",e)}const bn={};function th(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):bn[`${r.predicate}^${r.datatype}`]=r}function rh(){return Object.entries(bn).map(r=>r[1])}function nh(r,e){let t=bn[`${r}^${e}`];return t||(t=bn[`${r}^undefined`],t)?t:bn[`undefined^${e}`]}class wy{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)}}/**
77
77
  * @license
78
78
  * Copyright 2019 Google LLC
79
79
  * SPDX-License-Identifier: BSD-3-Clause
80
- */const Wn=globalThis,Na=Wn.ShadowRoot&&(Wn.ShadyCSS===void 0||Wn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ra=Symbol(),Po=new WeakMap;let hc=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Ra)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Na&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=Po.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Po.set(t,e))}return e}toString(){return this.cssText}};const th=r=>new hc(typeof r=="string"?r:r+"",void 0,Ra),St=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((n,i,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[s+1],r[0]);return new hc(t,r,Ra)},rh=(r,e)=>{if(Na)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Wn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Mo=Na?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return th(t)})(r):r;/**
80
+ */const Wn=globalThis,Da=Wn.ShadowRoot&&(Wn.ShadyCSS===void 0||Wn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,La=Symbol(),Uo=new WeakMap;let gc=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==La)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(Da&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=Uo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Uo.set(t,e))}return e}toString(){return this.cssText}};const ih=r=>new gc(typeof r=="string"?r:r+"",void 0,La),St=(r,...e)=>{const t=r.length===1?r[0]:e.reduce((n,i,s)=>n+(a=>{if(a._$cssResult$===!0)return a.cssText;if(typeof a=="number")return a;throw Error("Value passed to 'css' function must be a 'css' function result: "+a+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[s+1],r[0]);return new gc(t,r,La)},sh=(r,e)=>{if(Da)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Wn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Ho=Da?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return ih(t)})(r):r;/**
81
81
  * @license
82
82
  * Copyright 2017 Google LLC
83
83
  * SPDX-License-Identifier: BSD-3-Clause
84
- */const{is:nh,defineProperty:ih,getOwnPropertyDescriptor:sh,getOwnPropertyNames:ah,getOwnPropertySymbols:oh,getPrototypeOf:lh}=Object,ci=globalThis,Bo=ci.trustedTypes,uh=Bo?Bo.emptyScript:"",ch=ci.reactiveElementPolyfillSupport,_n=(r,e)=>r,la={toAttribute(r,e){switch(e){case Boolean:r=r?uh:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},fc=(r,e)=>!nh(r,e),qo={attribute:!0,type:String,converter:la,reflect:!1,useDefault:!1,hasChanged:fc};Symbol.metadata??=Symbol("metadata"),ci.litPropertyMetadata??=new WeakMap;let vr=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=qo){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){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&ih(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=sh(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??qo}static _$Ei(){if(this.hasOwnProperty(_n("elementProperties")))return;const e=lh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_n("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_n("properties"))){const t=this.properties,n=[...ah(t),...oh(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Mo(i))}else e!==void 0&&t.push(Mo(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?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_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return rh(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){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const s=(n.converter?.toAttribute!==void 0?n.converter:la).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=n.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:la;this._$Em=i;const o=a.fromAttribute(t,s.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,s=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??fc)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const 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(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,s]of n){const{wrapped:a}=s,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.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(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};vr.elementStyles=[],vr.shadowRootOptions={mode:"open"},vr[_n("elementProperties")]=new Map,vr[_n("finalized")]=new Map,ch?.({ReactiveElement:vr}),(ci.reactiveElementVersions??=[]).push("2.1.1");/**
84
+ */const{is:ah,defineProperty:oh,getOwnPropertyDescriptor:lh,getOwnPropertyNames:uh,getOwnPropertySymbols:ch,getPrototypeOf:dh}=Object,fi=globalThis,Vo=fi.trustedTypes,hh=Vo?Vo.emptyScript:"",fh=fi.reactiveElementPolyfillSupport,_n=(r,e)=>r,ha={toAttribute(r,e){switch(e){case Boolean:r=r?hh:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},mc=(r,e)=>!ah(r,e),Go={attribute:!0,type:String,converter:ha,reflect:!1,useDefault:!1,hasChanged:mc};Symbol.metadata??=Symbol("metadata"),fi.litPropertyMetadata??=new WeakMap;let vr=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=Go){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){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&oh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=lh(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Go}static _$Ei(){if(this.hasOwnProperty(_n("elementProperties")))return;const e=dh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_n("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_n("properties"))){const t=this.properties,n=[...uh(t),...ch(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Ho(i))}else e!==void 0&&t.push(Ho(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?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_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return sh(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){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const s=(n.converter?.toAttribute!==void 0?n.converter:ha).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=n.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ha;this._$Em=i;const o=a.fromAttribute(t,s.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,s=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??mc)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const 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(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,s]of n){const{wrapped:a}=s,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.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(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}};vr.elementStyles=[],vr.shadowRootOptions={mode:"open"},vr[_n("elementProperties")]=new Map,vr[_n("finalized")]=new Map,fh?.({ReactiveElement:vr}),(fi.reactiveElementVersions??=[]).push("2.1.1");/**
85
85
  * @license
86
86
  * Copyright 2017 Google LLC
87
87
  * SPDX-License-Identifier: BSD-3-Clause
88
- */const Ta=globalThis,ei=Ta.trustedTypes,Uo=ei?ei.createPolicy("lit-html",{createHTML:r=>r}):void 0,pc="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,gc="?"+Ht,dh=`<${gc}>`,ur=document,En=()=>ur.createComment(""),Sn=r=>r===null||typeof r!="object"&&typeof r!="function",Aa=Array.isArray,hh=r=>Aa(r)||typeof r?.[Symbol.iterator]=="function",Wi=`[
89
- \f\r]`,Qr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ho=/-->/g,Vo=/>/g,Kt=RegExp(`>|${Wi}(?:([^\\s"'>=/]+)(${Wi}*=${Wi}*(?:[^
90
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Go=/'/g,Wo=/"/g,mc=/^(?:script|style|textarea|title)$/i,fh=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),dt=fh(1),Rr=Symbol.for("lit-noChange"),Ve=Symbol.for("lit-nothing"),zo=new WeakMap,or=ur.createTreeWalker(ur,129);function yc(r,e){if(!Aa(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Uo!==void 0?Uo.createHTML(e):e}const ph=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=Qr;for(let o=0;o<t;o++){const u=r[o];let l,c,d=-1,b=0;for(;b<u.length&&(a.lastIndex=b,c=a.exec(u),c!==null);)b=a.lastIndex,a===Qr?c[1]==="!--"?a=Ho:c[1]!==void 0?a=Vo:c[2]!==void 0?(mc.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Kt):c[3]!==void 0&&(a=Kt):a===Kt?c[0]===">"?(a=i??Qr,d=-1):c[1]===void 0?d=-2:(d=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Kt:c[3]==='"'?Wo:Go):a===Wo||a===Go?a=Kt:a===Ho||a===Vo?a=Qr:(a=Kt,i=void 0);const y=a===Kt&&r[o+1].startsWith("/>")?" ":"";s+=a===Qr?u+dh:d>=0?(n.push(l),u.slice(0,d)+pc+u.slice(d)+Ht+y):u+Ht+(d===-2?o:y)}return[yc(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let ua=class bc{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,u=this.parts,[l,c]=ph(e,t);if(this.el=bc.createElement(l,n),or.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=or.nextNode())!==null&&u.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(pc)){const b=c[a++],y=i.getAttribute(d).split(Ht),_=/([.?@])?(.*)/.exec(b);u.push({type:1,index:s,name:_[2],strings:y,ctor:_[1]==="."?mh:_[1]==="?"?yh:_[1]==="@"?bh:di}),i.removeAttribute(d)}else d.startsWith(Ht)&&(u.push({type:6,index:s}),i.removeAttribute(d));if(mc.test(i.tagName)){const d=i.textContent.split(Ht),b=d.length-1;if(b>0){i.textContent=ei?ei.emptyScript:"";for(let y=0;y<b;y++)i.append(d[y],En()),or.nextNode(),u.push({type:2,index:++s});i.append(d[b],En())}}}else if(i.nodeType===8)if(i.data===gc)u.push({type:2,index:s});else{let d=-1;for(;(d=i.data.indexOf(Ht,d+1))!==-1;)u.push({type:7,index:s}),d+=Ht.length-1}s++}}static createElement(e,t){const n=ur.createElement("template");return n.innerHTML=e,n}};function Tr(r,e,t=r,n){if(e===Rr)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const s=Sn(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=Tr(r,i._$AS(r,e.values),i,n)),e}let gh=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){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ur).importNode(t,!0);or.currentNode=i;let s=or.nextNode(),a=0,o=0,u=n[0];for(;u!==void 0;){if(a===u.index){let l;u.type===2?l=new Da(s,s.nextSibling,this,e):u.type===1?l=new u.ctor(s,u.name,u.strings,this,e):u.type===6&&(l=new _h(s,this,e)),this._$AV.push(l),u=n[++o]}a!==u?.index&&(s=or.nextNode(),a++)}return or.currentNode=ur,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},Da=class _c{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Ve,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const 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=Tr(this,e,t),Sn(e)?e===Ve||e==null||e===""?(this._$AH!==Ve&&this._$AR(),this._$AH=Ve):e!==this._$AH&&e!==Rr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):hh(e)?this.k(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!==Ve&&Sn(this._$AH)?this._$AA.nextSibling.data=e:this.T(ur.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ua.createElement(yc(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new gh(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=zo.get(e.strings);return t===void 0&&zo.set(e.strings,t=new ua(e)),t}k(e){Aa(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new _c(this.O(En()),this.O(En()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},di=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=Ve,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ve}_$AI(e,t=this,n,i){const s=this.strings;let a=!1;if(s===void 0)e=Tr(this,e,t,0),a=!Sn(e)||e!==this._$AH&&e!==Rr,a&&(this._$AH=e);else{const o=e;let u,l;for(e=s[0],u=0;u<s.length-1;u++)l=Tr(this,o[n+u],t,u),l===Rr&&(l=this._$AH[u]),a||=!Sn(l)||l!==this._$AH[u],l===Ve?e=Ve:e!==Ve&&(e+=(l??"")+s[u+1]),this._$AH[u]=l}a&&!i&&this.j(e)}j(e){e===Ve?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},mh=class extends di{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ve?void 0:e}};class yh extends di{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ve)}}let bh=class extends di{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Tr(this,e,t,0)??Ve)===Rr)return;const n=this._$AH,i=e===Ve&&n!==Ve||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ve&&(n===Ve||i);i&&this.element.removeEventListener(this.name,this,n),s&&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)}},_h=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){Tr(this,e)}};const wh=Ta.litHtmlPolyfillSupport;wh?.(ua,Da),(Ta.litHtmlVersions??=[]).push("3.3.1");const vh=(r,e,t)=>{const n=t?.renderBefore??e;let i=n._$litPart$;if(i===void 0){const s=t?.renderBefore??null;n._$litPart$=i=new Da(e.insertBefore(En(),s),s,void 0,t??{})}return i._$AI(r),i};/**
88
+ */const Oa=globalThis,ri=Oa.trustedTypes,Wo=ri?ri.createPolicy("lit-html",{createHTML:r=>r}):void 0,yc="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,bc="?"+Ht,ph=`<${bc}>`,ur=document,xn=()=>ur.createComment(""),En=r=>r===null||typeof r!="object"&&typeof r!="function",Ca=Array.isArray,gh=r=>Ca(r)||typeof r?.[Symbol.iterator]=="function",Xi=`[
89
+ \f\r]`,Qr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zo=/-->/g,Qo=/>/g,Kt=RegExp(`>|${Xi}(?:([^\\s"'>=/]+)(${Xi}*=${Xi}*(?:[^
90
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Xo=/'/g,Jo=/"/g,_c=/^(?:script|style|textarea|title)$/i,mh=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ct=mh(1),Rr=Symbol.for("lit-noChange"),Ve=Symbol.for("lit-nothing"),Ko=new WeakMap,or=ur.createTreeWalker(ur,129);function wc(r,e){if(!Ca(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wo!==void 0?Wo.createHTML(e):e}const yh=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=Qr;for(let o=0;o<t;o++){const u=r[o];let l,c,h=-1,b=0;for(;b<u.length&&(a.lastIndex=b,c=a.exec(u),c!==null);)b=a.lastIndex,a===Qr?c[1]==="!--"?a=zo:c[1]!==void 0?a=Qo:c[2]!==void 0?(_c.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Kt):c[3]!==void 0&&(a=Kt):a===Kt?c[0]===">"?(a=i??Qr,h=-1):c[1]===void 0?h=-2:(h=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Kt:c[3]==='"'?Jo:Xo):a===Jo||a===Xo?a=Kt:a===zo||a===Qo?a=Qr:(a=Kt,i=void 0);const y=a===Kt&&r[o+1].startsWith("/>")?" ":"";s+=a===Qr?u+ph:h>=0?(n.push(l),u.slice(0,h)+yc+u.slice(h)+Ht+y):u+Ht+(h===-2?o:y)}return[wc(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let fa=class vc{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,u=this.parts,[l,c]=yh(e,t);if(this.el=vc.createElement(l,n),or.currentNode=this.el.content,t===2||t===3){const h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(i=or.nextNode())!==null&&u.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const h of i.getAttributeNames())if(h.endsWith(yc)){const b=c[a++],y=i.getAttribute(h).split(Ht),_=/([.?@])?(.*)/.exec(b);u.push({type:1,index:s,name:_[2],strings:y,ctor:_[1]==="."?_h:_[1]==="?"?wh:_[1]==="@"?vh:pi}),i.removeAttribute(h)}else h.startsWith(Ht)&&(u.push({type:6,index:s}),i.removeAttribute(h));if(_c.test(i.tagName)){const h=i.textContent.split(Ht),b=h.length-1;if(b>0){i.textContent=ri?ri.emptyScript:"";for(let y=0;y<b;y++)i.append(h[y],xn()),or.nextNode(),u.push({type:2,index:++s});i.append(h[b],xn())}}}else if(i.nodeType===8)if(i.data===bc)u.push({type:2,index:s});else{let h=-1;for(;(h=i.data.indexOf(Ht,h+1))!==-1;)u.push({type:7,index:s}),h+=Ht.length-1}s++}}static createElement(e,t){const n=ur.createElement("template");return n.innerHTML=e,n}};function Tr(r,e,t=r,n){if(e===Rr)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const s=En(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=Tr(r,i._$AS(r,e.values),i,n)),e}class bh{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){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ur).importNode(t,!0);or.currentNode=i;let s=or.nextNode(),a=0,o=0,u=n[0];for(;u!==void 0;){if(a===u.index){let l;u.type===2?l=new ja(s,s.nextSibling,this,e):u.type===1?l=new u.ctor(s,u.name,u.strings,this,e):u.type===6&&(l=new xh(s,this,e)),this._$AV.push(l),u=n[++o]}a!==u?.index&&(s=or.nextNode(),a++)}return or.currentNode=ur,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}let ja=class xc{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Ve,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const 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=Tr(this,e,t),En(e)?e===Ve||e==null||e===""?(this._$AH!==Ve&&this._$AR(),this._$AH=Ve):e!==this._$AH&&e!==Rr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):gh(e)?this.k(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!==Ve&&En(this._$AH)?this._$AA.nextSibling.data=e:this.T(ur.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=fa.createElement(wc(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new bh(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=Ko.get(e.strings);return t===void 0&&Ko.set(e.strings,t=new fa(e)),t}k(e){Ca(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new xc(this.O(xn()),this.O(xn()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},pi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=Ve,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ve}_$AI(e,t=this,n,i){const s=this.strings;let a=!1;if(s===void 0)e=Tr(this,e,t,0),a=!En(e)||e!==this._$AH&&e!==Rr,a&&(this._$AH=e);else{const o=e;let u,l;for(e=s[0],u=0;u<s.length-1;u++)l=Tr(this,o[n+u],t,u),l===Rr&&(l=this._$AH[u]),a||=!En(l)||l!==this._$AH[u],l===Ve?e=Ve:e!==Ve&&(e+=(l??"")+s[u+1]),this._$AH[u]=l}a&&!i&&this.j(e)}j(e){e===Ve?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},_h=class extends pi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ve?void 0:e}},wh=class extends pi{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ve)}},vh=class extends pi{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Tr(this,e,t,0)??Ve)===Rr)return;const n=this._$AH,i=e===Ve&&n!==Ve||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ve&&(n===Ve||i);i&&this.element.removeEventListener(this.name,this,n),s&&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)}},xh=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){Tr(this,e)}};const Eh=Oa.litHtmlPolyfillSupport;Eh?.(fa,ja),(Oa.litHtmlVersions??=[]).push("3.3.1");const Sh=(r,e,t)=>{const n=t?.renderBefore??e;let i=n._$litPart$;if(i===void 0){const s=t?.renderBefore??null;n._$litPart$=i=new ja(e.insertBefore(xn(),s),s,void 0,t??{})}return i._$AI(r),i};/**
91
91
  * @license
92
92
  * Copyright 2017 Google LLC
93
93
  * SPDX-License-Identifier: BSD-3-Clause
94
- */const La=globalThis;class lr extends vr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=vh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Rr}}lr._$litElement$=!0,lr.finalized=!0,La.litElementHydrateSupport?.({LitElement:lr});const xh=La.litElementPolyfillSupport;xh?.({LitElement:lr});(La.litElementVersions??=[]).push("4.2.1");var wc=r=>{throw TypeError(r)},vc=(r,e,t)=>e.has(r)||wc("Cannot "+t),Bt=(r,e,t)=>(vc(r,e,"read from private field"),t?t.call(r):e.get(r)),Eh=(r,e,t)=>e.has(r)?wc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Sh=(r,e,t,n)=>(vc(r,e,"write to private field"),e.set(r,t),t);const Qt=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},zn=globalThis,Oa=zn.ShadowRoot&&(zn.ShadyCSS===void 0||zn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,xc=Symbol(),Qo=new WeakMap;let Ih=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==xc)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o;const e=this.t;if(Oa&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Qo.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Qo.set(e,r))}return r}toString(){return this.cssText}};const Nh=r=>new Ih(typeof r=="string"?r:r+"",void 0,xc),Rh=(r,e)=>{if(Oa)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=zn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Xo=Oa?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Nh(t)})(r):r,{is:Th,defineProperty:Ah,getOwnPropertyDescriptor:Dh,getOwnPropertyNames:Lh,getOwnPropertySymbols:Oh,getPrototypeOf:Ch}=Object,hi=globalThis,Jo=hi.trustedTypes,jh=Jo?Jo.emptyScript:"",$h=hi.reactiveElementPolyfillSupport,wn=(r,e)=>r,ti={toAttribute(r,e){switch(e){case Boolean:r=r?jh:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Ca=(r,e)=>!Th(r,e),Ko={attribute:!0,type:String,converter:ti,reflect:!1,useDefault:!1,hasChanged:Ca};Symbol.metadata??=Symbol("metadata"),hi.litPropertyMetadata??=new WeakMap;class Xr 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=Ko){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){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Ah(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Dh(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ko}static _$Ei(){if(this.hasOwnProperty(wn("elementProperties")))return;const e=Ch(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(wn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(wn("properties"))){const t=this.properties,n=[...Lh(t),...Oh(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Xo(i))}else e!==void 0&&t.push(Xo(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?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_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Rh(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){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const s=(n.converter?.toAttribute!==void 0?n.converter:ti).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=n.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ti;this._$Em=i,this[i]=a.fromAttribute(t,s.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,s=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??Ca)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const 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(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,s]of n){const{wrapped:a}=s,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.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(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}}Xr.elementStyles=[],Xr.shadowRootOptions={mode:"open"},Xr[wn("elementProperties")]=new Map,Xr[wn("finalized")]=new Map,$h?.({ReactiveElement:Xr}),(hi.reactiveElementVersions??=[]).push("2.1.0");const Fh={attribute:!0,type:String,converter:ti,reflect:!1,hasChanged:Ca},kh=(r=Fh,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),s.set(t.name,r),n==="accessor"){const{name:a}=t;return{set(o){const u=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,u,r)},init(o){return o!==void 0&&this.C(a,void 0,r,o),o}}}if(n==="setter"){const{name:a}=t;return function(o){const u=this[a];e.call(this,o),this.requestUpdate(a,u,r)}}throw Error("Unsupported decorator location: "+n)};function Se(r){return(e,t)=>typeof t=="object"?kh(r,e,t):((n,i,s)=>{const a=i.hasOwnProperty(s);return i.constructor.createProperty(s,n),a?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}function ja(r){return Se({...r,state:!0,attribute:!1})}const Ph=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function pt(r,e){return(t,n,i)=>{const s=a=>a.renderRoot?.querySelector(r)??null;return Ph(t,n,{get(){return s(this)}})}}var Mh=Object.defineProperty,Xt=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(e,t,i)||i);return i&&Mh(e,t,i),i};const ca=class extends lr{constructor(){super(...arguments),this.dense=!1}};ca.shadowRootOptions={...lr.shadowRootOptions,delegatesFocus:!0},ca.styles=[St`
94
+ */const $a=globalThis;class lr extends vr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Sh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Rr}}lr._$litElement$=!0,lr.finalized=!0,$a.litElementHydrateSupport?.({LitElement:lr});const Ih=$a.litElementPolyfillSupport;Ih?.({LitElement:lr});($a.litElementVersions??=[]).push("4.2.1");var Ec=r=>{throw TypeError(r)},Sc=(r,e,t)=>e.has(r)||Ec("Cannot "+t),Bt=(r,e,t)=>(Sc(r,e,"read from private field"),t?t.call(r):e.get(r)),Nh=(r,e,t)=>e.has(r)?Ec("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Rh=(r,e,t,n)=>(Sc(r,e,"write to private field"),e.set(r,t),t);const Qt=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},zn=globalThis,Fa=zn.ShadowRoot&&(zn.ShadyCSS===void 0||zn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ic=Symbol(),Yo=new WeakMap;let Th=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Ic)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=r,this.t=e}get styleSheet(){let r=this.o;const e=this.t;if(Fa&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Yo.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Yo.set(e,r))}return r}toString(){return this.cssText}};const Ah=r=>new Th(typeof r=="string"?r:r+"",void 0,Ic),Dh=(r,e)=>{if(Fa)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=zn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Zo=Fa?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Ah(t)})(r):r,{is:Lh,defineProperty:Oh,getOwnPropertyDescriptor:Ch,getOwnPropertyNames:jh,getOwnPropertySymbols:$h,getPrototypeOf:Fh}=Object,gi=globalThis,el=gi.trustedTypes,kh=el?el.emptyScript:"",Ph=gi.reactiveElementPolyfillSupport,wn=(r,e)=>r,ni={toAttribute(r,e){switch(e){case Boolean:r=r?kh:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},ka=(r,e)=>!Lh(r,e),tl={attribute:!0,type:String,converter:ni,reflect:!1,useDefault:!1,hasChanged:ka};Symbol.metadata??=Symbol("metadata"),gi.litPropertyMetadata??=new WeakMap;class Xr 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=tl){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){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Oh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Ch(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??tl}static _$Ei(){if(this.hasOwnProperty(wn("elementProperties")))return;const e=Fh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(wn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(wn("properties"))){const t=this.properties,n=[...jh(t),...$h(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Zo(i))}else e!==void 0&&t.push(Zo(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?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_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Dh(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){const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const s=(n.converter?.toAttribute!==void 0?n.converter:ni).toAttribute(t,n.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=n.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ni;this._$Em=i,this[i]=a.fromAttribute(t,s.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,s=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??ka)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const 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(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,s]of n){const{wrapped:a}=s,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(t=>t.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(t=>this._$ET(t,this[t])),this._$EM()}updated(e){}firstUpdated(e){}}Xr.elementStyles=[],Xr.shadowRootOptions={mode:"open"},Xr[wn("elementProperties")]=new Map,Xr[wn("finalized")]=new Map,Ph?.({ReactiveElement:Xr}),(gi.reactiveElementVersions??=[]).push("2.1.0");const Mh={attribute:!0,type:String,converter:ni,reflect:!1,hasChanged:ka},Bh=(r=Mh,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),s.set(t.name,r),n==="accessor"){const{name:a}=t;return{set(o){const u=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,u,r)},init(o){return o!==void 0&&this.C(a,void 0,r,o),o}}}if(n==="setter"){const{name:a}=t;return function(o){const u=this[a];e.call(this,o),this.requestUpdate(a,u,r)}}throw Error("Unsupported decorator location: "+n)};function Se(r){return(e,t)=>typeof t=="object"?Bh(r,e,t):((n,i,s)=>{const a=i.hasOwnProperty(s);return i.constructor.createProperty(s,n),a?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}function Pa(r){return Se({...r,state:!0,attribute:!1})}const qh=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function ft(r,e){return(t,n,i)=>{const s=a=>a.renderRoot?.querySelector(r)??null;return qh(t,n,{get(){return s(this)}})}}var Uh=Object.defineProperty,Xt=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(e,t,i)||i);return i&&Uh(e,t,i),i};const pa=class extends lr{constructor(){super(...arguments),this.dense=!1}};pa.shadowRootOptions={...lr.shadowRootOptions,delegatesFocus:!0},pa.styles=[St`
95
95
  :host {
96
96
  /* color-scheme: light dark; */
97
97
  --rokit-primary-color-inner: var(--rokit-primary-color, #008877);
@@ -114,11 +114,11 @@ a, a:visited { color: inherit; }
114
114
  }
115
115
  }
116
116
  */
117
- `];let $t=ca;Xt([Se({type:Boolean,reflect:!0})],$t.prototype,"dense");var bt;const da=class extends $t{constructor(){super(),Eh(this,bt),this.value="",this.clearable=!1,this.required=!1,this.disabled=!1,Sh(this,bt,this.attachInternals())}checkValidity(){return Bt(this,bt).checkValidity()}reportValidity(){const e=Bt(this,bt).reportValidity();return this.classList.toggle("invalid",!e),e}get validity(){return Bt(this,bt).validity}get validationMessage(){return Bt(this,bt).validationMessage}setCustomValidity(e,t){e?Bt(this,bt).setValidity({customError:!0},e,t):Bt(this,bt).setValidity(void 0)}updateValidity(e,t,n){Bt(this,bt).setValidity(e,t,n)}setFormValue(e,t){Bt(this,bt).setFormValue(e,t)}};bt=new WeakMap,da.formAssociated=!0,da.styles=[...$t.styles,St`
117
+ `];let $t=pa;Xt([Se({type:Boolean,reflect:!0})],$t.prototype,"dense");var yt;const ga=class extends $t{constructor(){super(),Nh(this,yt),this.value="",this.clearable=!1,this.required=!1,this.disabled=!1,Rh(this,yt,this.attachInternals())}checkValidity(){return Bt(this,yt).checkValidity()}reportValidity(){const e=Bt(this,yt).reportValidity();return this.classList.toggle("invalid",!e),e}get validity(){return Bt(this,yt).validity}get validationMessage(){return Bt(this,yt).validationMessage}setCustomValidity(e,t){e?Bt(this,yt).setValidity({customError:!0},e,t):Bt(this,yt).setValidity(void 0)}updateValidity(e,t,n){Bt(this,yt).setValidity(e,t,n)}setFormValue(e,t){Bt(this,yt).setFormValue(e,t)}};yt=new WeakMap,ga.formAssociated=!0,ga.styles=[...$t.styles,St`
118
118
  :host { display: inline-flex; align-items: center; padding: 6px 8px; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); box-sizing: border-box; position: relative; }
119
119
  :host(:focus) { border-color: var(--rokit-primary-color-inner); }
120
120
  :host(.invalid) { border-color: var(--rokit-error-color-inner); }
121
- `];let vt=da;Xt([Se()],vt.prototype,"name");Xt([Se()],vt.prototype,"value");Xt([Se({type:Boolean})],vt.prototype,"clearable");Xt([Se({type:Boolean})],vt.prototype,"required");Xt([Se({type:Boolean})],vt.prototype,"disabled");Xt([Se()],vt.prototype,"label");Xt([Se()],vt.prototype,"placeholder");function Bh(r){const e=parseFloat(r),t=r.match(/m?s/);let n=0;if(t)switch(t[0]){case"s":n=e*1e3;break;case"ms":n=e;break;default:n=0;break}return n}var qh=Object.defineProperty,Uh=Object.getOwnPropertyDescriptor,Ec=(r,e,t,n)=>{for(var i=n>1?void 0:n?Uh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&qh(e,t,i),i};let Ar=class extends $t{constructor(){super(...arguments),this.icon=!1}render(){return dt`<a part="link"><slot><slot></a>`}};Ar.styles=[...$t.styles,St`
121
+ `];let vt=ga;Xt([Se()],vt.prototype,"name");Xt([Se()],vt.prototype,"value");Xt([Se({type:Boolean})],vt.prototype,"clearable");Xt([Se({type:Boolean})],vt.prototype,"required");Xt([Se({type:Boolean})],vt.prototype,"disabled");Xt([Se()],vt.prototype,"label");Xt([Se()],vt.prototype,"placeholder");function Hh(r){const e=parseFloat(r),t=r.match(/m?s/);let n=0;if(t)switch(t[0]){case"s":n=e*1e3;break;case"ms":n=e;break;default:n=0;break}return n}var Vh=Object.defineProperty,Gh=Object.getOwnPropertyDescriptor,Nc=(r,e,t,n)=>{for(var i=n>1?void 0:n?Gh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Vh(e,t,i),i};let Ar=class extends $t{constructor(){super(...arguments),this.icon=!1}render(){return ct`<a part="link"><slot><slot></a>`}};Ar.styles=[...$t.styles,St`
122
122
  :host { display: inline-flex; }
123
123
  :host a { display: flex; min-width: 1em; height: 1em; padding: 0.5em; cursor: pointer; border-radius: 0.6em; align-items: center; justify-content: center; }
124
124
  :host a:hover { text-shadow: 0 0 1px; }
@@ -130,7 +130,7 @@ a, a:visited { color: inherit; }
130
130
  :host(.caret) a:before { content: ''; width: var(--rokit-caret-size-inner); height: var(--rokit-caret-size-inner); border-style: none solid solid none; border-width: calc(0.3 * var(--rokit-caret-size-inner)); transform: translate(0.15em, -0.15em) rotate(45deg); transition: transform var(--rokit-transition-duration-inner) ease-out; margin-right: calc(0.5 * var(--rokit-caret-size-inner)); }
131
131
  :host(.caret.down) a:before { transform: translate(0.15em, 0.15em) rotate(225deg); }
132
132
  :host(.caret.right) a:before { transform: translate(0em, 0em) rotate(-45deg); }
133
- `];Ec([Se({type:Boolean,reflect:!0})],Ar.prototype,"icon",2);Ar=Ec([Qt("rokit-button")],Ar);var Hh=Object.defineProperty,Vh=Object.getOwnPropertyDescriptor,Ft=(r,e,t,n)=>{for(var i=n>1?void 0:n?Vh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Hh(e,t,i),i};let nt=class extends $t{constructor(){super(...arguments),this.open=!1,this.disabled=!1,this.transitioning=!1,this.closedBeforeTransition=!1,this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClick=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this)}firstUpdated(){this.transitionDuration=Bh(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner")),new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateContentHeight()}).observe(this)}updated(r){r.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),r.has("disabled")&&(this.disabled?(this.header.removeEventListener("mousedown",this.onMouseDown),this.header.removeEventListener("click",this.onClick)):(this.header.addEventListener("mousedown",this.onMouseDown),this.header.addEventListener("click",this.onClick))),r.has("open")&&!this.disabled&&(this.transitioning||this.toggle(this.open))}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight!==void 0?Math.min(this.maxHeight,this.content.scrollHeight):this.content.scrollHeight)+"px",this.classList.toggle("has-content",this.content.style.maxHeight!=="0px")})}onSlotChange(){const r=this.shadowRoot.querySelector("#content > slot").assignedNodes(),e=new MutationObserver(()=>this.updateContentHeight());for(const t of r)e.observe(t,{subtree:!0,childList:!0,characterData:!0});this.updateContentHeight()}toggle(r=!this.open,e=!1){this.disabled||(this.transitioning=!0,this.open=r,this.toggleButton.classList.toggle("down",r),setTimeout(()=>{this.transitioning=!1,this.open&&e&&this.content.scrollIntoView({block:"nearest"})},this.transitionDuration))}render(){return dt`
133
+ `];Nc([Se({type:Boolean,reflect:!0})],Ar.prototype,"icon",2);Ar=Nc([Qt("rokit-button")],Ar);var Wh=Object.defineProperty,zh=Object.getOwnPropertyDescriptor,Rc=r=>{throw TypeError(r)},Ft=(r,e,t,n)=>{for(var i=n>1?void 0:n?zh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Wh(e,t,i),i},Qh=(r,e,t)=>e.has(r)||Rc("Cannot "+t),rl=(r,e,t)=>(Qh(r,e,"read from private field"),t?t.call(r):e.get(r)),Xh=(r,e,t)=>e.has(r)?Rc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Qn;let nt=class extends $t{constructor(){super(...arguments),this.open=!1,this.disabled=!1,this.transitioning=!1,this.closedBeforeTransition=!1,Xh(this,Qn,new MutationObserver(()=>this.updateContentHeight())),this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClick=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this)}firstUpdated(){this.transitionDuration=Hh(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner")),new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateContentHeight()}).observe(this)}updated(r){r.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),r.has("disabled")&&(this.disabled?(this.header.removeEventListener("mousedown",this.onMouseDown),this.header.removeEventListener("click",this.onClick)):(this.header.addEventListener("mousedown",this.onMouseDown),this.header.addEventListener("click",this.onClick))),r.has("open")&&!this.disabled&&(this.transitioning||this.toggle(this.open))}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight!==void 0?Math.min(this.maxHeight,this.content.scrollHeight):this.content.scrollHeight)+"px",this.classList.toggle("has-content",this.content.style.maxHeight!=="0px")})}onSlotChange(){const r=this.shadowRoot.querySelector("#content > slot").assignedNodes();rl(this,Qn).disconnect();for(const e of r)rl(this,Qn).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0});this.updateContentHeight()}toggle(r=!this.open,e=!1){this.disabled||(this.transitioning=!0,this.open=r,this.toggleButton.classList.toggle("down",r),setTimeout(()=>{this.transitioning=!1,this.open&&e&&this.content.scrollIntoView({block:"nearest"})},this.transitionDuration))}render(){return ct`
134
134
  <header part="header">
135
135
  <slot name="prefix" part="prefix"></slot>
136
136
  <span class="label"><slot name="label" part="label">${this.label}</slot></span>
@@ -141,7 +141,7 @@ a, a:visited { color: inherit; }
141
141
  <div id="content" part="content">
142
142
  <slot @slotchange=${this.onSlotChange}></slot>
143
143
  </div>
144
- `}};nt.styles=[...$t.styles,St`
144
+ `}};Qn=new WeakMap;nt.styles=[...$t.styles,St`
145
145
  :host { display: flex; flex-direction: column; align-items: stretch; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); }
146
146
  :host header { cursor: pointer; }
147
147
  :host([dense]) header { padding: 2px 4px; }
@@ -153,12 +153,12 @@ a, a:visited { color: inherit; }
153
153
  .label { flex-grow: 1; overflow: hidden; }
154
154
  #content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
155
155
  #toggle { margin-left: 3px; }
156
- `];Ft([Se({type:Boolean,reflect:!0})],nt.prototype,"open",2);Ft([Se()],nt.prototype,"label",2);Ft([Se({reflect:!0})],nt.prototype,"maxHeight",2);Ft([Se({type:Boolean})],nt.prototype,"disabled",2);Ft([pt("#content")],nt.prototype,"content",2);Ft([pt("#toggle")],nt.prototype,"toggleButton",2);Ft([pt("header")],nt.prototype,"header",2);Ft([ja()],nt.prototype,"transitioning",2);nt=Ft([Qt("rokit-collapsible")],nt);var Gh=Object.defineProperty,Wh=Object.getOwnPropertyDescriptor,Sc=r=>{throw TypeError(r)},lt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Wh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Gh(e,t,i),i},Ic=(r,e,t)=>e.has(r)||Sc("Cannot "+t),zh=(r,e,t)=>(Ic(r,e,"read from private field"),e.get(r)),Qh=(r,e,t)=>e.has(r)?Sc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Yo=(r,e,t,n)=>(Ic(r,e,"write to private field"),e.set(r,t),t),fn;let Ue=class extends vt{constructor(){super(),this.type="text",this.readonly=!1,this.sticky=!1,this.minWidth=80,this.autoGrowLabelWidth=!1,Qh(this,fn,""),this.addEventListener("keydown",r=>{r.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(){Yo(this,fn,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.autoGrowLabelWidth&&new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateMinWidth()}).observe(this)}updateMinWidth(){const r=this.shadowRoot.querySelector(".wrapper");if(r){const e=this.shadowRoot?.querySelector("label")?.scrollWidth||0,t=this.minWidth>e?this.minWidth:e;r.style.minWidth=t>0?t+"px":""}}updated(r){r.has("label")&&(this.classList.toggle("has-label",this.label!==void 0),this.autoGrowLabelWidth&&this.updateMinWidth()),r.has("min")&&(this.inputElement.min=this.min||""),r.has("max")&&(this.inputElement.max=this.max||""),r.has("step")&&(this.inputElement.step=this.step||""),r.has("placeholder")&&(this.inputElement.placeholder=this.placeholder||""),r.has("pattern")&&(this.inputElement.pattern=this.pattern||""),r.has("minLength")&&(this.inputElement.minLength=this.minLength===void 0?-1:this.minLength),r.has("maxLength")&&(this.inputElement.maxLength=this.maxLength===void 0?-1:this.maxLength),r.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!==zh(this,fn)&&(Yo(this,fn,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return dt`<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 dt`
156
+ `];Ft([Se({type:Boolean,reflect:!0})],nt.prototype,"open",2);Ft([Se()],nt.prototype,"label",2);Ft([Se({reflect:!0})],nt.prototype,"maxHeight",2);Ft([Se({type:Boolean})],nt.prototype,"disabled",2);Ft([ft("#content")],nt.prototype,"content",2);Ft([ft("#toggle")],nt.prototype,"toggleButton",2);Ft([ft("header")],nt.prototype,"header",2);Ft([Pa()],nt.prototype,"transitioning",2);nt=Ft([Qt("rokit-collapsible")],nt);var Jh=Object.defineProperty,Kh=Object.getOwnPropertyDescriptor,Tc=r=>{throw TypeError(r)},lt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Kh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Jh(e,t,i),i},Ac=(r,e,t)=>e.has(r)||Tc("Cannot "+t),Yh=(r,e,t)=>(Ac(r,e,"read from private field"),e.get(r)),Zh=(r,e,t)=>e.has(r)?Tc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),nl=(r,e,t,n)=>(Ac(r,e,"write to private field"),e.set(r,t),t),fn;let Ue=class extends vt{constructor(){super(),this.type="text",this.readonly=!1,this.sticky=!1,this.minWidth=80,this.autoGrowLabelWidth=!1,Zh(this,fn,""),this.addEventListener("keydown",r=>{r.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(){nl(this,fn,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.autoGrowLabelWidth&&new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateMinWidth()}).observe(this)}updateMinWidth(){const r=this.shadowRoot.querySelector(".wrapper");if(r){const e=this.shadowRoot?.querySelector("label")?.scrollWidth||0,t=this.minWidth>e?this.minWidth:e;r.style.minWidth=t>0?t+"px":""}}updated(r){r.has("label")&&(this.classList.toggle("has-label",this.label!==void 0),this.autoGrowLabelWidth&&this.updateMinWidth()),r.has("min")&&(this.inputElement.min=this.min||""),r.has("max")&&(this.inputElement.max=this.max||""),r.has("step")&&(this.inputElement.step=this.step||""),r.has("placeholder")&&(this.inputElement.placeholder=this.placeholder||""),r.has("pattern")&&(this.inputElement.pattern=this.pattern||""),r.has("minLength")&&(this.inputElement.minLength=this.minLength===void 0?-1:this.minLength),r.has("maxLength")&&(this.inputElement.maxLength=this.maxLength===void 0?-1:this.maxLength),r.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!==Yh(this,fn)&&(nl(this,fn,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return ct`<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 ct`
157
157
  <slot name="prefix" part="prefix"></slot>
158
158
  <div class="wrapper">
159
159
  <label for="input" part="label">${this.label}</label>
160
160
  ${this.renderInput()}
161
- ${this.clearable?dt`
161
+ ${this.clearable?ct`
162
162
  <rokit-button class="clear" icon ?dense="${this.dense}" @mousedown="${r=>{r.preventDefault()}}" @click="${r=>{r.stopPropagation(),this.clear()}}" title="Clear"></rokit-button>
163
163
  `:Ve}
164
164
  </div>
@@ -177,7 +177,7 @@ a, a:visited { color: inherit; }
177
177
  :host(.has-label) #input { margin-top: 0.9em; }
178
178
  :host(.has-label:not(.has-focus):not(.has-value):not([sticky])) #input { clip-path: polygon(0 0, 0 0, 0 0, 0 0); }
179
179
  :host(:not(.has-value)) .clear { visibility: hidden; }
180
- `];lt([Se()],Ue.prototype,"type",2);lt([Se({type:Boolean,reflect:!0})],Ue.prototype,"readonly",2);lt([Se({type:Boolean,reflect:!0})],Ue.prototype,"sticky",2);lt([Se()],Ue.prototype,"pattern",2);lt([Se()],Ue.prototype,"minLength",2);lt([Se()],Ue.prototype,"maxLength",2);lt([Se()],Ue.prototype,"min",2);lt([Se()],Ue.prototype,"max",2);lt([Se()],Ue.prototype,"step",2);lt([Se()],Ue.prototype,"minWidth",2);lt([Se({type:Boolean})],Ue.prototype,"autoGrowLabelWidth",2);lt([pt("#input")],Ue.prototype,"inputElement",2);Ue=lt([Qt("rokit-input")],Ue);var Xh=Object.defineProperty,Jh=Object.getOwnPropertyDescriptor,Nc=r=>{throw TypeError(r)},rt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Jh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Xh(e,t,i),i},Rc=(r,e,t)=>e.has(r)||Nc("Cannot "+t),Zo=(r,e,t)=>(Rc(r,e,"read from private field"),t?t.call(r):e.get(r)),el=(r,e,t)=>e.has(r)?Nc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Hn=(r,e,t,n)=>(Rc(r,e,"write to private field"),e.set(r,t),t),xr,Qn;let Ge=class extends vt{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.autoGrowLabelWidth=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,el(this,xr,""),el(this,Qn,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)}),this.addEventListener("input",()=>{this.collapsible.toggle(!0)})}firstUpdated(){Hn(this,xr,this.value),Hn(this,Qn,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?this.collapsibleMaxHeight:getComputedStyle(this).getPropertyValue("--rokit-list-max-height-inner")),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(r){if(r.has("selectedItem")){const e=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):"",this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,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}))}r.has("value")&&this.selectItem(this.findItem(this.value)),r.has("disabled")&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled),(r.has("filterableThreshold")||r.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?"none":"")}checkInputValue(r=!0){if(this.input.value){const e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}r&&(this.input.value="",this.input.title="",Hn(this,xr,""),this.selectItem(null,!1))}filter(r){r=r.toLowerCase();let e=!0;for(const t of this.listContainer.querySelectorAll("li"))if(t.id!=="noresult"){const n=this.itemText(t).toLowerCase().indexOf(r)==-1;t.classList.toggle("hidden",n),this.collapse&&(t.classList.remove("open"),t.querySelector("ul")?.classList.remove("open")),n||(e=!1)}for(const t of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))t.classList.remove("hidden"),r&&this.collapse&&(t.classList.add("open"),t.querySelector("ul")?.classList.add("open")),e=!1;this.highlightItem(null),this.listContainer.querySelector("#noresult")?.classList.toggle("hidden",!e)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&Hn(this,xr,this.value),setTimeout(()=>this.blur())}findItem(r){if(r){for(const e of this.listContainer.querySelectorAll("li"))if(this.itemValue(e)===r||this.itemText(e)===r)return e}return null}highlightItem(r,e=!0){if(this.listContainer.querySelector("li.active")?.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let t=r.closest("ul");t;t=t.parentElement.closest("ul"))t.classList.add("open"),t.closest("li")?.classList.add("open");this.collapsible.open&&r.scrollIntoView({block:"nearest"})}}highlightNextItem(){const r=this.listContainer.querySelector("li.active");let e=r;const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");if(r){for(let n=0;n<t.length;n++)if(t[n]===r&&n<t.length-1){e=t[n+1];break}}else t.length>0&&(e=t[0]);this.highlightItem(e)}highlightPreviousItem(){const r=this.listContainer.querySelector("li.active");let e=null;if(r){const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");for(let n=0;n<t.length;n++)if(t[n]===r&&n>0){e=t[n-1];break}}this.highlightItem(e),e||this.input.focus()}itemValue(r){return r.dataset.value||this.itemText(r)||""}itemText(r){return r.querySelector("div > div")?.innerText||""}elementText(r){let e="";for(const t of r.childNodes)t.nodeType==3&&(e+=t.nodeValue?.trim());return e}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let r=null;const e=this.shadowRoot.querySelector("#list-container-slot").assignedElements();if(e?.length===1&&(r=Array.prototype.slice.call(e[0].querySelectorAll(":scope > li")),this.copyItems(r,this.listContainer)),this.emptyMessage){const t=document.createElement("li");t.id="noresult",t.setAttribute("disabled",""),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),r&&r.length>0&&t.classList.add("hidden")}this.value=this.value||Zo(this,xr),this.selectItem(this.findItem(this.value))}copyItems(r,e,t=0){if(this.sort!==void 0){const i=this.sort||"asc";r=r.sort((s,a)=>i==="desc"?(this.elementText(a)||this.itemValue(a)).localeCompare(this.elementText(s)||this.itemValue(s)):(this.elementText(s)||this.itemValue(s)).localeCompare(this.elementText(a)||this.itemValue(a)))}let n="";t>0&&(n=`calc(0.3em + ${t}*${Zo(this,Qn)})`);for(const i of r){const s=i.cloneNode();s.replaceChildren();const a=document.createElement("div");n&&(a.style.paddingLeft=n);const o=document.createElement("div");a.appendChild(o);for(const l of i.childNodes)if(l.nodeName!=="UL"){const c=l.cloneNode(!0);c.nodeType===3&&c.nodeValue&&(c.nodeValue=c.nodeValue.trim()),o.appendChild(c)}s.appendChild(a),s.title=s.title||this.itemText(s);const u=i.querySelector("ul");if(u?.childElementCount){const l=document.createElement("ul");if(s.appendChild(l),this.copyItems(Array.prototype.slice.call(u.children),l,t+1),this.collapse){const c=new Ar;c.title="Open",c.dense=!0,c.icon=!0,c.classList.add("toggle-node","caret"),c.addEventListener("click",d=>{d.stopPropagation(),s.classList.toggle("open"),l.classList.toggle("open"),c.title=s.classList.contains("open")?"Close":"Open",this.collapsible.updateContentHeight()}),a.prepend(c)}else l.classList.add("open")}e.appendChild(s),this.itemCount++}}render(){return dt`
180
+ `];lt([Se()],Ue.prototype,"type",2);lt([Se({type:Boolean,reflect:!0})],Ue.prototype,"readonly",2);lt([Se({type:Boolean,reflect:!0})],Ue.prototype,"sticky",2);lt([Se()],Ue.prototype,"pattern",2);lt([Se()],Ue.prototype,"minLength",2);lt([Se()],Ue.prototype,"maxLength",2);lt([Se()],Ue.prototype,"min",2);lt([Se()],Ue.prototype,"max",2);lt([Se()],Ue.prototype,"step",2);lt([Se()],Ue.prototype,"minWidth",2);lt([Se({type:Boolean})],Ue.prototype,"autoGrowLabelWidth",2);lt([ft("#input")],Ue.prototype,"inputElement",2);Ue=lt([Qt("rokit-input")],Ue);var ef=Object.defineProperty,tf=Object.getOwnPropertyDescriptor,Dc=r=>{throw TypeError(r)},rt=(r,e,t,n)=>{for(var i=n>1?void 0:n?tf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&ef(e,t,i),i},Lc=(r,e,t)=>e.has(r)||Dc("Cannot "+t),Un=(r,e,t)=>(Lc(r,e,"read from private field"),t?t.call(r):e.get(r)),Ji=(r,e,t)=>e.has(r)?Dc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Hn=(r,e,t,n)=>(Lc(r,e,"write to private field"),e.set(r,t),t),xr,Xn,Jn;let Ge=class extends vt{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.autoGrowLabelWidth=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,Ji(this,xr,""),Ji(this,Xn,""),Ji(this,Jn,new MutationObserver(()=>this.onSlotChange())),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)}),this.addEventListener("input",()=>{this.collapsible.toggle(!0)})}firstUpdated(){Hn(this,xr,this.value),Hn(this,Xn,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?this.collapsibleMaxHeight:getComputedStyle(this).getPropertyValue("--rokit-list-max-height-inner")),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(r){if(r.has("selectedItem")){const e=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):"",this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,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}))}r.has("value")&&this.selectItem(this.findItem(this.value)),r.has("disabled")&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled),(r.has("filterableThreshold")||r.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?"none":"")}checkInputValue(r=!0){if(this.input.value){const e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}r&&(this.input.value="",this.input.title="",Hn(this,xr,""),this.selectItem(null,!1))}filter(r){r=r.toLowerCase();let e=!0;for(const t of this.listContainer.querySelectorAll("li"))if(t.id!=="noresult"){const n=this.itemText(t).toLowerCase().indexOf(r)==-1;t.classList.toggle("hidden",n),this.collapse&&(t.classList.remove("open"),t.querySelector("ul")?.classList.remove("open")),n||(e=!1)}for(const t of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))t.classList.remove("hidden"),r&&this.collapse&&(t.classList.add("open"),t.querySelector("ul")?.classList.add("open")),e=!1;this.highlightItem(null),this.listContainer.querySelector("#noresult")?.classList.toggle("hidden",!e)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&Hn(this,xr,this.value),setTimeout(()=>this.blur())}findItem(r){if(r){for(const e of this.listContainer.querySelectorAll("li"))if(this.itemValue(e)===r||this.itemText(e)===r)return e}return null}highlightItem(r,e=!0){if(this.listContainer.querySelector("li.active")?.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let t=r.closest("ul");t;t=t.parentElement.closest("ul"))t.classList.add("open"),t.closest("li")?.classList.add("open");this.collapsible.open&&r.scrollIntoView({block:"nearest"})}}highlightNextItem(){const r=this.listContainer.querySelector("li.active");let e=r;const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");if(r){for(let n=0;n<t.length;n++)if(t[n]===r&&n<t.length-1){e=t[n+1];break}}else t.length>0&&(e=t[0]);this.highlightItem(e)}highlightPreviousItem(){const r=this.listContainer.querySelector("li.active");let e=null;if(r){const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");for(let n=0;n<t.length;n++)if(t[n]===r&&n>0){e=t[n-1];break}}this.highlightItem(e),e||this.input.focus()}itemValue(r){return r.dataset.value||this.itemText(r)||""}itemText(r){return r.querySelector("div > div")?.innerText||""}elementText(r){let e="";for(const t of r.childNodes)t.nodeType==3&&(e+=t.nodeValue?.trim());return e}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let r=null;const e=this.shadowRoot.querySelector("#list-container-slot").assignedElements();if(e?.length===1&&(r=Array.prototype.slice.call(e[0].querySelectorAll(":scope > li")),this.copyItems(r,this.listContainer),Un(this,Jn).disconnect(),Un(this,Jn).observe(e[0],{subtree:!0,childList:!0,characterData:!0,attributes:!0})),this.emptyMessage){const t=document.createElement("li");t.id="noresult",t.setAttribute("disabled",""),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),r&&r.length>0&&t.classList.add("hidden")}this.value=this.value||Un(this,xr),this.selectItem(this.findItem(this.value))}copyItems(r,e,t=0){if(this.sort!==void 0){const i=this.sort||"asc";r=r.sort((s,a)=>i==="desc"?(this.elementText(a)||this.itemValue(a)).localeCompare(this.elementText(s)||this.itemValue(s)):(this.elementText(s)||this.itemValue(s)).localeCompare(this.elementText(a)||this.itemValue(a)))}let n="";t>0&&(n=`calc(0.3em + ${t}*${Un(this,Xn)})`);for(const i of r){const s=i.cloneNode();s.replaceChildren();const a=document.createElement("div");n&&(a.style.paddingLeft=n);const o=document.createElement("div");a.appendChild(o);for(const l of i.childNodes)if(l.nodeName!=="UL"){const c=l.cloneNode(!0);c.nodeType===3&&c.nodeValue&&(c.nodeValue=c.nodeValue.trim()),o.appendChild(c)}s.appendChild(a),s.title=s.title||this.itemText(s);const u=i.querySelector("ul");if(u?.childElementCount){const l=document.createElement("ul");if(s.appendChild(l),this.copyItems(Array.prototype.slice.call(u.children),l,t+1),this.collapse){const c=new Ar;c.title="Open",c.dense=!0,c.icon=!0,c.classList.add("toggle-node","caret"),c.addEventListener("click",h=>{h.stopPropagation(),s.classList.toggle("open"),l.classList.toggle("open"),c.title=s.classList.contains("open")?"Close":"Open",this.collapsible.updateContentHeight()}),a.prepend(c)}else l.classList.add("open")}e.appendChild(s),this.itemCount++}}render(){return ct`
181
181
  <rokit-collapsible ?dense="${this.dense}" part="collapsible">
182
182
  <slot name="prefix" part="prefix" slot="prefix"></slot>
183
183
  <slot name="suffix" part="suffix" slot="suffix"></slot>
@@ -197,7 +197,7 @@ a, a:visited { color: inherit; }
197
197
  </ul>
198
198
  <slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
199
199
  </rokit-collapsible>
200
- `}};xr=new WeakMap;Qn=new WeakMap;Ge.styles=[...vt.styles,St`
200
+ `}};xr=new WeakMap;Xn=new WeakMap;Jn=new WeakMap;Ge.styles=[...vt.styles,St`
201
201
  :host { background-color: var(--rokit-light-background-color-inner); user-select: none; padding: 0; }
202
202
  :host([dense]) li > div { padding: 4px 2px; }
203
203
  :host([dense]) li.large > div, :host([dense]) li.header > div { padding-top: 6px; padding-bottom: 6px; }
@@ -223,19 +223,19 @@ a, a:visited { color: inherit; }
223
223
  :host([collapse]) li > div > div { padding-left: 1.8em; }
224
224
  :host([collapse]) ul:not(.open) { display: none; }
225
225
  :host([collapse]) li:not(.open) > div > .toggle-node::part(link):before { transform: translate(0em, 0em) rotate(-45deg); }
226
- `];rt([Se()],Ge.prototype,"emptyMessage",2);rt([Se()],Ge.prototype,"sort",2);rt([Se()],Ge.prototype,"collapsibleMaxHeight",2);rt([Se()],Ge.prototype,"collapsibleOrientationLeft",2);rt([Se()],Ge.prototype,"collapsibleOrientationRight",2);rt([Se()],Ge.prototype,"collapsibleWidth",2);rt([Se({type:Boolean})],Ge.prototype,"autoGrowLabelWidth",2);rt([Se()],Ge.prototype,"inputMinWidth",2);rt([Se({type:Boolean,reflect:!0})],Ge.prototype,"collapse",2);rt([Se()],Ge.prototype,"filterableThreshold",2);rt([pt("rokit-collapsible")],Ge.prototype,"collapsible",2);rt([pt("#input")],Ge.prototype,"input",2);rt([pt("#list-container")],Ge.prototype,"listContainer",2);rt([ja()],Ge.prototype,"selectedItem",2);rt([ja()],Ge.prototype,"itemCount",2);Ge=rt([Qt("rokit-select")],Ge);var Kh=Object.defineProperty,Yh=Object.getOwnPropertyDescriptor,fi=(r,e,t,n)=>{for(var i=n>1?void 0:n?Yh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Kh(e,t,i),i};let cr=class extends Ue{constructor(){super(...arguments),this.resize="none",this.rows=3}firstUpdated(){super.firstUpdated(),this.inputElement.rows=this.rows,this.cols!==void 0&&(this.inputElement.cols=this.cols),this.resize==="auto"?(this.inputElement.style.resize="none",this.inputElement.addEventListener("input",()=>this.autoResize())):this.inputElement.style.resize=this.resize}updated(r){super.updated(r),this.resize==="auto"&&r.has("resize")&&new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.autoResize()}).observe(this),this.resize==="auto"&&r.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const r=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");r.trim()!==""&&(this.value=r)}renderInput(){return dt`
226
+ `];rt([Se()],Ge.prototype,"emptyMessage",2);rt([Se()],Ge.prototype,"sort",2);rt([Se()],Ge.prototype,"collapsibleMaxHeight",2);rt([Se()],Ge.prototype,"collapsibleOrientationLeft",2);rt([Se()],Ge.prototype,"collapsibleOrientationRight",2);rt([Se()],Ge.prototype,"collapsibleWidth",2);rt([Se({type:Boolean})],Ge.prototype,"autoGrowLabelWidth",2);rt([Se()],Ge.prototype,"inputMinWidth",2);rt([Se({type:Boolean,reflect:!0})],Ge.prototype,"collapse",2);rt([Se()],Ge.prototype,"filterableThreshold",2);rt([ft("rokit-collapsible")],Ge.prototype,"collapsible",2);rt([ft("#input")],Ge.prototype,"input",2);rt([ft("#list-container")],Ge.prototype,"listContainer",2);rt([Pa()],Ge.prototype,"selectedItem",2);rt([Pa()],Ge.prototype,"itemCount",2);Ge=rt([Qt("rokit-select")],Ge);var rf=Object.defineProperty,nf=Object.getOwnPropertyDescriptor,mi=(r,e,t,n)=>{for(var i=n>1?void 0:n?nf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rf(e,t,i),i};let cr=class extends Ue{constructor(){super(...arguments),this.resize="none",this.rows=3}firstUpdated(){super.firstUpdated(),this.inputElement.rows=this.rows,this.cols!==void 0&&(this.inputElement.cols=this.cols),this.resize==="auto"?(this.inputElement.style.resize="none",this.inputElement.addEventListener("input",()=>this.autoResize())):this.inputElement.style.resize=this.resize}updated(r){super.updated(r),this.resize==="auto"&&r.has("resize")&&new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.autoResize()}).observe(this),this.resize==="auto"&&r.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const r=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");r.trim()!==""&&(this.value=r)}renderInput(){return ct`
227
227
  <textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
228
228
  <slot id="content" @slotchange=${this.onSlotChange}></slot>
229
229
  `}};cr.styles=[...Ue.styles,St`
230
230
  :host, .wrapper { align-items: flex-start; }
231
231
  #input { height: initial; }
232
232
  #content { display: none; }
233
- `];fi([Se()],cr.prototype,"resize",2);fi([Se()],cr.prototype,"rows",2);fi([Se()],cr.prototype,"cols",2);cr=fi([Qt("rokit-textarea")],cr);var Zh=Object.defineProperty,ef=Object.getOwnPropertyDescriptor,Tc=r=>{throw TypeError(r)},It=(r,e,t,n)=>{for(var i=n>1?void 0:n?ef(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Zh(e,t,i),i},Ac=(r,e,t)=>e.has(r)||Tc("Cannot "+t),je=(r,e,t)=>(Ac(r,e,"read from private field"),t?t.call(r):e.get(r)),zi=(r,e,t)=>e.has(r)?Tc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Vn=(r,e,t,n)=>(Ac(r,e,"write to private field"),e.set(r,t),t),Me,At,Er;const Vt=18;let Ot=class extends Ue{constructor(){super(...arguments),this.labelFormatter=r=>String(r),zi(this,Me,[0,1]),zi(this,At,[je(this,Me)[0],je(this,Me)[1]]),zi(this,Er)}firstUpdated(){super.firstUpdated(),this.sliderElement.addEventListener("mousedown",r=>this.onKnobDrag(r)),this.sliderElement.addEventListener("touchstart",r=>this.onKnobDrag(r)),new ResizeObserver(()=>{this.updateKnobPositions()}).observe(this.sliderElement)}updated(r){if(super.updated(r),r.has("min")&&(je(this,Me)[0]=parseFloat(this.min||"0"),je(this,Me)[1]=Math.max(je(this,Me)[0],je(this,Me)[1])),r.has("max")&&(je(this,Me)[1]=parseFloat(this.max||"1"),je(this,Me)[0]=Math.min(je(this,Me)[0],je(this,Me)[1])),r.has("step")&&Vn(this,Er,this.step?parseFloat(this.step):void 0),r.has("value")||r.has("min")||r.has("max"))if(this.value)if(this.range!==void 0){const e=JSON.parse(this.value);Vn(this,At,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else Vn(this,At,[this.applyConstraints(parseFloat(this.value))]);else Vn(this,At,[je(this,Me)[0],je(this,Me)[1]]);this.updateKnobPositions()}updateValidity(r,e){super.updateValidity(r,e,this.sliderElement)}chooseKnob(r){if(!this.endKnob)return this.startKnob;let e=Math.abs(r-this.startKnob.offsetLeft)<Math.abs(r-this.endKnob.offsetLeft)?this.startKnob:this.endKnob;return this.startKnob.value===this.endKnob.value&&(e.id==="start"&&e.value===je(this,Me)[0]?e=this.endKnob:e.id==="end"&&e.value===je(this,Me)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-je(this,Me)[0])/(je(this,Me)[1]-je(this,Me)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(je(this,Me)[1]-je(this,Me)[0])+je(this,Me)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,je(this,Me)[0]),je(this,Me)[1]);return je(this,Er)&&(t=Math.round(t/je(this,Er))*je(this,Er)),e!==void 0&&this.endKnob&&(t=e?Math.min(t,this.endKnob.value):Math.max(t,this.startKnob.value)),t}updateKnob(r,e){r.value=e,r.offset=this.toScreenSpace(e),r.label=this.labelFormatter(e),this.endKnob&&(r.id==="start"?this.track.style.borderLeftWidth=r.offset+"px":this.track.style.borderRightWidth=this.track.offsetWidth-r.offset+"px")}updateKnobPositions(){this.updateKnob(this.startKnob,je(this,At)[0]),this.endKnob&&this.updateKnob(this.endKnob,je(this,At)[1])}onKnobDrag(r){if(r.target instanceof Dr||this.classList.contains("has-value")||this.classList.contains("has-focus")){let e;const t=i=>{let s=0;i.type==="touchmove"||i.type==="touchstart"?s=i.touches[0].clientX:s=i.clientX,s=s-this.track.getBoundingClientRect().left,e||(e=this.chooseKnob(s),e.classList.add("focus")),this.updateKnob(e,this.applyConstraints(this.toValueSpace(s),e.id==="start"))},n=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n),e&&(e.classList.remove("focus"),this.range!==void 0?e.id==="end"?this.value=JSON.stringify([je(this,At)[0],e.value]):this.value=JSON.stringify([e.value,je(this,At)[1]]):this.value=String(e.value)),e=void 0};this.sliderElement.focus(),document.addEventListener("mousemove",t),document.addEventListener("touchmove",t),document.addEventListener("mouseup",n),document.addEventListener("touchend",n),t(r)}}renderInput(){return dt`
233
+ `];mi([Se()],cr.prototype,"resize",2);mi([Se()],cr.prototype,"rows",2);mi([Se()],cr.prototype,"cols",2);cr=mi([Qt("rokit-textarea")],cr);var sf=Object.defineProperty,af=Object.getOwnPropertyDescriptor,Oc=r=>{throw TypeError(r)},It=(r,e,t,n)=>{for(var i=n>1?void 0:n?af(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&sf(e,t,i),i},Cc=(r,e,t)=>e.has(r)||Oc("Cannot "+t),je=(r,e,t)=>(Cc(r,e,"read from private field"),t?t.call(r):e.get(r)),Ki=(r,e,t)=>e.has(r)?Oc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Vn=(r,e,t,n)=>(Cc(r,e,"write to private field"),e.set(r,t),t),Me,At,Er;const Vt=18;let Ot=class extends Ue{constructor(){super(...arguments),this.labelFormatter=r=>String(r),Ki(this,Me,[0,1]),Ki(this,At,[je(this,Me)[0],je(this,Me)[1]]),Ki(this,Er)}firstUpdated(){super.firstUpdated(),this.sliderElement.addEventListener("mousedown",r=>this.onKnobDrag(r)),this.sliderElement.addEventListener("touchstart",r=>this.onKnobDrag(r)),new ResizeObserver(()=>{this.updateKnobPositions()}).observe(this.sliderElement)}updated(r){if(super.updated(r),r.has("min")&&(je(this,Me)[0]=parseFloat(this.min||"0"),je(this,Me)[1]=Math.max(je(this,Me)[0],je(this,Me)[1])),r.has("max")&&(je(this,Me)[1]=parseFloat(this.max||"1"),je(this,Me)[0]=Math.min(je(this,Me)[0],je(this,Me)[1])),r.has("step")&&Vn(this,Er,this.step?parseFloat(this.step):void 0),r.has("value")||r.has("min")||r.has("max"))if(this.value)if(this.range!==void 0){const e=JSON.parse(this.value);Vn(this,At,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else Vn(this,At,[this.applyConstraints(parseFloat(this.value))]);else Vn(this,At,[je(this,Me)[0],je(this,Me)[1]]);this.updateKnobPositions()}updateValidity(r,e){super.updateValidity(r,e,this.sliderElement)}chooseKnob(r){if(!this.endKnob)return this.startKnob;let e=Math.abs(r-this.startKnob.offsetLeft)<Math.abs(r-this.endKnob.offsetLeft)?this.startKnob:this.endKnob;return this.startKnob.value===this.endKnob.value&&(e.id==="start"&&e.value===je(this,Me)[0]?e=this.endKnob:e.id==="end"&&e.value===je(this,Me)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-je(this,Me)[0])/(je(this,Me)[1]-je(this,Me)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(je(this,Me)[1]-je(this,Me)[0])+je(this,Me)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,je(this,Me)[0]),je(this,Me)[1]);return je(this,Er)&&(t=Math.round(t/je(this,Er))*je(this,Er)),e!==void 0&&this.endKnob&&(t=e?Math.min(t,this.endKnob.value):Math.max(t,this.startKnob.value)),t}updateKnob(r,e){r.value=e,r.offset=this.toScreenSpace(e),r.label=this.labelFormatter(e),this.endKnob&&(r.id==="start"?this.track.style.borderLeftWidth=r.offset+"px":this.track.style.borderRightWidth=this.track.offsetWidth-r.offset+"px")}updateKnobPositions(){this.updateKnob(this.startKnob,je(this,At)[0]),this.endKnob&&this.updateKnob(this.endKnob,je(this,At)[1])}onKnobDrag(r){if(r.target instanceof Dr||this.classList.contains("has-value")||this.classList.contains("has-focus")){let e;const t=i=>{let s=0;i.type==="touchmove"||i.type==="touchstart"?s=i.touches[0].clientX:s=i.clientX,s=s-this.track.getBoundingClientRect().left,e||(e=this.chooseKnob(s),e.classList.add("focus")),this.updateKnob(e,this.applyConstraints(this.toValueSpace(s),e.id==="start"))},n=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n),e&&(e.classList.remove("focus"),this.range!==void 0?e.id==="end"?this.value=JSON.stringify([je(this,At)[0],e.value]):this.value=JSON.stringify([e.value,je(this,At)[1]]):this.value=String(e.value)),e=void 0};this.sliderElement.focus(),document.addEventListener("mousemove",t),document.addEventListener("touchmove",t),document.addEventListener("mouseup",n),document.addEventListener("touchend",n),t(r)}}renderInput(){return ct`
234
234
  ${super.renderInput()}
235
235
  <div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
236
236
  <div id="track"></div>
237
237
  <rokit-slider-knob id="start"></rokit-slider-knob>
238
- ${this.range===void 0?Ve:dt`
238
+ ${this.range===void 0?Ve:ct`
239
239
  <rokit-slider-knob id="end"></rokit-slider-knob>
240
240
  `}
241
241
  </div>
@@ -248,7 +248,7 @@ a, a:visited { color: inherit; }
248
248
  :host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
249
249
  #track { height: 2px; flex-grow: 1; background-color: #CCC; }
250
250
  #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; }
251
- `];It([Se()],Ot.prototype,"range",2);It([Se()],Ot.prototype,"labelFormatter",2);It([pt("#slider")],Ot.prototype,"sliderElement",2);It([pt("#track")],Ot.prototype,"track",2);It([pt("#start")],Ot.prototype,"startKnob",2);It([pt("#end")],Ot.prototype,"endKnob",2);Ot=It([Qt("rokit-slider")],Ot);let Dr=class extends lr{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(r){r.has("offset")&&(this.style.left=this.offset+"px")}render(){return dt`<label part="label">${this.label}</label>`}};Dr.styles=[St`
251
+ `];It([Se()],Ot.prototype,"range",2);It([Se()],Ot.prototype,"labelFormatter",2);It([ft("#slider")],Ot.prototype,"sliderElement",2);It([ft("#track")],Ot.prototype,"track",2);It([ft("#start")],Ot.prototype,"startKnob",2);It([ft("#end")],Ot.prototype,"endKnob",2);Ot=It([Qt("rokit-slider")],Ot);let Dr=class extends lr{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(r){r.has("offset")&&(this.style.left=this.offset+"px")}render(){return ct`<label part="label">${this.label}</label>`}};Dr.styles=[St`
252
252
  :host { position: absolute; width: ${Vt}px; height: ${Vt}px; border-radius: ${Vt}px; background-color: var(--rokit-primary-color-inner); }
253
253
  :host(.focus), :host(:hover) { box-shadow: 0 0 0 ${Vt/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
254
254
  label {
@@ -278,13 +278,13 @@ a, a:visited { color: inherit; }
278
278
  background-color: inherit;
279
279
  clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
280
280
  }
281
- `];It([Se()],Dr.prototype,"offset",2);It([Se()],Dr.prototype,"label",2);Dr=It([Qt("rokit-slider-knob")],Dr);var tf=Object.defineProperty,rf=Object.getOwnPropertyDescriptor,Tn=(r,e,t,n)=>{for(var i=n>1?void 0:n?rf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&tf(e,t,i),i};let dr=class extends $t{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.title=""}firstUpdated(){this.dialogElement.addEventListener("close",()=>{this.open=!1,this.dispatchEvent(new Event("close"))})}updated(r){if(r.has("open"))if(this.open)document.body.style.top=`-${window.scrollY}px`,document.body.style.position="fixed",this.dialogElement.showModal();else{const e=document.body.style.top;document.body.style.position="",document.body.style.top="",window.scrollTo(0,parseInt(e||"0")*-1),this.dialogElement.close()}}render(){return dt`
281
+ `];It([Se()],Dr.prototype,"offset",2);It([Se()],Dr.prototype,"label",2);Dr=It([Qt("rokit-slider-knob")],Dr);var of=Object.defineProperty,lf=Object.getOwnPropertyDescriptor,Rn=(r,e,t,n)=>{for(var i=n>1?void 0:n?lf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&of(e,t,i),i};let dr=class extends $t{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.title=""}firstUpdated(){this.dialogElement.addEventListener("close",()=>{this.open=!1,this.dispatchEvent(new Event("close"))})}updated(r){if(r.has("open"))if(this.open)document.body.style.left=`-${window.scrollX}px`,document.body.style.top=`-${window.scrollY}px`,document.body.style.position="fixed",this.dialogElement.showModal();else{const e=document.body.style.left,t=document.body.style.top;document.body.style.position="",document.body.style.left="",document.body.style.top="",window.scrollTo(parseInt(e||"0")*-1,parseInt(t||"0")*-1),this.dialogElement.close()}}render(){return ct`
282
282
  <dialog id="dialog" part="dialog">
283
283
  <header>
284
284
  <div class="title" part="title">
285
285
  <slot name="header">${this.title}</slot>
286
286
  </div>
287
- ${this.closable?dt`
287
+ ${this.closable?ct`
288
288
  <rokit-button class="clear" icon ?dense="${this.dense}" @click="${()=>{this.open=!1}}" title="Close"></rokit-button>
289
289
  `:Ve}
290
290
  </header>
@@ -299,7 +299,7 @@ a, a:visited { color: inherit; }
299
299
  .title { font-weight: 600; flex-grow: 1; text-align: center; }
300
300
  .clear { justify-self: flex-end; }
301
301
  main { flex-grow: 1; overflow: auto; }
302
- `];Tn([Se({type:Boolean,reflect:!0})],dr.prototype,"open",2);Tn([Se({type:Boolean})],dr.prototype,"closable",2);Tn([Se()],dr.prototype,"title",2);Tn([pt("#dialog")],dr.prototype,"dialogElement",2);dr=Tn([Qt("rokit-dialog")],dr);class ri extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new Gd(n.store.getQuads(e,null,null,null),t,n),this.container=this,this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new nt;s.classList.add("collapsible","shacl-group"),s.open=n.attributes.collapse==="open",s.label=this.template.label,this.container=s}if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),n.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let s=[];i&&(t.linked?s=n.store.getQuads(i,this.template.path,null,null):s=n.store.getQuads(i,this.template.path,null,Dt));let a=!1;for(const o of s)this.isValueValid(o.object)&&(this.addPropertyInstance(o.object),this.template.hasValue&&o.object.equals(this.template.hasValue)&&(a=!0));n.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}n.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof nt&&(n.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const n=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let i=!1;if(e){const s=Ud(n,e,this.template.config);s.length&&(t=Xn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=dc(n,this,this.template.config),Dc(t,""))}else{let n=!1;if(e&&!(e instanceof ct)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,tt,i,Dt)===0&&(n=!0)}t=Xn(this.template,e,void 0,n||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const n=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",n)}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const i=Ne.namedNode(n.dataset.path);if(n.firstChild instanceof Wt){const s=n.firstChild.toRDF(e);e.addQuad(t,i,s,this.template.config.valuesGraphId)}else for(const s of n.querySelectorAll(":scope > .editor")){const a=Kd(s);a&&e.addQuad(t,i,a,this.template.config.valuesGraphId)}}}getRdfClassToLinkOrCreate(){if(this.template.class&&this.template.node)return this.template.class;for(const e of this.template.extendedShapes){const t=this.template.config.store.getObjects(e,Nr,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const n=this.template.config.store.getObjects(t,Nr,null);for(const i of n)if(this.template.config.store.countQuads(e,tt,i,null)>0)return!0}return!1}createAddButton(){const e=new Ge;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,e.classList.add("add-button");let t=[],n=this.getRdfClassToLinkOrCreate();if(n&&(t=Ia(n,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",i=>{e.blur();const s=this.addPropertyInstance();s.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{Bd(s),s.classList.remove("fadeIn")},200)});else{const i=document.createElement("ul"),s=document.createElement("li");s.innerHTML="&#xFF0B; Create new "+this.template.label+"...",s.dataset.value="new",s.classList.add("large"),i.appendChild(s);const a=document.createElement("li");a.classList.add("divider"),i.appendChild(a);const o=document.createElement("li");o.classList.add("header"),o.innerText="Or link existing:",i.appendChild(o);for(const u of t){const l=document.createElement("li"),c=typeof u.value=="string"?u.value:u.value.value;l.innerText=u.label?u.label:c,l.dataset.value=JSON.stringify(u.value),i.appendChild(l)}e.appendChild(i),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const u=JSON.parse(e.value);this.container.insertBefore(Xn(this.template,u,!0,!0),e)}e.value=""})}return e}}function Xn(r,e,t=!1,n=!1){let i;if(r.extendedShapes.length){i=document.createElement("div"),i.classList.add("property-instance");for(const s of r.extendedShapes)i.appendChild(new Wt(s,r.config,e,r.parent,r.nodeKind,r.label,n))}else{const s=eh(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=Qd(r,e||null,r.config.editMode&&!n),i.classList.add("property-instance"),n&&i.classList.add("linked")}return r.config.editMode&&Dc(i,r.label,t),i.dataset.path=r.path,i}function Dc(r,e,t=!1){const n=new Ar;n.classList.add("remove-button","clear"),n.title="Remove "+e,n.dense=!0,n.icon=!0,n.addEventListener("click",i=>{r.classList.remove("fadeIn"),r.classList.add("fadeOut"),setTimeout(()=>{const s=r.parentElement;r.remove(),s?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&n.classList.add("persistent"),r.appendChild(n)}window.customElements.define("shacl-property",ri);function nf(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=yn(n,"label",va,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new nt,s.classList.add("collapsible"),s.open=e.attributes.collapse==="open",s.label=t;else{s=document.createElement("div");const o=document.createElement("h1");o.innerText=t,s.appendChild(o)}s.dataset.subject=r,s.classList.add("shacl-group");const a=yn(n,"order");return a&&(s.style.order=a),s}const Je=[];for(let r=0;r<256;++r)Je.push((r+256).toString(16).slice(1));function sf(r,e=0){return(Je[r[e+0]]+Je[r[e+1]]+Je[r[e+2]]+Je[r[e+3]]+"-"+Je[r[e+4]]+Je[r[e+5]]+"-"+Je[r[e+6]]+Je[r[e+7]]+"-"+Je[r[e+8]]+Je[r[e+9]]+"-"+Je[r[e+10]]+Je[r[e+11]]+Je[r[e+12]]+Je[r[e+13]]+Je[r[e+14]]+Je[r[e+15]]).toLowerCase()}let Qi;const af=new Uint8Array(16);function of(){if(!Qi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Qi=crypto.getRandomValues.bind(crypto)}return Qi(af)}const lf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tl={randomUUID:lf};function rl(r,e,t){if(tl.randomUUID&&!r)return tl.randomUUID();r=r||{};const n=r.random??r.rng?.()??of();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,sf(n)}class Wt extends HTMLElement{constructor(e,t,n,i,s,a,o){super(),this.owlImports=[],this.parent=i,this.config=t,this.shaclSubject=e,this.linked=o||!1;let u=n;if(!u){if(!s){const c=t.store.getObjects(e,`${xe}nodeKind`,null);c.length&&(s=c[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${xe}IRI`?u=Ne.namedNode(t.attributes.valuesNamespace+rl()):u=Ne.blankNode(rl())}this.nodeId=u;const l=JSON.stringify([e,n]);if(n&&t.renderedNodes.has(l)){a=a||"Link";const c=document.createElement("label");c.innerText=a,c.classList.add("linked"),this.appendChild(c);const d=document.createElement("a");let b=n.termType==="BlankNode"?"_:"+n.value:n.value;d.innerText=b,d.classList.add("ref-link"),d.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${b}']`)?.scrollIntoView()},this.appendChild(d),this.style.flexDirection="row"}else{if(n&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const c=document.createElement("div");c.innerText=`id: ${this.nodeId.id}`,c.classList.add("node-id-display"),this.appendChild(c)}for(const c of t.store.getQuads(e,Ea,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case Zn.id:this.addPropertyInstance(c.object,t,n);break;case`${xe}and`:const d=t.lists[c.object.value];if(d?.length)for(const b of d)this.prepend(new Wt(b,t,n,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case Fd.id:this.prepend(new Wt(c.object,t,n,this));break;case`${xe}targetClass`:this.targetClass=c.object;break;case`${xe}or`:this.tryResolve(c.object,n,t);break;case`${xe}xone`:this.tryResolve(c.object,n,t);break}if(a){const c=document.createElement("h1");c.innerText=a,this.prepend(c)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const 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.targetClass&&e.addQuad(t,tt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Ne.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,n){let i=this;const s=t.store.getQuads(e,`${xe}group`,null,null);if(s.length>0){const o=s[0].object.value;if(t.groups.indexOf(o)>-1){let u=this.querySelector(`:scope > .shacl-group[data-subject='${o}']`);u||(u=nf(o,t),this.appendChild(u)),i=u}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new ri(e,this,t,n);a.childElementCount>0&&i.appendChild(a)}tryResolve(e,t,n){const i=n.lists[e.value];if(i?.length){let s=!1;if(t){const a=Hd(i,t,n);if(a.length){for(const o of a)this.addPropertyInstance(o,n,t);s=!0}}s||this.appendChild(dc(i,this,n))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",n.lists)}}window.customElements.define("shacl-node",Wt);var Yt={},Zt={},er={},Tt={},nl;function uf(){if(nl)return Tt;nl=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.removeDotSegmentsOfPath=Tt.removeDotSegments=Tt.resolve=void 0;function r(i,s){s=s||"";const a=s.indexOf("#");if(a>0&&(s=s.substr(0,a)),!i.length){if(s.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${s}' for value '${i}'`);return s}if(i.startsWith("?")){const y=s.indexOf("?");return y>0&&(s=s.substr(0,y)),s+i}if(i.startsWith("#"))return s+i;if(!s.length){const y=i.indexOf(":");if(y<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return t(i,y)}const o=i.indexOf(":");if(o>=0)return t(i,o);const u=s.indexOf(":");if(u<0)throw new Error(`Found invalid baseIRI '${s}' for value '${i}'`);const l=s.substr(0,u+1);if(i.indexOf("//")===0)return l+t(i,o);let c;if(s.indexOf("//",u)===u+1){if(c=s.indexOf("/",u+3),c<0)return s.length>u+3?s+"/"+t(i,o):l+t(i,o)}else if(c=s.indexOf("/",u+1),c<0)return l+t(i,o);if(i.indexOf("/")===0)return s.substr(0,c)+e(i);let d=s.substr(c);const b=d.lastIndexOf("/");return b>=0&&b<d.length-1&&(d=d.substr(0,b+1),i[0]==="."&&i[1]!=="."&&i[1]!=="/"&&i[2]&&(i=i.substr(1))),i=d+i,i=e(i),s.substr(0,c)+i}Tt.resolve=r;function e(i){const s=[];let a=0;for(;a<i.length;)switch(i[a]){case"/":if(i[a+1]===".")if(i[a+2]==="."){if(!n(i[a+3])){s.push([]),a++;break}s.pop(),i[a+3]||s.push([]),a+=3}else{if(!n(i[a+2])){s.push([]),a++;break}i[a+2]||s.push([]),a+=2}else s.push([]),a++;break;case"#":case"?":s.length||s.push([]),s[s.length-1].push(i.substr(a)),a=i.length;break;default:s.length||s.push([]),s[s.length-1].push(i[a]),a++;break}return"/"+s.map(o=>o.join("")).join("/")}Tt.removeDotSegments=e;function t(i,s){let a=s+1;s>=0?i[s+1]==="/"&&i[s+2]==="/"&&(a=s+3):i[0]==="/"&&i[1]==="/"&&(a=2);const o=i.indexOf("/",a);if(o<0)return i;const u=i.substr(0,o),l=i.substr(o);return u+e(l)}Tt.removeDotSegmentsOfPath=t;function n(i){return!i||i==="#"||i==="?"||i==="/"}return Tt}var il;function cf(){return il||(il=1,function(r){var e=er&&er.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=er&&er.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(uf(),r)}(er)),er}var tr={},Xi={},sl;function df(){return sl||(sl=1,function(r){/**
302
+ `];Rn([Se({type:Boolean,reflect:!0})],dr.prototype,"open",2);Rn([Se({type:Boolean})],dr.prototype,"closable",2);Rn([Se()],dr.prototype,"title",2);Rn([ft("#dialog")],dr.prototype,"dialogElement",2);dr=Rn([Qt("rokit-dialog")],dr);class ii extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new Qd(n.store.getQuads(e,null,null,null),t,n),this.container=this,this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new nt;s.classList.add("collapsible","shacl-group"),s.open=n.attributes.collapse==="open",s.label=this.template.label,this.container=s}if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),n.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let s=[];i&&(t.linked?s=n.store.getQuads(i,this.template.path,null,null):s=n.store.getQuads(i,this.template.path,null,Dt));let a=!1;for(const o of s)this.isValueValid(o.object)&&(this.addPropertyInstance(o.object),this.template.hasValue&&o.object.equals(this.template.hasValue)&&(a=!0));n.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}n.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof nt&&(n.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const n=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let i=!1;if(e){const s=Gd(n,e,this.template.config);s.length&&(t=Kn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=pc(n,this,this.template.config),jc(t,""))}else{let n=!1;if(e&&!(e instanceof _t)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,tt,i,Dt)===0&&(n=!0)}t=Kn(this.template,e,void 0,n||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const n=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",n)}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const i=Ne.namedNode(n.dataset.path);if(n.firstChild instanceof Wt){const s=n.firstChild.toRDF(e);e.addQuad(t,i,s,this.template.config.valuesGraphId)}else for(const s of n.querySelectorAll(":scope > .editor")){const a=eh(s);a&&e.addQuad(t,i,a,this.template.config.valuesGraphId)}}}getRdfClassToLinkOrCreate(){if(this.template.class&&this.template.node)return this.template.class;for(const e of this.template.extendedShapes){const t=this.template.config.store.getObjects(e,Nr,null);if(t.length>0)return t[0]}}isValueValid(e){if(!this.template.extendedShapes.length)return!0;for(const t of this.template.extendedShapes){const n=this.template.config.store.getObjects(t,Nr,null);for(const i of n)if(this.template.config.store.countQuads(e,tt,i,null)>0)return!0}return!1}createAddButton(){const e=new Ge;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,e.classList.add("add-button");let t=[],n=this.getRdfClassToLinkOrCreate();if(n&&(t=Aa(n,this.template)),t.length===0)e.emptyMessage="",e.inputMinWidth=0,e.addEventListener("click",i=>{e.blur();const s=this.addPropertyInstance();s.classList.add("fadeIn"),this.updateControls(),setTimeout(()=>{Hd(s),s.classList.remove("fadeIn")},200)});else{const i=document.createElement("ul"),s=document.createElement("li");s.innerHTML="&#xFF0B; Create new "+this.template.label+"...",s.dataset.value="new",s.classList.add("large"),i.appendChild(s);const a=document.createElement("li");a.classList.add("divider"),i.appendChild(a);const o=document.createElement("li");o.classList.add("header"),o.innerText="Or link existing:",i.appendChild(o);for(const u of t){const l=document.createElement("li"),c=typeof u.value=="string"?u.value:u.value.value;l.innerText=u.label?u.label:c,l.dataset.value=JSON.stringify(u.value),i.appendChild(l)}e.appendChild(i),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const u=JSON.parse(e.value);this.container.insertBefore(Kn(this.template,u,!0,!0),e)}e.value=""})}return e}}function Kn(r,e,t=!1,n=!1){let i;if(r.extendedShapes.length){i=document.createElement("div"),i.classList.add("property-instance");for(const s of r.extendedShapes)i.appendChild(new Wt(s,r.config,e,r.parent,r.nodeKind,r.label,n))}else{const s=nh(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=Kd(r,e||null,r.config.editMode&&!n),i.classList.add("property-instance"),n&&i.classList.add("linked")}return r.config.editMode&&jc(i,r.label,t),i.dataset.path=r.path,i}function jc(r,e,t=!1){const n=new Ar;n.classList.add("remove-button","clear"),n.title="Remove "+e,n.dense=!0,n.icon=!0,n.addEventListener("click",i=>{r.classList.remove("fadeIn"),r.classList.add("fadeOut"),setTimeout(()=>{const s=r.parentElement;r.remove(),s?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&n.classList.add("persistent"),r.appendChild(n)}window.customElements.define("shacl-property",ii);function uf(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=yn(n,"label",Ia,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new nt,s.classList.add("collapsible"),s.open=e.attributes.collapse==="open",s.label=t;else{s=document.createElement("div");const o=document.createElement("h1");o.innerText=t,s.appendChild(o)}s.dataset.subject=r,s.classList.add("shacl-group");const a=yn(n,"order");return a&&(s.style.order=a),s}const Je=[];for(let r=0;r<256;++r)Je.push((r+256).toString(16).slice(1));function cf(r,e=0){return(Je[r[e+0]]+Je[r[e+1]]+Je[r[e+2]]+Je[r[e+3]]+"-"+Je[r[e+4]]+Je[r[e+5]]+"-"+Je[r[e+6]]+Je[r[e+7]]+"-"+Je[r[e+8]]+Je[r[e+9]]+"-"+Je[r[e+10]]+Je[r[e+11]]+Je[r[e+12]]+Je[r[e+13]]+Je[r[e+14]]+Je[r[e+15]]).toLowerCase()}let Yi;const df=new Uint8Array(16);function hf(){if(!Yi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Yi=crypto.getRandomValues.bind(crypto)}return Yi(df)}const ff=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),il={randomUUID:ff};function sl(r,e,t){if(il.randomUUID&&!r)return il.randomUUID();r=r||{};const n=r.random??r.rng?.()??hf();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,cf(n)}class Wt extends HTMLElement{constructor(e,t,n,i,s,a,o){super(),this.owlImports=[],this.parent=i,this.config=t,this.shaclSubject=e,this.linked=o||!1;let u=n;if(!u){if(!s){const c=t.store.getObjects(e,`${xe}nodeKind`,null);c.length&&(s=c[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${xe}IRI`?u=Ne.namedNode(t.attributes.valuesNamespace+sl()):u=Ne.blankNode(sl())}this.nodeId=u;const l=JSON.stringify([e,n]);if(n&&t.renderedNodes.has(l)){a=a||"Link";const c=document.createElement("label");c.innerText=a,c.classList.add("linked"),this.appendChild(c);const h=document.createElement("a");let b=n.termType==="BlankNode"?"_:"+n.value:n.value;h.innerText=b,h.classList.add("ref-link"),h.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${b}']`)?.scrollIntoView()},this.appendChild(h),this.style.flexDirection="row"}else{if(n&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const c=document.createElement("div");c.innerText=`id: ${this.nodeId.id}`,c.classList.add("node-id-display"),this.appendChild(c)}for(const c of t.store.getQuads(e,Ra,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case ti.id:this.addPropertyInstance(c.object,t,n);break;case`${xe}and`:const h=t.lists[c.object.value];if(h?.length)for(const b of h)this.prepend(new Wt(b,t,n,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case Bd.id:this.prepend(new Wt(c.object,t,n,this));break;case`${xe}targetClass`:this.targetClass=c.object;break;case`${xe}or`:this.tryResolve(c.object,n,t);break;case`${xe}xone`:this.tryResolve(c.object,n,t);break}if(a){const c=document.createElement("h1");c.innerText=a,this.prepend(c)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const 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.targetClass&&e.addQuad(t,tt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Ne.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,n){let i=this;const s=t.store.getQuads(e,`${xe}group`,null,null);if(s.length>0){const o=s[0].object.value;if(t.groups.indexOf(o)>-1){let u=this.querySelector(`:scope > .shacl-group[data-subject='${o}']`);u||(u=uf(o,t),this.appendChild(u)),i=u}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new ii(e,this,t,n);a.childElementCount>0&&i.appendChild(a)}tryResolve(e,t,n){const i=n.lists[e.value];if(i?.length){let s=!1;if(t){const a=Wd(i,t,n);if(a.length){for(const o of a)this.addPropertyInstance(o,n,t);s=!0}}s||this.appendChild(pc(i,this,n))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",n.lists)}}window.customElements.define("shacl-node",Wt);var Yt={},Zt={},er={},Tt={},al;function pf(){if(al)return Tt;al=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.removeDotSegmentsOfPath=Tt.removeDotSegments=Tt.resolve=void 0;function r(i,s){s=s||"";const a=s.indexOf("#");if(a>0&&(s=s.substr(0,a)),!i.length){if(s.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${s}' for value '${i}'`);return s}if(i.startsWith("?")){const y=s.indexOf("?");return y>0&&(s=s.substr(0,y)),s+i}if(i.startsWith("#"))return s+i;if(!s.length){const y=i.indexOf(":");if(y<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return t(i,y)}const o=i.indexOf(":");if(o>=0)return t(i,o);const u=s.indexOf(":");if(u<0)throw new Error(`Found invalid baseIRI '${s}' for value '${i}'`);const l=s.substr(0,u+1);if(i.indexOf("//")===0)return l+t(i,o);let c;if(s.indexOf("//",u)===u+1){if(c=s.indexOf("/",u+3),c<0)return s.length>u+3?s+"/"+t(i,o):l+t(i,o)}else if(c=s.indexOf("/",u+1),c<0)return l+t(i,o);if(i.indexOf("/")===0)return s.substr(0,c)+e(i);let h=s.substr(c);const b=h.lastIndexOf("/");return b>=0&&b<h.length-1&&(h=h.substr(0,b+1),i[0]==="."&&i[1]!=="."&&i[1]!=="/"&&i[2]&&(i=i.substr(1))),i=h+i,i=e(i),s.substr(0,c)+i}Tt.resolve=r;function e(i){const s=[];let a=0;for(;a<i.length;)switch(i[a]){case"/":if(i[a+1]===".")if(i[a+2]==="."){if(!n(i[a+3])){s.push([]),a++;break}s.pop(),i[a+3]||s.push([]),a+=3}else{if(!n(i[a+2])){s.push([]),a++;break}i[a+2]||s.push([]),a+=2}else s.push([]),a++;break;case"#":case"?":s.length||s.push([]),s[s.length-1].push(i.substr(a)),a=i.length;break;default:s.length||s.push([]),s[s.length-1].push(i[a]),a++;break}return"/"+s.map(o=>o.join("")).join("/")}Tt.removeDotSegments=e;function t(i,s){let a=s+1;s>=0?i[s+1]==="/"&&i[s+2]==="/"&&(a=s+3):i[0]==="/"&&i[1]==="/"&&(a=2);const o=i.indexOf("/",a);if(o<0)return i;const u=i.substr(0,o),l=i.substr(o);return u+e(l)}Tt.removeDotSegmentsOfPath=t;function n(i){return!i||i==="#"||i==="?"||i==="/"}return Tt}var ol;function gf(){return ol||(ol=1,function(r){var e=er&&er.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=er&&er.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(pf(),r)}(er)),er}var tr={},Zi={},ll;function mf(){return ll||(ll=1,function(r){/**
303
303
  * Character classes and associated utilities for the 5th edition of XML 1.0.
304
304
  *
305
305
  * @author Louis-Dominique Dubeau
@@ -307,52 +307,52 @@ a, a:visited { color: inherit; }
307
307
  * @copyright Louis-Dominique Dubeau
308
308
  */Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR=`
309
309
  \r -퟿-�𐀀-􏿿`,r.S=` \r
310
- `,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,n=13,i=32;r.S_LIST=[i,t,n,e];function s(l){return l>=i&&l<=55295||l===t||l===n||l===e||l>=57344&&l<=65533||l>=65536&&l<=1114111}r.isChar=s;function a(l){return l===i||l===t||l===n||l===e}r.isS=a;function o(l){return l>=65&&l<=90||l>=97&&l<=122||l===58||l===95||l===8204||l===8205||l>=192&&l<=214||l>=216&&l<=246||l>=248&&l<=767||l>=880&&l<=893||l>=895&&l<=8191||l>=8304&&l<=8591||l>=11264&&l<=12271||l>=12289&&l<=55295||l>=63744&&l<=64975||l>=65008&&l<=65533||l>=65536&&l<=983039}r.isNameStartChar=o;function u(l){return o(l)||l>=48&&l<=57||l===45||l===46||l===183||l>=768&&l<=879||l>=8255&&l<=8256}r.isNameChar=u}(Xi)),Xi}var Ji={},al;function hf(){return al||(al=1,function(r){/**
310
+ `,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,n=13,i=32;r.S_LIST=[i,t,n,e];function s(l){return l>=i&&l<=55295||l===t||l===n||l===e||l>=57344&&l<=65533||l>=65536&&l<=1114111}r.isChar=s;function a(l){return l===i||l===t||l===n||l===e}r.isS=a;function o(l){return l>=65&&l<=90||l>=97&&l<=122||l===58||l===95||l===8204||l===8205||l>=192&&l<=214||l>=216&&l<=246||l>=248&&l<=767||l>=880&&l<=893||l>=895&&l<=8191||l>=8304&&l<=8591||l>=11264&&l<=12271||l>=12289&&l<=55295||l>=63744&&l<=64975||l>=65008&&l<=65533||l>=65536&&l<=983039}r.isNameStartChar=o;function u(l){return o(l)||l>=48&&l<=57||l===45||l===46||l===183||l>=768&&l<=879||l>=8255&&l<=8256}r.isNameChar=u}(Zi)),Zi}var es={},ul;function yf(){return ul||(ul=1,function(r){/**
311
311
  * Character classes and associated utilities for the 2nd edition of XML 1.1.
312
312
  *
313
313
  * @author Louis-Dominique Dubeau
314
314
  * @license MIT
315
315
  * @copyright Louis-Dominique Dubeau
316
316
  */Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR="-퟿-�𐀀-􏿿",r.RESTRICTED_CHAR="-\b\v\f--„†-Ÿ",r.S=` \r
317
- `,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.RESTRICTED_CHAR_RE=new RegExp("^["+r.RESTRICTED_CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,n=13,i=32;r.S_LIST=[i,t,n,e];function s(d){return d>=1&&d<=55295||d>=57344&&d<=65533||d>=65536&&d<=1114111}r.isChar=s;function a(d){return d>=1&&d<=8||d===11||d===12||d>=14&&d<=31||d>=127&&d<=132||d>=134&&d<=159}r.isRestrictedChar=a;function o(d){return d===9||d===10||d===13||d>31&&d<127||d===133||d>159&&d<=55295||d>=57344&&d<=65533||d>=65536&&d<=1114111}r.isCharAndNotRestricted=o;function u(d){return d===i||d===t||d===n||d===e}r.isS=u;function l(d){return d>=65&&d<=90||d>=97&&d<=122||d===58||d===95||d===8204||d===8205||d>=192&&d<=214||d>=216&&d<=246||d>=248&&d<=767||d>=880&&d<=893||d>=895&&d<=8191||d>=8304&&d<=8591||d>=11264&&d<=12271||d>=12289&&d<=55295||d>=63744&&d<=64975||d>=65008&&d<=65533||d>=65536&&d<=983039}r.isNameStartChar=l;function c(d){return l(d)||d>=48&&d<=57||d===45||d===46||d===183||d>=768&&d<=879||d>=8255&&d<=8256}r.isNameChar=c}(Ji)),Ji}var Ki={},ol;function ff(){return ol||(ol=1,function(r){/**
317
+ `,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.RESTRICTED_CHAR_RE=new RegExp("^["+r.RESTRICTED_CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,n=13,i=32;r.S_LIST=[i,t,n,e];function s(h){return h>=1&&h<=55295||h>=57344&&h<=65533||h>=65536&&h<=1114111}r.isChar=s;function a(h){return h>=1&&h<=8||h===11||h===12||h>=14&&h<=31||h>=127&&h<=132||h>=134&&h<=159}r.isRestrictedChar=a;function o(h){return h===9||h===10||h===13||h>31&&h<127||h===133||h>159&&h<=55295||h>=57344&&h<=65533||h>=65536&&h<=1114111}r.isCharAndNotRestricted=o;function u(h){return h===i||h===t||h===n||h===e}r.isS=u;function l(h){return h>=65&&h<=90||h>=97&&h<=122||h===58||h===95||h===8204||h===8205||h>=192&&h<=214||h>=216&&h<=246||h>=248&&h<=767||h>=880&&h<=893||h>=895&&h<=8191||h>=8304&&h<=8591||h>=11264&&h<=12271||h>=12289&&h<=55295||h>=63744&&h<=64975||h>=65008&&h<=65533||h>=65536&&h<=983039}r.isNameStartChar=l;function c(h){return l(h)||h>=48&&h<=57||h===45||h===46||h===183||h>=768&&h<=879||h>=8255&&h<=8256}r.isNameChar=c}(es)),es}var ts={},cl;function bf(){return cl||(cl=1,function(r){/**
318
318
  * Character class utilities for XML NS 1.0 edition 3.
319
319
  *
320
320
  * @author Louis-Dominique Dubeau
321
321
  * @license MIT
322
322
  * @copyright Louis-Dominique Dubeau
323
- */Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u");function e(n){return n>=65&&n<=90||n===95||n>=97&&n<=122||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||n>=65536&&n<=983039}r.isNCNameStartChar=e;function t(n){return e(n)||n===45||n===46||n>=48&&n<=57||n===183||n>=768&&n<=879||n>=8255&&n<=8256}r.isNCNameChar=t}(Ki)),Ki}var ll;function pf(){if(ll)return tr;ll=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.SaxesParser=tr.EVENTS=void 0;const r=df(),e=hf(),t=ff();var n=r.isS,i=r.isChar,s=r.isNameStartChar,a=r.isNameChar,o=r.S_LIST,u=r.NAME_RE,l=e.isChar,c=t.isNCNameStartChar,d=t.isNCNameChar,b=t.NC_NAME_RE;const y="http://www.w3.org/XML/1998/namespace",_="http://www.w3.org/2000/xmlns/",E={__proto__:null,xml:y,xmlns:_},v={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},x=-1,S=-2,m=0,h=1,g=2,N=3,C=4,A=5,B=6,R=7,F=8,q=9,D=10,L=11,te=12,T=13,Z=14,k=15,Y=16,w=17,H=18,K=19,Q=20,ue=21,V=22,G=23,z=24,U=25,ee=26,re=27,fe=28,ge=29,j=30,W=31,se=32,he=33,pe=34,me=35,J=36,ce=37,ye=38,le=39,Re=40,ze=41,Ie=42,Xe=43,I=44,f=9,p=10,$=13,X=32,oe=33,de=34,Ee=38,ke=39,Le=45,Oe=47,De=59,yt=60,Pt=61,qe=62,He=63,Ln=91,Mt=93,gr=133,Pr=8232,O=We=>We===de||We===ke,M=[de,ke],be=[...M,Ln,qe],_e=[...M,yt,Mt],ve=[Pt,He,...o],Qe=[...o,qe,Ee,yt];function Ye(We,P,ne){switch(P){case"xml":ne!==y&&We.fail(`xml prefix must be bound to ${y}.`);break;case"xmlns":ne!==_&&We.fail(`xmlns prefix must be bound to ${_}.`);break}switch(ne){case _:We.fail(P===""?`the default namespace may not be set to ${ne}.`:`may not assign a prefix (even "xmlns") to the URI ${_}.`);break;case y:switch(P){case"xml":break;case"":We.fail(`the default namespace may not be set to ${ne}.`);break;default:We.fail("may not assign the xml namespace to another prefix.")}break}}function On(We,P){for(const ne of Object.keys(P))Ye(We,ne,P[ne])}const Nt=We=>b.test(We),Cn=We=>u.test(We),Rt=0,Mr=1,mr=2;tr.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const yr={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"};class Br{get closed(){return this._closed}constructor(P){this.opt=P??{},this.fragmentOpt=!!this.opt.fragment;const ne=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,ne){this.nameStartCheck=c,this.nameCheck=d,this.isName=Nt,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},E);const ie=this.opt.additionalNamespaces;ie!=null&&(On(this,ie),Object.assign(this.ns,ie))}else this.nameStartCheck=s,this.nameCheck=a,this.isName=Cn,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 P;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=Rt,this.attribList=[];const{fragmentOpt:ne}=this;this.state=ne?T:m,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=ne,this.xmlDeclPossible=!ne,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:ie}=this.opt;if(ie===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");ie="1.0"}this.setXMLVersion(ie),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(v),(P=this.readyHandler)===null||P===void 0||P.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(P,ne){this[yr[P]]=ne}off(P){this[yr[P]]=void 0}makeError(P){var ne;let ie=(ne=this.fileName)!==null&&ne!==void 0?ne:"";return this.trackPosition&&(ie.length>0&&(ie+=":"),ie+=`${this.line}:${this.column}`),ie.length>0&&(ie+=": "),new Error(ie+P)}fail(P){const ne=this.makeError(P),ie=this.errorHandler;if(ie===void 0)throw ne;return ie(ne),this}write(P){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let ne=!1;P===null?(ne=!0,P=""):typeof P=="object"&&(P=P.toString()),this.carriedFromPrevious!==void 0&&(P=`${this.carriedFromPrevious}${P}`,this.carriedFromPrevious=void 0);let ie=P.length;const we=P.charCodeAt(ie-1);!ne&&(we===$||we>=55296&&we<=56319)&&(this.carriedFromPrevious=P[ie-1],ie--,P=P.slice(0,ie));const{stateTable:Ae}=this;for(this.chunk=P,this.i=0;this.i<ie;)Ae[this.state].call(this);return this.chunkPosition+=ie,ne?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:P,i:ne}=this;if(this.prevI=ne,this.i=ne+1,ne>=P.length)return x;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>=X||ie===f)return ie;switch(ie){case p:return this.line++,this.column=0,this.positionAtNewLine=this.position,p;case $:return P.charCodeAt(ne+1)===p&&(this.i=ne+2),this.line++,this.column=0,this.positionAtNewLine=this.position,S;default:return this.fail("disallowed character."),ie}}if(ie>56319)return ie>=57344&&ie<=65533||this.fail("disallowed character."),ie;const we=65536+(ie-55296)*1024+(P.charCodeAt(ne+1)-56320);return this.i=ne+2,we>1114111&&this.fail("disallowed character."),we}getCode11(){const{chunk:P,i:ne}=this;if(this.prevI=ne,this.i=ne+1,ne>=P.length)return x;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>31&&ie<127||ie>159&&ie!==Pr||ie===f)return ie;switch(ie){case p:return this.line++,this.column=0,this.positionAtNewLine=this.position,p;case $:{const Ae=P.charCodeAt(ne+1);(Ae===p||Ae===gr)&&(this.i=ne+2)}case gr:case Pr:return this.line++,this.column=0,this.positionAtNewLine=this.position,S;default:return this.fail("disallowed character."),ie}}if(ie>56319)return ie>=57344&&ie<=65533||this.fail("disallowed character."),ie;const we=65536+(ie-55296)*1024+(P.charCodeAt(ne+1)-56320);return this.i=ne+2,we>1114111&&this.fail("disallowed character."),we}getCodeNorm(){const P=this.getCode();return P===S?p:P}unget(){this.i=this.prevI,this.column--}captureTo(P){let{i:ne}=this;const{chunk:ie}=this;for(;;){const we=this.getCode(),Ae=we===S,Ce=Ae?p:we;if(Ce===x||P.includes(Ce))return this.text+=ie.slice(ne,this.prevI),Ce;Ae&&(this.text+=`${ie.slice(ne,this.prevI)}
323
+ */Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u");function e(n){return n>=65&&n<=90||n===95||n>=97&&n<=122||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||n>=65536&&n<=983039}r.isNCNameStartChar=e;function t(n){return e(n)||n===45||n===46||n>=48&&n<=57||n===183||n>=768&&n<=879||n>=8255&&n<=8256}r.isNCNameChar=t}(ts)),ts}var dl;function _f(){if(dl)return tr;dl=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.SaxesParser=tr.EVENTS=void 0;const r=mf(),e=yf(),t=bf();var n=r.isS,i=r.isChar,s=r.isNameStartChar,a=r.isNameChar,o=r.S_LIST,u=r.NAME_RE,l=e.isChar,c=t.isNCNameStartChar,h=t.isNCNameChar,b=t.NC_NAME_RE;const y="http://www.w3.org/XML/1998/namespace",_="http://www.w3.org/2000/xmlns/",E={__proto__:null,xml:y,xmlns:_},v={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},x=-1,S=-2,m=0,d=1,g=2,N=3,C=4,A=5,B=6,R=7,F=8,q=9,D=10,L=11,te=12,T=13,Z=14,k=15,Y=16,w=17,H=18,K=19,Q=20,ue=21,V=22,G=23,z=24,U=25,ee=26,re=27,fe=28,ge=29,j=30,W=31,se=32,he=33,pe=34,me=35,J=36,ce=37,ye=38,le=39,Re=40,ze=41,Ie=42,Xe=43,I=44,f=9,p=10,$=13,X=32,oe=33,de=34,Ee=38,ke=39,Le=45,Oe=47,De=59,mt=60,Pt=61,qe=62,He=63,Dn=91,Mt=93,gr=133,Pr=8232,O=We=>We===de||We===ke,M=[de,ke],be=[...M,Dn,qe],_e=[...M,mt,Mt],ve=[Pt,He,...o],Qe=[...o,qe,Ee,mt];function Ye(We,P,ne){switch(P){case"xml":ne!==y&&We.fail(`xml prefix must be bound to ${y}.`);break;case"xmlns":ne!==_&&We.fail(`xmlns prefix must be bound to ${_}.`);break}switch(ne){case _:We.fail(P===""?`the default namespace may not be set to ${ne}.`:`may not assign a prefix (even "xmlns") to the URI ${_}.`);break;case y:switch(P){case"xml":break;case"":We.fail(`the default namespace may not be set to ${ne}.`);break;default:We.fail("may not assign the xml namespace to another prefix.")}break}}function Ln(We,P){for(const ne of Object.keys(P))Ye(We,ne,P[ne])}const Nt=We=>b.test(We),On=We=>u.test(We),Rt=0,Mr=1,mr=2;tr.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const yr={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"};class Br{get closed(){return this._closed}constructor(P){this.opt=P??{},this.fragmentOpt=!!this.opt.fragment;const ne=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,ne){this.nameStartCheck=c,this.nameCheck=h,this.isName=Nt,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},E);const ie=this.opt.additionalNamespaces;ie!=null&&(Ln(this,ie),Object.assign(this.ns,ie))}else this.nameStartCheck=s,this.nameCheck=a,this.isName=On,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 P;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=Rt,this.attribList=[];const{fragmentOpt:ne}=this;this.state=ne?T:m,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=ne,this.xmlDeclPossible=!ne,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:ie}=this.opt;if(ie===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");ie="1.0"}this.setXMLVersion(ie),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(v),(P=this.readyHandler)===null||P===void 0||P.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(P,ne){this[yr[P]]=ne}off(P){this[yr[P]]=void 0}makeError(P){var ne;let ie=(ne=this.fileName)!==null&&ne!==void 0?ne:"";return this.trackPosition&&(ie.length>0&&(ie+=":"),ie+=`${this.line}:${this.column}`),ie.length>0&&(ie+=": "),new Error(ie+P)}fail(P){const ne=this.makeError(P),ie=this.errorHandler;if(ie===void 0)throw ne;return ie(ne),this}write(P){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let ne=!1;P===null?(ne=!0,P=""):typeof P=="object"&&(P=P.toString()),this.carriedFromPrevious!==void 0&&(P=`${this.carriedFromPrevious}${P}`,this.carriedFromPrevious=void 0);let ie=P.length;const we=P.charCodeAt(ie-1);!ne&&(we===$||we>=55296&&we<=56319)&&(this.carriedFromPrevious=P[ie-1],ie--,P=P.slice(0,ie));const{stateTable:Ae}=this;for(this.chunk=P,this.i=0;this.i<ie;)Ae[this.state].call(this);return this.chunkPosition+=ie,ne?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:P,i:ne}=this;if(this.prevI=ne,this.i=ne+1,ne>=P.length)return x;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>=X||ie===f)return ie;switch(ie){case p:return this.line++,this.column=0,this.positionAtNewLine=this.position,p;case $:return P.charCodeAt(ne+1)===p&&(this.i=ne+2),this.line++,this.column=0,this.positionAtNewLine=this.position,S;default:return this.fail("disallowed character."),ie}}if(ie>56319)return ie>=57344&&ie<=65533||this.fail("disallowed character."),ie;const we=65536+(ie-55296)*1024+(P.charCodeAt(ne+1)-56320);return this.i=ne+2,we>1114111&&this.fail("disallowed character."),we}getCode11(){const{chunk:P,i:ne}=this;if(this.prevI=ne,this.i=ne+1,ne>=P.length)return x;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>31&&ie<127||ie>159&&ie!==Pr||ie===f)return ie;switch(ie){case p:return this.line++,this.column=0,this.positionAtNewLine=this.position,p;case $:{const Ae=P.charCodeAt(ne+1);(Ae===p||Ae===gr)&&(this.i=ne+2)}case gr:case Pr:return this.line++,this.column=0,this.positionAtNewLine=this.position,S;default:return this.fail("disallowed character."),ie}}if(ie>56319)return ie>=57344&&ie<=65533||this.fail("disallowed character."),ie;const we=65536+(ie-55296)*1024+(P.charCodeAt(ne+1)-56320);return this.i=ne+2,we>1114111&&this.fail("disallowed character."),we}getCodeNorm(){const P=this.getCode();return P===S?p:P}unget(){this.i=this.prevI,this.column--}captureTo(P){let{i:ne}=this;const{chunk:ie}=this;for(;;){const we=this.getCode(),Ae=we===S,Ce=Ae?p:we;if(Ce===x||P.includes(Ce))return this.text+=ie.slice(ne,this.prevI),Ce;Ae&&(this.text+=`${ie.slice(ne,this.prevI)}
324
324
  `,ne=this.i)}}captureToChar(P){let{i:ne}=this;const{chunk:ie}=this;for(;;){let we=this.getCode();switch(we){case S:this.text+=`${ie.slice(ne,this.prevI)}
325
- `,ne=this.i,we=p;break;case x:return this.text+=ie.slice(ne),!1}if(we===P)return this.text+=ie.slice(ne,this.prevI),!0}}captureNameChars(){const{chunk:P,i:ne}=this;for(;;){const ie=this.getCode();if(ie===x)return this.name+=P.slice(ne),x;if(!a(ie))return this.name+=P.slice(ne,this.prevI),ie===S?p:ie}}skipSpaces(){for(;;){const P=this.getCodeNorm();if(P===x||!n(P))return P}}setXMLVersion(P){this.currentXMLVersion=P,P==="1.0"?(this.isChar=i,this.getCode=this.getCode10):(this.isChar=l,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=h}sBeginWhitespace(){const P=this.i,ne=this.skipSpaces();switch(this.prevI!==P&&(this.xmlDeclPossible=!1),ne){case yt:if(this.state=k,this.text.length!==0)throw new Error("no-empty text at start");break;case x:break;default:this.unget(),this.state=T,this.xmlDeclPossible=!1}}sDoctype(){var P;const ne=this.captureTo(be);switch(ne){case qe:{(P=this.doctypeHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=T,this.doctype=!0;break}case x:break;default:this.text+=String.fromCodePoint(ne),ne===Ln?this.state=C:O(ne)&&(this.state=N,this.q=ne)}}sDoctypeQuote(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.q=null,this.state=g)}sDTD(){const P=this.captureTo(_e);P!==x&&(this.text+=String.fromCodePoint(P),P===Mt?this.state=g:P===yt?this.state=B:O(P)&&(this.state=A,this.q=P))}sDTDQuoted(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.state=C,this.q=null)}sDTDOpenWaka(){const P=this.getCodeNorm();switch(this.text+=String.fromCodePoint(P),P){case oe:this.state=R,this.openWakaBang="";break;case He:this.state=L;break;default:this.state=C}}sDTDOpenWakaBang(){const P=String.fromCodePoint(this.getCodeNorm()),ne=this.openWakaBang+=P;this.text+=P,ne!=="-"&&(this.state=ne==="--"?F:C,this.openWakaBang="")}sDTDComment(){this.captureToChar(Le)&&(this.text+="-",this.state=q)}sDTDCommentEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),this.state=P===Le?D:F}sDTDCommentEnded(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe?this.state=C:(this.fail("malformed comment."),this.state=F)}sDTDPI(){this.captureToChar(He)&&(this.text+="?",this.state=te)}sDTDPIEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe&&(this.state=C)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:P}=this;const{chunk:ne}=this;e:for(;;)switch(this.getCode()){case S:this.entity+=`${ne.slice(P,this.prevI)}
326
- `,P=this.i;break;case De:{const{entityReturnState:ie}=this,we=this.entity+ne.slice(P,this.prevI);this.state=ie;let Ae;we===""?(this.fail("empty entity name."),Ae="&;"):(Ae=this.parseEntity(we),this.entity=""),(ie!==T||this.textHandler!==void 0)&&(this.text+=Ae);break e}case x:this.entity+=ne.slice(P);break e}}sOpenWaka(){const P=this.getCode();if(s(P))this.state=pe,this.unget(),this.xmlDeclPossible=!1;else switch(P){case Oe:this.state=Xe,this.xmlDeclPossible=!1;break;case oe:this.state=Y,this.openWakaBang="",this.xmlDeclPossible=!1;break;case He:this.state=G;break;default:this.fail("disallowed character in tag name"),this.state=T,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=Q,this.openWakaBang="";break;case"--":this.state=w,this.openWakaBang="";break;case"DOCTYPE":this.state=g,(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(Le)&&(this.state=H)}sCommentEnding(){var P;const ne=this.getCodeNorm();ne===Le?(this.state=K,(P=this.commentHandler)===null||P===void 0||P.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(ne)}`,this.state=w)}sCommentEnded(){const P=this.getCodeNorm();P!==qe?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(P)}`,this.state=w):this.state=T}sCData(){this.captureToChar(Mt)&&(this.state=ue)}sCDataEnding(){const P=this.getCodeNorm();P===Mt?this.state=V:(this.text+=`]${String.fromCodePoint(P)}`,this.state=Q)}sCDataEnding2(){var P;const ne=this.getCodeNorm();switch(ne){case qe:{(P=this.cdataHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=T;break}case Mt:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(ne)}`,this.state=Q}}sPIFirstChar(){const P=this.getCodeNorm();this.nameStartCheck(P)?(this.piTarget+=String.fromCodePoint(P),this.state=z):P===He||n(P)?(this.fail("processing instruction without a target."),this.state=P===He?ee:U):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(P),this.state=z)}sPIRest(){const{chunk:P,i:ne}=this;for(;;){const ie=this.getCodeNorm();if(ie===x){this.piTarget+=P.slice(ne);return}if(!this.nameCheck(ie)){this.piTarget+=P.slice(ne,this.prevI);const we=ie===He;we||n(ie)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=we?he:re):this.state=we?ee:U:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(ie));break}}}sPIBody(){if(this.text.length===0){const P=this.getCodeNorm();P===He?this.state=ee:n(P)||(this.text=String.fromCodePoint(P))}else this.captureToChar(He)&&(this.state=ee)}sPIEnding(){var P;const ne=this.getCodeNorm();if(ne===qe){const{piTarget:ie}=this;ie.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(P=this.piHandler)===null||P===void 0||P.call(this,{target:ie,body:this.text}),this.piTarget=this.text="",this.state=T}else ne===He?this.text+="?":(this.text+=`?${String.fromCodePoint(ne)}`,this.state=U);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const P=this.skipSpaces();if(P===He){this.state=he;return}P!==x&&(this.state=fe,this.name=String.fromCodePoint(P))}sXMLDeclName(){const P=this.captureTo(ve);if(P===He){this.state=he,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(n(P)||P===Pt){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=P===Pt?j:ge}}sXMLDeclEq(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(P!==Pt&&this.fail("value required."),this.state=j)}sXMLDeclValueStart(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(O(P)?this.q=P:(this.fail("value must be quoted."),this.q=X),this.state=W)}sXMLDeclValue(){const P=this.captureTo([this.q,He]);if(P===He){this.state=he,this.text="",this.fail("XML declaration is incomplete.");return}if(P===x)return;const ne=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const ie=ne;this.xmlDecl.version=ie,/^1\.[0-9]+$/.test(ie)?this.opt.forceXMLVersion||this.setXMLVersion(ie):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(ne)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=ne;break;case"standalone":ne!=="yes"&&ne!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=ne;break}this.name="",this.state=se}sXMLDeclSeparator(){const P=this.getCodeNorm();if(P===He){this.state=he;return}n(P)||(this.fail("whitespace required."),this.unget()),this.state=re}sXMLDeclEnding(){var P;this.getCodeNorm()===qe?(this.piTarget!=="xml"?this.fail("processing instructions are not allowed before root."):this.name!=="version"&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),(P=this.xmldeclHandler)===null||P===void 0||P.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=T):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var P;const ne=this.captureNameChars();if(ne===x)return;const ie=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=ie.ns=Object.create(null)),(P=this.openTagStartHandler)===null||P===void 0||P.call(this,ie),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),ne){case qe:this.openTag();break;case Oe:this.state=me;break;default:n(ne)||this.fail("disallowed character in tag name."),this.state=J}}sOpenTagSlash(){this.getCode()===qe?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=J)}sAttrib(){const P=this.skipSpaces();P!==x&&(s(P)?(this.unget(),this.state=ce):P===qe?this.openTag():P===Oe?this.state=me:this.fail("disallowed character in attribute name."))}sAttribName(){const P=this.captureNameChars();P===Pt?this.state=le:n(P)?this.state=ye:P===qe?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):P!==x&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const P=this.skipSpaces();switch(P){case x:return;case Pt:this.state=le;break;default:this.fail("attribute without value."),this.text="",this.name="",P===qe?this.openTag():s(P)?(this.unget(),this.state=ce):(this.fail("disallowed character in attribute name."),this.state=J)}}sAttribValue(){const P=this.getCodeNorm();O(P)?(this.q=P,this.state=Re):n(P)||(this.fail("unquoted attribute value."),this.state=Ie,this.unget())}sAttribValueQuoted(){const{q:P,chunk:ne}=this;let{i:ie}=this;for(;;)switch(this.getCode()){case P:this.pushAttrib(this.name,this.text+ne.slice(ie,this.prevI)),this.name=this.text="",this.q=null,this.state=ze;return;case Ee:this.text+=ne.slice(ie,this.prevI),this.state=Z,this.entityReturnState=Re;return;case p:case S:case f:this.text+=`${ne.slice(ie,this.prevI)} `,ie=this.i;break;case yt:this.text+=ne.slice(ie,this.prevI),this.fail("disallowed character.");return;case x:this.text+=ne.slice(ie);return}}sAttribValueClosed(){const P=this.getCodeNorm();n(P)?this.state=J:P===qe?this.openTag():P===Oe?this.state=me:s(P)?(this.fail("no whitespace between attributes."),this.unget(),this.state=ce):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const P=this.captureTo(Qe);switch(P){case Ee:this.state=Z,this.entityReturnState=Ie;break;case yt:this.fail("disallowed character.");break;case x:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",P===qe?this.openTag():this.state=J}}sCloseTag(){const P=this.captureNameChars();P===qe?this.closeTag():n(P)?this.state=I:P!==x&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case qe:this.closeTag();break;case x:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:P,forbiddenState:ne}=this;const{chunk:ie,textHandler:we}=this;e:for(;;)switch(this.getCode()){case yt:{if(this.state=k,we!==void 0){const{text:Ae}=this,Ce=ie.slice(P,this.prevI);Ae.length!==0?(we(Ae+Ce),this.text=""):Ce.length!==0&&we(Ce)}ne=Rt;break e}case Ee:this.state=Z,this.entityReturnState=T,we!==void 0&&(this.text+=ie.slice(P,this.prevI)),ne=Rt;break e;case Mt:switch(ne){case Rt:ne=Mr;break;case Mr:ne=mr;break;case mr:break;default:throw new Error("impossible state")}break;case qe:ne===mr&&this.fail('the string "]]>" is disallowed in char data.'),ne=Rt;break;case S:we!==void 0&&(this.text+=`${ie.slice(P,this.prevI)}
327
- `),P=this.i,ne=Rt;break;case x:we!==void 0&&(this.text+=ie.slice(P));break e;default:ne=Rt}this.forbiddenState=ne}handleTextOutsideRoot(){let{i:P}=this;const{chunk:ne,textHandler:ie}=this;let we=!1;e:for(;;){const Ae=this.getCode();switch(Ae){case yt:{if(this.state=k,ie!==void 0){const{text:Ce}=this,Ze=ne.slice(P,this.prevI);Ce.length!==0?(ie(Ce+Ze),this.text=""):Ze.length!==0&&ie(Ze)}break e}case Ee:this.state=Z,this.entityReturnState=T,ie!==void 0&&(this.text+=ne.slice(P,this.prevI)),we=!0;break e;case S:ie!==void 0&&(this.text+=`${ne.slice(P,this.prevI)}
328
- `),P=this.i;break;case x:ie!==void 0&&(this.text+=ne.slice(P));break e;default:n(Ae)||(we=!0)}}we&&(!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(P,ne){var ie;const{prefix:we,local:Ae}=this.qname(P),Ce={name:P,prefix:we,local:Ae,value:ne};if(this.attribList.push(Ce),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,Ce),we==="xmlns"){const Ze=ne.trim();this.currentXMLVersion==="1.0"&&Ze===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Ae]=Ze,Ye(this,Ae,Ze)}else if(P==="xmlns"){const Ze=ne.trim();this.topNS[""]=Ze,Ye(this,"",Ze)}}pushAttribPlain(P,ne){var ie;const we={name:P,value:ne};this.attribList.push(we),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,we)}end(){var P,ne;this.sawRoot||this.fail("document must contain a root element.");const{tags:ie}=this;for(;ie.length>0;){const Ae=ie.pop();this.fail(`unclosed tag: ${Ae.name}`)}this.state!==m&&this.state!==T&&this.fail("unexpected end.");const{text:we}=this;return we.length!==0&&((P=this.textHandler)===null||P===void 0||P.call(this,we),this.text=""),this._closed=!0,(ne=this.endHandler)===null||ne===void 0||ne.call(this),this._init(),this}resolve(P){var ne,ie;let we=this.topNS[P];if(we!==void 0)return we;const{tags:Ae}=this;for(let Ce=Ae.length-1;Ce>=0;Ce--)if(we=Ae[Ce].ns[P],we!==void 0)return we;return we=this.ns[P],we!==void 0?we:(ie=(ne=this.opt).resolvePrefix)===null||ie===void 0?void 0:ie.call(ne,P)}qname(P){const ne=P.indexOf(":");if(ne===-1)return{prefix:"",local:P};const ie=P.slice(ne+1),we=P.slice(0,ne);return(we===""||ie===""||ie.includes(":"))&&this.fail(`malformed name: ${P}.`),{prefix:we,local:ie}}processAttribsNS(){var P;const{attribList:ne}=this,ie=this.tag;{const{prefix:Ce,local:Ze}=this.qname(ie.name);ie.prefix=Ce,ie.local=Ze;const br=ie.uri=(P=this.resolve(Ce))!==null&&P!==void 0?P:"";Ce!==""&&(Ce==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),br===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(Ce)}.`),ie.uri=Ce))}if(ne.length===0)return;const{attributes:we}=ie,Ae=new Set;for(const Ce of ne){const{name:Ze,prefix:br,local:ed}=Ce;let _r,qr;br===""?(_r=Ze==="xmlns"?_:"",qr=Ze):(_r=this.resolve(br),_r===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(br)}.`),_r=br),qr=`{${_r}}${ed}`),Ae.has(qr)&&this.fail(`duplicate attribute: ${qr}.`),Ae.add(qr),Ce.uri=_r,we[Ze]=Ce}this.attribList=[]}processAttribsPlain(){const{attribList:P}=this,ne=this.tag.attributes;for(const{name:ie,value:we}of P)ne[ie]!==void 0&&this.fail(`duplicate attribute: ${ie}.`),ne[ie]=we;this.attribList=[]}openTag(){var P;this.processAttribs();const{tags:ne}=this,ie=this.tag;ie.isSelfClosing=!1,(P=this.openTagHandler)===null||P===void 0||P.call(this,ie),ne.push(ie),this.state=T,this.name=""}openSelfClosingTag(){var P,ne,ie;this.processAttribs();const{tags:we}=this,Ae=this.tag;Ae.isSelfClosing=!0,(P=this.openTagHandler)===null||P===void 0||P.call(this,Ae),(ne=this.closeTagHandler)===null||ne===void 0||ne.call(this,Ae),(this.tag=(ie=we[we.length-1])!==null&&ie!==void 0?ie:null)===null&&(this.closedRoot=!0),this.state=T,this.name=""}closeTag(){const{tags:P,name:ne}=this;if(this.state=T,this.name="",ne===""){this.fail("weird empty close tag."),this.text+="</>";return}const ie=this.closeTagHandler;let we=P.length;for(;we-- >0;){const Ae=this.tag=P.pop();if(this.topNS=Ae.ns,ie?.(Ae),Ae.name===ne)break;this.fail("unexpected close tag.")}we===0?this.closedRoot=!0:we<0&&(this.fail(`unmatched closing tag: ${ne}.`),this.text+=`</${ne}>`)}parseEntity(P){if(P[0]!=="#"){const ie=this.ENTITIES[P];return ie!==void 0?ie:(this.fail(this.isName(P)?"undefined entity.":"disallowed character in entity name."),`&${P};`)}let ne=NaN;return P[1]==="x"&&/^#x[0-9a-f]+$/i.test(P)?ne=parseInt(P.slice(2),16):/^#[0-9]+$/.test(P)&&(ne=parseInt(P.slice(1),10)),this.isChar(ne)?String.fromCodePoint(ne):(this.fail("malformed character entity."),`&${P};`)}}return tr.SaxesParser=Br,tr}var Jr={},ul;function gf(){if(ul)return Jr;ul=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.ParseError=void 0;let r=class extends Error{constructor(t,n){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${n}`:n)}};return Jr.ParseError=r,Jr}var rr={},Kr={},cl;function Lc(){if(cl)return Kr;cl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.BlankNode=void 0;class r{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}}return Kr.BlankNode=r,Kr}var Yr={},Zr={},dl;function Oc(){if(dl)return Zr;dl=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return Zr.DefaultGraph=r,r.INSTANCE=new r,Zr}var en={},tn={},hl;function $a(){if(hl)return tn;hl=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.NamedNode=void 0;class r{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&t.termType==="NamedNode"&&t.value===this.value}}return tn.NamedNode=r,tn}var fl;function Cc(){if(fl)return en;fl=1,Object.defineProperty(en,"__esModule",{value:!0}),en.Literal=void 0;const r=$a();class e{constructor(n,i){this.termType="Literal",this.value=n,typeof i=="string"?(this.language=i,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=""):i?"termType"in i?(this.language="",this.datatype=i,this.direction=""):(this.language=i.language,this.datatype=i.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=i.direction||""):(this.language="",this.datatype=e.XSD_STRING,this.direction="")}equals(n){return!!n&&n.termType==="Literal"&&n.value===this.value&&n.language===this.language&&(n.direction===this.direction||!n.direction&&this.direction==="")&&this.datatype.equals(n.datatype)}}return en.Literal=e,e.RDF_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.RDF_DIRECTIONAL_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),e.XSD_STRING=new r.NamedNode("http://www.w3.org/2001/XMLSchema#string"),en}var rn={},pl;function jc(){if(pl)return rn;pl=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.Quad=void 0;class r{constructor(t,n,i,s){this.termType="Quad",this.value="",this.subject=t,this.predicate=n,this.object=i,this.graph=s}equals(t){return!!t&&(t.termType==="Quad"||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}}return rn.Quad=r,rn}var nn={},gl;function $c(){if(gl)return nn;gl=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.Variable=void 0;class r{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&t.termType==="Variable"&&t.value===this.value}}return nn.Variable=r,nn}var ml;function mf(){if(ml)return Yr;ml=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.DataFactory=void 0;const r=Lc(),e=Oc(),t=Cc(),n=$a(),i=jc(),s=$c();let a=0;class o{constructor(l){this.blankNodeCounter=0,l=l||{},this.blankNodePrefix=l.blankNodePrefix||`df_${a++}_`}namedNode(l){return new n.NamedNode(l)}blankNode(l){return new r.BlankNode(l||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(l,c){return new t.Literal(l,c)}variable(l){return new s.Variable(l)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(l,c,d,b){return new i.Quad(l,c,d,b||this.defaultGraph())}fromTerm(l){switch(l.termType){case"NamedNode":return this.namedNode(l.value);case"BlankNode":return this.blankNode(l.value);case"Literal":return l.language?this.literal(l.value,l.language):l.datatype.equals(t.Literal.XSD_STRING)?this.literal(l.value):this.literal(l.value,this.fromTerm(l.datatype));case"Variable":return this.variable(l.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(l.subject),this.fromTerm(l.predicate),this.fromTerm(l.object),this.fromTerm(l.graph))}}fromQuad(l){return this.fromTerm(l)}resetBlankNodeCounter(){this.blankNodeCounter=0}}return Yr.DataFactory=o,Yr}var yl;function Fc(){return yl||(yl=1,function(r){var e=rr&&rr.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=rr&&rr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Lc(),r),t(mf(),r),t(Oc(),r),t(Cc(),r),t($a(),r),t(jc(),r),t($c(),r)}(rr)),rr}var nr={},Yi={},bl;function yf(){return bl||(bl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.validateIri=r.IriValidationStrategy=void 0;function e(){const o="[!$&'()*+,;=]",u="%[a-fA-F0-9]{2}",l="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",c=`${l}\\.${l}\\.${l}\\.${l}`,d="[a-fA-F0-9]{1,4}",b=`(${d}:${d}|${c})`,y=`((${d}:){6}${b}|::(${d}:){5}${b}|(${d})?::(${d}:){4}${b}|((${d}:){0,1}${d})?::(${d}:){3}${b}|((${d}:){0,2}${d})?::(${d}:){2}${b}|((${d}:){0,3}${d})?::${d}:${b}|((${d}:){0,4}${d})?::${b}|((${d}:){0,5}${d})?::${d}|((${d}:){0,6}${d})?::)`,_=`v[a-fA-F0-9]+\\.(${o}|${o}|":)+`,E=`\\[(${y}|${_})\\]`,v="[0-9]*",x="[a-zA-Z][a-zA-Z0-9+\\-.]*",m="[-󰀀-󿿽􀀀-􏿽]",N="[a-zA-Z0-9\\-._~ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]",C=`(${N}|${u}|${o}|[:@])*`,A=`(${C}|[\\/?])*`,B=`(${C}|${m}|[\\/?])*`,R=`(${C})+`,F=`(${C})*`,q="",D=`${R}(\\/${F})*`,L=`\\/(${R}(\\/${F})*)?`,te=`(\\/${F})*`,T=`(${N}|${u}|${o})*`,Z=`(${E}|${c}|${T})`,w=`(\\/\\/${`(${`(${N}|${u}|${o}|:)*`}@)?${Z}(:${v})?`}${te}|${L}|${D}|${q})`,H=`^${x}:${w}(\\?${B})?(#${A})?$`;return new RegExp(H,"u")}const t=e(),n=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var i;(function(a){a.Strict="strict",a.Pragmatic="pragmatic",a.None="none"})(i=r.IriValidationStrategy||(r.IriValidationStrategy={}));function s(a,o=i.Strict){switch(o){case i.Strict:return t.test(a)?void 0:new Error(`Invalid IRI according to RFC 3987: '${a}'`);case i.Pragmatic:return n.test(a)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${a}'`);case i.None:return;default:return new Error(`Not supported validation strategy "${o}"`)}}r.validateIri=s}(Yi)),Yi}var _l;function bf(){return _l||(_l=1,function(r){var e=nr&&nr.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=nr&&nr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(yf(),r)}(nr)),nr}var wl;function _f(){if(wl)return Zt;wl=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.ParseType=Zt.RdfXmlParser=void 0;const r=cf(),e=pf(),t=ac(),n=gf(),i=Fc(),s=bf();let a=class $e extends t.Transform{constructor(l){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},l&&(Object.assign(this,l),this.options=l),this.dataFactory||(this.dataFactory=new i.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?s.IriValidationStrategy.Pragmatic:s.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(l){const c=new t.PassThrough({readableObjectMode:!0});l.on("error",b=>d.emit("error",b)),l.on("data",b=>c.push(b)),l.on("end",()=>c.push(null));const d=c.pipe(new $e(this.options));return d}_transform(l,c,d){try{this.saxParser.write(l)}catch(b){return d(b)}d()}newParseError(l){return new n.ParseError(this,l)}valueToUri(l,c){return this.uriToNamedNode((0,r.resolve)(l,c.baseIRI))}uriToNamedNode(l){const c=(0,s.validateIri)(l,this.iriValidationStrategy);if(c instanceof Error)throw this.newParseError(c.message);return this.dataFactory.namedNode(l)}validateNcname(l){if(!$e.NCNAME_MATCHER.test(l))throw this.newParseError(`Not a valid NCName: ${l}`)}createLiteral(l,c){return this.dataFactory.literal(l,c.datatype?c.datatype:c.language?{language:c.language,direction:c.rdfVersion?c.direction:void 0}:void 0)}attachSaxListeners(){this.saxParser.on("error",l=>this.emit("error",l)),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(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let d=o.RESOURCE;if(c&&(c.hadChildren=!0,d=c.childrenParseType),c&&c.childrenStringTags){const y=l.name;let _="";for(const{key:S,value:m}of c.namespaces||[])_+=` ${S}="${m}"`;for(const S in l.attributes)_+=` ${S}="${l.attributes[S].value}"`;const v=`<${`${y}${_}`}>`;c.childrenStringTags.push(v);const x={childrenStringTags:c.childrenStringTags};x.childrenStringEmitClosingTag=`</${y}>`,this.activeTagStack.push(x);return}const b={};c?(b.language=c.language,b.direction=c.direction,b.baseIRI=c.baseIRI,b.childrenTripleTerms=c.childrenTripleTerms,b.rdfVersion=c.rdfVersion):b.baseIRI=this.baseIRI,this.activeTagStack.push(b),d===o.RESOURCE?this.onTagResource(l,b,c,!c):this.onTagProperty(l,b,c);for(const y in l.attributes){const _=l.attributes[y];_.prefix==="xmlns"&&(b.namespaces||(b.namespaces=[]),b.namespaces.push({key:`${_.prefix}:${_.local}`,value:_.value}))}c&&c.namespaces&&(b.namespaces=[...b.namespaces||[],...c.namespaces])}onTagResource(l,c,d,b){c.childrenParseType=o.PROPERTY;let y=!0;if(l.uri===$e.RDF){if(!b&&$e.FORBIDDEN_NODE_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal node element name: ${l.local}`);switch(l.local){case"RDF":c.childrenParseType=o.RESOURCE;case"Description":y=!1}}const _=[],E=[];let v=null,x=!1,S=!1,m=null;for(const h in l.attributes){const g=l.attributes[h];if(g.uri===$e.RDF&&g.local==="version"){this.setVersion(c,g.value);continue}else if(d&&g.uri===$e.RDF)switch(g.local){case"about":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);v=g.value;continue;case"ID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v="#"+g.value,x=!0;continue;case"nodeID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v=g.value,S=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":m=g.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(g.uri===$e.XML){if(g.local==="lang"){c.language=g.value===""?null:g.value.toLowerCase();continue}else if(g.local==="base"){c.baseIRI=(0,r.resolve)(g.value,c.baseIRI);continue}}else if(g.uri===$e.ITS&&g.local==="dir"){this.setDirection(c,g.value);continue}g.prefix!=="xml"&&g.prefix!=="xmlns"&&(g.prefix!==""||g.local!=="xmlns")&&g.uri&&(_.push(this.uriToNamedNode(g.uri+g.local)),E.push(g.value))}if(v!==null&&(c.subject=S?this.dataFactory.blankNode(v):this.valueToUri(v,c),x&&this.claimNodeId(c.subject)),c.subject||(c.subject=this.dataFactory.blankNode()),y){const h=this.uriToNamedNode(l.uri+l.local);this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),h,d?d.reifiedStatementId:null,c.childrenTripleTerms,c.reifier)}if(d){if(d.predicate)if(d.childrenCollectionSubject){const h=this.dataFactory.blankNode(),g=this.dataFactory.namedNode($e.RDF+"rest"),N=d.childrenCollectionPredicate.equals(g);this.emitTriple(d.childrenCollectionSubject,d.childrenCollectionPredicate,h,N?null:d.reifiedStatementId,d.childrenTripleTerms,N?null:d.reifier),this.emitTriple(h,this.dataFactory.namedNode($e.RDF+"first"),c.subject,null,c.childrenTripleTerms),d.childrenCollectionSubject=h,d.childrenCollectionPredicate=g}else{d.childrenTagsToTripleTerms||(this.emitTriple(d.subject,d.predicate,c.subject,d.reifiedStatementId,d.childrenTripleTerms,d.reifier),d.predicateEmitted=!0);for(let h=0;h<d.predicateSubPredicates.length;h++)this.emitTriple(c.subject,d.predicateSubPredicates[h],d.predicateSubObjects[h],null,d.childrenTripleTerms,d.reifier);d.predicateSubPredicates=[],d.predicateSubObjects=[]}for(let h=0;h<_.length;h++){const g=this.createLiteral(E[h],c);this.emitTriple(c.subject,_[h],g,d.reifiedStatementId,d.childrenTripleTerms,d.reifier)}m&&this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),this.uriToNamedNode(m),null,c.childrenTripleTerms,c.reifier)}}onTagProperty(l,c,d){if(c.childrenParseType=o.RESOURCE,c.subject=d.subject,l.uri===$e.RDF&&l.local==="li"?(d.listItemCounter||(d.listItemCounter=1),c.predicate=this.uriToNamedNode(l.uri+"_"+d.listItemCounter++)):c.predicate=this.uriToNamedNode(l.uri+l.local),l.uri===$e.RDF&&$e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal property element name: ${l.local}`);c.predicateSubPredicates=[],c.predicateSubObjects=[];let b=!1,y=!1,_=null,E=!0;const v=[],x=[];for(const S in l.attributes){const m=l.attributes[S];if(m.uri===$e.RDF&&m.local==="version"){this.setVersion(c,m.value);continue}else if(m.uri===$e.RDF)switch(m.local){case"resource":if(_)throw this.newParseError(`Found both rdf:resource (${m.value}) and rdf:nodeID (${_}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${m.value})`);c.hadChildren=!0,_=m.value,E=!1;continue;case"datatype":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${m.value})`);c.datatype=this.valueToUri(m.value,c);continue;case"nodeID":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${m.value}).`);if(c.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${m.value})`);this.validateNcname(m.value),c.hadChildren=!0,_=m.value,E=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(y)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(c.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.datatype.value})`);if(_)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${_})`);if(m.value==="Resource"){b=!0,c.childrenParseType=o.PROPERTY;const h=this.dataFactory.blankNode();this.emitTriple(c.subject,c.predicate,h,c.reifiedStatementId,c.childrenTripleTerms,c.reifier),c.subject=h,c.predicate=null}else m.value==="Collection"?(b=!0,c.hadChildren=!0,c.childrenCollectionSubject=c.subject,c.childrenCollectionPredicate=c.predicate,E=!1):m.value==="Literal"?(b=!0,c.childrenTagsToString=!0,c.childrenStringTags=[]):m.value==="Triple"&&(b=!0,c.childrenTagsToTripleTerms=!0,c.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(m.value),c.reifiedStatementId=this.valueToUri("#"+m.value,c),this.claimNodeId(c.reifiedStatementId);continue;case"annotation":c.reifier=this.dataFactory.namedNode(m.value);continue;case"annotationNodeID":c.reifier=this.dataFactory.blankNode(m.value);continue}else if(m.uri===$e.XML&&m.local==="lang"){c.language=m.value===""?null:m.value.toLowerCase();continue}else if(m.uri===$e.ITS&&m.local==="dir"){this.setDirection(c,m.value);continue}else if(m.uri===$e.ITS&&m.local==="version")continue;if(m.prefix!=="xml"&&m.prefix!=="xmlns"&&(m.prefix!==""||m.local!=="xmlns")&&m.uri){if(b||c.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${m.value}`);c.hadChildren=!0,y=!0,v.push(this.uriToNamedNode(m.uri+m.local)),x.push(this.createLiteral(m.value,c))}}if(_!==null){const S=c.subject;c.subject=E?this.dataFactory.blankNode(_):this.valueToUri(_,c),this.emitTriple(S,c.predicate,c.subject,c.reifiedStatementId,c.childrenTripleTerms,c.reifier);for(let m=0;m<v.length;m++)this.emitTriple(c.subject,v[m],x[m],null,c.childrenTripleTerms,c.reifier);c.predicateEmitted=!0}else E&&(c.predicateSubPredicates=v,c.predicateSubObjects=x,c.predicateEmitted=!1)}emitTriple(l,c,d,b,y,_){const E=this.dataFactory.quad(l,c,d,this.defaultGraph);y?y.push(E):this.push(E),_&&this.push(this.dataFactory.quad(_,this.dataFactory.namedNode($e.RDF+"reifies"),E)),b&&(this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"type"),this.dataFactory.namedNode($e.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"subject"),l,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"predicate"),c,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"object"),d,this.defaultGraph)))}claimNodeId(l){if(!this.allowDuplicateRdfIds){if(this.nodeIds[l.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${l.value}'.`);this.nodeIds[l.value]=!0}}onText(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;c&&(c.childrenStringTags?c.childrenStringTags.push(l):c.predicate&&(c.text=l))}onCloseTag(){const l=this.activeTagStack.pop(),c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(l.childrenStringEmitClosingTag&&l.childrenStringTags.push(l.childrenStringEmitClosingTag),l.childrenTagsToString&&(l.datatype=this.dataFactory.namedNode($e.RDF+"XMLLiteral"),l.text=l.childrenStringTags.join(""),l.hadChildren=!1),l.childrenTagsToTripleTerms&&l.predicate&&l.rdfVersion){if(l.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${l.childrenTripleTerms.length}`);for(const d of l.childrenTripleTerms)this.emitTriple(l.subject,l.predicate,d,null,c.childrenTripleTerms,c.reifier);l.predicateEmitted=!0}if(l.childrenCollectionSubject)this.emitTriple(l.childrenCollectionSubject,l.childrenCollectionPredicate,this.dataFactory.namedNode($e.RDF+"nil"),null,l.childrenTripleTerms);else if(l.predicate){if(!l.hadChildren&&l.childrenParseType!==o.PROPERTY)this.emitTriple(l.subject,l.predicate,this.createLiteral(l.text||"",l),l.reifiedStatementId,l.childrenTripleTerms,l.reifier);else if(!l.predicateEmitted){const d=this.dataFactory.blankNode();this.emitTriple(l.subject,l.predicate,d,l.reifiedStatementId,l.childrenTripleTerms,l.reifier);for(let b=0;b<l.predicateSubPredicates.length;b++)this.emitTriple(d,l.predicateSubPredicates[b],l.predicateSubObjects[b],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,d,b)=>(this.saxParser.ENTITIES[d]=b,""))}setDirection(l,c){if(c){if(c!=="ltr"&&c!=="rtl")throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${c}' was found.`);l.direction=c}else delete l.direction}setVersion(l,c){l.rdfVersion=c,this.emit("version",c)}};Zt.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.ITS="http://www.w3.org/2005/11/its",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u;var o;return function(u){u[u.RESOURCE=0]="RESOURCE",u[u.PROPERTY=1]="PROPERTY"}(o||(Zt.ParseType=o={})),Zt}var vl;function wf(){return vl||(vl=1,function(r){var e=Yt&&Yt.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=Yt&&Yt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(_f(),r)}(Yt)),Yt}var vf=wf(),Zi={},es,xl;function Fa(){return xl||(xl=1,es=class kc{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){const{prefix:e,_existing:t,counter:n}=this;return new kc(e,new Map(t),n)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}),es}var ts={},El;function xf(){return El||(El=1,function(r,e){if(r.setImmediate)return;var t=1,n={},i=!1,s=r.document,a;function o(S){typeof S!="function"&&(S=new Function(""+S));for(var m=new Array(arguments.length-1),h=0;h<m.length;h++)m[h]=arguments[h+1];var g={callback:S,args:m};return n[t]=g,a(t),t++}function u(S){delete n[S]}function l(S){var m=S.callback,h=S.args;switch(h.length){case 0:m();break;case 1:m(h[0]);break;case 2:m(h[0],h[1]);break;case 3:m(h[0],h[1],h[2]);break;default:m.apply(e,h);break}}function c(S){if(i)setTimeout(c,0,S);else{var m=n[S];if(m){i=!0;try{l(m)}finally{u(S),i=!1}}}}function d(){a=function(S){process.nextTick(function(){c(S)})}}function b(){if(r.postMessage&&!r.importScripts){var S=!0,m=r.onmessage;return r.onmessage=function(){S=!1},r.postMessage("","*"),r.onmessage=m,S}}function y(){var S="setImmediate$"+Math.random()+"$",m=function(h){h.source===r&&typeof h.data=="string"&&h.data.indexOf(S)===0&&c(+h.data.slice(S.length))};r.addEventListener?r.addEventListener("message",m,!1):r.attachEvent("onmessage",m),a=function(h){r.postMessage(S+h,"*")}}function _(){var S=new MessageChannel;S.port1.onmessage=function(m){var h=m.data;c(h)},a=function(m){S.port2.postMessage(m)}}function E(){var S=s.documentElement;a=function(m){var h=s.createElement("script");h.onreadystatechange=function(){c(m),h.onreadystatechange=null,S.removeChild(h),h=null},S.appendChild(h)}}function v(){a=function(S){setTimeout(c,0,S)}}var x=Object.getPrototypeOf&&Object.getPrototypeOf(r);x=x&&x.setTimeout?x:r,{}.toString.call(r.process)==="[object process]"?d():b()?y():r.MessageChannel?_():s&&"onreadystatechange"in s.createElement("script")?E():v(),x.setImmediate=o,x.clearImmediate=u}(typeof self>"u"?typeof Sr>"u"?ts:Sr:self)),ts}/*!
325
+ `,ne=this.i,we=p;break;case x:return this.text+=ie.slice(ne),!1}if(we===P)return this.text+=ie.slice(ne,this.prevI),!0}}captureNameChars(){const{chunk:P,i:ne}=this;for(;;){const ie=this.getCode();if(ie===x)return this.name+=P.slice(ne),x;if(!a(ie))return this.name+=P.slice(ne,this.prevI),ie===S?p:ie}}skipSpaces(){for(;;){const P=this.getCodeNorm();if(P===x||!n(P))return P}}setXMLVersion(P){this.currentXMLVersion=P,P==="1.0"?(this.isChar=i,this.getCode=this.getCode10):(this.isChar=l,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=d}sBeginWhitespace(){const P=this.i,ne=this.skipSpaces();switch(this.prevI!==P&&(this.xmlDeclPossible=!1),ne){case mt:if(this.state=k,this.text.length!==0)throw new Error("no-empty text at start");break;case x:break;default:this.unget(),this.state=T,this.xmlDeclPossible=!1}}sDoctype(){var P;const ne=this.captureTo(be);switch(ne){case qe:{(P=this.doctypeHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=T,this.doctype=!0;break}case x:break;default:this.text+=String.fromCodePoint(ne),ne===Dn?this.state=C:O(ne)&&(this.state=N,this.q=ne)}}sDoctypeQuote(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.q=null,this.state=g)}sDTD(){const P=this.captureTo(_e);P!==x&&(this.text+=String.fromCodePoint(P),P===Mt?this.state=g:P===mt?this.state=B:O(P)&&(this.state=A,this.q=P))}sDTDQuoted(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.state=C,this.q=null)}sDTDOpenWaka(){const P=this.getCodeNorm();switch(this.text+=String.fromCodePoint(P),P){case oe:this.state=R,this.openWakaBang="";break;case He:this.state=L;break;default:this.state=C}}sDTDOpenWakaBang(){const P=String.fromCodePoint(this.getCodeNorm()),ne=this.openWakaBang+=P;this.text+=P,ne!=="-"&&(this.state=ne==="--"?F:C,this.openWakaBang="")}sDTDComment(){this.captureToChar(Le)&&(this.text+="-",this.state=q)}sDTDCommentEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),this.state=P===Le?D:F}sDTDCommentEnded(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe?this.state=C:(this.fail("malformed comment."),this.state=F)}sDTDPI(){this.captureToChar(He)&&(this.text+="?",this.state=te)}sDTDPIEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe&&(this.state=C)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:P}=this;const{chunk:ne}=this;e:for(;;)switch(this.getCode()){case S:this.entity+=`${ne.slice(P,this.prevI)}
326
+ `,P=this.i;break;case De:{const{entityReturnState:ie}=this,we=this.entity+ne.slice(P,this.prevI);this.state=ie;let Ae;we===""?(this.fail("empty entity name."),Ae="&;"):(Ae=this.parseEntity(we),this.entity=""),(ie!==T||this.textHandler!==void 0)&&(this.text+=Ae);break e}case x:this.entity+=ne.slice(P);break e}}sOpenWaka(){const P=this.getCode();if(s(P))this.state=pe,this.unget(),this.xmlDeclPossible=!1;else switch(P){case Oe:this.state=Xe,this.xmlDeclPossible=!1;break;case oe:this.state=Y,this.openWakaBang="",this.xmlDeclPossible=!1;break;case He:this.state=G;break;default:this.fail("disallowed character in tag name"),this.state=T,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=Q,this.openWakaBang="";break;case"--":this.state=w,this.openWakaBang="";break;case"DOCTYPE":this.state=g,(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(Le)&&(this.state=H)}sCommentEnding(){var P;const ne=this.getCodeNorm();ne===Le?(this.state=K,(P=this.commentHandler)===null||P===void 0||P.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(ne)}`,this.state=w)}sCommentEnded(){const P=this.getCodeNorm();P!==qe?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(P)}`,this.state=w):this.state=T}sCData(){this.captureToChar(Mt)&&(this.state=ue)}sCDataEnding(){const P=this.getCodeNorm();P===Mt?this.state=V:(this.text+=`]${String.fromCodePoint(P)}`,this.state=Q)}sCDataEnding2(){var P;const ne=this.getCodeNorm();switch(ne){case qe:{(P=this.cdataHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=T;break}case Mt:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(ne)}`,this.state=Q}}sPIFirstChar(){const P=this.getCodeNorm();this.nameStartCheck(P)?(this.piTarget+=String.fromCodePoint(P),this.state=z):P===He||n(P)?(this.fail("processing instruction without a target."),this.state=P===He?ee:U):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(P),this.state=z)}sPIRest(){const{chunk:P,i:ne}=this;for(;;){const ie=this.getCodeNorm();if(ie===x){this.piTarget+=P.slice(ne);return}if(!this.nameCheck(ie)){this.piTarget+=P.slice(ne,this.prevI);const we=ie===He;we||n(ie)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=we?he:re):this.state=we?ee:U:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(ie));break}}}sPIBody(){if(this.text.length===0){const P=this.getCodeNorm();P===He?this.state=ee:n(P)||(this.text=String.fromCodePoint(P))}else this.captureToChar(He)&&(this.state=ee)}sPIEnding(){var P;const ne=this.getCodeNorm();if(ne===qe){const{piTarget:ie}=this;ie.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(P=this.piHandler)===null||P===void 0||P.call(this,{target:ie,body:this.text}),this.piTarget=this.text="",this.state=T}else ne===He?this.text+="?":(this.text+=`?${String.fromCodePoint(ne)}`,this.state=U);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const P=this.skipSpaces();if(P===He){this.state=he;return}P!==x&&(this.state=fe,this.name=String.fromCodePoint(P))}sXMLDeclName(){const P=this.captureTo(ve);if(P===He){this.state=he,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(n(P)||P===Pt){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=P===Pt?j:ge}}sXMLDeclEq(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(P!==Pt&&this.fail("value required."),this.state=j)}sXMLDeclValueStart(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(O(P)?this.q=P:(this.fail("value must be quoted."),this.q=X),this.state=W)}sXMLDeclValue(){const P=this.captureTo([this.q,He]);if(P===He){this.state=he,this.text="",this.fail("XML declaration is incomplete.");return}if(P===x)return;const ne=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const ie=ne;this.xmlDecl.version=ie,/^1\.[0-9]+$/.test(ie)?this.opt.forceXMLVersion||this.setXMLVersion(ie):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(ne)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=ne;break;case"standalone":ne!=="yes"&&ne!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=ne;break}this.name="",this.state=se}sXMLDeclSeparator(){const P=this.getCodeNorm();if(P===He){this.state=he;return}n(P)||(this.fail("whitespace required."),this.unget()),this.state=re}sXMLDeclEnding(){var P;this.getCodeNorm()===qe?(this.piTarget!=="xml"?this.fail("processing instructions are not allowed before root."):this.name!=="version"&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),(P=this.xmldeclHandler)===null||P===void 0||P.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=T):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var P;const ne=this.captureNameChars();if(ne===x)return;const ie=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=ie.ns=Object.create(null)),(P=this.openTagStartHandler)===null||P===void 0||P.call(this,ie),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),ne){case qe:this.openTag();break;case Oe:this.state=me;break;default:n(ne)||this.fail("disallowed character in tag name."),this.state=J}}sOpenTagSlash(){this.getCode()===qe?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=J)}sAttrib(){const P=this.skipSpaces();P!==x&&(s(P)?(this.unget(),this.state=ce):P===qe?this.openTag():P===Oe?this.state=me:this.fail("disallowed character in attribute name."))}sAttribName(){const P=this.captureNameChars();P===Pt?this.state=le:n(P)?this.state=ye:P===qe?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):P!==x&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const P=this.skipSpaces();switch(P){case x:return;case Pt:this.state=le;break;default:this.fail("attribute without value."),this.text="",this.name="",P===qe?this.openTag():s(P)?(this.unget(),this.state=ce):(this.fail("disallowed character in attribute name."),this.state=J)}}sAttribValue(){const P=this.getCodeNorm();O(P)?(this.q=P,this.state=Re):n(P)||(this.fail("unquoted attribute value."),this.state=Ie,this.unget())}sAttribValueQuoted(){const{q:P,chunk:ne}=this;let{i:ie}=this;for(;;)switch(this.getCode()){case P:this.pushAttrib(this.name,this.text+ne.slice(ie,this.prevI)),this.name=this.text="",this.q=null,this.state=ze;return;case Ee:this.text+=ne.slice(ie,this.prevI),this.state=Z,this.entityReturnState=Re;return;case p:case S:case f:this.text+=`${ne.slice(ie,this.prevI)} `,ie=this.i;break;case mt:this.text+=ne.slice(ie,this.prevI),this.fail("disallowed character.");return;case x:this.text+=ne.slice(ie);return}}sAttribValueClosed(){const P=this.getCodeNorm();n(P)?this.state=J:P===qe?this.openTag():P===Oe?this.state=me:s(P)?(this.fail("no whitespace between attributes."),this.unget(),this.state=ce):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const P=this.captureTo(Qe);switch(P){case Ee:this.state=Z,this.entityReturnState=Ie;break;case mt:this.fail("disallowed character.");break;case x:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",P===qe?this.openTag():this.state=J}}sCloseTag(){const P=this.captureNameChars();P===qe?this.closeTag():n(P)?this.state=I:P!==x&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case qe:this.closeTag();break;case x:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:P,forbiddenState:ne}=this;const{chunk:ie,textHandler:we}=this;e:for(;;)switch(this.getCode()){case mt:{if(this.state=k,we!==void 0){const{text:Ae}=this,Ce=ie.slice(P,this.prevI);Ae.length!==0?(we(Ae+Ce),this.text=""):Ce.length!==0&&we(Ce)}ne=Rt;break e}case Ee:this.state=Z,this.entityReturnState=T,we!==void 0&&(this.text+=ie.slice(P,this.prevI)),ne=Rt;break e;case Mt:switch(ne){case Rt:ne=Mr;break;case Mr:ne=mr;break;case mr:break;default:throw new Error("impossible state")}break;case qe:ne===mr&&this.fail('the string "]]>" is disallowed in char data.'),ne=Rt;break;case S:we!==void 0&&(this.text+=`${ie.slice(P,this.prevI)}
327
+ `),P=this.i,ne=Rt;break;case x:we!==void 0&&(this.text+=ie.slice(P));break e;default:ne=Rt}this.forbiddenState=ne}handleTextOutsideRoot(){let{i:P}=this;const{chunk:ne,textHandler:ie}=this;let we=!1;e:for(;;){const Ae=this.getCode();switch(Ae){case mt:{if(this.state=k,ie!==void 0){const{text:Ce}=this,Ze=ne.slice(P,this.prevI);Ce.length!==0?(ie(Ce+Ze),this.text=""):Ze.length!==0&&ie(Ze)}break e}case Ee:this.state=Z,this.entityReturnState=T,ie!==void 0&&(this.text+=ne.slice(P,this.prevI)),we=!0;break e;case S:ie!==void 0&&(this.text+=`${ne.slice(P,this.prevI)}
328
+ `),P=this.i;break;case x:ie!==void 0&&(this.text+=ne.slice(P));break e;default:n(Ae)||(we=!0)}}we&&(!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(P,ne){var ie;const{prefix:we,local:Ae}=this.qname(P),Ce={name:P,prefix:we,local:Ae,value:ne};if(this.attribList.push(Ce),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,Ce),we==="xmlns"){const Ze=ne.trim();this.currentXMLVersion==="1.0"&&Ze===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Ae]=Ze,Ye(this,Ae,Ze)}else if(P==="xmlns"){const Ze=ne.trim();this.topNS[""]=Ze,Ye(this,"",Ze)}}pushAttribPlain(P,ne){var ie;const we={name:P,value:ne};this.attribList.push(we),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,we)}end(){var P,ne;this.sawRoot||this.fail("document must contain a root element.");const{tags:ie}=this;for(;ie.length>0;){const Ae=ie.pop();this.fail(`unclosed tag: ${Ae.name}`)}this.state!==m&&this.state!==T&&this.fail("unexpected end.");const{text:we}=this;return we.length!==0&&((P=this.textHandler)===null||P===void 0||P.call(this,we),this.text=""),this._closed=!0,(ne=this.endHandler)===null||ne===void 0||ne.call(this),this._init(),this}resolve(P){var ne,ie;let we=this.topNS[P];if(we!==void 0)return we;const{tags:Ae}=this;for(let Ce=Ae.length-1;Ce>=0;Ce--)if(we=Ae[Ce].ns[P],we!==void 0)return we;return we=this.ns[P],we!==void 0?we:(ie=(ne=this.opt).resolvePrefix)===null||ie===void 0?void 0:ie.call(ne,P)}qname(P){const ne=P.indexOf(":");if(ne===-1)return{prefix:"",local:P};const ie=P.slice(ne+1),we=P.slice(0,ne);return(we===""||ie===""||ie.includes(":"))&&this.fail(`malformed name: ${P}.`),{prefix:we,local:ie}}processAttribsNS(){var P;const{attribList:ne}=this,ie=this.tag;{const{prefix:Ce,local:Ze}=this.qname(ie.name);ie.prefix=Ce,ie.local=Ze;const br=ie.uri=(P=this.resolve(Ce))!==null&&P!==void 0?P:"";Ce!==""&&(Ce==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),br===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(Ce)}.`),ie.uri=Ce))}if(ne.length===0)return;const{attributes:we}=ie,Ae=new Set;for(const Ce of ne){const{name:Ze,prefix:br,local:id}=Ce;let _r,qr;br===""?(_r=Ze==="xmlns"?_:"",qr=Ze):(_r=this.resolve(br),_r===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(br)}.`),_r=br),qr=`{${_r}}${id}`),Ae.has(qr)&&this.fail(`duplicate attribute: ${qr}.`),Ae.add(qr),Ce.uri=_r,we[Ze]=Ce}this.attribList=[]}processAttribsPlain(){const{attribList:P}=this,ne=this.tag.attributes;for(const{name:ie,value:we}of P)ne[ie]!==void 0&&this.fail(`duplicate attribute: ${ie}.`),ne[ie]=we;this.attribList=[]}openTag(){var P;this.processAttribs();const{tags:ne}=this,ie=this.tag;ie.isSelfClosing=!1,(P=this.openTagHandler)===null||P===void 0||P.call(this,ie),ne.push(ie),this.state=T,this.name=""}openSelfClosingTag(){var P,ne,ie;this.processAttribs();const{tags:we}=this,Ae=this.tag;Ae.isSelfClosing=!0,(P=this.openTagHandler)===null||P===void 0||P.call(this,Ae),(ne=this.closeTagHandler)===null||ne===void 0||ne.call(this,Ae),(this.tag=(ie=we[we.length-1])!==null&&ie!==void 0?ie:null)===null&&(this.closedRoot=!0),this.state=T,this.name=""}closeTag(){const{tags:P,name:ne}=this;if(this.state=T,this.name="",ne===""){this.fail("weird empty close tag."),this.text+="</>";return}const ie=this.closeTagHandler;let we=P.length;for(;we-- >0;){const Ae=this.tag=P.pop();if(this.topNS=Ae.ns,ie?.(Ae),Ae.name===ne)break;this.fail("unexpected close tag.")}we===0?this.closedRoot=!0:we<0&&(this.fail(`unmatched closing tag: ${ne}.`),this.text+=`</${ne}>`)}parseEntity(P){if(P[0]!=="#"){const ie=this.ENTITIES[P];return ie!==void 0?ie:(this.fail(this.isName(P)?"undefined entity.":"disallowed character in entity name."),`&${P};`)}let ne=NaN;return P[1]==="x"&&/^#x[0-9a-f]+$/i.test(P)?ne=parseInt(P.slice(2),16):/^#[0-9]+$/.test(P)&&(ne=parseInt(P.slice(1),10)),this.isChar(ne)?String.fromCodePoint(ne):(this.fail("malformed character entity."),`&${P};`)}}return tr.SaxesParser=Br,tr}var Jr={},hl;function wf(){if(hl)return Jr;hl=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.ParseError=void 0;let r=class extends Error{constructor(t,n){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${n}`:n)}};return Jr.ParseError=r,Jr}var rr={},Kr={},fl;function $c(){if(fl)return Kr;fl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.BlankNode=void 0;class r{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}}return Kr.BlankNode=r,Kr}var Yr={},Zr={},pl;function Fc(){if(pl)return Zr;pl=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return Zr.DefaultGraph=r,r.INSTANCE=new r,Zr}var en={},tn={},gl;function Ma(){if(gl)return tn;gl=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.NamedNode=void 0;class r{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&t.termType==="NamedNode"&&t.value===this.value}}return tn.NamedNode=r,tn}var ml;function kc(){if(ml)return en;ml=1,Object.defineProperty(en,"__esModule",{value:!0}),en.Literal=void 0;const r=Ma();class e{constructor(n,i){this.termType="Literal",this.value=n,typeof i=="string"?(this.language=i,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=""):i?"termType"in i?(this.language="",this.datatype=i,this.direction=""):(this.language=i.language,this.datatype=i.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=i.direction||""):(this.language="",this.datatype=e.XSD_STRING,this.direction="")}equals(n){return!!n&&n.termType==="Literal"&&n.value===this.value&&n.language===this.language&&(n.direction===this.direction||!n.direction&&this.direction==="")&&this.datatype.equals(n.datatype)}}return en.Literal=e,e.RDF_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.RDF_DIRECTIONAL_LANGUAGE_STRING=new r.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),e.XSD_STRING=new r.NamedNode("http://www.w3.org/2001/XMLSchema#string"),en}var rn={},yl;function Pc(){if(yl)return rn;yl=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.Quad=void 0;class r{constructor(t,n,i,s){this.termType="Quad",this.value="",this.subject=t,this.predicate=n,this.object=i,this.graph=s}equals(t){return!!t&&(t.termType==="Quad"||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}}return rn.Quad=r,rn}var nn={},bl;function Mc(){if(bl)return nn;bl=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.Variable=void 0;class r{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&t.termType==="Variable"&&t.value===this.value}}return nn.Variable=r,nn}var _l;function vf(){if(_l)return Yr;_l=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.DataFactory=void 0;const r=$c(),e=Fc(),t=kc(),n=Ma(),i=Pc(),s=Mc();let a=0;class o{constructor(l){this.blankNodeCounter=0,l=l||{},this.blankNodePrefix=l.blankNodePrefix||`df_${a++}_`}namedNode(l){return new n.NamedNode(l)}blankNode(l){return new r.BlankNode(l||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(l,c){return new t.Literal(l,c)}variable(l){return new s.Variable(l)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(l,c,h,b){return new i.Quad(l,c,h,b||this.defaultGraph())}fromTerm(l){switch(l.termType){case"NamedNode":return this.namedNode(l.value);case"BlankNode":return this.blankNode(l.value);case"Literal":return l.language?this.literal(l.value,l.language):l.datatype.equals(t.Literal.XSD_STRING)?this.literal(l.value):this.literal(l.value,this.fromTerm(l.datatype));case"Variable":return this.variable(l.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(l.subject),this.fromTerm(l.predicate),this.fromTerm(l.object),this.fromTerm(l.graph))}}fromQuad(l){return this.fromTerm(l)}resetBlankNodeCounter(){this.blankNodeCounter=0}}return Yr.DataFactory=o,Yr}var wl;function Bc(){return wl||(wl=1,function(r){var e=rr&&rr.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=rr&&rr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t($c(),r),t(vf(),r),t(Fc(),r),t(kc(),r),t(Ma(),r),t(Pc(),r),t(Mc(),r)}(rr)),rr}var nr={},rs={},vl;function xf(){return vl||(vl=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.validateIri=r.IriValidationStrategy=void 0;function e(){const o="[!$&'()*+,;=]",u="%[a-fA-F0-9]{2}",l="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",c=`${l}\\.${l}\\.${l}\\.${l}`,h="[a-fA-F0-9]{1,4}",b=`(${h}:${h}|${c})`,y=`((${h}:){6}${b}|::(${h}:){5}${b}|(${h})?::(${h}:){4}${b}|((${h}:){0,1}${h})?::(${h}:){3}${b}|((${h}:){0,2}${h})?::(${h}:){2}${b}|((${h}:){0,3}${h})?::${h}:${b}|((${h}:){0,4}${h})?::${b}|((${h}:){0,5}${h})?::${h}|((${h}:){0,6}${h})?::)`,_=`v[a-fA-F0-9]+\\.(${o}|${o}|":)+`,E=`\\[(${y}|${_})\\]`,v="[0-9]*",x="[a-zA-Z][a-zA-Z0-9+\\-.]*",m="[-󰀀-󿿽􀀀-􏿽]",N="[a-zA-Z0-9\\-._~ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]",C=`(${N}|${u}|${o}|[:@])*`,A=`(${C}|[\\/?])*`,B=`(${C}|${m}|[\\/?])*`,R=`(${C})+`,F=`(${C})*`,q="",D=`${R}(\\/${F})*`,L=`\\/(${R}(\\/${F})*)?`,te=`(\\/${F})*`,T=`(${N}|${u}|${o})*`,Z=`(${E}|${c}|${T})`,w=`(\\/\\/${`(${`(${N}|${u}|${o}|:)*`}@)?${Z}(:${v})?`}${te}|${L}|${D}|${q})`,H=`^${x}:${w}(\\?${B})?(#${A})?$`;return new RegExp(H,"u")}const t=e(),n=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var i;(function(a){a.Strict="strict",a.Pragmatic="pragmatic",a.None="none"})(i=r.IriValidationStrategy||(r.IriValidationStrategy={}));function s(a,o=i.Strict){switch(o){case i.Strict:return t.test(a)?void 0:new Error(`Invalid IRI according to RFC 3987: '${a}'`);case i.Pragmatic:return n.test(a)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${a}'`);case i.None:return;default:return new Error(`Not supported validation strategy "${o}"`)}}r.validateIri=s}(rs)),rs}var xl;function Ef(){return xl||(xl=1,function(r){var e=nr&&nr.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=nr&&nr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(xf(),r)}(nr)),nr}var El;function Sf(){if(El)return Zt;El=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.ParseType=Zt.RdfXmlParser=void 0;const r=gf(),e=_f(),t=uc(),n=wf(),i=Bc(),s=Ef();let a=class $e extends t.Transform{constructor(l){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},l&&(Object.assign(this,l),this.options=l),this.dataFactory||(this.dataFactory=new i.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?s.IriValidationStrategy.Pragmatic:s.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(l){const c=new t.PassThrough({readableObjectMode:!0});l.on("error",b=>h.emit("error",b)),l.on("data",b=>c.push(b)),l.on("end",()=>c.push(null));const h=c.pipe(new $e(this.options));return h}_transform(l,c,h){try{this.saxParser.write(l)}catch(b){return h(b)}h()}newParseError(l){return new n.ParseError(this,l)}valueToUri(l,c){return this.uriToNamedNode((0,r.resolve)(l,c.baseIRI))}uriToNamedNode(l){const c=(0,s.validateIri)(l,this.iriValidationStrategy);if(c instanceof Error)throw this.newParseError(c.message);return this.dataFactory.namedNode(l)}validateNcname(l){if(!$e.NCNAME_MATCHER.test(l))throw this.newParseError(`Not a valid NCName: ${l}`)}createLiteral(l,c){return this.dataFactory.literal(l,c.datatype?c.datatype:c.language?{language:c.language,direction:c.rdfVersion?c.direction:void 0}:void 0)}attachSaxListeners(){this.saxParser.on("error",l=>this.emit("error",l)),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(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let h=o.RESOURCE;if(c&&(c.hadChildren=!0,h=c.childrenParseType),c&&c.childrenStringTags){const y=l.name;let _="";for(const{key:S,value:m}of c.namespaces||[])_+=` ${S}="${m}"`;for(const S in l.attributes)_+=` ${S}="${l.attributes[S].value}"`;const v=`<${`${y}${_}`}>`;c.childrenStringTags.push(v);const x={childrenStringTags:c.childrenStringTags};x.childrenStringEmitClosingTag=`</${y}>`,this.activeTagStack.push(x);return}const b={};c?(b.language=c.language,b.direction=c.direction,b.baseIRI=c.baseIRI,b.childrenTripleTerms=c.childrenTripleTerms,b.rdfVersion=c.rdfVersion):b.baseIRI=this.baseIRI,this.activeTagStack.push(b),h===o.RESOURCE?this.onTagResource(l,b,c,!c):this.onTagProperty(l,b,c);for(const y in l.attributes){const _=l.attributes[y];_.prefix==="xmlns"&&(b.namespaces||(b.namespaces=[]),b.namespaces.push({key:`${_.prefix}:${_.local}`,value:_.value}))}c&&c.namespaces&&(b.namespaces=[...b.namespaces||[],...c.namespaces])}onTagResource(l,c,h,b){c.childrenParseType=o.PROPERTY;let y=!0;if(l.uri===$e.RDF){if(!b&&$e.FORBIDDEN_NODE_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal node element name: ${l.local}`);switch(l.local){case"RDF":c.childrenParseType=o.RESOURCE;case"Description":y=!1}}const _=[],E=[];let v=null,x=!1,S=!1,m=null;for(const d in l.attributes){const g=l.attributes[d];if(g.uri===$e.RDF&&g.local==="version"){this.setVersion(c,g.value);continue}else if(h&&g.uri===$e.RDF)switch(g.local){case"about":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);v=g.value;continue;case"ID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v="#"+g.value,x=!0;continue;case"nodeID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v=g.value,S=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":m=g.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(g.uri===$e.XML){if(g.local==="lang"){c.language=g.value===""?null:g.value.toLowerCase();continue}else if(g.local==="base"){c.baseIRI=(0,r.resolve)(g.value,c.baseIRI);continue}}else if(g.uri===$e.ITS&&g.local==="dir"){this.setDirection(c,g.value);continue}g.prefix!=="xml"&&g.prefix!=="xmlns"&&(g.prefix!==""||g.local!=="xmlns")&&g.uri&&(_.push(this.uriToNamedNode(g.uri+g.local)),E.push(g.value))}if(v!==null&&(c.subject=S?this.dataFactory.blankNode(v):this.valueToUri(v,c),x&&this.claimNodeId(c.subject)),c.subject||(c.subject=this.dataFactory.blankNode()),y){const d=this.uriToNamedNode(l.uri+l.local);this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),d,h?h.reifiedStatementId:null,c.childrenTripleTerms,c.reifier)}if(h){if(h.predicate)if(h.childrenCollectionSubject){const d=this.dataFactory.blankNode(),g=this.dataFactory.namedNode($e.RDF+"rest"),N=h.childrenCollectionPredicate.equals(g);this.emitTriple(h.childrenCollectionSubject,h.childrenCollectionPredicate,d,N?null:h.reifiedStatementId,h.childrenTripleTerms,N?null:h.reifier),this.emitTriple(d,this.dataFactory.namedNode($e.RDF+"first"),c.subject,null,c.childrenTripleTerms),h.childrenCollectionSubject=d,h.childrenCollectionPredicate=g}else{h.childrenTagsToTripleTerms||(this.emitTriple(h.subject,h.predicate,c.subject,h.reifiedStatementId,h.childrenTripleTerms,h.reifier),h.predicateEmitted=!0);for(let d=0;d<h.predicateSubPredicates.length;d++)this.emitTriple(c.subject,h.predicateSubPredicates[d],h.predicateSubObjects[d],null,h.childrenTripleTerms,h.reifier);h.predicateSubPredicates=[],h.predicateSubObjects=[]}for(let d=0;d<_.length;d++){const g=this.createLiteral(E[d],c);this.emitTriple(c.subject,_[d],g,h.reifiedStatementId,h.childrenTripleTerms,h.reifier)}m&&this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),this.uriToNamedNode(m),null,c.childrenTripleTerms,c.reifier)}}onTagProperty(l,c,h){if(c.childrenParseType=o.RESOURCE,c.subject=h.subject,l.uri===$e.RDF&&l.local==="li"?(h.listItemCounter||(h.listItemCounter=1),c.predicate=this.uriToNamedNode(l.uri+"_"+h.listItemCounter++)):c.predicate=this.uriToNamedNode(l.uri+l.local),l.uri===$e.RDF&&$e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal property element name: ${l.local}`);c.predicateSubPredicates=[],c.predicateSubObjects=[];let b=!1,y=!1,_=null,E=!0;const v=[],x=[];for(const S in l.attributes){const m=l.attributes[S];if(m.uri===$e.RDF&&m.local==="version"){this.setVersion(c,m.value);continue}else if(m.uri===$e.RDF)switch(m.local){case"resource":if(_)throw this.newParseError(`Found both rdf:resource (${m.value}) and rdf:nodeID (${_}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${m.value})`);c.hadChildren=!0,_=m.value,E=!1;continue;case"datatype":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${m.value})`);c.datatype=this.valueToUri(m.value,c);continue;case"nodeID":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${m.value}).`);if(c.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${m.value})`);this.validateNcname(m.value),c.hadChildren=!0,_=m.value,E=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(y)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(c.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.datatype.value})`);if(_)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${_})`);if(m.value==="Resource"){b=!0,c.childrenParseType=o.PROPERTY;const d=this.dataFactory.blankNode();this.emitTriple(c.subject,c.predicate,d,c.reifiedStatementId,c.childrenTripleTerms,c.reifier),c.subject=d,c.predicate=null}else m.value==="Collection"?(b=!0,c.hadChildren=!0,c.childrenCollectionSubject=c.subject,c.childrenCollectionPredicate=c.predicate,E=!1):m.value==="Literal"?(b=!0,c.childrenTagsToString=!0,c.childrenStringTags=[]):m.value==="Triple"&&(b=!0,c.childrenTagsToTripleTerms=!0,c.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(m.value),c.reifiedStatementId=this.valueToUri("#"+m.value,c),this.claimNodeId(c.reifiedStatementId);continue;case"annotation":c.reifier=this.dataFactory.namedNode(m.value);continue;case"annotationNodeID":c.reifier=this.dataFactory.blankNode(m.value);continue}else if(m.uri===$e.XML&&m.local==="lang"){c.language=m.value===""?null:m.value.toLowerCase();continue}else if(m.uri===$e.ITS&&m.local==="dir"){this.setDirection(c,m.value);continue}else if(m.uri===$e.ITS&&m.local==="version")continue;if(m.prefix!=="xml"&&m.prefix!=="xmlns"&&(m.prefix!==""||m.local!=="xmlns")&&m.uri){if(b||c.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${m.value}`);c.hadChildren=!0,y=!0,v.push(this.uriToNamedNode(m.uri+m.local)),x.push(this.createLiteral(m.value,c))}}if(_!==null){const S=c.subject;c.subject=E?this.dataFactory.blankNode(_):this.valueToUri(_,c),this.emitTriple(S,c.predicate,c.subject,c.reifiedStatementId,c.childrenTripleTerms,c.reifier);for(let m=0;m<v.length;m++)this.emitTriple(c.subject,v[m],x[m],null,c.childrenTripleTerms,c.reifier);c.predicateEmitted=!0}else E&&(c.predicateSubPredicates=v,c.predicateSubObjects=x,c.predicateEmitted=!1)}emitTriple(l,c,h,b,y,_){const E=this.dataFactory.quad(l,c,h,this.defaultGraph);y?y.push(E):this.push(E),_&&this.push(this.dataFactory.quad(_,this.dataFactory.namedNode($e.RDF+"reifies"),E)),b&&(this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"type"),this.dataFactory.namedNode($e.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"subject"),l,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"predicate"),c,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"object"),h,this.defaultGraph)))}claimNodeId(l){if(!this.allowDuplicateRdfIds){if(this.nodeIds[l.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${l.value}'.`);this.nodeIds[l.value]=!0}}onText(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;c&&(c.childrenStringTags?c.childrenStringTags.push(l):c.predicate&&(c.text=l))}onCloseTag(){const l=this.activeTagStack.pop(),c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(l.childrenStringEmitClosingTag&&l.childrenStringTags.push(l.childrenStringEmitClosingTag),l.childrenTagsToString&&(l.datatype=this.dataFactory.namedNode($e.RDF+"XMLLiteral"),l.text=l.childrenStringTags.join(""),l.hadChildren=!1),l.childrenTagsToTripleTerms&&l.predicate&&l.rdfVersion){if(l.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${l.childrenTripleTerms.length}`);for(const h of l.childrenTripleTerms)this.emitTriple(l.subject,l.predicate,h,null,c.childrenTripleTerms,c.reifier);l.predicateEmitted=!0}if(l.childrenCollectionSubject)this.emitTriple(l.childrenCollectionSubject,l.childrenCollectionPredicate,this.dataFactory.namedNode($e.RDF+"nil"),null,l.childrenTripleTerms);else if(l.predicate){if(!l.hadChildren&&l.childrenParseType!==o.PROPERTY)this.emitTriple(l.subject,l.predicate,this.createLiteral(l.text||"",l),l.reifiedStatementId,l.childrenTripleTerms,l.reifier);else if(!l.predicateEmitted){const h=this.dataFactory.blankNode();this.emitTriple(l.subject,l.predicate,h,l.reifiedStatementId,l.childrenTripleTerms,l.reifier);for(let b=0;b<l.predicateSubPredicates.length;b++)this.emitTriple(h,l.predicateSubPredicates[b],l.predicateSubObjects[b],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,h,b)=>(this.saxParser.ENTITIES[h]=b,""))}setDirection(l,c){if(c){if(c!=="ltr"&&c!=="rtl")throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${c}' was found.`);l.direction=c}else delete l.direction}setVersion(l,c){l.rdfVersion=c,this.emit("version",c)}};Zt.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.ITS="http://www.w3.org/2005/11/its",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u;var o;return function(u){u[u.RESOURCE=0]="RESOURCE",u[u.PROPERTY=1]="PROPERTY"}(o||(Zt.ParseType=o={})),Zt}var Sl;function If(){return Sl||(Sl=1,function(r){var e=Yt&&Yt.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=Yt&&Yt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Sf(),r)}(Yt)),Yt}var Nf=If(),ns={},is,Il;function Ba(){return Il||(Il=1,is=class qc{constructor(e,t=new Map,n=0){this.prefix=e,this._existing=t,this.counter=n}clone(){const{prefix:e,_existing:t,counter:n}=this;return new qc(e,new Map(t),n)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const n=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,n),n}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}),is}var ss={},Nl;function Rf(){return Nl||(Nl=1,function(r,e){if(r.setImmediate)return;var t=1,n={},i=!1,s=r.document,a;function o(S){typeof S!="function"&&(S=new Function(""+S));for(var m=new Array(arguments.length-1),d=0;d<m.length;d++)m[d]=arguments[d+1];var g={callback:S,args:m};return n[t]=g,a(t),t++}function u(S){delete n[S]}function l(S){var m=S.callback,d=S.args;switch(d.length){case 0:m();break;case 1:m(d[0]);break;case 2:m(d[0],d[1]);break;case 3:m(d[0],d[1],d[2]);break;default:m.apply(e,d);break}}function c(S){if(i)setTimeout(c,0,S);else{var m=n[S];if(m){i=!0;try{l(m)}finally{u(S),i=!1}}}}function h(){a=function(S){process.nextTick(function(){c(S)})}}function b(){if(r.postMessage&&!r.importScripts){var S=!0,m=r.onmessage;return r.onmessage=function(){S=!1},r.postMessage("","*"),r.onmessage=m,S}}function y(){var S="setImmediate$"+Math.random()+"$",m=function(d){d.source===r&&typeof d.data=="string"&&d.data.indexOf(S)===0&&c(+d.data.slice(S.length))};r.addEventListener?r.addEventListener("message",m,!1):r.attachEvent("onmessage",m),a=function(d){r.postMessage(S+d,"*")}}function _(){var S=new MessageChannel;S.port1.onmessage=function(m){var d=m.data;c(d)},a=function(m){S.port2.postMessage(m)}}function E(){var S=s.documentElement;a=function(m){var d=s.createElement("script");d.onreadystatechange=function(){c(m),d.onreadystatechange=null,S.removeChild(d),d=null},S.appendChild(d)}}function v(){a=function(S){setTimeout(c,0,S)}}var x=Object.getPrototypeOf&&Object.getPrototypeOf(r);x=x&&x.setTimeout?x:r,{}.toString.call(r.process)==="[object process]"?h():b()?y():r.MessageChannel?_():s&&"onreadystatechange"in s.createElement("script")?E():v(),x.setImmediate=o,x.clearImmediate=u}(typeof self>"u"?typeof Sr>"u"?ss:Sr:self)),ss}/*!
329
329
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
330
- */var rs,Sl;function pi(){if(Sl)return rs;Sl=1,xf();const r=self.crypto||self.msCrypto;return rs=class{constructor(t){if(!(r&&r.subtle))throw new Error("crypto.subtle not found.");if(t==="sha256")this.algorithm={name:"SHA-256"};else if(t==="sha1")this.algorithm={name:"SHA-1"};else throw new Error(`Unsupported algorithm "${t}".`);this._content=""}update(t){this._content+=t}async digest(){const t=new TextEncoder().encode(this._content),n=new Uint8Array(await r.subtle.digest(this.algorithm,t));let i="";for(let s=0;s<n.length;++s)i+=n[s].toString(16).padStart(2,"0");return i}},rs}/*!
330
+ */var as,Rl;function yi(){if(Rl)return as;Rl=1,Rf();const r=self.crypto||self.msCrypto;return as=class{constructor(t){if(!(r&&r.subtle))throw new Error("crypto.subtle not found.");if(t==="sha256")this.algorithm={name:"SHA-256"};else if(t==="sha1")this.algorithm={name:"SHA-1"};else throw new Error(`Unsupported algorithm "${t}".`);this._content=""}update(t){this._content+=t}async digest(){const t=new TextEncoder().encode(this._content),n=new Uint8Array(await r.subtle.digest(this.algorithm,t));let i="";for(let s=0;s<n.length;++s)i+=n[s].toString(16).padStart(2,"0");return i}},as}/*!
331
331
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
332
- */var ns,Il;function Pc(){return Il||(Il=1,ns=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,n=e.slice();let i=null,s=0;const a=e.length;for(let o=0;o<a;++o){const u=e[o],l=t.get(u);(i===null||u>i)&&(l&&o>0&&u>e[o-1]||!l&&o<a-1&&u>e[o+1])&&(i=u,s=o)}if(i===null)this.done=!0;else{const o=t.get(i)?s-1:s+1;e[s]=e[o],e[o]=i;for(const u of e)u>i&&t.set(u,!t.get(u))}return n}}),ns}/*!
332
+ */var os,Tl;function Uc(){return Tl||(Tl=1,os=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,n=e.slice();let i=null,s=0;const a=e.length;for(let o=0;o<a;++o){const u=e[o],l=t.get(u);(i===null||u>i)&&(l&&o>0&&u>e[o-1]||!l&&o<a-1&&u>e[o+1])&&(i=u,s=o)}if(i===null)this.done=!0;else{const o=t.get(i)?s-1:s+1;e[s]=e[o],e[o]=i;for(const u of e)u>i&&t.set(u,!t.get(u))}return n}}),os}/*!
333
333
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
334
- */var is,Nl;function ka(){if(Nl)return is;Nl=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+"langString",t="http://www.w3.org/2001/XMLSchema#string",n="NamedNode",i="BlankNode",s="Literal",a="DefaultGraph",o={};(()=>{const y="(?:<([^:]+:[^>]*)>)",E="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"+"_",v=E+"0-9-·̀-ͯ‿-⁀",S="(_:(?:["+E+"0-9])(?:(?:["+v+".])*(?:["+v+"]))?)",m='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',h="(?:\\^\\^"+y+")",N="(?:"+m+"(?:"+h+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",C="[ \\t]+",A="[ \\t]*",B="(?:"+y+"|"+S+")"+C,R=y+C,F="(?:"+y+"|"+S+"|"+N+")"+A,q="(?:\\.|(?:(?:"+y+"|"+S+")"+A+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^"+A+"$"),o.quad=new RegExp("^"+A+B+R+F+q+A+"$")})(),is=class Jn{static parse(_){const E=[],v={},x=_.split(o.eoln);let S=0;for(const m of x){if(S++,o.empty.test(m))continue;const h=m.match(o.quad);if(h===null)throw new Error("N-Quads parse error on line "+S+".");const g={subject:null,predicate:null,object:null,graph:null};if(h[1]!==void 0?g.subject={termType:n,value:h[1]}:g.subject={termType:i,value:h[2]},g.predicate={termType:n,value:h[3]},h[4]!==void 0?g.object={termType:n,value:h[4]}:h[5]!==void 0?g.object={termType:i,value:h[5]}:(g.object={termType:s,value:void 0,datatype:{termType:n}},h[7]!==void 0?g.object.datatype.value=h[7]:h[8]!==void 0?(g.object.datatype.value=e,g.object.language=h[8]):g.object.datatype.value=t,g.object.value=b(h[6])),h[9]!==void 0?g.graph={termType:n,value:h[9]}:h[10]!==void 0?g.graph={termType:i,value:h[10]}:g.graph={termType:a,value:""},!(g.graph.value in v))v[g.graph.value]=[g],E.push(g);else{let N=!0;const C=v[g.graph.value];for(const A of C)if(u(A,g)){N=!1;break}N&&(C.push(g),E.push(g))}}return E}static serialize(_){Array.isArray(_)||(_=Jn.legacyDatasetToQuads(_));const E=[];for(const v of _)E.push(Jn.serializeQuad(v));return E.sort().join("")}static serializeQuadComponents(_,E,v,x){let S="";return _.termType===n?S+=`<${_.value}>`:S+=`${_.value}`,S+=` <${E.value}> `,v.termType===n?S+=`<${v.value}>`:v.termType===i?S+=v.value:(S+=`"${c(v.value)}"`,v.datatype.value===e?v.language&&(S+=`@${v.language}`):v.datatype.value!==t&&(S+=`^^<${v.datatype.value}>`)),x.termType===n?S+=` <${x.value}>`:x.termType===i&&(S+=` ${x.value}`),S+=` .
335
- `,S}static serializeQuad(_){return Jn.serializeQuadComponents(_.subject,_.predicate,_.object,_.graph)}static legacyDatasetToQuads(_){const E=[],v={"blank node":i,IRI:n,literal:s};for(const x in _)_[x].forEach(m=>{const h={};for(const g in m){const N=m[g],C={termType:v[N.type],value:N.value};C.termType===s&&(C.datatype={termType:n},"datatype"in N&&(C.datatype.value=N.datatype),"language"in N?("datatype"in N||(C.datatype.value=e),C.language=N.language):"datatype"in N||(C.datatype.value=t)),h[g]=C}x==="@default"?h.graph={termType:a,value:""}:h.graph={termType:x.startsWith("_:")?i:n,value:x},E.push(h)});return E}};function u(y,_){return!(y.subject.termType===_.subject.termType&&y.object.termType===_.object.termType)||!(y.subject.value===_.subject.value&&y.predicate.value===_.predicate.value&&y.object.value===_.object.value)?!1:y.object.termType!==s?!0:y.object.datatype.termType===_.object.datatype.termType&&y.object.language===_.object.language&&y.object.datatype.value===_.object.datatype.value}const l=/["\\\n\r]/g;function c(y){return y.replace(l,function(_){switch(_){case'"':return'\\"';case"\\":return"\\\\";case`
336
- `:return"\\n";case"\r":return"\\r"}})}const d=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function b(y){return y.replace(d,function(_,E,v,x){if(E)switch(E){case"t":return" ";case"b":return"\b";case"n":return`
337
- `;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(v)return String.fromCharCode(parseInt(v,16));if(x)throw new Error("Unsupported U escape")})}return is}/*!
334
+ */var ls,Al;function qa(){if(Al)return ls;Al=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+"langString",t="http://www.w3.org/2001/XMLSchema#string",n="NamedNode",i="BlankNode",s="Literal",a="DefaultGraph",o={};(()=>{const y="(?:<([^:]+:[^>]*)>)",E="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"+"_",v=E+"0-9-·̀-ͯ‿-⁀",S="(_:(?:["+E+"0-9])(?:(?:["+v+".])*(?:["+v+"]))?)",m='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',d="(?:\\^\\^"+y+")",N="(?:"+m+"(?:"+d+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",C="[ \\t]+",A="[ \\t]*",B="(?:"+y+"|"+S+")"+C,R=y+C,F="(?:"+y+"|"+S+"|"+N+")"+A,q="(?:\\.|(?:(?:"+y+"|"+S+")"+A+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^"+A+"$"),o.quad=new RegExp("^"+A+B+R+F+q+A+"$")})(),ls=class Yn{static parse(_){const E=[],v={},x=_.split(o.eoln);let S=0;for(const m of x){if(S++,o.empty.test(m))continue;const d=m.match(o.quad);if(d===null)throw new Error("N-Quads parse error on line "+S+".");const g={subject:null,predicate:null,object:null,graph:null};if(d[1]!==void 0?g.subject={termType:n,value:d[1]}:g.subject={termType:i,value:d[2]},g.predicate={termType:n,value:d[3]},d[4]!==void 0?g.object={termType:n,value:d[4]}:d[5]!==void 0?g.object={termType:i,value:d[5]}:(g.object={termType:s,value:void 0,datatype:{termType:n}},d[7]!==void 0?g.object.datatype.value=d[7]:d[8]!==void 0?(g.object.datatype.value=e,g.object.language=d[8]):g.object.datatype.value=t,g.object.value=b(d[6])),d[9]!==void 0?g.graph={termType:n,value:d[9]}:d[10]!==void 0?g.graph={termType:i,value:d[10]}:g.graph={termType:a,value:""},!(g.graph.value in v))v[g.graph.value]=[g],E.push(g);else{let N=!0;const C=v[g.graph.value];for(const A of C)if(u(A,g)){N=!1;break}N&&(C.push(g),E.push(g))}}return E}static serialize(_){Array.isArray(_)||(_=Yn.legacyDatasetToQuads(_));const E=[];for(const v of _)E.push(Yn.serializeQuad(v));return E.sort().join("")}static serializeQuadComponents(_,E,v,x){let S="";return _.termType===n?S+=`<${_.value}>`:S+=`${_.value}`,S+=` <${E.value}> `,v.termType===n?S+=`<${v.value}>`:v.termType===i?S+=v.value:(S+=`"${c(v.value)}"`,v.datatype.value===e?v.language&&(S+=`@${v.language}`):v.datatype.value!==t&&(S+=`^^<${v.datatype.value}>`)),x.termType===n?S+=` <${x.value}>`:x.termType===i&&(S+=` ${x.value}`),S+=` .
335
+ `,S}static serializeQuad(_){return Yn.serializeQuadComponents(_.subject,_.predicate,_.object,_.graph)}static legacyDatasetToQuads(_){const E=[],v={"blank node":i,IRI:n,literal:s};for(const x in _)_[x].forEach(m=>{const d={};for(const g in m){const N=m[g],C={termType:v[N.type],value:N.value};C.termType===s&&(C.datatype={termType:n},"datatype"in N&&(C.datatype.value=N.datatype),"language"in N?("datatype"in N||(C.datatype.value=e),C.language=N.language):"datatype"in N||(C.datatype.value=t)),d[g]=C}x==="@default"?d.graph={termType:a,value:""}:d.graph={termType:x.startsWith("_:")?i:n,value:x},E.push(d)});return E}};function u(y,_){return!(y.subject.termType===_.subject.termType&&y.object.termType===_.object.termType)||!(y.subject.value===_.subject.value&&y.predicate.value===_.predicate.value&&y.object.value===_.object.value)?!1:y.object.termType!==s?!0:y.object.datatype.termType===_.object.datatype.termType&&y.object.language===_.object.language&&y.object.datatype.value===_.object.datatype.value}const l=/["\\\n\r]/g;function c(y){return y.replace(l,function(_){switch(_){case'"':return'\\"';case"\\":return"\\\\";case`
336
+ `:return"\\n";case"\r":return"\\r"}})}const h=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function b(y){return y.replace(h,function(_,E,v,x){if(E)switch(E){case"t":return" ";case"b":return"\b";case"n":return`
337
+ `;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(v)return String.fromCharCode(parseInt(v,16));if(x)throw new Error("Unsupported U escape")})}return ls}/*!
338
338
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
339
- */var ss,Rl;function Mc(){if(Rl)return ss;Rl=1;const r=Fa(),e=pi(),t=Pc(),n=ka();ss=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:u=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=u,this.quads=null,this.deepIterations=null}async main(a){this.deepIterations=new Map,this.quads=a;for(const y of a)this._addBlankNodeQuadInfo({quad:y,component:y.subject}),this._addBlankNodeQuadInfo({quad:y,component:y.object}),this._addBlankNodeQuadInfo({quad:y,component:y.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];let l=0;for(const y of u)++l%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:y,hashToBlankNodes:o});const c=[...o.keys()].sort(),d=[];for(const y of c){const _=o.get(y);if(_.length>1){d.push(_);continue}const E=_[0];this.canonicalIssuer.getId(E)}for(const y of d){const _=[];for(const E of y){if(this.canonicalIssuer.hasId(E))continue;const v=new r("_:b");v.getId(E);const x=await this.hashNDegreeQuads(E,v);_.push(x)}_.sort(i);for(const E of _){const v=E.issuer.getOldIds();for(const x of v)this.canonicalIssuer.getId(x)}}const b=[];for(const y of this.quads){const _=n.serializeQuadComponents(this._componentWithCanonicalId(y.subject),y.predicate,this._componentWithCanonicalId(y.object),this._componentWithCanonicalId(y.graph));b.push(_)}return b.sort(),b.join("")}async hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const d of l){const b={subject:null,predicate:d.predicate,object:null,graph:null};b.subject=this.modifyFirstDegreeComponent(a,d.subject,"subject"),b.object=this.modifyFirstDegreeComponent(a,d.object,"object"),b.graph=this.modifyFirstDegreeComponent(a,d.graph,"graph"),o.push(n.serializeQuad(b))}o.sort();const c=this.createMessageDigest();for(const d of o)c.update(d);return u.hash=await c.digest(),u.hash}async hashRelatedBlankNode(a,o,u,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):u.hasId(a)?c=u.getId(a):c=this.blankNodeInfo.get(a).hash;const d=this.createMessageDigest();return d.update(l),l!=="g"&&d.update(this.getRelatedPredicate(o)),d.update(c),d.digest()}async hashNDegreeQuads(a,o){const u=this.deepIterations.get(a)||0;if(u>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,u+1);const l=this.createMessageDigest(),c=await this.createHashToRelated(a,o),d=[...c.keys()].sort();for(const b of d){l.update(b);let y="",_;const E=new t(c.get(b));let v=0;for(;E.hasNext();){const x=E.next();++v%3===0&&await this._yield();let S=o.clone(),m="";const h=[];let g=!1;for(const N of x)if(this.canonicalIssuer.hasId(N)?m+=this.canonicalIssuer.getId(N):(S.hasId(N)||h.push(N),m+=S.getId(N)),y.length!==0&&m>y){g=!0;break}if(!g){for(const N of h){const C=await this.hashNDegreeQuads(N,S);if(m+=S.getId(N),m+=`<${C.hash}>`,S=C.issuer,y.length!==0&&m>y){g=!0;break}}g||(y.length===0||m<y)&&(y=m,_=S)}}l.update(y),o=_}return{hash:await l.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}async createHashToRelated(a,o){const u=new Map,l=this.blankNodeInfo.get(a).quads;let c=0;for(const d of l)++c%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:d,component:d.subject,position:"s",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:d,component:d.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:d,component:d.graph,position:"g",id:a,issuer:o,hashToRelated:u})]);return u}async _hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const u=await this.hashFirstDegreeQuads(a),l=o.get(u);l?l.push(a):o.set(u,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const u=o.value,l=this.blankNodeInfo.get(u);l?l.quads.add(a):this.blankNodeInfo.set(u,{quads:new Set([a]),hash:null})}async _addRelatedBlankNodeHash({quad:a,component:o,position:u,id:l,issuer:c,hashToRelated:d}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const b=o.value,y=await this.hashRelatedBlankNode(b,a,c,u),_=d.get(y);_?_.push(b):d.set(y,[b])}_componentWithCanonicalId(a){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}async _yield(){return new Promise(a=>setImmediate(a))}};function i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return ss}/*!
339
+ */var us,Dl;function Hc(){if(Dl)return us;Dl=1;const r=Ba(),e=yi(),t=Uc(),n=qa();us=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:u=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=u,this.quads=null,this.deepIterations=null}async main(a){this.deepIterations=new Map,this.quads=a;for(const y of a)this._addBlankNodeQuadInfo({quad:y,component:y.subject}),this._addBlankNodeQuadInfo({quad:y,component:y.object}),this._addBlankNodeQuadInfo({quad:y,component:y.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];let l=0;for(const y of u)++l%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:y,hashToBlankNodes:o});const c=[...o.keys()].sort(),h=[];for(const y of c){const _=o.get(y);if(_.length>1){h.push(_);continue}const E=_[0];this.canonicalIssuer.getId(E)}for(const y of h){const _=[];for(const E of y){if(this.canonicalIssuer.hasId(E))continue;const v=new r("_:b");v.getId(E);const x=await this.hashNDegreeQuads(E,v);_.push(x)}_.sort(i);for(const E of _){const v=E.issuer.getOldIds();for(const x of v)this.canonicalIssuer.getId(x)}}const b=[];for(const y of this.quads){const _=n.serializeQuadComponents(this._componentWithCanonicalId(y.subject),y.predicate,this._componentWithCanonicalId(y.object),this._componentWithCanonicalId(y.graph));b.push(_)}return b.sort(),b.join("")}async hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const h of l){const b={subject:null,predicate:h.predicate,object:null,graph:null};b.subject=this.modifyFirstDegreeComponent(a,h.subject,"subject"),b.object=this.modifyFirstDegreeComponent(a,h.object,"object"),b.graph=this.modifyFirstDegreeComponent(a,h.graph,"graph"),o.push(n.serializeQuad(b))}o.sort();const c=this.createMessageDigest();for(const h of o)c.update(h);return u.hash=await c.digest(),u.hash}async hashRelatedBlankNode(a,o,u,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):u.hasId(a)?c=u.getId(a):c=this.blankNodeInfo.get(a).hash;const h=this.createMessageDigest();return h.update(l),l!=="g"&&h.update(this.getRelatedPredicate(o)),h.update(c),h.digest()}async hashNDegreeQuads(a,o){const u=this.deepIterations.get(a)||0;if(u>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,u+1);const l=this.createMessageDigest(),c=await this.createHashToRelated(a,o),h=[...c.keys()].sort();for(const b of h){l.update(b);let y="",_;const E=new t(c.get(b));let v=0;for(;E.hasNext();){const x=E.next();++v%3===0&&await this._yield();let S=o.clone(),m="";const d=[];let g=!1;for(const N of x)if(this.canonicalIssuer.hasId(N)?m+=this.canonicalIssuer.getId(N):(S.hasId(N)||d.push(N),m+=S.getId(N)),y.length!==0&&m>y){g=!0;break}if(!g){for(const N of d){const C=await this.hashNDegreeQuads(N,S);if(m+=S.getId(N),m+=`<${C.hash}>`,S=C.issuer,y.length!==0&&m>y){g=!0;break}}g||(y.length===0||m<y)&&(y=m,_=S)}}l.update(y),o=_}return{hash:await l.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}async createHashToRelated(a,o){const u=new Map,l=this.blankNodeInfo.get(a).quads;let c=0;for(const h of l)++c%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:h,component:h.subject,position:"s",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:h,component:h.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:h,component:h.graph,position:"g",id:a,issuer:o,hashToRelated:u})]);return u}async _hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const u=await this.hashFirstDegreeQuads(a),l=o.get(u);l?l.push(a):o.set(u,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const u=o.value,l=this.blankNodeInfo.get(u);l?l.quads.add(a):this.blankNodeInfo.set(u,{quads:new Set([a]),hash:null})}async _addRelatedBlankNodeHash({quad:a,component:o,position:u,id:l,issuer:c,hashToRelated:h}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const b=o.value,y=await this.hashRelatedBlankNode(b,a,c,u),_=h.get(y);_?_.push(b):h.set(y,[b])}_componentWithCanonicalId(a){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}async _yield(){return new Promise(a=>setImmediate(a))}};function i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return us}/*!
340
340
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
341
- */var as,Tl;function Ef(){if(Tl)return as;Tl=1;const r=pi(),e=Mc();return as=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}async createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;let o=0;for(const u of a){let l,c;if(u.subject.termType==="BlankNode"&&u.subject.value!==n)c=u.subject.value,l="p";else if(u.object.termType==="BlankNode"&&u.object.value!==n)c=u.object.value,l="r";else continue;++o%100===0&&await this._yield();const d=await this.hashRelatedBlankNode(c,u,i,l),b=s.get(d);b?b.push(c):s.set(d,[c])}return s}},as}/*!
341
+ */var cs,Ll;function Tf(){if(Ll)return cs;Ll=1;const r=yi(),e=Hc();return cs=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}async createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;let o=0;for(const u of a){let l,c;if(u.subject.termType==="BlankNode"&&u.subject.value!==n)c=u.subject.value,l="p";else if(u.object.termType==="BlankNode"&&u.object.value!==n)c=u.object.value,l="r";else continue;++o%100===0&&await this._yield();const h=await this.hashRelatedBlankNode(c,u,i,l),b=s.get(h);b?b.push(c):s.set(h,[c])}return s}},cs}/*!
342
342
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
343
- */var os,Al;function Bc(){if(Al)return os;Al=1;const r=Fa(),e=pi(),t=Pc(),n=ka();os=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:u=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=u,this.quads=null,this.deepIterations=null}main(a){this.deepIterations=new Map,this.quads=a;for(const b of a)this._addBlankNodeQuadInfo({quad:b,component:b.subject}),this._addBlankNodeQuadInfo({quad:b,component:b.object}),this._addBlankNodeQuadInfo({quad:b,component:b.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];for(const b of u)this._hashAndTrackBlankNode({id:b,hashToBlankNodes:o});const l=[...o.keys()].sort(),c=[];for(const b of l){const y=o.get(b);if(y.length>1){c.push(y);continue}const _=y[0];this.canonicalIssuer.getId(_)}for(const b of c){const y=[];for(const _ of b){if(this.canonicalIssuer.hasId(_))continue;const E=new r("_:b");E.getId(_);const v=this.hashNDegreeQuads(_,E);y.push(v)}y.sort(i);for(const _ of y){const E=_.issuer.getOldIds();for(const v of E)this.canonicalIssuer.getId(v)}}const d=[];for(const b of this.quads){const y=n.serializeQuadComponents(this._componentWithCanonicalId({component:b.subject}),b.predicate,this._componentWithCanonicalId({component:b.object}),this._componentWithCanonicalId({component:b.graph}));d.push(y)}return d.sort(),d.join("")}hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const d of l){const b={subject:null,predicate:d.predicate,object:null,graph:null};b.subject=this.modifyFirstDegreeComponent(a,d.subject,"subject"),b.object=this.modifyFirstDegreeComponent(a,d.object,"object"),b.graph=this.modifyFirstDegreeComponent(a,d.graph,"graph"),o.push(n.serializeQuad(b))}o.sort();const c=this.createMessageDigest();for(const d of o)c.update(d);return u.hash=c.digest(),u.hash}hashRelatedBlankNode(a,o,u,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):u.hasId(a)?c=u.getId(a):c=this.blankNodeInfo.get(a).hash;const d=this.createMessageDigest();return d.update(l),l!=="g"&&d.update(this.getRelatedPredicate(o)),d.update(c),d.digest()}hashNDegreeQuads(a,o){const u=this.deepIterations.get(a)||0;if(u>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,u+1);const l=this.createMessageDigest(),c=this.createHashToRelated(a,o),d=[...c.keys()].sort();for(const b of d){l.update(b);let y="",_;const E=new t(c.get(b));for(;E.hasNext();){const v=E.next();let x=o.clone(),S="";const m=[];let h=!1;for(const g of v)if(this.canonicalIssuer.hasId(g)?S+=this.canonicalIssuer.getId(g):(x.hasId(g)||m.push(g),S+=x.getId(g)),y.length!==0&&S>y){h=!0;break}if(!h){for(const g of m){const N=this.hashNDegreeQuads(g,x);if(S+=x.getId(g),S+=`<${N.hash}>`,x=N.issuer,y.length!==0&&S>y){h=!0;break}}h||(y.length===0||S<y)&&(y=S,_=x)}}l.update(y),o=_}return{hash:l.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}createHashToRelated(a,o){const u=new Map,l=this.blankNodeInfo.get(a).quads;for(const c of l)this._addRelatedBlankNodeHash({quad:c,component:c.subject,position:"s",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:c,component:c.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:c,component:c.graph,position:"g",id:a,issuer:o,hashToRelated:u});return u}_hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const u=this.hashFirstDegreeQuads(a),l=o.get(u);l?l.push(a):o.set(u,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const u=o.value,l=this.blankNodeInfo.get(u);l?l.quads.add(a):this.blankNodeInfo.set(u,{quads:new Set([a]),hash:null})}_addRelatedBlankNodeHash({quad:a,component:o,position:u,id:l,issuer:c,hashToRelated:d}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const b=o.value,y=this.hashRelatedBlankNode(b,a,c,u),_=d.get(y);_?_.push(b):d.set(y,[b])}_componentWithCanonicalId({component:a}){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}};function i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return os}/*!
343
+ */var ds,Ol;function Vc(){if(Ol)return ds;Ol=1;const r=Ba(),e=yi(),t=Uc(),n=qa();ds=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:u=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=u,this.quads=null,this.deepIterations=null}main(a){this.deepIterations=new Map,this.quads=a;for(const b of a)this._addBlankNodeQuadInfo({quad:b,component:b.subject}),this._addBlankNodeQuadInfo({quad:b,component:b.object}),this._addBlankNodeQuadInfo({quad:b,component:b.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];for(const b of u)this._hashAndTrackBlankNode({id:b,hashToBlankNodes:o});const l=[...o.keys()].sort(),c=[];for(const b of l){const y=o.get(b);if(y.length>1){c.push(y);continue}const _=y[0];this.canonicalIssuer.getId(_)}for(const b of c){const y=[];for(const _ of b){if(this.canonicalIssuer.hasId(_))continue;const E=new r("_:b");E.getId(_);const v=this.hashNDegreeQuads(_,E);y.push(v)}y.sort(i);for(const _ of y){const E=_.issuer.getOldIds();for(const v of E)this.canonicalIssuer.getId(v)}}const h=[];for(const b of this.quads){const y=n.serializeQuadComponents(this._componentWithCanonicalId({component:b.subject}),b.predicate,this._componentWithCanonicalId({component:b.object}),this._componentWithCanonicalId({component:b.graph}));h.push(y)}return h.sort(),h.join("")}hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const h of l){const b={subject:null,predicate:h.predicate,object:null,graph:null};b.subject=this.modifyFirstDegreeComponent(a,h.subject,"subject"),b.object=this.modifyFirstDegreeComponent(a,h.object,"object"),b.graph=this.modifyFirstDegreeComponent(a,h.graph,"graph"),o.push(n.serializeQuad(b))}o.sort();const c=this.createMessageDigest();for(const h of o)c.update(h);return u.hash=c.digest(),u.hash}hashRelatedBlankNode(a,o,u,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):u.hasId(a)?c=u.getId(a):c=this.blankNodeInfo.get(a).hash;const h=this.createMessageDigest();return h.update(l),l!=="g"&&h.update(this.getRelatedPredicate(o)),h.update(c),h.digest()}hashNDegreeQuads(a,o){const u=this.deepIterations.get(a)||0;if(u>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,u+1);const l=this.createMessageDigest(),c=this.createHashToRelated(a,o),h=[...c.keys()].sort();for(const b of h){l.update(b);let y="",_;const E=new t(c.get(b));for(;E.hasNext();){const v=E.next();let x=o.clone(),S="";const m=[];let d=!1;for(const g of v)if(this.canonicalIssuer.hasId(g)?S+=this.canonicalIssuer.getId(g):(x.hasId(g)||m.push(g),S+=x.getId(g)),y.length!==0&&S>y){d=!0;break}if(!d){for(const g of m){const N=this.hashNDegreeQuads(g,x);if(S+=x.getId(g),S+=`<${N.hash}>`,x=N.issuer,y.length!==0&&S>y){d=!0;break}}d||(y.length===0||S<y)&&(y=S,_=x)}}l.update(y),o=_}return{hash:l.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}createHashToRelated(a,o){const u=new Map,l=this.blankNodeInfo.get(a).quads;for(const c of l)this._addRelatedBlankNodeHash({quad:c,component:c.subject,position:"s",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:c,component:c.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:c,component:c.graph,position:"g",id:a,issuer:o,hashToRelated:u});return u}_hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const u=this.hashFirstDegreeQuads(a),l=o.get(u);l?l.push(a):o.set(u,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const u=o.value,l=this.blankNodeInfo.get(u);l?l.quads.add(a):this.blankNodeInfo.set(u,{quads:new Set([a]),hash:null})}_addRelatedBlankNodeHash({quad:a,component:o,position:u,id:l,issuer:c,hashToRelated:h}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const b=o.value,y=this.hashRelatedBlankNode(b,a,c,u),_=h.get(y);_?_.push(b):h.set(y,[b])}_componentWithCanonicalId({component:a}){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}};function i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return ds}/*!
344
344
  * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
345
- */var ls,Dl;function Sf(){if(Dl)return ls;Dl=1;const r=pi(),e=Bc();return ls=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;for(const o of a){let u,l;if(o.subject.termType==="BlankNode"&&o.subject.value!==n)l=o.subject.value,u="p";else if(o.object.termType==="BlankNode"&&o.object.value!==n)l=o.object.value,u="r";else continue;const c=this.hashRelatedBlankNode(l,o,i,u),d=s.get(c);d?d.push(l):s.set(c,[l])}return s}},ls}const If={},Nf=Object.freeze(Object.defineProperty({__proto__:null,default:If},Symbol.toStringTag,{value:"Module"})),Rf=rd(Nf);var Ll;function Tf(){return Ll||(Ll=1,function(r){const e=Mc(),t=Ef(),n=Bc(),i=Sf();let s;try{s=Rf}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=ka(),r.IdentifierIssuer=Fa(),r._rdfCanonizeNative=function(o){return o&&(s=o),s},r.canonize=async function(o,u){const l=a(o);if(u.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((c,d)=>s.canonize(l,u,(b,y)=>b?d(b):c(y)))}if(u.algorithm==="URDNA2015")return new e(u).main(l);if(u.algorithm==="URGNA2012"){if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(u).main(l)}throw"algorithm"in u?new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},r._canonizeSync=function(o,u){const l=a(o);if(u.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(l,u)}if(u.algorithm==="URDNA2015")return new n(u).main(l);if(u.algorithm==="URGNA2012"){if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(u).main(l)}throw"algorithm"in u?new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}}(Zi)),Zi}var us,Ol;function Pa(){return Ol||(Ol=1,us=Tf()),us}var cs,Cl;function ut(){if(Cl)return cs;Cl=1;const r={};return cs=r,r.isArray=Array.isArray,r.isBoolean=e=>typeof e=="boolean"||Object.prototype.toString.call(e)==="[object Boolean]",r.isDouble=e=>r.isNumber(e)&&(String(e).indexOf(".")!==-1||Math.abs(e)>=1e21),r.isEmptyObject=e=>r.isObject(e)&&Object.keys(e).length===0,r.isNumber=e=>typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]",r.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),r.isObject=e=>Object.prototype.toString.call(e)==="[object Object]",r.isString=e=>typeof e=="string"||Object.prototype.toString.call(e)==="[object String]",r.isUndefined=e=>typeof e>"u",cs}var ds,jl;function kt(){if(jl)return ds;jl=1;const r=ut(),e={};return ds=e,e.isSubject=t=>r.isObject(t)&&!("@value"in t||"@set"in t||"@list"in t)?Object.keys(t).length>1||!("@id"in t):!1,e.isSubjectReference=t=>r.isObject(t)&&Object.keys(t).length===1&&"@id"in t,e.isValue=t=>r.isObject(t)&&"@value"in t,e.isList=t=>r.isObject(t)&&"@list"in t,e.isGraph=t=>r.isObject(t)&&"@graph"in t&&Object.keys(t).filter(n=>n!=="@id"&&n!=="@index").length===1,e.isSimpleGraph=t=>e.isGraph(t)&&!("@id"in t),e.isBlankNode=t=>{if(r.isObject(t)){if("@id"in t){const n=t["@id"];return!r.isString(n)||n.indexOf("_:")===0}return Object.keys(t).length===0||!("@value"in t||"@set"in t||"@list"in t)}return!1},ds}var hs,$l;function gt(){return $l||($l=1,hs=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}}),hs}var fs,Fl;function ht(){if(Fl)return fs;Fl=1;const r=kt(),e=ut(),t=Pa().IdentifierIssuer,n=gt(),i=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,o=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,l={headers:{accept:"application/ld+json, application/json"}},c={};fs=c,c.IdentifierIssuer=t,c.REGEX_BCP47=i,c.REGEX_KEYWORD=u,c.clone=function(b){if(b&&typeof b=="object"){let y;if(e.isArray(b)){y=[];for(let _=0;_<b.length;++_)y[_]=c.clone(b[_])}else if(b instanceof Map){y=new Map;for(const[_,E]of b)y.set(_,c.clone(E))}else if(b instanceof Set){y=new Set;for(const _ of b)y.add(c.clone(_))}else if(e.isObject(b)){y={};for(const _ in b)y[_]=c.clone(b[_])}else y=b.toString();return y}return b},c.asArray=function(b){return Array.isArray(b)?b:[b]},c.buildHeaders=(b={})=>{if(Object.keys(b).some(_=>_.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+l.headers.accept+'" is supported.');return Object.assign({Accept:l.headers.accept},b)},c.parseLinkHeader=b=>{const y={},_=b.match(s);for(let E=0;E<_.length;++E){let v=_[E].match(a);if(!v)continue;const x={target:v[1]},S=v[2];for(;v=o.exec(S);)x[v[1]]=v[2]===void 0?v[3]:v[2];const m=x.rel||"";Array.isArray(y[m])?y[m].push(x):y.hasOwnProperty(m)?y[m]=[y[m],x]:y[m]=x}return y},c.validateTypeValue=(b,y)=>{if(!e.isString(b)&&!(e.isArray(b)&&b.every(_=>e.isString(_)))){if(y&&e.isObject(b))switch(Object.keys(b).length){case 0:return;case 1:if("@default"in b&&c.asArray(b["@default"]).every(_=>e.isString(_)))return}throw new n('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:b})}},c.hasProperty=(b,y)=>{if(b.hasOwnProperty(y)){const _=b[y];return!e.isArray(_)||_.length>0}return!1},c.hasValue=(b,y,_)=>{if(c.hasProperty(b,y)){let E=b[y];const v=r.isList(E);if(e.isArray(E)||v){v&&(E=E["@list"]);for(let x=0;x<E.length;++x)if(c.compareValues(_,E[x]))return!0}else if(!e.isArray(_))return c.compareValues(_,E)}return!1},c.addValue=(b,y,_,E)=>{if(E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1),"valueIsArray"in E||(E.valueIsArray=!1),"allowDuplicate"in E||(E.allowDuplicate=!0),"prependValue"in E||(E.prependValue=!1),E.valueIsArray)b[y]=_;else if(e.isArray(_)){_.length===0&&E.propertyIsArray&&!b.hasOwnProperty(y)&&(b[y]=[]),E.prependValue&&(_=_.concat(b[y]),b[y]=[]);for(let v=0;v<_.length;++v)c.addValue(b,y,_[v],E)}else if(b.hasOwnProperty(y)){const v=!E.allowDuplicate&&c.hasValue(b,y,_);!e.isArray(b[y])&&(!v||E.propertyIsArray)&&(b[y]=[b[y]]),v||(E.prependValue?b[y].unshift(_):b[y].push(_))}else b[y]=E.propertyIsArray?[_]:_},c.getValues=(b,y)=>[].concat(b[y]||[]),c.removeProperty=(b,y)=>{delete b[y]},c.removeValue=(b,y,_,E)=>{E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1);const v=c.getValues(b,y).filter(x=>!c.compareValues(x,_));v.length===0?c.removeProperty(b,y):v.length===1&&!E.propertyIsArray?b[y]=v[0]:b[y]=v},c.relabelBlankNodes=(b,y)=>{y=y||{};const _=y.issuer||new t("_:b");return d(_,b)},c.compareValues=(b,y)=>b===y||r.isValue(b)&&r.isValue(y)&&b["@value"]===y["@value"]&&b["@type"]===y["@type"]&&b["@language"]===y["@language"]&&b["@index"]===y["@index"]?!0:e.isObject(b)&&"@id"in b&&e.isObject(y)&&"@id"in y?b["@id"]===y["@id"]:!1,c.compareShortestLeast=(b,y)=>b.length<y.length?-1:y.length<b.length?1:b===y?0:b<y?-1:1;function d(b,y){if(e.isArray(y))for(let _=0;_<y.length;++_)y[_]=d(b,y[_]);else if(r.isList(y))y["@list"]=d(b,y["@list"]);else if(e.isObject(y)){r.isBlankNode(y)&&(y["@id"]=b.getId(y["@id"]));const _=Object.keys(y).sort();for(let E=0;E<_.length;++E){const v=_[E];v!=="@id"&&(y[v]=d(b,y[v]))}}return y}return fs}var ps,kl;function Ma(){if(kl)return ps;kl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return ps={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:r,RDF_LIST:r+"List",RDF_FIRST:r+"first",RDF_REST:r+"rest",RDF_NIL:r+"nil",RDF_TYPE:r+"type",RDF_PLAIN_LITERAL:r+"PlainLiteral",RDF_XML_LITERAL:r+"XMLLiteral",RDF_JSON_LITERAL:r+"JSON",RDF_OBJECT:r+"object",RDF_LANGSTRING:r+"langString",XSD:e,XSD_BOOLEAN:e+"boolean",XSD_DOUBLE:e+"double",XSD_INTEGER:e+"integer",XSD_STRING:e+"string"},ps}var gs,Pl;function qc(){return Pl||(Pl=1,gs=class{constructor(){this._requests={}}wrapLoader(e){const t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}),gs}var ms,Ml;function Jt(){if(Ml)return ms;Ml=1;const r=ut(),e={};ms=e,e.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*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},e.parse=(n,i)=>{const s={},a=e.parsers[i||"full"],o=a.regex.exec(n);let u=a.keys.length;for(;u--;)s[a.keys[u]]=o[u]===void 0?null:o[u];return(s.scheme==="https"&&s.port==="443"||s.scheme==="http"&&s.port==="80")&&(s.href=s.href.replace(":"+s.port,""),s.authority=s.authority.replace(":"+s.port,""),s.port=null),s.normalizedPath=e.removeDotSegments(s.path),s},e.prependBase=(n,i)=>{if(n===null||e.isAbsolute(i))return i;(!n||r.isString(n))&&(n=e.parse(n||""));const s=e.parse(i),a={protocol:n.protocol||""};if(s.authority!==null)a.authority=s.authority,a.path=s.path,a.query=s.query;else if(a.authority=n.authority,s.path==="")a.path=n.path,s.query!==null?a.query=s.query:a.query=n.query;else{if(s.path.indexOf("/")===0)a.path=s.path;else{let u=n.path;u=u.substr(0,u.lastIndexOf("/")+1),(u.length>0||n.authority)&&u.substr(-1)!=="/"&&(u+="/"),u+=s.path,a.path=u}a.query=s.query}s.path!==""&&(a.path=e.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+="//"+a.authority),o+=a.path,a.query!==null&&(o+="?"+a.query),s.fragment!==null&&(o+="#"+s.fragment),o===""&&(o="./"),o},e.removeBase=(n,i)=>{if(n===null)return i;(!n||r.isString(n))&&(n=e.parse(n||""));let s="";if(n.href!==""?s+=(n.protocol||"")+"//"+(n.authority||""):i.indexOf("//")&&(s+="//"),i.indexOf(s)!==0)return i;const a=e.parse(i.substr(s.length)),o=n.normalizedPath.split("/"),u=a.normalizedPath.split("/"),l=a.fragment||a.query?0:1;for(;o.length>0&&u.length>l&&o[0]===u[0];)o.shift(),u.shift();let c="";if(o.length>0){o.pop();for(let d=0;d<o.length;++d)c+="../"}return c+=u.join("/"),a.query!==null&&(c+="?"+a.query),a.fragment!==null&&(c+="#"+a.fragment),c===""&&(c="./"),c},e.removeDotSegments=n=>{if(n.length===0)return"";const i=n.split("/"),s=[];for(;i.length>0;){const a=i.shift(),o=i.length===0;if(a==="."){o&&s.push("");continue}if(a===".."){s.pop(),o&&s.push("");continue}s.push(a)}return n[0]==="/"&&s.length>0&&s[0]!==""&&s.unshift(""),s.length===1&&s[0]===""?"/":s.join("/")};const t=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;return e.isAbsolute=n=>r.isString(n)&&t.test(n),e.isRelative=n=>r.isString(n),ms}var ys,Bl;function Af(){if(Bl)return ys;Bl=1;const{parseLinkHeader:r,buildHeaders:e}=ht(),{LINK_HEADER_CONTEXT:t}=Ma(),n=gt(),i=qc(),{prependBase:s}=Jt(),a=/(^|(\r\n))link:/i;ys=({secure:u,headers:l={},xhr:c}={headers:{}})=>{return l=e(l),new i().wrapLoader(b);async function b(y){if(y.indexOf("http:")!==0&&y.indexOf("https:")!==0)throw new n('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:y});if(u&&y.indexOf("https")!==0)throw new n(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,"jsonld.InvalidUrl",{code:"loading document failed",url:y});let _;try{_=await o(c,y,l)}catch(m){throw new n("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:y,cause:m})}if(_.status>=400)throw new n("URL could not be dereferenced: "+_.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:y,httpStatusCode:_.status});let E={contextUrl:null,documentUrl:y,document:_.response},v=null;const x=_.getResponseHeader("Content-Type");let S;if(a.test(_.getAllResponseHeaders())&&(S=_.getResponseHeader("Link")),S&&x!=="application/ld+json"){const m=r(S),h=m[t];if(Array.isArray(h))throw new n("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:y});h&&(E.contextUrl=h.target),v=m.alternate,v&&v.type=="application/ld+json"&&!(x||"").match(/^application\/(\w*\+)?json$/)&&(E=await b(s(y,v.target)))}return E}};function o(u,l,c){u=u||XMLHttpRequest;const d=new u;return new Promise((b,y)=>{d.onload=()=>b(d),d.onerror=_=>y(_),d.open("GET",l,!0);for(const _ in c)d.setRequestHeader(_,c[_]);d.send()})}return ys}var bs,ql;function Df(){if(ql)return bs;ql=1;const r=Af(),e={};return bs=e,e.setupDocumentLoaders=function(t){typeof XMLHttpRequest<"u"&&(t.documentLoaders.xhr=r,t.useDocumentLoader("xhr"))},e.setupGlobals=function(t){typeof globalThis.JsonLdProcessor>"u"&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t.JsonLdProcessor})},bs}var _s,Ul;function Lf(){return Ul||(Ul=1,_s=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),_s}var ws,Hl;function Of(){if(Hl)return ws;Hl=1,ws=r,r.Node=i,r.create=r;function r(s){var a=this;if(a instanceof r||(a=new r),a.tail=null,a.head=null,a.length=0,s&&typeof s.forEach=="function")s.forEach(function(l){a.push(l)});else if(arguments.length>0)for(var o=0,u=arguments.length;o<u;o++)a.push(arguments[o]);return a}r.prototype.removeNode=function(s){if(s.list!==this)throw new Error("removing node which does not belong to this list");var a=s.next,o=s.prev;return a&&(a.prev=o),o&&(o.next=a),s===this.head&&(this.head=a),s===this.tail&&(this.tail=o),s.list.length--,s.next=null,s.prev=null,s.list=null,a},r.prototype.unshiftNode=function(s){if(s!==this.head){s.list&&s.list.removeNode(s);var a=this.head;s.list=this,s.next=a,a&&(a.prev=s),this.head=s,this.tail||(this.tail=s),this.length++}},r.prototype.pushNode=function(s){if(s!==this.tail){s.list&&s.list.removeNode(s);var a=this.tail;s.list=this,s.prev=a,a&&(a.next=s),this.tail=s,this.head||(this.head=s),this.length++}},r.prototype.push=function(){for(var s=0,a=arguments.length;s<a;s++)t(this,arguments[s]);return this.length},r.prototype.unshift=function(){for(var s=0,a=arguments.length;s<a;s++)n(this,arguments[s]);return this.length},r.prototype.pop=function(){if(this.tail){var s=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,s}},r.prototype.shift=function(){if(this.head){var s=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,s}},r.prototype.forEach=function(s,a){a=a||this;for(var o=this.head,u=0;o!==null;u++)s.call(a,o.value,u,this),o=o.next},r.prototype.forEachReverse=function(s,a){a=a||this;for(var o=this.tail,u=this.length-1;o!==null;u--)s.call(a,o.value,u,this),o=o.prev},r.prototype.get=function(s){for(var a=0,o=this.head;o!==null&&a<s;a++)o=o.next;if(a===s&&o!==null)return o.value},r.prototype.getReverse=function(s){for(var a=0,o=this.tail;o!==null&&a<s;a++)o=o.prev;if(a===s&&o!==null)return o.value},r.prototype.map=function(s,a){a=a||this;for(var o=new r,u=this.head;u!==null;)o.push(s.call(a,u.value,this)),u=u.next;return o},r.prototype.mapReverse=function(s,a){a=a||this;for(var o=new r,u=this.tail;u!==null;)o.push(s.call(a,u.value,this)),u=u.prev;return o},r.prototype.reduce=function(s,a){var o,u=this.head;if(arguments.length>1)o=a;else if(this.head)u=this.head.next,o=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=0;u!==null;l++)o=s(o,u.value,l),u=u.next;return o},r.prototype.reduceReverse=function(s,a){var o,u=this.tail;if(arguments.length>1)o=a;else if(this.tail)u=this.tail.prev,o=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=this.length-1;u!==null;l--)o=s(o,u.value,l),u=u.prev;return o},r.prototype.toArray=function(){for(var s=new Array(this.length),a=0,o=this.head;o!==null;a++)s[a]=o.value,o=o.next;return s},r.prototype.toArrayReverse=function(){for(var s=new Array(this.length),a=0,o=this.tail;o!==null;a++)s[a]=o.value,o=o.prev;return s},r.prototype.slice=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var u=0,l=this.head;l!==null&&u<s;u++)l=l.next;for(;l!==null&&u<a;u++,l=l.next)o.push(l.value);return o},r.prototype.sliceReverse=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var u=this.length,l=this.tail;l!==null&&u>a;u--)l=l.prev;for(;l!==null&&u>s;u--,l=l.prev)o.push(l.value);return o},r.prototype.splice=function(s,a,...o){s>this.length&&(s=this.length-1),s<0&&(s=this.length+s);for(var u=0,l=this.head;l!==null&&u<s;u++)l=l.next;for(var c=[],u=0;l&&u<a;u++)c.push(l.value),l=this.removeNode(l);l===null&&(l=this.tail),l!==this.head&&l!==this.tail&&(l=l.prev);for(var u=0;u<o.length;u++)l=e(this,l,o[u]);return c},r.prototype.reverse=function(){for(var s=this.head,a=this.tail,o=s;o!==null;o=o.prev){var u=o.prev;o.prev=o.next,o.next=u}return this.head=a,this.tail=s,this};function e(s,a,o){var u=a===s.head?new i(o,null,a,s):new i(o,a,a.next,s);return u.next===null&&(s.tail=u),u.prev===null&&(s.head=u),s.length++,u}function t(s,a){s.tail=new i(a,s.tail,null,s),s.head||(s.head=s.tail),s.length++}function n(s,a){s.head=new i(a,null,s.head,s),s.tail||(s.tail=s.head),s.length++}function i(s,a,o,u){if(!(this instanceof i))return new i(s,a,o,u);this.list=u,this.value=s,a?(a.next=this,this.prev=a):this.prev=null,o?(o.prev=this,this.next=o):this.next=null}try{Lf()(r)}catch{}return ws}var vs,Vl;function Uc(){if(Vl)return vs;Vl=1;const r=Of(),e=Symbol("max"),t=Symbol("length"),n=Symbol("lengthCalculator"),i=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),u=Symbol("lruList"),l=Symbol("cache"),c=Symbol("updateAgeOnGet"),d=()=>1;class b{constructor(h){if(typeof h=="number"&&(h={max:h}),h||(h={}),h.max&&(typeof h.max!="number"||h.max<0))throw new TypeError("max must be a non-negative number");this[e]=h.max||1/0;const g=h.length||d;if(this[n]=typeof g!="function"?d:g,this[i]=h.stale||!1,h.maxAge&&typeof h.maxAge!="number")throw new TypeError("maxAge must be a number");this[s]=h.maxAge||0,this[a]=h.dispose,this[o]=h.noDisposeOnSet||!1,this[c]=h.updateAgeOnGet||!1,this.reset()}set max(h){if(typeof h!="number"||h<0)throw new TypeError("max must be a non-negative number");this[e]=h||1/0,E(this)}get max(){return this[e]}set allowStale(h){this[i]=!!h}get allowStale(){return this[i]}set maxAge(h){if(typeof h!="number")throw new TypeError("maxAge must be a non-negative number");this[s]=h,E(this)}get maxAge(){return this[s]}set lengthCalculator(h){typeof h!="function"&&(h=d),h!==this[n]&&(this[n]=h,this[t]=0,this[u].forEach(g=>{g.length=this[n](g.value,g.key),this[t]+=g.length})),E(this)}get lengthCalculator(){return this[n]}get length(){return this[t]}get itemCount(){return this[u].length}rforEach(h,g){g=g||this;for(let N=this[u].tail;N!==null;){const C=N.prev;S(this,h,N,g),N=C}}forEach(h,g){g=g||this;for(let N=this[u].head;N!==null;){const C=N.next;S(this,h,N,g),N=C}}keys(){return this[u].toArray().map(h=>h.key)}values(){return this[u].toArray().map(h=>h.value)}reset(){this[a]&&this[u]&&this[u].length&&this[u].forEach(h=>this[a](h.key,h.value)),this[l]=new Map,this[u]=new r,this[t]=0}dump(){return this[u].map(h=>_(this,h)?!1:{k:h.key,v:h.value,e:h.now+(h.maxAge||0)}).toArray().filter(h=>h)}dumpLru(){return this[u]}set(h,g,N){if(N=N||this[s],N&&typeof N!="number")throw new TypeError("maxAge must be a number");const C=N?Date.now():0,A=this[n](g,h);if(this[l].has(h)){if(A>this[e])return v(this,this[l].get(h)),!1;const F=this[l].get(h).value;return this[a]&&(this[o]||this[a](h,F.value)),F.now=C,F.maxAge=N,F.value=g,this[t]+=A-F.length,F.length=A,this.get(h),E(this),!0}const B=new x(h,g,A,C,N);return B.length>this[e]?(this[a]&&this[a](h,g),!1):(this[t]+=B.length,this[u].unshift(B),this[l].set(h,this[u].head),E(this),!0)}has(h){if(!this[l].has(h))return!1;const g=this[l].get(h).value;return!_(this,g)}get(h){return y(this,h,!0)}peek(h){return y(this,h,!1)}pop(){const h=this[u].tail;return h?(v(this,h),h.value):null}del(h){v(this,this[l].get(h))}load(h){this.reset();const g=Date.now();for(let N=h.length-1;N>=0;N--){const C=h[N],A=C.e||0;if(A===0)this.set(C.k,C.v);else{const B=A-g;B>0&&this.set(C.k,C.v,B)}}}prune(){this[l].forEach((h,g)=>y(this,g,!1))}}const y=(m,h,g)=>{const N=m[l].get(h);if(N){const C=N.value;if(_(m,C)){if(v(m,N),!m[i])return}else g&&(m[c]&&(N.value.now=Date.now()),m[u].unshiftNode(N));return C.value}},_=(m,h)=>{if(!h||!h.maxAge&&!m[s])return!1;const g=Date.now()-h.now;return h.maxAge?g>h.maxAge:m[s]&&g>m[s]},E=m=>{if(m[t]>m[e])for(let h=m[u].tail;m[t]>m[e]&&h!==null;){const g=h.prev;v(m,h),h=g}},v=(m,h)=>{if(h){const g=h.value;m[a]&&m[a](g.key,g.value),m[t]-=g.length,m[l].delete(g.key),m[u].removeNode(h)}};class x{constructor(h,g,N,C,A){this.key=h,this.value=g,this.length=N,this.now=C,this.maxAge=A||0}}const S=(m,h,g,N)=>{let C=g.value;_(m,C)&&(v(m,g),m[i]||(C=void 0)),C&&h.call(N,C.value,C.key,m)};return vs=b,vs}var xs,Gl;function Cf(){if(Gl)return xs;Gl=1;const r=Uc(),e=10;return xs=class{constructor({document:n}){this.document=n,this.cache=new r({max:e})}getProcessed(n){return this.cache.get(n)}setProcessed(n,i){this.cache.set(n,i)}},xs}var Es,Wl;function jf(){if(Wl)return Es;Wl=1;const{isArray:r,isObject:e,isString:t}=ut(),{asArray:n}=ht(),{prependBase:i}=Jt(),s=gt(),a=Cf(),o=10;Es=class{constructor({sharedCache:d}){this.perOpCache=new Map,this.sharedCache=d}async resolve({activeCtx:d,context:b,documentLoader:y,base:_,cycles:E=new Set}){b&&e(b)&&b["@context"]&&(b=b["@context"]),b=n(b);const v=[];for(const x of b){if(t(x)){let h=this._get(x);h||(h=await this._resolveRemoteContext({activeCtx:d,url:x,documentLoader:y,base:_,cycles:E})),r(h)?v.push(...h):v.push(h);continue}if(x===null){v.push(new a({document:null}));continue}e(x)||u(b);const S=JSON.stringify(x);let m=this._get(S);m||(m=new a({document:x}),this._cacheResolvedContext({key:S,resolved:m,tag:"static"})),v.push(m)}return v}_get(d){let b=this.perOpCache.get(d);if(!b){const y=this.sharedCache.get(d);y&&(b=y.get("static"),b&&this.perOpCache.set(d,b))}return b}_cacheResolvedContext({key:d,resolved:b,tag:y}){if(this.perOpCache.set(d,b),y!==void 0){let _=this.sharedCache.get(d);_||(_=new Map,this.sharedCache.set(d,_)),_.set(y,b)}return b}async _resolveRemoteContext({activeCtx:d,url:b,documentLoader:y,base:_,cycles:E}){b=i(_,b);const{context:v,remoteDoc:x}=await this._fetchContext({activeCtx:d,url:b,documentLoader:y,cycles:E});_=x.documentUrl||b,l({context:v,base:_});const S=await this.resolve({activeCtx:d,context:v,documentLoader:y,base:_,cycles:E});return this._cacheResolvedContext({key:b,resolved:S,tag:x.tag}),S}async _fetchContext({activeCtx:d,url:b,documentLoader:y,cycles:_}){if(_.size>o)throw new s("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:d.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:o});if(_.has(b))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:d.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:b});_.add(b);let E,v;try{v=await y(b),E=v.document||null,t(E)&&(E=JSON.parse(E))}catch(x){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: "${b}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:b,cause:x})}if(!e(E))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: "${b}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:b});return"@context"in E?E={"@context":E["@context"]}:E={"@context":{}},v.contextUrl&&(r(E["@context"])||(E["@context"]=[E["@context"]]),E["@context"].push(v.contextUrl)),{context:E,remoteDoc:v}}};function u(c){throw new s("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:c})}function l({context:c,base:d}){if(!c)return;const b=c["@context"];if(t(b)){c["@context"]=i(d,b);return}if(r(b)){for(let y=0;y<b.length;++y){const _=b[y];if(t(_)){b[y]=i(d,_);continue}e(_)&&l({context:{"@context":_},base:d})}return}if(e(b))for(const y in b)l({context:b[y],base:d})}return Es}var Ss,zl;function $f(){return zl||(zl=1,Ss=Pa().NQuads),Ss}var Is,Ql;function An(){if(Ql)return Is;Ql=1;const r=gt(),{isArray:e}=ut(),{asArray:t}=ht(),n={};Is=n,n.defaultEventHandler=null,n.setupEventHandler=({options:a={}})=>{const o=[].concat(a.safe?n.safeEventHandler:[],a.eventHandler?t(a.eventHandler):[],n.defaultEventHandler?n.defaultEventHandler:[]);return o.length===0?null:o},n.handleEvent=({event:a,options:o})=>{i({event:a,handlers:o.eventHandler})};function i({event:a,handlers:o}){let u=!0;for(let l=0;u&&l<o.length;++l){u=!1;const c=o[l];if(e(c))u=i({event:a,handlers:c});else if(typeof c=="function")c({event:a,next:()=>{u=!0}});else if(typeof c=="object")a.code in c?c[a.code]({event:a,next:()=>{u=!0}}):u=!0;else throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return u}const 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"]);return n.safeEventHandler=function({event:o,next:u}){if(o.level==="warning"&&s.has(o.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:o});u()},n.logEventHandler=function({event:o,next:u}){console.log(`EVENT: ${o.message}`,{event:o}),u()},n.logWarningEventHandler=function({event:o,next:u}){o.level==="warning"&&console.warn(`WARNING: ${o.message}`,{event:o}),u()},n.unhandledEventHandler=function({event:o}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:o})},n.setDefaultEventHandler=function({eventHandler:a}={}){n.defaultEventHandler=a?t(a):null},Is}var Ns,Xl;function hr(){if(Xl)return Ns;Xl=1;const r=ht(),e=gt(),{isArray:t,isObject:n,isString:i,isUndefined:s}=ut(),{isAbsolute:a,isRelative:o,prependBase:u}=Jt(),{handleEvent:l}=An(),{REGEX_BCP47:c,REGEX_KEYWORD:d,asArray:b,compareShortestLeast:y}=ht(),_=new Map,E=1e4,v={};Ns=v,v.process=async({activeCtx:m,localCtx:h,options:g,propagate:N=!0,overrideProtected:C=!1,cycles:A=new Set})=>{if(n(h)&&"@context"in h&&t(h["@context"])&&(h=h["@context"]),b(h).length===0)return m;const R=[],F=[({event:te,next:T})=>{R.push(te),T()}];g.eventHandler&&F.push(g.eventHandler);const q=g;g={...g,eventHandler:F};const D=await g.contextResolver.resolve({activeCtx:m,context:h,documentLoader:g.documentLoader,base:g.base});n(D[0].document)&&typeof D[0].document["@propagate"]=="boolean"&&(N=D[0].document["@propagate"]);let L=m;!N&&!L.previousContext&&(L=L.clone(),L.previousContext=m);for(const te of D){let{document:T}=te;if(m=L,T===null){if(!C&&Object.keys(m.protected).length!==0)throw new e("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});L=m=v.getInitialContext(g).clone();continue}const Z=te.getProcessed(m);if(Z){if(q.eventHandler)for(const Y of Z.events)l({event:Y,options:q});L=m=Z.context;continue}if(n(T)&&"@context"in T&&(T=T["@context"]),!n(T))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:T});L=L.clone();const k=new Map;if("@version"in T){if(T["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+T["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:T});if(m.processingMode&&m.processingMode==="json-ld-1.0")throw new e("@version: "+T["@version"]+" not compatible with "+m.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:T});L.processingMode="json-ld-1.1",L["@version"]=T["@version"],k.set("@version",!0)}if(L.processingMode=L.processingMode||m.processingMode,"@base"in T){let Y=T["@base"];if(!(Y===null||a(Y)))if(o(Y))Y=u(L["@base"],Y);else throw new e('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:T});L["@base"]=Y,k.set("@base",!0)}if("@vocab"in T){const Y=T["@vocab"];if(Y===null)delete L["@vocab"];else if(i(Y)){if(!a(Y)&&v.processingMode(L,1))throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:T});{const w=x(L,Y,{vocab:!0,base:!0},void 0,void 0,g);a(w)||g.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:w}},options:g}),L["@vocab"]=w}}else throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:T});k.set("@vocab",!0)}if("@language"in T){const Y=T["@language"];if(Y===null)delete L["@language"];else if(i(Y))Y.match(c)||g.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:g}),L["@language"]=Y.toLowerCase();else throw new e('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:T});k.set("@language",!0)}if("@direction"in T){const Y=T["@direction"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:T});if(Y===null)delete L["@direction"];else{if(Y!=="ltr"&&Y!=="rtl")throw new e('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:T});L["@direction"]=Y}k.set("@direction",!0)}if("@propagate"in T){const Y=T["@propagate"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(typeof Y!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:h});k.set("@propagate",!0)}if("@import"in T){const Y=T["@import"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(!i(Y))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:h});const w=await g.contextResolver.resolve({activeCtx:m,context:Y,documentLoader:g.documentLoader,base:g.base});if(w.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:h});const H=w[0].getProcessed(m);if(H)T=H;else{const K=w[0].document;if("@import"in K)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:h});for(const Q in K)T.hasOwnProperty(Q)||(T[Q]=K[Q]);w[0].setProcessed(m,T)}k.set("@import",!0)}k.set("@protected",T["@protected"]||!1);for(const Y in T)if(v.createTermDefinition({activeCtx:L,localCtx:T,term:Y,defined:k,options:g,overrideProtected:C}),n(T[Y])&&"@context"in T[Y]){const w=T[Y]["@context"];let H=!0;if(i(w)){const K=u(g.base,w);A.has(K)?H=!1:A.add(K)}if(H)try{await v.process({activeCtx:L.clone(),localCtx:T[Y]["@context"],overrideProtected:!0,options:g,cycles:A})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:T[Y]["@context"],term:Y})}}te.setProcessed(m,{context:L,events:R})}return L},v.createTermDefinition=({activeCtx:m,localCtx:h,term:g,defined:N,options:C,overrideProtected:A=!1})=>{if(N.has(g)){if(N.get(g))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:h,term:g})}N.set(g,!1);let B;if(h.hasOwnProperty(g)&&(B=h[g]),g==="@type"&&n(B)&&(B["@container"]||"@set")==="@set"&&v.processingMode(m,1.1)){const T=["@container","@id","@protected"],Z=Object.keys(B);if(Z.length===0||Z.some(k=>!T.includes(k)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:h,term:g})}else{if(v.isKeyword(g))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:h,term:g});if(g.match(d)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:g}},options:C});return}else if(g==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:h})}const R=m.mappings.get(g);m.mappings.has(g)&&m.mappings.delete(g);let F=!1;if((i(B)||B===null)&&(F=!0,B={"@id":B}),!n(B))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:h});const q={};m.mappings.set(g,q),q.reverse=!1;const D=["@container","@id","@language","@reverse","@type"];v.processingMode(m,1.1)&&D.push("@context","@direction","@index","@nest","@prefix","@protected");for(const T in B)if(!D.includes(T))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+T,"jsonld.SyntaxError",{code:"invalid term definition",context:h});const L=g.indexOf(":");if(q._termHasColon=L>0,"@reverse"in B){if("@id"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:h});if("@nest"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:h});const T=B["@reverse"];if(!i(T))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h});if(T.match(d)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:T}},options:C}),R?m.mappings.set(g,R):m.mappings.delete(g);return}const Z=x(m,T,{vocab:!0,base:!1},h,N,C);if(!a(Z))throw new e("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:h});q["@id"]=Z,q.reverse=!0}else if("@id"in B){let T=B["@id"];if(T&&!i(T))throw new e("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h});if(T===null)q["@id"]=null;else if(!v.isKeyword(T)&&T.match(d)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:T}},options:C}),R?m.mappings.set(g,R):m.mappings.delete(g);return}else if(T!==g){if(T=x(m,T,{vocab:!0,base:!1},h,N,C),!a(T)&&!v.isKeyword(T))throw new e("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:h});if(g.match(/(?::[^:])|\//)){const Z=new Map(N).set(g,!0);if(x(m,g,{vocab:!0,base:!1},h,Z,C)!==T)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h})}q["@id"]=T,q._prefix=F&&!q._termHasColon&&T.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in q))if(q._termHasColon){const T=g.substr(0,L);if(h.hasOwnProperty(T)&&v.createTermDefinition({activeCtx:m,localCtx:h,term:T,defined:N,options:C}),m.mappings.has(T)){const Z=g.substr(L+1);q["@id"]=m.mappings.get(T)["@id"]+Z}else q["@id"]=g}else if(g==="@type")q["@id"]=g;else{if(!("@vocab"in m))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h,term:g});q["@id"]=m["@vocab"]+g}if((B["@protected"]===!0||N.get("@protected")===!0&&B["@protected"]!==!1)&&(m.protected[g]=!0,q.protected=!0),N.set(g,!0),"@type"in B){let T=B["@type"];if(!i(T))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:h});if(T==="@json"||T==="@none"){if(v.processingMode(m,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${T}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:h})}else if(T!=="@id"&&T!=="@vocab"){if(T=x(m,T,{vocab:!0,base:!1},h,N,C),!a(T))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:h});if(T.indexOf("_:")===0)throw new e("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:h})}q["@type"]=T}if("@container"in B){const T=i(B["@container"])?[B["@container"]]:B["@container"]||[],Z=["@list","@set","@index","@language"];let k=!0;const Y=T.includes("@set");if(v.processingMode(m,1.1)){if(Z.push("@graph","@id","@type"),T.includes("@list")){if(T.length!==1)throw new e("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:h})}else if(T.includes("@graph")){if(T.some(w=>w!=="@graph"&&w!=="@id"&&w!=="@index"&&w!=="@set"))throw new e("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:h})}else k&=T.length<=(Y?2:1);if(T.includes("@type")&&(q["@type"]=q["@type"]||"@id",!["@id","@vocab"].includes(q["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:h})}else k&=!t(B["@container"]),k&=T.length<=1;if(k&=T.every(w=>Z.includes(w)),k&=!(Y&&T.includes("@list")),!k)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+Z.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:h});if(q.reverse&&!T.every(w=>["@index","@set"].includes(w)))throw new e("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:h});q["@container"]=T}if("@index"in B){if(!("@container"in B)||!q["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${B["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:h});if(!i(B["@index"])||B["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${B["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:h});q["@index"]=B["@index"]}if("@context"in B&&(q["@context"]=B["@context"]),"@language"in B&&!("@type"in B)){let T=B["@language"];if(T!==null&&!i(T))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:h});T!==null&&(T=T.toLowerCase()),q["@language"]=T}if("@prefix"in B){if(g.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:h});if(v.isKeyword(q["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:h});if(typeof B["@prefix"]=="boolean")q._prefix=B["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:h})}if("@direction"in B){const T=B["@direction"];if(T!==null&&T!=="ltr"&&T!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:h});q["@direction"]=T}if("@nest"in B){const T=B["@nest"];if(!i(T)||T!=="@nest"&&T.indexOf("@")===0)throw new e("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:h});q["@nest"]=T}// disallow aliasing @context and @preserve
346
- const te=q["@id"];if(te==="@context"||te==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:h});if(R&&R.protected&&!A&&(m.protected[g]=!0,q.protected=!0,!S(R,q)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:h,term:g})},v.expandIri=(m,h,g,N)=>x(m,h,g,void 0,void 0,N);function x(m,h,g,N,C,A){if(h===null||!i(h)||v.isKeyword(h))return h;if(h.match(d))return null;if(N&&N.hasOwnProperty(h)&&C.get(h)!==!0&&v.createTermDefinition({activeCtx:m,localCtx:N,term:h,defined:C,options:A}),g=g||{},g.vocab){const R=m.mappings.get(h);if(R===null)return null;if(n(R)&&"@id"in R)return R["@id"]}const B=h.indexOf(":");if(B>0){const R=h.substr(0,B),F=h.substr(B+1);if(R==="_"||F.indexOf("//")===0)return h;N&&N.hasOwnProperty(R)&&v.createTermDefinition({activeCtx:m,localCtx:N,term:R,defined:C,options:A});const q=m.mappings.get(R);if(q&&q._prefix)return q["@id"]+F;if(a(h))return h}if(g.vocab&&"@vocab"in m)h=m["@vocab"]+h;else if(g.base){let R,F;"@base"in m?m["@base"]?(F=u(A.base,m["@base"]),R=u(F,h)):(F=m["@base"],R=h):(F=A.base,R=u(A.base,h)),h=R}return h}v.getInitialContext=m=>{const h=JSON.stringify({processingMode:m.processingMode}),g=_.get(h);if(g)return g;const N={processingMode:m.processingMode,mappings:new Map,inverse:null,getInverse:C,clone:R,revertToPreviousContext:F,protected:{}};return _.size===E&&_.clear(),_.set(h,N),N;function C(){const q=this;if(q.inverse)return q.inverse;const D=q.inverse={},L=q.fastCurieMap={},te={},T=(q["@language"]||"@none").toLowerCase(),Z=q["@direction"],k=q.mappings,Y=[...k.keys()].sort(y);for(const w of Y){const H=k.get(w);if(H===null)continue;let K=H["@container"]||"@none";if(K=[].concat(K).sort().join(""),H["@id"]===null)continue;const Q=b(H["@id"]);for(const ue of Q){let V=D[ue];const G=v.isKeyword(ue);if(V)!G&&!H._termHasColon&&te[ue].push(w);else if(D[ue]=V={},!G&&!H._termHasColon){te[ue]=[w];const z={iri:ue,terms:te[ue]};ue[0]in L?L[ue[0]].push(z):L[ue[0]]=[z]}if(V[K]||(V[K]={"@language":{},"@type":{},"@any":{}}),V=V[K],B(w,V["@any"],"@none"),H.reverse)B(w,V["@type"],"@reverse");else if(H["@type"]==="@none")B(w,V["@any"],"@none"),B(w,V["@language"],"@none"),B(w,V["@type"],"@none");else if("@type"in H)B(w,V["@type"],H["@type"]);else if("@language"in H&&"@direction"in H){const z=H["@language"],U=H["@direction"];z&&U?B(w,V["@language"],`${z}_${U}`.toLowerCase()):z?B(w,V["@language"],z.toLowerCase()):U?B(w,V["@language"],`_${U}`):B(w,V["@language"],"@null")}else"@language"in H?B(w,V["@language"],(H["@language"]||"@null").toLowerCase()):"@direction"in H?H["@direction"]?B(w,V["@language"],`_${H["@direction"]}`):B(w,V["@language"],"@none"):Z?(B(w,V["@language"],`_${Z}`),B(w,V["@language"],"@none"),B(w,V["@type"],"@none")):(B(w,V["@language"],T),B(w,V["@language"],"@none"),B(w,V["@type"],"@none"))}}for(const w in L)A(L,w,1);return D}function A(q,D,L){const te=q[D],T=q[D]={};let Z,k;for(const Y of te)Z=Y.iri,L>=Z.length?k="":k=Z[L],k in T?T[k].push(Y):T[k]=[Y];for(const Y in T)Y!==""&&A(T,Y,L+1)}function B(q,D,L){D.hasOwnProperty(L)||(D[L]=q)}function R(){const q={};return q.mappings=r.clone(this.mappings),q.clone=this.clone,q.inverse=null,q.getInverse=this.getInverse,q.protected=r.clone(this.protected),this.previousContext&&(q.previousContext=this.previousContext.clone()),q.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(q["@base"]=this["@base"]),"@language"in this&&(q["@language"]=this["@language"]),"@vocab"in this&&(q["@vocab"]=this["@vocab"]),q}function F(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(m,h,g)=>{if(h===null)return g==="@context"?void 0:null;if(m.mappings.has(h)){const N=m.mappings.get(h);if(s(g))return N;if(N.hasOwnProperty(g))return N[g]}if(g==="@language"&&g in m||g==="@direction"&&g in m)return m[g];if(g!=="@context")return null},v.processingMode=(m,h)=>h.toString()>="1.1"?!m.processingMode||m.processingMode>="json-ld-"+h.toString():m.processingMode==="json-ld-1.0",v.isKeyword=m=>{if(!i(m)||m[0]!=="@")return!1;switch(m){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 S(m,h){if(!(m&&typeof m=="object")||!(h&&typeof h=="object"))return m===h;const g=Array.isArray(m);if(g!==Array.isArray(h))return!1;if(g){if(m.length!==h.length)return!1;for(let A=0;A<m.length;++A)if(!S(m[A],h[A]))return!1;return!0}const N=Object.keys(m),C=Object.keys(h);if(N.length!==C.length)return!1;for(const A in m){let B=m[A],R=h[A];if(A==="@container"&&Array.isArray(B)&&Array.isArray(R)&&(B=B.slice().sort(),R=R.slice().sort()),!S(B,R))return!1}return!0}return Ns}var Rs,Jl;function Ff(){if(Jl)return Rs;Jl=1;const r=gt(),{isArray:e,isObject:t,isEmptyObject:n,isString:i,isUndefined:s}=ut(),{isList:a,isValue:o,isGraph:u,isSubject:l}=kt(),{expandIri:c,getContextValue:d,isKeyword:b,process:y,processingMode:_}=hr(),{isAbsolute:E}=Jt(),{REGEX_BCP47:v,REGEX_KEYWORD:x,addValue:S,asArray:m,getValues:h,validateTypeValue:g}=ht(),{handleEvent:N}=An(),C={};Rs=C,C.expand=async({activeCtx:D,activeProperty:L=null,element:te,options:T={},insideList:Z=!1,insideIndex:k=!1,typeScopedContext:Y=null})=>{if(te==null)return null;if(L==="@default"&&(T=Object.assign({},T,{isFrame:!1})),!e(te)&&!t(te))return!Z&&(L===null||c(D,L,{vocab:!0},T)==="@graph")?(T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:te}},options:T}),null):R({activeCtx:D,activeProperty:L,value:te,options:T});if(e(te)){let z=[];const U=d(D,L,"@container")||[];Z=Z||U.includes("@list");for(let ee=0;ee<te.length;++ee){let re=await C.expand({activeCtx:D,activeProperty:L,element:te[ee],options:T,insideIndex:k,typeScopedContext:Y});Z&&e(re)&&(re={"@list":re}),re!==null&&(e(re)?z=z.concat(re):z.push(re))}return z}const w=c(D,L,{vocab:!0},T),H=d(D,L,"@context");Y=Y||(D.previousContext?D:null);let K=Object.keys(te).sort(),Q=!k;if(Q&&Y&&K.length<=2&&!K.includes("@context"))for(const z of K){const U=c(Y,z,{vocab:!0},T);if(U==="@value"){Q=!1,D=Y;break}if(U==="@id"&&K.length===1){Q=!1;break}}Q&&(D=D.revertToPreviousContext()),s(H)||(D=await y({activeCtx:D,localCtx:H,propagate:!0,overrideProtected:!0,options:T})),"@context"in te&&(D=await y({activeCtx:D,localCtx:te["@context"],options:T})),Y=D;let ue=null;for(const z of K)if(c(D,z,{vocab:!0},T)==="@type"){ue=ue||z;const ee=te[z],re=Array.isArray(ee)?ee.length>1?ee.slice().sort():ee:[ee];for(const fe of re){const ge=d(Y,fe,"@context");s(ge)||(D=await y({activeCtx:D,localCtx:ge,options:T,propagate:!1}))}}let V={};await B({activeCtx:D,activeProperty:L,expandedActiveProperty:w,element:te,expandedParent:V,options:T,insideList:Z,typeKey:ue,typeScopedContext:Y}),K=Object.keys(V);let G=K.length;if("@value"in V){if("@type"in V&&("@language"in V||"@direction"in V))throw new r('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:V});let z=G-1;if("@type"in V&&(z-=1),"@index"in V&&(z-=1),"@language"in V&&(z-=1),"@direction"in V&&(z-=1),z!==0)throw new r('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:V});const U=V["@value"]===null?[]:m(V["@value"]),ee=h(V,"@type");if(!(_(D,1.1)&&ee.includes("@json")&&ee.length===1))if(U.length===0)T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:V}},options:T}),V=null;else{if(!U.every(re=>i(re)||n(re))&&"@language"in V)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:V});if(!ee.every(re=>E(re)&&!(i(re)&&re.indexOf("_:")===0)||n(re)))throw new r('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:V})}}else if("@type"in V&&!e(V["@type"]))V["@type"]=[V["@type"]];else if("@set"in V||"@list"in V){if(G>1&&!(G===2&&"@index"in V))throw new r('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:V});"@set"in V&&(V=V["@set"],K=Object.keys(V),G=K.length)}else G===1&&"@language"in V&&(T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:V}},options:T}),V=null);return t(V)&&!T.keepFreeFloatingNodes&&!Z&&(L===null||w==="@graph"||(d(D,L,"@container")||[]).includes("@graph"))&&(V=A({value:V,count:G,options:T})),V};function A({value:D,count:L,options:te}){if(L===0||"@value"in D||"@list"in D||L===1&&"@id"in D){if(te.eventHandler){let T,Z;L===0?(T="empty object",Z="Dropping empty object."):"@value"in D?(T="object with only @value",Z="Dropping object with only @value."):"@list"in D?(T="object with only @list",Z="Dropping object with only @list."):L===1&&"@id"in D&&(T="object with only @id",Z="Dropping object with only @id."),N({event:{type:["JsonLdEvent"],code:T,level:"warning",message:Z,details:{value:D}},options:te})}return null}return D}async function B({activeCtx:D,activeProperty:L,expandedActiveProperty:te,element:T,expandedParent:Z,options:k={},insideList:Y,typeKey:w,typeScopedContext:H}){const K=Object.keys(T).sort(),Q=[];let ue;const V=T[w]&&c(D,e(T[w])?T[w][0]:T[w],{vocab:!0},{...k,typeExpansion:!0})==="@json";for(const G of K){let z=T[G],U;if(G==="@context")continue;const ee=c(D,G,{vocab:!0},k);if(ee===null||!(E(ee)||b(ee))){k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:G,expandedProperty:ee}},options:k});continue}if(b(ee)){if(te==="@reverse")throw new r("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:z});if(ee in Z&&ee!=="@included"&&ee!=="@type")throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:ee})}if(ee==="@id"){if(!i(z)){if(!k.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:z});if(t(z)){if(!n(z))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}else if(e(z)){if(!z.every(j=>i(j)))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}else throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}S(Z,"@id",m(z).map(j=>{if(i(j)){const W=c(D,j,{base:!0},k);return k.eventHandler&&(W===null?N(j===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:j}},options:k}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:k}):E(W)||N({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:j,expandedId:W}},options:k})),W}return j}),{propertyIsArray:k.isFrame});continue}if(ee==="@type"){t(z)&&(z=Object.fromEntries(Object.entries(z).map(([j,W])=>[c(H,j,{vocab:!0}),m(W).map(se=>c(H,se,{base:!0,vocab:!0},{...k,typeExpansion:!0}))]))),g(z,k.isFrame),S(Z,"@type",m(z).map(j=>{if(i(j)){const W=c(H,j,{base:!0,vocab:!0},{...k,typeExpansion:!0});return W!=="@json"&&!E(W)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:j}},options:k}),W}return j}),{propertyIsArray:!!k.isFrame});continue}if(ee==="@included"&&_(D,1.1)){const j=m(await C.expand({activeCtx:D,activeProperty:L,element:z,options:k}));if(!j.every(W=>l(W)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:z});S(Z,"@included",j,{propertyIsArray:!0});continue}if(ee==="@graph"&&!(t(z)||e(z)))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:z});if(ee==="@value"){ue=z,V&&_(D,1.1)?Z["@value"]=z:S(Z,"@value",z,{propertyIsArray:k.isFrame});continue}if(ee==="@language"){if(z===null)continue;if(!i(z)&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:z});z=m(z).map(j=>i(j)?j.toLowerCase():j);for(const j of z)i(j)&&!j.match(v)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:j}},options:k});S(Z,"@language",z,{propertyIsArray:k.isFrame});continue}if(ee==="@direction"){if(!i(z)&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:z});z=m(z);for(const j of z)if(i(j)&&j!=="ltr"&&j!=="rtl")throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:z});S(Z,"@direction",z,{propertyIsArray:k.isFrame});continue}if(ee==="@index"){if(!i(z))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:z});S(Z,"@index",z);continue}if(ee==="@reverse"){if(!t(z))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:z});if(U=await C.expand({activeCtx:D,activeProperty:"@reverse",element:z,options:k}),"@reverse"in U)for(const W in U["@reverse"])S(Z,W,U["@reverse"][W],{propertyIsArray:!0});let j=Z["@reverse"]||null;for(const W in U){if(W==="@reverse")continue;j===null&&(j=Z["@reverse"]={}),S(j,W,[],{propertyIsArray:!0});const se=U[W];for(let he=0;he<se.length;++he){const pe=se[he];if(o(pe)||a(pe))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:U});S(j,W,pe,{propertyIsArray:!0})}}continue}if(ee==="@nest"){Q.push(G);continue}let re=D;const fe=d(D,G,"@context");s(fe)||(re=await y({activeCtx:D,localCtx:fe,propagate:!0,overrideProtected:!0,options:k}));const ge=d(D,G,"@container")||[];if(ge.includes("@language")&&t(z)){const j=d(re,G,"@direction");U=F(re,z,j,k)}else if(ge.includes("@index")&&t(z)){const j=ge.includes("@graph"),W=d(re,G,"@index")||"@index",se=W!=="@index"&&c(D,W,{vocab:!0},k);U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:j,indexKey:W,propertyIndex:se})}else if(ge.includes("@id")&&t(z)){const j=ge.includes("@graph");U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:j,indexKey:"@id"})}else if(ge.includes("@type")&&t(z))U=await q({activeCtx:re.revertToPreviousContext(),options:k,activeProperty:G,value:z,asGraph:!1,indexKey:"@type"});else{const j=ee==="@list";if(j||ee==="@set"){let W=L;j&&te==="@graph"&&(W=null),U=await C.expand({activeCtx:re,activeProperty:W,element:z,options:k,insideList:j})}else d(D,G,"@type")==="@json"?U={"@type":"@json","@value":z}:U=await C.expand({activeCtx:re,activeProperty:G,element:z,options:k,insideList:!1})}if(!(U===null&&ee!=="@value")){if(ee!=="@list"&&!a(U)&&ge.includes("@list")&&(U={"@list":m(U)}),ge.includes("@graph")&&!ge.some(j=>j==="@id"||j==="@index")){if(U=m(U),k.isFrame||(U=U.filter(j=>{const W=Object.keys(j).length;return A({value:j,count:W,options:k})!==null})),U.length===0)continue;U=U.map(j=>({"@graph":m(j)}))}if(re.mappings.has(G)&&re.mappings.get(G).reverse){const j=Z["@reverse"]=Z["@reverse"]||{};U=m(U);for(let W=0;W<U.length;++W){const se=U[W];if(o(se)||a(se))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:U});S(j,ee,se,{propertyIsArray:!0})}continue}S(Z,ee,U,{propertyIsArray:!0})}}if("@value"in Z&&!(Z["@type"]==="@json"&&_(D,1.1))){if((t(ue)||e(ue))&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:ue})}for(const G of Q){const z=e(T[G])?T[G]:[T[G]];for(const U of z){if(!t(U)||Object.keys(U).some(ee=>c(D,ee,{vocab:!0},k)==="@value"))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:U});await B({activeCtx:D,activeProperty:L,expandedActiveProperty:te,element:U,expandedParent:Z,options:k,insideList:Y,typeScopedContext:H,typeKey:w})}}}function R({activeCtx:D,activeProperty:L,value:te,options:T}){if(te==null)return null;const Z=c(D,L,{vocab:!0},T);if(Z==="@id")return c(D,te,{base:!0},T);if(Z==="@type")return c(D,te,{vocab:!0,base:!0},{...T,typeExpansion:!0});const k=d(D,L,"@type");if((k==="@id"||Z==="@graph")&&i(te)){const w=c(D,te,{base:!0},T);return w===null&&te.match(x)&&T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:L}},options:T}),{"@id":w}}if(k==="@vocab"&&i(te))return{"@id":c(D,te,{vocab:!0,base:!0},T)};if(b(Z))return te;const Y={};if(k&&!["@id","@vocab","@none"].includes(k))Y["@type"]=k;else if(i(te)){const w=d(D,L,"@language");w!==null&&(Y["@language"]=w);const H=d(D,L,"@direction");H!==null&&(Y["@direction"]=H)}return["boolean","number","string"].includes(typeof te)||(te=te.toString()),Y["@value"]=te,Y}function F(D,L,te,T){const Z=[],k=Object.keys(L).sort();for(const Y of k){const w=c(D,Y,{vocab:!0},T);let H=L[Y];e(H)||(H=[H]);for(const K of H){if(K===null)continue;if(!i(K))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:L});const Q={"@value":K};w!=="@none"&&(Y.match(v)||T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:T}),Q["@language"]=Y.toLowerCase()),te&&(Q["@direction"]=te),Z.push(Q)}}return Z}async function q({activeCtx:D,options:L,activeProperty:te,value:T,asGraph:Z,indexKey:k,propertyIndex:Y}){const w=[],H=Object.keys(T).sort(),K=k==="@type";for(let Q of H){if(K){const G=d(D,Q,"@context");s(G)||(D=await y({activeCtx:D,localCtx:G,propagate:!1,options:L}))}let ue=T[Q];e(ue)||(ue=[ue]),ue=await C.expand({activeCtx:D,activeProperty:te,element:ue,options:L,insideList:!1,insideIndex:!0});let V;Y?Q==="@none"?V="@none":V=R({activeCtx:D,activeProperty:k,value:Q,options:L}):V=c(D,Q,{vocab:!0},L),k==="@id"?Q=c(D,Q,{base:!0},L):K&&(Q=V);for(let G of ue){if(Z&&!u(G)&&(G={"@graph":[G]}),k==="@type")V==="@none"||(G["@type"]?G["@type"]=[Q].concat(G["@type"]):G["@type"]=[Q]);else{if(o(G)&&!["@language","@type","@index"].includes(k))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${k}".`,"jsonld.SyntaxError",{code:"invalid value object",value:G});Y?V!=="@none"&&S(G,Y,V,{propertyIsArray:!0,prependValue:!0}):V!=="@none"&&!(k in G)&&(G[k]=Q)}w.push(G)}}return w}return Rs}var Ts,Kl;function gi(){if(Kl)return Ts;Kl=1;const{isKeyword:r}=hr(),e=kt(),t=ut(),n=ht(),i=gt(),s={};return Ts=s,s.createMergedNodeMap=(a,o)=>{o=o||{};const u=o.issuer||new n.IdentifierIssuer("_:b"),l={"@default":{}};return s.createNodeMap(a,l,"@default",u),s.mergeNodeMaps(l)},s.createNodeMap=(a,o,u,l,c,d)=>{if(t.isArray(a)){for(const E of a)s.createNodeMap(E,o,u,l,void 0,d);return}if(!t.isObject(a)){d&&d.push(a);return}if(e.isValue(a)){if("@type"in a){let E=a["@type"];E.indexOf("_:")===0&&(a["@type"]=E=l.getId(E))}d&&d.push(a);return}else if(d&&e.isList(a)){const E=[];s.createNodeMap(a["@list"],o,u,l,c,E),d.push({"@list":E});return}if("@type"in a){const E=a["@type"];for(const v of E)v.indexOf("_:")===0&&l.getId(v)}t.isUndefined(c)&&(c=e.isBlankNode(a)?l.getId(a["@id"]):a["@id"]),d&&d.push({"@id":c});const b=o[u],y=b[c]=b[c]||{};y["@id"]=c;const _=Object.keys(a).sort();for(let E of _){if(E==="@id")continue;if(E==="@reverse"){const x={"@id":c},S=a["@reverse"];for(const m in S){const h=S[m];for(const g of h){let N=g["@id"];e.isBlankNode(g)&&(N=l.getId(N)),s.createNodeMap(g,o,u,l,N),n.addValue(b[N],m,x,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(E==="@graph"){c in o||(o[c]={}),s.createNodeMap(a[E],o,c,l);continue}if(E==="@included"){s.createNodeMap(a[E],o,u,l);continue}if(E!=="@type"&&r(E)){if(E==="@index"&&E in y&&(a[E]!==y[E]||a[E]["@id"]!==y[E]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:y});y[E]=a[E];continue}const v=a[E];if(E.indexOf("_:")===0&&(E=l.getId(E)),v.length===0){n.addValue(y,E,[],{propertyIsArray:!0});continue}for(let x of v)if(E==="@type"&&(x=x.indexOf("_:")===0?l.getId(x):x),e.isSubject(x)||e.isSubjectReference(x)){if("@id"in x&&!x["@id"])continue;const S=e.isBlankNode(x)?l.getId(x["@id"]):x["@id"];n.addValue(y,E,{"@id":S},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(x,o,u,l,S)}else if(e.isValue(x))n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(x)){const S=[];s.createNodeMap(x["@list"],o,u,l,c,S),x={"@list":S},n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(x,o,u,l,c),n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=a=>{const o={};for(const u of Object.keys(a).sort())for(const l of Object.keys(a[u]).sort()){const c=a[u][l];l in o||(o[l]={"@id":l});const d=o[l];for(const b of Object.keys(c).sort())if(r(b)&&b!=="@type")d[b]=n.clone(c[b]);else for(const y of c[b])n.addValue(d,b,n.clone(y),{propertyIsArray:!0,allowDuplicate:!1})}return o},s.mergeNodeMaps=a=>{const o=a["@default"],u=Object.keys(a).sort();for(const l of u){if(l==="@default")continue;const c=a[l];let d=o[l];d?"@graph"in d||(d["@graph"]=[]):o[l]=d={"@id":l,"@graph":[]};const b=d["@graph"];for(const y of Object.keys(c).sort()){const _=c[y];e.isSubjectReference(_)||b.push(_)}}return o},Ts}var As,Yl;function kf(){if(Yl)return As;Yl=1;const{isSubjectReference:r}=kt(),{createMergedNodeMap:e}=gi(),t={};return As=t,t.flatten=n=>{const i=e(n),s=[],a=Object.keys(i).sort();for(let o=0;o<a.length;++o){const u=i[a[o]];r(u)||s.push(u)}return s},As}var Ds,Zl;function Pf(){if(Zl)return Ds;Zl=1;const r=gt(),e=kt(),t=ut(),{REGEX_BCP47:n,addValue:i}=ht(),{handleEvent:s}=An(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:u,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:d,XSD_BOOLEAN:b,XSD_DOUBLE:y,XSD_INTEGER:_,XSD_STRING:E}=Ma(),v={};Ds=v,v.fromRDF=async(S,m)=>{const{useRdfType:h=!1,useNativeTypes:g=!1,rdfDirection:N=null}=m,C={},A={"@default":C},B={};if(N){if(N==="compound-literal")throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:N});if(N!=="i18n-datatype")throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:N})}for(const q of S){const D=q.graph.termType==="DefaultGraph"?"@default":q.graph.value;D in A||(A[D]={}),D!=="@default"&&!(D in C)&&(C[D]={"@id":D});const L=A[D],te=q.subject.value,T=q.predicate.value,Z=q.object;te in L||(L[te]={"@id":te});const k=L[te],Y=Z.termType.endsWith("Node");if(Y&&!(Z.value in L)&&(L[Z.value]={"@id":Z.value}),T===c&&!h&&Y){i(k,"@type",Z.value,{propertyIsArray:!0});continue}const w=x(Z,g,N,m);if(i(k,T,w,{propertyIsArray:!0}),Y)if(Z.value===l){const H=L[Z.value];"usages"in H||(H.usages=[]),H.usages.push({node:k,property:T,value:w})}else Z.value in B?B[Z.value]=!1:B[Z.value]={node:k,property:T,value:w}}for(const q in A){const D=A[q];if(!(l in D))continue;const L=D[l];if(L.usages){for(let te of L.usages){let T=te.node,Z=te.property,k=te.value;const Y=[],w=[];let H=Object.keys(T).length;for(;Z===u&&t.isObject(B[T["@id"]])&&t.isArray(T[o])&&T[o].length===1&&t.isArray(T[u])&&T[u].length===1&&(H===3||H===4&&t.isArray(T["@type"])&&T["@type"].length===1&&T["@type"][0]===a)&&(Y.push(T[o][0]),w.push(T["@id"]),te=B[T["@id"]],T=te.node,Z=te.property,k=te.value,H=Object.keys(T).length,!!e.isBlankNode(T)););delete k["@id"],k["@list"]=Y.reverse();for(const K of w)delete D[K]}delete L.usages}}const R=[],F=Object.keys(C).sort();for(const q of F){const D=C[q];if(q in A){const L=D["@graph"]=[],te=A[q],T=Object.keys(te).sort();for(const Z of T){const k=te[Z];e.isSubjectReference(k)||L.push(k)}}e.isSubjectReference(D)||R.push(D)}return R};function x(S,m,h,g){if(S.termType.endsWith("Node"))return{"@id":S.value};const N={"@value":S.value};if(S.language)S.language.match(n)||g.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:S.language}},options:g}),N["@language"]=S.language;else{let C=S.datatype.value;if(C||(C=E),C===d){C="@json";try{N["@value"]=JSON.parse(N["@value"])}catch(A){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:N["@value"],cause:A})}}if(m){if(C===b)N["@value"]==="true"?N["@value"]=!0:N["@value"]==="false"&&(N["@value"]=!1);else if(t.isNumeric(N["@value"]))if(C===_){const A=parseInt(N["@value"],10);A.toFixed(0)===N["@value"]&&(N["@value"]=A)}else C===y&&(N["@value"]=parseFloat(N["@value"]));[b,_,y,E].includes(C)||(N["@type"]=C)}else if(h==="i18n-datatype"&&C.startsWith("https://www.w3.org/ns/i18n#")){const[,A,B]=C.split(/[#_]/);A.length>0&&(N["@language"]=A,A.match(n)||g.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:A}},options:g})),N["@direction"]=B}else C!==E&&(N["@type"]=C)}return N}return Ds}var Ls,eu;function Mf(){return eu||(eu=1,Ls=function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,n,i)=>{const s=i===0?"":",",a=n===void 0||typeof n=="symbol"?null:n;return t+s+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,n,i)=>{if(e[n]===void 0||typeof e[n]=="symbol")return t;const s=t.length===0?"":",";return t+s+r(n)+":"+r(e[n])},"")+"}"}),Ls}var Os,tu;function Bf(){if(tu)return Os;tu=1;const{createNodeMap:r}=gi(),{isKeyword:e}=hr(),t=kt(),n=Mf(),i=gt(),s=ut(),a=ht(),{handleEvent:o}=An(),{RDF_FIRST:u,RDF_REST:l,RDF_NIL:c,RDF_TYPE:d,RDF_JSON_LITERAL:b,RDF_LANGSTRING:y,XSD_BOOLEAN:_,XSD_DOUBLE:E,XSD_INTEGER:v,XSD_STRING:x}=Ma(),{isAbsolute:S}=Jt(),m={};Os=m,m.toRDF=(C,A)=>{const B=new a.IdentifierIssuer("_:b"),R={"@default":{}};r(C,R,"@default",B);const F=[],q=Object.keys(R).sort();for(const D of q){let L;if(D==="@default")L={termType:"DefaultGraph",value:""};else if(S(D))D.startsWith("_:")?L={termType:"BlankNode"}:L={termType:"NamedNode"},L.value=D;else{A.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:D}},options:A});continue}h(F,R[D],L,B,A)}return F};function h(C,A,B,R,F){const q=Object.keys(A).sort();for(const D of q){const L=A[D],te=Object.keys(L).sort();for(let T of te){const Z=L[T];if(T==="@type")T=d;else if(e(T))continue;for(const k of Z){const Y={termType:D.startsWith("_:")?"BlankNode":"NamedNode",value:D};if(!S(D)){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:D}},options:F});continue}const w={termType:T.startsWith("_:")?"BlankNode":"NamedNode",value:T};if(!S(T)){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:T}},options:F});continue}if(w.termType==="BlankNode"&&!F.produceGeneralizedRdf){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:R.getOldIds().find(K=>R.getId(K)===T)}},options:F});continue}const H=N(k,R,C,B,F.rdfDirection,F);H&&C.push({subject:Y,predicate:w,object:H,graph:B})}}}}function g(C,A,B,R,F,q){const D={termType:"NamedNode",value:u},L={termType:"NamedNode",value:l},te={termType:"NamedNode",value:c},T=C.pop(),Z=T?{termType:"BlankNode",value:A.getId()}:te;let k=Z;for(const Y of C){const w=N(Y,A,B,R,F,q),H={termType:"BlankNode",value:A.getId()};B.push({subject:k,predicate:D,object:w,graph:R}),B.push({subject:k,predicate:L,object:H,graph:R}),k=H}if(T){const Y=N(T,A,B,R,F,q);B.push({subject:k,predicate:D,object:Y,graph:R}),B.push({subject:k,predicate:L,object:te,graph:R})}return Z}function N(C,A,B,R,F,q){const D={};if(t.isValue(C)){D.termType="Literal",D.value=void 0,D.datatype={termType:"NamedNode"};let L=C["@value"];const te=C["@type"]||null;if(te==="@json")D.value=n(L),D.datatype.value=b;else if(s.isBoolean(L))D.value=L.toString(),D.datatype.value=te||_;else if(s.isDouble(L)||te===E)s.isDouble(L)||(L=parseFloat(L)),D.value=L.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),D.datatype.value=te||E;else if(s.isNumber(L))D.value=L.toFixed(0),D.datatype.value=te||v;else if("@direction"in C&&F==="i18n-datatype"){const T=(C["@language"]||"").toLowerCase(),Z=C["@direction"],k=`https://www.w3.org/ns/i18n#${T}_${Z}`;D.datatype.value=k,D.value=L}else{if("@direction"in C&&F==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});if("@direction"in C&&F)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});"@language"in C?("@direction"in C&&!F&&q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:D.value}},options:q}),D.value=L,D.datatype.value=te||y,D.language=C["@language"]):("@direction"in C&&!F&&q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:D.value}},options:q}),D.value=L,D.datatype.value=te||x)}}else if(t.isList(C)){const L=g(C["@list"],A,B,R,F,q);D.termType=L.termType,D.value=L.value}else{const L=s.isObject(C)?C["@id"]:C;D.termType=L.startsWith("_:")?"BlankNode":"NamedNode",D.value=L}return D.termType==="NamedNode"&&!S(D.value)?(q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:D.value}},options:q}),null):D}return Os}var Cs,ru;function qf(){if(ru)return Cs;ru=1;const{isKeyword:r}=hr(),e=kt(),t=ut(),n=ht(),i=Jt(),s=gt(),{createNodeMap:a,mergeNodeMapGraphs:o}=gi(),u={};Cs=u,u.frameMergedOrDefault=(h,g,N)=>{const C={options:N,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},A=new n.IdentifierIssuer("_:b");a(h,C.graphMap,"@default",A),N.merged&&(C.graphMap["@merged"]=o(C.graphMap),C.graph="@merged"),C.subjects=C.graphMap[C.graph];const B=[];u.frame(C,Object.keys(C.subjects).sort(),g,B),N.pruneBlankNodeIdentifiers&&(N.bnodesToClear=Object.keys(C.bnodeMap).filter(R=>C.bnodeMap[R].length===1));// remove @preserve from results
347
- return N.link={},v(B,N)},u.frame=(h,g,N,C,A=null)=>{b(N),N=N[0];const B=h.options,R={embed:d(N,B,"embed"),explicit:d(N,B,"explicit"),requireAll:d(N,B,"requireAll")};h.link.hasOwnProperty(h.graph)||(h.link[h.graph]={});const F=h.link[h.graph],q=y(h,g,N,R),D=Object.keys(q).sort();for(const L of D){const te=q[L];if(A===null?h.uniqueEmbeds={[h.graph]:{}}:h.uniqueEmbeds[h.graph]=h.uniqueEmbeds[h.graph]||{},R.embed==="@link"&&L in F){x(C,A,F[L]);continue}const T={"@id":L};if(L.indexOf("_:")===0&&n.addValue(h.bnodeMap,L,T,{propertyIsArray:!0}),F[L]=T,(R.embed==="@first"||R.embed==="@last")&&h.is11)throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:N});if(!(!h.embedded&&h.uniqueEmbeds[h.graph].hasOwnProperty(L))){if(h.embedded&&(R.embed==="@never"||c(te,h.graph,h.subjectStack))){x(C,A,T);continue}if(h.embedded&&(R.embed=="@first"||R.embed=="@once")&&h.uniqueEmbeds[h.graph].hasOwnProperty(L)){x(C,A,T);continue}if(R.embed==="@last"&&L in h.uniqueEmbeds[h.graph]&&E(h,L),h.uniqueEmbeds[h.graph][L]={parent:C,property:A},h.subjectStack.push({subject:te,graph:h.graph}),L in h.graphMap){let Z=!1,k=null;"@graph"in N?(k=N["@graph"][0],Z=!(L==="@merged"||L==="@default"),t.isObject(k)||(k={})):(Z=h.graph!=="@merged",k={}),Z&&u.frame({...h,graph:L,embedded:!1},Object.keys(h.graphMap[L]).sort(),[k],T,"@graph")}"@included"in N&&u.frame({...h,embedded:!1},g,N["@included"],T,"@included");for(const Z of Object.keys(te).sort()){if(r(Z)){if(T[Z]=n.clone(te[Z]),Z==="@type")for(const k of te["@type"])k.indexOf("_:")===0&&n.addValue(h.bnodeMap,k,T,{propertyIsArray:!0});continue}if(!(R.explicit&&!(Z in N)))for(const k of te[Z]){const Y=Z in N?N[Z]:l(R);if(e.isList(k)){const w=N[Z]&&N[Z][0]&&N[Z][0]["@list"]?N[Z][0]["@list"]:l(R),H={"@list":[]};x(T,Z,H);const K=k["@list"];for(const Q of K)e.isSubjectReference(Q)?u.frame({...h,embedded:!0},[Q["@id"]],w,H,"@list"):x(H,"@list",n.clone(Q))}else e.isSubjectReference(k)?u.frame({...h,embedded:!0},[k["@id"]],Y,T,Z):m(Y[0],k)&&x(T,Z,n.clone(k))}}for(const Z of Object.keys(N).sort()){if(Z==="@type"){if(!t.isObject(N[Z][0])||!("@default"in N[Z][0]))continue}else if(r(Z))continue;const k=N[Z][0]||{};if(!d(k,B,"omitDefault")&&!(Z in T)){let w="@null";"@default"in k&&(w=n.clone(k["@default"])),t.isArray(w)||(w=[w]),T[Z]=[{"@preserve":w}]}}for(const Z of Object.keys(N["@reverse"]||{}).sort()){const k=N["@reverse"][Z];for(const Y of Object.keys(h.subjects))n.getValues(h.subjects[Y],Z).some(H=>H["@id"]===L)&&(T["@reverse"]=T["@reverse"]||{},n.addValue(T["@reverse"],Z,[],{propertyIsArray:!0}),u.frame({...h,embedded:!0},[Y],k,T["@reverse"][Z],A))}x(C,A,T),h.subjectStack.pop()}}},u.cleanupNull=(h,g)=>{if(t.isArray(h))return h.map(C=>u.cleanupNull(C,g)).filter(C=>C);if(h==="@null")return null;if(t.isObject(h)){if("@id"in h){const N=h["@id"];if(g.link.hasOwnProperty(N)){const C=g.link[N].indexOf(h);if(C!==-1)return g.link[N][C];g.link[N].push(h)}else g.link[N]=[h]}for(const N in h)h[N]=u.cleanupNull(h[N],g)}return h};function l(h){const g={};for(const N in h)h[N]!==void 0&&(g["@"+N]=[h[N]]);return[g]}function c(h,g,N){for(let C=N.length-1;C>=0;--C){const A=N[C];if(A.graph===g&&A.subject["@id"]===h["@id"])return!0}return!1}function d(h,g,N){const C="@"+N;let A=C in h?h[C][0]:g[N];if(N==="embed"){if(A===!0)A="@once";else if(A===!1)A="@never";else if(A!=="@always"&&A!=="@never"&&A!=="@link"&&A!=="@first"&&A!=="@last"&&A!=="@once")throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:h})}return A}function b(h){if(!t.isArray(h)||h.length!==1||!t.isObject(h[0]))throw new s("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:h});if("@id"in h[0]){for(const g of n.asArray(h[0]["@id"]))if(!(t.isObject(g)||i.isAbsolute(g))||t.isString(g)&&g.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:h})}if("@type"in h[0]){for(const g of n.asArray(h[0]["@type"]))if(!(t.isObject(g)||i.isAbsolute(g)||g==="@json")||t.isString(g)&&g.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:h})}}function y(h,g,N,C){const A={};for(const B of g){const R=h.graphMap[h.graph][B];_(h,R,N,C)&&(A[B]=R)}return A}function _(h,g,N,C){let A=!0,B=!1;for(const R in N){let F=!1;const q=n.getValues(g,R),D=n.getValues(N,R).length===0;if(R==="@id"){if(t.isEmptyObject(N["@id"][0]||{})?F=!0:N["@id"].length>=0&&(F=N["@id"].includes(q[0])),!C.requireAll)return F}else if(R==="@type"){if(A=!1,D){if(q.length>0)return!1;F=!0}else if(N["@type"].length===1&&t.isEmptyObject(N["@type"][0]))F=q.length>0;else for(const L of N["@type"])t.isObject(L)&&"@default"in L?F=!0:F=F||q.some(te=>te===L);if(!C.requireAll)return F}else{if(r(R))continue;{const L=n.getValues(N,R)[0];let te=!1;if(L&&(b([L]),te="@default"in L),A=!1,q.length===0&&te)continue;if(q.length>0&&D)return!1;if(L===void 0){if(q.length>0)return!1;F=!0}else if(e.isList(L)){const T=L["@list"][0];if(e.isList(q[0])){const Z=q[0]["@list"];e.isValue(T)?F=Z.some(k=>m(T,k)):(e.isSubject(T)||e.isSubjectReference(T))&&(F=Z.some(k=>S(h,T,k,C)))}}else e.isValue(L)?F=q.some(T=>m(L,T)):e.isSubjectReference(L)?F=q.some(T=>S(h,L,T,C)):t.isObject(L)?F=q.length>0:F=!1}}if(!F&&C.requireAll)return!1;B=B||F}return A||B}function E(h,g){const N=h.uniqueEmbeds[h.graph],C=N[g],A=C.parent,B=C.property,R={"@id":g};if(t.isArray(A)){for(let q=0;q<A.length;++q)if(n.compareValues(A[q],R)){A[q]=R;break}}else{const q=t.isArray(A[B]);n.removeValue(A,B,R,{propertyIsArray:q}),n.addValue(A,B,R,{propertyIsArray:q})}const F=q=>{const D=Object.keys(N);for(const L of D)L in N&&t.isObject(N[L].parent)&&N[L].parent["@id"]===q&&(delete N[L],F(L))};F(g)}/**
345
+ */var hs,Cl;function Af(){if(Cl)return hs;Cl=1;const r=yi(),e=Vc();return hs=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;for(const o of a){let u,l;if(o.subject.termType==="BlankNode"&&o.subject.value!==n)l=o.subject.value,u="p";else if(o.object.termType==="BlankNode"&&o.object.value!==n)l=o.object.value,u="r";else continue;const c=this.hashRelatedBlankNode(l,o,i,u),h=s.get(c);h?h.push(l):s.set(c,[l])}return s}},hs}const Df={},Lf=Object.freeze(Object.defineProperty({__proto__:null,default:Df},Symbol.toStringTag,{value:"Module"})),Of=ad(Lf);var jl;function Cf(){return jl||(jl=1,function(r){const e=Hc(),t=Tf(),n=Vc(),i=Af();let s;try{s=Of}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=qa(),r.IdentifierIssuer=Ba(),r._rdfCanonizeNative=function(o){return o&&(s=o),s},r.canonize=async function(o,u){const l=a(o);if(u.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((c,h)=>s.canonize(l,u,(b,y)=>b?h(b):c(y)))}if(u.algorithm==="URDNA2015")return new e(u).main(l);if(u.algorithm==="URGNA2012"){if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(u).main(l)}throw"algorithm"in u?new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},r._canonizeSync=function(o,u){const l=a(o);if(u.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(l,u)}if(u.algorithm==="URDNA2015")return new n(u).main(l);if(u.algorithm==="URGNA2012"){if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(u).main(l)}throw"algorithm"in u?new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}}(ns)),ns}var fs,$l;function Ua(){return $l||($l=1,fs=Cf()),fs}var ps,Fl;function ut(){if(Fl)return ps;Fl=1;const r={};return ps=r,r.isArray=Array.isArray,r.isBoolean=e=>typeof e=="boolean"||Object.prototype.toString.call(e)==="[object Boolean]",r.isDouble=e=>r.isNumber(e)&&(String(e).indexOf(".")!==-1||Math.abs(e)>=1e21),r.isEmptyObject=e=>r.isObject(e)&&Object.keys(e).length===0,r.isNumber=e=>typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]",r.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),r.isObject=e=>Object.prototype.toString.call(e)==="[object Object]",r.isString=e=>typeof e=="string"||Object.prototype.toString.call(e)==="[object String]",r.isUndefined=e=>typeof e>"u",ps}var gs,kl;function kt(){if(kl)return gs;kl=1;const r=ut(),e={};return gs=e,e.isSubject=t=>r.isObject(t)&&!("@value"in t||"@set"in t||"@list"in t)?Object.keys(t).length>1||!("@id"in t):!1,e.isSubjectReference=t=>r.isObject(t)&&Object.keys(t).length===1&&"@id"in t,e.isValue=t=>r.isObject(t)&&"@value"in t,e.isList=t=>r.isObject(t)&&"@list"in t,e.isGraph=t=>r.isObject(t)&&"@graph"in t&&Object.keys(t).filter(n=>n!=="@id"&&n!=="@index").length===1,e.isSimpleGraph=t=>e.isGraph(t)&&!("@id"in t),e.isBlankNode=t=>{if(r.isObject(t)){if("@id"in t){const n=t["@id"];return!r.isString(n)||n.indexOf("_:")===0}return Object.keys(t).length===0||!("@value"in t||"@set"in t||"@list"in t)}return!1},gs}var ms,Pl;function pt(){return Pl||(Pl=1,ms=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}}),ms}var ys,Ml;function dt(){if(Ml)return ys;Ml=1;const r=kt(),e=ut(),t=Ua().IdentifierIssuer,n=pt(),i=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,o=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,l={headers:{accept:"application/ld+json, application/json"}},c={};ys=c,c.IdentifierIssuer=t,c.REGEX_BCP47=i,c.REGEX_KEYWORD=u,c.clone=function(b){if(b&&typeof b=="object"){let y;if(e.isArray(b)){y=[];for(let _=0;_<b.length;++_)y[_]=c.clone(b[_])}else if(b instanceof Map){y=new Map;for(const[_,E]of b)y.set(_,c.clone(E))}else if(b instanceof Set){y=new Set;for(const _ of b)y.add(c.clone(_))}else if(e.isObject(b)){y={};for(const _ in b)y[_]=c.clone(b[_])}else y=b.toString();return y}return b},c.asArray=function(b){return Array.isArray(b)?b:[b]},c.buildHeaders=(b={})=>{if(Object.keys(b).some(_=>_.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+l.headers.accept+'" is supported.');return Object.assign({Accept:l.headers.accept},b)},c.parseLinkHeader=b=>{const y={},_=b.match(s);for(let E=0;E<_.length;++E){let v=_[E].match(a);if(!v)continue;const x={target:v[1]},S=v[2];for(;v=o.exec(S);)x[v[1]]=v[2]===void 0?v[3]:v[2];const m=x.rel||"";Array.isArray(y[m])?y[m].push(x):y.hasOwnProperty(m)?y[m]=[y[m],x]:y[m]=x}return y},c.validateTypeValue=(b,y)=>{if(!e.isString(b)&&!(e.isArray(b)&&b.every(_=>e.isString(_)))){if(y&&e.isObject(b))switch(Object.keys(b).length){case 0:return;case 1:if("@default"in b&&c.asArray(b["@default"]).every(_=>e.isString(_)))return}throw new n('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:b})}},c.hasProperty=(b,y)=>{if(b.hasOwnProperty(y)){const _=b[y];return!e.isArray(_)||_.length>0}return!1},c.hasValue=(b,y,_)=>{if(c.hasProperty(b,y)){let E=b[y];const v=r.isList(E);if(e.isArray(E)||v){v&&(E=E["@list"]);for(let x=0;x<E.length;++x)if(c.compareValues(_,E[x]))return!0}else if(!e.isArray(_))return c.compareValues(_,E)}return!1},c.addValue=(b,y,_,E)=>{if(E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1),"valueIsArray"in E||(E.valueIsArray=!1),"allowDuplicate"in E||(E.allowDuplicate=!0),"prependValue"in E||(E.prependValue=!1),E.valueIsArray)b[y]=_;else if(e.isArray(_)){_.length===0&&E.propertyIsArray&&!b.hasOwnProperty(y)&&(b[y]=[]),E.prependValue&&(_=_.concat(b[y]),b[y]=[]);for(let v=0;v<_.length;++v)c.addValue(b,y,_[v],E)}else if(b.hasOwnProperty(y)){const v=!E.allowDuplicate&&c.hasValue(b,y,_);!e.isArray(b[y])&&(!v||E.propertyIsArray)&&(b[y]=[b[y]]),v||(E.prependValue?b[y].unshift(_):b[y].push(_))}else b[y]=E.propertyIsArray?[_]:_},c.getValues=(b,y)=>[].concat(b[y]||[]),c.removeProperty=(b,y)=>{delete b[y]},c.removeValue=(b,y,_,E)=>{E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1);const v=c.getValues(b,y).filter(x=>!c.compareValues(x,_));v.length===0?c.removeProperty(b,y):v.length===1&&!E.propertyIsArray?b[y]=v[0]:b[y]=v},c.relabelBlankNodes=(b,y)=>{y=y||{};const _=y.issuer||new t("_:b");return h(_,b)},c.compareValues=(b,y)=>b===y||r.isValue(b)&&r.isValue(y)&&b["@value"]===y["@value"]&&b["@type"]===y["@type"]&&b["@language"]===y["@language"]&&b["@index"]===y["@index"]?!0:e.isObject(b)&&"@id"in b&&e.isObject(y)&&"@id"in y?b["@id"]===y["@id"]:!1,c.compareShortestLeast=(b,y)=>b.length<y.length?-1:y.length<b.length?1:b===y?0:b<y?-1:1;function h(b,y){if(e.isArray(y))for(let _=0;_<y.length;++_)y[_]=h(b,y[_]);else if(r.isList(y))y["@list"]=h(b,y["@list"]);else if(e.isObject(y)){r.isBlankNode(y)&&(y["@id"]=b.getId(y["@id"]));const _=Object.keys(y).sort();for(let E=0;E<_.length;++E){const v=_[E];v!=="@id"&&(y[v]=h(b,y[v]))}}return y}return ys}var bs,Bl;function Ha(){if(Bl)return bs;Bl=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return bs={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:r,RDF_LIST:r+"List",RDF_FIRST:r+"first",RDF_REST:r+"rest",RDF_NIL:r+"nil",RDF_TYPE:r+"type",RDF_PLAIN_LITERAL:r+"PlainLiteral",RDF_XML_LITERAL:r+"XMLLiteral",RDF_JSON_LITERAL:r+"JSON",RDF_OBJECT:r+"object",RDF_LANGSTRING:r+"langString",XSD:e,XSD_BOOLEAN:e+"boolean",XSD_DOUBLE:e+"double",XSD_INTEGER:e+"integer",XSD_STRING:e+"string"},bs}var _s,ql;function Gc(){return ql||(ql=1,_s=class{constructor(){this._requests={}}wrapLoader(e){const t=this;return t._loader=e,function(){return t.add.apply(t,arguments)}}async add(e){let t=this._requests[e];if(t)return Promise.resolve(t);t=this._requests[e]=this._loader(e);try{return await t}finally{delete this._requests[e]}}}),_s}var ws,Ul;function Jt(){if(Ul)return ws;Ul=1;const r=ut(),e={};ws=e,e.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*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},e.parse=(n,i)=>{const s={},a=e.parsers[i||"full"],o=a.regex.exec(n);let u=a.keys.length;for(;u--;)s[a.keys[u]]=o[u]===void 0?null:o[u];return(s.scheme==="https"&&s.port==="443"||s.scheme==="http"&&s.port==="80")&&(s.href=s.href.replace(":"+s.port,""),s.authority=s.authority.replace(":"+s.port,""),s.port=null),s.normalizedPath=e.removeDotSegments(s.path),s},e.prependBase=(n,i)=>{if(n===null||e.isAbsolute(i))return i;(!n||r.isString(n))&&(n=e.parse(n||""));const s=e.parse(i),a={protocol:n.protocol||""};if(s.authority!==null)a.authority=s.authority,a.path=s.path,a.query=s.query;else if(a.authority=n.authority,s.path==="")a.path=n.path,s.query!==null?a.query=s.query:a.query=n.query;else{if(s.path.indexOf("/")===0)a.path=s.path;else{let u=n.path;u=u.substr(0,u.lastIndexOf("/")+1),(u.length>0||n.authority)&&u.substr(-1)!=="/"&&(u+="/"),u+=s.path,a.path=u}a.query=s.query}s.path!==""&&(a.path=e.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+="//"+a.authority),o+=a.path,a.query!==null&&(o+="?"+a.query),s.fragment!==null&&(o+="#"+s.fragment),o===""&&(o="./"),o},e.removeBase=(n,i)=>{if(n===null)return i;(!n||r.isString(n))&&(n=e.parse(n||""));let s="";if(n.href!==""?s+=(n.protocol||"")+"//"+(n.authority||""):i.indexOf("//")&&(s+="//"),i.indexOf(s)!==0)return i;const a=e.parse(i.substr(s.length)),o=n.normalizedPath.split("/"),u=a.normalizedPath.split("/"),l=a.fragment||a.query?0:1;for(;o.length>0&&u.length>l&&o[0]===u[0];)o.shift(),u.shift();let c="";if(o.length>0){o.pop();for(let h=0;h<o.length;++h)c+="../"}return c+=u.join("/"),a.query!==null&&(c+="?"+a.query),a.fragment!==null&&(c+="#"+a.fragment),c===""&&(c="./"),c},e.removeDotSegments=n=>{if(n.length===0)return"";const i=n.split("/"),s=[];for(;i.length>0;){const a=i.shift(),o=i.length===0;if(a==="."){o&&s.push("");continue}if(a===".."){s.pop(),o&&s.push("");continue}s.push(a)}return n[0]==="/"&&s.length>0&&s[0]!==""&&s.unshift(""),s.length===1&&s[0]===""?"/":s.join("/")};const t=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;return e.isAbsolute=n=>r.isString(n)&&t.test(n),e.isRelative=n=>r.isString(n),ws}var vs,Hl;function jf(){if(Hl)return vs;Hl=1;const{parseLinkHeader:r,buildHeaders:e}=dt(),{LINK_HEADER_CONTEXT:t}=Ha(),n=pt(),i=Gc(),{prependBase:s}=Jt(),a=/(^|(\r\n))link:/i;vs=({secure:u,headers:l={},xhr:c}={headers:{}})=>{return l=e(l),new i().wrapLoader(b);async function b(y){if(y.indexOf("http:")!==0&&y.indexOf("https:")!==0)throw new n('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:y});if(u&&y.indexOf("https")!==0)throw new n(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,"jsonld.InvalidUrl",{code:"loading document failed",url:y});let _;try{_=await o(c,y,l)}catch(m){throw new n("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:y,cause:m})}if(_.status>=400)throw new n("URL could not be dereferenced: "+_.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:y,httpStatusCode:_.status});let E={contextUrl:null,documentUrl:y,document:_.response},v=null;const x=_.getResponseHeader("Content-Type");let S;if(a.test(_.getAllResponseHeaders())&&(S=_.getResponseHeader("Link")),S&&x!=="application/ld+json"){const m=r(S),d=m[t];if(Array.isArray(d))throw new n("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:y});d&&(E.contextUrl=d.target),v=m.alternate,v&&v.type=="application/ld+json"&&!(x||"").match(/^application\/(\w*\+)?json$/)&&(E=await b(s(y,v.target)))}return E}};function o(u,l,c){u=u||XMLHttpRequest;const h=new u;return new Promise((b,y)=>{h.onload=()=>b(h),h.onerror=_=>y(_),h.open("GET",l,!0);for(const _ in c)h.setRequestHeader(_,c[_]);h.send()})}return vs}var xs,Vl;function $f(){if(Vl)return xs;Vl=1;const r=jf(),e={};return xs=e,e.setupDocumentLoaders=function(t){typeof XMLHttpRequest<"u"&&(t.documentLoaders.xhr=r,t.useDocumentLoader("xhr"))},e.setupGlobals=function(t){typeof globalThis.JsonLdProcessor>"u"&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t.JsonLdProcessor})},xs}var Es,Gl;function Ff(){return Gl||(Gl=1,Es=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Es}var Ss,Wl;function kf(){if(Wl)return Ss;Wl=1,Ss=r,r.Node=i,r.create=r;function r(s){var a=this;if(a instanceof r||(a=new r),a.tail=null,a.head=null,a.length=0,s&&typeof s.forEach=="function")s.forEach(function(l){a.push(l)});else if(arguments.length>0)for(var o=0,u=arguments.length;o<u;o++)a.push(arguments[o]);return a}r.prototype.removeNode=function(s){if(s.list!==this)throw new Error("removing node which does not belong to this list");var a=s.next,o=s.prev;return a&&(a.prev=o),o&&(o.next=a),s===this.head&&(this.head=a),s===this.tail&&(this.tail=o),s.list.length--,s.next=null,s.prev=null,s.list=null,a},r.prototype.unshiftNode=function(s){if(s!==this.head){s.list&&s.list.removeNode(s);var a=this.head;s.list=this,s.next=a,a&&(a.prev=s),this.head=s,this.tail||(this.tail=s),this.length++}},r.prototype.pushNode=function(s){if(s!==this.tail){s.list&&s.list.removeNode(s);var a=this.tail;s.list=this,s.prev=a,a&&(a.next=s),this.tail=s,this.head||(this.head=s),this.length++}},r.prototype.push=function(){for(var s=0,a=arguments.length;s<a;s++)t(this,arguments[s]);return this.length},r.prototype.unshift=function(){for(var s=0,a=arguments.length;s<a;s++)n(this,arguments[s]);return this.length},r.prototype.pop=function(){if(this.tail){var s=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,s}},r.prototype.shift=function(){if(this.head){var s=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,s}},r.prototype.forEach=function(s,a){a=a||this;for(var o=this.head,u=0;o!==null;u++)s.call(a,o.value,u,this),o=o.next},r.prototype.forEachReverse=function(s,a){a=a||this;for(var o=this.tail,u=this.length-1;o!==null;u--)s.call(a,o.value,u,this),o=o.prev},r.prototype.get=function(s){for(var a=0,o=this.head;o!==null&&a<s;a++)o=o.next;if(a===s&&o!==null)return o.value},r.prototype.getReverse=function(s){for(var a=0,o=this.tail;o!==null&&a<s;a++)o=o.prev;if(a===s&&o!==null)return o.value},r.prototype.map=function(s,a){a=a||this;for(var o=new r,u=this.head;u!==null;)o.push(s.call(a,u.value,this)),u=u.next;return o},r.prototype.mapReverse=function(s,a){a=a||this;for(var o=new r,u=this.tail;u!==null;)o.push(s.call(a,u.value,this)),u=u.prev;return o},r.prototype.reduce=function(s,a){var o,u=this.head;if(arguments.length>1)o=a;else if(this.head)u=this.head.next,o=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=0;u!==null;l++)o=s(o,u.value,l),u=u.next;return o},r.prototype.reduceReverse=function(s,a){var o,u=this.tail;if(arguments.length>1)o=a;else if(this.tail)u=this.tail.prev,o=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=this.length-1;u!==null;l--)o=s(o,u.value,l),u=u.prev;return o},r.prototype.toArray=function(){for(var s=new Array(this.length),a=0,o=this.head;o!==null;a++)s[a]=o.value,o=o.next;return s},r.prototype.toArrayReverse=function(){for(var s=new Array(this.length),a=0,o=this.tail;o!==null;a++)s[a]=o.value,o=o.prev;return s},r.prototype.slice=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var u=0,l=this.head;l!==null&&u<s;u++)l=l.next;for(;l!==null&&u<a;u++,l=l.next)o.push(l.value);return o},r.prototype.sliceReverse=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var u=this.length,l=this.tail;l!==null&&u>a;u--)l=l.prev;for(;l!==null&&u>s;u--,l=l.prev)o.push(l.value);return o},r.prototype.splice=function(s,a,...o){s>this.length&&(s=this.length-1),s<0&&(s=this.length+s);for(var u=0,l=this.head;l!==null&&u<s;u++)l=l.next;for(var c=[],u=0;l&&u<a;u++)c.push(l.value),l=this.removeNode(l);l===null&&(l=this.tail),l!==this.head&&l!==this.tail&&(l=l.prev);for(var u=0;u<o.length;u++)l=e(this,l,o[u]);return c},r.prototype.reverse=function(){for(var s=this.head,a=this.tail,o=s;o!==null;o=o.prev){var u=o.prev;o.prev=o.next,o.next=u}return this.head=a,this.tail=s,this};function e(s,a,o){var u=a===s.head?new i(o,null,a,s):new i(o,a,a.next,s);return u.next===null&&(s.tail=u),u.prev===null&&(s.head=u),s.length++,u}function t(s,a){s.tail=new i(a,s.tail,null,s),s.head||(s.head=s.tail),s.length++}function n(s,a){s.head=new i(a,null,s.head,s),s.tail||(s.tail=s.head),s.length++}function i(s,a,o,u){if(!(this instanceof i))return new i(s,a,o,u);this.list=u,this.value=s,a?(a.next=this,this.prev=a):this.prev=null,o?(o.prev=this,this.next=o):this.next=null}try{Ff()(r)}catch{}return Ss}var Is,zl;function Wc(){if(zl)return Is;zl=1;const r=kf(),e=Symbol("max"),t=Symbol("length"),n=Symbol("lengthCalculator"),i=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),u=Symbol("lruList"),l=Symbol("cache"),c=Symbol("updateAgeOnGet"),h=()=>1;class b{constructor(d){if(typeof d=="number"&&(d={max:d}),d||(d={}),d.max&&(typeof d.max!="number"||d.max<0))throw new TypeError("max must be a non-negative number");this[e]=d.max||1/0;const g=d.length||h;if(this[n]=typeof g!="function"?h:g,this[i]=d.stale||!1,d.maxAge&&typeof d.maxAge!="number")throw new TypeError("maxAge must be a number");this[s]=d.maxAge||0,this[a]=d.dispose,this[o]=d.noDisposeOnSet||!1,this[c]=d.updateAgeOnGet||!1,this.reset()}set max(d){if(typeof d!="number"||d<0)throw new TypeError("max must be a non-negative number");this[e]=d||1/0,E(this)}get max(){return this[e]}set allowStale(d){this[i]=!!d}get allowStale(){return this[i]}set maxAge(d){if(typeof d!="number")throw new TypeError("maxAge must be a non-negative number");this[s]=d,E(this)}get maxAge(){return this[s]}set lengthCalculator(d){typeof d!="function"&&(d=h),d!==this[n]&&(this[n]=d,this[t]=0,this[u].forEach(g=>{g.length=this[n](g.value,g.key),this[t]+=g.length})),E(this)}get lengthCalculator(){return this[n]}get length(){return this[t]}get itemCount(){return this[u].length}rforEach(d,g){g=g||this;for(let N=this[u].tail;N!==null;){const C=N.prev;S(this,d,N,g),N=C}}forEach(d,g){g=g||this;for(let N=this[u].head;N!==null;){const C=N.next;S(this,d,N,g),N=C}}keys(){return this[u].toArray().map(d=>d.key)}values(){return this[u].toArray().map(d=>d.value)}reset(){this[a]&&this[u]&&this[u].length&&this[u].forEach(d=>this[a](d.key,d.value)),this[l]=new Map,this[u]=new r,this[t]=0}dump(){return this[u].map(d=>_(this,d)?!1:{k:d.key,v:d.value,e:d.now+(d.maxAge||0)}).toArray().filter(d=>d)}dumpLru(){return this[u]}set(d,g,N){if(N=N||this[s],N&&typeof N!="number")throw new TypeError("maxAge must be a number");const C=N?Date.now():0,A=this[n](g,d);if(this[l].has(d)){if(A>this[e])return v(this,this[l].get(d)),!1;const F=this[l].get(d).value;return this[a]&&(this[o]||this[a](d,F.value)),F.now=C,F.maxAge=N,F.value=g,this[t]+=A-F.length,F.length=A,this.get(d),E(this),!0}const B=new x(d,g,A,C,N);return B.length>this[e]?(this[a]&&this[a](d,g),!1):(this[t]+=B.length,this[u].unshift(B),this[l].set(d,this[u].head),E(this),!0)}has(d){if(!this[l].has(d))return!1;const g=this[l].get(d).value;return!_(this,g)}get(d){return y(this,d,!0)}peek(d){return y(this,d,!1)}pop(){const d=this[u].tail;return d?(v(this,d),d.value):null}del(d){v(this,this[l].get(d))}load(d){this.reset();const g=Date.now();for(let N=d.length-1;N>=0;N--){const C=d[N],A=C.e||0;if(A===0)this.set(C.k,C.v);else{const B=A-g;B>0&&this.set(C.k,C.v,B)}}}prune(){this[l].forEach((d,g)=>y(this,g,!1))}}const y=(m,d,g)=>{const N=m[l].get(d);if(N){const C=N.value;if(_(m,C)){if(v(m,N),!m[i])return}else g&&(m[c]&&(N.value.now=Date.now()),m[u].unshiftNode(N));return C.value}},_=(m,d)=>{if(!d||!d.maxAge&&!m[s])return!1;const g=Date.now()-d.now;return d.maxAge?g>d.maxAge:m[s]&&g>m[s]},E=m=>{if(m[t]>m[e])for(let d=m[u].tail;m[t]>m[e]&&d!==null;){const g=d.prev;v(m,d),d=g}},v=(m,d)=>{if(d){const g=d.value;m[a]&&m[a](g.key,g.value),m[t]-=g.length,m[l].delete(g.key),m[u].removeNode(d)}};class x{constructor(d,g,N,C,A){this.key=d,this.value=g,this.length=N,this.now=C,this.maxAge=A||0}}const S=(m,d,g,N)=>{let C=g.value;_(m,C)&&(v(m,g),m[i]||(C=void 0)),C&&d.call(N,C.value,C.key,m)};return Is=b,Is}var Ns,Ql;function Pf(){if(Ql)return Ns;Ql=1;const r=Wc(),e=10;return Ns=class{constructor({document:n}){this.document=n,this.cache=new r({max:e})}getProcessed(n){return this.cache.get(n)}setProcessed(n,i){this.cache.set(n,i)}},Ns}var Rs,Xl;function Mf(){if(Xl)return Rs;Xl=1;const{isArray:r,isObject:e,isString:t}=ut(),{asArray:n}=dt(),{prependBase:i}=Jt(),s=pt(),a=Pf(),o=10;Rs=class{constructor({sharedCache:h}){this.perOpCache=new Map,this.sharedCache=h}async resolve({activeCtx:h,context:b,documentLoader:y,base:_,cycles:E=new Set}){b&&e(b)&&b["@context"]&&(b=b["@context"]),b=n(b);const v=[];for(const x of b){if(t(x)){let d=this._get(x);d||(d=await this._resolveRemoteContext({activeCtx:h,url:x,documentLoader:y,base:_,cycles:E})),r(d)?v.push(...d):v.push(d);continue}if(x===null){v.push(new a({document:null}));continue}e(x)||u(b);const S=JSON.stringify(x);let m=this._get(S);m||(m=new a({document:x}),this._cacheResolvedContext({key:S,resolved:m,tag:"static"})),v.push(m)}return v}_get(h){let b=this.perOpCache.get(h);if(!b){const y=this.sharedCache.get(h);y&&(b=y.get("static"),b&&this.perOpCache.set(h,b))}return b}_cacheResolvedContext({key:h,resolved:b,tag:y}){if(this.perOpCache.set(h,b),y!==void 0){let _=this.sharedCache.get(h);_||(_=new Map,this.sharedCache.set(h,_)),_.set(y,b)}return b}async _resolveRemoteContext({activeCtx:h,url:b,documentLoader:y,base:_,cycles:E}){b=i(_,b);const{context:v,remoteDoc:x}=await this._fetchContext({activeCtx:h,url:b,documentLoader:y,cycles:E});_=x.documentUrl||b,l({context:v,base:_});const S=await this.resolve({activeCtx:h,context:v,documentLoader:y,base:_,cycles:E});return this._cacheResolvedContext({key:b,resolved:S,tag:x.tag}),S}async _fetchContext({activeCtx:h,url:b,documentLoader:y,cycles:_}){if(_.size>o)throw new s("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:h.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:o});if(_.has(b))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:h.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:b});_.add(b);let E,v;try{v=await y(b),E=v.document||null,t(E)&&(E=JSON.parse(E))}catch(x){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: "${b}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:b,cause:x})}if(!e(E))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: "${b}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:b});return"@context"in E?E={"@context":E["@context"]}:E={"@context":{}},v.contextUrl&&(r(E["@context"])||(E["@context"]=[E["@context"]]),E["@context"].push(v.contextUrl)),{context:E,remoteDoc:v}}};function u(c){throw new s("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:c})}function l({context:c,base:h}){if(!c)return;const b=c["@context"];if(t(b)){c["@context"]=i(h,b);return}if(r(b)){for(let y=0;y<b.length;++y){const _=b[y];if(t(_)){b[y]=i(h,_);continue}e(_)&&l({context:{"@context":_},base:h})}return}if(e(b))for(const y in b)l({context:b[y],base:h})}return Rs}var Ts,Jl;function Bf(){return Jl||(Jl=1,Ts=Ua().NQuads),Ts}var As,Kl;function Tn(){if(Kl)return As;Kl=1;const r=pt(),{isArray:e}=ut(),{asArray:t}=dt(),n={};As=n,n.defaultEventHandler=null,n.setupEventHandler=({options:a={}})=>{const o=[].concat(a.safe?n.safeEventHandler:[],a.eventHandler?t(a.eventHandler):[],n.defaultEventHandler?n.defaultEventHandler:[]);return o.length===0?null:o},n.handleEvent=({event:a,options:o})=>{i({event:a,handlers:o.eventHandler})};function i({event:a,handlers:o}){let u=!0;for(let l=0;u&&l<o.length;++l){u=!1;const c=o[l];if(e(c))u=i({event:a,handlers:c});else if(typeof c=="function")c({event:a,next:()=>{u=!0}});else if(typeof c=="object")a.code in c?c[a.code]({event:a,next:()=>{u=!0}}):u=!0;else throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return u}const 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"]);return n.safeEventHandler=function({event:o,next:u}){if(o.level==="warning"&&s.has(o.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:o});u()},n.logEventHandler=function({event:o,next:u}){console.log(`EVENT: ${o.message}`,{event:o}),u()},n.logWarningEventHandler=function({event:o,next:u}){o.level==="warning"&&console.warn(`WARNING: ${o.message}`,{event:o}),u()},n.unhandledEventHandler=function({event:o}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:o})},n.setDefaultEventHandler=function({eventHandler:a}={}){n.defaultEventHandler=a?t(a):null},As}var Ds,Yl;function hr(){if(Yl)return Ds;Yl=1;const r=dt(),e=pt(),{isArray:t,isObject:n,isString:i,isUndefined:s}=ut(),{isAbsolute:a,isRelative:o,prependBase:u}=Jt(),{handleEvent:l}=Tn(),{REGEX_BCP47:c,REGEX_KEYWORD:h,asArray:b,compareShortestLeast:y}=dt(),_=new Map,E=1e4,v={};Ds=v,v.process=async({activeCtx:m,localCtx:d,options:g,propagate:N=!0,overrideProtected:C=!1,cycles:A=new Set})=>{if(n(d)&&"@context"in d&&t(d["@context"])&&(d=d["@context"]),b(d).length===0)return m;const R=[],F=[({event:te,next:T})=>{R.push(te),T()}];g.eventHandler&&F.push(g.eventHandler);const q=g;g={...g,eventHandler:F};const D=await g.contextResolver.resolve({activeCtx:m,context:d,documentLoader:g.documentLoader,base:g.base});n(D[0].document)&&typeof D[0].document["@propagate"]=="boolean"&&(N=D[0].document["@propagate"]);let L=m;!N&&!L.previousContext&&(L=L.clone(),L.previousContext=m);for(const te of D){let{document:T}=te;if(m=L,T===null){if(!C&&Object.keys(m.protected).length!==0)throw new e("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});L=m=v.getInitialContext(g).clone();continue}const Z=te.getProcessed(m);if(Z){if(q.eventHandler)for(const Y of Z.events)l({event:Y,options:q});L=m=Z.context;continue}if(n(T)&&"@context"in T&&(T=T["@context"]),!n(T))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:T});L=L.clone();const k=new Map;if("@version"in T){if(T["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+T["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:T});if(m.processingMode&&m.processingMode==="json-ld-1.0")throw new e("@version: "+T["@version"]+" not compatible with "+m.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:T});L.processingMode="json-ld-1.1",L["@version"]=T["@version"],k.set("@version",!0)}if(L.processingMode=L.processingMode||m.processingMode,"@base"in T){let Y=T["@base"];if(!(Y===null||a(Y)))if(o(Y))Y=u(L["@base"],Y);else throw new e('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:T});L["@base"]=Y,k.set("@base",!0)}if("@vocab"in T){const Y=T["@vocab"];if(Y===null)delete L["@vocab"];else if(i(Y)){if(!a(Y)&&v.processingMode(L,1))throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:T});{const w=x(L,Y,{vocab:!0,base:!0},void 0,void 0,g);a(w)||g.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:w}},options:g}),L["@vocab"]=w}}else throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:T});k.set("@vocab",!0)}if("@language"in T){const Y=T["@language"];if(Y===null)delete L["@language"];else if(i(Y))Y.match(c)||g.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:g}),L["@language"]=Y.toLowerCase();else throw new e('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:T});k.set("@language",!0)}if("@direction"in T){const Y=T["@direction"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:T});if(Y===null)delete L["@direction"];else{if(Y!=="ltr"&&Y!=="rtl")throw new e('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:T});L["@direction"]=Y}k.set("@direction",!0)}if("@propagate"in T){const Y=T["@propagate"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(typeof Y!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:d});k.set("@propagate",!0)}if("@import"in T){const Y=T["@import"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(!i(Y))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:d});const w=await g.contextResolver.resolve({activeCtx:m,context:Y,documentLoader:g.documentLoader,base:g.base});if(w.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:d});const H=w[0].getProcessed(m);if(H)T=H;else{const K=w[0].document;if("@import"in K)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:d});for(const Q in K)T.hasOwnProperty(Q)||(T[Q]=K[Q]);w[0].setProcessed(m,T)}k.set("@import",!0)}k.set("@protected",T["@protected"]||!1);for(const Y in T)if(v.createTermDefinition({activeCtx:L,localCtx:T,term:Y,defined:k,options:g,overrideProtected:C}),n(T[Y])&&"@context"in T[Y]){const w=T[Y]["@context"];let H=!0;if(i(w)){const K=u(g.base,w);A.has(K)?H=!1:A.add(K)}if(H)try{await v.process({activeCtx:L.clone(),localCtx:T[Y]["@context"],overrideProtected:!0,options:g,cycles:A})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:T[Y]["@context"],term:Y})}}te.setProcessed(m,{context:L,events:R})}return L},v.createTermDefinition=({activeCtx:m,localCtx:d,term:g,defined:N,options:C,overrideProtected:A=!1})=>{if(N.has(g)){if(N.get(g))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:d,term:g})}N.set(g,!1);let B;if(d.hasOwnProperty(g)&&(B=d[g]),g==="@type"&&n(B)&&(B["@container"]||"@set")==="@set"&&v.processingMode(m,1.1)){const T=["@container","@id","@protected"],Z=Object.keys(B);if(Z.length===0||Z.some(k=>!T.includes(k)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:d,term:g})}else{if(v.isKeyword(g))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:d,term:g});if(g.match(h)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:g}},options:C});return}else if(g==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:d})}const R=m.mappings.get(g);m.mappings.has(g)&&m.mappings.delete(g);let F=!1;if((i(B)||B===null)&&(F=!0,B={"@id":B}),!n(B))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:d});const q={};m.mappings.set(g,q),q.reverse=!1;const D=["@container","@id","@language","@reverse","@type"];v.processingMode(m,1.1)&&D.push("@context","@direction","@index","@nest","@prefix","@protected");for(const T in B)if(!D.includes(T))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+T,"jsonld.SyntaxError",{code:"invalid term definition",context:d});const L=g.indexOf(":");if(q._termHasColon=L>0,"@reverse"in B){if("@id"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:d});if("@nest"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:d});const T=B["@reverse"];if(!i(T))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:d});if(T.match(h)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:T}},options:C}),R?m.mappings.set(g,R):m.mappings.delete(g);return}const Z=x(m,T,{vocab:!0,base:!1},d,N,C);if(!a(Z))throw new e("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:d});q["@id"]=Z,q.reverse=!0}else if("@id"in B){let T=B["@id"];if(T&&!i(T))throw new e("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:d});if(T===null)q["@id"]=null;else if(!v.isKeyword(T)&&T.match(h)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:T}},options:C}),R?m.mappings.set(g,R):m.mappings.delete(g);return}else if(T!==g){if(T=x(m,T,{vocab:!0,base:!1},d,N,C),!a(T)&&!v.isKeyword(T))throw new e("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:d});if(g.match(/(?::[^:])|\//)){const Z=new Map(N).set(g,!0);if(x(m,g,{vocab:!0,base:!1},d,Z,C)!==T)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:d})}q["@id"]=T,q._prefix=F&&!q._termHasColon&&T.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in q))if(q._termHasColon){const T=g.substr(0,L);if(d.hasOwnProperty(T)&&v.createTermDefinition({activeCtx:m,localCtx:d,term:T,defined:N,options:C}),m.mappings.has(T)){const Z=g.substr(L+1);q["@id"]=m.mappings.get(T)["@id"]+Z}else q["@id"]=g}else if(g==="@type")q["@id"]=g;else{if(!("@vocab"in m))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:d,term:g});q["@id"]=m["@vocab"]+g}if((B["@protected"]===!0||N.get("@protected")===!0&&B["@protected"]!==!1)&&(m.protected[g]=!0,q.protected=!0),N.set(g,!0),"@type"in B){let T=B["@type"];if(!i(T))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:d});if(T==="@json"||T==="@none"){if(v.processingMode(m,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${T}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:d})}else if(T!=="@id"&&T!=="@vocab"){if(T=x(m,T,{vocab:!0,base:!1},d,N,C),!a(T))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:d});if(T.indexOf("_:")===0)throw new e("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:d})}q["@type"]=T}if("@container"in B){const T=i(B["@container"])?[B["@container"]]:B["@container"]||[],Z=["@list","@set","@index","@language"];let k=!0;const Y=T.includes("@set");if(v.processingMode(m,1.1)){if(Z.push("@graph","@id","@type"),T.includes("@list")){if(T.length!==1)throw new e("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:d})}else if(T.includes("@graph")){if(T.some(w=>w!=="@graph"&&w!=="@id"&&w!=="@index"&&w!=="@set"))throw new e("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:d})}else k&=T.length<=(Y?2:1);if(T.includes("@type")&&(q["@type"]=q["@type"]||"@id",!["@id","@vocab"].includes(q["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:d})}else k&=!t(B["@container"]),k&=T.length<=1;if(k&=T.every(w=>Z.includes(w)),k&=!(Y&&T.includes("@list")),!k)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+Z.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:d});if(q.reverse&&!T.every(w=>["@index","@set"].includes(w)))throw new e("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:d});q["@container"]=T}if("@index"in B){if(!("@container"in B)||!q["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${B["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:d});if(!i(B["@index"])||B["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${B["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:d});q["@index"]=B["@index"]}if("@context"in B&&(q["@context"]=B["@context"]),"@language"in B&&!("@type"in B)){let T=B["@language"];if(T!==null&&!i(T))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:d});T!==null&&(T=T.toLowerCase()),q["@language"]=T}if("@prefix"in B){if(g.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:d});if(v.isKeyword(q["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:d});if(typeof B["@prefix"]=="boolean")q._prefix=B["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:d})}if("@direction"in B){const T=B["@direction"];if(T!==null&&T!=="ltr"&&T!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:d});q["@direction"]=T}if("@nest"in B){const T=B["@nest"];if(!i(T)||T!=="@nest"&&T.indexOf("@")===0)throw new e("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:d});q["@nest"]=T}// disallow aliasing @context and @preserve
346
+ const te=q["@id"];if(te==="@context"||te==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:d});if(R&&R.protected&&!A&&(m.protected[g]=!0,q.protected=!0,!S(R,q)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:d,term:g})},v.expandIri=(m,d,g,N)=>x(m,d,g,void 0,void 0,N);function x(m,d,g,N,C,A){if(d===null||!i(d)||v.isKeyword(d))return d;if(d.match(h))return null;if(N&&N.hasOwnProperty(d)&&C.get(d)!==!0&&v.createTermDefinition({activeCtx:m,localCtx:N,term:d,defined:C,options:A}),g=g||{},g.vocab){const R=m.mappings.get(d);if(R===null)return null;if(n(R)&&"@id"in R)return R["@id"]}const B=d.indexOf(":");if(B>0){const R=d.substr(0,B),F=d.substr(B+1);if(R==="_"||F.indexOf("//")===0)return d;N&&N.hasOwnProperty(R)&&v.createTermDefinition({activeCtx:m,localCtx:N,term:R,defined:C,options:A});const q=m.mappings.get(R);if(q&&q._prefix)return q["@id"]+F;if(a(d))return d}if(g.vocab&&"@vocab"in m)d=m["@vocab"]+d;else if(g.base){let R,F;"@base"in m?m["@base"]?(F=u(A.base,m["@base"]),R=u(F,d)):(F=m["@base"],R=d):(F=A.base,R=u(A.base,d)),d=R}return d}v.getInitialContext=m=>{const d=JSON.stringify({processingMode:m.processingMode}),g=_.get(d);if(g)return g;const N={processingMode:m.processingMode,mappings:new Map,inverse:null,getInverse:C,clone:R,revertToPreviousContext:F,protected:{}};return _.size===E&&_.clear(),_.set(d,N),N;function C(){const q=this;if(q.inverse)return q.inverse;const D=q.inverse={},L=q.fastCurieMap={},te={},T=(q["@language"]||"@none").toLowerCase(),Z=q["@direction"],k=q.mappings,Y=[...k.keys()].sort(y);for(const w of Y){const H=k.get(w);if(H===null)continue;let K=H["@container"]||"@none";if(K=[].concat(K).sort().join(""),H["@id"]===null)continue;const Q=b(H["@id"]);for(const ue of Q){let V=D[ue];const G=v.isKeyword(ue);if(V)!G&&!H._termHasColon&&te[ue].push(w);else if(D[ue]=V={},!G&&!H._termHasColon){te[ue]=[w];const z={iri:ue,terms:te[ue]};ue[0]in L?L[ue[0]].push(z):L[ue[0]]=[z]}if(V[K]||(V[K]={"@language":{},"@type":{},"@any":{}}),V=V[K],B(w,V["@any"],"@none"),H.reverse)B(w,V["@type"],"@reverse");else if(H["@type"]==="@none")B(w,V["@any"],"@none"),B(w,V["@language"],"@none"),B(w,V["@type"],"@none");else if("@type"in H)B(w,V["@type"],H["@type"]);else if("@language"in H&&"@direction"in H){const z=H["@language"],U=H["@direction"];z&&U?B(w,V["@language"],`${z}_${U}`.toLowerCase()):z?B(w,V["@language"],z.toLowerCase()):U?B(w,V["@language"],`_${U}`):B(w,V["@language"],"@null")}else"@language"in H?B(w,V["@language"],(H["@language"]||"@null").toLowerCase()):"@direction"in H?H["@direction"]?B(w,V["@language"],`_${H["@direction"]}`):B(w,V["@language"],"@none"):Z?(B(w,V["@language"],`_${Z}`),B(w,V["@language"],"@none"),B(w,V["@type"],"@none")):(B(w,V["@language"],T),B(w,V["@language"],"@none"),B(w,V["@type"],"@none"))}}for(const w in L)A(L,w,1);return D}function A(q,D,L){const te=q[D],T=q[D]={};let Z,k;for(const Y of te)Z=Y.iri,L>=Z.length?k="":k=Z[L],k in T?T[k].push(Y):T[k]=[Y];for(const Y in T)Y!==""&&A(T,Y,L+1)}function B(q,D,L){D.hasOwnProperty(L)||(D[L]=q)}function R(){const q={};return q.mappings=r.clone(this.mappings),q.clone=this.clone,q.inverse=null,q.getInverse=this.getInverse,q.protected=r.clone(this.protected),this.previousContext&&(q.previousContext=this.previousContext.clone()),q.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(q["@base"]=this["@base"]),"@language"in this&&(q["@language"]=this["@language"]),"@vocab"in this&&(q["@vocab"]=this["@vocab"]),q}function F(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(m,d,g)=>{if(d===null)return g==="@context"?void 0:null;if(m.mappings.has(d)){const N=m.mappings.get(d);if(s(g))return N;if(N.hasOwnProperty(g))return N[g]}if(g==="@language"&&g in m||g==="@direction"&&g in m)return m[g];if(g!=="@context")return null},v.processingMode=(m,d)=>d.toString()>="1.1"?!m.processingMode||m.processingMode>="json-ld-"+d.toString():m.processingMode==="json-ld-1.0",v.isKeyword=m=>{if(!i(m)||m[0]!=="@")return!1;switch(m){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 S(m,d){if(!(m&&typeof m=="object")||!(d&&typeof d=="object"))return m===d;const g=Array.isArray(m);if(g!==Array.isArray(d))return!1;if(g){if(m.length!==d.length)return!1;for(let A=0;A<m.length;++A)if(!S(m[A],d[A]))return!1;return!0}const N=Object.keys(m),C=Object.keys(d);if(N.length!==C.length)return!1;for(const A in m){let B=m[A],R=d[A];if(A==="@container"&&Array.isArray(B)&&Array.isArray(R)&&(B=B.slice().sort(),R=R.slice().sort()),!S(B,R))return!1}return!0}return Ds}var Ls,Zl;function qf(){if(Zl)return Ls;Zl=1;const r=pt(),{isArray:e,isObject:t,isEmptyObject:n,isString:i,isUndefined:s}=ut(),{isList:a,isValue:o,isGraph:u,isSubject:l}=kt(),{expandIri:c,getContextValue:h,isKeyword:b,process:y,processingMode:_}=hr(),{isAbsolute:E}=Jt(),{REGEX_BCP47:v,REGEX_KEYWORD:x,addValue:S,asArray:m,getValues:d,validateTypeValue:g}=dt(),{handleEvent:N}=Tn(),C={};Ls=C,C.expand=async({activeCtx:D,activeProperty:L=null,element:te,options:T={},insideList:Z=!1,insideIndex:k=!1,typeScopedContext:Y=null})=>{if(te==null)return null;if(L==="@default"&&(T=Object.assign({},T,{isFrame:!1})),!e(te)&&!t(te))return!Z&&(L===null||c(D,L,{vocab:!0},T)==="@graph")?(T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:te}},options:T}),null):R({activeCtx:D,activeProperty:L,value:te,options:T});if(e(te)){let z=[];const U=h(D,L,"@container")||[];Z=Z||U.includes("@list");for(let ee=0;ee<te.length;++ee){let re=await C.expand({activeCtx:D,activeProperty:L,element:te[ee],options:T,insideIndex:k,typeScopedContext:Y});Z&&e(re)&&(re={"@list":re}),re!==null&&(e(re)?z=z.concat(re):z.push(re))}return z}const w=c(D,L,{vocab:!0},T),H=h(D,L,"@context");Y=Y||(D.previousContext?D:null);let K=Object.keys(te).sort(),Q=!k;if(Q&&Y&&K.length<=2&&!K.includes("@context"))for(const z of K){const U=c(Y,z,{vocab:!0},T);if(U==="@value"){Q=!1,D=Y;break}if(U==="@id"&&K.length===1){Q=!1;break}}Q&&(D=D.revertToPreviousContext()),s(H)||(D=await y({activeCtx:D,localCtx:H,propagate:!0,overrideProtected:!0,options:T})),"@context"in te&&(D=await y({activeCtx:D,localCtx:te["@context"],options:T})),Y=D;let ue=null;for(const z of K)if(c(D,z,{vocab:!0},T)==="@type"){ue=ue||z;const ee=te[z],re=Array.isArray(ee)?ee.length>1?ee.slice().sort():ee:[ee];for(const fe of re){const ge=h(Y,fe,"@context");s(ge)||(D=await y({activeCtx:D,localCtx:ge,options:T,propagate:!1}))}}let V={};await B({activeCtx:D,activeProperty:L,expandedActiveProperty:w,element:te,expandedParent:V,options:T,insideList:Z,typeKey:ue,typeScopedContext:Y}),K=Object.keys(V);let G=K.length;if("@value"in V){if("@type"in V&&("@language"in V||"@direction"in V))throw new r('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:V});let z=G-1;if("@type"in V&&(z-=1),"@index"in V&&(z-=1),"@language"in V&&(z-=1),"@direction"in V&&(z-=1),z!==0)throw new r('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:V});const U=V["@value"]===null?[]:m(V["@value"]),ee=d(V,"@type");if(!(_(D,1.1)&&ee.includes("@json")&&ee.length===1))if(U.length===0)T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:V}},options:T}),V=null;else{if(!U.every(re=>i(re)||n(re))&&"@language"in V)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:V});if(!ee.every(re=>E(re)&&!(i(re)&&re.indexOf("_:")===0)||n(re)))throw new r('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:V})}}else if("@type"in V&&!e(V["@type"]))V["@type"]=[V["@type"]];else if("@set"in V||"@list"in V){if(G>1&&!(G===2&&"@index"in V))throw new r('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:V});"@set"in V&&(V=V["@set"],K=Object.keys(V),G=K.length)}else G===1&&"@language"in V&&(T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:V}},options:T}),V=null);return t(V)&&!T.keepFreeFloatingNodes&&!Z&&(L===null||w==="@graph"||(h(D,L,"@container")||[]).includes("@graph"))&&(V=A({value:V,count:G,options:T})),V};function A({value:D,count:L,options:te}){if(L===0||"@value"in D||"@list"in D||L===1&&"@id"in D){if(te.eventHandler){let T,Z;L===0?(T="empty object",Z="Dropping empty object."):"@value"in D?(T="object with only @value",Z="Dropping object with only @value."):"@list"in D?(T="object with only @list",Z="Dropping object with only @list."):L===1&&"@id"in D&&(T="object with only @id",Z="Dropping object with only @id."),N({event:{type:["JsonLdEvent"],code:T,level:"warning",message:Z,details:{value:D}},options:te})}return null}return D}async function B({activeCtx:D,activeProperty:L,expandedActiveProperty:te,element:T,expandedParent:Z,options:k={},insideList:Y,typeKey:w,typeScopedContext:H}){const K=Object.keys(T).sort(),Q=[];let ue;const V=T[w]&&c(D,e(T[w])?T[w][0]:T[w],{vocab:!0},{...k,typeExpansion:!0})==="@json";for(const G of K){let z=T[G],U;if(G==="@context")continue;const ee=c(D,G,{vocab:!0},k);if(ee===null||!(E(ee)||b(ee))){k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:G,expandedProperty:ee}},options:k});continue}if(b(ee)){if(te==="@reverse")throw new r("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:z});if(ee in Z&&ee!=="@included"&&ee!=="@type")throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:ee})}if(ee==="@id"){if(!i(z)){if(!k.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:z});if(t(z)){if(!n(z))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}else if(e(z)){if(!z.every(j=>i(j)))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}else throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}S(Z,"@id",m(z).map(j=>{if(i(j)){const W=c(D,j,{base:!0},k);return k.eventHandler&&(W===null?N(j===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:j}},options:k}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:k}):E(W)||N({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:j,expandedId:W}},options:k})),W}return j}),{propertyIsArray:k.isFrame});continue}if(ee==="@type"){t(z)&&(z=Object.fromEntries(Object.entries(z).map(([j,W])=>[c(H,j,{vocab:!0}),m(W).map(se=>c(H,se,{base:!0,vocab:!0},{...k,typeExpansion:!0}))]))),g(z,k.isFrame),S(Z,"@type",m(z).map(j=>{if(i(j)){const W=c(H,j,{base:!0,vocab:!0},{...k,typeExpansion:!0});return W!=="@json"&&!E(W)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:j}},options:k}),W}return j}),{propertyIsArray:!!k.isFrame});continue}if(ee==="@included"&&_(D,1.1)){const j=m(await C.expand({activeCtx:D,activeProperty:L,element:z,options:k}));if(!j.every(W=>l(W)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:z});S(Z,"@included",j,{propertyIsArray:!0});continue}if(ee==="@graph"&&!(t(z)||e(z)))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:z});if(ee==="@value"){ue=z,V&&_(D,1.1)?Z["@value"]=z:S(Z,"@value",z,{propertyIsArray:k.isFrame});continue}if(ee==="@language"){if(z===null)continue;if(!i(z)&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:z});z=m(z).map(j=>i(j)?j.toLowerCase():j);for(const j of z)i(j)&&!j.match(v)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:j}},options:k});S(Z,"@language",z,{propertyIsArray:k.isFrame});continue}if(ee==="@direction"){if(!i(z)&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:z});z=m(z);for(const j of z)if(i(j)&&j!=="ltr"&&j!=="rtl")throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:z});S(Z,"@direction",z,{propertyIsArray:k.isFrame});continue}if(ee==="@index"){if(!i(z))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:z});S(Z,"@index",z);continue}if(ee==="@reverse"){if(!t(z))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:z});if(U=await C.expand({activeCtx:D,activeProperty:"@reverse",element:z,options:k}),"@reverse"in U)for(const W in U["@reverse"])S(Z,W,U["@reverse"][W],{propertyIsArray:!0});let j=Z["@reverse"]||null;for(const W in U){if(W==="@reverse")continue;j===null&&(j=Z["@reverse"]={}),S(j,W,[],{propertyIsArray:!0});const se=U[W];for(let he=0;he<se.length;++he){const pe=se[he];if(o(pe)||a(pe))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:U});S(j,W,pe,{propertyIsArray:!0})}}continue}if(ee==="@nest"){Q.push(G);continue}let re=D;const fe=h(D,G,"@context");s(fe)||(re=await y({activeCtx:D,localCtx:fe,propagate:!0,overrideProtected:!0,options:k}));const ge=h(D,G,"@container")||[];if(ge.includes("@language")&&t(z)){const j=h(re,G,"@direction");U=F(re,z,j,k)}else if(ge.includes("@index")&&t(z)){const j=ge.includes("@graph"),W=h(re,G,"@index")||"@index",se=W!=="@index"&&c(D,W,{vocab:!0},k);U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:j,indexKey:W,propertyIndex:se})}else if(ge.includes("@id")&&t(z)){const j=ge.includes("@graph");U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:j,indexKey:"@id"})}else if(ge.includes("@type")&&t(z))U=await q({activeCtx:re.revertToPreviousContext(),options:k,activeProperty:G,value:z,asGraph:!1,indexKey:"@type"});else{const j=ee==="@list";if(j||ee==="@set"){let W=L;j&&te==="@graph"&&(W=null),U=await C.expand({activeCtx:re,activeProperty:W,element:z,options:k,insideList:j})}else h(D,G,"@type")==="@json"?U={"@type":"@json","@value":z}:U=await C.expand({activeCtx:re,activeProperty:G,element:z,options:k,insideList:!1})}if(!(U===null&&ee!=="@value")){if(ee!=="@list"&&!a(U)&&ge.includes("@list")&&(U={"@list":m(U)}),ge.includes("@graph")&&!ge.some(j=>j==="@id"||j==="@index")){if(U=m(U),k.isFrame||(U=U.filter(j=>{const W=Object.keys(j).length;return A({value:j,count:W,options:k})!==null})),U.length===0)continue;U=U.map(j=>({"@graph":m(j)}))}if(re.mappings.has(G)&&re.mappings.get(G).reverse){const j=Z["@reverse"]=Z["@reverse"]||{};U=m(U);for(let W=0;W<U.length;++W){const se=U[W];if(o(se)||a(se))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:U});S(j,ee,se,{propertyIsArray:!0})}continue}S(Z,ee,U,{propertyIsArray:!0})}}if("@value"in Z&&!(Z["@type"]==="@json"&&_(D,1.1))){if((t(ue)||e(ue))&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:ue})}for(const G of Q){const z=e(T[G])?T[G]:[T[G]];for(const U of z){if(!t(U)||Object.keys(U).some(ee=>c(D,ee,{vocab:!0},k)==="@value"))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:U});await B({activeCtx:D,activeProperty:L,expandedActiveProperty:te,element:U,expandedParent:Z,options:k,insideList:Y,typeScopedContext:H,typeKey:w})}}}function R({activeCtx:D,activeProperty:L,value:te,options:T}){if(te==null)return null;const Z=c(D,L,{vocab:!0},T);if(Z==="@id")return c(D,te,{base:!0},T);if(Z==="@type")return c(D,te,{vocab:!0,base:!0},{...T,typeExpansion:!0});const k=h(D,L,"@type");if((k==="@id"||Z==="@graph")&&i(te)){const w=c(D,te,{base:!0},T);return w===null&&te.match(x)&&T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:L}},options:T}),{"@id":w}}if(k==="@vocab"&&i(te))return{"@id":c(D,te,{vocab:!0,base:!0},T)};if(b(Z))return te;const Y={};if(k&&!["@id","@vocab","@none"].includes(k))Y["@type"]=k;else if(i(te)){const w=h(D,L,"@language");w!==null&&(Y["@language"]=w);const H=h(D,L,"@direction");H!==null&&(Y["@direction"]=H)}return["boolean","number","string"].includes(typeof te)||(te=te.toString()),Y["@value"]=te,Y}function F(D,L,te,T){const Z=[],k=Object.keys(L).sort();for(const Y of k){const w=c(D,Y,{vocab:!0},T);let H=L[Y];e(H)||(H=[H]);for(const K of H){if(K===null)continue;if(!i(K))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:L});const Q={"@value":K};w!=="@none"&&(Y.match(v)||T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:T}),Q["@language"]=Y.toLowerCase()),te&&(Q["@direction"]=te),Z.push(Q)}}return Z}async function q({activeCtx:D,options:L,activeProperty:te,value:T,asGraph:Z,indexKey:k,propertyIndex:Y}){const w=[],H=Object.keys(T).sort(),K=k==="@type";for(let Q of H){if(K){const G=h(D,Q,"@context");s(G)||(D=await y({activeCtx:D,localCtx:G,propagate:!1,options:L}))}let ue=T[Q];e(ue)||(ue=[ue]),ue=await C.expand({activeCtx:D,activeProperty:te,element:ue,options:L,insideList:!1,insideIndex:!0});let V;Y?Q==="@none"?V="@none":V=R({activeCtx:D,activeProperty:k,value:Q,options:L}):V=c(D,Q,{vocab:!0},L),k==="@id"?Q=c(D,Q,{base:!0},L):K&&(Q=V);for(let G of ue){if(Z&&!u(G)&&(G={"@graph":[G]}),k==="@type")V==="@none"||(G["@type"]?G["@type"]=[Q].concat(G["@type"]):G["@type"]=[Q]);else{if(o(G)&&!["@language","@type","@index"].includes(k))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${k}".`,"jsonld.SyntaxError",{code:"invalid value object",value:G});Y?V!=="@none"&&S(G,Y,V,{propertyIsArray:!0,prependValue:!0}):V!=="@none"&&!(k in G)&&(G[k]=Q)}w.push(G)}}return w}return Ls}var Os,eu;function bi(){if(eu)return Os;eu=1;const{isKeyword:r}=hr(),e=kt(),t=ut(),n=dt(),i=pt(),s={};return Os=s,s.createMergedNodeMap=(a,o)=>{o=o||{};const u=o.issuer||new n.IdentifierIssuer("_:b"),l={"@default":{}};return s.createNodeMap(a,l,"@default",u),s.mergeNodeMaps(l)},s.createNodeMap=(a,o,u,l,c,h)=>{if(t.isArray(a)){for(const E of a)s.createNodeMap(E,o,u,l,void 0,h);return}if(!t.isObject(a)){h&&h.push(a);return}if(e.isValue(a)){if("@type"in a){let E=a["@type"];E.indexOf("_:")===0&&(a["@type"]=E=l.getId(E))}h&&h.push(a);return}else if(h&&e.isList(a)){const E=[];s.createNodeMap(a["@list"],o,u,l,c,E),h.push({"@list":E});return}if("@type"in a){const E=a["@type"];for(const v of E)v.indexOf("_:")===0&&l.getId(v)}t.isUndefined(c)&&(c=e.isBlankNode(a)?l.getId(a["@id"]):a["@id"]),h&&h.push({"@id":c});const b=o[u],y=b[c]=b[c]||{};y["@id"]=c;const _=Object.keys(a).sort();for(let E of _){if(E==="@id")continue;if(E==="@reverse"){const x={"@id":c},S=a["@reverse"];for(const m in S){const d=S[m];for(const g of d){let N=g["@id"];e.isBlankNode(g)&&(N=l.getId(N)),s.createNodeMap(g,o,u,l,N),n.addValue(b[N],m,x,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(E==="@graph"){c in o||(o[c]={}),s.createNodeMap(a[E],o,c,l);continue}if(E==="@included"){s.createNodeMap(a[E],o,u,l);continue}if(E!=="@type"&&r(E)){if(E==="@index"&&E in y&&(a[E]!==y[E]||a[E]["@id"]!==y[E]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:y});y[E]=a[E];continue}const v=a[E];if(E.indexOf("_:")===0&&(E=l.getId(E)),v.length===0){n.addValue(y,E,[],{propertyIsArray:!0});continue}for(let x of v)if(E==="@type"&&(x=x.indexOf("_:")===0?l.getId(x):x),e.isSubject(x)||e.isSubjectReference(x)){if("@id"in x&&!x["@id"])continue;const S=e.isBlankNode(x)?l.getId(x["@id"]):x["@id"];n.addValue(y,E,{"@id":S},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(x,o,u,l,S)}else if(e.isValue(x))n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(x)){const S=[];s.createNodeMap(x["@list"],o,u,l,c,S),x={"@list":S},n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(x,o,u,l,c),n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=a=>{const o={};for(const u of Object.keys(a).sort())for(const l of Object.keys(a[u]).sort()){const c=a[u][l];l in o||(o[l]={"@id":l});const h=o[l];for(const b of Object.keys(c).sort())if(r(b)&&b!=="@type")h[b]=n.clone(c[b]);else for(const y of c[b])n.addValue(h,b,n.clone(y),{propertyIsArray:!0,allowDuplicate:!1})}return o},s.mergeNodeMaps=a=>{const o=a["@default"],u=Object.keys(a).sort();for(const l of u){if(l==="@default")continue;const c=a[l];let h=o[l];h?"@graph"in h||(h["@graph"]=[]):o[l]=h={"@id":l,"@graph":[]};const b=h["@graph"];for(const y of Object.keys(c).sort()){const _=c[y];e.isSubjectReference(_)||b.push(_)}}return o},Os}var Cs,tu;function Uf(){if(tu)return Cs;tu=1;const{isSubjectReference:r}=kt(),{createMergedNodeMap:e}=bi(),t={};return Cs=t,t.flatten=n=>{const i=e(n),s=[],a=Object.keys(i).sort();for(let o=0;o<a.length;++o){const u=i[a[o]];r(u)||s.push(u)}return s},Cs}var js,ru;function Hf(){if(ru)return js;ru=1;const r=pt(),e=kt(),t=ut(),{REGEX_BCP47:n,addValue:i}=dt(),{handleEvent:s}=Tn(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:u,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:h,XSD_BOOLEAN:b,XSD_DOUBLE:y,XSD_INTEGER:_,XSD_STRING:E}=Ha(),v={};js=v,v.fromRDF=async(S,m)=>{const{useRdfType:d=!1,useNativeTypes:g=!1,rdfDirection:N=null}=m,C={},A={"@default":C},B={};if(N){if(N==="compound-literal")throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:N});if(N!=="i18n-datatype")throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:N})}for(const q of S){const D=q.graph.termType==="DefaultGraph"?"@default":q.graph.value;D in A||(A[D]={}),D!=="@default"&&!(D in C)&&(C[D]={"@id":D});const L=A[D],te=q.subject.value,T=q.predicate.value,Z=q.object;te in L||(L[te]={"@id":te});const k=L[te],Y=Z.termType.endsWith("Node");if(Y&&!(Z.value in L)&&(L[Z.value]={"@id":Z.value}),T===c&&!d&&Y){i(k,"@type",Z.value,{propertyIsArray:!0});continue}const w=x(Z,g,N,m);if(i(k,T,w,{propertyIsArray:!0}),Y)if(Z.value===l){const H=L[Z.value];"usages"in H||(H.usages=[]),H.usages.push({node:k,property:T,value:w})}else Z.value in B?B[Z.value]=!1:B[Z.value]={node:k,property:T,value:w}}for(const q in A){const D=A[q];if(!(l in D))continue;const L=D[l];if(L.usages){for(let te of L.usages){let T=te.node,Z=te.property,k=te.value;const Y=[],w=[];let H=Object.keys(T).length;for(;Z===u&&t.isObject(B[T["@id"]])&&t.isArray(T[o])&&T[o].length===1&&t.isArray(T[u])&&T[u].length===1&&(H===3||H===4&&t.isArray(T["@type"])&&T["@type"].length===1&&T["@type"][0]===a)&&(Y.push(T[o][0]),w.push(T["@id"]),te=B[T["@id"]],T=te.node,Z=te.property,k=te.value,H=Object.keys(T).length,!!e.isBlankNode(T)););delete k["@id"],k["@list"]=Y.reverse();for(const K of w)delete D[K]}delete L.usages}}const R=[],F=Object.keys(C).sort();for(const q of F){const D=C[q];if(q in A){const L=D["@graph"]=[],te=A[q],T=Object.keys(te).sort();for(const Z of T){const k=te[Z];e.isSubjectReference(k)||L.push(k)}}e.isSubjectReference(D)||R.push(D)}return R};function x(S,m,d,g){if(S.termType.endsWith("Node"))return{"@id":S.value};const N={"@value":S.value};if(S.language)S.language.match(n)||g.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:S.language}},options:g}),N["@language"]=S.language;else{let C=S.datatype.value;if(C||(C=E),C===h){C="@json";try{N["@value"]=JSON.parse(N["@value"])}catch(A){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:N["@value"],cause:A})}}if(m){if(C===b)N["@value"]==="true"?N["@value"]=!0:N["@value"]==="false"&&(N["@value"]=!1);else if(t.isNumeric(N["@value"]))if(C===_){const A=parseInt(N["@value"],10);A.toFixed(0)===N["@value"]&&(N["@value"]=A)}else C===y&&(N["@value"]=parseFloat(N["@value"]));[b,_,y,E].includes(C)||(N["@type"]=C)}else if(d==="i18n-datatype"&&C.startsWith("https://www.w3.org/ns/i18n#")){const[,A,B]=C.split(/[#_]/);A.length>0&&(N["@language"]=A,A.match(n)||g.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:A}},options:g})),N["@direction"]=B}else C!==E&&(N["@type"]=C)}return N}return js}var $s,nu;function Vf(){return nu||(nu=1,$s=function r(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,n,i)=>{const s=i===0?"":",",a=n===void 0||typeof n=="symbol"?null:n;return t+s+r(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,n,i)=>{if(e[n]===void 0||typeof e[n]=="symbol")return t;const s=t.length===0?"":",";return t+s+r(n)+":"+r(e[n])},"")+"}"}),$s}var Fs,iu;function Gf(){if(iu)return Fs;iu=1;const{createNodeMap:r}=bi(),{isKeyword:e}=hr(),t=kt(),n=Vf(),i=pt(),s=ut(),a=dt(),{handleEvent:o}=Tn(),{RDF_FIRST:u,RDF_REST:l,RDF_NIL:c,RDF_TYPE:h,RDF_JSON_LITERAL:b,RDF_LANGSTRING:y,XSD_BOOLEAN:_,XSD_DOUBLE:E,XSD_INTEGER:v,XSD_STRING:x}=Ha(),{isAbsolute:S}=Jt(),m={};Fs=m,m.toRDF=(C,A)=>{const B=new a.IdentifierIssuer("_:b"),R={"@default":{}};r(C,R,"@default",B);const F=[],q=Object.keys(R).sort();for(const D of q){let L;if(D==="@default")L={termType:"DefaultGraph",value:""};else if(S(D))D.startsWith("_:")?L={termType:"BlankNode"}:L={termType:"NamedNode"},L.value=D;else{A.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:D}},options:A});continue}d(F,R[D],L,B,A)}return F};function d(C,A,B,R,F){const q=Object.keys(A).sort();for(const D of q){const L=A[D],te=Object.keys(L).sort();for(let T of te){const Z=L[T];if(T==="@type")T=h;else if(e(T))continue;for(const k of Z){const Y={termType:D.startsWith("_:")?"BlankNode":"NamedNode",value:D};if(!S(D)){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:D}},options:F});continue}const w={termType:T.startsWith("_:")?"BlankNode":"NamedNode",value:T};if(!S(T)){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:T}},options:F});continue}if(w.termType==="BlankNode"&&!F.produceGeneralizedRdf){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:R.getOldIds().find(K=>R.getId(K)===T)}},options:F});continue}const H=N(k,R,C,B,F.rdfDirection,F);H&&C.push({subject:Y,predicate:w,object:H,graph:B})}}}}function g(C,A,B,R,F,q){const D={termType:"NamedNode",value:u},L={termType:"NamedNode",value:l},te={termType:"NamedNode",value:c},T=C.pop(),Z=T?{termType:"BlankNode",value:A.getId()}:te;let k=Z;for(const Y of C){const w=N(Y,A,B,R,F,q),H={termType:"BlankNode",value:A.getId()};B.push({subject:k,predicate:D,object:w,graph:R}),B.push({subject:k,predicate:L,object:H,graph:R}),k=H}if(T){const Y=N(T,A,B,R,F,q);B.push({subject:k,predicate:D,object:Y,graph:R}),B.push({subject:k,predicate:L,object:te,graph:R})}return Z}function N(C,A,B,R,F,q){const D={};if(t.isValue(C)){D.termType="Literal",D.value=void 0,D.datatype={termType:"NamedNode"};let L=C["@value"];const te=C["@type"]||null;if(te==="@json")D.value=n(L),D.datatype.value=b;else if(s.isBoolean(L))D.value=L.toString(),D.datatype.value=te||_;else if(s.isDouble(L)||te===E)s.isDouble(L)||(L=parseFloat(L)),D.value=L.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),D.datatype.value=te||E;else if(s.isNumber(L))D.value=L.toFixed(0),D.datatype.value=te||v;else if("@direction"in C&&F==="i18n-datatype"){const T=(C["@language"]||"").toLowerCase(),Z=C["@direction"],k=`https://www.w3.org/ns/i18n#${T}_${Z}`;D.datatype.value=k,D.value=L}else{if("@direction"in C&&F==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});if("@direction"in C&&F)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});"@language"in C?("@direction"in C&&!F&&q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:D.value}},options:q}),D.value=L,D.datatype.value=te||y,D.language=C["@language"]):("@direction"in C&&!F&&q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:D.value}},options:q}),D.value=L,D.datatype.value=te||x)}}else if(t.isList(C)){const L=g(C["@list"],A,B,R,F,q);D.termType=L.termType,D.value=L.value}else{const L=s.isObject(C)?C["@id"]:C;D.termType=L.startsWith("_:")?"BlankNode":"NamedNode",D.value=L}return D.termType==="NamedNode"&&!S(D.value)?(q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:D.value}},options:q}),null):D}return Fs}var ks,su;function Wf(){if(su)return ks;su=1;const{isKeyword:r}=hr(),e=kt(),t=ut(),n=dt(),i=Jt(),s=pt(),{createNodeMap:a,mergeNodeMapGraphs:o}=bi(),u={};ks=u,u.frameMergedOrDefault=(d,g,N)=>{const C={options:N,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},A=new n.IdentifierIssuer("_:b");a(d,C.graphMap,"@default",A),N.merged&&(C.graphMap["@merged"]=o(C.graphMap),C.graph="@merged"),C.subjects=C.graphMap[C.graph];const B=[];u.frame(C,Object.keys(C.subjects).sort(),g,B),N.pruneBlankNodeIdentifiers&&(N.bnodesToClear=Object.keys(C.bnodeMap).filter(R=>C.bnodeMap[R].length===1));// remove @preserve from results
347
+ return N.link={},v(B,N)},u.frame=(d,g,N,C,A=null)=>{b(N),N=N[0];const B=d.options,R={embed:h(N,B,"embed"),explicit:h(N,B,"explicit"),requireAll:h(N,B,"requireAll")};d.link.hasOwnProperty(d.graph)||(d.link[d.graph]={});const F=d.link[d.graph],q=y(d,g,N,R),D=Object.keys(q).sort();for(const L of D){const te=q[L];if(A===null?d.uniqueEmbeds={[d.graph]:{}}:d.uniqueEmbeds[d.graph]=d.uniqueEmbeds[d.graph]||{},R.embed==="@link"&&L in F){x(C,A,F[L]);continue}const T={"@id":L};if(L.indexOf("_:")===0&&n.addValue(d.bnodeMap,L,T,{propertyIsArray:!0}),F[L]=T,(R.embed==="@first"||R.embed==="@last")&&d.is11)throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:N});if(!(!d.embedded&&d.uniqueEmbeds[d.graph].hasOwnProperty(L))){if(d.embedded&&(R.embed==="@never"||c(te,d.graph,d.subjectStack))){x(C,A,T);continue}if(d.embedded&&(R.embed=="@first"||R.embed=="@once")&&d.uniqueEmbeds[d.graph].hasOwnProperty(L)){x(C,A,T);continue}if(R.embed==="@last"&&L in d.uniqueEmbeds[d.graph]&&E(d,L),d.uniqueEmbeds[d.graph][L]={parent:C,property:A},d.subjectStack.push({subject:te,graph:d.graph}),L in d.graphMap){let Z=!1,k=null;"@graph"in N?(k=N["@graph"][0],Z=!(L==="@merged"||L==="@default"),t.isObject(k)||(k={})):(Z=d.graph!=="@merged",k={}),Z&&u.frame({...d,graph:L,embedded:!1},Object.keys(d.graphMap[L]).sort(),[k],T,"@graph")}"@included"in N&&u.frame({...d,embedded:!1},g,N["@included"],T,"@included");for(const Z of Object.keys(te).sort()){if(r(Z)){if(T[Z]=n.clone(te[Z]),Z==="@type")for(const k of te["@type"])k.indexOf("_:")===0&&n.addValue(d.bnodeMap,k,T,{propertyIsArray:!0});continue}if(!(R.explicit&&!(Z in N)))for(const k of te[Z]){const Y=Z in N?N[Z]:l(R);if(e.isList(k)){const w=N[Z]&&N[Z][0]&&N[Z][0]["@list"]?N[Z][0]["@list"]:l(R),H={"@list":[]};x(T,Z,H);const K=k["@list"];for(const Q of K)e.isSubjectReference(Q)?u.frame({...d,embedded:!0},[Q["@id"]],w,H,"@list"):x(H,"@list",n.clone(Q))}else e.isSubjectReference(k)?u.frame({...d,embedded:!0},[k["@id"]],Y,T,Z):m(Y[0],k)&&x(T,Z,n.clone(k))}}for(const Z of Object.keys(N).sort()){if(Z==="@type"){if(!t.isObject(N[Z][0])||!("@default"in N[Z][0]))continue}else if(r(Z))continue;const k=N[Z][0]||{};if(!h(k,B,"omitDefault")&&!(Z in T)){let w="@null";"@default"in k&&(w=n.clone(k["@default"])),t.isArray(w)||(w=[w]),T[Z]=[{"@preserve":w}]}}for(const Z of Object.keys(N["@reverse"]||{}).sort()){const k=N["@reverse"][Z];for(const Y of Object.keys(d.subjects))n.getValues(d.subjects[Y],Z).some(H=>H["@id"]===L)&&(T["@reverse"]=T["@reverse"]||{},n.addValue(T["@reverse"],Z,[],{propertyIsArray:!0}),u.frame({...d,embedded:!0},[Y],k,T["@reverse"][Z],A))}x(C,A,T),d.subjectStack.pop()}}},u.cleanupNull=(d,g)=>{if(t.isArray(d))return d.map(C=>u.cleanupNull(C,g)).filter(C=>C);if(d==="@null")return null;if(t.isObject(d)){if("@id"in d){const N=d["@id"];if(g.link.hasOwnProperty(N)){const C=g.link[N].indexOf(d);if(C!==-1)return g.link[N][C];g.link[N].push(d)}else g.link[N]=[d]}for(const N in d)d[N]=u.cleanupNull(d[N],g)}return d};function l(d){const g={};for(const N in d)d[N]!==void 0&&(g["@"+N]=[d[N]]);return[g]}function c(d,g,N){for(let C=N.length-1;C>=0;--C){const A=N[C];if(A.graph===g&&A.subject["@id"]===d["@id"])return!0}return!1}function h(d,g,N){const C="@"+N;let A=C in d?d[C][0]:g[N];if(N==="embed"){if(A===!0)A="@once";else if(A===!1)A="@never";else if(A!=="@always"&&A!=="@never"&&A!=="@link"&&A!=="@first"&&A!=="@last"&&A!=="@once")throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:d})}return A}function b(d){if(!t.isArray(d)||d.length!==1||!t.isObject(d[0]))throw new s("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:d});if("@id"in d[0]){for(const g of n.asArray(d[0]["@id"]))if(!(t.isObject(g)||i.isAbsolute(g))||t.isString(g)&&g.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:d})}if("@type"in d[0]){for(const g of n.asArray(d[0]["@type"]))if(!(t.isObject(g)||i.isAbsolute(g)||g==="@json")||t.isString(g)&&g.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:d})}}function y(d,g,N,C){const A={};for(const B of g){const R=d.graphMap[d.graph][B];_(d,R,N,C)&&(A[B]=R)}return A}function _(d,g,N,C){let A=!0,B=!1;for(const R in N){let F=!1;const q=n.getValues(g,R),D=n.getValues(N,R).length===0;if(R==="@id"){if(t.isEmptyObject(N["@id"][0]||{})?F=!0:N["@id"].length>=0&&(F=N["@id"].includes(q[0])),!C.requireAll)return F}else if(R==="@type"){if(A=!1,D){if(q.length>0)return!1;F=!0}else if(N["@type"].length===1&&t.isEmptyObject(N["@type"][0]))F=q.length>0;else for(const L of N["@type"])t.isObject(L)&&"@default"in L?F=!0:F=F||q.some(te=>te===L);if(!C.requireAll)return F}else{if(r(R))continue;{const L=n.getValues(N,R)[0];let te=!1;if(L&&(b([L]),te="@default"in L),A=!1,q.length===0&&te)continue;if(q.length>0&&D)return!1;if(L===void 0){if(q.length>0)return!1;F=!0}else if(e.isList(L)){const T=L["@list"][0];if(e.isList(q[0])){const Z=q[0]["@list"];e.isValue(T)?F=Z.some(k=>m(T,k)):(e.isSubject(T)||e.isSubjectReference(T))&&(F=Z.some(k=>S(d,T,k,C)))}}else e.isValue(L)?F=q.some(T=>m(L,T)):e.isSubjectReference(L)?F=q.some(T=>S(d,L,T,C)):t.isObject(L)?F=q.length>0:F=!1}}if(!F&&C.requireAll)return!1;B=B||F}return A||B}function E(d,g){const N=d.uniqueEmbeds[d.graph],C=N[g],A=C.parent,B=C.property,R={"@id":g};if(t.isArray(A)){for(let q=0;q<A.length;++q)if(n.compareValues(A[q],R)){A[q]=R;break}}else{const q=t.isArray(A[B]);n.removeValue(A,B,R,{propertyIsArray:q}),n.addValue(A,B,R,{propertyIsArray:q})}const F=q=>{const D=Object.keys(N);for(const L of D)L in N&&t.isObject(N[L].parent)&&N[L].parent["@id"]===q&&(delete N[L],F(L))};F(g)}/**
348
348
  * Removes the @preserve keywords from expanded result of framing.
349
349
  *
350
350
  * @param input the framed, framed output.
351
351
  * @param options the framing options used.
352
352
  *
353
353
  * @return the resulting output.
354
- */function v(h,g){if(t.isArray(h))return h.map(N=>v(N,g));if(t.isObject(h)){// remove @preserve
355
- if("@preserve"in h)return h["@preserve"][0];if(e.isValue(h))return h;if(e.isList(h))return h["@list"]=v(h["@list"],g),h;if("@id"in h){const N=h["@id"];if(g.link.hasOwnProperty(N)){const C=g.link[N].indexOf(h);if(C!==-1)return g.link[N][C];g.link[N].push(h)}else g.link[N]=[h]}for(const N in h){if(N==="@id"&&g.bnodesToClear.includes(h[N])){delete h["@id"];continue}h[N]=v(h[N],g)}}return h}function x(h,g,N){t.isObject(h)?n.addValue(h,g,N,{propertyIsArray:!0}):h.push(N)}function S(h,g,N,C){if(!("@id"in N))return!1;const A=h.subjects[N["@id"]];return A&&_(h,A,g,C)}function m(h,g){const N=g["@value"],C=g["@type"],A=g["@language"],B=h["@value"]?t.isArray(h["@value"])?h["@value"]:[h["@value"]]:[],R=h["@type"]?t.isArray(h["@type"])?h["@type"]:[h["@type"]]:[],F=h["@language"]?t.isArray(h["@language"])?h["@language"]:[h["@language"]]:[];return B.length===0&&R.length===0&&F.length===0?!0:!(!(B.includes(N)||t.isEmptyObject(B[0]))||!(!C&&R.length===0||R.includes(C)||C&&t.isEmptyObject(R[0]))||!(!A&&F.length===0||F.includes(A)||A&&t.isEmptyObject(F[0])))}return Cs}var js,nu;function Uf(){if(nu)return js;nu=1;const r=gt(),{isArray:e,isObject:t,isString:n,isUndefined:i}=ut(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:u,isSubjectReference:l}=kt(),{expandIri:c,getContextValue:d,isKeyword:b,process:y,processingMode:_}=hr(),{removeBase:E,prependBase:v}=Jt(),{REGEX_KEYWORD:x,addValue:S,asArray:m,compareShortestLeast:h}=ht(),g={};js=g,g.compact=async({activeCtx:A,activeProperty:B=null,element:R,options:F={}})=>{if(e(R)){let D=[];for(let L=0;L<R.length;++L){const te=await g.compact({activeCtx:A,activeProperty:B,element:R[L],options:F});te!==null&&D.push(te)}return F.compactArrays&&D.length===1&&(d(A,B,"@container")||[]).length===0&&(D=D[0]),D}const q=d(A,B,"@context");if(i(q)||(A=await y({activeCtx:A,localCtx:q,propagate:!0,overrideProtected:!0,options:F})),t(R)){if(F.link&&"@id"in R&&F.link.hasOwnProperty(R["@id"])){const w=F.link[R["@id"]];for(let H=0;H<w.length;++H)if(w[H].expanded===R)return w[H].compacted}if(a(R)||l(R)){const w=g.compactValue({activeCtx:A,activeProperty:B,value:R,options:F});return F.link&&l(R)&&(F.link.hasOwnProperty(R["@id"])||(F.link[R["@id"]]=[]),F.link[R["@id"]].push({expanded:R,compacted:w})),w}if(s(R)&&(d(A,B,"@container")||[]).includes("@list"))return g.compact({activeCtx:A,activeProperty:B,element:R["@list"],options:F});const D=B==="@reverse",L={},te=A;!a(R)&&!l(R)&&(A=A.revertToPreviousContext());const T=d(te,B,"@context");i(T)||(A=await y({activeCtx:A,localCtx:T,propagate:!0,overrideProtected:!0,options:F})),F.link&&"@id"in R&&(F.link.hasOwnProperty(R["@id"])||(F.link[R["@id"]]=[]),F.link[R["@id"]].push({expanded:R,compacted:L}));let Z=R["@type"]||[];Z.length>1&&(Z=Array.from(Z).sort());const k=A;for(const w of Z){const H=g.compactIri({activeCtx:k,iri:w,relativeTo:{vocab:!0}}),K=d(te,H,"@context");i(K)||(A=await y({activeCtx:A,localCtx:K,options:F,propagate:!1}))}const Y=Object.keys(R).sort();for(const w of Y){const H=R[w];if(w==="@id"){let K=m(H).map(ue=>g.compactIri({activeCtx:A,iri:ue,relativeTo:{vocab:!1},base:F.base}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});L[Q]=K;continue}if(w==="@type"){let K=m(H).map(z=>g.compactIri({activeCtx:te,iri:z,relativeTo:{vocab:!0}}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}}),G=(d(A,Q,"@container")||[]).includes("@set")&&_(A,1.1)||e(K)&&H.length===0;S(L,Q,K,{propertyIsArray:G});continue}if(w==="@reverse"){const K=await g.compact({activeCtx:A,activeProperty:"@reverse",element:H,options:F});for(const Q in K)if(A.mappings.has(Q)&&A.mappings.get(Q).reverse){const ue=K[Q],G=(d(A,Q,"@container")||[]).includes("@set")||!F.compactArrays;S(L,Q,ue,{propertyIsArray:G}),delete K[Q]}if(Object.keys(K).length>0){const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,Q,K)}continue}if(w==="@preserve"){const K=await g.compact({activeCtx:A,activeProperty:B,element:H,options:F});e(K)&&K.length===0||S(L,w,K);continue}if(w==="@index"){if((d(A,B,"@container")||[]).includes("@index"))continue;const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,Q,H);continue}if(w!=="@graph"&&w!=="@list"&&w!=="@included"&&b(w)){const K=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,K,H);continue}if(!e(H))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(H.length===0){const K=g.compactIri({activeCtx:A,iri:w,value:H,relativeTo:{vocab:!0},reverse:D}),Q=A.mappings.has(K)?A.mappings.get(K)["@nest"]:null;let ue=L;Q&&(C(A,Q,F),t(L[Q])||(L[Q]={}),ue=L[Q]),S(ue,K,H,{propertyIsArray:!0})}for(const K of H){const Q=g.compactIri({activeCtx:A,iri:w,value:K,relativeTo:{vocab:!0},reverse:D}),ue=A.mappings.has(Q)?A.mappings.get(Q)["@nest"]:null;let V=L;ue&&(C(A,ue,F),t(L[ue])||(L[ue]={}),V=L[ue]);const G=d(A,Q,"@container")||[],z=o(K),U=s(K);let ee;U?ee=K["@list"]:z&&(ee=K["@graph"]);let re=await g.compact({activeCtx:A,activeProperty:Q,element:U||z?ee:K,options:F});if(U)if(e(re)||(re=[re]),!G.includes("@list"))re={[g.compactIri({activeCtx:A,iri:"@list",relativeTo:{vocab:!0}})]:re},"@index"in K&&(re[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]);else{S(V,Q,re,{valueIsArray:!0,allowDuplicate:!0});continue}if(z)if(G.includes("@graph")&&(G.includes("@id")||G.includes("@index")&&u(K))){let fe;V.hasOwnProperty(Q)?fe=V[Q]:V[Q]=fe={};const ge=(G.includes("@id")?K["@id"]:K["@index"])||g.compactIri({activeCtx:A,iri:"@none",relativeTo:{vocab:!0}});S(fe,ge,re,{propertyIsArray:!F.compactArrays||G.includes("@set")})}else G.includes("@graph")&&u(K)?(e(re)&&re.length>1&&(re={"@included":re}),S(V,Q,re,{propertyIsArray:!F.compactArrays||G.includes("@set")})):(e(re)&&re.length===1&&F.compactArrays&&(re=re[0]),re={[g.compactIri({activeCtx:A,iri:"@graph",relativeTo:{vocab:!0}})]:re},"@id"in K&&(re[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]=K["@id"]),"@index"in K&&(re[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]),S(V,Q,re,{propertyIsArray:!F.compactArrays||G.includes("@set")}));else if(G.includes("@language")||G.includes("@index")||G.includes("@id")||G.includes("@type")){let fe;V.hasOwnProperty(Q)?fe=V[Q]:V[Q]=fe={};let ge;if(G.includes("@language"))a(re)&&(re=re["@value"]),ge=K["@language"];else if(G.includes("@index")){const j=d(A,Q,"@index")||"@index",W=g.compactIri({activeCtx:A,iri:j,relativeTo:{vocab:!0}});if(j==="@index")ge=K["@index"],delete re[W];else{let se;if([ge,...se]=m(re[j]||[]),!n(ge))ge=null;else switch(se.length){case 0:delete re[j];break;case 1:re[j]=se[0];break;default:re[j]=se;break}}}else if(G.includes("@id")){const j=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});ge=re[j],delete re[j]}else if(G.includes("@type")){const j=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}});let W;switch([ge,...W]=m(re[j]||[]),W.length){case 0:delete re[j];break;case 1:re[j]=W[0];break;default:re[j]=W;break}Object.keys(re).length===1&&"@id"in K&&(re=await g.compact({activeCtx:A,activeProperty:Q,element:{"@id":K["@id"]},options:F}))}ge||(ge=g.compactIri({activeCtx:A,iri:"@none",relativeTo:{vocab:!0}})),S(fe,ge,re,{propertyIsArray:G.includes("@set")})}else{const fe=!F.compactArrays||G.includes("@set")||G.includes("@list")||e(re)&&re.length===0||w==="@list"||w==="@graph";S(V,Q,re,{propertyIsArray:fe})}}}return L}return R},g.compactIri=({activeCtx:A,iri:B,value:R=null,relativeTo:F={vocab:!1},reverse:q=!1,base:D=null})=>{if(B===null)return B;A.isPropertyTermScoped&&A.previousContext&&(A=A.previousContext);const L=A.getInverse();if(b(B)&&B in L&&"@none"in L[B]&&"@type"in L[B]["@none"]&&"@none"in L[B]["@none"]["@type"])return L[B]["@none"]["@type"]["@none"];if(F.vocab&&B in L){const Y=A["@language"]||"@none",w=[];t(R)&&"@index"in R&&!("@graph"in R)&&w.push("@index","@index@set"),t(R)&&"@preserve"in R&&(R=R["@preserve"][0]),o(R)?("@index"in R&&w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R&&w.push("@graph@id","@graph@id@set"),w.push("@graph","@graph@set","@set"),"@index"in R||w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R||w.push("@graph@id","@graph@id@set")):t(R)&&!a(R)&&w.push("@id","@id@set","@type","@set@type");let H="@language",K="@null";if(q)H="@type",K="@reverse",w.push("@set");else if(s(R)){"@index"in R||w.push("@list");const ue=R["@list"];if(ue.length===0)H="@any",K="@none";else{let V=ue.length===0?Y:null,G=null;for(let z=0;z<ue.length;++z){const U=ue[z];let ee="@none",re="@none";if(a(U))if("@direction"in U){const fe=(U["@language"]||"").toLowerCase(),ge=U["@direction"];ee=`${fe}_${ge}`}else"@language"in U?ee=U["@language"].toLowerCase():"@type"in U?re=U["@type"]:ee="@null";else re="@id";if(V===null?V=ee:ee!==V&&a(U)&&(V="@none"),G===null?G=re:re!==G&&(G="@none"),V==="@none"&&G==="@none")break}V=V||"@none",G=G||"@none",G!=="@none"?(H="@type",K=G):K=V}}else{if(a(R))if("@language"in R&&!("@index"in R)){w.push("@language","@language@set"),K=R["@language"];const ue=R["@direction"];ue&&(K=`${K}_${ue}`)}else"@direction"in R&&!("@index"in R)?K=`_${R["@direction"]}`:"@type"in R&&(H="@type",K=R["@type"]);else H="@type",K="@id";w.push("@set")}w.push("@none"),t(R)&&!("@index"in R)&&w.push("@index","@index@set"),a(R)&&Object.keys(R).length===1&&w.push("@language","@language@set");const Q=N(A,B,R,w,H,K);if(Q!==null)return Q}if(F.vocab&&"@vocab"in A){const Y=A["@vocab"];if(B.indexOf(Y)===0&&B!==Y){const w=B.substr(Y.length);if(!A.mappings.has(w))return w}}let te=null;const T=[];let Z=A.fastCurieMap;const k=B.length-1;for(let Y=0;Y<k&&B[Y]in Z;++Y)Z=Z[B[Y]],""in Z&&T.push(Z[""][0]);for(let Y=T.length-1;Y>=0;--Y){const w=T[Y],H=w.terms;for(const K of H){const Q=K+":"+B.substr(w.iri.length);A.mappings.get(K)._prefix&&(!A.mappings.has(Q)||R===null&&A.mappings.get(Q)["@id"]===B)&&(te===null||h(Q,te)<0)&&(te=Q)}}if(te!==null)return te;for(const[Y,w]of A.mappings)if(w&&w._prefix&&B.startsWith(Y+":"))throw new r(`Absolute IRI "${B}" confused with prefix "${Y}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:A});if(!F.vocab)if("@base"in A)if(A["@base"]){const Y=E(v(D,A["@base"]),B);return x.test(Y)?`./${Y}`:Y}else return B;else return E(D,B);return B},g.compactValue=({activeCtx:A,activeProperty:B,value:R,options:F})=>{if(a(R)){const te=d(A,B,"@type"),T=d(A,B,"@language"),Z=d(A,B,"@direction"),k=d(A,B,"@container")||[],Y="@index"in R&&!k.includes("@index");if(!Y&&te!=="@none"&&(R["@type"]===te||"@language"in R&&R["@language"]===T&&"@direction"in R&&R["@direction"]===Z||"@language"in R&&R["@language"]===T||"@direction"in R&&R["@direction"]===Z))return R["@value"];const w=Object.keys(R).length,H=w===1||w===2&&"@index"in R&&!Y,K="@language"in A,Q=n(R["@value"]),ue=A.mappings.has(B)&&A.mappings.get(B)["@language"]===null;if(H&&te!=="@none"&&(!K||!Q||ue))return R["@value"];const V={};return Y&&(V[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=R["@index"]),"@type"in R?V[g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}})]=g.compactIri({activeCtx:A,iri:R["@type"],relativeTo:{vocab:!0}}):"@language"in R&&(V[g.compactIri({activeCtx:A,iri:"@language",relativeTo:{vocab:!0}})]=R["@language"]),"@direction"in R&&(V[g.compactIri({activeCtx:A,iri:"@direction",relativeTo:{vocab:!0}})]=R["@direction"]),V[g.compactIri({activeCtx:A,iri:"@value",relativeTo:{vocab:!0}})]=R["@value"],V}const q=c(A,B,{vocab:!0},F),D=d(A,B,"@type"),L=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:D==="@vocab"},base:F.base});return D==="@id"||D==="@vocab"||q==="@graph"?L:{[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]:L}};function N(A,B,R,F,q,D){D===null&&(D="@null");const L=[];if((D==="@id"||D==="@reverse")&&t(R)&&"@id"in R){D==="@reverse"&&L.push("@reverse");const T=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:!0}});A.mappings.has(T)&&A.mappings.get(T)&&A.mappings.get(T)["@id"]===R["@id"]?L.push.apply(L,["@vocab","@id"]):L.push.apply(L,["@id","@vocab"])}else{L.push(D);const T=L.find(Z=>Z.includes("_"));T&&L.push(T.replace(/^[^_]+_/,"_"))}L.push("@none");const te=A.inverse[B];for(const T of F){if(!(T in te))continue;const Z=te[T][q];for(const k of L)if(k in Z)return Z[k]}return null}function C(A,B,R){if(c(A,B,{vocab:!0},R)!=="@nest")throw new r("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}return js}var $s,iu;function Hf(){return iu||(iu=1,$s=r=>{class e{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(e,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(e.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:e}),e.compact=function(t,n){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):r.compact(t,n)},e.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):r.expand(t)},e.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):r.flatten(t)},e}),$s}/**
354
+ */function v(d,g){if(t.isArray(d))return d.map(N=>v(N,g));if(t.isObject(d)){// remove @preserve
355
+ if("@preserve"in d)return d["@preserve"][0];if(e.isValue(d))return d;if(e.isList(d))return d["@list"]=v(d["@list"],g),d;if("@id"in d){const N=d["@id"];if(g.link.hasOwnProperty(N)){const C=g.link[N].indexOf(d);if(C!==-1)return g.link[N][C];g.link[N].push(d)}else g.link[N]=[d]}for(const N in d){if(N==="@id"&&g.bnodesToClear.includes(d[N])){delete d["@id"];continue}d[N]=v(d[N],g)}}return d}function x(d,g,N){t.isObject(d)?n.addValue(d,g,N,{propertyIsArray:!0}):d.push(N)}function S(d,g,N,C){if(!("@id"in N))return!1;const A=d.subjects[N["@id"]];return A&&_(d,A,g,C)}function m(d,g){const N=g["@value"],C=g["@type"],A=g["@language"],B=d["@value"]?t.isArray(d["@value"])?d["@value"]:[d["@value"]]:[],R=d["@type"]?t.isArray(d["@type"])?d["@type"]:[d["@type"]]:[],F=d["@language"]?t.isArray(d["@language"])?d["@language"]:[d["@language"]]:[];return B.length===0&&R.length===0&&F.length===0?!0:!(!(B.includes(N)||t.isEmptyObject(B[0]))||!(!C&&R.length===0||R.includes(C)||C&&t.isEmptyObject(R[0]))||!(!A&&F.length===0||F.includes(A)||A&&t.isEmptyObject(F[0])))}return ks}var Ps,au;function zf(){if(au)return Ps;au=1;const r=pt(),{isArray:e,isObject:t,isString:n,isUndefined:i}=ut(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:u,isSubjectReference:l}=kt(),{expandIri:c,getContextValue:h,isKeyword:b,process:y,processingMode:_}=hr(),{removeBase:E,prependBase:v}=Jt(),{REGEX_KEYWORD:x,addValue:S,asArray:m,compareShortestLeast:d}=dt(),g={};Ps=g,g.compact=async({activeCtx:A,activeProperty:B=null,element:R,options:F={}})=>{if(e(R)){let D=[];for(let L=0;L<R.length;++L){const te=await g.compact({activeCtx:A,activeProperty:B,element:R[L],options:F});te!==null&&D.push(te)}return F.compactArrays&&D.length===1&&(h(A,B,"@container")||[]).length===0&&(D=D[0]),D}const q=h(A,B,"@context");if(i(q)||(A=await y({activeCtx:A,localCtx:q,propagate:!0,overrideProtected:!0,options:F})),t(R)){if(F.link&&"@id"in R&&F.link.hasOwnProperty(R["@id"])){const w=F.link[R["@id"]];for(let H=0;H<w.length;++H)if(w[H].expanded===R)return w[H].compacted}if(a(R)||l(R)){const w=g.compactValue({activeCtx:A,activeProperty:B,value:R,options:F});return F.link&&l(R)&&(F.link.hasOwnProperty(R["@id"])||(F.link[R["@id"]]=[]),F.link[R["@id"]].push({expanded:R,compacted:w})),w}if(s(R)&&(h(A,B,"@container")||[]).includes("@list"))return g.compact({activeCtx:A,activeProperty:B,element:R["@list"],options:F});const D=B==="@reverse",L={},te=A;!a(R)&&!l(R)&&(A=A.revertToPreviousContext());const T=h(te,B,"@context");i(T)||(A=await y({activeCtx:A,localCtx:T,propagate:!0,overrideProtected:!0,options:F})),F.link&&"@id"in R&&(F.link.hasOwnProperty(R["@id"])||(F.link[R["@id"]]=[]),F.link[R["@id"]].push({expanded:R,compacted:L}));let Z=R["@type"]||[];Z.length>1&&(Z=Array.from(Z).sort());const k=A;for(const w of Z){const H=g.compactIri({activeCtx:k,iri:w,relativeTo:{vocab:!0}}),K=h(te,H,"@context");i(K)||(A=await y({activeCtx:A,localCtx:K,options:F,propagate:!1}))}const Y=Object.keys(R).sort();for(const w of Y){const H=R[w];if(w==="@id"){let K=m(H).map(ue=>g.compactIri({activeCtx:A,iri:ue,relativeTo:{vocab:!1},base:F.base}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});L[Q]=K;continue}if(w==="@type"){let K=m(H).map(z=>g.compactIri({activeCtx:te,iri:z,relativeTo:{vocab:!0}}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}}),G=(h(A,Q,"@container")||[]).includes("@set")&&_(A,1.1)||e(K)&&H.length===0;S(L,Q,K,{propertyIsArray:G});continue}if(w==="@reverse"){const K=await g.compact({activeCtx:A,activeProperty:"@reverse",element:H,options:F});for(const Q in K)if(A.mappings.has(Q)&&A.mappings.get(Q).reverse){const ue=K[Q],G=(h(A,Q,"@container")||[]).includes("@set")||!F.compactArrays;S(L,Q,ue,{propertyIsArray:G}),delete K[Q]}if(Object.keys(K).length>0){const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,Q,K)}continue}if(w==="@preserve"){const K=await g.compact({activeCtx:A,activeProperty:B,element:H,options:F});e(K)&&K.length===0||S(L,w,K);continue}if(w==="@index"){if((h(A,B,"@container")||[]).includes("@index"))continue;const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,Q,H);continue}if(w!=="@graph"&&w!=="@list"&&w!=="@included"&&b(w)){const K=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,K,H);continue}if(!e(H))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(H.length===0){const K=g.compactIri({activeCtx:A,iri:w,value:H,relativeTo:{vocab:!0},reverse:D}),Q=A.mappings.has(K)?A.mappings.get(K)["@nest"]:null;let ue=L;Q&&(C(A,Q,F),t(L[Q])||(L[Q]={}),ue=L[Q]),S(ue,K,H,{propertyIsArray:!0})}for(const K of H){const Q=g.compactIri({activeCtx:A,iri:w,value:K,relativeTo:{vocab:!0},reverse:D}),ue=A.mappings.has(Q)?A.mappings.get(Q)["@nest"]:null;let V=L;ue&&(C(A,ue,F),t(L[ue])||(L[ue]={}),V=L[ue]);const G=h(A,Q,"@container")||[],z=o(K),U=s(K);let ee;U?ee=K["@list"]:z&&(ee=K["@graph"]);let re=await g.compact({activeCtx:A,activeProperty:Q,element:U||z?ee:K,options:F});if(U)if(e(re)||(re=[re]),!G.includes("@list"))re={[g.compactIri({activeCtx:A,iri:"@list",relativeTo:{vocab:!0}})]:re},"@index"in K&&(re[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]);else{S(V,Q,re,{valueIsArray:!0,allowDuplicate:!0});continue}if(z)if(G.includes("@graph")&&(G.includes("@id")||G.includes("@index")&&u(K))){let fe;V.hasOwnProperty(Q)?fe=V[Q]:V[Q]=fe={};const ge=(G.includes("@id")?K["@id"]:K["@index"])||g.compactIri({activeCtx:A,iri:"@none",relativeTo:{vocab:!0}});S(fe,ge,re,{propertyIsArray:!F.compactArrays||G.includes("@set")})}else G.includes("@graph")&&u(K)?(e(re)&&re.length>1&&(re={"@included":re}),S(V,Q,re,{propertyIsArray:!F.compactArrays||G.includes("@set")})):(e(re)&&re.length===1&&F.compactArrays&&(re=re[0]),re={[g.compactIri({activeCtx:A,iri:"@graph",relativeTo:{vocab:!0}})]:re},"@id"in K&&(re[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]=K["@id"]),"@index"in K&&(re[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]),S(V,Q,re,{propertyIsArray:!F.compactArrays||G.includes("@set")}));else if(G.includes("@language")||G.includes("@index")||G.includes("@id")||G.includes("@type")){let fe;V.hasOwnProperty(Q)?fe=V[Q]:V[Q]=fe={};let ge;if(G.includes("@language"))a(re)&&(re=re["@value"]),ge=K["@language"];else if(G.includes("@index")){const j=h(A,Q,"@index")||"@index",W=g.compactIri({activeCtx:A,iri:j,relativeTo:{vocab:!0}});if(j==="@index")ge=K["@index"],delete re[W];else{let se;if([ge,...se]=m(re[j]||[]),!n(ge))ge=null;else switch(se.length){case 0:delete re[j];break;case 1:re[j]=se[0];break;default:re[j]=se;break}}}else if(G.includes("@id")){const j=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});ge=re[j],delete re[j]}else if(G.includes("@type")){const j=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}});let W;switch([ge,...W]=m(re[j]||[]),W.length){case 0:delete re[j];break;case 1:re[j]=W[0];break;default:re[j]=W;break}Object.keys(re).length===1&&"@id"in K&&(re=await g.compact({activeCtx:A,activeProperty:Q,element:{"@id":K["@id"]},options:F}))}ge||(ge=g.compactIri({activeCtx:A,iri:"@none",relativeTo:{vocab:!0}})),S(fe,ge,re,{propertyIsArray:G.includes("@set")})}else{const fe=!F.compactArrays||G.includes("@set")||G.includes("@list")||e(re)&&re.length===0||w==="@list"||w==="@graph";S(V,Q,re,{propertyIsArray:fe})}}}return L}return R},g.compactIri=({activeCtx:A,iri:B,value:R=null,relativeTo:F={vocab:!1},reverse:q=!1,base:D=null})=>{if(B===null)return B;A.isPropertyTermScoped&&A.previousContext&&(A=A.previousContext);const L=A.getInverse();if(b(B)&&B in L&&"@none"in L[B]&&"@type"in L[B]["@none"]&&"@none"in L[B]["@none"]["@type"])return L[B]["@none"]["@type"]["@none"];if(F.vocab&&B in L){const Y=A["@language"]||"@none",w=[];t(R)&&"@index"in R&&!("@graph"in R)&&w.push("@index","@index@set"),t(R)&&"@preserve"in R&&(R=R["@preserve"][0]),o(R)?("@index"in R&&w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R&&w.push("@graph@id","@graph@id@set"),w.push("@graph","@graph@set","@set"),"@index"in R||w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R||w.push("@graph@id","@graph@id@set")):t(R)&&!a(R)&&w.push("@id","@id@set","@type","@set@type");let H="@language",K="@null";if(q)H="@type",K="@reverse",w.push("@set");else if(s(R)){"@index"in R||w.push("@list");const ue=R["@list"];if(ue.length===0)H="@any",K="@none";else{let V=ue.length===0?Y:null,G=null;for(let z=0;z<ue.length;++z){const U=ue[z];let ee="@none",re="@none";if(a(U))if("@direction"in U){const fe=(U["@language"]||"").toLowerCase(),ge=U["@direction"];ee=`${fe}_${ge}`}else"@language"in U?ee=U["@language"].toLowerCase():"@type"in U?re=U["@type"]:ee="@null";else re="@id";if(V===null?V=ee:ee!==V&&a(U)&&(V="@none"),G===null?G=re:re!==G&&(G="@none"),V==="@none"&&G==="@none")break}V=V||"@none",G=G||"@none",G!=="@none"?(H="@type",K=G):K=V}}else{if(a(R))if("@language"in R&&!("@index"in R)){w.push("@language","@language@set"),K=R["@language"];const ue=R["@direction"];ue&&(K=`${K}_${ue}`)}else"@direction"in R&&!("@index"in R)?K=`_${R["@direction"]}`:"@type"in R&&(H="@type",K=R["@type"]);else H="@type",K="@id";w.push("@set")}w.push("@none"),t(R)&&!("@index"in R)&&w.push("@index","@index@set"),a(R)&&Object.keys(R).length===1&&w.push("@language","@language@set");const Q=N(A,B,R,w,H,K);if(Q!==null)return Q}if(F.vocab&&"@vocab"in A){const Y=A["@vocab"];if(B.indexOf(Y)===0&&B!==Y){const w=B.substr(Y.length);if(!A.mappings.has(w))return w}}let te=null;const T=[];let Z=A.fastCurieMap;const k=B.length-1;for(let Y=0;Y<k&&B[Y]in Z;++Y)Z=Z[B[Y]],""in Z&&T.push(Z[""][0]);for(let Y=T.length-1;Y>=0;--Y){const w=T[Y],H=w.terms;for(const K of H){const Q=K+":"+B.substr(w.iri.length);A.mappings.get(K)._prefix&&(!A.mappings.has(Q)||R===null&&A.mappings.get(Q)["@id"]===B)&&(te===null||d(Q,te)<0)&&(te=Q)}}if(te!==null)return te;for(const[Y,w]of A.mappings)if(w&&w._prefix&&B.startsWith(Y+":"))throw new r(`Absolute IRI "${B}" confused with prefix "${Y}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:A});if(!F.vocab)if("@base"in A)if(A["@base"]){const Y=E(v(D,A["@base"]),B);return x.test(Y)?`./${Y}`:Y}else return B;else return E(D,B);return B},g.compactValue=({activeCtx:A,activeProperty:B,value:R,options:F})=>{if(a(R)){const te=h(A,B,"@type"),T=h(A,B,"@language"),Z=h(A,B,"@direction"),k=h(A,B,"@container")||[],Y="@index"in R&&!k.includes("@index");if(!Y&&te!=="@none"&&(R["@type"]===te||"@language"in R&&R["@language"]===T&&"@direction"in R&&R["@direction"]===Z||"@language"in R&&R["@language"]===T||"@direction"in R&&R["@direction"]===Z))return R["@value"];const w=Object.keys(R).length,H=w===1||w===2&&"@index"in R&&!Y,K="@language"in A,Q=n(R["@value"]),ue=A.mappings.has(B)&&A.mappings.get(B)["@language"]===null;if(H&&te!=="@none"&&(!K||!Q||ue))return R["@value"];const V={};return Y&&(V[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=R["@index"]),"@type"in R?V[g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}})]=g.compactIri({activeCtx:A,iri:R["@type"],relativeTo:{vocab:!0}}):"@language"in R&&(V[g.compactIri({activeCtx:A,iri:"@language",relativeTo:{vocab:!0}})]=R["@language"]),"@direction"in R&&(V[g.compactIri({activeCtx:A,iri:"@direction",relativeTo:{vocab:!0}})]=R["@direction"]),V[g.compactIri({activeCtx:A,iri:"@value",relativeTo:{vocab:!0}})]=R["@value"],V}const q=c(A,B,{vocab:!0},F),D=h(A,B,"@type"),L=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:D==="@vocab"},base:F.base});return D==="@id"||D==="@vocab"||q==="@graph"?L:{[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]:L}};function N(A,B,R,F,q,D){D===null&&(D="@null");const L=[];if((D==="@id"||D==="@reverse")&&t(R)&&"@id"in R){D==="@reverse"&&L.push("@reverse");const T=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:!0}});A.mappings.has(T)&&A.mappings.get(T)&&A.mappings.get(T)["@id"]===R["@id"]?L.push.apply(L,["@vocab","@id"]):L.push.apply(L,["@id","@vocab"])}else{L.push(D);const T=L.find(Z=>Z.includes("_"));T&&L.push(T.replace(/^[^_]+_/,"_"))}L.push("@none");const te=A.inverse[B];for(const T of F){if(!(T in te))continue;const Z=te[T][q];for(const k of L)if(k in Z)return Z[k]}return null}function C(A,B,R){if(c(A,B,{vocab:!0},R)!=="@nest")throw new r("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}return Ps}var Ms,ou;function Qf(){return ou||(ou=1,Ms=r=>{class e{toString(){return"[object JsonLdProcessor]"}}return Object.defineProperty(e,"prototype",{writable:!1,enumerable:!1}),Object.defineProperty(e.prototype,"constructor",{writable:!0,enumerable:!1,configurable:!0,value:e}),e.compact=function(t,n){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):r.compact(t,n)},e.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):r.expand(t)},e.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):r.flatten(t)},e}),Ms}/**
356
356
  * A JavaScript implementation of the JSON-LD API.
357
357
  *
358
358
  * @author Dave Longley
@@ -386,17 +386,17 @@ if("@preserve"in h)return h["@preserve"][0];if(e.isValue(h))return h;if(e.isList
386
386
  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
387
387
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
388
388
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
389
- */var Fs,su;function Vf(){if(su)return Fs;su=1;const r=Pa(),e=Df(),t=ht(),n=jf(),i=t.IdentifierIssuer,s=gt(),a=Uc(),o=$f(),{expand:u}=Ff(),{flatten:l}=kf(),{fromRDF:c}=Pf(),{toRDF:d}=Bf(),{frameMergedOrDefault:b,cleanupNull:y}=qf(),{isArray:_,isObject:E,isString:v}=ut(),{isSubjectReference:x}=kt(),{expandIri:S,getInitialContext:m,process:h,processingMode:g}=hr(),{compact:N,compactIri:C}=Uf(),{createNodeMap:A,createMergedNodeMap:B,mergeNodeMaps:R}=gi(),{logEventHandler:F,logWarningEventHandler:q,safeEventHandler:D,setDefaultEventHandler:L,setupEventHandler:te,strictEventHandler:T,unhandledEventHandler:Z}=An(),k=function(w){const H={},Q=new a({max:100});w.compact=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(V===null)return null;z=ue(z,{base:v(V)?V:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:Q})}),z.link&&(z.skipExpansion=!0),z.compactToRelative||delete z.base;let U;z.skipExpansion?U=V:U=await w.expand(V,z);const ee=await w.processContext(m(z),G,z);let re=await N({activeCtx:ee,element:U,options:z});z.compactArrays&&!z.graph&&_(re)?re.length===1?re=re[0]:re.length===0&&(re={}):z.graph&&E(re)&&(re=[re]),E(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),_(G)||(G=[G]);const fe=G;G=[];for(let j=0;j<fe.length;++j)(!E(fe[j])||Object.keys(fe[j]).length>0)&&G.push(fe[j]);const ge=G.length>0;if(G.length===1&&(G=G[0]),_(re)){const j=C({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),W=re;re={},ge&&(re["@context"]=G),re[j]=W}else if(E(re)&&ge){const j=re;re={"@context":G};for(const W in j)re[W]=j[W]}return re},w.expand=async function(V,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=ue(G,{keepFreeFloatingNodes:!1,contextResolver:new n({sharedCache:Q})});const z={},U=[];if("expandContext"in G){const ge=t.clone(G.expandContext);E(ge)&&"@context"in ge?z.expandContext=ge:z.expandContext={"@context":ge},U.push(z.expandContext)}let ee;if(!v(V))z.input=t.clone(V);else{const ge=await w.get(V,G);ee=ge.documentUrl,z.input=ge.document,ge.contextUrl&&(z.remoteContext={"@context":ge.contextUrl},U.push(z.remoteContext))}"base"in G||(G.base=ee||"");let re=m(G);for(const ge of U)re=await h({activeCtx:re,localCtx:ge,options:G});let fe=await u({activeCtx:re,element:z.input,options:G});return E(fe)&&"@graph"in fe&&Object.keys(fe).length===1?fe=fe["@graph"]:fe===null&&(fe=[]),_(fe)||(fe=[fe]),fe},w.flatten=async function(V,G,z){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,z=ue(z,{base:v(V)?V:"",contextResolver:new n({sharedCache:Q})});const U=await w.expand(V,z),ee=l(U);return G===null?ee:(z.graph=!0,z.skipExpansion=!0,await w.compact(ee,G,z))},w.frame=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(z=ue(z,{base:v(V)?V:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:Q})}),v(G)){const he=await w.get(G,z);if(G=he.document,he.contextUrl){let pe=G["@context"];pe?_(pe)?pe.push(he.contextUrl):pe=[pe,he.contextUrl]:pe=he.contextUrl,G["@context"]=pe}}const U=G?G["@context"]||{}:{},ee=await w.processContext(m(z),U,z);z.hasOwnProperty("omitGraph")||(z.omitGraph=g(ee,1.1)),z.hasOwnProperty("pruneBlankNodeIdentifiers")||(z.pruneBlankNodeIdentifiers=g(ee,1.1));const re=await w.expand(V,z),fe={...z};fe.isFrame=!0,fe.keepFreeFloatingNodes=!0;const ge=await w.expand(G,fe),j=Object.keys(G).map(he=>S(ee,he,{vocab:!0}));fe.merged=!j.includes("@graph"),fe.is11=g(ee,1.1);const W=b(re,ge,fe);fe.graph=!z.omitGraph,fe.skipExpansion=!0,fe.link={},fe.framing=!0;let se=await w.compact(W,U,fe);return fe.link={},se=y(se,fe),se},w.link=async function(V,G,z){const U={};return G&&(U["@context"]=G),U["@embed"]="@link",w.frame(V,U,z)},w.normalize=w.canonize=async function(V,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=ue(G,{base:v(V)?V:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:Q})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=o.parse(V);return r.canonize(ee,G)}const z={...G};delete z.format,z.produceGeneralizedRdf=!1;const U=await w.toRDF(V,z);return r.canonize(U,G)},w.fromRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=ue(G,{format:v(V)?"application/n-quads":void 0});const{format:z}=G;let{rdfParser:U}=G;if(z){if(U=U||H[z],!U)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:z})}else U=()=>V;const ee=await U(V);return c(ee,G)},w.toRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=ue(G,{base:v(V)?V:"",skipExpansion:!1,contextResolver:new n({sharedCache:Q})});let z;G.skipExpansion?z=V:z=await w.expand(V,G);const U=d(z,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return o.serialize(U);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return U},w.createNodeMap=async function(V,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=ue(G,{base:v(V)?V:"",contextResolver:new n({sharedCache:Q})});const z=await w.expand(V,G);return B(z,G)},w.merge=async function(V,G,z){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!_(V))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,z=ue(z,{contextResolver:new n({sharedCache:Q})});const U=await Promise.all(V.map(he=>{const pe={...z};return w.expand(he,pe)}));let ee=!0;"mergeNodes"in z&&(ee=z.mergeNodes);const re=z.issuer||new i("_:b"),fe={"@default":{}};for(let he=0;he<U.length;++he){const pe=t.relabelBlankNodes(U[he],{issuer:new i("_:b"+he+"-")}),me=ee||he===0?fe:{"@default":{}};if(A(pe,me,"@default",re),me!==fe)for(const J in me){const ce=me[J];if(!(J in fe)){fe[J]=ce;continue}const ye=fe[J];for(const le in ce)le in ye||(ye[le]=ce[le])}}const ge=R(fe),j=[],W=Object.keys(ge).sort();for(let he=0;he<W.length;++he){const pe=ge[W[he]];x(pe)||j.push(pe)}return G===null?j:(z.graph=!0,z.skipExpansion=!0,await w.compact(j,G,z))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:V=>w._documentLoader=V}),w.documentLoader=async V=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:V})},w.get=async function(V,G){let z;typeof G.documentLoader=="function"?z=G.documentLoader:z=w.documentLoader;const U=await z(V);try{if(!U.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");v(U.document)&&(U.document=JSON.parse(U.document))}catch(ee){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:U})}return U},w.processContext=async function(V,G,z){return z=ue(z,{base:"",contextResolver:new n({sharedCache:Q})}),G===null?m(z):(G=t.clone(G),E(G)&&"@context"in G||(G={"@context":G}),h({activeCtx:V,localCtx:G,options:z}))},w.getContextValue=hr().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(V){if(!(V in w.documentLoaders))throw new s('Unknown document loader type: "'+V+'"',"jsonld.UnknownDocumentLoader",{type:V});w.documentLoader=w.documentLoaders[V].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(V,G){H[V]=G},w.unregisterRDFParser=function(V){delete H[V]},w.registerRDFParser("application/n-quads",o.parse),w.registerRDFParser("application/nquads",o.parse),w.url=Jt(),w.logEventHandler=F,w.logWarningEventHandler=q,w.safeEventHandler=D,w.setDefaultEventHandler=L,w.strictEventHandler=T,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=qc(),w.JsonLdProcessor=Hf()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function ue(V,{documentLoader:G=w.documentLoader,...z}){if(V&&"compactionMap"in V)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(V&&"expansionMap"in V)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},z,V,{eventHandler:te({options:V})})}return w},Y=function(){return k(function(){return Y()})};return k(Y),Fs=Y,Fs}var Gf=Vf();const ks={},Ps={};class Wf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[],this.config.prefixes={};const e=[],t=new et;if(e.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",t,mn)),e.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,Dt)),await Promise.all(e),t.countQuads(null,null,null,mn)===0&&this.config.attributes.valuesSubject){const n=[...t.getObjects(this.config.attributes.valuesSubject,sa,Dt)],i=[];for(const s of n){const a=this.toURL(s.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),i.push(this.importRDF(this.fetchRDF(a),t,mn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=t}async importRDF(e,t,n){const i=async s=>{const a=[];await new Promise((o,u)=>{const l=au(s)==="xml"?new vf.RdfXmlParser:new Td;l.on("data",c=>{if(t.add(new si(c.subject,c.predicate,c.object,n)),this.config.attributes.ignoreOwlImports===null&&Ea.equals(c.predicate)){const d=this.toURL(c.object.value);d&&this.loadedExternalUrls.indexOf(d)<0&&(this.loadedExternalUrls.push(d),a.push(this.importRDF(this.fetchRDF(d),t,Ne.namedNode(d))))}if(this.config.classInstanceProvider&&(Sa.equals(c.predicate)||Nr.equals(c.predicate))){const d=c.object.value;if(this.loadedClasses.indexOf(d)<0){let b;d in Ps?b=Ps[d]:(b=this.config.classInstanceProvider(d),Ps[d]=b),this.loadedClasses.push(d),a.push(this.importRDF(b,t,n))}}}).on("error",c=>{console.warn("failed parsing graph",n,c.message),u(c)}).on("prefix",(c,d)=>{c&&(this.config.prefixes[c]=d)}).on("end",()=>{o(null)}),l.write(s),l.end()});try{await Promise.allSettled(a)}catch(o){console.warn(o)}};if(e instanceof Promise&&(e=await e),e){if(au(e)==="json")try{e=await Gf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await i(e)}}toURL(e){if(oa(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const n=this.config.prefixes[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),oa(e)))return e}}return null}async fetchRDF(e){if(e in ks)return ks[e];let t=e;this.config.attributes.proxy&&(t=this.config.attributes.proxy+encodeURIComponent(e));const n=fetch(t,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(i=>i.text());return ks[e]=n,n}}function au(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}class Ms{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.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class ou{constructor(e,t){this.attributes=new Ms,this.loader=new Wf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new et,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}updateAttributes(e){const t=new Ms;if(Object.keys(t).forEach(n=>{const i=e.dataset[n];i!==void 0&&(t[n]=i)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const n=this.languages.indexOf(t.language);n>-1&&this.languages.splice(n,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Ne.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Ms;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=qd(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${xe}PropertyGroup`,null)}}function zf(r){return"_:"+r.value}function Qf(r,e){return[...r].map(t=>e(t)).join(`
389
+ */var Bs,lu;function Xf(){if(lu)return Bs;lu=1;const r=Ua(),e=$f(),t=dt(),n=Mf(),i=t.IdentifierIssuer,s=pt(),a=Wc(),o=Bf(),{expand:u}=qf(),{flatten:l}=Uf(),{fromRDF:c}=Hf(),{toRDF:h}=Gf(),{frameMergedOrDefault:b,cleanupNull:y}=Wf(),{isArray:_,isObject:E,isString:v}=ut(),{isSubjectReference:x}=kt(),{expandIri:S,getInitialContext:m,process:d,processingMode:g}=hr(),{compact:N,compactIri:C}=zf(),{createNodeMap:A,createMergedNodeMap:B,mergeNodeMaps:R}=bi(),{logEventHandler:F,logWarningEventHandler:q,safeEventHandler:D,setDefaultEventHandler:L,setupEventHandler:te,strictEventHandler:T,unhandledEventHandler:Z}=Tn(),k=function(w){const H={},Q=new a({max:100});w.compact=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(V===null)return null;z=ue(z,{base:v(V)?V:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:Q})}),z.link&&(z.skipExpansion=!0),z.compactToRelative||delete z.base;let U;z.skipExpansion?U=V:U=await w.expand(V,z);const ee=await w.processContext(m(z),G,z);let re=await N({activeCtx:ee,element:U,options:z});z.compactArrays&&!z.graph&&_(re)?re.length===1?re=re[0]:re.length===0&&(re={}):z.graph&&E(re)&&(re=[re]),E(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),_(G)||(G=[G]);const fe=G;G=[];for(let j=0;j<fe.length;++j)(!E(fe[j])||Object.keys(fe[j]).length>0)&&G.push(fe[j]);const ge=G.length>0;if(G.length===1&&(G=G[0]),_(re)){const j=C({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),W=re;re={},ge&&(re["@context"]=G),re[j]=W}else if(E(re)&&ge){const j=re;re={"@context":G};for(const W in j)re[W]=j[W]}return re},w.expand=async function(V,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=ue(G,{keepFreeFloatingNodes:!1,contextResolver:new n({sharedCache:Q})});const z={},U=[];if("expandContext"in G){const ge=t.clone(G.expandContext);E(ge)&&"@context"in ge?z.expandContext=ge:z.expandContext={"@context":ge},U.push(z.expandContext)}let ee;if(!v(V))z.input=t.clone(V);else{const ge=await w.get(V,G);ee=ge.documentUrl,z.input=ge.document,ge.contextUrl&&(z.remoteContext={"@context":ge.contextUrl},U.push(z.remoteContext))}"base"in G||(G.base=ee||"");let re=m(G);for(const ge of U)re=await d({activeCtx:re,localCtx:ge,options:G});let fe=await u({activeCtx:re,element:z.input,options:G});return E(fe)&&"@graph"in fe&&Object.keys(fe).length===1?fe=fe["@graph"]:fe===null&&(fe=[]),_(fe)||(fe=[fe]),fe},w.flatten=async function(V,G,z){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,z=ue(z,{base:v(V)?V:"",contextResolver:new n({sharedCache:Q})});const U=await w.expand(V,z),ee=l(U);return G===null?ee:(z.graph=!0,z.skipExpansion=!0,await w.compact(ee,G,z))},w.frame=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(z=ue(z,{base:v(V)?V:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:Q})}),v(G)){const he=await w.get(G,z);if(G=he.document,he.contextUrl){let pe=G["@context"];pe?_(pe)?pe.push(he.contextUrl):pe=[pe,he.contextUrl]:pe=he.contextUrl,G["@context"]=pe}}const U=G?G["@context"]||{}:{},ee=await w.processContext(m(z),U,z);z.hasOwnProperty("omitGraph")||(z.omitGraph=g(ee,1.1)),z.hasOwnProperty("pruneBlankNodeIdentifiers")||(z.pruneBlankNodeIdentifiers=g(ee,1.1));const re=await w.expand(V,z),fe={...z};fe.isFrame=!0,fe.keepFreeFloatingNodes=!0;const ge=await w.expand(G,fe),j=Object.keys(G).map(he=>S(ee,he,{vocab:!0}));fe.merged=!j.includes("@graph"),fe.is11=g(ee,1.1);const W=b(re,ge,fe);fe.graph=!z.omitGraph,fe.skipExpansion=!0,fe.link={},fe.framing=!0;let se=await w.compact(W,U,fe);return fe.link={},se=y(se,fe),se},w.link=async function(V,G,z){const U={};return G&&(U["@context"]=G),U["@embed"]="@link",w.frame(V,U,z)},w.normalize=w.canonize=async function(V,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=ue(G,{base:v(V)?V:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:Q})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=o.parse(V);return r.canonize(ee,G)}const z={...G};delete z.format,z.produceGeneralizedRdf=!1;const U=await w.toRDF(V,z);return r.canonize(U,G)},w.fromRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=ue(G,{format:v(V)?"application/n-quads":void 0});const{format:z}=G;let{rdfParser:U}=G;if(z){if(U=U||H[z],!U)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:z})}else U=()=>V;const ee=await U(V);return c(ee,G)},w.toRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=ue(G,{base:v(V)?V:"",skipExpansion:!1,contextResolver:new n({sharedCache:Q})});let z;G.skipExpansion?z=V:z=await w.expand(V,G);const U=h(z,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return o.serialize(U);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return U},w.createNodeMap=async function(V,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=ue(G,{base:v(V)?V:"",contextResolver:new n({sharedCache:Q})});const z=await w.expand(V,G);return B(z,G)},w.merge=async function(V,G,z){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!_(V))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,z=ue(z,{contextResolver:new n({sharedCache:Q})});const U=await Promise.all(V.map(he=>{const pe={...z};return w.expand(he,pe)}));let ee=!0;"mergeNodes"in z&&(ee=z.mergeNodes);const re=z.issuer||new i("_:b"),fe={"@default":{}};for(let he=0;he<U.length;++he){const pe=t.relabelBlankNodes(U[he],{issuer:new i("_:b"+he+"-")}),me=ee||he===0?fe:{"@default":{}};if(A(pe,me,"@default",re),me!==fe)for(const J in me){const ce=me[J];if(!(J in fe)){fe[J]=ce;continue}const ye=fe[J];for(const le in ce)le in ye||(ye[le]=ce[le])}}const ge=R(fe),j=[],W=Object.keys(ge).sort();for(let he=0;he<W.length;++he){const pe=ge[W[he]];x(pe)||j.push(pe)}return G===null?j:(z.graph=!0,z.skipExpansion=!0,await w.compact(j,G,z))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:V=>w._documentLoader=V}),w.documentLoader=async V=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:V})},w.get=async function(V,G){let z;typeof G.documentLoader=="function"?z=G.documentLoader:z=w.documentLoader;const U=await z(V);try{if(!U.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");v(U.document)&&(U.document=JSON.parse(U.document))}catch(ee){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:U})}return U},w.processContext=async function(V,G,z){return z=ue(z,{base:"",contextResolver:new n({sharedCache:Q})}),G===null?m(z):(G=t.clone(G),E(G)&&"@context"in G||(G={"@context":G}),d({activeCtx:V,localCtx:G,options:z}))},w.getContextValue=hr().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(V){if(!(V in w.documentLoaders))throw new s('Unknown document loader type: "'+V+'"',"jsonld.UnknownDocumentLoader",{type:V});w.documentLoader=w.documentLoaders[V].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(V,G){H[V]=G},w.unregisterRDFParser=function(V){delete H[V]},w.registerRDFParser("application/n-quads",o.parse),w.registerRDFParser("application/nquads",o.parse),w.url=Jt(),w.logEventHandler=F,w.logWarningEventHandler=q,w.safeEventHandler=D,w.setDefaultEventHandler=L,w.strictEventHandler=T,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=Gc(),w.JsonLdProcessor=Qf()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function ue(V,{documentLoader:G=w.documentLoader,...z}){if(V&&"compactionMap"in V)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(V&&"expansionMap"in V)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},z,V,{eventHandler:te({options:V})})}return w},Y=function(){return k(function(){return Y()})};return k(Y),Bs=Y,Bs}var Jf=Xf();const qs={},Us={};class Kf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[],this.config.prefixes={};const e=[],t=new et;if(e.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",t,mn)),e.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,Dt)),await Promise.all(e),t.countQuads(null,null,null,mn)===0&&this.config.attributes.valuesSubject){const n=[...t.getObjects(this.config.attributes.valuesSubject,ua,Dt)],i=[];for(const s of n){const a=this.toURL(s.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),i.push(this.importRDF(this.fetchRDF(a),t,mn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=t}async importRDF(e,t,n){const i=async s=>{const a=[];await new Promise((o,u)=>{const l=uu(s)==="xml"?new Nf.RdfXmlParser:new Od;l.on("data",c=>{if(t.add(new li(c.subject,c.predicate,c.object,n)),this.config.attributes.ignoreOwlImports===null&&Ra.equals(c.predicate)){const h=this.toURL(c.object.value);h&&this.loadedExternalUrls.indexOf(h)<0&&(this.loadedExternalUrls.push(h),a.push(this.importRDF(this.fetchRDF(h),t,Ne.namedNode(h))))}if(this.config.classInstanceProvider&&(Ta.equals(c.predicate)||Nr.equals(c.predicate))){const h=c.object.value;if(this.loadedClasses.indexOf(h)<0){let b;h in Us?b=Us[h]:(b=this.config.classInstanceProvider(h),Us[h]=b),this.loadedClasses.push(h),a.push(this.importRDF(b,t,n))}}}).on("error",c=>{console.warn("failed parsing graph",n,c.message),u(c)}).on("prefix",(c,h)=>{c&&(this.config.prefixes[c]=h)}).on("end",()=>{o(null)}),l.write(s),l.end()});try{await Promise.allSettled(a)}catch(o){console.warn(o)}};if(e instanceof Promise&&(e=await e),e){if(uu(e)==="json")try{e=await Jf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await i(e)}}toURL(e){if(da(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const n=this.config.prefixes[t[0]];if(n&&(e=e.replace(`${t[0]}:`,n),da(e)))return e}}return null}async fetchRDF(e){if(e in qs)return qs[e];let t=e;this.config.attributes.proxy&&(t=this.config.attributes.proxy+encodeURIComponent(e));const n=fetch(t,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(i=>i.text());return qs[e]=n,n}}function uu(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}class Hs{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.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class cu{constructor(e,t){this.attributes=new Hs,this.loader=new Kf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new et,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}updateAttributes(e){const t=new Hs;if(Object.keys(t).forEach(n=>{const i=e.dataset[n];i!==void 0&&(t[n]=i)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const n=this.languages.indexOf(t.language);n>-1&&this.languages.splice(n,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Ne.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Hs;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,n=>"-"+n.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=Vd(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${xe}PropertyGroup`,null)}}function Yf(r){return"_:"+r.value}function Zf(r,e){return[...r].map(t=>e(t)).join(`
390
390
  `)+`
391
- `}function Xf(){return""}function Hc(r){return"<"+r.value+">"}const Jf=/["\\\\\n\r]/,Kf=/["\\\\\n\r]/g,Yf={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Zf(r){return Yf[r]}function ep(r){return Jf.test(r)?r.replace(Kf,Zf):r}function tp(r){const e=ep(r.value);return r.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':r.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+r.language:'"'+e+'"^^'+Hc(r.datatype)}function rp(r,e){const t=e(r.subject),n=e(r.predicate),i=e(r.object),s=e(r.graph);return`${t} ${n} ${i} ${s?s+" ":""}.`}function np(r){return"?"+r.value}function ot(r){if(!r)return null;if(r.termType==="BlankNode")return zf(r);if(r.termType==="DefaultGraph")return Xf();if(r.termType==="Literal")return tp(r);if(r.termType==="NamedNode")return Hc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return rp(r,ot);if(r.termType==="Variable")return np(r);if(r[Symbol.iterator])return Qf(r,ot);throw new Error(`unknown termType ${r.termType}`)}class $r{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(ot(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(ot(e));return t&&t.value}has(e){return this.index.has(ot(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=ot(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class lu{constructor({dataset:e,end:t,quad:n,start:i}){this.dataset=e,this.end=t,this.quad=n,this.start=i}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function uu(r){try{return ot(r)}catch{return null}}class ft{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=ot(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(uu(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(uu(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Vc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Vc.prototype.termType="BlankNode";class Ba{equals(e){return!!e&&e.termType===this.termType}}Ba.prototype.termType="DefaultGraph";Ba.prototype.value="";function cu(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),n=r.fromTerm(e.predicate),i=r.fromTerm(e.object),s=r.fromTerm(e.graph);return r.quad(t,n,i,s)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Kn{constructor(e,t,n,i=""){this.value=e,this.language=t,this.datatype=n,this.direction=i}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}}Kn.prototype.termType="Literal";class Dn{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Dn.prototype.termType="NamedNode";class qa{constructor(e,t,n,i){this.subject=e,this.predicate=t,this.object=n,this.graph=i}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)}}qa.prototype.termType="Quad";qa.prototype.value="";class Gc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Gc.prototype.termType="Variable";const ip=new Dn("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),du=new Dn("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),sp=new Dn("http://www.w3.org/2001/XMLSchema#string");class Wc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Ba}}namedNode(e){return new Dn(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Vc(e)}literal(e,t){return typeof t=="string"?new Kn(e,t,du):typeof t?.language=="string"?new Kn(e,t.language,t.direction?ip:du,t.direction):new Kn(e,"",t||sp)}variable(e){return new Gc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new qa(e,t,n,i)}fromTerm(e){return cu(this,e)}fromQuad(e){return cu(this,e)}}Wc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Ua=new Wc,ap={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function mt(r,{factory:e=Ua}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,ap)}mt("http://www.w3.org/2001/XMLSchema#");const xt=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");mt("http://www.w3.org/2000/01/rdf-schema#");class Fe{static add({ptr:e,start:t,end:n,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:u}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};u&&(l=c=>{u(new lu({dataset:e.dataset,start:t,end:n,quad:c}))});for(const c of i)for(const d of s)for(const b of a)for(const y of o){const _={subject:c,predicate:d,object:b,graph:y};_[t]=e.term;const E=e.factory.quad(_.subject,_.predicate,_.object,_.graph);e.dataset.add(E),l(E)}return e}static addList({ptr:e,predicates:t,items:n,graphs:i}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const a of i){const o=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,o[0]||xt.nil,a));for(let u=0;u<o.length;u++)e.dataset.add(e.factory.quad(o[u],xt.first,n[u],a)),e.dataset.add(e.factory.quad(o[u],xt.rest,o[u+1]||xt.nil,a))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:i=[null],objects:s=[null]}){for(const a of n)for(const o of i)for(const u of s){const l={subject:a,predicate:o,object:u};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const d of c)e.dataset.delete(d)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const i of t)for(const s of e.dataset.match(e.term,i)){let a=s.object;for(n.push(s);!xt.nil.equals(a);){a=n[n.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const u of o)n.push(u)}}for(const i of n)e.dataset.delete(i);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,items:c,callback:d}={}){if(t==="add")return Fe.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,callback:d});if(t==="addList")return Fe.addList({ptr:e,predicates:o,items:c,graphs:l});if(t==="delete")return Fe.delete({ptr:e,start:i,subjects:a,predicates:o,objects:u});if(t==="deleteList")return Fe.deleteList({ptr:e,predicates:o});if(t==="isList")return Fe.isList({ptr:e});if(t==="list")return Fe.list({ptr:e});if(t==="traverse")return Fe.traverse({ptr:e,quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(xt.nil.equals(e.term)||Fe.traverse({ptr:e,predicates:[xt.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(xt.nil);){const t=e.out([xt.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([xt.rest]);if(n.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:i="object",subjects:s=[null],predicates:a=[null],objects:o=[null],graphs:u=[null],callback:l}){if(t==="one")return Fe.traverseOne({ptr:e,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="oneOrMore"){const c=Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});return Fe.traverseMore({ptrs:c,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})}if(t==="zeroOrMore")return Fe.traverseMore({ptrs:[e],end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="zeroOrOne")return[e,...Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u}={}){let l=[...e],c,d;do{c=[];for(const b of e)c=[...c,...Fe.traverseOne({ptr:b,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u})];d&&(c=c.filter(b=>!d.has(b.term))),e=c,l=[...l,...c],d=new ft(l.map(b=>b.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u=(l,c)=>c.extend(l)}={}){const l=[];for(const c of i)for(const d of s)for(const b of a)for(const y of o){const _={subject:c,predicate:d,object:b,graph:y};_[t]=e.term;for(const E of e.dataset.match(_.subject,_.predicate,_.object,_.graph))l.push(u(new lu({dataset:e.dataset,end:n,quad:E,start:t}),e))}return l}}function hu(r,e){return e?t=>e(r.extend(t)):()=>{}}class fu{constructor({dataset:e,edges:t=[],factory:n,graph:i,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=i,t.length===0&&(this._term=s)}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?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,n){return Fe.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:hu(this,n)})}addList(e,t){return Fe.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Fe.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:hu(this,n)})}deleteIn(e,t){return Fe.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Fe.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Fe.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c}){return Fe.execute({ptr:this,operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Fe.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Fe.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Fe.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Fe.isList({ptr:this})}list(){return Fe.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}: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})}out(e,t){return Fe.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{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 pu(r,e){return r?r.equals(e):r===e}function op(r,e){return!(r.dataset!==e.dataset||!pu(r.graph,e.graph)||!pu(r.term,e.term))}function gu(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class ni{constructor({dataset:e,factory:t,ptrs:n,terms:i,graphs:s}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(const a of i||[null])for(const o of s||[null])this.ptrs.push(new fu({dataset:e,factory:t,graph:o,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new ft(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,n){const i=gu(this,n);for(const s of this.ptrs)s.addIn(e,t,i);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){const i=gu(this,n);for(const s of this.ptrs)s.addOut(e,t,i);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const n of this.ptrs)n.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,n)=>(t.some(i=>op(i,n))||t.push(n.trim()),t),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(const n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.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?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const n of e)yield t.clone({ptrs:[n]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,n=[...e].map(i=>new fu({dataset:t,factory:this.factory,term:i}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}mt("http://www.w3.org/2002/07/owl#");const fr=mt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),lp=mt("http://www.w3.org/2000/01/rdf-schema#"),ae=mt("http://www.w3.org/ns/shacl#"),ha=mt("https://schemas.link/shacl-next#"),Ha=mt("http://www.w3.org/2001/XMLSchema#");function up(r){return r?`{${[...r.quads()].map(e=>ot(e)).join(" ")}}`:"{}"}function cp(r){return r?`{${r.map(e=>up(e)).join(" ")}}`:"{}"}var Bs,mu;function dp(){if(mu)return Bs;mu=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Bs=e,Bs}var qs,yu;function hp(){if(yu)return qs;yu=1;var r=dp(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return qs=t,qs}var Us,bu;function fp(){if(bu)return Us;bu=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Us=r,Us}var Hs,_u;function pp(){if(_u)return Hs;_u=1;var r=typeof Sr=="object"&&Sr&&Sr.Object===Object&&Sr;return Hs=r,Hs}var Vs,wu;function gp(){if(wu)return Vs;wu=1;var r=pp(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Vs=t,Vs}var Gs,vu;function zc(){if(vu)return Gs;vu=1;var r=gp(),e=r.Symbol;return Gs=e,Gs}var Ws,xu;function mp(){if(xu)return Ws;xu=1;var r=zc(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function s(a){var o=t.call(a,i),u=a[i];try{a[i]=void 0;var l=!0}catch{}var c=n.call(a);return l&&(o?a[i]=u:delete a[i]),c}return Ws=s,Ws}var zs,Eu;function yp(){if(Eu)return zs;Eu=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return zs=t,zs}var Qs,Su;function bp(){if(Su)return Qs;Su=1;var r=zc(),e=mp(),t=yp(),n="[object Null]",i="[object Undefined]",s=r?r.toStringTag:void 0;function a(o){return o==null?o===void 0?i:n:s&&s in Object(o)?e(o):t(o)}return Qs=a,Qs}var Xs,Iu;function _p(){if(Iu)return Xs;Iu=1;function r(e){return e!=null&&typeof e=="object"}return Xs=r,Xs}var Js,Nu;function wp(){if(Nu)return Js;Nu=1;var r=bp(),e=_p(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return Js=n,Js}var Ks,Ru;function vp(){if(Ru)return Ks;Ru=1;var r=hp(),e=fp(),t=wp(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var d=s.test(l);return d||a.test(l)?o(l.slice(2),d?2:8):i.test(l)?n:+l}return Ks=u,Ks}var Ys,Tu;function xp(){if(Tu)return Ys;Tu=1;var r=vp(),e=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===e||i===-e){var s=i<0?-1:1;return s*t}return i===i?i:0}return Ys=n,Ys}var Zs,Au;function Ep(){if(Au)return Zs;Au=1;var r=xp();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return Zs=e,Zs}var ea,Du;function Sp(){if(Du)return ea;Du=1;var r=Ep(),e="Expected a function";function t(n,i){var s;if(typeof i!="function")throw new TypeError(e);return n=r(n),function(){return--n>0&&(s=i.apply(this,arguments)),n<=1&&(i=void 0),s}}return ea=t,ea}var ta,Lu;function Ip(){if(Lu)return ta;Lu=1;var r=Sp();function e(t){return r(2,t)}return ta=e,ta}var Np=Ip();const _t=td(Np);let Ou=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=_t(()=>!this.results.some(s=>s.severity.equals(ae.Info)||s.severity.equals(ae.Violation)||s.severity.equals(ae.Warning))),this._ptr=_t(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new ni({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([fr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Ha.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Rp(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Tp=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:u,shape:l,source:c=[],value:d,valuePaths:b=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=i,this.path=a||l.path,this.results=o,this.severity=u,this.shape=l,this.source=c,this.value=d,this.valuePaths=b,this._message=_t(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),s.map(y=>n.literal(Rp(y.value,e),y.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([fr.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const n=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],n(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(i=>n(i).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const i of this.results)e.addOut([ae.detail],[this.factory.blankNode()],s=>{i.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Va{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new Ou({factory:e,options:n}),results:a=new Map,shape:o,value:u,valueOrNode:l,valuePaths:c,values:d}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=u,this.valuePaths=c,this.valueOrNode=l,this.values=d}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:i=this.value,valueOrNode:s=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new Va({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Ou({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:i,valueOrNode:s,valuePaths:a,values:o})}id({shape:e=this.shape}={}){return`${ot(e.ptr.term)} - ${ot(this.focusNode.term)} - ${cp(this.valuePaths)}`}result(e){const t=new Tp({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:ha.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:ha.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||ae.Violation,...t})}}function Ap(){return{generic:Dp()}}function Dp(){return r=>{r.trace(ha.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Lp{constructor(e){this.validations=new $r(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const i=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(s.term);a&&(i.add(a),s.term.equals(ae.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&i.add(Ap),[...i].map(s=>s(e)).filter(Boolean)}}var ir={},sr={},sn={},an={},Cu;function Lr(){if(Cu)return an;Cu=1,Object.defineProperty(an,"__esModule",{value:!0}),an.Translator=void 0;let r=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,n,i){for(const s of n)this.supportedRdfDatatypes.push(s),this.fromRdfHandlers[s.value]=t;for(const s of i){let a=this.toRdfHandlers[s];a||(this.toRdfHandlers[s]=a=[]),a.push(t)}}fromRdf(t,n){const i=this.fromRdfHandlers[t.datatype.value];return i?i.fromRdf(t,n):t.value}toRdf(t,n){const i=this.toRdfHandlers[typeof t];if(i)for(const s of i){const a=s.toRdf(t,n);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return an.Translator=r,an}var ju;function Op(){if(ju)return sn;ju=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.TypeHandlerBoolean=void 0;const r=Lr();let e=class Qc{fromRdf(n,i){switch(n.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return i&&r.Translator.incorrectRdfDataType(n),!1}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(n?"true":"false",i||s.namedNode(Qc.TYPE))}};return sn.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",sn}var on={},$u;function Cp(){if($u)return on;$u=1,Object.defineProperty(on,"__esModule",{value:!0}),on.TypeHandlerDate=void 0;const r=Lr();let e=class fa{fromRdf(n,i){switch(i&&!n.value.match(fa.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&r.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":const s=n.value.split("-");return new Date(0,parseInt(s[0],10)-1,parseInt(s[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(n,{datatype:i,dataFactory:s}){if(i=i||s.namedNode(fa.TYPES[0]),!(n instanceof Date))return null;const a=n;let o;switch(i.value){case"http://www.w3.org/2001/XMLSchema#gDay":o=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":o=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":o=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":o=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":o=a.toISOString().replace(/T.*$/,"");break;default:o=a.toISOString()}return s.literal(o,i)}};return on.TypeHandlerDate=e,e.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"],e.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]$/},on}var ln={},Fu;function jp(){if(Fu)return ln;Fu=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.TypeHandlerNumberDouble=void 0;const r=Lr();let e=class Xc{fromRdf(n,i){const s=parseFloat(n.value);return i&&isNaN(s)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return i=i||s.namedNode(Xc.TYPES[0]),isNaN(n)?s.literal("NaN",i):isFinite(n)?n%1===0?null:s.literal(n.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i):s.literal(n>0?"INF":"-INF",i)}};return ln.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],ln}var un={},ku;function $p(){if(ku)return un;ku=1,Object.defineProperty(un,"__esModule",{value:!0}),un.TypeHandlerNumberInteger=void 0;const r=Lr();let e=class pn{fromRdf(n,i){const s=parseInt(n.value,10);return i&&(isNaN(s)||n.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(String(n),i||(n<=pn.MAX_INT&&n>=pn.MIN_INT?s.namedNode(pn.TYPES[0]):s.namedNode(pn.TYPES[1])))}};return un.TypeHandlerNumberInteger=e,e.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"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,un}var cn={},Pu;function Fp(){if(Pu)return cn;Pu=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return cn.TypeHandlerString=r,r.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],cn}var Mu;function Bu(){return Mu||(Mu=1,function(r){var e=sr&&sr.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=sr&&sr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Op(),r),t(Cp(),r),t(jp(),r),t($p(),r),t(Fp(),r)}(sr)),sr}var ra={},qu;function kp(){return qu||(qu=1,Object.defineProperty(ra,"__esModule",{value:!0})),ra}var Uu;function Pp(){return Uu||(Uu=1,function(r){var e=ir&&ir.__createBinding||(Object.create?function(y,_,E,v){v===void 0&&(v=E);var x=Object.getOwnPropertyDescriptor(_,E);(!x||("get"in x?!_.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return _[E]}}),Object.defineProperty(y,v,x)}:function(y,_,E,v){v===void 0&&(v=E),y[v]=_[E]}),t=ir&&ir.__exportStar||function(y,_){for(var E in y)E!=="default"&&!Object.prototype.hasOwnProperty.call(_,E)&&e(_,y,E)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=u,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=d,r.getSupportedJavaScriptPrimitives=b;const n=Fc(),i=Bu(),s=Lr();t(Bu(),r),t(kp(),r),t(Lr(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(y=>a.namedNode(y)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(y=>a.namedNode(y)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(y=>a.namedNode(y)),["object"]);function u(y,_){return o.fromRdf(y,_)}function l(y,_){return _&&"namedNode"in _&&(_={dataFactory:_}),_=_||{},_&&!_.dataFactory&&(_.dataFactory=a),o.toRdf(y,_)}function c(y,_){return y.termType==="Literal"?u(y,_):y.value}function d(){return o.getSupportedRdfDatatypes()}function b(){return o.getSupportedJavaScriptPrimitives()}}(ir)),ir}var In=Pp();function Hu(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const n=r.out([ae.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=r.out([ae.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=r.out([ae.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function Mp(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Hu(e)):[Hu(r)]}class Bp{constructor(e){this.shape=e,this._compiled=_t(()=>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){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const n of this.compiled)n.node&&await n.node(t),n.generic&&await n.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const n=t.node(new ft(t.terms)),i=[...t].reduce((a,o)=>{const u=o.term,l=t.node([u]);return a.has(u)||a.set(u,{value:l,valuePaths:[]}),a.get(u).valuePaths.push(o),a},new $r).values(),s=e.create({shape:this.shape,values:n});for(const a of this.compiled)a.property&&await a.property(s);for(const{value:a,valuePaths:o}of i){const u=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const l of this.compiled)l.generic&&await l.generic(u)}}}function pa(r){const e=new ft,n=new ni({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[lp.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class qp{constructor(e){this.targetClass=new ft([...pa(e.hasOut([fr.type],[ae.NodeShape])),...pa(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([fr.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],i=e.focusNode.clone({ptrs:n});return i.node([...new ft(i.terms)])}}class Up{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=_t(()=>{const n=this.ptr.out([ae.deactivated]).term;return n&&In.fromRdf(n)}),this._message=_t(()=>this.ptr.out([ae.message]).terms),this._path=_t(()=>Mp(this.ptr.out([ae.path]))),this._severity=_t(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=_t(()=>new Bp(this)),this._sparql=_t(()=>this.ptr.out([ae.sparql])),this._targetResolver=_t(()=>new qp(this.ptr))}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()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Hp(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Vp(e)}}function Vp(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Gp(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Wp(e)}}function Wp(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function zp(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Qp(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function mi(r,e){return Promise.all(r.map(e))}async function Xp(r,e){for(const t of r)if(await e(t))return!0;return!1}function Jp(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Kp(e)}}function Kp(r){return async e=>{const t=await mi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.every(i=>i.conforms);e.test(n,ae.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function Yp(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:Zp(e)}}function Zp(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!t.conforms;e.test(n,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function eg(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:tg(e)}}function tg(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await mi(r,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=i.flatMap(s=>s.results),n=i.some(s=>s.conforms)}else n=await Xp(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(n,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function rg(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:ng(e)}}function ng(r){return async e=>{const t=await mi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.filter(i=>i.conforms).length===1;e.test(n,ae.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function ig(r){if(!In.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(s=>r.validator.shape(s)),n=new ft(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new ft([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(s=>s.term));return{node:sg(n,i)}}function sg(r,e){return t=>{const n=t.focusNode.execute({start:"subject",end:"predicate"}).filter(i=>e.has(i.term)?!1:!r.has(i.term));if(n.ptrs.length>0)for(const i of n)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[i.term]}],value:t.focusNode.node([[...i.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function ag(r){const e=r.ptr.out([ae.hasValue]).term;return{node:og(e),property:lg(e)}}function og(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function lg(r){return e=>{const t=[...e.values].some(n=>r.equals(n.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function ug(r){const e=new ft([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:cg(e)}}function cg(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function Fr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Vu(r)!==Vu(e))return null;const t=In.fromRdf(r),n=In.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function Vu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Ha.dateTime.equals(r.datatype)&&e.test(r.value)}function dg(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:hg(e)}}function hg(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function fg(r){const e=r.ptr.out([ae.equals]).term;return{node:pg(e),property:gg(e)}}function pg(r){return e=>{const t=e.focusNode.out([r]),n=t.filter(s=>!s.term.equals(e.focusNode.term)),i=t.terms.length!==0&&n.terms.length===0;e.test(i,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:n.terms[0]&&e.focusNode.node([n.terms[0]])||e.focusNode})}}function gg(r){return e=>{const t=new ft(e.focusNode.out([r]).terms),n=new ft(e.values.terms),i=[...n].filter(o=>!t.has(o)),s=[...t].filter(o=>!n.has(o)),a=[...i,...s];for(const o of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function mg(r){const e=r.ptr.out([ae.lessThan]).term;return{property:yg(e)}}function yg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=Fr(n.term,i);s===null||s>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}}}function bg(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:_g(e)}}function _g(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=Fr(n.term,i);s===null||s>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}}}function wg(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:vg(e)}}function vg(r){return e=>{const t=Fr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function xg(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:Eg(e)}}function Eg(r){return e=>{const t=Fr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function Sg(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:Ig(e)}}function Ig(r){return e=>{const t=Fr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Ng(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Rg(e)}}function Rg(r){return e=>{const t=Fr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Tg(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Ag(e)}}function Ag(r){return async e=>{for(const t of r){const n=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(n.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:n.report.results,value:e.valueOrNode})}}}function Dg(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Lg(e)}}function Lg(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Og(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,n=t?In.fromRdf(t):!1,i=r.ptr.out([ae.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:Cg(e,n,s,o)}}function Cg(r,e,t,n){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(u=>!u.term.equals(r.ptr.term)).map(u=>i.shape.validator.shape(u))));const o=(await Qp(i.values,async u=>{const l=(await r.validate(i.create({child:!0,focusNode:u}))).report;if(s.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const c=await mi([...a],async d=>(await d.validate(i.create({child:!0,focusNode:u}))).report);return s.push(c.flatMap(d=>d.results)),!c.every(d=>d.conforms)}else return!await zp([...a],async c=>(await c.validate(i.create({child:!0,focusNode:u}))).report.conforms)})).length;t!==null&&i.test(o<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),n!==null&&i.test(o>=n,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:n,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function jg(r,e){return e?e.slice(0,r.length)===r:!1}function $g(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:Fg(e)}}function Fg(r){return e=>{const t=r.some(n=>jg(n,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function kg(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:Pg(e)}}function Pg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Mg(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Bg(e)}}function Bg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function qg(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,n=new RegExp(e,t);return{generic:Ug(e,t,n)}}function Ug(r,e,t){return n=>{n.test(t.test(n.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function Hg(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Ha.boolean.equals(e.datatype)?{property:Vg()}:null}function Vg(){return r=>{const t=Object.entries(r.values.terms.reduce((n,i)=>(i.language&&(n[i.language]=(n[i.language]||0)+1),n),{})).filter(([,n])=>n>1);for(const[n]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:n},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const Yn=mt("http://www.w3.org/ns/shacl#"),Jc=mt("https://schemas.link/shacl-next#");class Or{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(Yn.Info)||e.severity.equals(Yn.Violation)||e.severity.equals(Yn.Warning))}}function Gg(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class ii{constructor({args:e={},factory:t,message:n=[],severity:i=Yn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(Gg(s.value,e),s.language||null))}}class Ga{constructor({factory:e=Ua}={}){this.factory=e}clone({factory:e}={}){return new Ga({factory:e||this.factory})}validate(){return new Or}validateSimple(){return!0}}class kr extends Ga{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const n of Array.isArray(e)?e:[e])n&&this.datatypes.push(this.factory.fromTerm(n))}clone({factory:e}={}){return new kr({datatypes:this.datatypes,factory:e||this.factory})}}class Wg{constructor({factory:e=Ua,validations:t}={}){if(this.factory=e,this.validations=new $r,t)for(const n of Object.values(t)){const i=n.clone({factory:this.factory});for(const s of i.datatypes)this.validations.set(s,i)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Or}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends kr{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:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(n=>{let i;n.test(e.value)&&(i=Jc.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new ii({args:s,factory:this.factory,message:this.message,severity:i})});return new Or({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const zg=/^([-+]?[0-9]+)$/;class st extends Pe{constructor(e=null,t=null,n,{factory:i}={}){super(zg,n,{factory:i}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new st(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!Jc.Debug.equals(t[0].severity))return new Or({results:t});const n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){const i=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ii({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&n>this.maxInclusive){const i=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ii({factory:this.factory,message:s}))}return new Or({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Wa extends kr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Wa(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(n)];t.push(new ii({factory:this.factory,message:i}))}return new Or({results:t})}validateSimple(e){return this.values.has(e.value)}}const Te={xsd:mt("http://www.w3.org/2001/XMLSchema#")},Qg=new kr({datatypes:Te.xsd.anySimpleType}),Xg=new kr({datatypes:Te.xsd.anyAtomicType}),yi=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Jg=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,Kc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,za=/^(-?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)))))$/,Yc=/^(-?([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))?)$/,Kg=/^((([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))?)$/,Yg=/^(-?([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))?)$/,Zg=/^(-?([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))?)$/,em=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,tm=/^(--(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))?)$/,rm=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,nm=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,im=/^(([0-9a-fA-F]{2})*)$/,sm=/^(((([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] ?= ?=))?)$/,am=new Pe(yi,Te.xsd.string),om=new Wa(["1","true","0","false"],Te.xsd.boolean),lm=new Pe(Jg,Te.xsd.decimal),um=new Pe(Kc,Te.xsd.float),cm=new Pe(Kc,Te.xsd.double),dm=new Pe(za,Te.xsd.duration),hm=new Pe(Yc,Te.xsd.dateTime),fm=new Pe(Kg,Te.xsd.time),pm=new Pe(Yg,Te.xsd.date),gm=new Pe(Zg,Te.xsd.gYearMonth),mm=new Pe(em,Te.xsd.gYear),ym=new Pe(tm,Te.xsd.gMonthDay),bm=new Pe(rm,Te.xsd.gDay),_m=new Pe(nm,Te.xsd.gMonth),wm=new Pe(im,Te.xsd.hexBinary),vm=new Pe(sm,Te.xsd.base64Binary),xm=new Pe(yi,Te.xsd.anyURI),Zc=/^([^\u000d\u000a\u0009]*)$/,Em=/^([^ ]+( [^ ]+)*)*$/,Sm=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Im=/^([^DT]*)$/,Nm=/^([^YM]*[DT].*)$/,Rm=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Tm=new Pe([yi,Zc],Te.xsd.normalizedString),Am=new Pe([yi,Zc,Em],Te.xsd.token),Dm=new Pe(Sm,Te.xsd.language),Lm=new st(null,null,Te.xsd.integer),Om=new st(null,"0",Te.xsd.nonPositiveInteger),Cm=new st(null,"-1",Te.xsd.negativeInteger),jm=new st("-9223372036854775808","9223372036854775807",Te.xsd.long),$m=new st("-2147483648","2147483647",Te.xsd.int),Fm=new st("-32768","32767",Te.xsd.short),km=new st("-128","127",Te.xsd.byte),Pm=new st("0",null,Te.xsd.nonNegativeInteger),Mm=new st("0","18446744073709551615",Te.xsd.unsignedLong),Bm=new st("0","4294967295",Te.xsd.unsignedInt),qm=new st("0","65535",Te.xsd.unsignedShort),Um=new st("0","255",Te.xsd.unsignedByte),Hm=new st("1",null,Te.xsd.positiveInteger),Vm=new Pe([za,Im],Te.xsd.yearMonthDuration),Gm=new Pe([za,Nm],Te.xsd.dayTimeDuration),Wm=new Pe([Yc,Rm],Te.xsd.dateTimeStamp),zm=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Xg,anySimpleType:Qg,anyURI:xm,base64Binary:vm,boolean:om,byte:km,date:pm,dateTime:hm,dateTimeStamp:Wm,dayTimeDuration:Gm,decimal:lm,double:cm,duration:dm,float:um,gDay:bm,gMonth:_m,gMonthDay:ym,gYear:mm,gYearMonth:gm,hexBinary:wm,int:$m,integer:Lm,language:Dm,long:jm,negativeInteger:Cm,nonNegativeInteger:Pm,nonPositiveInteger:Om,normalizedString:Tm,positiveInteger:Hm,short:Fm,string:am,time:fm,token:Am,unsignedByte:Um,unsignedInt:Bm,unsignedLong:Mm,unsignedShort:qm,yearMonthDuration:Vm},Symbol.toStringTag,{value:"Module"}));class Qm extends Wg{constructor({factory:e}={}){super({factory:e,validations:{...zm}})}}const Xm=new $r([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function Jm(r){const e=r.ptr.out([ae.class]).map(t=>pa(t));return{generic:Km(e)}}function Km(r){return e=>{const t=new ft(e.valueOrNode.out([fr.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function Ym(r){const e=r.ptr.out([ae.datatype]).term,t=new Qm;return{generic:Zm(e,t)}}function Zm(r,e){return t=>{const n=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(n,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function ey(r){const e=r.ptr.out([ae.nodeKind]).term,t=Xm.get(e);return{generic:ty(e,t)}}function ty(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const ry=new $r([[ae.maxCount,Hp],[ae.minCount,Gp],[ae.and,Jp],[ae.not,Yp],[ae.or,eg],[ae.xone,rg],[ae.closed,ig],[ae.hasValue,ag],[ae.in,ug],[ae.disjoint,dg],[ae.equals,fg],[ae.lessThan,mg],[ae.lessThanOrEquals,bg],[ae.maxExclusive,wg],[ae.maxInclusive,xg],[ae.minExclusive,Sg],[ae.minInclusive,Ng],[ae.node,Tg],[ae.property,Dg],[ae.qualifiedValueShape,Og],[ae.languageIn,$g],[ae.maxLength,kg],[ae.minLength,Mg],[ae.pattern,qg],[ae.uniqueLang,Hg],[ae.class,Jm],[ae.datatype,Ym],[ae.nodeKind,ey]]);class ny{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Lp(ry),this.shapesPtr=new ni({dataset:e,factory:t}),this.shapes=new $r,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[s,a]of this.options.validations)this.registry.validations.set(s,a);const i=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([fr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([fr.type],[ae.PropertyShape])];for(const s of i)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Up(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new ni({...e,factory:this.factory}),i=new Va({factory:this.factory,focusNode:n,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const a=i.create({shape:s});let o;n.isAny()?o=s.resolveTargets(a):o=n;for(const u of o)await s.validate(a.create({focusNode:u}))}return i.report}}let iy=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new ou(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(n=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:n.conforms,report:n}}))}).catch(n=>{console.warn(n)})})}static get observedAttributes(){return ou.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{this.setAttribute("loading",""),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading));try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(n=>{this.form.classList.remove(n)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const n of Zd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Wt(e,this.config,this.config.attributes.valuesSubject?Ne.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const n=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);n.addEventListener("click",i=>{i.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(n)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Ne.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,mn)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}this.removeAttribute("loading")},200)}serialize(e="text/turtle",t=this.toRDF()){const n=t.getQuads(null,null,null,null);return Xd(n,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){Yd(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape&&(this.shape.toRDF(this.config.store),this.config.store.add(new si(this.shape.shaclSubject,Ne.namedNode(xe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId)));try{const t=this.config.store,n=await new ny(t,{details:!0,factory:Ne}).validate({dataset:t});for(const i of n.results)if(i.focusNode?.ptrs?.length)for(const s of i.focusNode.ptrs){const a=s._term;if(i.path?.length){const o=i.path[0].predicates[0];let u=this.form.querySelectorAll(`
391
+ `}function ep(){return""}function zc(r){return"<"+r.value+">"}const tp=/["\\\\\n\r]/,rp=/["\\\\\n\r]/g,np={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function ip(r){return np[r]}function sp(r){return tp.test(r)?r.replace(rp,ip):r}function ap(r){const e=sp(r.value);return r.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':r.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+r.language:'"'+e+'"^^'+zc(r.datatype)}function op(r,e){const t=e(r.subject),n=e(r.predicate),i=e(r.object),s=e(r.graph);return`${t} ${n} ${i} ${s?s+" ":""}.`}function lp(r){return"?"+r.value}function ot(r){if(!r)return null;if(r.termType==="BlankNode")return Yf(r);if(r.termType==="DefaultGraph")return ep();if(r.termType==="Literal")return ap(r);if(r.termType==="NamedNode")return zc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return op(r,ot);if(r.termType==="Variable")return lp(r);if(r[Symbol.iterator])return Zf(r,ot);throw new Error(`unknown termType ${r.termType}`)}class $r{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(ot(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(ot(e));return t&&t.value}has(e){return this.index.has(ot(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=ot(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class du{constructor({dataset:e,end:t,quad:n,start:i}){this.dataset=e,this.end=t,this.quad=n,this.start=i}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function hu(r){try{return ot(r)}catch{return null}}class ht{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=ot(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(hu(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(hu(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Qc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Qc.prototype.termType="BlankNode";class Va{equals(e){return!!e&&e.termType===this.termType}}Va.prototype.termType="DefaultGraph";Va.prototype.value="";function fu(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),n=r.fromTerm(e.predicate),i=r.fromTerm(e.object),s=r.fromTerm(e.graph);return r.quad(t,n,i,s)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class Zn{constructor(e,t,n,i=""){this.value=e,this.language=t,this.datatype=n,this.direction=i}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}}Zn.prototype.termType="Literal";class An{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}An.prototype.termType="NamedNode";class Ga{constructor(e,t,n,i){this.subject=e,this.predicate=t,this.object=n,this.graph=i}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)}}Ga.prototype.termType="Quad";Ga.prototype.value="";class Xc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Xc.prototype.termType="Variable";const up=new An("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),pu=new An("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),cp=new An("http://www.w3.org/2001/XMLSchema#string");class Jc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Va}}namedNode(e){return new An(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Qc(e)}literal(e,t){return typeof t=="string"?new Zn(e,t,pu):typeof t?.language=="string"?new Zn(e,t.language,t.direction?up:pu,t.direction):new Zn(e,"",t||cp)}variable(e){return new Xc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new Ga(e,t,n,i)}fromTerm(e){return fu(this,e)}fromQuad(e){return fu(this,e)}}Jc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Wa=new Jc,dp={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function gt(r,{factory:e=Wa}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,dp)}gt("http://www.w3.org/2001/XMLSchema#");const xt=gt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");gt("http://www.w3.org/2000/01/rdf-schema#");class Fe{static add({ptr:e,start:t,end:n,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:u}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};u&&(l=c=>{u(new du({dataset:e.dataset,start:t,end:n,quad:c}))});for(const c of i)for(const h of s)for(const b of a)for(const y of o){const _={subject:c,predicate:h,object:b,graph:y};_[t]=e.term;const E=e.factory.quad(_.subject,_.predicate,_.object,_.graph);e.dataset.add(E),l(E)}return e}static addList({ptr:e,predicates:t,items:n,graphs:i}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const a of i){const o=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,o[0]||xt.nil,a));for(let u=0;u<o.length;u++)e.dataset.add(e.factory.quad(o[u],xt.first,n[u],a)),e.dataset.add(e.factory.quad(o[u],xt.rest,o[u+1]||xt.nil,a))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:i=[null],objects:s=[null]}){for(const a of n)for(const o of i)for(const u of s){const l={subject:a,predicate:o,object:u};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const h of c)e.dataset.delete(h)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const i of t)for(const s of e.dataset.match(e.term,i)){let a=s.object;for(n.push(s);!xt.nil.equals(a);){a=n[n.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const u of o)n.push(u)}}for(const i of n)e.dataset.delete(i);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,items:c,callback:h}={}){if(t==="add")return Fe.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,callback:h});if(t==="addList")return Fe.addList({ptr:e,predicates:o,items:c,graphs:l});if(t==="delete")return Fe.delete({ptr:e,start:i,subjects:a,predicates:o,objects:u});if(t==="deleteList")return Fe.deleteList({ptr:e,predicates:o});if(t==="isList")return Fe.isList({ptr:e});if(t==="list")return Fe.list({ptr:e});if(t==="traverse")return Fe.traverse({ptr:e,quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(xt.nil.equals(e.term)||Fe.traverse({ptr:e,predicates:[xt.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(xt.nil);){const t=e.out([xt.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([xt.rest]);if(n.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:i="object",subjects:s=[null],predicates:a=[null],objects:o=[null],graphs:u=[null],callback:l}){if(t==="one")return Fe.traverseOne({ptr:e,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="oneOrMore"){const c=Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});return Fe.traverseMore({ptrs:c,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})}if(t==="zeroOrMore")return Fe.traverseMore({ptrs:[e],end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="zeroOrOne")return[e,...Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u}={}){let l=[...e],c,h;do{c=[];for(const b of e)c=[...c,...Fe.traverseOne({ptr:b,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u})];h&&(c=c.filter(b=>!h.has(b.term))),e=c,l=[...l,...c],h=new ht(l.map(b=>b.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u=(l,c)=>c.extend(l)}={}){const l=[];for(const c of i)for(const h of s)for(const b of a)for(const y of o){const _={subject:c,predicate:h,object:b,graph:y};_[t]=e.term;for(const E of e.dataset.match(_.subject,_.predicate,_.object,_.graph))l.push(u(new du({dataset:e.dataset,end:n,quad:E,start:t}),e))}return l}}function gu(r,e){return e?t=>e(r.extend(t)):()=>{}}class mu{constructor({dataset:e,edges:t=[],factory:n,graph:i,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=i,t.length===0&&(this._term=s)}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?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,n){return Fe.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:gu(this,n)})}addList(e,t){return Fe.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Fe.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:gu(this,n)})}deleteIn(e,t){return Fe.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Fe.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Fe.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c}){return Fe.execute({ptr:this,operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Fe.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Fe.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Fe.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Fe.isList({ptr:this})}list(){return Fe.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}: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})}out(e,t){return Fe.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{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 yu(r,e){return r?r.equals(e):r===e}function hp(r,e){return!(r.dataset!==e.dataset||!yu(r.graph,e.graph)||!yu(r.term,e.term))}function bu(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class si{constructor({dataset:e,factory:t,ptrs:n,terms:i,graphs:s}){if(this.factory=t,n)this.ptrs=[...n];else{this.ptrs=[];for(const a of i||[null])for(const o of s||[null])this.ptrs.push(new mu({dataset:e,factory:t,graph:o,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new ht(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,n){const i=bu(this,n);for(const s of this.ptrs)s.addIn(e,t,i);return this}addList(e,t){if(this.isAny())throw new Error("can't attach a list to an any ptr");for(const n of this.ptrs)n.addList(e,t);return this}addOut(e,t,n){const i=bu(this,n);for(const s of this.ptrs)s.addOut(e,t,i);return this}clone(e){return new this.constructor({factory:this.factory,ptrs:this.ptrs,...e})}deleteIn(e,t){for(const n of this.ptrs)n.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const n of this.ptrs)n.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,n)=>(t.some(i=>hp(i,n))||t.push(n.trim()),t),[]);return this.clone({ptrs:e})}execute(e){return this.clone({ptrs:this.ptrs.flatMap(t=>t.execute(e))})}executeAll(e){let t=this;for(const n of e)t=t.execute(n);return t}filter(e){return this.clone({ptrs:[...this].filter(e).map(t=>t.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?!1:this.ptrs[0].isList()}list(){if(!this.isList())return;const e=this.ptrs[0].list(),t=this;return function*(){for(const n of e)yield t.clone({ptrs:[n]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,n=[...e].map(i=>new mu({dataset:t,factory:this.factory,term:i}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}gt("http://www.w3.org/2002/07/owl#");const fr=gt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),fp=gt("http://www.w3.org/2000/01/rdf-schema#"),ae=gt("http://www.w3.org/ns/shacl#"),ma=gt("https://schemas.link/shacl-next#"),za=gt("http://www.w3.org/2001/XMLSchema#");function pp(r){return r?`{${[...r.quads()].map(e=>ot(e)).join(" ")}}`:"{}"}function gp(r){return r?`{${r.map(e=>pp(e)).join(" ")}}`:"{}"}var Vs,_u;function mp(){if(_u)return Vs;_u=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Vs=e,Vs}var Gs,wu;function yp(){if(wu)return Gs;wu=1;var r=mp(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Gs=t,Gs}var Ws,vu;function bp(){if(vu)return Ws;vu=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return Ws=r,Ws}var zs,xu;function _p(){if(xu)return zs;xu=1;var r=typeof Sr=="object"&&Sr&&Sr.Object===Object&&Sr;return zs=r,zs}var Qs,Eu;function wp(){if(Eu)return Qs;Eu=1;var r=_p(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Qs=t,Qs}var Xs,Su;function Kc(){if(Su)return Xs;Su=1;var r=wp(),e=r.Symbol;return Xs=e,Xs}var Js,Iu;function vp(){if(Iu)return Js;Iu=1;var r=Kc(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function s(a){var o=t.call(a,i),u=a[i];try{a[i]=void 0;var l=!0}catch{}var c=n.call(a);return l&&(o?a[i]=u:delete a[i]),c}return Js=s,Js}var Ks,Nu;function xp(){if(Nu)return Ks;Nu=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Ks=t,Ks}var Ys,Ru;function Ep(){if(Ru)return Ys;Ru=1;var r=Kc(),e=vp(),t=xp(),n="[object Null]",i="[object Undefined]",s=r?r.toStringTag:void 0;function a(o){return o==null?o===void 0?i:n:s&&s in Object(o)?e(o):t(o)}return Ys=a,Ys}var Zs,Tu;function Sp(){if(Tu)return Zs;Tu=1;function r(e){return e!=null&&typeof e=="object"}return Zs=r,Zs}var ea,Au;function Ip(){if(Au)return ea;Au=1;var r=Ep(),e=Sp(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return ea=n,ea}var ta,Du;function Np(){if(Du)return ta;Du=1;var r=yp(),e=bp(),t=Ip(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var h=s.test(l);return h||a.test(l)?o(l.slice(2),h?2:8):i.test(l)?n:+l}return ta=u,ta}var ra,Lu;function Rp(){if(Lu)return ra;Lu=1;var r=Np(),e=1/0,t=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=r(i),i===e||i===-e){var s=i<0?-1:1;return s*t}return i===i?i:0}return ra=n,ra}var na,Ou;function Tp(){if(Ou)return na;Ou=1;var r=Rp();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return na=e,na}var ia,Cu;function Ap(){if(Cu)return ia;Cu=1;var r=Tp(),e="Expected a function";function t(n,i){var s;if(typeof i!="function")throw new TypeError(e);return n=r(n),function(){return--n>0&&(s=i.apply(this,arguments)),n<=1&&(i=void 0),s}}return ia=t,ia}var sa,ju;function Dp(){if(ju)return sa;ju=1;var r=Ap();function e(t){return r(2,t)}return sa=e,sa}var Lp=Dp();const bt=sd(Lp);let $u=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=bt(()=>!this.results.some(s=>s.severity.equals(ae.Info)||s.severity.equals(ae.Violation)||s.severity.equals(ae.Warning))),this._ptr=bt(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new si({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([fr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),za.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Op(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Cp=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:u,shape:l,source:c=[],value:h,valuePaths:b=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=i,this.path=a||l.path,this.results=o,this.severity=u,this.shape=l,this.source=c,this.value=h,this.valuePaths=b,this._message=bt(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),s.map(y=>n.literal(Op(y.value,e),y.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([fr.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const n=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],n(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(i=>n(i).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const i of this.results)e.addOut([ae.detail],[this.factory.blankNode()],s=>{i.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Qa{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new $u({factory:e,options:n}),results:a=new Map,shape:o,value:u,valueOrNode:l,valuePaths:c,values:h}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=u,this.valuePaths=c,this.valueOrNode=l,this.values=h}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:i=this.value,valueOrNode:s=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new Qa({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new $u({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:i,valueOrNode:s,valuePaths:a,values:o})}id({shape:e=this.shape}={}){return`${ot(e.ptr.term)} - ${ot(this.focusNode.term)} - ${gp(this.valuePaths)}`}result(e){const t=new Cp({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:ma.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:ma.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||ae.Violation,...t})}}function jp(){return{generic:$p()}}function $p(){return r=>{r.trace(ma.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Fp{constructor(e){this.validations=new $r(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const i=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(s.term);a&&(i.add(a),s.term.equals(ae.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&i.add(jp),[...i].map(s=>s(e)).filter(Boolean)}}var ir={},sr={},sn={},an={},Fu;function Lr(){if(Fu)return an;Fu=1,Object.defineProperty(an,"__esModule",{value:!0}),an.Translator=void 0;let r=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,n,i){for(const s of n)this.supportedRdfDatatypes.push(s),this.fromRdfHandlers[s.value]=t;for(const s of i){let a=this.toRdfHandlers[s];a||(this.toRdfHandlers[s]=a=[]),a.push(t)}}fromRdf(t,n){const i=this.fromRdfHandlers[t.datatype.value];return i?i.fromRdf(t,n):t.value}toRdf(t,n){const i=this.toRdfHandlers[typeof t];if(i)for(const s of i){const a=s.toRdf(t,n);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return an.Translator=r,an}var ku;function kp(){if(ku)return sn;ku=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.TypeHandlerBoolean=void 0;const r=Lr();let e=class Yc{fromRdf(n,i){switch(n.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return i&&r.Translator.incorrectRdfDataType(n),!1}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(n?"true":"false",i||s.namedNode(Yc.TYPE))}};return sn.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",sn}var on={},Pu;function Pp(){if(Pu)return on;Pu=1,Object.defineProperty(on,"__esModule",{value:!0}),on.TypeHandlerDate=void 0;const r=Lr();let e=class ya{fromRdf(n,i){switch(i&&!n.value.match(ya.VALIDATORS[n.datatype.value.substr(33,n.datatype.value.length)])&&r.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":const s=n.value.split("-");return new Date(0,parseInt(s[0],10)-1,parseInt(s[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(n,{datatype:i,dataFactory:s}){if(i=i||s.namedNode(ya.TYPES[0]),!(n instanceof Date))return null;const a=n;let o;switch(i.value){case"http://www.w3.org/2001/XMLSchema#gDay":o=String(a.getUTCDate());break;case"http://www.w3.org/2001/XMLSchema#gMonthDay":o=a.getUTCMonth()+1+"-"+a.getUTCDate();break;case"http://www.w3.org/2001/XMLSchema#gYear":o=String(a.getUTCFullYear());break;case"http://www.w3.org/2001/XMLSchema#gYearMonth":o=a.getUTCFullYear()+"-"+(a.getUTCMonth()+1);break;case"http://www.w3.org/2001/XMLSchema#date":o=a.toISOString().replace(/T.*$/,"");break;default:o=a.toISOString()}return s.literal(o,i)}};return on.TypeHandlerDate=e,e.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"],e.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]$/},on}var ln={},Mu;function Mp(){if(Mu)return ln;Mu=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.TypeHandlerNumberDouble=void 0;const r=Lr();let e=class Zc{fromRdf(n,i){const s=parseFloat(n.value);return i&&isNaN(s)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return i=i||s.namedNode(Zc.TYPES[0]),isNaN(n)?s.literal("NaN",i):isFinite(n)?n%1===0?null:s.literal(n.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i):s.literal(n>0?"INF":"-INF",i)}};return ln.TypeHandlerNumberDouble=e,e.TYPES=["http://www.w3.org/2001/XMLSchema#double","http://www.w3.org/2001/XMLSchema#decimal","http://www.w3.org/2001/XMLSchema#float"],ln}var un={},Bu;function Bp(){if(Bu)return un;Bu=1,Object.defineProperty(un,"__esModule",{value:!0}),un.TypeHandlerNumberInteger=void 0;const r=Lr();let e=class pn{fromRdf(n,i){const s=parseInt(n.value,10);return i&&(isNaN(s)||n.value.indexOf(".")>=0)&&r.Translator.incorrectRdfDataType(n),s}toRdf(n,{datatype:i,dataFactory:s}){return s.literal(String(n),i||(n<=pn.MAX_INT&&n>=pn.MIN_INT?s.namedNode(pn.TYPES[0]):s.namedNode(pn.TYPES[1])))}};return un.TypeHandlerNumberInteger=e,e.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"],e.MAX_INT=2147483647,e.MIN_INT=-2147483648,un}var cn={},qu;function qp(){if(qu)return cn;qu=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return cn.TypeHandlerString=r,r.TYPES=["http://www.w3.org/2001/XMLSchema#string","http://www.w3.org/2001/XMLSchema#normalizedString","http://www.w3.org/2001/XMLSchema#anyURI","http://www.w3.org/2001/XMLSchema#base64Binary","http://www.w3.org/2001/XMLSchema#language","http://www.w3.org/2001/XMLSchema#Name","http://www.w3.org/2001/XMLSchema#NCName","http://www.w3.org/2001/XMLSchema#NMTOKEN","http://www.w3.org/2001/XMLSchema#token","http://www.w3.org/2001/XMLSchema#hexBinary","http://www.w3.org/1999/02/22-rdf-syntax-ns#langString","http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString","http://www.w3.org/2001/XMLSchema#time","http://www.w3.org/2001/XMLSchema#duration"],cn}var Uu;function Hu(){return Uu||(Uu=1,function(r){var e=sr&&sr.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),t=sr&&sr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(kp(),r),t(Pp(),r),t(Mp(),r),t(Bp(),r),t(qp(),r)}(sr)),sr}var aa={},Vu;function Up(){return Vu||(Vu=1,Object.defineProperty(aa,"__esModule",{value:!0})),aa}var Gu;function Hp(){return Gu||(Gu=1,function(r){var e=ir&&ir.__createBinding||(Object.create?function(y,_,E,v){v===void 0&&(v=E);var x=Object.getOwnPropertyDescriptor(_,E);(!x||("get"in x?!_.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return _[E]}}),Object.defineProperty(y,v,x)}:function(y,_,E,v){v===void 0&&(v=E),y[v]=_[E]}),t=ir&&ir.__exportStar||function(y,_){for(var E in y)E!=="default"&&!Object.prototype.hasOwnProperty.call(_,E)&&e(_,y,E)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=u,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=h,r.getSupportedJavaScriptPrimitives=b;const n=Bc(),i=Hu(),s=Lr();t(Hu(),r),t(Up(),r),t(Lr(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(y=>a.namedNode(y)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(y=>a.namedNode(y)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(y=>a.namedNode(y)),["object"]);function u(y,_){return o.fromRdf(y,_)}function l(y,_){return _&&"namedNode"in _&&(_={dataFactory:_}),_=_||{},_&&!_.dataFactory&&(_.dataFactory=a),o.toRdf(y,_)}function c(y,_){return y.termType==="Literal"?u(y,_):y.value}function h(){return o.getSupportedRdfDatatypes()}function b(){return o.getSupportedJavaScriptPrimitives()}}(ir)),ir}var Sn=Hp();function Wu(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const n=r.out([ae.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=r.out([ae.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=r.out([ae.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function Vp(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Wu(e)):[Wu(r)]}class Gp{constructor(e){this.shape=e,this._compiled=bt(()=>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){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const n of this.compiled)n.node&&await n.node(t),n.generic&&await n.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const n=t.node(new ht(t.terms)),i=[...t].reduce((a,o)=>{const u=o.term,l=t.node([u]);return a.has(u)||a.set(u,{value:l,valuePaths:[]}),a.get(u).valuePaths.push(o),a},new $r).values(),s=e.create({shape:this.shape,values:n});for(const a of this.compiled)a.property&&await a.property(s);for(const{value:a,valuePaths:o}of i){const u=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const l of this.compiled)l.generic&&await l.generic(u)}}}function ba(r){const e=new ht,n=new si({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[fp.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class Wp{constructor(e){this.targetClass=new ht([...ba(e.hasOut([fr.type],[ae.NodeShape])),...ba(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([fr.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],i=e.focusNode.clone({ptrs:n});return i.node([...new ht(i.terms)])}}class zp{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=bt(()=>{const n=this.ptr.out([ae.deactivated]).term;return n&&Sn.fromRdf(n)}),this._message=bt(()=>this.ptr.out([ae.message]).terms),this._path=bt(()=>Vp(this.ptr.out([ae.path]))),this._severity=bt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=bt(()=>new Gp(this)),this._sparql=bt(()=>this.ptr.out([ae.sparql])),this._targetResolver=bt(()=>new Wp(this.ptr))}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()}resolveTargets(e){return this.targetResolver.resolve(e)}async validate(e){const t=e.id({shape:this});if(e.processed.has(t)){if(e.results.has(t))for(const n of e.results.get(t))e.report.results.push(n);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Qp(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:Xp(e)}}function Xp(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Jp(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:Kp(e)}}function Kp(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Yp(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Zp(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function _i(r,e){return Promise.all(r.map(e))}async function eg(r,e){for(const t of r)if(await e(t))return!0;return!1}function tg(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:rg(e)}}function rg(r){return async e=>{const t=await _i(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.every(i=>i.conforms);e.test(n,ae.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function ng(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:ig(e)}}function ig(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!t.conforms;e.test(n,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function sg(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:ag(e)}}function ag(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await _i(r,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=i.flatMap(s=>s.results),n=i.some(s=>s.conforms)}else n=await eg(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(n,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function og(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:lg(e)}}function lg(r){return async e=>{const t=await _i(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.filter(i=>i.conforms).length===1;e.test(n,ae.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function ug(r){if(!Sn.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(s=>r.validator.shape(s)),n=new ht(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new ht([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(s=>s.term));return{node:cg(n,i)}}function cg(r,e){return t=>{const n=t.focusNode.execute({start:"subject",end:"predicate"}).filter(i=>e.has(i.term)?!1:!r.has(i.term));if(n.ptrs.length>0)for(const i of n)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[i.term]}],value:t.focusNode.node([[...i.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function dg(r){const e=r.ptr.out([ae.hasValue]).term;return{node:hg(e),property:fg(e)}}function hg(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function fg(r){return e=>{const t=[...e.values].some(n=>r.equals(n.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function pg(r){const e=new ht([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:gg(e)}}function gg(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function Fr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||zu(r)!==zu(e))return null;const t=Sn.fromRdf(r),n=Sn.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function zu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return za.dateTime.equals(r.datatype)&&e.test(r.value)}function mg(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:yg(e)}}function yg(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function bg(r){const e=r.ptr.out([ae.equals]).term;return{node:_g(e),property:wg(e)}}function _g(r){return e=>{const t=e.focusNode.out([r]),n=t.filter(s=>!s.term.equals(e.focusNode.term)),i=t.terms.length!==0&&n.terms.length===0;e.test(i,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:n.terms[0]&&e.focusNode.node([n.terms[0]])||e.focusNode})}}function wg(r){return e=>{const t=new ht(e.focusNode.out([r]).terms),n=new ht(e.values.terms),i=[...n].filter(o=>!t.has(o)),s=[...t].filter(o=>!n.has(o)),a=[...i,...s];for(const o of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function vg(r){const e=r.ptr.out([ae.lessThan]).term;return{property:xg(e)}}function xg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=Fr(n.term,i);s===null||s>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}}}function Eg(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:Sg(e)}}function Sg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=Fr(n.term,i);s===null||s>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}}}function Ig(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:Ng(e)}}function Ng(r){return e=>{const t=Fr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function Rg(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:Tg(e)}}function Tg(r){return e=>{const t=Fr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function Ag(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:Dg(e)}}function Dg(r){return e=>{const t=Fr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Lg(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:Og(e)}}function Og(r){return e=>{const t=Fr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Cg(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:jg(e)}}function jg(r){return async e=>{for(const t of r){const n=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(n.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:n.report.results,value:e.valueOrNode})}}}function $g(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:Fg(e)}}function Fg(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function kg(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,n=t?Sn.fromRdf(t):!1,i=r.ptr.out([ae.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:Pg(e,n,s,o)}}function Pg(r,e,t,n){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(u=>!u.term.equals(r.ptr.term)).map(u=>i.shape.validator.shape(u))));const o=(await Zp(i.values,async u=>{const l=(await r.validate(i.create({child:!0,focusNode:u}))).report;if(s.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const c=await _i([...a],async h=>(await h.validate(i.create({child:!0,focusNode:u}))).report);return s.push(c.flatMap(h=>h.results)),!c.every(h=>h.conforms)}else return!await Yp([...a],async c=>(await c.validate(i.create({child:!0,focusNode:u}))).report.conforms)})).length;t!==null&&i.test(o<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),n!==null&&i.test(o>=n,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:n,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function Mg(r,e){return e?e.slice(0,r.length)===r:!1}function Bg(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:qg(e)}}function qg(r){return e=>{const t=r.some(n=>Mg(n,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Ug(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:Hg(e)}}function Hg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Vg(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Gg(e)}}function Gg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function Wg(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,n=new RegExp(e,t);return{generic:zg(e,t,n)}}function zg(r,e,t){return n=>{n.test(t.test(n.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function Qg(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&za.boolean.equals(e.datatype)?{property:Xg()}:null}function Xg(){return r=>{const t=Object.entries(r.values.terms.reduce((n,i)=>(i.language&&(n[i.language]=(n[i.language]||0)+1),n),{})).filter(([,n])=>n>1);for(const[n]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:n},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const ei=gt("http://www.w3.org/ns/shacl#"),ed=gt("https://schemas.link/shacl-next#");class Or{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(ei.Info)||e.severity.equals(ei.Violation)||e.severity.equals(ei.Warning))}}function Jg(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class ai{constructor({args:e={},factory:t,message:n=[],severity:i=ei.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(Jg(s.value,e),s.language||null))}}class Xa{constructor({factory:e=Wa}={}){this.factory=e}clone({factory:e}={}){return new Xa({factory:e||this.factory})}validate(){return new Or}validateSimple(){return!0}}class kr extends Xa{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const n of Array.isArray(e)?e:[e])n&&this.datatypes.push(this.factory.fromTerm(n))}clone({factory:e}={}){return new kr({datatypes:this.datatypes,factory:e||this.factory})}}class Kg{constructor({factory:e=Wa,validations:t}={}){if(this.factory=e,this.validations=new $r,t)for(const n of Object.values(t)){const i=n.clone({factory:this.factory});for(const s of i.datatypes)this.validations.set(s,i)}}validate(e){const t=this.validations.get(e.datatype);return t?t.validate(e):new Or}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends kr{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:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(n=>{let i;n.test(e.value)&&(i=ed.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new ai({args:s,factory:this.factory,message:this.message,severity:i})});return new Or({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Yg=/^([-+]?[0-9]+)$/;class st extends Pe{constructor(e=null,t=null,n,{factory:i}={}){super(Yg,n,{factory:i}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new st(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!ed.Debug.equals(t[0].severity))return new Or({results:t});const n=BigInt(e.value);if(this.minInclusive!==null&&n<this.minInclusive){const i=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ai({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&n>this.maxInclusive){const i=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new ai({factory:this.factory,message:s}))}return new Or({results:t})}validateSimple(e){if(!super.validateSimple(e))return!1;const t=BigInt(e.value);return!(this.minInclusive!==null&&t<this.minInclusive||this.maxInclusive!==null&&t>this.maxInclusive)}}class Ja extends kr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new Ja(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const n=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(n)];t.push(new ai({factory:this.factory,message:i}))}return new Or({results:t})}validateSimple(e){return this.values.has(e.value)}}const Te={xsd:gt("http://www.w3.org/2001/XMLSchema#")},Zg=new kr({datatypes:Te.xsd.anySimpleType}),em=new kr({datatypes:Te.xsd.anyAtomicType}),wi=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,tm=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,td=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Ka=/^(-?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)))))$/,rd=/^(-?([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))?)$/,rm=/^((([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))?)$/,nm=/^(-?([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))?)$/,im=/^(-?([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))?)$/,sm=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,am=/^(--(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))?)$/,om=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,lm=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,um=/^(([0-9a-fA-F]{2})*)$/,cm=/^(((([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] ?= ?=))?)$/,dm=new Pe(wi,Te.xsd.string),hm=new Ja(["1","true","0","false"],Te.xsd.boolean),fm=new Pe(tm,Te.xsd.decimal),pm=new Pe(td,Te.xsd.float),gm=new Pe(td,Te.xsd.double),mm=new Pe(Ka,Te.xsd.duration),ym=new Pe(rd,Te.xsd.dateTime),bm=new Pe(rm,Te.xsd.time),_m=new Pe(nm,Te.xsd.date),wm=new Pe(im,Te.xsd.gYearMonth),vm=new Pe(sm,Te.xsd.gYear),xm=new Pe(am,Te.xsd.gMonthDay),Em=new Pe(om,Te.xsd.gDay),Sm=new Pe(lm,Te.xsd.gMonth),Im=new Pe(um,Te.xsd.hexBinary),Nm=new Pe(cm,Te.xsd.base64Binary),Rm=new Pe(wi,Te.xsd.anyURI),nd=/^([^\u000d\u000a\u0009]*)$/,Tm=/^([^ ]+( [^ ]+)*)*$/,Am=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Dm=/^([^DT]*)$/,Lm=/^([^YM]*[DT].*)$/,Om=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Cm=new Pe([wi,nd],Te.xsd.normalizedString),jm=new Pe([wi,nd,Tm],Te.xsd.token),$m=new Pe(Am,Te.xsd.language),Fm=new st(null,null,Te.xsd.integer),km=new st(null,"0",Te.xsd.nonPositiveInteger),Pm=new st(null,"-1",Te.xsd.negativeInteger),Mm=new st("-9223372036854775808","9223372036854775807",Te.xsd.long),Bm=new st("-2147483648","2147483647",Te.xsd.int),qm=new st("-32768","32767",Te.xsd.short),Um=new st("-128","127",Te.xsd.byte),Hm=new st("0",null,Te.xsd.nonNegativeInteger),Vm=new st("0","18446744073709551615",Te.xsd.unsignedLong),Gm=new st("0","4294967295",Te.xsd.unsignedInt),Wm=new st("0","65535",Te.xsd.unsignedShort),zm=new st("0","255",Te.xsd.unsignedByte),Qm=new st("1",null,Te.xsd.positiveInteger),Xm=new Pe([Ka,Dm],Te.xsd.yearMonthDuration),Jm=new Pe([Ka,Lm],Te.xsd.dayTimeDuration),Km=new Pe([rd,Om],Te.xsd.dateTimeStamp),Ym=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:em,anySimpleType:Zg,anyURI:Rm,base64Binary:Nm,boolean:hm,byte:Um,date:_m,dateTime:ym,dateTimeStamp:Km,dayTimeDuration:Jm,decimal:fm,double:gm,duration:mm,float:pm,gDay:Em,gMonth:Sm,gMonthDay:xm,gYear:vm,gYearMonth:wm,hexBinary:Im,int:Bm,integer:Fm,language:$m,long:Mm,negativeInteger:Pm,nonNegativeInteger:Hm,nonPositiveInteger:km,normalizedString:Cm,positiveInteger:Qm,short:qm,string:dm,time:bm,token:jm,unsignedByte:zm,unsignedInt:Gm,unsignedLong:Vm,unsignedShort:Wm,yearMonthDuration:Xm},Symbol.toStringTag,{value:"Module"}));class Zm extends Kg{constructor({factory:e}={}){super({factory:e,validations:{...Ym}})}}const ey=new $r([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function ty(r){const e=r.ptr.out([ae.class]).map(t=>ba(t));return{generic:ry(e)}}function ry(r){return e=>{const t=new ht(e.valueOrNode.out([fr.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function ny(r){const e=r.ptr.out([ae.datatype]).term,t=new Zm;return{generic:iy(e,t)}}function iy(r,e){return t=>{const n=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(n,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function sy(r){const e=r.ptr.out([ae.nodeKind]).term,t=ey.get(e);return{generic:ay(e,t)}}function ay(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const oy=new $r([[ae.maxCount,Qp],[ae.minCount,Jp],[ae.and,tg],[ae.not,ng],[ae.or,sg],[ae.xone,og],[ae.closed,ug],[ae.hasValue,dg],[ae.in,pg],[ae.disjoint,mg],[ae.equals,bg],[ae.lessThan,vg],[ae.lessThanOrEquals,Eg],[ae.maxExclusive,Ig],[ae.maxInclusive,Rg],[ae.minExclusive,Ag],[ae.minInclusive,Lg],[ae.node,Cg],[ae.property,$g],[ae.qualifiedValueShape,kg],[ae.languageIn,Bg],[ae.maxLength,Ug],[ae.minLength,Vg],[ae.pattern,Wg],[ae.uniqueLang,Qg],[ae.class,ty],[ae.datatype,ny],[ae.nodeKind,sy]]);class ly{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Fp(oy),this.shapesPtr=new si({dataset:e,factory:t}),this.shapes=new $r,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[s,a]of this.options.validations)this.registry.validations.set(s,a);const i=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([fr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([fr.type],[ae.PropertyShape])];for(const s of i)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new zp(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new si({...e,factory:this.factory}),i=new Qa({factory:this.factory,focusNode:n,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const a=i.create({shape:s});let o;n.isAny()?o=s.resolveTargets(a):o=n;for(const u of o)await s.validate(a.create({focusNode:u}))}return i.report}}let uy=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new cu(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(n=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:n.conforms,report:n}}))}).catch(n=>{console.warn(n)})})}static get observedAttributes(){return cu.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.setAttribute("loading",""),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading)),this.initDebounceTimeout=setTimeout(async()=>{try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(n=>{this.form.classList.remove(n)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const n of rh())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Wt(e,this.config,this.config.attributes.valuesSubject?Ne.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const n=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);n.addEventListener("click",i=>{i.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(n)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Ne.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,mn)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}this.removeAttribute("loading")},200)}serialize(e="text/turtle",t=this.toRDF()){const n=t.getQuads(null,null,null,null);return Yd(n,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){th(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape&&(this.shape.toRDF(this.config.store),this.config.store.add(new li(this.shape.shaclSubject,Ne.namedNode(xe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId)));try{const t=this.config.store,n=await new ly(t,{details:!0,factory:Ne}).validate({dataset:t});for(const i of n.results)if(i.focusNode?.ptrs?.length)for(const s of i.focusNode.ptrs){const a=s._term;if(i.path?.length){const o=i.path[0].predicates[0];let u=this.form.querySelectorAll(`
392
392
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
393
393
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor,
394
394
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
395
395
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor`);u.length===0&&(u=this.form.querySelectorAll(`
396
396
  :scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'],
397
397
  :scope [data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}']`));for(const l of u)if(l.classList.contains("editor")){if(!e||l.value){let c=l.parentElement;c.classList.add("invalid"),c.classList.remove("valid"),c.appendChild(this.createValidationErrorDisplay(i));do c instanceof nt&&(c.open=!0),c=c.parentElement;while(c)}}else e||(l.classList.add("invalid"),l.classList.remove("valid"),l.appendChild(this.createValidationErrorDisplay(i,"node")))}else e||this.form.querySelector(`:scope [data-node-id='${a.id}']`)?.prepend(this.createValidationErrorDisplay(i,"node"))}return n}catch(t){return console.error(t),!1}}createValidationErrorDisplay(e,t){const n=document.createElement("span");if(n.classList.add("validation-error"),t&&n.classList.add(t),e)if(e.message?.length>0)for(const i of e.message)n.title+=i.value+`
398
- `;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Ne.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,Un,null).length===0){console.warn(`shapes graph does not contain requested root shape ${this.config.attributes.shapeSubject}`);return}}else if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,Dt)>0){const t=Ne.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,tt,null,Dt),...this.config.store.getQuads(t,sa,null,Dt)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${sa.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,tt,Un,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,Nr,n[0].object,null);if(i.length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);return}if(i.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${i[0].subject})`),this.config.store.getQuads(i[0].subject,tt,Un,null).length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${i[0].subject})`);return}e=i[0].subject}}else{const t=this.config.store.getQuads(null,tt,Un,null);if(t.length==0){console.warn("shapes graph does not contain any root shapes");return}t.length>1&&(console.warn("shapes graph contains",t.length,"root shapes. choosing first found which is",t[0].subject.value),console.info('hint: set the shape to use with attribute "data-shape-subject"')),e=t[0].subject}return e}removeFromDataGraph(e){this.config.attributes.valuesSubject;for(const t of this.config.store.getQuads(e,null,null,Dt))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const sy=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
398
+ `;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Ne.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,qn,null).length===0){console.warn(`shapes graph does not contain requested root shape ${this.config.attributes.shapeSubject}`);return}}else if(this.config.attributes.valuesSubject&&this.config.store.countQuads(null,null,null,Dt)>0){const t=Ne.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,tt,null,Dt),...this.config.store.getQuads(t,ua,null,Dt)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${ua.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,tt,qn,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,Nr,n[0].object,null);if(i.length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);return}if(i.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${i[0].subject})`),this.config.store.getQuads(i[0].subject,tt,qn,null).length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${i[0].subject})`);return}e=i[0].subject}}else{const t=this.config.store.getQuads(null,tt,qn,null);if(t.length==0){console.warn("shapes graph does not contain any root shapes");return}t.length>1&&(console.warn("shapes graph contains",t.length,"root shapes. choosing first found which is",t[0].subject.value),console.info('hint: set the shape to use with attribute "data-shape-subject"')),e=t[0].subject}return e}removeFromDataGraph(e){this.config.attributes.valuesSubject;for(const t of this.config.store.getQuads(e,null,null,Dt))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const cy=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
399
399
  .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; }
400
400
  .property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
401
401
  .mode-edit .property-instance label { width: var(--label-width); }
402
- `;class ay extends zd{constructor(e){super(e||sy),this.idCtr=0}createDefaultTemplate(e,t,n,i,s){i.id=`e${this.idCtr++}`,i.classList.add("editor"),s?.datatype?i.shaclDatatype=s.datatype:t instanceof ct&&(i.shaclDatatype=t.datatype),s?.minCount!==void 0&&(i.dataset.minCount=String(s.minCount)),s?.class&&(i.dataset.class=s.class.value),s?.nodeKind?i.dataset.nodeKind=s.nodeKind.value:t instanceof vn&&(i.dataset.nodeKind=xe+"IRI"),(s?.hasValue||s?.readonly)&&(i.disabled=!0),i.value=t?.value||s?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=i.id,a.innerText=e,s?.description&&a.setAttribute("title",s.description.value);const o=s?.description?s.description.value:s?.pattern?s.pattern:null;o&&i.setAttribute("placeholder",o),n&&(i.setAttribute("required","true"),a.classList.add("required"));const u=document.createElement("div");return u.appendChild(a),u.appendChild(i),u}createDateEditor(e,t,n,i){const s=new Ue;i.datatype?.value===Gt+"dateTime"?(s.type="datetime-local",s.setAttribute("step","1")):s.type="date",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=this.createDefaultTemplate(e,null,n,s,i);if(t)try{let o=new Date(t.value).toISOString();i.datatype?.value===Gt+"dateTime"?o=o.slice(0,19):o=o.slice(0,10),s.value=o}catch(o){console.error(o,t)}return a}createTextEditor(e,t,n,i){let s;return i.singleLine===!1?(s=new cr,s.resize="auto"):s=new Ue,s.dense=!0,i.pattern&&(s.pattern=i.pattern),i.minLength&&(s.minLength=i.minLength),i.maxLength&&(s.maxLength=i.maxLength),this.createDefaultTemplate(e,t,n,s,i)}createLangStringEditor(e,t,n,i){const s=this.createTextEditor(e,t,n,i),a=s.querySelector(":scope .editor");let o;if(i.languageIn?.length){o=document.createElement("select");for(const u of i.languageIn){const l=document.createElement("option");l.innerText=u.value,o.appendChild(l)}}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.slot="suffix",o.addEventListener("change",u=>{u.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof ct&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),s}createBooleanEditor(e,t,n,i){const s=document.createElement("input");s.type="checkbox",s.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,n,s,i);return s.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof ct&&(s.checked=t.value==="true"),a}createFileEditor(e,t,n,i){const s=document.createElement("input");return s.type="file",s.addEventListener("change",a=>{if(s.files?.length){a.stopPropagation();const o=new FileReader;o.readAsDataURL(s.files[0]),o.onload=()=>{s.binaryData=btoa(o.result),s.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else s.binaryData=void 0}),this.createDefaultTemplate(e,t,n,s,i)}createNumberEditor(e,t,n,i){const s=new Ue;s.type="number",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=i.minInclusive!==void 0?i.minInclusive:i.minExclusive!==void 0?i.minExclusive+1:void 0,o=i.maxInclusive!==void 0?i.maxInclusive:i.maxExclusive!==void 0?i.maxExclusive-1:void 0;return a!==void 0&&(s.min=String(a)),o!==void 0&&(s.max=String(o)),i.datatype?.value!==Gt+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new Ge;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),u=document.createElement("ul");let l=!0;const c=(d,b)=>{const y=document.createElement("li");if(typeof d.value=="string"?(y.dataset.value=d.value,y.innerText=d.label?d.label:d.value):(d.value instanceof ct&&d.value.datatype.equals(Pd)?y.dataset.value=d.value.value:d.value instanceof vn?y.dataset.value="<"+d.value.value+">":y.dataset.value=d.value.id,y.innerText=d.label?d.label:d.value.value),b.appendChild(y),d.children?.length){l=!1;const _=document.createElement("ul");y.appendChild(_);for(const E of d.children)c(E,_)}};for(const d of i)c(d,u);return l||(a.collapse=!0),a.appendChild(u),t&&(a.value=t.value),o}createButton(e,t){const n=document.createElement("button");return n.type="button",n.innerHTML=e,n}}class oy extends iy{constructor(){super(new ay)}}window.customElements.define("shacl-form",oy);export{ou as Config,Wf as Loader,gy as Plugin,oy as ShaclForm,Gd as ShaclPropertyTemplate,zd as Theme,Rn as findLabel,Yd as registerPlugin};
402
+ `;class dy extends Jd{constructor(e){super(e||cy),this.idCtr=0}createDefaultTemplate(e,t,n,i,s){i.id=`e${this.idCtr++}`,i.classList.add("editor"),s?.datatype?i.shaclDatatype=s.datatype:t instanceof _t&&(i.shaclDatatype=t.datatype),s?.minCount!==void 0&&(i.dataset.minCount=String(s.minCount)),s?.class&&(i.dataset.class=s.class.value),s?.nodeKind?i.dataset.nodeKind=s.nodeKind.value:t instanceof oi&&(i.dataset.nodeKind=xe+"IRI"),(s?.hasValue||s?.readonly)&&(i.disabled=!0),i.value=t?.value||s?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=i.id,a.innerText=e,s?.description&&a.setAttribute("title",s.description.value);const o=s?.description?s.description.value:s?.pattern?s.pattern:null;o&&i.setAttribute("placeholder",o),n&&(i.setAttribute("required","true"),a.classList.add("required"));const u=document.createElement("div");return u.appendChild(a),u.appendChild(i),u}createDateEditor(e,t,n,i){const s=new Ue;i.datatype?.value===Gt+"dateTime"?(s.type="datetime-local",s.setAttribute("step","1")):s.type="date",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=this.createDefaultTemplate(e,null,n,s,i);if(t)try{let o=new Date(t.value).toISOString();i.datatype?.value===Gt+"dateTime"?o=o.slice(0,19):o=o.slice(0,10),s.value=o}catch(o){console.error(o,t)}return a}createTextEditor(e,t,n,i){let s;return i.singleLine===!1?(s=new cr,s.resize="auto"):s=new Ue,s.dense=!0,i.pattern&&(s.pattern=i.pattern),i.minLength&&(s.minLength=i.minLength),i.maxLength&&(s.maxLength=i.maxLength),this.createDefaultTemplate(e,t,n,s,i)}createLangStringEditor(e,t,n,i){const s=this.createTextEditor(e,t,n,i),a=s.querySelector(":scope .editor");let o;if(i.languageIn?.length){o=document.createElement("select");for(const u of i.languageIn){const l=document.createElement("option");l.innerText=u.value,o.appendChild(l)}}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.slot="suffix",o.addEventListener("change",u=>{u.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof _t&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),s}createBooleanEditor(e,t,n,i){const s=document.createElement("input");s.type="checkbox",s.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,n,s,i);return s.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof _t&&(s.checked=t.value==="true"),a}createFileEditor(e,t,n,i){const s=document.createElement("input");return s.type="file",s.addEventListener("change",a=>{if(s.files?.length){a.stopPropagation();const o=new FileReader;o.readAsDataURL(s.files[0]),o.onload=()=>{s.binaryData=btoa(o.result),s.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else s.binaryData=void 0}),this.createDefaultTemplate(e,t,n,s,i)}createNumberEditor(e,t,n,i){const s=new Ue;s.type="number",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=i.minInclusive!==void 0?i.minInclusive:i.minExclusive!==void 0?i.minExclusive+1:void 0,o=i.maxInclusive!==void 0?i.maxInclusive:i.maxExclusive!==void 0?i.maxExclusive-1:void 0;return a!==void 0&&(s.min=String(a)),o!==void 0&&(s.max=String(o)),i.datatype?.value!==Gt+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new Ge;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),u=document.createElement("ul");let l=!0;const c=(h,b)=>{const y=document.createElement("li");if(typeof h.value=="string"?(y.dataset.value=h.value,y.innerText=h.label?h.label:h.value):(y.dataset.value=h.value.id,y.innerText=h.label?h.label:h.value.value),b.appendChild(y),h.children?.length){l=!1;const _=document.createElement("ul");y.appendChild(_);for(const E of h.children)c(E,_)}};for(const h of i)c(h,u);return l||(a.collapse=!0),a.appendChild(u),t&&(a.value=t.id),o}createButton(e,t){const n=document.createElement("button");return n.type="button",n.innerHTML=e,n}}class hy extends uy{constructor(){super(new dy)}}window.customElements.define("shacl-form",hy);export{cu as Config,Kf as Loader,wy as Plugin,hy as ShaclForm,Qd as ShaclPropertyTemplate,Jd as Theme,Nn as findLabel,th as registerPlugin};