@ulb-darmstadt/shacl-form 1.8.2 → 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.
- package/README.md +14 -12
- package/dist/constants.d.ts +2 -0
- package/dist/form-bootstrap.js +70 -67
- package/dist/form-default.js +58 -55
- package/dist/form-material.js +100 -97
- package/dist/plugins/leaflet.js +7 -7
- package/dist/plugins/mapbox.js +19 -19
- package/package.json +3 -3
- package/src/constants.ts +2 -0
- package/src/property.ts +1 -0
- package/src/styles.css +2 -2
- package/src/util.ts +42 -22
package/dist/form-default.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
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 Ra;function bt(){return Ra||(Ra=1,function(r){const e=_c(),t=xc(),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"||Se(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,Se(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(Se(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+=Be[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=ve(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=ve(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=ve(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=ve(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=ve(function(u,f=0){return z(this,u,f,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=ve(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=ve(function(u,f=0){return z(this,u,f,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=ve(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 Se(E){return E!==E}const Be=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 ve(E){return typeof BigInt>"u"?He:E}function He(){throw new Error("BigInt not supported")}}(Vn)),Vn}var Sc=bt();const hr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",pr="http://www.w3.org/2001/XMLSchema#",Zr="http://www.w3.org/2000/10/swap/",Pe={xsd:{decimal:`${pr}decimal`,boolean:`${pr}boolean`,double:`${pr}double`,integer:`${pr}integer`,string:`${pr}string`},rdf:{type:`${hr}type`,nil:`${hr}nil`,first:`${hr}first`,rest:`${hr}rest`,langString:`${hr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Zr}reify#forSome`,forAll:`${Zr}reify#forAll`},log:{implies:`${Zr}log#implies`,isImpliedBy:`${Zr}log#isImpliedBy`}},{xsd:en}=Pe,Ec=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Na={"\\":"\\","'":"'",'"':'"',n:`
|
|
7
|
-
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Ic=/[\x00-\x20<>\\"\{\}\|\^\`]/,Rc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Nc=/$0^/;class Tc{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 Rc)&&this[t]instanceof RegExp&&(this[t]=Nc)}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||Ic.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"?en.double:typeof m[2]=="string"?en.decimal:en.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=en.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(Ec,(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 Na?Na[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=Sc.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:Ac,xsd:Mt}=Pe;let ar,Lc=0;const Ee={namedNode:cu,blankNode:du,variable:hu,literal:fu,defaultGraph:kc,quad:Is,triple:Is,fromTerm:kr,fromQuad:pu};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 In=class extends at{get termType(){return"NamedNode"}},Ze=class uu 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 In(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:Ac.langString}equals(e){return e instanceof uu?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}}}},jc=class extends at{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Oc=class extends at{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},$c=class extends at{constructor(){return super(""),ar||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};ar=new $c;function $r(r,e,t){if(e=e||Ee,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Ee)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($r(r[0],e,!0),$r(r[1],e,!0),$r(r[2],e,!0),r[3]&&$r(r[3],e,!0))}function Zt(r,e){if(typeof r=="string")return r;if(r instanceof at&&r.termType!=="Quad")return r.id;if(!r)return ar.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=[Zt(r.subject,!0),Zt(r.predicate,!0),Zt(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Zt(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let Rn=class extends at{constructor(e,t,n,i){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=i||ar}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 cu(r){return new In(r)}function du(r){return new jc(r||`n3-${Lc++}`)}function fu(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 hu(r){return new Oc(r)}function kc(){return ar}function Is(r,e,t,n){return new Rn(r,e,t,n)}function kr(r){if(r instanceof at)return r;switch(r.termType){case"NamedNode":return cu(r.value);case"BlankNode":return du(r.value);case"Variable":return hu(r.value);case"DefaultGraph":return ar;case"Literal":return fu(r.value,r.language||r.datatype);case"Quad":return pu(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function pu(r){if(r instanceof Rn)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return Is(kr(r.subject),kr(r.predicate),kr(r.object),kr(r.graph))}let Ta=0;class Rs{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&gu(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 Tc({lineMode:l,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Ta=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=tn}_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${Ta++}_`,this._prefixCallback=s||tn,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=tn):this._readCallback&&(this._readCallback=this._readCallback(d))};a&&(this._lexer.comments=!0,o=(l,d)=>{l!==null?(this._callback(l),this._callback=tn):this._readCallback&&(d.type==="comment"?a(d.value):this._readCallback=this._readCallback(d))}),this._callback=i,this._lexer.tokenize(e,o)}}function tn(){}function gu(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")}gu(Rs.prototype,Ee);function Ns(r){return!!r&&r.termType==="DefaultGraph"}function cn(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const Dc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Mc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Aa="./",Cc="../",Gn="?",La="#";class qs{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Dc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!qs.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",cn(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]===La?l=s.lastIndex-1:(t.push(cn(a[0]),"(?:"),n.push(")?"),a[1]!==Gn?i.push(d=s.lastIndex):(o=d=s.lastIndex,l=this.base.indexOf(La,o),this._pathReplacements[o]=Gn));for(let h=0;h<i.length;h++)this._pathReplacements[i[h]]=Cc.repeat(i.length-h-1);return this._pathReplacements[i[i.length-1]]=Aa,this._baseLength=l>0?l:this.base.length,t.push(cn(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&&!Mc.test(s)?e:i===Aa&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const gr=Ee.defaultGraph(),{rdf:Pc,xsd:Jt}=Pe,ja=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Oa=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,qc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class yr 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=gr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new qs(t.baseIRI)))}get _inDefaultGraph(){return gr.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,n,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
|
|
6
|
+
*/var 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
11
|
`)),this._graph=i,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,s):this._write(`;
|
|
12
12
|
${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s):this._write(`${(this._subject===null?"":`.
|
|
13
13
|
`)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s)}catch(a){s&&s(a)}}_writeQuadLine(e,t,n,i,s){delete this._prefixMatch,this._write(this.quadToString(e,t,n,i),s)}quadToString(e,t,n,i){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(n)}${i&&i.value?` ${this._encodeIriOrBlank(i)} .
|
|
14
14
|
`:` .
|
|
15
|
-
`}`}quadsToString(e){let t="";for(const n of e)t+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return t}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseIri&&(t=this._baseIri.toRelative(t)),
|
|
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(n){let i="",s="";for(const a in this._prefixIRIs)i+=i?`|${a}`:a,s+=(s?"|":"")+this._prefixIRIs[a];i=
|
|
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
|
|
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
|
-
`)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new
|
|
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
|
|
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,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&&((n,i)=>{t=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function
|
|
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,Da;function yu(){return Da||(Da=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,Ma;function Ve(){if(Ma)return Kn;Ma=1;const{format:r,inspect:e}=yu(),{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 mr={exports:{}},Ca;function Hr(){if(Ca)return mr.exports;Ca=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return mr.exports=r,mr.exports.AbortSignal=e,mr.exports.default=r,mr.exports}var rn={exports:{}},Pa;function Nn(){if(Pa)return rn.exports;Pa=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)}rn.exports=s,rn.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 rn.exports}var qa;function ze(){return qa||(qa=1,function(r){const e=bt(),{format:t,inspect:n}=yu(),{codes:{ERR_INVALID_ARG_TYPE:i}}=Ve(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=$e(),l=globalThis.AbortSignal||Hr().AbortSignal,d=globalThis.AbortController||Hr().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:Nn().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 nn={},Yn,Ba;function Qr(){if(Ba)return Yn;Ba=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,Se=4294967295;if(X<se||X>Se)throw new I(le,`>= ${se} && <= ${Se}`,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 Se="must be one of: "+t(n(he,Be=>typeof Be=="string"?`'${Be}'`:y(Be)),", ");throw new S(le,X,Se)}});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),Se=v(he,"allowFunction",!1);if(!v(he,"nullable",!1)&&X===null||!se&&r(X)||typeof X!="object"&&(!Se||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],Se=`${le}[${he}]`;if(se==null)throw new x(Se,"AbortSignal",se);ce(se,Se)}}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 Se=X[se];de(Se,"hints"),he+=Se,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 sn={exports:{}},Zn={exports:{}},Fa;function Ht(){if(Fa)return Zn.exports;Fa=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,Ua;function wt(){if(Ua)return ei;Ua=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 Ha;function Tt(){if(Ha)return sn.exports;Ha=1;const r=Ht(),{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}=Qr(),{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 sn.exports=Y,sn.exports.finished=ee,sn.exports}var ti,Va;function or(){if(Va)return ti;Va=1;const r=Ht(),{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,Ga;function Fs(){if(Ga)return ri;Ga=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=$e(),{EventEmitter:t}=Nn();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:{}},Wa;function Tn(){return Wa||(Wa=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,za;function Bc(){if(za)return ii;za=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,Ja;function An(){if(Ja)return si;Ja=1;const{MathFloor:r,NumberIsInteger:e}=$e(),{validateInteger:t}=Qr(),{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={},an={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var Qa;function Fc(){return Qa||(Qa=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)}}(an,an.exports)),an.exports}var Xa;function Uc(){if(Xa)return ai;Xa=1;var r=Fc().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,Ka;function mu(){if(Ka)return oi;Ka=1;const r=Ht(),{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,Ya;function Ln(){if(Ya)return li;Ya=1;const r=Ht(),{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}=Nn(),{Stream:m,prependListener:_}=Fs(),{Buffer:x}=bt(),{addAbortSignal:S}=Tn(),I=Tt();let b=ze().debuglog("stream",$=>{b=$});const c=Bc(),p=or(),{getHighWaterMark:N,getDefaultHighWaterMark:D}=An(),{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}=Qr(),L=w("kPaused"),{StringDecoder:ee}=Uc(),C=mu();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 Se(this,$,P,!1)},se.prototype.unshift=function($,P){return Se(this,$,P,!0)};function Se($,P,ge,ye){b("readableAddChunk",P);const me=$._readableState;let Fe;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&&(Fe=new q("chunk",["string","Buffer","Uint8Array"],P))),Fe)v($,Fe);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;Be($,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?Be($,me,P,!1):J($,me)):Be($,me,P,!1)}else ye||(me.state&=~ae,J($,me));return!me.ended&&(me.length<me.highWaterMark||me.length===0)}function Be($,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 ve=1073741824;function He($){if($>ve)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(Fe){v(this,Fe)}P.state&=~V,P.reading||($=E(ge,P))}let me;return $>0?me=ba($,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 Fe=(!P||P.end!==!1)&&$!==r.stdout&&$!==r.stderr?va:dr;ye.endEmitted?r.nextTick(Fe):ge.once("end",Fe),$.on("unpipe",Ye);function Ye(jt,pt){b("onunpipe"),jt===ge&&pt&&pt.hasUnpiped===!1&&(pt.hasUnpiped=!0,bc())}function va(){b("onend"),$.end()}let Lt,_a=!1;function bc(){b("cleanup"),$.removeListener("close",Un),$.removeListener("finish",Hn),Lt&&$.removeListener("drain",Lt),$.removeListener("error",Fn),$.removeListener("unpipe",Ye),ge.removeListener("end",va),ge.removeListener("end",dr),ge.removeListener("data",Sa),_a=!0,Lt&&ye.awaitDrainWriters&&(!$._writableState||$._writableState.needDrain)&&Lt()}function xa(){_a||(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",Sa);function Sa(jt){b("ondata");const pt=$.write(jt);b("dest.write",pt),pt===!1&&xa()}function Fn(jt){if(b("onerror",jt),dr(),$.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),dr()}$.once("close",Un);function Hn(){b("onfinish"),$.removeListener("close",Un),dr()}$.once("finish",Hn);function dr(){b("unpipe"),ge.unpipe($)}return $.emit("pipe",ge),$.writableNeedDrain===!0?xa():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 Fe=0;Fe<me.length;Fe++)me[Fe].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 ma(this)},se.prototype.iterator=function($){return $!==void 0&&Y($,"options"),ma(this,$)};function ma($,P){typeof $.read!="function"&&($=se.wrap($,{objectMode:!0}));const ge=gc($,P);return ge.stream=$,ge}async function*gc($,P){let ge=K;function ye(Ye){this===$?(ge(),ge=K):ge=Ye}$.on("readable",ye);let me;const Fe=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),Fe())}}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=ba;function ba($,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(yc,P,$))}function yc($,P){if(b("endReadableNT",$.endEmitted,$.length),!$.errored&&!$.closeEmitted&&!$.endEmitted&&$.length===0){if($.endEmitted=!0,P.emit("end"),P.writable&&P.allowHalfOpen===!1)r.nextTick(mc,P);else if($.autoDestroy){const ge=P._writableState;(!ge||ge.autoDestroy&&(ge.finished||ge.writable===!1))&&P.destroy()}}}function mc($){$.writable&&!$.writableEnded&&!$.destroyed&&$.end()}se.from=function($,P){return C(se,$,P)};let Bn;function wa(){return Bn===void 0&&(Bn={}),Bn}return se.fromWeb=function($,P){return wa().newStreamReadableFromReadableStream($,P)},se.toWeb=function($,P){return wa().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,Fe){p.destroyer($,me),Fe(me)}}).wrap($)},li}var ui,Za;function Us(){if(Za)return ui;Za=1;const r=Ht(),{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}=Nn(),y=Fs().Stream,{Buffer:w}=bt(),g=or(),{addAbortSignal:m}=Tn(),{getHighWaterMark:_,getDefaultHighWaterMark:x}=An(),{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 Se=X;Se<re.length;++Se)re[Se].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 Se=de?1:le.length;C(O,G,!1,Se,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,eo;function Hc(){if(eo)return ci;eo=1;const r=Ht(),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:_}=or(),x=yt(),S=Ln(),I=Us(),{createDeferredPromise:b}=ze(),c=mu(),p=globalThis.Blob||e.Blob,N=typeof p<"u"?function(A){return A instanceof p}:function(A){return!1},D=globalThis.AbortController||Hr().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,to;function yt(){if(to)return di;to=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=$e();di=a;const i=Ln(),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=Hc()),d(h,"body")},di}var fi,ro;function bu(){if(ro)return fi;ro=1;const{ObjectSetPrototypeOf:r,Symbol:e}=$e();fi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=Ve().codes,n=yt(),{getHighWaterMark:i}=An();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,no;function wu(){if(no)return hi;no=1;const{ObjectSetPrototypeOf:r}=$e();hi=t;const e=bu();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,io;function Hs(){if(io)return pi;io=1;const r=Ht(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=$e(),s=Tt(),{once:a}=ze(),o=or(),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}=Qr(),{isIterable:I,isReadable:b,isReadableNodeStream:c,isNodeStream:p,isTransformStream:N,isWebStream:D,isReadableStream:T,isReadableFinished:q}=wt(),R=globalThis.AbortController||Hr().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=Ln()),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 Se;if(he&&(!fe||fe.code==="ERR_STREAM_PREMATURE_CLOSE")&&(fe=he),!(!fe&&!se)){for(;G.length;)G.shift()(fe);(Se=ce)===null||Se===void 0||Se[i](),V.abort(),se&&(fe||Z.forEach(Be=>Be()),r.nextTick(ae,fe,O))}}let pe;for(let he=0;he<z.length;he++){const se=z[he],Se=he<z.length-1,Be=he>0,ve=Se||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(ve){const{destroy:u,cleanup:f}=j(se,Se,Be);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}),Se){if(!I(pe,!0))throw new y("AsyncIterable",`transform[${he-1}]`,pe)}else{var le;M||(M=wu());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),ve&&E.end(),r.nextTick(ue)},J=>{E.destroy(J),r.nextTick(ue,J)});else if(I(pe,!0))re++,C(pe,E,ue,{end:ve});else if(T(pe)||N(pe)){const J=pe.readable||pe;re++,C(J,E,ue,{end:ve})}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:ve});b(se)&&He&&Z.push(E)}else if(N(pe)||T(pe)){const E=pe.readable||pe;re++,C(E,se,ue,{end:ve})}else if(I(pe))re++,C(pe,se,ue,{end:ve});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:ve});else if(T(pe)||I(pe))re++,K(pe,se,ue,{end:ve});else if(N(pe))re++,K(pe.readable,se,ue,{end:ve});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,so;function vu(){if(so)return gi;so=1;const{pipeline:r}=Hs(),e=yt(),{destroyer:t}=or(),{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 ao;function Vc(){if(ao)return nn;ao=1;const r=globalThis.AbortController||Hr().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}=Qr(),d=$e().Symbol("kWeak"),h=$e().Symbol("kResistStopPropagation"),{finished:y}=Tt(),w=vu(),{addAbortSignalNoValidate:g}=Tn(),{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,Se()}function Se(){pe&&!X&&le<te&&re.length<ce&&(pe(),pe=null)}async function Be(){try{for await(let ve of G){if(X)return;if(O.aborted)throw new s;try{if(ve=F(ve,ue),ve===M)continue;ve=T(ve)}catch(He){ve=D(He)}le+=1,q(ve,se,he),re.push(ve),de&&(de(),de=null),!X&&(re.length>=ce||le>=te)&&await new N(He=>{pe=He})}re.push(B)}catch(ve){const He=D(ve);q(He,se,he),re.push(He)}finally{X=!0,de&&(de(),de=null)}}Be();try{for(;;){for(;re.length>0;){const ve=await re[0];if(ve===B)return;if(O.aborted)throw new s;ve!==M&&(yield ve),re.shift(),Se()}await new N(ve=>{de=ve})}}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 nn.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},nn.promiseReturningOperators={every:ee,forEach:K,reduce:Q,toArray:z,some:L,find:C},nn}var yi,oo;function _u(){if(oo)return yi;oo=1;const{ArrayPrototypePop:r,Promise:e}=$e(),{isIterable:t,isNodeStream:n,isWebStream:i}=wt(),{pipelineImpl:s}=Hs(),{finished:a}=Tt();xu();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 lo;function xu(){if(lo)return zn.exports;lo=1;const{Buffer:r}=bt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=$e(),{promisify:{custom:i}}=ze(),{streamReturningOperators:s,promiseReturningOperators:a}=Vc(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=Ve(),l=vu(),{setDefaultHighWaterMark:d,getDefaultHighWaterMark:h}=An(),{pipeline:y}=Hs(),{destroyer:w}=or(),g=Tt(),m=_u(),_=wt(),x=zn.exports=Fs().Stream;x.isDestroyed=_.isDestroyed,x.isDisturbed=_.isDisturbed,x.isErrored=_.isErrored,x.isReadable=_.isReadable,x.isWritable=_.isWritable,x.Readable=Ln();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=bu(),x.PassThrough=wu(),x.pipeline=y;const{addAbortSignal:S}=Tn();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 uo;function Gc(){return uo||(uo=1,function(r){const e=xu(),t=_u(),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 Su=Gc();const mi=Symbol("iter");function Pr(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=Pr(r[n]||Object.create(null),e[n],t-1);return r}function Eu(r,e,t=4){let n=!1;for(const i in r)if(i in e){const s=t===0?null:Eu(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 Iu(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:Pr({},r[i],t-1);else if(t!==0){const s=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}class Wc{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||Ee}_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 $r(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[Zt(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)}`}`:Zt(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 Ue{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||Ee,this._entityIndex=t.entityIndex||new Wc({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 Su.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 Ue&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Pr(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 Ue)||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 Ue({entityIndex:this._entityIndex});if(e instanceof Ue&&e._entityIndex===this._entityIndex){const t=new Ue({entityIndex:this._entityIndex}),n=Iu(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 Ue({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 Ue({entityIndex:this._entityIndex});return t._graphs=Pr(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof Ue&&this._entityIndex===e._entityIndex){const t=new Ue({entityIndex:this._entityIndex}),n=Eu(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 Ue({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 Ue({entityIndex:this._entityIndex});return t._graphs=Pr(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 Su.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 Ue({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#",co="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#",zc="http://www.w3.org/2004/02/skos/core#",Jc="http://www.w3.org/2002/07/owl#",Qc="http://www.w3.org/ns/oa#",Xc="http://purl.org/dc/terms/",Kc="http://xmlns.com/foaf/0.1/",bn=Ee.namedNode("loaded-shapes"),ut=Ee.namedNode("loaded-data"),qe=Ee.namedNode(Vs+"type"),Ts=Ee.namedNode(Xc+"conformsTo"),Yc=Ee.namedNode(Gs+"subClassOf"),Ws=Ee.namedNode(Jc+"imports"),on=Ee.namedNode(be+"NodeShape"),Zc=Ee.namedNode(be+"IRI"),wn=Ee.namedNode(be+"property"),zs=Ee.namedNode(be+"class"),Vr=Ee.namedNode(be+"targetClass"),ed=Ee.namedNode(be+"nodeKind"),td=Ee.namedNode(Rt+"string");function qr(r,e,t=be,n){let i="";const s=rd(r,e,t,n);return s&&(i=s.value),i}function rd(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 nd(r){r.querySelector("input,select,textarea")?.focus()}function jn(r,e){return qr(r,"prefLabel",zc,e)||qr(r,"label",Gs,e)||qr(r,"name",Kc,e)}function Ru(r,e,t){const n=[];for(const i of r)n.push({value:i,label:jn(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 Nu(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(qe,r,s)));e.parent&&Nu(r,e.parent,t,n,i)}function Js(r,e){let t;if(e.shaclIn){const i=e.config.lists[e.shaclIn];t=i?.length?i:[]}else t=e.config.store.getSubjects(qe,r,bn),t.push(...e.config.store.getSubjects(qe,r,ut)),Nu(r,e,e.config.store,t);const n=Ru(t,e.config.store,e.config.languages);if(e.shaclIn===void 0)for(const i of e.config.store.getSubjects(Yc,r,null)){const s=Js(i,e);for(const a of s){let o=!1;for(const l of n)e.config.store.countQuads(a.value,qe,l.value,null)>0&&(l.children.push(a),o=!0);o||n.push(a)}}return n}function Ls(r){let e;try{e=new URL(r)}catch{return!1}return e.protocol==="http:"||e.protocol==="https:"}function fo(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 Tu(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],wn,null,null)>0);for(let d=0;d<r.length;d++)if(a){const h=t.store.getObjects(r[d],wn,null),y=[];let w="";for(const g of h){const m=new xn(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 xn(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:jn(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(pn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function id(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,qe,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,Vr,o,null).length>0)return s}if(a.predicate.equals(zs)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(ed)&&a.object.equals(Zc))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function sd(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,wn,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 ad={[`${be}name`]:(r,e)=>{const t=e;r.name=fo(r.config.languages,r.name,t)},[`${be}description`]:(r,e)=>{const t=e;r.description=fo(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)},[`${co}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${co}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Qc}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=Ee.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)},[Ws.id]:(r,e)=>{r.owlImports.push(e)},[zs.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Vr,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 od{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)ad[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||jn(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 ld=`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; }
|
|
@@ -39,7 +39,7 @@ shacl-property:not(.may-remove) > .property-instance > .remove-button:not(.persi
|
|
|
39
39
|
shacl-property:not(.may-remove) > .shacl-or-constraint > .remove-button:not(.persistent) { visibility: hidden; }
|
|
40
40
|
.mode-view .shacl-group:not(:has(shacl-property)) { display: none; }
|
|
41
41
|
.property-instance, .shacl-or-constraint { display: flex; align-items: flex-start; padding: 4px 0; width: 100%; position: relative; }
|
|
42
|
-
.shacl-or-constraint > div { display: flex; flex-grow: 1; }
|
|
42
|
+
.shacl-or-constraint > div { display: flex; flex-grow: 1; align-items: flex-start; }
|
|
43
43
|
.shacl-or-constraint label { display: inline-block; word-break: break-word; width: var(--label-width); line-height: 1em; padding-top: 0.15em; padding-right: 1em; flex-shrink: 0; position: relative; }
|
|
44
44
|
.property-instance label[title] { cursor: help; text-decoration: underline dashed #AAA; }
|
|
45
45
|
.property-instance.linked label:after, label.linked:after { content: '\\1F517'; font-size: 0.6em; padding-left: 6px; }
|
|
@@ -48,7 +48,7 @@ shacl-property:not(.may-remove) > .shacl-or-constraint > .remove-button:not(.per
|
|
|
48
48
|
.editor:not([type='checkbox']) { flex-grow: 1; }
|
|
49
49
|
textarea.editor { resize: vertical; }
|
|
50
50
|
.lang-chooser { border: 0; background-color: #e9e9ed; padding: 2px 4px; align-self: flex-start; }
|
|
51
|
-
.validation-error { position: absolute; left: calc(var(--label-width) - 1em);
|
|
51
|
+
.validation-error { position: absolute; left: calc(var(--label-width) - 1em); color: red; cursor: help; }
|
|
52
52
|
.validation-error::before { content: '\\26a0' }
|
|
53
53
|
.validation-error.node { left: -1em; }
|
|
54
54
|
.invalid > .editor { border-color: red !important; }
|
|
@@ -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
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
89
|
-
\f\r]`,
|
|
90
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
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 ea=globalThis;class Pt extends Qt{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=Cd(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return er}}Pt._$litElement$=!0,Pt.finalized=!0,ea.litElementHydrateSupport?.({LitElement:Pt});const Pd=ea.litElementPolyfillSupport;Pd?.({LitElement:Pt});(ea.litElementVersions??=[]).push("4.2.1");var Cu=r=>{throw TypeError(r)},Pu=(r,e,t)=>e.has(r)||Cu("Cannot "+t),xt=(r,e,t)=>(Pu(r,e,"read from private field"),t?t.call(r):e.get(r)),qd=(r,e,t)=>e.has(r)?Cu("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Bd=(r,e,t,n)=>(Pu(r,e,"write to private field"),e.set(r,t),t);const Vt=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},fn=globalThis,ta=fn.ShadowRoot&&(fn.ShadyCSS===void 0||fn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qu=Symbol(),So=new WeakMap;let Fd=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==qu)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(ta&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=So.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&So.set(e,r))}return r}toString(){return this.cssText}};const Ud=r=>new Fd(typeof r=="string"?r:r+"",void 0,qu),Hd=(r,e)=>{if(ta)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)}},Eo=ta?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Ud(t)})(r):r,{is:Vd,defineProperty:Gd,getOwnPropertyDescriptor:Wd,getOwnPropertyNames:zd,getOwnPropertySymbols:Jd,getPrototypeOf:Qd}=Object,rr=globalThis,Io=rr.trustedTypes,Xd=Io?Io.emptyScript:"",Ro=rr.reactiveElementPolyfillSupport,Ur=(r,e)=>r,_n={toAttribute(r,e){switch(e){case Boolean:r=r?Xd: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}},ra=(r,e)=>!Vd(r,e),No={attribute:!0,type:String,converter:_n,reflect:!1,useDefault:!1,hasChanged:ra};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),rr.litPropertyMetadata??(rr.litPropertyMetadata=new WeakMap);class wr 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=No){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&&Gd(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=Wd(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)??No}static _$Ei(){if(this.hasOwnProperty(Ur("elementProperties")))return;const e=Qd(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ur("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ur("properties"))){const t=this.properties,n=[...zd(t),...Jd(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(Eo(i))}else e!==void 0&&t.push(Eo(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 Hd(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:_n).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:_n;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??ra)(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){}}wr.elementStyles=[],wr.shadowRootOptions={mode:"open"},wr[Ur("elementProperties")]=new Map,wr[Ur("finalized")]=new Map,Ro?.({ReactiveElement:wr}),(rr.reactiveElementVersions??(rr.reactiveElementVersions=[])).push("2.1.0");const Kd={attribute:!0,type:String,converter:_n,reflect:!1,hasChanged:ra},Yd=(r=Kd,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 _e(r){return(e,t)=>typeof t=="object"?Yd(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 na(r){return _e({...r,state:!0,attribute:!1})}const Zd=(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 Zd(t,n,{get(){return s(this)}})}}var ef=Object.defineProperty,Gt=(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&&ef(e,t,i),i};const $s=class extends Pt{constructor(){super(...arguments),this.dense=!1}};$s.shadowRootOptions={...Pt.shadowRootOptions,delegatesFocus:!0},$s.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,30 +114,34 @@ a, a:visited { color: inherit; }
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
*/
|
|
117
|
-
`];let
|
|
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=ks;
|
|
122
|
-
:host
|
|
123
|
-
:host a
|
|
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
|
+
:host { display: inline-flex; }
|
|
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
|
+
:host a:hover { text-shadow: 0 0 1px; }
|
|
125
|
+
:host(:not([icon])) a { background-color: var(--rokit-light-background-color-inner); }
|
|
126
|
+
:host([icon]) a { border-radius: 1em; }
|
|
127
|
+
:host([icon]) a:hover { text-shadow: 0 0 1px var(--rokit-shadow-color-inner); background-color: var(--rokit-light-background-darker-color-inner); }
|
|
124
128
|
:host([dense]) { font-size: 0.65em; }
|
|
125
129
|
:host(.clear) a:before { content: '\u2715'; }
|
|
126
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)); }
|
|
127
131
|
:host(.caret.down) a:before { transform: translate(0.15em, 0.15em) rotate(225deg); }
|
|
128
132
|
:host(.caret.right) a:before { transform: translate(0em, 0em) rotate(-45deg); }
|
|
129
|
-
`];
|
|
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`
|
|
130
134
|
<header part="header">
|
|
131
135
|
<slot name="prefix" part="prefix"></slot>
|
|
132
136
|
<span class="label"><slot name="label" part="label">${this.label}</slot></span>
|
|
133
137
|
<slot name="pre-suffix" part="suffix"></slot>
|
|
134
|
-
<rokit-button id="toggle" part="toggle" class="caret" ?dense="${this.dense}" title="${this.open?"Collapse":"Expand"}"></rokit-button>
|
|
138
|
+
<rokit-button id="toggle" part="toggle" class="caret" icon ?dense="${this.dense}" title="${this.open?"Collapse":"Expand"}"></rokit-button>
|
|
135
139
|
<slot name="suffix" part="suffix"></slot>
|
|
136
140
|
</header>
|
|
137
141
|
<div id="content" part="content">
|
|
138
142
|
<slot @slotchange=${this.onSlotChange}></slot>
|
|
139
143
|
</div>
|
|
140
|
-
`}};Qe.styles=[...
|
|
144
|
+
`}};Qe.styles=[...zt.styles,vt`
|
|
141
145
|
:host { display: flex; flex-direction: column; align-items: stretch; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); }
|
|
142
146
|
:host header { cursor: pointer; }
|
|
143
147
|
:host([dense]) header { padding: 2px 4px; }
|
|
@@ -149,17 +153,17 @@ a, a:visited { color: inherit; }
|
|
|
149
153
|
.label { flex-grow: 1; }
|
|
150
154
|
#content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
|
|
151
155
|
#toggle { margin-left: 3px; }
|
|
152
|
-
`];
|
|
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`
|
|
153
157
|
<slot name="prefix" part="prefix"></slot>
|
|
154
158
|
<div class="wrapper">
|
|
155
159
|
<label for="input" part="label">${this.label}</label>
|
|
156
160
|
${this.renderInput()}
|
|
157
161
|
${this.clearable?ct`
|
|
158
|
-
<rokit-button class="clear" ?dense="${this.dense}" @mousedown="${r=>{r.preventDefault()}}" @click="${r=>{r.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>
|
|
159
163
|
`:De}
|
|
160
164
|
</div>
|
|
161
165
|
<slot name="suffix" part="suffix"></slot>
|
|
162
|
-
`}};
|
|
166
|
+
`}};Cr=new WeakMap;ke.styles=[...ft.styles,vt`
|
|
163
167
|
:host { background-color: var(--rokit-light-background-color-inner); user-select: none; }
|
|
164
168
|
:host([dense]) { padding: 2px 4px; }
|
|
165
169
|
:host(.has-focus:not([readonly])) label, :host(.has-value) label, :host([sticky]) label { font-size: 0.75em; top: 0.5em; font-weight: 600; }
|
|
@@ -173,7 +177,7 @@ a, a:visited { color: inherit; }
|
|
|
173
177
|
:host(.has-label) #input { margin-top: 0.9em; }
|
|
174
178
|
:host(.has-label:not(.has-focus):not(.has-value):not([sticky])) #input { clip-path: polygon(0 0, 0 0, 0 0, 0 0); }
|
|
175
179
|
:host(:not(.has-value)) .clear { visibility: hidden; }
|
|
176
|
-
`];Xe([
|
|
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`
|
|
177
181
|
<rokit-collapsible ?dense="${this.dense}" part="collapsible">
|
|
178
182
|
<slot name="prefix" part="prefix" slot="prefix"></slot>
|
|
179
183
|
<slot name="suffix" part="suffix" slot="suffix"></slot>
|
|
@@ -192,7 +196,7 @@ a, a:visited { color: inherit; }
|
|
|
192
196
|
</ul>
|
|
193
197
|
<slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
|
|
194
198
|
</rokit-collapsible>
|
|
195
|
-
`}};
|
|
199
|
+
`}};Kt=new WeakMap;pn=new WeakMap;Me.styles=[...ft.styles,vt`
|
|
196
200
|
:host { background-color: var(--rokit-light-background-color-inner); user-select: none; padding: 0; }
|
|
197
201
|
:host([dense]) li > div { padding: 4px 2px; }
|
|
198
202
|
:host([dense]) li.large > div, :host([dense]) li.header > div { padding-top: 6px; padding-bottom: 6px; }
|
|
@@ -218,15 +222,14 @@ a, a:visited { color: inherit; }
|
|
|
218
222
|
:host([collapse]) li > div > div { padding-left: 1.8em; }
|
|
219
223
|
:host([collapse]) ul:not(.open) { display: none; }
|
|
220
224
|
:host([collapse]) li:not(.open) > div > .toggle-node::part(link):before { transform: translate(0em, 0em) rotate(-45deg); }
|
|
221
|
-
`];Ge([
|
|
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`
|
|
222
226
|
<textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
|
|
223
227
|
<slot id="content" @slotchange=${this.onSlotChange}></slot>
|
|
224
|
-
`}};
|
|
225
|
-
:host { align-items:
|
|
228
|
+
`}};Ft.styles=[...ke.styles,vt`
|
|
229
|
+
:host, .wrapper { align-items: flex-start; }
|
|
226
230
|
#input { height: initial; }
|
|
227
231
|
#content { display: none; }
|
|
228
|
-
|
|
229
|
-
`];kn([_e()],Bt.prototype,"resize",2);kn([_e()],Bt.prototype,"rows",2);kn([_e()],Bt.prototype,"cols",2);Bt=kn([Vt("rokit-textarea")],Bt);var pf=Object.defineProperty,gf=Object.getOwnPropertyDescriptor,Vu=r=>{throw TypeError(r)},ht=(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),Re=(r,e,t)=>(Gu(r,e,"read from private field"),t?t.call(r):e.get(r)),wi=(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),Oe,gt,Kt;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,Kt)}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")&&un(this,Kt,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);un(this,gt,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else un(this,gt,[this.applyConstraints(parseFloat(this.value))]);else un(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,Kt)&&(t=Math.round(t/Re(this,Kt))*Re(this,Kt)),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 nr||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`
|
|
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`
|
|
230
233
|
${super.renderInput()}
|
|
231
234
|
<div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
|
|
232
235
|
<div id="track"></div>
|
|
@@ -235,7 +238,7 @@ a, a:visited { color: inherit; }
|
|
|
235
238
|
<rokit-slider-knob id="end"></rokit-slider-knob>
|
|
236
239
|
`}
|
|
237
240
|
</div>
|
|
238
|
-
`}};Oe=new WeakMap;gt=new WeakMap;
|
|
241
|
+
`}};Oe=new WeakMap;gt=new WeakMap;Yt=new WeakMap;mt.styles=[...ke.styles,vt`
|
|
239
242
|
:host(.has-label:not(:focus):not(.has-value):not([sticky])) #slider > * { visibility: hidden; }
|
|
240
243
|
:host(.has-label) .wrapper { padding-top: 1em; }
|
|
241
244
|
:host([sticky]) #slider { margin-top: ${.25*It+22}px; }
|
|
@@ -244,7 +247,7 @@ a, a:visited { color: inherit; }
|
|
|
244
247
|
:host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
|
|
245
248
|
#track { height: 2px; flex-grow: 1; background-color: #CCC; }
|
|
246
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; }
|
|
247
|
-
`];ht([
|
|
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`
|
|
248
251
|
:host { position: absolute; width: ${It}px; height: ${It}px; border-radius: ${It}px; background-color: var(--rokit-primary-color-inner); }
|
|
249
252
|
:host(.focus), :host(:hover) { box-shadow: 0 0 0 ${It/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
|
|
250
253
|
label {
|
|
@@ -274,25 +277,25 @@ a, a:visited { color: inherit; }
|
|
|
274
277
|
background-color: inherit;
|
|
275
278
|
clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
|
|
276
279
|
}
|
|
277
|
-
`];ht([_e()],nr.prototype,"offset",2);ht([_e()],nr.prototype,"label",2);nr=ht([Vt("rokit-slider-knob")],nr);class xn extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new od(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=id(n,e,this.template.config);s.length&&(t=pn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=Tu(n,this,this.template.config),Wu(t,""))}else{let n=!1;if(e&&!(e instanceof Ze)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,qe,i,ut)===0&&(n=!0)}t=pn(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=Ee.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=hd(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,Vr,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,Vr,null);for(const i of n)if(this.template.config.store.countQuads(e,qe,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=Js(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(()=>{nd(s),s.classList.remove("fadeIn")},200)});else{const i=document.createElement("ul"),s=document.createElement("li");s.innerHTML="+ 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(pn(this.template,l,!0,!0),e)}e.value=""})}return e}}function pn(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=yd(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=cd(r,e||null,r.config.editMode&&!n),i.classList.add("property-instance"),n&&i.classList.add("linked")}return r.config.editMode&&Wu(i,r.label,t),i.dataset.path=r.path,i}function Wu(r,e,t=!1){const n=new zr;n.classList.add("remove-button","clear"),n.title="Remove "+e,n.dense=!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",xn);function yf(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=qr(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=qr(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 mf(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 bf=new Uint8Array(16);function wf(){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(bf)}const vf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),jo={randomUUID:vf};function Oo(r,e,t){if(jo.randomUUID&&!r)return jo.randomUUID();r=r||{};const n=r.random??r.rng?.()??wf();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,mf(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=Ee.namedNode(t.attributes.valuesNamespace+Oo()):l=Ee.blankNode(Oo())}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,Ws,null,null))this.owlImports.push(h.object);for(const h of t.store.getQuads(e,null,null,null))switch(h.predicate.id){case wn.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,qe,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Ee.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=yf(o,t),this.appendChild(l)),i=l}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new xn(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=sd(i,t,n);if(a.length){for(const o of a)this.addPropertyInstance(o,n,t);s=!0}}s||this.appendChild(Tu(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,$o;function ia(){return $o||($o=1,xi=class zu{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 zu(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={},ko;function _f(){return ko||(ko=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 Yt>"u"?Si:Yt: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="+ 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}/*!
|
|
278
281
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
279
|
-
*/var 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}/*!
|
|
280
283
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
281
|
-
*/var 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}/*!
|
|
282
285
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
283
|
-
*/var Ri,
|
|
284
|
-
`,I}static serializeQuad(m){return
|
|
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`
|
|
285
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`
|
|
286
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}/*!
|
|
287
290
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
288
|
-
*/var 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}/*!
|
|
289
292
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
290
|
-
*/var 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}/*!
|
|
291
294
|
* Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
|
|
292
|
-
*/var 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}/*!
|
|
293
296
|
* Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
|
|
294
|
-
*/var Li,Fo;function Sf(){if(Fo)return Li;Fo=1;const r=Dn(),e=Xu();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 Ef={},If=Object.freeze(Object.defineProperty({__proto__:null,default:Ef},Symbol.toStringTag,{value:"Module"})),Rf=vc(If);var Uo;function Nf(){return Uo||(Uo=1,function(r){const e=Qu(),t=xf(),n=Xu(),i=Sf();let s;try{s=Rf}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=sa(),r.IdentifierIssuer=ia(),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,Ho;function aa(){return Ho||(Ho=1,ji=Nf()),ji}var Oi,Vo;function Ke(){if(Vo)return Oi;Vo=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,Go;function _t(){if(Go)return $i;Go=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,Wo;function rt(){return Wo||(Wo=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,zo;function et(){if(zo)return Di;zo=1;const r=_t(),e=Ke(),t=aa().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,Jo;function oa(){if(Jo)return Mi;Jo=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,Qo;function Ku(){return Qo||(Qo=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,Xo;function At(){if(Xo)return Pi;Xo=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,Ko;function Tf(){if(Ko)return qi;Ko=1;const{parseLinkHeader:r,buildHeaders:e}=et(),{LINK_HEADER_CONTEXT:t}=oa(),n=rt(),i=Ku(),{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,Yo;function Af(){if(Yo)return Bi;Yo=1;const r=Tf(),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,Zo;function Lf(){return Zo||(Zo=1,Fi=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Fi}var Ui,el;function jf(){if(el)return Ui;el=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{Lf()(r)}catch{}return Ui}var Hi,tl;function Yu(){if(tl)return Hi;tl=1;const r=jf(),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,rl;function Of(){if(rl)return Vi;rl=1;const r=Yu(),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,nl;function $f(){if(nl)return Gi;nl=1;const{isArray:r,isObject:e,isString:t}=Ke(),{asArray:n}=et(),{prependBase:i}=At(),s=rt(),a=Of(),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,il;function kf(){return il||(il=1,Wi=aa().NQuads),Wi}var zi,sl;function Xr(){if(sl)return zi;sl=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,al;function Ft(){if(al)return Ji;al=1;const r=et(),e=rt(),{isArray:t,isObject:n,isString:i,isUndefined:s}=Ke(),{isAbsolute:a,isRelative:o,prependBase:l}=At(),{handleEvent:d}=Xr(),{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
|
|
295
|
-
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,ol;function Df(){if(ol)return Qi;ol=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}=Ft(),{isAbsolute:_}=At(),{REGEX_BCP47:x,REGEX_KEYWORD:S,addValue:I,asArray:b,getValues:c,validateTypeValue:p}=et(),{handleEvent:N}=Xr(),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,ll;function Mn(){if(ll)return Xi;ll=1;const{isKeyword:r}=Ft(),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,ul;function Mf(){if(ul)return Ki;ul=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,cl;function Cf(){if(cl)return Yi;cl=1;const r=rt(),e=_t(),t=Ke(),{REGEX_BCP47:n,addValue:i}=et(),{handleEvent:s}=Xr(),{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:_}=oa(),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,dl;function Pf(){return dl||(dl=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,fl;function qf(){if(fl)return es;fl=1;const{createNodeMap:r}=Mn(),{isKeyword:e}=Ft(),t=_t(),n=Pf(),i=rt(),s=Ke(),a=et(),{handleEvent:o}=Xr(),{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}=oa(),{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,hl;function Bf(){if(hl)return ts;hl=1;const{isKeyword:r}=Ft(),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
|
|
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
|
|
296
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)}/**
|
|
297
300
|
* Removes the @preserve keywords from expanded result of framing.
|
|
298
301
|
*
|
|
@@ -301,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
|
|
|
301
304
|
*
|
|
302
305
|
* @return the resulting output.
|
|
303
306
|
*/function x(c,p){if(t.isArray(c))return c.map(N=>x(N,p));if(t.isObject(c)){// remove @preserve
|
|
304
|
-
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,pl;function Ff(){if(pl)return rs;pl=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}=Ft(),{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,gl;function Uf(){return gl||(gl=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}/**
|
|
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}/**
|
|
305
308
|
* A JavaScript implementation of the JSON-LD API.
|
|
306
309
|
*
|
|
307
310
|
* @author Dave Longley
|
|
@@ -335,17 +338,17 @@ if("@preserve"in c)return c["@preserve"][0];if(e.isValue(c))return c;if(e.isList
|
|
|
335
338
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
336
339
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
337
340
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
338
|
-
*/var is,yl;function Hf(){if(yl)return is;yl=1;const r=aa(),e=Af(),t=et(),n=$f(),i=t.IdentifierIssuer,s=rt(),a=Yu(),o=kf(),{expand:l}=Df(),{flatten:d}=Mf(),{fromRDF:h}=Cf(),{toRDF:y}=qf(),{frameMergedOrDefault:w,cleanupNull:g}=Bf(),{isArray:m,isObject:_,isString:x}=Ke(),{isSubjectReference:S}=_t(),{expandIri:I,getInitialContext:b,process:c,processingMode:p}=Ft(),{compact:N,compactIri:D}=Ff(),{createNodeMap:T,createMergedNodeMap:q,mergeNodeMaps:R}=Mn(),{logEventHandler:M,logWarningEventHandler:B,safeEventHandler:A,setDefaultEventHandler:j,setupEventHandler:Y,strictEventHandler:L,unhandledEventHandler:ee}=Xr(),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=Ft().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=Ku(),v.JsonLdProcessor=Uf()(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 Vf=Hf();const ss={},as={};let Ds;class Gf{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 Ue,t.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",e,bn))),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,qe,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,bn)))}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 Rn(w.subject,w.predicate,w.object,n)),this.config.attributes.ignoreOwlImports===null&&Ws.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,Ee.namedNode(m),i)))}if(this.config.classInstanceProvider&&zs.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 Vf.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 Wf(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 ml{constructor(e,t){this.attributes=new os,this.loader=new Gf(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new Ue,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=Ee.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)},qe,`${be}PropertyGroup`,null)}registerPrefixes(e){for(const t in e)t&&(this.prefixes[t]=e[t])}}function zf(r){return"_:"+r.value}function Jf(r,e){return[...r].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(`
|
|
339
342
|
`)+`
|
|
340
|
-
`}function Qf(){return""}function Zu(r){return"<"+r.value+">"}const Xf=/["\\\\\n\r]/,Kf=/["\\\\\n\r]/g,Yf={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function Zf(r){return Yf[r]}function eh(r){return Xf.test(r)?r.replace(Kf,Zf):r}function th(r){const e=eh(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+'"^^'+Zu(r.datatype)}function rh(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 nh(r){return"?"+r.value}function Je(r){if(!r)return null;if(r.termType==="BlankNode")return zf(r);if(r.termType==="DefaultGraph")return Qf();if(r.termType==="Literal")return th(r);if(r.termType==="NamedNode")return Zu(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return rh(r,Je);if(r.termType==="Variable")return nh(r);if(r[Symbol.iterator])return Jf(r,Je);throw new Error(`unknown termType ${r.termType}`)}class lr{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 bl{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 wl(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(wl(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(wl(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}let ec=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};ec.prototype.termType="BlankNode";let la=class{equals(e){return!!e&&e.termType===this.termType}};la.prototype.termType="DefaultGraph";la.prototype.value="";function vl(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 yn=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}};yn.prototype.termType="Literal";let Kr=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};Kr.prototype.termType="NamedNode";let ua=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)}};ua.prototype.termType="Quad";ua.prototype.value="";let tc=class{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}};tc.prototype.termType="Variable";const ih=new Kr("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),_l=new Kr("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),sh=new Kr("http://www.w3.org/2001/XMLSchema#string");let rc=class{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new la}}namedNode(e){return new Kr(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new ec(e)}literal(e,t){return typeof t=="string"?new yn(e,t,_l):typeof t?.language=="string"?new yn(e,t.language,t.direction?ih:_l,t.direction):new yn(e,"",t||sh)}variable(e){return new tc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new ua(e,t,n,i)}fromTerm(e){return vl(this,e)}fromQuad(e){return vl(this,e)}};rc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const ca=new rc,ah={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function nt(r,{factory:e=ca}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,ah)}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 bl({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 bl({dataset:e.dataset,end:n,quad:_,start:t}),e))}return d}}function xl(r,e){return e?t=>e(r.extend(t)):()=>{}}class Sl{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:xl(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:xl(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 El(r,e){return r?r.equals(e):r===e}function oh(r,e){return!(r.dataset!==e.dataset||!El(r.graph,e.graph)||!El(r.term,e.term))}function Il(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class Sn{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 Sl({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=Il(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=Il(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=>oh(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 Sl({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 Ut=nt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),lh=nt("http://www.w3.org/2000/01/rdf-schema#"),ne=nt("http://www.w3.org/ns/shacl#"),Ms=nt("https://schemas.link/shacl-next#"),da=nt("http://www.w3.org/2001/XMLSchema#");function uh(r){return r?`{${[...r.quads()].map(e=>Je(e)).join(" ")}}`:"{}"}function ch(r){return r?`{${r.map(e=>uh(e)).join(" ")}}`:"{}"}var ls,Rl;function dh(){if(Rl)return ls;Rl=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,Nl;function fh(){if(Nl)return us;Nl=1;var r=dh(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return us=t,us}var cs,Tl;function hh(){if(Tl)return cs;Tl=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return cs=r,cs}var ds,Al;function ph(){if(Al)return ds;Al=1;var r=typeof Yt=="object"&&Yt&&Yt.Object===Object&&Yt;return ds=r,ds}var fs,Ll;function gh(){if(Ll)return fs;Ll=1;var r=ph(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return fs=t,fs}var hs,jl;function nc(){if(jl)return hs;jl=1;var r=gh(),e=r.Symbol;return hs=e,hs}var ps,Ol;function yh(){if(Ol)return ps;Ol=1;var r=nc(),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,$l;function mh(){if($l)return gs;$l=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return gs=t,gs}var ys,kl;function bh(){if(kl)return ys;kl=1;var r=nc(),e=yh(),t=mh(),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,Dl;function wh(){if(Dl)return ms;Dl=1;function r(e){return e!=null&&typeof e=="object"}return ms=r,ms}var bs,Ml;function vh(){if(Ml)return bs;Ml=1;var r=bh(),e=wh(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return bs=n,bs}var ws,Cl;function _h(){if(Cl)return ws;Cl=1;var r=fh(),e=hh(),t=vh(),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,Pl;function xh(){if(Pl)return vs;Pl=1;var r=_h(),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,ql;function Sh(){if(ql)return _s;ql=1;var r=xh();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return _s=e,_s}var xs,Bl;function Eh(){if(Bl)return xs;Bl=1;var r=Sh(),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,Fl;function Ih(){if(Fl)return Ss;Fl=1;var r=Eh();function e(t){return r(2,t)}return Ss=e,Ss}var Rh=Ih();const st=wc(Rh);let Ul=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 Sn({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([Ut.type],[ne.ValidationReport]).addOut([ne.conforms],[this.factory.literal(this.conforms.toString(),da.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 Nh(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 Th=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(Nh(g.value,e),g.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([Ut.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 fa{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new Ul({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 fa({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new Ul({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)} - ${ch(this.valuePaths)}`}result(e){const t=new Th({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 Ah(){return{generic:Lh()}}function Lh(){return r=>{r.trace(Ms.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class jh{constructor(e){this.validations=new lr(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(Ah),[...i].map(s=>s(e)).filter(Boolean)}}var $t={},kt={},vr={},Hl;function ic(){if(Hl)return vr;Hl=1,Object.defineProperty(vr,"__esModule",{value:!0}),vr.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 vr.BlankNode=r,vr}var _r={},xr={},Vl;function sc(){if(Vl)return xr;Vl=1,Object.defineProperty(xr,"__esModule",{value:!0}),xr.DefaultGraph=void 0;let r=class{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}};return xr.DefaultGraph=r,r.INSTANCE=new r,xr}var Sr={},Er={},Gl;function ha(){if(Gl)return Er;Gl=1,Object.defineProperty(Er,"__esModule",{value:!0}),Er.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 Er.NamedNode=r,Er}var Wl;function ac(){if(Wl)return Sr;Wl=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.Literal=void 0;const r=ha();let e=class Mr{constructor(n,i){this.termType="Literal",this.value=n,typeof i=="string"?(this.language=i,this.datatype=Mr.RDF_LANGUAGE_STRING,this.direction=""):i?"termType"in i?(this.language="",this.datatype=i,this.direction=""):(this.language=i.language,this.datatype=i.direction?Mr.RDF_DIRECTIONAL_LANGUAGE_STRING:Mr.RDF_LANGUAGE_STRING,this.direction=i.direction||""):(this.language="",this.datatype=Mr.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 Sr.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"),Sr}var Ir={},zl;function oc(){if(zl)return Ir;zl=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.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 Ir.Quad=r,Ir}var Rr={},Jl;function lc(){if(Jl)return Rr;Jl=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.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 Rr.Variable=r,Rr}var Ql;function Oh(){if(Ql)return _r;Ql=1,Object.defineProperty(_r,"__esModule",{value:!0}),_r.DataFactory=void 0;const r=ic(),e=sc(),t=ac(),n=ha(),i=oc(),s=lc();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 _r.DataFactory=o,_r}var Xl;function $h(){return Xl||(Xl=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(ic(),r),t(Oh(),r),t(sc(),r),t(ac(),r),t(ha(),r),t(oc(),r),t(lc(),r)}(kt)),kt}var Dt={},Nr={},Tr={},Kl;function ir(){if(Kl)return Tr;Kl=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.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 Tr.Translator=r,Tr}var Yl;function kh(){if(Yl)return Nr;Yl=1,Object.defineProperty(Nr,"__esModule",{value:!0}),Nr.TypeHandlerBoolean=void 0;const r=ir();let e=class uc{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(uc.TYPE))}};return Nr.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",Nr}var Ar={},Zl;function Dh(){if(Zl)return Ar;Zl=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.TypeHandlerDate=void 0;const r=ir();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 Ar.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]$/},Ar}var Lr={},eu;function Mh(){if(eu)return Lr;eu=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.TypeHandlerNumberDouble=void 0;const r=ir();let e=class cc{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(cc.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 Lr.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"],Lr}var jr={},tu;function Ch(){if(tu)return jr;tu=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.TypeHandlerNumberInteger=void 0;const r=ir();let e=class Cr{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<=Cr.MAX_INT&&n>=Cr.MIN_INT?s.namedNode(Cr.TYPES[0]):s.namedNode(Cr.TYPES[1])))}};return jr.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,jr}var Or={},ru;function Ph(){if(ru)return Or;ru=1,Object.defineProperty(Or,"__esModule",{value:!0}),Or.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return Or.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"],Or}var nu;function iu(){return nu||(nu=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(kh(),r),t(Dh(),r),t(Mh(),r),t(Ch(),r),t(Ph(),r)}(Dt)),Dt}var Es={},su;function qh(){return su||(su=1,Object.defineProperty(Es,"__esModule",{value:!0})),Es}var au;function Bh(){return au||(au=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=$h(),i=iu(),s=ir();t(iu(),r),t(qh(),r),t(ir(),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 Jr=Bh();function ou(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 Fh(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>ou(e)):[ou(r)]}class Uh{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 lr).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 Sn({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[lh.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class Hh{constructor(e){this.targetClass=new tt([...Ps(e.hasOut([Ut.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([Ut.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 Vh{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=st(()=>{const n=this.ptr.out([ne.deactivated]).term;return n&&Jr.fromRdf(n)}),this._message=st(()=>this.ptr.out([ne.message]).terms),this._path=st(()=>Fh(this.ptr.out([ne.path]))),this._severity=st(()=>this.ptr.out([ne.severity]).term),this._shapeValidator=st(()=>new Uh(this)),this._sparql=st(()=>this.ptr.out([ne.sparql])),this._targetResolver=st(()=>new Hh(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 Gh(r){const e=parseInt(r.ptr.out([ne.maxCount]).value);return{property:Wh(e)}}function Wh(r){return e=>{e.test(e.values.terms.length<=r,ne.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function zh(r){const e=parseInt(r.ptr.out([ne.minCount]).value);return{property:Jh(e)}}function Jh(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 Qh(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function Xh(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 Kh(r,e){for(const t of r)if(await e(t))return!0;return!1}function Yh(r){const e=[...r.ptr.out([ne.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:Zh(e)}}function Zh(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 ep(r){const e=r.validator.shape(r.ptr.out([ne.not]));return{generic:tp(e)}}function tp(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 rp(r){const e=[...r.ptr.out([ne.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:np(e)}}function np(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 Kh(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 ip(r){const e=[...r.ptr.out([ne.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:sp(e)}}function sp(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 ap(r){if(!Jr.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:op(n,i)}}function op(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 lp(r){const e=r.ptr.out([ne.hasValue]).term;return{node:up(e),property:cp(e)}}function up(r){return e=>{e.test(r.equals(e.valueOrNode.term),ne.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function cp(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 dp(r){const e=new tt([...r.ptr.out([ne.in]).list()].map(t=>t.term));return{generic:fp(e)}}function fp(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 ur(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||lu(r)!==lu(e))return null;const t=Jr.fromRdf(r),n=Jr.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function lu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return da.dateTime.equals(r.datatype)&&e.test(r.value)}function hp(r){const e=r.ptr.out([ne.disjoint]).term;return{generic:pp(e)}}function pp(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 gp(r){const e=r.ptr.out([ne.equals]).term;return{node:yp(e),property:mp(e)}}function yp(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 mp(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 bp(r){const e=r.ptr.out([ne.lessThan]).term;return{property:wp(e)}}function wp(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=ur(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 vp(r){const e=r.ptr.out([ne.lessThanOrEquals]).term;return{property:_p(e)}}function _p(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=ur(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 xp(r){const e=r.ptr.out([ne.maxExclusive]).term;return{generic:Sp(e)}}function Sp(r){return e=>{const t=ur(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 Ep(r){const e=r.ptr.out([ne.maxInclusive]).term;return{generic:Ip(e)}}function Ip(r){return e=>{const t=ur(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 Rp(r){const e=r.ptr.out([ne.minExclusive]).term;return{generic:Np(e)}}function Np(r){return e=>{const t=ur(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 Tp(r){const e=r.ptr.out([ne.minInclusive]).term;return{generic:Ap(e)}}function Ap(r){return e=>{const t=ur(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 Lp(r){const e=[...r.ptr.out([ne.node])].map(t=>r.validator.shape(t));return{generic:jp(e)}}function jp(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 Op(r){const e=[...r.ptr.out([ne.property])].map(t=>r.validator.shape(t));return{generic:$p(e)}}function $p(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function kp(r){const e=r.validator.shape(r.ptr.out([ne.qualifiedValueShape])),t=r.ptr.out([ne.qualifiedValueShapesDisjoint]).term,n=t?Jr.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:Dp(e,n,s,o)}}function Dp(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 Xh(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 Qh([...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 Mp(r,e){return e?e.slice(0,r.length)===r:!1}function Cp(r){const e=[...new Set([...r.ptr.out([ne.languageIn]).list()].map(t=>t.value))];return{generic:Pp(e)}}function Pp(r){return e=>{const t=r.some(n=>Mp(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 qp(r){const e=parseInt(r.ptr.out([ne.maxLength]).value);return{generic:Bp(e)}}function Bp(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 Fp(r){const e=parseInt(r.ptr.out([ne.minLength]).value);return{generic:Up(e)}}function Up(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 Hp(r){const e=r.ptr.out([ne.pattern]).value,t=r.ptr.out([ne.flags]).value,n=new RegExp(e,t);return{generic:Vp(e,t,n)}}function Vp(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 Gp(r){const e=r.ptr.out([ne.uniqueLang]).term;return e.value==="true"&&da.boolean.equals(e.datatype)?{property:Wp()}:null}function Wp(){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 mn=nt("http://www.w3.org/ns/shacl#"),dc=nt("https://schemas.link/shacl-next#");class sr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(mn.Info)||e.severity.equals(mn.Violation)||e.severity.equals(mn.Warning))}}function zp(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 En{constructor({args:e={},factory:t,message:n=[],severity:i=mn.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(zp(s.value,e),s.language||null))}}class pa{constructor({factory:e=ca}={}){this.factory=e}clone({factory:e}={}){return new pa({factory:e||this.factory})}validate(){return new sr}validateSimple(){return!0}}class cr extends pa{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 cr({datatypes:this.datatypes,factory:e||this.factory})}}class Jp{constructor({factory:e=ca,validations:t}={}){if(this.factory=e,this.validations=new lr,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 sr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Ae extends cr{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=dc.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new En({args:s,factory:this.factory,message:this.message,severity:i})});return new sr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const Qp=/^([-+]?[0-9]+)$/;class We extends Ae{constructor(e=null,t=null,n,{factory:i}={}){super(Qp,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(!dc.Debug.equals(t[0].severity))return new sr({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 En({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 En({factory:this.factory,message:s}))}return new sr({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 ga extends cr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.values=new Set(e)}clone({factory:e}={}){return new ga(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 En({factory:this.factory,message:i}))}return new sr({results:t})}validateSimple(e){return this.values.has(e.value)}}const xe={xsd:nt("http://www.w3.org/2001/XMLSchema#")},Xp=new cr({datatypes:xe.xsd.anySimpleType}),Kp=new cr({datatypes:xe.xsd.anyAtomicType}),Pn=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,Yp=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,fc=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,ya=/^(-?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)))))$/,hc=/^(-?([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))?)$/,Zp=/^((([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))?)$/,eg=/^(-?([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))?)$/,tg=/^(-?([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))?)$/,rg=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,ng=/^(--(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))?)$/,ig=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,sg=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,ag=/^(([0-9a-fA-F]{2})*)$/,og=/^(((([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] ?= ?=))?)$/,lg=new Ae(Pn,xe.xsd.string),ug=new ga(["1","true","0","false"],xe.xsd.boolean),cg=new Ae(Yp,xe.xsd.decimal),dg=new Ae(fc,xe.xsd.float),fg=new Ae(fc,xe.xsd.double),hg=new Ae(ya,xe.xsd.duration),pg=new Ae(hc,xe.xsd.dateTime),gg=new Ae(Zp,xe.xsd.time),yg=new Ae(eg,xe.xsd.date),mg=new Ae(tg,xe.xsd.gYearMonth),bg=new Ae(rg,xe.xsd.gYear),wg=new Ae(ng,xe.xsd.gMonthDay),vg=new Ae(ig,xe.xsd.gDay),_g=new Ae(sg,xe.xsd.gMonth),xg=new Ae(ag,xe.xsd.hexBinary),Sg=new Ae(og,xe.xsd.base64Binary),Eg=new Ae(Pn,xe.xsd.anyURI),pc=/^([^\u000d\u000a\u0009]*)$/,Ig=/^([^ ]+( [^ ]+)*)*$/,Rg=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,Ng=/^([^DT]*)$/,Tg=/^([^YM]*[DT].*)$/,Ag=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Lg=new Ae([Pn,pc],xe.xsd.normalizedString),jg=new Ae([Pn,pc,Ig],xe.xsd.token),Og=new Ae(Rg,xe.xsd.language),$g=new We(null,null,xe.xsd.integer),kg=new We(null,"0",xe.xsd.nonPositiveInteger),Dg=new We(null,"-1",xe.xsd.negativeInteger),Mg=new We("-9223372036854775808","9223372036854775807",xe.xsd.long),Cg=new We("-2147483648","2147483647",xe.xsd.int),Pg=new We("-32768","32767",xe.xsd.short),qg=new We("-128","127",xe.xsd.byte),Bg=new We("0",null,xe.xsd.nonNegativeInteger),Fg=new We("0","18446744073709551615",xe.xsd.unsignedLong),Ug=new We("0","4294967295",xe.xsd.unsignedInt),Hg=new We("0","65535",xe.xsd.unsignedShort),Vg=new We("0","255",xe.xsd.unsignedByte),Gg=new We("1",null,xe.xsd.positiveInteger),Wg=new Ae([ya,Ng],xe.xsd.yearMonthDuration),zg=new Ae([ya,Tg],xe.xsd.dayTimeDuration),Jg=new Ae([hc,Ag],xe.xsd.dateTimeStamp),Qg=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:Kp,anySimpleType:Xp,anyURI:Eg,base64Binary:Sg,boolean:ug,byte:qg,date:yg,dateTime:pg,dateTimeStamp:Jg,dayTimeDuration:zg,decimal:cg,double:fg,duration:hg,float:dg,gDay:vg,gMonth:_g,gMonthDay:wg,gYear:bg,gYearMonth:mg,hexBinary:xg,int:Cg,integer:$g,language:Og,long:Mg,negativeInteger:Dg,nonNegativeInteger:Bg,nonPositiveInteger:kg,normalizedString:Lg,positiveInteger:Gg,short:Pg,string:lg,time:gg,token:jg,unsignedByte:Vg,unsignedInt:Ug,unsignedLong:Fg,unsignedShort:Hg,yearMonthDuration:Wg},Symbol.toStringTag,{value:"Module"}));class Xg extends Jp{constructor({factory:e}={}){super({factory:e,validations:{...Qg}})}}const Kg=new lr([[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 Yg(r){const e=r.ptr.out([ne.class]).map(t=>Ps(t));return{generic:Zg(e)}}function Zg(r){return e=>{const t=new tt(e.valueOrNode.out([Ut.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ne.ClassConstraintComponent,{value:e.valueOrNode})}}}function ey(r){const e=r.ptr.out([ne.datatype]).term,t=new Xg;return{generic:ty(e,t)}}function ty(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 ry(r){const e=r.ptr.out([ne.nodeKind]).term,t=Kg.get(e);return{generic:ny(e,t)}}function ny(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 iy=new lr([[ne.maxCount,Gh],[ne.minCount,zh],[ne.and,Yh],[ne.not,ep],[ne.or,rp],[ne.xone,ip],[ne.closed,ap],[ne.hasValue,lp],[ne.in,dp],[ne.disjoint,hp],[ne.equals,gp],[ne.lessThan,bp],[ne.lessThanOrEquals,vp],[ne.maxExclusive,xp],[ne.maxInclusive,Ep],[ne.minExclusive,Rp],[ne.minInclusive,Tp],[ne.node,Lp],[ne.property,Op],[ne.qualifiedValueShape,kp],[ne.languageIn,Cp],[ne.maxLength,qp],[ne.minLength,Fp],[ne.pattern,Hp],[ne.uniqueLang,Gp],[ne.class,Yg],[ne.datatype,ey],[ne.nodeKind,ry]]);class sy{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new jh(iy),this.shapesPtr=new Sn({dataset:e,factory:t}),this.shapes=new lr,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([Ut.type],[ne.NodeShape]),...this.shapesPtr.hasOut([Ut.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 Vh(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new Sn({...e,factory:this.factory}),i=new fa({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 ay=class extends HTMLElement{constructor(e){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new ml(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 ml.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 gd())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new Nt(e,this.config,this.config.attributes.valuesSubject?Ee.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(Ee.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,bn)>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 dd(n,e,this.config.prefixes)}toRDF(e=new Ue){return this.shape?.toRDF(e),e}registerPlugin(e){pd(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setSharedShapesGraph(e){Wf(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 Rn(this.shape.shaclSubject,Ee.namedNode(be+"targetNode"),this.shape.nodeId,this.config.valuesGraphId));try{const t=this.config.store,n=await new sy(t,{details:!0,factory:Ee}).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(`
|
|
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(`
|
|
341
344
|
:scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
|
|
342
345
|
:scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor,
|
|
343
346
|
:scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
|
|
344
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(`
|
|
345
348
|
:scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'],
|
|
346
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+`
|
|
347
|
-
`;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=
|
|
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; }
|
|
348
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; }
|
|
349
352
|
.property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
|
|
350
353
|
.mode-edit .property-instance label { width: var(--label-width); }
|
|
351
|
-
`;class
|
|
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};
|