@ulb-darmstadt/shacl-form 1.8.3 → 1.8.4

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,30 +1,30 @@
1
- var Zt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function Sc(n){if(Object.prototype.hasOwnProperty.call(n,"__esModule"))return n;var e=n.default;if(typeof e=="function"){var t=function r(){var i=!1;try{i=this instanceof r}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(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var Vn={},pr={},Ra;function Ec(){if(Ra)return pr;Ra=1,pr.byteLength=o,pr.toByteArray=d,pr.fromByteArray=w;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=r.length;i<s;++i)n[i]=r[i],e[r.charCodeAt(i)]=i;e[45]=62,e[95]=63;function a(g){var m=g.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=g.indexOf("=");_===-1&&(_=m);var x=_===m?0:4-_%4;return[_,x]}function o(g){var m=a(g),_=m[0],x=m[1];return(_+x)*3/4-x}function l(g,m,_){return(m+_)*3/4-_}function d(g){var m,_=a(g),x=_[0],S=_[1],I=new t(l(g,x,S)),b=0,c=S>0?x-4:x,p;for(p=0;p<c;p+=4)m=e[g.charCodeAt(p)]<<18|e[g.charCodeAt(p+1)]<<12|e[g.charCodeAt(p+2)]<<6|e[g.charCodeAt(p+3)],I[b++]=m>>16&255,I[b++]=m>>8&255,I[b++]=m&255;return S===2&&(m=e[g.charCodeAt(p)]<<2|e[g.charCodeAt(p+1)]>>4,I[b++]=m&255),S===1&&(m=e[g.charCodeAt(p)]<<10|e[g.charCodeAt(p+1)]<<4|e[g.charCodeAt(p+2)]>>2,I[b++]=m>>8&255,I[b++]=m&255),I}function h(g){return n[g>>18&63]+n[g>>12&63]+n[g>>6&63]+n[g&63]}function y(g,m,_){for(var x,S=[],I=m;I<_;I+=3)x=(g[I]<<16&16711680)+(g[I+1]<<8&65280)+(g[I+2]&255),S.push(h(x));return S.join("")}function w(g){for(var m,_=g.length,x=_%3,S=[],I=16383,b=0,c=_-x;b<c;b+=I)S.push(y(g,b,b+I>c?c:b+I));return x===1?(m=g[_-1],S.push(n[m>>2]+n[m<<4&63]+"==")):x===2&&(m=(g[_-2]<<8)+g[_-1],S.push(n[m>>10]+n[m>>4&63]+n[m<<2&63]+"=")),S.join("")}return pr}var Zr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Na;function Ic(){return Na||(Na=1,Zr.read=function(n,e,t,r,i){var s,a,o=i*8-r-1,l=(1<<o)-1,d=l>>1,h=-7,y=t?i-1:0,w=t?-1:1,g=n[e+y];for(y+=w,s=g&(1<<-h)-1,g>>=-h,h+=o;h>0;s=s*256+n[e+y],y+=w,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=r;h>0;a=a*256+n[e+y],y+=w,h-=8);if(s===0)s=1-d;else{if(s===l)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,r),s=s-d}return(g?-1:1)*a*Math.pow(2,s-r)},Zr.write=function(n,e,t,r,i,s){var a,o,l,d=s*8-i-1,h=(1<<d)-1,y=h>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=r?0:s-1,m=r?1:-1,_=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=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+y>=1?e+=w/l:e+=w*Math.pow(2,1-y),e*l>=2&&(a++,l/=2),a+y>=h?(o=0,a=h):a+y>=1?(o=(e*l-1)*Math.pow(2,i),a=a+y):(o=e*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;n[t+g]=o&255,g+=m,o/=256,i-=8);for(a=a<<i|o,d+=i;d>0;n[t+g]=a&255,g+=m,a/=256,d-=8);n[t+g-m]|=_*128}),Zr}/*!
1
+ var Zt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _c(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function xc(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 Vn={},pr={},Ia;function Sc(){if(Ia)return pr;Ia=1,pr.byteLength=o,pr.toByteArray=d,pr.fromByteArray=w;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(g){var m=g.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var _=g.indexOf("=");_===-1&&(_=m);var x=_===m?0:4-_%4;return[_,x]}function o(g){var m=a(g),_=m[0],x=m[1];return(_+x)*3/4-x}function l(g,m,_){return(m+_)*3/4-_}function d(g){var m,_=a(g),x=_[0],S=_[1],I=new t(l(g,x,S)),b=0,c=S>0?x-4:x,p;for(p=0;p<c;p+=4)m=e[g.charCodeAt(p)]<<18|e[g.charCodeAt(p+1)]<<12|e[g.charCodeAt(p+2)]<<6|e[g.charCodeAt(p+3)],I[b++]=m>>16&255,I[b++]=m>>8&255,I[b++]=m&255;return S===2&&(m=e[g.charCodeAt(p)]<<2|e[g.charCodeAt(p+1)]>>4,I[b++]=m&255),S===1&&(m=e[g.charCodeAt(p)]<<10|e[g.charCodeAt(p+1)]<<4|e[g.charCodeAt(p+2)]>>2,I[b++]=m>>8&255,I[b++]=m&255),I}function h(g){return r[g>>18&63]+r[g>>12&63]+r[g>>6&63]+r[g&63]}function y(g,m,_){for(var x,S=[],I=m;I<_;I+=3)x=(g[I]<<16&16711680)+(g[I+1]<<8&65280)+(g[I+2]&255),S.push(h(x));return S.join("")}function w(g){for(var m,_=g.length,x=_%3,S=[],I=16383,b=0,c=_-x;b<c;b+=I)S.push(y(g,b,b+I>c?c:b+I));return x===1?(m=g[_-1],S.push(r[m>>2]+r[m<<4&63]+"==")):x===2&&(m=(g[_-2]<<8)+g[_-1],S.push(r[m>>10]+r[m>>4&63]+r[m<<2&63]+"=")),S.join("")}return pr}var Zr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Ra;function Ec(){return Ra||(Ra=1,Zr.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,l=(1<<o)-1,d=l>>1,h=-7,y=t?i-1:0,w=t?-1:1,g=r[e+y];for(y+=w,s=g&(1<<-h)-1,g>>=-h,h+=o;h>0;s=s*256+r[e+y],y+=w,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=a*256+r[e+y],y+=w,h-=8);if(s===0)s=1-d;else{if(s===l)return a?NaN:(g?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-d}return(g?-1:1)*a*Math.pow(2,s-n)},Zr.write=function(r,e,t,n,i,s){var a,o,l,d=s*8-i-1,h=(1<<d)-1,y=h>>1,w=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:s-1,m=n?1:-1,_=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=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+y>=1?e+=w/l:e+=w*Math.pow(2,1-y),e*l>=2&&(a++,l/=2),a+y>=h?(o=0,a=h):a+y>=1?(o=(e*l-1)*Math.pow(2,i),a=a+y):(o=e*Math.pow(2,y-1)*Math.pow(2,i),a=0));i>=8;r[t+g]=o&255,g+=m,o/=256,i-=8);for(a=a<<i|o,d+=i;d>0;r[t+g]=a&255,g+=m,a/=256,d-=8);r[t+g-m]|=_*128}),Zr}/*!
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 Ta;function bt(){return Ta||(Ta=1,function(n){const e=Ec(),t=Ic(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=o,n.SlowBuffer=I,n.INSPECT_MAX_BYTES=50;const i=2147483647;n.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 E=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(E,u),E.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(E){if(E>i)throw new RangeError('The value "'+E+'" is invalid for option "size"');const u=new Uint8Array(E);return Object.setPrototypeOf(u,o.prototype),u}function o(E,u,f){if(typeof E=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(E)}return l(E,u,f)}o.poolSize=8192;function l(E,u,f){if(typeof E=="string")return w(E,u);if(ArrayBuffer.isView(E))return m(E);if(E==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E);if(se(E,ArrayBuffer)||E&&se(E.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(se(E,SharedArrayBuffer)||E&&se(E.buffer,SharedArrayBuffer)))return _(E,u,f);if(typeof E=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const k=E.valueOf&&E.valueOf();if(k!=null&&k!==E)return o.from(k,u,f);const J=x(E);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof E[Symbol.toPrimitive]=="function")return o.from(E[Symbol.toPrimitive]("string"),u,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E)}o.from=function(E,u,f){return l(E,u,f)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function d(E){if(typeof E!="number")throw new TypeError('"size" argument must be of type number');if(E<0)throw new RangeError('The value "'+E+'" is invalid for option "size"')}function h(E,u,f){return d(E),E<=0?a(E):u!==void 0?typeof f=="string"?a(E).fill(u,f):a(E).fill(u):a(E)}o.alloc=function(E,u,f){return h(E,u,f)};function y(E){return d(E),a(E<0?0:S(E)|0)}o.allocUnsafe=function(E){return y(E)},o.allocUnsafeSlow=function(E){return y(E)};function w(E,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);const f=b(E,u)|0;let k=a(f);const J=k.write(E,u);return J!==f&&(k=k.slice(0,J)),k}function g(E){const u=E.length<0?0:S(E.length)|0,f=a(u);for(let k=0;k<u;k+=1)f[k]=E[k]&255;return f}function m(E){if(se(E,Uint8Array)){const u=new Uint8Array(E);return _(u.buffer,u.byteOffset,u.byteLength)}return g(E)}function _(E,u,f){if(u<0||E.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(E.byteLength<u+(f||0))throw new RangeError('"length" is outside of buffer bounds');let k;return u===void 0&&f===void 0?k=new Uint8Array(E):f===void 0?k=new Uint8Array(E,u):k=new Uint8Array(E,u,f),Object.setPrototypeOf(k,o.prototype),k}function x(E){if(o.isBuffer(E)){const u=S(E.length)|0,f=a(u);return f.length===0||E.copy(f,0,0,u),f}if(E.length!==void 0)return typeof E.length!="number"||Ee(E.length)?a(0):g(E);if(E.type==="Buffer"&&Array.isArray(E.data))return g(E.data)}function S(E){if(E>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return E|0}function I(E){return+E!=E&&(E=0),o.alloc(+E)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,f){if(se(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),se(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),!o.isBuffer(u)||!o.isBuffer(f))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===f)return 0;let k=u.length,J=f.length;for(let ie=0,oe=Math.min(k,J);ie<oe;++ie)if(u[ie]!==f[ie]){k=u[ie],J=f[ie];break}return k<J?-1:J<k?1:0},o.isEncoding=function(u){switch(String(u).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(u,f){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);let k;if(f===void 0)for(f=0,k=0;k<u.length;++k)f+=u[k].length;const J=o.allocUnsafe(f);let ie=0;for(k=0;k<u.length;++k){let oe=u[k];if(se(oe,Uint8Array))ie+oe.length>J.length?(o.isBuffer(oe)||(oe=o.from(oe)),oe.copy(J,ie)):Uint8Array.prototype.set.call(J,oe,ie);else if(o.isBuffer(oe))oe.copy(J,ie);else throw new TypeError('"list" argument must be an Array of Buffers');ie+=oe.length}return J};function b(E,u){if(o.isBuffer(E))return E.length;if(ArrayBuffer.isView(E)||se(E,ArrayBuffer))return E.byteLength;if(typeof E!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof E);const f=E.length,k=arguments.length>2&&arguments[2]===!0;if(!k&&f===0)return 0;let J=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return de(E).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return le(E).length;default:if(J)return k?-1:de(E).length;u=(""+u).toLowerCase(),J=!0}}o.byteLength=b;function c(E,u,f){let k=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,u>>>=0,f<=u))return"";for(E||(E="utf8");;)switch(E){case"hex":return K(this,u,f);case"utf8":case"utf-8":return j(this,u,f);case"ascii":return ee(this,u,f);case"latin1":case"binary":return C(this,u,f);case"base64":return A(this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,u,f);default:if(k)throw new TypeError("Unknown encoding: "+E);E=(E+"").toLowerCase(),k=!0}}o.prototype._isBuffer=!0;function p(E,u,f){const k=E[u];E[u]=E[f],E[f]=k}o.prototype.swap16=function(){const u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let f=0;f<u;f+=2)p(this,f,f+1);return this},o.prototype.swap32=function(){const u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let f=0;f<u;f+=4)p(this,f,f+3),p(this,f+1,f+2);return this},o.prototype.swap64=function(){const u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let f=0;f<u;f+=8)p(this,f,f+7),p(this,f+1,f+6),p(this,f+2,f+5),p(this,f+3,f+4);return this},o.prototype.toString=function(){const u=this.length;return u===0?"":arguments.length===0?j(this,0,u):c.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){let u="";const f=n.INSPECT_MAX_BYTES;return u=this.toString("hex",0,f).replace(/(.{2})/g,"$1 ").trim(),this.length>f&&(u+=" ... "),"<Buffer "+u+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(u,f,k,J,ie){if(se(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(f===void 0&&(f=0),k===void 0&&(k=u?u.length:0),J===void 0&&(J=0),ie===void 0&&(ie=this.length),f<0||k>u.length||J<0||ie>this.length)throw new RangeError("out of range index");if(J>=ie&&f>=k)return 0;if(J>=ie)return-1;if(f>=k)return 1;if(f>>>=0,k>>>=0,J>>>=0,ie>>>=0,this===u)return 0;let oe=ie-J,we=k-f;const Le=Math.min(oe,we),Te=this.slice(J,ie),je=u.slice(f,k);for(let Ie=0;Ie<Le;++Ie)if(Te[Ie]!==je[Ie]){oe=Te[Ie],we=je[Ie];break}return oe<we?-1:we<oe?1:0};function N(E,u,f,k,J){if(E.length===0)return-1;if(typeof f=="string"?(k=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,Ee(f)&&(f=J?0:E.length-1),f<0&&(f=E.length+f),f>=E.length){if(J)return-1;f=E.length-1}else if(f<0)if(J)f=0;else return-1;if(typeof u=="string"&&(u=o.from(u,k)),o.isBuffer(u))return u.length===0?-1:D(E,u,f,k,J);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(E,u,f):Uint8Array.prototype.lastIndexOf.call(E,u,f):D(E,[u],f,k,J);throw new TypeError("val must be string, number or Buffer")}function D(E,u,f,k,J){let ie=1,oe=E.length,we=u.length;if(k!==void 0&&(k=String(k).toLowerCase(),k==="ucs2"||k==="ucs-2"||k==="utf16le"||k==="utf-16le")){if(E.length<2||u.length<2)return-1;ie=2,oe/=2,we/=2,f/=2}function Le(je,Ie){return ie===1?je[Ie]:je.readUInt16BE(Ie*ie)}let Te;if(J){let je=-1;for(Te=f;Te<oe;Te++)if(Le(E,Te)===Le(u,je===-1?0:Te-je)){if(je===-1&&(je=Te),Te-je+1===we)return je*ie}else je!==-1&&(Te-=Te-je),je=-1}else for(f+we>oe&&(f=oe-we),Te=f;Te>=0;Te--){let je=!0;for(let Ie=0;Ie<we;Ie++)if(Le(E,Te+Ie)!==Le(u,Ie)){je=!1;break}if(je)return Te}return-1}o.prototype.includes=function(u,f,k){return this.indexOf(u,f,k)!==-1},o.prototype.indexOf=function(u,f,k){return N(this,u,f,k,!0)},o.prototype.lastIndexOf=function(u,f,k){return N(this,u,f,k,!1)};function T(E,u,f,k){f=Number(f)||0;const J=E.length-f;k?(k=Number(k),k>J&&(k=J)):k=J;const ie=u.length;k>ie/2&&(k=ie/2);let oe;for(oe=0;oe<k;++oe){const we=parseInt(u.substr(oe*2,2),16);if(Ee(we))return oe;E[f+oe]=we}return oe}function q(E,u,f,k){return he(de(u,E.length-f),E,f,k)}function R(E,u,f,k){return he(pe(u),E,f,k)}function M(E,u,f,k){return he(le(u),E,f,k)}function B(E,u,f,k){return he(X(u,E.length-f),E,f,k)}o.prototype.write=function(u,f,k,J){if(f===void 0)J="utf8",k=this.length,f=0;else if(k===void 0&&typeof f=="string")J=f,k=this.length,f=0;else if(isFinite(f))f=f>>>0,isFinite(k)?(k=k>>>0,J===void 0&&(J="utf8")):(J=k,k=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ie=this.length-f;if((k===void 0||k>ie)&&(k=ie),u.length>0&&(k<0||f<0)||f>this.length)throw new RangeError("Attempt to write outside buffer bounds");J||(J="utf8");let oe=!1;for(;;)switch(J){case"hex":return T(this,u,f,k);case"utf8":case"utf-8":return q(this,u,f,k);case"ascii":case"latin1":case"binary":return R(this,u,f,k);case"base64":return M(this,u,f,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,u,f,k);default:if(oe)throw new TypeError("Unknown encoding: "+J);J=(""+J).toLowerCase(),oe=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(E,u,f){return u===0&&f===E.length?e.fromByteArray(E):e.fromByteArray(E.slice(u,f))}function j(E,u,f){f=Math.min(E.length,f);const k=[];let J=u;for(;J<f;){const ie=E[J];let oe=null,we=ie>239?4:ie>223?3:ie>191?2:1;if(J+we<=f){let Le,Te,je,Ie;switch(we){case 1:ie<128&&(oe=ie);break;case 2:Le=E[J+1],(Le&192)===128&&(Ie=(ie&31)<<6|Le&63,Ie>127&&(oe=Ie));break;case 3:Le=E[J+1],Te=E[J+2],(Le&192)===128&&(Te&192)===128&&(Ie=(ie&15)<<12|(Le&63)<<6|Te&63,Ie>2047&&(Ie<55296||Ie>57343)&&(oe=Ie));break;case 4:Le=E[J+1],Te=E[J+2],je=E[J+3],(Le&192)===128&&(Te&192)===128&&(je&192)===128&&(Ie=(ie&15)<<18|(Le&63)<<12|(Te&63)<<6|je&63,Ie>65535&&Ie<1114112&&(oe=Ie))}}oe===null?(oe=65533,we=1):oe>65535&&(oe-=65536,k.push(oe>>>10&1023|55296),oe=56320|oe&1023),k.push(oe),J+=we}return L(k)}const Y=4096;function L(E){const u=E.length;if(u<=Y)return String.fromCharCode.apply(String,E);let f="",k=0;for(;k<u;)f+=String.fromCharCode.apply(String,E.slice(k,k+=Y));return f}function ee(E,u,f){let k="";f=Math.min(E.length,f);for(let J=u;J<f;++J)k+=String.fromCharCode(E[J]&127);return k}function C(E,u,f){let k="";f=Math.min(E.length,f);for(let J=u;J<f;++J)k+=String.fromCharCode(E[J]);return k}function K(E,u,f){const k=E.length;(!u||u<0)&&(u=0),(!f||f<0||f>k)&&(f=k);let J="";for(let ie=u;ie<f;++ie)J+=qe[E[ie]];return J}function v(E,u,f){const k=E.slice(u,f);let J="";for(let ie=0;ie<k.length-1;ie+=2)J+=String.fromCharCode(k[ie]+k[ie+1]*256);return J}o.prototype.slice=function(u,f){const k=this.length;u=~~u,f=f===void 0?k:~~f,u<0?(u+=k,u<0&&(u=0)):u>k&&(u=k),f<0?(f+=k,f<0&&(f=0)):f>k&&(f=k),f<u&&(f=u);const J=this.subarray(u,f);return Object.setPrototypeOf(J,o.prototype),J};function U(E,u,f){if(E%1!==0||E<0)throw new RangeError("offset is not uint");if(E+u>f)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u],ie=1,oe=0;for(;++oe<f&&(ie*=256);)J+=this[u+oe]*ie;return J},o.prototype.readUintBE=o.prototype.readUIntBE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u+--f],ie=1;for(;f>0&&(ie*=256);)J+=this[u+--f]*ie;return J},o.prototype.readUint8=o.prototype.readUInt8=function(u,f){return u=u>>>0,f||U(u,1,this.length),this[u]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(u,f){return u=u>>>0,f||U(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(u,f){return u=u>>>0,f||U(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(u,f){return u=u>>>0,f||U(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readBigUInt64LE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,ie=this[++u]+this[++u]*2**8+this[++u]*2**16+k*2**24;return BigInt(J)+(BigInt(ie)<<BigInt(32))}),o.prototype.readBigUInt64BE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=f*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],ie=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+k;return(BigInt(J)<<BigInt(32))+BigInt(ie)}),o.prototype.readIntLE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u],ie=1,oe=0;for(;++oe<f&&(ie*=256);)J+=this[u+oe]*ie;return ie*=128,J>=ie&&(J-=Math.pow(2,8*f)),J},o.prototype.readIntBE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=f,ie=1,oe=this[u+--J];for(;J>0&&(ie*=256);)oe+=this[u+--J]*ie;return ie*=128,oe>=ie&&(oe-=Math.pow(2,8*f)),oe},o.prototype.readInt8=function(u,f){return u=u>>>0,f||U(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,f){u=u>>>0,f||U(u,2,this.length);const k=this[u]|this[u+1]<<8;return k&32768?k|4294901760:k},o.prototype.readInt16BE=function(u,f){u=u>>>0,f||U(u,2,this.length);const k=this[u+1]|this[u]<<8;return k&32768?k|4294901760:k},o.prototype.readInt32LE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readBigInt64LE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(k<<24);return(BigInt(J)<<BigInt(32))+BigInt(f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),o.prototype.readBigInt64BE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=(f<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(J)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+k)}),o.prototype.readFloatLE=function(u,f){return u=u>>>0,f||U(u,4,this.length),t.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,f){return u=u>>>0,f||U(u,4,this.length),t.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,f){return u=u>>>0,f||U(u,8,this.length),t.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,f){return u=u>>>0,f||U(u,8,this.length),t.read(this,u,!1,52,8)};function Q(E,u,f,k,J,ie){if(!o.isBuffer(E))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>J||u<ie)throw new RangeError('"value" argument is out of bounds');if(f+k>E.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(u,f,k,J){if(u=+u,f=f>>>0,k=k>>>0,!J){const we=Math.pow(2,8*k)-1;Q(this,u,f,k,we,0)}let ie=1,oe=0;for(this[f]=u&255;++oe<k&&(ie*=256);)this[f+oe]=u/ie&255;return f+k},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(u,f,k,J){if(u=+u,f=f>>>0,k=k>>>0,!J){const we=Math.pow(2,8*k)-1;Q(this,u,f,k,we,0)}let ie=k-1,oe=1;for(this[f+ie]=u&255;--ie>=0&&(oe*=256);)this[f+ie]=u/oe&255;return f+k},o.prototype.writeUint8=o.prototype.writeUInt8=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,1,255,0),this[f]=u&255,f+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,65535,0),this[f]=u&255,this[f+1]=u>>>8,f+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,65535,0),this[f]=u>>>8,this[f+1]=u&255,f+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,4294967295,0),this[f+3]=u>>>24,this[f+2]=u>>>16,this[f+1]=u>>>8,this[f]=u&255,f+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,4294967295,0),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4};function z(E,u,f,k,J){fe(u,k,J,E,f,7);let ie=Number(u&BigInt(4294967295));E[f++]=ie,ie=ie>>8,E[f++]=ie,ie=ie>>8,E[f++]=ie,ie=ie>>8,E[f++]=ie;let oe=Number(u>>BigInt(32)&BigInt(4294967295));return E[f++]=oe,oe=oe>>8,E[f++]=oe,oe=oe>>8,E[f++]=oe,oe=oe>>8,E[f++]=oe,f}function ae(E,u,f,k,J){fe(u,k,J,E,f,7);let ie=Number(u&BigInt(4294967295));E[f+7]=ie,ie=ie>>8,E[f+6]=ie,ie=ie>>8,E[f+5]=ie,ie=ie>>8,E[f+4]=ie;let oe=Number(u>>BigInt(32)&BigInt(4294967295));return E[f+3]=oe,oe=oe>>8,E[f+2]=oe,oe=oe>>8,E[f+1]=oe,oe=oe>>8,E[f]=oe,f+8}o.prototype.writeBigUInt64LE=_e(function(u,f=0){return z(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=_e(function(u,f=0){return ae(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(u,f,k,J){if(u=+u,f=f>>>0,!J){const Le=Math.pow(2,8*k-1);Q(this,u,f,k,Le-1,-Le)}let ie=0,oe=1,we=0;for(this[f]=u&255;++ie<k&&(oe*=256);)u<0&&we===0&&this[f+ie-1]!==0&&(we=1),this[f+ie]=(u/oe>>0)-we&255;return f+k},o.prototype.writeIntBE=function(u,f,k,J){if(u=+u,f=f>>>0,!J){const Le=Math.pow(2,8*k-1);Q(this,u,f,k,Le-1,-Le)}let ie=k-1,oe=1,we=0;for(this[f+ie]=u&255;--ie>=0&&(oe*=256);)u<0&&we===0&&this[f+ie+1]!==0&&(we=1),this[f+ie]=(u/oe>>0)-we&255;return f+k},o.prototype.writeInt8=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,1,127,-128),u<0&&(u=255+u+1),this[f]=u&255,f+1},o.prototype.writeInt16LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,32767,-32768),this[f]=u&255,this[f+1]=u>>>8,f+2},o.prototype.writeInt16BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,32767,-32768),this[f]=u>>>8,this[f+1]=u&255,f+2},o.prototype.writeInt32LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,2147483647,-2147483648),this[f]=u&255,this[f+1]=u>>>8,this[f+2]=u>>>16,this[f+3]=u>>>24,f+4},o.prototype.writeInt32BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4},o.prototype.writeBigInt64LE=_e(function(u,f=0){return z(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=_e(function(u,f=0){return ae(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function H(E,u,f,k,J,ie){if(f+k>E.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function V(E,u,f,k,J){return u=+u,f=f>>>0,J||H(E,u,f,4),t.write(E,u,f,k,23,4),f+4}o.prototype.writeFloatLE=function(u,f,k){return V(this,u,f,!0,k)},o.prototype.writeFloatBE=function(u,f,k){return V(this,u,f,!1,k)};function W(E,u,f,k,J){return u=+u,f=f>>>0,J||H(E,u,f,8),t.write(E,u,f,k,52,8),f+8}o.prototype.writeDoubleLE=function(u,f,k){return W(this,u,f,!0,k)},o.prototype.writeDoubleBE=function(u,f,k){return W(this,u,f,!1,k)},o.prototype.copy=function(u,f,k,J){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(k||(k=0),!J&&J!==0&&(J=this.length),f>=u.length&&(f=u.length),f||(f=0),J>0&&J<k&&(J=k),J===k||u.length===0||this.length===0)return 0;if(f<0)throw new RangeError("targetStart out of bounds");if(k<0||k>=this.length)throw new RangeError("Index out of range");if(J<0)throw new RangeError("sourceEnd out of bounds");J>this.length&&(J=this.length),u.length-f<J-k&&(J=u.length-f+k);const ie=J-k;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(f,k,J):Uint8Array.prototype.set.call(u,this.subarray(k,J),f),ie},o.prototype.fill=function(u,f,k,J){if(typeof u=="string"){if(typeof f=="string"?(J=f,f=0,k=this.length):typeof k=="string"&&(J=k,k=this.length),J!==void 0&&typeof J!="string")throw new TypeError("encoding must be a string");if(typeof J=="string"&&!o.isEncoding(J))throw new TypeError("Unknown encoding: "+J);if(u.length===1){const oe=u.charCodeAt(0);(J==="utf8"&&oe<128||J==="latin1")&&(u=oe)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(f<0||this.length<f||this.length<k)throw new RangeError("Out of range index");if(k<=f)return this;f=f>>>0,k=k===void 0?this.length:k>>>0,u||(u=0);let ie;if(typeof u=="number")for(ie=f;ie<k;++ie)this[ie]=u;else{const oe=o.isBuffer(u)?u:o.from(u,J),we=oe.length;if(we===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(ie=0;ie<k-f;++ie)this[ie+f]=oe[ie%we]}return this};const F={};function Z(E,u,f){F[E]=class extends f{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${E}]`,this.stack,delete this.name}get code(){return E}set code(J){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:J,writable:!0})}toString(){return`${this.name} [${E}]: ${this.message}`}}}Z("ERR_BUFFER_OUT_OF_BOUNDS",function(E){return E?`${E} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Z("ERR_INVALID_ARG_TYPE",function(E,u){return`The "${E}" argument must be of type number. Received type ${typeof u}`},TypeError),Z("ERR_OUT_OF_RANGE",function(E,u,f){let k=`The value of "${E}" is out of range.`,J=f;return Number.isInteger(f)&&Math.abs(f)>2**32?J=te(String(f)):typeof f=="bigint"&&(J=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(J=te(J)),J+="n"),k+=` It must be ${u}. Received ${J}`,k},RangeError);function te(E){let u="",f=E.length;const k=E[0]==="-"?1:0;for(;f>=k+4;f-=3)u=`_${E.slice(f-3,f)}${u}`;return`${E.slice(0,f)}${u}`}function ce(E,u,f){O(u,"offset"),(E[u]===void 0||E[u+f]===void 0)&&G(u,E.length-(f+1))}function fe(E,u,f,k,J,ie){if(E>f||E<u){const oe=typeof u=="bigint"?"n":"";let we;throw u===0||u===BigInt(0)?we=`>= 0${oe} and < 2${oe} ** ${(ie+1)*8}${oe}`:we=`>= -(2${oe} ** ${(ie+1)*8-1}${oe}) and < 2 ** ${(ie+1)*8-1}${oe}`,new F.ERR_OUT_OF_RANGE("value",we,E)}ce(k,J,ie)}function O(E,u){if(typeof E!="number")throw new F.ERR_INVALID_ARG_TYPE(u,"number",E)}function G(E,u,f){throw Math.floor(E)!==E?(O(E,f),new F.ERR_OUT_OF_RANGE("offset","an integer",E)):u<0?new F.ERR_BUFFER_OUT_OF_BOUNDS:new F.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,E)}const re=/[^+/0-9A-Za-z-_]/g;function ue(E){if(E=E.split("=")[0],E=E.trim().replace(re,""),E.length<2)return"";for(;E.length%4!==0;)E=E+"=";return E}function de(E,u){u=u||1/0;let f;const k=E.length;let J=null;const ie=[];for(let oe=0;oe<k;++oe){if(f=E.charCodeAt(oe),f>55295&&f<57344){if(!J){if(f>56319){(u-=3)>-1&&ie.push(239,191,189);continue}else if(oe+1===k){(u-=3)>-1&&ie.push(239,191,189);continue}J=f;continue}if(f<56320){(u-=3)>-1&&ie.push(239,191,189),J=f;continue}f=(J-55296<<10|f-56320)+65536}else J&&(u-=3)>-1&&ie.push(239,191,189);if(J=null,f<128){if((u-=1)<0)break;ie.push(f)}else if(f<2048){if((u-=2)<0)break;ie.push(f>>6|192,f&63|128)}else if(f<65536){if((u-=3)<0)break;ie.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((u-=4)<0)break;ie.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return ie}function pe(E){const u=[];for(let f=0;f<E.length;++f)u.push(E.charCodeAt(f)&255);return u}function X(E,u){let f,k,J;const ie=[];for(let oe=0;oe<E.length&&!((u-=2)<0);++oe)f=E.charCodeAt(oe),k=f>>8,J=f%256,ie.push(J),ie.push(k);return ie}function le(E){return e.toByteArray(ue(E))}function he(E,u,f,k){let J;for(J=0;J<k&&!(J+f>=u.length||J>=E.length);++J)u[J+f]=E[J];return J}function se(E,u){return E instanceof u||E!=null&&E.constructor!=null&&E.constructor.name!=null&&E.constructor.name===u.name}function Ee(E){return E!==E}const qe=function(){const E="0123456789abcdef",u=new Array(256);for(let f=0;f<16;++f){const k=f*16;for(let J=0;J<16;++J)u[k+J]=E[f]+E[J]}return u}();function _e(E){return typeof BigInt>"u"?He:E}function He(){throw new Error("BigInt not supported")}}(Vn)),Vn}var Rc=bt();const gr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",yr="http://www.w3.org/2001/XMLSchema#",en="http://www.w3.org/2000/10/swap/",Pe={xsd:{decimal:`${yr}decimal`,boolean:`${yr}boolean`,double:`${yr}double`,integer:`${yr}integer`,string:`${yr}string`},rdf:{type:`${gr}type`,nil:`${gr}nil`,first:`${gr}first`,rest:`${gr}rest`,langString:`${gr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${en}reify#forSome`,forAll:`${en}reify#forAll`},log:{implies:`${en}log#implies`,isImpliedBy:`${en}log#isImpliedBy`}},{xsd:tn}=Pe,Nc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Aa={"\\":"\\","'":"'",'"':'"',n:`
7
- `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Tc=/[\x00-\x20<>\\"\{\}\|\^\`]/,Ac={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Lc=/$0^/;class jc{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 Ac)&&this[t]instanceof RegExp&&(this[t]=Lc)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let r=this._input,i=r.length;for(;;){let o,l;for(;o=this._newline.exec(r);)this.comments&&(l=this._comment.exec(o[0]))&&s("comment",l[1],"",this._line,o[0].length),r=r.substr(o[0].length,r.length),i=r.length,this._line++;if(!o&&(o=this._whitespace.exec(r))&&(r=r.substr(o[0].length,r.length)),this._endOfFile.test(r))return t&&(this.comments&&(l=this._comment.exec(r))&&s("comment",l[1],"",this._line,r.length),r=null,s("eof","","",this._line,0)),this._input=r;const d=this._line,h=r[0];let y="",w="",g="",m=null,_=0,x=!1;switch(h){case"^":if(r.length<3)break;if(r[1]==="^"){if(this._previousMarker="^^",r=r.substr(2),r[0]!=="<"){x=!0;break}}else{this._n3Mode&&(_=1,y="^");break}case"<":if(m=this._unescapedIri.exec(r))y="IRI",w=m[1];else if(m=this._iri.exec(r)){if(w=this._unescape(m[1]),w===null||Tc.test(w))return a(this);y="IRI"}else r.length>1&&r[1]==="<"?(y="<<",_=2):this._n3Mode&&r.length>1&&r[1]==="="&&(_=2,this._isImpliedBy?(y="abbreviation",w="<"):(y="inverse",w=">"));break;case">":r.length>1&&r[1]===">"&&(y=">>",_=2);break;case"_":((m=this._blank.exec(r))||t&&(m=this._blank.exec(`${r} `)))&&(y="blank",g="_",w=m[1]);break;case'"':if(m=this._simpleQuotedString.exec(r))w=m[1];else if({value:w,matchLength:_}=this._parseLiteral(r),w===null)return a(this);(m!==null||_!==0)&&(y="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(m=this._simpleApostropheString.exec(r))w=m[1];else if({value:w,matchLength:_}=this._parseLiteral(r),w===null)return a(this);(m!==null||_!==0)&&(y="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(m=this._variable.exec(r))&&(y="var",w=m[0]);break;case"@":this._previousMarker==="literal"&&(m=this._langcode.exec(r))?(y="langcode",w=m[1]):(m=this._keyword.exec(r))&&(y=m[0]);break;case".":if(r.length===1?t:r[1]<"0"||r[1]>"9"){y=".",_=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(m=this._number.exec(r)||t&&(m=this._number.exec(`${r} `)))&&(y="literal",w=m[0],g=typeof m[1]=="string"?tn.double:typeof m[2]=="string"?tn.decimal:tn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(m=this._sparqlKeyword.exec(r))?y=m[0].toUpperCase():x=!0;break;case"f":case"t":(m=this._boolean.exec(r))?(y="literal",w=m[0],g=tn.boolean):x=!0;break;case"a":(m=this._shortPredicates.exec(r))?(y="abbreviation",w="a"):x=!0;break;case"=":this._n3Mode&&r.length>1&&(y="abbreviation",r[1]!==">"?(_=1,w="="):(_=2,w=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(_=1,y=h);break;case"{":!this._lineMode&&r.length>=2&&(r[1]==="|"?(y="{|",_=2):(y=h,_=1));break;case"|":r.length>=2&&r[1]==="}"&&(y="|}",_=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(m=this._prefix.exec(r))?(y="prefix",w=m[1]||""):((m=this._prefixed.exec(r))||t&&(m=this._prefixed.exec(`${r} `)))&&(y="prefixed",g=m[1]||"",w=this._unescape(m[2]))),this._previousMarker==="^^")switch(y){case"prefixed":y="type";break;case"IRI":y="typeIRI";break;default:y=""}if(!y)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?a(this):this._input=r;const S=_||m[0].length,I=s(y,w,g,d,S);this.previousToken=I,this._previousMarker=y,r=r.substr(S,r.length)}function s(o,l,d,h,y){const w=r?i-r.length:i,g=w+y,m={type:o,value:l,prefix:d,line:h,start:w,end:g};return e(null,m),m}function a(o){e(o._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(e){let t=!1;const r=e.replace(Nc,(i,s,a,o)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof a=="string"){let l=Number.parseInt(a,16);return l<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023))}return o in Aa?Aa[o]:(t=!0,"")});return t?null:r}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length;let i=Math.max(this._literalClosingPos,r);for(;(i=e.indexOf(t,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){const a=e.substring(r,i),o=a.split(/\r\n|\r|\n/).length-1,l=i+r;if(r===1&&o!==0||r===3&&this._lineMode)break;return this._line+=o,{value:this._unescape(a),matchLength:l}}i++}this._literalClosingPos=e.length-r+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const r=[];let i;if(this._tokenizeToEnd((s,a)=>s?i=s:r.push(a),!0),i)throw i;return r}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",r=>{this._input!==null&&r.length!==0&&(this._pendingBuffer&&(r=Rc.Buffer.concat([this._pendingBuffer,r]),this._pendingBuffer=null),r[r.length-1]&128?this._pendingBuffer=r:(typeof this._input>"u"?this._input=this._readStartingBom(typeof r=="string"?r:r.toString()):this._input+=r,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}}const{rdf:Oc,xsd:Mt}=Pe;let lr,$c=0;const xe={namedNode:fu,blankNode:hu,variable:gu,literal:pu,defaultGraph:Cc,quad:Is,triple:Is,fromTerm:Mr,fromQuad:yu};class at{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof at?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 Rn=class extends at{get termType(){return"NamedNode"}},Ze=class du extends at{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 Rn(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return r==="^"?e.substr(t+2):r!=="@"?Mt.string:Oc.langString}equals(e){return e instanceof du?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}}}},kc=class extends at{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Dc=class extends at{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Mc=class extends at{constructor(){return super(""),lr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};lr=new Mc;function Dr(n,e,t){if(e=e||xe,!n)return e.defaultGraph();switch(n[0]){case"?":return e.variable(n.substr(1));case"_":return e.blankNode(n.substr(2));case'"':if(e===xe)return new Ze(n);if(n[n.length-1]==='"')return e.literal(n.substr(1,n.length-2));const r=n.lastIndexOf('"',n.length-1);return e.literal(n.substr(1,r-1),n[r+1]==="@"?n.substr(r+2):e.namedNode(n.substr(r+3)));case"[":n=JSON.parse(n);break;default:if(!t||!Array.isArray(n))return e.namedNode(n)}return e.quad(Dr(n[0],e,!0),Dr(n[1],e,!0),Dr(n[2],e,!0),n[3]&&Dr(n[3],e,!0))}function er(n,e){if(typeof n=="string")return n;if(n instanceof at&&n.termType!=="Quad")return n.id;if(!n)return lr.id;switch(n.termType){case"NamedNode":return n.value;case"BlankNode":return`_:${n.value}`;case"Variable":return`?${n.value}`;case"DefaultGraph":return"";case"Literal":return`"${n.value}"${n.language?`@${n.language}`:n.datatype&&n.datatype.value!==Mt.string?`^^${n.datatype.value}`:""}`;case"Quad":const t=[er(n.subject,!0),er(n.predicate,!0),er(n.object,!0)];return n.graph&&n.graph.termType!=="DefaultGraph"&&t.push(er(n.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${n.termType}`)}}let Nn=class extends at{constructor(e,t,r,i){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=i||lr}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 fu(n){return new Rn(n)}function hu(n){return new kc(n||`n3-${$c++}`)}function pu(n,e){if(typeof e=="string")return new Ze(`"${n}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof n=="boolean"?t=Mt.boolean:typeof n=="number"&&(Number.isFinite(n)?t=Number.isInteger(n)?Mt.integer:Mt.double:(t=Mt.double,Number.isNaN(n)||(n=n>0?"INF":"-INF")))),t===""||t===Mt.string?new Ze(`"${n}"`):new Ze(`"${n}"^^${t}`)}function gu(n){return new Dc(n)}function Cc(){return lr}function Is(n,e,t,r){return new Nn(n,e,t,r)}function Mr(n){if(n instanceof at)return n;switch(n.termType){case"NamedNode":return fu(n.value);case"BlankNode":return hu(n.value);case"Variable":return gu(n.value);case"DefaultGraph":return lr;case"Literal":return pu(n.value,n.language||n.datatype);case"Quad":return yu(n);default:throw new Error(`Unexpected termType: ${n.termType}`)}}function yu(n){if(n instanceof Nn)return n;if(n.termType!=="Quad")throw new Error(`Unexpected termType: ${n.termType}`);return Is(Mr(n.subject),Mr(n.predicate),Mr(n.object),Mr(n.graph))}let La=0;class Rs{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&mu(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),i=/trig/.test(t),s=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),l=s||a;(this._supportsNamedGraphs=!(r||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||i||s||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),l&&(this._resolveRelativeIRI=d=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new jc({lineMode:l,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){La=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,r,i,s){const a=this._n3Mode;this._contextStack.push({type:e,subject:r,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 r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified)}_readInTopContext(e){switch(e.type){case"eof":return 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 r;switch(e.type){case"IRI":case"typeIRI":const i=this._resolveIRI(e.value);if(i===null)return this._error("Invalid IRI",e);r=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);r=this._factory.namedNode(s+e.value);break;case"blank":r=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._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,r=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,r=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),i=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=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;r=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(r===null&&(this._subject=r=this._factory.blankNode()),s===null?o.predicate===null?o.subject=r:o.object=r:this._emit(s,this.RDF_REST,r,this._graph),t!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph)}return 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 r=this._readEntity(e);if(r===void 0)return;t=this._factory.literal(this._literalValue,r),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 r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),r.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.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,r=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&&(r=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,r):this._emit(i,a,o,r)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return 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,r=t.length&&t[t.length-1];if(r&&r.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,r;const i=this._factory.blankNode();if((r=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=i):(t=this._object,this._object=i),this._emit(t,r,i,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let r,i;if((r=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=t):(i=this._object,this._object=t),this._emit(t,r,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,r,i){this._callback(null,this._factory.quad(e,t,r,i||this.DEFAULTGRAPH))}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=rn}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",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"/":r+=e.substring(a,i-1),a=i+1;break;case void 0:case"?":case"#":return r+e.substring(a,i)+e.substr(i+1);case".":if(o=e[++i+1],o===void 0||o==="/"||o==="?"||o==="#"){if(r+=e.substring(a,i-2),(a=r.lastIndexOf("/"))>=s&&(r=r.substr(0,a)),o!=="/")return`${r}/${e.substr(i+1)}`;a=i+1}}}o=e[++i]}return r+e.substring(a)}parse(e,t,r){let i,s,a;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(i=t.onQuad,s=t.onPrefix,a=t.onComment):(i=t,s=r),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${La++}_`,this._prefixCallback=s||rn,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const l=[];let d;if(this._callback=(h,y)=>{h?d=h:y&&l.push(y)},this._lexer.tokenize(e).every(h=>this._readCallback=this._readCallback(h)),d)throw d;return l}let o=(l,d)=>{l!==null?(this._callback(l),this._callback=rn):this._readCallback&&(this._readCallback=this._readCallback(d))};a&&(this._lexer.comments=!0,o=(l,d)=>{l!==null?(this._callback(l),this._callback=rn):this._readCallback&&(d.type==="comment"?a(d.value):this._readCallback=this._readCallback(d))}),this._callback=i,this._lexer.tokenize(e,o)}}function rn(){}function mu(n,e){n._factory=e,n.DEFAULTGRAPH=e.defaultGraph(),n.RDF_FIRST=e.namedNode(Pe.rdf.first),n.RDF_REST=e.namedNode(Pe.rdf.rest),n.RDF_NIL=e.namedNode(Pe.rdf.nil),n.N3_FORALL=e.namedNode(Pe.r.forAll),n.N3_FORSOME=e.namedNode(Pe.r.forSome),n.ABBREVIATIONS={a:e.namedNode(Pe.rdf.type),"=":e.namedNode(Pe.owl.sameAs),">":e.namedNode(Pe.log.implies),"<":e.namedNode(Pe.log.isImpliedBy)},n.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}mu(Rs.prototype,xe);function Ns(n){return!!n&&n.termType==="DefaultGraph"}function dn(n){return n.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const Pc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,qc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,ja="./",Bc="../",Gn="?",Oa="#";class Bs{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Pc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!Bs.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",dn(e)],r=[],i=[],s=/[^/?#]*([/?#])/y;let a,o=0,l=0,d=s.lastIndex=e.length;for(;!o&&!l&&(a=s.exec(this.base));)a[1]===Oa?l=s.lastIndex-1:(t.push(dn(a[0]),"(?:"),r.push(")?"),a[1]!==Gn?i.push(d=s.lastIndex):(o=d=s.lastIndex,l=this.base.indexOf(Oa,o),this._pathReplacements[o]=Gn));for(let h=0;h<i.length;h++)this._pathReplacements[i[h]]=Bc.repeat(i.length-h-1);return this._pathReplacements[i[i.length-1]]=ja,this._baseLength=l>0?l:this.base.length,t.push(dn(this.base.substring(d,this._baseLength)),o?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...r].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const r=t[0].length;if(r===this._baseLength&&r===e.length)return"";const i=this._pathReplacements[r];if(i){const s=e.substring(r);return i!==Gn&&!qc.test(s)?e:i===ja&&/^[^?#]/.test(s)?s:i+s}return e.substring(r-1)}}const mr=xe.defaultGraph(),{rdf:Fc,xsd:Qt}=Pe,$a=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ka=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Uc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class br extends at{equals(e){return e===this}}class Fs{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 r="";this._outputStream={write(i,s,a){r+=i,a&&a()},end:i=>{i&&i(null,r)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=mr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new Bs(t.baseIRI)))}get _inDefaultGraph(){return mr.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,r,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
6
+ */var Na;function bt(){return Na||(Na=1,function(r){const e=Sc(),t=Ec(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=o,r.SlowBuffer=I,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 E=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(E,u),E.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(E){if(E>i)throw new RangeError('The value "'+E+'" is invalid for option "size"');const u=new Uint8Array(E);return Object.setPrototypeOf(u,o.prototype),u}function o(E,u,f){if(typeof E=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(E)}return l(E,u,f)}o.poolSize=8192;function l(E,u,f){if(typeof E=="string")return w(E,u);if(ArrayBuffer.isView(E))return m(E);if(E==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E);if(se(E,ArrayBuffer)||E&&se(E.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(se(E,SharedArrayBuffer)||E&&se(E.buffer,SharedArrayBuffer)))return _(E,u,f);if(typeof E=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const k=E.valueOf&&E.valueOf();if(k!=null&&k!==E)return o.from(k,u,f);const J=x(E);if(J)return J;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof E[Symbol.toPrimitive]=="function")return o.from(E[Symbol.toPrimitive]("string"),u,f);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof E)}o.from=function(E,u,f){return l(E,u,f)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function d(E){if(typeof E!="number")throw new TypeError('"size" argument must be of type number');if(E<0)throw new RangeError('The value "'+E+'" is invalid for option "size"')}function h(E,u,f){return d(E),E<=0?a(E):u!==void 0?typeof f=="string"?a(E).fill(u,f):a(E).fill(u):a(E)}o.alloc=function(E,u,f){return h(E,u,f)};function y(E){return d(E),a(E<0?0:S(E)|0)}o.allocUnsafe=function(E){return y(E)},o.allocUnsafeSlow=function(E){return y(E)};function w(E,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);const f=b(E,u)|0;let k=a(f);const J=k.write(E,u);return J!==f&&(k=k.slice(0,J)),k}function g(E){const u=E.length<0?0:S(E.length)|0,f=a(u);for(let k=0;k<u;k+=1)f[k]=E[k]&255;return f}function m(E){if(se(E,Uint8Array)){const u=new Uint8Array(E);return _(u.buffer,u.byteOffset,u.byteLength)}return g(E)}function _(E,u,f){if(u<0||E.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(E.byteLength<u+(f||0))throw new RangeError('"length" is outside of buffer bounds');let k;return u===void 0&&f===void 0?k=new Uint8Array(E):f===void 0?k=new Uint8Array(E,u):k=new Uint8Array(E,u,f),Object.setPrototypeOf(k,o.prototype),k}function x(E){if(o.isBuffer(E)){const u=S(E.length)|0,f=a(u);return f.length===0||E.copy(f,0,0,u),f}if(E.length!==void 0)return typeof E.length!="number"||Ee(E.length)?a(0):g(E);if(E.type==="Buffer"&&Array.isArray(E.data))return g(E.data)}function S(E){if(E>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return E|0}function I(E){return+E!=E&&(E=0),o.alloc(+E)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,f){if(se(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),se(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),!o.isBuffer(u)||!o.isBuffer(f))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===f)return 0;let k=u.length,J=f.length;for(let ie=0,oe=Math.min(k,J);ie<oe;++ie)if(u[ie]!==f[ie]){k=u[ie],J=f[ie];break}return k<J?-1:J<k?1:0},o.isEncoding=function(u){switch(String(u).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(u,f){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);let k;if(f===void 0)for(f=0,k=0;k<u.length;++k)f+=u[k].length;const J=o.allocUnsafe(f);let ie=0;for(k=0;k<u.length;++k){let oe=u[k];if(se(oe,Uint8Array))ie+oe.length>J.length?(o.isBuffer(oe)||(oe=o.from(oe)),oe.copy(J,ie)):Uint8Array.prototype.set.call(J,oe,ie);else if(o.isBuffer(oe))oe.copy(J,ie);else throw new TypeError('"list" argument must be an Array of Buffers');ie+=oe.length}return J};function b(E,u){if(o.isBuffer(E))return E.length;if(ArrayBuffer.isView(E)||se(E,ArrayBuffer))return E.byteLength;if(typeof E!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof E);const f=E.length,k=arguments.length>2&&arguments[2]===!0;if(!k&&f===0)return 0;let J=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return f;case"utf8":case"utf-8":return de(E).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f*2;case"hex":return f>>>1;case"base64":return le(E).length;default:if(J)return k?-1:de(E).length;u=(""+u).toLowerCase(),J=!0}}o.byteLength=b;function c(E,u,f){let k=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((f===void 0||f>this.length)&&(f=this.length),f<=0)||(f>>>=0,u>>>=0,f<=u))return"";for(E||(E="utf8");;)switch(E){case"hex":return K(this,u,f);case"utf8":case"utf-8":return j(this,u,f);case"ascii":return ee(this,u,f);case"latin1":case"binary":return C(this,u,f);case"base64":return A(this,u,f);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,u,f);default:if(k)throw new TypeError("Unknown encoding: "+E);E=(E+"").toLowerCase(),k=!0}}o.prototype._isBuffer=!0;function p(E,u,f){const k=E[u];E[u]=E[f],E[f]=k}o.prototype.swap16=function(){const u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let f=0;f<u;f+=2)p(this,f,f+1);return this},o.prototype.swap32=function(){const u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let f=0;f<u;f+=4)p(this,f,f+3),p(this,f+1,f+2);return this},o.prototype.swap64=function(){const u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let f=0;f<u;f+=8)p(this,f,f+7),p(this,f+1,f+6),p(this,f+2,f+5),p(this,f+3,f+4);return this},o.prototype.toString=function(){const u=this.length;return u===0?"":arguments.length===0?j(this,0,u):c.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){let u="";const f=r.INSPECT_MAX_BYTES;return u=this.toString("hex",0,f).replace(/(.{2})/g,"$1 ").trim(),this.length>f&&(u+=" ... "),"<Buffer "+u+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(u,f,k,J,ie){if(se(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(f===void 0&&(f=0),k===void 0&&(k=u?u.length:0),J===void 0&&(J=0),ie===void 0&&(ie=this.length),f<0||k>u.length||J<0||ie>this.length)throw new RangeError("out of range index");if(J>=ie&&f>=k)return 0;if(J>=ie)return-1;if(f>=k)return 1;if(f>>>=0,k>>>=0,J>>>=0,ie>>>=0,this===u)return 0;let oe=ie-J,we=k-f;const Le=Math.min(oe,we),Te=this.slice(J,ie),je=u.slice(f,k);for(let Ie=0;Ie<Le;++Ie)if(Te[Ie]!==je[Ie]){oe=Te[Ie],we=je[Ie];break}return oe<we?-1:we<oe?1:0};function N(E,u,f,k,J){if(E.length===0)return-1;if(typeof f=="string"?(k=f,f=0):f>2147483647?f=2147483647:f<-2147483648&&(f=-2147483648),f=+f,Ee(f)&&(f=J?0:E.length-1),f<0&&(f=E.length+f),f>=E.length){if(J)return-1;f=E.length-1}else if(f<0)if(J)f=0;else return-1;if(typeof u=="string"&&(u=o.from(u,k)),o.isBuffer(u))return u.length===0?-1:D(E,u,f,k,J);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(E,u,f):Uint8Array.prototype.lastIndexOf.call(E,u,f):D(E,[u],f,k,J);throw new TypeError("val must be string, number or Buffer")}function D(E,u,f,k,J){let ie=1,oe=E.length,we=u.length;if(k!==void 0&&(k=String(k).toLowerCase(),k==="ucs2"||k==="ucs-2"||k==="utf16le"||k==="utf-16le")){if(E.length<2||u.length<2)return-1;ie=2,oe/=2,we/=2,f/=2}function Le(je,Ie){return ie===1?je[Ie]:je.readUInt16BE(Ie*ie)}let Te;if(J){let je=-1;for(Te=f;Te<oe;Te++)if(Le(E,Te)===Le(u,je===-1?0:Te-je)){if(je===-1&&(je=Te),Te-je+1===we)return je*ie}else je!==-1&&(Te-=Te-je),je=-1}else for(f+we>oe&&(f=oe-we),Te=f;Te>=0;Te--){let je=!0;for(let Ie=0;Ie<we;Ie++)if(Le(E,Te+Ie)!==Le(u,Ie)){je=!1;break}if(je)return Te}return-1}o.prototype.includes=function(u,f,k){return this.indexOf(u,f,k)!==-1},o.prototype.indexOf=function(u,f,k){return N(this,u,f,k,!0)},o.prototype.lastIndexOf=function(u,f,k){return N(this,u,f,k,!1)};function T(E,u,f,k){f=Number(f)||0;const J=E.length-f;k?(k=Number(k),k>J&&(k=J)):k=J;const ie=u.length;k>ie/2&&(k=ie/2);let oe;for(oe=0;oe<k;++oe){const we=parseInt(u.substr(oe*2,2),16);if(Ee(we))return oe;E[f+oe]=we}return oe}function q(E,u,f,k){return he(de(u,E.length-f),E,f,k)}function R(E,u,f,k){return he(pe(u),E,f,k)}function M(E,u,f,k){return he(le(u),E,f,k)}function B(E,u,f,k){return he(X(u,E.length-f),E,f,k)}o.prototype.write=function(u,f,k,J){if(f===void 0)J="utf8",k=this.length,f=0;else if(k===void 0&&typeof f=="string")J=f,k=this.length,f=0;else if(isFinite(f))f=f>>>0,isFinite(k)?(k=k>>>0,J===void 0&&(J="utf8")):(J=k,k=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ie=this.length-f;if((k===void 0||k>ie)&&(k=ie),u.length>0&&(k<0||f<0)||f>this.length)throw new RangeError("Attempt to write outside buffer bounds");J||(J="utf8");let oe=!1;for(;;)switch(J){case"hex":return T(this,u,f,k);case"utf8":case"utf-8":return q(this,u,f,k);case"ascii":case"latin1":case"binary":return R(this,u,f,k);case"base64":return M(this,u,f,k);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,u,f,k);default:if(oe)throw new TypeError("Unknown encoding: "+J);J=(""+J).toLowerCase(),oe=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(E,u,f){return u===0&&f===E.length?e.fromByteArray(E):e.fromByteArray(E.slice(u,f))}function j(E,u,f){f=Math.min(E.length,f);const k=[];let J=u;for(;J<f;){const ie=E[J];let oe=null,we=ie>239?4:ie>223?3:ie>191?2:1;if(J+we<=f){let Le,Te,je,Ie;switch(we){case 1:ie<128&&(oe=ie);break;case 2:Le=E[J+1],(Le&192)===128&&(Ie=(ie&31)<<6|Le&63,Ie>127&&(oe=Ie));break;case 3:Le=E[J+1],Te=E[J+2],(Le&192)===128&&(Te&192)===128&&(Ie=(ie&15)<<12|(Le&63)<<6|Te&63,Ie>2047&&(Ie<55296||Ie>57343)&&(oe=Ie));break;case 4:Le=E[J+1],Te=E[J+2],je=E[J+3],(Le&192)===128&&(Te&192)===128&&(je&192)===128&&(Ie=(ie&15)<<18|(Le&63)<<12|(Te&63)<<6|je&63,Ie>65535&&Ie<1114112&&(oe=Ie))}}oe===null?(oe=65533,we=1):oe>65535&&(oe-=65536,k.push(oe>>>10&1023|55296),oe=56320|oe&1023),k.push(oe),J+=we}return L(k)}const Y=4096;function L(E){const u=E.length;if(u<=Y)return String.fromCharCode.apply(String,E);let f="",k=0;for(;k<u;)f+=String.fromCharCode.apply(String,E.slice(k,k+=Y));return f}function ee(E,u,f){let k="";f=Math.min(E.length,f);for(let J=u;J<f;++J)k+=String.fromCharCode(E[J]&127);return k}function C(E,u,f){let k="";f=Math.min(E.length,f);for(let J=u;J<f;++J)k+=String.fromCharCode(E[J]);return k}function K(E,u,f){const k=E.length;(!u||u<0)&&(u=0),(!f||f<0||f>k)&&(f=k);let J="";for(let ie=u;ie<f;++ie)J+=qe[E[ie]];return J}function v(E,u,f){const k=E.slice(u,f);let J="";for(let ie=0;ie<k.length-1;ie+=2)J+=String.fromCharCode(k[ie]+k[ie+1]*256);return J}o.prototype.slice=function(u,f){const k=this.length;u=~~u,f=f===void 0?k:~~f,u<0?(u+=k,u<0&&(u=0)):u>k&&(u=k),f<0?(f+=k,f<0&&(f=0)):f>k&&(f=k),f<u&&(f=u);const J=this.subarray(u,f);return Object.setPrototypeOf(J,o.prototype),J};function U(E,u,f){if(E%1!==0||E<0)throw new RangeError("offset is not uint");if(E+u>f)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u],ie=1,oe=0;for(;++oe<f&&(ie*=256);)J+=this[u+oe]*ie;return J},o.prototype.readUintBE=o.prototype.readUIntBE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u+--f],ie=1;for(;f>0&&(ie*=256);)J+=this[u+--f]*ie;return J},o.prototype.readUint8=o.prototype.readUInt8=function(u,f){return u=u>>>0,f||U(u,1,this.length),this[u]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(u,f){return u=u>>>0,f||U(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(u,f){return u=u>>>0,f||U(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(u,f){return u=u>>>0,f||U(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readBigUInt64LE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,ie=this[++u]+this[++u]*2**8+this[++u]*2**16+k*2**24;return BigInt(J)+(BigInt(ie)<<BigInt(32))}),o.prototype.readBigUInt64BE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=f*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],ie=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+k;return(BigInt(J)<<BigInt(32))+BigInt(ie)}),o.prototype.readIntLE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=this[u],ie=1,oe=0;for(;++oe<f&&(ie*=256);)J+=this[u+oe]*ie;return ie*=128,J>=ie&&(J-=Math.pow(2,8*f)),J},o.prototype.readIntBE=function(u,f,k){u=u>>>0,f=f>>>0,k||U(u,f,this.length);let J=f,ie=1,oe=this[u+--J];for(;J>0&&(ie*=256);)oe+=this[u+--J]*ie;return ie*=128,oe>=ie&&(oe-=Math.pow(2,8*f)),oe},o.prototype.readInt8=function(u,f){return u=u>>>0,f||U(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,f){u=u>>>0,f||U(u,2,this.length);const k=this[u]|this[u+1]<<8;return k&32768?k|4294901760:k},o.prototype.readInt16BE=function(u,f){u=u>>>0,f||U(u,2,this.length);const k=this[u+1]|this[u]<<8;return k&32768?k|4294901760:k},o.prototype.readInt32LE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,f){return u=u>>>0,f||U(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readBigInt64LE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(k<<24);return(BigInt(J)<<BigInt(32))+BigInt(f+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),o.prototype.readBigInt64BE=_e(function(u){u=u>>>0,O(u,"offset");const f=this[u],k=this[u+7];(f===void 0||k===void 0)&&G(u,this.length-8);const J=(f<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(J)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+k)}),o.prototype.readFloatLE=function(u,f){return u=u>>>0,f||U(u,4,this.length),t.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,f){return u=u>>>0,f||U(u,4,this.length),t.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,f){return u=u>>>0,f||U(u,8,this.length),t.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,f){return u=u>>>0,f||U(u,8,this.length),t.read(this,u,!1,52,8)};function Q(E,u,f,k,J,ie){if(!o.isBuffer(E))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>J||u<ie)throw new RangeError('"value" argument is out of bounds');if(f+k>E.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(u,f,k,J){if(u=+u,f=f>>>0,k=k>>>0,!J){const we=Math.pow(2,8*k)-1;Q(this,u,f,k,we,0)}let ie=1,oe=0;for(this[f]=u&255;++oe<k&&(ie*=256);)this[f+oe]=u/ie&255;return f+k},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(u,f,k,J){if(u=+u,f=f>>>0,k=k>>>0,!J){const we=Math.pow(2,8*k)-1;Q(this,u,f,k,we,0)}let ie=k-1,oe=1;for(this[f+ie]=u&255;--ie>=0&&(oe*=256);)this[f+ie]=u/oe&255;return f+k},o.prototype.writeUint8=o.prototype.writeUInt8=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,1,255,0),this[f]=u&255,f+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,65535,0),this[f]=u&255,this[f+1]=u>>>8,f+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,65535,0),this[f]=u>>>8,this[f+1]=u&255,f+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,4294967295,0),this[f+3]=u>>>24,this[f+2]=u>>>16,this[f+1]=u>>>8,this[f]=u&255,f+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,4294967295,0),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4};function z(E,u,f,k,J){fe(u,k,J,E,f,7);let ie=Number(u&BigInt(4294967295));E[f++]=ie,ie=ie>>8,E[f++]=ie,ie=ie>>8,E[f++]=ie,ie=ie>>8,E[f++]=ie;let oe=Number(u>>BigInt(32)&BigInt(4294967295));return E[f++]=oe,oe=oe>>8,E[f++]=oe,oe=oe>>8,E[f++]=oe,oe=oe>>8,E[f++]=oe,f}function ae(E,u,f,k,J){fe(u,k,J,E,f,7);let ie=Number(u&BigInt(4294967295));E[f+7]=ie,ie=ie>>8,E[f+6]=ie,ie=ie>>8,E[f+5]=ie,ie=ie>>8,E[f+4]=ie;let oe=Number(u>>BigInt(32)&BigInt(4294967295));return E[f+3]=oe,oe=oe>>8,E[f+2]=oe,oe=oe>>8,E[f+1]=oe,oe=oe>>8,E[f]=oe,f+8}o.prototype.writeBigUInt64LE=_e(function(u,f=0){return z(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=_e(function(u,f=0){return ae(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(u,f,k,J){if(u=+u,f=f>>>0,!J){const Le=Math.pow(2,8*k-1);Q(this,u,f,k,Le-1,-Le)}let ie=0,oe=1,we=0;for(this[f]=u&255;++ie<k&&(oe*=256);)u<0&&we===0&&this[f+ie-1]!==0&&(we=1),this[f+ie]=(u/oe>>0)-we&255;return f+k},o.prototype.writeIntBE=function(u,f,k,J){if(u=+u,f=f>>>0,!J){const Le=Math.pow(2,8*k-1);Q(this,u,f,k,Le-1,-Le)}let ie=k-1,oe=1,we=0;for(this[f+ie]=u&255;--ie>=0&&(oe*=256);)u<0&&we===0&&this[f+ie+1]!==0&&(we=1),this[f+ie]=(u/oe>>0)-we&255;return f+k},o.prototype.writeInt8=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,1,127,-128),u<0&&(u=255+u+1),this[f]=u&255,f+1},o.prototype.writeInt16LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,32767,-32768),this[f]=u&255,this[f+1]=u>>>8,f+2},o.prototype.writeInt16BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,2,32767,-32768),this[f]=u>>>8,this[f+1]=u&255,f+2},o.prototype.writeInt32LE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,2147483647,-2147483648),this[f]=u&255,this[f+1]=u>>>8,this[f+2]=u>>>16,this[f+3]=u>>>24,f+4},o.prototype.writeInt32BE=function(u,f,k){return u=+u,f=f>>>0,k||Q(this,u,f,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[f]=u>>>24,this[f+1]=u>>>16,this[f+2]=u>>>8,this[f+3]=u&255,f+4},o.prototype.writeBigInt64LE=_e(function(u,f=0){return z(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=_e(function(u,f=0){return ae(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function H(E,u,f,k,J,ie){if(f+k>E.length)throw new RangeError("Index out of range");if(f<0)throw new RangeError("Index out of range")}function V(E,u,f,k,J){return u=+u,f=f>>>0,J||H(E,u,f,4),t.write(E,u,f,k,23,4),f+4}o.prototype.writeFloatLE=function(u,f,k){return V(this,u,f,!0,k)},o.prototype.writeFloatBE=function(u,f,k){return V(this,u,f,!1,k)};function W(E,u,f,k,J){return u=+u,f=f>>>0,J||H(E,u,f,8),t.write(E,u,f,k,52,8),f+8}o.prototype.writeDoubleLE=function(u,f,k){return W(this,u,f,!0,k)},o.prototype.writeDoubleBE=function(u,f,k){return W(this,u,f,!1,k)},o.prototype.copy=function(u,f,k,J){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(k||(k=0),!J&&J!==0&&(J=this.length),f>=u.length&&(f=u.length),f||(f=0),J>0&&J<k&&(J=k),J===k||u.length===0||this.length===0)return 0;if(f<0)throw new RangeError("targetStart out of bounds");if(k<0||k>=this.length)throw new RangeError("Index out of range");if(J<0)throw new RangeError("sourceEnd out of bounds");J>this.length&&(J=this.length),u.length-f<J-k&&(J=u.length-f+k);const ie=J-k;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(f,k,J):Uint8Array.prototype.set.call(u,this.subarray(k,J),f),ie},o.prototype.fill=function(u,f,k,J){if(typeof u=="string"){if(typeof f=="string"?(J=f,f=0,k=this.length):typeof k=="string"&&(J=k,k=this.length),J!==void 0&&typeof J!="string")throw new TypeError("encoding must be a string");if(typeof J=="string"&&!o.isEncoding(J))throw new TypeError("Unknown encoding: "+J);if(u.length===1){const oe=u.charCodeAt(0);(J==="utf8"&&oe<128||J==="latin1")&&(u=oe)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(f<0||this.length<f||this.length<k)throw new RangeError("Out of range index");if(k<=f)return this;f=f>>>0,k=k===void 0?this.length:k>>>0,u||(u=0);let ie;if(typeof u=="number")for(ie=f;ie<k;++ie)this[ie]=u;else{const oe=o.isBuffer(u)?u:o.from(u,J),we=oe.length;if(we===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(ie=0;ie<k-f;++ie)this[ie+f]=oe[ie%we]}return this};const F={};function Z(E,u,f){F[E]=class extends f{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${E}]`,this.stack,delete this.name}get code(){return E}set code(J){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:J,writable:!0})}toString(){return`${this.name} [${E}]: ${this.message}`}}}Z("ERR_BUFFER_OUT_OF_BOUNDS",function(E){return E?`${E} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Z("ERR_INVALID_ARG_TYPE",function(E,u){return`The "${E}" argument must be of type number. Received type ${typeof u}`},TypeError),Z("ERR_OUT_OF_RANGE",function(E,u,f){let k=`The value of "${E}" is out of range.`,J=f;return Number.isInteger(f)&&Math.abs(f)>2**32?J=te(String(f)):typeof f=="bigint"&&(J=String(f),(f>BigInt(2)**BigInt(32)||f<-(BigInt(2)**BigInt(32)))&&(J=te(J)),J+="n"),k+=` It must be ${u}. Received ${J}`,k},RangeError);function te(E){let u="",f=E.length;const k=E[0]==="-"?1:0;for(;f>=k+4;f-=3)u=`_${E.slice(f-3,f)}${u}`;return`${E.slice(0,f)}${u}`}function ce(E,u,f){O(u,"offset"),(E[u]===void 0||E[u+f]===void 0)&&G(u,E.length-(f+1))}function fe(E,u,f,k,J,ie){if(E>f||E<u){const oe=typeof u=="bigint"?"n":"";let we;throw u===0||u===BigInt(0)?we=`>= 0${oe} and < 2${oe} ** ${(ie+1)*8}${oe}`:we=`>= -(2${oe} ** ${(ie+1)*8-1}${oe}) and < 2 ** ${(ie+1)*8-1}${oe}`,new F.ERR_OUT_OF_RANGE("value",we,E)}ce(k,J,ie)}function O(E,u){if(typeof E!="number")throw new F.ERR_INVALID_ARG_TYPE(u,"number",E)}function G(E,u,f){throw Math.floor(E)!==E?(O(E,f),new F.ERR_OUT_OF_RANGE("offset","an integer",E)):u<0?new F.ERR_BUFFER_OUT_OF_BOUNDS:new F.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,E)}const re=/[^+/0-9A-Za-z-_]/g;function ue(E){if(E=E.split("=")[0],E=E.trim().replace(re,""),E.length<2)return"";for(;E.length%4!==0;)E=E+"=";return E}function de(E,u){u=u||1/0;let f;const k=E.length;let J=null;const ie=[];for(let oe=0;oe<k;++oe){if(f=E.charCodeAt(oe),f>55295&&f<57344){if(!J){if(f>56319){(u-=3)>-1&&ie.push(239,191,189);continue}else if(oe+1===k){(u-=3)>-1&&ie.push(239,191,189);continue}J=f;continue}if(f<56320){(u-=3)>-1&&ie.push(239,191,189),J=f;continue}f=(J-55296<<10|f-56320)+65536}else J&&(u-=3)>-1&&ie.push(239,191,189);if(J=null,f<128){if((u-=1)<0)break;ie.push(f)}else if(f<2048){if((u-=2)<0)break;ie.push(f>>6|192,f&63|128)}else if(f<65536){if((u-=3)<0)break;ie.push(f>>12|224,f>>6&63|128,f&63|128)}else if(f<1114112){if((u-=4)<0)break;ie.push(f>>18|240,f>>12&63|128,f>>6&63|128,f&63|128)}else throw new Error("Invalid code point")}return ie}function pe(E){const u=[];for(let f=0;f<E.length;++f)u.push(E.charCodeAt(f)&255);return u}function X(E,u){let f,k,J;const ie=[];for(let oe=0;oe<E.length&&!((u-=2)<0);++oe)f=E.charCodeAt(oe),k=f>>8,J=f%256,ie.push(J),ie.push(k);return ie}function le(E){return e.toByteArray(ue(E))}function he(E,u,f,k){let J;for(J=0;J<k&&!(J+f>=u.length||J>=E.length);++J)u[J+f]=E[J];return J}function se(E,u){return E instanceof u||E!=null&&E.constructor!=null&&E.constructor.name!=null&&E.constructor.name===u.name}function Ee(E){return E!==E}const qe=function(){const E="0123456789abcdef",u=new Array(256);for(let f=0;f<16;++f){const k=f*16;for(let J=0;J<16;++J)u[k+J]=E[f]+E[J]}return u}();function _e(E){return typeof BigInt>"u"?He:E}function He(){throw new Error("BigInt not supported")}}(Vn)),Vn}var Ic=bt();const gr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",yr="http://www.w3.org/2001/XMLSchema#",en="http://www.w3.org/2000/10/swap/",Pe={xsd:{decimal:`${yr}decimal`,boolean:`${yr}boolean`,double:`${yr}double`,integer:`${yr}integer`,string:`${yr}string`},rdf:{type:`${gr}type`,nil:`${gr}nil`,first:`${gr}first`,rest:`${gr}rest`,langString:`${gr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${en}reify#forSome`,forAll:`${en}reify#forAll`},log:{implies:`${en}log#implies`,isImpliedBy:`${en}log#isImpliedBy`}},{xsd:tn}=Pe,Rc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ta={"\\":"\\","'":"'",'"':'"',n:`
7
+ `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Nc=/[\x00-\x20<>\\"\{\}\|\^\`]/,Tc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Ac=/$0^/;class Lc{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 Tc)&&this[t]instanceof RegExp&&(this[t]=Ac)}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,l;for(;o=this._newline.exec(n);)this.comments&&(l=this._comment.exec(o[0]))&&s("comment",l[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&&(l=this._comment.exec(n))&&s("comment",l[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;const d=this._line,h=n[0];let y="",w="",g="",m=null,_=0,x=!1;switch(h){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){x=!0;break}}else{this._n3Mode&&(_=1,y="^");break}case"<":if(m=this._unescapedIri.exec(n))y="IRI",w=m[1];else if(m=this._iri.exec(n)){if(w=this._unescape(m[1]),w===null||Nc.test(w))return a(this);y="IRI"}else n.length>1&&n[1]==="<"?(y="<<",_=2):this._n3Mode&&n.length>1&&n[1]==="="&&(_=2,this._isImpliedBy?(y="abbreviation",w="<"):(y="inverse",w=">"));break;case">":n.length>1&&n[1]===">"&&(y=">>",_=2);break;case"_":((m=this._blank.exec(n))||t&&(m=this._blank.exec(`${n} `)))&&(y="blank",g="_",w=m[1]);break;case'"':if(m=this._simpleQuotedString.exec(n))w=m[1];else if({value:w,matchLength:_}=this._parseLiteral(n),w===null)return a(this);(m!==null||_!==0)&&(y="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(m=this._simpleApostropheString.exec(n))w=m[1];else if({value:w,matchLength:_}=this._parseLiteral(n),w===null)return a(this);(m!==null||_!==0)&&(y="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(m=this._variable.exec(n))&&(y="var",w=m[0]);break;case"@":this._previousMarker==="literal"&&(m=this._langcode.exec(n))?(y="langcode",w=m[1]):(m=this._keyword.exec(n))&&(y=m[0]);break;case".":if(n.length===1?t:n[1]<"0"||n[1]>"9"){y=".",_=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(m=this._number.exec(n)||t&&(m=this._number.exec(`${n} `)))&&(y="literal",w=m[0],g=typeof m[1]=="string"?tn.double:typeof m[2]=="string"?tn.decimal:tn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(m=this._sparqlKeyword.exec(n))?y=m[0].toUpperCase():x=!0;break;case"f":case"t":(m=this._boolean.exec(n))?(y="literal",w=m[0],g=tn.boolean):x=!0;break;case"a":(m=this._shortPredicates.exec(n))?(y="abbreviation",w="a"):x=!0;break;case"=":this._n3Mode&&n.length>1&&(y="abbreviation",n[1]!==">"?(_=1,w="="):(_=2,w=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(_=1,y=h);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(y="{|",_=2):(y=h,_=1));break;case"|":n.length>=2&&n[1]==="}"&&(y="|}",_=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(m=this._prefix.exec(n))?(y="prefix",w=m[1]||""):((m=this._prefixed.exec(n))||t&&(m=this._prefixed.exec(`${n} `)))&&(y="prefixed",g=m[1]||"",w=this._unescape(m[2]))),this._previousMarker==="^^")switch(y){case"prefixed":y="type";break;case"IRI":y="typeIRI";break;default:y=""}if(!y)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;const S=_||m[0].length,I=s(y,w,g,d,S);this.previousToken=I,this._previousMarker=y,n=n.substr(S,n.length)}function s(o,l,d,h,y){const w=n?i-n.length:i,g=w+y,m={type:o,value:l,prefix:d,line:h,start:w,end:g};return e(null,m),m}function a(o){e(o._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(Rc,(i,s,a,o)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof a=="string"){let l=Number.parseInt(a,16);return l<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023))}return o in Ta?Ta[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,l=i+n;if(n===1&&o!==0||n===3&&this._lineMode)break;return this._line+=o,{value:this._unescape(a),matchLength:l}}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=Ic.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:jc,xsd:Mt}=Pe;let lr,Oc=0;const xe={namedNode:du,blankNode:fu,variable:pu,literal:hu,defaultGraph:Mc,quad:Is,triple:Is,fromTerm:Mr,fromQuad:gu};class at{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof at?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 Rn=class extends at{get termType(){return"NamedNode"}},Ze=class cu extends at{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 Rn(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!=="@"?Mt.string:jc.langString}equals(e){return e instanceof cu?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}}}},$c=class extends at{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},kc=class extends at{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Dc=class extends at{constructor(){return super(""),lr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};lr=new Dc;function Dr(r,e,t){if(e=e||xe,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===xe)return new Ze(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(Dr(r[0],e,!0),Dr(r[1],e,!0),Dr(r[2],e,!0),r[3]&&Dr(r[3],e,!0))}function er(r,e){if(typeof r=="string")return r;if(r instanceof at&&r.termType!=="Quad")return r.id;if(!r)return lr.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!==Mt.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[er(r.subject,!0),er(r.predicate,!0),er(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(er(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let Nn=class extends at{constructor(e,t,n,i){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=i||lr}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 du(r){return new Rn(r)}function fu(r){return new $c(r||`n3-${Oc++}`)}function hu(r,e){if(typeof e=="string")return new Ze(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=Mt.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?Mt.integer:Mt.double:(t=Mt.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===Mt.string?new Ze(`"${r}"`):new Ze(`"${r}"^^${t}`)}function pu(r){return new kc(r)}function Mc(){return lr}function Is(r,e,t,n){return new Nn(r,e,t,n)}function Mr(r){if(r instanceof at)return r;switch(r.termType){case"NamedNode":return du(r.value);case"BlankNode":return fu(r.value);case"Variable":return pu(r.value);case"DefaultGraph":return lr;case"Literal":return hu(r.value,r.language||r.datatype);case"Quad":return gu(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function gu(r){if(r instanceof Nn)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return Is(Mr(r.subject),Mr(r.predicate),Mr(r.object),Mr(r.graph))}let Aa=0;class Rs{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),l=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),l&&(this._resolveRelativeIRI=d=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Lc({lineMode:l,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Aa=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=rn}_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${Aa++}_`,this._prefixCallback=s||rn,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const l=[];let d;if(this._callback=(h,y)=>{h?d=h:y&&l.push(y)},this._lexer.tokenize(e).every(h=>this._readCallback=this._readCallback(h)),d)throw d;return l}let o=(l,d)=>{l!==null?(this._callback(l),this._callback=rn):this._readCallback&&(this._readCallback=this._readCallback(d))};a&&(this._lexer.comments=!0,o=(l,d)=>{l!==null?(this._callback(l),this._callback=rn):this._readCallback&&(d.type==="comment"?a(d.value):this._readCallback=this._readCallback(d))}),this._callback=i,this._lexer.tokenize(e,o)}}function rn(){}function yu(r,e){r._factory=e,r.DEFAULTGRAPH=e.defaultGraph(),r.RDF_FIRST=e.namedNode(Pe.rdf.first),r.RDF_REST=e.namedNode(Pe.rdf.rest),r.RDF_NIL=e.namedNode(Pe.rdf.nil),r.N3_FORALL=e.namedNode(Pe.r.forAll),r.N3_FORSOME=e.namedNode(Pe.r.forSome),r.ABBREVIATIONS={a:e.namedNode(Pe.rdf.type),"=":e.namedNode(Pe.owl.sameAs),">":e.namedNode(Pe.log.implies),"<":e.namedNode(Pe.log.isImpliedBy)},r.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}yu(Rs.prototype,xe);function Ns(r){return!!r&&r.termType==="DefaultGraph"}function dn(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const Cc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Pc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,La="./",qc="../",Gn="?",ja="#";class qs{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Cc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!qs.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",dn(e)],n=[],i=[],s=/[^/?#]*([/?#])/y;let a,o=0,l=0,d=s.lastIndex=e.length;for(;!o&&!l&&(a=s.exec(this.base));)a[1]===ja?l=s.lastIndex-1:(t.push(dn(a[0]),"(?:"),n.push(")?"),a[1]!==Gn?i.push(d=s.lastIndex):(o=d=s.lastIndex,l=this.base.indexOf(ja,o),this._pathReplacements[o]=Gn));for(let h=0;h<i.length;h++)this._pathReplacements[i[h]]=qc.repeat(i.length-h-1);return this._pathReplacements[i[i.length-1]]=La,this._baseLength=l>0?l:this.base.length,t.push(dn(this.base.substring(d,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!==Gn&&!Pc.test(s)?e:i===La&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const mr=xe.defaultGraph(),{rdf:Bc,xsd:Qt}=Pe,Oa=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,$a=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Fc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class br extends at{equals(e){return e===this}}class Bs{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=mr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new qs(t.baseIRI)))}get _inDefaultGraph(){return mr.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
  `)+(mr.equals(i)?"":`${this._encodeIriOrBlank(i)} {
11
- `)),this._graph=i,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(r)}`,s):this._write(`;
12
- ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,s):this._write(`${(this._subject===null?"":`.
13
- `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,s)}catch(a){s&&s(a)}}_writeQuadLine(e,t,r,i,s){delete this._prefixMatch,this._write(this.quadToString(e,t,r,i),s)}quadToString(e,t,r,i){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${i&&i.value?` ${this._encodeIriOrBlank(i)} .
11
+ `)),this._graph=i,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,s):this._write(`;
12
+ ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s):this._write(`${(this._subject===null?"":`.
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 r of e)t+=this.quadToString(r.subject,r.predicate,r.object,r.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)),$a.test(t)&&(t=t.replace(ka,Da));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if($a.test(t)&&(t=t.replace(ka,Da)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===Qt.string)return`"${t}"`}else switch(e.datatype.value){case Qt.string:return`"${t}"`;case Qt.boolean:if(t==="true"||t==="false")return t;break;case Qt.integer:if(/^[+-]?\d+$/.test(t))return t;break;case Qt.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case Qt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Fc.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:i}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${Ns(i)?"":` ${this._encodeIriOrBlank(i)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,i,s){r===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof i=="function"?this._writeQuad(e,t,r,mr,i):this._writeQuad(e,t,r,i||mr,s)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,r){const i={};i[e]=t,this.addPrefixes(i,r)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let r=!1;for(let i in e){let s=e[i];typeof s!="string"&&(s=s.value),r=!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)),Oa.test(t)&&(t=t.replace($a,ka));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(Oa.test(t)&&(t=t.replace($a,ka)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===Qt.string)return`"${t}"`}else switch(e.datatype.value){case Qt.string:return`"${t}"`;case Qt.boolean:if(t==="true"||t==="false")return t;break;case Qt.integer:if(/^[+-]?\d+$/.test(t))return t;break;case Qt.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case Qt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Bc.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)}${Ns(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,mr,i):this._writeQuad(e,t,n,i||mr,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}>.
19
- `)}if(r){let i="",s="";for(const a in this._prefixIRIs)i+=i?`|${a}`:a,s+=(s?"|":"")+this._prefixIRIs[a];i=dn(i),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${i})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(r?`
20
- `:"",t)}blank(e,t){let r=e,i,s;switch(e===void 0?r=[]:e.termType?r=[{predicate:e,object:t}]:"length"in e||(r=[e]),s=r.length){case 0:return new br("[]");case 1:if(i=r[0],!(i.object instanceof br))return new br(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let a="[";for(let o=0;o<s;o++)i=r[o],i.predicate.equals(e)?a+=`, ${this._encodeObject(i.object)}`:(a+=`${(o?`;
19
+ `)}if(n){let i="",s="";for(const a in this._prefixIRIs)i+=i?`|${a}`:a,s+=(s?"|":"")+this._prefixIRIs[a];i=dn(i),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${i})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(n?`
20
+ `:"",t)}blank(e,t){let n=e,i,s;switch(e===void 0?n=[]:e.termType?n=[{predicate:e,object:t}]:"length"in e||(n=[e]),s=n.length){case 0:return new br("[]");case 1:if(i=n[0],!(i.object instanceof br))return new br(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let a="[";for(let o=0;o<s;o++)i=n[o],i.predicate.equals(e)?a+=`, ${this._encodeObject(i.object)}`:(a+=`${(o?`;
21
21
  `:`
22
22
  `)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new br(`${a}
23
- ]`)}}list(e){const t=e&&e.length||0,r=new Array(t);for(let i=0;i<t;i++)r[i]=this._encodeObject(e[i]);return new br(`(${r.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
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 br(`(${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&&((r,i)=>{t=null,e(r,i)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function Da(n){let e=Uc[n];return e===void 0&&(n.length===1?(e=n.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((n.charCodeAt(0)-55296)*1024+n.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Wn={exports:{}},zn={exports:{}},Jn,Ma;function $e(){if(Ma)return Jn;Ma=1;class n extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let r="";for(let i=0;i<t.length;i++)r+=` ${t[i].stack}
27
- `;super(r),this.name="AggregateError",this.errors=t}}return Jn={AggregateError:n,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,r){return e.slice(t,r)},Error,FunctionPrototypeCall(e,t,...r){return e.call(t,...r)},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,r){return Object.defineProperty(e,t,r)},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,r){return e.then(t,r)},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,r){return e.slice(t,r)},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,r){return e.set(t,r)},Boolean,Uint8Array},Jn}var Qn={exports:{}},Xn,Ca;function bu(){return Ca||(Ca=1,Xn={format(n,...e){return n.replace(/%([sdifj])/g,function(...[t,r]){const i=e.shift();return r==="f"?i.toFixed(6):r==="j"?JSON.stringify(i):r==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(n){switch(typeof n){case"string":if(n.includes("'"))if(n.includes('"')){if(!n.includes("`")&&!n.includes("${"))return`\`${n}\``}else return`"${n}"`;return`'${n}'`;case"number":return isNaN(n)?"NaN":Object.is(n,-0)?String(n):n;case"bigint":return`${String(n)}n`;case"boolean":case"undefined":return String(n);case"object":return"{}"}}}),Xn}var Kn,Pa;function Ve(){if(Pa)return Kn;Pa=1;const{format:n,inspect:e}=bu(),{AggregateError:t}=$e(),r=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_",l={};function d(x,S){if(!x)throw new l.ERR_INTERNAL_ASSERTION(S)}function h(x){let S="",I=x.length;const b=x[0]==="-"?1:0;for(;I>=b+4;I-=3)S=`_${x.slice(I-3,I)}${S}`;return`${x.slice(0,I)}${S}`}function y(x,S,I){if(typeof S=="function")return d(S.length<=I.length,`Code: ${x}; The provided arguments length (${I.length}) does not match the required ones (${S.length}).`),S(...I);const b=(S.match(/%[dfijoOs]/g)||[]).length;return d(b===I.length,`Code: ${x}; The provided arguments length (${I.length}) does not match the required ones (${b}).`),I.length===0?S:n(S,...I)}function w(x,S,I){I||(I=Error);class b extends I{constructor(...p){super(y(x,S,p))}toString(){return`${this.name} [${x}]: ${this.message}`}}Object.defineProperties(b.prototype,{name:{value:I.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${x}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),b.prototype.code=x,b.prototype[i]=!0,l[x]=b}function g(x){const S=o+x.name;return Object.defineProperty(x,"name",{value:S}),x}function m(x,S){if(x&&S&&x!==S){if(Array.isArray(S.errors))return S.errors.push(x),S;const I=new r([S,x],S.message);return I.code=S.code,I}return x||S}class _ extends Error{constructor(S="The operation was aborted",I=void 0){if(I!==void 0&&typeof I!="object")throw new l.ERR_INVALID_ARG_TYPE("options","Object",I);super(S,I),this.code="ABORT_ERR",this.name="AbortError"}}return w("ERR_ASSERTION","%s",Error),w("ERR_INVALID_ARG_TYPE",(x,S,I)=>{d(typeof x=="string","'name' must be a string"),Array.isArray(S)||(S=[S]);let b="The ";x.endsWith(" argument")?b+=`${x} `:b+=`"${x}" ${x.includes(".")?"property":"argument"} `,b+="must be ";const c=[],p=[],N=[];for(const T of S)d(typeof T=="string","All expected entries have to be of type string"),s.includes(T)?c.push(T.toLowerCase()):a.test(T)?p.push(T):(d(T!=="object",'The value "object" should be written as "Object"'),N.push(T));if(p.length>0){const T=c.indexOf("object");T!==-1&&(c.splice(c,T,1),p.push("Object"))}if(c.length>0){switch(c.length){case 1:b+=`of type ${c[0]}`;break;case 2:b+=`one of type ${c[0]} or ${c[1]}`;break;default:{const T=c.pop();b+=`one of type ${c.join(", ")}, or ${T}`}}(p.length>0||N.length>0)&&(b+=" or ")}if(p.length>0){switch(p.length){case 1:b+=`an instance of ${p[0]}`;break;case 2:b+=`an instance of ${p[0]} or ${p[1]}`;break;default:{const T=p.pop();b+=`an instance of ${p.join(", ")}, or ${T}`}}N.length>0&&(b+=" or ")}switch(N.length){case 0:break;case 1:N[0].toLowerCase()!==N[0]&&(b+="an "),b+=`${N[0]}`;break;case 2:b+=`one of ${N[0]} or ${N[1]}`;break;default:{const T=N.pop();b+=`one of ${N.join(", ")}, or ${T}`}}if(I==null)b+=`. Received ${I}`;else if(typeof I=="function"&&I.name)b+=`. Received function ${I.name}`;else if(typeof I=="object"){var D;if((D=I.constructor)!==null&&D!==void 0&&D.name)b+=`. Received an instance of ${I.constructor.name}`;else{const T=e(I,{depth:-1});b+=`. Received ${T}`}}else{let T=e(I,{colors:!1});T.length>25&&(T=`${T.slice(0,25)}...`),b+=`. Received type ${typeof I} (${T})`}return b},TypeError),w("ERR_INVALID_ARG_VALUE",(x,S,I="is invalid")=>{let b=e(S);return b.length>128&&(b=b.slice(0,128)+"..."),`The ${x.includes(".")?"property":"argument"} '${x}' ${I}. Received ${b}`},TypeError),w("ERR_INVALID_RETURN_VALUE",(x,S,I)=>{var b;const c=I!=null&&(b=I.constructor)!==null&&b!==void 0&&b.name?`instance of ${I.constructor.name}`:`type ${typeof I}`;return`Expected ${x} to be returned from the "${S}" function but got ${c}.`},TypeError),w("ERR_MISSING_ARGS",(...x)=>{d(x.length>0,"At least one arg needs to be specified");let S;const I=x.length;switch(x=(Array.isArray(x)?x:[x]).map(b=>`"${b}"`).join(" or "),I){case 1:S+=`The ${x[0]} argument`;break;case 2:S+=`The ${x[0]} and ${x[1]} arguments`;break;default:{const b=x.pop();S+=`The ${x.join(", ")}, and ${b} arguments`}break}return`${S} must be specified`},TypeError),w("ERR_OUT_OF_RANGE",(x,S,I)=>{d(S,'Missing "range" argument');let b;if(Number.isInteger(I)&&Math.abs(I)>2**32)b=h(String(I));else if(typeof I=="bigint"){b=String(I);const c=BigInt(2)**BigInt(32);(I>c||I<-c)&&(b=h(b)),b+="n"}else b=e(I);return`The value of "${x}" is out of range. It must be ${S}. Received ${b}`},RangeError),w("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),w("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),w("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),w("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),w("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),w("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),w("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),w("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),w("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),w("ERR_STREAM_WRITE_AFTER_END","write after end",Error),w("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Kn={AbortError:_,aggregateTwoErrors:g(m),hideStackFrames:g,codes:l},Kn}var wr={exports:{}},qa;function Gr(){if(qa)return wr.exports;qa=1;const{AbortController:n,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return wr.exports=n,wr.exports.AbortSignal=e,wr.exports.default=n,wr.exports}var nn={exports:{}},Ba;function Tn(){if(Ba)return nn.exports;Ba=1;var n=typeof Reflect=="object"?Reflect:null,e=n&&typeof n.apply=="function"?n.apply:function(p,N,D){return Function.prototype.apply.call(p,N,D)},t;n&&typeof n.ownKeys=="function"?t=n.ownKeys:Object.getOwnPropertySymbols?t=function(p){return Object.getOwnPropertyNames(p).concat(Object.getOwnPropertySymbols(p))}:t=function(p){return Object.getOwnPropertyNames(p)};function r(c){console&&console.warn&&console.warn(c)}var i=Number.isNaN||function(p){return p!==p};function s(){s.init.call(this)}nn.exports=s,nn.exports.once=S,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(c){if(typeof c!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof c)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(c){if(typeof c!="number"||c<0||i(c))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+c+".");a=c}}),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(p){if(typeof p!="number"||p<0||i(p))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+p+".");return this._maxListeners=p,this};function l(c){return c._maxListeners===void 0?s.defaultMaxListeners:c._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(p){for(var N=[],D=1;D<arguments.length;D++)N.push(arguments[D]);var T=p==="error",q=this._events;if(q!==void 0)T=T&&q.error===void 0;else if(!T)return!1;if(T){var R;if(N.length>0&&(R=N[0]),R instanceof Error)throw R;var M=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw M.context=R,M}var B=q[p];if(B===void 0)return!1;if(typeof B=="function")e(B,this,N);else for(var A=B.length,j=m(B,A),D=0;D<A;++D)e(j[D],this,N);return!0};function d(c,p,N,D){var T,q,R;if(o(N),q=c._events,q===void 0?(q=c._events=Object.create(null),c._eventsCount=0):(q.newListener!==void 0&&(c.emit("newListener",p,N.listener?N.listener:N),q=c._events),R=q[p]),R===void 0)R=q[p]=N,++c._eventsCount;else if(typeof R=="function"?R=q[p]=D?[N,R]:[R,N]:D?R.unshift(N):R.push(N),T=l(c),T>0&&R.length>T&&!R.warned){R.warned=!0;var M=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(p)+" listeners added. Use emitter.setMaxListeners() to increase limit");M.name="MaxListenersExceededWarning",M.emitter=c,M.type=p,M.count=R.length,r(M)}return c}s.prototype.addListener=function(p,N){return d(this,p,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(p,N){return d(this,p,N,!0)};function h(){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 y(c,p,N){var D={fired:!1,wrapFn:void 0,target:c,type:p,listener:N},T=h.bind(D);return T.listener=N,D.wrapFn=T,T}s.prototype.once=function(p,N){return o(N),this.on(p,y(this,p,N)),this},s.prototype.prependOnceListener=function(p,N){return o(N),this.prependListener(p,y(this,p,N)),this},s.prototype.removeListener=function(p,N){var D,T,q,R,M;if(o(N),T=this._events,T===void 0)return this;if(D=T[p],D===void 0)return this;if(D===N||D.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete T[p],T.removeListener&&this.emit("removeListener",p,D.listener||N));else if(typeof D!="function"){for(q=-1,R=D.length-1;R>=0;R--)if(D[R]===N||D[R].listener===N){M=D[R].listener,q=R;break}if(q<0)return this;q===0?D.shift():_(D,q),D.length===1&&(T[p]=D[0]),T.removeListener!==void 0&&this.emit("removeListener",p,M||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(p){var N,D,T;if(D=this._events,D===void 0)return this;if(D.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):D[p]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete D[p]),this;if(arguments.length===0){var q=Object.keys(D),R;for(T=0;T<q.length;++T)R=q[T],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=D[p],typeof N=="function")this.removeListener(p,N);else if(N!==void 0)for(T=N.length-1;T>=0;T--)this.removeListener(p,N[T]);return this};function w(c,p,N){var D=c._events;if(D===void 0)return[];var T=D[p];return T===void 0?[]:typeof T=="function"?N?[T.listener||T]:[T]:N?x(T):m(T,T.length)}s.prototype.listeners=function(p){return w(this,p,!0)},s.prototype.rawListeners=function(p){return w(this,p,!1)},s.listenerCount=function(c,p){return typeof c.listenerCount=="function"?c.listenerCount(p):g.call(c,p)},s.prototype.listenerCount=g;function g(c){var p=this._events;if(p!==void 0){var N=p[c];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 m(c,p){for(var N=new Array(p),D=0;D<p;++D)N[D]=c[D];return N}function _(c,p){for(;p+1<c.length;p++)c[p]=c[p+1];c.pop()}function x(c){for(var p=new Array(c.length),N=0;N<p.length;++N)p[N]=c[N].listener||c[N];return p}function S(c,p){return new Promise(function(N,D){function T(R){c.removeListener(p,q),D(R)}function q(){typeof c.removeListener=="function"&&c.removeListener("error",T),N([].slice.call(arguments))}b(c,p,q,{once:!0}),p!=="error"&&I(c,T,{once:!0})})}function I(c,p,N){typeof c.on=="function"&&b(c,"error",p,N)}function b(c,p,N,D){if(typeof c.on=="function")D.once?c.once(p,N):c.on(p,N);else if(typeof c.addEventListener=="function")c.addEventListener(p,function T(q){D.once&&c.removeEventListener(p,T),N(q)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof c)}return nn.exports}var Fa;function ze(){return Fa||(Fa=1,function(n){const e=bt(),{format:t,inspect:r}=bu(),{codes:{ERR_INVALID_ARG_TYPE:i}}=Ve(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=$e(),l=globalThis.AbortSignal||Gr().AbortSignal,d=globalThis.AbortController||Gr().AbortController,h=Object.getPrototypeOf(async function(){}).constructor,y=globalThis.Blob||e.Blob,w=typeof y<"u"?function(x){return x instanceof y}:function(x){return!1},g=(_,x)=>{if(_!==void 0&&(_===null||typeof _!="object"||!("aborted"in _)))throw new i(x,"AbortSignal",_)},m=(_,x)=>{if(typeof _!="function")throw new i(x,"Function",_)};n.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(_){let x=!1;return function(...S){x||(x=!0,_.apply(this,S))}},createDeferredPromise:function(){let _,x;return{promise:new Promise((I,b)=>{_=I,x=b}),resolve:_,reject:x}},promisify(_){return new Promise((x,S)=>{_((I,...b)=>I?S(I):x(...b))})},debuglog(){return function(){}},format:t,inspect:r,types:{isAsyncFunction(_){return _ instanceof h},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:w,deprecate(_,x){return _},addAbortListener:Tn().addAbortListener||function(x,S){if(x===void 0)throw new i("signal","AbortSignal",x);g(x,"signal"),m(S,"listener");let I;return x.aborted?queueMicrotask(()=>S()):(x.addEventListener("abort",S,{__proto__:null,once:!0,[s]:!0}),I=()=>{x.removeEventListener("abort",S)}),{__proto__:null,[o](){var b;(b=I)===null||b===void 0||b()}}},AbortSignalAny:l.any||function(x){if(x.length===1)return x[0];const S=new d,I=()=>S.abort();return x.forEach(b=>{g(b,"signals"),b.addEventListener("abort",I,{once:!0})}),S.signal.addEventListener("abort",()=>{x.forEach(b=>b.removeEventListener("abort",I))},{once:!0}),S.signal}},n.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(Qn)),Qn.exports}var sn={},Yn,Ua;function Xr(){if(Ua)return Yn;Ua=1;const{ArrayIsArray:n,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:r,NumberIsInteger:i,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:o,NumberParseInt:l,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:h,String:y,StringPrototypeToUpperCase:w,StringPrototypeTrim:g}=$e(),{hideStackFrames:m,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:x,ERR_INVALID_ARG_VALUE:S,ERR_OUT_OF_RANGE:I,ERR_UNKNOWN_SIGNAL:b}}=Ve(),{normalizeEncoding:c}=ze(),{isAsyncFunction:p,isArrayBufferView:N}=ze().types,D={};function T(X){return X===(X|0)}function q(X){return X===X>>>0}const R=/^[0-7]+$/,M="must be a 32-bit unsigned integer or an octal string";function B(X,le,he){if(typeof X>"u"&&(X=he),typeof X=="string"){if(h(R,X)===null)throw new S(le,X,M);X=l(X,8)}return Y(X,le),X}const A=m((X,le,he=o,se=a)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);if(X<he||X>se)throw new I(le,`>= ${he} && <= ${se}`,X)}),j=m((X,le,he=-2147483648,se=2147483647)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);if(X<he||X>se)throw new I(le,`>= ${he} && <= ${se}`,X)}),Y=m((X,le,he=!1)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);const se=he?1:0,Ee=4294967295;if(X<se||X>Ee)throw new I(le,`>= ${se} && <= ${Ee}`,X)});function L(X,le){if(typeof X!="string")throw new x(le,"string",X)}function ee(X,le,he=void 0,se){if(typeof X!="number")throw new x(le,"number",X);if(he!=null&&X<he||se!=null&&X>se||(he!=null||se!=null)&&s(X))throw new I(le,`${he!=null?`>= ${he}`:""}${he!=null&&se!=null?" && ":""}${se!=null?`<= ${se}`:""}`,X)}const C=m((X,le,he)=>{if(!e(he,X)){const Ee="must be one of: "+t(r(he,qe=>typeof qe=="string"?`'${qe}'`:y(qe)),", ");throw new S(le,X,Ee)}});function K(X,le){if(typeof X!="boolean")throw new x(le,"boolean",X)}function v(X,le,he){return X==null||!d(X,le)?he:X[le]}const U=m((X,le,he=null)=>{const se=v(he,"allowArray",!1),Ee=v(he,"allowFunction",!1);if(!v(he,"nullable",!1)&&X===null||!se&&n(X)||typeof X!="object"&&(!Ee||typeof X!="function"))throw new x(le,"Object",X)}),Q=m((X,le)=>{if(X!=null&&typeof X!="object"&&typeof X!="function")throw new x(le,"a dictionary",X)}),z=m((X,le,he=0)=>{if(!n(X))throw new x(le,"Array",X);if(X.length<he){const se=`must be longer than ${he}`;throw new S(le,X,se)}});function ae(X,le){z(X,le);for(let he=0;he<X.length;he++)L(X[he],`${le}[${he}]`)}function H(X,le){z(X,le);for(let he=0;he<X.length;he++)K(X[he],`${le}[${he}]`)}function V(X,le){z(X,le);for(let he=0;he<X.length;he++){const se=X[he],Ee=`${le}[${he}]`;if(se==null)throw new x(Ee,"AbortSignal",se);ce(se,Ee)}}function W(X,le="signal"){if(L(X,le),D[X]===void 0)throw D[w(X)]!==void 0?new b(X+" (signals must use all capital letters)"):new b(X)}const F=m((X,le="buffer")=>{if(!N(X))throw new x(le,["Buffer","TypedArray","DataView"],X)});function Z(X,le){const he=c(le),se=X.length;if(he==="hex"&&se%2!==0)throw new S("encoding",le,`is invalid for data of length ${se}`)}function te(X,le="Port",he=!0){if(typeof X!="number"&&typeof X!="string"||typeof X=="string"&&g(X).length===0||+X!==+X>>>0||X>65535||X===0&&!he)throw new _(le,X,he);return X|0}const ce=m((X,le)=>{if(X!==void 0&&(X===null||typeof X!="object"||!("aborted"in X)))throw new x(le,"AbortSignal",X)}),fe=m((X,le)=>{if(typeof X!="function")throw new x(le,"Function",X)}),O=m((X,le)=>{if(typeof X!="function"||p(X))throw new x(le,"Function",X)}),G=m((X,le)=>{if(X!==void 0)throw new x(le,"undefined",X)});function re(X,le,he){if(!e(he,X))throw new x(le,`('${t(he,"|")}')`,X)}const ue=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function de(X,le){if(typeof X>"u"||!h(ue,X))throw new S(le,X,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function pe(X){if(typeof X=="string")return de(X,"hints"),X;if(n(X)){const le=X.length;let he="";if(le===0)return he;for(let se=0;se<le;se++){const Ee=X[se];de(Ee,"hints"),he+=Ee,se!==le-1&&(he+=", ")}return he}throw new S("hints",X,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Yn={isInt32:T,isUint32:q,parseFileMode:B,validateArray:z,validateStringArray:ae,validateBooleanArray:H,validateAbortSignalArray:V,validateBoolean:K,validateBuffer:F,validateDictionary:Q,validateEncoding:Z,validateFunction:fe,validateInt32:j,validateInteger:A,validateNumber:ee,validateObject:U,validateOneOf:C,validatePlainFunction:O,validatePort:te,validateSignalName:W,validateString:L,validateUint32:Y,validateUndefined:G,validateUnion:re,validateAbortSignal:ce,validateLinkHeaderValue:pe},Yn}var an={exports:{}},Zn={exports:{}},Ha;function Vt(){if(Ha)return Zn.exports;Ha=1;var n=Zn.exports={},e,t;function r(){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=r}catch{e=r}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function s(_){if(e===setTimeout)return setTimeout(_,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(_,0);try{return e(_,0)}catch{try{return e.call(null,_,0)}catch{return e.call(this,_,0)}}}function a(_){if(t===clearTimeout)return clearTimeout(_);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(_);try{return t(_)}catch{try{return t.call(null,_)}catch{return t.call(this,_)}}}var o=[],l=!1,d,h=-1;function y(){!l||!d||(l=!1,d.length?o=d.concat(o):h=-1,o.length&&w())}function w(){if(!l){var _=s(y);l=!0;for(var x=o.length;x;){for(d=o,o=[];++h<x;)d&&d[h].run();h=-1,x=o.length}d=null,l=!1,a(_)}}n.nextTick=function(_){var x=new Array(arguments.length-1);if(arguments.length>1)for(var S=1;S<arguments.length;S++)x[S-1]=arguments[S];o.push(new g(_,x)),o.length===1&&!l&&s(w)};function g(_,x){this.fun=_,this.array=x}g.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={};function m(){}return n.on=m,n.addListener=m,n.once=m,n.off=m,n.removeListener=m,n.removeAllListeners=m,n.emit=m,n.prependListener=m,n.prependOnceListener=m,n.listeners=function(_){return[]},n.binding=function(_){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(_){throw new Error("process.chdir is not supported")},n.umask=function(){return 0},Zn.exports}var ei,Va;function wt(){if(Va)return ei;Va=1;const{SymbolAsyncIterator:n,SymbolIterator:e,SymbolFor:t}=$e(),r=t("nodejs.stream.destroyed"),i=t("nodejs.stream.errored"),s=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),o=t("nodejs.stream.disturbed"),l=t("nodejs.webstream.isClosedPromise"),d=t("nodejs.webstream.controllerErrorFunction");function h(v,U=!1){var Q;return!!(v&&typeof v.pipe=="function"&&typeof v.on=="function"&&(!U||typeof v.pause=="function"&&typeof v.resume=="function")&&(!v._writableState||((Q=v._readableState)===null||Q===void 0?void 0:Q.readable)!==!1)&&(!v._writableState||v._readableState))}function y(v){var U;return!!(v&&typeof v.write=="function"&&typeof v.on=="function"&&(!v._readableState||((U=v._writableState)===null||U===void 0?void 0:U.writable)!==!1))}function w(v){return!!(v&&typeof v.pipe=="function"&&v._readableState&&typeof v.on=="function"&&typeof v.write=="function")}function g(v){return v&&(v._readableState||v._writableState||typeof v.write=="function"&&typeof v.on=="function"||typeof v.pipe=="function"&&typeof v.on=="function")}function m(v){return!!(v&&!g(v)&&typeof v.pipeThrough=="function"&&typeof v.getReader=="function"&&typeof v.cancel=="function")}function _(v){return!!(v&&!g(v)&&typeof v.getWriter=="function"&&typeof v.abort=="function")}function x(v){return!!(v&&!g(v)&&typeof v.readable=="object"&&typeof v.writable=="object")}function S(v){return m(v)||_(v)||x(v)}function I(v,U){return v==null?!1:U===!0?typeof v[n]=="function":U===!1?typeof v[e]=="function":typeof v[n]=="function"||typeof v[e]=="function"}function b(v){if(!g(v))return null;const U=v._writableState,Q=v._readableState,z=U||Q;return!!(v.destroyed||v[r]||z!=null&&z.destroyed)}function c(v){if(!y(v))return null;if(v.writableEnded===!0)return!0;const U=v._writableState;return U!=null&&U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function p(v,U){if(!y(v))return null;if(v.writableFinished===!0)return!0;const Q=v._writableState;return Q!=null&&Q.errored?!1:typeof Q?.finished!="boolean"?null:!!(Q.finished||U===!1&&Q.ended===!0&&Q.length===0)}function N(v){if(!h(v))return null;if(v.readableEnded===!0)return!0;const U=v._readableState;return!U||U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function D(v,U){if(!h(v))return null;const Q=v._readableState;return Q!=null&&Q.errored?!1:typeof Q?.endEmitted!="boolean"?null:!!(Q.endEmitted||U===!1&&Q.ended===!0&&Q.length===0)}function T(v){return v&&v[s]!=null?v[s]:typeof v?.readable!="boolean"?null:b(v)?!1:h(v)&&v.readable&&!D(v)}function q(v){return v&&v[a]!=null?v[a]:typeof v?.writable!="boolean"?null:b(v)?!1:y(v)&&v.writable&&!c(v)}function R(v,U){return g(v)?b(v)?!0:!(U?.readable!==!1&&T(v)||U?.writable!==!1&&q(v)):null}function M(v){var U,Q;return g(v)?v.writableErrored?v.writableErrored:(U=(Q=v._writableState)===null||Q===void 0?void 0:Q.errored)!==null&&U!==void 0?U:null:null}function B(v){var U,Q;return g(v)?v.readableErrored?v.readableErrored:(U=(Q=v._readableState)===null||Q===void 0?void 0:Q.errored)!==null&&U!==void 0?U:null:null}function A(v){if(!g(v))return null;if(typeof v.closed=="boolean")return v.closed;const U=v._writableState,Q=v._readableState;return typeof U?.closed=="boolean"||typeof Q?.closed=="boolean"?U?.closed||Q?.closed:typeof v._closed=="boolean"&&j(v)?v._closed:null}function j(v){return typeof v._closed=="boolean"&&typeof v._defaultKeepAlive=="boolean"&&typeof v._removedConnection=="boolean"&&typeof v._removedContLen=="boolean"}function Y(v){return typeof v._sent100=="boolean"&&j(v)}function L(v){var U;return typeof v._consuming=="boolean"&&typeof v._dumped=="boolean"&&((U=v.req)===null||U===void 0?void 0:U.upgradeOrConnect)===void 0}function ee(v){if(!g(v))return null;const U=v._writableState,Q=v._readableState,z=U||Q;return!z&&Y(v)||!!(z&&z.autoDestroy&&z.emitClose&&z.closed===!1)}function C(v){var U;return!!(v&&((U=v[o])!==null&&U!==void 0?U:v.readableDidRead||v.readableAborted))}function K(v){var U,Q,z,ae,H,V,W,F,Z,te;return!!(v&&((U=(Q=(z=(ae=(H=(V=v[i])!==null&&V!==void 0?V:v.readableErrored)!==null&&H!==void 0?H:v.writableErrored)!==null&&ae!==void 0?ae:(W=v._readableState)===null||W===void 0?void 0:W.errorEmitted)!==null&&z!==void 0?z:(F=v._writableState)===null||F===void 0?void 0:F.errorEmitted)!==null&&Q!==void 0?Q:(Z=v._readableState)===null||Z===void 0?void 0:Z.errored)!==null&&U!==void 0?U:!((te=v._writableState)===null||te===void 0)&&te.errored))}return ei={isDestroyed:b,kIsDestroyed:r,isDisturbed:C,kIsDisturbed:o,isErrored:K,kIsErrored:i,isReadable:T,kIsReadable:s,kIsClosedPromise:l,kControllerErrorFunction:d,kIsWritable:a,isClosed:A,isDuplexNodeStream:w,isFinished:R,isIterable:I,isReadableNodeStream:h,isReadableStream:m,isReadableEnded:N,isReadableFinished:D,isReadableErrored:B,isNodeStream:g,isWebStream:S,isWritable:q,isWritableNodeStream:y,isWritableStream:_,isWritableEnded:c,isWritableFinished:p,isWritableErrored:M,isServerRequest:L,isServerResponse:Y,willEmitClose:ee,isTransformStream:x},ei}var Ga;function Tt(){if(Ga)return an.exports;Ga=1;const n=Vt(),{AbortError:e,codes:t}=Ve(),{ERR_INVALID_ARG_TYPE:r,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=ze(),{validateAbortSignal:o,validateFunction:l,validateObject:d,validateBoolean:h}=Xr(),{Promise:y,PromisePrototypeThen:w,SymbolDispose:g}=$e(),{isClosed:m,isReadable:_,isReadableNodeStream:x,isReadableStream:S,isReadableFinished:I,isReadableErrored:b,isWritable:c,isWritableNodeStream:p,isWritableStream:N,isWritableFinished:D,isWritableErrored:T,isNodeStream:q,willEmitClose:R,kIsClosedPromise:M}=wt();let B;function A(C){return C.setHeader&&typeof C.abort=="function"}const j=()=>{};function Y(C,K,v){var U,Q;if(arguments.length===2?(v=K,K=s):K==null?K=s:d(K,"options"),l(v,"callback"),o(K.signal,"options.signal"),v=a(v),S(C)||N(C))return L(C,K,v);if(!q(C))throw new r("stream",["ReadableStream","WritableStream","Stream"],C);const z=(U=K.readable)!==null&&U!==void 0?U:x(C),ae=(Q=K.writable)!==null&&Q!==void 0?Q:p(C),H=C._writableState,V=C._readableState,W=()=>{C.writable||te()};let F=R(C)&&x(C)===z&&p(C)===ae,Z=D(C,!1);const te=()=>{Z=!0,C.destroyed&&(F=!1),!(F&&(!C.readable||z))&&(!z||ce)&&v.call(C)};let ce=I(C,!1);const fe=()=>{ce=!0,C.destroyed&&(F=!1),!(F&&(!C.writable||ae))&&(!ae||Z)&&v.call(C)},O=X=>{v.call(C,X)};let G=m(C);const re=()=>{G=!0;const X=T(C)||b(C);if(X&&typeof X!="boolean")return v.call(C,X);if(z&&!ce&&x(C,!0)&&!I(C,!1))return v.call(C,new i);if(ae&&!Z&&!D(C,!1))return v.call(C,new i);v.call(C)},ue=()=>{G=!0;const X=T(C)||b(C);if(X&&typeof X!="boolean")return v.call(C,X);v.call(C)},de=()=>{C.req.on("finish",te)};A(C)?(C.on("complete",te),F||C.on("abort",re),C.req?de():C.on("request",de)):ae&&!H&&(C.on("end",W),C.on("close",W)),!F&&typeof C.aborted=="boolean"&&C.on("aborted",re),C.on("end",fe),C.on("finish",te),K.error!==!1&&C.on("error",O),C.on("close",re),G?n.nextTick(re):H!=null&&H.errorEmitted||V!=null&&V.errorEmitted?F||n.nextTick(ue):(!z&&(!F||_(C))&&(Z||c(C)===!1)||!ae&&(!F||c(C))&&(ce||_(C)===!1)||V&&C.req&&C.aborted)&&n.nextTick(ue);const pe=()=>{v=j,C.removeListener("aborted",re),C.removeListener("complete",te),C.removeListener("abort",re),C.removeListener("request",de),C.req&&C.req.removeListener("finish",te),C.removeListener("end",W),C.removeListener("close",W),C.removeListener("finish",te),C.removeListener("end",fe),C.removeListener("error",O),C.removeListener("close",re)};if(K.signal&&!G){const X=()=>{const le=v;pe(),le.call(C,new e(void 0,{cause:K.signal.reason}))};if(K.signal.aborted)n.nextTick(X);else{B=B||ze().addAbortListener;const le=B(K.signal,X),he=v;v=a((...se)=>{le[g](),he.apply(C,se)})}}return pe}function L(C,K,v){let U=!1,Q=j;if(K.signal)if(Q=()=>{U=!0,v.call(C,new e(void 0,{cause:K.signal.reason}))},K.signal.aborted)n.nextTick(Q);else{B=B||ze().addAbortListener;const ae=B(K.signal,Q),H=v;v=a((...V)=>{ae[g](),H.apply(C,V)})}const z=(...ae)=>{U||n.nextTick(()=>v.apply(C,ae))};return w(C[M].promise,z,z),j}function ee(C,K){var v;let U=!1;return K===null&&(K=s),(v=K)!==null&&v!==void 0&&v.cleanup&&(h(K.cleanup,"cleanup"),U=K.cleanup),new y((Q,z)=>{const ae=Y(C,K,H=>{U&&ae(),H?z(H):Q()})})}return an.exports=Y,an.exports.finished=ee,an.exports}var ti,Wa;function ur(){if(Wa)return ti;Wa=1;const n=Vt(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:r}=Ve(),{Symbol:i}=$e(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:l}=wt(),d=i("kDestroy"),h=i("kConstruct");function y(R,M,B){R&&(R.stack,M&&!M.errored&&(M.errored=R),B&&!B.errored&&(B.errored=R))}function w(R,M){const B=this._readableState,A=this._writableState,j=A||B;return A!=null&&A.destroyed||B!=null&&B.destroyed?(typeof M=="function"&&M(),this):(y(R,A,B),A&&(A.destroyed=!0),B&&(B.destroyed=!0),j.constructed?g(this,R,M):this.once(d,function(Y){g(this,e(Y,R),M)}),this)}function g(R,M,B){let A=!1;function j(Y){if(A)return;A=!0;const L=R._readableState,ee=R._writableState;y(Y,ee,L),ee&&(ee.closed=!0),L&&(L.closed=!0),typeof B=="function"&&B(Y),Y?n.nextTick(m,R,Y):n.nextTick(_,R)}try{R._destroy(M||null,j)}catch(Y){j(Y)}}function m(R,M){x(R,M),_(R)}function _(R){const M=R._readableState,B=R._writableState;B&&(B.closeEmitted=!0),M&&(M.closeEmitted=!0),(B!=null&&B.emitClose||M!=null&&M.emitClose)&&R.emit("close")}function x(R,M){const B=R._readableState,A=R._writableState;A!=null&&A.errorEmitted||B!=null&&B.errorEmitted||(A&&(A.errorEmitted=!0),B&&(B.errorEmitted=!0),R.emit("error",M))}function S(){const R=this._readableState,M=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),M&&(M.constructed=!0,M.destroyed=!1,M.closed=!1,M.closeEmitted=!1,M.errored=null,M.errorEmitted=!1,M.finalCalled=!1,M.prefinished=!1,M.ended=M.writable===!1,M.ending=M.writable===!1,M.finished=M.writable===!1)}function I(R,M,B){const A=R._readableState,j=R._writableState;if(j!=null&&j.destroyed||A!=null&&A.destroyed)return this;A!=null&&A.autoDestroy||j!=null&&j.autoDestroy?R.destroy(M):M&&(M.stack,j&&!j.errored&&(j.errored=M),A&&!A.errored&&(A.errored=M),B?n.nextTick(x,R,M):x(R,M))}function b(R,M){if(typeof R._construct!="function")return;const B=R._readableState,A=R._writableState;B&&(B.constructed=!1),A&&(A.constructed=!1),R.once(h,M),!(R.listenerCount(h)>1)&&n.nextTick(c,R)}function c(R){let M=!1;function B(A){if(M){I(R,A??new t);return}M=!0;const j=R._readableState,Y=R._writableState,L=Y||j;j&&(j.constructed=!0),Y&&(Y.constructed=!0),L.destroyed?R.emit(d,A):A?I(R,A,!0):n.nextTick(p,R)}try{R._construct(A=>{n.nextTick(B,A)})}catch(A){n.nextTick(B,A)}}function p(R){R.emit(h)}function N(R){return R?.setHeader&&typeof R.abort=="function"}function D(R){R.emit("close")}function T(R,M){R.emit("error",M),n.nextTick(D,R)}function q(R,M){!R||a(R)||(!M&&!o(R)&&(M=new r),l(R)?(R.socket=null,R.destroy(M)):N(R)?R.abort():N(R.req)?R.req.abort():typeof R.destroy=="function"?R.destroy(M):typeof R.close=="function"?R.close():M?n.nextTick(T,R,M):n.nextTick(D,R),R.destroyed||(R[s]=!0))}return ti={construct:b,destroyer:q,destroy:w,undestroy:S,errorOrDestroy:I},ti}var ri,za;function Us(){if(za)return ri;za=1;const{ArrayIsArray:n,ObjectSetPrototypeOf:e}=$e(),{EventEmitter:t}=Tn();function r(s){t.call(this,s)}e(r.prototype,t.prototype),e(r,t),r.prototype.pipe=function(s,a){const o=this;function l(_){s.writable&&s.write(_)===!1&&o.pause&&o.pause()}o.on("data",l);function d(){o.readable&&o.resume&&o.resume()}s.on("drain",d),!s._isStdio&&(!a||a.end!==!1)&&(o.on("end",y),o.on("close",w));let h=!1;function y(){h||(h=!0,s.end())}function w(){h||(h=!0,typeof s.destroy=="function"&&s.destroy())}function g(_){m(),t.listenerCount(this,"error")===0&&this.emit("error",_)}i(o,"error",g),i(s,"error",g);function m(){o.removeListener("data",l),s.removeListener("drain",d),o.removeListener("end",y),o.removeListener("close",w),o.removeListener("error",g),s.removeListener("error",g),o.removeListener("end",m),o.removeListener("close",m),s.removeListener("close",m)}return o.on("end",m),o.on("close",m),s.on("close",m),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):n(s._events[a])?s._events[a].unshift(o):s._events[a]=[o,s._events[a]]}return ri={Stream:r,prependListener:i},ri}var ni={exports:{}},Ja;function An(){return Ja||(Ja=1,function(n){const{SymbolDispose:e}=$e(),{AbortError:t,codes:r}=Ve(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=wt(),o=Tt(),{ERR_INVALID_ARG_TYPE:l}=r;let d;const h=(y,w)=>{if(typeof y!="object"||!("aborted"in y))throw new l(w,"AbortSignal",y)};n.exports.addAbortSignal=function(w,g){if(h(w,"signal"),!i(g)&&!s(g))throw new l("stream",["ReadableStream","WritableStream","Stream"],g);return n.exports.addAbortSignalNoValidate(w,g)},n.exports.addAbortSignalNoValidate=function(y,w){if(typeof y!="object"||!("aborted"in y))return w;const g=i(w)?()=>{w.destroy(new t(void 0,{cause:y.reason}))}:()=>{w[a](new t(void 0,{cause:y.reason}))};if(y.aborted)g();else{d=d||ze().addAbortListener;const m=d(y,g);o(w,m[e])}return w}}(ni)),ni.exports}var ii,Qa;function Hc(){if(Qa)return ii;Qa=1;const{StringPrototypeSlice:n,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:r}=$e(),{Buffer:i}=bt(),{inspect:s}=ze();return ii=class{constructor(){this.head=null,this.tail=null,this.length=0}push(o){const l={data:o,next:null};this.length>0?this.tail.next=l:this.head=l,this.tail=l,++this.length}unshift(o){const l={data:o,next:this.head};this.length===0&&(this.tail=l),this.head=l,++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 l=this.head,d=""+l.data;for(;(l=l.next)!==null;)d+=o+l.data;return d}concat(o){if(this.length===0)return i.alloc(0);const l=i.allocUnsafe(o>>>0);let d=this.head,h=0;for(;d;)t(l,d.data,h),h+=d.data.length,d=d.next;return l}consume(o,l){const d=this.head.data;if(o<d.length){const h=d.slice(0,o);return this.head.data=d.slice(o),h}return o===d.length?this.shift():l?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 l="",d=this.head,h=0;do{const y=d.data;if(o>y.length)l+=y,o-=y.length;else{o===y.length?(l+=y,++h,d.next?this.head=d.next:this.head=this.tail=null):(l+=n(y,0,o),this.head=d,d.data=n(y,o));break}++h}while((d=d.next)!==null);return this.length-=h,l}_getBuffer(o){const l=i.allocUnsafe(o),d=o;let h=this.head,y=0;do{const w=h.data;if(o>w.length)t(l,w,d-o),o-=w.length;else{o===w.length?(t(l,w,d-o),++y,h.next?this.head=h.next:this.head=this.tail=null):(t(l,new r(w.buffer,w.byteOffset,o),d-o),this.head=h,h.data=w.slice(o));break}++y}while((h=h.next)!==null);return this.length-=y,l}[Symbol.for("nodejs.util.inspect.custom")](o,l){return s(this,{...l,depth:0,customInspect:!1})}},ii}var si,Xa;function Ln(){if(Xa)return si;Xa=1;const{MathFloor:n,NumberIsInteger:e}=$e(),{validateInteger:t}=Xr(),{ERR_INVALID_ARG_VALUE:r}=Ve().codes;let i=16*1024,s=16;function a(h,y,w){return h.highWaterMark!=null?h.highWaterMark:y?h[w]:null}function o(h){return h?s:i}function l(h,y){t(y,"value",0),h?s=y:i=y}function d(h,y,w,g){const m=a(y,g,w);if(m!=null){if(!e(m)||m<0){const _=g?`options.${w}`:"options.highWaterMark";throw new r(_,m)}return n(m)}return o(h.objectMode)}return si={getHighWaterMark:d,getDefaultHighWaterMark:o,setDefaultHighWaterMark:l},si}var ai={},on={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Ka;function Vc(){return Ka||(Ka=1,function(n,e){var t=bt(),r=t.Buffer;function i(a,o){for(var l in a)o[l]=a[l]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?n.exports=t:(i(t,e),e.Buffer=s);function s(a,o,l){return r(a,o,l)}s.prototype=Object.create(r.prototype),i(r,s),s.from=function(a,o,l){if(typeof a=="number")throw new TypeError("Argument must not be a number");return r(a,o,l)},s.alloc=function(a,o,l){if(typeof a!="number")throw new TypeError("Argument must be a number");var d=r(a);return o!==void 0?typeof l=="string"?d.fill(o,l):d.fill(o):d.fill(0),d},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}}(on,on.exports)),on.exports}var Ya;function Gc(){if(Ya)return ai;Ya=1;var n=Vc().Buffer,e=n.isEncoding||function(S){switch(S=""+S,S&&S.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(S){if(!S)return"utf8";for(var I;;)switch(S){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 S;default:if(I)return;S=(""+S).toLowerCase(),I=!0}}function r(S){var I=t(S);if(typeof I!="string"&&(n.isEncoding===e||!e(S)))throw new Error("Unknown encoding: "+S);return I||S}ai.StringDecoder=i;function i(S){this.encoding=r(S);var I;switch(this.encoding){case"utf16le":this.text=y,this.end=w,I=4;break;case"utf8":this.fillLast=l,I=4;break;case"base64":this.text=g,this.end=m,I=3;break;default:this.write=_,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=n.allocUnsafe(I)}i.prototype.write=function(S){if(S.length===0)return"";var I,b;if(this.lastNeed){if(I=this.fillLast(S),I===void 0)return"";b=this.lastNeed,this.lastNeed=0}else b=0;return b<S.length?I?I+this.text(S,b):this.text(S,b):I||""},i.prototype.end=h,i.prototype.text=d,i.prototype.fillLast=function(S){if(this.lastNeed<=S.length)return S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,S.length),this.lastNeed-=S.length};function s(S){return S<=127?0:S>>5===6?2:S>>4===14?3:S>>3===30?4:S>>6===2?-1:-2}function a(S,I,b){var c=I.length-1;if(c<b)return 0;var p=s(I[c]);return p>=0?(p>0&&(S.lastNeed=p-1),p):--c<b||p===-2?0:(p=s(I[c]),p>=0?(p>0&&(S.lastNeed=p-2),p):--c<b||p===-2?0:(p=s(I[c]),p>=0?(p>0&&(p===2?p=0:S.lastNeed=p-3),p):0))}function o(S,I,b){if((I[0]&192)!==128)return S.lastNeed=0,"�";if(S.lastNeed>1&&I.length>1){if((I[1]&192)!==128)return S.lastNeed=1,"�";if(S.lastNeed>2&&I.length>2&&(I[2]&192)!==128)return S.lastNeed=2,"�"}}function l(S){var I=this.lastTotal-this.lastNeed,b=o(this,S);if(b!==void 0)return b;if(this.lastNeed<=S.length)return S.copy(this.lastChar,I,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,I,0,S.length),this.lastNeed-=S.length}function d(S,I){var b=a(this,S,I);if(!this.lastNeed)return S.toString("utf8",I);this.lastTotal=b;var c=S.length-(b-this.lastNeed);return S.copy(this.lastChar,0,c),S.toString("utf8",I,c)}function h(S){var I=S&&S.length?this.write(S):"";return this.lastNeed?I+"�":I}function y(S,I){if((S.length-I)%2===0){var b=S.toString("utf16le",I);if(b){var c=b.charCodeAt(b.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1],b.slice(0,-1)}return b}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=S[S.length-1],S.toString("utf16le",I,S.length-1)}function w(S){var I=S&&S.length?this.write(S):"";if(this.lastNeed){var b=this.lastTotal-this.lastNeed;return I+this.lastChar.toString("utf16le",0,b)}return I}function g(S,I){var b=(S.length-I)%3;return b===0?S.toString("base64",I):(this.lastNeed=3-b,this.lastTotal=3,b===1?this.lastChar[0]=S[S.length-1]:(this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1]),S.toString("base64",I,S.length-b))}function m(S){var I=S&&S.length?this.write(S):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function _(S){return S.toString(this.encoding)}function x(S){return S&&S.length?this.write(S):""}return ai}var oi,Za;function wu(){if(Za)return oi;Za=1;const n=Vt(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:r}=$e(),{Buffer:i}=bt(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=Ve().codes;function o(l,d,h){let y;if(typeof d=="string"||d instanceof i)return new l({objectMode:!0,...h,read(){this.push(d),this.push(null)}});let w;if(d&&d[t])w=!0,y=d[t]();else if(d&&d[r])w=!1,y=d[r]();else throw new s("iterable",["Iterable"],d);const g=new l({objectMode:!0,highWaterMark:1,...h});let m=!1;g._read=function(){m||(m=!0,x())},g._destroy=function(S,I){e(_(S),()=>n.nextTick(I,S),b=>n.nextTick(I,b||S))};async function _(S){const I=S!=null,b=typeof y.throw=="function";if(I&&b){const{value:c,done:p}=await y.throw(S);if(await c,p)return}if(typeof y.return=="function"){const{value:c}=await y.return();await c}}async function x(){for(;;){try{const{value:S,done:I}=w?await y.next():y.next();if(I)g.push(null);else{const b=S&&typeof S.then=="function"?await S:S;if(b===null)throw m=!1,new a;if(g.push(b))continue;m=!1}}catch(S){g.destroy(S)}break}}return g}return oi=o,oi}var li,eo;function jn(){if(eo)return li;eo=1;const n=Vt(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:r,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:l,SafeSet:d,SymbolAsyncDispose:h,SymbolAsyncIterator:y,Symbol:w}=$e();li=se,se.ReadableState=he;const{EventEmitter:g}=Tn(),{Stream:m,prependListener:_}=Us(),{Buffer:x}=bt(),{addAbortSignal:S}=An(),I=Tt();let b=ze().debuglog("stream",$=>{b=$});const c=Hc(),p=ur(),{getHighWaterMark:N,getDefaultHighWaterMark:D}=Ln(),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:q,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:M,ERR_STREAM_PUSH_AFTER_EOF:B,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:A},AbortError:j}=Ve(),{validateObject:Y}=Xr(),L=w("kPaused"),{StringDecoder:ee}=Gc(),C=wu();o(se.prototype,m.prototype),o(se,m);const K=()=>{},{errorOrDestroy:v}=p,U=1,Q=2,z=4,ae=8,H=16,V=32,W=64,F=128,Z=256,te=512,ce=1024,fe=2048,O=4096,G=8192,re=16384,ue=32768,de=65536,pe=1<<17,X=1<<18;function le($){return{enumerable:!1,get(){return(this.state&$)!==0},set(P){P?this.state|=$:this.state&=~$}}}s(he.prototype,{objectMode:le(U),ended:le(Q),endEmitted:le(z),reading:le(ae),constructed:le(H),sync:le(V),needReadable:le(W),emittedReadable:le(F),readableListening:le(Z),resumeScheduled:le(te),errorEmitted:le(ce),emitClose:le(fe),autoDestroy:le(O),destroyed:le(G),closed:le(re),closeEmitted:le(ue),multiAwaitDrain:le(de),readingMore:le(pe),dataEmitted:le(X)});function he($,P,ge){typeof ge!="boolean"&&(ge=P instanceof yt()),this.state=fe|O|H|V,$&&$.objectMode&&(this.state|=U),ge&&$&&$.readableObjectMode&&(this.state|=U),this.highWaterMark=$?N(this,$,"readableHighWaterMark",ge):D(!1),this.buffer=new c,this.length=0,this.pipes=[],this.flowing=null,this[L]=null,$&&$.emitClose===!1&&(this.state&=~fe),$&&$.autoDestroy===!1&&(this.state&=~O),this.errored=null,this.defaultEncoding=$&&$.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,$&&$.encoding&&(this.decoder=new ee($.encoding),this.encoding=$.encoding)}function se($){if(!(this instanceof se))return new se($);const P=this instanceof yt();this._readableState=new he($,this,P),$&&(typeof $.read=="function"&&(this._read=$.read),typeof $.destroy=="function"&&(this._destroy=$.destroy),typeof $.construct=="function"&&(this._construct=$.construct),$.signal&&!P&&S($.signal,this)),m.call(this,$),p.construct(this,()=>{this._readableState.needReadable&&J(this,this._readableState)})}se.prototype.destroy=p.destroy,se.prototype._undestroy=p.undestroy,se.prototype._destroy=function($,P){P($)},se.prototype[g.captureRejectionSymbol]=function($){this.destroy($)},se.prototype[h]=function(){let $;return this.destroyed||($=this.readableEnded?null:new j,this.destroy($)),new l((P,ge)=>I(this,ye=>ye&&ye!==$?ge(ye):P(null)))},se.prototype.push=function($,P){return Ee(this,$,P,!1)},se.prototype.unshift=function($,P){return Ee(this,$,P,!0)};function Ee($,P,ge,ye){b("readableAddChunk",P);const me=$._readableState;let Be;if((me.state&U)===0&&(typeof P=="string"?(ge=ge||me.defaultEncoding,me.encoding!==ge&&(ye&&me.encoding?P=x.from(P,ge).toString(me.encoding):(P=x.from(P,ge),ge=""))):P instanceof x?ge="":m._isUint8Array(P)?(P=m._uint8ArrayToBuffer(P),ge=""):P!=null&&(Be=new q("chunk",["string","Buffer","Uint8Array"],P))),Be)v($,Be);else if(P===null)me.state&=~ae,u($,me);else if((me.state&U)!==0||P&&P.length>0)if(ye)if((me.state&z)!==0)v($,new A);else{if(me.destroyed||me.errored)return!1;qe($,me,P,!0)}else if(me.ended)v($,new B);else{if(me.destroyed||me.errored)return!1;me.state&=~ae,me.decoder&&!ge?(P=me.decoder.write(P),me.objectMode||P.length!==0?qe($,me,P,!1):J($,me)):qe($,me,P,!1)}else ye||(me.state&=~ae,J($,me));return!me.ended&&(me.length<me.highWaterMark||me.length===0)}function qe($,P,ge,ye){P.flowing&&P.length===0&&!P.sync&&$.listenerCount("data")>0?((P.state&de)!==0?P.awaitDrainWriters.clear():P.awaitDrainWriters=null,P.dataEmitted=!0,$.emit("data",ge)):(P.length+=P.objectMode?1:ge.length,ye?P.buffer.unshift(ge):P.buffer.push(ge),(P.state&W)!==0&&f($)),J($,P)}se.prototype.isPaused=function(){const $=this._readableState;return $[L]===!0||$.flowing===!1},se.prototype.setEncoding=function($){const P=new ee($);this._readableState.decoder=P,this._readableState.encoding=this._readableState.decoder.encoding;const ge=this._readableState.buffer;let ye="";for(const me of ge)ye+=P.write(me);return ge.clear(),ye!==""&&ge.push(ye),this._readableState.length=ye.length,this};const _e=1073741824;function He($){if($>_e)throw new M("size","<= 1GiB",$);return $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++,$}function E($,P){return $<=0||P.length===0&&P.ended?0:(P.state&U)!==0?1:r($)?P.flowing&&P.length?P.buffer.first().length:P.length:$<=P.length?$:P.ended?P.length:0}se.prototype.read=function($){b("read",$),$===void 0?$=NaN:t($)||($=i($,10));const P=this._readableState,ge=$;if($>P.highWaterMark&&(P.highWaterMark=He($)),$!==0&&(P.state&=~F),$===0&&P.needReadable&&((P.highWaterMark!==0?P.length>=P.highWaterMark:P.length>0)||P.ended))return b("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?qn(this):f(this),null;if($=E($,P),$===0&&P.ended)return P.length===0&&qn(this),null;let ye=(P.state&W)!==0;if(b("need readable",ye),(P.length===0||P.length-$<P.highWaterMark)&&(ye=!0,b("length less than watermark",ye)),P.ended||P.reading||P.destroyed||P.errored||!P.constructed)ye=!1,b("reading, ended or constructing",ye);else if(ye){b("do read"),P.state|=ae|V,P.length===0&&(P.state|=W);try{this._read(P.highWaterMark)}catch(Be){v(this,Be)}P.state&=~V,P.reading||($=E(ge,P))}let me;return $>0?me=va($,P):me=null,me===null?(P.needReadable=P.length<=P.highWaterMark,$=0):(P.length-=$,P.multiAwaitDrain?P.awaitDrainWriters.clear():P.awaitDrainWriters=null),P.length===0&&(P.ended||(P.needReadable=!0),ge!==$&&P.ended&&qn(this)),me!==null&&!P.errorEmitted&&!P.closeEmitted&&(P.dataEmitted=!0,this.emit("data",me)),me};function u($,P){if(b("onEofChunk"),!P.ended){if(P.decoder){const ge=P.decoder.end();ge&&ge.length&&(P.buffer.push(ge),P.length+=P.objectMode?1:ge.length)}P.ended=!0,P.sync?f($):(P.needReadable=!1,P.emittedReadable=!0,k($))}}function f($){const P=$._readableState;b("emitReadable",P.needReadable,P.emittedReadable),P.needReadable=!1,P.emittedReadable||(b("emitReadable",P.flowing),P.emittedReadable=!0,n.nextTick(k,$))}function k($){const P=$._readableState;b("emitReadable_",P.destroyed,P.length,P.ended),!P.destroyed&&!P.errored&&(P.length||P.ended)&&($.emit("readable"),P.emittedReadable=!1),P.needReadable=!P.flowing&&!P.ended&&P.length<=P.highWaterMark,Ie($)}function J($,P){!P.readingMore&&P.constructed&&(P.readingMore=!0,n.nextTick(ie,$,P))}function ie($,P){for(;!P.reading&&!P.ended&&(P.length<P.highWaterMark||P.flowing&&P.length===0);){const ge=P.length;if(b("maybeReadMore read 0"),$.read(0),ge===P.length)break}P.readingMore=!1}se.prototype._read=function($){throw new R("_read()")},se.prototype.pipe=function($,P){const ge=this,ye=this._readableState;ye.pipes.length===1&&(ye.multiAwaitDrain||(ye.multiAwaitDrain=!0,ye.awaitDrainWriters=new d(ye.awaitDrainWriters?[ye.awaitDrainWriters]:[]))),ye.pipes.push($),b("pipe count=%d opts=%j",ye.pipes.length,P);const Be=(!P||P.end!==!1)&&$!==n.stdout&&$!==n.stderr?xa:hr;ye.endEmitted?n.nextTick(Be):ge.once("end",Be),$.on("unpipe",Ye);function Ye(jt,pt){b("onunpipe"),jt===ge&&pt&&pt.hasUnpiped===!1&&(pt.hasUnpiped=!0,_c())}function xa(){b("onend"),$.end()}let Lt,Sa=!1;function _c(){b("cleanup"),$.removeListener("close",Un),$.removeListener("finish",Hn),Lt&&$.removeListener("drain",Lt),$.removeListener("error",Fn),$.removeListener("unpipe",Ye),ge.removeListener("end",xa),ge.removeListener("end",hr),ge.removeListener("data",Ia),Sa=!0,Lt&&ye.awaitDrainWriters&&(!$._writableState||$._writableState.needDrain)&&Lt()}function Ea(){Sa||(ye.pipes.length===1&&ye.pipes[0]===$?(b("false write response, pause",0),ye.awaitDrainWriters=$,ye.multiAwaitDrain=!1):ye.pipes.length>1&&ye.pipes.includes($)&&(b("false write response, pause",ye.awaitDrainWriters.size),ye.awaitDrainWriters.add($)),ge.pause()),Lt||(Lt=oe(ge,$),$.on("drain",Lt))}ge.on("data",Ia);function Ia(jt){b("ondata");const pt=$.write(jt);b("dest.write",pt),pt===!1&&Ea()}function Fn(jt){if(b("onerror",jt),hr(),$.removeListener("error",Fn),$.listenerCount("error")===0){const pt=$._writableState||$._readableState;pt&&!pt.errorEmitted?v($,jt):$.emit("error",jt)}}_($,"error",Fn);function Un(){$.removeListener("finish",Hn),hr()}$.once("close",Un);function Hn(){b("onfinish"),$.removeListener("close",Un),hr()}$.once("finish",Hn);function hr(){b("unpipe"),ge.unpipe($)}return $.emit("pipe",ge),$.writableNeedDrain===!0?Ea():ye.flowing||(b("pipe resume"),ge.resume()),$};function oe($,P){return function(){const ye=$._readableState;ye.awaitDrainWriters===P?(b("pipeOnDrain",1),ye.awaitDrainWriters=null):ye.multiAwaitDrain&&(b("pipeOnDrain",ye.awaitDrainWriters.size),ye.awaitDrainWriters.delete(P)),(!ye.awaitDrainWriters||ye.awaitDrainWriters.size===0)&&$.listenerCount("data")&&$.resume()}}se.prototype.unpipe=function($){const P=this._readableState,ge={hasUnpiped:!1};if(P.pipes.length===0)return this;if(!$){const me=P.pipes;P.pipes=[],this.pause();for(let Be=0;Be<me.length;Be++)me[Be].emit("unpipe",this,{hasUnpiped:!1});return this}const ye=e(P.pipes,$);return ye===-1?this:(P.pipes.splice(ye,1),P.pipes.length===0&&this.pause(),$.emit("unpipe",this,ge),this)},se.prototype.on=function($,P){const ge=m.prototype.on.call(this,$,P),ye=this._readableState;return $==="data"?(ye.readableListening=this.listenerCount("readable")>0,ye.flowing!==!1&&this.resume()):$==="readable"&&!ye.endEmitted&&!ye.readableListening&&(ye.readableListening=ye.needReadable=!0,ye.flowing=!1,ye.emittedReadable=!1,b("on readable",ye.length,ye.reading),ye.length?f(this):ye.reading||n.nextTick(Le,this)),ge},se.prototype.addListener=se.prototype.on,se.prototype.removeListener=function($,P){const ge=m.prototype.removeListener.call(this,$,P);return $==="readable"&&n.nextTick(we,this),ge},se.prototype.off=se.prototype.removeListener,se.prototype.removeAllListeners=function($){const P=m.prototype.removeAllListeners.apply(this,arguments);return($==="readable"||$===void 0)&&n.nextTick(we,this),P};function we($){const P=$._readableState;P.readableListening=$.listenerCount("readable")>0,P.resumeScheduled&&P[L]===!1?P.flowing=!0:$.listenerCount("data")>0?$.resume():P.readableListening||(P.flowing=null)}function Le($){b("readable nexttick read 0"),$.read(0)}se.prototype.resume=function(){const $=this._readableState;return $.flowing||(b("resume"),$.flowing=!$.readableListening,Te(this,$)),$[L]=!1,this};function Te($,P){P.resumeScheduled||(P.resumeScheduled=!0,n.nextTick(je,$,P))}function je($,P){b("resume",P.reading),P.reading||$.read(0),P.resumeScheduled=!1,$.emit("resume"),Ie($),P.flowing&&!P.reading&&$.read(0)}se.prototype.pause=function(){return b("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(b("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[L]=!0,this};function Ie($){const P=$._readableState;for(b("flow",P.flowing);P.flowing&&$.read()!==null;);}se.prototype.wrap=function($){let P=!1;$.on("data",ye=>{!this.push(ye)&&$.pause&&(P=!0,$.pause())}),$.on("end",()=>{this.push(null)}),$.on("error",ye=>{v(this,ye)}),$.on("close",()=>{this.destroy()}),$.on("destroy",()=>{this.destroy()}),this._read=()=>{P&&$.resume&&(P=!1,$.resume())};const ge=a($);for(let ye=1;ye<ge.length;ye++){const me=ge[ye];this[me]===void 0&&typeof $[me]=="function"&&(this[me]=$[me].bind($))}return this},se.prototype[y]=function(){return wa(this)},se.prototype.iterator=function($){return $!==void 0&&Y($,"options"),wa(this,$)};function wa($,P){typeof $.read!="function"&&($=se.wrap($,{objectMode:!0}));const ge=bc($,P);return ge.stream=$,ge}async function*bc($,P){let ge=K;function ye(Ye){this===$?(ge(),ge=K):ge=Ye}$.on("readable",ye);let me;const Be=I($,{writable:!1},Ye=>{me=Ye?T(me,Ye):null,ge(),ge=K});try{for(;;){const Ye=$.destroyed?null:$.read();if(Ye!==null)yield Ye;else{if(me)throw me;if(me===null)return;await new l(ye)}}}catch(Ye){throw me=T(me,Ye),me}finally{(me||P?.destroyOnReturn!==!1)&&(me===void 0||$._readableState.autoDestroy)?p.destroyer($,null):($.off("readable",ye),Be())}}s(se.prototype,{readable:{__proto__:null,get(){const $=this._readableState;return!!$&&$.readable!==!1&&!$.destroyed&&!$.errorEmitted&&!$.endEmitted},set($){this._readableState&&(this._readableState.readable=!!$)}},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($){this._readableState&&(this._readableState.flowing=$)}},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($){this._readableState&&(this._readableState.destroyed=$)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(he.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[L]!==!1},set($){this[L]=!!$}}}),se._fromList=va;function va($,P){if(P.length===0)return null;let ge;return P.objectMode?ge=P.buffer.shift():!$||$>=P.length?(P.decoder?ge=P.buffer.join(""):P.buffer.length===1?ge=P.buffer.first():ge=P.buffer.concat(P.length),P.buffer.clear()):ge=P.buffer.consume($,P.decoder),ge}function qn($){const P=$._readableState;b("endReadable",P.endEmitted),P.endEmitted||(P.ended=!0,n.nextTick(wc,P,$))}function wc($,P){if(b("endReadableNT",$.endEmitted,$.length),!$.errored&&!$.closeEmitted&&!$.endEmitted&&$.length===0){if($.endEmitted=!0,P.emit("end"),P.writable&&P.allowHalfOpen===!1)n.nextTick(vc,P);else if($.autoDestroy){const ge=P._writableState;(!ge||ge.autoDestroy&&(ge.finished||ge.writable===!1))&&P.destroy()}}}function vc($){$.writable&&!$.writableEnded&&!$.destroyed&&$.end()}se.from=function($,P){return C(se,$,P)};let Bn;function _a(){return Bn===void 0&&(Bn={}),Bn}return se.fromWeb=function($,P){return _a().newStreamReadableFromReadableStream($,P)},se.toWeb=function($,P){return _a().newReadableStreamFromStreamReadable($,P)},se.wrap=function($,P){var ge,ye;return new se({objectMode:(ge=(ye=$.readableObjectMode)!==null&&ye!==void 0?ye:$.objectMode)!==null&&ge!==void 0?ge:!0,...P,destroy(me,Be){p.destroyer($,me),Be(me)}}).wrap($)},li}var ui,to;function Hs(){if(to)return ui;to=1;const n=Vt(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:l,SymbolHasInstance:d}=$e();ui=Y,Y.WritableState=A;const{EventEmitter:h}=Tn(),y=Us().Stream,{Buffer:w}=bt(),g=ur(),{addAbortSignal:m}=An(),{getHighWaterMark:_,getDefaultHighWaterMark:x}=Ln(),{ERR_INVALID_ARG_TYPE:S,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_MULTIPLE_CALLBACK:b,ERR_STREAM_CANNOT_PIPE:c,ERR_STREAM_DESTROYED:p,ERR_STREAM_ALREADY_FINISHED:N,ERR_STREAM_NULL_VALUES:D,ERR_STREAM_WRITE_AFTER_END:T,ERR_UNKNOWN_ENCODING:q}=Ve().codes,{errorOrDestroy:R}=g;a(Y.prototype,y.prototype),a(Y,y);function M(){}const B=l("kOnFinished");function A(O,G,re){typeof re!="boolean"&&(re=G instanceof yt()),this.objectMode=!!(O&&O.objectMode),re&&(this.objectMode=this.objectMode||!!(O&&O.writableObjectMode)),this.highWaterMark=O?_(this,O,"writableHighWaterMark",re):x(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const ue=!!(O&&O.decodeStrings===!1);this.decodeStrings=!ue,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=v.bind(void 0,G),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,j(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!O||O.emitClose!==!1,this.autoDestroy=!O||O.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[B]=[]}function j(O){O.buffered=[],O.bufferedIndex=0,O.allBuffers=!0,O.allNoop=!0}A.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(A.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Y(O){const G=this instanceof yt();if(!G&&!r(Y,this))return new Y(O);this._writableState=new A(O,this,G),O&&(typeof O.write=="function"&&(this._write=O.write),typeof O.writev=="function"&&(this._writev=O.writev),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.final=="function"&&(this._final=O.final),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&m(O.signal,this)),y.call(this,O),g.construct(this,()=>{const re=this._writableState;re.writing||ae(this,re),F(this,re)})}i(Y,d,{__proto__:null,value:function(O){return r(this,O)?!0:this!==Y?!1:O&&O._writableState instanceof A}}),Y.prototype.pipe=function(){R(this,new c)};function L(O,G,re,ue){const de=O._writableState;if(typeof re=="function")ue=re,re=de.defaultEncoding;else{if(!re)re=de.defaultEncoding;else if(re!=="buffer"&&!w.isEncoding(re))throw new q(re);typeof ue!="function"&&(ue=M)}if(G===null)throw new D;if(!de.objectMode)if(typeof G=="string")de.decodeStrings!==!1&&(G=w.from(G,re),re="buffer");else if(G instanceof w)re="buffer";else if(y._isUint8Array(G))G=y._uint8ArrayToBuffer(G),re="buffer";else throw new S("chunk",["string","Buffer","Uint8Array"],G);let pe;return de.ending?pe=new T:de.destroyed&&(pe=new p("write")),pe?(n.nextTick(ue,pe),R(O,pe,!0),pe):(de.pendingcb++,ee(O,de,G,re,ue))}Y.prototype.write=function(O,G,re){return L(this,O,G,re)===!0},Y.prototype.cork=function(){this._writableState.corked++},Y.prototype.uncork=function(){const O=this._writableState;O.corked&&(O.corked--,O.writing||ae(this,O))},Y.prototype.setDefaultEncoding=function(G){if(typeof G=="string"&&(G=o(G)),!w.isEncoding(G))throw new q(G);return this._writableState.defaultEncoding=G,this};function ee(O,G,re,ue,de){const pe=G.objectMode?1:re.length;G.length+=pe;const X=G.length<G.highWaterMark;return X||(G.needDrain=!0),G.writing||G.corked||G.errored||!G.constructed?(G.buffered.push({chunk:re,encoding:ue,callback:de}),G.allBuffers&&ue!=="buffer"&&(G.allBuffers=!1),G.allNoop&&de!==M&&(G.allNoop=!1)):(G.writelen=pe,G.writecb=de,G.writing=!0,G.sync=!0,O._write(re,ue,G.onwrite),G.sync=!1),X&&!G.errored&&!G.destroyed}function C(O,G,re,ue,de,pe,X){G.writelen=ue,G.writecb=X,G.writing=!0,G.sync=!0,G.destroyed?G.onwrite(new p("write")):re?O._writev(de,G.onwrite):O._write(de,pe,G.onwrite),G.sync=!1}function K(O,G,re,ue){--G.pendingcb,ue(re),z(G),R(O,re)}function v(O,G){const re=O._writableState,ue=re.sync,de=re.writecb;if(typeof de!="function"){R(O,new b);return}re.writing=!1,re.writecb=null,re.length-=re.writelen,re.writelen=0,G?(G.stack,re.errored||(re.errored=G),O._readableState&&!O._readableState.errored&&(O._readableState.errored=G),ue?n.nextTick(K,O,re,G,de):K(O,re,G,de)):(re.buffered.length>re.bufferedIndex&&ae(O,re),ue?re.afterWriteTickInfo!==null&&re.afterWriteTickInfo.cb===de?re.afterWriteTickInfo.count++:(re.afterWriteTickInfo={count:1,cb:de,stream:O,state:re},n.nextTick(U,re.afterWriteTickInfo)):Q(O,re,1,de))}function U({stream:O,state:G,count:re,cb:ue}){return G.afterWriteTickInfo=null,Q(O,G,re,ue)}function Q(O,G,re,ue){for(!G.ending&&!O.destroyed&&G.length===0&&G.needDrain&&(G.needDrain=!1,O.emit("drain"));re-- >0;)G.pendingcb--,ue();G.destroyed&&z(G),F(O,G)}function z(O){if(O.writing)return;for(let de=O.bufferedIndex;de<O.buffered.length;++de){var G;const{chunk:pe,callback:X}=O.buffered[de],le=O.objectMode?1:pe.length;O.length-=le,X((G=O.errored)!==null&&G!==void 0?G:new p("write"))}const re=O[B].splice(0);for(let de=0;de<re.length;de++){var ue;re[de]((ue=O.errored)!==null&&ue!==void 0?ue:new p("end"))}j(O)}function ae(O,G){if(G.corked||G.bufferProcessing||G.destroyed||!G.constructed)return;const{buffered:re,bufferedIndex:ue,objectMode:de}=G,pe=re.length-ue;if(!pe)return;let X=ue;if(G.bufferProcessing=!0,pe>1&&O._writev){G.pendingcb-=pe-1;const le=G.allNoop?M:se=>{for(let Ee=X;Ee<re.length;++Ee)re[Ee].callback(se)},he=G.allNoop&&X===0?re:e(re,X);he.allBuffers=G.allBuffers,C(O,G,!0,G.length,he,"",le),j(G)}else{do{const{chunk:le,encoding:he,callback:se}=re[X];re[X++]=null;const Ee=de?1:le.length;C(O,G,!1,Ee,le,he,se)}while(X<re.length&&!G.writing);X===re.length?j(G):X>256?(re.splice(0,X),G.bufferedIndex=0):G.bufferedIndex=X}G.bufferProcessing=!1}Y.prototype._write=function(O,G,re){if(this._writev)this._writev([{chunk:O,encoding:G}],re);else throw new I("_write()")},Y.prototype._writev=null,Y.prototype.end=function(O,G,re){const ue=this._writableState;typeof O=="function"?(re=O,O=null,G=null):typeof G=="function"&&(re=G,G=null);let de;if(O!=null){const pe=L(this,O,G);pe instanceof t&&(de=pe)}return ue.corked&&(ue.corked=1,this.uncork()),de||(!ue.errored&&!ue.ending?(ue.ending=!0,F(this,ue,!0),ue.ended=!0):ue.finished?de=new N("end"):ue.destroyed&&(de=new p("end"))),typeof re=="function"&&(de||ue.finished?n.nextTick(re,de):ue[B].push(re)),this};function H(O){return O.ending&&!O.destroyed&&O.constructed&&O.length===0&&!O.errored&&O.buffered.length===0&&!O.finished&&!O.writing&&!O.errorEmitted&&!O.closeEmitted}function V(O,G){let re=!1;function ue(de){if(re){R(O,de??b());return}if(re=!0,G.pendingcb--,de){const pe=G[B].splice(0);for(let X=0;X<pe.length;X++)pe[X](de);R(O,de,G.sync)}else H(G)&&(G.prefinished=!0,O.emit("prefinish"),G.pendingcb++,n.nextTick(Z,O,G))}G.sync=!0,G.pendingcb++;try{O._final(ue)}catch(de){ue(de)}G.sync=!1}function W(O,G){!G.prefinished&&!G.finalCalled&&(typeof O._final=="function"&&!G.destroyed?(G.finalCalled=!0,V(O,G)):(G.prefinished=!0,O.emit("prefinish")))}function F(O,G,re){H(G)&&(W(O,G),G.pendingcb===0&&(re?(G.pendingcb++,n.nextTick((ue,de)=>{H(de)?Z(ue,de):de.pendingcb--},O,G)):H(G)&&(G.pendingcb++,Z(O,G))))}function Z(O,G){G.pendingcb--,G.finished=!0;const re=G[B].splice(0);for(let ue=0;ue<re.length;ue++)re[ue]();if(O.emit("finish"),G.autoDestroy){const ue=O._readableState;(!ue||ue.autoDestroy&&(ue.endEmitted||ue.readable===!1))&&O.destroy()}}s(Y.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(O){this._writableState&&(this._writableState.destroyed=O)}},writable:{__proto__:null,get(){const O=this._writableState;return!!O&&O.writable!==!1&&!O.destroyed&&!O.errored&&!O.ending&&!O.ended},set(O){this._writableState&&(this._writableState.writable=!!O)}},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 O=this._writableState;return O?!O.destroyed&&!O.ending&&O.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 te=g.destroy;Y.prototype.destroy=function(O,G){const re=this._writableState;return!re.destroyed&&(re.bufferedIndex<re.buffered.length||re[B].length)&&n.nextTick(z,re),te.call(this,O,G),this},Y.prototype._undestroy=g.undestroy,Y.prototype._destroy=function(O,G){G(O)},Y.prototype[h.captureRejectionSymbol]=function(O){this.destroy(O)};let ce;function fe(){return ce===void 0&&(ce={}),ce}return Y.fromWeb=function(O,G){return fe().newStreamWritableFromWritableStream(O,G)},Y.toWeb=function(O){return fe().newWritableStreamFromStreamWritable(O)},ui}var ci,ro;function Wc(){if(ro)return ci;ro=1;const n=Vt(),e=bt(),{isReadable:t,isWritable:r,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:l,isReadableStream:d,isWritableStream:h}=wt(),y=Tt(),{AbortError:w,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:m}}=Ve(),{destroyer:_}=ur(),x=yt(),S=jn(),I=Hs(),{createDeferredPromise:b}=ze(),c=wu(),p=globalThis.Blob||e.Blob,N=typeof p<"u"?function(A){return A instanceof p}:function(A){return!1},D=globalThis.AbortController||Gr().AbortController,{FunctionPrototypeCall:T}=$e();class q extends x{constructor(A){super(A),A?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),A?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}ci=function B(A,j){if(l(A))return A;if(a(A))return M({readable:A});if(o(A))return M({writable:A});if(s(A))return M({writable:!1,readable:!1});if(d(A))return M({readable:S.fromWeb(A)});if(h(A))return M({writable:I.fromWeb(A)});if(typeof A=="function"){const{value:L,write:ee,final:C,destroy:K}=R(A);if(i(L))return c(q,L,{objectMode:!0,write:ee,final:C,destroy:K});const v=L?.then;if(typeof v=="function"){let U;const Q=T(v,L,z=>{if(z!=null)throw new m("nully","body",z)},z=>{_(U,z)});return U=new q({objectMode:!0,readable:!1,write:ee,final(z){C(async()=>{try{await Q,n.nextTick(z,null)}catch(ae){n.nextTick(z,ae)}})},destroy:K})}throw new m("Iterable, AsyncIterable or AsyncFunction",j,L)}if(N(A))return B(A.arrayBuffer());if(i(A))return c(q,A,{objectMode:!0,writable:!1});if(d(A?.readable)&&h(A?.writable))return q.fromWeb(A);if(typeof A?.writable=="object"||typeof A?.readable=="object"){const L=A!=null&&A.readable?a(A?.readable)?A?.readable:B(A.readable):void 0,ee=A!=null&&A.writable?o(A?.writable)?A?.writable:B(A.writable):void 0;return M({readable:L,writable:ee})}const Y=A?.then;if(typeof Y=="function"){let L;return T(Y,A,ee=>{ee!=null&&L.push(ee),L.push(null)},ee=>{_(L,ee)}),L=new q({objectMode:!0,writable:!1,read(){}})}throw new g(j,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],A)};function R(B){let{promise:A,resolve:j}=b();const Y=new D,L=Y.signal;return{value:B(async function*(){for(;;){const C=A;A=null;const{chunk:K,done:v,cb:U}=await C;if(n.nextTick(U),v)return;if(L.aborted)throw new w(void 0,{cause:L.reason});({promise:A,resolve:j}=b()),yield K}}(),{signal:L}),write(C,K,v){const U=j;j=null,U({chunk:C,done:!1,cb:v})},final(C){const K=j;j=null,K({done:!0,cb:C})},destroy(C,K){Y.abort(),K(C)}}}function M(B){const A=B.readable&&typeof B.readable.read!="function"?S.wrap(B.readable):B.readable,j=B.writable;let Y=!!t(A),L=!!r(j),ee,C,K,v,U;function Q(z){const ae=v;v=null,ae?ae(z):z&&U.destroy(z)}return U=new q({readableObjectMode:!!(A!=null&&A.readableObjectMode),writableObjectMode:!!(j!=null&&j.writableObjectMode),readable:Y,writable:L}),L&&(y(j,z=>{L=!1,z&&_(A,z),Q(z)}),U._write=function(z,ae,H){j.write(z,ae)?H():ee=H},U._final=function(z){j.end(),C=z},j.on("drain",function(){if(ee){const z=ee;ee=null,z()}}),j.on("finish",function(){if(C){const z=C;C=null,z()}})),Y&&(y(A,z=>{Y=!1,z&&_(A,z),Q(z)}),A.on("readable",function(){if(K){const z=K;K=null,z()}}),A.on("end",function(){U.push(null)}),U._read=function(){for(;;){const z=A.read();if(z===null){K=U._read;return}if(!U.push(z))return}}),U._destroy=function(z,ae){!z&&v!==null&&(z=new w),K=null,ee=null,C=null,v===null?ae(z):(v=ae,_(j,z),_(A,z))},U}return ci}var di,no;function yt(){if(no)return di;no=1;const{ObjectDefineProperties:n,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=$e();di=a;const i=jn(),s=Hs();r(a.prototype,i.prototype),r(a,i);{const h=t(s.prototype);for(let y=0;y<h.length;y++){const w=h[y];a.prototype[w]||(a.prototype[w]=s.prototype[w])}}function a(h){if(!(this instanceof a))return new a(h);i.call(this,h),s.call(this,h),h?(this.allowHalfOpen=h.allowHalfOpen!==!1,h.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),h.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n(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(h){this._readableState&&this._writableState&&(this._readableState.destroyed=h,this._writableState.destroyed=h)}}});let o;function l(){return o===void 0&&(o={}),o}a.fromWeb=function(h,y){return l().newStreamDuplexFromReadableWritablePair(h,y)},a.toWeb=function(h){return l().newReadableWritablePairFromDuplex(h)};let d;return a.from=function(h){return d||(d=Wc()),d(h,"body")},di}var fi,io;function vu(){if(io)return fi;io=1;const{ObjectSetPrototypeOf:n,Symbol:e}=$e();fi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=Ve().codes,r=yt(),{getHighWaterMark:i}=Ln();n(a.prototype,r.prototype),n(a,r);const s=e("kCallback");function a(d){if(!(this instanceof a))return new a(d);const h=d?i(this,d,"readableHighWaterMark",!0):null;h===0&&(d={...d,highWaterMark:null,readableHighWaterMark:h,writableHighWaterMark:d.writableHighWaterMark||0}),r.call(this,d),this._readableState.sync=!1,this[s]=null,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",l)}function o(d){typeof this._flush=="function"&&!this.destroyed?this._flush((h,y)=>{if(h){d?d(h):this.destroy(h);return}y!=null&&this.push(y),this.push(null),d&&d()}):(this.push(null),d&&d())}function l(){this._final!==o&&o.call(this)}return a.prototype._final=o,a.prototype._transform=function(d,h,y){throw new t("_transform()")},a.prototype._write=function(d,h,y){const w=this._readableState,g=this._writableState,m=w.length;this._transform(d,h,(_,x)=>{if(_){y(_);return}x!=null&&this.push(x),g.ended||m===w.length||w.length<w.highWaterMark?y():this[s]=y})},a.prototype._read=function(){if(this[s]){const d=this[s];this[s]=null,d()}},fi}var hi,so;function _u(){if(so)return hi;so=1;const{ObjectSetPrototypeOf:n}=$e();hi=t;const e=vu();n(t.prototype,e.prototype),n(t,e);function t(r){if(!(this instanceof t))return new t(r);e.call(this,r)}return t.prototype._transform=function(r,i,s){s(null,r)},hi}var pi,ao;function Vs(){if(ao)return pi;ao=1;const n=Vt(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:r,SymbolDispose:i}=$e(),s=Tt(),{once:a}=ze(),o=ur(),l=yt(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:y,ERR_MISSING_ARGS:w,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:m},AbortError:_}=Ve(),{validateFunction:x,validateAbortSignal:S}=Xr(),{isIterable:I,isReadable:b,isReadableNodeStream:c,isNodeStream:p,isTransformStream:N,isWebStream:D,isReadableStream:T,isReadableFinished:q}=wt(),R=globalThis.AbortController||Gr().AbortController;let M,B,A;function j(z,ae,H){let V=!1;z.on("close",()=>{V=!0});const W=s(z,{readable:ae,writable:H},F=>{V=!F});return{destroy:F=>{V||(V=!0,o.destroyer(z,F||new g("pipe")))},cleanup:W}}function Y(z){return x(z[z.length-1],"streams[stream.length - 1]"),z.pop()}function L(z){if(I(z))return z;if(c(z))return ee(z);throw new h("val",["Readable","Iterable","AsyncIterable"],z)}async function*ee(z){B||(B=jn()),yield*B.prototype[r].call(z)}async function C(z,ae,H,{end:V}){let W,F=null;const Z=fe=>{if(fe&&(W=fe),F){const O=F;F=null,O()}},te=()=>new t((fe,O)=>{W?O(W):F=()=>{W?O(W):fe()}});ae.on("drain",Z);const ce=s(ae,{readable:!1},Z);try{ae.writableNeedDrain&&await te();for await(const fe of z)ae.write(fe)||await te();V&&(ae.end(),await te()),H()}catch(fe){H(W!==fe?d(W,fe):fe)}finally{ce(),ae.off("drain",Z)}}async function K(z,ae,H,{end:V}){N(ae)&&(ae=ae.writable);const W=ae.getWriter();try{for await(const F of z)await W.ready,W.write(F).catch(()=>{});await W.ready,V&&await W.close(),H()}catch(F){try{await W.abort(F),H(F)}catch(Z){H(Z)}}}function v(...z){return U(z,a(Y(z)))}function U(z,ae,H){if(z.length===1&&e(z[0])&&(z=z[0]),z.length<2)throw new w("streams");const V=new R,W=V.signal,F=H?.signal,Z=[];S(F,"options.signal");function te(){de(new _)}A=A||ze().addAbortListener;let ce;F&&(ce=A(F,te));let fe,O;const G=[];let re=0;function ue(he){de(he,--re===0)}function de(he,se){var Ee;if(he&&(!fe||fe.code==="ERR_STREAM_PREMATURE_CLOSE")&&(fe=he),!(!fe&&!se)){for(;G.length;)G.shift()(fe);(Ee=ce)===null||Ee===void 0||Ee[i](),V.abort(),se&&(fe||Z.forEach(qe=>qe()),n.nextTick(ae,fe,O))}}let pe;for(let he=0;he<z.length;he++){const se=z[he],Ee=he<z.length-1,qe=he>0,_e=Ee||H?.end!==!1,He=he===z.length-1;if(p(se)){let E=function(u){u&&u.name!=="AbortError"&&u.code!=="ERR_STREAM_PREMATURE_CLOSE"&&ue(u)};if(_e){const{destroy:u,cleanup:f}=j(se,Ee,qe);G.push(u),b(se)&&He&&Z.push(f)}se.on("error",E),b(se)&&He&&Z.push(()=>{se.removeListener("error",E)})}if(he===0)if(typeof se=="function"){if(pe=se({signal:W}),!I(pe))throw new y("Iterable, AsyncIterable or Stream","source",pe)}else I(se)||c(se)||N(se)?pe=se:pe=l.from(se);else if(typeof se=="function"){if(N(pe)){var X;pe=L((X=pe)===null||X===void 0?void 0:X.readable)}else pe=L(pe);if(pe=se(pe,{signal:W}),Ee){if(!I(pe,!0))throw new y("AsyncIterable",`transform[${he-1}]`,pe)}else{var le;M||(M=_u());const E=new M({objectMode:!0}),u=(le=pe)===null||le===void 0?void 0:le.then;if(typeof u=="function")re++,u.call(pe,J=>{O=J,J!=null&&E.write(J),_e&&E.end(),n.nextTick(ue)},J=>{E.destroy(J),n.nextTick(ue,J)});else if(I(pe,!0))re++,C(pe,E,ue,{end:_e});else if(T(pe)||N(pe)){const J=pe.readable||pe;re++,C(J,E,ue,{end:_e})}else throw new y("AsyncIterable or Promise","destination",pe);pe=E;const{destroy:f,cleanup:k}=j(pe,!1,!0);G.push(f),He&&Z.push(k)}}else if(p(se)){if(c(pe)){re+=2;const E=Q(pe,se,ue,{end:_e});b(se)&&He&&Z.push(E)}else if(N(pe)||T(pe)){const E=pe.readable||pe;re++,C(E,se,ue,{end:_e})}else if(I(pe))re++,C(pe,se,ue,{end:_e});else throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],pe);pe=se}else if(D(se)){if(c(pe))re++,K(L(pe),se,ue,{end:_e});else if(T(pe)||I(pe))re++,K(pe,se,ue,{end:_e});else if(N(pe))re++,K(pe.readable,se,ue,{end:_e});else throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],pe);pe=se}else pe=l.from(se)}return(W!=null&&W.aborted||F!=null&&F.aborted)&&n.nextTick(te),pe}function Q(z,ae,H,{end:V}){let W=!1;if(ae.on("close",()=>{W||H(new m)}),z.pipe(ae,{end:!1}),V){let F=function(){W=!0,ae.end()};q(z)?n.nextTick(F):z.once("end",F)}else H();return s(z,{readable:!0,writable:!1},F=>{const Z=z._readableState;F&&F.code==="ERR_STREAM_PREMATURE_CLOSE"&&Z&&Z.ended&&!Z.errored&&!Z.errorEmitted?z.once("end",H).once("error",H):H(F)}),s(ae,{readable:!1,writable:!0},H)}return pi={pipelineImpl:U,pipeline:v},pi}var gi,oo;function xu(){if(oo)return gi;oo=1;const{pipeline:n}=Vs(),e=yt(),{destroyer:t}=ur(),{isNodeStream:r,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:l,isReadableStream:d}=wt(),{AbortError:h,codes:{ERR_INVALID_ARG_VALUE:y,ERR_MISSING_ARGS:w}}=Ve(),g=Tt();return gi=function(..._){if(_.length===0)throw new w("streams");if(_.length===1)return e.from(_[0]);const x=[..._];if(typeof _[0]=="function"&&(_[0]=e.from(_[0])),typeof _[_.length-1]=="function"){const M=_.length-1;_[M]=e.from(_[M])}for(let M=0;M<_.length;++M)if(!(!r(_[M])&&!a(_[M]))){if(M<_.length-1&&!(i(_[M])||d(_[M])||o(_[M])))throw new y(`streams[${M}]`,x[M],"must be readable");if(M>0&&!(s(_[M])||l(_[M])||o(_[M])))throw new y(`streams[${M}]`,x[M],"must be writable")}let S,I,b,c,p;function N(M){const B=c;c=null,B?B(M):M?p.destroy(M):!R&&!q&&p.destroy()}const D=_[0],T=n(_,N),q=!!(s(D)||l(D)||o(D)),R=!!(i(T)||d(T)||o(T));if(p=new e({writableObjectMode:!!(D!=null&&D.writableObjectMode),readableObjectMode:!!(T!=null&&T.readableObjectMode),writable:q,readable:R}),q){if(r(D))p._write=function(B,A,j){D.write(B,A)?j():S=j},p._final=function(B){D.end(),I=B},D.on("drain",function(){if(S){const B=S;S=null,B()}});else if(a(D)){const A=(o(D)?D.writable:D).getWriter();p._write=async function(j,Y,L){try{await A.ready,A.write(j).catch(()=>{}),L()}catch(ee){L(ee)}},p._final=async function(j){try{await A.ready,A.close().catch(()=>{}),I=j}catch(Y){j(Y)}}}const M=o(T)?T.readable:T;g(M,()=>{if(I){const B=I;I=null,B()}})}if(R){if(r(T))T.on("readable",function(){if(b){const M=b;b=null,M()}}),T.on("end",function(){p.push(null)}),p._read=function(){for(;;){const M=T.read();if(M===null){b=p._read;return}if(!p.push(M))return}};else if(a(T)){const B=(o(T)?T.readable:T).getReader();p._read=async function(){for(;;)try{const{value:A,done:j}=await B.read();if(!p.push(A))return;if(j){p.push(null);return}}catch{return}}}}return p._destroy=function(M,B){!M&&c!==null&&(M=new h),b=null,S=null,I=null,c===null?B(M):(c=B,r(T)&&t(T,M))},p},gi}var lo;function zc(){if(lo)return sn;lo=1;const n=globalThis.AbortController||Gr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:r,ERR_OUT_OF_RANGE:i},AbortError:s}=Ve(),{validateAbortSignal:a,validateInteger:o,validateObject:l}=Xr(),d=$e().Symbol("kWeak"),h=$e().Symbol("kResistStopPropagation"),{finished:y}=Tt(),w=xu(),{addAbortSignalNoValidate:g}=An(),{isWritable:m,isNodeStream:_}=wt(),{deprecate:x}=ze(),{ArrayPrototypePush:S,Boolean:I,MathFloor:b,Number:c,NumberIsNaN:p,Promise:N,PromiseReject:D,PromiseResolve:T,PromisePrototypeThen:q,Symbol:R}=$e(),M=R("kEmpty"),B=R("kEof");function A(F,Z){if(Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),_(F)&&!m(F))throw new e("stream",F,"must be writable");const te=w(this,F);return Z!=null&&Z.signal&&g(Z.signal,te),te}function j(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal");let te=1;Z?.concurrency!=null&&(te=b(Z.concurrency));let ce=te-1;return Z?.highWaterMark!=null&&(ce=b(Z.highWaterMark)),o(te,"options.concurrency",1),o(ce,"options.highWaterMark",0),ce+=te,(async function*(){const O=ze().AbortSignalAny([Z?.signal].filter(I)),G=this,re=[],ue={signal:O};let de,pe,X=!1,le=0;function he(){X=!0,se()}function se(){le-=1,Ee()}function Ee(){pe&&!X&&le<te&&re.length<ce&&(pe(),pe=null)}async function qe(){try{for await(let _e of G){if(X)return;if(O.aborted)throw new s;try{if(_e=F(_e,ue),_e===M)continue;_e=T(_e)}catch(He){_e=D(He)}le+=1,q(_e,se,he),re.push(_e),de&&(de(),de=null),!X&&(re.length>=ce||le>=te)&&await new N(He=>{pe=He})}re.push(B)}catch(_e){const He=D(_e);q(He,se,he),re.push(He)}finally{X=!0,de&&(de(),de=null)}}qe();try{for(;;){for(;re.length>0;){const _e=await re[0];if(_e===B)return;if(O.aborted)throw new s;_e!==M&&(yield _e),re.shift(),Ee()}await new N(_e=>{de=_e})}}finally{X=!0,pe&&(pe(),pe=null)}}).call(this)}function Y(F=void 0){return F!=null&&l(F,"options"),F?.signal!=null&&a(F.signal,"options.signal"),(async function*(){let te=0;for await(const fe of this){var ce;if(F!=null&&(ce=F.signal)!==null&&ce!==void 0&&ce.aborted)throw new s({cause:F.signal.reason});yield[te++,fe]}}).call(this)}async function L(F,Z=void 0){for await(const te of v.call(this,F,Z))return!0;return!1}async function ee(F,Z=void 0){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);return!await L.call(this,async(...te)=>!await F(...te),Z)}async function C(F,Z){for await(const te of v.call(this,F,Z))return te}async function K(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);async function te(ce,fe){return await F(ce,fe),M}for await(const ce of j.call(this,te,Z));}function v(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);async function te(ce,fe){return await F(ce,fe)?ce:M}return j.call(this,te,Z)}class U extends r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Q(F,Z,te){var ce;if(typeof F!="function")throw new t("reducer",["Function","AsyncFunction"],F);te!=null&&l(te,"options"),te?.signal!=null&&a(te.signal,"options.signal");let fe=arguments.length>1;if(te!=null&&(ce=te.signal)!==null&&ce!==void 0&&ce.aborted){const de=new s(void 0,{cause:te.signal.reason});throw this.once("error",()=>{}),await y(this.destroy(de)),de}const O=new n,G=O.signal;if(te!=null&&te.signal){const de={once:!0,[d]:this,[h]:!0};te.signal.addEventListener("abort",()=>O.abort(),de)}let re=!1;try{for await(const de of this){var ue;if(re=!0,te!=null&&(ue=te.signal)!==null&&ue!==void 0&&ue.aborted)throw new s;fe?Z=await F(Z,de,{signal:G}):(Z=de,fe=!0)}if(!re&&!fe)throw new U}finally{O.abort()}return Z}async function z(F){F!=null&&l(F,"options"),F?.signal!=null&&a(F.signal,"options.signal");const Z=[];for await(const ce of this){var te;if(F!=null&&(te=F.signal)!==null&&te!==void 0&&te.aborted)throw new s(void 0,{cause:F.signal.reason});S(Z,ce)}return Z}function ae(F,Z){const te=j.call(this,F,Z);return(async function*(){for await(const fe of te)yield*fe}).call(this)}function H(F){if(F=c(F),p(F))return 0;if(F<0)throw new i("number",">= 0",F);return F}function V(F,Z=void 0){return Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),F=H(F),(async function*(){var ce;if(Z!=null&&(ce=Z.signal)!==null&&ce!==void 0&&ce.aborted)throw new s;for await(const O of this){var fe;if(Z!=null&&(fe=Z.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;F--<=0&&(yield O)}}).call(this)}function W(F,Z=void 0){return Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),F=H(F),(async function*(){var ce;if(Z!=null&&(ce=Z.signal)!==null&&ce!==void 0&&ce.aborted)throw new s;for await(const O of this){var fe;if(Z!=null&&(fe=Z.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;if(F-- >0&&(yield O),F<=0)return}}).call(this)}return sn.streamReturningOperators={asIndexedPairs:x(Y,"readable.asIndexedPairs will be removed in a future version."),drop:V,filter:v,flatMap:ae,map:j,take:W,compose:A},sn.promiseReturningOperators={every:ee,forEach:K,reduce:Q,toArray:z,some:L,find:C},sn}var yi,uo;function Su(){if(uo)return yi;uo=1;const{ArrayPrototypePop:n,Promise:e}=$e(),{isIterable:t,isNodeStream:r,isWebStream:i}=wt(),{pipelineImpl:s}=Vs(),{finished:a}=Tt();Eu();function o(...l){return new e((d,h)=>{let y,w;const g=l[l.length-1];if(g&&typeof g=="object"&&!r(g)&&!t(g)&&!i(g)){const m=n(l);y=m.signal,w=m.end}s(l,(m,_)=>{m?h(m):d(_)},{signal:y,end:w})})}return yi={finished:a,pipeline:o},yi}var co;function Eu(){if(co)return zn.exports;co=1;const{Buffer:n}=bt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=$e(),{promisify:{custom:i}}=ze(),{streamReturningOperators:s,promiseReturningOperators:a}=zc(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=Ve(),l=xu(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:h}=Ln(),{pipeline:y}=Vs(),{destroyer:w}=ur(),g=Tt(),m=Su(),_=wt(),x=zn.exports=Us().Stream;x.isDestroyed=_.isDestroyed,x.isDisturbed=_.isDisturbed,x.isErrored=_.isErrored,x.isReadable=_.isReadable,x.isWritable=_.isWritable,x.Readable=jn();for(const I of t(s)){let c=function(...p){if(new.target)throw o();return x.Readable.from(r(b,this,p))};const b=s[I];e(c,"name",{__proto__:null,value:b.name}),e(c,"length",{__proto__:null,value:b.length}),e(x.Readable.prototype,I,{__proto__:null,value:c,enumerable:!1,configurable:!0,writable:!0})}for(const I of t(a)){let c=function(...p){if(new.target)throw o();return r(b,this,p)};const b=a[I];e(c,"name",{__proto__:null,value:b.name}),e(c,"length",{__proto__:null,value:b.length}),e(x.Readable.prototype,I,{__proto__:null,value:c,enumerable:!1,configurable:!0,writable:!0})}x.Writable=Hs(),x.Duplex=yt(),x.Transform=vu(),x.PassThrough=_u(),x.pipeline=y;const{addAbortSignal:S}=An();return x.addAbortSignal=S,x.finished=g,x.destroy=w,x.compose=l,x.setDefaultHighWaterMark=d,x.getDefaultHighWaterMark=h,e(x,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return m}}),e(y,i,{__proto__:null,enumerable:!0,get(){return m.pipeline}}),e(g,i,{__proto__:null,enumerable:!0,get(){return m.finished}}),x.Stream=x,x._isUint8Array=function(b){return b instanceof Uint8Array},x._uint8ArrayToBuffer=function(b){return n.from(b.buffer,b.byteOffset,b.byteLength)},zn.exports}var fo;function Jc(){return fo||(fo=1,function(n){const e=Eu(),t=Su(),r=e.Readable.destroy;n.exports=e.Readable,n.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,n.exports._isUint8Array=e._isUint8Array,n.exports.isDisturbed=e.isDisturbed,n.exports.isErrored=e.isErrored,n.exports.isReadable=e.isReadable,n.exports.Readable=e.Readable,n.exports.Writable=e.Writable,n.exports.Duplex=e.Duplex,n.exports.Transform=e.Transform,n.exports.PassThrough=e.PassThrough,n.exports.addAbortSignal=e.addAbortSignal,n.exports.finished=e.finished,n.exports.destroy=e.destroy,n.exports.destroy=r,n.exports.pipeline=e.pipeline,n.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),n.exports.Stream=e.Stream,n.exports.default=n.exports}(Wn)),Wn.exports}var Iu=Jc();const mi=Symbol("iter");function Br(n,e,t=4){if(t===0)return Object.assign(n,e);for(const r in e)n[r]=Br(n[r]||Object.create(null),e[r],t-1);return n}function Ru(n,e,t=4){let r=!1;for(const i in n)if(i in e){const s=t===0?null:Ru(n[i],e[i],t-1);if(s!==!1)r=r||Object.create(null),r[i]=s;else if(t===3)return!1}return r}function Nu(n,e,t=4){let r=!1;for(const i in n)if(!(i in e))r=r||Object.create(null),r[i]=t===0?null:Br({},n[i],t-1);else if(t!==0){const s=Nu(n[i],e[i],t-1);if(s!==!1)r=r||Object.create(null),r[i]=s;else if(t===3)return!1}return r}class Qc{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||xe}_termFromId(e){if(e[0]==="."){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return Dr(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object);let s;return t&&r&&i&&(Ns(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${r}.${i}.${s}`:`.${t}.${r}.${i}`]}return this._ids[er(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${Ns(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:er(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}}class Fe{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||xe,this._entityIndex=t.entityIndex||new Qc({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 r,i;for(const s in t)for(const a in r=t[s].subjects)for(const o in i=r[a])e+=Object.keys(i[o]).length;return this._size=e}_addToIndex(e,t,r,i){const s=e[t]||(e[t]={}),a=s[r]||(s[r]={}),o=i in a;return o||(a[i]=null),!o}_removeFromIndex(e,t,r,i){const s=e[t],a=s[r];delete a[i];for(const o in a)return;delete s[r];for(const o in s)return;delete e[t]}*_findInIndex(e,t,r,i,s,a,o,l){let d,h,y;const w=this._entities,g=this._termFromId(w[l]),m={subject:null,predicate:null,object:null};t&&((d=e,e={})[t]=d[t]);for(const _ in e)if(h=e[_]){m[s]=this._termFromId(w[_]),r&&((d=h,h={})[r]=d[r]);for(const x in h)if(y=h[x]){m[a]=this._termFromId(w[x]);const S=i?i in y?[i]:[]:Object.keys(y);for(let I=0;I<S.length;I++)m[o]=this._termFromId(w[S[I]]),yield this._factory.quad(m.subject,m.predicate,m.object,g)}}}_loop(e,t){for(const r in e)t(r)}_loopByKey0(e,t,r){let i,s;if(i=e[t])for(s in i)r(s)}_loopByKey1(e,t,r){let i,s;for(i in e)s=e[i],s[t]&&r(i)}_loopBy2Keys(e,t,r,i){let s,a,o;if((s=e[t])&&(a=s[r]))for(o in a)i(o)}_countInIndex(e,t,r,i){let s=0,a,o,l;t&&((a=e,e={})[t]=a[t]);for(const d in e)if(o=e[d]){r&&((a=o,o={})[r]=a[r]);for(const h in o)(l=o[h])&&(i?i in l&&s++:s+=Object.keys(l).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 r=>{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,r,i){t||(i=e.graph,r=e.object,t=e.predicate,e=e.subject),i=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),r=this._termToNewNumericId(r),this._addToIndex(s.subjects,e,t,r)?(this._addToIndex(s.predicates,t,r,e),this._addToIndex(s.objects,r,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,r,i){return e&&e.subject&&({subject:e,predicate:t,object:r,graph:i}=e),!this.readQuads(e,t,r,i).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,r,i){t||({subject:e,predicate:t,object:r,graph:i}=e),i=i?this._termToNumericId(i):1;const s=this._graphs;let a,o,l;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(r=r&&this._termToNumericId(r))||!(a=s[i])||!(o=a.subjects[e])||!(l=o[t])||!(r in l))return!1;this._removeFromIndex(a.subjects,e,t,r),this._removeFromIndex(a.predicates,t,r,e),this._removeFromIndex(a.objects,r,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,r,i){const s=new Iu.Readable({objectMode:!0}),a=this.readQuads(e,t,r,i);return s._read=o=>{for(;--o>=0;){const{done:l,value:d}=a.next();if(l){s.push(null);return}s.push(d)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,i){return[...this.readQuads(e,t,r,i)]}*readQuads(e,t,r,i){const s=this._getGraphs(i);let a,o,l,d;if(!(e&&!(o=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||r&&!(d=this._termToNumericId(r))))for(const h in s)(a=s[h])&&(o?d?yield*this._findInIndex(a.objects,d,o,l,"object","subject","predicate",h):yield*this._findInIndex(a.subjects,o,l,null,"subject","predicate","object",h):l?yield*this._findInIndex(a.predicates,l,d,null,"predicate","object","subject",h):d?yield*this._findInIndex(a.objects,d,null,null,"object","subject","predicate",h):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",h))}match(e,t,r,i){return new St(this,e,t,r,i,{entityIndex:this._entityIndex})}countQuads(e,t,r,i){const s=this._getGraphs(i);let a=0,o,l,d,h;if(e&&!(l=this._termToNumericId(e))||t&&!(d=this._termToNumericId(t))||r&&!(h=this._termToNumericId(r)))return 0;for(const y in s)(o=s[y])&&(e?r?a+=this._countInIndex(o.objects,h,l,d):a+=this._countInIndex(o.subjects,l,d,h):t?a+=this._countInIndex(o.predicates,d,h,l):a+=this._countInIndex(o.objects,h,l,d));return a}forEach(e,t,r,i,s){this.some(a=>(e(a,this),!1),t,r,i,s)}every(e,t,r,i,s){return!this.some(a=>!e(a,this),t,r,i,s)}some(e,t,r,i,s){for(const a of this.readQuads(t,r,i,s))if(e(a,this))return!0;return!1}getSubjects(e,t,r){const i=[];return this.forSubjects(s=>{i.push(s)},e,t,r),i}forSubjects(e,t,r,i){const s=this._getGraphs(i);let a,o,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.predicates,o,l,e):this._loopByKey1(a.subjects,o,e):l?this._loopByKey0(a.objects,l,e):this._loop(a.subjects,e))}getPredicates(e,t,r){const i=[];return this.forPredicates(s=>{i.push(s)},e,t,r),i}forPredicates(e,t,r,i){const s=this._getGraphs(i);let a,o,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.objects,l,o,e):this._loopByKey0(a.subjects,o,e):l?this._loopByKey1(a.predicates,l,e):this._loop(a.predicates,e))}getObjects(e,t,r){const i=[];return this.forObjects(s=>{i.push(s)},e,t,r),i}forObjects(e,t,r,i){const s=this._getGraphs(i);let a,o,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||r&&!(l=this._termToNumericId(r))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.subjects,o,l,e):this._loopByKey1(a.objects,o,e):l?this._loopByKey0(a.predicates,l,e):this._loop(a.objects,e))}getGraphs(e,t,r){const i=[];return this.forGraphs(s=>{i.push(s)},e,t,r),i}forGraphs(e,t,r,i){for(const s in this._graphs)this.some(a=>(e(a.graph),!0),t,r,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},i=t?()=>!0:(o,l)=>{throw new Error(`${o.value} ${l}`)},s=this.getQuads(null,Pe.rdf.rest,Pe.rdf.nil,null),a=e?[...s]:[];return s.forEach(o=>{const l=[];let d=!1,h,y;const w=o.graph;let g=o.subject;for(;g&&!d;){const m=this.getQuads(null,null,g,null),_=this.getQuads(g,null,null,null);let x,S=null,I=null,b=null;for(let c=0;c<_.length&&!d;c++)x=_[c],x.graph.equals(w)?h?d=i(g,"has non-list arcs out"):x.predicate.value===Pe.rdf.first?S?d=i(g,"has multiple rdf:first arcs"):a.push(S=x):x.predicate.value===Pe.rdf.rest?I?d=i(g,"has multiple rdf:rest arcs"):a.push(I=x):m.length?d=i(g,"can't be subject and object"):(h=x,y="subject"):d=i(g,"not confined to single graph");for(let c=0;c<m.length&&!d;++c)x=m[c],h?d=i(g,"can't have coreferences"):x.predicate.value===Pe.rdf.rest?b?d=i(g,"has incoming rdf:rest arcs"):b=x:(h=x,y="object");S?l.unshift(S.object):d=i(g,"has no list head"),g=b&&b.subject}d?e=!1:h&&(r[h[y].value]=l)}),e&&this.removeQuads(a),r}addAll(e){if(e instanceof St&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof Fe&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Br(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof St&&(e=e.filtered),e===this)return!0;if(!(e instanceof Fe)||this._entityIndex!==e._entityIndex)return e.every(d=>this.has(d));const t=this._graphs,r=e._graphs;let i,s,a,o,l;for(const d in r){if(!(i=t[d]))return!1;i=i.subjects;for(const h in s=r[d].subjects){if(!(a=i[h]))return!1;for(const y in o=s[h]){if(!(l=a[y]))return!1;for(const w in o[y])if(!(w in l))return!1}}}return!0}deleteMatches(e,t,r,i){for(const s of this.match(e,t,r,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof St&&(e=e.filtered),e===this)return new Fe({entityIndex:this._entityIndex});if(e instanceof Fe&&e._entityIndex===this._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),r=Nu(this._graphs,e._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof St&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new Fe({entityIndex:this._entityIndex});for(const r of this)e(r,this)&&t.add(r);return t}intersection(e){if(e instanceof St&&(e=e.filtered),e===this){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=Br(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof Fe&&this._entityIndex===e._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),r=Ru(e._graphs,this._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new Fe({entityIndex:this._entityIndex});for(const r of this)t.add(e(r,this));return t}reduce(e,t){const r=this.readQuads();let i=t===void 0?r.next().value:t;for(const s of r)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new Fs().quadsToString(this)}union(e){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=Br(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function lt(n,e,t=0){const r=e[t];if(r&&!(r in n))return!1;let i=!1;for(const s in r?{[r]:n[r]}:n){const a=t===2?null:lt(n[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class St extends Iu.Readable{constructor(e,t,r,i,s,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:i,graph:s,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:i,subject:s}=this,a=this._filtered=new Fe({factory:e._factory,entityIndex:this.options.entityIndex});let o,l,d;if(s&&!(o=a._termToNumericId(s))||i&&!(l=a._termToNumericId(i))||r&&!(d=a._termToNumericId(r)))return a;const h=e._getGraphs(t);for(const y in h){let w,g,m,_;(_=h[y])&&(!o&&l?(g=lt(_.predicates,[l,d,o]))&&(w=lt(_.subjects,[o,l,d]),m=lt(_.objects,[d,o,l])):d?(m=lt(_.objects,[d,o,l]))&&(w=lt(_.subjects,[o,l,d]),g=lt(_.predicates,[l,d,o])):(w=lt(_.subjects,[o,l,d]))&&(g=lt(_.predicates,[l,d,o]),m=lt(_.objects,[d,o,l])),w&&(a._graphs[y]={subjects:w,predicates:g,objects:m}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[mi]&&(this[mi]=this[Symbol.iterator]());const t=this[mi];for(;--e>=0;){const{done:r,value:i}=t.next();if(r){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,r,i){return this.filtered.deleteMatches(e,t,r,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,r,i,s){return this.filtered.every(e,t,r,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,t,r,i,s){return this.filtered.forEach(e,t,r,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,r,i,s){return this.filtered.some(e,t,r,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 Fs().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,r,i){return new St(this.filtered,e,t,r,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}const be="http://www.w3.org/ns/shacl#",ho="http://datashapes.org/dash#",Rt="http://www.w3.org/2001/XMLSchema#",Gs="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Ws="http://www.w3.org/2000/01/rdf-schema#",zs="http://www.w3.org/2004/02/skos/core#",Xc="http://www.w3.org/2002/07/owl#",Kc="http://www.w3.org/ns/oa#",Yc="http://purl.org/dc/terms/",Zc="http://xmlns.com/foaf/0.1/",wn=xe.namedNode("loaded-shapes"),ut=xe.namedNode("loaded-data"),Ue=xe.namedNode(Gs+"type"),Ts=xe.namedNode(Yc+"conformsTo"),ed=xe.namedNode(Ws+"subClassOf"),Js=xe.namedNode(Xc+"imports"),td=xe.namedNode(zs+"broader"),rd=xe.namedNode(zs+"narrower"),ln=xe.namedNode(be+"NodeShape"),nd=xe.namedNode(be+"IRI"),vn=xe.namedNode(be+"property"),Qs=xe.namedNode(be+"class"),Wr=xe.namedNode(be+"targetClass"),id=xe.namedNode(be+"nodeKind"),sd=xe.namedNode(Rt+"string");function Fr(n,e,t=be,r){let i="";const s=ad(n,e,t,r);return s&&(i=s.value),i}function ad(n,e,t=be,r){let i;const s=t+e;if(r?.length){for(const a of r)for(const o of n)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 n)if(a.predicate.value===s)return a.object;return i}function od(n){n.querySelector("input,select,textarea")?.focus()}function qt(n,e){return Fr(n,"prefLabel",zs,e)||Fr(n,"label",Ws,e)||Fr(n,"name",Zc,e)}function Tu(n,e,t){const r=[];for(const i of n)r.push({value:i,label:qt(e.getQuads(i,null,null,null),t),children:[]});return r}function As(n,e){for(const t in e)n=n.replace(e[t],"");return n}function Au(n,e,t,r,i=new Set){for(const s of e.owlImports)i.has(s.id)||(i.add(s.id),r.push(...t.getSubjects(Ue,n,s)));e.parent&&Au(n,e.parent,t,r,i)}function Xs(n,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return Tu(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(Ue,n,wn);t.push(...e.config.store.getSubjects(Ue,n,ut)),Au(n,e,e.config.store,t);const r=new Map,i=new Map;for(const a of t)r.set(a.id,{value:a,label:qt(e.config.store.getQuads(a,null,null,null),e.config.languages),children:[]});for(const a of t)Ls(a,r,i,e);for(const[a,o]of i.entries())r.get(o).children.push(r.get(a));const s=[];for(const[a,o]of r.entries())i.has(a)||s.push(o);for(const a of e.config.store.getSubjects(ed,n,null))s.push(...Xs(a,e));return s}}function Ls(n,e,t,r){for(const i of r.config.store.getObjects(n,td,null))t.set(n.id,i.id),e.has(i.id)||e.set(i.id,{value:i,label:qt(r.config.store.getQuads(i,null,null,null),r.config.languages),children:[]}),Ls(i,e,t,r);for(const i of r.config.store.getObjects(n,rd,null))t.set(i.id,n.id),e.has(i.id)||e.set(i.id,{value:i,label:qt(r.config.store.getQuads(i,null,null,null),r.config.languages),children:[]}),Ls(i,e,t,r)}function js(n){let e;try{e=new URL(n)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function po(n,e,t){if(e===void 0)return t;if(t===void 0)return e;const r=n.indexOf(e.language);if(r<0)return t;const i=n.indexOf(t.language);return i<0||i>r?e:t}function Lu(n,e,t){const r=document.createElement("div");r.classList.add("shacl-or-constraint");const i=[];if(e instanceof Nt){const s=[];let a=!1;n.length&&(a=t.store.countQuads(n[0],vn,null,null)>0);for(let d=0;d<n.length;d++)if(a){const h=t.store.getObjects(n[d],vn,null),y=[];let w="";for(const g of h){const m=new Sn(g,e,t);y.push(m),w+=(w.length>1?" / ":"")+m.template.label}s.push(y),i.push({label:w,value:d.toString()})}else{const h=new Sn(n[d],e,t);s.push([h]),i.push({label:h.template.label,value:d.toString()})}const o=t.theme.createListEditor("Please choose",null,!1,i),l=o.querySelector(".editor");l.onchange=()=>{if(l.value){const d=s[parseInt(l.value)];let h;d.length&&(h=d[0],r.replaceWith(d[0]));for(let y=1;y<d.length;y++)h.after(d[y]),h=d[y]}},r.appendChild(o)}else{const s=[];for(let l=0;l<n.length;l++){const d=t.store.getQuads(n[l],null,null,null);d.length&&(s.push(d),i.push({label:qt(d,t.languages)||As(d[0].predicate.value,t.prefixes)+" = "+As(d[0].object.value,t.prefixes),value:l.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,i,e.template),o=a.querySelector(".editor");o.onchange=()=>{o.value&&r.replaceWith(gn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},r.appendChild(a)}return r}function ld(n,e,t){if(e instanceof Ze){const r=e.datatype;for(const i of n){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(a.predicate.value===`${be}datatype`&&a.object.equals(r))return s}}else{const r=t.store.getObjects(e,Ue,null);for(const i of n){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(r.length>0){if(a.predicate.value===`${be}node`){for(const o of r)if(t.store.getQuads(a.object,Wr,o,null).length>0)return s}if(a.predicate.equals(Qs)){for(const o of r)if(a.object.equals(o))return s}}else if(a.predicate.equals(id)&&a.object.equals(nd))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function ud(n,e,t){for(const r of n){let i=!1;const s=t.store.getObjects(r,vn,null);for(const a of s){const o=t.store.getObjects(a,`${be}path`,null);for(const l of o)if(i=t.store.countQuads(e,l,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 cd={[`${be}name`]:(n,e)=>{const t=e;n.name=po(n.config.languages,n.name,t)},[`${be}description`]:(n,e)=>{const t=e;n.description=po(n.config.languages,n.description,t)},[`${be}path`]:(n,e)=>{n.path=e.value},[`${be}node`]:(n,e)=>{n.node=e},[`${be}datatype`]:(n,e)=>{n.datatype=e},[`${be}nodeKind`]:(n,e)=>{n.nodeKind=e},[`${be}minCount`]:(n,e)=>{n.minCount=parseInt(e.value)},[`${be}maxCount`]:(n,e)=>{n.maxCount=parseInt(e.value)},[`${be}minLength`]:(n,e)=>{n.minLength=parseInt(e.value)},[`${be}maxLength`]:(n,e)=>{n.maxLength=parseInt(e.value)},[`${be}minInclusive`]:(n,e)=>{n.minInclusive=parseInt(e.value)},[`${be}maxInclusive`]:(n,e)=>{n.maxInclusive=parseInt(e.value)},[`${be}minExclusive`]:(n,e)=>{n.minExclusive=parseInt(e.value)},[`${be}maxExclusive`]:(n,e)=>{n.maxExclusive=parseInt(e.value)},[`${be}pattern`]:(n,e)=>{n.pattern=e.value},[`${be}order`]:(n,e)=>{n.order=parseInt(e.value)},[`${ho}singleLine`]:(n,e)=>{n.singleLine=e.value==="true"},[`${ho}readonly`]:(n,e)=>{n.readonly=e.value==="true"},[`${Kc}styleClass`]:(n,e)=>{n.cssClass=e.value},[`${be}and`]:(n,e)=>{n.shaclAnd=e.value},[`${be}in`]:(n,e)=>{n.shaclIn=e.value},[`${be}languageIn`]:(n,e)=>{n.languageIn=n.config.lists[e.value],n.datatype=xe.namedNode(Gs+"langString")},[`${be}defaultValue`]:(n,e)=>{n.defaultValue=e},[`${be}hasValue`]:(n,e)=>{n.hasValue=e},[`${be}qualifiedValueShape`]:(n,e)=>{n.qualifiedValueShape=e},[`${be}qualifiedMinCount`]:(n,e)=>{n.minCount=parseInt(e.value)},[`${be}qualifiedMaxCount`]:(n,e)=>{n.maxCount=parseInt(e.value)},[Js.id]:(n,e)=>{n.owlImports.push(e)},[Qs.id]:(n,e)=>{n.class=e;const t=n.config.store.getSubjects(Wr,e,null);t.length>0&&(n.node=t[0])},[`${be}or`]:(n,e)=>{const t=n.config.lists[e.value];t?.length?n.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",n.config.lists)},[`${be}xone`]:(n,e)=>{const t=n.config.lists[e.value];t?.length?n.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",n.config.lists)}};class dd{constructor(e,t,r){this.label="",this.owlImports=[],this.extendedShapes=[],this.parent=t,this.config=r,this.merge(e),this.qualifiedValueShape&&this.merge(r.store.getQuads(this.qualifiedValueShape,null,null,null))}merge(e){for(const t of e)cd[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||qt(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?As(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(this.node&&this.extendedShapes.push(this.node),this.shaclAnd)){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const r of t)this.extendedShapes.push(r)}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 fd=`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 ka(r){let e=Fc[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 Wn={exports:{}},zn={exports:{}},Jn,Da;function $e(){if(Da)return Jn;Da=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 Jn={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},Jn}var Qn={exports:{}},Xn,Ma;function mu(){return Ma||(Ma=1,Xn={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"{}"}}}),Xn}var Kn,Ca;function Ve(){if(Ca)return Kn;Ca=1;const{format:r,inspect:e}=mu(),{AggregateError:t}=$e(),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_",l={};function d(x,S){if(!x)throw new l.ERR_INTERNAL_ASSERTION(S)}function h(x){let S="",I=x.length;const b=x[0]==="-"?1:0;for(;I>=b+4;I-=3)S=`_${x.slice(I-3,I)}${S}`;return`${x.slice(0,I)}${S}`}function y(x,S,I){if(typeof S=="function")return d(S.length<=I.length,`Code: ${x}; The provided arguments length (${I.length}) does not match the required ones (${S.length}).`),S(...I);const b=(S.match(/%[dfijoOs]/g)||[]).length;return d(b===I.length,`Code: ${x}; The provided arguments length (${I.length}) does not match the required ones (${b}).`),I.length===0?S:r(S,...I)}function w(x,S,I){I||(I=Error);class b extends I{constructor(...p){super(y(x,S,p))}toString(){return`${this.name} [${x}]: ${this.message}`}}Object.defineProperties(b.prototype,{name:{value:I.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${x}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),b.prototype.code=x,b.prototype[i]=!0,l[x]=b}function g(x){const S=o+x.name;return Object.defineProperty(x,"name",{value:S}),x}function m(x,S){if(x&&S&&x!==S){if(Array.isArray(S.errors))return S.errors.push(x),S;const I=new n([S,x],S.message);return I.code=S.code,I}return x||S}class _ extends Error{constructor(S="The operation was aborted",I=void 0){if(I!==void 0&&typeof I!="object")throw new l.ERR_INVALID_ARG_TYPE("options","Object",I);super(S,I),this.code="ABORT_ERR",this.name="AbortError"}}return w("ERR_ASSERTION","%s",Error),w("ERR_INVALID_ARG_TYPE",(x,S,I)=>{d(typeof x=="string","'name' must be a string"),Array.isArray(S)||(S=[S]);let b="The ";x.endsWith(" argument")?b+=`${x} `:b+=`"${x}" ${x.includes(".")?"property":"argument"} `,b+="must be ";const c=[],p=[],N=[];for(const T of S)d(typeof T=="string","All expected entries have to be of type string"),s.includes(T)?c.push(T.toLowerCase()):a.test(T)?p.push(T):(d(T!=="object",'The value "object" should be written as "Object"'),N.push(T));if(p.length>0){const T=c.indexOf("object");T!==-1&&(c.splice(c,T,1),p.push("Object"))}if(c.length>0){switch(c.length){case 1:b+=`of type ${c[0]}`;break;case 2:b+=`one of type ${c[0]} or ${c[1]}`;break;default:{const T=c.pop();b+=`one of type ${c.join(", ")}, or ${T}`}}(p.length>0||N.length>0)&&(b+=" or ")}if(p.length>0){switch(p.length){case 1:b+=`an instance of ${p[0]}`;break;case 2:b+=`an instance of ${p[0]} or ${p[1]}`;break;default:{const T=p.pop();b+=`an instance of ${p.join(", ")}, or ${T}`}}N.length>0&&(b+=" or ")}switch(N.length){case 0:break;case 1:N[0].toLowerCase()!==N[0]&&(b+="an "),b+=`${N[0]}`;break;case 2:b+=`one of ${N[0]} or ${N[1]}`;break;default:{const T=N.pop();b+=`one of ${N.join(", ")}, or ${T}`}}if(I==null)b+=`. Received ${I}`;else if(typeof I=="function"&&I.name)b+=`. Received function ${I.name}`;else if(typeof I=="object"){var D;if((D=I.constructor)!==null&&D!==void 0&&D.name)b+=`. Received an instance of ${I.constructor.name}`;else{const T=e(I,{depth:-1});b+=`. Received ${T}`}}else{let T=e(I,{colors:!1});T.length>25&&(T=`${T.slice(0,25)}...`),b+=`. Received type ${typeof I} (${T})`}return b},TypeError),w("ERR_INVALID_ARG_VALUE",(x,S,I="is invalid")=>{let b=e(S);return b.length>128&&(b=b.slice(0,128)+"..."),`The ${x.includes(".")?"property":"argument"} '${x}' ${I}. Received ${b}`},TypeError),w("ERR_INVALID_RETURN_VALUE",(x,S,I)=>{var b;const c=I!=null&&(b=I.constructor)!==null&&b!==void 0&&b.name?`instance of ${I.constructor.name}`:`type ${typeof I}`;return`Expected ${x} to be returned from the "${S}" function but got ${c}.`},TypeError),w("ERR_MISSING_ARGS",(...x)=>{d(x.length>0,"At least one arg needs to be specified");let S;const I=x.length;switch(x=(Array.isArray(x)?x:[x]).map(b=>`"${b}"`).join(" or "),I){case 1:S+=`The ${x[0]} argument`;break;case 2:S+=`The ${x[0]} and ${x[1]} arguments`;break;default:{const b=x.pop();S+=`The ${x.join(", ")}, and ${b} arguments`}break}return`${S} must be specified`},TypeError),w("ERR_OUT_OF_RANGE",(x,S,I)=>{d(S,'Missing "range" argument');let b;if(Number.isInteger(I)&&Math.abs(I)>2**32)b=h(String(I));else if(typeof I=="bigint"){b=String(I);const c=BigInt(2)**BigInt(32);(I>c||I<-c)&&(b=h(b)),b+="n"}else b=e(I);return`The value of "${x}" is out of range. It must be ${S}. Received ${b}`},RangeError),w("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),w("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),w("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),w("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),w("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),w("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),w("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),w("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),w("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),w("ERR_STREAM_WRITE_AFTER_END","write after end",Error),w("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Kn={AbortError:_,aggregateTwoErrors:g(m),hideStackFrames:g,codes:l},Kn}var wr={exports:{}},Pa;function Gr(){if(Pa)return wr.exports;Pa=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return wr.exports=r,wr.exports.AbortSignal=e,wr.exports.default=r,wr.exports}var nn={exports:{}},qa;function Tn(){if(qa)return nn.exports;qa=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(p,N,D){return Function.prototype.apply.call(p,N,D)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(p){return Object.getOwnPropertyNames(p).concat(Object.getOwnPropertySymbols(p))}:t=function(p){return Object.getOwnPropertyNames(p)};function n(c){console&&console.warn&&console.warn(c)}var i=Number.isNaN||function(p){return p!==p};function s(){s.init.call(this)}nn.exports=s,nn.exports.once=S,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(c){if(typeof c!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof c)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(c){if(typeof c!="number"||c<0||i(c))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+c+".");a=c}}),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(p){if(typeof p!="number"||p<0||i(p))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+p+".");return this._maxListeners=p,this};function l(c){return c._maxListeners===void 0?s.defaultMaxListeners:c._maxListeners}s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(p){for(var N=[],D=1;D<arguments.length;D++)N.push(arguments[D]);var T=p==="error",q=this._events;if(q!==void 0)T=T&&q.error===void 0;else if(!T)return!1;if(T){var R;if(N.length>0&&(R=N[0]),R instanceof Error)throw R;var M=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw M.context=R,M}var B=q[p];if(B===void 0)return!1;if(typeof B=="function")e(B,this,N);else for(var A=B.length,j=m(B,A),D=0;D<A;++D)e(j[D],this,N);return!0};function d(c,p,N,D){var T,q,R;if(o(N),q=c._events,q===void 0?(q=c._events=Object.create(null),c._eventsCount=0):(q.newListener!==void 0&&(c.emit("newListener",p,N.listener?N.listener:N),q=c._events),R=q[p]),R===void 0)R=q[p]=N,++c._eventsCount;else if(typeof R=="function"?R=q[p]=D?[N,R]:[R,N]:D?R.unshift(N):R.push(N),T=l(c),T>0&&R.length>T&&!R.warned){R.warned=!0;var M=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(p)+" listeners added. Use emitter.setMaxListeners() to increase limit");M.name="MaxListenersExceededWarning",M.emitter=c,M.type=p,M.count=R.length,n(M)}return c}s.prototype.addListener=function(p,N){return d(this,p,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(p,N){return d(this,p,N,!0)};function h(){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 y(c,p,N){var D={fired:!1,wrapFn:void 0,target:c,type:p,listener:N},T=h.bind(D);return T.listener=N,D.wrapFn=T,T}s.prototype.once=function(p,N){return o(N),this.on(p,y(this,p,N)),this},s.prototype.prependOnceListener=function(p,N){return o(N),this.prependListener(p,y(this,p,N)),this},s.prototype.removeListener=function(p,N){var D,T,q,R,M;if(o(N),T=this._events,T===void 0)return this;if(D=T[p],D===void 0)return this;if(D===N||D.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete T[p],T.removeListener&&this.emit("removeListener",p,D.listener||N));else if(typeof D!="function"){for(q=-1,R=D.length-1;R>=0;R--)if(D[R]===N||D[R].listener===N){M=D[R].listener,q=R;break}if(q<0)return this;q===0?D.shift():_(D,q),D.length===1&&(T[p]=D[0]),T.removeListener!==void 0&&this.emit("removeListener",p,M||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(p){var N,D,T;if(D=this._events,D===void 0)return this;if(D.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):D[p]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete D[p]),this;if(arguments.length===0){var q=Object.keys(D),R;for(T=0;T<q.length;++T)R=q[T],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=D[p],typeof N=="function")this.removeListener(p,N);else if(N!==void 0)for(T=N.length-1;T>=0;T--)this.removeListener(p,N[T]);return this};function w(c,p,N){var D=c._events;if(D===void 0)return[];var T=D[p];return T===void 0?[]:typeof T=="function"?N?[T.listener||T]:[T]:N?x(T):m(T,T.length)}s.prototype.listeners=function(p){return w(this,p,!0)},s.prototype.rawListeners=function(p){return w(this,p,!1)},s.listenerCount=function(c,p){return typeof c.listenerCount=="function"?c.listenerCount(p):g.call(c,p)},s.prototype.listenerCount=g;function g(c){var p=this._events;if(p!==void 0){var N=p[c];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 m(c,p){for(var N=new Array(p),D=0;D<p;++D)N[D]=c[D];return N}function _(c,p){for(;p+1<c.length;p++)c[p]=c[p+1];c.pop()}function x(c){for(var p=new Array(c.length),N=0;N<p.length;++N)p[N]=c[N].listener||c[N];return p}function S(c,p){return new Promise(function(N,D){function T(R){c.removeListener(p,q),D(R)}function q(){typeof c.removeListener=="function"&&c.removeListener("error",T),N([].slice.call(arguments))}b(c,p,q,{once:!0}),p!=="error"&&I(c,T,{once:!0})})}function I(c,p,N){typeof c.on=="function"&&b(c,"error",p,N)}function b(c,p,N,D){if(typeof c.on=="function")D.once?c.once(p,N):c.on(p,N);else if(typeof c.addEventListener=="function")c.addEventListener(p,function T(q){D.once&&c.removeEventListener(p,T),N(q)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof c)}return nn.exports}var Ba;function ze(){return Ba||(Ba=1,function(r){const e=bt(),{format:t,inspect:n}=mu(),{codes:{ERR_INVALID_ARG_TYPE:i}}=Ve(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=$e(),l=globalThis.AbortSignal||Gr().AbortSignal,d=globalThis.AbortController||Gr().AbortController,h=Object.getPrototypeOf(async function(){}).constructor,y=globalThis.Blob||e.Blob,w=typeof y<"u"?function(x){return x instanceof y}:function(x){return!1},g=(_,x)=>{if(_!==void 0&&(_===null||typeof _!="object"||!("aborted"in _)))throw new i(x,"AbortSignal",_)},m=(_,x)=>{if(typeof _!="function")throw new i(x,"Function",_)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(_){let x=!1;return function(...S){x||(x=!0,_.apply(this,S))}},createDeferredPromise:function(){let _,x;return{promise:new Promise((I,b)=>{_=I,x=b}),resolve:_,reject:x}},promisify(_){return new Promise((x,S)=>{_((I,...b)=>I?S(I):x(...b))})},debuglog(){return function(){}},format:t,inspect:n,types:{isAsyncFunction(_){return _ instanceof h},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:w,deprecate(_,x){return _},addAbortListener:Tn().addAbortListener||function(x,S){if(x===void 0)throw new i("signal","AbortSignal",x);g(x,"signal"),m(S,"listener");let I;return x.aborted?queueMicrotask(()=>S()):(x.addEventListener("abort",S,{__proto__:null,once:!0,[s]:!0}),I=()=>{x.removeEventListener("abort",S)}),{__proto__:null,[o](){var b;(b=I)===null||b===void 0||b()}}},AbortSignalAny:l.any||function(x){if(x.length===1)return x[0];const S=new d,I=()=>S.abort();return x.forEach(b=>{g(b,"signals"),b.addEventListener("abort",I,{once:!0})}),S.signal.addEventListener("abort",()=>{x.forEach(b=>b.removeEventListener("abort",I))},{once:!0}),S.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")}(Qn)),Qn.exports}var sn={},Yn,Fa;function Xr(){if(Fa)return Yn;Fa=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:n,NumberIsInteger:i,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:o,NumberParseInt:l,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:h,String:y,StringPrototypeToUpperCase:w,StringPrototypeTrim:g}=$e(),{hideStackFrames:m,codes:{ERR_SOCKET_BAD_PORT:_,ERR_INVALID_ARG_TYPE:x,ERR_INVALID_ARG_VALUE:S,ERR_OUT_OF_RANGE:I,ERR_UNKNOWN_SIGNAL:b}}=Ve(),{normalizeEncoding:c}=ze(),{isAsyncFunction:p,isArrayBufferView:N}=ze().types,D={};function T(X){return X===(X|0)}function q(X){return X===X>>>0}const R=/^[0-7]+$/,M="must be a 32-bit unsigned integer or an octal string";function B(X,le,he){if(typeof X>"u"&&(X=he),typeof X=="string"){if(h(R,X)===null)throw new S(le,X,M);X=l(X,8)}return Y(X,le),X}const A=m((X,le,he=o,se=a)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);if(X<he||X>se)throw new I(le,`>= ${he} && <= ${se}`,X)}),j=m((X,le,he=-2147483648,se=2147483647)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);if(X<he||X>se)throw new I(le,`>= ${he} && <= ${se}`,X)}),Y=m((X,le,he=!1)=>{if(typeof X!="number")throw new x(le,"number",X);if(!i(X))throw new I(le,"an integer",X);const se=he?1:0,Ee=4294967295;if(X<se||X>Ee)throw new I(le,`>= ${se} && <= ${Ee}`,X)});function L(X,le){if(typeof X!="string")throw new x(le,"string",X)}function ee(X,le,he=void 0,se){if(typeof X!="number")throw new x(le,"number",X);if(he!=null&&X<he||se!=null&&X>se||(he!=null||se!=null)&&s(X))throw new I(le,`${he!=null?`>= ${he}`:""}${he!=null&&se!=null?" && ":""}${se!=null?`<= ${se}`:""}`,X)}const C=m((X,le,he)=>{if(!e(he,X)){const Ee="must be one of: "+t(n(he,qe=>typeof qe=="string"?`'${qe}'`:y(qe)),", ");throw new S(le,X,Ee)}});function K(X,le){if(typeof X!="boolean")throw new x(le,"boolean",X)}function v(X,le,he){return X==null||!d(X,le)?he:X[le]}const U=m((X,le,he=null)=>{const se=v(he,"allowArray",!1),Ee=v(he,"allowFunction",!1);if(!v(he,"nullable",!1)&&X===null||!se&&r(X)||typeof X!="object"&&(!Ee||typeof X!="function"))throw new x(le,"Object",X)}),Q=m((X,le)=>{if(X!=null&&typeof X!="object"&&typeof X!="function")throw new x(le,"a dictionary",X)}),z=m((X,le,he=0)=>{if(!r(X))throw new x(le,"Array",X);if(X.length<he){const se=`must be longer than ${he}`;throw new S(le,X,se)}});function ae(X,le){z(X,le);for(let he=0;he<X.length;he++)L(X[he],`${le}[${he}]`)}function H(X,le){z(X,le);for(let he=0;he<X.length;he++)K(X[he],`${le}[${he}]`)}function V(X,le){z(X,le);for(let he=0;he<X.length;he++){const se=X[he],Ee=`${le}[${he}]`;if(se==null)throw new x(Ee,"AbortSignal",se);ce(se,Ee)}}function W(X,le="signal"){if(L(X,le),D[X]===void 0)throw D[w(X)]!==void 0?new b(X+" (signals must use all capital letters)"):new b(X)}const F=m((X,le="buffer")=>{if(!N(X))throw new x(le,["Buffer","TypedArray","DataView"],X)});function Z(X,le){const he=c(le),se=X.length;if(he==="hex"&&se%2!==0)throw new S("encoding",le,`is invalid for data of length ${se}`)}function te(X,le="Port",he=!0){if(typeof X!="number"&&typeof X!="string"||typeof X=="string"&&g(X).length===0||+X!==+X>>>0||X>65535||X===0&&!he)throw new _(le,X,he);return X|0}const ce=m((X,le)=>{if(X!==void 0&&(X===null||typeof X!="object"||!("aborted"in X)))throw new x(le,"AbortSignal",X)}),fe=m((X,le)=>{if(typeof X!="function")throw new x(le,"Function",X)}),O=m((X,le)=>{if(typeof X!="function"||p(X))throw new x(le,"Function",X)}),G=m((X,le)=>{if(X!==void 0)throw new x(le,"undefined",X)});function re(X,le,he){if(!e(he,X))throw new x(le,`('${t(he,"|")}')`,X)}const ue=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function de(X,le){if(typeof X>"u"||!h(ue,X))throw new S(le,X,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function pe(X){if(typeof X=="string")return de(X,"hints"),X;if(r(X)){const le=X.length;let he="";if(le===0)return he;for(let se=0;se<le;se++){const Ee=X[se];de(Ee,"hints"),he+=Ee,se!==le-1&&(he+=", ")}return he}throw new S("hints",X,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Yn={isInt32:T,isUint32:q,parseFileMode:B,validateArray:z,validateStringArray:ae,validateBooleanArray:H,validateAbortSignalArray:V,validateBoolean:K,validateBuffer:F,validateDictionary:Q,validateEncoding:Z,validateFunction:fe,validateInt32:j,validateInteger:A,validateNumber:ee,validateObject:U,validateOneOf:C,validatePlainFunction:O,validatePort:te,validateSignalName:W,validateString:L,validateUint32:Y,validateUndefined:G,validateUnion:re,validateAbortSignal:ce,validateLinkHeaderValue:pe},Yn}var an={exports:{}},Zn={exports:{}},Ua;function Vt(){if(Ua)return Zn.exports;Ua=1;var r=Zn.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(_){if(e===setTimeout)return setTimeout(_,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(_,0);try{return e(_,0)}catch{try{return e.call(null,_,0)}catch{return e.call(this,_,0)}}}function a(_){if(t===clearTimeout)return clearTimeout(_);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(_);try{return t(_)}catch{try{return t.call(null,_)}catch{return t.call(this,_)}}}var o=[],l=!1,d,h=-1;function y(){!l||!d||(l=!1,d.length?o=d.concat(o):h=-1,o.length&&w())}function w(){if(!l){var _=s(y);l=!0;for(var x=o.length;x;){for(d=o,o=[];++h<x;)d&&d[h].run();h=-1,x=o.length}d=null,l=!1,a(_)}}r.nextTick=function(_){var x=new Array(arguments.length-1);if(arguments.length>1)for(var S=1;S<arguments.length;S++)x[S-1]=arguments[S];o.push(new g(_,x)),o.length===1&&!l&&s(w)};function g(_,x){this.fun=_,this.array=x}g.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function m(){}return r.on=m,r.addListener=m,r.once=m,r.off=m,r.removeListener=m,r.removeAllListeners=m,r.emit=m,r.prependListener=m,r.prependOnceListener=m,r.listeners=function(_){return[]},r.binding=function(_){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(_){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Zn.exports}var ei,Ha;function wt(){if(Ha)return ei;Ha=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=$e(),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"),l=t("nodejs.webstream.isClosedPromise"),d=t("nodejs.webstream.controllerErrorFunction");function h(v,U=!1){var Q;return!!(v&&typeof v.pipe=="function"&&typeof v.on=="function"&&(!U||typeof v.pause=="function"&&typeof v.resume=="function")&&(!v._writableState||((Q=v._readableState)===null||Q===void 0?void 0:Q.readable)!==!1)&&(!v._writableState||v._readableState))}function y(v){var U;return!!(v&&typeof v.write=="function"&&typeof v.on=="function"&&(!v._readableState||((U=v._writableState)===null||U===void 0?void 0:U.writable)!==!1))}function w(v){return!!(v&&typeof v.pipe=="function"&&v._readableState&&typeof v.on=="function"&&typeof v.write=="function")}function g(v){return v&&(v._readableState||v._writableState||typeof v.write=="function"&&typeof v.on=="function"||typeof v.pipe=="function"&&typeof v.on=="function")}function m(v){return!!(v&&!g(v)&&typeof v.pipeThrough=="function"&&typeof v.getReader=="function"&&typeof v.cancel=="function")}function _(v){return!!(v&&!g(v)&&typeof v.getWriter=="function"&&typeof v.abort=="function")}function x(v){return!!(v&&!g(v)&&typeof v.readable=="object"&&typeof v.writable=="object")}function S(v){return m(v)||_(v)||x(v)}function I(v,U){return v==null?!1:U===!0?typeof v[r]=="function":U===!1?typeof v[e]=="function":typeof v[r]=="function"||typeof v[e]=="function"}function b(v){if(!g(v))return null;const U=v._writableState,Q=v._readableState,z=U||Q;return!!(v.destroyed||v[n]||z!=null&&z.destroyed)}function c(v){if(!y(v))return null;if(v.writableEnded===!0)return!0;const U=v._writableState;return U!=null&&U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function p(v,U){if(!y(v))return null;if(v.writableFinished===!0)return!0;const Q=v._writableState;return Q!=null&&Q.errored?!1:typeof Q?.finished!="boolean"?null:!!(Q.finished||U===!1&&Q.ended===!0&&Q.length===0)}function N(v){if(!h(v))return null;if(v.readableEnded===!0)return!0;const U=v._readableState;return!U||U.errored?!1:typeof U?.ended!="boolean"?null:U.ended}function D(v,U){if(!h(v))return null;const Q=v._readableState;return Q!=null&&Q.errored?!1:typeof Q?.endEmitted!="boolean"?null:!!(Q.endEmitted||U===!1&&Q.ended===!0&&Q.length===0)}function T(v){return v&&v[s]!=null?v[s]:typeof v?.readable!="boolean"?null:b(v)?!1:h(v)&&v.readable&&!D(v)}function q(v){return v&&v[a]!=null?v[a]:typeof v?.writable!="boolean"?null:b(v)?!1:y(v)&&v.writable&&!c(v)}function R(v,U){return g(v)?b(v)?!0:!(U?.readable!==!1&&T(v)||U?.writable!==!1&&q(v)):null}function M(v){var U,Q;return g(v)?v.writableErrored?v.writableErrored:(U=(Q=v._writableState)===null||Q===void 0?void 0:Q.errored)!==null&&U!==void 0?U:null:null}function B(v){var U,Q;return g(v)?v.readableErrored?v.readableErrored:(U=(Q=v._readableState)===null||Q===void 0?void 0:Q.errored)!==null&&U!==void 0?U:null:null}function A(v){if(!g(v))return null;if(typeof v.closed=="boolean")return v.closed;const U=v._writableState,Q=v._readableState;return typeof U?.closed=="boolean"||typeof Q?.closed=="boolean"?U?.closed||Q?.closed:typeof v._closed=="boolean"&&j(v)?v._closed:null}function j(v){return typeof v._closed=="boolean"&&typeof v._defaultKeepAlive=="boolean"&&typeof v._removedConnection=="boolean"&&typeof v._removedContLen=="boolean"}function Y(v){return typeof v._sent100=="boolean"&&j(v)}function L(v){var U;return typeof v._consuming=="boolean"&&typeof v._dumped=="boolean"&&((U=v.req)===null||U===void 0?void 0:U.upgradeOrConnect)===void 0}function ee(v){if(!g(v))return null;const U=v._writableState,Q=v._readableState,z=U||Q;return!z&&Y(v)||!!(z&&z.autoDestroy&&z.emitClose&&z.closed===!1)}function C(v){var U;return!!(v&&((U=v[o])!==null&&U!==void 0?U:v.readableDidRead||v.readableAborted))}function K(v){var U,Q,z,ae,H,V,W,F,Z,te;return!!(v&&((U=(Q=(z=(ae=(H=(V=v[i])!==null&&V!==void 0?V:v.readableErrored)!==null&&H!==void 0?H:v.writableErrored)!==null&&ae!==void 0?ae:(W=v._readableState)===null||W===void 0?void 0:W.errorEmitted)!==null&&z!==void 0?z:(F=v._writableState)===null||F===void 0?void 0:F.errorEmitted)!==null&&Q!==void 0?Q:(Z=v._readableState)===null||Z===void 0?void 0:Z.errored)!==null&&U!==void 0?U:!((te=v._writableState)===null||te===void 0)&&te.errored))}return ei={isDestroyed:b,kIsDestroyed:n,isDisturbed:C,kIsDisturbed:o,isErrored:K,kIsErrored:i,isReadable:T,kIsReadable:s,kIsClosedPromise:l,kControllerErrorFunction:d,kIsWritable:a,isClosed:A,isDuplexNodeStream:w,isFinished:R,isIterable:I,isReadableNodeStream:h,isReadableStream:m,isReadableEnded:N,isReadableFinished:D,isReadableErrored:B,isNodeStream:g,isWebStream:S,isWritable:q,isWritableNodeStream:y,isWritableStream:_,isWritableEnded:c,isWritableFinished:p,isWritableErrored:M,isServerRequest:L,isServerResponse:Y,willEmitClose:ee,isTransformStream:x},ei}var Va;function Tt(){if(Va)return an.exports;Va=1;const r=Vt(),{AbortError:e,codes:t}=Ve(),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=ze(),{validateAbortSignal:o,validateFunction:l,validateObject:d,validateBoolean:h}=Xr(),{Promise:y,PromisePrototypeThen:w,SymbolDispose:g}=$e(),{isClosed:m,isReadable:_,isReadableNodeStream:x,isReadableStream:S,isReadableFinished:I,isReadableErrored:b,isWritable:c,isWritableNodeStream:p,isWritableStream:N,isWritableFinished:D,isWritableErrored:T,isNodeStream:q,willEmitClose:R,kIsClosedPromise:M}=wt();let B;function A(C){return C.setHeader&&typeof C.abort=="function"}const j=()=>{};function Y(C,K,v){var U,Q;if(arguments.length===2?(v=K,K=s):K==null?K=s:d(K,"options"),l(v,"callback"),o(K.signal,"options.signal"),v=a(v),S(C)||N(C))return L(C,K,v);if(!q(C))throw new n("stream",["ReadableStream","WritableStream","Stream"],C);const z=(U=K.readable)!==null&&U!==void 0?U:x(C),ae=(Q=K.writable)!==null&&Q!==void 0?Q:p(C),H=C._writableState,V=C._readableState,W=()=>{C.writable||te()};let F=R(C)&&x(C)===z&&p(C)===ae,Z=D(C,!1);const te=()=>{Z=!0,C.destroyed&&(F=!1),!(F&&(!C.readable||z))&&(!z||ce)&&v.call(C)};let ce=I(C,!1);const fe=()=>{ce=!0,C.destroyed&&(F=!1),!(F&&(!C.writable||ae))&&(!ae||Z)&&v.call(C)},O=X=>{v.call(C,X)};let G=m(C);const re=()=>{G=!0;const X=T(C)||b(C);if(X&&typeof X!="boolean")return v.call(C,X);if(z&&!ce&&x(C,!0)&&!I(C,!1))return v.call(C,new i);if(ae&&!Z&&!D(C,!1))return v.call(C,new i);v.call(C)},ue=()=>{G=!0;const X=T(C)||b(C);if(X&&typeof X!="boolean")return v.call(C,X);v.call(C)},de=()=>{C.req.on("finish",te)};A(C)?(C.on("complete",te),F||C.on("abort",re),C.req?de():C.on("request",de)):ae&&!H&&(C.on("end",W),C.on("close",W)),!F&&typeof C.aborted=="boolean"&&C.on("aborted",re),C.on("end",fe),C.on("finish",te),K.error!==!1&&C.on("error",O),C.on("close",re),G?r.nextTick(re):H!=null&&H.errorEmitted||V!=null&&V.errorEmitted?F||r.nextTick(ue):(!z&&(!F||_(C))&&(Z||c(C)===!1)||!ae&&(!F||c(C))&&(ce||_(C)===!1)||V&&C.req&&C.aborted)&&r.nextTick(ue);const pe=()=>{v=j,C.removeListener("aborted",re),C.removeListener("complete",te),C.removeListener("abort",re),C.removeListener("request",de),C.req&&C.req.removeListener("finish",te),C.removeListener("end",W),C.removeListener("close",W),C.removeListener("finish",te),C.removeListener("end",fe),C.removeListener("error",O),C.removeListener("close",re)};if(K.signal&&!G){const X=()=>{const le=v;pe(),le.call(C,new e(void 0,{cause:K.signal.reason}))};if(K.signal.aborted)r.nextTick(X);else{B=B||ze().addAbortListener;const le=B(K.signal,X),he=v;v=a((...se)=>{le[g](),he.apply(C,se)})}}return pe}function L(C,K,v){let U=!1,Q=j;if(K.signal)if(Q=()=>{U=!0,v.call(C,new e(void 0,{cause:K.signal.reason}))},K.signal.aborted)r.nextTick(Q);else{B=B||ze().addAbortListener;const ae=B(K.signal,Q),H=v;v=a((...V)=>{ae[g](),H.apply(C,V)})}const z=(...ae)=>{U||r.nextTick(()=>v.apply(C,ae))};return w(C[M].promise,z,z),j}function ee(C,K){var v;let U=!1;return K===null&&(K=s),(v=K)!==null&&v!==void 0&&v.cleanup&&(h(K.cleanup,"cleanup"),U=K.cleanup),new y((Q,z)=>{const ae=Y(C,K,H=>{U&&ae(),H?z(H):Q()})})}return an.exports=Y,an.exports.finished=ee,an.exports}var ti,Ga;function ur(){if(Ga)return ti;Ga=1;const r=Vt(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:n}=Ve(),{Symbol:i}=$e(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:l}=wt(),d=i("kDestroy"),h=i("kConstruct");function y(R,M,B){R&&(R.stack,M&&!M.errored&&(M.errored=R),B&&!B.errored&&(B.errored=R))}function w(R,M){const B=this._readableState,A=this._writableState,j=A||B;return A!=null&&A.destroyed||B!=null&&B.destroyed?(typeof M=="function"&&M(),this):(y(R,A,B),A&&(A.destroyed=!0),B&&(B.destroyed=!0),j.constructed?g(this,R,M):this.once(d,function(Y){g(this,e(Y,R),M)}),this)}function g(R,M,B){let A=!1;function j(Y){if(A)return;A=!0;const L=R._readableState,ee=R._writableState;y(Y,ee,L),ee&&(ee.closed=!0),L&&(L.closed=!0),typeof B=="function"&&B(Y),Y?r.nextTick(m,R,Y):r.nextTick(_,R)}try{R._destroy(M||null,j)}catch(Y){j(Y)}}function m(R,M){x(R,M),_(R)}function _(R){const M=R._readableState,B=R._writableState;B&&(B.closeEmitted=!0),M&&(M.closeEmitted=!0),(B!=null&&B.emitClose||M!=null&&M.emitClose)&&R.emit("close")}function x(R,M){const B=R._readableState,A=R._writableState;A!=null&&A.errorEmitted||B!=null&&B.errorEmitted||(A&&(A.errorEmitted=!0),B&&(B.errorEmitted=!0),R.emit("error",M))}function S(){const R=this._readableState,M=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),M&&(M.constructed=!0,M.destroyed=!1,M.closed=!1,M.closeEmitted=!1,M.errored=null,M.errorEmitted=!1,M.finalCalled=!1,M.prefinished=!1,M.ended=M.writable===!1,M.ending=M.writable===!1,M.finished=M.writable===!1)}function I(R,M,B){const A=R._readableState,j=R._writableState;if(j!=null&&j.destroyed||A!=null&&A.destroyed)return this;A!=null&&A.autoDestroy||j!=null&&j.autoDestroy?R.destroy(M):M&&(M.stack,j&&!j.errored&&(j.errored=M),A&&!A.errored&&(A.errored=M),B?r.nextTick(x,R,M):x(R,M))}function b(R,M){if(typeof R._construct!="function")return;const B=R._readableState,A=R._writableState;B&&(B.constructed=!1),A&&(A.constructed=!1),R.once(h,M),!(R.listenerCount(h)>1)&&r.nextTick(c,R)}function c(R){let M=!1;function B(A){if(M){I(R,A??new t);return}M=!0;const j=R._readableState,Y=R._writableState,L=Y||j;j&&(j.constructed=!0),Y&&(Y.constructed=!0),L.destroyed?R.emit(d,A):A?I(R,A,!0):r.nextTick(p,R)}try{R._construct(A=>{r.nextTick(B,A)})}catch(A){r.nextTick(B,A)}}function p(R){R.emit(h)}function N(R){return R?.setHeader&&typeof R.abort=="function"}function D(R){R.emit("close")}function T(R,M){R.emit("error",M),r.nextTick(D,R)}function q(R,M){!R||a(R)||(!M&&!o(R)&&(M=new n),l(R)?(R.socket=null,R.destroy(M)):N(R)?R.abort():N(R.req)?R.req.abort():typeof R.destroy=="function"?R.destroy(M):typeof R.close=="function"?R.close():M?r.nextTick(T,R,M):r.nextTick(D,R),R.destroyed||(R[s]=!0))}return ti={construct:b,destroyer:q,destroy:w,undestroy:S,errorOrDestroy:I},ti}var ri,Wa;function Fs(){if(Wa)return ri;Wa=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=$e(),{EventEmitter:t}=Tn();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 l(_){s.writable&&s.write(_)===!1&&o.pause&&o.pause()}o.on("data",l);function d(){o.readable&&o.resume&&o.resume()}s.on("drain",d),!s._isStdio&&(!a||a.end!==!1)&&(o.on("end",y),o.on("close",w));let h=!1;function y(){h||(h=!0,s.end())}function w(){h||(h=!0,typeof s.destroy=="function"&&s.destroy())}function g(_){m(),t.listenerCount(this,"error")===0&&this.emit("error",_)}i(o,"error",g),i(s,"error",g);function m(){o.removeListener("data",l),s.removeListener("drain",d),o.removeListener("end",y),o.removeListener("close",w),o.removeListener("error",g),s.removeListener("error",g),o.removeListener("end",m),o.removeListener("close",m),s.removeListener("close",m)}return o.on("end",m),o.on("close",m),s.on("close",m),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 ri={Stream:n,prependListener:i},ri}var ni={exports:{}},za;function An(){return za||(za=1,function(r){const{SymbolDispose:e}=$e(),{AbortError:t,codes:n}=Ve(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=wt(),o=Tt(),{ERR_INVALID_ARG_TYPE:l}=n;let d;const h=(y,w)=>{if(typeof y!="object"||!("aborted"in y))throw new l(w,"AbortSignal",y)};r.exports.addAbortSignal=function(w,g){if(h(w,"signal"),!i(g)&&!s(g))throw new l("stream",["ReadableStream","WritableStream","Stream"],g);return r.exports.addAbortSignalNoValidate(w,g)},r.exports.addAbortSignalNoValidate=function(y,w){if(typeof y!="object"||!("aborted"in y))return w;const g=i(w)?()=>{w.destroy(new t(void 0,{cause:y.reason}))}:()=>{w[a](new t(void 0,{cause:y.reason}))};if(y.aborted)g();else{d=d||ze().addAbortListener;const m=d(y,g);o(w,m[e])}return w}}(ni)),ni.exports}var ii,Ja;function Uc(){if(Ja)return ii;Ja=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:n}=$e(),{Buffer:i}=bt(),{inspect:s}=ze();return ii=class{constructor(){this.head=null,this.tail=null,this.length=0}push(o){const l={data:o,next:null};this.length>0?this.tail.next=l:this.head=l,this.tail=l,++this.length}unshift(o){const l={data:o,next:this.head};this.length===0&&(this.tail=l),this.head=l,++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 l=this.head,d=""+l.data;for(;(l=l.next)!==null;)d+=o+l.data;return d}concat(o){if(this.length===0)return i.alloc(0);const l=i.allocUnsafe(o>>>0);let d=this.head,h=0;for(;d;)t(l,d.data,h),h+=d.data.length,d=d.next;return l}consume(o,l){const d=this.head.data;if(o<d.length){const h=d.slice(0,o);return this.head.data=d.slice(o),h}return o===d.length?this.shift():l?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 l="",d=this.head,h=0;do{const y=d.data;if(o>y.length)l+=y,o-=y.length;else{o===y.length?(l+=y,++h,d.next?this.head=d.next:this.head=this.tail=null):(l+=r(y,0,o),this.head=d,d.data=r(y,o));break}++h}while((d=d.next)!==null);return this.length-=h,l}_getBuffer(o){const l=i.allocUnsafe(o),d=o;let h=this.head,y=0;do{const w=h.data;if(o>w.length)t(l,w,d-o),o-=w.length;else{o===w.length?(t(l,w,d-o),++y,h.next?this.head=h.next:this.head=this.tail=null):(t(l,new n(w.buffer,w.byteOffset,o),d-o),this.head=h,h.data=w.slice(o));break}++y}while((h=h.next)!==null);return this.length-=y,l}[Symbol.for("nodejs.util.inspect.custom")](o,l){return s(this,{...l,depth:0,customInspect:!1})}},ii}var si,Qa;function Ln(){if(Qa)return si;Qa=1;const{MathFloor:r,NumberIsInteger:e}=$e(),{validateInteger:t}=Xr(),{ERR_INVALID_ARG_VALUE:n}=Ve().codes;let i=16*1024,s=16;function a(h,y,w){return h.highWaterMark!=null?h.highWaterMark:y?h[w]:null}function o(h){return h?s:i}function l(h,y){t(y,"value",0),h?s=y:i=y}function d(h,y,w,g){const m=a(y,g,w);if(m!=null){if(!e(m)||m<0){const _=g?`options.${w}`:"options.highWaterMark";throw new n(_,m)}return r(m)}return o(h.objectMode)}return si={getHighWaterMark:d,getDefaultHighWaterMark:o,setDefaultHighWaterMark:l},si}var ai={},on={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Xa;function Hc(){return Xa||(Xa=1,function(r,e){var t=bt(),n=t.Buffer;function i(a,o){for(var l in a)o[l]=a[l]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=t:(i(t,e),e.Buffer=s);function s(a,o,l){return n(a,o,l)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,o,l){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,o,l)},s.alloc=function(a,o,l){if(typeof a!="number")throw new TypeError("Argument must be a number");var d=n(a);return o!==void 0?typeof l=="string"?d.fill(o,l):d.fill(o):d.fill(0),d},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)}}(on,on.exports)),on.exports}var Ka;function Vc(){if(Ka)return ai;Ka=1;var r=Hc().Buffer,e=r.isEncoding||function(S){switch(S=""+S,S&&S.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(S){if(!S)return"utf8";for(var I;;)switch(S){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 S;default:if(I)return;S=(""+S).toLowerCase(),I=!0}}function n(S){var I=t(S);if(typeof I!="string"&&(r.isEncoding===e||!e(S)))throw new Error("Unknown encoding: "+S);return I||S}ai.StringDecoder=i;function i(S){this.encoding=n(S);var I;switch(this.encoding){case"utf16le":this.text=y,this.end=w,I=4;break;case"utf8":this.fillLast=l,I=4;break;case"base64":this.text=g,this.end=m,I=3;break;default:this.write=_,this.end=x;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(I)}i.prototype.write=function(S){if(S.length===0)return"";var I,b;if(this.lastNeed){if(I=this.fillLast(S),I===void 0)return"";b=this.lastNeed,this.lastNeed=0}else b=0;return b<S.length?I?I+this.text(S,b):this.text(S,b):I||""},i.prototype.end=h,i.prototype.text=d,i.prototype.fillLast=function(S){if(this.lastNeed<=S.length)return S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,this.lastTotal-this.lastNeed,0,S.length),this.lastNeed-=S.length};function s(S){return S<=127?0:S>>5===6?2:S>>4===14?3:S>>3===30?4:S>>6===2?-1:-2}function a(S,I,b){var c=I.length-1;if(c<b)return 0;var p=s(I[c]);return p>=0?(p>0&&(S.lastNeed=p-1),p):--c<b||p===-2?0:(p=s(I[c]),p>=0?(p>0&&(S.lastNeed=p-2),p):--c<b||p===-2?0:(p=s(I[c]),p>=0?(p>0&&(p===2?p=0:S.lastNeed=p-3),p):0))}function o(S,I,b){if((I[0]&192)!==128)return S.lastNeed=0,"�";if(S.lastNeed>1&&I.length>1){if((I[1]&192)!==128)return S.lastNeed=1,"�";if(S.lastNeed>2&&I.length>2&&(I[2]&192)!==128)return S.lastNeed=2,"�"}}function l(S){var I=this.lastTotal-this.lastNeed,b=o(this,S);if(b!==void 0)return b;if(this.lastNeed<=S.length)return S.copy(this.lastChar,I,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);S.copy(this.lastChar,I,0,S.length),this.lastNeed-=S.length}function d(S,I){var b=a(this,S,I);if(!this.lastNeed)return S.toString("utf8",I);this.lastTotal=b;var c=S.length-(b-this.lastNeed);return S.copy(this.lastChar,0,c),S.toString("utf8",I,c)}function h(S){var I=S&&S.length?this.write(S):"";return this.lastNeed?I+"�":I}function y(S,I){if((S.length-I)%2===0){var b=S.toString("utf16le",I);if(b){var c=b.charCodeAt(b.length-1);if(c>=55296&&c<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1],b.slice(0,-1)}return b}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=S[S.length-1],S.toString("utf16le",I,S.length-1)}function w(S){var I=S&&S.length?this.write(S):"";if(this.lastNeed){var b=this.lastTotal-this.lastNeed;return I+this.lastChar.toString("utf16le",0,b)}return I}function g(S,I){var b=(S.length-I)%3;return b===0?S.toString("base64",I):(this.lastNeed=3-b,this.lastTotal=3,b===1?this.lastChar[0]=S[S.length-1]:(this.lastChar[0]=S[S.length-2],this.lastChar[1]=S[S.length-1]),S.toString("base64",I,S.length-b))}function m(S){var I=S&&S.length?this.write(S):"";return this.lastNeed?I+this.lastChar.toString("base64",0,3-this.lastNeed):I}function _(S){return S.toString(this.encoding)}function x(S){return S&&S.length?this.write(S):""}return ai}var oi,Ya;function bu(){if(Ya)return oi;Ya=1;const r=Vt(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:n}=$e(),{Buffer:i}=bt(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=Ve().codes;function o(l,d,h){let y;if(typeof d=="string"||d instanceof i)return new l({objectMode:!0,...h,read(){this.push(d),this.push(null)}});let w;if(d&&d[t])w=!0,y=d[t]();else if(d&&d[n])w=!1,y=d[n]();else throw new s("iterable",["Iterable"],d);const g=new l({objectMode:!0,highWaterMark:1,...h});let m=!1;g._read=function(){m||(m=!0,x())},g._destroy=function(S,I){e(_(S),()=>r.nextTick(I,S),b=>r.nextTick(I,b||S))};async function _(S){const I=S!=null,b=typeof y.throw=="function";if(I&&b){const{value:c,done:p}=await y.throw(S);if(await c,p)return}if(typeof y.return=="function"){const{value:c}=await y.return();await c}}async function x(){for(;;){try{const{value:S,done:I}=w?await y.next():y.next();if(I)g.push(null);else{const b=S&&typeof S.then=="function"?await S:S;if(b===null)throw m=!1,new a;if(g.push(b))continue;m=!1}}catch(S){g.destroy(S)}break}}return g}return oi=o,oi}var li,Za;function jn(){if(Za)return li;Za=1;const r=Vt(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:l,SafeSet:d,SymbolAsyncDispose:h,SymbolAsyncIterator:y,Symbol:w}=$e();li=se,se.ReadableState=he;const{EventEmitter:g}=Tn(),{Stream:m,prependListener:_}=Fs(),{Buffer:x}=bt(),{addAbortSignal:S}=An(),I=Tt();let b=ze().debuglog("stream",$=>{b=$});const c=Uc(),p=ur(),{getHighWaterMark:N,getDefaultHighWaterMark:D}=Ln(),{aggregateTwoErrors:T,codes:{ERR_INVALID_ARG_TYPE:q,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:M,ERR_STREAM_PUSH_AFTER_EOF:B,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:A},AbortError:j}=Ve(),{validateObject:Y}=Xr(),L=w("kPaused"),{StringDecoder:ee}=Vc(),C=bu();o(se.prototype,m.prototype),o(se,m);const K=()=>{},{errorOrDestroy:v}=p,U=1,Q=2,z=4,ae=8,H=16,V=32,W=64,F=128,Z=256,te=512,ce=1024,fe=2048,O=4096,G=8192,re=16384,ue=32768,de=65536,pe=1<<17,X=1<<18;function le($){return{enumerable:!1,get(){return(this.state&$)!==0},set(P){P?this.state|=$:this.state&=~$}}}s(he.prototype,{objectMode:le(U),ended:le(Q),endEmitted:le(z),reading:le(ae),constructed:le(H),sync:le(V),needReadable:le(W),emittedReadable:le(F),readableListening:le(Z),resumeScheduled:le(te),errorEmitted:le(ce),emitClose:le(fe),autoDestroy:le(O),destroyed:le(G),closed:le(re),closeEmitted:le(ue),multiAwaitDrain:le(de),readingMore:le(pe),dataEmitted:le(X)});function he($,P,ge){typeof ge!="boolean"&&(ge=P instanceof yt()),this.state=fe|O|H|V,$&&$.objectMode&&(this.state|=U),ge&&$&&$.readableObjectMode&&(this.state|=U),this.highWaterMark=$?N(this,$,"readableHighWaterMark",ge):D(!1),this.buffer=new c,this.length=0,this.pipes=[],this.flowing=null,this[L]=null,$&&$.emitClose===!1&&(this.state&=~fe),$&&$.autoDestroy===!1&&(this.state&=~O),this.errored=null,this.defaultEncoding=$&&$.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,$&&$.encoding&&(this.decoder=new ee($.encoding),this.encoding=$.encoding)}function se($){if(!(this instanceof se))return new se($);const P=this instanceof yt();this._readableState=new he($,this,P),$&&(typeof $.read=="function"&&(this._read=$.read),typeof $.destroy=="function"&&(this._destroy=$.destroy),typeof $.construct=="function"&&(this._construct=$.construct),$.signal&&!P&&S($.signal,this)),m.call(this,$),p.construct(this,()=>{this._readableState.needReadable&&J(this,this._readableState)})}se.prototype.destroy=p.destroy,se.prototype._undestroy=p.undestroy,se.prototype._destroy=function($,P){P($)},se.prototype[g.captureRejectionSymbol]=function($){this.destroy($)},se.prototype[h]=function(){let $;return this.destroyed||($=this.readableEnded?null:new j,this.destroy($)),new l((P,ge)=>I(this,ye=>ye&&ye!==$?ge(ye):P(null)))},se.prototype.push=function($,P){return Ee(this,$,P,!1)},se.prototype.unshift=function($,P){return Ee(this,$,P,!0)};function Ee($,P,ge,ye){b("readableAddChunk",P);const me=$._readableState;let Be;if((me.state&U)===0&&(typeof P=="string"?(ge=ge||me.defaultEncoding,me.encoding!==ge&&(ye&&me.encoding?P=x.from(P,ge).toString(me.encoding):(P=x.from(P,ge),ge=""))):P instanceof x?ge="":m._isUint8Array(P)?(P=m._uint8ArrayToBuffer(P),ge=""):P!=null&&(Be=new q("chunk",["string","Buffer","Uint8Array"],P))),Be)v($,Be);else if(P===null)me.state&=~ae,u($,me);else if((me.state&U)!==0||P&&P.length>0)if(ye)if((me.state&z)!==0)v($,new A);else{if(me.destroyed||me.errored)return!1;qe($,me,P,!0)}else if(me.ended)v($,new B);else{if(me.destroyed||me.errored)return!1;me.state&=~ae,me.decoder&&!ge?(P=me.decoder.write(P),me.objectMode||P.length!==0?qe($,me,P,!1):J($,me)):qe($,me,P,!1)}else ye||(me.state&=~ae,J($,me));return!me.ended&&(me.length<me.highWaterMark||me.length===0)}function qe($,P,ge,ye){P.flowing&&P.length===0&&!P.sync&&$.listenerCount("data")>0?((P.state&de)!==0?P.awaitDrainWriters.clear():P.awaitDrainWriters=null,P.dataEmitted=!0,$.emit("data",ge)):(P.length+=P.objectMode?1:ge.length,ye?P.buffer.unshift(ge):P.buffer.push(ge),(P.state&W)!==0&&f($)),J($,P)}se.prototype.isPaused=function(){const $=this._readableState;return $[L]===!0||$.flowing===!1},se.prototype.setEncoding=function($){const P=new ee($);this._readableState.decoder=P,this._readableState.encoding=this._readableState.decoder.encoding;const ge=this._readableState.buffer;let ye="";for(const me of ge)ye+=P.write(me);return ge.clear(),ye!==""&&ge.push(ye),this._readableState.length=ye.length,this};const _e=1073741824;function He($){if($>_e)throw new M("size","<= 1GiB",$);return $--,$|=$>>>1,$|=$>>>2,$|=$>>>4,$|=$>>>8,$|=$>>>16,$++,$}function E($,P){return $<=0||P.length===0&&P.ended?0:(P.state&U)!==0?1:n($)?P.flowing&&P.length?P.buffer.first().length:P.length:$<=P.length?$:P.ended?P.length:0}se.prototype.read=function($){b("read",$),$===void 0?$=NaN:t($)||($=i($,10));const P=this._readableState,ge=$;if($>P.highWaterMark&&(P.highWaterMark=He($)),$!==0&&(P.state&=~F),$===0&&P.needReadable&&((P.highWaterMark!==0?P.length>=P.highWaterMark:P.length>0)||P.ended))return b("read: emitReadable",P.length,P.ended),P.length===0&&P.ended?qn(this):f(this),null;if($=E($,P),$===0&&P.ended)return P.length===0&&qn(this),null;let ye=(P.state&W)!==0;if(b("need readable",ye),(P.length===0||P.length-$<P.highWaterMark)&&(ye=!0,b("length less than watermark",ye)),P.ended||P.reading||P.destroyed||P.errored||!P.constructed)ye=!1,b("reading, ended or constructing",ye);else if(ye){b("do read"),P.state|=ae|V,P.length===0&&(P.state|=W);try{this._read(P.highWaterMark)}catch(Be){v(this,Be)}P.state&=~V,P.reading||($=E(ge,P))}let me;return $>0?me=wa($,P):me=null,me===null?(P.needReadable=P.length<=P.highWaterMark,$=0):(P.length-=$,P.multiAwaitDrain?P.awaitDrainWriters.clear():P.awaitDrainWriters=null),P.length===0&&(P.ended||(P.needReadable=!0),ge!==$&&P.ended&&qn(this)),me!==null&&!P.errorEmitted&&!P.closeEmitted&&(P.dataEmitted=!0,this.emit("data",me)),me};function u($,P){if(b("onEofChunk"),!P.ended){if(P.decoder){const ge=P.decoder.end();ge&&ge.length&&(P.buffer.push(ge),P.length+=P.objectMode?1:ge.length)}P.ended=!0,P.sync?f($):(P.needReadable=!1,P.emittedReadable=!0,k($))}}function f($){const P=$._readableState;b("emitReadable",P.needReadable,P.emittedReadable),P.needReadable=!1,P.emittedReadable||(b("emitReadable",P.flowing),P.emittedReadable=!0,r.nextTick(k,$))}function k($){const P=$._readableState;b("emitReadable_",P.destroyed,P.length,P.ended),!P.destroyed&&!P.errored&&(P.length||P.ended)&&($.emit("readable"),P.emittedReadable=!1),P.needReadable=!P.flowing&&!P.ended&&P.length<=P.highWaterMark,Ie($)}function J($,P){!P.readingMore&&P.constructed&&(P.readingMore=!0,r.nextTick(ie,$,P))}function ie($,P){for(;!P.reading&&!P.ended&&(P.length<P.highWaterMark||P.flowing&&P.length===0);){const ge=P.length;if(b("maybeReadMore read 0"),$.read(0),ge===P.length)break}P.readingMore=!1}se.prototype._read=function($){throw new R("_read()")},se.prototype.pipe=function($,P){const ge=this,ye=this._readableState;ye.pipes.length===1&&(ye.multiAwaitDrain||(ye.multiAwaitDrain=!0,ye.awaitDrainWriters=new d(ye.awaitDrainWriters?[ye.awaitDrainWriters]:[]))),ye.pipes.push($),b("pipe count=%d opts=%j",ye.pipes.length,P);const Be=(!P||P.end!==!1)&&$!==r.stdout&&$!==r.stderr?_a:hr;ye.endEmitted?r.nextTick(Be):ge.once("end",Be),$.on("unpipe",Ye);function Ye(jt,pt){b("onunpipe"),jt===ge&&pt&&pt.hasUnpiped===!1&&(pt.hasUnpiped=!0,vc())}function _a(){b("onend"),$.end()}let Lt,xa=!1;function vc(){b("cleanup"),$.removeListener("close",Un),$.removeListener("finish",Hn),Lt&&$.removeListener("drain",Lt),$.removeListener("error",Fn),$.removeListener("unpipe",Ye),ge.removeListener("end",_a),ge.removeListener("end",hr),ge.removeListener("data",Ea),xa=!0,Lt&&ye.awaitDrainWriters&&(!$._writableState||$._writableState.needDrain)&&Lt()}function Sa(){xa||(ye.pipes.length===1&&ye.pipes[0]===$?(b("false write response, pause",0),ye.awaitDrainWriters=$,ye.multiAwaitDrain=!1):ye.pipes.length>1&&ye.pipes.includes($)&&(b("false write response, pause",ye.awaitDrainWriters.size),ye.awaitDrainWriters.add($)),ge.pause()),Lt||(Lt=oe(ge,$),$.on("drain",Lt))}ge.on("data",Ea);function Ea(jt){b("ondata");const pt=$.write(jt);b("dest.write",pt),pt===!1&&Sa()}function Fn(jt){if(b("onerror",jt),hr(),$.removeListener("error",Fn),$.listenerCount("error")===0){const pt=$._writableState||$._readableState;pt&&!pt.errorEmitted?v($,jt):$.emit("error",jt)}}_($,"error",Fn);function Un(){$.removeListener("finish",Hn),hr()}$.once("close",Un);function Hn(){b("onfinish"),$.removeListener("close",Un),hr()}$.once("finish",Hn);function hr(){b("unpipe"),ge.unpipe($)}return $.emit("pipe",ge),$.writableNeedDrain===!0?Sa():ye.flowing||(b("pipe resume"),ge.resume()),$};function oe($,P){return function(){const ye=$._readableState;ye.awaitDrainWriters===P?(b("pipeOnDrain",1),ye.awaitDrainWriters=null):ye.multiAwaitDrain&&(b("pipeOnDrain",ye.awaitDrainWriters.size),ye.awaitDrainWriters.delete(P)),(!ye.awaitDrainWriters||ye.awaitDrainWriters.size===0)&&$.listenerCount("data")&&$.resume()}}se.prototype.unpipe=function($){const P=this._readableState,ge={hasUnpiped:!1};if(P.pipes.length===0)return this;if(!$){const me=P.pipes;P.pipes=[],this.pause();for(let Be=0;Be<me.length;Be++)me[Be].emit("unpipe",this,{hasUnpiped:!1});return this}const ye=e(P.pipes,$);return ye===-1?this:(P.pipes.splice(ye,1),P.pipes.length===0&&this.pause(),$.emit("unpipe",this,ge),this)},se.prototype.on=function($,P){const ge=m.prototype.on.call(this,$,P),ye=this._readableState;return $==="data"?(ye.readableListening=this.listenerCount("readable")>0,ye.flowing!==!1&&this.resume()):$==="readable"&&!ye.endEmitted&&!ye.readableListening&&(ye.readableListening=ye.needReadable=!0,ye.flowing=!1,ye.emittedReadable=!1,b("on readable",ye.length,ye.reading),ye.length?f(this):ye.reading||r.nextTick(Le,this)),ge},se.prototype.addListener=se.prototype.on,se.prototype.removeListener=function($,P){const ge=m.prototype.removeListener.call(this,$,P);return $==="readable"&&r.nextTick(we,this),ge},se.prototype.off=se.prototype.removeListener,se.prototype.removeAllListeners=function($){const P=m.prototype.removeAllListeners.apply(this,arguments);return($==="readable"||$===void 0)&&r.nextTick(we,this),P};function we($){const P=$._readableState;P.readableListening=$.listenerCount("readable")>0,P.resumeScheduled&&P[L]===!1?P.flowing=!0:$.listenerCount("data")>0?$.resume():P.readableListening||(P.flowing=null)}function Le($){b("readable nexttick read 0"),$.read(0)}se.prototype.resume=function(){const $=this._readableState;return $.flowing||(b("resume"),$.flowing=!$.readableListening,Te(this,$)),$[L]=!1,this};function Te($,P){P.resumeScheduled||(P.resumeScheduled=!0,r.nextTick(je,$,P))}function je($,P){b("resume",P.reading),P.reading||$.read(0),P.resumeScheduled=!1,$.emit("resume"),Ie($),P.flowing&&!P.reading&&$.read(0)}se.prototype.pause=function(){return b("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(b("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[L]=!0,this};function Ie($){const P=$._readableState;for(b("flow",P.flowing);P.flowing&&$.read()!==null;);}se.prototype.wrap=function($){let P=!1;$.on("data",ye=>{!this.push(ye)&&$.pause&&(P=!0,$.pause())}),$.on("end",()=>{this.push(null)}),$.on("error",ye=>{v(this,ye)}),$.on("close",()=>{this.destroy()}),$.on("destroy",()=>{this.destroy()}),this._read=()=>{P&&$.resume&&(P=!1,$.resume())};const ge=a($);for(let ye=1;ye<ge.length;ye++){const me=ge[ye];this[me]===void 0&&typeof $[me]=="function"&&(this[me]=$[me].bind($))}return this},se.prototype[y]=function(){return ba(this)},se.prototype.iterator=function($){return $!==void 0&&Y($,"options"),ba(this,$)};function ba($,P){typeof $.read!="function"&&($=se.wrap($,{objectMode:!0}));const ge=mc($,P);return ge.stream=$,ge}async function*mc($,P){let ge=K;function ye(Ye){this===$?(ge(),ge=K):ge=Ye}$.on("readable",ye);let me;const Be=I($,{writable:!1},Ye=>{me=Ye?T(me,Ye):null,ge(),ge=K});try{for(;;){const Ye=$.destroyed?null:$.read();if(Ye!==null)yield Ye;else{if(me)throw me;if(me===null)return;await new l(ye)}}}catch(Ye){throw me=T(me,Ye),me}finally{(me||P?.destroyOnReturn!==!1)&&(me===void 0||$._readableState.autoDestroy)?p.destroyer($,null):($.off("readable",ye),Be())}}s(se.prototype,{readable:{__proto__:null,get(){const $=this._readableState;return!!$&&$.readable!==!1&&!$.destroyed&&!$.errorEmitted&&!$.endEmitted},set($){this._readableState&&(this._readableState.readable=!!$)}},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($){this._readableState&&(this._readableState.flowing=$)}},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($){this._readableState&&(this._readableState.destroyed=$)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(he.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[L]!==!1},set($){this[L]=!!$}}}),se._fromList=wa;function wa($,P){if(P.length===0)return null;let ge;return P.objectMode?ge=P.buffer.shift():!$||$>=P.length?(P.decoder?ge=P.buffer.join(""):P.buffer.length===1?ge=P.buffer.first():ge=P.buffer.concat(P.length),P.buffer.clear()):ge=P.buffer.consume($,P.decoder),ge}function qn($){const P=$._readableState;b("endReadable",P.endEmitted),P.endEmitted||(P.ended=!0,r.nextTick(bc,P,$))}function bc($,P){if(b("endReadableNT",$.endEmitted,$.length),!$.errored&&!$.closeEmitted&&!$.endEmitted&&$.length===0){if($.endEmitted=!0,P.emit("end"),P.writable&&P.allowHalfOpen===!1)r.nextTick(wc,P);else if($.autoDestroy){const ge=P._writableState;(!ge||ge.autoDestroy&&(ge.finished||ge.writable===!1))&&P.destroy()}}}function wc($){$.writable&&!$.writableEnded&&!$.destroyed&&$.end()}se.from=function($,P){return C(se,$,P)};let Bn;function va(){return Bn===void 0&&(Bn={}),Bn}return se.fromWeb=function($,P){return va().newStreamReadableFromReadableStream($,P)},se.toWeb=function($,P){return va().newReadableStreamFromStreamReadable($,P)},se.wrap=function($,P){var ge,ye;return new se({objectMode:(ge=(ye=$.readableObjectMode)!==null&&ye!==void 0?ye:$.objectMode)!==null&&ge!==void 0?ge:!0,...P,destroy(me,Be){p.destroyer($,me),Be(me)}}).wrap($)},li}var ui,eo;function Us(){if(eo)return ui;eo=1;const r=Vt(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:l,SymbolHasInstance:d}=$e();ui=Y,Y.WritableState=A;const{EventEmitter:h}=Tn(),y=Fs().Stream,{Buffer:w}=bt(),g=ur(),{addAbortSignal:m}=An(),{getHighWaterMark:_,getDefaultHighWaterMark:x}=Ln(),{ERR_INVALID_ARG_TYPE:S,ERR_METHOD_NOT_IMPLEMENTED:I,ERR_MULTIPLE_CALLBACK:b,ERR_STREAM_CANNOT_PIPE:c,ERR_STREAM_DESTROYED:p,ERR_STREAM_ALREADY_FINISHED:N,ERR_STREAM_NULL_VALUES:D,ERR_STREAM_WRITE_AFTER_END:T,ERR_UNKNOWN_ENCODING:q}=Ve().codes,{errorOrDestroy:R}=g;a(Y.prototype,y.prototype),a(Y,y);function M(){}const B=l("kOnFinished");function A(O,G,re){typeof re!="boolean"&&(re=G instanceof yt()),this.objectMode=!!(O&&O.objectMode),re&&(this.objectMode=this.objectMode||!!(O&&O.writableObjectMode)),this.highWaterMark=O?_(this,O,"writableHighWaterMark",re):x(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const ue=!!(O&&O.decodeStrings===!1);this.decodeStrings=!ue,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=v.bind(void 0,G),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,j(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!O||O.emitClose!==!1,this.autoDestroy=!O||O.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[B]=[]}function j(O){O.buffered=[],O.bufferedIndex=0,O.allBuffers=!0,O.allNoop=!0}A.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(A.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Y(O){const G=this instanceof yt();if(!G&&!n(Y,this))return new Y(O);this._writableState=new A(O,this,G),O&&(typeof O.write=="function"&&(this._write=O.write),typeof O.writev=="function"&&(this._writev=O.writev),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.final=="function"&&(this._final=O.final),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&m(O.signal,this)),y.call(this,O),g.construct(this,()=>{const re=this._writableState;re.writing||ae(this,re),F(this,re)})}i(Y,d,{__proto__:null,value:function(O){return n(this,O)?!0:this!==Y?!1:O&&O._writableState instanceof A}}),Y.prototype.pipe=function(){R(this,new c)};function L(O,G,re,ue){const de=O._writableState;if(typeof re=="function")ue=re,re=de.defaultEncoding;else{if(!re)re=de.defaultEncoding;else if(re!=="buffer"&&!w.isEncoding(re))throw new q(re);typeof ue!="function"&&(ue=M)}if(G===null)throw new D;if(!de.objectMode)if(typeof G=="string")de.decodeStrings!==!1&&(G=w.from(G,re),re="buffer");else if(G instanceof w)re="buffer";else if(y._isUint8Array(G))G=y._uint8ArrayToBuffer(G),re="buffer";else throw new S("chunk",["string","Buffer","Uint8Array"],G);let pe;return de.ending?pe=new T:de.destroyed&&(pe=new p("write")),pe?(r.nextTick(ue,pe),R(O,pe,!0),pe):(de.pendingcb++,ee(O,de,G,re,ue))}Y.prototype.write=function(O,G,re){return L(this,O,G,re)===!0},Y.prototype.cork=function(){this._writableState.corked++},Y.prototype.uncork=function(){const O=this._writableState;O.corked&&(O.corked--,O.writing||ae(this,O))},Y.prototype.setDefaultEncoding=function(G){if(typeof G=="string"&&(G=o(G)),!w.isEncoding(G))throw new q(G);return this._writableState.defaultEncoding=G,this};function ee(O,G,re,ue,de){const pe=G.objectMode?1:re.length;G.length+=pe;const X=G.length<G.highWaterMark;return X||(G.needDrain=!0),G.writing||G.corked||G.errored||!G.constructed?(G.buffered.push({chunk:re,encoding:ue,callback:de}),G.allBuffers&&ue!=="buffer"&&(G.allBuffers=!1),G.allNoop&&de!==M&&(G.allNoop=!1)):(G.writelen=pe,G.writecb=de,G.writing=!0,G.sync=!0,O._write(re,ue,G.onwrite),G.sync=!1),X&&!G.errored&&!G.destroyed}function C(O,G,re,ue,de,pe,X){G.writelen=ue,G.writecb=X,G.writing=!0,G.sync=!0,G.destroyed?G.onwrite(new p("write")):re?O._writev(de,G.onwrite):O._write(de,pe,G.onwrite),G.sync=!1}function K(O,G,re,ue){--G.pendingcb,ue(re),z(G),R(O,re)}function v(O,G){const re=O._writableState,ue=re.sync,de=re.writecb;if(typeof de!="function"){R(O,new b);return}re.writing=!1,re.writecb=null,re.length-=re.writelen,re.writelen=0,G?(G.stack,re.errored||(re.errored=G),O._readableState&&!O._readableState.errored&&(O._readableState.errored=G),ue?r.nextTick(K,O,re,G,de):K(O,re,G,de)):(re.buffered.length>re.bufferedIndex&&ae(O,re),ue?re.afterWriteTickInfo!==null&&re.afterWriteTickInfo.cb===de?re.afterWriteTickInfo.count++:(re.afterWriteTickInfo={count:1,cb:de,stream:O,state:re},r.nextTick(U,re.afterWriteTickInfo)):Q(O,re,1,de))}function U({stream:O,state:G,count:re,cb:ue}){return G.afterWriteTickInfo=null,Q(O,G,re,ue)}function Q(O,G,re,ue){for(!G.ending&&!O.destroyed&&G.length===0&&G.needDrain&&(G.needDrain=!1,O.emit("drain"));re-- >0;)G.pendingcb--,ue();G.destroyed&&z(G),F(O,G)}function z(O){if(O.writing)return;for(let de=O.bufferedIndex;de<O.buffered.length;++de){var G;const{chunk:pe,callback:X}=O.buffered[de],le=O.objectMode?1:pe.length;O.length-=le,X((G=O.errored)!==null&&G!==void 0?G:new p("write"))}const re=O[B].splice(0);for(let de=0;de<re.length;de++){var ue;re[de]((ue=O.errored)!==null&&ue!==void 0?ue:new p("end"))}j(O)}function ae(O,G){if(G.corked||G.bufferProcessing||G.destroyed||!G.constructed)return;const{buffered:re,bufferedIndex:ue,objectMode:de}=G,pe=re.length-ue;if(!pe)return;let X=ue;if(G.bufferProcessing=!0,pe>1&&O._writev){G.pendingcb-=pe-1;const le=G.allNoop?M:se=>{for(let Ee=X;Ee<re.length;++Ee)re[Ee].callback(se)},he=G.allNoop&&X===0?re:e(re,X);he.allBuffers=G.allBuffers,C(O,G,!0,G.length,he,"",le),j(G)}else{do{const{chunk:le,encoding:he,callback:se}=re[X];re[X++]=null;const Ee=de?1:le.length;C(O,G,!1,Ee,le,he,se)}while(X<re.length&&!G.writing);X===re.length?j(G):X>256?(re.splice(0,X),G.bufferedIndex=0):G.bufferedIndex=X}G.bufferProcessing=!1}Y.prototype._write=function(O,G,re){if(this._writev)this._writev([{chunk:O,encoding:G}],re);else throw new I("_write()")},Y.prototype._writev=null,Y.prototype.end=function(O,G,re){const ue=this._writableState;typeof O=="function"?(re=O,O=null,G=null):typeof G=="function"&&(re=G,G=null);let de;if(O!=null){const pe=L(this,O,G);pe instanceof t&&(de=pe)}return ue.corked&&(ue.corked=1,this.uncork()),de||(!ue.errored&&!ue.ending?(ue.ending=!0,F(this,ue,!0),ue.ended=!0):ue.finished?de=new N("end"):ue.destroyed&&(de=new p("end"))),typeof re=="function"&&(de||ue.finished?r.nextTick(re,de):ue[B].push(re)),this};function H(O){return O.ending&&!O.destroyed&&O.constructed&&O.length===0&&!O.errored&&O.buffered.length===0&&!O.finished&&!O.writing&&!O.errorEmitted&&!O.closeEmitted}function V(O,G){let re=!1;function ue(de){if(re){R(O,de??b());return}if(re=!0,G.pendingcb--,de){const pe=G[B].splice(0);for(let X=0;X<pe.length;X++)pe[X](de);R(O,de,G.sync)}else H(G)&&(G.prefinished=!0,O.emit("prefinish"),G.pendingcb++,r.nextTick(Z,O,G))}G.sync=!0,G.pendingcb++;try{O._final(ue)}catch(de){ue(de)}G.sync=!1}function W(O,G){!G.prefinished&&!G.finalCalled&&(typeof O._final=="function"&&!G.destroyed?(G.finalCalled=!0,V(O,G)):(G.prefinished=!0,O.emit("prefinish")))}function F(O,G,re){H(G)&&(W(O,G),G.pendingcb===0&&(re?(G.pendingcb++,r.nextTick((ue,de)=>{H(de)?Z(ue,de):de.pendingcb--},O,G)):H(G)&&(G.pendingcb++,Z(O,G))))}function Z(O,G){G.pendingcb--,G.finished=!0;const re=G[B].splice(0);for(let ue=0;ue<re.length;ue++)re[ue]();if(O.emit("finish"),G.autoDestroy){const ue=O._readableState;(!ue||ue.autoDestroy&&(ue.endEmitted||ue.readable===!1))&&O.destroy()}}s(Y.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(O){this._writableState&&(this._writableState.destroyed=O)}},writable:{__proto__:null,get(){const O=this._writableState;return!!O&&O.writable!==!1&&!O.destroyed&&!O.errored&&!O.ending&&!O.ended},set(O){this._writableState&&(this._writableState.writable=!!O)}},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 O=this._writableState;return O?!O.destroyed&&!O.ending&&O.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 te=g.destroy;Y.prototype.destroy=function(O,G){const re=this._writableState;return!re.destroyed&&(re.bufferedIndex<re.buffered.length||re[B].length)&&r.nextTick(z,re),te.call(this,O,G),this},Y.prototype._undestroy=g.undestroy,Y.prototype._destroy=function(O,G){G(O)},Y.prototype[h.captureRejectionSymbol]=function(O){this.destroy(O)};let ce;function fe(){return ce===void 0&&(ce={}),ce}return Y.fromWeb=function(O,G){return fe().newStreamWritableFromWritableStream(O,G)},Y.toWeb=function(O){return fe().newWritableStreamFromStreamWritable(O)},ui}var ci,to;function Gc(){if(to)return ci;to=1;const r=Vt(),e=bt(),{isReadable:t,isWritable:n,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:l,isReadableStream:d,isWritableStream:h}=wt(),y=Tt(),{AbortError:w,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:m}}=Ve(),{destroyer:_}=ur(),x=yt(),S=jn(),I=Us(),{createDeferredPromise:b}=ze(),c=bu(),p=globalThis.Blob||e.Blob,N=typeof p<"u"?function(A){return A instanceof p}:function(A){return!1},D=globalThis.AbortController||Gr().AbortController,{FunctionPrototypeCall:T}=$e();class q extends x{constructor(A){super(A),A?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),A?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}ci=function B(A,j){if(l(A))return A;if(a(A))return M({readable:A});if(o(A))return M({writable:A});if(s(A))return M({writable:!1,readable:!1});if(d(A))return M({readable:S.fromWeb(A)});if(h(A))return M({writable:I.fromWeb(A)});if(typeof A=="function"){const{value:L,write:ee,final:C,destroy:K}=R(A);if(i(L))return c(q,L,{objectMode:!0,write:ee,final:C,destroy:K});const v=L?.then;if(typeof v=="function"){let U;const Q=T(v,L,z=>{if(z!=null)throw new m("nully","body",z)},z=>{_(U,z)});return U=new q({objectMode:!0,readable:!1,write:ee,final(z){C(async()=>{try{await Q,r.nextTick(z,null)}catch(ae){r.nextTick(z,ae)}})},destroy:K})}throw new m("Iterable, AsyncIterable or AsyncFunction",j,L)}if(N(A))return B(A.arrayBuffer());if(i(A))return c(q,A,{objectMode:!0,writable:!1});if(d(A?.readable)&&h(A?.writable))return q.fromWeb(A);if(typeof A?.writable=="object"||typeof A?.readable=="object"){const L=A!=null&&A.readable?a(A?.readable)?A?.readable:B(A.readable):void 0,ee=A!=null&&A.writable?o(A?.writable)?A?.writable:B(A.writable):void 0;return M({readable:L,writable:ee})}const Y=A?.then;if(typeof Y=="function"){let L;return T(Y,A,ee=>{ee!=null&&L.push(ee),L.push(null)},ee=>{_(L,ee)}),L=new q({objectMode:!0,writable:!1,read(){}})}throw new g(j,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],A)};function R(B){let{promise:A,resolve:j}=b();const Y=new D,L=Y.signal;return{value:B(async function*(){for(;;){const C=A;A=null;const{chunk:K,done:v,cb:U}=await C;if(r.nextTick(U),v)return;if(L.aborted)throw new w(void 0,{cause:L.reason});({promise:A,resolve:j}=b()),yield K}}(),{signal:L}),write(C,K,v){const U=j;j=null,U({chunk:C,done:!1,cb:v})},final(C){const K=j;j=null,K({done:!0,cb:C})},destroy(C,K){Y.abort(),K(C)}}}function M(B){const A=B.readable&&typeof B.readable.read!="function"?S.wrap(B.readable):B.readable,j=B.writable;let Y=!!t(A),L=!!n(j),ee,C,K,v,U;function Q(z){const ae=v;v=null,ae?ae(z):z&&U.destroy(z)}return U=new q({readableObjectMode:!!(A!=null&&A.readableObjectMode),writableObjectMode:!!(j!=null&&j.writableObjectMode),readable:Y,writable:L}),L&&(y(j,z=>{L=!1,z&&_(A,z),Q(z)}),U._write=function(z,ae,H){j.write(z,ae)?H():ee=H},U._final=function(z){j.end(),C=z},j.on("drain",function(){if(ee){const z=ee;ee=null,z()}}),j.on("finish",function(){if(C){const z=C;C=null,z()}})),Y&&(y(A,z=>{Y=!1,z&&_(A,z),Q(z)}),A.on("readable",function(){if(K){const z=K;K=null,z()}}),A.on("end",function(){U.push(null)}),U._read=function(){for(;;){const z=A.read();if(z===null){K=U._read;return}if(!U.push(z))return}}),U._destroy=function(z,ae){!z&&v!==null&&(z=new w),K=null,ee=null,C=null,v===null?ae(z):(v=ae,_(j,z),_(A,z))},U}return ci}var di,ro;function yt(){if(ro)return di;ro=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=$e();di=a;const i=jn(),s=Us();n(a.prototype,i.prototype),n(a,i);{const h=t(s.prototype);for(let y=0;y<h.length;y++){const w=h[y];a.prototype[w]||(a.prototype[w]=s.prototype[w])}}function a(h){if(!(this instanceof a))return new a(h);i.call(this,h),s.call(this,h),h?(this.allowHalfOpen=h.allowHalfOpen!==!1,h.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),h.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(h){this._readableState&&this._writableState&&(this._readableState.destroyed=h,this._writableState.destroyed=h)}}});let o;function l(){return o===void 0&&(o={}),o}a.fromWeb=function(h,y){return l().newStreamDuplexFromReadableWritablePair(h,y)},a.toWeb=function(h){return l().newReadableWritablePairFromDuplex(h)};let d;return a.from=function(h){return d||(d=Gc()),d(h,"body")},di}var fi,no;function wu(){if(no)return fi;no=1;const{ObjectSetPrototypeOf:r,Symbol:e}=$e();fi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=Ve().codes,n=yt(),{getHighWaterMark:i}=Ln();r(a.prototype,n.prototype),r(a,n);const s=e("kCallback");function a(d){if(!(this instanceof a))return new a(d);const h=d?i(this,d,"readableHighWaterMark",!0):null;h===0&&(d={...d,highWaterMark:null,readableHighWaterMark:h,writableHighWaterMark:d.writableHighWaterMark||0}),n.call(this,d),this._readableState.sync=!1,this[s]=null,d&&(typeof d.transform=="function"&&(this._transform=d.transform),typeof d.flush=="function"&&(this._flush=d.flush)),this.on("prefinish",l)}function o(d){typeof this._flush=="function"&&!this.destroyed?this._flush((h,y)=>{if(h){d?d(h):this.destroy(h);return}y!=null&&this.push(y),this.push(null),d&&d()}):(this.push(null),d&&d())}function l(){this._final!==o&&o.call(this)}return a.prototype._final=o,a.prototype._transform=function(d,h,y){throw new t("_transform()")},a.prototype._write=function(d,h,y){const w=this._readableState,g=this._writableState,m=w.length;this._transform(d,h,(_,x)=>{if(_){y(_);return}x!=null&&this.push(x),g.ended||m===w.length||w.length<w.highWaterMark?y():this[s]=y})},a.prototype._read=function(){if(this[s]){const d=this[s];this[s]=null,d()}},fi}var hi,io;function vu(){if(io)return hi;io=1;const{ObjectSetPrototypeOf:r}=$e();hi=t;const e=wu();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)},hi}var pi,so;function Hs(){if(so)return pi;so=1;const r=Vt(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=$e(),s=Tt(),{once:a}=ze(),o=ur(),l=yt(),{aggregateTwoErrors:d,codes:{ERR_INVALID_ARG_TYPE:h,ERR_INVALID_RETURN_VALUE:y,ERR_MISSING_ARGS:w,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:m},AbortError:_}=Ve(),{validateFunction:x,validateAbortSignal:S}=Xr(),{isIterable:I,isReadable:b,isReadableNodeStream:c,isNodeStream:p,isTransformStream:N,isWebStream:D,isReadableStream:T,isReadableFinished:q}=wt(),R=globalThis.AbortController||Gr().AbortController;let M,B,A;function j(z,ae,H){let V=!1;z.on("close",()=>{V=!0});const W=s(z,{readable:ae,writable:H},F=>{V=!F});return{destroy:F=>{V||(V=!0,o.destroyer(z,F||new g("pipe")))},cleanup:W}}function Y(z){return x(z[z.length-1],"streams[stream.length - 1]"),z.pop()}function L(z){if(I(z))return z;if(c(z))return ee(z);throw new h("val",["Readable","Iterable","AsyncIterable"],z)}async function*ee(z){B||(B=jn()),yield*B.prototype[n].call(z)}async function C(z,ae,H,{end:V}){let W,F=null;const Z=fe=>{if(fe&&(W=fe),F){const O=F;F=null,O()}},te=()=>new t((fe,O)=>{W?O(W):F=()=>{W?O(W):fe()}});ae.on("drain",Z);const ce=s(ae,{readable:!1},Z);try{ae.writableNeedDrain&&await te();for await(const fe of z)ae.write(fe)||await te();V&&(ae.end(),await te()),H()}catch(fe){H(W!==fe?d(W,fe):fe)}finally{ce(),ae.off("drain",Z)}}async function K(z,ae,H,{end:V}){N(ae)&&(ae=ae.writable);const W=ae.getWriter();try{for await(const F of z)await W.ready,W.write(F).catch(()=>{});await W.ready,V&&await W.close(),H()}catch(F){try{await W.abort(F),H(F)}catch(Z){H(Z)}}}function v(...z){return U(z,a(Y(z)))}function U(z,ae,H){if(z.length===1&&e(z[0])&&(z=z[0]),z.length<2)throw new w("streams");const V=new R,W=V.signal,F=H?.signal,Z=[];S(F,"options.signal");function te(){de(new _)}A=A||ze().addAbortListener;let ce;F&&(ce=A(F,te));let fe,O;const G=[];let re=0;function ue(he){de(he,--re===0)}function de(he,se){var Ee;if(he&&(!fe||fe.code==="ERR_STREAM_PREMATURE_CLOSE")&&(fe=he),!(!fe&&!se)){for(;G.length;)G.shift()(fe);(Ee=ce)===null||Ee===void 0||Ee[i](),V.abort(),se&&(fe||Z.forEach(qe=>qe()),r.nextTick(ae,fe,O))}}let pe;for(let he=0;he<z.length;he++){const se=z[he],Ee=he<z.length-1,qe=he>0,_e=Ee||H?.end!==!1,He=he===z.length-1;if(p(se)){let E=function(u){u&&u.name!=="AbortError"&&u.code!=="ERR_STREAM_PREMATURE_CLOSE"&&ue(u)};if(_e){const{destroy:u,cleanup:f}=j(se,Ee,qe);G.push(u),b(se)&&He&&Z.push(f)}se.on("error",E),b(se)&&He&&Z.push(()=>{se.removeListener("error",E)})}if(he===0)if(typeof se=="function"){if(pe=se({signal:W}),!I(pe))throw new y("Iterable, AsyncIterable or Stream","source",pe)}else I(se)||c(se)||N(se)?pe=se:pe=l.from(se);else if(typeof se=="function"){if(N(pe)){var X;pe=L((X=pe)===null||X===void 0?void 0:X.readable)}else pe=L(pe);if(pe=se(pe,{signal:W}),Ee){if(!I(pe,!0))throw new y("AsyncIterable",`transform[${he-1}]`,pe)}else{var le;M||(M=vu());const E=new M({objectMode:!0}),u=(le=pe)===null||le===void 0?void 0:le.then;if(typeof u=="function")re++,u.call(pe,J=>{O=J,J!=null&&E.write(J),_e&&E.end(),r.nextTick(ue)},J=>{E.destroy(J),r.nextTick(ue,J)});else if(I(pe,!0))re++,C(pe,E,ue,{end:_e});else if(T(pe)||N(pe)){const J=pe.readable||pe;re++,C(J,E,ue,{end:_e})}else throw new y("AsyncIterable or Promise","destination",pe);pe=E;const{destroy:f,cleanup:k}=j(pe,!1,!0);G.push(f),He&&Z.push(k)}}else if(p(se)){if(c(pe)){re+=2;const E=Q(pe,se,ue,{end:_e});b(se)&&He&&Z.push(E)}else if(N(pe)||T(pe)){const E=pe.readable||pe;re++,C(E,se,ue,{end:_e})}else if(I(pe))re++,C(pe,se,ue,{end:_e});else throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],pe);pe=se}else if(D(se)){if(c(pe))re++,K(L(pe),se,ue,{end:_e});else if(T(pe)||I(pe))re++,K(pe,se,ue,{end:_e});else if(N(pe))re++,K(pe.readable,se,ue,{end:_e});else throw new h("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],pe);pe=se}else pe=l.from(se)}return(W!=null&&W.aborted||F!=null&&F.aborted)&&r.nextTick(te),pe}function Q(z,ae,H,{end:V}){let W=!1;if(ae.on("close",()=>{W||H(new m)}),z.pipe(ae,{end:!1}),V){let F=function(){W=!0,ae.end()};q(z)?r.nextTick(F):z.once("end",F)}else H();return s(z,{readable:!0,writable:!1},F=>{const Z=z._readableState;F&&F.code==="ERR_STREAM_PREMATURE_CLOSE"&&Z&&Z.ended&&!Z.errored&&!Z.errorEmitted?z.once("end",H).once("error",H):H(F)}),s(ae,{readable:!1,writable:!0},H)}return pi={pipelineImpl:U,pipeline:v},pi}var gi,ao;function _u(){if(ao)return gi;ao=1;const{pipeline:r}=Hs(),e=yt(),{destroyer:t}=ur(),{isNodeStream:n,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:l,isReadableStream:d}=wt(),{AbortError:h,codes:{ERR_INVALID_ARG_VALUE:y,ERR_MISSING_ARGS:w}}=Ve(),g=Tt();return gi=function(..._){if(_.length===0)throw new w("streams");if(_.length===1)return e.from(_[0]);const x=[..._];if(typeof _[0]=="function"&&(_[0]=e.from(_[0])),typeof _[_.length-1]=="function"){const M=_.length-1;_[M]=e.from(_[M])}for(let M=0;M<_.length;++M)if(!(!n(_[M])&&!a(_[M]))){if(M<_.length-1&&!(i(_[M])||d(_[M])||o(_[M])))throw new y(`streams[${M}]`,x[M],"must be readable");if(M>0&&!(s(_[M])||l(_[M])||o(_[M])))throw new y(`streams[${M}]`,x[M],"must be writable")}let S,I,b,c,p;function N(M){const B=c;c=null,B?B(M):M?p.destroy(M):!R&&!q&&p.destroy()}const D=_[0],T=r(_,N),q=!!(s(D)||l(D)||o(D)),R=!!(i(T)||d(T)||o(T));if(p=new e({writableObjectMode:!!(D!=null&&D.writableObjectMode),readableObjectMode:!!(T!=null&&T.readableObjectMode),writable:q,readable:R}),q){if(n(D))p._write=function(B,A,j){D.write(B,A)?j():S=j},p._final=function(B){D.end(),I=B},D.on("drain",function(){if(S){const B=S;S=null,B()}});else if(a(D)){const A=(o(D)?D.writable:D).getWriter();p._write=async function(j,Y,L){try{await A.ready,A.write(j).catch(()=>{}),L()}catch(ee){L(ee)}},p._final=async function(j){try{await A.ready,A.close().catch(()=>{}),I=j}catch(Y){j(Y)}}}const M=o(T)?T.readable:T;g(M,()=>{if(I){const B=I;I=null,B()}})}if(R){if(n(T))T.on("readable",function(){if(b){const M=b;b=null,M()}}),T.on("end",function(){p.push(null)}),p._read=function(){for(;;){const M=T.read();if(M===null){b=p._read;return}if(!p.push(M))return}};else if(a(T)){const B=(o(T)?T.readable:T).getReader();p._read=async function(){for(;;)try{const{value:A,done:j}=await B.read();if(!p.push(A))return;if(j){p.push(null);return}}catch{return}}}}return p._destroy=function(M,B){!M&&c!==null&&(M=new h),b=null,S=null,I=null,c===null?B(M):(c=B,n(T)&&t(T,M))},p},gi}var oo;function Wc(){if(oo)return sn;oo=1;const r=globalThis.AbortController||Gr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:n,ERR_OUT_OF_RANGE:i},AbortError:s}=Ve(),{validateAbortSignal:a,validateInteger:o,validateObject:l}=Xr(),d=$e().Symbol("kWeak"),h=$e().Symbol("kResistStopPropagation"),{finished:y}=Tt(),w=_u(),{addAbortSignalNoValidate:g}=An(),{isWritable:m,isNodeStream:_}=wt(),{deprecate:x}=ze(),{ArrayPrototypePush:S,Boolean:I,MathFloor:b,Number:c,NumberIsNaN:p,Promise:N,PromiseReject:D,PromiseResolve:T,PromisePrototypeThen:q,Symbol:R}=$e(),M=R("kEmpty"),B=R("kEof");function A(F,Z){if(Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),_(F)&&!m(F))throw new e("stream",F,"must be writable");const te=w(this,F);return Z!=null&&Z.signal&&g(Z.signal,te),te}function j(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal");let te=1;Z?.concurrency!=null&&(te=b(Z.concurrency));let ce=te-1;return Z?.highWaterMark!=null&&(ce=b(Z.highWaterMark)),o(te,"options.concurrency",1),o(ce,"options.highWaterMark",0),ce+=te,(async function*(){const O=ze().AbortSignalAny([Z?.signal].filter(I)),G=this,re=[],ue={signal:O};let de,pe,X=!1,le=0;function he(){X=!0,se()}function se(){le-=1,Ee()}function Ee(){pe&&!X&&le<te&&re.length<ce&&(pe(),pe=null)}async function qe(){try{for await(let _e of G){if(X)return;if(O.aborted)throw new s;try{if(_e=F(_e,ue),_e===M)continue;_e=T(_e)}catch(He){_e=D(He)}le+=1,q(_e,se,he),re.push(_e),de&&(de(),de=null),!X&&(re.length>=ce||le>=te)&&await new N(He=>{pe=He})}re.push(B)}catch(_e){const He=D(_e);q(He,se,he),re.push(He)}finally{X=!0,de&&(de(),de=null)}}qe();try{for(;;){for(;re.length>0;){const _e=await re[0];if(_e===B)return;if(O.aborted)throw new s;_e!==M&&(yield _e),re.shift(),Ee()}await new N(_e=>{de=_e})}}finally{X=!0,pe&&(pe(),pe=null)}}).call(this)}function Y(F=void 0){return F!=null&&l(F,"options"),F?.signal!=null&&a(F.signal,"options.signal"),(async function*(){let te=0;for await(const fe of this){var ce;if(F!=null&&(ce=F.signal)!==null&&ce!==void 0&&ce.aborted)throw new s({cause:F.signal.reason});yield[te++,fe]}}).call(this)}async function L(F,Z=void 0){for await(const te of v.call(this,F,Z))return!0;return!1}async function ee(F,Z=void 0){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);return!await L.call(this,async(...te)=>!await F(...te),Z)}async function C(F,Z){for await(const te of v.call(this,F,Z))return te}async function K(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);async function te(ce,fe){return await F(ce,fe),M}for await(const ce of j.call(this,te,Z));}function v(F,Z){if(typeof F!="function")throw new t("fn",["Function","AsyncFunction"],F);async function te(ce,fe){return await F(ce,fe)?ce:M}return j.call(this,te,Z)}class U extends n{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Q(F,Z,te){var ce;if(typeof F!="function")throw new t("reducer",["Function","AsyncFunction"],F);te!=null&&l(te,"options"),te?.signal!=null&&a(te.signal,"options.signal");let fe=arguments.length>1;if(te!=null&&(ce=te.signal)!==null&&ce!==void 0&&ce.aborted){const de=new s(void 0,{cause:te.signal.reason});throw this.once("error",()=>{}),await y(this.destroy(de)),de}const O=new r,G=O.signal;if(te!=null&&te.signal){const de={once:!0,[d]:this,[h]:!0};te.signal.addEventListener("abort",()=>O.abort(),de)}let re=!1;try{for await(const de of this){var ue;if(re=!0,te!=null&&(ue=te.signal)!==null&&ue!==void 0&&ue.aborted)throw new s;fe?Z=await F(Z,de,{signal:G}):(Z=de,fe=!0)}if(!re&&!fe)throw new U}finally{O.abort()}return Z}async function z(F){F!=null&&l(F,"options"),F?.signal!=null&&a(F.signal,"options.signal");const Z=[];for await(const ce of this){var te;if(F!=null&&(te=F.signal)!==null&&te!==void 0&&te.aborted)throw new s(void 0,{cause:F.signal.reason});S(Z,ce)}return Z}function ae(F,Z){const te=j.call(this,F,Z);return(async function*(){for await(const fe of te)yield*fe}).call(this)}function H(F){if(F=c(F),p(F))return 0;if(F<0)throw new i("number",">= 0",F);return F}function V(F,Z=void 0){return Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),F=H(F),(async function*(){var ce;if(Z!=null&&(ce=Z.signal)!==null&&ce!==void 0&&ce.aborted)throw new s;for await(const O of this){var fe;if(Z!=null&&(fe=Z.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;F--<=0&&(yield O)}}).call(this)}function W(F,Z=void 0){return Z!=null&&l(Z,"options"),Z?.signal!=null&&a(Z.signal,"options.signal"),F=H(F),(async function*(){var ce;if(Z!=null&&(ce=Z.signal)!==null&&ce!==void 0&&ce.aborted)throw new s;for await(const O of this){var fe;if(Z!=null&&(fe=Z.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;if(F-- >0&&(yield O),F<=0)return}}).call(this)}return sn.streamReturningOperators={asIndexedPairs:x(Y,"readable.asIndexedPairs will be removed in a future version."),drop:V,filter:v,flatMap:ae,map:j,take:W,compose:A},sn.promiseReturningOperators={every:ee,forEach:K,reduce:Q,toArray:z,some:L,find:C},sn}var yi,lo;function xu(){if(lo)return yi;lo=1;const{ArrayPrototypePop:r,Promise:e}=$e(),{isIterable:t,isNodeStream:n,isWebStream:i}=wt(),{pipelineImpl:s}=Hs(),{finished:a}=Tt();Su();function o(...l){return new e((d,h)=>{let y,w;const g=l[l.length-1];if(g&&typeof g=="object"&&!n(g)&&!t(g)&&!i(g)){const m=r(l);y=m.signal,w=m.end}s(l,(m,_)=>{m?h(m):d(_)},{signal:y,end:w})})}return yi={finished:a,pipeline:o},yi}var uo;function Su(){if(uo)return zn.exports;uo=1;const{Buffer:r}=bt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=$e(),{promisify:{custom:i}}=ze(),{streamReturningOperators:s,promiseReturningOperators:a}=Wc(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=Ve(),l=_u(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:h}=Ln(),{pipeline:y}=Hs(),{destroyer:w}=ur(),g=Tt(),m=xu(),_=wt(),x=zn.exports=Fs().Stream;x.isDestroyed=_.isDestroyed,x.isDisturbed=_.isDisturbed,x.isErrored=_.isErrored,x.isReadable=_.isReadable,x.isWritable=_.isWritable,x.Readable=jn();for(const I of t(s)){let c=function(...p){if(new.target)throw o();return x.Readable.from(n(b,this,p))};const b=s[I];e(c,"name",{__proto__:null,value:b.name}),e(c,"length",{__proto__:null,value:b.length}),e(x.Readable.prototype,I,{__proto__:null,value:c,enumerable:!1,configurable:!0,writable:!0})}for(const I of t(a)){let c=function(...p){if(new.target)throw o();return n(b,this,p)};const b=a[I];e(c,"name",{__proto__:null,value:b.name}),e(c,"length",{__proto__:null,value:b.length}),e(x.Readable.prototype,I,{__proto__:null,value:c,enumerable:!1,configurable:!0,writable:!0})}x.Writable=Us(),x.Duplex=yt(),x.Transform=wu(),x.PassThrough=vu(),x.pipeline=y;const{addAbortSignal:S}=An();return x.addAbortSignal=S,x.finished=g,x.destroy=w,x.compose=l,x.setDefaultHighWaterMark=d,x.getDefaultHighWaterMark=h,e(x,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return m}}),e(y,i,{__proto__:null,enumerable:!0,get(){return m.pipeline}}),e(g,i,{__proto__:null,enumerable:!0,get(){return m.finished}}),x.Stream=x,x._isUint8Array=function(b){return b instanceof Uint8Array},x._uint8ArrayToBuffer=function(b){return r.from(b.buffer,b.byteOffset,b.byteLength)},zn.exports}var co;function zc(){return co||(co=1,function(r){const e=Su(),t=xu(),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}(Wn)),Wn.exports}var Eu=zc();const mi=Symbol("iter");function Br(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=Br(r[n]||Object.create(null),e[n],t-1);return r}function Iu(r,e,t=4){let n=!1;for(const i in r)if(i in e){const s=t===0?null:Iu(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 Ru(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:Br({},r[i],t-1);else if(t!==0){const s=Ru(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 Jc{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||xe}_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 Dr(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&&(Ns(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${n}.${i}.${s}`:`.${t}.${n}.${i}`]}return this._ids[er(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${Ns(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:er(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 Fe{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||xe,this._entityIndex=t.entityIndex||new Jc({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,l){let d,h,y;const w=this._entities,g=this._termFromId(w[l]),m={subject:null,predicate:null,object:null};t&&((d=e,e={})[t]=d[t]);for(const _ in e)if(h=e[_]){m[s]=this._termFromId(w[_]),n&&((d=h,h={})[n]=d[n]);for(const x in h)if(y=h[x]){m[a]=this._termFromId(w[x]);const S=i?i in y?[i]:[]:Object.keys(y);for(let I=0;I<S.length;I++)m[o]=this._termFromId(w[S[I]]),yield this._factory.quad(m.subject,m.predicate,m.object,g)}}}_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,l;t&&((a=e,e={})[t]=a[t]);for(const d in e)if(o=e[d]){n&&((a=o,o={})[n]=a[n]);for(const h in o)(l=o[h])&&(i?i in l&&s++:s+=Object.keys(l).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,l;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(n=n&&this._termToNumericId(n))||!(a=s[i])||!(o=a.subjects[e])||!(l=o[t])||!(n in l))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 Eu.Readable({objectMode:!0}),a=this.readQuads(e,t,n,i);return s._read=o=>{for(;--o>=0;){const{done:l,value:d}=a.next();if(l){s.push(null);return}s.push(d)}},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,l,d;if(!(e&&!(o=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||n&&!(d=this._termToNumericId(n))))for(const h in s)(a=s[h])&&(o?d?yield*this._findInIndex(a.objects,d,o,l,"object","subject","predicate",h):yield*this._findInIndex(a.subjects,o,l,null,"subject","predicate","object",h):l?yield*this._findInIndex(a.predicates,l,d,null,"predicate","object","subject",h):d?yield*this._findInIndex(a.objects,d,null,null,"object","subject","predicate",h):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",h))}match(e,t,n,i){return new St(this,e,t,n,i,{entityIndex:this._entityIndex})}countQuads(e,t,n,i){const s=this._getGraphs(i);let a=0,o,l,d,h;if(e&&!(l=this._termToNumericId(e))||t&&!(d=this._termToNumericId(t))||n&&!(h=this._termToNumericId(n)))return 0;for(const y in s)(o=s[y])&&(e?n?a+=this._countInIndex(o.objects,h,l,d):a+=this._countInIndex(o.subjects,l,d,h):t?a+=this._countInIndex(o.predicates,d,h,l):a+=this._countInIndex(o.objects,h,l,d));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,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.predicates,o,l,e):this._loopByKey1(a.subjects,o,e):l?this._loopByKey0(a.objects,l,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,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.objects,l,o,e):this._loopByKey0(a.subjects,o,e):l?this._loopByKey1(a.predicates,l,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,l;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?l?this._loopBy2Keys(a.subjects,o,l,e):this._loopByKey1(a.objects,o,e):l?this._loopByKey0(a.predicates,l,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,l)=>{throw new Error(`${o.value} ${l}`)},s=this.getQuads(null,Pe.rdf.rest,Pe.rdf.nil,null),a=e?[...s]:[];return s.forEach(o=>{const l=[];let d=!1,h,y;const w=o.graph;let g=o.subject;for(;g&&!d;){const m=this.getQuads(null,null,g,null),_=this.getQuads(g,null,null,null);let x,S=null,I=null,b=null;for(let c=0;c<_.length&&!d;c++)x=_[c],x.graph.equals(w)?h?d=i(g,"has non-list arcs out"):x.predicate.value===Pe.rdf.first?S?d=i(g,"has multiple rdf:first arcs"):a.push(S=x):x.predicate.value===Pe.rdf.rest?I?d=i(g,"has multiple rdf:rest arcs"):a.push(I=x):m.length?d=i(g,"can't be subject and object"):(h=x,y="subject"):d=i(g,"not confined to single graph");for(let c=0;c<m.length&&!d;++c)x=m[c],h?d=i(g,"can't have coreferences"):x.predicate.value===Pe.rdf.rest?b?d=i(g,"has incoming rdf:rest arcs"):b=x:(h=x,y="object");S?l.unshift(S.object):d=i(g,"has no list head"),g=b&&b.subject}d?e=!1:h&&(n[h[y].value]=l)}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof St&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof Fe&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Br(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof St&&(e=e.filtered),e===this)return!0;if(!(e instanceof Fe)||this._entityIndex!==e._entityIndex)return e.every(d=>this.has(d));const t=this._graphs,n=e._graphs;let i,s,a,o,l;for(const d in n){if(!(i=t[d]))return!1;i=i.subjects;for(const h in s=n[d].subjects){if(!(a=i[h]))return!1;for(const y in o=s[h]){if(!(l=a[y]))return!1;for(const w in o[y])if(!(w in l))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 St&&(e=e.filtered),e===this)return new Fe({entityIndex:this._entityIndex});if(e instanceof Fe&&e._entityIndex===this._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),n=Ru(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 St&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new Fe({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e instanceof St&&(e=e.filtered),e===this){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=Br(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof Fe&&this._entityIndex===e._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),n=Iu(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 Fe({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 Bs().quadsToString(this)}union(e){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=Br(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function lt(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:lt(r[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class St extends Eu.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 Fe({factory:e._factory,entityIndex:this.options.entityIndex});let o,l,d;if(s&&!(o=a._termToNumericId(s))||i&&!(l=a._termToNumericId(i))||n&&!(d=a._termToNumericId(n)))return a;const h=e._getGraphs(t);for(const y in h){let w,g,m,_;(_=h[y])&&(!o&&l?(g=lt(_.predicates,[l,d,o]))&&(w=lt(_.subjects,[o,l,d]),m=lt(_.objects,[d,o,l])):d?(m=lt(_.objects,[d,o,l]))&&(w=lt(_.subjects,[o,l,d]),g=lt(_.predicates,[l,d,o])):(w=lt(_.subjects,[o,l,d]))&&(g=lt(_.predicates,[l,d,o]),m=lt(_.objects,[d,o,l])),w&&(a._graphs[y]={subjects:w,predicates:g,objects:m}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[mi]&&(this[mi]=this[Symbol.iterator]());const t=this[mi];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 Bs().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 St(this.filtered,e,t,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}const be="http://www.w3.org/ns/shacl#",fo="http://datashapes.org/dash#",Rt="http://www.w3.org/2001/XMLSchema#",Vs="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Gs="http://www.w3.org/2000/01/rdf-schema#",Ws="http://www.w3.org/2004/02/skos/core#",Qc="http://www.w3.org/2002/07/owl#",Xc="http://www.w3.org/ns/oa#",Kc="http://purl.org/dc/terms/",Yc="http://xmlns.com/foaf/0.1/",wn=xe.namedNode("loaded-shapes"),ut=xe.namedNode("loaded-data"),Ue=xe.namedNode(Vs+"type"),Ts=xe.namedNode(Kc+"conformsTo"),Zc=xe.namedNode(Gs+"subClassOf"),zs=xe.namedNode(Qc+"imports"),ed=xe.namedNode(Ws+"broader"),td=xe.namedNode(Ws+"narrower"),ln=xe.namedNode(be+"NodeShape"),rd=xe.namedNode(be+"IRI"),vn=xe.namedNode(be+"property"),Js=xe.namedNode(be+"class"),Wr=xe.namedNode(be+"targetClass"),nd=xe.namedNode(be+"nodeKind"),id=xe.namedNode(Rt+"string");function Fr(r,e,t=be,n){let i="";const s=sd(r,e,t,n);return s&&(i=s.value),i}function sd(r,e,t=be,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 ad(r){r.querySelector("input,select,textarea")?.focus()}function Pt(r,e){return Fr(r,"prefLabel",Ws,e)||Fr(r,"label",Gs,e)||Fr(r,"name",Yc,e)}function Nu(r,e,t){const n=[];for(const i of r)n.push({value:i,label:Pt(e.getQuads(i,null,null,null),t),children:[]});return n}function As(r,e){for(const t in e)r=r.replace(e[t],"");return r}function Tu(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(Ue,r,s)));e.parent&&Tu(r,e.parent,t,n,i)}function Qs(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return Nu(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(Ue,r,wn);t.push(...e.config.store.getSubjects(Ue,r,ut)),Tu(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:Pt(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,ed,null))i.set(a.id,o.id),n.has(o.id)||n.set(o.id,{value:o,label:Pt(e.config.store.getQuads(o,null,null,null),e.config.languages),children:[]});for(const o of e.config.store.getObjects(a,td,null))i.set(o.id,a.id),n.has(o.id)||n.set(o.id,{value:o,label:Pt(e.config.store.getQuads(o,null,null,null),e.config.languages),children:[]})}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(Zc,r,null))s.push(...Qs(a,e));return s}}function Ls(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function ho(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 Au(r,e,t){const n=document.createElement("div");n.classList.add("shacl-or-constraint");const i=[];if(e instanceof Nt){const s=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],vn,null,null)>0);for(let d=0;d<r.length;d++)if(a){const h=t.store.getObjects(r[d],vn,null),y=[];let w="";for(const g of h){const m=new Sn(g,e,t);y.push(m),w+=(w.length>1?" / ":"")+m.template.label}s.push(y),i.push({label:w,value:d.toString()})}else{const h=new Sn(r[d],e,t);s.push([h]),i.push({label:h.template.label,value:d.toString()})}const o=t.theme.createListEditor("Please choose",null,!1,i),l=o.querySelector(".editor");l.onchange=()=>{if(l.value){const d=s[parseInt(l.value)];let h;d.length&&(h=d[0],n.replaceWith(d[0]));for(let y=1;y<d.length;y++)h.after(d[y]),h=d[y]}},n.appendChild(o)}else{const s=[];for(let l=0;l<r.length;l++){const d=t.store.getQuads(r[l],null,null,null);d.length&&(s.push(d),i.push({label:Pt(d,t.languages)||As(d[0].predicate.value,t.prefixes)+" = "+As(d[0].object.value,t.prefixes),value:l.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,i,e.template),o=a.querySelector(".editor");o.onchange=()=>{o.value&&n.replaceWith(gn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function od(r,e,t){if(e instanceof Ze){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===`${be}datatype`&&a.object.equals(n))return s}}else{const n=t.store.getObjects(e,Ue,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===`${be}node`){for(const o of n)if(t.store.getQuads(a.object,Wr,o,null).length>0)return s}if(a.predicate.equals(Js)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(nd)&&a.object.equals(rd))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function ld(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,vn,null);for(const a of s){const o=t.store.getObjects(a,`${be}path`,null);for(const l of o)if(i=t.store.countQuads(e,l,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 ud={[`${be}name`]:(r,e)=>{const t=e;r.name=ho(r.config.languages,r.name,t)},[`${be}description`]:(r,e)=>{const t=e;r.description=ho(r.config.languages,r.description,t)},[`${be}path`]:(r,e)=>{r.path=e.value},[`${be}node`]:(r,e)=>{r.node=e},[`${be}datatype`]:(r,e)=>{r.datatype=e},[`${be}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${be}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${be}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${be}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${be}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${be}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${be}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${be}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${be}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${be}pattern`]:(r,e)=>{r.pattern=e.value},[`${be}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${fo}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${fo}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Xc}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${be}and`]:(r,e)=>{r.shaclAnd=e.value},[`${be}in`]:(r,e)=>{r.shaclIn=e.value},[`${be}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=xe.namedNode(Vs+"langString")},[`${be}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${be}hasValue`]:(r,e)=>{r.hasValue=e},[`${be}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${be}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${be}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[zs.id]:(r,e)=>{r.owlImports.push(e)},[Js.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Wr,e,null);t.length>0&&(r.node=t[0])},[`${be}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)},[`${be}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 cd{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)ud[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Pt(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?As(this.path,this.config.prefixes):"unknown"),(this.node||this.shaclAnd)&&(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 dd=`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 hd{constructor(e){let t=fd;e&&(t+=`
76
- `+e),this.stylesheet=new CSSStyleSheet,this.stylesheet.replaceSync(t)}apply(e){}createViewer(e,t,r){const i=document.createElement("div"),s=document.createElement("label");s.innerHTML=e+":",r.description&&s.setAttribute("title",r.description.value),i.appendChild(s);let a=t.value,o=null;if(t instanceof Rn){const d=r.config.store.getQuads(a,null,null,null);if(d.length){const h=qt(d,r.config.languages);h&&(a=h)}}else t instanceof Ze&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Rt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Rt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let l;return js(t.value)?(l=document.createElement("a"),l.setAttribute("href",t.value)):l=document.createElement("div"),l.classList.add("d-flex"),l.innerText=a,o&&l.appendChild(o),i.appendChild(l),i}}function pd(n,e,t){if(t){const r=n.minCount!==void 0&&n.minCount>0;if(n.class)return n.config.theme.createListEditor(n.label,e,r,Xs(n.class,n),n);if(n.shaclIn){const i=n.config.lists[n.shaclIn];if(i?.length){const s=Tu(i,n.config.store,n.config.languages);return n.config.theme.createListEditor(n.label,e,r,s,n)}else console.error("list not found:",n.shaclIn,"existing lists:",n.config.lists)}if(n.datatype?.value===`${Gs}langString`||n.languageIn?.length)return n.config.theme.createLangStringEditor(n.label,e,r,n);switch(n.datatype?.value.replace(Rt,"")){case"integer":case"float":case"double":case"decimal":return n.config.theme.createNumberEditor(n.label,e,r,n);case"date":case"dateTime":return n.config.theme.createDateEditor(n.label,e,r,n);case"boolean":return n.config.theme.createBooleanEditor(n.label,e,r,n);case"base64Binary":return n.config.theme.createFileEditor(n.label,e,r,n)}return n.config.theme.createTextEditor(n.label,e,r,n)}else{if(e)return n.config.theme.createViewer(n.label,e,n);const r=document.createElement("div");return r.innerHTML="No value",r}}function gd(n,e,t){if(e==="application/ld+json")return yd(n);{const r=new Fs({format:e,prefixes:t});r.addQuads(n);let i="";return r.end((s,a)=>{s&&console.error(s),i=a}),i}}function yd(n){const e=[];for(const t of n){const r={"@id":t.subject.id};if(t.predicate===Ue)r["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof Ze?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Rt}#string`&&(i={"@type":t.object.datatype.value,"@value":t.object.value}):i={"@id":t.object.id},r[t.predicate.value]=i}e.push(r)}return JSON.stringify(e)}function md(n){let e=n.shaclDatatype,t=n.value;if(t){if(n.dataset.class||n.dataset.nodeKind===be+"IRI")return xe.namedNode(t);if(n.dataset.link)return JSON.parse(n.dataset.link);if(n.dataset.lang?e=n.dataset.lang:n.type==="number"?t=parseFloat(t):n.type==="file"&&n.binaryData?t=n.binaryData:n.type==="datetime-local"&&(t=new Date(t).toISOString().slice(0,19)),!e&&typeof t=="string"){const r=t.split("^^");r.length===2&&(r[0].startsWith('"')&&r[0].endsWith('"')||r[0].startsWith("'")&&r[0].endsWith("'"))&&r[1].split(":").length===2&&(t=r[0].substring(1,r[0].length-1),e=xe.namedNode(r[1]))}return xe.literal(t,e)}else if((n.type==="checkbox"||n.getAttribute("type")==="checkbox")&&(n.checked||parseInt(n.dataset.minCount||"0")>0))return xe.literal(n.checked?"true":"false",e)}const Ur={};function bd(n){n.predicate===void 0&&n.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',n):Ur[`${n.predicate}^${n.datatype}`]=n}function wd(){return Object.entries(Ur).map(n=>n[1])}function vd(n,e){let t=Ur[`${n}^${e}`];return t||(t=Ur[`${n}^undefined`],t)?t:Ur[`undefined^${e}`]}class xy{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 fd{constructor(e){let t=dd;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 Rn){const d=n.config.store.getQuads(a,null,null,null);if(d.length){const h=Pt(d,n.config.languages);h&&(a=h)}}else t instanceof Ze&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Rt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Rt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let l;return Ls(t.value)?(l=document.createElement("a"),l.setAttribute("href",t.value)):l=document.createElement("div"),l.classList.add("d-flex"),l.innerText=a,o&&l.appendChild(o),i.appendChild(l),i}}function hd(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,Qs(r.class,r),r);if(r.shaclIn){const i=r.config.lists[r.shaclIn];if(i?.length){const s=Nu(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===`${Vs}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Rt,"")){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 pd(r,e,t){if(e==="application/ld+json")return gd(r);{const n=new Bs({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function gd(r){const e=[];for(const t of r){const n={"@id":t.subject.id};if(t.predicate===Ue)n["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof Ze?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Rt}#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 yd(r){let e=r.shaclDatatype,t=r.value;if(t){if(r.dataset.class||r.dataset.nodeKind===be+"IRI")return xe.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=xe.namedNode(n[1]))}return xe.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return xe.literal(r.checked?"true":"false",e)}const Ur={};function md(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):Ur[`${r.predicate}^${r.datatype}`]=r}function bd(){return Object.entries(Ur).map(r=>r[1])}function wd(r,e){let t=Ur[`${r}^${e}`];return t||(t=Ur[`${r}^undefined`],t)?t:Ur[`undefined^${e}`]}class _y{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 fn=globalThis,Ks=fn.ShadowRoot&&(fn.ShadyCSS===void 0||fn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ys=Symbol(),go=new WeakMap;let ju=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ys)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(Ks&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=go.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&go.set(t,e))}return e}toString(){return this.cssText}};const _d=n=>new ju(typeof n=="string"?n:n+"",void 0,Ys),vt=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((r,i,s)=>r+(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)+n[s+1],n[0]);return new ju(t,n,Ys)},xd=(n,e)=>{if(Ks)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const r=document.createElement("style"),i=fn.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},yo=Ks?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return _d(t)})(n):n;/**
80
+ */const fn=globalThis,Xs=fn.ShadowRoot&&(fn.ShadyCSS===void 0||fn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ks=Symbol(),po=new WeakMap;let Lu=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Ks)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(Xs&&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 vd=r=>new Lu(typeof r=="string"?r:r+"",void 0,Ks),vt=(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 Lu(t,r,Ks)},_d=(r,e)=>{if(Xs)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=fn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},go=Xs?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return vd(t)})(r):r;/**
81
81
  * @license
82
82
  * Copyright 2017 Google LLC
83
83
  * SPDX-License-Identifier: BSD-3-Clause
84
- */const{is:Sd,defineProperty:Ed,getOwnPropertyDescriptor:Id,getOwnPropertyNames:Rd,getOwnPropertySymbols:Nd,getPrototypeOf:Td}=Object,On=globalThis,mo=On.trustedTypes,Ad=mo?mo.emptyScript:"",Ld=On.reactiveElementPolyfillSupport,Hr=(n,e)=>n,Os={toAttribute(n,e){switch(e){case Boolean:n=n?Ad:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},Ou=(n,e)=>!Sd(n,e),bo={attribute:!0,type:String,converter:Os,reflect:!1,useDefault:!1,hasChanged:Ou};Symbol.metadata??=Symbol("metadata"),On.litPropertyMetadata??=new WeakMap;let Xt=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=bo){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 r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Ed(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:s}=Id(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,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??bo}static _$Ei(){if(this.hasOwnProperty(Hr("elementProperties")))return;const e=Td(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Hr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Hr("properties"))){const t=this.properties,r=[...Rd(t),...Nd(t)];for(const i of r)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const i of r)t.unshift(yo(i))}else e!==void 0&&t.push(yo(e));return t}static _$Eu(e,t){const r=t.attribute;return r===!1?void 0:typeof r=="string"?r: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 r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xd(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,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){const s=(r.converter?.toAttribute!==void 0?r.converter:Os).toAttribute(t,r.type);this._$Em=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$Em=null}}_$AK(e,t){const r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const s=r.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Os;this._$Em=i;const o=a.fromAttribute(t,s.type);this[i]=o??this._$Ej?.get(i)??o,this._$Em=null}}requestUpdate(e,t,r){if(e!==void 0){const i=this.constructor,s=this[e];if(r??=i.getPropertyOptions(e),!((r.hasChanged??Ou)(s,t)||r.useDefault&&r.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},a){r&&!(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||r||(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 r=this.constructor.elementProperties;if(r.size>0)for(const[i,s]of r){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(r=>r.hostUpdate?.()),this.update(t)):this._$EM()}catch(r){throw e=!1,this._$EM(),r}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){}};Xt.elementStyles=[],Xt.shadowRootOptions={mode:"open"},Xt[Hr("elementProperties")]=new Map,Xt[Hr("finalized")]=new Map,Ld?.({ReactiveElement:Xt}),(On.reactiveElementVersions??=[]).push("2.1.1");/**
84
+ */const{is:xd,defineProperty:Sd,getOwnPropertyDescriptor:Ed,getOwnPropertyNames:Id,getOwnPropertySymbols:Rd,getPrototypeOf:Nd}=Object,On=globalThis,yo=On.trustedTypes,Td=yo?yo.emptyScript:"",Ad=On.reactiveElementPolyfillSupport,Hr=(r,e)=>r,js={toAttribute(r,e){switch(e){case Boolean:r=r?Td: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}},ju=(r,e)=>!xd(r,e),mo={attribute:!0,type:String,converter:js,reflect:!1,useDefault:!1,hasChanged:ju};Symbol.metadata??=Symbol("metadata"),On.litPropertyMetadata??=new WeakMap;let Xt=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=mo){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&&Sd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Ed(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)??mo}static _$Ei(){if(this.hasOwnProperty(Hr("elementProperties")))return;const e=Nd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Hr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Hr("properties"))){const t=this.properties,n=[...Id(t),...Rd(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(go(i))}else e!==void 0&&t.push(go(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 _d(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:js).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:js;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??ju)(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){}};Xt.elementStyles=[],Xt.shadowRootOptions={mode:"open"},Xt[Hr("elementProperties")]=new Map,Xt[Hr("finalized")]=new Map,Ad?.({ReactiveElement:Xt}),(On.reactiveElementVersions??=[]).push("2.1.1");/**
85
85
  * @license
86
86
  * Copyright 2017 Google LLC
87
87
  * SPDX-License-Identifier: BSD-3-Clause
88
- */const Zs=globalThis,_n=Zs.trustedTypes,wo=_n?_n.createPolicy("lit-html",{createHTML:n=>n}):void 0,$u="$lit$",Et=`lit$${Math.random().toFixed(9).slice(2)}$`,ku="?"+Et,jd=`<${ku}>`,Bt=document,zr=()=>Bt.createComment(""),Jr=n=>n===null||typeof n!="object"&&typeof n!="function",ea=Array.isArray,Od=n=>ea(n)||typeof n?.[Symbol.iterator]=="function",bi=`[
89
- \f\r]`,vr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,vo=/-->/g,_o=/>/g,Ot=RegExp(`>|${bi}(?:([^\\s"'>=/]+)(${bi}*=${bi}*(?:[^
90
- \f\r"'\`<>=]|("|')|))|$)`,"g"),xo=/'/g,So=/"/g,Du=/^(?:script|style|textarea|title)$/i,$d=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),ct=$d(1),tr=Symbol.for("lit-noChange"),De=Symbol.for("lit-nothing"),Eo=new WeakMap,Ct=Bt.createTreeWalker(Bt,129);function Mu(n,e){if(!ea(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return wo!==void 0?wo.createHTML(e):e}const kd=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=vr;for(let o=0;o<t;o++){const l=n[o];let d,h,y=-1,w=0;for(;w<l.length&&(a.lastIndex=w,h=a.exec(l),h!==null);)w=a.lastIndex,a===vr?h[1]==="!--"?a=vo:h[1]!==void 0?a=_o:h[2]!==void 0?(Du.test(h[2])&&(i=RegExp("</"+h[2],"g")),a=Ot):h[3]!==void 0&&(a=Ot):a===Ot?h[0]===">"?(a=i??vr,y=-1):h[1]===void 0?y=-2:(y=a.lastIndex-h[2].length,d=h[1],a=h[3]===void 0?Ot:h[3]==='"'?So:xo):a===So||a===xo?a=Ot:a===vo||a===_o?a=vr:(a=Ot,i=void 0);const g=a===Ot&&n[o+1].startsWith("/>")?" ":"";s+=a===vr?l+jd:y>=0?(r.push(d),l.slice(0,y)+$u+l.slice(y)+Et+g):l+Et+(y===-2?o:g)}return[Mu(n,s+(n[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),r]};let $s=class Cu{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,a=0;const o=e.length-1,l=this.parts,[d,h]=kd(e,t);if(this.el=Cu.createElement(d,r),Ct.currentNode=this.el.content,t===2||t===3){const y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(i=Ct.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const y of i.getAttributeNames())if(y.endsWith($u)){const w=h[a++],g=i.getAttribute(y).split(Et),m=/([.?@])?(.*)/.exec(w);l.push({type:1,index:s,name:m[2],strings:g,ctor:m[1]==="."?Md:m[1]==="?"?Cd:m[1]==="@"?Pd:$n}),i.removeAttribute(y)}else y.startsWith(Et)&&(l.push({type:6,index:s}),i.removeAttribute(y));if(Du.test(i.tagName)){const y=i.textContent.split(Et),w=y.length-1;if(w>0){i.textContent=_n?_n.emptyScript:"";for(let g=0;g<w;g++)i.append(y[g],zr()),Ct.nextNode(),l.push({type:2,index:++s});i.append(y[w],zr())}}}else if(i.nodeType===8)if(i.data===ku)l.push({type:2,index:s});else{let y=-1;for(;(y=i.data.indexOf(Et,y+1))!==-1;)l.push({type:7,index:s}),y+=Et.length-1}s++}}static createElement(e,t){const r=Bt.createElement("template");return r.innerHTML=e,r}};function rr(n,e,t=n,r){if(e===tr)return e;let i=r!==void 0?t._$Co?.[r]:t._$Cl;const s=Jr(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(n),i._$AT(n,t,r)),r!==void 0?(t._$Co??=[])[r]=i:t._$Cl=i),i!==void 0&&(e=rr(n,i._$AS(n,e.values),i,r)),e}let Dd=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:r}=this._$AD,i=(e?.creationScope??Bt).importNode(t,!0);Ct.currentNode=i;let s=Ct.nextNode(),a=0,o=0,l=r[0];for(;l!==void 0;){if(a===l.index){let d;l.type===2?d=new ta(s,s.nextSibling,this,e):l.type===1?d=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(d=new qd(s,this,e)),this._$AV.push(d),l=r[++o]}a!==l?.index&&(s=Ct.nextNode(),a++)}return Ct.currentNode=Bt,i}p(e){let t=0;for(const r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},ta=class Pu{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,i){this.type=2,this._$AH=De,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,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=rr(this,e,t),Jr(e)?e===De||e==null||e===""?(this._$AH!==De&&this._$AR(),this._$AH=De):e!==this._$AH&&e!==tr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Od(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!==De&&Jr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Bt.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,i=typeof r=="number"?this._$AC(e):(r.el===void 0&&(r.el=$s.createElement(Mu(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new Dd(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=Eo.get(e.strings);return t===void 0&&Eo.set(e.strings,t=new $s(e)),t}k(e){ea(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,i=0;for(const s of e)i===t.length?t.push(r=new Pu(this.O(zr()),this.O(zr()),this,this.options)):r=t[i],r._$AI(s),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},$n=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,s){this.type=1,this._$AH=De,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=De}_$AI(e,t=this,r,i){const s=this.strings;let a=!1;if(s===void 0)e=rr(this,e,t,0),a=!Jr(e)||e!==this._$AH&&e!==tr,a&&(this._$AH=e);else{const o=e;let l,d;for(e=s[0],l=0;l<s.length-1;l++)d=rr(this,o[r+l],t,l),d===tr&&(d=this._$AH[l]),a||=!Jr(d)||d!==this._$AH[l],d===De?e=De:e!==De&&(e+=(d??"")+s[l+1]),this._$AH[l]=d}a&&!i&&this.j(e)}j(e){e===De?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Md=class extends $n{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===De?void 0:e}},Cd=class extends $n{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==De)}},Pd=class extends $n{constructor(e,t,r,i,s){super(e,t,r,i,s),this.type=5}_$AI(e,t=this){if((e=rr(this,e,t,0)??De)===tr)return;const r=this._$AH,i=e===De&&r!==De||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,s=e!==De&&(r===De||i);i&&this.element.removeEventListener(this.name,this,r),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)}},qd=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){rr(this,e)}};const Bd=Zs.litHtmlPolyfillSupport;Bd?.($s,ta),(Zs.litHtmlVersions??=[]).push("3.3.1");const Fd=(n,e,t)=>{const r=t?.renderBefore??e;let i=r._$litPart$;if(i===void 0){const s=t?.renderBefore??null;r._$litPart$=i=new ta(e.insertBefore(zr(),s),s,void 0,t??{})}return i._$AI(n),i};/**
88
+ */const Ys=globalThis,_n=Ys.trustedTypes,bo=_n?_n.createPolicy("lit-html",{createHTML:r=>r}):void 0,Ou="$lit$",Et=`lit$${Math.random().toFixed(9).slice(2)}$`,$u="?"+Et,Ld=`<${$u}>`,Bt=document,zr=()=>Bt.createComment(""),Jr=r=>r===null||typeof r!="object"&&typeof r!="function",Zs=Array.isArray,jd=r=>Zs(r)||typeof r?.[Symbol.iterator]=="function",bi=`[
89
+ \f\r]`,vr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,wo=/-->/g,vo=/>/g,Ot=RegExp(`>|${bi}(?:([^\\s"'>=/]+)(${bi}*=${bi}*(?:[^
90
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),_o=/'/g,xo=/"/g,ku=/^(?:script|style|textarea|title)$/i,Od=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),ct=Od(1),tr=Symbol.for("lit-noChange"),De=Symbol.for("lit-nothing"),So=new WeakMap,Ct=Bt.createTreeWalker(Bt,129);function Du(r,e){if(!Zs(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return bo!==void 0?bo.createHTML(e):e}const $d=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=vr;for(let o=0;o<t;o++){const l=r[o];let d,h,y=-1,w=0;for(;w<l.length&&(a.lastIndex=w,h=a.exec(l),h!==null);)w=a.lastIndex,a===vr?h[1]==="!--"?a=wo:h[1]!==void 0?a=vo:h[2]!==void 0?(ku.test(h[2])&&(i=RegExp("</"+h[2],"g")),a=Ot):h[3]!==void 0&&(a=Ot):a===Ot?h[0]===">"?(a=i??vr,y=-1):h[1]===void 0?y=-2:(y=a.lastIndex-h[2].length,d=h[1],a=h[3]===void 0?Ot:h[3]==='"'?xo:_o):a===xo||a===_o?a=Ot:a===wo||a===vo?a=vr:(a=Ot,i=void 0);const g=a===Ot&&r[o+1].startsWith("/>")?" ":"";s+=a===vr?l+Ld:y>=0?(n.push(d),l.slice(0,y)+Ou+l.slice(y)+Et+g):l+Et+(y===-2?o:g)}return[Du(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let Os=class Mu{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,l=this.parts,[d,h]=$d(e,t);if(this.el=Mu.createElement(d,n),Ct.currentNode=this.el.content,t===2||t===3){const y=this.el.content.firstChild;y.replaceWith(...y.childNodes)}for(;(i=Ct.nextNode())!==null&&l.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const y of i.getAttributeNames())if(y.endsWith(Ou)){const w=h[a++],g=i.getAttribute(y).split(Et),m=/([.?@])?(.*)/.exec(w);l.push({type:1,index:s,name:m[2],strings:g,ctor:m[1]==="."?Dd:m[1]==="?"?Md:m[1]==="@"?Cd:$n}),i.removeAttribute(y)}else y.startsWith(Et)&&(l.push({type:6,index:s}),i.removeAttribute(y));if(ku.test(i.tagName)){const y=i.textContent.split(Et),w=y.length-1;if(w>0){i.textContent=_n?_n.emptyScript:"";for(let g=0;g<w;g++)i.append(y[g],zr()),Ct.nextNode(),l.push({type:2,index:++s});i.append(y[w],zr())}}}else if(i.nodeType===8)if(i.data===$u)l.push({type:2,index:s});else{let y=-1;for(;(y=i.data.indexOf(Et,y+1))!==-1;)l.push({type:7,index:s}),y+=Et.length-1}s++}}static createElement(e,t){const n=Bt.createElement("template");return n.innerHTML=e,n}};function rr(r,e,t=r,n){if(e===tr)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const s=Jr(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=rr(r,i._$AS(r,e.values),i,n)),e}let kd=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??Bt).importNode(t,!0);Ct.currentNode=i;let s=Ct.nextNode(),a=0,o=0,l=n[0];for(;l!==void 0;){if(a===l.index){let d;l.type===2?d=new ea(s,s.nextSibling,this,e):l.type===1?d=new l.ctor(s,l.name,l.strings,this,e):l.type===6&&(d=new Pd(s,this,e)),this._$AV.push(d),l=n[++o]}a!==l?.index&&(s=Ct.nextNode(),a++)}return Ct.currentNode=Bt,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++}},ea=class Cu{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=De,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=rr(this,e,t),Jr(e)?e===De||e==null||e===""?(this._$AH!==De&&this._$AR(),this._$AH=De):e!==this._$AH&&e!==tr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):jd(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!==De&&Jr(this._$AH)?this._$AA.nextSibling.data=e:this.T(Bt.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=Os.createElement(Du(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new kd(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=So.get(e.strings);return t===void 0&&So.set(e.strings,t=new Os(e)),t}k(e){Zs(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 Cu(this.O(zr()),this.O(zr()),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))}},$n=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=De,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=De}_$AI(e,t=this,n,i){const s=this.strings;let a=!1;if(s===void 0)e=rr(this,e,t,0),a=!Jr(e)||e!==this._$AH&&e!==tr,a&&(this._$AH=e);else{const o=e;let l,d;for(e=s[0],l=0;l<s.length-1;l++)d=rr(this,o[n+l],t,l),d===tr&&(d=this._$AH[l]),a||=!Jr(d)||d!==this._$AH[l],d===De?e=De:e!==De&&(e+=(d??"")+s[l+1]),this._$AH[l]=d}a&&!i&&this.j(e)}j(e){e===De?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Dd=class extends $n{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===De?void 0:e}},Md=class extends $n{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==De)}},Cd=class extends $n{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=rr(this,e,t,0)??De)===tr)return;const n=this._$AH,i=e===De&&n!==De||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==De&&(n===De||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)}},Pd=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){rr(this,e)}};const qd=Ys.litHtmlPolyfillSupport;qd?.(Os,ea),(Ys.litHtmlVersions??=[]).push("3.3.1");const Bd=(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 ea(e.insertBefore(zr(),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 ra=globalThis;class Pt extends Xt{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=Fd(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return tr}}Pt._$litElement$=!0,Pt.finalized=!0,ra.litElementHydrateSupport?.({LitElement:Pt});const Ud=ra.litElementPolyfillSupport;Ud?.({LitElement:Pt});(ra.litElementVersions??=[]).push("4.2.1");var qu=n=>{throw TypeError(n)},Bu=(n,e,t)=>e.has(n)||qu("Cannot "+t),xt=(n,e,t)=>(Bu(n,e,"read from private field"),t?t.call(n):e.get(n)),Hd=(n,e,t)=>e.has(n)?qu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Vd=(n,e,t,r)=>(Bu(n,e,"write to private field"),e.set(n,t),t);const Gt=n=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)},hn=globalThis,na=hn.ShadowRoot&&(hn.ShadyCSS===void 0||hn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Fu=Symbol(),Io=new WeakMap;let Gd=class{constructor(n,e,t){if(this._$cssResult$=!0,t!==Fu)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=n,this.t=e}get styleSheet(){let n=this.o;const e=this.t;if(na&&n===void 0){const t=e!==void 0&&e.length===1;t&&(n=Io.get(e)),n===void 0&&((this.o=n=new CSSStyleSheet).replaceSync(this.cssText),t&&Io.set(e,n))}return n}toString(){return this.cssText}};const Wd=n=>new Gd(typeof n=="string"?n:n+"",void 0,Fu),zd=(n,e)=>{if(na)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const r=document.createElement("style"),i=hn.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},Ro=na?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return Wd(t)})(n):n,{is:Jd,defineProperty:Qd,getOwnPropertyDescriptor:Xd,getOwnPropertyNames:Kd,getOwnPropertySymbols:Yd,getPrototypeOf:Zd}=Object,nr=globalThis,No=nr.trustedTypes,ef=No?No.emptyScript:"",To=nr.reactiveElementPolyfillSupport,Vr=(n,e)=>n,xn={toAttribute(n,e){switch(e){case Boolean:n=n?ef:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},ia=(n,e)=>!Jd(n,e),Ao={attribute:!0,type:String,converter:xn,reflect:!1,useDefault:!1,hasChanged:ia};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),nr.litPropertyMetadata??(nr.litPropertyMetadata=new WeakMap);class _r extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=Ao){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 r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Qd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:s}=Xd(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,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Ao}static _$Ei(){if(this.hasOwnProperty(Vr("elementProperties")))return;const e=Zd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Vr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Vr("properties"))){const t=this.properties,r=[...Kd(t),...Yd(t)];for(const i of r)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const i of r)t.unshift(Ro(i))}else e!==void 0&&t.push(Ro(e));return t}static _$Eu(e,t){const r=t.attribute;return r===!1?void 0:typeof r=="string"?r: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(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return zd(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var r;return(r=t.hostConnected)==null?void 0:r.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var r;return(r=t.hostDisconnected)==null?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){var r;const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){const a=(((r=i.converter)==null?void 0:r.toAttribute)!==void 0?i.converter:xn).toAttribute(t,i.type);this._$Em=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(e,t){var r,i;const s=this.constructor,a=s._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const o=s.getPropertyOptions(a),l=typeof o.converter=="function"?{fromAttribute:o.converter}:((r=o.converter)==null?void 0:r.fromAttribute)!==void 0?o.converter:xn;this._$Em=a,this[a]=l.fromAttribute(t,o.type)??((i=this._$Ej)==null?void 0:i.get(a))??null,this._$Em=null}}requestUpdate(e,t,r){var i;if(e!==void 0){const s=this.constructor,a=this[e];if(r??(r=s.getPropertyOptions(e)),!((r.hasChanged??ia)(a,t)||r.useDefault&&r.reflect&&a===((i=this._$Ej)==null?void 0:i.get(e))&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:s},a){r&&!(this._$Ej??(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||r||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(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(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,a]of this._$Ep)this[s]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,a]of i){const{wrapped:o}=a,l=this[s];o!==!0||this._$AL.has(s)||l===void 0||this.C(s,void 0,a,l)}}let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(r)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(r=>{var i;return(i=r.hostUpdated)==null?void 0:i.call(r)}),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=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}}_r.elementStyles=[],_r.shadowRootOptions={mode:"open"},_r[Vr("elementProperties")]=new Map,_r[Vr("finalized")]=new Map,To?.({ReactiveElement:_r}),(nr.reactiveElementVersions??(nr.reactiveElementVersions=[])).push("2.1.0");const tf={attribute:!0,type:String,converter:xn,reflect:!1,hasChanged:ia},rf=(n=tf,e,t)=>{const{kind:r,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),r==="setter"&&((n=Object.create(n)).wrapped=!0),s.set(t.name,n),r==="accessor"){const{name:a}=t;return{set(o){const l=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,l,n)},init(o){return o!==void 0&&this.C(a,void 0,n,o),o}}}if(r==="setter"){const{name:a}=t;return function(o){const l=this[a];e.call(this,o),this.requestUpdate(a,l,n)}}throw Error("Unsupported decorator location: "+r)};function ve(n){return(e,t)=>typeof t=="object"?rf(n,e,t):((r,i,s)=>{const a=i.hasOwnProperty(s);return i.constructor.createProperty(s,r),a?Object.getOwnPropertyDescriptor(i,s):void 0})(n,e,t)}function sa(n){return ve({...n,state:!0,attribute:!1})}const nf=(n,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(n,e,t),t);function dt(n,e){return(t,r,i)=>{const s=a=>{var o;return((o=a.renderRoot)==null?void 0:o.querySelector(n))??null};return nf(t,r,{get(){return s(this)}})}}var sf=Object.defineProperty,Wt=(n,e,t,r)=>{for(var i=void 0,s=n.length-1,a;s>=0;s--)(a=n[s])&&(i=a(e,t,i)||i);return i&&sf(e,t,i),i};const ks=class extends Pt{constructor(){super(...arguments),this.dense=!1}};ks.shadowRootOptions={...Pt.shadowRootOptions,delegatesFocus:!0},ks.styles=[vt`
94
+ */const ta=globalThis;class qt extends Xt{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=Bd(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return tr}}qt._$litElement$=!0,qt.finalized=!0,ta.litElementHydrateSupport?.({LitElement:qt});const Fd=ta.litElementPolyfillSupport;Fd?.({LitElement:qt});(ta.litElementVersions??=[]).push("4.2.1");var Pu=r=>{throw TypeError(r)},qu=(r,e,t)=>e.has(r)||Pu("Cannot "+t),xt=(r,e,t)=>(qu(r,e,"read from private field"),t?t.call(r):e.get(r)),Ud=(r,e,t)=>e.has(r)?Pu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Hd=(r,e,t,n)=>(qu(r,e,"write to private field"),e.set(r,t),t);const Gt=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},hn=globalThis,ra=hn.ShadowRoot&&(hn.ShadyCSS===void 0||hn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Bu=Symbol(),Eo=new WeakMap;let Vd=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Bu)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(ra&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=Eo.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&Eo.set(e,r))}return r}toString(){return this.cssText}};const Gd=r=>new Vd(typeof r=="string"?r:r+"",void 0,Bu),Wd=(r,e)=>{if(ra)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=hn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Io=ra?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Gd(t)})(r):r,{is:zd,defineProperty:Jd,getOwnPropertyDescriptor:Qd,getOwnPropertyNames:Xd,getOwnPropertySymbols:Kd,getPrototypeOf:Yd}=Object,nr=globalThis,Ro=nr.trustedTypes,Zd=Ro?Ro.emptyScript:"",No=nr.reactiveElementPolyfillSupport,Vr=(r,e)=>r,xn={toAttribute(r,e){switch(e){case Boolean:r=r?Zd: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}},na=(r,e)=>!zd(r,e),To={attribute:!0,type:String,converter:xn,reflect:!1,useDefault:!1,hasChanged:na};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),nr.litPropertyMetadata??(nr.litPropertyMetadata=new WeakMap);class _r extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=To){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&&Jd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Qd(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)??To}static _$Ei(){if(this.hasOwnProperty(Vr("elementProperties")))return;const e=Yd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Vr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Vr("properties"))){const t=this.properties,n=[...Xd(t),...Kd(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(Io(i))}else e!==void 0&&t.push(Io(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(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$EO)==null||t.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 Wd(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){var n;const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(s!==void 0&&i.reflect===!0){const a=(((n=i.converter)==null?void 0:n.toAttribute)!==void 0?i.converter:xn).toAttribute(t,i.type);this._$Em=e,a==null?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(e,t){var n,i;const s=this.constructor,a=s._$Eh.get(e);if(a!==void 0&&this._$Em!==a){const o=s.getPropertyOptions(a),l=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)==null?void 0:n.fromAttribute)!==void 0?o.converter:xn;this._$Em=a,this[a]=l.fromAttribute(t,o.type)??((i=this._$Ej)==null?void 0:i.get(a))??null,this._$Em=null}}requestUpdate(e,t,n){var i;if(e!==void 0){const s=this.constructor,a=this[e];if(n??(n=s.getPropertyOptions(e)),!((n.hasChanged??na)(a,t)||n.useDefault&&n.reflect&&a===((i=this._$Ej)==null?void 0:i.get(e))&&!this.hasAttribute(s._$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??(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??(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(){var e;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,a]of this._$Ep)this[s]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,a]of i){const{wrapped:o}=a,l=this[s];o!==!0||this._$AL.has(s)||l===void 0||this.C(s,void 0,a,l)}}let t=!1;const n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$EO)==null||e.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(n)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),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=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}}_r.elementStyles=[],_r.shadowRootOptions={mode:"open"},_r[Vr("elementProperties")]=new Map,_r[Vr("finalized")]=new Map,No?.({ReactiveElement:_r}),(nr.reactiveElementVersions??(nr.reactiveElementVersions=[])).push("2.1.0");const ef={attribute:!0,type:String,converter:xn,reflect:!1,hasChanged:na},tf=(r=ef,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 l=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,l,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 l=this[a];e.call(this,o),this.requestUpdate(a,l,r)}}throw Error("Unsupported decorator location: "+n)};function ve(r){return(e,t)=>typeof t=="object"?tf(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 ia(r){return ve({...r,state:!0,attribute:!1})}const rf=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function dt(r,e){return(t,n,i)=>{const s=a=>{var o;return((o=a.renderRoot)==null?void 0:o.querySelector(r))??null};return rf(t,n,{get(){return s(this)}})}}var nf=Object.defineProperty,Wt=(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&&nf(e,t,i),i};const $s=class extends qt{constructor(){super(...arguments),this.dense=!1}};$s.shadowRootOptions={...qt.shadowRootOptions,delegatesFocus:!0},$s.styles=[vt`
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 zt=ks;Wt([ve({type:Boolean,reflect:!0})],zt.prototype,"dense");var it;const Ds=class extends zt{constructor(){super(),Hd(this,it),this.value="",this.clearable=!1,this.required=!1,Vd(this,it,this.attachInternals())}checkValidity(){return xt(this,it).checkValidity()}reportValidity(){const e=xt(this,it).reportValidity();return this.classList.toggle("invalid",!e),e}get validity(){return xt(this,it).validity}get validationMessage(){return xt(this,it).validationMessage}setCustomValidity(e,t){e?xt(this,it).setValidity({customError:!0},e,t):xt(this,it).setValidity(void 0)}updateValidity(e,t,r){xt(this,it).setValidity(e,t,r)}setFormValue(e,t){xt(this,it).setFormValue(e,t)}};it=new WeakMap,Ds.formAssociated=!0,Ds.styles=[...zt.styles,vt`
117
+ `];let zt=$s;Wt([ve({type:Boolean,reflect:!0})],zt.prototype,"dense");var it;const ks=class extends zt{constructor(){super(),Ud(this,it),this.value="",this.clearable=!1,this.required=!1,Hd(this,it,this.attachInternals())}checkValidity(){return xt(this,it).checkValidity()}reportValidity(){const e=xt(this,it).reportValidity();return this.classList.toggle("invalid",!e),e}get validity(){return xt(this,it).validity}get validationMessage(){return xt(this,it).validationMessage}setCustomValidity(e,t){e?xt(this,it).setValidity({customError:!0},e,t):xt(this,it).setValidity(void 0)}updateValidity(e,t,n){xt(this,it).setValidity(e,t,n)}setFormValue(e,t){xt(this,it).setFormValue(e,t)}};it=new WeakMap,ks.formAssociated=!0,ks.styles=[...zt.styles,vt`
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 ft=Ds;Wt([ve()],ft.prototype,"name");Wt([ve()],ft.prototype,"value");Wt([ve({type:Boolean})],ft.prototype,"clearable");Wt([ve({type:Boolean})],ft.prototype,"required");Wt([ve()],ft.prototype,"label");Wt([ve()],ft.prototype,"placeholder");function af(n){const e=parseFloat(n),t=n.match(/m?s/);let r=0;if(t)switch(t[0]){case"s":r=e*1e3;break;case"ms":r=e;break;default:r=0;break}return r}var of=Object.defineProperty,lf=Object.getOwnPropertyDescriptor,Uu=(n,e,t,r)=>{for(var i=r>1?void 0:r?lf(e,t):e,s=n.length-1,a;s>=0;s--)(a=n[s])&&(i=(r?a(e,t,i):a(i))||i);return r&&i&&of(e,t,i),i};let ir=class extends zt{constructor(){super(...arguments),this.icon=!1}render(){return ct`<a part="link"><slot><slot></a>`}};ir.styles=[...zt.styles,vt`
121
+ `];let ft=ks;Wt([ve()],ft.prototype,"name");Wt([ve()],ft.prototype,"value");Wt([ve({type:Boolean})],ft.prototype,"clearable");Wt([ve({type:Boolean})],ft.prototype,"required");Wt([ve()],ft.prototype,"label");Wt([ve()],ft.prototype,"placeholder");function sf(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 af=Object.defineProperty,of=Object.getOwnPropertyDescriptor,Fu=(r,e,t,n)=>{for(var i=n>1?void 0:n?of(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&&af(e,t,i),i};let ir=class extends zt{constructor(){super(...arguments),this.icon=!1}render(){return ct`<a part="link"><slot><slot></a>`}};ir.styles=[...zt.styles,vt`
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
- `];Uu([ve({type:Boolean,reflect:!0})],ir.prototype,"icon",2);ir=Uu([Gt("rokit-button")],ir);var uf=Object.defineProperty,cf=Object.getOwnPropertyDescriptor,Jt=(n,e,t,r)=>{for(var i=r>1?void 0:r?cf(e,t):e,s=n.length-1,a;s>=0;s--)(a=n[s])&&(i=(r?a(e,t,i):a(i))||i);return r&&i&&uf(e,t,i),i};let Qe=class extends zt{constructor(){super(...arguments),this.open=!1,this.transitioning=!1,this.closedBeforeTransition=!1}firstUpdated(){const n=this.shadowRoot.querySelector("header");n.addEventListener("mousedown",()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}),n.addEventListener("click",()=>{this.toggle(this.closedBeforeTransition)}),this.transitionDuration=af(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner"))}updated(n){n.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),n.has("open")&&(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 n=this.shadowRoot.querySelector("#content > slot").assignedNodes(),e=new MutationObserver(()=>this.updateContentHeight());for(const t of n)e.observe(t,{subtree:!0,childList:!0,characterData:!0});this.updateContentHeight()}toggle(n=!this.open){this.transitioning=!0,this.open=n,this.toggleButton.classList.toggle("down",n),setTimeout(()=>{this.transitioning=!1,this.open&&this.content.scrollIntoView({block:"nearest"})},this.transitionDuration)}render(){return ct`
133
+ `];Fu([ve({type:Boolean,reflect:!0})],ir.prototype,"icon",2);ir=Fu([Gt("rokit-button")],ir);var lf=Object.defineProperty,uf=Object.getOwnPropertyDescriptor,Jt=(r,e,t,n)=>{for(var i=n>1?void 0:n?uf(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&&lf(e,t,i),i};let Qe=class extends zt{constructor(){super(...arguments),this.open=!1,this.transitioning=!1,this.closedBeforeTransition=!1}firstUpdated(){const r=this.shadowRoot.querySelector("header");r.addEventListener("mousedown",()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}),r.addEventListener("click",()=>{this.toggle(this.closedBeforeTransition,!0)}),this.transitionDuration=sf(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner"))}updated(r){r.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),r.has("open")&&(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.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>
@@ -153,13 +153,13 @@ a, a:visited { color: inherit; }
153
153
  .label { flex-grow: 1; }
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
- `];Jt([ve({type:Boolean,reflect:!0})],Qe.prototype,"open",2);Jt([ve()],Qe.prototype,"label",2);Jt([ve({reflect:!0})],Qe.prototype,"maxHeight",2);Jt([dt("#content")],Qe.prototype,"content",2);Jt([dt("#toggle")],Qe.prototype,"toggleButton",2);Jt([sa()],Qe.prototype,"transitioning",2);Qe=Jt([Gt("rokit-collapsible")],Qe);var df=Object.defineProperty,ff=Object.getOwnPropertyDescriptor,Hu=n=>{throw TypeError(n)},Xe=(n,e,t,r)=>{for(var i=r>1?void 0:r?ff(e,t):e,s=n.length-1,a;s>=0;s--)(a=n[s])&&(i=(r?a(e,t,i):a(i))||i);return r&&i&&df(e,t,i),i},Vu=(n,e,t)=>e.has(n)||Hu("Cannot "+t),hf=(n,e,t)=>(Vu(n,e,"read from private field"),e.get(n)),pf=(n,e,t)=>e.has(n)?Hu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Lo=(n,e,t,r)=>(Vu(n,e,"write to private field"),e.set(n,t),t),Cr;let ke=class extends ft{constructor(){super(),this.type="text",this.disabled=!1,this.readonly=!1,this.sticky=!1,this.minWidth=80,pf(this,Cr,""),this.addEventListener("keydown",n=>{n.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(){Lo(this,Cr,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.updateMinWidth()}updateMinWidth(){var n,e;const t=((e=(n=this.shadowRoot)==null?void 0:n.querySelector("label"))==null?void 0:e.scrollWidth)||0,r=this.shadowRoot.querySelector(".wrapper");r.style.minWidth=`${this.minWidth>t?this.minWidth:t}px`}updated(n){n.has("label")&&this.classList.toggle("has-label",this.label!==void 0),n.has("min")&&(this.inputElement.min=this.min||""),n.has("max")&&(this.inputElement.max=this.max||""),n.has("step")&&(this.inputElement.step=this.step||""),n.has("placeholder")&&(this.inputElement.placeholder=this.placeholder||""),n.has("pattern")&&(this.inputElement.pattern=this.pattern||""),n.has("minLength")&&(this.inputElement.minLength=this.minLength===void 0?-1:this.minLength),n.has("maxLength")&&(this.inputElement.maxLength=this.maxLength===void 0?-1:this.maxLength),n.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!==hf(this,Cr)&&(Lo(this,Cr,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`
156
+ `];Jt([ve({type:Boolean,reflect:!0})],Qe.prototype,"open",2);Jt([ve()],Qe.prototype,"label",2);Jt([ve({reflect:!0})],Qe.prototype,"maxHeight",2);Jt([dt("#content")],Qe.prototype,"content",2);Jt([dt("#toggle")],Qe.prototype,"toggleButton",2);Jt([ia()],Qe.prototype,"transitioning",2);Qe=Jt([Gt("rokit-collapsible")],Qe);var cf=Object.defineProperty,df=Object.getOwnPropertyDescriptor,Uu=r=>{throw TypeError(r)},Xe=(r,e,t,n)=>{for(var i=n>1?void 0:n?df(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&&cf(e,t,i),i},Hu=(r,e,t)=>e.has(r)||Uu("Cannot "+t),ff=(r,e,t)=>(Hu(r,e,"read from private field"),e.get(r)),hf=(r,e,t)=>e.has(r)?Uu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Ao=(r,e,t,n)=>(Hu(r,e,"write to private field"),e.set(r,t),t),Cr;let ke=class extends ft{constructor(){super(),this.type="text",this.disabled=!1,this.readonly=!1,this.sticky=!1,this.minWidth=80,hf(this,Cr,""),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(){Ao(this,Cr,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.updateMinWidth()}updateMinWidth(){var r,e;const t=((e=(r=this.shadowRoot)==null?void 0:r.querySelector("label"))==null?void 0:e.scrollWidth)||0,n=this.shadowRoot.querySelector(".wrapper");n.style.minWidth=`${this.minWidth>t?this.minWidth:t}px`}updated(r){r.has("label")&&this.classList.toggle("has-label",this.label!==void 0),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!==ff(this,Cr)&&(Ao(this,Cr,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
161
  ${this.clearable?ct`
162
- <rokit-button class="clear" icon ?dense="${this.dense}" @mousedown="${n=>{n.preventDefault()}}" @click="${n=>{n.stopPropagation(),this.clear()}}" title="Clear"></rokit-button>
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
  `:De}
164
164
  </div>
165
165
  <slot name="suffix" part="suffix"></slot>
@@ -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
- `];Xe([ve()],ke.prototype,"type",2);Xe([ve({type:Boolean})],ke.prototype,"disabled",2);Xe([ve({type:Boolean,reflect:!0})],ke.prototype,"readonly",2);Xe([ve({type:Boolean,reflect:!0})],ke.prototype,"sticky",2);Xe([ve()],ke.prototype,"pattern",2);Xe([ve()],ke.prototype,"minLength",2);Xe([ve()],ke.prototype,"maxLength",2);Xe([ve()],ke.prototype,"min",2);Xe([ve()],ke.prototype,"max",2);Xe([ve()],ke.prototype,"step",2);Xe([ve()],ke.prototype,"minWidth",2);Xe([dt("#input")],ke.prototype,"inputElement",2);ke=Xe([Gt("rokit-input")],ke);var gf=Object.defineProperty,yf=Object.getOwnPropertyDescriptor,Gu=n=>{throw TypeError(n)},Ge=(n,e,t,r)=>{for(var i=r>1?void 0:r?yf(e,t):e,s=n.length-1,a;s>=0;s--)(a=n[s])&&(i=(r?a(e,t,i):a(i))||i);return r&&i&&gf(e,t,i),i},Wu=(n,e,t)=>e.has(n)||Gu("Cannot "+t),jo=(n,e,t)=>(Wu(n,e,"read from private field"),t?t.call(n):e.get(n)),Oo=(n,e,t)=>e.has(n)?Gu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),un=(n,e,t,r)=>(Wu(n,e,"write to private field"),e.set(n,t),t),Kt,pn;let Me=class extends ft{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,Oo(this,Kt,""),Oo(this,pn,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)})}firstUpdated(){un(this,Kt,this.value),un(this,pn,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(n){var e;if(n.has("selectedItem")){const t=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(),t!==this.value&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}n.has("value")&&this.selectItem(this.findItem(this.value)),(n.has("filterableThreshold")||n.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),(e=this.collapsible)!=null&&e.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?"none":"")}checkInputValue(n=!0){if(this.input.value){const e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}n&&(this.input.value="",this.input.title="",un(this,Kt,""),this.selectItem(null,!1))}filter(n){var e,t,r;n=n.toLowerCase();let i=!0;for(const s of this.listContainer.querySelectorAll("li"))if(s.id!=="noresult"){const a=this.itemText(s).toLowerCase().indexOf(n)==-1;s.classList.toggle("hidden",a),this.collapse&&(s.classList.remove("open"),(e=s.querySelector("ul"))==null||e.classList.remove("open")),a||(i=!1)}for(const s of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))s.classList.remove("hidden"),n&&this.collapse&&(s.classList.add("open"),(t=s.querySelector("ul"))==null||t.classList.add("open")),i=!1;this.highlightItem(null),(r=this.listContainer.querySelector("#noresult"))==null||r.classList.toggle("hidden",!i)}selectItem(n,e=!0){n?.getAttribute("disabled")!==null&&(n=null),this.selectedItem=n,this.filter(""),this.highlightItem(n,!1),e&&this.value&&un(this,Kt,this.value),setTimeout(()=>this.blur())}findItem(n){if(n){for(const e of this.listContainer.querySelectorAll("li"))if(this.itemValue(e)===n||this.itemText(e)===n)return e}return null}highlightItem(n,e=!0){var t,r;if((t=this.listContainer.querySelector("li.active"))==null||t.classList.remove("active"),n){if(e&&this.listContainer.focus(),n.classList.add("active"),this.collapse)for(let i=n.closest("ul");i;i=i.parentElement.closest("ul"))i.classList.add("open"),(r=i.closest("li"))==null||r.classList.add("open");n.scrollIntoView({block:"nearest"})}}highlightNextItem(){const n=this.listContainer.querySelector("li.active");let e=n;const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");if(n){for(let r=0;r<t.length;r++)if(t[r]===n&&r<t.length-1){e=t[r+1];break}}else t.length>0&&(e=t[0]);this.highlightItem(e)}highlightPreviousItem(){const n=this.listContainer.querySelector("li.active");let e=null;if(n){const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");for(let r=0;r<t.length;r++)if(t[r]===n&&r>0){e=t[r-1];break}}this.highlightItem(e),e||this.input.focus()}itemValue(n){return n.dataset.value||this.itemText(n)||""}itemText(n){var e;return((e=n.querySelector("div > div"))==null?void 0:e.innerText)||""}elementText(n){var e;let t="";for(const r of n.childNodes)r.nodeType==3&&(t+=(e=r.nodeValue)==null?void 0:e.trim());return t}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let n=null;const e=this.shadowRoot.querySelector("#list-container-slot").assignedElements();if(e?.length===1&&(n=Array.prototype.slice.call(e[0].querySelectorAll(":scope > li")),this.copyItems(n,this.listContainer)),this.emptyMessage){const t=document.createElement("li");t.id="noresult",t.setAttribute("disabled",""),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),n&&n.length>0&&t.classList.add("hidden")}this.value=this.value||jo(this,Kt),this.selectItem(this.findItem(this.value))}copyItems(n,e,t=0){if(this.sort!==void 0){const i=this.sort||"asc";n=n.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 r="";t>0&&(r=`calc(0.3em + ${t}*${jo(this,pn)})`);for(const i of n){const s=i.cloneNode();s.replaceChildren();const a=document.createElement("div");r&&(a.style.paddingLeft=r);const o=document.createElement("div");a.appendChild(o);for(const d of i.childNodes)if(d.nodeName!=="UL"){const h=d.cloneNode(!0);h.nodeType===3&&h.nodeValue&&(h.nodeValue=h.nodeValue.trim()),o.appendChild(h)}s.appendChild(a),s.title=s.title||this.itemText(s);const l=i.querySelector("ul");if(l!=null&&l.childElementCount){const d=document.createElement("ul");if(s.appendChild(d),this.copyItems(Array.prototype.slice.call(l.children),d,t+1),this.collapse){const h=new ir;h.title="Open",h.dense=!0,h.icon=!0,h.classList.add("toggle-node","caret"),h.addEventListener("click",y=>{y.stopPropagation(),s.classList.toggle("open"),d.classList.toggle("open"),h.title=s.classList.contains("open")?"Close":"Open",this.collapsible.updateContentHeight()}),a.prepend(h)}else d.classList.add("open")}e.appendChild(s),this.itemCount++}}render(){return ct`
180
+ `];Xe([ve()],ke.prototype,"type",2);Xe([ve({type:Boolean})],ke.prototype,"disabled",2);Xe([ve({type:Boolean,reflect:!0})],ke.prototype,"readonly",2);Xe([ve({type:Boolean,reflect:!0})],ke.prototype,"sticky",2);Xe([ve()],ke.prototype,"pattern",2);Xe([ve()],ke.prototype,"minLength",2);Xe([ve()],ke.prototype,"maxLength",2);Xe([ve()],ke.prototype,"min",2);Xe([ve()],ke.prototype,"max",2);Xe([ve()],ke.prototype,"step",2);Xe([ve()],ke.prototype,"minWidth",2);Xe([dt("#input")],ke.prototype,"inputElement",2);ke=Xe([Gt("rokit-input")],ke);var pf=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,Vu=r=>{throw TypeError(r)},Ge=(r,e,t,n)=>{for(var i=n>1?void 0:n?gf(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&&pf(e,t,i),i},Gu=(r,e,t)=>e.has(r)||Vu("Cannot "+t),Lo=(r,e,t)=>(Gu(r,e,"read from private field"),t?t.call(r):e.get(r)),jo=(r,e,t)=>e.has(r)?Vu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),un=(r,e,t,n)=>(Gu(r,e,"write to private field"),e.set(r,t),t),Kt,pn;let Me=class extends ft{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,jo(this,Kt,""),jo(this,pn,""),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)})}firstUpdated(){un(this,Kt,this.value),un(this,pn,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){var e;if(r.has("selectedItem")){const t=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(),t!==this.value&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}r.has("value")&&this.selectItem(this.findItem(this.value)),(r.has("filterableThreshold")||r.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),(e=this.collapsible)!=null&&e.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="",un(this,Kt,""),this.selectItem(null,!1))}filter(r){var e,t,n;r=r.toLowerCase();let i=!0;for(const s of this.listContainer.querySelectorAll("li"))if(s.id!=="noresult"){const a=this.itemText(s).toLowerCase().indexOf(r)==-1;s.classList.toggle("hidden",a),this.collapse&&(s.classList.remove("open"),(e=s.querySelector("ul"))==null||e.classList.remove("open")),a||(i=!1)}for(const s of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))s.classList.remove("hidden"),r&&this.collapse&&(s.classList.add("open"),(t=s.querySelector("ul"))==null||t.classList.add("open")),i=!1;this.highlightItem(null),(n=this.listContainer.querySelector("#noresult"))==null||n.classList.toggle("hidden",!i)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&un(this,Kt,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){var t,n;if((t=this.listContainer.querySelector("li.active"))==null||t.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let i=r.closest("ul");i;i=i.parentElement.closest("ul"))i.classList.add("open"),(n=i.closest("li"))==null||n.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){var e;return((e=r.querySelector("div > div"))==null?void 0:e.innerText)||""}elementText(r){var e;let t="";for(const n of r.childNodes)n.nodeType==3&&(t+=(e=n.nodeValue)==null?void 0:e.trim());return t}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||Lo(this,Kt),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}*${Lo(this,pn)})`);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 d of i.childNodes)if(d.nodeName!=="UL"){const h=d.cloneNode(!0);h.nodeType===3&&h.nodeValue&&(h.nodeValue=h.nodeValue.trim()),o.appendChild(h)}s.appendChild(a),s.title=s.title||this.itemText(s);const l=i.querySelector("ul");if(l!=null&&l.childElementCount){const d=document.createElement("ul");if(s.appendChild(d),this.copyItems(Array.prototype.slice.call(l.children),d,t+1),this.collapse){const h=new ir;h.title="Open",h.dense=!0,h.icon=!0,h.classList.add("toggle-node","caret"),h.addEventListener("click",y=>{y.stopPropagation(),s.classList.toggle("open"),d.classList.toggle("open"),h.title=s.classList.contains("open")?"Close":"Open",this.collapsible.updateContentHeight()}),a.prepend(h)}else d.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>
@@ -187,12 +187,12 @@ a, a:visited { color: inherit; }
187
187
  @change="${()=>{this.checkInputValue(this.input.inputElement.value===""||!this.collapsible.open)}}"
188
188
  @input="${()=>{this.filter(this.input.inputElement.value)}}"
189
189
  @click="${()=>{this.collapsible.toggle(!0)}}"
190
- @keydown="${n=>{switch(n.code){case"ArrowDown":n.preventDefault(),this.highlightNextItem();break;case"Enter":{const e=this.findItem(this.input.value);e?this.selectItem(e):this.filter(this.input.value);break}}}}"
190
+ @keydown="${r=>{switch(r.code){case"ArrowDown":r.preventDefault(),this.highlightNextItem();break;case"Enter":{const e=this.findItem(this.input.value);e?this.selectItem(e):this.filter(this.input.value);break}}}}"
191
191
  ></rokit-input>
192
192
  <ul id="list-container" tabindex="-1" part="list" class="open"
193
- @mousedown="${n=>{n.preventDefault()}}"
194
- @click="${n=>{const e=n.target.closest("li");e&&e.getAttribute("disabled")===null&&!e.classList.contains("divider")&&this.selectItem(e)}}"
195
- @keydown="${n=>{var e,t;switch(n.code){case"Enter":this.selectItem(this.listContainer.querySelector("li.active"));break;case"ArrowDown":n.preventDefault(),this.highlightNextItem();break;case"ArrowUp":n.preventDefault(),this.highlightPreviousItem();break;case"ArrowRight":if(this.collapse){const r=this.listContainer.querySelector("li.active");r&&(n.preventDefault(),r.classList.add("open"),(e=r.querySelector("ul"))==null||e.classList.add("open"),this.collapsible.updateContentHeight())}break;case"ArrowLeft":if(this.collapse){const r=this.listContainer.querySelector("li.active");r&&(n.preventDefault(),r.classList.remove("open"),(t=r.querySelector("ul"))==null||t.classList.remove("open"),this.collapsible.updateContentHeight())}break;case"Escape":this.listContainer.blur();break}}}">
193
+ @mousedown="${r=>{r.preventDefault()}}"
194
+ @click="${r=>{const e=r.target.closest("li");e&&e.getAttribute("disabled")===null&&!e.classList.contains("divider")&&this.selectItem(e)}}"
195
+ @keydown="${r=>{var e,t;switch(r.code){case"Enter":this.selectItem(this.listContainer.querySelector("li.active"));break;case"ArrowDown":r.preventDefault(),this.highlightNextItem();break;case"ArrowUp":r.preventDefault(),this.highlightPreviousItem();break;case"ArrowRight":if(this.collapse){const n=this.listContainer.querySelector("li.active");n&&(r.preventDefault(),n.classList.add("open"),(e=n.querySelector("ul"))==null||e.classList.add("open"),this.collapsible.updateContentHeight())}break;case"ArrowLeft":if(this.collapse){const n=this.listContainer.querySelector("li.active");n&&(r.preventDefault(),n.classList.remove("open"),(t=n.querySelector("ul"))==null||t.classList.remove("open"),this.collapsible.updateContentHeight())}break;case"Escape":this.listContainer.blur();break}}}">
196
196
  </ul>
197
197
  <slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
198
198
  </rokit-collapsible>
@@ -222,15 +222,14 @@ a, a:visited { color: inherit; }
222
222
  :host([collapse]) li > div > div { padding-left: 1.8em; }
223
223
  :host([collapse]) ul:not(.open) { display: none; }
224
224
  :host([collapse]) li:not(.open) > div > .toggle-node::part(link):before { transform: translate(0em, 0em) rotate(-45deg); }
225
- `];Ge([ve()],Me.prototype,"emptyMessage",2);Ge([ve()],Me.prototype,"sort",2);Ge([ve()],Me.prototype,"collapsibleMaxHeight",2);Ge([ve()],Me.prototype,"collapsibleOrientationLeft",2);Ge([ve()],Me.prototype,"collapsibleOrientationRight",2);Ge([ve()],Me.prototype,"collapsibleWidth",2);Ge([ve()],Me.prototype,"inputMinWidth",2);Ge([ve({type:Boolean,reflect:!0})],Me.prototype,"collapse",2);Ge([ve()],Me.prototype,"filterableThreshold",2);Ge([dt("rokit-collapsible")],Me.prototype,"collapsible",2);Ge([dt("#input")],Me.prototype,"input",2);Ge([dt("#list-container")],Me.prototype,"listContainer",2);Ge([sa()],Me.prototype,"selectedItem",2);Ge([sa()],Me.prototype,"itemCount",2);Me=Ge([Gt("rokit-select")],Me);var mf=Object.defineProperty,bf=Object.getOwnPropertyDescriptor,kn=(n,e,t,r)=>{for(var i=r>1?void 0:r?bf(e,t):e,s=n.length-1,a;s>=0;s--)(a=n[s])&&(i=(r?a(e,t,i):a(i))||i);return r&&i&&mf(e,t,i),i};let Ft=class extends ke{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(n){super.updated(n),this.resize==="auto"&&n.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const n=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");n.trim()!==""&&(this.value=n)}renderInput(){return ct`
225
+ `];Ge([ve()],Me.prototype,"emptyMessage",2);Ge([ve()],Me.prototype,"sort",2);Ge([ve()],Me.prototype,"collapsibleMaxHeight",2);Ge([ve()],Me.prototype,"collapsibleOrientationLeft",2);Ge([ve()],Me.prototype,"collapsibleOrientationRight",2);Ge([ve()],Me.prototype,"collapsibleWidth",2);Ge([ve()],Me.prototype,"inputMinWidth",2);Ge([ve({type:Boolean,reflect:!0})],Me.prototype,"collapse",2);Ge([ve()],Me.prototype,"filterableThreshold",2);Ge([dt("rokit-collapsible")],Me.prototype,"collapsible",2);Ge([dt("#input")],Me.prototype,"input",2);Ge([dt("#list-container")],Me.prototype,"listContainer",2);Ge([ia()],Me.prototype,"selectedItem",2);Ge([ia()],Me.prototype,"itemCount",2);Me=Ge([Gt("rokit-select")],Me);var yf=Object.defineProperty,mf=Object.getOwnPropertyDescriptor,kn=(r,e,t,n)=>{for(var i=n>1?void 0:n?mf(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&&yf(e,t,i),i};let Ft=class extends ke{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("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`
226
226
  <textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
227
227
  <slot id="content" @slotchange=${this.onSlotChange}></slot>
228
228
  `}};Ft.styles=[...ke.styles,vt`
229
- :host { align-items: last baseline; }
229
+ :host, .wrapper { align-items: flex-start; }
230
230
  #input { height: initial; }
231
231
  #content { display: none; }
232
- .wrapper { align-items: flex-start; }
233
- `];kn([ve()],Ft.prototype,"resize",2);kn([ve()],Ft.prototype,"rows",2);kn([ve()],Ft.prototype,"cols",2);Ft=kn([Gt("rokit-textarea")],Ft);var wf=Object.defineProperty,vf=Object.getOwnPropertyDescriptor,zu=n=>{throw TypeError(n)},ht=(n,e,t,r)=>{for(var i=r>1?void 0:r?vf(e,t):e,s=n.length-1,a;s>=0;s--)(a=n[s])&&(i=(r?a(e,t,i):a(i))||i);return r&&i&&wf(e,t,i),i},Ju=(n,e,t)=>e.has(n)||zu("Cannot "+t),Re=(n,e,t)=>(Ju(n,e,"read from private field"),t?t.call(n):e.get(n)),wi=(n,e,t)=>e.has(n)?zu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),cn=(n,e,t,r)=>(Ju(n,e,"write to private field"),e.set(n,t),t),Oe,gt,Yt;const It=18;let mt=class extends ke{constructor(){super(...arguments),this.labelFormatter=n=>String(n),wi(this,Oe,[0,1]),wi(this,gt,[Re(this,Oe)[0],Re(this,Oe)[1]]),wi(this,Yt)}firstUpdated(){super.firstUpdated(),this.sliderElement.addEventListener("mousedown",n=>this.onKnobDrag(n)),this.sliderElement.addEventListener("touchstart",n=>this.onKnobDrag(n)),new ResizeObserver(()=>{this.updateKnobPositions()}).observe(this.sliderElement)}updated(n){if(super.updated(n),n.has("min")&&(Re(this,Oe)[0]=parseFloat(this.min||"0"),Re(this,Oe)[1]=Math.max(Re(this,Oe)[0],Re(this,Oe)[1])),n.has("max")&&(Re(this,Oe)[1]=parseFloat(this.max||"1"),Re(this,Oe)[0]=Math.min(Re(this,Oe)[0],Re(this,Oe)[1])),n.has("step")&&cn(this,Yt,this.step?parseFloat(this.step):void 0),n.has("value")||n.has("min")||n.has("max"))if(this.value)if(this.range!==void 0){const e=JSON.parse(this.value);cn(this,gt,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else cn(this,gt,[this.applyConstraints(parseFloat(this.value))]);else cn(this,gt,[Re(this,Oe)[0],Re(this,Oe)[1]]);this.updateKnobPositions()}updateValidity(n,e){super.updateValidity(n,e,this.sliderElement)}chooseKnob(n){if(!this.endKnob)return this.startKnob;let e=Math.abs(n-this.startKnob.offsetLeft)<Math.abs(n-this.endKnob.offsetLeft)?this.startKnob:this.endKnob;return this.startKnob.value===this.endKnob.value&&(e.id==="start"&&e.value===Re(this,Oe)[0]?e=this.endKnob:e.id==="end"&&e.value===Re(this,Oe)[1]&&(e=this.startKnob)),e}toScreenSpace(n){return(n-Re(this,Oe)[0])/(Re(this,Oe)[1]-Re(this,Oe)[0])*this.track.offsetWidth}toValueSpace(n){return n/this.track.offsetWidth*(Re(this,Oe)[1]-Re(this,Oe)[0])+Re(this,Oe)[0]}applyConstraints(n,e){let t=Math.min(Math.max(n,Re(this,Oe)[0]),Re(this,Oe)[1]);return Re(this,Yt)&&(t=Math.round(t/Re(this,Yt))*Re(this,Yt)),e!==void 0&&this.endKnob&&(t=e?Math.min(t,this.endKnob.value):Math.max(t,this.startKnob.value)),t}updateKnob(n,e){n.value=e,n.offset=this.toScreenSpace(e),n.label=this.labelFormatter(e),this.endKnob&&(n.id==="start"?this.track.style.borderLeftWidth=n.offset+"px":this.track.style.borderRightWidth=this.track.offsetWidth-n.offset+"px")}updateKnobPositions(){this.updateKnob(this.startKnob,Re(this,gt)[0]),this.endKnob&&this.updateKnob(this.endKnob,Re(this,gt)[1])}onKnobDrag(n){if(n.target instanceof sr||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"))},r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",r),document.removeEventListener("touchend",r),e&&(e.classList.remove("focus"),this.range!==void 0?e.id==="end"?this.value=JSON.stringify([Re(this,gt)[0],e.value]):this.value=JSON.stringify([e.value,Re(this,gt)[1]]):this.value=String(e.value)),e=void 0};this.sliderElement.focus(),document.addEventListener("mousemove",t),document.addEventListener("touchmove",t),document.addEventListener("mouseup",r),document.addEventListener("touchend",r),t(n)}}renderInput(){return ct`
232
+ `];kn([ve()],Ft.prototype,"resize",2);kn([ve()],Ft.prototype,"rows",2);kn([ve()],Ft.prototype,"cols",2);Ft=kn([Gt("rokit-textarea")],Ft);var bf=Object.defineProperty,wf=Object.getOwnPropertyDescriptor,Wu=r=>{throw TypeError(r)},ht=(r,e,t,n)=>{for(var i=n>1?void 0:n?wf(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&&bf(e,t,i),i},zu=(r,e,t)=>e.has(r)||Wu("Cannot "+t),Re=(r,e,t)=>(zu(r,e,"read from private field"),t?t.call(r):e.get(r)),wi=(r,e,t)=>e.has(r)?Wu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),cn=(r,e,t,n)=>(zu(r,e,"write to private field"),e.set(r,t),t),Oe,gt,Yt;const It=18;let mt=class extends ke{constructor(){super(...arguments),this.labelFormatter=r=>String(r),wi(this,Oe,[0,1]),wi(this,gt,[Re(this,Oe)[0],Re(this,Oe)[1]]),wi(this,Yt)}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")&&(Re(this,Oe)[0]=parseFloat(this.min||"0"),Re(this,Oe)[1]=Math.max(Re(this,Oe)[0],Re(this,Oe)[1])),r.has("max")&&(Re(this,Oe)[1]=parseFloat(this.max||"1"),Re(this,Oe)[0]=Math.min(Re(this,Oe)[0],Re(this,Oe)[1])),r.has("step")&&cn(this,Yt,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);cn(this,gt,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else cn(this,gt,[this.applyConstraints(parseFloat(this.value))]);else cn(this,gt,[Re(this,Oe)[0],Re(this,Oe)[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===Re(this,Oe)[0]?e=this.endKnob:e.id==="end"&&e.value===Re(this,Oe)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-Re(this,Oe)[0])/(Re(this,Oe)[1]-Re(this,Oe)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(Re(this,Oe)[1]-Re(this,Oe)[0])+Re(this,Oe)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,Re(this,Oe)[0]),Re(this,Oe)[1]);return Re(this,Yt)&&(t=Math.round(t/Re(this,Yt))*Re(this,Yt)),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,Re(this,gt)[0]),this.endKnob&&this.updateKnob(this.endKnob,Re(this,gt)[1])}onKnobDrag(r){if(r.target instanceof sr||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([Re(this,gt)[0],e.value]):this.value=JSON.stringify([e.value,Re(this,gt)[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
233
  ${super.renderInput()}
235
234
  <div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
236
235
  <div id="track"></div>
@@ -248,7 +247,7 @@ a, a:visited { color: inherit; }
248
247
  :host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
249
248
  #track { height: 2px; flex-grow: 1; background-color: #CCC; }
250
249
  #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
- `];ht([ve()],mt.prototype,"range",2);ht([ve()],mt.prototype,"labelFormatter",2);ht([dt("#slider")],mt.prototype,"sliderElement",2);ht([dt("#track")],mt.prototype,"track",2);ht([dt("#start")],mt.prototype,"startKnob",2);ht([dt("#end")],mt.prototype,"endKnob",2);mt=ht([Gt("rokit-slider")],mt);let sr=class extends Pt{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(n){n.has("offset")&&(this.style.left=this.offset+"px")}render(){return ct`<label part="label">${this.label}</label>`}};sr.styles=[vt`
250
+ `];ht([ve()],mt.prototype,"range",2);ht([ve()],mt.prototype,"labelFormatter",2);ht([dt("#slider")],mt.prototype,"sliderElement",2);ht([dt("#track")],mt.prototype,"track",2);ht([dt("#start")],mt.prototype,"startKnob",2);ht([dt("#end")],mt.prototype,"endKnob",2);mt=ht([Gt("rokit-slider")],mt);let sr=class extends qt{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>`}};sr.styles=[vt`
252
251
  :host { position: absolute; width: ${It}px; height: ${It}px; border-radius: ${It}px; background-color: var(--rokit-primary-color-inner); }
253
252
  :host(.focus), :host(:hover) { box-shadow: 0 0 0 ${It/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
254
253
  label {
@@ -278,26 +277,26 @@ a, a:visited { color: inherit; }
278
277
  background-color: inherit;
279
278
  clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
280
279
  }
281
- `];ht([ve()],sr.prototype,"offset",2);ht([ve()],sr.prototype,"label",2);sr=ht([Gt("rokit-slider-knob")],sr);class Sn extends HTMLElement{constructor(e,t,r,i){if(super(),this.template=new dd(r.store.getQuads(e,null,null,null),t,r),this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new Qe;s.classList.add("collapsible","shacl-group"),s.open=r.attributes.collapse==="open",s.label=this.template.label,this.container=s}else this.container=this;if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),r.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let s=[];i&&(t.linked?s=r.store.getQuads(i,this.template.path,null,null):s=r.store.getQuads(i,this.template.path,null,ut));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));r.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}r.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof Qe&&(r.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 r=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let i=!1;if(e){const s=ld(r,e,this.template.config);s.length&&(t=gn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=Lu(r,this,this.template.config),Qu(t,""))}else{let r=!1;if(e&&!(e instanceof Ze)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,Ue,i,ut)===0&&(r=!0)}t=gn(this.template,e,void 0,r||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 r=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",r),r&&this.addButton?.input&&this.addButton.input.updateMinWidth()}toRDF(e,t){for(const r of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const i=xe.namedNode(r.dataset.path);if(r.firstChild instanceof Nt){const s=r.firstChild.toRDF(e);e.addQuad(t,i,s,this.template.config.valuesGraphId)}else for(const s of r.querySelectorAll(":scope > .editor")){const a=md(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,Wr,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 r=this.template.config.store.getObjects(t,Wr,null);for(const i of r)if(this.template.config.store.countQuads(e,Ue,i,null)>0)return!0}return!1}createAddButton(){const e=new Me;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.classList.add("add-button");let t=[],r=this.getRdfClassToLinkOrCreate();if(r&&(t=Xs(r,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(()=>{od(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 l of t){const d=document.createElement("li"),h=typeof l.value=="string"?l.value:l.value.value;d.innerText=l.label?l.label:h,d.dataset.value=JSON.stringify(l.value),i.appendChild(d)}e.appendChild(i),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const l=JSON.parse(e.value);this.container.insertBefore(gn(this.template,l,!0,!0),e)}e.value=""})}return e}}function gn(n,e,t=!1,r=!1){let i;if(n.extendedShapes.length){i=document.createElement("div"),i.classList.add("property-instance");for(const s of n.extendedShapes)i.appendChild(new Nt(s,n.config,e,n.parent,n.nodeKind,n.label,r))}else{const s=vd(n.path,n.datatype?.value);s?n.config.editMode&&!r?i=s.createEditor(n,e):i=s.createViewer(n,e):i=pd(n,e||null,n.config.editMode&&!r),i.classList.add("property-instance"),r&&i.classList.add("linked")}return n.config.editMode&&Qu(i,n.label,t),i.dataset.path=n.path,i}function Qu(n,e,t=!1){const r=new ir;r.classList.add("remove-button","clear"),r.title="Remove "+e,r.dense=!0,r.icon=!0,r.addEventListener("click",i=>{n.classList.remove("fadeIn"),n.classList.add("fadeOut"),setTimeout(()=>{const s=n.parentElement;n.remove(),s?.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},200)}),t&&r.classList.add("persistent"),n.appendChild(r)}window.customElements.define("shacl-property",Sn);function _f(n,e){let t=n;const r=e.store.getQuads(n,null,null,null),i=Fr(r,"label",Ws,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new Qe,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=n,s.classList.add("shacl-group");const a=Fr(r,"order");return a&&(s.style.order=a),s}const Ce=[];for(let n=0;n<256;++n)Ce.push((n+256).toString(16).slice(1));function xf(n,e=0){return(Ce[n[e+0]]+Ce[n[e+1]]+Ce[n[e+2]]+Ce[n[e+3]]+"-"+Ce[n[e+4]]+Ce[n[e+5]]+"-"+Ce[n[e+6]]+Ce[n[e+7]]+"-"+Ce[n[e+8]]+Ce[n[e+9]]+"-"+Ce[n[e+10]]+Ce[n[e+11]]+Ce[n[e+12]]+Ce[n[e+13]]+Ce[n[e+14]]+Ce[n[e+15]]).toLowerCase()}let vi;const Sf=new Uint8Array(16);function Ef(){if(!vi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vi=crypto.getRandomValues.bind(crypto)}return vi(Sf)}const If=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),$o={randomUUID:If};function ko(n,e,t){if($o.randomUUID&&!n)return $o.randomUUID();n=n||{};const r=n.random??n.rng?.()??Ef();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,xf(r)}class Nt extends HTMLElement{constructor(e,t,r,i,s,a,o){super(),this.owlImports=[],this.parent=i,this.config=t,this.shaclSubject=e,this.linked=o||!1;let l=r;if(!l){if(!s){const h=t.store.getObjects(e,`${be}nodeKind`,null);h.length&&(s=h[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${be}IRI`?l=xe.namedNode(t.attributes.valuesNamespace+ko()):l=xe.blankNode(ko())}this.nodeId=l;const d=JSON.stringify([e,r]);if(r&&t.renderedNodes.has(d)){a=a||"Link";const h=document.createElement("label");h.innerText=a,h.classList.add("linked"),this.appendChild(h);const y=document.createElement("a");let w=r.termType==="BlankNode"?"_:"+r.value:r.value;y.innerText=w,y.classList.add("ref-link"),y.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${w}']`)?.scrollIntoView()},this.appendChild(y),this.style.flexDirection="row"}else{if(r&&t.renderedNodes.add(d),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const h=document.createElement("div");h.innerText=`id: ${this.nodeId.id}`,h.classList.add("node-id-display"),this.appendChild(h)}for(const h of t.store.getQuads(e,Js,null,null))this.owlImports.push(h.object);for(const h of t.store.getQuads(e,null,null,null))switch(h.predicate.id){case vn.id:this.addPropertyInstance(h.object,t,r);break;case`${be}and`:const y=t.lists[h.object.value];if(y?.length)for(const w of y)this.prepend(new Nt(w,t,r,this));else console.error("list not found:",h.object.value,"existing lists:",t.lists);break;case`${be}node`:this.prepend(new Nt(h.object,t,r,this));break;case`${be}targetClass`:this.targetClass=h.object;break;case`${be}or`:this.tryResolve(h.object,r,t);break;case`${be}xone`:this.tryResolve(h.object,r,t);break}if(a){const h=document.createElement("h1");h.innerText=a,this.prepend(h)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const r of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))r.toRDF(e,t);this.targetClass&&e.addQuad(t,Ue,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,xe.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,r){let i=this;const s=t.store.getQuads(e,`${be}group`,null,null);if(s.length>0){const o=s[0].object.value;if(t.groups.indexOf(o)>-1){let l=this.querySelector(`:scope > .shacl-group[data-subject='${o}']`);l||(l=_f(o,t),this.appendChild(l)),i=l}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new Sn(e,this,t,r);a.childElementCount>0&&i.appendChild(a)}tryResolve(e,t,r){const i=r.lists[e.value];if(i?.length){let s=!1;if(t){const a=ud(i,t,r);if(a.length){for(const o of a)this.addPropertyInstance(o,r,t);s=!0}}s||this.appendChild(Lu(i,this,r))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",r.lists)}}window.customElements.define("shacl-node",Nt);var _i={},xi,Do;function aa(){return Do||(Do=1,xi=class Xu{constructor(e,t=new Map,r=0){this.prefix=e,this._existing=t,this.counter=r}clone(){const{prefix:e,_existing:t,counter:r}=this;return new Xu(e,new Map(t),r)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const r=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,r),r}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}}),xi}var Si={},Mo;function Rf(){return Mo||(Mo=1,function(n,e){if(n.setImmediate)return;var t=1,r={},i=!1,s=n.document,a;function o(I){typeof I!="function"&&(I=new Function(""+I));for(var b=new Array(arguments.length-1),c=0;c<b.length;c++)b[c]=arguments[c+1];var p={callback:I,args:b};return r[t]=p,a(t),t++}function l(I){delete r[I]}function d(I){var b=I.callback,c=I.args;switch(c.length){case 0:b();break;case 1:b(c[0]);break;case 2:b(c[0],c[1]);break;case 3:b(c[0],c[1],c[2]);break;default:b.apply(e,c);break}}function h(I){if(i)setTimeout(h,0,I);else{var b=r[I];if(b){i=!0;try{d(b)}finally{l(I),i=!1}}}}function y(){a=function(I){process.nextTick(function(){h(I)})}}function w(){if(n.postMessage&&!n.importScripts){var I=!0,b=n.onmessage;return n.onmessage=function(){I=!1},n.postMessage("","*"),n.onmessage=b,I}}function g(){var I="setImmediate$"+Math.random()+"$",b=function(c){c.source===n&&typeof c.data=="string"&&c.data.indexOf(I)===0&&h(+c.data.slice(I.length))};n.addEventListener?n.addEventListener("message",b,!1):n.attachEvent("onmessage",b),a=function(c){n.postMessage(I+c,"*")}}function m(){var I=new MessageChannel;I.port1.onmessage=function(b){var c=b.data;h(c)},a=function(b){I.port2.postMessage(b)}}function _(){var I=s.documentElement;a=function(b){var c=s.createElement("script");c.onreadystatechange=function(){h(b),c.onreadystatechange=null,I.removeChild(c),c=null},I.appendChild(c)}}function x(){a=function(I){setTimeout(h,0,I)}}var S=Object.getPrototypeOf&&Object.getPrototypeOf(n);S=S&&S.setTimeout?S:n,{}.toString.call(n.process)==="[object process]"?y():w()?g():n.MessageChannel?m():s&&"onreadystatechange"in s.createElement("script")?_():x(),S.setImmediate=o,S.clearImmediate=l}(typeof self>"u"?typeof Zt>"u"?Si:Zt:self)),Si}/*!
280
+ `];ht([ve()],sr.prototype,"offset",2);ht([ve()],sr.prototype,"label",2);sr=ht([Gt("rokit-slider-knob")],sr);class Sn extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new cd(n.store.getQuads(e,null,null,null),t,n),this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new Qe;s.classList.add("collapsible","shacl-group"),s.open=n.attributes.collapse==="open",s.label=this.template.label,this.container=s}else this.container=this;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,ut));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 Qe&&(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=od(n,e,this.template.config);s.length&&(t=gn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=Au(n,this,this.template.config),Ju(t,""))}else{let n=!1;if(e&&!(e instanceof Ze)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,Ue,i,ut)===0&&(n=!0)}t=gn(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),n&&this.addButton?.input&&this.addButton.input.updateMinWidth()}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const i=xe.namedNode(n.dataset.path);if(n.firstChild instanceof Nt){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=yd(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,Wr,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,Wr,null);for(const i of n)if(this.template.config.store.countQuads(e,Ue,i,null)>0)return!0}return!1}createAddButton(){const e=new Me;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.classList.add("add-button");let t=[],n=this.getRdfClassToLinkOrCreate();if(n&&(t=Qs(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(()=>{ad(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 l of t){const d=document.createElement("li"),h=typeof l.value=="string"?l.value:l.value.value;d.innerText=l.label?l.label:h,d.dataset.value=JSON.stringify(l.value),i.appendChild(d)}e.appendChild(i),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const l=JSON.parse(e.value);this.container.insertBefore(gn(this.template,l,!0,!0),e)}e.value=""})}return e}}function gn(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 Nt(s,r.config,e,r.parent,r.nodeKind,r.label,n))}else{const s=wd(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=hd(r,e||null,r.config.editMode&&!n),i.classList.add("property-instance"),n&&i.classList.add("linked")}return r.config.editMode&&Ju(i,r.label,t),i.dataset.path=r.path,i}function Ju(r,e,t=!1){const n=new ir;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",Sn);function vf(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=Fr(n,"label",Gs,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new Qe,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=Fr(n,"order");return a&&(s.style.order=a),s}const Ce=[];for(let r=0;r<256;++r)Ce.push((r+256).toString(16).slice(1));function _f(r,e=0){return(Ce[r[e+0]]+Ce[r[e+1]]+Ce[r[e+2]]+Ce[r[e+3]]+"-"+Ce[r[e+4]]+Ce[r[e+5]]+"-"+Ce[r[e+6]]+Ce[r[e+7]]+"-"+Ce[r[e+8]]+Ce[r[e+9]]+"-"+Ce[r[e+10]]+Ce[r[e+11]]+Ce[r[e+12]]+Ce[r[e+13]]+Ce[r[e+14]]+Ce[r[e+15]]).toLowerCase()}let vi;const xf=new Uint8Array(16);function Sf(){if(!vi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");vi=crypto.getRandomValues.bind(crypto)}return vi(xf)}const Ef=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Oo={randomUUID:Ef};function $o(r,e,t){if(Oo.randomUUID&&!r)return Oo.randomUUID();r=r||{};const n=r.random??r.rng?.()??Sf();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,_f(n)}class Nt 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 l=n;if(!l){if(!s){const h=t.store.getObjects(e,`${be}nodeKind`,null);h.length&&(s=h[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${be}IRI`?l=xe.namedNode(t.attributes.valuesNamespace+$o()):l=xe.blankNode($o())}this.nodeId=l;const d=JSON.stringify([e,n]);if(n&&t.renderedNodes.has(d)){a=a||"Link";const h=document.createElement("label");h.innerText=a,h.classList.add("linked"),this.appendChild(h);const y=document.createElement("a");let w=n.termType==="BlankNode"?"_:"+n.value:n.value;y.innerText=w,y.classList.add("ref-link"),y.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${w}']`)?.scrollIntoView()},this.appendChild(y),this.style.flexDirection="row"}else{if(n&&t.renderedNodes.add(d),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const h=document.createElement("div");h.innerText=`id: ${this.nodeId.id}`,h.classList.add("node-id-display"),this.appendChild(h)}for(const h of t.store.getQuads(e,zs,null,null))this.owlImports.push(h.object);for(const h of t.store.getQuads(e,null,null,null))switch(h.predicate.id){case vn.id:this.addPropertyInstance(h.object,t,n);break;case`${be}and`:const y=t.lists[h.object.value];if(y?.length)for(const w of y)this.prepend(new Nt(w,t,n,this));else console.error("list not found:",h.object.value,"existing lists:",t.lists);break;case`${be}node`:this.prepend(new Nt(h.object,t,n,this));break;case`${be}targetClass`:this.targetClass=h.object;break;case`${be}or`:this.tryResolve(h.object,n,t);break;case`${be}xone`:this.tryResolve(h.object,n,t);break}if(a){const h=document.createElement("h1");h.innerText=a,this.prepend(h)}}}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,Ue,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,xe.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,`${be}group`,null,null);if(s.length>0){const o=s[0].object.value;if(t.groups.indexOf(o)>-1){let l=this.querySelector(`:scope > .shacl-group[data-subject='${o}']`);l||(l=vf(o,t),this.appendChild(l)),i=l}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new Sn(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=ld(i,t,n);if(a.length){for(const o of a)this.addPropertyInstance(o,n,t);s=!0}}s||this.appendChild(Au(i,this,n))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",n.lists)}}window.customElements.define("shacl-node",Nt);var _i={},xi,ko;function sa(){return ko||(ko=1,xi=class Qu{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 Qu(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()]}}),xi}var Si={},Do;function If(){return Do||(Do=1,function(r,e){if(r.setImmediate)return;var t=1,n={},i=!1,s=r.document,a;function o(I){typeof I!="function"&&(I=new Function(""+I));for(var b=new Array(arguments.length-1),c=0;c<b.length;c++)b[c]=arguments[c+1];var p={callback:I,args:b};return n[t]=p,a(t),t++}function l(I){delete n[I]}function d(I){var b=I.callback,c=I.args;switch(c.length){case 0:b();break;case 1:b(c[0]);break;case 2:b(c[0],c[1]);break;case 3:b(c[0],c[1],c[2]);break;default:b.apply(e,c);break}}function h(I){if(i)setTimeout(h,0,I);else{var b=n[I];if(b){i=!0;try{d(b)}finally{l(I),i=!1}}}}function y(){a=function(I){process.nextTick(function(){h(I)})}}function w(){if(r.postMessage&&!r.importScripts){var I=!0,b=r.onmessage;return r.onmessage=function(){I=!1},r.postMessage("","*"),r.onmessage=b,I}}function g(){var I="setImmediate$"+Math.random()+"$",b=function(c){c.source===r&&typeof c.data=="string"&&c.data.indexOf(I)===0&&h(+c.data.slice(I.length))};r.addEventListener?r.addEventListener("message",b,!1):r.attachEvent("onmessage",b),a=function(c){r.postMessage(I+c,"*")}}function m(){var I=new MessageChannel;I.port1.onmessage=function(b){var c=b.data;h(c)},a=function(b){I.port2.postMessage(b)}}function _(){var I=s.documentElement;a=function(b){var c=s.createElement("script");c.onreadystatechange=function(){h(b),c.onreadystatechange=null,I.removeChild(c),c=null},I.appendChild(c)}}function x(){a=function(I){setTimeout(h,0,I)}}var S=Object.getPrototypeOf&&Object.getPrototypeOf(r);S=S&&S.setTimeout?S:r,{}.toString.call(r.process)==="[object process]"?y():w()?g():r.MessageChannel?m():s&&"onreadystatechange"in s.createElement("script")?_():x(),S.setImmediate=o,S.clearImmediate=l}(typeof self>"u"?typeof Zt>"u"?Si:Zt:self)),Si}/*!
282
281
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
283
- */var Ei,Co;function Dn(){if(Co)return Ei;Co=1,Rf();const n=self.crypto||self.msCrypto;return Ei=class{constructor(t){if(!(n&&n.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),r=new Uint8Array(await n.subtle.digest(this.algorithm,t));let i="";for(let s=0;s<r.length;++s)i+=r[s].toString(16).padStart(2,"0");return i}},Ei}/*!
282
+ */var Ei,Mo;function Dn(){if(Mo)return Ei;Mo=1,If();const r=self.crypto||self.msCrypto;return Ei=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}},Ei}/*!
284
283
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
285
- */var Ii,Po;function Ku(){return Po||(Po=1,Ii=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,r=e.slice();let i=null,s=0;const a=e.length;for(let o=0;o<a;++o){const l=e[o],d=t.get(l);(i===null||l>i)&&(d&&o>0&&l>e[o-1]||!d&&o<a-1&&l>e[o+1])&&(i=l,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 l of e)l>i&&t.set(l,!t.get(l))}return r}}),Ii}/*!
284
+ */var Ii,Co;function Xu(){return Co||(Co=1,Ii=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 l=e[o],d=t.get(l);(i===null||l>i)&&(d&&o>0&&l>e[o-1]||!d&&o<a-1&&l>e[o+1])&&(i=l,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 l of e)l>i&&t.set(l,!t.get(l))}return n}}),Ii}/*!
286
285
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
287
- */var Ri,qo;function oa(){if(qo)return Ri;qo=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+"langString",t="http://www.w3.org/2001/XMLSchema#string",r="NamedNode",i="BlankNode",s="Literal",a="DefaultGraph",o={};(()=>{const g="(?:<([^:]+:[^>]*)>)",_="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"+"_",x=_+"0-9-·̀-ͯ‿-⁀",I="(_:(?:["+_+"0-9])(?:(?:["+x+".])*(?:["+x+"]))?)",b='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',c="(?:\\^\\^"+g+")",N="(?:"+b+"(?:"+c+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",D="[ \\t]+",T="[ \\t]*",q="(?:"+g+"|"+I+")"+D,R=g+D,M="(?:"+g+"|"+I+"|"+N+")"+T,B="(?:\\.|(?:(?:"+g+"|"+I+")"+T+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^"+T+"$"),o.quad=new RegExp("^"+T+q+R+M+B+T+"$")})(),Ri=class yn{static parse(m){const _=[],x={},S=m.split(o.eoln);let I=0;for(const b of S){if(I++,o.empty.test(b))continue;const c=b.match(o.quad);if(c===null)throw new Error("N-Quads parse error on line "+I+".");const p={subject:null,predicate:null,object:null,graph:null};if(c[1]!==void 0?p.subject={termType:r,value:c[1]}:p.subject={termType:i,value:c[2]},p.predicate={termType:r,value:c[3]},c[4]!==void 0?p.object={termType:r,value:c[4]}:c[5]!==void 0?p.object={termType:i,value:c[5]}:(p.object={termType:s,value:void 0,datatype:{termType:r}},c[7]!==void 0?p.object.datatype.value=c[7]:c[8]!==void 0?(p.object.datatype.value=e,p.object.language=c[8]):p.object.datatype.value=t,p.object.value=w(c[6])),c[9]!==void 0?p.graph={termType:r,value:c[9]}:c[10]!==void 0?p.graph={termType:i,value:c[10]}:p.graph={termType:a,value:""},!(p.graph.value in x))x[p.graph.value]=[p],_.push(p);else{let N=!0;const D=x[p.graph.value];for(const T of D)if(l(T,p)){N=!1;break}N&&(D.push(p),_.push(p))}}return _}static serialize(m){Array.isArray(m)||(m=yn.legacyDatasetToQuads(m));const _=[];for(const x of m)_.push(yn.serializeQuad(x));return _.sort().join("")}static serializeQuadComponents(m,_,x,S){let I="";return m.termType===r?I+=`<${m.value}>`:I+=`${m.value}`,I+=` <${_.value}> `,x.termType===r?I+=`<${x.value}>`:x.termType===i?I+=x.value:(I+=`"${h(x.value)}"`,x.datatype.value===e?x.language&&(I+=`@${x.language}`):x.datatype.value!==t&&(I+=`^^<${x.datatype.value}>`)),S.termType===r?I+=` <${S.value}>`:S.termType===i&&(I+=` ${S.value}`),I+=` .
288
- `,I}static serializeQuad(m){return yn.serializeQuadComponents(m.subject,m.predicate,m.object,m.graph)}static legacyDatasetToQuads(m){const _=[],x={"blank node":i,IRI:r,literal:s};for(const S in m)m[S].forEach(b=>{const c={};for(const p in b){const N=b[p],D={termType:x[N.type],value:N.value};D.termType===s&&(D.datatype={termType:r},"datatype"in N&&(D.datatype.value=N.datatype),"language"in N?("datatype"in N||(D.datatype.value=e),D.language=N.language):"datatype"in N||(D.datatype.value=t)),c[p]=D}S==="@default"?c.graph={termType:a,value:""}:c.graph={termType:S.startsWith("_:")?i:r,value:S},_.push(c)});return _}};function l(g,m){return!(g.subject.termType===m.subject.termType&&g.object.termType===m.object.termType)||!(g.subject.value===m.subject.value&&g.predicate.value===m.predicate.value&&g.object.value===m.object.value)?!1:g.object.termType!==s?!0:g.object.datatype.termType===m.object.datatype.termType&&g.object.language===m.object.language&&g.object.datatype.value===m.object.datatype.value}const d=/["\\\n\r]/g;function h(g){return g.replace(d,function(m){switch(m){case'"':return'\\"';case"\\":return"\\\\";case`
286
+ */var Ri,Po;function aa(){if(Po)return Ri;Po=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 g="(?:<([^:]+:[^>]*)>)",_="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"+"_",x=_+"0-9-·̀-ͯ‿-⁀",I="(_:(?:["+_+"0-9])(?:(?:["+x+".])*(?:["+x+"]))?)",b='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',c="(?:\\^\\^"+g+")",N="(?:"+b+"(?:"+c+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",D="[ \\t]+",T="[ \\t]*",q="(?:"+g+"|"+I+")"+D,R=g+D,M="(?:"+g+"|"+I+"|"+N+")"+T,B="(?:\\.|(?:(?:"+g+"|"+I+")"+T+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^"+T+"$"),o.quad=new RegExp("^"+T+q+R+M+B+T+"$")})(),Ri=class yn{static parse(m){const _=[],x={},S=m.split(o.eoln);let I=0;for(const b of S){if(I++,o.empty.test(b))continue;const c=b.match(o.quad);if(c===null)throw new Error("N-Quads parse error on line "+I+".");const p={subject:null,predicate:null,object:null,graph:null};if(c[1]!==void 0?p.subject={termType:n,value:c[1]}:p.subject={termType:i,value:c[2]},p.predicate={termType:n,value:c[3]},c[4]!==void 0?p.object={termType:n,value:c[4]}:c[5]!==void 0?p.object={termType:i,value:c[5]}:(p.object={termType:s,value:void 0,datatype:{termType:n}},c[7]!==void 0?p.object.datatype.value=c[7]:c[8]!==void 0?(p.object.datatype.value=e,p.object.language=c[8]):p.object.datatype.value=t,p.object.value=w(c[6])),c[9]!==void 0?p.graph={termType:n,value:c[9]}:c[10]!==void 0?p.graph={termType:i,value:c[10]}:p.graph={termType:a,value:""},!(p.graph.value in x))x[p.graph.value]=[p],_.push(p);else{let N=!0;const D=x[p.graph.value];for(const T of D)if(l(T,p)){N=!1;break}N&&(D.push(p),_.push(p))}}return _}static serialize(m){Array.isArray(m)||(m=yn.legacyDatasetToQuads(m));const _=[];for(const x of m)_.push(yn.serializeQuad(x));return _.sort().join("")}static serializeQuadComponents(m,_,x,S){let I="";return m.termType===n?I+=`<${m.value}>`:I+=`${m.value}`,I+=` <${_.value}> `,x.termType===n?I+=`<${x.value}>`:x.termType===i?I+=x.value:(I+=`"${h(x.value)}"`,x.datatype.value===e?x.language&&(I+=`@${x.language}`):x.datatype.value!==t&&(I+=`^^<${x.datatype.value}>`)),S.termType===n?I+=` <${S.value}>`:S.termType===i&&(I+=` ${S.value}`),I+=` .
287
+ `,I}static serializeQuad(m){return yn.serializeQuadComponents(m.subject,m.predicate,m.object,m.graph)}static legacyDatasetToQuads(m){const _=[],x={"blank node":i,IRI:n,literal:s};for(const S in m)m[S].forEach(b=>{const c={};for(const p in b){const N=b[p],D={termType:x[N.type],value:N.value};D.termType===s&&(D.datatype={termType:n},"datatype"in N&&(D.datatype.value=N.datatype),"language"in N?("datatype"in N||(D.datatype.value=e),D.language=N.language):"datatype"in N||(D.datatype.value=t)),c[p]=D}S==="@default"?c.graph={termType:a,value:""}:c.graph={termType:S.startsWith("_:")?i:n,value:S},_.push(c)});return _}};function l(g,m){return!(g.subject.termType===m.subject.termType&&g.object.termType===m.object.termType)||!(g.subject.value===m.subject.value&&g.predicate.value===m.predicate.value&&g.object.value===m.object.value)?!1:g.object.termType!==s?!0:g.object.datatype.termType===m.object.datatype.termType&&g.object.language===m.object.language&&g.object.datatype.value===m.object.datatype.value}const d=/["\\\n\r]/g;function h(g){return g.replace(d,function(m){switch(m){case'"':return'\\"';case"\\":return"\\\\";case`
289
288
  `:return"\\n";case"\r":return"\\r"}})}const y=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function w(g){return g.replace(y,function(m,_,x,S){if(_)switch(_){case"t":return" ";case"b":return"\b";case"n":return`
290
289
  `;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(x)return String.fromCharCode(parseInt(x,16));if(S)throw new Error("Unsupported U escape")})}return Ri}/*!
291
290
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
292
- */var Ni,Bo;function Yu(){if(Bo)return Ni;Bo=1;const n=aa(),e=Dn(),t=Ku(),r=oa();Ni=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:l=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new n("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=l,this.quads=null,this.deepIterations=null}async main(a){this.deepIterations=new Map,this.quads=a;for(const g of a)this._addBlankNodeQuadInfo({quad:g,component:g.subject}),this._addBlankNodeQuadInfo({quad:g,component:g.object}),this._addBlankNodeQuadInfo({quad:g,component:g.graph});const o=new Map,l=[...this.blankNodeInfo.keys()];let d=0;for(const g of l)++d%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:g,hashToBlankNodes:o});const h=[...o.keys()].sort(),y=[];for(const g of h){const m=o.get(g);if(m.length>1){y.push(m);continue}const _=m[0];this.canonicalIssuer.getId(_)}for(const g of y){const m=[];for(const _ of g){if(this.canonicalIssuer.hasId(_))continue;const x=new n("_:b");x.getId(_);const S=await this.hashNDegreeQuads(_,x);m.push(S)}m.sort(i);for(const _ of m){const x=_.issuer.getOldIds();for(const S of x)this.canonicalIssuer.getId(S)}}const w=[];for(const g of this.quads){const m=r.serializeQuadComponents(this._componentWithCanonicalId(g.subject),g.predicate,this._componentWithCanonicalId(g.object),this._componentWithCanonicalId(g.graph));w.push(m)}return w.sort(),w.join("")}async hashFirstDegreeQuads(a){const o=[],l=this.blankNodeInfo.get(a),d=l.quads;for(const y of d){const w={subject:null,predicate:y.predicate,object:null,graph:null};w.subject=this.modifyFirstDegreeComponent(a,y.subject,"subject"),w.object=this.modifyFirstDegreeComponent(a,y.object,"object"),w.graph=this.modifyFirstDegreeComponent(a,y.graph,"graph"),o.push(r.serializeQuad(w))}o.sort();const h=this.createMessageDigest();for(const y of o)h.update(y);return l.hash=await h.digest(),l.hash}async hashRelatedBlankNode(a,o,l,d){let h;this.canonicalIssuer.hasId(a)?h=this.canonicalIssuer.getId(a):l.hasId(a)?h=l.getId(a):h=this.blankNodeInfo.get(a).hash;const y=this.createMessageDigest();return y.update(d),d!=="g"&&y.update(this.getRelatedPredicate(o)),y.update(h),y.digest()}async hashNDegreeQuads(a,o){const l=this.deepIterations.get(a)||0;if(l>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,l+1);const d=this.createMessageDigest(),h=await this.createHashToRelated(a,o),y=[...h.keys()].sort();for(const w of y){d.update(w);let g="",m;const _=new t(h.get(w));let x=0;for(;_.hasNext();){const S=_.next();++x%3===0&&await this._yield();let I=o.clone(),b="";const c=[];let p=!1;for(const N of S)if(this.canonicalIssuer.hasId(N)?b+=this.canonicalIssuer.getId(N):(I.hasId(N)||c.push(N),b+=I.getId(N)),g.length!==0&&b>g){p=!0;break}if(!p){for(const N of c){const D=await this.hashNDegreeQuads(N,I);if(b+=I.getId(N),b+=`<${D.hash}>`,I=D.issuer,g.length!==0&&b>g){p=!0;break}}p||(g.length===0||b<g)&&(g=b,m=I)}}d.update(g),o=m}return{hash:await d.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 l=new Map,d=this.blankNodeInfo.get(a).quads;let h=0;for(const y of d)++h%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:y,component:y.subject,position:"s",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:y,component:y.object,position:"o",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:y,component:y.graph,position:"g",id:a,issuer:o,hashToRelated:l})]);return l}async _hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const l=await this.hashFirstDegreeQuads(a),d=o.get(l);d?d.push(a):o.set(l,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const l=o.value,d=this.blankNodeInfo.get(l);d?d.quads.add(a):this.blankNodeInfo.set(l,{quads:new Set([a]),hash:null})}async _addRelatedBlankNodeHash({quad:a,component:o,position:l,id:d,issuer:h,hashToRelated:y}){if(!(o.termType==="BlankNode"&&o.value!==d))return;const w=o.value,g=await this.hashRelatedBlankNode(w,a,h,l),m=y.get(g);m?m.push(w):y.set(g,[w])}_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 Ni}/*!
291
+ */var Ni,qo;function Ku(){if(qo)return Ni;qo=1;const r=sa(),e=Dn(),t=Xu(),n=aa();Ni=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:l=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=l,this.quads=null,this.deepIterations=null}async main(a){this.deepIterations=new Map,this.quads=a;for(const g of a)this._addBlankNodeQuadInfo({quad:g,component:g.subject}),this._addBlankNodeQuadInfo({quad:g,component:g.object}),this._addBlankNodeQuadInfo({quad:g,component:g.graph});const o=new Map,l=[...this.blankNodeInfo.keys()];let d=0;for(const g of l)++d%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:g,hashToBlankNodes:o});const h=[...o.keys()].sort(),y=[];for(const g of h){const m=o.get(g);if(m.length>1){y.push(m);continue}const _=m[0];this.canonicalIssuer.getId(_)}for(const g of y){const m=[];for(const _ of g){if(this.canonicalIssuer.hasId(_))continue;const x=new r("_:b");x.getId(_);const S=await this.hashNDegreeQuads(_,x);m.push(S)}m.sort(i);for(const _ of m){const x=_.issuer.getOldIds();for(const S of x)this.canonicalIssuer.getId(S)}}const w=[];for(const g of this.quads){const m=n.serializeQuadComponents(this._componentWithCanonicalId(g.subject),g.predicate,this._componentWithCanonicalId(g.object),this._componentWithCanonicalId(g.graph));w.push(m)}return w.sort(),w.join("")}async hashFirstDegreeQuads(a){const o=[],l=this.blankNodeInfo.get(a),d=l.quads;for(const y of d){const w={subject:null,predicate:y.predicate,object:null,graph:null};w.subject=this.modifyFirstDegreeComponent(a,y.subject,"subject"),w.object=this.modifyFirstDegreeComponent(a,y.object,"object"),w.graph=this.modifyFirstDegreeComponent(a,y.graph,"graph"),o.push(n.serializeQuad(w))}o.sort();const h=this.createMessageDigest();for(const y of o)h.update(y);return l.hash=await h.digest(),l.hash}async hashRelatedBlankNode(a,o,l,d){let h;this.canonicalIssuer.hasId(a)?h=this.canonicalIssuer.getId(a):l.hasId(a)?h=l.getId(a):h=this.blankNodeInfo.get(a).hash;const y=this.createMessageDigest();return y.update(d),d!=="g"&&y.update(this.getRelatedPredicate(o)),y.update(h),y.digest()}async hashNDegreeQuads(a,o){const l=this.deepIterations.get(a)||0;if(l>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,l+1);const d=this.createMessageDigest(),h=await this.createHashToRelated(a,o),y=[...h.keys()].sort();for(const w of y){d.update(w);let g="",m;const _=new t(h.get(w));let x=0;for(;_.hasNext();){const S=_.next();++x%3===0&&await this._yield();let I=o.clone(),b="";const c=[];let p=!1;for(const N of S)if(this.canonicalIssuer.hasId(N)?b+=this.canonicalIssuer.getId(N):(I.hasId(N)||c.push(N),b+=I.getId(N)),g.length!==0&&b>g){p=!0;break}if(!p){for(const N of c){const D=await this.hashNDegreeQuads(N,I);if(b+=I.getId(N),b+=`<${D.hash}>`,I=D.issuer,g.length!==0&&b>g){p=!0;break}}p||(g.length===0||b<g)&&(g=b,m=I)}}d.update(g),o=m}return{hash:await d.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 l=new Map,d=this.blankNodeInfo.get(a).quads;let h=0;for(const y of d)++h%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:y,component:y.subject,position:"s",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:y,component:y.object,position:"o",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:y,component:y.graph,position:"g",id:a,issuer:o,hashToRelated:l})]);return l}async _hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const l=await this.hashFirstDegreeQuads(a),d=o.get(l);d?d.push(a):o.set(l,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const l=o.value,d=this.blankNodeInfo.get(l);d?d.quads.add(a):this.blankNodeInfo.set(l,{quads:new Set([a]),hash:null})}async _addRelatedBlankNodeHash({quad:a,component:o,position:l,id:d,issuer:h,hashToRelated:y}){if(!(o.termType==="BlankNode"&&o.value!==d))return;const w=o.value,g=await this.hashRelatedBlankNode(w,a,h,l),m=y.get(g);m?m.push(w):y.set(g,[w])}_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 Ni}/*!
293
292
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
294
- */var Ti,Fo;function Nf(){if(Fo)return Ti;Fo=1;const n=Dn(),e=Yu();return Ti=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new n("sha1")}modifyFirstDegreeComponent(r,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===r?"_:a":"_:z"}}getRelatedPredicate(r){return r.predicate.value}async createHashToRelated(r,i){const s=new Map,a=this.blankNodeInfo.get(r).quads;let o=0;for(const l of a){let d,h;if(l.subject.termType==="BlankNode"&&l.subject.value!==r)h=l.subject.value,d="p";else if(l.object.termType==="BlankNode"&&l.object.value!==r)h=l.object.value,d="r";else continue;++o%100===0&&await this._yield();const y=await this.hashRelatedBlankNode(h,l,i,d),w=s.get(y);w?w.push(h):s.set(y,[h])}return s}},Ti}/*!
293
+ */var Ti,Bo;function Rf(){if(Bo)return Ti;Bo=1;const r=Dn(),e=Ku();return Ti=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 l of a){let d,h;if(l.subject.termType==="BlankNode"&&l.subject.value!==n)h=l.subject.value,d="p";else if(l.object.termType==="BlankNode"&&l.object.value!==n)h=l.object.value,d="r";else continue;++o%100===0&&await this._yield();const y=await this.hashRelatedBlankNode(h,l,i,d),w=s.get(y);w?w.push(h):s.set(y,[h])}return s}},Ti}/*!
295
294
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
296
- */var Ai,Uo;function Zu(){if(Uo)return Ai;Uo=1;const n=aa(),e=Dn(),t=Ku(),r=oa();Ai=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:l=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new n("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=l,this.quads=null,this.deepIterations=null}main(a){this.deepIterations=new Map,this.quads=a;for(const w of a)this._addBlankNodeQuadInfo({quad:w,component:w.subject}),this._addBlankNodeQuadInfo({quad:w,component:w.object}),this._addBlankNodeQuadInfo({quad:w,component:w.graph});const o=new Map,l=[...this.blankNodeInfo.keys()];for(const w of l)this._hashAndTrackBlankNode({id:w,hashToBlankNodes:o});const d=[...o.keys()].sort(),h=[];for(const w of d){const g=o.get(w);if(g.length>1){h.push(g);continue}const m=g[0];this.canonicalIssuer.getId(m)}for(const w of h){const g=[];for(const m of w){if(this.canonicalIssuer.hasId(m))continue;const _=new n("_:b");_.getId(m);const x=this.hashNDegreeQuads(m,_);g.push(x)}g.sort(i);for(const m of g){const _=m.issuer.getOldIds();for(const x of _)this.canonicalIssuer.getId(x)}}const y=[];for(const w of this.quads){const g=r.serializeQuadComponents(this._componentWithCanonicalId({component:w.subject}),w.predicate,this._componentWithCanonicalId({component:w.object}),this._componentWithCanonicalId({component:w.graph}));y.push(g)}return y.sort(),y.join("")}hashFirstDegreeQuads(a){const o=[],l=this.blankNodeInfo.get(a),d=l.quads;for(const y of d){const w={subject:null,predicate:y.predicate,object:null,graph:null};w.subject=this.modifyFirstDegreeComponent(a,y.subject,"subject"),w.object=this.modifyFirstDegreeComponent(a,y.object,"object"),w.graph=this.modifyFirstDegreeComponent(a,y.graph,"graph"),o.push(r.serializeQuad(w))}o.sort();const h=this.createMessageDigest();for(const y of o)h.update(y);return l.hash=h.digest(),l.hash}hashRelatedBlankNode(a,o,l,d){let h;this.canonicalIssuer.hasId(a)?h=this.canonicalIssuer.getId(a):l.hasId(a)?h=l.getId(a):h=this.blankNodeInfo.get(a).hash;const y=this.createMessageDigest();return y.update(d),d!=="g"&&y.update(this.getRelatedPredicate(o)),y.update(h),y.digest()}hashNDegreeQuads(a,o){const l=this.deepIterations.get(a)||0;if(l>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,l+1);const d=this.createMessageDigest(),h=this.createHashToRelated(a,o),y=[...h.keys()].sort();for(const w of y){d.update(w);let g="",m;const _=new t(h.get(w));for(;_.hasNext();){const x=_.next();let S=o.clone(),I="";const b=[];let c=!1;for(const p of x)if(this.canonicalIssuer.hasId(p)?I+=this.canonicalIssuer.getId(p):(S.hasId(p)||b.push(p),I+=S.getId(p)),g.length!==0&&I>g){c=!0;break}if(!c){for(const p of b){const N=this.hashNDegreeQuads(p,S);if(I+=S.getId(p),I+=`<${N.hash}>`,S=N.issuer,g.length!==0&&I>g){c=!0;break}}c||(g.length===0||I<g)&&(g=I,m=S)}}d.update(g),o=m}return{hash:d.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 l=new Map,d=this.blankNodeInfo.get(a).quads;for(const h of d)this._addRelatedBlankNodeHash({quad:h,component:h.subject,position:"s",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:h,component:h.object,position:"o",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:h,component:h.graph,position:"g",id:a,issuer:o,hashToRelated:l});return l}_hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const l=this.hashFirstDegreeQuads(a),d=o.get(l);d?d.push(a):o.set(l,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const l=o.value,d=this.blankNodeInfo.get(l);d?d.quads.add(a):this.blankNodeInfo.set(l,{quads:new Set([a]),hash:null})}_addRelatedBlankNodeHash({quad:a,component:o,position:l,id:d,issuer:h,hashToRelated:y}){if(!(o.termType==="BlankNode"&&o.value!==d))return;const w=o.value,g=this.hashRelatedBlankNode(w,a,h,l),m=y.get(g);m?m.push(w):y.set(g,[w])}_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 Ai}/*!
295
+ */var Ai,Fo;function Yu(){if(Fo)return Ai;Fo=1;const r=sa(),e=Dn(),t=Xu(),n=aa();Ai=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:l=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=l,this.quads=null,this.deepIterations=null}main(a){this.deepIterations=new Map,this.quads=a;for(const w of a)this._addBlankNodeQuadInfo({quad:w,component:w.subject}),this._addBlankNodeQuadInfo({quad:w,component:w.object}),this._addBlankNodeQuadInfo({quad:w,component:w.graph});const o=new Map,l=[...this.blankNodeInfo.keys()];for(const w of l)this._hashAndTrackBlankNode({id:w,hashToBlankNodes:o});const d=[...o.keys()].sort(),h=[];for(const w of d){const g=o.get(w);if(g.length>1){h.push(g);continue}const m=g[0];this.canonicalIssuer.getId(m)}for(const w of h){const g=[];for(const m of w){if(this.canonicalIssuer.hasId(m))continue;const _=new r("_:b");_.getId(m);const x=this.hashNDegreeQuads(m,_);g.push(x)}g.sort(i);for(const m of g){const _=m.issuer.getOldIds();for(const x of _)this.canonicalIssuer.getId(x)}}const y=[];for(const w of this.quads){const g=n.serializeQuadComponents(this._componentWithCanonicalId({component:w.subject}),w.predicate,this._componentWithCanonicalId({component:w.object}),this._componentWithCanonicalId({component:w.graph}));y.push(g)}return y.sort(),y.join("")}hashFirstDegreeQuads(a){const o=[],l=this.blankNodeInfo.get(a),d=l.quads;for(const y of d){const w={subject:null,predicate:y.predicate,object:null,graph:null};w.subject=this.modifyFirstDegreeComponent(a,y.subject,"subject"),w.object=this.modifyFirstDegreeComponent(a,y.object,"object"),w.graph=this.modifyFirstDegreeComponent(a,y.graph,"graph"),o.push(n.serializeQuad(w))}o.sort();const h=this.createMessageDigest();for(const y of o)h.update(y);return l.hash=h.digest(),l.hash}hashRelatedBlankNode(a,o,l,d){let h;this.canonicalIssuer.hasId(a)?h=this.canonicalIssuer.getId(a):l.hasId(a)?h=l.getId(a):h=this.blankNodeInfo.get(a).hash;const y=this.createMessageDigest();return y.update(d),d!=="g"&&y.update(this.getRelatedPredicate(o)),y.update(h),y.digest()}hashNDegreeQuads(a,o){const l=this.deepIterations.get(a)||0;if(l>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,l+1);const d=this.createMessageDigest(),h=this.createHashToRelated(a,o),y=[...h.keys()].sort();for(const w of y){d.update(w);let g="",m;const _=new t(h.get(w));for(;_.hasNext();){const x=_.next();let S=o.clone(),I="";const b=[];let c=!1;for(const p of x)if(this.canonicalIssuer.hasId(p)?I+=this.canonicalIssuer.getId(p):(S.hasId(p)||b.push(p),I+=S.getId(p)),g.length!==0&&I>g){c=!0;break}if(!c){for(const p of b){const N=this.hashNDegreeQuads(p,S);if(I+=S.getId(p),I+=`<${N.hash}>`,S=N.issuer,g.length!==0&&I>g){c=!0;break}}c||(g.length===0||I<g)&&(g=I,m=S)}}d.update(g),o=m}return{hash:d.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 l=new Map,d=this.blankNodeInfo.get(a).quads;for(const h of d)this._addRelatedBlankNodeHash({quad:h,component:h.subject,position:"s",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:h,component:h.object,position:"o",id:a,issuer:o,hashToRelated:l}),this._addRelatedBlankNodeHash({quad:h,component:h.graph,position:"g",id:a,issuer:o,hashToRelated:l});return l}_hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const l=this.hashFirstDegreeQuads(a),d=o.get(l);d?d.push(a):o.set(l,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const l=o.value,d=this.blankNodeInfo.get(l);d?d.quads.add(a):this.blankNodeInfo.set(l,{quads:new Set([a]),hash:null})}_addRelatedBlankNodeHash({quad:a,component:o,position:l,id:d,issuer:h,hashToRelated:y}){if(!(o.termType==="BlankNode"&&o.value!==d))return;const w=o.value,g=this.hashRelatedBlankNode(w,a,h,l),m=y.get(g);m?m.push(w):y.set(g,[w])}_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 Ai}/*!
297
296
  * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
298
- */var Li,Ho;function Tf(){if(Ho)return Li;Ho=1;const n=Dn(),e=Zu();return Li=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new n("sha1")}modifyFirstDegreeComponent(r,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===r?"_:a":"_:z"}}getRelatedPredicate(r){return r.predicate.value}createHashToRelated(r,i){const s=new Map,a=this.blankNodeInfo.get(r).quads;for(const o of a){let l,d;if(o.subject.termType==="BlankNode"&&o.subject.value!==r)d=o.subject.value,l="p";else if(o.object.termType==="BlankNode"&&o.object.value!==r)d=o.object.value,l="r";else continue;const h=this.hashRelatedBlankNode(d,o,i,l),y=s.get(h);y?y.push(d):s.set(h,[d])}return s}},Li}const Af={},Lf=Object.freeze(Object.defineProperty({__proto__:null,default:Af},Symbol.toStringTag,{value:"Module"})),jf=Sc(Lf);var Vo;function Of(){return Vo||(Vo=1,function(n){const e=Yu(),t=Nf(),r=Zu(),i=Tf();let s;try{s=jf}catch{}function a(o){return Array.isArray(o)?o:n.NQuads.legacyDatasetToQuads(o)}n.NQuads=oa(),n.IdentifierIssuer=aa(),n._rdfCanonizeNative=function(o){return o&&(s=o),s},n.canonize=async function(o,l){const d=a(o);if(l.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((h,y)=>s.canonize(d,l,(w,g)=>w?y(w):h(g)))}if(l.algorithm==="URDNA2015")return new e(l).main(d);if(l.algorithm==="URGNA2012"){if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(l).main(d)}throw"algorithm"in l?new Error("Invalid RDF Dataset Canonicalization algorithm: "+l.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},n._canonizeSync=function(o,l){const d=a(o);if(l.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(d,l)}if(l.algorithm==="URDNA2015")return new r(l).main(d);if(l.algorithm==="URGNA2012"){if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(l).main(d)}throw"algorithm"in l?new Error("Invalid RDF Dataset Canonicalization algorithm: "+l.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}}(_i)),_i}var ji,Go;function la(){return Go||(Go=1,ji=Of()),ji}var Oi,Wo;function Ke(){if(Wo)return Oi;Wo=1;const n={};return Oi=n,n.isArray=Array.isArray,n.isBoolean=e=>typeof e=="boolean"||Object.prototype.toString.call(e)==="[object Boolean]",n.isDouble=e=>n.isNumber(e)&&(String(e).indexOf(".")!==-1||Math.abs(e)>=1e21),n.isEmptyObject=e=>n.isObject(e)&&Object.keys(e).length===0,n.isNumber=e=>typeof e=="number"||Object.prototype.toString.call(e)==="[object Number]",n.isNumeric=e=>!isNaN(parseFloat(e))&&isFinite(e),n.isObject=e=>Object.prototype.toString.call(e)==="[object Object]",n.isString=e=>typeof e=="string"||Object.prototype.toString.call(e)==="[object String]",n.isUndefined=e=>typeof e>"u",Oi}var $i,zo;function _t(){if(zo)return $i;zo=1;const n=Ke(),e={};return $i=e,e.isSubject=t=>n.isObject(t)&&!("@value"in t||"@set"in t||"@list"in t)?Object.keys(t).length>1||!("@id"in t):!1,e.isSubjectReference=t=>n.isObject(t)&&Object.keys(t).length===1&&"@id"in t,e.isValue=t=>n.isObject(t)&&"@value"in t,e.isList=t=>n.isObject(t)&&"@list"in t,e.isGraph=t=>n.isObject(t)&&"@graph"in t&&Object.keys(t).filter(r=>r!=="@id"&&r!=="@index").length===1,e.isSimpleGraph=t=>e.isGraph(t)&&!("@id"in t),e.isBlankNode=t=>{if(n.isObject(t)){if("@id"in t){const r=t["@id"];return!n.isString(r)||r.indexOf("_:")===0}return Object.keys(t).length===0||!("@value"in t||"@set"in t||"@list"in t)}return!1},$i}var ki,Jo;function rt(){return Jo||(Jo=1,ki=class extends Error{constructor(e="An unspecified JSON-LD error occurred.",t="jsonld.Error",r={}){super(e),this.name=t,this.message=e,this.details=r}}),ki}var Di,Qo;function et(){if(Qo)return Di;Qo=1;const n=_t(),e=Ke(),t=la().IdentifierIssuer,r=rt(),i=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,o=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,l=/^@[a-zA-Z]+$/,d={headers:{accept:"application/ld+json, application/json"}},h={};Di=h,h.IdentifierIssuer=t,h.REGEX_BCP47=i,h.REGEX_KEYWORD=l,h.clone=function(w){if(w&&typeof w=="object"){let g;if(e.isArray(w)){g=[];for(let m=0;m<w.length;++m)g[m]=h.clone(w[m])}else if(w instanceof Map){g=new Map;for(const[m,_]of w)g.set(m,h.clone(_))}else if(w instanceof Set){g=new Set;for(const m of w)g.add(h.clone(m))}else if(e.isObject(w)){g={};for(const m in w)g[m]=h.clone(w[m])}else g=w.toString();return g}return w},h.asArray=function(w){return Array.isArray(w)?w:[w]},h.buildHeaders=(w={})=>{if(Object.keys(w).some(m=>m.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+d.headers.accept+'" is supported.');return Object.assign({Accept:d.headers.accept},w)},h.parseLinkHeader=w=>{const g={},m=w.match(s);for(let _=0;_<m.length;++_){let x=m[_].match(a);if(!x)continue;const S={target:x[1]},I=x[2];for(;x=o.exec(I);)S[x[1]]=x[2]===void 0?x[3]:x[2];const b=S.rel||"";Array.isArray(g[b])?g[b].push(S):g.hasOwnProperty(b)?g[b]=[g[b],S]:g[b]=S}return g},h.validateTypeValue=(w,g)=>{if(!e.isString(w)&&!(e.isArray(w)&&w.every(m=>e.isString(m)))){if(g&&e.isObject(w))switch(Object.keys(w).length){case 0:return;case 1:if("@default"in w&&h.asArray(w["@default"]).every(m=>e.isString(m)))return}throw new r('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:w})}},h.hasProperty=(w,g)=>{if(w.hasOwnProperty(g)){const m=w[g];return!e.isArray(m)||m.length>0}return!1},h.hasValue=(w,g,m)=>{if(h.hasProperty(w,g)){let _=w[g];const x=n.isList(_);if(e.isArray(_)||x){x&&(_=_["@list"]);for(let S=0;S<_.length;++S)if(h.compareValues(m,_[S]))return!0}else if(!e.isArray(m))return h.compareValues(m,_)}return!1},h.addValue=(w,g,m,_)=>{if(_=_||{},"propertyIsArray"in _||(_.propertyIsArray=!1),"valueIsArray"in _||(_.valueIsArray=!1),"allowDuplicate"in _||(_.allowDuplicate=!0),"prependValue"in _||(_.prependValue=!1),_.valueIsArray)w[g]=m;else if(e.isArray(m)){m.length===0&&_.propertyIsArray&&!w.hasOwnProperty(g)&&(w[g]=[]),_.prependValue&&(m=m.concat(w[g]),w[g]=[]);for(let x=0;x<m.length;++x)h.addValue(w,g,m[x],_)}else if(w.hasOwnProperty(g)){const x=!_.allowDuplicate&&h.hasValue(w,g,m);!e.isArray(w[g])&&(!x||_.propertyIsArray)&&(w[g]=[w[g]]),x||(_.prependValue?w[g].unshift(m):w[g].push(m))}else w[g]=_.propertyIsArray?[m]:m},h.getValues=(w,g)=>[].concat(w[g]||[]),h.removeProperty=(w,g)=>{delete w[g]},h.removeValue=(w,g,m,_)=>{_=_||{},"propertyIsArray"in _||(_.propertyIsArray=!1);const x=h.getValues(w,g).filter(S=>!h.compareValues(S,m));x.length===0?h.removeProperty(w,g):x.length===1&&!_.propertyIsArray?w[g]=x[0]:w[g]=x},h.relabelBlankNodes=(w,g)=>{g=g||{};const m=g.issuer||new t("_:b");return y(m,w)},h.compareValues=(w,g)=>w===g||n.isValue(w)&&n.isValue(g)&&w["@value"]===g["@value"]&&w["@type"]===g["@type"]&&w["@language"]===g["@language"]&&w["@index"]===g["@index"]?!0:e.isObject(w)&&"@id"in w&&e.isObject(g)&&"@id"in g?w["@id"]===g["@id"]:!1,h.compareShortestLeast=(w,g)=>w.length<g.length?-1:g.length<w.length?1:w===g?0:w<g?-1:1;function y(w,g){if(e.isArray(g))for(let m=0;m<g.length;++m)g[m]=y(w,g[m]);else if(n.isList(g))g["@list"]=y(w,g["@list"]);else if(e.isObject(g)){n.isBlankNode(g)&&(g["@id"]=w.getId(g["@id"]));const m=Object.keys(g).sort();for(let _=0;_<m.length;++_){const x=m[_];x!=="@id"&&(g[x]=y(w,g[x]))}}return g}return Di}var Mi,Xo;function ua(){if(Xo)return Mi;Xo=1;const n="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return Mi={LINK_HEADER_REL:"http://www.w3.org/ns/json-ld#context",LINK_HEADER_CONTEXT:"http://www.w3.org/ns/json-ld#context",RDF:n,RDF_LIST:n+"List",RDF_FIRST:n+"first",RDF_REST:n+"rest",RDF_NIL:n+"nil",RDF_TYPE:n+"type",RDF_PLAIN_LITERAL:n+"PlainLiteral",RDF_XML_LITERAL:n+"XMLLiteral",RDF_JSON_LITERAL:n+"JSON",RDF_OBJECT:n+"object",RDF_LANGSTRING:n+"langString",XSD:e,XSD_BOOLEAN:e+"boolean",XSD_DOUBLE:e+"double",XSD_INTEGER:e+"integer",XSD_STRING:e+"string"},Mi}var Ci,Ko;function ec(){return Ko||(Ko=1,Ci=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]}}}),Ci}var Pi,Yo;function At(){if(Yo)return Pi;Yo=1;const n=Ke(),e={};Pi=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=(r,i)=>{const s={},a=e.parsers[i||"full"],o=a.regex.exec(r);let l=a.keys.length;for(;l--;)s[a.keys[l]]=o[l]===void 0?null:o[l];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=(r,i)=>{if(r===null||e.isAbsolute(i))return i;(!r||n.isString(r))&&(r=e.parse(r||""));const s=e.parse(i),a={protocol:r.protocol||""};if(s.authority!==null)a.authority=s.authority,a.path=s.path,a.query=s.query;else if(a.authority=r.authority,s.path==="")a.path=r.path,s.query!==null?a.query=s.query:a.query=r.query;else{if(s.path.indexOf("/")===0)a.path=s.path;else{let l=r.path;l=l.substr(0,l.lastIndexOf("/")+1),(l.length>0||r.authority)&&l.substr(-1)!=="/"&&(l+="/"),l+=s.path,a.path=l}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=(r,i)=>{if(r===null)return i;(!r||n.isString(r))&&(r=e.parse(r||""));let s="";if(r.href!==""?s+=(r.protocol||"")+"//"+(r.authority||""):i.indexOf("//")&&(s+="//"),i.indexOf(s)!==0)return i;const a=e.parse(i.substr(s.length)),o=r.normalizedPath.split("/"),l=a.normalizedPath.split("/"),d=a.fragment||a.query?0:1;for(;o.length>0&&l.length>d&&o[0]===l[0];)o.shift(),l.shift();let h="";if(o.length>0){o.pop();for(let y=0;y<o.length;++y)h+="../"}return h+=l.join("/"),a.query!==null&&(h+="?"+a.query),a.fragment!==null&&(h+="#"+a.fragment),h===""&&(h="./"),h},e.removeDotSegments=r=>{if(r.length===0)return"";const i=r.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 r[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=r=>n.isString(r)&&t.test(r),e.isRelative=r=>n.isString(r),Pi}var qi,Zo;function $f(){if(Zo)return qi;Zo=1;const{parseLinkHeader:n,buildHeaders:e}=et(),{LINK_HEADER_CONTEXT:t}=ua(),r=rt(),i=ec(),{prependBase:s}=At(),a=/(^|(\r\n))link:/i;qi=({secure:l,headers:d={},xhr:h}={headers:{}})=>{return d=e(d),new i().wrapLoader(w);async function w(g){if(g.indexOf("http:")!==0&&g.indexOf("https:")!==0)throw new r('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:g});if(l&&g.indexOf("https")!==0)throw new r(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,"jsonld.InvalidUrl",{code:"loading document failed",url:g});let m;try{m=await o(h,g,d)}catch(b){throw new r("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:g,cause:b})}if(m.status>=400)throw new r("URL could not be dereferenced: "+m.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:g,httpStatusCode:m.status});let _={contextUrl:null,documentUrl:g,document:m.response},x=null;const S=m.getResponseHeader("Content-Type");let I;if(a.test(m.getAllResponseHeaders())&&(I=m.getResponseHeader("Link")),I&&S!=="application/ld+json"){const b=n(I),c=b[t];if(Array.isArray(c))throw new r("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:g});c&&(_.contextUrl=c.target),x=b.alternate,x&&x.type=="application/ld+json"&&!(S||"").match(/^application\/(\w*\+)?json$/)&&(_=await w(s(g,x.target)))}return _}};function o(l,d,h){l=l||XMLHttpRequest;const y=new l;return new Promise((w,g)=>{y.onload=()=>w(y),y.onerror=m=>g(m),y.open("GET",d,!0);for(const m in h)y.setRequestHeader(m,h[m]);y.send()})}return qi}var Bi,el;function kf(){if(el)return Bi;el=1;const n=$f(),e={};return Bi=e,e.setupDocumentLoaders=function(t){typeof XMLHttpRequest<"u"&&(t.documentLoaders.xhr=n,t.useDocumentLoader("xhr"))},e.setupGlobals=function(t){typeof globalThis.JsonLdProcessor>"u"&&Object.defineProperty(globalThis,"JsonLdProcessor",{writable:!0,enumerable:!1,configurable:!0,value:t.JsonLdProcessor})},Bi}var Fi,tl;function Df(){return tl||(tl=1,Fi=function(n){n.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Fi}var Ui,rl;function Mf(){if(rl)return Ui;rl=1,Ui=n,n.Node=i,n.create=n;function n(s){var a=this;if(a instanceof n||(a=new n),a.tail=null,a.head=null,a.length=0,s&&typeof s.forEach=="function")s.forEach(function(d){a.push(d)});else if(arguments.length>0)for(var o=0,l=arguments.length;o<l;o++)a.push(arguments[o]);return a}n.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},n.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++}},n.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++}},n.prototype.push=function(){for(var s=0,a=arguments.length;s<a;s++)t(this,arguments[s]);return this.length},n.prototype.unshift=function(){for(var s=0,a=arguments.length;s<a;s++)r(this,arguments[s]);return this.length},n.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}},n.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}},n.prototype.forEach=function(s,a){a=a||this;for(var o=this.head,l=0;o!==null;l++)s.call(a,o.value,l,this),o=o.next},n.prototype.forEachReverse=function(s,a){a=a||this;for(var o=this.tail,l=this.length-1;o!==null;l--)s.call(a,o.value,l,this),o=o.prev},n.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},n.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},n.prototype.map=function(s,a){a=a||this;for(var o=new n,l=this.head;l!==null;)o.push(s.call(a,l.value,this)),l=l.next;return o},n.prototype.mapReverse=function(s,a){a=a||this;for(var o=new n,l=this.tail;l!==null;)o.push(s.call(a,l.value,this)),l=l.prev;return o},n.prototype.reduce=function(s,a){var o,l=this.head;if(arguments.length>1)o=a;else if(this.head)l=this.head.next,o=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var d=0;l!==null;d++)o=s(o,l.value,d),l=l.next;return o},n.prototype.reduceReverse=function(s,a){var o,l=this.tail;if(arguments.length>1)o=a;else if(this.tail)l=this.tail.prev,o=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var d=this.length-1;l!==null;d--)o=s(o,l.value,d),l=l.prev;return o},n.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},n.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},n.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 n;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var l=0,d=this.head;d!==null&&l<s;l++)d=d.next;for(;d!==null&&l<a;l++,d=d.next)o.push(d.value);return o},n.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 n;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var l=this.length,d=this.tail;d!==null&&l>a;l--)d=d.prev;for(;d!==null&&l>s;l--,d=d.prev)o.push(d.value);return o},n.prototype.splice=function(s,a,...o){s>this.length&&(s=this.length-1),s<0&&(s=this.length+s);for(var l=0,d=this.head;d!==null&&l<s;l++)d=d.next;for(var h=[],l=0;d&&l<a;l++)h.push(d.value),d=this.removeNode(d);d===null&&(d=this.tail),d!==this.head&&d!==this.tail&&(d=d.prev);for(var l=0;l<o.length;l++)d=e(this,d,o[l]);return h},n.prototype.reverse=function(){for(var s=this.head,a=this.tail,o=s;o!==null;o=o.prev){var l=o.prev;o.prev=o.next,o.next=l}return this.head=a,this.tail=s,this};function e(s,a,o){var l=a===s.head?new i(o,null,a,s):new i(o,a,a.next,s);return l.next===null&&(s.tail=l),l.prev===null&&(s.head=l),s.length++,l}function t(s,a){s.tail=new i(a,s.tail,null,s),s.head||(s.head=s.tail),s.length++}function r(s,a){s.head=new i(a,null,s.head,s),s.tail||(s.tail=s.head),s.length++}function i(s,a,o,l){if(!(this instanceof i))return new i(s,a,o,l);this.list=l,this.value=s,a?(a.next=this,this.prev=a):this.prev=null,o?(o.prev=this,this.next=o):this.next=null}try{Df()(n)}catch{}return Ui}var Hi,nl;function tc(){if(nl)return Hi;nl=1;const n=Mf(),e=Symbol("max"),t=Symbol("length"),r=Symbol("lengthCalculator"),i=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),l=Symbol("lruList"),d=Symbol("cache"),h=Symbol("updateAgeOnGet"),y=()=>1;class w{constructor(c){if(typeof c=="number"&&(c={max:c}),c||(c={}),c.max&&(typeof c.max!="number"||c.max<0))throw new TypeError("max must be a non-negative number");this[e]=c.max||1/0;const p=c.length||y;if(this[r]=typeof p!="function"?y:p,this[i]=c.stale||!1,c.maxAge&&typeof c.maxAge!="number")throw new TypeError("maxAge must be a number");this[s]=c.maxAge||0,this[a]=c.dispose,this[o]=c.noDisposeOnSet||!1,this[h]=c.updateAgeOnGet||!1,this.reset()}set max(c){if(typeof c!="number"||c<0)throw new TypeError("max must be a non-negative number");this[e]=c||1/0,_(this)}get max(){return this[e]}set allowStale(c){this[i]=!!c}get allowStale(){return this[i]}set maxAge(c){if(typeof c!="number")throw new TypeError("maxAge must be a non-negative number");this[s]=c,_(this)}get maxAge(){return this[s]}set lengthCalculator(c){typeof c!="function"&&(c=y),c!==this[r]&&(this[r]=c,this[t]=0,this[l].forEach(p=>{p.length=this[r](p.value,p.key),this[t]+=p.length})),_(this)}get lengthCalculator(){return this[r]}get length(){return this[t]}get itemCount(){return this[l].length}rforEach(c,p){p=p||this;for(let N=this[l].tail;N!==null;){const D=N.prev;I(this,c,N,p),N=D}}forEach(c,p){p=p||this;for(let N=this[l].head;N!==null;){const D=N.next;I(this,c,N,p),N=D}}keys(){return this[l].toArray().map(c=>c.key)}values(){return this[l].toArray().map(c=>c.value)}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach(c=>this[a](c.key,c.value)),this[d]=new Map,this[l]=new n,this[t]=0}dump(){return this[l].map(c=>m(this,c)?!1:{k:c.key,v:c.value,e:c.now+(c.maxAge||0)}).toArray().filter(c=>c)}dumpLru(){return this[l]}set(c,p,N){if(N=N||this[s],N&&typeof N!="number")throw new TypeError("maxAge must be a number");const D=N?Date.now():0,T=this[r](p,c);if(this[d].has(c)){if(T>this[e])return x(this,this[d].get(c)),!1;const M=this[d].get(c).value;return this[a]&&(this[o]||this[a](c,M.value)),M.now=D,M.maxAge=N,M.value=p,this[t]+=T-M.length,M.length=T,this.get(c),_(this),!0}const q=new S(c,p,T,D,N);return q.length>this[e]?(this[a]&&this[a](c,p),!1):(this[t]+=q.length,this[l].unshift(q),this[d].set(c,this[l].head),_(this),!0)}has(c){if(!this[d].has(c))return!1;const p=this[d].get(c).value;return!m(this,p)}get(c){return g(this,c,!0)}peek(c){return g(this,c,!1)}pop(){const c=this[l].tail;return c?(x(this,c),c.value):null}del(c){x(this,this[d].get(c))}load(c){this.reset();const p=Date.now();for(let N=c.length-1;N>=0;N--){const D=c[N],T=D.e||0;if(T===0)this.set(D.k,D.v);else{const q=T-p;q>0&&this.set(D.k,D.v,q)}}}prune(){this[d].forEach((c,p)=>g(this,p,!1))}}const g=(b,c,p)=>{const N=b[d].get(c);if(N){const D=N.value;if(m(b,D)){if(x(b,N),!b[i])return}else p&&(b[h]&&(N.value.now=Date.now()),b[l].unshiftNode(N));return D.value}},m=(b,c)=>{if(!c||!c.maxAge&&!b[s])return!1;const p=Date.now()-c.now;return c.maxAge?p>c.maxAge:b[s]&&p>b[s]},_=b=>{if(b[t]>b[e])for(let c=b[l].tail;b[t]>b[e]&&c!==null;){const p=c.prev;x(b,c),c=p}},x=(b,c)=>{if(c){const p=c.value;b[a]&&b[a](p.key,p.value),b[t]-=p.length,b[d].delete(p.key),b[l].removeNode(c)}};class S{constructor(c,p,N,D,T){this.key=c,this.value=p,this.length=N,this.now=D,this.maxAge=T||0}}const I=(b,c,p,N)=>{let D=p.value;m(b,D)&&(x(b,p),b[i]||(D=void 0)),D&&c.call(N,D.value,D.key,b)};return Hi=w,Hi}var Vi,il;function Cf(){if(il)return Vi;il=1;const n=tc(),e=10;return Vi=class{constructor({document:r}){this.document=r,this.cache=new n({max:e})}getProcessed(r){return this.cache.get(r)}setProcessed(r,i){this.cache.set(r,i)}},Vi}var Gi,sl;function Pf(){if(sl)return Gi;sl=1;const{isArray:n,isObject:e,isString:t}=Ke(),{asArray:r}=et(),{prependBase:i}=At(),s=rt(),a=Cf(),o=10;Gi=class{constructor({sharedCache:y}){this.perOpCache=new Map,this.sharedCache=y}async resolve({activeCtx:y,context:w,documentLoader:g,base:m,cycles:_=new Set}){w&&e(w)&&w["@context"]&&(w=w["@context"]),w=r(w);const x=[];for(const S of w){if(t(S)){let c=this._get(S);c||(c=await this._resolveRemoteContext({activeCtx:y,url:S,documentLoader:g,base:m,cycles:_})),n(c)?x.push(...c):x.push(c);continue}if(S===null){x.push(new a({document:null}));continue}e(S)||l(w);const I=JSON.stringify(S);let b=this._get(I);b||(b=new a({document:S}),this._cacheResolvedContext({key:I,resolved:b,tag:"static"})),x.push(b)}return x}_get(y){let w=this.perOpCache.get(y);if(!w){const g=this.sharedCache.get(y);g&&(w=g.get("static"),w&&this.perOpCache.set(y,w))}return w}_cacheResolvedContext({key:y,resolved:w,tag:g}){if(this.perOpCache.set(y,w),g!==void 0){let m=this.sharedCache.get(y);m||(m=new Map,this.sharedCache.set(y,m)),m.set(g,w)}return w}async _resolveRemoteContext({activeCtx:y,url:w,documentLoader:g,base:m,cycles:_}){w=i(m,w);const{context:x,remoteDoc:S}=await this._fetchContext({activeCtx:y,url:w,documentLoader:g,cycles:_});m=S.documentUrl||w,d({context:x,base:m});const I=await this.resolve({activeCtx:y,context:x,documentLoader:g,base:m,cycles:_});return this._cacheResolvedContext({key:w,resolved:I,tag:S.tag}),I}async _fetchContext({activeCtx:y,url:w,documentLoader:g,cycles:m}){if(m.size>o)throw new s("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:y.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:o});if(m.has(w))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:y.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:w});m.add(w);let _,x;try{x=await g(w),_=x.document||null,t(_)&&(_=JSON.parse(_))}catch(S){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: "${w}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:w,cause:S})}if(!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: "${w}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:w});return"@context"in _?_={"@context":_["@context"]}:_={"@context":{}},x.contextUrl&&(n(_["@context"])||(_["@context"]=[_["@context"]]),_["@context"].push(x.contextUrl)),{context:_,remoteDoc:x}}};function l(h){throw new s("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:h})}function d({context:h,base:y}){if(!h)return;const w=h["@context"];if(t(w)){h["@context"]=i(y,w);return}if(n(w)){for(let g=0;g<w.length;++g){const m=w[g];if(t(m)){w[g]=i(y,m);continue}e(m)&&d({context:{"@context":m},base:y})}return}if(e(w))for(const g in w)d({context:w[g],base:y})}return Gi}var Wi,al;function qf(){return al||(al=1,Wi=la().NQuads),Wi}var zi,ol;function Kr(){if(ol)return zi;ol=1;const n=rt(),{isArray:e}=Ke(),{asArray:t}=et(),r={};zi=r,r.defaultEventHandler=null,r.setupEventHandler=({options:a={}})=>{const o=[].concat(a.safe?r.safeEventHandler:[],a.eventHandler?t(a.eventHandler):[],r.defaultEventHandler?r.defaultEventHandler:[]);return o.length===0?null:o},r.handleEvent=({event:a,options:o})=>{i({event:a,handlers:o.eventHandler})};function i({event:a,handlers:o}){let l=!0;for(let d=0;l&&d<o.length;++d){l=!1;const h=o[d];if(e(h))l=i({event:a,handlers:h});else if(typeof h=="function")h({event:a,next:()=>{l=!0}});else if(typeof h=="object")a.code in h?h[a.code]({event:a,next:()=>{l=!0}}):l=!0;else throw new n("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return l}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 r.safeEventHandler=function({event:o,next:l}){if(o.level==="warning"&&s.has(o.code))throw new n("Safe mode validation error.","jsonld.ValidationError",{event:o});l()},r.logEventHandler=function({event:o,next:l}){console.log(`EVENT: ${o.message}`,{event:o}),l()},r.logWarningEventHandler=function({event:o,next:l}){o.level==="warning"&&console.warn(`WARNING: ${o.message}`,{event:o}),l()},r.unhandledEventHandler=function({event:o}){throw new n("No handler for event.","jsonld.UnhandledEvent",{event:o})},r.setDefaultEventHandler=function({eventHandler:a}={}){r.defaultEventHandler=a?t(a):null},zi}var Ji,ll;function Ut(){if(ll)return Ji;ll=1;const n=et(),e=rt(),{isArray:t,isObject:r,isString:i,isUndefined:s}=Ke(),{isAbsolute:a,isRelative:o,prependBase:l}=At(),{handleEvent:d}=Kr(),{REGEX_BCP47:h,REGEX_KEYWORD:y,asArray:w,compareShortestLeast:g}=et(),m=new Map,_=1e4,x={};Ji=x,x.process=async({activeCtx:b,localCtx:c,options:p,propagate:N=!0,overrideProtected:D=!1,cycles:T=new Set})=>{if(r(c)&&"@context"in c&&t(c["@context"])&&(c=c["@context"]),w(c).length===0)return b;const R=[],M=[({event:Y,next:L})=>{R.push(Y),L()}];p.eventHandler&&M.push(p.eventHandler);const B=p;p={...p,eventHandler:M};const A=await p.contextResolver.resolve({activeCtx:b,context:c,documentLoader:p.documentLoader,base:p.base});r(A[0].document)&&typeof A[0].document["@propagate"]=="boolean"&&(N=A[0].document["@propagate"]);let j=b;!N&&!j.previousContext&&(j=j.clone(),j.previousContext=b);for(const Y of A){let{document:L}=Y;if(b=j,L===null){if(!D&&Object.keys(b.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"});j=b=x.getInitialContext(p).clone();continue}const ee=Y.getProcessed(b);if(ee){if(B.eventHandler)for(const K of ee.events)d({event:K,options:B});j=b=ee.context;continue}if(r(L)&&"@context"in L&&(L=L["@context"]),!r(L))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:L});j=j.clone();const C=new Map;if("@version"in L){if(L["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+L["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:L});if(b.processingMode&&b.processingMode==="json-ld-1.0")throw new e("@version: "+L["@version"]+" not compatible with "+b.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:L});j.processingMode="json-ld-1.1",j["@version"]=L["@version"],C.set("@version",!0)}if(j.processingMode=j.processingMode||b.processingMode,"@base"in L){let K=L["@base"];if(!(K===null||a(K)))if(o(K))K=l(j["@base"],K);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:L});j["@base"]=K,C.set("@base",!0)}if("@vocab"in L){const K=L["@vocab"];if(K===null)delete j["@vocab"];else if(i(K)){if(!a(K)&&x.processingMode(j,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:L});{const v=S(j,K,{vocab:!0,base:!0},void 0,void 0,p);a(v)||p.eventHandler&&d({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:v}},options:p}),j["@vocab"]=v}}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:L});C.set("@vocab",!0)}if("@language"in L){const K=L["@language"];if(K===null)delete j["@language"];else if(i(K))K.match(h)||p.eventHandler&&d({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:K}},options:p}),j["@language"]=K.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:L});C.set("@language",!0)}if("@direction"in L){const K=L["@direction"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:L});if(K===null)delete j["@direction"];else{if(K!=="ltr"&&K!=="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:L});j["@direction"]=K}C.set("@direction",!0)}if("@propagate"in L){const K=L["@propagate"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:L});if(typeof K!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:c});C.set("@propagate",!0)}if("@import"in L){const K=L["@import"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:L});if(!i(K))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:c});const v=await p.contextResolver.resolve({activeCtx:b,context:K,documentLoader:p.documentLoader,base:p.base});if(v.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:c});const U=v[0].getProcessed(b);if(U)L=U;else{const Q=v[0].document;if("@import"in Q)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:c});for(const z in Q)L.hasOwnProperty(z)||(L[z]=Q[z]);v[0].setProcessed(b,L)}C.set("@import",!0)}C.set("@protected",L["@protected"]||!1);for(const K in L)if(x.createTermDefinition({activeCtx:j,localCtx:L,term:K,defined:C,options:p,overrideProtected:D}),r(L[K])&&"@context"in L[K]){const v=L[K]["@context"];let U=!0;if(i(v)){const Q=l(p.base,v);T.has(Q)?U=!1:T.add(Q)}if(U)try{await x.process({activeCtx:j.clone(),localCtx:L[K]["@context"],overrideProtected:!0,options:p,cycles:T})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:L[K]["@context"],term:K})}}Y.setProcessed(b,{context:j,events:R})}return j},x.createTermDefinition=({activeCtx:b,localCtx:c,term:p,defined:N,options:D,overrideProtected:T=!1})=>{if(N.has(p)){if(N.get(p))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:c,term:p})}N.set(p,!1);let q;if(c.hasOwnProperty(p)&&(q=c[p]),p==="@type"&&r(q)&&(q["@container"]||"@set")==="@set"&&x.processingMode(b,1.1)){const L=["@container","@id","@protected"],ee=Object.keys(q);if(ee.length===0||ee.some(C=>!L.includes(C)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:c,term:p})}else{if(x.isKeyword(p))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:c,term:p});if(p.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:p}},options:D});return}else if(p==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:c})}const R=b.mappings.get(p);b.mappings.has(p)&&b.mappings.delete(p);let M=!1;if((i(q)||q===null)&&(M=!0,q={"@id":q}),!r(q))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:c});const B={};b.mappings.set(p,B),B.reverse=!1;const A=["@container","@id","@language","@reverse","@type"];x.processingMode(b,1.1)&&A.push("@context","@direction","@index","@nest","@prefix","@protected");for(const L in q)if(!A.includes(L))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+L,"jsonld.SyntaxError",{code:"invalid term definition",context:c});const j=p.indexOf(":");if(B._termHasColon=j>0,"@reverse"in q){if("@id"in q)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:c});if("@nest"in q)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:c});const L=q["@reverse"];if(!i(L))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c});if(L.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:L}},options:D}),R?b.mappings.set(p,R):b.mappings.delete(p);return}const ee=S(b,L,{vocab:!0,base:!1},c,N,D);if(!a(ee))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:c});B["@id"]=ee,B.reverse=!0}else if("@id"in q){let L=q["@id"];if(L&&!i(L))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:c});if(L===null)B["@id"]=null;else if(!x.isKeyword(L)&&L.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:L}},options:D}),R?b.mappings.set(p,R):b.mappings.delete(p);return}else if(L!==p){if(L=S(b,L,{vocab:!0,base:!1},c,N,D),!a(L)&&!x.isKeyword(L))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:c});if(p.match(/(?::[^:])|\//)){const ee=new Map(N).set(p,!0);if(S(b,p,{vocab:!0,base:!1},c,ee,D)!==L)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c})}B["@id"]=L,B._prefix=M&&!B._termHasColon&&L.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in B))if(B._termHasColon){const L=p.substr(0,j);if(c.hasOwnProperty(L)&&x.createTermDefinition({activeCtx:b,localCtx:c,term:L,defined:N,options:D}),b.mappings.has(L)){const ee=p.substr(j+1);B["@id"]=b.mappings.get(L)["@id"]+ee}else B["@id"]=p}else if(p==="@type")B["@id"]=p;else{if(!("@vocab"in b))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c,term:p});B["@id"]=b["@vocab"]+p}if((q["@protected"]===!0||N.get("@protected")===!0&&q["@protected"]!==!1)&&(b.protected[p]=!0,B.protected=!0),N.set(p,!0),"@type"in q){let L=q["@type"];if(!i(L))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:c});if(L==="@json"||L==="@none"){if(x.processingMode(b,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${L}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:c})}else if(L!=="@id"&&L!=="@vocab"){if(L=S(b,L,{vocab:!0,base:!1},c,N,D),!a(L))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:c});if(L.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:c})}B["@type"]=L}if("@container"in q){const L=i(q["@container"])?[q["@container"]]:q["@container"]||[],ee=["@list","@set","@index","@language"];let C=!0;const K=L.includes("@set");if(x.processingMode(b,1.1)){if(ee.push("@graph","@id","@type"),L.includes("@list")){if(L.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:c})}else if(L.includes("@graph")){if(L.some(v=>v!=="@graph"&&v!=="@id"&&v!=="@index"&&v!=="@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:c})}else C&=L.length<=(K?2:1);if(L.includes("@type")&&(B["@type"]=B["@type"]||"@id",!["@id","@vocab"].includes(B["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:c})}else C&=!t(q["@container"]),C&=L.length<=1;if(C&=L.every(v=>ee.includes(v)),C&=!(K&&L.includes("@list")),!C)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+ee.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:c});if(B.reverse&&!L.every(v=>["@index","@set"].includes(v)))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:c});B["@container"]=L}if("@index"in q){if(!("@container"in q)||!B["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${q["@index"]}" on term "${p}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:c});if(!i(q["@index"])||q["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${q["@index"]}" on term "${p}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:c});B["@index"]=q["@index"]}if("@context"in q&&(B["@context"]=q["@context"]),"@language"in q&&!("@type"in q)){let L=q["@language"];if(L!==null&&!i(L))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:c});L!==null&&(L=L.toLowerCase()),B["@language"]=L}if("@prefix"in q){if(p.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:c});if(x.isKeyword(B["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:c});if(typeof q["@prefix"]=="boolean")B._prefix=q["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:c})}if("@direction"in q){const L=q["@direction"];if(L!==null&&L!=="ltr"&&L!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:c});B["@direction"]=L}if("@nest"in q){const L=q["@nest"];if(!i(L)||L!=="@nest"&&L.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:c});B["@nest"]=L}// disallow aliasing @context and @preserve
299
- const Y=B["@id"];if(Y==="@context"||Y==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:c});if(R&&R.protected&&!T&&(b.protected[p]=!0,B.protected=!0,!I(R,B)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:c,term:p})},x.expandIri=(b,c,p,N)=>S(b,c,p,void 0,void 0,N);function S(b,c,p,N,D,T){if(c===null||!i(c)||x.isKeyword(c))return c;if(c.match(y))return null;if(N&&N.hasOwnProperty(c)&&D.get(c)!==!0&&x.createTermDefinition({activeCtx:b,localCtx:N,term:c,defined:D,options:T}),p=p||{},p.vocab){const R=b.mappings.get(c);if(R===null)return null;if(r(R)&&"@id"in R)return R["@id"]}const q=c.indexOf(":");if(q>0){const R=c.substr(0,q),M=c.substr(q+1);if(R==="_"||M.indexOf("//")===0)return c;N&&N.hasOwnProperty(R)&&x.createTermDefinition({activeCtx:b,localCtx:N,term:R,defined:D,options:T});const B=b.mappings.get(R);if(B&&B._prefix)return B["@id"]+M;if(a(c))return c}if(p.vocab&&"@vocab"in b)c=b["@vocab"]+c;else if(p.base){let R,M;"@base"in b?b["@base"]?(M=l(T.base,b["@base"]),R=l(M,c)):(M=b["@base"],R=c):(M=T.base,R=l(T.base,c)),c=R}return c}x.getInitialContext=b=>{const c=JSON.stringify({processingMode:b.processingMode}),p=m.get(c);if(p)return p;const N={processingMode:b.processingMode,mappings:new Map,inverse:null,getInverse:D,clone:R,revertToPreviousContext:M,protected:{}};return m.size===_&&m.clear(),m.set(c,N),N;function D(){const B=this;if(B.inverse)return B.inverse;const A=B.inverse={},j=B.fastCurieMap={},Y={},L=(B["@language"]||"@none").toLowerCase(),ee=B["@direction"],C=B.mappings,K=[...C.keys()].sort(g);for(const v of K){const U=C.get(v);if(U===null)continue;let Q=U["@container"]||"@none";if(Q=[].concat(Q).sort().join(""),U["@id"]===null)continue;const z=w(U["@id"]);for(const ae of z){let H=A[ae];const V=x.isKeyword(ae);if(H)!V&&!U._termHasColon&&Y[ae].push(v);else if(A[ae]=H={},!V&&!U._termHasColon){Y[ae]=[v];const W={iri:ae,terms:Y[ae]};ae[0]in j?j[ae[0]].push(W):j[ae[0]]=[W]}if(H[Q]||(H[Q]={"@language":{},"@type":{},"@any":{}}),H=H[Q],q(v,H["@any"],"@none"),U.reverse)q(v,H["@type"],"@reverse");else if(U["@type"]==="@none")q(v,H["@any"],"@none"),q(v,H["@language"],"@none"),q(v,H["@type"],"@none");else if("@type"in U)q(v,H["@type"],U["@type"]);else if("@language"in U&&"@direction"in U){const W=U["@language"],F=U["@direction"];W&&F?q(v,H["@language"],`${W}_${F}`.toLowerCase()):W?q(v,H["@language"],W.toLowerCase()):F?q(v,H["@language"],`_${F}`):q(v,H["@language"],"@null")}else"@language"in U?q(v,H["@language"],(U["@language"]||"@null").toLowerCase()):"@direction"in U?U["@direction"]?q(v,H["@language"],`_${U["@direction"]}`):q(v,H["@language"],"@none"):ee?(q(v,H["@language"],`_${ee}`),q(v,H["@language"],"@none"),q(v,H["@type"],"@none")):(q(v,H["@language"],L),q(v,H["@language"],"@none"),q(v,H["@type"],"@none"))}}for(const v in j)T(j,v,1);return A}function T(B,A,j){const Y=B[A],L=B[A]={};let ee,C;for(const K of Y)ee=K.iri,j>=ee.length?C="":C=ee[j],C in L?L[C].push(K):L[C]=[K];for(const K in L)K!==""&&T(L,K,j+1)}function q(B,A,j){A.hasOwnProperty(j)||(A[j]=B)}function R(){const B={};return B.mappings=n.clone(this.mappings),B.clone=this.clone,B.inverse=null,B.getInverse=this.getInverse,B.protected=n.clone(this.protected),this.previousContext&&(B.previousContext=this.previousContext.clone()),B.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(B["@base"]=this["@base"]),"@language"in this&&(B["@language"]=this["@language"]),"@vocab"in this&&(B["@vocab"]=this["@vocab"]),B}function M(){return this.previousContext?this.previousContext.clone():this}},x.getContextValue=(b,c,p)=>{if(c===null)return p==="@context"?void 0:null;if(b.mappings.has(c)){const N=b.mappings.get(c);if(s(p))return N;if(N.hasOwnProperty(p))return N[p]}if(p==="@language"&&p in b||p==="@direction"&&p in b)return b[p];if(p!=="@context")return null},x.processingMode=(b,c)=>c.toString()>="1.1"?!b.processingMode||b.processingMode>="json-ld-"+c.toString():b.processingMode==="json-ld-1.0",x.isKeyword=b=>{if(!i(b)||b[0]!=="@")return!1;switch(b){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 I(b,c){if(!(b&&typeof b=="object")||!(c&&typeof c=="object"))return b===c;const p=Array.isArray(b);if(p!==Array.isArray(c))return!1;if(p){if(b.length!==c.length)return!1;for(let T=0;T<b.length;++T)if(!I(b[T],c[T]))return!1;return!0}const N=Object.keys(b),D=Object.keys(c);if(N.length!==D.length)return!1;for(const T in b){let q=b[T],R=c[T];if(T==="@container"&&Array.isArray(q)&&Array.isArray(R)&&(q=q.slice().sort(),R=R.slice().sort()),!I(q,R))return!1}return!0}return Ji}var Qi,ul;function Bf(){if(ul)return Qi;ul=1;const n=rt(),{isArray:e,isObject:t,isEmptyObject:r,isString:i,isUndefined:s}=Ke(),{isList:a,isValue:o,isGraph:l,isSubject:d}=_t(),{expandIri:h,getContextValue:y,isKeyword:w,process:g,processingMode:m}=Ut(),{isAbsolute:_}=At(),{REGEX_BCP47:x,REGEX_KEYWORD:S,addValue:I,asArray:b,getValues:c,validateTypeValue:p}=et(),{handleEvent:N}=Kr(),D={};Qi=D,D.expand=async({activeCtx:A,activeProperty:j=null,element:Y,options:L={},insideList:ee=!1,insideIndex:C=!1,typeScopedContext:K=null})=>{if(Y==null)return null;if(j==="@default"&&(L=Object.assign({},L,{isFrame:!1})),!e(Y)&&!t(Y))return!ee&&(j===null||h(A,j,{vocab:!0},L)==="@graph")?(L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:Y}},options:L}),null):R({activeCtx:A,activeProperty:j,value:Y,options:L});if(e(Y)){let W=[];const F=y(A,j,"@container")||[];ee=ee||F.includes("@list");for(let Z=0;Z<Y.length;++Z){let te=await D.expand({activeCtx:A,activeProperty:j,element:Y[Z],options:L,insideIndex:C,typeScopedContext:K});ee&&e(te)&&(te={"@list":te}),te!==null&&(e(te)?W=W.concat(te):W.push(te))}return W}const v=h(A,j,{vocab:!0},L),U=y(A,j,"@context");K=K||(A.previousContext?A:null);let Q=Object.keys(Y).sort(),z=!C;if(z&&K&&Q.length<=2&&!Q.includes("@context"))for(const W of Q){const F=h(K,W,{vocab:!0},L);if(F==="@value"){z=!1,A=K;break}if(F==="@id"&&Q.length===1){z=!1;break}}z&&(A=A.revertToPreviousContext()),s(U)||(A=await g({activeCtx:A,localCtx:U,propagate:!0,overrideProtected:!0,options:L})),"@context"in Y&&(A=await g({activeCtx:A,localCtx:Y["@context"],options:L})),K=A;let ae=null;for(const W of Q)if(h(A,W,{vocab:!0},L)==="@type"){ae=ae||W;const Z=Y[W],te=Array.isArray(Z)?Z.length>1?Z.slice().sort():Z:[Z];for(const ce of te){const fe=y(K,ce,"@context");s(fe)||(A=await g({activeCtx:A,localCtx:fe,options:L,propagate:!1}))}}let H={};await q({activeCtx:A,activeProperty:j,expandedActiveProperty:v,element:Y,expandedParent:H,options:L,insideList:ee,typeKey:ae,typeScopedContext:K}),Q=Object.keys(H);let V=Q.length;if("@value"in H){if("@type"in H&&("@language"in H||"@direction"in H))throw new n('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:H});let W=V-1;if("@type"in H&&(W-=1),"@index"in H&&(W-=1),"@language"in H&&(W-=1),"@direction"in H&&(W-=1),W!==0)throw new n('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:H});const F=H["@value"]===null?[]:b(H["@value"]),Z=c(H,"@type");if(!(m(A,1.1)&&Z.includes("@json")&&Z.length===1))if(F.length===0)L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:H}},options:L}),H=null;else{if(!F.every(te=>i(te)||r(te))&&"@language"in H)throw new n("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:H});if(!Z.every(te=>_(te)&&!(i(te)&&te.indexOf("_:")===0)||r(te)))throw new n('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:H})}}else if("@type"in H&&!e(H["@type"]))H["@type"]=[H["@type"]];else if("@set"in H||"@list"in H){if(V>1&&!(V===2&&"@index"in H))throw new n('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:H});"@set"in H&&(H=H["@set"],Q=Object.keys(H),V=Q.length)}else V===1&&"@language"in H&&(L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:H}},options:L}),H=null);return t(H)&&!L.keepFreeFloatingNodes&&!ee&&(j===null||v==="@graph"||(y(A,j,"@container")||[]).includes("@graph"))&&(H=T({value:H,count:V,options:L})),H};function T({value:A,count:j,options:Y}){if(j===0||"@value"in A||"@list"in A||j===1&&"@id"in A){if(Y.eventHandler){let L,ee;j===0?(L="empty object",ee="Dropping empty object."):"@value"in A?(L="object with only @value",ee="Dropping object with only @value."):"@list"in A?(L="object with only @list",ee="Dropping object with only @list."):j===1&&"@id"in A&&(L="object with only @id",ee="Dropping object with only @id."),N({event:{type:["JsonLdEvent"],code:L,level:"warning",message:ee,details:{value:A}},options:Y})}return null}return A}async function q({activeCtx:A,activeProperty:j,expandedActiveProperty:Y,element:L,expandedParent:ee,options:C={},insideList:K,typeKey:v,typeScopedContext:U}){const Q=Object.keys(L).sort(),z=[];let ae;const H=L[v]&&h(A,e(L[v])?L[v][0]:L[v],{vocab:!0},{...C,typeExpansion:!0})==="@json";for(const V of Q){let W=L[V],F;if(V==="@context")continue;const Z=h(A,V,{vocab:!0},C);if(Z===null||!(_(Z)||w(Z))){C.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:V,expandedProperty:Z}},options:C});continue}if(w(Z)){if(Y==="@reverse")throw new n("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:W});if(Z in ee&&Z!=="@included"&&Z!=="@type")throw new n("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:Z})}if(Z==="@id"){if(!i(W)){if(!C.isFrame)throw new n('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:W});if(t(W)){if(!r(W))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:W})}else if(e(W)){if(!W.every(O=>i(O)))throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:W})}else throw new n('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:W})}I(ee,"@id",b(W).map(O=>{if(i(O)){const G=h(A,O,{base:!0},C);return C.eventHandler&&(G===null?N(O===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:O}},options:C}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:O}},options:C}):_(G)||N({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:O,expandedId:G}},options:C})),G}return O}),{propertyIsArray:C.isFrame});continue}if(Z==="@type"){t(W)&&(W=Object.fromEntries(Object.entries(W).map(([O,G])=>[h(U,O,{vocab:!0}),b(G).map(re=>h(U,re,{base:!0,vocab:!0},{...C,typeExpansion:!0}))]))),p(W,C.isFrame),I(ee,"@type",b(W).map(O=>{if(i(O)){const G=h(U,O,{base:!0,vocab:!0},{...C,typeExpansion:!0});return G!=="@json"&&!_(G)&&C.eventHandler&&N({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:O}},options:C}),G}return O}),{propertyIsArray:!!C.isFrame});continue}if(Z==="@included"&&m(A,1.1)){const O=b(await D.expand({activeCtx:A,activeProperty:j,element:W,options:C}));if(!O.every(G=>d(G)))throw new n("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:W});I(ee,"@included",O,{propertyIsArray:!0});continue}if(Z==="@graph"&&!(t(W)||e(W)))throw new n('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:W});if(Z==="@value"){ae=W,H&&m(A,1.1)?ee["@value"]=W:I(ee,"@value",W,{propertyIsArray:C.isFrame});continue}if(Z==="@language"){if(W===null)continue;if(!i(W)&&!C.isFrame)throw new n('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:W});W=b(W).map(O=>i(O)?O.toLowerCase():O);for(const O of W)i(O)&&!O.match(x)&&C.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:O}},options:C});I(ee,"@language",W,{propertyIsArray:C.isFrame});continue}if(Z==="@direction"){if(!i(W)&&!C.isFrame)throw new n('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:W});W=b(W);for(const O of W)if(i(O)&&O!=="ltr"&&O!=="rtl")throw new n('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:W});I(ee,"@direction",W,{propertyIsArray:C.isFrame});continue}if(Z==="@index"){if(!i(W))throw new n('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:W});I(ee,"@index",W);continue}if(Z==="@reverse"){if(!t(W))throw new n('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:W});if(F=await D.expand({activeCtx:A,activeProperty:"@reverse",element:W,options:C}),"@reverse"in F)for(const G in F["@reverse"])I(ee,G,F["@reverse"][G],{propertyIsArray:!0});let O=ee["@reverse"]||null;for(const G in F){if(G==="@reverse")continue;O===null&&(O=ee["@reverse"]={}),I(O,G,[],{propertyIsArray:!0});const re=F[G];for(let ue=0;ue<re.length;++ue){const de=re[ue];if(o(de)||a(de))throw new n('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:F});I(O,G,de,{propertyIsArray:!0})}}continue}if(Z==="@nest"){z.push(V);continue}let te=A;const ce=y(A,V,"@context");s(ce)||(te=await g({activeCtx:A,localCtx:ce,propagate:!0,overrideProtected:!0,options:C}));const fe=y(A,V,"@container")||[];if(fe.includes("@language")&&t(W)){const O=y(te,V,"@direction");F=M(te,W,O,C)}else if(fe.includes("@index")&&t(W)){const O=fe.includes("@graph"),G=y(te,V,"@index")||"@index",re=G!=="@index"&&h(A,G,{vocab:!0},C);F=await B({activeCtx:te,options:C,activeProperty:V,value:W,asGraph:O,indexKey:G,propertyIndex:re})}else if(fe.includes("@id")&&t(W)){const O=fe.includes("@graph");F=await B({activeCtx:te,options:C,activeProperty:V,value:W,asGraph:O,indexKey:"@id"})}else if(fe.includes("@type")&&t(W))F=await B({activeCtx:te.revertToPreviousContext(),options:C,activeProperty:V,value:W,asGraph:!1,indexKey:"@type"});else{const O=Z==="@list";if(O||Z==="@set"){let G=j;O&&Y==="@graph"&&(G=null),F=await D.expand({activeCtx:te,activeProperty:G,element:W,options:C,insideList:O})}else y(A,V,"@type")==="@json"?F={"@type":"@json","@value":W}:F=await D.expand({activeCtx:te,activeProperty:V,element:W,options:C,insideList:!1})}if(!(F===null&&Z!=="@value")){if(Z!=="@list"&&!a(F)&&fe.includes("@list")&&(F={"@list":b(F)}),fe.includes("@graph")&&!fe.some(O=>O==="@id"||O==="@index")){if(F=b(F),C.isFrame||(F=F.filter(O=>{const G=Object.keys(O).length;return T({value:O,count:G,options:C})!==null})),F.length===0)continue;F=F.map(O=>({"@graph":b(O)}))}if(te.mappings.has(V)&&te.mappings.get(V).reverse){const O=ee["@reverse"]=ee["@reverse"]||{};F=b(F);for(let G=0;G<F.length;++G){const re=F[G];if(o(re)||a(re))throw new n('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:F});I(O,Z,re,{propertyIsArray:!0})}continue}I(ee,Z,F,{propertyIsArray:!0})}}if("@value"in ee&&!(ee["@type"]==="@json"&&m(A,1.1))){if((t(ae)||e(ae))&&!C.isFrame)throw new n('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:ae})}for(const V of z){const W=e(L[V])?L[V]:[L[V]];for(const F of W){if(!t(F)||Object.keys(F).some(Z=>h(A,Z,{vocab:!0},C)==="@value"))throw new n("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:F});await q({activeCtx:A,activeProperty:j,expandedActiveProperty:Y,element:F,expandedParent:ee,options:C,insideList:K,typeScopedContext:U,typeKey:v})}}}function R({activeCtx:A,activeProperty:j,value:Y,options:L}){if(Y==null)return null;const ee=h(A,j,{vocab:!0},L);if(ee==="@id")return h(A,Y,{base:!0},L);if(ee==="@type")return h(A,Y,{vocab:!0,base:!0},{...L,typeExpansion:!0});const C=y(A,j,"@type");if((C==="@id"||ee==="@graph")&&i(Y)){const v=h(A,Y,{base:!0},L);return v===null&&Y.match(S)&&L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:L}),{"@id":v}}if(C==="@vocab"&&i(Y))return{"@id":h(A,Y,{vocab:!0,base:!0},L)};if(w(ee))return Y;const K={};if(C&&!["@id","@vocab","@none"].includes(C))K["@type"]=C;else if(i(Y)){const v=y(A,j,"@language");v!==null&&(K["@language"]=v);const U=y(A,j,"@direction");U!==null&&(K["@direction"]=U)}return["boolean","number","string"].includes(typeof Y)||(Y=Y.toString()),K["@value"]=Y,K}function M(A,j,Y,L){const ee=[],C=Object.keys(j).sort();for(const K of C){const v=h(A,K,{vocab:!0},L);let U=j[K];e(U)||(U=[U]);for(const Q of U){if(Q===null)continue;if(!i(Q))throw new n("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:j});const z={"@value":Q};v!=="@none"&&(K.match(x)||L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:K}},options:L}),z["@language"]=K.toLowerCase()),Y&&(z["@direction"]=Y),ee.push(z)}}return ee}async function B({activeCtx:A,options:j,activeProperty:Y,value:L,asGraph:ee,indexKey:C,propertyIndex:K}){const v=[],U=Object.keys(L).sort(),Q=C==="@type";for(let z of U){if(Q){const V=y(A,z,"@context");s(V)||(A=await g({activeCtx:A,localCtx:V,propagate:!1,options:j}))}let ae=L[z];e(ae)||(ae=[ae]),ae=await D.expand({activeCtx:A,activeProperty:Y,element:ae,options:j,insideList:!1,insideIndex:!0});let H;K?z==="@none"?H="@none":H=R({activeCtx:A,activeProperty:C,value:z,options:j}):H=h(A,z,{vocab:!0},j),C==="@id"?z=h(A,z,{base:!0},j):Q&&(z=H);for(let V of ae){if(ee&&!l(V)&&(V={"@graph":[V]}),C==="@type")H==="@none"||(V["@type"]?V["@type"]=[z].concat(V["@type"]):V["@type"]=[z]);else{if(o(V)&&!["@language","@type","@index"].includes(C))throw new n(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${C}".`,"jsonld.SyntaxError",{code:"invalid value object",value:V});K?H!=="@none"&&I(V,K,H,{propertyIsArray:!0,prependValue:!0}):H!=="@none"&&!(C in V)&&(V[C]=z)}v.push(V)}}return v}return Qi}var Xi,cl;function Mn(){if(cl)return Xi;cl=1;const{isKeyword:n}=Ut(),e=_t(),t=Ke(),r=et(),i=rt(),s={};return Xi=s,s.createMergedNodeMap=(a,o)=>{o=o||{};const l=o.issuer||new r.IdentifierIssuer("_:b"),d={"@default":{}};return s.createNodeMap(a,d,"@default",l),s.mergeNodeMaps(d)},s.createNodeMap=(a,o,l,d,h,y)=>{if(t.isArray(a)){for(const _ of a)s.createNodeMap(_,o,l,d,void 0,y);return}if(!t.isObject(a)){y&&y.push(a);return}if(e.isValue(a)){if("@type"in a){let _=a["@type"];_.indexOf("_:")===0&&(a["@type"]=_=d.getId(_))}y&&y.push(a);return}else if(y&&e.isList(a)){const _=[];s.createNodeMap(a["@list"],o,l,d,h,_),y.push({"@list":_});return}if("@type"in a){const _=a["@type"];for(const x of _)x.indexOf("_:")===0&&d.getId(x)}t.isUndefined(h)&&(h=e.isBlankNode(a)?d.getId(a["@id"]):a["@id"]),y&&y.push({"@id":h});const w=o[l],g=w[h]=w[h]||{};g["@id"]=h;const m=Object.keys(a).sort();for(let _ of m){if(_==="@id")continue;if(_==="@reverse"){const S={"@id":h},I=a["@reverse"];for(const b in I){const c=I[b];for(const p of c){let N=p["@id"];e.isBlankNode(p)&&(N=d.getId(N)),s.createNodeMap(p,o,l,d,N),r.addValue(w[N],b,S,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(_==="@graph"){h in o||(o[h]={}),s.createNodeMap(a[_],o,h,d);continue}if(_==="@included"){s.createNodeMap(a[_],o,l,d);continue}if(_!=="@type"&&n(_)){if(_==="@index"&&_ in g&&(a[_]!==g[_]||a[_]["@id"]!==g[_]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:g});g[_]=a[_];continue}const x=a[_];if(_.indexOf("_:")===0&&(_=d.getId(_)),x.length===0){r.addValue(g,_,[],{propertyIsArray:!0});continue}for(let S of x)if(_==="@type"&&(S=S.indexOf("_:")===0?d.getId(S):S),e.isSubject(S)||e.isSubjectReference(S)){if("@id"in S&&!S["@id"])continue;const I=e.isBlankNode(S)?d.getId(S["@id"]):S["@id"];r.addValue(g,_,{"@id":I},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(S,o,l,d,I)}else if(e.isValue(S))r.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(S)){const I=[];s.createNodeMap(S["@list"],o,l,d,h,I),S={"@list":I},r.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(S,o,l,d,h),r.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=a=>{const o={};for(const l of Object.keys(a).sort())for(const d of Object.keys(a[l]).sort()){const h=a[l][d];d in o||(o[d]={"@id":d});const y=o[d];for(const w of Object.keys(h).sort())if(n(w)&&w!=="@type")y[w]=r.clone(h[w]);else for(const g of h[w])r.addValue(y,w,r.clone(g),{propertyIsArray:!0,allowDuplicate:!1})}return o},s.mergeNodeMaps=a=>{const o=a["@default"],l=Object.keys(a).sort();for(const d of l){if(d==="@default")continue;const h=a[d];let y=o[d];y?"@graph"in y||(y["@graph"]=[]):o[d]=y={"@id":d,"@graph":[]};const w=y["@graph"];for(const g of Object.keys(h).sort()){const m=h[g];e.isSubjectReference(m)||w.push(m)}}return o},Xi}var Ki,dl;function Ff(){if(dl)return Ki;dl=1;const{isSubjectReference:n}=_t(),{createMergedNodeMap:e}=Mn(),t={};return Ki=t,t.flatten=r=>{const i=e(r),s=[],a=Object.keys(i).sort();for(let o=0;o<a.length;++o){const l=i[a[o]];n(l)||s.push(l)}return s},Ki}var Yi,fl;function Uf(){if(fl)return Yi;fl=1;const n=rt(),e=_t(),t=Ke(),{REGEX_BCP47:r,addValue:i}=et(),{handleEvent:s}=Kr(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:l,RDF_NIL:d,RDF_TYPE:h,RDF_JSON_LITERAL:y,XSD_BOOLEAN:w,XSD_DOUBLE:g,XSD_INTEGER:m,XSD_STRING:_}=ua(),x={};Yi=x,x.fromRDF=async(I,b)=>{const{useRdfType:c=!1,useNativeTypes:p=!1,rdfDirection:N=null}=b,D={},T={"@default":D},q={};if(N){if(N==="compound-literal")throw new n("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:N});if(N!=="i18n-datatype")throw new n("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:N})}for(const B of I){const A=B.graph.termType==="DefaultGraph"?"@default":B.graph.value;A in T||(T[A]={}),A!=="@default"&&!(A in D)&&(D[A]={"@id":A});const j=T[A],Y=B.subject.value,L=B.predicate.value,ee=B.object;Y in j||(j[Y]={"@id":Y});const C=j[Y],K=ee.termType.endsWith("Node");if(K&&!(ee.value in j)&&(j[ee.value]={"@id":ee.value}),L===h&&!c&&K){i(C,"@type",ee.value,{propertyIsArray:!0});continue}const v=S(ee,p,N,b);if(i(C,L,v,{propertyIsArray:!0}),K)if(ee.value===d){const U=j[ee.value];"usages"in U||(U.usages=[]),U.usages.push({node:C,property:L,value:v})}else ee.value in q?q[ee.value]=!1:q[ee.value]={node:C,property:L,value:v}}for(const B in T){const A=T[B];if(!(d in A))continue;const j=A[d];if(j.usages){for(let Y of j.usages){let L=Y.node,ee=Y.property,C=Y.value;const K=[],v=[];let U=Object.keys(L).length;for(;ee===l&&t.isObject(q[L["@id"]])&&t.isArray(L[o])&&L[o].length===1&&t.isArray(L[l])&&L[l].length===1&&(U===3||U===4&&t.isArray(L["@type"])&&L["@type"].length===1&&L["@type"][0]===a)&&(K.push(L[o][0]),v.push(L["@id"]),Y=q[L["@id"]],L=Y.node,ee=Y.property,C=Y.value,U=Object.keys(L).length,!!e.isBlankNode(L)););delete C["@id"],C["@list"]=K.reverse();for(const Q of v)delete A[Q]}delete j.usages}}const R=[],M=Object.keys(D).sort();for(const B of M){const A=D[B];if(B in T){const j=A["@graph"]=[],Y=T[B],L=Object.keys(Y).sort();for(const ee of L){const C=Y[ee];e.isSubjectReference(C)||j.push(C)}}e.isSubjectReference(A)||R.push(A)}return R};function S(I,b,c,p){if(I.termType.endsWith("Node"))return{"@id":I.value};const N={"@value":I.value};if(I.language)I.language.match(r)||p.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:I.language}},options:p}),N["@language"]=I.language;else{let D=I.datatype.value;if(D||(D=_),D===y){D="@json";try{N["@value"]=JSON.parse(N["@value"])}catch(T){throw new n("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:N["@value"],cause:T})}}if(b){if(D===w)N["@value"]==="true"?N["@value"]=!0:N["@value"]==="false"&&(N["@value"]=!1);else if(t.isNumeric(N["@value"]))if(D===m){const T=parseInt(N["@value"],10);T.toFixed(0)===N["@value"]&&(N["@value"]=T)}else D===g&&(N["@value"]=parseFloat(N["@value"]));[w,m,g,_].includes(D)||(N["@type"]=D)}else if(c==="i18n-datatype"&&D.startsWith("https://www.w3.org/ns/i18n#")){const[,T,q]=D.split(/[#_]/);T.length>0&&(N["@language"]=T,T.match(r)||p.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:T}},options:p})),N["@direction"]=q}else D!==_&&(N["@type"]=D)}return N}return Yi}var Zi,hl;function Hf(){return hl||(hl=1,Zi=function n(e){return e===null||typeof e!="object"||e.toJSON!=null?JSON.stringify(e):Array.isArray(e)?"["+e.reduce((t,r,i)=>{const s=i===0?"":",",a=r===void 0||typeof r=="symbol"?null:r;return t+s+n(a)},"")+"]":"{"+Object.keys(e).sort().reduce((t,r,i)=>{if(e[r]===void 0||typeof e[r]=="symbol")return t;const s=t.length===0?"":",";return t+s+n(r)+":"+n(e[r])},"")+"}"}),Zi}var es,pl;function Vf(){if(pl)return es;pl=1;const{createNodeMap:n}=Mn(),{isKeyword:e}=Ut(),t=_t(),r=Hf(),i=rt(),s=Ke(),a=et(),{handleEvent:o}=Kr(),{RDF_FIRST:l,RDF_REST:d,RDF_NIL:h,RDF_TYPE:y,RDF_JSON_LITERAL:w,RDF_LANGSTRING:g,XSD_BOOLEAN:m,XSD_DOUBLE:_,XSD_INTEGER:x,XSD_STRING:S}=ua(),{isAbsolute:I}=At(),b={};es=b,b.toRDF=(D,T)=>{const q=new a.IdentifierIssuer("_:b"),R={"@default":{}};n(D,R,"@default",q);const M=[],B=Object.keys(R).sort();for(const A of B){let j;if(A==="@default")j={termType:"DefaultGraph",value:""};else if(I(A))A.startsWith("_:")?j={termType:"BlankNode"}:j={termType:"NamedNode"},j.value=A;else{T.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:A}},options:T});continue}c(M,R[A],j,q,T)}return M};function c(D,T,q,R,M){const B=Object.keys(T).sort();for(const A of B){const j=T[A],Y=Object.keys(j).sort();for(let L of Y){const ee=j[L];if(L==="@type")L=y;else if(e(L))continue;for(const C of ee){const K={termType:A.startsWith("_:")?"BlankNode":"NamedNode",value:A};if(!I(A)){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:A}},options:M});continue}const v={termType:L.startsWith("_:")?"BlankNode":"NamedNode",value:L};if(!I(L)){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:L}},options:M});continue}if(v.termType==="BlankNode"&&!M.produceGeneralizedRdf){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:R.getOldIds().find(Q=>R.getId(Q)===L)}},options:M});continue}const U=N(C,R,D,q,M.rdfDirection,M);U&&D.push({subject:K,predicate:v,object:U,graph:q})}}}}function p(D,T,q,R,M,B){const A={termType:"NamedNode",value:l},j={termType:"NamedNode",value:d},Y={termType:"NamedNode",value:h},L=D.pop(),ee=L?{termType:"BlankNode",value:T.getId()}:Y;let C=ee;for(const K of D){const v=N(K,T,q,R,M,B),U={termType:"BlankNode",value:T.getId()};q.push({subject:C,predicate:A,object:v,graph:R}),q.push({subject:C,predicate:j,object:U,graph:R}),C=U}if(L){const K=N(L,T,q,R,M,B);q.push({subject:C,predicate:A,object:K,graph:R}),q.push({subject:C,predicate:j,object:Y,graph:R})}return ee}function N(D,T,q,R,M,B){const A={};if(t.isValue(D)){A.termType="Literal",A.value=void 0,A.datatype={termType:"NamedNode"};let j=D["@value"];const Y=D["@type"]||null;if(Y==="@json")A.value=r(j),A.datatype.value=w;else if(s.isBoolean(j))A.value=j.toString(),A.datatype.value=Y||m;else if(s.isDouble(j)||Y===_)s.isDouble(j)||(j=parseFloat(j)),A.value=j.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),A.datatype.value=Y||_;else if(s.isNumber(j))A.value=j.toFixed(0),A.datatype.value=Y||x;else if("@direction"in D&&M==="i18n-datatype"){const L=(D["@language"]||"").toLowerCase(),ee=D["@direction"],C=`https://www.w3.org/ns/i18n#${L}_${ee}`;A.datatype.value=C,A.value=j}else{if("@direction"in D&&M==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:M});if("@direction"in D&&M)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:M});"@language"in D?("@direction"in D&&!M&&B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:B}),A.value=j,A.datatype.value=Y||g,A.language=D["@language"]):("@direction"in D&&!M&&B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:B}),A.value=j,A.datatype.value=Y||S)}}else if(t.isList(D)){const j=p(D["@list"],T,q,R,M,B);A.termType=j.termType,A.value=j.value}else{const j=s.isObject(D)?D["@id"]:D;A.termType=j.startsWith("_:")?"BlankNode":"NamedNode",A.value=j}return A.termType==="NamedNode"&&!I(A.value)?(B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:A.value}},options:B}),null):A}return es}var ts,gl;function Gf(){if(gl)return ts;gl=1;const{isKeyword:n}=Ut(),e=_t(),t=Ke(),r=et(),i=At(),s=rt(),{createNodeMap:a,mergeNodeMapGraphs:o}=Mn(),l={};ts=l,l.frameMergedOrDefault=(c,p,N)=>{const D={options:N,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},T=new r.IdentifierIssuer("_:b");a(c,D.graphMap,"@default",T),N.merged&&(D.graphMap["@merged"]=o(D.graphMap),D.graph="@merged"),D.subjects=D.graphMap[D.graph];const q=[];l.frame(D,Object.keys(D.subjects).sort(),p,q),N.pruneBlankNodeIdentifiers&&(N.bnodesToClear=Object.keys(D.bnodeMap).filter(R=>D.bnodeMap[R].length===1));// remove @preserve from results
300
- return N.link={},x(q,N)},l.frame=(c,p,N,D,T=null)=>{w(N),N=N[0];const q=c.options,R={embed:y(N,q,"embed"),explicit:y(N,q,"explicit"),requireAll:y(N,q,"requireAll")};c.link.hasOwnProperty(c.graph)||(c.link[c.graph]={});const M=c.link[c.graph],B=g(c,p,N,R),A=Object.keys(B).sort();for(const j of A){const Y=B[j];if(T===null?c.uniqueEmbeds={[c.graph]:{}}:c.uniqueEmbeds[c.graph]=c.uniqueEmbeds[c.graph]||{},R.embed==="@link"&&j in M){S(D,T,M[j]);continue}const L={"@id":j};if(j.indexOf("_:")===0&&r.addValue(c.bnodeMap,j,L,{propertyIsArray:!0}),M[j]=L,(R.embed==="@first"||R.embed==="@last")&&c.is11)throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:N});if(!(!c.embedded&&c.uniqueEmbeds[c.graph].hasOwnProperty(j))){if(c.embedded&&(R.embed==="@never"||h(Y,c.graph,c.subjectStack))){S(D,T,L);continue}if(c.embedded&&(R.embed=="@first"||R.embed=="@once")&&c.uniqueEmbeds[c.graph].hasOwnProperty(j)){S(D,T,L);continue}if(R.embed==="@last"&&j in c.uniqueEmbeds[c.graph]&&_(c,j),c.uniqueEmbeds[c.graph][j]={parent:D,property:T},c.subjectStack.push({subject:Y,graph:c.graph}),j in c.graphMap){let ee=!1,C=null;"@graph"in N?(C=N["@graph"][0],ee=!(j==="@merged"||j==="@default"),t.isObject(C)||(C={})):(ee=c.graph!=="@merged",C={}),ee&&l.frame({...c,graph:j,embedded:!1},Object.keys(c.graphMap[j]).sort(),[C],L,"@graph")}"@included"in N&&l.frame({...c,embedded:!1},p,N["@included"],L,"@included");for(const ee of Object.keys(Y).sort()){if(n(ee)){if(L[ee]=r.clone(Y[ee]),ee==="@type")for(const C of Y["@type"])C.indexOf("_:")===0&&r.addValue(c.bnodeMap,C,L,{propertyIsArray:!0});continue}if(!(R.explicit&&!(ee in N)))for(const C of Y[ee]){const K=ee in N?N[ee]:d(R);if(e.isList(C)){const v=N[ee]&&N[ee][0]&&N[ee][0]["@list"]?N[ee][0]["@list"]:d(R),U={"@list":[]};S(L,ee,U);const Q=C["@list"];for(const z of Q)e.isSubjectReference(z)?l.frame({...c,embedded:!0},[z["@id"]],v,U,"@list"):S(U,"@list",r.clone(z))}else e.isSubjectReference(C)?l.frame({...c,embedded:!0},[C["@id"]],K,L,ee):b(K[0],C)&&S(L,ee,r.clone(C))}}for(const ee of Object.keys(N).sort()){if(ee==="@type"){if(!t.isObject(N[ee][0])||!("@default"in N[ee][0]))continue}else if(n(ee))continue;const C=N[ee][0]||{};if(!y(C,q,"omitDefault")&&!(ee in L)){let v="@null";"@default"in C&&(v=r.clone(C["@default"])),t.isArray(v)||(v=[v]),L[ee]=[{"@preserve":v}]}}for(const ee of Object.keys(N["@reverse"]||{}).sort()){const C=N["@reverse"][ee];for(const K of Object.keys(c.subjects))r.getValues(c.subjects[K],ee).some(U=>U["@id"]===j)&&(L["@reverse"]=L["@reverse"]||{},r.addValue(L["@reverse"],ee,[],{propertyIsArray:!0}),l.frame({...c,embedded:!0},[K],C,L["@reverse"][ee],T))}S(D,T,L),c.subjectStack.pop()}}},l.cleanupNull=(c,p)=>{if(t.isArray(c))return c.map(D=>l.cleanupNull(D,p)).filter(D=>D);if(c==="@null")return null;if(t.isObject(c)){if("@id"in c){const N=c["@id"];if(p.link.hasOwnProperty(N)){const D=p.link[N].indexOf(c);if(D!==-1)return p.link[N][D];p.link[N].push(c)}else p.link[N]=[c]}for(const N in c)c[N]=l.cleanupNull(c[N],p)}return c};function d(c){const p={};for(const N in c)c[N]!==void 0&&(p["@"+N]=[c[N]]);return[p]}function h(c,p,N){for(let D=N.length-1;D>=0;--D){const T=N[D];if(T.graph===p&&T.subject["@id"]===c["@id"])return!0}return!1}function y(c,p,N){const D="@"+N;let T=D in c?c[D][0]:p[N];if(N==="embed"){if(T===!0)T="@once";else if(T===!1)T="@never";else if(T!=="@always"&&T!=="@never"&&T!=="@link"&&T!=="@first"&&T!=="@last"&&T!=="@once")throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:c})}return T}function w(c){if(!t.isArray(c)||c.length!==1||!t.isObject(c[0]))throw new s("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:c});if("@id"in c[0]){for(const p of r.asArray(c[0]["@id"]))if(!(t.isObject(p)||i.isAbsolute(p))||t.isString(p)&&p.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:c})}if("@type"in c[0]){for(const p of r.asArray(c[0]["@type"]))if(!(t.isObject(p)||i.isAbsolute(p)||p==="@json")||t.isString(p)&&p.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:c})}}function g(c,p,N,D){const T={};for(const q of p){const R=c.graphMap[c.graph][q];m(c,R,N,D)&&(T[q]=R)}return T}function m(c,p,N,D){let T=!0,q=!1;for(const R in N){let M=!1;const B=r.getValues(p,R),A=r.getValues(N,R).length===0;if(R==="@id"){if(t.isEmptyObject(N["@id"][0]||{})?M=!0:N["@id"].length>=0&&(M=N["@id"].includes(B[0])),!D.requireAll)return M}else if(R==="@type"){if(T=!1,A){if(B.length>0)return!1;M=!0}else if(N["@type"].length===1&&t.isEmptyObject(N["@type"][0]))M=B.length>0;else for(const j of N["@type"])t.isObject(j)&&"@default"in j?M=!0:M=M||B.some(Y=>Y===j);if(!D.requireAll)return M}else{if(n(R))continue;{const j=r.getValues(N,R)[0];let Y=!1;if(j&&(w([j]),Y="@default"in j),T=!1,B.length===0&&Y)continue;if(B.length>0&&A)return!1;if(j===void 0){if(B.length>0)return!1;M=!0}else if(e.isList(j)){const L=j["@list"][0];if(e.isList(B[0])){const ee=B[0]["@list"];e.isValue(L)?M=ee.some(C=>b(L,C)):(e.isSubject(L)||e.isSubjectReference(L))&&(M=ee.some(C=>I(c,L,C,D)))}}else e.isValue(j)?M=B.some(L=>b(j,L)):e.isSubjectReference(j)?M=B.some(L=>I(c,j,L,D)):t.isObject(j)?M=B.length>0:M=!1}}if(!M&&D.requireAll)return!1;q=q||M}return T||q}function _(c,p){const N=c.uniqueEmbeds[c.graph],D=N[p],T=D.parent,q=D.property,R={"@id":p};if(t.isArray(T)){for(let B=0;B<T.length;++B)if(r.compareValues(T[B],R)){T[B]=R;break}}else{const B=t.isArray(T[q]);r.removeValue(T,q,R,{propertyIsArray:B}),r.addValue(T,q,R,{propertyIsArray:B})}const M=B=>{const A=Object.keys(N);for(const j of A)j in N&&t.isObject(N[j].parent)&&N[j].parent["@id"]===B&&(delete N[j],M(j))};M(p)}/**
297
+ */var Li,Uo;function Nf(){if(Uo)return Li;Uo=1;const r=Dn(),e=Yu();return Li=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 l,d;if(o.subject.termType==="BlankNode"&&o.subject.value!==n)d=o.subject.value,l="p";else if(o.object.termType==="BlankNode"&&o.object.value!==n)d=o.object.value,l="r";else continue;const h=this.hashRelatedBlankNode(d,o,i,l),y=s.get(h);y?y.push(d):s.set(h,[d])}return s}},Li}const Tf={},Af=Object.freeze(Object.defineProperty({__proto__:null,default:Tf},Symbol.toStringTag,{value:"Module"})),Lf=xc(Af);var Ho;function jf(){return Ho||(Ho=1,function(r){const e=Ku(),t=Rf(),n=Yu(),i=Nf();let s;try{s=Lf}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=aa(),r.IdentifierIssuer=sa(),r._rdfCanonizeNative=function(o){return o&&(s=o),s},r.canonize=async function(o,l){const d=a(o);if(l.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((h,y)=>s.canonize(d,l,(w,g)=>w?y(w):h(g)))}if(l.algorithm==="URDNA2015")return new e(l).main(d);if(l.algorithm==="URGNA2012"){if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(l).main(d)}throw"algorithm"in l?new Error("Invalid RDF Dataset Canonicalization algorithm: "+l.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},r._canonizeSync=function(o,l){const d=a(o);if(l.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(d,l)}if(l.algorithm==="URDNA2015")return new n(l).main(d);if(l.algorithm==="URGNA2012"){if(l.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(l).main(d)}throw"algorithm"in l?new Error("Invalid RDF Dataset Canonicalization algorithm: "+l.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}}(_i)),_i}var ji,Vo;function oa(){return Vo||(Vo=1,ji=jf()),ji}var Oi,Go;function Ke(){if(Go)return Oi;Go=1;const r={};return Oi=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",Oi}var $i,Wo;function _t(){if(Wo)return $i;Wo=1;const r=Ke(),e={};return $i=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},$i}var ki,zo;function rt(){return zo||(zo=1,ki=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}}),ki}var Di,Jo;function et(){if(Jo)return Di;Jo=1;const r=_t(),e=Ke(),t=oa().IdentifierIssuer,n=rt(),i=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,o=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,l=/^@[a-zA-Z]+$/,d={headers:{accept:"application/ld+json, application/json"}},h={};Di=h,h.IdentifierIssuer=t,h.REGEX_BCP47=i,h.REGEX_KEYWORD=l,h.clone=function(w){if(w&&typeof w=="object"){let g;if(e.isArray(w)){g=[];for(let m=0;m<w.length;++m)g[m]=h.clone(w[m])}else if(w instanceof Map){g=new Map;for(const[m,_]of w)g.set(m,h.clone(_))}else if(w instanceof Set){g=new Set;for(const m of w)g.add(h.clone(m))}else if(e.isObject(w)){g={};for(const m in w)g[m]=h.clone(w[m])}else g=w.toString();return g}return w},h.asArray=function(w){return Array.isArray(w)?w:[w]},h.buildHeaders=(w={})=>{if(Object.keys(w).some(m=>m.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+d.headers.accept+'" is supported.');return Object.assign({Accept:d.headers.accept},w)},h.parseLinkHeader=w=>{const g={},m=w.match(s);for(let _=0;_<m.length;++_){let x=m[_].match(a);if(!x)continue;const S={target:x[1]},I=x[2];for(;x=o.exec(I);)S[x[1]]=x[2]===void 0?x[3]:x[2];const b=S.rel||"";Array.isArray(g[b])?g[b].push(S):g.hasOwnProperty(b)?g[b]=[g[b],S]:g[b]=S}return g},h.validateTypeValue=(w,g)=>{if(!e.isString(w)&&!(e.isArray(w)&&w.every(m=>e.isString(m)))){if(g&&e.isObject(w))switch(Object.keys(w).length){case 0:return;case 1:if("@default"in w&&h.asArray(w["@default"]).every(m=>e.isString(m)))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:w})}},h.hasProperty=(w,g)=>{if(w.hasOwnProperty(g)){const m=w[g];return!e.isArray(m)||m.length>0}return!1},h.hasValue=(w,g,m)=>{if(h.hasProperty(w,g)){let _=w[g];const x=r.isList(_);if(e.isArray(_)||x){x&&(_=_["@list"]);for(let S=0;S<_.length;++S)if(h.compareValues(m,_[S]))return!0}else if(!e.isArray(m))return h.compareValues(m,_)}return!1},h.addValue=(w,g,m,_)=>{if(_=_||{},"propertyIsArray"in _||(_.propertyIsArray=!1),"valueIsArray"in _||(_.valueIsArray=!1),"allowDuplicate"in _||(_.allowDuplicate=!0),"prependValue"in _||(_.prependValue=!1),_.valueIsArray)w[g]=m;else if(e.isArray(m)){m.length===0&&_.propertyIsArray&&!w.hasOwnProperty(g)&&(w[g]=[]),_.prependValue&&(m=m.concat(w[g]),w[g]=[]);for(let x=0;x<m.length;++x)h.addValue(w,g,m[x],_)}else if(w.hasOwnProperty(g)){const x=!_.allowDuplicate&&h.hasValue(w,g,m);!e.isArray(w[g])&&(!x||_.propertyIsArray)&&(w[g]=[w[g]]),x||(_.prependValue?w[g].unshift(m):w[g].push(m))}else w[g]=_.propertyIsArray?[m]:m},h.getValues=(w,g)=>[].concat(w[g]||[]),h.removeProperty=(w,g)=>{delete w[g]},h.removeValue=(w,g,m,_)=>{_=_||{},"propertyIsArray"in _||(_.propertyIsArray=!1);const x=h.getValues(w,g).filter(S=>!h.compareValues(S,m));x.length===0?h.removeProperty(w,g):x.length===1&&!_.propertyIsArray?w[g]=x[0]:w[g]=x},h.relabelBlankNodes=(w,g)=>{g=g||{};const m=g.issuer||new t("_:b");return y(m,w)},h.compareValues=(w,g)=>w===g||r.isValue(w)&&r.isValue(g)&&w["@value"]===g["@value"]&&w["@type"]===g["@type"]&&w["@language"]===g["@language"]&&w["@index"]===g["@index"]?!0:e.isObject(w)&&"@id"in w&&e.isObject(g)&&"@id"in g?w["@id"]===g["@id"]:!1,h.compareShortestLeast=(w,g)=>w.length<g.length?-1:g.length<w.length?1:w===g?0:w<g?-1:1;function y(w,g){if(e.isArray(g))for(let m=0;m<g.length;++m)g[m]=y(w,g[m]);else if(r.isList(g))g["@list"]=y(w,g["@list"]);else if(e.isObject(g)){r.isBlankNode(g)&&(g["@id"]=w.getId(g["@id"]));const m=Object.keys(g).sort();for(let _=0;_<m.length;++_){const x=m[_];x!=="@id"&&(g[x]=y(w,g[x]))}}return g}return Di}var Mi,Qo;function la(){if(Qo)return Mi;Qo=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return Mi={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"},Mi}var Ci,Xo;function Zu(){return Xo||(Xo=1,Ci=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]}}}),Ci}var Pi,Ko;function At(){if(Ko)return Pi;Ko=1;const r=Ke(),e={};Pi=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 l=a.keys.length;for(;l--;)s[a.keys[l]]=o[l]===void 0?null:o[l];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 l=n.path;l=l.substr(0,l.lastIndexOf("/")+1),(l.length>0||n.authority)&&l.substr(-1)!=="/"&&(l+="/"),l+=s.path,a.path=l}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("/"),l=a.normalizedPath.split("/"),d=a.fragment||a.query?0:1;for(;o.length>0&&l.length>d&&o[0]===l[0];)o.shift(),l.shift();let h="";if(o.length>0){o.pop();for(let y=0;y<o.length;++y)h+="../"}return h+=l.join("/"),a.query!==null&&(h+="?"+a.query),a.fragment!==null&&(h+="#"+a.fragment),h===""&&(h="./"),h},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),Pi}var qi,Yo;function Of(){if(Yo)return qi;Yo=1;const{parseLinkHeader:r,buildHeaders:e}=et(),{LINK_HEADER_CONTEXT:t}=la(),n=rt(),i=Zu(),{prependBase:s}=At(),a=/(^|(\r\n))link:/i;qi=({secure:l,headers:d={},xhr:h}={headers:{}})=>{return d=e(d),new i().wrapLoader(w);async function w(g){if(g.indexOf("http:")!==0&&g.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:g});if(l&&g.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:g});let m;try{m=await o(h,g,d)}catch(b){throw new n("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:g,cause:b})}if(m.status>=400)throw new n("URL could not be dereferenced: "+m.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:g,httpStatusCode:m.status});let _={contextUrl:null,documentUrl:g,document:m.response},x=null;const S=m.getResponseHeader("Content-Type");let I;if(a.test(m.getAllResponseHeaders())&&(I=m.getResponseHeader("Link")),I&&S!=="application/ld+json"){const b=r(I),c=b[t];if(Array.isArray(c))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:g});c&&(_.contextUrl=c.target),x=b.alternate,x&&x.type=="application/ld+json"&&!(S||"").match(/^application\/(\w*\+)?json$/)&&(_=await w(s(g,x.target)))}return _}};function o(l,d,h){l=l||XMLHttpRequest;const y=new l;return new Promise((w,g)=>{y.onload=()=>w(y),y.onerror=m=>g(m),y.open("GET",d,!0);for(const m in h)y.setRequestHeader(m,h[m]);y.send()})}return qi}var Bi,Zo;function $f(){if(Zo)return Bi;Zo=1;const r=Of(),e={};return Bi=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})},Bi}var Fi,el;function kf(){return el||(el=1,Fi=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Fi}var Ui,tl;function Df(){if(tl)return Ui;tl=1,Ui=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(d){a.push(d)});else if(arguments.length>0)for(var o=0,l=arguments.length;o<l;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,l=0;o!==null;l++)s.call(a,o.value,l,this),o=o.next},r.prototype.forEachReverse=function(s,a){a=a||this;for(var o=this.tail,l=this.length-1;o!==null;l--)s.call(a,o.value,l,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,l=this.head;l!==null;)o.push(s.call(a,l.value,this)),l=l.next;return o},r.prototype.mapReverse=function(s,a){a=a||this;for(var o=new r,l=this.tail;l!==null;)o.push(s.call(a,l.value,this)),l=l.prev;return o},r.prototype.reduce=function(s,a){var o,l=this.head;if(arguments.length>1)o=a;else if(this.head)l=this.head.next,o=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var d=0;l!==null;d++)o=s(o,l.value,d),l=l.next;return o},r.prototype.reduceReverse=function(s,a){var o,l=this.tail;if(arguments.length>1)o=a;else if(this.tail)l=this.tail.prev,o=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var d=this.length-1;l!==null;d--)o=s(o,l.value,d),l=l.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 l=0,d=this.head;d!==null&&l<s;l++)d=d.next;for(;d!==null&&l<a;l++,d=d.next)o.push(d.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 l=this.length,d=this.tail;d!==null&&l>a;l--)d=d.prev;for(;d!==null&&l>s;l--,d=d.prev)o.push(d.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 l=0,d=this.head;d!==null&&l<s;l++)d=d.next;for(var h=[],l=0;d&&l<a;l++)h.push(d.value),d=this.removeNode(d);d===null&&(d=this.tail),d!==this.head&&d!==this.tail&&(d=d.prev);for(var l=0;l<o.length;l++)d=e(this,d,o[l]);return h},r.prototype.reverse=function(){for(var s=this.head,a=this.tail,o=s;o!==null;o=o.prev){var l=o.prev;o.prev=o.next,o.next=l}return this.head=a,this.tail=s,this};function e(s,a,o){var l=a===s.head?new i(o,null,a,s):new i(o,a,a.next,s);return l.next===null&&(s.tail=l),l.prev===null&&(s.head=l),s.length++,l}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,l){if(!(this instanceof i))return new i(s,a,o,l);this.list=l,this.value=s,a?(a.next=this,this.prev=a):this.prev=null,o?(o.prev=this,this.next=o):this.next=null}try{kf()(r)}catch{}return Ui}var Hi,rl;function ec(){if(rl)return Hi;rl=1;const r=Df(),e=Symbol("max"),t=Symbol("length"),n=Symbol("lengthCalculator"),i=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),l=Symbol("lruList"),d=Symbol("cache"),h=Symbol("updateAgeOnGet"),y=()=>1;class w{constructor(c){if(typeof c=="number"&&(c={max:c}),c||(c={}),c.max&&(typeof c.max!="number"||c.max<0))throw new TypeError("max must be a non-negative number");this[e]=c.max||1/0;const p=c.length||y;if(this[n]=typeof p!="function"?y:p,this[i]=c.stale||!1,c.maxAge&&typeof c.maxAge!="number")throw new TypeError("maxAge must be a number");this[s]=c.maxAge||0,this[a]=c.dispose,this[o]=c.noDisposeOnSet||!1,this[h]=c.updateAgeOnGet||!1,this.reset()}set max(c){if(typeof c!="number"||c<0)throw new TypeError("max must be a non-negative number");this[e]=c||1/0,_(this)}get max(){return this[e]}set allowStale(c){this[i]=!!c}get allowStale(){return this[i]}set maxAge(c){if(typeof c!="number")throw new TypeError("maxAge must be a non-negative number");this[s]=c,_(this)}get maxAge(){return this[s]}set lengthCalculator(c){typeof c!="function"&&(c=y),c!==this[n]&&(this[n]=c,this[t]=0,this[l].forEach(p=>{p.length=this[n](p.value,p.key),this[t]+=p.length})),_(this)}get lengthCalculator(){return this[n]}get length(){return this[t]}get itemCount(){return this[l].length}rforEach(c,p){p=p||this;for(let N=this[l].tail;N!==null;){const D=N.prev;I(this,c,N,p),N=D}}forEach(c,p){p=p||this;for(let N=this[l].head;N!==null;){const D=N.next;I(this,c,N,p),N=D}}keys(){return this[l].toArray().map(c=>c.key)}values(){return this[l].toArray().map(c=>c.value)}reset(){this[a]&&this[l]&&this[l].length&&this[l].forEach(c=>this[a](c.key,c.value)),this[d]=new Map,this[l]=new r,this[t]=0}dump(){return this[l].map(c=>m(this,c)?!1:{k:c.key,v:c.value,e:c.now+(c.maxAge||0)}).toArray().filter(c=>c)}dumpLru(){return this[l]}set(c,p,N){if(N=N||this[s],N&&typeof N!="number")throw new TypeError("maxAge must be a number");const D=N?Date.now():0,T=this[n](p,c);if(this[d].has(c)){if(T>this[e])return x(this,this[d].get(c)),!1;const M=this[d].get(c).value;return this[a]&&(this[o]||this[a](c,M.value)),M.now=D,M.maxAge=N,M.value=p,this[t]+=T-M.length,M.length=T,this.get(c),_(this),!0}const q=new S(c,p,T,D,N);return q.length>this[e]?(this[a]&&this[a](c,p),!1):(this[t]+=q.length,this[l].unshift(q),this[d].set(c,this[l].head),_(this),!0)}has(c){if(!this[d].has(c))return!1;const p=this[d].get(c).value;return!m(this,p)}get(c){return g(this,c,!0)}peek(c){return g(this,c,!1)}pop(){const c=this[l].tail;return c?(x(this,c),c.value):null}del(c){x(this,this[d].get(c))}load(c){this.reset();const p=Date.now();for(let N=c.length-1;N>=0;N--){const D=c[N],T=D.e||0;if(T===0)this.set(D.k,D.v);else{const q=T-p;q>0&&this.set(D.k,D.v,q)}}}prune(){this[d].forEach((c,p)=>g(this,p,!1))}}const g=(b,c,p)=>{const N=b[d].get(c);if(N){const D=N.value;if(m(b,D)){if(x(b,N),!b[i])return}else p&&(b[h]&&(N.value.now=Date.now()),b[l].unshiftNode(N));return D.value}},m=(b,c)=>{if(!c||!c.maxAge&&!b[s])return!1;const p=Date.now()-c.now;return c.maxAge?p>c.maxAge:b[s]&&p>b[s]},_=b=>{if(b[t]>b[e])for(let c=b[l].tail;b[t]>b[e]&&c!==null;){const p=c.prev;x(b,c),c=p}},x=(b,c)=>{if(c){const p=c.value;b[a]&&b[a](p.key,p.value),b[t]-=p.length,b[d].delete(p.key),b[l].removeNode(c)}};class S{constructor(c,p,N,D,T){this.key=c,this.value=p,this.length=N,this.now=D,this.maxAge=T||0}}const I=(b,c,p,N)=>{let D=p.value;m(b,D)&&(x(b,p),b[i]||(D=void 0)),D&&c.call(N,D.value,D.key,b)};return Hi=w,Hi}var Vi,nl;function Mf(){if(nl)return Vi;nl=1;const r=ec(),e=10;return Vi=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)}},Vi}var Gi,il;function Cf(){if(il)return Gi;il=1;const{isArray:r,isObject:e,isString:t}=Ke(),{asArray:n}=et(),{prependBase:i}=At(),s=rt(),a=Mf(),o=10;Gi=class{constructor({sharedCache:y}){this.perOpCache=new Map,this.sharedCache=y}async resolve({activeCtx:y,context:w,documentLoader:g,base:m,cycles:_=new Set}){w&&e(w)&&w["@context"]&&(w=w["@context"]),w=n(w);const x=[];for(const S of w){if(t(S)){let c=this._get(S);c||(c=await this._resolveRemoteContext({activeCtx:y,url:S,documentLoader:g,base:m,cycles:_})),r(c)?x.push(...c):x.push(c);continue}if(S===null){x.push(new a({document:null}));continue}e(S)||l(w);const I=JSON.stringify(S);let b=this._get(I);b||(b=new a({document:S}),this._cacheResolvedContext({key:I,resolved:b,tag:"static"})),x.push(b)}return x}_get(y){let w=this.perOpCache.get(y);if(!w){const g=this.sharedCache.get(y);g&&(w=g.get("static"),w&&this.perOpCache.set(y,w))}return w}_cacheResolvedContext({key:y,resolved:w,tag:g}){if(this.perOpCache.set(y,w),g!==void 0){let m=this.sharedCache.get(y);m||(m=new Map,this.sharedCache.set(y,m)),m.set(g,w)}return w}async _resolveRemoteContext({activeCtx:y,url:w,documentLoader:g,base:m,cycles:_}){w=i(m,w);const{context:x,remoteDoc:S}=await this._fetchContext({activeCtx:y,url:w,documentLoader:g,cycles:_});m=S.documentUrl||w,d({context:x,base:m});const I=await this.resolve({activeCtx:y,context:x,documentLoader:g,base:m,cycles:_});return this._cacheResolvedContext({key:w,resolved:I,tag:S.tag}),I}async _fetchContext({activeCtx:y,url:w,documentLoader:g,cycles:m}){if(m.size>o)throw new s("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:y.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:o});if(m.has(w))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:y.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:w});m.add(w);let _,x;try{x=await g(w),_=x.document||null,t(_)&&(_=JSON.parse(_))}catch(S){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: "${w}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:w,cause:S})}if(!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: "${w}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:w});return"@context"in _?_={"@context":_["@context"]}:_={"@context":{}},x.contextUrl&&(r(_["@context"])||(_["@context"]=[_["@context"]]),_["@context"].push(x.contextUrl)),{context:_,remoteDoc:x}}};function l(h){throw new s("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:h})}function d({context:h,base:y}){if(!h)return;const w=h["@context"];if(t(w)){h["@context"]=i(y,w);return}if(r(w)){for(let g=0;g<w.length;++g){const m=w[g];if(t(m)){w[g]=i(y,m);continue}e(m)&&d({context:{"@context":m},base:y})}return}if(e(w))for(const g in w)d({context:w[g],base:y})}return Gi}var Wi,sl;function Pf(){return sl||(sl=1,Wi=oa().NQuads),Wi}var zi,al;function Kr(){if(al)return zi;al=1;const r=rt(),{isArray:e}=Ke(),{asArray:t}=et(),n={};zi=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 l=!0;for(let d=0;l&&d<o.length;++d){l=!1;const h=o[d];if(e(h))l=i({event:a,handlers:h});else if(typeof h=="function")h({event:a,next:()=>{l=!0}});else if(typeof h=="object")a.code in h?h[a.code]({event:a,next:()=>{l=!0}}):l=!0;else throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return l}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:l}){if(o.level==="warning"&&s.has(o.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:o});l()},n.logEventHandler=function({event:o,next:l}){console.log(`EVENT: ${o.message}`,{event:o}),l()},n.logWarningEventHandler=function({event:o,next:l}){o.level==="warning"&&console.warn(`WARNING: ${o.message}`,{event:o}),l()},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},zi}var Ji,ol;function Ut(){if(ol)return Ji;ol=1;const r=et(),e=rt(),{isArray:t,isObject:n,isString:i,isUndefined:s}=Ke(),{isAbsolute:a,isRelative:o,prependBase:l}=At(),{handleEvent:d}=Kr(),{REGEX_BCP47:h,REGEX_KEYWORD:y,asArray:w,compareShortestLeast:g}=et(),m=new Map,_=1e4,x={};Ji=x,x.process=async({activeCtx:b,localCtx:c,options:p,propagate:N=!0,overrideProtected:D=!1,cycles:T=new Set})=>{if(n(c)&&"@context"in c&&t(c["@context"])&&(c=c["@context"]),w(c).length===0)return b;const R=[],M=[({event:Y,next:L})=>{R.push(Y),L()}];p.eventHandler&&M.push(p.eventHandler);const B=p;p={...p,eventHandler:M};const A=await p.contextResolver.resolve({activeCtx:b,context:c,documentLoader:p.documentLoader,base:p.base});n(A[0].document)&&typeof A[0].document["@propagate"]=="boolean"&&(N=A[0].document["@propagate"]);let j=b;!N&&!j.previousContext&&(j=j.clone(),j.previousContext=b);for(const Y of A){let{document:L}=Y;if(b=j,L===null){if(!D&&Object.keys(b.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"});j=b=x.getInitialContext(p).clone();continue}const ee=Y.getProcessed(b);if(ee){if(B.eventHandler)for(const K of ee.events)d({event:K,options:B});j=b=ee.context;continue}if(n(L)&&"@context"in L&&(L=L["@context"]),!n(L))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:L});j=j.clone();const C=new Map;if("@version"in L){if(L["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+L["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:L});if(b.processingMode&&b.processingMode==="json-ld-1.0")throw new e("@version: "+L["@version"]+" not compatible with "+b.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:L});j.processingMode="json-ld-1.1",j["@version"]=L["@version"],C.set("@version",!0)}if(j.processingMode=j.processingMode||b.processingMode,"@base"in L){let K=L["@base"];if(!(K===null||a(K)))if(o(K))K=l(j["@base"],K);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:L});j["@base"]=K,C.set("@base",!0)}if("@vocab"in L){const K=L["@vocab"];if(K===null)delete j["@vocab"];else if(i(K)){if(!a(K)&&x.processingMode(j,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:L});{const v=S(j,K,{vocab:!0,base:!0},void 0,void 0,p);a(v)||p.eventHandler&&d({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:v}},options:p}),j["@vocab"]=v}}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:L});C.set("@vocab",!0)}if("@language"in L){const K=L["@language"];if(K===null)delete j["@language"];else if(i(K))K.match(h)||p.eventHandler&&d({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:K}},options:p}),j["@language"]=K.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:L});C.set("@language",!0)}if("@direction"in L){const K=L["@direction"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:L});if(K===null)delete j["@direction"];else{if(K!=="ltr"&&K!=="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:L});j["@direction"]=K}C.set("@direction",!0)}if("@propagate"in L){const K=L["@propagate"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:L});if(typeof K!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:c});C.set("@propagate",!0)}if("@import"in L){const K=L["@import"];if(b.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+b.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:L});if(!i(K))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:c});const v=await p.contextResolver.resolve({activeCtx:b,context:K,documentLoader:p.documentLoader,base:p.base});if(v.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:c});const U=v[0].getProcessed(b);if(U)L=U;else{const Q=v[0].document;if("@import"in Q)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:c});for(const z in Q)L.hasOwnProperty(z)||(L[z]=Q[z]);v[0].setProcessed(b,L)}C.set("@import",!0)}C.set("@protected",L["@protected"]||!1);for(const K in L)if(x.createTermDefinition({activeCtx:j,localCtx:L,term:K,defined:C,options:p,overrideProtected:D}),n(L[K])&&"@context"in L[K]){const v=L[K]["@context"];let U=!0;if(i(v)){const Q=l(p.base,v);T.has(Q)?U=!1:T.add(Q)}if(U)try{await x.process({activeCtx:j.clone(),localCtx:L[K]["@context"],overrideProtected:!0,options:p,cycles:T})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:L[K]["@context"],term:K})}}Y.setProcessed(b,{context:j,events:R})}return j},x.createTermDefinition=({activeCtx:b,localCtx:c,term:p,defined:N,options:D,overrideProtected:T=!1})=>{if(N.has(p)){if(N.get(p))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:c,term:p})}N.set(p,!1);let q;if(c.hasOwnProperty(p)&&(q=c[p]),p==="@type"&&n(q)&&(q["@container"]||"@set")==="@set"&&x.processingMode(b,1.1)){const L=["@container","@id","@protected"],ee=Object.keys(q);if(ee.length===0||ee.some(C=>!L.includes(C)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:c,term:p})}else{if(x.isKeyword(p))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:c,term:p});if(p.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:p}},options:D});return}else if(p==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:c})}const R=b.mappings.get(p);b.mappings.has(p)&&b.mappings.delete(p);let M=!1;if((i(q)||q===null)&&(M=!0,q={"@id":q}),!n(q))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:c});const B={};b.mappings.set(p,B),B.reverse=!1;const A=["@container","@id","@language","@reverse","@type"];x.processingMode(b,1.1)&&A.push("@context","@direction","@index","@nest","@prefix","@protected");for(const L in q)if(!A.includes(L))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+L,"jsonld.SyntaxError",{code:"invalid term definition",context:c});const j=p.indexOf(":");if(B._termHasColon=j>0,"@reverse"in q){if("@id"in q)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:c});if("@nest"in q)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:c});const L=q["@reverse"];if(!i(L))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c});if(L.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:L}},options:D}),R?b.mappings.set(p,R):b.mappings.delete(p);return}const ee=S(b,L,{vocab:!0,base:!1},c,N,D);if(!a(ee))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:c});B["@id"]=ee,B.reverse=!0}else if("@id"in q){let L=q["@id"];if(L&&!i(L))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:c});if(L===null)B["@id"]=null;else if(!x.isKeyword(L)&&L.match(y)){D.eventHandler&&d({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:L}},options:D}),R?b.mappings.set(p,R):b.mappings.delete(p);return}else if(L!==p){if(L=S(b,L,{vocab:!0,base:!1},c,N,D),!a(L)&&!x.isKeyword(L))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:c});if(p.match(/(?::[^:])|\//)){const ee=new Map(N).set(p,!0);if(S(b,p,{vocab:!0,base:!1},c,ee,D)!==L)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c})}B["@id"]=L,B._prefix=M&&!B._termHasColon&&L.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in B))if(B._termHasColon){const L=p.substr(0,j);if(c.hasOwnProperty(L)&&x.createTermDefinition({activeCtx:b,localCtx:c,term:L,defined:N,options:D}),b.mappings.has(L)){const ee=p.substr(j+1);B["@id"]=b.mappings.get(L)["@id"]+ee}else B["@id"]=p}else if(p==="@type")B["@id"]=p;else{if(!("@vocab"in b))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:c,term:p});B["@id"]=b["@vocab"]+p}if((q["@protected"]===!0||N.get("@protected")===!0&&q["@protected"]!==!1)&&(b.protected[p]=!0,B.protected=!0),N.set(p,!0),"@type"in q){let L=q["@type"];if(!i(L))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:c});if(L==="@json"||L==="@none"){if(x.processingMode(b,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${L}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:c})}else if(L!=="@id"&&L!=="@vocab"){if(L=S(b,L,{vocab:!0,base:!1},c,N,D),!a(L))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:c});if(L.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:c})}B["@type"]=L}if("@container"in q){const L=i(q["@container"])?[q["@container"]]:q["@container"]||[],ee=["@list","@set","@index","@language"];let C=!0;const K=L.includes("@set");if(x.processingMode(b,1.1)){if(ee.push("@graph","@id","@type"),L.includes("@list")){if(L.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:c})}else if(L.includes("@graph")){if(L.some(v=>v!=="@graph"&&v!=="@id"&&v!=="@index"&&v!=="@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:c})}else C&=L.length<=(K?2:1);if(L.includes("@type")&&(B["@type"]=B["@type"]||"@id",!["@id","@vocab"].includes(B["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:c})}else C&=!t(q["@container"]),C&=L.length<=1;if(C&=L.every(v=>ee.includes(v)),C&=!(K&&L.includes("@list")),!C)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+ee.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:c});if(B.reverse&&!L.every(v=>["@index","@set"].includes(v)))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:c});B["@container"]=L}if("@index"in q){if(!("@container"in q)||!B["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${q["@index"]}" on term "${p}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:c});if(!i(q["@index"])||q["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${q["@index"]}" on term "${p}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:c});B["@index"]=q["@index"]}if("@context"in q&&(B["@context"]=q["@context"]),"@language"in q&&!("@type"in q)){let L=q["@language"];if(L!==null&&!i(L))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:c});L!==null&&(L=L.toLowerCase()),B["@language"]=L}if("@prefix"in q){if(p.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:c});if(x.isKeyword(B["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:c});if(typeof q["@prefix"]=="boolean")B._prefix=q["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:c})}if("@direction"in q){const L=q["@direction"];if(L!==null&&L!=="ltr"&&L!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:c});B["@direction"]=L}if("@nest"in q){const L=q["@nest"];if(!i(L)||L!=="@nest"&&L.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:c});B["@nest"]=L}// disallow aliasing @context and @preserve
298
+ const Y=B["@id"];if(Y==="@context"||Y==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:c});if(R&&R.protected&&!T&&(b.protected[p]=!0,B.protected=!0,!I(R,B)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:c,term:p})},x.expandIri=(b,c,p,N)=>S(b,c,p,void 0,void 0,N);function S(b,c,p,N,D,T){if(c===null||!i(c)||x.isKeyword(c))return c;if(c.match(y))return null;if(N&&N.hasOwnProperty(c)&&D.get(c)!==!0&&x.createTermDefinition({activeCtx:b,localCtx:N,term:c,defined:D,options:T}),p=p||{},p.vocab){const R=b.mappings.get(c);if(R===null)return null;if(n(R)&&"@id"in R)return R["@id"]}const q=c.indexOf(":");if(q>0){const R=c.substr(0,q),M=c.substr(q+1);if(R==="_"||M.indexOf("//")===0)return c;N&&N.hasOwnProperty(R)&&x.createTermDefinition({activeCtx:b,localCtx:N,term:R,defined:D,options:T});const B=b.mappings.get(R);if(B&&B._prefix)return B["@id"]+M;if(a(c))return c}if(p.vocab&&"@vocab"in b)c=b["@vocab"]+c;else if(p.base){let R,M;"@base"in b?b["@base"]?(M=l(T.base,b["@base"]),R=l(M,c)):(M=b["@base"],R=c):(M=T.base,R=l(T.base,c)),c=R}return c}x.getInitialContext=b=>{const c=JSON.stringify({processingMode:b.processingMode}),p=m.get(c);if(p)return p;const N={processingMode:b.processingMode,mappings:new Map,inverse:null,getInverse:D,clone:R,revertToPreviousContext:M,protected:{}};return m.size===_&&m.clear(),m.set(c,N),N;function D(){const B=this;if(B.inverse)return B.inverse;const A=B.inverse={},j=B.fastCurieMap={},Y={},L=(B["@language"]||"@none").toLowerCase(),ee=B["@direction"],C=B.mappings,K=[...C.keys()].sort(g);for(const v of K){const U=C.get(v);if(U===null)continue;let Q=U["@container"]||"@none";if(Q=[].concat(Q).sort().join(""),U["@id"]===null)continue;const z=w(U["@id"]);for(const ae of z){let H=A[ae];const V=x.isKeyword(ae);if(H)!V&&!U._termHasColon&&Y[ae].push(v);else if(A[ae]=H={},!V&&!U._termHasColon){Y[ae]=[v];const W={iri:ae,terms:Y[ae]};ae[0]in j?j[ae[0]].push(W):j[ae[0]]=[W]}if(H[Q]||(H[Q]={"@language":{},"@type":{},"@any":{}}),H=H[Q],q(v,H["@any"],"@none"),U.reverse)q(v,H["@type"],"@reverse");else if(U["@type"]==="@none")q(v,H["@any"],"@none"),q(v,H["@language"],"@none"),q(v,H["@type"],"@none");else if("@type"in U)q(v,H["@type"],U["@type"]);else if("@language"in U&&"@direction"in U){const W=U["@language"],F=U["@direction"];W&&F?q(v,H["@language"],`${W}_${F}`.toLowerCase()):W?q(v,H["@language"],W.toLowerCase()):F?q(v,H["@language"],`_${F}`):q(v,H["@language"],"@null")}else"@language"in U?q(v,H["@language"],(U["@language"]||"@null").toLowerCase()):"@direction"in U?U["@direction"]?q(v,H["@language"],`_${U["@direction"]}`):q(v,H["@language"],"@none"):ee?(q(v,H["@language"],`_${ee}`),q(v,H["@language"],"@none"),q(v,H["@type"],"@none")):(q(v,H["@language"],L),q(v,H["@language"],"@none"),q(v,H["@type"],"@none"))}}for(const v in j)T(j,v,1);return A}function T(B,A,j){const Y=B[A],L=B[A]={};let ee,C;for(const K of Y)ee=K.iri,j>=ee.length?C="":C=ee[j],C in L?L[C].push(K):L[C]=[K];for(const K in L)K!==""&&T(L,K,j+1)}function q(B,A,j){A.hasOwnProperty(j)||(A[j]=B)}function R(){const B={};return B.mappings=r.clone(this.mappings),B.clone=this.clone,B.inverse=null,B.getInverse=this.getInverse,B.protected=r.clone(this.protected),this.previousContext&&(B.previousContext=this.previousContext.clone()),B.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(B["@base"]=this["@base"]),"@language"in this&&(B["@language"]=this["@language"]),"@vocab"in this&&(B["@vocab"]=this["@vocab"]),B}function M(){return this.previousContext?this.previousContext.clone():this}},x.getContextValue=(b,c,p)=>{if(c===null)return p==="@context"?void 0:null;if(b.mappings.has(c)){const N=b.mappings.get(c);if(s(p))return N;if(N.hasOwnProperty(p))return N[p]}if(p==="@language"&&p in b||p==="@direction"&&p in b)return b[p];if(p!=="@context")return null},x.processingMode=(b,c)=>c.toString()>="1.1"?!b.processingMode||b.processingMode>="json-ld-"+c.toString():b.processingMode==="json-ld-1.0",x.isKeyword=b=>{if(!i(b)||b[0]!=="@")return!1;switch(b){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 I(b,c){if(!(b&&typeof b=="object")||!(c&&typeof c=="object"))return b===c;const p=Array.isArray(b);if(p!==Array.isArray(c))return!1;if(p){if(b.length!==c.length)return!1;for(let T=0;T<b.length;++T)if(!I(b[T],c[T]))return!1;return!0}const N=Object.keys(b),D=Object.keys(c);if(N.length!==D.length)return!1;for(const T in b){let q=b[T],R=c[T];if(T==="@container"&&Array.isArray(q)&&Array.isArray(R)&&(q=q.slice().sort(),R=R.slice().sort()),!I(q,R))return!1}return!0}return Ji}var Qi,ll;function qf(){if(ll)return Qi;ll=1;const r=rt(),{isArray:e,isObject:t,isEmptyObject:n,isString:i,isUndefined:s}=Ke(),{isList:a,isValue:o,isGraph:l,isSubject:d}=_t(),{expandIri:h,getContextValue:y,isKeyword:w,process:g,processingMode:m}=Ut(),{isAbsolute:_}=At(),{REGEX_BCP47:x,REGEX_KEYWORD:S,addValue:I,asArray:b,getValues:c,validateTypeValue:p}=et(),{handleEvent:N}=Kr(),D={};Qi=D,D.expand=async({activeCtx:A,activeProperty:j=null,element:Y,options:L={},insideList:ee=!1,insideIndex:C=!1,typeScopedContext:K=null})=>{if(Y==null)return null;if(j==="@default"&&(L=Object.assign({},L,{isFrame:!1})),!e(Y)&&!t(Y))return!ee&&(j===null||h(A,j,{vocab:!0},L)==="@graph")?(L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:Y}},options:L}),null):R({activeCtx:A,activeProperty:j,value:Y,options:L});if(e(Y)){let W=[];const F=y(A,j,"@container")||[];ee=ee||F.includes("@list");for(let Z=0;Z<Y.length;++Z){let te=await D.expand({activeCtx:A,activeProperty:j,element:Y[Z],options:L,insideIndex:C,typeScopedContext:K});ee&&e(te)&&(te={"@list":te}),te!==null&&(e(te)?W=W.concat(te):W.push(te))}return W}const v=h(A,j,{vocab:!0},L),U=y(A,j,"@context");K=K||(A.previousContext?A:null);let Q=Object.keys(Y).sort(),z=!C;if(z&&K&&Q.length<=2&&!Q.includes("@context"))for(const W of Q){const F=h(K,W,{vocab:!0},L);if(F==="@value"){z=!1,A=K;break}if(F==="@id"&&Q.length===1){z=!1;break}}z&&(A=A.revertToPreviousContext()),s(U)||(A=await g({activeCtx:A,localCtx:U,propagate:!0,overrideProtected:!0,options:L})),"@context"in Y&&(A=await g({activeCtx:A,localCtx:Y["@context"],options:L})),K=A;let ae=null;for(const W of Q)if(h(A,W,{vocab:!0},L)==="@type"){ae=ae||W;const Z=Y[W],te=Array.isArray(Z)?Z.length>1?Z.slice().sort():Z:[Z];for(const ce of te){const fe=y(K,ce,"@context");s(fe)||(A=await g({activeCtx:A,localCtx:fe,options:L,propagate:!1}))}}let H={};await q({activeCtx:A,activeProperty:j,expandedActiveProperty:v,element:Y,expandedParent:H,options:L,insideList:ee,typeKey:ae,typeScopedContext:K}),Q=Object.keys(H);let V=Q.length;if("@value"in H){if("@type"in H&&("@language"in H||"@direction"in H))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:H});let W=V-1;if("@type"in H&&(W-=1),"@index"in H&&(W-=1),"@language"in H&&(W-=1),"@direction"in H&&(W-=1),W!==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:H});const F=H["@value"]===null?[]:b(H["@value"]),Z=c(H,"@type");if(!(m(A,1.1)&&Z.includes("@json")&&Z.length===1))if(F.length===0)L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:H}},options:L}),H=null;else{if(!F.every(te=>i(te)||n(te))&&"@language"in H)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:H});if(!Z.every(te=>_(te)&&!(i(te)&&te.indexOf("_:")===0)||n(te)))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:H})}}else if("@type"in H&&!e(H["@type"]))H["@type"]=[H["@type"]];else if("@set"in H||"@list"in H){if(V>1&&!(V===2&&"@index"in H))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:H});"@set"in H&&(H=H["@set"],Q=Object.keys(H),V=Q.length)}else V===1&&"@language"in H&&(L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:H}},options:L}),H=null);return t(H)&&!L.keepFreeFloatingNodes&&!ee&&(j===null||v==="@graph"||(y(A,j,"@container")||[]).includes("@graph"))&&(H=T({value:H,count:V,options:L})),H};function T({value:A,count:j,options:Y}){if(j===0||"@value"in A||"@list"in A||j===1&&"@id"in A){if(Y.eventHandler){let L,ee;j===0?(L="empty object",ee="Dropping empty object."):"@value"in A?(L="object with only @value",ee="Dropping object with only @value."):"@list"in A?(L="object with only @list",ee="Dropping object with only @list."):j===1&&"@id"in A&&(L="object with only @id",ee="Dropping object with only @id."),N({event:{type:["JsonLdEvent"],code:L,level:"warning",message:ee,details:{value:A}},options:Y})}return null}return A}async function q({activeCtx:A,activeProperty:j,expandedActiveProperty:Y,element:L,expandedParent:ee,options:C={},insideList:K,typeKey:v,typeScopedContext:U}){const Q=Object.keys(L).sort(),z=[];let ae;const H=L[v]&&h(A,e(L[v])?L[v][0]:L[v],{vocab:!0},{...C,typeExpansion:!0})==="@json";for(const V of Q){let W=L[V],F;if(V==="@context")continue;const Z=h(A,V,{vocab:!0},C);if(Z===null||!(_(Z)||w(Z))){C.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:V,expandedProperty:Z}},options:C});continue}if(w(Z)){if(Y==="@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:W});if(Z in ee&&Z!=="@included"&&Z!=="@type")throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:Z})}if(Z==="@id"){if(!i(W)){if(!C.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:W});if(t(W)){if(!n(W))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:W})}else if(e(W)){if(!W.every(O=>i(O)))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:W})}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:W})}I(ee,"@id",b(W).map(O=>{if(i(O)){const G=h(A,O,{base:!0},C);return C.eventHandler&&(G===null?N(O===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:O}},options:C}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:O}},options:C}):_(G)||N({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:O,expandedId:G}},options:C})),G}return O}),{propertyIsArray:C.isFrame});continue}if(Z==="@type"){t(W)&&(W=Object.fromEntries(Object.entries(W).map(([O,G])=>[h(U,O,{vocab:!0}),b(G).map(re=>h(U,re,{base:!0,vocab:!0},{...C,typeExpansion:!0}))]))),p(W,C.isFrame),I(ee,"@type",b(W).map(O=>{if(i(O)){const G=h(U,O,{base:!0,vocab:!0},{...C,typeExpansion:!0});return G!=="@json"&&!_(G)&&C.eventHandler&&N({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:O}},options:C}),G}return O}),{propertyIsArray:!!C.isFrame});continue}if(Z==="@included"&&m(A,1.1)){const O=b(await D.expand({activeCtx:A,activeProperty:j,element:W,options:C}));if(!O.every(G=>d(G)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:W});I(ee,"@included",O,{propertyIsArray:!0});continue}if(Z==="@graph"&&!(t(W)||e(W)))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:W});if(Z==="@value"){ae=W,H&&m(A,1.1)?ee["@value"]=W:I(ee,"@value",W,{propertyIsArray:C.isFrame});continue}if(Z==="@language"){if(W===null)continue;if(!i(W)&&!C.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:W});W=b(W).map(O=>i(O)?O.toLowerCase():O);for(const O of W)i(O)&&!O.match(x)&&C.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:O}},options:C});I(ee,"@language",W,{propertyIsArray:C.isFrame});continue}if(Z==="@direction"){if(!i(W)&&!C.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:W});W=b(W);for(const O of W)if(i(O)&&O!=="ltr"&&O!=="rtl")throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:W});I(ee,"@direction",W,{propertyIsArray:C.isFrame});continue}if(Z==="@index"){if(!i(W))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:W});I(ee,"@index",W);continue}if(Z==="@reverse"){if(!t(W))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:W});if(F=await D.expand({activeCtx:A,activeProperty:"@reverse",element:W,options:C}),"@reverse"in F)for(const G in F["@reverse"])I(ee,G,F["@reverse"][G],{propertyIsArray:!0});let O=ee["@reverse"]||null;for(const G in F){if(G==="@reverse")continue;O===null&&(O=ee["@reverse"]={}),I(O,G,[],{propertyIsArray:!0});const re=F[G];for(let ue=0;ue<re.length;++ue){const de=re[ue];if(o(de)||a(de))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:F});I(O,G,de,{propertyIsArray:!0})}}continue}if(Z==="@nest"){z.push(V);continue}let te=A;const ce=y(A,V,"@context");s(ce)||(te=await g({activeCtx:A,localCtx:ce,propagate:!0,overrideProtected:!0,options:C}));const fe=y(A,V,"@container")||[];if(fe.includes("@language")&&t(W)){const O=y(te,V,"@direction");F=M(te,W,O,C)}else if(fe.includes("@index")&&t(W)){const O=fe.includes("@graph"),G=y(te,V,"@index")||"@index",re=G!=="@index"&&h(A,G,{vocab:!0},C);F=await B({activeCtx:te,options:C,activeProperty:V,value:W,asGraph:O,indexKey:G,propertyIndex:re})}else if(fe.includes("@id")&&t(W)){const O=fe.includes("@graph");F=await B({activeCtx:te,options:C,activeProperty:V,value:W,asGraph:O,indexKey:"@id"})}else if(fe.includes("@type")&&t(W))F=await B({activeCtx:te.revertToPreviousContext(),options:C,activeProperty:V,value:W,asGraph:!1,indexKey:"@type"});else{const O=Z==="@list";if(O||Z==="@set"){let G=j;O&&Y==="@graph"&&(G=null),F=await D.expand({activeCtx:te,activeProperty:G,element:W,options:C,insideList:O})}else y(A,V,"@type")==="@json"?F={"@type":"@json","@value":W}:F=await D.expand({activeCtx:te,activeProperty:V,element:W,options:C,insideList:!1})}if(!(F===null&&Z!=="@value")){if(Z!=="@list"&&!a(F)&&fe.includes("@list")&&(F={"@list":b(F)}),fe.includes("@graph")&&!fe.some(O=>O==="@id"||O==="@index")){if(F=b(F),C.isFrame||(F=F.filter(O=>{const G=Object.keys(O).length;return T({value:O,count:G,options:C})!==null})),F.length===0)continue;F=F.map(O=>({"@graph":b(O)}))}if(te.mappings.has(V)&&te.mappings.get(V).reverse){const O=ee["@reverse"]=ee["@reverse"]||{};F=b(F);for(let G=0;G<F.length;++G){const re=F[G];if(o(re)||a(re))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:F});I(O,Z,re,{propertyIsArray:!0})}continue}I(ee,Z,F,{propertyIsArray:!0})}}if("@value"in ee&&!(ee["@type"]==="@json"&&m(A,1.1))){if((t(ae)||e(ae))&&!C.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:ae})}for(const V of z){const W=e(L[V])?L[V]:[L[V]];for(const F of W){if(!t(F)||Object.keys(F).some(Z=>h(A,Z,{vocab:!0},C)==="@value"))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:F});await q({activeCtx:A,activeProperty:j,expandedActiveProperty:Y,element:F,expandedParent:ee,options:C,insideList:K,typeScopedContext:U,typeKey:v})}}}function R({activeCtx:A,activeProperty:j,value:Y,options:L}){if(Y==null)return null;const ee=h(A,j,{vocab:!0},L);if(ee==="@id")return h(A,Y,{base:!0},L);if(ee==="@type")return h(A,Y,{vocab:!0,base:!0},{...L,typeExpansion:!0});const C=y(A,j,"@type");if((C==="@id"||ee==="@graph")&&i(Y)){const v=h(A,Y,{base:!0},L);return v===null&&Y.match(S)&&L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:L}),{"@id":v}}if(C==="@vocab"&&i(Y))return{"@id":h(A,Y,{vocab:!0,base:!0},L)};if(w(ee))return Y;const K={};if(C&&!["@id","@vocab","@none"].includes(C))K["@type"]=C;else if(i(Y)){const v=y(A,j,"@language");v!==null&&(K["@language"]=v);const U=y(A,j,"@direction");U!==null&&(K["@direction"]=U)}return["boolean","number","string"].includes(typeof Y)||(Y=Y.toString()),K["@value"]=Y,K}function M(A,j,Y,L){const ee=[],C=Object.keys(j).sort();for(const K of C){const v=h(A,K,{vocab:!0},L);let U=j[K];e(U)||(U=[U]);for(const Q of U){if(Q===null)continue;if(!i(Q))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:j});const z={"@value":Q};v!=="@none"&&(K.match(x)||L.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:K}},options:L}),z["@language"]=K.toLowerCase()),Y&&(z["@direction"]=Y),ee.push(z)}}return ee}async function B({activeCtx:A,options:j,activeProperty:Y,value:L,asGraph:ee,indexKey:C,propertyIndex:K}){const v=[],U=Object.keys(L).sort(),Q=C==="@type";for(let z of U){if(Q){const V=y(A,z,"@context");s(V)||(A=await g({activeCtx:A,localCtx:V,propagate:!1,options:j}))}let ae=L[z];e(ae)||(ae=[ae]),ae=await D.expand({activeCtx:A,activeProperty:Y,element:ae,options:j,insideList:!1,insideIndex:!0});let H;K?z==="@none"?H="@none":H=R({activeCtx:A,activeProperty:C,value:z,options:j}):H=h(A,z,{vocab:!0},j),C==="@id"?z=h(A,z,{base:!0},j):Q&&(z=H);for(let V of ae){if(ee&&!l(V)&&(V={"@graph":[V]}),C==="@type")H==="@none"||(V["@type"]?V["@type"]=[z].concat(V["@type"]):V["@type"]=[z]);else{if(o(V)&&!["@language","@type","@index"].includes(C))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${C}".`,"jsonld.SyntaxError",{code:"invalid value object",value:V});K?H!=="@none"&&I(V,K,H,{propertyIsArray:!0,prependValue:!0}):H!=="@none"&&!(C in V)&&(V[C]=z)}v.push(V)}}return v}return Qi}var Xi,ul;function Mn(){if(ul)return Xi;ul=1;const{isKeyword:r}=Ut(),e=_t(),t=Ke(),n=et(),i=rt(),s={};return Xi=s,s.createMergedNodeMap=(a,o)=>{o=o||{};const l=o.issuer||new n.IdentifierIssuer("_:b"),d={"@default":{}};return s.createNodeMap(a,d,"@default",l),s.mergeNodeMaps(d)},s.createNodeMap=(a,o,l,d,h,y)=>{if(t.isArray(a)){for(const _ of a)s.createNodeMap(_,o,l,d,void 0,y);return}if(!t.isObject(a)){y&&y.push(a);return}if(e.isValue(a)){if("@type"in a){let _=a["@type"];_.indexOf("_:")===0&&(a["@type"]=_=d.getId(_))}y&&y.push(a);return}else if(y&&e.isList(a)){const _=[];s.createNodeMap(a["@list"],o,l,d,h,_),y.push({"@list":_});return}if("@type"in a){const _=a["@type"];for(const x of _)x.indexOf("_:")===0&&d.getId(x)}t.isUndefined(h)&&(h=e.isBlankNode(a)?d.getId(a["@id"]):a["@id"]),y&&y.push({"@id":h});const w=o[l],g=w[h]=w[h]||{};g["@id"]=h;const m=Object.keys(a).sort();for(let _ of m){if(_==="@id")continue;if(_==="@reverse"){const S={"@id":h},I=a["@reverse"];for(const b in I){const c=I[b];for(const p of c){let N=p["@id"];e.isBlankNode(p)&&(N=d.getId(N)),s.createNodeMap(p,o,l,d,N),n.addValue(w[N],b,S,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(_==="@graph"){h in o||(o[h]={}),s.createNodeMap(a[_],o,h,d);continue}if(_==="@included"){s.createNodeMap(a[_],o,l,d);continue}if(_!=="@type"&&r(_)){if(_==="@index"&&_ in g&&(a[_]!==g[_]||a[_]["@id"]!==g[_]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:g});g[_]=a[_];continue}const x=a[_];if(_.indexOf("_:")===0&&(_=d.getId(_)),x.length===0){n.addValue(g,_,[],{propertyIsArray:!0});continue}for(let S of x)if(_==="@type"&&(S=S.indexOf("_:")===0?d.getId(S):S),e.isSubject(S)||e.isSubjectReference(S)){if("@id"in S&&!S["@id"])continue;const I=e.isBlankNode(S)?d.getId(S["@id"]):S["@id"];n.addValue(g,_,{"@id":I},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(S,o,l,d,I)}else if(e.isValue(S))n.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(S)){const I=[];s.createNodeMap(S["@list"],o,l,d,h,I),S={"@list":I},n.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(S,o,l,d,h),n.addValue(g,_,S,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=a=>{const o={};for(const l of Object.keys(a).sort())for(const d of Object.keys(a[l]).sort()){const h=a[l][d];d in o||(o[d]={"@id":d});const y=o[d];for(const w of Object.keys(h).sort())if(r(w)&&w!=="@type")y[w]=n.clone(h[w]);else for(const g of h[w])n.addValue(y,w,n.clone(g),{propertyIsArray:!0,allowDuplicate:!1})}return o},s.mergeNodeMaps=a=>{const o=a["@default"],l=Object.keys(a).sort();for(const d of l){if(d==="@default")continue;const h=a[d];let y=o[d];y?"@graph"in y||(y["@graph"]=[]):o[d]=y={"@id":d,"@graph":[]};const w=y["@graph"];for(const g of Object.keys(h).sort()){const m=h[g];e.isSubjectReference(m)||w.push(m)}}return o},Xi}var Ki,cl;function Bf(){if(cl)return Ki;cl=1;const{isSubjectReference:r}=_t(),{createMergedNodeMap:e}=Mn(),t={};return Ki=t,t.flatten=n=>{const i=e(n),s=[],a=Object.keys(i).sort();for(let o=0;o<a.length;++o){const l=i[a[o]];r(l)||s.push(l)}return s},Ki}var Yi,dl;function Ff(){if(dl)return Yi;dl=1;const r=rt(),e=_t(),t=Ke(),{REGEX_BCP47:n,addValue:i}=et(),{handleEvent:s}=Kr(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:l,RDF_NIL:d,RDF_TYPE:h,RDF_JSON_LITERAL:y,XSD_BOOLEAN:w,XSD_DOUBLE:g,XSD_INTEGER:m,XSD_STRING:_}=la(),x={};Yi=x,x.fromRDF=async(I,b)=>{const{useRdfType:c=!1,useNativeTypes:p=!1,rdfDirection:N=null}=b,D={},T={"@default":D},q={};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 B of I){const A=B.graph.termType==="DefaultGraph"?"@default":B.graph.value;A in T||(T[A]={}),A!=="@default"&&!(A in D)&&(D[A]={"@id":A});const j=T[A],Y=B.subject.value,L=B.predicate.value,ee=B.object;Y in j||(j[Y]={"@id":Y});const C=j[Y],K=ee.termType.endsWith("Node");if(K&&!(ee.value in j)&&(j[ee.value]={"@id":ee.value}),L===h&&!c&&K){i(C,"@type",ee.value,{propertyIsArray:!0});continue}const v=S(ee,p,N,b);if(i(C,L,v,{propertyIsArray:!0}),K)if(ee.value===d){const U=j[ee.value];"usages"in U||(U.usages=[]),U.usages.push({node:C,property:L,value:v})}else ee.value in q?q[ee.value]=!1:q[ee.value]={node:C,property:L,value:v}}for(const B in T){const A=T[B];if(!(d in A))continue;const j=A[d];if(j.usages){for(let Y of j.usages){let L=Y.node,ee=Y.property,C=Y.value;const K=[],v=[];let U=Object.keys(L).length;for(;ee===l&&t.isObject(q[L["@id"]])&&t.isArray(L[o])&&L[o].length===1&&t.isArray(L[l])&&L[l].length===1&&(U===3||U===4&&t.isArray(L["@type"])&&L["@type"].length===1&&L["@type"][0]===a)&&(K.push(L[o][0]),v.push(L["@id"]),Y=q[L["@id"]],L=Y.node,ee=Y.property,C=Y.value,U=Object.keys(L).length,!!e.isBlankNode(L)););delete C["@id"],C["@list"]=K.reverse();for(const Q of v)delete A[Q]}delete j.usages}}const R=[],M=Object.keys(D).sort();for(const B of M){const A=D[B];if(B in T){const j=A["@graph"]=[],Y=T[B],L=Object.keys(Y).sort();for(const ee of L){const C=Y[ee];e.isSubjectReference(C)||j.push(C)}}e.isSubjectReference(A)||R.push(A)}return R};function S(I,b,c,p){if(I.termType.endsWith("Node"))return{"@id":I.value};const N={"@value":I.value};if(I.language)I.language.match(n)||p.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:I.language}},options:p}),N["@language"]=I.language;else{let D=I.datatype.value;if(D||(D=_),D===y){D="@json";try{N["@value"]=JSON.parse(N["@value"])}catch(T){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:N["@value"],cause:T})}}if(b){if(D===w)N["@value"]==="true"?N["@value"]=!0:N["@value"]==="false"&&(N["@value"]=!1);else if(t.isNumeric(N["@value"]))if(D===m){const T=parseInt(N["@value"],10);T.toFixed(0)===N["@value"]&&(N["@value"]=T)}else D===g&&(N["@value"]=parseFloat(N["@value"]));[w,m,g,_].includes(D)||(N["@type"]=D)}else if(c==="i18n-datatype"&&D.startsWith("https://www.w3.org/ns/i18n#")){const[,T,q]=D.split(/[#_]/);T.length>0&&(N["@language"]=T,T.match(n)||p.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:T}},options:p})),N["@direction"]=q}else D!==_&&(N["@type"]=D)}return N}return Yi}var Zi,fl;function Uf(){return fl||(fl=1,Zi=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])},"")+"}"}),Zi}var es,hl;function Hf(){if(hl)return es;hl=1;const{createNodeMap:r}=Mn(),{isKeyword:e}=Ut(),t=_t(),n=Uf(),i=rt(),s=Ke(),a=et(),{handleEvent:o}=Kr(),{RDF_FIRST:l,RDF_REST:d,RDF_NIL:h,RDF_TYPE:y,RDF_JSON_LITERAL:w,RDF_LANGSTRING:g,XSD_BOOLEAN:m,XSD_DOUBLE:_,XSD_INTEGER:x,XSD_STRING:S}=la(),{isAbsolute:I}=At(),b={};es=b,b.toRDF=(D,T)=>{const q=new a.IdentifierIssuer("_:b"),R={"@default":{}};r(D,R,"@default",q);const M=[],B=Object.keys(R).sort();for(const A of B){let j;if(A==="@default")j={termType:"DefaultGraph",value:""};else if(I(A))A.startsWith("_:")?j={termType:"BlankNode"}:j={termType:"NamedNode"},j.value=A;else{T.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:A}},options:T});continue}c(M,R[A],j,q,T)}return M};function c(D,T,q,R,M){const B=Object.keys(T).sort();for(const A of B){const j=T[A],Y=Object.keys(j).sort();for(let L of Y){const ee=j[L];if(L==="@type")L=y;else if(e(L))continue;for(const C of ee){const K={termType:A.startsWith("_:")?"BlankNode":"NamedNode",value:A};if(!I(A)){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:A}},options:M});continue}const v={termType:L.startsWith("_:")?"BlankNode":"NamedNode",value:L};if(!I(L)){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:L}},options:M});continue}if(v.termType==="BlankNode"&&!M.produceGeneralizedRdf){M.eventHandler&&o({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:R.getOldIds().find(Q=>R.getId(Q)===L)}},options:M});continue}const U=N(C,R,D,q,M.rdfDirection,M);U&&D.push({subject:K,predicate:v,object:U,graph:q})}}}}function p(D,T,q,R,M,B){const A={termType:"NamedNode",value:l},j={termType:"NamedNode",value:d},Y={termType:"NamedNode",value:h},L=D.pop(),ee=L?{termType:"BlankNode",value:T.getId()}:Y;let C=ee;for(const K of D){const v=N(K,T,q,R,M,B),U={termType:"BlankNode",value:T.getId()};q.push({subject:C,predicate:A,object:v,graph:R}),q.push({subject:C,predicate:j,object:U,graph:R}),C=U}if(L){const K=N(L,T,q,R,M,B);q.push({subject:C,predicate:A,object:K,graph:R}),q.push({subject:C,predicate:j,object:Y,graph:R})}return ee}function N(D,T,q,R,M,B){const A={};if(t.isValue(D)){A.termType="Literal",A.value=void 0,A.datatype={termType:"NamedNode"};let j=D["@value"];const Y=D["@type"]||null;if(Y==="@json")A.value=n(j),A.datatype.value=w;else if(s.isBoolean(j))A.value=j.toString(),A.datatype.value=Y||m;else if(s.isDouble(j)||Y===_)s.isDouble(j)||(j=parseFloat(j)),A.value=j.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),A.datatype.value=Y||_;else if(s.isNumber(j))A.value=j.toFixed(0),A.datatype.value=Y||x;else if("@direction"in D&&M==="i18n-datatype"){const L=(D["@language"]||"").toLowerCase(),ee=D["@direction"],C=`https://www.w3.org/ns/i18n#${L}_${ee}`;A.datatype.value=C,A.value=j}else{if("@direction"in D&&M==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:M});if("@direction"in D&&M)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:M});"@language"in D?("@direction"in D&&!M&&B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:B}),A.value=j,A.datatype.value=Y||g,A.language=D["@language"]):("@direction"in D&&!M&&B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:A.value}},options:B}),A.value=j,A.datatype.value=Y||S)}}else if(t.isList(D)){const j=p(D["@list"],T,q,R,M,B);A.termType=j.termType,A.value=j.value}else{const j=s.isObject(D)?D["@id"]:D;A.termType=j.startsWith("_:")?"BlankNode":"NamedNode",A.value=j}return A.termType==="NamedNode"&&!I(A.value)?(B.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:A.value}},options:B}),null):A}return es}var ts,pl;function Vf(){if(pl)return ts;pl=1;const{isKeyword:r}=Ut(),e=_t(),t=Ke(),n=et(),i=At(),s=rt(),{createNodeMap:a,mergeNodeMapGraphs:o}=Mn(),l={};ts=l,l.frameMergedOrDefault=(c,p,N)=>{const D={options:N,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},T=new n.IdentifierIssuer("_:b");a(c,D.graphMap,"@default",T),N.merged&&(D.graphMap["@merged"]=o(D.graphMap),D.graph="@merged"),D.subjects=D.graphMap[D.graph];const q=[];l.frame(D,Object.keys(D.subjects).sort(),p,q),N.pruneBlankNodeIdentifiers&&(N.bnodesToClear=Object.keys(D.bnodeMap).filter(R=>D.bnodeMap[R].length===1));// remove @preserve from results
299
+ return N.link={},x(q,N)},l.frame=(c,p,N,D,T=null)=>{w(N),N=N[0];const q=c.options,R={embed:y(N,q,"embed"),explicit:y(N,q,"explicit"),requireAll:y(N,q,"requireAll")};c.link.hasOwnProperty(c.graph)||(c.link[c.graph]={});const M=c.link[c.graph],B=g(c,p,N,R),A=Object.keys(B).sort();for(const j of A){const Y=B[j];if(T===null?c.uniqueEmbeds={[c.graph]:{}}:c.uniqueEmbeds[c.graph]=c.uniqueEmbeds[c.graph]||{},R.embed==="@link"&&j in M){S(D,T,M[j]);continue}const L={"@id":j};if(j.indexOf("_:")===0&&n.addValue(c.bnodeMap,j,L,{propertyIsArray:!0}),M[j]=L,(R.embed==="@first"||R.embed==="@last")&&c.is11)throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:N});if(!(!c.embedded&&c.uniqueEmbeds[c.graph].hasOwnProperty(j))){if(c.embedded&&(R.embed==="@never"||h(Y,c.graph,c.subjectStack))){S(D,T,L);continue}if(c.embedded&&(R.embed=="@first"||R.embed=="@once")&&c.uniqueEmbeds[c.graph].hasOwnProperty(j)){S(D,T,L);continue}if(R.embed==="@last"&&j in c.uniqueEmbeds[c.graph]&&_(c,j),c.uniqueEmbeds[c.graph][j]={parent:D,property:T},c.subjectStack.push({subject:Y,graph:c.graph}),j in c.graphMap){let ee=!1,C=null;"@graph"in N?(C=N["@graph"][0],ee=!(j==="@merged"||j==="@default"),t.isObject(C)||(C={})):(ee=c.graph!=="@merged",C={}),ee&&l.frame({...c,graph:j,embedded:!1},Object.keys(c.graphMap[j]).sort(),[C],L,"@graph")}"@included"in N&&l.frame({...c,embedded:!1},p,N["@included"],L,"@included");for(const ee of Object.keys(Y).sort()){if(r(ee)){if(L[ee]=n.clone(Y[ee]),ee==="@type")for(const C of Y["@type"])C.indexOf("_:")===0&&n.addValue(c.bnodeMap,C,L,{propertyIsArray:!0});continue}if(!(R.explicit&&!(ee in N)))for(const C of Y[ee]){const K=ee in N?N[ee]:d(R);if(e.isList(C)){const v=N[ee]&&N[ee][0]&&N[ee][0]["@list"]?N[ee][0]["@list"]:d(R),U={"@list":[]};S(L,ee,U);const Q=C["@list"];for(const z of Q)e.isSubjectReference(z)?l.frame({...c,embedded:!0},[z["@id"]],v,U,"@list"):S(U,"@list",n.clone(z))}else e.isSubjectReference(C)?l.frame({...c,embedded:!0},[C["@id"]],K,L,ee):b(K[0],C)&&S(L,ee,n.clone(C))}}for(const ee of Object.keys(N).sort()){if(ee==="@type"){if(!t.isObject(N[ee][0])||!("@default"in N[ee][0]))continue}else if(r(ee))continue;const C=N[ee][0]||{};if(!y(C,q,"omitDefault")&&!(ee in L)){let v="@null";"@default"in C&&(v=n.clone(C["@default"])),t.isArray(v)||(v=[v]),L[ee]=[{"@preserve":v}]}}for(const ee of Object.keys(N["@reverse"]||{}).sort()){const C=N["@reverse"][ee];for(const K of Object.keys(c.subjects))n.getValues(c.subjects[K],ee).some(U=>U["@id"]===j)&&(L["@reverse"]=L["@reverse"]||{},n.addValue(L["@reverse"],ee,[],{propertyIsArray:!0}),l.frame({...c,embedded:!0},[K],C,L["@reverse"][ee],T))}S(D,T,L),c.subjectStack.pop()}}},l.cleanupNull=(c,p)=>{if(t.isArray(c))return c.map(D=>l.cleanupNull(D,p)).filter(D=>D);if(c==="@null")return null;if(t.isObject(c)){if("@id"in c){const N=c["@id"];if(p.link.hasOwnProperty(N)){const D=p.link[N].indexOf(c);if(D!==-1)return p.link[N][D];p.link[N].push(c)}else p.link[N]=[c]}for(const N in c)c[N]=l.cleanupNull(c[N],p)}return c};function d(c){const p={};for(const N in c)c[N]!==void 0&&(p["@"+N]=[c[N]]);return[p]}function h(c,p,N){for(let D=N.length-1;D>=0;--D){const T=N[D];if(T.graph===p&&T.subject["@id"]===c["@id"])return!0}return!1}function y(c,p,N){const D="@"+N;let T=D in c?c[D][0]:p[N];if(N==="embed"){if(T===!0)T="@once";else if(T===!1)T="@never";else if(T!=="@always"&&T!=="@never"&&T!=="@link"&&T!=="@first"&&T!=="@last"&&T!=="@once")throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:c})}return T}function w(c){if(!t.isArray(c)||c.length!==1||!t.isObject(c[0]))throw new s("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:c});if("@id"in c[0]){for(const p of n.asArray(c[0]["@id"]))if(!(t.isObject(p)||i.isAbsolute(p))||t.isString(p)&&p.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:c})}if("@type"in c[0]){for(const p of n.asArray(c[0]["@type"]))if(!(t.isObject(p)||i.isAbsolute(p)||p==="@json")||t.isString(p)&&p.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:c})}}function g(c,p,N,D){const T={};for(const q of p){const R=c.graphMap[c.graph][q];m(c,R,N,D)&&(T[q]=R)}return T}function m(c,p,N,D){let T=!0,q=!1;for(const R in N){let M=!1;const B=n.getValues(p,R),A=n.getValues(N,R).length===0;if(R==="@id"){if(t.isEmptyObject(N["@id"][0]||{})?M=!0:N["@id"].length>=0&&(M=N["@id"].includes(B[0])),!D.requireAll)return M}else if(R==="@type"){if(T=!1,A){if(B.length>0)return!1;M=!0}else if(N["@type"].length===1&&t.isEmptyObject(N["@type"][0]))M=B.length>0;else for(const j of N["@type"])t.isObject(j)&&"@default"in j?M=!0:M=M||B.some(Y=>Y===j);if(!D.requireAll)return M}else{if(r(R))continue;{const j=n.getValues(N,R)[0];let Y=!1;if(j&&(w([j]),Y="@default"in j),T=!1,B.length===0&&Y)continue;if(B.length>0&&A)return!1;if(j===void 0){if(B.length>0)return!1;M=!0}else if(e.isList(j)){const L=j["@list"][0];if(e.isList(B[0])){const ee=B[0]["@list"];e.isValue(L)?M=ee.some(C=>b(L,C)):(e.isSubject(L)||e.isSubjectReference(L))&&(M=ee.some(C=>I(c,L,C,D)))}}else e.isValue(j)?M=B.some(L=>b(j,L)):e.isSubjectReference(j)?M=B.some(L=>I(c,j,L,D)):t.isObject(j)?M=B.length>0:M=!1}}if(!M&&D.requireAll)return!1;q=q||M}return T||q}function _(c,p){const N=c.uniqueEmbeds[c.graph],D=N[p],T=D.parent,q=D.property,R={"@id":p};if(t.isArray(T)){for(let B=0;B<T.length;++B)if(n.compareValues(T[B],R)){T[B]=R;break}}else{const B=t.isArray(T[q]);n.removeValue(T,q,R,{propertyIsArray:B}),n.addValue(T,q,R,{propertyIsArray:B})}const M=B=>{const A=Object.keys(N);for(const j of A)j in N&&t.isObject(N[j].parent)&&N[j].parent["@id"]===B&&(delete N[j],M(j))};M(p)}/**
301
300
  * Removes the @preserve keywords from expanded result of framing.
302
301
  *
303
302
  * @param input the framed, framed output.
@@ -305,7 +304,7 @@ return N.link={},x(q,N)},l.frame=(c,p,N,D,T=null)=>{w(N),N=N[0];const q=c.option
305
304
  *
306
305
  * @return the resulting output.
307
306
  */function x(c,p){if(t.isArray(c))return c.map(N=>x(N,p));if(t.isObject(c)){// remove @preserve
308
- if("@preserve"in c)return c["@preserve"][0];if(e.isValue(c))return c;if(e.isList(c))return c["@list"]=x(c["@list"],p),c;if("@id"in c){const N=c["@id"];if(p.link.hasOwnProperty(N)){const D=p.link[N].indexOf(c);if(D!==-1)return p.link[N][D];p.link[N].push(c)}else p.link[N]=[c]}for(const N in c){if(N==="@id"&&p.bnodesToClear.includes(c[N])){delete c["@id"];continue}c[N]=x(c[N],p)}}return c}function S(c,p,N){t.isObject(c)?r.addValue(c,p,N,{propertyIsArray:!0}):c.push(N)}function I(c,p,N,D){if(!("@id"in N))return!1;const T=c.subjects[N["@id"]];return T&&m(c,T,p,D)}function b(c,p){const N=p["@value"],D=p["@type"],T=p["@language"],q=c["@value"]?t.isArray(c["@value"])?c["@value"]:[c["@value"]]:[],R=c["@type"]?t.isArray(c["@type"])?c["@type"]:[c["@type"]]:[],M=c["@language"]?t.isArray(c["@language"])?c["@language"]:[c["@language"]]:[];return q.length===0&&R.length===0&&M.length===0?!0:!(!(q.includes(N)||t.isEmptyObject(q[0]))||!(!D&&R.length===0||R.includes(D)||D&&t.isEmptyObject(R[0]))||!(!T&&M.length===0||M.includes(T)||T&&t.isEmptyObject(M[0])))}return ts}var rs,yl;function Wf(){if(yl)return rs;yl=1;const n=rt(),{isArray:e,isObject:t,isString:r,isUndefined:i}=Ke(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:l,isSubjectReference:d}=_t(),{expandIri:h,getContextValue:y,isKeyword:w,process:g,processingMode:m}=Ut(),{removeBase:_,prependBase:x}=At(),{REGEX_KEYWORD:S,addValue:I,asArray:b,compareShortestLeast:c}=et(),p={};rs=p,p.compact=async({activeCtx:T,activeProperty:q=null,element:R,options:M={}})=>{if(e(R)){let A=[];for(let j=0;j<R.length;++j){const Y=await p.compact({activeCtx:T,activeProperty:q,element:R[j],options:M});Y!==null&&A.push(Y)}return M.compactArrays&&A.length===1&&(y(T,q,"@container")||[]).length===0&&(A=A[0]),A}const B=y(T,q,"@context");if(i(B)||(T=await g({activeCtx:T,localCtx:B,propagate:!0,overrideProtected:!0,options:M})),t(R)){if(M.link&&"@id"in R&&M.link.hasOwnProperty(R["@id"])){const v=M.link[R["@id"]];for(let U=0;U<v.length;++U)if(v[U].expanded===R)return v[U].compacted}if(a(R)||d(R)){const v=p.compactValue({activeCtx:T,activeProperty:q,value:R,options:M});return M.link&&d(R)&&(M.link.hasOwnProperty(R["@id"])||(M.link[R["@id"]]=[]),M.link[R["@id"]].push({expanded:R,compacted:v})),v}if(s(R)&&(y(T,q,"@container")||[]).includes("@list"))return p.compact({activeCtx:T,activeProperty:q,element:R["@list"],options:M});const A=q==="@reverse",j={},Y=T;!a(R)&&!d(R)&&(T=T.revertToPreviousContext());const L=y(Y,q,"@context");i(L)||(T=await g({activeCtx:T,localCtx:L,propagate:!0,overrideProtected:!0,options:M})),M.link&&"@id"in R&&(M.link.hasOwnProperty(R["@id"])||(M.link[R["@id"]]=[]),M.link[R["@id"]].push({expanded:R,compacted:j}));let ee=R["@type"]||[];ee.length>1&&(ee=Array.from(ee).sort());const C=T;for(const v of ee){const U=p.compactIri({activeCtx:C,iri:v,relativeTo:{vocab:!0}}),Q=y(Y,U,"@context");i(Q)||(T=await g({activeCtx:T,localCtx:Q,options:M,propagate:!1}))}const K=Object.keys(R).sort();for(const v of K){const U=R[v];if(v==="@id"){let Q=b(U).map(ae=>p.compactIri({activeCtx:T,iri:ae,relativeTo:{vocab:!1},base:M.base}));Q.length===1&&(Q=Q[0]);const z=p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});j[z]=Q;continue}if(v==="@type"){let Q=b(U).map(W=>p.compactIri({activeCtx:Y,iri:W,relativeTo:{vocab:!0}}));Q.length===1&&(Q=Q[0]);const z=p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}}),V=(y(T,z,"@container")||[]).includes("@set")&&m(T,1.1)||e(Q)&&U.length===0;I(j,z,Q,{propertyIsArray:V});continue}if(v==="@reverse"){const Q=await p.compact({activeCtx:T,activeProperty:"@reverse",element:U,options:M});for(const z in Q)if(T.mappings.has(z)&&T.mappings.get(z).reverse){const ae=Q[z],V=(y(T,z,"@container")||[]).includes("@set")||!M.compactArrays;I(j,z,ae,{propertyIsArray:V}),delete Q[z]}if(Object.keys(Q).length>0){const z=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,z,Q)}continue}if(v==="@preserve"){const Q=await p.compact({activeCtx:T,activeProperty:q,element:U,options:M});e(Q)&&Q.length===0||I(j,v,Q);continue}if(v==="@index"){if((y(T,q,"@container")||[]).includes("@index"))continue;const z=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,z,U);continue}if(v!=="@graph"&&v!=="@list"&&v!=="@included"&&w(v)){const Q=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,Q,U);continue}if(!e(U))throw new n("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(U.length===0){const Q=p.compactIri({activeCtx:T,iri:v,value:U,relativeTo:{vocab:!0},reverse:A}),z=T.mappings.has(Q)?T.mappings.get(Q)["@nest"]:null;let ae=j;z&&(D(T,z,M),t(j[z])||(j[z]={}),ae=j[z]),I(ae,Q,U,{propertyIsArray:!0})}for(const Q of U){const z=p.compactIri({activeCtx:T,iri:v,value:Q,relativeTo:{vocab:!0},reverse:A}),ae=T.mappings.has(z)?T.mappings.get(z)["@nest"]:null;let H=j;ae&&(D(T,ae,M),t(j[ae])||(j[ae]={}),H=j[ae]);const V=y(T,z,"@container")||[],W=o(Q),F=s(Q);let Z;F?Z=Q["@list"]:W&&(Z=Q["@graph"]);let te=await p.compact({activeCtx:T,activeProperty:z,element:F||W?Z:Q,options:M});if(F)if(e(te)||(te=[te]),!V.includes("@list"))te={[p.compactIri({activeCtx:T,iri:"@list",relativeTo:{vocab:!0}})]:te},"@index"in Q&&(te[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=Q["@index"]);else{I(H,z,te,{valueIsArray:!0,allowDuplicate:!0});continue}if(W)if(V.includes("@graph")&&(V.includes("@id")||V.includes("@index")&&l(Q))){let ce;H.hasOwnProperty(z)?ce=H[z]:H[z]=ce={};const fe=(V.includes("@id")?Q["@id"]:Q["@index"])||p.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}});I(ce,fe,te,{propertyIsArray:!M.compactArrays||V.includes("@set")})}else V.includes("@graph")&&l(Q)?(e(te)&&te.length>1&&(te={"@included":te}),I(H,z,te,{propertyIsArray:!M.compactArrays||V.includes("@set")})):(e(te)&&te.length===1&&M.compactArrays&&(te=te[0]),te={[p.compactIri({activeCtx:T,iri:"@graph",relativeTo:{vocab:!0}})]:te},"@id"in Q&&(te[p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]=Q["@id"]),"@index"in Q&&(te[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=Q["@index"]),I(H,z,te,{propertyIsArray:!M.compactArrays||V.includes("@set")}));else if(V.includes("@language")||V.includes("@index")||V.includes("@id")||V.includes("@type")){let ce;H.hasOwnProperty(z)?ce=H[z]:H[z]=ce={};let fe;if(V.includes("@language"))a(te)&&(te=te["@value"]),fe=Q["@language"];else if(V.includes("@index")){const O=y(T,z,"@index")||"@index",G=p.compactIri({activeCtx:T,iri:O,relativeTo:{vocab:!0}});if(O==="@index")fe=Q["@index"],delete te[G];else{let re;if([fe,...re]=b(te[O]||[]),!r(fe))fe=null;else switch(re.length){case 0:delete te[O];break;case 1:te[O]=re[0];break;default:te[O]=re;break}}}else if(V.includes("@id")){const O=p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});fe=te[O],delete te[O]}else if(V.includes("@type")){const O=p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}});let G;switch([fe,...G]=b(te[O]||[]),G.length){case 0:delete te[O];break;case 1:te[O]=G[0];break;default:te[O]=G;break}Object.keys(te).length===1&&"@id"in Q&&(te=await p.compact({activeCtx:T,activeProperty:z,element:{"@id":Q["@id"]},options:M}))}fe||(fe=p.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}})),I(ce,fe,te,{propertyIsArray:V.includes("@set")})}else{const ce=!M.compactArrays||V.includes("@set")||V.includes("@list")||e(te)&&te.length===0||v==="@list"||v==="@graph";I(H,z,te,{propertyIsArray:ce})}}}return j}return R},p.compactIri=({activeCtx:T,iri:q,value:R=null,relativeTo:M={vocab:!1},reverse:B=!1,base:A=null})=>{if(q===null)return q;T.isPropertyTermScoped&&T.previousContext&&(T=T.previousContext);const j=T.getInverse();if(w(q)&&q in j&&"@none"in j[q]&&"@type"in j[q]["@none"]&&"@none"in j[q]["@none"]["@type"])return j[q]["@none"]["@type"]["@none"];if(M.vocab&&q in j){const K=T["@language"]||"@none",v=[];t(R)&&"@index"in R&&!("@graph"in R)&&v.push("@index","@index@set"),t(R)&&"@preserve"in R&&(R=R["@preserve"][0]),o(R)?("@index"in R&&v.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R&&v.push("@graph@id","@graph@id@set"),v.push("@graph","@graph@set","@set"),"@index"in R||v.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R||v.push("@graph@id","@graph@id@set")):t(R)&&!a(R)&&v.push("@id","@id@set","@type","@set@type");let U="@language",Q="@null";if(B)U="@type",Q="@reverse",v.push("@set");else if(s(R)){"@index"in R||v.push("@list");const ae=R["@list"];if(ae.length===0)U="@any",Q="@none";else{let H=ae.length===0?K:null,V=null;for(let W=0;W<ae.length;++W){const F=ae[W];let Z="@none",te="@none";if(a(F))if("@direction"in F){const ce=(F["@language"]||"").toLowerCase(),fe=F["@direction"];Z=`${ce}_${fe}`}else"@language"in F?Z=F["@language"].toLowerCase():"@type"in F?te=F["@type"]:Z="@null";else te="@id";if(H===null?H=Z:Z!==H&&a(F)&&(H="@none"),V===null?V=te:te!==V&&(V="@none"),H==="@none"&&V==="@none")break}H=H||"@none",V=V||"@none",V!=="@none"?(U="@type",Q=V):Q=H}}else{if(a(R))if("@language"in R&&!("@index"in R)){v.push("@language","@language@set"),Q=R["@language"];const ae=R["@direction"];ae&&(Q=`${Q}_${ae}`)}else"@direction"in R&&!("@index"in R)?Q=`_${R["@direction"]}`:"@type"in R&&(U="@type",Q=R["@type"]);else U="@type",Q="@id";v.push("@set")}v.push("@none"),t(R)&&!("@index"in R)&&v.push("@index","@index@set"),a(R)&&Object.keys(R).length===1&&v.push("@language","@language@set");const z=N(T,q,R,v,U,Q);if(z!==null)return z}if(M.vocab&&"@vocab"in T){const K=T["@vocab"];if(q.indexOf(K)===0&&q!==K){const v=q.substr(K.length);if(!T.mappings.has(v))return v}}let Y=null;const L=[];let ee=T.fastCurieMap;const C=q.length-1;for(let K=0;K<C&&q[K]in ee;++K)ee=ee[q[K]],""in ee&&L.push(ee[""][0]);for(let K=L.length-1;K>=0;--K){const v=L[K],U=v.terms;for(const Q of U){const z=Q+":"+q.substr(v.iri.length);T.mappings.get(Q)._prefix&&(!T.mappings.has(z)||R===null&&T.mappings.get(z)["@id"]===q)&&(Y===null||c(z,Y)<0)&&(Y=z)}}if(Y!==null)return Y;for(const[K,v]of T.mappings)if(v&&v._prefix&&q.startsWith(K+":"))throw new n(`Absolute IRI "${q}" confused with prefix "${K}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:T});if(!M.vocab)if("@base"in T)if(T["@base"]){const K=_(x(A,T["@base"]),q);return S.test(K)?`./${K}`:K}else return q;else return _(A,q);return q},p.compactValue=({activeCtx:T,activeProperty:q,value:R,options:M})=>{if(a(R)){const Y=y(T,q,"@type"),L=y(T,q,"@language"),ee=y(T,q,"@direction"),C=y(T,q,"@container")||[],K="@index"in R&&!C.includes("@index");if(!K&&Y!=="@none"&&(R["@type"]===Y||"@language"in R&&R["@language"]===L&&"@direction"in R&&R["@direction"]===ee||"@language"in R&&R["@language"]===L||"@direction"in R&&R["@direction"]===ee))return R["@value"];const v=Object.keys(R).length,U=v===1||v===2&&"@index"in R&&!K,Q="@language"in T,z=r(R["@value"]),ae=T.mappings.has(q)&&T.mappings.get(q)["@language"]===null;if(U&&Y!=="@none"&&(!Q||!z||ae))return R["@value"];const H={};return K&&(H[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=R["@index"]),"@type"in R?H[p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}})]=p.compactIri({activeCtx:T,iri:R["@type"],relativeTo:{vocab:!0}}):"@language"in R&&(H[p.compactIri({activeCtx:T,iri:"@language",relativeTo:{vocab:!0}})]=R["@language"]),"@direction"in R&&(H[p.compactIri({activeCtx:T,iri:"@direction",relativeTo:{vocab:!0}})]=R["@direction"]),H[p.compactIri({activeCtx:T,iri:"@value",relativeTo:{vocab:!0}})]=R["@value"],H}const B=h(T,q,{vocab:!0},M),A=y(T,q,"@type"),j=p.compactIri({activeCtx:T,iri:R["@id"],relativeTo:{vocab:A==="@vocab"},base:M.base});return A==="@id"||A==="@vocab"||B==="@graph"?j:{[p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]:j}};function N(T,q,R,M,B,A){A===null&&(A="@null");const j=[];if((A==="@id"||A==="@reverse")&&t(R)&&"@id"in R){A==="@reverse"&&j.push("@reverse");const L=p.compactIri({activeCtx:T,iri:R["@id"],relativeTo:{vocab:!0}});T.mappings.has(L)&&T.mappings.get(L)&&T.mappings.get(L)["@id"]===R["@id"]?j.push.apply(j,["@vocab","@id"]):j.push.apply(j,["@id","@vocab"])}else{j.push(A);const L=j.find(ee=>ee.includes("_"));L&&j.push(L.replace(/^[^_]+_/,"_"))}j.push("@none");const Y=T.inverse[q];for(const L of M){if(!(L in Y))continue;const ee=Y[L][B];for(const C of j)if(C in ee)return ee[C]}return null}function D(T,q,R){if(h(T,q,{vocab:!0},R)!=="@nest")throw new n("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}return rs}var ns,ml;function zf(){return ml||(ml=1,ns=n=>{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,r){return arguments.length<2?Promise.reject(new TypeError("Could not compact, too few arguments.")):n.compact(t,r)},e.expand=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not expand, too few arguments.")):n.expand(t)},e.flatten=function(t){return arguments.length<1?Promise.reject(new TypeError("Could not flatten, too few arguments.")):n.flatten(t)},e}),ns}/**
307
+ if("@preserve"in c)return c["@preserve"][0];if(e.isValue(c))return c;if(e.isList(c))return c["@list"]=x(c["@list"],p),c;if("@id"in c){const N=c["@id"];if(p.link.hasOwnProperty(N)){const D=p.link[N].indexOf(c);if(D!==-1)return p.link[N][D];p.link[N].push(c)}else p.link[N]=[c]}for(const N in c){if(N==="@id"&&p.bnodesToClear.includes(c[N])){delete c["@id"];continue}c[N]=x(c[N],p)}}return c}function S(c,p,N){t.isObject(c)?n.addValue(c,p,N,{propertyIsArray:!0}):c.push(N)}function I(c,p,N,D){if(!("@id"in N))return!1;const T=c.subjects[N["@id"]];return T&&m(c,T,p,D)}function b(c,p){const N=p["@value"],D=p["@type"],T=p["@language"],q=c["@value"]?t.isArray(c["@value"])?c["@value"]:[c["@value"]]:[],R=c["@type"]?t.isArray(c["@type"])?c["@type"]:[c["@type"]]:[],M=c["@language"]?t.isArray(c["@language"])?c["@language"]:[c["@language"]]:[];return q.length===0&&R.length===0&&M.length===0?!0:!(!(q.includes(N)||t.isEmptyObject(q[0]))||!(!D&&R.length===0||R.includes(D)||D&&t.isEmptyObject(R[0]))||!(!T&&M.length===0||M.includes(T)||T&&t.isEmptyObject(M[0])))}return ts}var rs,gl;function Gf(){if(gl)return rs;gl=1;const r=rt(),{isArray:e,isObject:t,isString:n,isUndefined:i}=Ke(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:l,isSubjectReference:d}=_t(),{expandIri:h,getContextValue:y,isKeyword:w,process:g,processingMode:m}=Ut(),{removeBase:_,prependBase:x}=At(),{REGEX_KEYWORD:S,addValue:I,asArray:b,compareShortestLeast:c}=et(),p={};rs=p,p.compact=async({activeCtx:T,activeProperty:q=null,element:R,options:M={}})=>{if(e(R)){let A=[];for(let j=0;j<R.length;++j){const Y=await p.compact({activeCtx:T,activeProperty:q,element:R[j],options:M});Y!==null&&A.push(Y)}return M.compactArrays&&A.length===1&&(y(T,q,"@container")||[]).length===0&&(A=A[0]),A}const B=y(T,q,"@context");if(i(B)||(T=await g({activeCtx:T,localCtx:B,propagate:!0,overrideProtected:!0,options:M})),t(R)){if(M.link&&"@id"in R&&M.link.hasOwnProperty(R["@id"])){const v=M.link[R["@id"]];for(let U=0;U<v.length;++U)if(v[U].expanded===R)return v[U].compacted}if(a(R)||d(R)){const v=p.compactValue({activeCtx:T,activeProperty:q,value:R,options:M});return M.link&&d(R)&&(M.link.hasOwnProperty(R["@id"])||(M.link[R["@id"]]=[]),M.link[R["@id"]].push({expanded:R,compacted:v})),v}if(s(R)&&(y(T,q,"@container")||[]).includes("@list"))return p.compact({activeCtx:T,activeProperty:q,element:R["@list"],options:M});const A=q==="@reverse",j={},Y=T;!a(R)&&!d(R)&&(T=T.revertToPreviousContext());const L=y(Y,q,"@context");i(L)||(T=await g({activeCtx:T,localCtx:L,propagate:!0,overrideProtected:!0,options:M})),M.link&&"@id"in R&&(M.link.hasOwnProperty(R["@id"])||(M.link[R["@id"]]=[]),M.link[R["@id"]].push({expanded:R,compacted:j}));let ee=R["@type"]||[];ee.length>1&&(ee=Array.from(ee).sort());const C=T;for(const v of ee){const U=p.compactIri({activeCtx:C,iri:v,relativeTo:{vocab:!0}}),Q=y(Y,U,"@context");i(Q)||(T=await g({activeCtx:T,localCtx:Q,options:M,propagate:!1}))}const K=Object.keys(R).sort();for(const v of K){const U=R[v];if(v==="@id"){let Q=b(U).map(ae=>p.compactIri({activeCtx:T,iri:ae,relativeTo:{vocab:!1},base:M.base}));Q.length===1&&(Q=Q[0]);const z=p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});j[z]=Q;continue}if(v==="@type"){let Q=b(U).map(W=>p.compactIri({activeCtx:Y,iri:W,relativeTo:{vocab:!0}}));Q.length===1&&(Q=Q[0]);const z=p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}}),V=(y(T,z,"@container")||[]).includes("@set")&&m(T,1.1)||e(Q)&&U.length===0;I(j,z,Q,{propertyIsArray:V});continue}if(v==="@reverse"){const Q=await p.compact({activeCtx:T,activeProperty:"@reverse",element:U,options:M});for(const z in Q)if(T.mappings.has(z)&&T.mappings.get(z).reverse){const ae=Q[z],V=(y(T,z,"@container")||[]).includes("@set")||!M.compactArrays;I(j,z,ae,{propertyIsArray:V}),delete Q[z]}if(Object.keys(Q).length>0){const z=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,z,Q)}continue}if(v==="@preserve"){const Q=await p.compact({activeCtx:T,activeProperty:q,element:U,options:M});e(Q)&&Q.length===0||I(j,v,Q);continue}if(v==="@index"){if((y(T,q,"@container")||[]).includes("@index"))continue;const z=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,z,U);continue}if(v!=="@graph"&&v!=="@list"&&v!=="@included"&&w(v)){const Q=p.compactIri({activeCtx:T,iri:v,relativeTo:{vocab:!0}});I(j,Q,U);continue}if(!e(U))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(U.length===0){const Q=p.compactIri({activeCtx:T,iri:v,value:U,relativeTo:{vocab:!0},reverse:A}),z=T.mappings.has(Q)?T.mappings.get(Q)["@nest"]:null;let ae=j;z&&(D(T,z,M),t(j[z])||(j[z]={}),ae=j[z]),I(ae,Q,U,{propertyIsArray:!0})}for(const Q of U){const z=p.compactIri({activeCtx:T,iri:v,value:Q,relativeTo:{vocab:!0},reverse:A}),ae=T.mappings.has(z)?T.mappings.get(z)["@nest"]:null;let H=j;ae&&(D(T,ae,M),t(j[ae])||(j[ae]={}),H=j[ae]);const V=y(T,z,"@container")||[],W=o(Q),F=s(Q);let Z;F?Z=Q["@list"]:W&&(Z=Q["@graph"]);let te=await p.compact({activeCtx:T,activeProperty:z,element:F||W?Z:Q,options:M});if(F)if(e(te)||(te=[te]),!V.includes("@list"))te={[p.compactIri({activeCtx:T,iri:"@list",relativeTo:{vocab:!0}})]:te},"@index"in Q&&(te[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=Q["@index"]);else{I(H,z,te,{valueIsArray:!0,allowDuplicate:!0});continue}if(W)if(V.includes("@graph")&&(V.includes("@id")||V.includes("@index")&&l(Q))){let ce;H.hasOwnProperty(z)?ce=H[z]:H[z]=ce={};const fe=(V.includes("@id")?Q["@id"]:Q["@index"])||p.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}});I(ce,fe,te,{propertyIsArray:!M.compactArrays||V.includes("@set")})}else V.includes("@graph")&&l(Q)?(e(te)&&te.length>1&&(te={"@included":te}),I(H,z,te,{propertyIsArray:!M.compactArrays||V.includes("@set")})):(e(te)&&te.length===1&&M.compactArrays&&(te=te[0]),te={[p.compactIri({activeCtx:T,iri:"@graph",relativeTo:{vocab:!0}})]:te},"@id"in Q&&(te[p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]=Q["@id"]),"@index"in Q&&(te[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=Q["@index"]),I(H,z,te,{propertyIsArray:!M.compactArrays||V.includes("@set")}));else if(V.includes("@language")||V.includes("@index")||V.includes("@id")||V.includes("@type")){let ce;H.hasOwnProperty(z)?ce=H[z]:H[z]=ce={};let fe;if(V.includes("@language"))a(te)&&(te=te["@value"]),fe=Q["@language"];else if(V.includes("@index")){const O=y(T,z,"@index")||"@index",G=p.compactIri({activeCtx:T,iri:O,relativeTo:{vocab:!0}});if(O==="@index")fe=Q["@index"],delete te[G];else{let re;if([fe,...re]=b(te[O]||[]),!n(fe))fe=null;else switch(re.length){case 0:delete te[O];break;case 1:te[O]=re[0];break;default:te[O]=re;break}}}else if(V.includes("@id")){const O=p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}});fe=te[O],delete te[O]}else if(V.includes("@type")){const O=p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}});let G;switch([fe,...G]=b(te[O]||[]),G.length){case 0:delete te[O];break;case 1:te[O]=G[0];break;default:te[O]=G;break}Object.keys(te).length===1&&"@id"in Q&&(te=await p.compact({activeCtx:T,activeProperty:z,element:{"@id":Q["@id"]},options:M}))}fe||(fe=p.compactIri({activeCtx:T,iri:"@none",relativeTo:{vocab:!0}})),I(ce,fe,te,{propertyIsArray:V.includes("@set")})}else{const ce=!M.compactArrays||V.includes("@set")||V.includes("@list")||e(te)&&te.length===0||v==="@list"||v==="@graph";I(H,z,te,{propertyIsArray:ce})}}}return j}return R},p.compactIri=({activeCtx:T,iri:q,value:R=null,relativeTo:M={vocab:!1},reverse:B=!1,base:A=null})=>{if(q===null)return q;T.isPropertyTermScoped&&T.previousContext&&(T=T.previousContext);const j=T.getInverse();if(w(q)&&q in j&&"@none"in j[q]&&"@type"in j[q]["@none"]&&"@none"in j[q]["@none"]["@type"])return j[q]["@none"]["@type"]["@none"];if(M.vocab&&q in j){const K=T["@language"]||"@none",v=[];t(R)&&"@index"in R&&!("@graph"in R)&&v.push("@index","@index@set"),t(R)&&"@preserve"in R&&(R=R["@preserve"][0]),o(R)?("@index"in R&&v.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R&&v.push("@graph@id","@graph@id@set"),v.push("@graph","@graph@set","@set"),"@index"in R||v.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R||v.push("@graph@id","@graph@id@set")):t(R)&&!a(R)&&v.push("@id","@id@set","@type","@set@type");let U="@language",Q="@null";if(B)U="@type",Q="@reverse",v.push("@set");else if(s(R)){"@index"in R||v.push("@list");const ae=R["@list"];if(ae.length===0)U="@any",Q="@none";else{let H=ae.length===0?K:null,V=null;for(let W=0;W<ae.length;++W){const F=ae[W];let Z="@none",te="@none";if(a(F))if("@direction"in F){const ce=(F["@language"]||"").toLowerCase(),fe=F["@direction"];Z=`${ce}_${fe}`}else"@language"in F?Z=F["@language"].toLowerCase():"@type"in F?te=F["@type"]:Z="@null";else te="@id";if(H===null?H=Z:Z!==H&&a(F)&&(H="@none"),V===null?V=te:te!==V&&(V="@none"),H==="@none"&&V==="@none")break}H=H||"@none",V=V||"@none",V!=="@none"?(U="@type",Q=V):Q=H}}else{if(a(R))if("@language"in R&&!("@index"in R)){v.push("@language","@language@set"),Q=R["@language"];const ae=R["@direction"];ae&&(Q=`${Q}_${ae}`)}else"@direction"in R&&!("@index"in R)?Q=`_${R["@direction"]}`:"@type"in R&&(U="@type",Q=R["@type"]);else U="@type",Q="@id";v.push("@set")}v.push("@none"),t(R)&&!("@index"in R)&&v.push("@index","@index@set"),a(R)&&Object.keys(R).length===1&&v.push("@language","@language@set");const z=N(T,q,R,v,U,Q);if(z!==null)return z}if(M.vocab&&"@vocab"in T){const K=T["@vocab"];if(q.indexOf(K)===0&&q!==K){const v=q.substr(K.length);if(!T.mappings.has(v))return v}}let Y=null;const L=[];let ee=T.fastCurieMap;const C=q.length-1;for(let K=0;K<C&&q[K]in ee;++K)ee=ee[q[K]],""in ee&&L.push(ee[""][0]);for(let K=L.length-1;K>=0;--K){const v=L[K],U=v.terms;for(const Q of U){const z=Q+":"+q.substr(v.iri.length);T.mappings.get(Q)._prefix&&(!T.mappings.has(z)||R===null&&T.mappings.get(z)["@id"]===q)&&(Y===null||c(z,Y)<0)&&(Y=z)}}if(Y!==null)return Y;for(const[K,v]of T.mappings)if(v&&v._prefix&&q.startsWith(K+":"))throw new r(`Absolute IRI "${q}" confused with prefix "${K}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:T});if(!M.vocab)if("@base"in T)if(T["@base"]){const K=_(x(A,T["@base"]),q);return S.test(K)?`./${K}`:K}else return q;else return _(A,q);return q},p.compactValue=({activeCtx:T,activeProperty:q,value:R,options:M})=>{if(a(R)){const Y=y(T,q,"@type"),L=y(T,q,"@language"),ee=y(T,q,"@direction"),C=y(T,q,"@container")||[],K="@index"in R&&!C.includes("@index");if(!K&&Y!=="@none"&&(R["@type"]===Y||"@language"in R&&R["@language"]===L&&"@direction"in R&&R["@direction"]===ee||"@language"in R&&R["@language"]===L||"@direction"in R&&R["@direction"]===ee))return R["@value"];const v=Object.keys(R).length,U=v===1||v===2&&"@index"in R&&!K,Q="@language"in T,z=n(R["@value"]),ae=T.mappings.has(q)&&T.mappings.get(q)["@language"]===null;if(U&&Y!=="@none"&&(!Q||!z||ae))return R["@value"];const H={};return K&&(H[p.compactIri({activeCtx:T,iri:"@index",relativeTo:{vocab:!0}})]=R["@index"]),"@type"in R?H[p.compactIri({activeCtx:T,iri:"@type",relativeTo:{vocab:!0}})]=p.compactIri({activeCtx:T,iri:R["@type"],relativeTo:{vocab:!0}}):"@language"in R&&(H[p.compactIri({activeCtx:T,iri:"@language",relativeTo:{vocab:!0}})]=R["@language"]),"@direction"in R&&(H[p.compactIri({activeCtx:T,iri:"@direction",relativeTo:{vocab:!0}})]=R["@direction"]),H[p.compactIri({activeCtx:T,iri:"@value",relativeTo:{vocab:!0}})]=R["@value"],H}const B=h(T,q,{vocab:!0},M),A=y(T,q,"@type"),j=p.compactIri({activeCtx:T,iri:R["@id"],relativeTo:{vocab:A==="@vocab"},base:M.base});return A==="@id"||A==="@vocab"||B==="@graph"?j:{[p.compactIri({activeCtx:T,iri:"@id",relativeTo:{vocab:!0}})]:j}};function N(T,q,R,M,B,A){A===null&&(A="@null");const j=[];if((A==="@id"||A==="@reverse")&&t(R)&&"@id"in R){A==="@reverse"&&j.push("@reverse");const L=p.compactIri({activeCtx:T,iri:R["@id"],relativeTo:{vocab:!0}});T.mappings.has(L)&&T.mappings.get(L)&&T.mappings.get(L)["@id"]===R["@id"]?j.push.apply(j,["@vocab","@id"]):j.push.apply(j,["@id","@vocab"])}else{j.push(A);const L=j.find(ee=>ee.includes("_"));L&&j.push(L.replace(/^[^_]+_/,"_"))}j.push("@none");const Y=T.inverse[q];for(const L of M){if(!(L in Y))continue;const ee=Y[L][B];for(const C of j)if(C in ee)return ee[C]}return null}function D(T,q,R){if(h(T,q,{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 rs}var ns,yl;function Wf(){return yl||(yl=1,ns=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}),ns}/**
309
308
  * A JavaScript implementation of the JSON-LD API.
310
309
  *
311
310
  * @author Dave Longley
@@ -339,17 +338,17 @@ if("@preserve"in c)return c["@preserve"][0];if(e.isValue(c))return c;if(e.isList
339
338
  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
340
339
  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
341
340
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
342
- */var is,bl;function Jf(){if(bl)return is;bl=1;const n=la(),e=kf(),t=et(),r=Pf(),i=t.IdentifierIssuer,s=rt(),a=tc(),o=qf(),{expand:l}=Bf(),{flatten:d}=Ff(),{fromRDF:h}=Uf(),{toRDF:y}=Vf(),{frameMergedOrDefault:w,cleanupNull:g}=Gf(),{isArray:m,isObject:_,isString:x}=Ke(),{isSubjectReference:S}=_t(),{expandIri:I,getInitialContext:b,process:c,processingMode:p}=Ut(),{compact:N,compactIri:D}=Wf(),{createNodeMap:T,createMergedNodeMap:q,mergeNodeMaps:R}=Mn(),{logEventHandler:M,logWarningEventHandler:B,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:Y,strictEventHandler:L,unhandledEventHandler:ee}=Kr(),C=function(v){const U={},z=new a({max:100});v.compact=async function(H,V,W){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(V===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(H===null)return null;W=ae(W,{base:x(H)?H:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new r({sharedCache:z})}),W.link&&(W.skipExpansion=!0),W.compactToRelative||delete W.base;let F;W.skipExpansion?F=H:F=await v.expand(H,W);const Z=await v.processContext(b(W),V,W);let te=await N({activeCtx:Z,element:F,options:W});W.compactArrays&&!W.graph&&m(te)?te.length===1?te=te[0]:te.length===0&&(te={}):W.graph&&_(te)&&(te=[te]),_(V)&&"@context"in V&&(V=V["@context"]),V=t.clone(V),m(V)||(V=[V]);const ce=V;V=[];for(let O=0;O<ce.length;++O)(!_(ce[O])||Object.keys(ce[O]).length>0)&&V.push(ce[O]);const fe=V.length>0;if(V.length===1&&(V=V[0]),m(te)){const O=D({activeCtx:Z,iri:"@graph",relativeTo:{vocab:!0}}),G=te;te={},fe&&(te["@context"]=V),te[O]=G}else if(_(te)&&fe){const O=te;te={"@context":V};for(const G in O)te[G]=O[G]}return te},v.expand=async function(H,V){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");V=ae(V,{keepFreeFloatingNodes:!1,contextResolver:new r({sharedCache:z})});const W={},F=[];if("expandContext"in V){const fe=t.clone(V.expandContext);_(fe)&&"@context"in fe?W.expandContext=fe:W.expandContext={"@context":fe},F.push(W.expandContext)}let Z;if(!x(H))W.input=t.clone(H);else{const fe=await v.get(H,V);Z=fe.documentUrl,W.input=fe.document,fe.contextUrl&&(W.remoteContext={"@context":fe.contextUrl},F.push(W.remoteContext))}"base"in V||(V.base=Z||"");let te=b(V);for(const fe of F)te=await c({activeCtx:te,localCtx:fe,options:V});let ce=await l({activeCtx:te,element:W.input,options:V});return _(ce)&&"@graph"in ce&&Object.keys(ce).length===1?ce=ce["@graph"]:ce===null&&(ce=[]),m(ce)||(ce=[ce]),ce},v.flatten=async function(H,V,W){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof V=="function"?V=null:V=V||null,W=ae(W,{base:x(H)?H:"",contextResolver:new r({sharedCache:z})});const F=await v.expand(H,W),Z=d(F);return V===null?Z:(W.graph=!0,W.skipExpansion=!0,await v.compact(Z,V,W))},v.frame=async function(H,V,W){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(W=ae(W,{base:x(H)?H:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new r({sharedCache:z})}),x(V)){const ue=await v.get(V,W);if(V=ue.document,ue.contextUrl){let de=V["@context"];de?m(de)?de.push(ue.contextUrl):de=[de,ue.contextUrl]:de=ue.contextUrl,V["@context"]=de}}const F=V?V["@context"]||{}:{},Z=await v.processContext(b(W),F,W);W.hasOwnProperty("omitGraph")||(W.omitGraph=p(Z,1.1)),W.hasOwnProperty("pruneBlankNodeIdentifiers")||(W.pruneBlankNodeIdentifiers=p(Z,1.1));const te=await v.expand(H,W),ce={...W};ce.isFrame=!0,ce.keepFreeFloatingNodes=!0;const fe=await v.expand(V,ce),O=Object.keys(V).map(ue=>I(Z,ue,{vocab:!0}));ce.merged=!O.includes("@graph"),ce.is11=p(Z,1.1);const G=w(te,fe,ce);ce.graph=!W.omitGraph,ce.skipExpansion=!0,ce.link={},ce.framing=!0;let re=await v.compact(G,F,ce);return ce.link={},re=g(re,ce),re},v.link=async function(H,V,W){const F={};return V&&(F["@context"]=V),F["@embed"]="@link",v.frame(H,F,W)},v.normalize=v.canonize=async function(H,V){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(V=ae(V,{base:x(H)?H:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new r({sharedCache:z})}),"inputFormat"in V){if(V.inputFormat!=="application/n-quads"&&V.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const Z=o.parse(H);return n.canonize(Z,V)}const W={...V};delete W.format,W.produceGeneralizedRdf=!1;const F=await v.toRDF(H,W);return n.canonize(F,V)},v.fromRDF=async function(H,V){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");V=ae(V,{format:x(H)?"application/n-quads":void 0});const{format:W}=V;let{rdfParser:F}=V;if(W){if(F=F||U[W],!F)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:W})}else F=()=>H;const Z=await F(H);return h(Z,V)},v.toRDF=async function(H,V){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");V=ae(V,{base:x(H)?H:"",skipExpansion:!1,contextResolver:new r({sharedCache:z})});let W;V.skipExpansion?W=H:W=await v.expand(H,V);const F=y(W,V);if(V.format){if(V.format==="application/n-quads"||V.format==="application/nquads")return o.serialize(F);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:V.format})}return F},v.createNodeMap=async function(H,V){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");V=ae(V,{base:x(H)?H:"",contextResolver:new r({sharedCache:z})});const W=await v.expand(H,V);return q(W,V)},v.merge=async function(H,V,W){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!m(H))throw new TypeError('Could not merge, "docs" must be an array.');typeof V=="function"?V=null:V=V||null,W=ae(W,{contextResolver:new r({sharedCache:z})});const F=await Promise.all(H.map(ue=>{const de={...W};return v.expand(ue,de)}));let Z=!0;"mergeNodes"in W&&(Z=W.mergeNodes);const te=W.issuer||new i("_:b"),ce={"@default":{}};for(let ue=0;ue<F.length;++ue){const de=t.relabelBlankNodes(F[ue],{issuer:new i("_:b"+ue+"-")}),pe=Z||ue===0?ce:{"@default":{}};if(T(de,pe,"@default",te),pe!==ce)for(const X in pe){const le=pe[X];if(!(X in ce)){ce[X]=le;continue}const he=ce[X];for(const se in le)se in he||(he[se]=le[se])}}const fe=R(ce),O=[],G=Object.keys(fe).sort();for(let ue=0;ue<G.length;++ue){const de=fe[G[ue]];S(de)||O.push(de)}return V===null?O:(W.graph=!0,W.skipExpansion=!0,await v.compact(O,V,W))},Object.defineProperty(v,"documentLoader",{get:()=>v._documentLoader,set:H=>v._documentLoader=H}),v.documentLoader=async H=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:H})},v.get=async function(H,V){let W;typeof V.documentLoader=="function"?W=V.documentLoader:W=v.documentLoader;const F=await W(H);try{if(!F.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");x(F.document)&&(F.document=JSON.parse(F.document))}catch(Z){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:Z,remoteDoc:F})}return F},v.processContext=async function(H,V,W){return W=ae(W,{base:"",contextResolver:new r({sharedCache:z})}),V===null?b(W):(V=t.clone(V),_(V)&&"@context"in V||(V={"@context":V}),c({activeCtx:H,localCtx:V,options:W}))},v.getContextValue=Ut().getContextValue,v.documentLoaders={},v.useDocumentLoader=function(H){if(!(H in v.documentLoaders))throw new s('Unknown document loader type: "'+H+'"',"jsonld.UnknownDocumentLoader",{type:H});v.documentLoader=v.documentLoaders[H].apply(v,Array.prototype.slice.call(arguments,1))},v.registerRDFParser=function(H,V){U[H]=V},v.unregisterRDFParser=function(H){delete U[H]},v.registerRDFParser("application/n-quads",o.parse),v.registerRDFParser("application/nquads",o.parse),v.url=At(),v.logEventHandler=M,v.logWarningEventHandler=B,v.safeEventHandler=A,v.setDefaultEventHandler=j,v.strictEventHandler=L,v.unhandledEventHandler=ee,v.util=t,Object.assign(v,t),v.promises=v,v.RequestQueue=ec(),v.JsonLdProcessor=zf()(v),e.setupGlobals(v),e.setupDocumentLoaders(v);function ae(H,{documentLoader:V=v.documentLoader,...W}){if(H&&"compactionMap"in H)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(H&&"expansionMap"in H)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:V},W,H,{eventHandler:Y({options:H})})}return v},K=function(){return C(function(){return K()})};return C(K),is=K,is}var Qf=Jf();const ss={},as={};let Ms;class Xf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=Ms;this.config.prefixes={};const t=[];if(e||(e=new Fe,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",e,wn))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",e,ut,new Rs({blankNodePrefix:""}))),await Promise.all(t),!Ms&&e?.size==0&&this.config.attributes.valuesSubject){const r=[...e.getObjects(this.config.attributes.valuesSubject,Ue,ut),...e.getObjects(this.config.attributes.valuesSubject,Ts,ut)],i=[];for(const s of r){const a=this.toURL(s.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),i.push(this.importRDF(this.fetchRDF(a),e,wn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=e}async importRDF(e,t,r,i){const s=i||new Rs,a=async o=>{const l=[];await new Promise((d,h)=>{s.parse(o,(y,w,g)=>{if(y)return console.warn("failed parsing graph",r,y.message),h(y);if(w){if(t.add(new Nn(w.subject,w.predicate,w.object,r)),this.config.attributes.ignoreOwlImports===null&&Js.equals(w.predicate)){const m=this.toURL(w.object.value);m&&this.loadedExternalUrls.indexOf(m)<0&&(this.loadedExternalUrls.push(m),l.push(this.importRDF(this.fetchRDF(m),t,xe.namedNode(m),i)))}if(this.config.classInstanceProvider&&Qs.equals(w.predicate)){const m=w.object.value;if(this.loadedClasses.indexOf(m)<0){let _;m in as?_=as[m]:(_=this.config.classInstanceProvider(m),as[m]=_),this.loadedClasses.push(m),l.push(this.importRDF(_,t,r,i))}}return}g&&this.config.registerPrefixes(g),d(null)})});try{await Promise.allSettled(l)}catch(d){console.warn(d)}};if(e instanceof Promise&&(e=await e),e){try{e=await Qf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch{}await a(e)}}async fetchRDF(e){if(e in ss)return ss[e];const t=fetch(e,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(r=>r.text());return ss[e]=t,t}toURL(e){if(js(e))return e;if(this.config.prefixes){const t=e.split(":");if(t.length===2){const r=this.config.prefixes[t[0]];if(r&&(e=e.replace(`${t[0]}:`,r),js(e)))return e}}return null}}function Kf(n){Ms=n}class os{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.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class wl{constructor(e,t){this.attributes=new os,this.loader=new Xf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new Fe,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(r=>r.length>2?[r.toLocaleLowerCase(),r.substring(0,2)]:r)),""]}updateAttributes(e){const t=new os;if(Object.keys(t).forEach(r=>{const i=e.dataset[r];i!==void 0&&(t[r]=i)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const r=this.languages.indexOf(t.language);r>-1&&this.languages.splice(r,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=xe.namedNode(t.valuesGraph))}static dataAttributes(){const e=new os;return Object.keys(e).map(t=>(t=t.replace(/[A-Z]/g,r=>"-"+r.toLowerCase()),"data-"+t))}get store(){return this._store}set store(e){this._store=e,this.lists=e.extractLists(),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},Ue,`${be}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}function Yf(n){return"_:"+n.value}function Zf(n,e){return[...n].map(t=>e(t)).join(`
341
+ */var is,ml;function zf(){if(ml)return is;ml=1;const r=oa(),e=$f(),t=et(),n=Cf(),i=t.IdentifierIssuer,s=rt(),a=ec(),o=Pf(),{expand:l}=qf(),{flatten:d}=Bf(),{fromRDF:h}=Ff(),{toRDF:y}=Hf(),{frameMergedOrDefault:w,cleanupNull:g}=Vf(),{isArray:m,isObject:_,isString:x}=Ke(),{isSubjectReference:S}=_t(),{expandIri:I,getInitialContext:b,process:c,processingMode:p}=Ut(),{compact:N,compactIri:D}=Gf(),{createNodeMap:T,createMergedNodeMap:q,mergeNodeMaps:R}=Mn(),{logEventHandler:M,logWarningEventHandler:B,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:Y,strictEventHandler:L,unhandledEventHandler:ee}=Kr(),C=function(v){const U={},z=new a({max:100});v.compact=async function(H,V,W){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(V===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(H===null)return null;W=ae(W,{base:x(H)?H:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:z})}),W.link&&(W.skipExpansion=!0),W.compactToRelative||delete W.base;let F;W.skipExpansion?F=H:F=await v.expand(H,W);const Z=await v.processContext(b(W),V,W);let te=await N({activeCtx:Z,element:F,options:W});W.compactArrays&&!W.graph&&m(te)?te.length===1?te=te[0]:te.length===0&&(te={}):W.graph&&_(te)&&(te=[te]),_(V)&&"@context"in V&&(V=V["@context"]),V=t.clone(V),m(V)||(V=[V]);const ce=V;V=[];for(let O=0;O<ce.length;++O)(!_(ce[O])||Object.keys(ce[O]).length>0)&&V.push(ce[O]);const fe=V.length>0;if(V.length===1&&(V=V[0]),m(te)){const O=D({activeCtx:Z,iri:"@graph",relativeTo:{vocab:!0}}),G=te;te={},fe&&(te["@context"]=V),te[O]=G}else if(_(te)&&fe){const O=te;te={"@context":V};for(const G in O)te[G]=O[G]}return te},v.expand=async function(H,V){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");V=ae(V,{keepFreeFloatingNodes:!1,contextResolver:new n({sharedCache:z})});const W={},F=[];if("expandContext"in V){const fe=t.clone(V.expandContext);_(fe)&&"@context"in fe?W.expandContext=fe:W.expandContext={"@context":fe},F.push(W.expandContext)}let Z;if(!x(H))W.input=t.clone(H);else{const fe=await v.get(H,V);Z=fe.documentUrl,W.input=fe.document,fe.contextUrl&&(W.remoteContext={"@context":fe.contextUrl},F.push(W.remoteContext))}"base"in V||(V.base=Z||"");let te=b(V);for(const fe of F)te=await c({activeCtx:te,localCtx:fe,options:V});let ce=await l({activeCtx:te,element:W.input,options:V});return _(ce)&&"@graph"in ce&&Object.keys(ce).length===1?ce=ce["@graph"]:ce===null&&(ce=[]),m(ce)||(ce=[ce]),ce},v.flatten=async function(H,V,W){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof V=="function"?V=null:V=V||null,W=ae(W,{base:x(H)?H:"",contextResolver:new n({sharedCache:z})});const F=await v.expand(H,W),Z=d(F);return V===null?Z:(W.graph=!0,W.skipExpansion=!0,await v.compact(Z,V,W))},v.frame=async function(H,V,W){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(W=ae(W,{base:x(H)?H:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:z})}),x(V)){const ue=await v.get(V,W);if(V=ue.document,ue.contextUrl){let de=V["@context"];de?m(de)?de.push(ue.contextUrl):de=[de,ue.contextUrl]:de=ue.contextUrl,V["@context"]=de}}const F=V?V["@context"]||{}:{},Z=await v.processContext(b(W),F,W);W.hasOwnProperty("omitGraph")||(W.omitGraph=p(Z,1.1)),W.hasOwnProperty("pruneBlankNodeIdentifiers")||(W.pruneBlankNodeIdentifiers=p(Z,1.1));const te=await v.expand(H,W),ce={...W};ce.isFrame=!0,ce.keepFreeFloatingNodes=!0;const fe=await v.expand(V,ce),O=Object.keys(V).map(ue=>I(Z,ue,{vocab:!0}));ce.merged=!O.includes("@graph"),ce.is11=p(Z,1.1);const G=w(te,fe,ce);ce.graph=!W.omitGraph,ce.skipExpansion=!0,ce.link={},ce.framing=!0;let re=await v.compact(G,F,ce);return ce.link={},re=g(re,ce),re},v.link=async function(H,V,W){const F={};return V&&(F["@context"]=V),F["@embed"]="@link",v.frame(H,F,W)},v.normalize=v.canonize=async function(H,V){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(V=ae(V,{base:x(H)?H:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:z})}),"inputFormat"in V){if(V.inputFormat!=="application/n-quads"&&V.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const Z=o.parse(H);return r.canonize(Z,V)}const W={...V};delete W.format,W.produceGeneralizedRdf=!1;const F=await v.toRDF(H,W);return r.canonize(F,V)},v.fromRDF=async function(H,V){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");V=ae(V,{format:x(H)?"application/n-quads":void 0});const{format:W}=V;let{rdfParser:F}=V;if(W){if(F=F||U[W],!F)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:W})}else F=()=>H;const Z=await F(H);return h(Z,V)},v.toRDF=async function(H,V){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");V=ae(V,{base:x(H)?H:"",skipExpansion:!1,contextResolver:new n({sharedCache:z})});let W;V.skipExpansion?W=H:W=await v.expand(H,V);const F=y(W,V);if(V.format){if(V.format==="application/n-quads"||V.format==="application/nquads")return o.serialize(F);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:V.format})}return F},v.createNodeMap=async function(H,V){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");V=ae(V,{base:x(H)?H:"",contextResolver:new n({sharedCache:z})});const W=await v.expand(H,V);return q(W,V)},v.merge=async function(H,V,W){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!m(H))throw new TypeError('Could not merge, "docs" must be an array.');typeof V=="function"?V=null:V=V||null,W=ae(W,{contextResolver:new n({sharedCache:z})});const F=await Promise.all(H.map(ue=>{const de={...W};return v.expand(ue,de)}));let Z=!0;"mergeNodes"in W&&(Z=W.mergeNodes);const te=W.issuer||new i("_:b"),ce={"@default":{}};for(let ue=0;ue<F.length;++ue){const de=t.relabelBlankNodes(F[ue],{issuer:new i("_:b"+ue+"-")}),pe=Z||ue===0?ce:{"@default":{}};if(T(de,pe,"@default",te),pe!==ce)for(const X in pe){const le=pe[X];if(!(X in ce)){ce[X]=le;continue}const he=ce[X];for(const se in le)se in he||(he[se]=le[se])}}const fe=R(ce),O=[],G=Object.keys(fe).sort();for(let ue=0;ue<G.length;++ue){const de=fe[G[ue]];S(de)||O.push(de)}return V===null?O:(W.graph=!0,W.skipExpansion=!0,await v.compact(O,V,W))},Object.defineProperty(v,"documentLoader",{get:()=>v._documentLoader,set:H=>v._documentLoader=H}),v.documentLoader=async H=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:H})},v.get=async function(H,V){let W;typeof V.documentLoader=="function"?W=V.documentLoader:W=v.documentLoader;const F=await W(H);try{if(!F.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");x(F.document)&&(F.document=JSON.parse(F.document))}catch(Z){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:Z,remoteDoc:F})}return F},v.processContext=async function(H,V,W){return W=ae(W,{base:"",contextResolver:new n({sharedCache:z})}),V===null?b(W):(V=t.clone(V),_(V)&&"@context"in V||(V={"@context":V}),c({activeCtx:H,localCtx:V,options:W}))},v.getContextValue=Ut().getContextValue,v.documentLoaders={},v.useDocumentLoader=function(H){if(!(H in v.documentLoaders))throw new s('Unknown document loader type: "'+H+'"',"jsonld.UnknownDocumentLoader",{type:H});v.documentLoader=v.documentLoaders[H].apply(v,Array.prototype.slice.call(arguments,1))},v.registerRDFParser=function(H,V){U[H]=V},v.unregisterRDFParser=function(H){delete U[H]},v.registerRDFParser("application/n-quads",o.parse),v.registerRDFParser("application/nquads",o.parse),v.url=At(),v.logEventHandler=M,v.logWarningEventHandler=B,v.safeEventHandler=A,v.setDefaultEventHandler=j,v.strictEventHandler=L,v.unhandledEventHandler=ee,v.util=t,Object.assign(v,t),v.promises=v,v.RequestQueue=Zu(),v.JsonLdProcessor=Wf()(v),e.setupGlobals(v),e.setupDocumentLoaders(v);function ae(H,{documentLoader:V=v.documentLoader,...W}){if(H&&"compactionMap"in H)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(H&&"expansionMap"in H)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:V},W,H,{eventHandler:Y({options:H})})}return v},K=function(){return C(function(){return K()})};return C(K),is=K,is}var Jf=zf();const ss={},as={};let Ds;class Qf{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[];let e=Ds;this.config.prefixes={};const t=[];if(e||(e=new Fe,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",e,wn))),t.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",e,ut,new Rs({blankNodePrefix:""}))),await Promise.all(t),!Ds&&e?.size==0&&this.config.attributes.valuesSubject){const n=[...e.getObjects(this.config.attributes.valuesSubject,Ue,ut),...e.getObjects(this.config.attributes.valuesSubject,Ts,ut)],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),e,wn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=e}async importRDF(e,t,n,i){const s=i||new Rs,a=async o=>{const l=[];await new Promise((d,h)=>{s.parse(o,(y,w,g)=>{if(y)return console.warn("failed parsing graph",n,y.message),h(y);if(w){if(t.add(new Nn(w.subject,w.predicate,w.object,n)),this.config.attributes.ignoreOwlImports===null&&zs.equals(w.predicate)){const m=this.toURL(w.object.value);m&&this.loadedExternalUrls.indexOf(m)<0&&(this.loadedExternalUrls.push(m),l.push(this.importRDF(this.fetchRDF(m),t,xe.namedNode(m),i)))}if(this.config.classInstanceProvider&&Js.equals(w.predicate)){const m=w.object.value;if(this.loadedClasses.indexOf(m)<0){let _;m in as?_=as[m]:(_=this.config.classInstanceProvider(m),as[m]=_),this.loadedClasses.push(m),l.push(this.importRDF(_,t,n,i))}}return}g&&this.config.registerPrefixes(g),d(null)})});try{await Promise.allSettled(l)}catch(d){console.warn(d)}};if(e instanceof Promise&&(e=await e),e){try{e=await Jf.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch{}await a(e)}}async fetchRDF(e){if(e in ss)return ss[e];const t=fetch(e,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(n=>n.text());return ss[e]=t,t}toURL(e){if(Ls(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),Ls(e)))return e}}return null}}function Xf(r){Ds=r}class os{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.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class bl{constructor(e,t){this.attributes=new os,this.loader=new Qf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new Fe,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 os;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=xe.namedNode(t.valuesGraph))}static dataAttributes(){const e=new os;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=e.extractLists(),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},Ue,`${be}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}function Kf(r){return"_:"+r.value}function Yf(r,e){return[...r].map(t=>e(t)).join(`
343
342
  `)+`
344
- `}function eh(){return""}function rc(n){return"<"+n.value+">"}const th=/["\\\\\n\r]/,rh=/["\\\\\n\r]/g,nh={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function ih(n){return nh[n]}function sh(n){return th.test(n)?n.replace(rh,ih):n}function ah(n){const e=sh(n.value);return n.datatype.value==="http://www.w3.org/2001/XMLSchema#string"?'"'+e+'"':n.datatype.value==="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"?'"'+e+'"@'+n.language:'"'+e+'"^^'+rc(n.datatype)}function oh(n,e){const t=e(n.subject),r=e(n.predicate),i=e(n.object),s=e(n.graph);return`${t} ${r} ${i} ${s?s+" ":""}.`}function lh(n){return"?"+n.value}function Je(n){if(!n)return null;if(n.termType==="BlankNode")return Yf(n);if(n.termType==="DefaultGraph")return eh();if(n.termType==="Literal")return ah(n);if(n.termType==="NamedNode")return rc(n);if(n.termType==="Quad"||n.subject&&n.predicate&&n.object&&n.graph)return oh(n,Je);if(n.termType==="Variable")return lh(n);if(n[Symbol.iterator])return Zf(n,Je);throw new Error(`unknown termType ${n.termType}`)}class cr{constructor(e){if(this.index=new Map,e)for(const[t,r]of e)this.set(t,r)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(Je(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const r of this.entries())e.call(t,r[1],r[0],this)}get(e){const t=this.index.get(Je(e));return t&&t.value}has(e){return this.index.has(Je(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const r=Je(e);return this.index.set(r,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class vl{constructor({dataset:e,end:t,quad:r,start:i}){this.dataset=e,this.end=t,this.quad=r,this.start=i}get term(){return this.quad[this.end]}get graph(){return this.quad.graph}get startTerm(){return this.quad[this.start]}}function _l(n){try{return Je(n)}catch{return null}}class tt{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=Je(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(_l(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(_l(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}let nc=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};nc.prototype.termType="BlankNode";let ca=class{equals(e){return!!e&&e.termType===this.termType}};ca.prototype.termType="DefaultGraph";ca.prototype.value="";function xl(n,e){if(!e)return null;if(e.termType==="BlankNode")return n.blankNode(e.value);if(e.termType==="DefaultGraph")return n.defaultGraph();if(e.termType==="Literal")return n.literal(e.value,e.language||n.namedNode(e.datatype.value));if(e.termType==="NamedNode")return n.namedNode(e.value);if(e.termType==="Quad"){const t=n.fromTerm(e.subject),r=n.fromTerm(e.predicate),i=n.fromTerm(e.object),s=n.fromTerm(e.graph);return n.quad(t,r,i,s)}if(e.termType==="Variable")return n.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}let mn=class{constructor(e,t,r,i=""){this.value=e,this.language=t,this.datatype=r,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}};mn.prototype.termType="Literal";let Yr=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Yr.prototype.termType="NamedNode";let da=class{constructor(e,t,r,i){this.subject=e,this.predicate=t,this.object=r,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)}};da.prototype.termType="Quad";da.prototype.value="";let ic=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};ic.prototype.termType="Variable";const uh=new Yr("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),Sl=new Yr("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),ch=new Yr("http://www.w3.org/2001/XMLSchema#string");let sc=class{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new ca}}namedNode(e){return new Yr(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new nc(e)}literal(e,t){return typeof t=="string"?new mn(e,t,Sl):typeof t?.language=="string"?new mn(e,t.language,t.direction?uh:Sl,t.direction):new mn(e,"",t||ch)}variable(e){return new ic(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,r,i=this.defaultGraph()){return new da(e,t,r,i)}fromTerm(e){return xl(this,e)}fromQuad(e){return xl(this,e)}};sc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const fa=new sc,dh={apply:(n,e,t)=>n(t[0]),get:(n,e)=>n(e)};function nt(n,{factory:e=fa}={}){const t=(r="")=>e.namedNode(`${n}${r.raw||r}`);return typeof Proxy>"u"?t:new Proxy(t,dh)}nt("http://www.w3.org/2001/XMLSchema#");const ot=nt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");nt("http://www.w3.org/2000/01/rdf-schema#");class Ne{static add({ptr:e,start:t,end:r,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:l}={}){if(!e.factory)throw new Error("add operation requires a factory");let d=()=>{};l&&(d=h=>{l(new vl({dataset:e.dataset,start:t,end:r,quad:h}))});for(const h of i)for(const y of s)for(const w of a)for(const g of o){const m={subject:h,predicate:y,object:w,graph:g};m[t]=e.term;const _=e.factory.quad(m.subject,m.predicate,m.object,m.graph);e.dataset.add(_),d(_)}return e}static addList({ptr:e,predicates:t,items:r,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=r.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,o[0]||ot.nil,a));for(let l=0;l<o.length;l++)e.dataset.add(e.factory.quad(o[l],ot.first,r[l],a)),e.dataset.add(e.factory.quad(o[l],ot.rest,o[l+1]||ot.nil,a))}return e}static delete({ptr:e,start:t,subjects:r=[null],predicates:i=[null],objects:s=[null]}){for(const a of r)for(const o of i)for(const l of s){const d={subject:a,predicate:o,object:l};d[t]=e.term;const h=e.dataset.match(d.subject,d.predicate,d.object);for(const y of h)e.dataset.delete(y)}return e}static deleteList({ptr:e,predicates:t}){const r=[];for(const i of t)for(const s of e.dataset.match(e.term,i)){let a=s.object;for(r.push(s);!ot.nil.equals(a);){a=r[r.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const l of o)r.push(l)}}for(const i of r)e.dataset.delete(i);return e}static execute({ptr:e,operation:t="traverse",quantifier:r,start:i,end:s,subjects:a,predicates:o,objects:l,graphs:d,items:h,callback:y}={}){if(t==="add")return Ne.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:l,graphs:d,callback:y});if(t==="addList")return Ne.addList({ptr:e,predicates:o,items:h,graphs:d});if(t==="delete")return Ne.delete({ptr:e,start:i,subjects:a,predicates:o,objects:l});if(t==="deleteList")return Ne.deleteList({ptr:e,predicates:o});if(t==="isList")return Ne.isList({ptr:e});if(t==="list")return Ne.list({ptr:e});if(t==="traverse")return Ne.traverse({ptr:e,quantifier:r,start:i,end:s,subjects:a,predicates:o,objects:l,graphs:d});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(ot.nil.equals(e.term)||Ne.traverse({ptr:e,predicates:[ot.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(ot.nil);){const t=e.out([ot.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const r=e.out([ot.rest]);if(r.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=r[0]}}}}static traverse({ptr:e,quantifier:t="one",start:r="subject",end:i="object",subjects:s=[null],predicates:a=[null],objects:o=[null],graphs:l=[null],callback:d}){if(t==="one")return Ne.traverseOne({ptr:e,start:r,end:i,subjects:s,predicates:a,objects:o,graphs:l,callback:d});if(t==="oneOrMore"){const h=Ne.traverse({ptr:e,end:i,start:r,subjects:s,predicates:a,objects:o,graphs:l,callback:d});return Ne.traverseMore({ptrs:h,end:i,start:r,subjects:s,predicates:a,objects:o,graphs:l,callback:d})}if(t==="zeroOrMore")return Ne.traverseMore({ptrs:[e],end:i,start:r,subjects:s,predicates:a,objects:o,graphs:l,callback:d});if(t==="zeroOrOne")return[e,...Ne.traverse({ptr:e,end:i,start:r,subjects:s,predicates:a,objects:o,graphs:l,callback:d})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:r,subjects:i,predicates:s,objects:a,graphs:o,callback:l}={}){let d=[...e],h,y;do{h=[];for(const w of e)h=[...h,...Ne.traverseOne({ptr:w,end:t,start:r,subjects:i,predicates:s,objects:a,graphs:o,callback:l})];y&&(h=h.filter(w=>!y.has(w.term))),e=h,d=[...d,...h],y=new tt(d.map(w=>w.term))}while(h.length>0);return d}static traverseOne({ptr:e,start:t,end:r,subjects:i,predicates:s,objects:a,graphs:o,callback:l=(d,h)=>h.extend(d)}={}){const d=[];for(const h of i)for(const y of s)for(const w of a)for(const g of o){const m={subject:h,predicate:y,object:w,graph:g};m[t]=e.term;for(const _ of e.dataset.match(m.subject,m.predicate,m.object,m.graph))d.push(l(new vl({dataset:e.dataset,end:r,quad:_,start:t}),e))}return d}}function El(n,e){return e?t=>e(n.extend(t)):()=>{}}class Il{constructor({dataset:e,edges:t=[],factory:r,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=r,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,r){return Ne.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:El(this,r)})}addList(e,t){return Ne.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,r){return Ne.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:El(this,r)})}deleteIn(e,t){return Ne.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Ne.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Ne.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:r,end:i,subjects:s,predicates:a,objects:o,graphs:l,items:d,callback:h}){return Ne.execute({ptr:this,operation:e,quantifier:t,start:r,end:i,subjects:s,predicates:a,objects:o,graphs:l,items:d,callback:h})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Ne.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Ne.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Ne.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Ne.isList({ptr:this})}list(){return Ne.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 Ne.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 Rl(n,e){return n?n.equals(e):n===e}function fh(n,e){return!(n.dataset!==e.dataset||!Rl(n.graph,e.graph)||!Rl(n.term,e.term))}function Nl(n,e){return e?t=>e(new n.constructor({factory:n.factory,ptrs:[t]})):()=>{}}class En{constructor({dataset:e,factory:t,ptrs:r,terms:i,graphs:s}){if(this.factory=t,r)this.ptrs=[...r];else{this.ptrs=[];for(const a of i||[null])for(const o of s||[null])this.ptrs.push(new Il({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 tt(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,r){const i=Nl(this,r);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 r of this.ptrs)r.addList(e,t);return this}addOut(e,t,r){const i=Nl(this,r);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 r of this.ptrs)r.deleteIn(e,t);return this}deleteList(e){for(const t of this.ptrs)t.deleteList(e);return this}deleteOut(e,t){for(const r of this.ptrs)r.deleteOut(e,t);return this}distinct(){const e=this.ptrs.reduce((t,r)=>(t.some(i=>fh(i,r))||t.push(r.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 r of e)t=t.execute(r);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(r=>r.hasIn(e,t))})}hasOut(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.hasOut(e,t))})}in(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.in(e,t))})}isAny(){return this.ptrs.length>0&&this.ptrs.some(e=>e.isAny())}isList(){return 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 r of e)yield t.clone({ptrs:[r]})}()}map(e){return[...this].map(e)}node(e){const t=this.dataset,r=[...e].map(i=>new Il({dataset:t,factory:this.factory,term:i}));return this.clone({ptrs:r})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(r=>r.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]})}}nt("http://www.w3.org/2002/07/owl#");const Ht=nt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),hh=nt("http://www.w3.org/2000/01/rdf-schema#"),ne=nt("http://www.w3.org/ns/shacl#"),Cs=nt("https://schemas.link/shacl-next#"),ha=nt("http://www.w3.org/2001/XMLSchema#");function ph(n){return n?`{${[...n.quads()].map(e=>Je(e)).join(" ")}}`:"{}"}function gh(n){return n?`{${n.map(e=>ph(e)).join(" ")}}`:"{}"}var ls,Tl;function yh(){if(Tl)return ls;Tl=1;var n=/\s/;function e(t){for(var r=t.length;r--&&n.test(t.charAt(r)););return r}return ls=e,ls}var us,Al;function mh(){if(Al)return us;Al=1;var n=yh(),e=/^\s+/;function t(r){return r&&r.slice(0,n(r)+1).replace(e,"")}return us=t,us}var cs,Ll;function bh(){if(Ll)return cs;Ll=1;function n(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return cs=n,cs}var ds,jl;function wh(){if(jl)return ds;jl=1;var n=typeof Zt=="object"&&Zt&&Zt.Object===Object&&Zt;return ds=n,ds}var fs,Ol;function vh(){if(Ol)return fs;Ol=1;var n=wh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=n||e||Function("return this")();return fs=t,fs}var hs,$l;function ac(){if($l)return hs;$l=1;var n=vh(),e=n.Symbol;return hs=e,hs}var ps,kl;function _h(){if(kl)return ps;kl=1;var n=ac(),e=Object.prototype,t=e.hasOwnProperty,r=e.toString,i=n?n.toStringTag:void 0;function s(a){var o=t.call(a,i),l=a[i];try{a[i]=void 0;var d=!0}catch{}var h=r.call(a);return d&&(o?a[i]=l:delete a[i]),h}return ps=s,ps}var gs,Dl;function xh(){if(Dl)return gs;Dl=1;var n=Object.prototype,e=n.toString;function t(r){return e.call(r)}return gs=t,gs}var ys,Ml;function Sh(){if(Ml)return ys;Ml=1;var n=ac(),e=_h(),t=xh(),r="[object Null]",i="[object Undefined]",s=n?n.toStringTag:void 0;function a(o){return o==null?o===void 0?i:r:s&&s in Object(o)?e(o):t(o)}return ys=a,ys}var ms,Cl;function Eh(){if(Cl)return ms;Cl=1;function n(e){return e!=null&&typeof e=="object"}return ms=n,ms}var bs,Pl;function Ih(){if(Pl)return bs;Pl=1;var n=Sh(),e=Eh(),t="[object Symbol]";function r(i){return typeof i=="symbol"||e(i)&&n(i)==t}return bs=r,bs}var ws,ql;function Rh(){if(ql)return ws;ql=1;var n=mh(),e=bh(),t=Ih(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function l(d){if(typeof d=="number")return d;if(t(d))return r;if(e(d)){var h=typeof d.valueOf=="function"?d.valueOf():d;d=e(h)?h+"":h}if(typeof d!="string")return d===0?d:+d;d=n(d);var y=s.test(d);return y||a.test(d)?o(d.slice(2),y?2:8):i.test(d)?r:+d}return ws=l,ws}var vs,Bl;function Nh(){if(Bl)return vs;Bl=1;var n=Rh(),e=1/0,t=17976931348623157e292;function r(i){if(!i)return i===0?i:0;if(i=n(i),i===e||i===-e){var s=i<0?-1:1;return s*t}return i===i?i:0}return vs=r,vs}var _s,Fl;function Th(){if(Fl)return _s;Fl=1;var n=Nh();function e(t){var r=n(t),i=r%1;return r===r?i?r-i:r:0}return _s=e,_s}var xs,Ul;function Ah(){if(Ul)return xs;Ul=1;var n=Th(),e="Expected a function";function t(r,i){var s;if(typeof i!="function")throw new TypeError(e);return r=n(r),function(){return--r>0&&(s=i.apply(this,arguments)),r<=1&&(i=void 0),s}}return xs=t,xs}var Ss,Hl;function Lh(){if(Hl)return Ss;Hl=1;var n=Ah();function e(t){return n(2,t)}return Ss=e,Ss}var jh=Lh();const st=xc(jh);let Vl=class{constructor({details:e,factory:t,options:r,results:i=[]}={}){this.details=e,this.factory=t,this.options=r,this.results=i,this._conforms=st(()=>!this.results.some(s=>s.severity.equals(ne.Info)||s.severity.equals(ne.Violation)||s.severity.equals(ne.Warning))),this._ptr=st(()=>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 En({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Ht.type],[ne.ValidationReport]).addOut([ne.conforms],[this.factory.literal(this.conforms.toString(),ha.boolean)]);for(const t of this.results)e.addOut([ne.result],[this.factory.blankNode()],r=>{t.build(r,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function Oh(n,e){return Object.entries(e).reduce((t,[r,i])=>(i&&i.termType&&(i=Je(i)),t.replace(`{$${r}}`,i).replace(`{?${r}}`,i)),n)}let $h=class{constructor({args:e={},constraintComponent:t,factory:r,focusNode:i,message:s=[],path:a,results:o=[],severity:l,shape:d,source:h=[],value:y,valuePaths:w=[]}={}){this.args=e,this.constraintComponent=t,this.factory=r,this.focusNode=i,this.path=a||d.path,this.results=o,this.severity=l,this.shape=d,this.source=h,this.value=y,this.valuePaths=w,this._message=st(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ne.message]).terms),s.map(g=>r.literal(Oh(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Ht.type],[ne.ValidationResult]).addOut([ne.focusNode],this.focusNode.terms).addOut([ne.resultSeverity],[this.severity]).addOut([ne.sourceConstraint],this.source).addOut([ne.sourceConstraintComponent],[this.constraintComponent]).addOut([ne.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ne.resultMessage],this.message);const r=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ne.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ne.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ne.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ne.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ne.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ne.resultPath],r(this.path[0]).terms):e.addList([ne.resultPath],this.path.map(i=>r(i).term))),typeof this.value<"u"&&e.addOut([ne.value],this.value.terms),t)for(const i of this.results)e.addOut([ne.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 pa{constructor({factory:e,focusNode:t,options:r={debug:!1,details:!1},processed:i=new Set,report:s=new Vl({factory:e,options:r}),results:a=new Map,shape:o,value:l,valueOrNode:d,valuePaths:h,values:y}={}){this.factory=e,this.focusNode=t,this.options=r,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=l,this.valuePaths=h,this.valueOrNode=d,this.values=y}create({child:e,focusNode:t=this.focusNode,shape:r=this.shape,value:i=this.value,valueOrNode:s=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new pa({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Vl({factory:this.factory,options:this.options}):this.report,results:this.results,shape:r,value:i,valueOrNode:s,valuePaths:a,values:o})}id({shape:e=this.shape}={}){return`${Je(e.ptr.term)} - ${Je(this.focusNode.term)} - ${gh(this.valuePaths)}`}result(e){const t=new $h({factory:this.factory,focusNode:this.focusNode,shape:this.shape,value:this.value,valuePaths:this.valuePaths,...e}),r=this.id();this.results.has(r)?this.results.get(r).add(t):this.results.set(r,new Set([t])),this.report.results.push(t)}debug(e,t){this.options.debug&&this.result({severity:Cs.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:Cs.Trace,constraintComponent:e,...t})}test(e,t,r){e?this.debug(t,r):this.violation(t,r)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ne.Violation,...t})}}function kh(){return{generic:Dh()}}function Dh(){return n=>{n.trace(Cs.TraversalConstraintComponent,{args:{},message:[n.factory.literal("Traversal")],value:n.valueOrNode})}}class Mh{constructor(e){this.validations=new cr(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let r=!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(ne.property)&&(r=!0))}return t&&e.isPropertyShape&&!r&&i.add(kh),[...i].map(s=>s(e)).filter(Boolean)}}var $t={},kt={},xr={},Gl;function oc(){if(Gl)return xr;Gl=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.BlankNode=void 0;let n=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}};return xr.BlankNode=n,xr}var Sr={},Er={},Wl;function lc(){if(Wl)return Er;Wl=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.DefaultGraph=void 0;let n=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}};return Er.DefaultGraph=n,n.INSTANCE=new n,Er}var Ir={},Rr={},zl;function ga(){if(zl)return Rr;zl=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.NamedNode=void 0;let n=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&t.termType==="NamedNode"&&t.value===this.value}};return Rr.NamedNode=n,Rr}var Jl;function uc(){if(Jl)return Ir;Jl=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.Literal=void 0;const n=ga();let e=class Pr{constructor(r,i){this.termType="Literal",this.value=r,typeof i=="string"?(this.language=i,this.datatype=Pr.RDF_LANGUAGE_STRING,this.direction=""):i?"termType"in i?(this.language="",this.datatype=i,this.direction=""):(this.language=i.language,this.datatype=i.direction?Pr.RDF_DIRECTIONAL_LANGUAGE_STRING:Pr.RDF_LANGUAGE_STRING,this.direction=i.direction||""):(this.language="",this.datatype=Pr.XSD_STRING,this.direction="")}equals(r){return!!r&&r.termType==="Literal"&&r.value===this.value&&r.language===this.language&&(r.direction===this.direction||!r.direction&&this.direction==="")&&this.datatype.equals(r.datatype)}};return Ir.Literal=e,e.RDF_LANGUAGE_STRING=new n.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),e.RDF_DIRECTIONAL_LANGUAGE_STRING=new n.NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),e.XSD_STRING=new n.NamedNode("http://www.w3.org/2001/XMLSchema#string"),Ir}var Nr={},Ql;function cc(){if(Ql)return Nr;Ql=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.Quad=void 0;let n=class{constructor(t,r,i,s){this.termType="Quad",this.value="",this.subject=t,this.predicate=r,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 Nr.Quad=n,Nr}var Tr={},Xl;function dc(){if(Xl)return Tr;Xl=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.Variable=void 0;let n=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&t.termType==="Variable"&&t.value===this.value}};return Tr.Variable=n,Tr}var Kl;function Ch(){if(Kl)return Sr;Kl=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.DataFactory=void 0;const n=oc(),e=lc(),t=uc(),r=ga(),i=cc(),s=dc();let a=0,o=class{constructor(d){this.blankNodeCounter=0,d=d||{},this.blankNodePrefix=d.blankNodePrefix||`df_${a++}_`}namedNode(d){return new r.NamedNode(d)}blankNode(d){return new n.BlankNode(d||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(d,h){return new t.Literal(d,h)}variable(d){return new s.Variable(d)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(d,h,y,w){return new i.Quad(d,h,y,w||this.defaultGraph())}fromTerm(d){switch(d.termType){case"NamedNode":return this.namedNode(d.value);case"BlankNode":return this.blankNode(d.value);case"Literal":return d.language?this.literal(d.value,d.language):d.datatype.equals(t.Literal.XSD_STRING)?this.literal(d.value):this.literal(d.value,this.fromTerm(d.datatype));case"Variable":return this.variable(d.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(d.subject),this.fromTerm(d.predicate),this.fromTerm(d.object),this.fromTerm(d.graph))}}fromQuad(d){return this.fromTerm(d)}resetBlankNodeCounter(){this.blankNodeCounter=0}};return Sr.DataFactory=o,Sr}var Yl;function Ph(){return Yl||(Yl=1,function(n){var e=kt&&kt.__createBinding||(Object.create?function(r,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(r,a,o)}:function(r,i,s,a){a===void 0&&(a=s),r[a]=i[s]}),t=kt&&kt.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,r,s)};Object.defineProperty(n,"__esModule",{value:!0}),t(oc(),n),t(Ch(),n),t(lc(),n),t(uc(),n),t(ga(),n),t(cc(),n),t(dc(),n)}(kt)),kt}var Dt={},Ar={},Lr={},Zl;function ar(){if(Zl)return Lr;Zl=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.Translator=void 0;let n=class{constructor(){this.supportedRdfDatatypes=[],this.fromRdfHandlers={},this.toRdfHandlers={}}static incorrectRdfDataType(t){throw new Error(`Invalid RDF ${t.datatype.value} value: '${t.value}'`)}registerHandler(t,r,i){for(const s of r)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,r){const i=this.fromRdfHandlers[t.datatype.value];return i?i.fromRdf(t,r):t.value}toRdf(t,r){const i=this.toRdfHandlers[typeof t];if(i)for(const s of i){const a=s.toRdf(t,r);if(a)return a}throw new Error(`Invalid JavaScript value: '${t}'`)}getSupportedRdfDatatypes(){return this.supportedRdfDatatypes}getSupportedJavaScriptPrimitives(){return Object.keys(this.toRdfHandlers)}};return Lr.Translator=n,Lr}var eu;function qh(){if(eu)return Ar;eu=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.TypeHandlerBoolean=void 0;const n=ar();let e=class fc{fromRdf(r,i){switch(r.value){case"true":return!0;case"false":return!1;case"1":return!0;case"0":return!1}return i&&n.Translator.incorrectRdfDataType(r),!1}toRdf(r,{datatype:i,dataFactory:s}){return s.literal(r?"true":"false",i||s.namedNode(fc.TYPE))}};return Ar.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",Ar}var jr={},tu;function Bh(){if(tu)return jr;tu=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.TypeHandlerDate=void 0;const n=ar();let e=class Ps{fromRdf(r,i){switch(i&&!r.value.match(Ps.VALIDATORS[r.datatype.value.substr(33,r.datatype.value.length)])&&n.Translator.incorrectRdfDataType(r),r.datatype.value){case"http://www.w3.org/2001/XMLSchema#gDay":return new Date(0,0,parseInt(r.value,10));case"http://www.w3.org/2001/XMLSchema#gMonthDay":const s=r.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(r.value+"-01-01");case"http://www.w3.org/2001/XMLSchema#gYearMonth":return new Date(r.value+"-01");default:return new Date(r.value)}}toRdf(r,{datatype:i,dataFactory:s}){if(i=i||s.namedNode(Ps.TYPES[0]),!(r instanceof Date))return null;const a=r;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 jr.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]$/},jr}var Or={},ru;function Fh(){if(ru)return Or;ru=1,Object.defineProperty(Or,"__esModule",{value:!0}),Or.TypeHandlerNumberDouble=void 0;const n=ar();let e=class hc{fromRdf(r,i){const s=parseFloat(r.value);return i&&isNaN(s)&&n.Translator.incorrectRdfDataType(r),s}toRdf(r,{datatype:i,dataFactory:s}){return i=i||s.namedNode(hc.TYPES[0]),isNaN(r)?s.literal("NaN",i):isFinite(r)?r%1===0?null:s.literal(r.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),i):s.literal(r>0?"INF":"-INF",i)}};return Or.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"],Or}var $r={},nu;function Uh(){if(nu)return $r;nu=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.TypeHandlerNumberInteger=void 0;const n=ar();let e=class qr{fromRdf(r,i){const s=parseInt(r.value,10);return i&&(isNaN(s)||r.value.indexOf(".")>=0)&&n.Translator.incorrectRdfDataType(r),s}toRdf(r,{datatype:i,dataFactory:s}){return s.literal(String(r),i||(r<=qr.MAX_INT&&r>=qr.MIN_INT?s.namedNode(qr.TYPES[0]):s.namedNode(qr.TYPES[1])))}};return $r.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,$r}var kr={},iu;function Hh(){if(iu)return kr;iu=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.TypeHandlerString=void 0;let n=class{fromRdf(t){return t.value}toRdf(t,{datatype:r,dataFactory:i}){return i.literal(t,r)}};return kr.TypeHandlerString=n,n.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"],kr}var su;function au(){return su||(su=1,function(n){var e=Dt&&Dt.__createBinding||(Object.create?function(r,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(r,a,o)}:function(r,i,s,a){a===void 0&&(a=s),r[a]=i[s]}),t=Dt&&Dt.__exportStar||function(r,i){for(var s in r)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,r,s)};Object.defineProperty(n,"__esModule",{value:!0}),t(qh(),n),t(Bh(),n),t(Fh(),n),t(Uh(),n),t(Hh(),n)}(Dt)),Dt}var Es={},ou;function Vh(){return ou||(ou=1,Object.defineProperty(Es,"__esModule",{value:!0})),Es}var lu;function Gh(){return lu||(lu=1,function(n){var e=$t&&$t.__createBinding||(Object.create?function(g,m,_,x){x===void 0&&(x=_);var S=Object.getOwnPropertyDescriptor(m,_);(!S||("get"in S?!m.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return m[_]}}),Object.defineProperty(g,x,S)}:function(g,m,_,x){x===void 0&&(x=_),g[x]=m[_]}),t=$t&&$t.__exportStar||function(g,m){for(var _ in g)_!=="default"&&!Object.prototype.hasOwnProperty.call(m,_)&&e(m,g,_)};Object.defineProperty(n,"__esModule",{value:!0}),n.fromRdf=l,n.toRdf=d,n.getTermRaw=h,n.getSupportedRdfDatatypes=y,n.getSupportedJavaScriptPrimitives=w;const r=Ph(),i=au(),s=ar();t(au(),n),t(Vh(),n),t(ar(),n);const a=new r.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(g=>a.namedNode(g)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(g=>a.namedNode(g)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(g=>a.namedNode(g)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(g=>a.namedNode(g)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(g=>a.namedNode(g)),["object"]);function l(g,m){return o.fromRdf(g,m)}function d(g,m){return m&&"namedNode"in m&&(m={dataFactory:m}),m=m||{},m&&!m.dataFactory&&(m.dataFactory=a),o.toRdf(g,m)}function h(g,m){return g.termType==="Literal"?l(g,m):g.value}function y(){return o.getSupportedRdfDatatypes()}function w(){return o.getSupportedJavaScriptPrimitives()}}($t)),$t}var Qr=Gh();function uu(n){if(n.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[n.term]};const e=n.out([ne.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=n.out([ne.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const r=n.out([ne.oneOrMorePath]);if(r.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[r.term]};const i=n.out([ne.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=n.out([ne.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function Wh(n){return n.terms.length===0?null:n.ptrs[0].isList()?[...n.list()].map(e=>uu(e)):[uu(n)]}class zh{constructor(e){this.shape=e,this._compiled=st(()=>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 r of this.compiled)r.node&&await r.node(t),r.generic&&await r.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const r=t.node(new tt(t.terms)),i=[...t].reduce((a,o)=>{const l=o.term,d=t.node([l]);return a.has(l)||a.set(l,{value:d,valuePaths:[]}),a.get(l).valuePaths.push(o),a},new cr).values(),s=e.create({shape:this.shape,values:r});for(const a of this.compiled)a.property&&await a.property(s);for(const{value:a,valuePaths:o}of i){const l=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const d of this.compiled)d.generic&&await d.generic(l)}}}function qs(n){const e=new tt,r=new En({dataset:n.dataset,terms:n.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[hh.subClassOf]});for(const i of r.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class Jh{constructor(e){this.targetClass=new tt([...qs(e.hasOut([Ht.type],[ne.NodeShape])),...qs(e.out([ne.targetClass]))]),this.targetNode=e.out([ne.targetNode]).terms,this.targetObjectsOf=e.out([ne.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ne.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),r=[...e.focusNode.hasOut([Ht.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:r});return i.node([...new tt(i.terms)])}}class Qh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=st(()=>{const r=this.ptr.out([ne.deactivated]).term;return r&&Qr.fromRdf(r)}),this._message=st(()=>this.ptr.out([ne.message]).terms),this._path=st(()=>Wh(this.ptr.out([ne.path]))),this._severity=st(()=>this.ptr.out([ne.severity]).term),this._shapeValidator=st(()=>new zh(this)),this._sparql=st(()=>this.ptr.out([ne.sparql])),this._targetResolver=st(()=>new Jh(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 r of e.results.get(t))e.report.results.push(r);return e}return e.processed.add(t),this.shapeValidator.validate(e)}}function Xh(n){const e=parseInt(n.ptr.out([ne.maxCount]).value);return{property:Kh(e)}}function Kh(n){return e=>{e.test(e.values.terms.length<=n,ne.MaxCountConstraintComponent,{args:{maxCount:n},message:[e.factory.literal("More than {$maxCount} values")]})}}function Yh(n){const e=parseInt(n.ptr.out([ne.minCount]).value);return{property:Zh(e)}}function Zh(n){return e=>{e.test(e.values.terms.length>=n,ne.MinCountConstraintComponent,{args:{minCount:n},message:[e.factory.literal("Less than {$minCount} values")]})}}async function ep(n,e){for(const t of n)if(!await e(t))return!1;return!0}async function tp(n,e){return(await Promise.all(n.map(t=>e(t)))).filter(Boolean)}async function Cn(n,e){return Promise.all(n.map(e))}async function rp(n,e){for(const t of n)if(await e(t))return!0;return!1}function np(n){const e=[...n.ptr.out([ne.and])].flatMap(t=>[...t.list()]).map(t=>n.validator.shape(t));return{generic:ip(e)}}function ip(n){return async e=>{const t=await Cn(n,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),r=t.every(i=>i.conforms);e.test(r,ne.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function sp(n){const e=n.validator.shape(n.ptr.out([ne.not]));return{generic:ap(e)}}function ap(n){return async e=>{const t=(await n.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,r=!t.conforms;e.test(r,ne.NotConstraintComponent,{args:{not:n.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function op(n){const e=[...n.ptr.out([ne.or])].flatMap(t=>[...t.list()]).map(t=>n.validator.shape(t));return{generic:lp(e)}}function lp(n){return async e=>{let t=[],r;if(e.options.debug||e.options.details){const i=await Cn(n,async s=>(await s.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report);t=i.flatMap(s=>s.results),r=i.some(s=>s.conforms)}else r=await rp(n,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(r,ne.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function up(n){const e=[...n.ptr.out([ne.xone])].flatMap(t=>[...t.list()]).map(t=>n.validator.shape(t));return{generic:cp(e)}}function cp(n){return async e=>{const t=await Cn(n,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),r=t.filter(i=>i.conforms).length===1;e.test(r,ne.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function dp(n){if(!Qr.fromRdf(n.ptr.out([ne.closed]).term))return null;const t=n.ptr.out([ne.property]).map(s=>n.validator.shape(s)),r=new tt(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new tt([...n.ptr.out([ne.ignoredProperties]).list()||[]].map(s=>s.term));return{node:fp(r,i)}}function fp(n,e){return t=>{const r=t.focusNode.execute({start:"subject",end:"predicate"}).filter(i=>e.has(i.term)?!1:!n.has(i.term));if(r.ptrs.length>0)for(const i of r)t.violation(ne.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(ne.ClosedConstraintComponent)}}function hp(n){const e=n.ptr.out([ne.hasValue]).term;return{node:pp(e),property:gp(e)}}function pp(n){return e=>{e.test(n.equals(e.valueOrNode.term),ne.HasValueConstraintComponent,{args:{hasValue:n},message:[e.factory.literal("Value must be {$hasValue}")]})}}function gp(n){return e=>{const t=[...e.values].some(r=>n.equals(r.term));e.test(t,ne.HasValueConstraintComponent,{args:{hasValue:n},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function yp(n){const e=new tt([...n.ptr.out([ne.in]).list()].map(t=>t.term));return{generic:mp(e)}}function mp(n){return e=>{e.test(n.has(e.valueOrNode.term),ne.InConstraintComponent,{args:{in:[...n].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function dr(n,e){if(!n||n.termType!=="Literal"||!e||e.termType!=="Literal"||cu(n)!==cu(e))return null;const t=Qr.fromRdf(n),r=Qr.fromRdf(e);return typeof t!=typeof r?null:typeof t=="string"?t.localeCompare(r):t-r}function cu(n){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return ha.dateTime.equals(n.datatype)&&e.test(n.value)}function bp(n){const e=n.ptr.out([ne.disjoint]).term;return{generic:wp(e)}}function wp(n){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,n,e.valueOrNode.term);e.test(t.size===0,ne.DisjointConstraintComponent,{args:{disjoint:n},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function vp(n){const e=n.ptr.out([ne.equals]).term;return{node:_p(e),property:xp(e)}}function _p(n){return e=>{const t=e.focusNode.out([n]),r=t.filter(s=>!s.term.equals(e.focusNode.term)),i=t.terms.length!==0&&r.terms.length===0;e.test(i,ne.EqualsConstraintComponent,{args:{equals:n},message:[e.factory.literal("Must have same values as {$equals}")],value:r.terms[0]&&e.focusNode.node([r.terms[0]])||e.focusNode})}}function xp(n){return e=>{const t=new tt(e.focusNode.out([n]).terms),r=new tt(e.values.terms),i=[...r].filter(o=>!t.has(o)),s=[...t].filter(o=>!r.has(o)),a=[...i,...s];for(const o of a)e.violation(ne.EqualsConstraintComponent,{args:{equals:n},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ne.EqualsConstraintComponent,{args:{equals:n},message:[e.factory.literal("Must have same values as {$equals}")]})}}function Sp(n){const e=n.ptr.out([ne.lessThan]).term;return{property:Ep(e)}}function Ep(n){return e=>{const t=e.focusNode.out([n]).terms;for(const r of e.values)for(const i of t){const s=dr(r.term,i);s===null||s>=0?e.violation(ne.LessThanConstraintComponent,{args:{lessThan:n},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r}):e.debug(ne.LessThanConstraintComponent,{args:{lessThan:n},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:r})}}}function Ip(n){const e=n.ptr.out([ne.lessThanOrEquals]).term;return{property:Rp(e)}}function Rp(n){return e=>{const t=e.focusNode.out([n]).terms;for(const r of e.values)for(const i of t){const s=dr(r.term,i);s===null||s>0?e.violation(ne.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:n},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r}):e.debug(ne.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:n},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:r})}}}function Np(n){const e=n.ptr.out([ne.maxExclusive]).term;return{generic:Tp(e)}}function Tp(n){return e=>{const t=dr(e.valueOrNode.term,n);e.test(t!==null&&t<0,ne.MaxExclusiveConstraintComponent,{args:{maxExclusive:n},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function Ap(n){const e=n.ptr.out([ne.maxInclusive]).term;return{generic:Lp(e)}}function Lp(n){return e=>{const t=dr(e.valueOrNode.term,n);e.test(t!==null&&t<=0,ne.MaxInclusiveConstraintComponent,{args:{maxInclusive:n},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function jp(n){const e=n.ptr.out([ne.minExclusive]).term;return{generic:Op(e)}}function Op(n){return e=>{const t=dr(e.valueOrNode.term,n);e.test(t!==null&&t>0,ne.MinExclusiveConstraintComponent,{args:{minExclusive:n},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function $p(n){const e=n.ptr.out([ne.minInclusive]).term;return{generic:kp(e)}}function kp(n){return e=>{const t=dr(e.valueOrNode.term,n);e.test(t!==null&&t>=0,ne.MinInclusiveConstraintComponent,{args:{minInclusive:n},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Dp(n){const e=[...n.ptr.out([ne.node])].map(t=>n.validator.shape(t));return{generic:Mp(e)}}function Mp(n){return async e=>{for(const t of n){const r=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(r.report.conforms,ne.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:r.report.results,value:e.valueOrNode})}}}function Cp(n){const e=[...n.ptr.out([ne.property])].map(t=>n.validator.shape(t));return{generic:Pp(e)}}function Pp(n){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const r of n)await r.validate(t)}}function qp(n){const e=n.validator.shape(n.ptr.out([ne.qualifiedValueShape])),t=n.ptr.out([ne.qualifiedValueShapesDisjoint]).term,r=t?Qr.fromRdf(t):!1,i=n.ptr.out([ne.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=n.ptr.out([ne.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:Bp(e,r,s,o)}}function Bp(n,e,t,r){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ne.property]).out([ne.property]).out([ne.qualifiedValueShape]).filter(l=>!l.term.equals(n.ptr.term)).map(l=>i.shape.validator.shape(l))));const o=(await tp(i.values,async l=>{const d=(await n.validate(i.create({child:!0,focusNode:l}))).report;if(s.push(d.results),!d.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const h=await Cn([...a],async y=>(await y.validate(i.create({child:!0,focusNode:l}))).report);return s.push(h.flatMap(y=>y.results)),!h.every(y=>y.conforms)}else return!await ep([...a],async h=>(await h.validate(i.create({child:!0,focusNode:l}))).report.conforms)})).length;t!==null&&i.test(o<=t,ne.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:n.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),r!==null&&i.test(o>=r,ne.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:r,qualifiedValueShape:n.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function Fp(n,e){return e?e.slice(0,n.length)===n:!1}function Up(n){const e=[...new Set([...n.ptr.out([ne.languageIn]).list()].map(t=>t.value))];return{generic:Hp(e)}}function Hp(n){return e=>{const t=n.some(r=>Fp(r,e.valueOrNode.term.language));e.test(t,ne.LanguageInConstraintComponent,{args:{languageIn:n.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Vp(n){const e=parseInt(n.ptr.out([ne.maxLength]).value);return{generic:Gp(e)}}function Gp(n){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=n;e.test(t,ne.MaxLengthConstraintComponent,{args:{maxLength:n},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Wp(n){const e=parseInt(n.ptr.out([ne.minLength]).value);return{generic:zp(e)}}function zp(n){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=n;e.test(t,ne.MinLengthConstraintComponent,{args:{minLength:n},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function Jp(n){const e=n.ptr.out([ne.pattern]).value,t=n.ptr.out([ne.flags]).value,r=new RegExp(e,t);return{generic:Qp(e,t,r)}}function Qp(n,e,t){return r=>{r.test(t.test(r.valueOrNode.term.value),ne.PatternConstraintComponent,{args:{flags:e,pattern:n},message:[r.factory.literal('Value does not match pattern "{$pattern}"')],value:r.valueOrNode})}}function Xp(n){const e=n.ptr.out([ne.uniqueLang]).term;return e.value==="true"&&ha.boolean.equals(e.datatype)?{property:Kp()}:null}function Kp(){return n=>{const t=Object.entries(n.values.terms.reduce((r,i)=>(i.language&&(r[i.language]=(r[i.language]||0)+1),r),{})).filter(([,r])=>r>1);for(const[r]of t)n.violation(ne.UniqueLangConstraintComponent,{args:{lang:r},message:[n.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&n.debug(ne.UniqueLangConstraintComponent)}}const bn=nt("http://www.w3.org/ns/shacl#"),pc=nt("https://schemas.link/shacl-next#");class or{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(bn.Info)||e.severity.equals(bn.Violation)||e.severity.equals(bn.Warning))}}function Yp(n,e){return Object.entries(e).reduce((t,[r,i])=>(i&&i.termType&&(i=Je(i)),t.replace(`{$${r}}`,i).replace(`{?${r}}`,i)),n)}class In{constructor({args:e={},factory:t,message:r=[],severity:i=bn.Violation}={}){this.severity=i,this.message=r.map(s=>t.literal(Yp(s.value,e),s.language||null))}}class ya{constructor({factory:e=fa}={}){this.factory=e}clone({factory:e}={}){return new ya({factory:e||this.factory})}validate(){return new or}validateSimple(){return!0}}class fr extends ya{constructor({datatypes:e,factory:t}={}){super({factory:t}),this.datatypes=[];for(const r of Array.isArray(e)?e:[e])r&&this.datatypes.push(this.factory.fromTerm(r))}clone({factory:e}={}){return new fr({datatypes:this.datatypes,factory:e||this.factory})}}class Zp{constructor({factory:e=fa,validations:t}={}){if(this.factory=e,this.validations=new cr,t)for(const r of Object.values(t)){const i=r.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 Ae extends fr{constructor(e,t,{factory:r}={}){super({datatypes:t,factory:r}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Ae(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(r=>{let i;r.test(e.value)&&(i=pc.Debug);const s={pattern:this.factory.literal(r.toString()),this:e};return new In({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 eg=/^([-+]?[0-9]+)$/;class We extends Ae{constructor(e=null,t=null,r,{factory:i}={}){super(eg,r,{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 We(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!pc.Debug.equals(t[0].severity))return new or({results:t});const r=BigInt(e.value);if(this.minInclusive!==null&&r<this.minInclusive){const i=`term value "${e.value}" is less than "${this.minInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new In({factory:this.factory,message:s}))}if(this.maxInclusive!==null&&r>this.maxInclusive){const i=`term value "${e.value}" is greater than "${this.maxInclusive.toString()}"`,s=[this.factory.literal(i)];t.push(new In({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 ma extends fr{constructor(e,t,{factory:r}={}){super({datatypes:t,factory:r}),this.values=new Set(e)}clone({factory:e}={}){return new ma(this.values,this.datatypes,{factory:e||this.factory})}validate(e){const t=[];if(!this.values.has(e.value)){const r=`term value "${e.value}" is not included in the list: ${[...this.values].join(",")}`,i=[this.factory.literal(r)];t.push(new In({factory:this.factory,message:i}))}return new or({results:t})}validateSimple(e){return this.values.has(e.value)}}const Se={xsd:nt("http://www.w3.org/2001/XMLSchema#")},tg=new fr({datatypes:Se.xsd.anySimpleType}),rg=new fr({datatypes:Se.xsd.anyAtomicType}),Pn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,ng=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,gc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,ba=/^(-?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))?)$/,ig=/^((([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))?)$/,sg=/^(-?([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))?)$/,ag=/^(-?([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))?)$/,og=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,lg=/^(--(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))?)$/,ug=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,cg=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,dg=/^(([0-9a-fA-F]{2})*)$/,fg=/^(((([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] ?= ?=))?)$/,hg=new Ae(Pn,Se.xsd.string),pg=new ma(["1","true","0","false"],Se.xsd.boolean),gg=new Ae(ng,Se.xsd.decimal),yg=new Ae(gc,Se.xsd.float),mg=new Ae(gc,Se.xsd.double),bg=new Ae(ba,Se.xsd.duration),wg=new Ae(yc,Se.xsd.dateTime),vg=new Ae(ig,Se.xsd.time),_g=new Ae(sg,Se.xsd.date),xg=new Ae(ag,Se.xsd.gYearMonth),Sg=new Ae(og,Se.xsd.gYear),Eg=new Ae(lg,Se.xsd.gMonthDay),Ig=new Ae(ug,Se.xsd.gDay),Rg=new Ae(cg,Se.xsd.gMonth),Ng=new Ae(dg,Se.xsd.hexBinary),Tg=new Ae(fg,Se.xsd.base64Binary),Ag=new Ae(Pn,Se.xsd.anyURI),mc=/^([^\u000d\u000a\u0009]*)$/,Lg=/^([^ ]+( [^ ]+)*)*$/,jg=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Og=/^([^DT]*)$/,$g=/^([^YM]*[DT].*)$/,kg=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Dg=new Ae([Pn,mc],Se.xsd.normalizedString),Mg=new Ae([Pn,mc,Lg],Se.xsd.token),Cg=new Ae(jg,Se.xsd.language),Pg=new We(null,null,Se.xsd.integer),qg=new We(null,"0",Se.xsd.nonPositiveInteger),Bg=new We(null,"-1",Se.xsd.negativeInteger),Fg=new We("-9223372036854775808","9223372036854775807",Se.xsd.long),Ug=new We("-2147483648","2147483647",Se.xsd.int),Hg=new We("-32768","32767",Se.xsd.short),Vg=new We("-128","127",Se.xsd.byte),Gg=new We("0",null,Se.xsd.nonNegativeInteger),Wg=new We("0","18446744073709551615",Se.xsd.unsignedLong),zg=new We("0","4294967295",Se.xsd.unsignedInt),Jg=new We("0","65535",Se.xsd.unsignedShort),Qg=new We("0","255",Se.xsd.unsignedByte),Xg=new We("1",null,Se.xsd.positiveInteger),Kg=new Ae([ba,Og],Se.xsd.yearMonthDuration),Yg=new Ae([ba,$g],Se.xsd.dayTimeDuration),Zg=new Ae([yc,kg],Se.xsd.dateTimeStamp),ey=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:rg,anySimpleType:tg,anyURI:Ag,base64Binary:Tg,boolean:pg,byte:Vg,date:_g,dateTime:wg,dateTimeStamp:Zg,dayTimeDuration:Yg,decimal:gg,double:mg,duration:bg,float:yg,gDay:Ig,gMonth:Rg,gMonthDay:Eg,gYear:Sg,gYearMonth:xg,hexBinary:Ng,int:Ug,integer:Pg,language:Cg,long:Fg,negativeInteger:Bg,nonNegativeInteger:Gg,nonPositiveInteger:qg,normalizedString:Dg,positiveInteger:Xg,short:Hg,string:hg,time:vg,token:Mg,unsignedByte:Qg,unsignedInt:zg,unsignedLong:Wg,unsignedShort:Jg,yearMonthDuration:Kg},Symbol.toStringTag,{value:"Module"}));class ty extends Zp{constructor({factory:e}={}){super({factory:e,validations:{...ey}})}}const ry=new cr([[ne.BlankNode,new Set(["BlankNode"])],[ne.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ne.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ne.IRI,new Set(["NamedNode"])],[ne.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ne.Literal,new Set(["Literal"])]]);function ny(n){const e=n.ptr.out([ne.class]).map(t=>qs(t));return{generic:iy(e)}}function iy(n){return e=>{const t=new tt(e.valueOrNode.out([Ht.type]).terms);for(const r of n){const i=[...t].some(s=>r.has(s));e.test(i,ne.ClassConstraintComponent,{value:e.valueOrNode})}}}function sy(n){const e=n.ptr.out([ne.datatype]).term,t=new ty;return{generic:ay(e,t)}}function ay(n,e){return t=>{const r=n.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(r,ne.DatatypeConstraintComponent,{args:{datatype:n},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function oy(n){const e=n.ptr.out([ne.nodeKind]).term,t=ry.get(e);return{generic:ly(e,t)}}function ly(n,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ne.NodeKindConstraintComponent,{args:{nodeKind:n},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const uy=new cr([[ne.maxCount,Xh],[ne.minCount,Yh],[ne.and,np],[ne.not,sp],[ne.or,op],[ne.xone,up],[ne.closed,dp],[ne.hasValue,hp],[ne.in,yp],[ne.disjoint,bp],[ne.equals,vp],[ne.lessThan,Sp],[ne.lessThanOrEquals,Ip],[ne.maxExclusive,Np],[ne.maxInclusive,Ap],[ne.minExclusive,jp],[ne.minInclusive,$p],[ne.node,Dp],[ne.property,Cp],[ne.qualifiedValueShape,qp],[ne.languageIn,Up],[ne.maxLength,Vp],[ne.minLength,Wp],[ne.pattern,Jp],[ne.uniqueLang,Xp],[ne.class,ny],[ne.datatype,sy],[ne.nodeKind,oy]]);class cy{constructor(e,{factory:t,...r}){if(this.factory=t,this.options=r,this.registry=new Mh(uy),this.shapesPtr=new En({dataset:e,factory:t}),this.shapes=new cr,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([ne.targetClass]),...this.shapesPtr.hasOut([ne.targetNode]),...this.shapesPtr.hasOut([ne.targetObjectsOf]),...this.shapesPtr.hasOut([ne.targetSubjectsOf]),...this.shapesPtr.hasOut([Ht.type],[ne.NodeShape]),...this.shapesPtr.hasOut([Ht.type],[ne.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 Qh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const r=new En({...e,factory:this.factory}),i=new pa({factory:this.factory,focusNode:r,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;r.isAny()?o=s.resolveTargets(a):o=r;for(const l of o)await s.validate(a.create({focusNode:l}))}return i.report}}let dy=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new wl(e,this.form),this.form.addEventListener("change",t=>{t.stopPropagation(),this.config.editMode&&this.validate(!0).then(r=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:r.conforms,report:r}}))}).catch(r=>{console.warn(r)})})}static get observedAttributes(){return wl.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{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(r=>{this.form.classList.remove(r)}),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 r of wd())r.stylesheet&&t.push(r.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Nt(e,this.config,this.config.attributes.valuesSubject?xe.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const r=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);r.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(r)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(xe.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,wn)>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)}},200)}serialize(e="text/turtle",t=this.toRDF()){const r=t.getQuads(null,null,null,null);return gd(r,e,this.config.prefixes)}toRDF(e=new Fe){return this.shape?.toRDF(e),e}registerPlugin(e){bd(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Kf(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?.toRDF(this.config.store),this.shape&&this.config.store.add(new Nn(this.shape.shaclSubject,xe.namedNode(be+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,r=await new cy(t,{details:!0,factory:xe}).validate({dataset:t});for(const i of r.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 l=this.form.querySelectorAll(`
343
+ `}function Zf(){return""}function tc(r){return"<"+r.value+">"}const eh=/["\\\\\n\r]/,th=/["\\\\\n\r]/g,rh={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function nh(r){return rh[r]}function ih(r){return eh.test(r)?r.replace(th,nh):r}function sh(r){const e=ih(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+'"^^'+tc(r.datatype)}function ah(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 oh(r){return"?"+r.value}function Je(r){if(!r)return null;if(r.termType==="BlankNode")return Kf(r);if(r.termType==="DefaultGraph")return Zf();if(r.termType==="Literal")return sh(r);if(r.termType==="NamedNode")return tc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return ah(r,Je);if(r.termType==="Variable")return oh(r);if(r[Symbol.iterator])return Yf(r,Je);throw new Error(`unknown termType ${r.termType}`)}class cr{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(Je(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(Je(e));return t&&t.value}has(e){return this.index.has(Je(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=Je(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 wl{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 vl(r){try{return Je(r)}catch{return null}}class tt{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=Je(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(vl(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(vl(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}let rc=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};rc.prototype.termType="BlankNode";let ua=class{equals(e){return!!e&&e.termType===this.termType}};ua.prototype.termType="DefaultGraph";ua.prototype.value="";function _l(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}`)}let mn=class{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}};mn.prototype.termType="Literal";let Yr=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Yr.prototype.termType="NamedNode";let ca=class{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)}};ca.prototype.termType="Quad";ca.prototype.value="";let nc=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};nc.prototype.termType="Variable";const lh=new Yr("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),xl=new Yr("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),uh=new Yr("http://www.w3.org/2001/XMLSchema#string");let ic=class{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new ua}}namedNode(e){return new Yr(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new rc(e)}literal(e,t){return typeof t=="string"?new mn(e,t,xl):typeof t?.language=="string"?new mn(e,t.language,t.direction?lh:xl,t.direction):new mn(e,"",t||uh)}variable(e){return new nc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new ca(e,t,n,i)}fromTerm(e){return _l(this,e)}fromQuad(e){return _l(this,e)}};ic.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const da=new ic,ch={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function nt(r,{factory:e=da}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,ch)}nt("http://www.w3.org/2001/XMLSchema#");const ot=nt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");nt("http://www.w3.org/2000/01/rdf-schema#");class Ne{static add({ptr:e,start:t,end:n,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:l}={}){if(!e.factory)throw new Error("add operation requires a factory");let d=()=>{};l&&(d=h=>{l(new wl({dataset:e.dataset,start:t,end:n,quad:h}))});for(const h of i)for(const y of s)for(const w of a)for(const g of o){const m={subject:h,predicate:y,object:w,graph:g};m[t]=e.term;const _=e.factory.quad(m.subject,m.predicate,m.object,m.graph);e.dataset.add(_),d(_)}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]||ot.nil,a));for(let l=0;l<o.length;l++)e.dataset.add(e.factory.quad(o[l],ot.first,n[l],a)),e.dataset.add(e.factory.quad(o[l],ot.rest,o[l+1]||ot.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 l of s){const d={subject:a,predicate:o,object:l};d[t]=e.term;const h=e.dataset.match(d.subject,d.predicate,d.object);for(const y of h)e.dataset.delete(y)}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);!ot.nil.equals(a);){a=n[n.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const l of o)n.push(l)}}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:l,graphs:d,items:h,callback:y}={}){if(t==="add")return Ne.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:l,graphs:d,callback:y});if(t==="addList")return Ne.addList({ptr:e,predicates:o,items:h,graphs:d});if(t==="delete")return Ne.delete({ptr:e,start:i,subjects:a,predicates:o,objects:l});if(t==="deleteList")return Ne.deleteList({ptr:e,predicates:o});if(t==="isList")return Ne.isList({ptr:e});if(t==="list")return Ne.list({ptr:e});if(t==="traverse")return Ne.traverse({ptr:e,quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:l,graphs:d});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(ot.nil.equals(e.term)||Ne.traverse({ptr:e,predicates:[ot.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(ot.nil);){const t=e.out([ot.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([ot.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:l=[null],callback:d}){if(t==="one")return Ne.traverseOne({ptr:e,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:l,callback:d});if(t==="oneOrMore"){const h=Ne.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:l,callback:d});return Ne.traverseMore({ptrs:h,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:l,callback:d})}if(t==="zeroOrMore")return Ne.traverseMore({ptrs:[e],end:i,start:n,subjects:s,predicates:a,objects:o,graphs:l,callback:d});if(t==="zeroOrOne")return[e,...Ne.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:l,callback:d})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:l}={}){let d=[...e],h,y;do{h=[];for(const w of e)h=[...h,...Ne.traverseOne({ptr:w,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:l})];y&&(h=h.filter(w=>!y.has(w.term))),e=h,d=[...d,...h],y=new tt(d.map(w=>w.term))}while(h.length>0);return d}static traverseOne({ptr:e,start:t,end:n,subjects:i,predicates:s,objects:a,graphs:o,callback:l=(d,h)=>h.extend(d)}={}){const d=[];for(const h of i)for(const y of s)for(const w of a)for(const g of o){const m={subject:h,predicate:y,object:w,graph:g};m[t]=e.term;for(const _ of e.dataset.match(m.subject,m.predicate,m.object,m.graph))d.push(l(new wl({dataset:e.dataset,end:n,quad:_,start:t}),e))}return d}}function Sl(r,e){return e?t=>e(r.extend(t)):()=>{}}class El{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 Ne.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:Sl(this,n)})}addList(e,t){return Ne.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Ne.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:Sl(this,n)})}deleteIn(e,t){return Ne.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Ne.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Ne.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:l,items:d,callback:h}){return Ne.execute({ptr:this,operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:l,items:d,callback:h})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Ne.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Ne.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Ne.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Ne.isList({ptr:this})}list(){return Ne.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 Ne.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 Il(r,e){return r?r.equals(e):r===e}function dh(r,e){return!(r.dataset!==e.dataset||!Il(r.graph,e.graph)||!Il(r.term,e.term))}function Rl(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class En{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 El({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 tt(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=Rl(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=Rl(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=>dh(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 El({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]})}}nt("http://www.w3.org/2002/07/owl#");const Ht=nt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),fh=nt("http://www.w3.org/2000/01/rdf-schema#"),ne=nt("http://www.w3.org/ns/shacl#"),Ms=nt("https://schemas.link/shacl-next#"),fa=nt("http://www.w3.org/2001/XMLSchema#");function hh(r){return r?`{${[...r.quads()].map(e=>Je(e)).join(" ")}}`:"{}"}function ph(r){return r?`{${r.map(e=>hh(e)).join(" ")}}`:"{}"}var ls,Nl;function gh(){if(Nl)return ls;Nl=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return ls=e,ls}var us,Tl;function yh(){if(Tl)return us;Tl=1;var r=gh(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return us=t,us}var cs,Al;function mh(){if(Al)return cs;Al=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return cs=r,cs}var ds,Ll;function bh(){if(Ll)return ds;Ll=1;var r=typeof Zt=="object"&&Zt&&Zt.Object===Object&&Zt;return ds=r,ds}var fs,jl;function wh(){if(jl)return fs;jl=1;var r=bh(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return fs=t,fs}var hs,Ol;function sc(){if(Ol)return hs;Ol=1;var r=wh(),e=r.Symbol;return hs=e,hs}var ps,$l;function vh(){if($l)return ps;$l=1;var r=sc(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function s(a){var o=t.call(a,i),l=a[i];try{a[i]=void 0;var d=!0}catch{}var h=n.call(a);return d&&(o?a[i]=l:delete a[i]),h}return ps=s,ps}var gs,kl;function _h(){if(kl)return gs;kl=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return gs=t,gs}var ys,Dl;function xh(){if(Dl)return ys;Dl=1;var r=sc(),e=vh(),t=_h(),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 ms,Ml;function Sh(){if(Ml)return ms;Ml=1;function r(e){return e!=null&&typeof e=="object"}return ms=r,ms}var bs,Cl;function Eh(){if(Cl)return bs;Cl=1;var r=xh(),e=Sh(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return bs=n,bs}var ws,Pl;function Ih(){if(Pl)return ws;Pl=1;var r=yh(),e=mh(),t=Eh(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function l(d){if(typeof d=="number")return d;if(t(d))return n;if(e(d)){var h=typeof d.valueOf=="function"?d.valueOf():d;d=e(h)?h+"":h}if(typeof d!="string")return d===0?d:+d;d=r(d);var y=s.test(d);return y||a.test(d)?o(d.slice(2),y?2:8):i.test(d)?n:+d}return ws=l,ws}var vs,ql;function Rh(){if(ql)return vs;ql=1;var r=Ih(),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 vs=n,vs}var _s,Bl;function Nh(){if(Bl)return _s;Bl=1;var r=Rh();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return _s=e,_s}var xs,Fl;function Th(){if(Fl)return xs;Fl=1;var r=Nh(),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 xs=t,xs}var Ss,Ul;function Ah(){if(Ul)return Ss;Ul=1;var r=Th();function e(t){return r(2,t)}return Ss=e,Ss}var Lh=Ah();const st=_c(Lh);let Hl=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=st(()=>!this.results.some(s=>s.severity.equals(ne.Info)||s.severity.equals(ne.Violation)||s.severity.equals(ne.Warning))),this._ptr=st(()=>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 En({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Ht.type],[ne.ValidationReport]).addOut([ne.conforms],[this.factory.literal(this.conforms.toString(),fa.boolean)]);for(const t of this.results)e.addOut([ne.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function jh(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=Je(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Oh=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:l,shape:d,source:h=[],value:y,valuePaths:w=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=i,this.path=a||d.path,this.results=o,this.severity=l,this.shape=d,this.source=h,this.value=y,this.valuePaths=w,this._message=st(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ne.message]).terms),s.map(g=>n.literal(jh(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Ht.type],[ne.ValidationResult]).addOut([ne.focusNode],this.focusNode.terms).addOut([ne.resultSeverity],[this.severity]).addOut([ne.sourceConstraint],this.source).addOut([ne.sourceConstraintComponent],[this.constraintComponent]).addOut([ne.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ne.resultMessage],this.message);const n=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ne.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ne.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ne.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ne.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ne.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ne.resultPath],n(this.path[0]).terms):e.addList([ne.resultPath],this.path.map(i=>n(i).term))),typeof this.value<"u"&&e.addOut([ne.value],this.value.terms),t)for(const i of this.results)e.addOut([ne.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 ha{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new Hl({factory:e,options:n}),results:a=new Map,shape:o,value:l,valueOrNode:d,valuePaths:h,values:y}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=l,this.valuePaths=h,this.valueOrNode=d,this.values=y}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 ha({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Hl({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`${Je(e.ptr.term)} - ${Je(this.focusNode.term)} - ${ph(this.valuePaths)}`}result(e){const t=new Oh({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:Ms.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:Ms.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||ne.Violation,...t})}}function $h(){return{generic:kh()}}function kh(){return r=>{r.trace(Ms.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class Dh{constructor(e){this.validations=new cr(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(ne.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&i.add($h),[...i].map(s=>s(e)).filter(Boolean)}}var $t={},kt={},xr={},Vl;function ac(){if(Vl)return xr;Vl=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.BlankNode=void 0;let r=class{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}};return xr.BlankNode=r,xr}var Sr={},Er={},Gl;function oc(){if(Gl)return Er;Gl=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.DefaultGraph=void 0;let r=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}};return Er.DefaultGraph=r,r.INSTANCE=new r,Er}var Ir={},Rr={},Wl;function pa(){if(Wl)return Rr;Wl=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.NamedNode=void 0;let r=class{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&t.termType==="NamedNode"&&t.value===this.value}};return Rr.NamedNode=r,Rr}var zl;function lc(){if(zl)return Ir;zl=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.Literal=void 0;const r=pa();let e=class Pr{constructor(n,i){this.termType="Literal",this.value=n,typeof i=="string"?(this.language=i,this.datatype=Pr.RDF_LANGUAGE_STRING,this.direction=""):i?"termType"in i?(this.language="",this.datatype=i,this.direction=""):(this.language=i.language,this.datatype=i.direction?Pr.RDF_DIRECTIONAL_LANGUAGE_STRING:Pr.RDF_LANGUAGE_STRING,this.direction=i.direction||""):(this.language="",this.datatype=Pr.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 Ir.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"),Ir}var Nr={},Jl;function uc(){if(Jl)return Nr;Jl=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.Quad=void 0;let r=class{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 Nr.Quad=r,Nr}var Tr={},Ql;function cc(){if(Ql)return Tr;Ql=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.Variable=void 0;let r=class{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&t.termType==="Variable"&&t.value===this.value}};return Tr.Variable=r,Tr}var Xl;function Mh(){if(Xl)return Sr;Xl=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.DataFactory=void 0;const r=ac(),e=oc(),t=lc(),n=pa(),i=uc(),s=cc();let a=0,o=class{constructor(d){this.blankNodeCounter=0,d=d||{},this.blankNodePrefix=d.blankNodePrefix||`df_${a++}_`}namedNode(d){return new n.NamedNode(d)}blankNode(d){return new r.BlankNode(d||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(d,h){return new t.Literal(d,h)}variable(d){return new s.Variable(d)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(d,h,y,w){return new i.Quad(d,h,y,w||this.defaultGraph())}fromTerm(d){switch(d.termType){case"NamedNode":return this.namedNode(d.value);case"BlankNode":return this.blankNode(d.value);case"Literal":return d.language?this.literal(d.value,d.language):d.datatype.equals(t.Literal.XSD_STRING)?this.literal(d.value):this.literal(d.value,this.fromTerm(d.datatype));case"Variable":return this.variable(d.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(d.subject),this.fromTerm(d.predicate),this.fromTerm(d.object),this.fromTerm(d.graph))}}fromQuad(d){return this.fromTerm(d)}resetBlankNodeCounter(){this.blankNodeCounter=0}};return Sr.DataFactory=o,Sr}var Kl;function Ch(){return Kl||(Kl=1,function(r){var e=kt&&kt.__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=kt&&kt.__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(ac(),r),t(Mh(),r),t(oc(),r),t(lc(),r),t(pa(),r),t(uc(),r),t(cc(),r)}(kt)),kt}var Dt={},Ar={},Lr={},Yl;function ar(){if(Yl)return Lr;Yl=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.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 Lr.Translator=r,Lr}var Zl;function Ph(){if(Zl)return Ar;Zl=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.TypeHandlerBoolean=void 0;const r=ar();let e=class dc{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(dc.TYPE))}};return Ar.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",Ar}var jr={},eu;function qh(){if(eu)return jr;eu=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.TypeHandlerDate=void 0;const r=ar();let e=class Cs{fromRdf(n,i){switch(i&&!n.value.match(Cs.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(Cs.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 jr.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]$/},jr}var Or={},tu;function Bh(){if(tu)return Or;tu=1,Object.defineProperty(Or,"__esModule",{value:!0}),Or.TypeHandlerNumberDouble=void 0;const r=ar();let e=class fc{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(fc.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 Or.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"],Or}var $r={},ru;function Fh(){if(ru)return $r;ru=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.TypeHandlerNumberInteger=void 0;const r=ar();let e=class qr{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<=qr.MAX_INT&&n>=qr.MIN_INT?s.namedNode(qr.TYPES[0]):s.namedNode(qr.TYPES[1])))}};return $r.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,$r}var kr={},nu;function Uh(){if(nu)return kr;nu=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return kr.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"],kr}var iu;function su(){return iu||(iu=1,function(r){var e=Dt&&Dt.__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=Dt&&Dt.__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(Ph(),r),t(qh(),r),t(Bh(),r),t(Fh(),r),t(Uh(),r)}(Dt)),Dt}var Es={},au;function Hh(){return au||(au=1,Object.defineProperty(Es,"__esModule",{value:!0})),Es}var ou;function Vh(){return ou||(ou=1,function(r){var e=$t&&$t.__createBinding||(Object.create?function(g,m,_,x){x===void 0&&(x=_);var S=Object.getOwnPropertyDescriptor(m,_);(!S||("get"in S?!m.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return m[_]}}),Object.defineProperty(g,x,S)}:function(g,m,_,x){x===void 0&&(x=_),g[x]=m[_]}),t=$t&&$t.__exportStar||function(g,m){for(var _ in g)_!=="default"&&!Object.prototype.hasOwnProperty.call(m,_)&&e(m,g,_)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=l,r.toRdf=d,r.getTermRaw=h,r.getSupportedRdfDatatypes=y,r.getSupportedJavaScriptPrimitives=w;const n=Ch(),i=su(),s=ar();t(su(),r),t(Hh(),r),t(ar(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(g=>a.namedNode(g)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(g=>a.namedNode(g)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(g=>a.namedNode(g)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(g=>a.namedNode(g)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(g=>a.namedNode(g)),["object"]);function l(g,m){return o.fromRdf(g,m)}function d(g,m){return m&&"namedNode"in m&&(m={dataFactory:m}),m=m||{},m&&!m.dataFactory&&(m.dataFactory=a),o.toRdf(g,m)}function h(g,m){return g.termType==="Literal"?l(g,m):g.value}function y(){return o.getSupportedRdfDatatypes()}function w(){return o.getSupportedJavaScriptPrimitives()}}($t)),$t}var Qr=Vh();function lu(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ne.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([ne.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const n=r.out([ne.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=r.out([ne.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=r.out([ne.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function Gh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>lu(e)):[lu(r)]}class Wh{constructor(e){this.shape=e,this._compiled=st(()=>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 tt(t.terms)),i=[...t].reduce((a,o)=>{const l=o.term,d=t.node([l]);return a.has(l)||a.set(l,{value:d,valuePaths:[]}),a.get(l).valuePaths.push(o),a},new cr).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 l=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const d of this.compiled)d.generic&&await d.generic(l)}}}function Ps(r){const e=new tt,n=new En({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[fh.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class zh{constructor(e){this.targetClass=new tt([...Ps(e.hasOut([Ht.type],[ne.NodeShape])),...Ps(e.out([ne.targetClass]))]),this.targetNode=e.out([ne.targetNode]).terms,this.targetObjectsOf=e.out([ne.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ne.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([Ht.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 tt(i.terms)])}}class Jh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=st(()=>{const n=this.ptr.out([ne.deactivated]).term;return n&&Qr.fromRdf(n)}),this._message=st(()=>this.ptr.out([ne.message]).terms),this._path=st(()=>Gh(this.ptr.out([ne.path]))),this._severity=st(()=>this.ptr.out([ne.severity]).term),this._shapeValidator=st(()=>new Wh(this)),this._sparql=st(()=>this.ptr.out([ne.sparql])),this._targetResolver=st(()=>new zh(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 Qh(r){const e=parseInt(r.ptr.out([ne.maxCount]).value);return{property:Xh(e)}}function Xh(r){return e=>{e.test(e.values.terms.length<=r,ne.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function Kh(r){const e=parseInt(r.ptr.out([ne.minCount]).value);return{property:Yh(e)}}function Yh(r){return e=>{e.test(e.values.terms.length>=r,ne.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function Zh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function ep(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function Cn(r,e){return Promise.all(r.map(e))}async function tp(r,e){for(const t of r)if(await e(t))return!0;return!1}function rp(r){const e=[...r.ptr.out([ne.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:np(e)}}function np(r){return async e=>{const t=await Cn(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.every(i=>i.conforms);e.test(n,ne.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function ip(r){const e=r.validator.shape(r.ptr.out([ne.not]));return{generic:sp(e)}}function sp(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!t.conforms;e.test(n,ne.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function ap(r){const e=[...r.ptr.out([ne.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:op(e)}}function op(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await Cn(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 tp(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(n,ne.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function lp(r){const e=[...r.ptr.out([ne.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:up(e)}}function up(r){return async e=>{const t=await Cn(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,ne.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function cp(r){if(!Qr.fromRdf(r.ptr.out([ne.closed]).term))return null;const t=r.ptr.out([ne.property]).map(s=>r.validator.shape(s)),n=new tt(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new tt([...r.ptr.out([ne.ignoredProperties]).list()||[]].map(s=>s.term));return{node:dp(n,i)}}function dp(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(ne.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(ne.ClosedConstraintComponent)}}function fp(r){const e=r.ptr.out([ne.hasValue]).term;return{node:hp(e),property:pp(e)}}function hp(r){return e=>{e.test(r.equals(e.valueOrNode.term),ne.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function pp(r){return e=>{const t=[...e.values].some(n=>r.equals(n.term));e.test(t,ne.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function gp(r){const e=new tt([...r.ptr.out([ne.in]).list()].map(t=>t.term));return{generic:yp(e)}}function yp(r){return e=>{e.test(r.has(e.valueOrNode.term),ne.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function dr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||uu(r)!==uu(e))return null;const t=Qr.fromRdf(r),n=Qr.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function uu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return fa.dateTime.equals(r.datatype)&&e.test(r.value)}function mp(r){const e=r.ptr.out([ne.disjoint]).term;return{generic:bp(e)}}function bp(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ne.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function wp(r){const e=r.ptr.out([ne.equals]).term;return{node:vp(e),property:_p(e)}}function vp(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,ne.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 _p(r){return e=>{const t=new tt(e.focusNode.out([r]).terms),n=new tt(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(ne.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ne.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function xp(r){const e=r.ptr.out([ne.lessThan]).term;return{property:Sp(e)}}function Sp(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=dr(n.term,i);s===null||s>=0?e.violation(ne.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(ne.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}}}function Ep(r){const e=r.ptr.out([ne.lessThanOrEquals]).term;return{property:Ip(e)}}function Ip(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=dr(n.term,i);s===null||s>0?e.violation(ne.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(ne.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}}}function Rp(r){const e=r.ptr.out([ne.maxExclusive]).term;return{generic:Np(e)}}function Np(r){return e=>{const t=dr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ne.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function Tp(r){const e=r.ptr.out([ne.maxInclusive]).term;return{generic:Ap(e)}}function Ap(r){return e=>{const t=dr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ne.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function Lp(r){const e=r.ptr.out([ne.minExclusive]).term;return{generic:jp(e)}}function jp(r){return e=>{const t=dr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ne.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Op(r){const e=r.ptr.out([ne.minInclusive]).term;return{generic:$p(e)}}function $p(r){return e=>{const t=dr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ne.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function kp(r){const e=[...r.ptr.out([ne.node])].map(t=>r.validator.shape(t));return{generic:Dp(e)}}function Dp(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,ne.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:n.report.results,value:e.valueOrNode})}}}function Mp(r){const e=[...r.ptr.out([ne.property])].map(t=>r.validator.shape(t));return{generic:Cp(e)}}function Cp(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Pp(r){const e=r.validator.shape(r.ptr.out([ne.qualifiedValueShape])),t=r.ptr.out([ne.qualifiedValueShapesDisjoint]).term,n=t?Qr.fromRdf(t):!1,i=r.ptr.out([ne.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=r.ptr.out([ne.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:qp(e,n,s,o)}}function qp(r,e,t,n){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ne.property]).out([ne.property]).out([ne.qualifiedValueShape]).filter(l=>!l.term.equals(r.ptr.term)).map(l=>i.shape.validator.shape(l))));const o=(await ep(i.values,async l=>{const d=(await r.validate(i.create({child:!0,focusNode:l}))).report;if(s.push(d.results),!d.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const h=await Cn([...a],async y=>(await y.validate(i.create({child:!0,focusNode:l}))).report);return s.push(h.flatMap(y=>y.results)),!h.every(y=>y.conforms)}else return!await Zh([...a],async h=>(await h.validate(i.create({child:!0,focusNode:l}))).report.conforms)})).length;t!==null&&i.test(o<=t,ne.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,ne.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 Bp(r,e){return e?e.slice(0,r.length)===r:!1}function Fp(r){const e=[...new Set([...r.ptr.out([ne.languageIn]).list()].map(t=>t.value))];return{generic:Up(e)}}function Up(r){return e=>{const t=r.some(n=>Bp(n,e.valueOrNode.term.language));e.test(t,ne.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function Hp(r){const e=parseInt(r.ptr.out([ne.maxLength]).value);return{generic:Vp(e)}}function Vp(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ne.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Gp(r){const e=parseInt(r.ptr.out([ne.minLength]).value);return{generic:Wp(e)}}function Wp(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ne.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function zp(r){const e=r.ptr.out([ne.pattern]).value,t=r.ptr.out([ne.flags]).value,n=new RegExp(e,t);return{generic:Jp(e,t,n)}}function Jp(r,e,t){return n=>{n.test(t.test(n.valueOrNode.term.value),ne.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function Qp(r){const e=r.ptr.out([ne.uniqueLang]).term;return e.value==="true"&&fa.boolean.equals(e.datatype)?{property:Xp()}:null}function Xp(){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(ne.UniqueLangConstraintComponent,{args:{lang:n},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ne.UniqueLangConstraintComponent)}}const bn=nt("http://www.w3.org/ns/shacl#"),hc=nt("https://schemas.link/shacl-next#");class or{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(bn.Info)||e.severity.equals(bn.Violation)||e.severity.equals(bn.Warning))}}function Kp(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=Je(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class In{constructor({args:e={},factory:t,message:n=[],severity:i=bn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(Kp(s.value,e),s.language||null))}}class ga{constructor({factory:e=da}={}){this.factory=e}clone({factory:e}={}){return new ga({factory:e||this.factory})}validate(){return new or}validateSimple(){return!0}}class fr 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 fr({datatypes:this.datatypes,factory:e||this.factory})}}class Yp{constructor({factory:e=da,validations:t}={}){if(this.factory=e,this.validations=new cr,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 Ae extends fr{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 Ae(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(n=>{let i;n.test(e.value)&&(i=hc.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new In({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 Zp=/^([-+]?[0-9]+)$/;class We extends Ae{constructor(e=null,t=null,n,{factory:i}={}){super(Zp,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 We(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!hc.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 In({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 In({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 ya extends fr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new ya(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 In({factory:this.factory,message:i}))}return new or({results:t})}validateSimple(e){return this.values.has(e.value)}}const Se={xsd:nt("http://www.w3.org/2001/XMLSchema#")},eg=new fr({datatypes:Se.xsd.anySimpleType}),tg=new fr({datatypes:Se.xsd.anyAtomicType}),Pn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,rg=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,pc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,ma=/^(-?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)))))$/,gc=/^(-?([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))?)$/,ng=/^((([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))?)$/,ig=/^(-?([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))?)$/,sg=/^(-?([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))?)$/,ag=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,og=/^(--(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))?)$/,lg=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,ug=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,cg=/^(([0-9a-fA-F]{2})*)$/,dg=/^(((([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] ?= ?=))?)$/,fg=new Ae(Pn,Se.xsd.string),hg=new ya(["1","true","0","false"],Se.xsd.boolean),pg=new Ae(rg,Se.xsd.decimal),gg=new Ae(pc,Se.xsd.float),yg=new Ae(pc,Se.xsd.double),mg=new Ae(ma,Se.xsd.duration),bg=new Ae(gc,Se.xsd.dateTime),wg=new Ae(ng,Se.xsd.time),vg=new Ae(ig,Se.xsd.date),_g=new Ae(sg,Se.xsd.gYearMonth),xg=new Ae(ag,Se.xsd.gYear),Sg=new Ae(og,Se.xsd.gMonthDay),Eg=new Ae(lg,Se.xsd.gDay),Ig=new Ae(ug,Se.xsd.gMonth),Rg=new Ae(cg,Se.xsd.hexBinary),Ng=new Ae(dg,Se.xsd.base64Binary),Tg=new Ae(Pn,Se.xsd.anyURI),yc=/^([^\u000d\u000a\u0009]*)$/,Ag=/^([^ ]+( [^ ]+)*)*$/,Lg=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,jg=/^([^DT]*)$/,Og=/^([^YM]*[DT].*)$/,$g=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,kg=new Ae([Pn,yc],Se.xsd.normalizedString),Dg=new Ae([Pn,yc,Ag],Se.xsd.token),Mg=new Ae(Lg,Se.xsd.language),Cg=new We(null,null,Se.xsd.integer),Pg=new We(null,"0",Se.xsd.nonPositiveInteger),qg=new We(null,"-1",Se.xsd.negativeInteger),Bg=new We("-9223372036854775808","9223372036854775807",Se.xsd.long),Fg=new We("-2147483648","2147483647",Se.xsd.int),Ug=new We("-32768","32767",Se.xsd.short),Hg=new We("-128","127",Se.xsd.byte),Vg=new We("0",null,Se.xsd.nonNegativeInteger),Gg=new We("0","18446744073709551615",Se.xsd.unsignedLong),Wg=new We("0","4294967295",Se.xsd.unsignedInt),zg=new We("0","65535",Se.xsd.unsignedShort),Jg=new We("0","255",Se.xsd.unsignedByte),Qg=new We("1",null,Se.xsd.positiveInteger),Xg=new Ae([ma,jg],Se.xsd.yearMonthDuration),Kg=new Ae([ma,Og],Se.xsd.dayTimeDuration),Yg=new Ae([gc,$g],Se.xsd.dateTimeStamp),Zg=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:tg,anySimpleType:eg,anyURI:Tg,base64Binary:Ng,boolean:hg,byte:Hg,date:vg,dateTime:bg,dateTimeStamp:Yg,dayTimeDuration:Kg,decimal:pg,double:yg,duration:mg,float:gg,gDay:Eg,gMonth:Ig,gMonthDay:Sg,gYear:xg,gYearMonth:_g,hexBinary:Rg,int:Fg,integer:Cg,language:Mg,long:Bg,negativeInteger:qg,nonNegativeInteger:Vg,nonPositiveInteger:Pg,normalizedString:kg,positiveInteger:Qg,short:Ug,string:fg,time:wg,token:Dg,unsignedByte:Jg,unsignedInt:Wg,unsignedLong:Gg,unsignedShort:zg,yearMonthDuration:Xg},Symbol.toStringTag,{value:"Module"}));class ey extends Yp{constructor({factory:e}={}){super({factory:e,validations:{...Zg}})}}const ty=new cr([[ne.BlankNode,new Set(["BlankNode"])],[ne.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ne.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ne.IRI,new Set(["NamedNode"])],[ne.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ne.Literal,new Set(["Literal"])]]);function ry(r){const e=r.ptr.out([ne.class]).map(t=>Ps(t));return{generic:ny(e)}}function ny(r){return e=>{const t=new tt(e.valueOrNode.out([Ht.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ne.ClassConstraintComponent,{value:e.valueOrNode})}}}function iy(r){const e=r.ptr.out([ne.datatype]).term,t=new ey;return{generic:sy(e,t)}}function sy(r,e){return t=>{const n=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(n,ne.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function ay(r){const e=r.ptr.out([ne.nodeKind]).term,t=ty.get(e);return{generic:oy(e,t)}}function oy(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ne.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const ly=new cr([[ne.maxCount,Qh],[ne.minCount,Kh],[ne.and,rp],[ne.not,ip],[ne.or,ap],[ne.xone,lp],[ne.closed,cp],[ne.hasValue,fp],[ne.in,gp],[ne.disjoint,mp],[ne.equals,wp],[ne.lessThan,xp],[ne.lessThanOrEquals,Ep],[ne.maxExclusive,Rp],[ne.maxInclusive,Tp],[ne.minExclusive,Lp],[ne.minInclusive,Op],[ne.node,kp],[ne.property,Mp],[ne.qualifiedValueShape,Pp],[ne.languageIn,Fp],[ne.maxLength,Hp],[ne.minLength,Gp],[ne.pattern,zp],[ne.uniqueLang,Qp],[ne.class,ry],[ne.datatype,iy],[ne.nodeKind,ay]]);class uy{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new Dh(ly),this.shapesPtr=new En({dataset:e,factory:t}),this.shapes=new cr,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([ne.targetClass]),...this.shapesPtr.hasOut([ne.targetNode]),...this.shapesPtr.hasOut([ne.targetObjectsOf]),...this.shapesPtr.hasOut([ne.targetSubjectsOf]),...this.shapesPtr.hasOut([Ht.type],[ne.NodeShape]),...this.shapesPtr.hasOut([Ht.type],[ne.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 Jh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new En({...e,factory:this.factory}),i=new ha({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 l of o)await s.validate(a.create({focusNode:l}))}return i.report}}let cy=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new bl(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 bl.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.initDebounceTimeout=setTimeout(async()=>{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 bd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Nt(e,this.config,this.config.attributes.valuesSubject?xe.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(xe.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,wn)>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)}},200)}serialize(e="text/turtle",t=this.toRDF()){const n=t.getQuads(null,null,null,null);return pd(n,e,this.config.prefixes)}toRDF(e=new Fe){return this.shape?.toRDF(e),e}registerPlugin(e){md(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Xf(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?.toRDF(this.config.store),this.shape&&this.config.store.add(new Nn(this.shape.shaclSubject,xe.namedNode(be+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,n=await new uy(t,{details:!0,factory:xe}).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 l=this.form.querySelectorAll(`
345
344
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
346
345
  :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor,
347
346
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
348
347
  :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor`);l.length===0&&(l=this.form.querySelectorAll(`
349
348
  :scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'],
350
- :scope [data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}']`));for(const d of l)if(d.classList.contains("editor")){if(!e||d.value){let h=d.parentElement;h.classList.add("invalid"),h.classList.remove("valid"),h.appendChild(this.createValidationErrorDisplay(i));do h instanceof Qe&&(h.open=!0),h=h.parentElement;while(h)}}else e||(d.classList.add("invalid"),d.classList.remove("valid"),d.appendChild(this.createValidationErrorDisplay(i,"node")))}else e||this.form.querySelector(`:scope [data-node-id='${a.id}']`)?.prepend(this.createValidationErrorDisplay(i,"node"))}return r}catch(t){return console.error(t),!1}}createValidationErrorDisplay(e,t){const r=document.createElement("span");if(r.classList.add("validation-error"),t&&r.classList.add(t),e)if(e.message?.length>0)for(const i of e.message)r.title+=i.value+`
351
- `;else r.title=e.sourceConstraintComponent?.value;return r}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=xe.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,Ue,ln,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,ut)>0){const t=xe.namedNode(this.config.attributes.valuesSubject),r=[...this.config.store.getQuads(t,Ue,null,ut),...this.config.store.getQuads(t,Ts,null,ut)];if(r.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${Ue.id} nor ${Ts.id} statement`);return}for(const i of r)if(this.config.store.getQuads(i.object,Ue,ln,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,Wr,r[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,Ue,ln,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,Ue,ln,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,ut))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const fy=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
349
+ :scope [data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}']`));for(const d of l)if(d.classList.contains("editor")){if(!e||d.value){let h=d.parentElement;h.classList.add("invalid"),h.classList.remove("valid"),h.appendChild(this.createValidationErrorDisplay(i));do h instanceof Qe&&(h.open=!0),h=h.parentElement;while(h)}}else e||(d.classList.add("invalid"),d.classList.remove("valid"),d.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+`
350
+ `;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=xe.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,Ue,ln,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,ut)>0){const t=xe.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,Ue,null,ut),...this.config.store.getQuads(t,Ts,null,ut)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${Ue.id} nor ${Ts.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,Ue,ln,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,Wr,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,Ue,ln,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,Ue,ln,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,ut))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}};const dy=`.editor:not([type='checkbox']) { border: 1px solid #DDD; }
352
351
  .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; }
353
352
  .property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
354
353
  .mode-edit .property-instance label { width: var(--label-width); }
355
- `;class hy extends hd{constructor(e){super(e||fy),this.idCtr=0}createDefaultTemplate(e,t,r,i,s){i.id=`e${this.idCtr++}`,i.classList.add("editor"),s?.datatype?i.shaclDatatype=s.datatype:t instanceof Ze&&(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 Rn&&(i.dataset.nodeKind=be+"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),r&&(i.setAttribute("required","true"),a.classList.add("required"));const l=document.createElement("div");return l.appendChild(a),l.appendChild(i),l}createDateEditor(e,t,r,i){const s=new ke;i.datatype?.value===Rt+"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,r,s,i);if(t)try{let o=new Date(t.value).toISOString();i.datatype?.value===Rt+"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,r,i){let s;return i.singleLine===!1?(s=new Ft,s.resize="auto"):s=new ke,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,r,s,i)}createLangStringEditor(e,t,r,i){const s=this.createTextEditor(e,t,r,i),a=s.querySelector(":scope .editor");let o;if(i.languageIn?.length){o=document.createElement("select");for(const l of i.languageIn){const d=document.createElement("option");d.innerText=l.value,o.appendChild(d)}}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",l=>{l.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof Ze&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),s}createBooleanEditor(e,t,r,i){const s=document.createElement("input");s.type="checkbox",s.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,r,s,i);return s.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof Ze&&(s.checked=t.value==="true"),a}createFileEditor(e,t,r,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,r,s,i)}createNumberEditor(e,t,r,i){const s=new ke;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!==Rt+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,r,s,i)}createListEditor(e,t,r,i,s){const a=new Me;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,r,a,s),l=document.createElement("ul");let d=!0;const h=(y,w)=>{const g=document.createElement("li");if(typeof y.value=="string"?(g.dataset.value=y.value,g.innerText=y.label?y.label:y.value):(y.value instanceof Ze&&y.value.datatype.equals(sd)?g.dataset.value=y.value.value:g.dataset.value=y.value.id,g.innerText=y.label?y.label:y.value.value),w.appendChild(g),y.children?.length){d=!1;const m=document.createElement("ul");g.appendChild(m);for(const _ of y.children)h(_,m)}};for(const y of i)h(y,l);return d||(a.collapse=!0),a.appendChild(l),t&&(a.value=t.value),o}createButton(e,t){const r=document.createElement("button");return r.type="button",r.innerHTML=e,r}}class py extends dy{constructor(){super(new hy)}}window.customElements.define("shacl-form",py);export{wl as Config,Xf as Loader,xy as Plugin,py as ShaclForm,dd as ShaclPropertyTemplate,hd as Theme,qt as findLabel,bd as registerPlugin,Kf as setSharedShapesGraph};
354
+ `;class fy extends fd{constructor(e){super(e||dy),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 Ze&&(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 Rn&&(i.dataset.nodeKind=be+"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 l=document.createElement("div");return l.appendChild(a),l.appendChild(i),l}createDateEditor(e,t,n,i){const s=new ke;i.datatype?.value===Rt+"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===Rt+"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 Ft,s.resize="auto"):s=new ke,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 l of i.languageIn){const d=document.createElement("option");d.innerText=l.value,o.appendChild(d)}}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",l=>{l.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof Ze&&(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 Ze&&(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 ke;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!==Rt+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new Me;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),l=document.createElement("ul");let d=!0;const h=(y,w)=>{const g=document.createElement("li");if(typeof y.value=="string"?(g.dataset.value=y.value,g.innerText=y.label?y.label:y.value):(y.value instanceof Ze&&y.value.datatype.equals(id)?g.dataset.value=y.value.value:g.dataset.value=y.value.id,g.innerText=y.label?y.label:y.value.value),w.appendChild(g),y.children?.length){d=!1;const m=document.createElement("ul");g.appendChild(m);for(const _ of y.children)h(_,m)}};for(const y of i)h(y,l);return d||(a.collapse=!0),a.appendChild(l),t&&(a.value=t.value),o}createButton(e,t){const n=document.createElement("button");return n.type="button",n.innerHTML=e,n}}class hy extends cy{constructor(){super(new fy)}}window.customElements.define("shacl-form",hy);export{bl as Config,Qf as Loader,_y as Plugin,hy as ShaclForm,cd as ShaclPropertyTemplate,fd as Theme,Pt as findLabel,md as registerPlugin,Xf as setSharedShapesGraph};