@ulb-darmstadt/shacl-form 1.10.3 → 2.0.0-rc1

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.
Files changed (55) hide show
  1. package/README.md +1 -1
  2. package/dist/bundle.js +412 -0
  3. package/dist/constants.d.ts +16 -16
  4. package/dist/constraints.d.ts +2 -2
  5. package/dist/form.d.ts +4 -3
  6. package/dist/index.js +62 -0
  7. package/dist/plugins/assets/plugin-VN3CfgGe.js +1 -0
  8. package/dist/plugins/file-upload.js +1 -0
  9. package/dist/plugins/leaflet.d.ts +3 -1
  10. package/dist/plugins/leaflet.js +5 -708
  11. package/dist/plugins/map-util.js +1 -0
  12. package/dist/{themes/default.d.ts → theme.default.d.ts} +2 -2
  13. package/package.json +28 -33
  14. package/dist/form-bootstrap.d.ts +0 -5
  15. package/dist/form-bootstrap.js +0 -413
  16. package/dist/form-default.d.ts +0 -5
  17. package/dist/form-default.js +0 -402
  18. package/dist/form-material.d.ts +0 -5
  19. package/dist/form-material.js +0 -722
  20. package/dist/plugins/fixed-list.d.ts +0 -9
  21. package/dist/plugins/mapbox.d.ts +0 -19
  22. package/dist/plugins/mapbox.js +0 -2870
  23. package/dist/themes/bootstrap.d.ts +0 -10
  24. package/dist/themes/material.d.ts +0 -15
  25. package/src/config.ts +0 -110
  26. package/src/constants.ts +0 -30
  27. package/src/constraints.ts +0 -149
  28. package/src/exports.ts +0 -7
  29. package/src/form-bootstrap.ts +0 -12
  30. package/src/form-default.ts +0 -12
  31. package/src/form-material.ts +0 -12
  32. package/src/form.ts +0 -319
  33. package/src/globals.d.ts +0 -2
  34. package/src/group.ts +0 -34
  35. package/src/loader.ts +0 -187
  36. package/src/node.ts +0 -192
  37. package/src/plugin.ts +0 -60
  38. package/src/plugins/file-upload.ts +0 -26
  39. package/src/plugins/fixed-list.ts +0 -19
  40. package/src/plugins/leaflet.ts +0 -196
  41. package/src/plugins/map-util.ts +0 -41
  42. package/src/plugins/mapbox.ts +0 -157
  43. package/src/property-template.ts +0 -151
  44. package/src/property.ts +0 -309
  45. package/src/serialize.ts +0 -96
  46. package/src/shacl-engine.d.ts +0 -2
  47. package/src/styles.css +0 -49
  48. package/src/theme.ts +0 -132
  49. package/src/themes/bootstrap.css +0 -6
  50. package/src/themes/bootstrap.ts +0 -44
  51. package/src/themes/default.css +0 -4
  52. package/src/themes/default.ts +0 -255
  53. package/src/themes/material.css +0 -14
  54. package/src/themes/material.ts +0 -250
  55. package/src/util.ts +0 -275
package/dist/bundle.js ADDED
@@ -0,0 +1,412 @@
1
+ var Sr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function od(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function ld(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 xi={},Hr={},eo;function ud(){if(eo)return Hr;eo=1,Hr.byteLength=o,Hr.toByteArray=l,Hr.fromByteArray=b;for(var r=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=n.length;i<s;++i)r[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function a(y){var _=y.length;if(_%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=y.indexOf("=");E===-1&&(E=_);var v=E===_?0:4-E%4;return[E,v]}function o(y){var _=a(y),E=_[0],v=_[1];return(E+v)*3/4-v}function u(y,_,E){return(_+E)*3/4-E}function l(y){var _,E=a(y),v=E[0],x=E[1],S=new t(u(y,v,x)),m=0,h=x>0?v-4:v,g;for(g=0;g<h;g+=4)_=e[y.charCodeAt(g)]<<18|e[y.charCodeAt(g+1)]<<12|e[y.charCodeAt(g+2)]<<6|e[y.charCodeAt(g+3)],S[m++]=_>>16&255,S[m++]=_>>8&255,S[m++]=_&255;return x===2&&(_=e[y.charCodeAt(g)]<<2|e[y.charCodeAt(g+1)]>>4,S[m++]=_&255),x===1&&(_=e[y.charCodeAt(g)]<<10|e[y.charCodeAt(g+1)]<<4|e[y.charCodeAt(g+2)]>>2,S[m++]=_>>8&255,S[m++]=_&255),S}function c(y){return r[y>>18&63]+r[y>>12&63]+r[y>>6&63]+r[y&63]}function d(y,_,E){for(var v,x=[],S=_;S<E;S+=3)v=(y[S]<<16&16711680)+(y[S+1]<<8&65280)+(y[S+2]&255),x.push(c(v));return x.join("")}function b(y){for(var _,E=y.length,v=E%3,x=[],S=16383,m=0,h=E-v;m<h;m+=S)x.push(d(y,m,m+S>h?h:m+S));return v===1?(_=y[E-1],x.push(r[_>>2]+r[_<<4&63]+"==")):v===2&&(_=(y[E-2]<<8)+y[E-1],x.push(r[_>>10]+r[_>>4&63]+r[_<<2&63]+"=")),x.join("")}return Hr}var $n={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var to;function cd(){return to||(to=1,$n.read=function(r,e,t,n,i){var s,a,o=i*8-n-1,u=(1<<o)-1,l=u>>1,c=-7,d=t?i-1:0,b=t?-1:1,y=r[e+d];for(d+=b,s=y&(1<<-c)-1,y>>=-c,c+=o;c>0;s=s*256+r[e+d],d+=b,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=a*256+r[e+d],d+=b,c-=8);if(s===0)s=1-l;else{if(s===u)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-l}return(y?-1:1)*a*Math.pow(2,s-n)},$n.write=function(r,e,t,n,i,s){var a,o,u,l=s*8-i-1,c=(1<<l)-1,d=c>>1,b=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:s-1,_=n?1:-1,E=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+d>=1?e+=b/u:e+=b*Math.pow(2,1-d),e*u>=2&&(a++,u/=2),a+d>=c?(o=0,a=c):a+d>=1?(o=(e*u-1)*Math.pow(2,i),a=a+d):(o=e*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;r[t+y]=o&255,y+=_,o/=256,i-=8);for(a=a<<i|o,l+=i;l>0;r[t+y]=a&255,y+=_,a/=256,l-=8);r[t+y-_]|=E*128}),$n}/*!
2
+ * The buffer module from node.js, for the browser.
3
+ *
4
+ * @author Feross Aboukhadijeh <https://feross.org>
5
+ * @license MIT
6
+ */var ro;function jt(){return ro||(ro=1,(function(r){const e=ud(),t=cd(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=o,r.SlowBuffer=S,r.INSPECT_MAX_BYTES=50;const i=2147483647;r.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=s(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const I=new Uint8Array(1),f={foo:function(){return 42}};return Object.setPrototypeOf(f,Uint8Array.prototype),Object.setPrototypeOf(I,f),I.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function a(I){if(I>i)throw new RangeError('The value "'+I+'" is invalid for option "size"');const f=new Uint8Array(I);return Object.setPrototypeOf(f,o.prototype),f}function o(I,f,p){if(typeof I=="number"){if(typeof f=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(I)}return u(I,f,p)}o.poolSize=8192;function u(I,f,p){if(typeof I=="string")return b(I,f);if(ArrayBuffer.isView(I))return _(I);if(I==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I);if(le(I,ArrayBuffer)||I&&le(I.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(le(I,SharedArrayBuffer)||I&&le(I.buffer,SharedArrayBuffer)))return E(I,f,p);if(typeof I=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $=I.valueOf&&I.valueOf();if($!=null&&$!==I)return o.from($,f,p);const X=v(I);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof I[Symbol.toPrimitive]=="function")return o.from(I[Symbol.toPrimitive]("string"),f,p);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof I)}o.from=function(I,f,p){return u(I,f,p)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function l(I){if(typeof I!="number")throw new TypeError('"size" argument must be of type number');if(I<0)throw new RangeError('The value "'+I+'" is invalid for option "size"')}function c(I,f,p){return l(I),I<=0?a(I):f!==void 0?typeof p=="string"?a(I).fill(f,p):a(I).fill(f):a(I)}o.alloc=function(I,f,p){return c(I,f,p)};function d(I){return l(I),a(I<0?0:x(I)|0)}o.allocUnsafe=function(I){return d(I)},o.allocUnsafeSlow=function(I){return d(I)};function b(I,f){if((typeof f!="string"||f==="")&&(f="utf8"),!o.isEncoding(f))throw new TypeError("Unknown encoding: "+f);const p=m(I,f)|0;let $=a(p);const X=$.write(I,f);return X!==p&&($=$.slice(0,X)),$}function y(I){const f=I.length<0?0:x(I.length)|0,p=a(f);for(let $=0;$<f;$+=1)p[$]=I[$]&255;return p}function _(I){if(le(I,Uint8Array)){const f=new Uint8Array(I);return E(f.buffer,f.byteOffset,f.byteLength)}return y(I)}function E(I,f,p){if(f<0||I.byteLength<f)throw new RangeError('"offset" is outside of buffer bounds');if(I.byteLength<f+(p||0))throw new RangeError('"length" is outside of buffer bounds');let $;return f===void 0&&p===void 0?$=new Uint8Array(I):p===void 0?$=new Uint8Array(I,f):$=new Uint8Array(I,f,p),Object.setPrototypeOf($,o.prototype),$}function v(I){if(o.isBuffer(I)){const f=x(I.length)|0,p=a(f);return p.length===0||I.copy(p,0,0,f),p}if(I.length!==void 0)return typeof I.length!="number"||Re(I.length)?a(0):y(I);if(I.type==="Buffer"&&Array.isArray(I.data))return y(I.data)}function x(I){if(I>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return I|0}function S(I){return+I!=I&&(I=0),o.alloc(+I)}o.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==o.prototype},o.compare=function(f,p){if(le(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),le(p,Uint8Array)&&(p=o.from(p,p.offset,p.byteLength)),!o.isBuffer(f)||!o.isBuffer(p))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===p)return 0;let $=f.length,X=p.length;for(let oe=0,de=Math.min($,X);oe<de;++oe)if(f[oe]!==p[oe]){$=f[oe],X=p[oe];break}return $<X?-1:X<$?1:0},o.isEncoding=function(f){switch(String(f).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(f,p){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return o.alloc(0);let $;if(p===void 0)for(p=0,$=0;$<f.length;++$)p+=f[$].length;const X=o.allocUnsafe(p);let oe=0;for($=0;$<f.length;++$){let de=f[$];if(le(de,Uint8Array))oe+de.length>X.length?(o.isBuffer(de)||(de=o.from(de)),de.copy(X,oe)):Uint8Array.prototype.set.call(X,de,oe);else if(o.isBuffer(de))de.copy(X,oe);else throw new TypeError('"list" argument must be an Array of Buffers');oe+=de.length}return X};function m(I,f){if(o.isBuffer(I))return I.length;if(ArrayBuffer.isView(I)||le(I,ArrayBuffer))return I.byteLength;if(typeof I!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof I);const p=I.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&p===0)return 0;let X=!1;for(;;)switch(f){case"ascii":case"latin1":case"binary":return p;case"utf8":case"utf-8":return pe(I).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return p*2;case"hex":return p>>>1;case"base64":return ce(I).length;default:if(X)return $?-1:pe(I).length;f=(""+f).toLowerCase(),X=!0}}o.byteLength=m;function h(I,f,p){let $=!1;if((f===void 0||f<0)&&(f=0),f>this.length||((p===void 0||p>this.length)&&(p=this.length),p<=0)||(p>>>=0,f>>>=0,p<=f))return"";for(I||(I="utf8");;)switch(I){case"hex":return Y(this,f,p);case"utf8":case"utf-8":return L(this,f,p);case"ascii":return Z(this,f,p);case"latin1":case"binary":return k(this,f,p);case"base64":return D(this,f,p);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,f,p);default:if($)throw new TypeError("Unknown encoding: "+I);I=(I+"").toLowerCase(),$=!0}}o.prototype._isBuffer=!0;function g(I,f,p){const $=I[f];I[f]=I[p],I[p]=$}o.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let p=0;p<f;p+=2)g(this,p,p+1);return this},o.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let p=0;p<f;p+=4)g(this,p,p+3),g(this,p+1,p+2);return this},o.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let p=0;p<f;p+=8)g(this,p,p+7),g(this,p+1,p+6),g(this,p+2,p+5),g(this,p+3,p+4);return this},o.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?L(this,0,f):h.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(f){if(!o.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:o.compare(this,f)===0},o.prototype.inspect=function(){let f="";const p=r.INSPECT_MAX_BYTES;return f=this.toString("hex",0,p).replace(/(.{2})/g,"$1 ").trim(),this.length>p&&(f+=" ... "),"<Buffer "+f+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(f,p,$,X,oe){if(le(f,Uint8Array)&&(f=o.from(f,f.offset,f.byteLength)),!o.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(p===void 0&&(p=0),$===void 0&&($=f?f.length:0),X===void 0&&(X=0),oe===void 0&&(oe=this.length),p<0||$>f.length||X<0||oe>this.length)throw new RangeError("out of range index");if(X>=oe&&p>=$)return 0;if(X>=oe)return-1;if(p>=$)return 1;if(p>>>=0,$>>>=0,X>>>=0,oe>>>=0,this===f)return 0;let de=oe-X,Ee=$-p;const ke=Math.min(de,Ee),Le=this.slice(X,oe),Oe=f.slice(p,$);for(let De=0;De<ke;++De)if(Le[De]!==Oe[De]){de=Le[De],Ee=Oe[De];break}return de<Ee?-1:Ee<de?1:0};function N(I,f,p,$,X){if(I.length===0)return-1;if(typeof p=="string"?($=p,p=0):p>2147483647?p=2147483647:p<-2147483648&&(p=-2147483648),p=+p,Re(p)&&(p=X?0:I.length-1),p<0&&(p=I.length+p),p>=I.length){if(X)return-1;p=I.length-1}else if(p<0)if(X)p=0;else return-1;if(typeof f=="string"&&(f=o.from(f,$)),o.isBuffer(f))return f.length===0?-1:C(I,f,p,$,X);if(typeof f=="number")return f=f&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(I,f,p):Uint8Array.prototype.lastIndexOf.call(I,f,p):C(I,[f],p,$,X);throw new TypeError("val must be string, number or Buffer")}function C(I,f,p,$,X){let oe=1,de=I.length,Ee=f.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(I.length<2||f.length<2)return-1;oe=2,de/=2,Ee/=2,p/=2}function ke(Oe,De){return oe===1?Oe[De]:Oe.readUInt16BE(De*oe)}let Le;if(X){let Oe=-1;for(Le=p;Le<de;Le++)if(ke(I,Le)===ke(f,Oe===-1?0:Le-Oe)){if(Oe===-1&&(Oe=Le),Le-Oe+1===Ee)return Oe*oe}else Oe!==-1&&(Le-=Le-Oe),Oe=-1}else for(p+Ee>de&&(p=de-Ee),Le=p;Le>=0;Le--){let Oe=!0;for(let De=0;De<Ee;De++)if(ke(I,Le+De)!==ke(f,De)){Oe=!1;break}if(Oe)return Le}return-1}o.prototype.includes=function(f,p,$){return this.indexOf(f,p,$)!==-1},o.prototype.indexOf=function(f,p,$){return N(this,f,p,$,!0)},o.prototype.lastIndexOf=function(f,p,$){return N(this,f,p,$,!1)};function A(I,f,p,$){p=Number(p)||0;const X=I.length-p;$?($=Number($),$>X&&($=X)):$=X;const oe=f.length;$>oe/2&&($=oe/2);let de;for(de=0;de<$;++de){const Ee=parseInt(f.substr(de*2,2),16);if(Re(Ee))return de;I[p+de]=Ee}return de}function B(I,f,p,$){return ye(pe(f,I.length-p),I,p,$)}function R(I,f,p,$){return ye(me(f),I,p,$)}function F(I,f,p,$){return ye(ce(f),I,p,$)}function q(I,f,p,$){return ye(J(f,I.length-p),I,p,$)}o.prototype.write=function(f,p,$,X){if(p===void 0)X="utf8",$=this.length,p=0;else if($===void 0&&typeof p=="string")X=p,$=this.length,p=0;else if(isFinite(p))p=p>>>0,isFinite($)?($=$>>>0,X===void 0&&(X="utf8")):(X=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const oe=this.length-p;if(($===void 0||$>oe)&&($=oe),f.length>0&&($<0||p<0)||p>this.length)throw new RangeError("Attempt to write outside buffer bounds");X||(X="utf8");let de=!1;for(;;)switch(X){case"hex":return A(this,f,p,$);case"utf8":case"utf-8":return B(this,f,p,$);case"ascii":case"latin1":case"binary":return R(this,f,p,$);case"base64":return F(this,f,p,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return q(this,f,p,$);default:if(de)throw new TypeError("Unknown encoding: "+X);X=(""+X).toLowerCase(),de=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function D(I,f,p){return f===0&&p===I.length?e.fromByteArray(I):e.fromByteArray(I.slice(f,p))}function L(I,f,p){p=Math.min(I.length,p);const $=[];let X=f;for(;X<p;){const oe=I[X];let de=null,Ee=oe>239?4:oe>223?3:oe>191?2:1;if(X+Ee<=p){let ke,Le,Oe,De;switch(Ee){case 1:oe<128&&(de=oe);break;case 2:ke=I[X+1],(ke&192)===128&&(De=(oe&31)<<6|ke&63,De>127&&(de=De));break;case 3:ke=I[X+1],Le=I[X+2],(ke&192)===128&&(Le&192)===128&&(De=(oe&15)<<12|(ke&63)<<6|Le&63,De>2047&&(De<55296||De>57343)&&(de=De));break;case 4:ke=I[X+1],Le=I[X+2],Oe=I[X+3],(ke&192)===128&&(Le&192)===128&&(Oe&192)===128&&(De=(oe&15)<<18|(ke&63)<<12|(Le&63)<<6|Oe&63,De>65535&&De<1114112&&(de=De))}}de===null?(de=65533,Ee=1):de>65535&&(de-=65536,$.push(de>>>10&1023|55296),de=56320|de&1023),$.push(de),X+=Ee}return T($)}const te=4096;function T(I){const f=I.length;if(f<=te)return String.fromCharCode.apply(String,I);let p="",$=0;for(;$<f;)p+=String.fromCharCode.apply(String,I.slice($,$+=te));return p}function Z(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]&127);return $}function k(I,f,p){let $="";p=Math.min(I.length,p);for(let X=f;X<p;++X)$+=String.fromCharCode(I[X]);return $}function Y(I,f,p){const $=I.length;(!f||f<0)&&(f=0),(!p||p<0||p>$)&&(p=$);let X="";for(let oe=f;oe<p;++oe)X+=ze[I[oe]];return X}function w(I,f,p){const $=I.slice(f,p);let X="";for(let oe=0;oe<$.length-1;oe+=2)X+=String.fromCharCode($[oe]+$[oe+1]*256);return X}o.prototype.slice=function(f,p){const $=this.length;f=~~f,p=p===void 0?$:~~p,f<0?(f+=$,f<0&&(f=0)):f>$&&(f=$),p<0?(p+=$,p<0&&(p=0)):p>$&&(p=$),p<f&&(p=f);const X=this.subarray(f,p);return Object.setPrototypeOf(X,o.prototype),X};function H(I,f,p){if(I%1!==0||I<0)throw new RangeError("offset is not uint");if(I+f>p)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return X},o.prototype.readUintBE=o.prototype.readUIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f+--p],oe=1;for(;p>0&&(oe*=256);)X+=this[f+--p]*oe;return X},o.prototype.readUint8=o.prototype.readUInt8=function(f,p){return f=f>>>0,p||H(f,1,this.length),this[f]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(f,p){return f=f>>>0,p||H(f,2,this.length),this[f]|this[f+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(f,p){return f=f>>>0,p||H(f,2,this.length),this[f]<<8|this[f+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(f,p){return f=f>>>0,p||H(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},o.prototype.readBigUInt64LE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,oe=this[++f]+this[++f]*2**8+this[++f]*2**16+$*2**24;return BigInt(X)+(BigInt(oe)<<BigInt(32))}),o.prototype.readBigUInt64BE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=p*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],oe=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+$;return(BigInt(X)<<BigInt(32))+BigInt(oe)}),o.prototype.readIntLE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=this[f],oe=1,de=0;for(;++de<p&&(oe*=256);)X+=this[f+de]*oe;return oe*=128,X>=oe&&(X-=Math.pow(2,8*p)),X},o.prototype.readIntBE=function(f,p,$){f=f>>>0,p=p>>>0,$||H(f,p,this.length);let X=p,oe=1,de=this[f+--X];for(;X>0&&(oe*=256);)de+=this[f+--X]*oe;return oe*=128,de>=oe&&(de-=Math.pow(2,8*p)),de},o.prototype.readInt8=function(f,p){return f=f>>>0,p||H(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},o.prototype.readInt16LE=function(f,p){f=f>>>0,p||H(f,2,this.length);const $=this[f]|this[f+1]<<8;return $&32768?$|4294901760:$},o.prototype.readInt16BE=function(f,p){f=f>>>0,p||H(f,2,this.length);const $=this[f+1]|this[f]<<8;return $&32768?$|4294901760:$},o.prototype.readInt32LE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},o.prototype.readInt32BE=function(f,p){return f=f>>>0,p||H(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},o.prototype.readBigInt64LE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+($<<24);return(BigInt(X)<<BigInt(32))+BigInt(p+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),o.prototype.readBigInt64BE=Ie(function(f){f=f>>>0,j(f,"offset");const p=this[f],$=this[f+7];(p===void 0||$===void 0)&&W(f,this.length-8);const X=(p<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(X)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+$)}),o.prototype.readFloatLE=function(f,p){return f=f>>>0,p||H(f,4,this.length),t.read(this,f,!0,23,4)},o.prototype.readFloatBE=function(f,p){return f=f>>>0,p||H(f,4,this.length),t.read(this,f,!1,23,4)},o.prototype.readDoubleLE=function(f,p){return f=f>>>0,p||H(f,8,this.length),t.read(this,f,!0,52,8)},o.prototype.readDoubleBE=function(f,p){return f=f>>>0,p||H(f,8,this.length),t.read(this,f,!1,52,8)};function K(I,f,p,$,X,oe){if(!o.isBuffer(I))throw new TypeError('"buffer" argument must be a Buffer instance');if(f>X||f<oe)throw new RangeError('"value" argument is out of bounds');if(p+$>I.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){const Ee=Math.pow(2,8*$)-1;K(this,f,p,$,Ee,0)}let oe=1,de=0;for(this[p]=f&255;++de<$&&(oe*=256);)this[p+de]=f/oe&255;return p+$},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(f,p,$,X){if(f=+f,p=p>>>0,$=$>>>0,!X){const Ee=Math.pow(2,8*$)-1;K(this,f,p,$,Ee,0)}let oe=$-1,de=1;for(this[p+oe]=f&255;--oe>=0&&(de*=256);)this[p+oe]=f/de&255;return p+$},o.prototype.writeUint8=o.prototype.writeUInt8=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,1,255,0),this[p]=f&255,p+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,65535,0),this[p]=f&255,this[p+1]=f>>>8,p+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,65535,0),this[p]=f>>>8,this[p+1]=f&255,p+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,4294967295,0),this[p+3]=f>>>24,this[p+2]=f>>>16,this[p+1]=f>>>8,this[p]=f&255,p+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,4294967295,0),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4};function Q(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe,oe=oe>>8,I[p++]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,de=de>>8,I[p++]=de,p}function ue(I,f,p,$,X){ge(f,$,X,I,p,7);let oe=Number(f&BigInt(4294967295));I[p+7]=oe,oe=oe>>8,I[p+6]=oe,oe=oe>>8,I[p+5]=oe,oe=oe>>8,I[p+4]=oe;let de=Number(f>>BigInt(32)&BigInt(4294967295));return I[p+3]=de,de=de>>8,I[p+2]=de,de=de>>8,I[p+1]=de,de=de>>8,I[p]=de,p+8}o.prototype.writeBigUInt64LE=Ie(function(f,p=0){return Q(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Ie(function(f,p=0){return ue(this,f,p,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(f,p,$,X){if(f=+f,p=p>>>0,!X){const ke=Math.pow(2,8*$-1);K(this,f,p,$,ke-1,-ke)}let oe=0,de=1,Ee=0;for(this[p]=f&255;++oe<$&&(de*=256);)f<0&&Ee===0&&this[p+oe-1]!==0&&(Ee=1),this[p+oe]=(f/de>>0)-Ee&255;return p+$},o.prototype.writeIntBE=function(f,p,$,X){if(f=+f,p=p>>>0,!X){const ke=Math.pow(2,8*$-1);K(this,f,p,$,ke-1,-ke)}let oe=$-1,de=1,Ee=0;for(this[p+oe]=f&255;--oe>=0&&(de*=256);)f<0&&Ee===0&&this[p+oe+1]!==0&&(Ee=1),this[p+oe]=(f/de>>0)-Ee&255;return p+$},o.prototype.writeInt8=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,1,127,-128),f<0&&(f=255+f+1),this[p]=f&255,p+1},o.prototype.writeInt16LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,32767,-32768),this[p]=f&255,this[p+1]=f>>>8,p+2},o.prototype.writeInt16BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,2,32767,-32768),this[p]=f>>>8,this[p+1]=f&255,p+2},o.prototype.writeInt32LE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,2147483647,-2147483648),this[p]=f&255,this[p+1]=f>>>8,this[p+2]=f>>>16,this[p+3]=f>>>24,p+4},o.prototype.writeInt32BE=function(f,p,$){return f=+f,p=p>>>0,$||K(this,f,p,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[p]=f>>>24,this[p+1]=f>>>16,this[p+2]=f>>>8,this[p+3]=f&255,p+4},o.prototype.writeBigInt64LE=Ie(function(f,p=0){return Q(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Ie(function(f,p=0){return ue(this,f,p,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function V(I,f,p,$,X,oe){if(p+$>I.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("Index out of range")}function G(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,4),t.write(I,f,p,$,23,4),p+4}o.prototype.writeFloatLE=function(f,p,$){return G(this,f,p,!0,$)},o.prototype.writeFloatBE=function(f,p,$){return G(this,f,p,!1,$)};function z(I,f,p,$,X){return f=+f,p=p>>>0,X||V(I,f,p,8),t.write(I,f,p,$,52,8),p+8}o.prototype.writeDoubleLE=function(f,p,$){return z(this,f,p,!0,$)},o.prototype.writeDoubleBE=function(f,p,$){return z(this,f,p,!1,$)},o.prototype.copy=function(f,p,$,X){if(!o.isBuffer(f))throw new TypeError("argument should be a Buffer");if($||($=0),!X&&X!==0&&(X=this.length),p>=f.length&&(p=f.length),p||(p=0),X>0&&X<$&&(X=$),X===$||f.length===0||this.length===0)return 0;if(p<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(X<0)throw new RangeError("sourceEnd out of bounds");X>this.length&&(X=this.length),f.length-p<X-$&&(X=f.length-p+$);const oe=X-$;return this===f&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(p,$,X):Uint8Array.prototype.set.call(f,this.subarray($,X),p),oe},o.prototype.fill=function(f,p,$,X){if(typeof f=="string"){if(typeof p=="string"?(X=p,p=0,$=this.length):typeof $=="string"&&(X=$,$=this.length),X!==void 0&&typeof X!="string")throw new TypeError("encoding must be a string");if(typeof X=="string"&&!o.isEncoding(X))throw new TypeError("Unknown encoding: "+X);if(f.length===1){const de=f.charCodeAt(0);(X==="utf8"&&de<128||X==="latin1")&&(f=de)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(p<0||this.length<p||this.length<$)throw new RangeError("Out of range index");if($<=p)return this;p=p>>>0,$=$===void 0?this.length:$>>>0,f||(f=0);let oe;if(typeof f=="number")for(oe=p;oe<$;++oe)this[oe]=f;else{const de=o.isBuffer(f)?f:o.from(f,X),Ee=de.length;if(Ee===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(oe=0;oe<$-p;++oe)this[oe+p]=de[oe%Ee]}return this};const U={};function ee(I,f,p){U[I]=class extends p{constructor(){super(),Object.defineProperty(this,"message",{value:f.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${I}]`,this.stack,delete this.name}get code(){return I}set code(X){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:X,writable:!0})}toString(){return`${this.name} [${I}]: ${this.message}`}}}ee("ERR_BUFFER_OUT_OF_BOUNDS",function(I){return I?`${I} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ee("ERR_INVALID_ARG_TYPE",function(I,f){return`The "${I}" argument must be of type number. Received type ${typeof f}`},TypeError),ee("ERR_OUT_OF_RANGE",function(I,f,p){let $=`The value of "${I}" is out of range.`,X=p;return Number.isInteger(p)&&Math.abs(p)>2**32?X=re(String(p)):typeof p=="bigint"&&(X=String(p),(p>BigInt(2)**BigInt(32)||p<-(BigInt(2)**BigInt(32)))&&(X=re(X)),X+="n"),$+=` It must be ${f}. Received ${X}`,$},RangeError);function re(I){let f="",p=I.length;const $=I[0]==="-"?1:0;for(;p>=$+4;p-=3)f=`_${I.slice(p-3,p)}${f}`;return`${I.slice(0,p)}${f}`}function fe(I,f,p){j(f,"offset"),(I[f]===void 0||I[f+p]===void 0)&&W(f,I.length-(p+1))}function ge(I,f,p,$,X,oe){if(I>p||I<f){const de=typeof f=="bigint"?"n":"";let Ee;throw f===0||f===BigInt(0)?Ee=`>= 0${de} and < 2${de} ** ${(oe+1)*8}${de}`:Ee=`>= -(2${de} ** ${(oe+1)*8-1}${de}) and < 2 ** ${(oe+1)*8-1}${de}`,new U.ERR_OUT_OF_RANGE("value",Ee,I)}fe($,X,oe)}function j(I,f){if(typeof I!="number")throw new U.ERR_INVALID_ARG_TYPE(f,"number",I)}function W(I,f,p){throw Math.floor(I)!==I?(j(I,p),new U.ERR_OUT_OF_RANGE("offset","an integer",I)):f<0?new U.ERR_BUFFER_OUT_OF_BOUNDS:new U.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${f}`,I)}const se=/[^+/0-9A-Za-z-_]/g;function he(I){if(I=I.split("=")[0],I=I.trim().replace(se,""),I.length<2)return"";for(;I.length%4!==0;)I=I+"=";return I}function pe(I,f){f=f||1/0;let p;const $=I.length;let X=null;const oe=[];for(let de=0;de<$;++de){if(p=I.charCodeAt(de),p>55295&&p<57344){if(!X){if(p>56319){(f-=3)>-1&&oe.push(239,191,189);continue}else if(de+1===$){(f-=3)>-1&&oe.push(239,191,189);continue}X=p;continue}if(p<56320){(f-=3)>-1&&oe.push(239,191,189),X=p;continue}p=(X-55296<<10|p-56320)+65536}else X&&(f-=3)>-1&&oe.push(239,191,189);if(X=null,p<128){if((f-=1)<0)break;oe.push(p)}else if(p<2048){if((f-=2)<0)break;oe.push(p>>6|192,p&63|128)}else if(p<65536){if((f-=3)<0)break;oe.push(p>>12|224,p>>6&63|128,p&63|128)}else if(p<1114112){if((f-=4)<0)break;oe.push(p>>18|240,p>>12&63|128,p>>6&63|128,p&63|128)}else throw new Error("Invalid code point")}return oe}function me(I){const f=[];for(let p=0;p<I.length;++p)f.push(I.charCodeAt(p)&255);return f}function J(I,f){let p,$,X;const oe=[];for(let de=0;de<I.length&&!((f-=2)<0);++de)p=I.charCodeAt(de),$=p>>8,X=p%256,oe.push(X),oe.push($);return oe}function ce(I){return e.toByteArray(he(I))}function ye(I,f,p,$){let X;for(X=0;X<$&&!(X+p>=f.length||X>=I.length);++X)f[X+p]=I[X];return X}function le(I,f){return I instanceof f||I!=null&&I.constructor!=null&&I.constructor.name!=null&&I.constructor.name===f.name}function Re(I){return I!==I}const ze=(function(){const I="0123456789abcdef",f=new Array(256);for(let p=0;p<16;++p){const $=p*16;for(let X=0;X<16;++X)f[$+X]=I[p]+I[X]}return f})();function Ie(I){return typeof BigInt>"u"?Xe:I}function Xe(){throw new Error("BigInt not supported")}})(xi)),xi}var dd=jt();const Vr="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Gr="http://www.w3.org/2001/XMLSchema#",Fn="http://www.w3.org/2000/10/swap/",Ke={xsd:{decimal:`${Gr}decimal`,boolean:`${Gr}boolean`,double:`${Gr}double`,integer:`${Gr}integer`,string:`${Gr}string`},rdf:{type:`${Vr}type`,nil:`${Vr}nil`,first:`${Vr}first`,rest:`${Vr}rest`,langString:`${Vr}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Fn}reify#forSome`,forAll:`${Fn}reify#forAll`},log:{implies:`${Fn}log#implies`,isImpliedBy:`${Fn}log#isImpliedBy`}},{xsd:kn}=Ke,hd=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,no={"\\":"\\","'":"'",'"':'"',n:`
7
+ `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},fd=/[\x00-\x20<>\\"\{\}\|\^\`]/,pd={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},gd=/$0^/;class md{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 pd)&&this[t]instanceof RegExp&&(this[t]=gd)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let n=this._input,i=n.length;for(;;){let o,u;for(;o=this._newline.exec(n);)this.comments&&(u=this._comment.exec(o[0]))&&s("comment",u[1],"",this._line,o[0].length),n=n.substr(o[0].length,n.length),i=n.length,this._line++;if(!o&&(o=this._whitespace.exec(n))&&(n=n.substr(o[0].length,n.length)),this._endOfFile.test(n))return t&&(this.comments&&(u=this._comment.exec(n))&&s("comment",u[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;const l=this._line,c=n[0];let d="",b="",y="",_=null,E=0,v=!1;switch(c){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){v=!0;break}}else{this._n3Mode&&(E=1,d="^");break}case"<":if(_=this._unescapedIri.exec(n))d="IRI",b=_[1];else if(_=this._iri.exec(n)){if(b=this._unescape(_[1]),b===null||fd.test(b))return a(this);d="IRI"}else n.length>1&&n[1]==="<"?(d="<<",E=2):this._n3Mode&&n.length>1&&n[1]==="="&&(E=2,this._isImpliedBy?(d="abbreviation",b="<"):(d="inverse",b=">"));break;case">":n.length>1&&n[1]===">"&&(d=">>",E=2);break;case"_":((_=this._blank.exec(n))||t&&(_=this._blank.exec(`${n} `)))&&(d="blank",y="_",b=_[1]);break;case'"':if(_=this._simpleQuotedString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(d="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=this._simpleApostropheString.exec(n))b=_[1];else if({value:b,matchLength:E}=this._parseLiteral(n),b===null)return a(this);(_!==null||E!==0)&&(d="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=this._variable.exec(n))&&(d="var",b=_[0]);break;case"@":this._previousMarker==="literal"&&(_=this._langcode.exec(n))?(d="langcode",b=_[1]):(_=this._keyword.exec(n))&&(d=_[0]);break;case".":if(n.length===1?t:n[1]<"0"||n[1]>"9"){d=".",E=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(_=this._number.exec(n)||t&&(_=this._number.exec(`${n} `)))&&(d="literal",b=_[0],y=typeof _[1]=="string"?kn.double:typeof _[2]=="string"?kn.decimal:kn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(_=this._sparqlKeyword.exec(n))?d=_[0].toUpperCase():v=!0;break;case"f":case"t":(_=this._boolean.exec(n))?(d="literal",b=_[0],y=kn.boolean):v=!0;break;case"a":(_=this._shortPredicates.exec(n))?(d="abbreviation",b="a"):v=!0;break;case"=":this._n3Mode&&n.length>1&&(d="abbreviation",n[1]!==">"?(E=1,b="="):(E=2,b=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(E=1,d=c);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(d="{|",E=2):(d=c,E=1));break;case"|":n.length>=2&&n[1]==="}"&&(d="|}",E=2);break;default:v=!0}if(v&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=this._prefix.exec(n))?(d="prefix",b=_[1]||""):((_=this._prefixed.exec(n))||t&&(_=this._prefixed.exec(`${n} `)))&&(d="prefixed",y=_[1]||"",b=this._unescape(_[2]))),this._previousMarker==="^^")switch(d){case"prefixed":d="type";break;case"IRI":d="typeIRI";break;default:d=""}if(!d)return t||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?a(this):this._input=n;const x=E||_[0].length,S=s(d,b,y,l,x);this.previousToken=S,this._previousMarker=d,n=n.substr(x,n.length)}function s(o,u,l,c,d){const b=n?i-n.length:i,y=b+d,_={type:o,value:u,prefix:l,line:c,start:b,end:y};return e(null,_),_}function a(o){e(o._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let t=!1;const n=e.replace(hd,(i,s,a,o)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof a=="string"){let u=Number.parseInt(a,16);return u<=65535?String.fromCharCode(Number.parseInt(a,16)):String.fromCharCode(55296+((u-=65536)>>10),56320+(u&1023))}return o in no?no[o]:(t=!0,"")});return t?null:n}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],n=t.length;let i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(t,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){const a=e.substring(n,i),o=a.split(/\r\n|\r|\n/).length-1,u=i+n;if(n===1&&o!==0||n===3&&this._lineMode)break;return this._line+=o,{value:this._unescape(a),matchLength:u}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const n=[];let i;if(this._tokenizeToEnd((s,a)=>s?i=s:n.push(a),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=dd.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:yd,xsd:ar}=Ke;let jr,bd=0;const Ne={namedNode:Ku,blankNode:Yu,variable:ec,literal:Zu,defaultGraph:xd,quad:la,triple:la,fromTerm:fn,fromQuad:tc};class wt{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof wt?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}let Nr=class extends wt{get termType(){return"NamedNode"}},_t=class Ju extends wt{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let t=e.lastIndexOf('"')+1;return t<e.length&&e[t++]==="@"?e.substr(t).toLowerCase():""}get datatype(){return new Nr(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,n=t<e.length?e[t]:"";return n==="^"?e.substr(t+2):n!=="@"?ar.string:yd.langString}equals(e){return e instanceof Ju?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}}}},_d=class extends wt{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},wd=class extends wt{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},vd=class extends wt{constructor(){return super(""),jr||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};jr=new vd;function hn(r,e,t){if(e=e||Ne,!r)return e.defaultGraph();switch(r[0]){case"?":return e.variable(r.substr(1));case"_":return e.blankNode(r.substr(2));case'"':if(e===Ne)return new _t(r);if(r[r.length-1]==='"')return e.literal(r.substr(1,r.length-2));const n=r.lastIndexOf('"',r.length-1);return e.literal(r.substr(1,n-1),r[n+1]==="@"?r.substr(n+2):e.namedNode(r.substr(n+3)));case"[":r=JSON.parse(r);break;default:if(!t||!Array.isArray(r))return e.namedNode(r)}return e.quad(hn(r[0],e,!0),hn(r[1],e,!0),hn(r[2],e,!0),r[3]&&hn(r[3],e,!0))}function Ir(r,e){if(typeof r=="string")return r;if(r instanceof wt&&r.termType!=="Quad")return r.id;if(!r)return jr.id;switch(r.termType){case"NamedNode":return r.value;case"BlankNode":return`_:${r.value}`;case"Variable":return`?${r.value}`;case"DefaultGraph":return"";case"Literal":return`"${r.value}"${r.language?`@${r.language}`:r.datatype&&r.datatype.value!==ar.string?`^^${r.datatype.value}`:""}`;case"Quad":const t=[Ir(r.subject,!0),Ir(r.predicate,!0),Ir(r.object,!0)];return r.graph&&r.graph.termType!=="DefaultGraph"&&t.push(Ir(r.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${r.termType}`)}}let ui=class extends wt{constructor(e,t,n,i){super(""),this._subject=e,this._predicate=t,this._object=n,this._graph=i||jr}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 Ku(r){return new Nr(r)}function Yu(r){return new _d(r||`n3-${bd++}`)}function Zu(r,e){if(typeof e=="string")return new _t(`"${r}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof r=="boolean"?t=ar.boolean:typeof r=="number"&&(Number.isFinite(r)?t=Number.isInteger(r)?ar.integer:ar.double:(t=ar.double,Number.isNaN(r)||(r=r>0?"INF":"-INF")))),t===""||t===ar.string?new _t(`"${r}"`):new _t(`"${r}"^^${t}`)}function ec(r){return new wd(r)}function xd(){return jr}function la(r,e,t,n){return new ui(r,e,t,n)}function fn(r){if(r instanceof wt)return r;switch(r.termType){case"NamedNode":return Ku(r.value);case"BlankNode":return Yu(r.value);case"Variable":return ec(r.value);case"DefaultGraph":return jr;case"Literal":return Zu(r.value,r.language||r.datatype);case"Quad":return tc(r);default:throw new Error(`Unexpected termType: ${r.termType}`)}}function tc(r){if(r instanceof ui)return r;if(r.termType!=="Quad")throw new Error(`Unexpected termType: ${r.termType}`);return la(fn(r.subject),fn(r.predicate),fn(r.object),fn(r.graph))}let io=0;class rc{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&nc(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(t),i=/trig/.test(t),s=/triple/.test(t),a=/quad/.test(t),o=this._n3Mode=/n3/.test(t),u=s||a;(this._supportsNamedGraphs=!(n||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||s||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),u&&(this._resolveRelativeIRI=l=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new md({lineMode:u,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){io=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=Pn}_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${io++}_`,this._prefixCallback=s||Pn,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const u=[];let l;if(this._callback=(c,d)=>{c?l=c:d&&u.push(d)},this._lexer.tokenize(e).every(c=>this._readCallback=this._readCallback(c)),l)throw l;return u}let o=(u,l)=>{u!==null?(this._callback(u),this._callback=Pn):this._readCallback&&(this._readCallback=this._readCallback(l))};a&&(this._lexer.comments=!0,o=(u,l)=>{u!==null?(this._callback(u),this._callback=Pn):this._readCallback&&(l.type==="comment"?a(l.value):this._readCallback=this._readCallback(l))}),this._callback=i,this._lexer.tokenize(e,o)}}function Pn(){}function nc(r,e){r._factory=e,r.DEFAULTGRAPH=e.defaultGraph(),r.RDF_FIRST=e.namedNode(Ke.rdf.first),r.RDF_REST=e.namedNode(Ke.rdf.rest),r.RDF_NIL=e.namedNode(Ke.rdf.nil),r.N3_FORALL=e.namedNode(Ke.r.forAll),r.N3_FORSOME=e.namedNode(Ke.r.forSome),r.ABBREVIATIONS={a:e.namedNode(Ke.rdf.type),"=":e.namedNode(Ke.owl.sameAs),">":e.namedNode(Ke.log.implies),"<":e.namedNode(Ke.log.isImpliedBy)},r.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}nc(rc.prototype,Ne);function ua(r){return!!r&&r.termType==="DefaultGraph"}function zn(r){return r.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const Ed=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Sd=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,so="./",Id="../",Ei="?",ao="#";class wa{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Ed.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!wa.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",zn(e)],n=[],i=[],s=/[^/?#]*([/?#])/y;let a,o=0,u=0,l=s.lastIndex=e.length;for(;!o&&!u&&(a=s.exec(this.base));)a[1]===ao?u=s.lastIndex-1:(t.push(zn(a[0]),"(?:"),n.push(")?"),a[1]!==Ei?i.push(l=s.lastIndex):(o=l=s.lastIndex,u=this.base.indexOf(ao,o),this._pathReplacements[o]=Ei));for(let c=0;c<i.length;c++)this._pathReplacements[i[c]]=Id.repeat(i.length-c-1);return this._pathReplacements[i[i.length-1]]=so,this._baseLength=u>0?u:this.base.length,t.push(zn(this.base.substring(l,this._baseLength)),o?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...n].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const n=t[0].length;if(n===this._baseLength&&n===e.length)return"";const i=this._pathReplacements[n];if(i){const s=e.substring(n);return i!==Ei&&!Sd.test(s)?e:i===so&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}}const Wr=Ne.defaultGraph(),{rdf:Nd,xsd:wr}=Ke,oo=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,lo=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Rd={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class zr extends wt{equals(e){return e===this}}class va{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=Wr,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new wa(t.baseIRI)))}get _inDefaultGraph(){return Wr.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
+ `:`
9
+ }
10
+ `)+(Wr.equals(i)?"":`${this._encodeIriOrBlank(i)} {
11
+ `)),this._graph=i,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,s):this._write(`;
12
+ ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s):this._write(`${(this._subject===null?"":`.
13
+ `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(n)}`,s)}catch(a){s&&s(a)}}_writeQuadLine(e,t,n,i,s){delete this._prefixMatch,this._write(this.quadToString(e,t,n,i),s)}quadToString(e,t,n,i){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(n)}${i&&i.value?` ${this._encodeIriOrBlank(i)} .
14
+ `:` .
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)),oo.test(t)&&(t=t.replace(lo,uo));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(oo.test(t)&&(t=t.replace(lo,uo)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===wr.string)return`"${t}"`}else switch(e.datatype.value){case wr.string:return`"${t}"`;case wr.boolean:if(t==="true"||t==="false")return t;break;case wr.integer:if(/^[+-]?\d+$/.test(t))return t;break;case wr.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case wr.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Nd.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)}${ua(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,Wr,i):this._writeQuad(e,t,n,i||Wr,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
+ `:`
17
+ }
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=zn(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 zr("[]");case 1:if(i=n[0],!(i.object instanceof zr))return new zr(`[ ${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
+ `:`
22
+ `)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new zr(`${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 zr(`(${n.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
24
+ `:`
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 uo(r){let e=Rd[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 Si={exports:{}},Ii={exports:{}},Ni,co;function Be(){if(co)return Ni;co=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 Ni={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},Ni}var Ri={exports:{}},Ti,ho;function ic(){return ho||(ho=1,Ti={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"{}"}}}),Ti}var Ai,fo;function it(){if(fo)return Ai;fo=1;const{format:r,inspect:e}=ic(),{AggregateError:t}=Be(),n=globalThis.AggregateError||t,i=Symbol("kIsNodeError"),s=["string","function","number","object","Function","Object","boolean","bigint","symbol"],a=/^([A-Z][a-z0-9]*)+$/,o="__node_internal_",u={};function l(v,x){if(!v)throw new u.ERR_INTERNAL_ASSERTION(x)}function c(v){let x="",S=v.length;const m=v[0]==="-"?1:0;for(;S>=m+4;S-=3)x=`_${v.slice(S-3,S)}${x}`;return`${v.slice(0,S)}${x}`}function d(v,x,S){if(typeof x=="function")return l(x.length<=S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${x.length}).`),x(...S);const m=(x.match(/%[dfijoOs]/g)||[]).length;return l(m===S.length,`Code: ${v}; The provided arguments length (${S.length}) does not match the required ones (${m}).`),S.length===0?x:r(x,...S)}function b(v,x,S){S||(S=Error);class m extends S{constructor(...g){super(d(v,x,g))}toString(){return`${this.name} [${v}]: ${this.message}`}}Object.defineProperties(m.prototype,{name:{value:S.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${v}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),m.prototype.code=v,m.prototype[i]=!0,u[v]=m}function y(v){const x=o+v.name;return Object.defineProperty(v,"name",{value:x}),v}function _(v,x){if(v&&x&&v!==x){if(Array.isArray(x.errors))return x.errors.push(v),x;const S=new n([x,v],x.message);return S.code=x.code,S}return v||x}class E extends Error{constructor(x="The operation was aborted",S=void 0){if(S!==void 0&&typeof S!="object")throw new u.ERR_INVALID_ARG_TYPE("options","Object",S);super(x,S),this.code="ABORT_ERR",this.name="AbortError"}}return b("ERR_ASSERTION","%s",Error),b("ERR_INVALID_ARG_TYPE",(v,x,S)=>{l(typeof v=="string","'name' must be a string"),Array.isArray(x)||(x=[x]);let m="The ";v.endsWith(" argument")?m+=`${v} `:m+=`"${v}" ${v.includes(".")?"property":"argument"} `,m+="must be ";const h=[],g=[],N=[];for(const A of x)l(typeof A=="string","All expected entries have to be of type string"),s.includes(A)?h.push(A.toLowerCase()):a.test(A)?g.push(A):(l(A!=="object",'The value "object" should be written as "Object"'),N.push(A));if(g.length>0){const A=h.indexOf("object");A!==-1&&(h.splice(h,A,1),g.push("Object"))}if(h.length>0){switch(h.length){case 1:m+=`of type ${h[0]}`;break;case 2:m+=`one of type ${h[0]} or ${h[1]}`;break;default:{const A=h.pop();m+=`one of type ${h.join(", ")}, or ${A}`}}(g.length>0||N.length>0)&&(m+=" or ")}if(g.length>0){switch(g.length){case 1:m+=`an instance of ${g[0]}`;break;case 2:m+=`an instance of ${g[0]} or ${g[1]}`;break;default:{const A=g.pop();m+=`an instance of ${g.join(", ")}, or ${A}`}}N.length>0&&(m+=" or ")}switch(N.length){case 0:break;case 1:N[0].toLowerCase()!==N[0]&&(m+="an "),m+=`${N[0]}`;break;case 2:m+=`one of ${N[0]} or ${N[1]}`;break;default:{const A=N.pop();m+=`one of ${N.join(", ")}, or ${A}`}}if(S==null)m+=`. Received ${S}`;else if(typeof S=="function"&&S.name)m+=`. Received function ${S.name}`;else if(typeof S=="object"){var C;if((C=S.constructor)!==null&&C!==void 0&&C.name)m+=`. Received an instance of ${S.constructor.name}`;else{const A=e(S,{depth:-1});m+=`. Received ${A}`}}else{let A=e(S,{colors:!1});A.length>25&&(A=`${A.slice(0,25)}...`),m+=`. Received type ${typeof S} (${A})`}return m},TypeError),b("ERR_INVALID_ARG_VALUE",(v,x,S="is invalid")=>{let m=e(x);return m.length>128&&(m=m.slice(0,128)+"..."),`The ${v.includes(".")?"property":"argument"} '${v}' ${S}. Received ${m}`},TypeError),b("ERR_INVALID_RETURN_VALUE",(v,x,S)=>{var m;const h=S!=null&&(m=S.constructor)!==null&&m!==void 0&&m.name?`instance of ${S.constructor.name}`:`type ${typeof S}`;return`Expected ${v} to be returned from the "${x}" function but got ${h}.`},TypeError),b("ERR_MISSING_ARGS",(...v)=>{l(v.length>0,"At least one arg needs to be specified");let x;const S=v.length;switch(v=(Array.isArray(v)?v:[v]).map(m=>`"${m}"`).join(" or "),S){case 1:x+=`The ${v[0]} argument`;break;case 2:x+=`The ${v[0]} and ${v[1]} arguments`;break;default:{const m=v.pop();x+=`The ${v.join(", ")}, and ${m} arguments`}break}return`${x} must be specified`},TypeError),b("ERR_OUT_OF_RANGE",(v,x,S)=>{l(x,'Missing "range" argument');let m;if(Number.isInteger(S)&&Math.abs(S)>2**32)m=c(String(S));else if(typeof S=="bigint"){m=String(S);const h=BigInt(2)**BigInt(32);(S>h||S<-h)&&(m=c(m)),m+="n"}else m=e(S);return`The value of "${v}" is out of range. It must be ${x}. Received ${m}`},RangeError),b("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),b("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),b("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),b("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),b("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),b("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),b("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),b("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),b("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),b("ERR_STREAM_WRITE_AFTER_END","write after end",Error),b("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),Ai={AbortError:E,aggregateTwoErrors:y(_),hideStackFrames:y,codes:u},Ai}var Qr={exports:{}},po;function xn(){if(po)return Qr.exports;po=1;const{AbortController:r,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Qr.exports=r,Qr.exports.AbortSignal=e,Qr.exports.default=r,Qr.exports}var Mn={exports:{}},go;function ci(){if(go)return Mn.exports;go=1;var r=typeof Reflect=="object"?Reflect:null,e=r&&typeof r.apply=="function"?r.apply:function(g,N,C){return Function.prototype.apply.call(g,N,C)},t;r&&typeof r.ownKeys=="function"?t=r.ownKeys:Object.getOwnPropertySymbols?t=function(g){return Object.getOwnPropertyNames(g).concat(Object.getOwnPropertySymbols(g))}:t=function(g){return Object.getOwnPropertyNames(g)};function n(h){console&&console.warn&&console.warn(h)}var i=Number.isNaN||function(g){return g!==g};function s(){s.init.call(this)}Mn.exports=s,Mn.exports.once=x,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var a=10;function o(h){if(typeof h!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof h)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(h){if(typeof h!="number"||h<0||i(h))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+h+".");a=h}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(g){if(typeof g!="number"||g<0||i(g))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+g+".");return this._maxListeners=g,this};function u(h){return h._maxListeners===void 0?s.defaultMaxListeners:h._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(g){for(var N=[],C=1;C<arguments.length;C++)N.push(arguments[C]);var A=g==="error",B=this._events;if(B!==void 0)A=A&&B.error===void 0;else if(!A)return!1;if(A){var R;if(N.length>0&&(R=N[0]),R instanceof Error)throw R;var F=new Error("Unhandled error."+(R?" ("+R.message+")":""));throw F.context=R,F}var q=B[g];if(q===void 0)return!1;if(typeof q=="function")e(q,this,N);else for(var D=q.length,L=_(q,D),C=0;C<D;++C)e(L[C],this,N);return!0};function l(h,g,N,C){var A,B,R;if(o(N),B=h._events,B===void 0?(B=h._events=Object.create(null),h._eventsCount=0):(B.newListener!==void 0&&(h.emit("newListener",g,N.listener?N.listener:N),B=h._events),R=B[g]),R===void 0)R=B[g]=N,++h._eventsCount;else if(typeof R=="function"?R=B[g]=C?[N,R]:[R,N]:C?R.unshift(N):R.push(N),A=u(h),A>0&&R.length>A&&!R.warned){R.warned=!0;var F=new Error("Possible EventEmitter memory leak detected. "+R.length+" "+String(g)+" listeners added. Use emitter.setMaxListeners() to increase limit");F.name="MaxListenersExceededWarning",F.emitter=h,F.type=g,F.count=R.length,n(F)}return h}s.prototype.addListener=function(g,N){return l(this,g,N,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(g,N){return l(this,g,N,!0)};function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(h,g,N){var C={fired:!1,wrapFn:void 0,target:h,type:g,listener:N},A=c.bind(C);return A.listener=N,C.wrapFn=A,A}s.prototype.once=function(g,N){return o(N),this.on(g,d(this,g,N)),this},s.prototype.prependOnceListener=function(g,N){return o(N),this.prependListener(g,d(this,g,N)),this},s.prototype.removeListener=function(g,N){var C,A,B,R,F;if(o(N),A=this._events,A===void 0)return this;if(C=A[g],C===void 0)return this;if(C===N||C.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete A[g],A.removeListener&&this.emit("removeListener",g,C.listener||N));else if(typeof C!="function"){for(B=-1,R=C.length-1;R>=0;R--)if(C[R]===N||C[R].listener===N){F=C[R].listener,B=R;break}if(B<0)return this;B===0?C.shift():E(C,B),C.length===1&&(A[g]=C[0]),A.removeListener!==void 0&&this.emit("removeListener",g,F||N)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(g){var N,C,A;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[g]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[g]),this;if(arguments.length===0){var B=Object.keys(C),R;for(A=0;A<B.length;++A)R=B[A],R!=="removeListener"&&this.removeAllListeners(R);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(N=C[g],typeof N=="function")this.removeListener(g,N);else if(N!==void 0)for(A=N.length-1;A>=0;A--)this.removeListener(g,N[A]);return this};function b(h,g,N){var C=h._events;if(C===void 0)return[];var A=C[g];return A===void 0?[]:typeof A=="function"?N?[A.listener||A]:[A]:N?v(A):_(A,A.length)}s.prototype.listeners=function(g){return b(this,g,!0)},s.prototype.rawListeners=function(g){return b(this,g,!1)},s.listenerCount=function(h,g){return typeof h.listenerCount=="function"?h.listenerCount(g):y.call(h,g)},s.prototype.listenerCount=y;function y(h){var g=this._events;if(g!==void 0){var N=g[h];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function _(h,g){for(var N=new Array(g),C=0;C<g;++C)N[C]=h[C];return N}function E(h,g){for(;g+1<h.length;g++)h[g]=h[g+1];h.pop()}function v(h){for(var g=new Array(h.length),N=0;N<g.length;++N)g[N]=h[N].listener||h[N];return g}function x(h,g){return new Promise(function(N,C){function A(R){h.removeListener(g,B),C(R)}function B(){typeof h.removeListener=="function"&&h.removeListener("error",A),N([].slice.call(arguments))}m(h,g,B,{once:!0}),g!=="error"&&S(h,A,{once:!0})})}function S(h,g,N){typeof h.on=="function"&&m(h,"error",g,N)}function m(h,g,N,C){if(typeof h.on=="function")C.once?h.once(g,N):h.on(g,N);else if(typeof h.addEventListener=="function")h.addEventListener(g,function A(B){C.once&&h.removeEventListener(g,A),N(B)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof h)}return Mn.exports}var mo;function at(){return mo||(mo=1,(function(r){const e=jt(),{format:t,inspect:n}=ic(),{codes:{ERR_INVALID_ARG_TYPE:i}}=it(),{kResistStopPropagation:s,AggregateError:a,SymbolDispose:o}=Be(),u=globalThis.AbortSignal||xn().AbortSignal,l=globalThis.AbortController||xn().AbortController,c=Object.getPrototypeOf(async function(){}).constructor,d=globalThis.Blob||e.Blob,b=typeof d<"u"?function(v){return v instanceof d}:function(v){return!1},y=(E,v)=>{if(E!==void 0&&(E===null||typeof E!="object"||!("aborted"in E)))throw new i(v,"AbortSignal",E)},_=(E,v)=>{if(typeof E!="function")throw new i(v,"Function",E)};r.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(E){let v=!1;return function(...x){v||(v=!0,E.apply(this,x))}},createDeferredPromise:function(){let E,v;return{promise:new Promise((S,m)=>{E=S,v=m}),resolve:E,reject:v}},promisify(E){return new Promise((v,x)=>{E((S,...m)=>S?x(S):v(...m))})},debuglog(){return function(){}},format:t,inspect:n,types:{isAsyncFunction(E){return E instanceof c},isArrayBufferView(E){return ArrayBuffer.isView(E)}},isBlob:b,deprecate(E,v){return E},addAbortListener:ci().addAbortListener||function(v,x){if(v===void 0)throw new i("signal","AbortSignal",v);y(v,"signal"),_(x,"listener");let S;return v.aborted?queueMicrotask(()=>x()):(v.addEventListener("abort",x,{__proto__:null,once:!0,[s]:!0}),S=()=>{v.removeEventListener("abort",x)}),{__proto__:null,[o](){var m;(m=S)===null||m===void 0||m()}}},AbortSignalAny:u.any||function(v){if(v.length===1)return v[0];const x=new l,S=()=>x.abort();return v.forEach(m=>{y(m,"signals"),m.addEventListener("abort",S,{once:!0})}),x.signal.addEventListener("abort",()=>{v.forEach(m=>m.removeEventListener("abort",S))},{once:!0}),x.signal}},r.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(Ri)),Ri.exports}var Bn={},Di,yo;function Rn(){if(yo)return Di;yo=1;const{ArrayIsArray:r,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:n,NumberIsInteger:i,NumberIsNaN:s,NumberMAX_SAFE_INTEGER:a,NumberMIN_SAFE_INTEGER:o,NumberParseInt:u,ObjectPrototypeHasOwnProperty:l,RegExpPrototypeExec:c,String:d,StringPrototypeToUpperCase:b,StringPrototypeTrim:y}=Be(),{hideStackFrames:_,codes:{ERR_SOCKET_BAD_PORT:E,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:x,ERR_OUT_OF_RANGE:S,ERR_UNKNOWN_SIGNAL:m}}=it(),{normalizeEncoding:h}=at(),{isAsyncFunction:g,isArrayBufferView:N}=at().types,C={};function A(J){return J===(J|0)}function B(J){return J===J>>>0}const R=/^[0-7]+$/,F="must be a 32-bit unsigned integer or an octal string";function q(J,ce,ye){if(typeof J>"u"&&(J=ye),typeof J=="string"){if(c(R,J)===null)throw new x(ce,J,F);J=u(J,8)}return te(J,ce),J}const D=_((J,ce,ye=o,le=a)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);if(J<ye||J>le)throw new S(ce,`>= ${ye} && <= ${le}`,J)}),L=_((J,ce,ye=-2147483648,le=2147483647)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);if(J<ye||J>le)throw new S(ce,`>= ${ye} && <= ${le}`,J)}),te=_((J,ce,ye=!1)=>{if(typeof J!="number")throw new v(ce,"number",J);if(!i(J))throw new S(ce,"an integer",J);const le=ye?1:0,Re=4294967295;if(J<le||J>Re)throw new S(ce,`>= ${le} && <= ${Re}`,J)});function T(J,ce){if(typeof J!="string")throw new v(ce,"string",J)}function Z(J,ce,ye=void 0,le){if(typeof J!="number")throw new v(ce,"number",J);if(ye!=null&&J<ye||le!=null&&J>le||(ye!=null||le!=null)&&s(J))throw new S(ce,`${ye!=null?`>= ${ye}`:""}${ye!=null&&le!=null?" && ":""}${le!=null?`<= ${le}`:""}`,J)}const k=_((J,ce,ye)=>{if(!e(ye,J)){const Re="must be one of: "+t(n(ye,ze=>typeof ze=="string"?`'${ze}'`:d(ze)),", ");throw new x(ce,J,Re)}});function Y(J,ce){if(typeof J!="boolean")throw new v(ce,"boolean",J)}function w(J,ce,ye){return J==null||!l(J,ce)?ye:J[ce]}const H=_((J,ce,ye=null)=>{const le=w(ye,"allowArray",!1),Re=w(ye,"allowFunction",!1);if(!w(ye,"nullable",!1)&&J===null||!le&&r(J)||typeof J!="object"&&(!Re||typeof J!="function"))throw new v(ce,"Object",J)}),K=_((J,ce)=>{if(J!=null&&typeof J!="object"&&typeof J!="function")throw new v(ce,"a dictionary",J)}),Q=_((J,ce,ye=0)=>{if(!r(J))throw new v(ce,"Array",J);if(J.length<ye){const le=`must be longer than ${ye}`;throw new x(ce,J,le)}});function ue(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)T(J[ye],`${ce}[${ye}]`)}function V(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++)Y(J[ye],`${ce}[${ye}]`)}function G(J,ce){Q(J,ce);for(let ye=0;ye<J.length;ye++){const le=J[ye],Re=`${ce}[${ye}]`;if(le==null)throw new v(Re,"AbortSignal",le);fe(le,Re)}}function z(J,ce="signal"){if(T(J,ce),C[J]===void 0)throw C[b(J)]!==void 0?new m(J+" (signals must use all capital letters)"):new m(J)}const U=_((J,ce="buffer")=>{if(!N(J))throw new v(ce,["Buffer","TypedArray","DataView"],J)});function ee(J,ce){const ye=h(ce),le=J.length;if(ye==="hex"&&le%2!==0)throw new x("encoding",ce,`is invalid for data of length ${le}`)}function re(J,ce="Port",ye=!0){if(typeof J!="number"&&typeof J!="string"||typeof J=="string"&&y(J).length===0||+J!==+J>>>0||J>65535||J===0&&!ye)throw new E(ce,J,ye);return J|0}const fe=_((J,ce)=>{if(J!==void 0&&(J===null||typeof J!="object"||!("aborted"in J)))throw new v(ce,"AbortSignal",J)}),ge=_((J,ce)=>{if(typeof J!="function")throw new v(ce,"Function",J)}),j=_((J,ce)=>{if(typeof J!="function"||g(J))throw new v(ce,"Function",J)}),W=_((J,ce)=>{if(J!==void 0)throw new v(ce,"undefined",J)});function se(J,ce,ye){if(!e(ye,J))throw new v(ce,`('${t(ye,"|")}')`,J)}const he=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pe(J,ce){if(typeof J>"u"||!c(he,J))throw new x(ce,J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function me(J){if(typeof J=="string")return pe(J,"hints"),J;if(r(J)){const ce=J.length;let ye="";if(ce===0)return ye;for(let le=0;le<ce;le++){const Re=J[le];pe(Re,"hints"),ye+=Re,le!==ce-1&&(ye+=", ")}return ye}throw new x("hints",J,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Di={isInt32:A,isUint32:B,parseFileMode:q,validateArray:Q,validateStringArray:ue,validateBooleanArray:V,validateAbortSignalArray:G,validateBoolean:Y,validateBuffer:U,validateDictionary:K,validateEncoding:ee,validateFunction:ge,validateInt32:L,validateInteger:D,validateNumber:Z,validateObject:H,validateOneOf:k,validatePlainFunction:j,validatePort:re,validateSignalName:z,validateString:T,validateUint32:te,validateUndefined:W,validateUnion:se,validateAbortSignal:fe,validateLinkHeaderValue:me},Di}var qn={exports:{}},Li={exports:{}},bo;function pr(){if(bo)return Li.exports;bo=1;var r=Li.exports={},e,t;function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=n}catch{e=n}try{typeof clearTimeout=="function"?t=clearTimeout:t=i}catch{t=i}})();function s(E){if(e===setTimeout)return setTimeout(E,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(E,0);try{return e(E,0)}catch{try{return e.call(null,E,0)}catch{return e.call(this,E,0)}}}function a(E){if(t===clearTimeout)return clearTimeout(E);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(E);try{return t(E)}catch{try{return t.call(null,E)}catch{return t.call(this,E)}}}var o=[],u=!1,l,c=-1;function d(){!u||!l||(u=!1,l.length?o=l.concat(o):c=-1,o.length&&b())}function b(){if(!u){var E=s(d);u=!0;for(var v=o.length;v;){for(l=o,o=[];++c<v;)l&&l[c].run();c=-1,v=o.length}l=null,u=!1,a(E)}}r.nextTick=function(E){var v=new Array(arguments.length-1);if(arguments.length>1)for(var x=1;x<arguments.length;x++)v[x-1]=arguments[x];o.push(new y(E,v)),o.length===1&&!u&&s(b)};function y(E,v){this.fun=E,this.array=v}y.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={};function _(){}return r.on=_,r.addListener=_,r.once=_,r.off=_,r.removeListener=_,r.removeAllListeners=_,r.emit=_,r.prependListener=_,r.prependOnceListener=_,r.listeners=function(E){return[]},r.binding=function(E){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(E){throw new Error("process.chdir is not supported")},r.umask=function(){return 0},Li.exports}var Oi,_o;function $t(){if(_o)return Oi;_o=1;const{SymbolAsyncIterator:r,SymbolIterator:e,SymbolFor:t}=Be(),n=t("nodejs.stream.destroyed"),i=t("nodejs.stream.errored"),s=t("nodejs.stream.readable"),a=t("nodejs.stream.writable"),o=t("nodejs.stream.disturbed"),u=t("nodejs.webstream.isClosedPromise"),l=t("nodejs.webstream.controllerErrorFunction");function c(w,H=!1){var K;return!!(w&&typeof w.pipe=="function"&&typeof w.on=="function"&&(!H||typeof w.pause=="function"&&typeof w.resume=="function")&&(!w._writableState||((K=w._readableState)===null||K===void 0?void 0:K.readable)!==!1)&&(!w._writableState||w._readableState))}function d(w){var H;return!!(w&&typeof w.write=="function"&&typeof w.on=="function"&&(!w._readableState||((H=w._writableState)===null||H===void 0?void 0:H.writable)!==!1))}function b(w){return!!(w&&typeof w.pipe=="function"&&w._readableState&&typeof w.on=="function"&&typeof w.write=="function")}function y(w){return w&&(w._readableState||w._writableState||typeof w.write=="function"&&typeof w.on=="function"||typeof w.pipe=="function"&&typeof w.on=="function")}function _(w){return!!(w&&!y(w)&&typeof w.pipeThrough=="function"&&typeof w.getReader=="function"&&typeof w.cancel=="function")}function E(w){return!!(w&&!y(w)&&typeof w.getWriter=="function"&&typeof w.abort=="function")}function v(w){return!!(w&&!y(w)&&typeof w.readable=="object"&&typeof w.writable=="object")}function x(w){return _(w)||E(w)||v(w)}function S(w,H){return w==null?!1:H===!0?typeof w[r]=="function":H===!1?typeof w[e]=="function":typeof w[r]=="function"||typeof w[e]=="function"}function m(w){if(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!!(w.destroyed||w[n]||Q!=null&&Q.destroyed)}function h(w){if(!d(w))return null;if(w.writableEnded===!0)return!0;const H=w._writableState;return H!=null&&H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function g(w,H){if(!d(w))return null;if(w.writableFinished===!0)return!0;const K=w._writableState;return K!=null&&K.errored?!1:typeof K?.finished!="boolean"?null:!!(K.finished||H===!1&&K.ended===!0&&K.length===0)}function N(w){if(!c(w))return null;if(w.readableEnded===!0)return!0;const H=w._readableState;return!H||H.errored?!1:typeof H?.ended!="boolean"?null:H.ended}function C(w,H){if(!c(w))return null;const K=w._readableState;return K!=null&&K.errored?!1:typeof K?.endEmitted!="boolean"?null:!!(K.endEmitted||H===!1&&K.ended===!0&&K.length===0)}function A(w){return w&&w[s]!=null?w[s]:typeof w?.readable!="boolean"?null:m(w)?!1:c(w)&&w.readable&&!C(w)}function B(w){return w&&w[a]!=null?w[a]:typeof w?.writable!="boolean"?null:m(w)?!1:d(w)&&w.writable&&!h(w)}function R(w,H){return y(w)?m(w)?!0:!(H?.readable!==!1&&A(w)||H?.writable!==!1&&B(w)):null}function F(w){var H,K;return y(w)?w.writableErrored?w.writableErrored:(H=(K=w._writableState)===null||K===void 0?void 0:K.errored)!==null&&H!==void 0?H:null:null}function q(w){var H,K;return y(w)?w.readableErrored?w.readableErrored:(H=(K=w._readableState)===null||K===void 0?void 0:K.errored)!==null&&H!==void 0?H:null:null}function D(w){if(!y(w))return null;if(typeof w.closed=="boolean")return w.closed;const H=w._writableState,K=w._readableState;return typeof H?.closed=="boolean"||typeof K?.closed=="boolean"?H?.closed||K?.closed:typeof w._closed=="boolean"&&L(w)?w._closed:null}function L(w){return typeof w._closed=="boolean"&&typeof w._defaultKeepAlive=="boolean"&&typeof w._removedConnection=="boolean"&&typeof w._removedContLen=="boolean"}function te(w){return typeof w._sent100=="boolean"&&L(w)}function T(w){var H;return typeof w._consuming=="boolean"&&typeof w._dumped=="boolean"&&((H=w.req)===null||H===void 0?void 0:H.upgradeOrConnect)===void 0}function Z(w){if(!y(w))return null;const H=w._writableState,K=w._readableState,Q=H||K;return!Q&&te(w)||!!(Q&&Q.autoDestroy&&Q.emitClose&&Q.closed===!1)}function k(w){var H;return!!(w&&((H=w[o])!==null&&H!==void 0?H:w.readableDidRead||w.readableAborted))}function Y(w){var H,K,Q,ue,V,G,z,U,ee,re;return!!(w&&((H=(K=(Q=(ue=(V=(G=w[i])!==null&&G!==void 0?G:w.readableErrored)!==null&&V!==void 0?V:w.writableErrored)!==null&&ue!==void 0?ue:(z=w._readableState)===null||z===void 0?void 0:z.errorEmitted)!==null&&Q!==void 0?Q:(U=w._writableState)===null||U===void 0?void 0:U.errorEmitted)!==null&&K!==void 0?K:(ee=w._readableState)===null||ee===void 0?void 0:ee.errored)!==null&&H!==void 0?H:!((re=w._writableState)===null||re===void 0)&&re.errored))}return Oi={isDestroyed:m,kIsDestroyed:n,isDisturbed:k,kIsDisturbed:o,isErrored:Y,kIsErrored:i,isReadable:A,kIsReadable:s,kIsClosedPromise:u,kControllerErrorFunction:l,kIsWritable:a,isClosed:D,isDuplexNodeStream:b,isFinished:R,isIterable:S,isReadableNodeStream:c,isReadableStream:_,isReadableEnded:N,isReadableFinished:C,isReadableErrored:q,isNodeStream:y,isWebStream:x,isWritable:B,isWritableNodeStream:d,isWritableStream:E,isWritableEnded:h,isWritableFinished:g,isWritableErrored:F,isServerRequest:T,isServerResponse:te,willEmitClose:Z,isTransformStream:v},Oi}var wo;function Qt(){if(wo)return qn.exports;wo=1;const r=pr(),{AbortError:e,codes:t}=it(),{ERR_INVALID_ARG_TYPE:n,ERR_STREAM_PREMATURE_CLOSE:i}=t,{kEmptyObject:s,once:a}=at(),{validateAbortSignal:o,validateFunction:u,validateObject:l,validateBoolean:c}=Rn(),{Promise:d,PromisePrototypeThen:b,SymbolDispose:y}=Be(),{isClosed:_,isReadable:E,isReadableNodeStream:v,isReadableStream:x,isReadableFinished:S,isReadableErrored:m,isWritable:h,isWritableNodeStream:g,isWritableStream:N,isWritableFinished:C,isWritableErrored:A,isNodeStream:B,willEmitClose:R,kIsClosedPromise:F}=$t();let q;function D(k){return k.setHeader&&typeof k.abort=="function"}const L=()=>{};function te(k,Y,w){var H,K;if(arguments.length===2?(w=Y,Y=s):Y==null?Y=s:l(Y,"options"),u(w,"callback"),o(Y.signal,"options.signal"),w=a(w),x(k)||N(k))return T(k,Y,w);if(!B(k))throw new n("stream",["ReadableStream","WritableStream","Stream"],k);const Q=(H=Y.readable)!==null&&H!==void 0?H:v(k),ue=(K=Y.writable)!==null&&K!==void 0?K:g(k),V=k._writableState,G=k._readableState,z=()=>{k.writable||re()};let U=R(k)&&v(k)===Q&&g(k)===ue,ee=C(k,!1);const re=()=>{ee=!0,k.destroyed&&(U=!1),!(U&&(!k.readable||Q))&&(!Q||fe)&&w.call(k)};let fe=S(k,!1);const ge=()=>{fe=!0,k.destroyed&&(U=!1),!(U&&(!k.writable||ue))&&(!ue||ee)&&w.call(k)},j=J=>{w.call(k,J)};let W=_(k);const se=()=>{W=!0;const J=A(k)||m(k);if(J&&typeof J!="boolean")return w.call(k,J);if(Q&&!fe&&v(k,!0)&&!S(k,!1))return w.call(k,new i);if(ue&&!ee&&!C(k,!1))return w.call(k,new i);w.call(k)},he=()=>{W=!0;const J=A(k)||m(k);if(J&&typeof J!="boolean")return w.call(k,J);w.call(k)},pe=()=>{k.req.on("finish",re)};D(k)?(k.on("complete",re),U||k.on("abort",se),k.req?pe():k.on("request",pe)):ue&&!V&&(k.on("end",z),k.on("close",z)),!U&&typeof k.aborted=="boolean"&&k.on("aborted",se),k.on("end",ge),k.on("finish",re),Y.error!==!1&&k.on("error",j),k.on("close",se),W?r.nextTick(se):V!=null&&V.errorEmitted||G!=null&&G.errorEmitted?U||r.nextTick(he):(!Q&&(!U||E(k))&&(ee||h(k)===!1)||!ue&&(!U||h(k))&&(fe||E(k)===!1)||G&&k.req&&k.aborted)&&r.nextTick(he);const me=()=>{w=L,k.removeListener("aborted",se),k.removeListener("complete",re),k.removeListener("abort",se),k.removeListener("request",pe),k.req&&k.req.removeListener("finish",re),k.removeListener("end",z),k.removeListener("close",z),k.removeListener("finish",re),k.removeListener("end",ge),k.removeListener("error",j),k.removeListener("close",se)};if(Y.signal&&!W){const J=()=>{const ce=w;me(),ce.call(k,new e(void 0,{cause:Y.signal.reason}))};if(Y.signal.aborted)r.nextTick(J);else{q=q||at().addAbortListener;const ce=q(Y.signal,J),ye=w;w=a((...le)=>{ce[y](),ye.apply(k,le)})}}return me}function T(k,Y,w){let H=!1,K=L;if(Y.signal)if(K=()=>{H=!0,w.call(k,new e(void 0,{cause:Y.signal.reason}))},Y.signal.aborted)r.nextTick(K);else{q=q||at().addAbortListener;const ue=q(Y.signal,K),V=w;w=a((...G)=>{ue[y](),V.apply(k,G)})}const Q=(...ue)=>{H||r.nextTick(()=>w.apply(k,ue))};return b(k[F].promise,Q,Q),L}function Z(k,Y){var w;let H=!1;return Y===null&&(Y=s),(w=Y)!==null&&w!==void 0&&w.cleanup&&(c(Y.cleanup,"cleanup"),H=Y.cleanup),new d((K,Q)=>{const ue=te(k,Y,V=>{H&&ue(),V?Q(V):K()})})}return qn.exports=te,qn.exports.finished=Z,qn.exports}var Ci,vo;function $r(){if(vo)return Ci;vo=1;const r=pr(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:n}=it(),{Symbol:i}=Be(),{kIsDestroyed:s,isDestroyed:a,isFinished:o,isServerRequest:u}=$t(),l=i("kDestroy"),c=i("kConstruct");function d(R,F,q){R&&(R.stack,F&&!F.errored&&(F.errored=R),q&&!q.errored&&(q.errored=R))}function b(R,F){const q=this._readableState,D=this._writableState,L=D||q;return D!=null&&D.destroyed||q!=null&&q.destroyed?(typeof F=="function"&&F(),this):(d(R,D,q),D&&(D.destroyed=!0),q&&(q.destroyed=!0),L.constructed?y(this,R,F):this.once(l,function(te){y(this,e(te,R),F)}),this)}function y(R,F,q){let D=!1;function L(te){if(D)return;D=!0;const T=R._readableState,Z=R._writableState;d(te,Z,T),Z&&(Z.closed=!0),T&&(T.closed=!0),typeof q=="function"&&q(te),te?r.nextTick(_,R,te):r.nextTick(E,R)}try{R._destroy(F||null,L)}catch(te){L(te)}}function _(R,F){v(R,F),E(R)}function E(R){const F=R._readableState,q=R._writableState;q&&(q.closeEmitted=!0),F&&(F.closeEmitted=!0),(q!=null&&q.emitClose||F!=null&&F.emitClose)&&R.emit("close")}function v(R,F){const q=R._readableState,D=R._writableState;D!=null&&D.errorEmitted||q!=null&&q.errorEmitted||(D&&(D.errorEmitted=!0),q&&(q.errorEmitted=!0),R.emit("error",F))}function x(){const R=this._readableState,F=this._writableState;R&&(R.constructed=!0,R.closed=!1,R.closeEmitted=!1,R.destroyed=!1,R.errored=null,R.errorEmitted=!1,R.reading=!1,R.ended=R.readable===!1,R.endEmitted=R.readable===!1),F&&(F.constructed=!0,F.destroyed=!1,F.closed=!1,F.closeEmitted=!1,F.errored=null,F.errorEmitted=!1,F.finalCalled=!1,F.prefinished=!1,F.ended=F.writable===!1,F.ending=F.writable===!1,F.finished=F.writable===!1)}function S(R,F,q){const D=R._readableState,L=R._writableState;if(L!=null&&L.destroyed||D!=null&&D.destroyed)return this;D!=null&&D.autoDestroy||L!=null&&L.autoDestroy?R.destroy(F):F&&(F.stack,L&&!L.errored&&(L.errored=F),D&&!D.errored&&(D.errored=F),q?r.nextTick(v,R,F):v(R,F))}function m(R,F){if(typeof R._construct!="function")return;const q=R._readableState,D=R._writableState;q&&(q.constructed=!1),D&&(D.constructed=!1),R.once(c,F),!(R.listenerCount(c)>1)&&r.nextTick(h,R)}function h(R){let F=!1;function q(D){if(F){S(R,D??new t);return}F=!0;const L=R._readableState,te=R._writableState,T=te||L;L&&(L.constructed=!0),te&&(te.constructed=!0),T.destroyed?R.emit(l,D):D?S(R,D,!0):r.nextTick(g,R)}try{R._construct(D=>{r.nextTick(q,D)})}catch(D){r.nextTick(q,D)}}function g(R){R.emit(c)}function N(R){return R?.setHeader&&typeof R.abort=="function"}function C(R){R.emit("close")}function A(R,F){R.emit("error",F),r.nextTick(C,R)}function B(R,F){!R||a(R)||(!F&&!o(R)&&(F=new n),u(R)?(R.socket=null,R.destroy(F)):N(R)?R.abort():N(R.req)?R.req.abort():typeof R.destroy=="function"?R.destroy(F):typeof R.close=="function"?R.close():F?r.nextTick(A,R,F):r.nextTick(C,R),R.destroyed||(R[s]=!0))}return Ci={construct:m,destroyer:B,destroy:b,undestroy:x,errorOrDestroy:S},Ci}var ji,xo;function xa(){if(xo)return ji;xo=1;const{ArrayIsArray:r,ObjectSetPrototypeOf:e}=Be(),{EventEmitter:t}=ci();function n(s){t.call(this,s)}e(n.prototype,t.prototype),e(n,t),n.prototype.pipe=function(s,a){const o=this;function u(E){s.writable&&s.write(E)===!1&&o.pause&&o.pause()}o.on("data",u);function l(){o.readable&&o.resume&&o.resume()}s.on("drain",l),!s._isStdio&&(!a||a.end!==!1)&&(o.on("end",d),o.on("close",b));let c=!1;function d(){c||(c=!0,s.end())}function b(){c||(c=!0,typeof s.destroy=="function"&&s.destroy())}function y(E){_(),t.listenerCount(this,"error")===0&&this.emit("error",E)}i(o,"error",y),i(s,"error",y);function _(){o.removeListener("data",u),s.removeListener("drain",l),o.removeListener("end",d),o.removeListener("close",b),o.removeListener("error",y),s.removeListener("error",y),o.removeListener("end",_),o.removeListener("close",_),s.removeListener("close",_)}return o.on("end",_),o.on("close",_),s.on("close",_),s.emit("pipe",o),s};function i(s,a,o){if(typeof s.prependListener=="function")return s.prependListener(a,o);!s._events||!s._events[a]?s.on(a,o):r(s._events[a])?s._events[a].unshift(o):s._events[a]=[o,s._events[a]]}return ji={Stream:n,prependListener:i},ji}var $i={exports:{}},Eo;function di(){return Eo||(Eo=1,(function(r){const{SymbolDispose:e}=Be(),{AbortError:t,codes:n}=it(),{isNodeStream:i,isWebStream:s,kControllerErrorFunction:a}=$t(),o=Qt(),{ERR_INVALID_ARG_TYPE:u}=n;let l;const c=(d,b)=>{if(typeof d!="object"||!("aborted"in d))throw new u(b,"AbortSignal",d)};r.exports.addAbortSignal=function(b,y){if(c(b,"signal"),!i(y)&&!s(y))throw new u("stream",["ReadableStream","WritableStream","Stream"],y);return r.exports.addAbortSignalNoValidate(b,y)},r.exports.addAbortSignalNoValidate=function(d,b){if(typeof d!="object"||!("aborted"in d))return b;const y=i(b)?()=>{b.destroy(new t(void 0,{cause:d.reason}))}:()=>{b[a](new t(void 0,{cause:d.reason}))};if(d.aborted)y();else{l=l||at().addAbortListener;const _=l(d,y);o(b,_[e])}return b}})($i)),$i.exports}var Fi,So;function Td(){if(So)return Fi;So=1;const{StringPrototypeSlice:r,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:n}=Be(),{Buffer:i}=jt(),{inspect:s}=at();return Fi=class{constructor(){this.head=null,this.tail=null,this.length=0}push(o){const u={data:o,next:null};this.length>0?this.tail.next=u:this.head=u,this.tail=u,++this.length}unshift(o){const u={data:o,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}shift(){if(this.length===0)return;const o=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,o}clear(){this.head=this.tail=null,this.length=0}join(o){if(this.length===0)return"";let u=this.head,l=""+u.data;for(;(u=u.next)!==null;)l+=o+u.data;return l}concat(o){if(this.length===0)return i.alloc(0);const u=i.allocUnsafe(o>>>0);let l=this.head,c=0;for(;l;)t(u,l.data,c),c+=l.data.length,l=l.next;return u}consume(o,u){const l=this.head.data;if(o<l.length){const c=l.slice(0,o);return this.head.data=l.slice(o),c}return o===l.length?this.shift():u?this._getString(o):this._getBuffer(o)}first(){return this.head.data}*[e](){for(let o=this.head;o;o=o.next)yield o.data}_getString(o){let u="",l=this.head,c=0;do{const d=l.data;if(o>d.length)u+=d,o-=d.length;else{o===d.length?(u+=d,++c,l.next?this.head=l.next:this.head=this.tail=null):(u+=r(d,0,o),this.head=l,l.data=r(d,o));break}++c}while((l=l.next)!==null);return this.length-=c,u}_getBuffer(o){const u=i.allocUnsafe(o),l=o;let c=this.head,d=0;do{const b=c.data;if(o>b.length)t(u,b,l-o),o-=b.length;else{o===b.length?(t(u,b,l-o),++d,c.next?this.head=c.next:this.head=this.tail=null):(t(u,new n(b.buffer,b.byteOffset,o),l-o),this.head=c,c.data=b.slice(o));break}++d}while((c=c.next)!==null);return this.length-=d,u}[Symbol.for("nodejs.util.inspect.custom")](o,u){return s(this,{...u,depth:0,customInspect:!1})}},Fi}var ki,Io;function hi(){if(Io)return ki;Io=1;const{MathFloor:r,NumberIsInteger:e}=Be(),{validateInteger:t}=Rn(),{ERR_INVALID_ARG_VALUE:n}=it().codes;let i=16*1024,s=16;function a(c,d,b){return c.highWaterMark!=null?c.highWaterMark:d?c[b]:null}function o(c){return c?s:i}function u(c,d){t(d,"value",0),c?s=d:i=d}function l(c,d,b,y){const _=a(d,y,b);if(_!=null){if(!e(_)||_<0){const E=y?`options.${b}`:"options.highWaterMark";throw new n(E,_)}return r(_)}return o(c.objectMode)}return ki={getHighWaterMark:l,getDefaultHighWaterMark:o,setDefaultHighWaterMark:u},ki}var Pi={},Un={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var No;function Ad(){return No||(No=1,(function(r,e){var t=jt(),n=t.Buffer;function i(a,o){for(var u in a)o[u]=a[u]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=t:(i(t,e),e.Buffer=s);function s(a,o,u){return n(a,o,u)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,o,u){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,o,u)},s.alloc=function(a,o,u){if(typeof a!="number")throw new TypeError("Argument must be a number");var l=n(a);return o!==void 0?typeof u=="string"?l.fill(o,u):l.fill(o):l.fill(0),l},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(a)}})(Un,Un.exports)),Un.exports}var Ro;function Dd(){if(Ro)return Pi;Ro=1;var r=Ad().Buffer,e=r.isEncoding||function(x){switch(x=""+x,x&&x.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function t(x){if(!x)return"utf8";for(var S;;)switch(x){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return x;default:if(S)return;x=(""+x).toLowerCase(),S=!0}}function n(x){var S=t(x);if(typeof S!="string"&&(r.isEncoding===e||!e(x)))throw new Error("Unknown encoding: "+x);return S||x}Pi.StringDecoder=i;function i(x){this.encoding=n(x);var S;switch(this.encoding){case"utf16le":this.text=d,this.end=b,S=4;break;case"utf8":this.fillLast=u,S=4;break;case"base64":this.text=y,this.end=_,S=3;break;default:this.write=E,this.end=v;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(S)}i.prototype.write=function(x){if(x.length===0)return"";var S,m;if(this.lastNeed){if(S=this.fillLast(x),S===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m<x.length?S?S+this.text(x,m):this.text(x,m):S||""},i.prototype.end=c,i.prototype.text=l,i.prototype.fillLast=function(x){if(this.lastNeed<=x.length)return x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,this.lastTotal-this.lastNeed,0,x.length),this.lastNeed-=x.length};function s(x){return x<=127?0:x>>5===6?2:x>>4===14?3:x>>3===30?4:x>>6===2?-1:-2}function a(x,S,m){var h=S.length-1;if(h<m)return 0;var g=s(S[h]);return g>=0?(g>0&&(x.lastNeed=g-1),g):--h<m||g===-2?0:(g=s(S[h]),g>=0?(g>0&&(x.lastNeed=g-2),g):--h<m||g===-2?0:(g=s(S[h]),g>=0?(g>0&&(g===2?g=0:x.lastNeed=g-3),g):0))}function o(x,S,m){if((S[0]&192)!==128)return x.lastNeed=0,"�";if(x.lastNeed>1&&S.length>1){if((S[1]&192)!==128)return x.lastNeed=1,"�";if(x.lastNeed>2&&S.length>2&&(S[2]&192)!==128)return x.lastNeed=2,"�"}}function u(x){var S=this.lastTotal-this.lastNeed,m=o(this,x);if(m!==void 0)return m;if(this.lastNeed<=x.length)return x.copy(this.lastChar,S,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);x.copy(this.lastChar,S,0,x.length),this.lastNeed-=x.length}function l(x,S){var m=a(this,x,S);if(!this.lastNeed)return x.toString("utf8",S);this.lastTotal=m;var h=x.length-(m-this.lastNeed);return x.copy(this.lastChar,0,h),x.toString("utf8",S,h)}function c(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+"�":S}function d(x,S){if((x.length-S)%2===0){var m=x.toString("utf16le",S);if(m){var h=m.charCodeAt(m.length-1);if(h>=55296&&h<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=x[x.length-1],x.toString("utf16le",S,x.length-1)}function b(x){var S=x&&x.length?this.write(x):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return S+this.lastChar.toString("utf16le",0,m)}return S}function y(x,S){var m=(x.length-S)%3;return m===0?x.toString("base64",S):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=x[x.length-1]:(this.lastChar[0]=x[x.length-2],this.lastChar[1]=x[x.length-1]),x.toString("base64",S,x.length-m))}function _(x){var S=x&&x.length?this.write(x):"";return this.lastNeed?S+this.lastChar.toString("base64",0,3-this.lastNeed):S}function E(x){return x.toString(this.encoding)}function v(x){return x&&x.length?this.write(x):""}return Pi}var Mi,To;function sc(){if(To)return Mi;To=1;const r=pr(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:n}=Be(),{Buffer:i}=jt(),{ERR_INVALID_ARG_TYPE:s,ERR_STREAM_NULL_VALUES:a}=it().codes;function o(u,l,c){let d;if(typeof l=="string"||l instanceof i)return new u({objectMode:!0,...c,read(){this.push(l),this.push(null)}});let b;if(l&&l[t])b=!0,d=l[t]();else if(l&&l[n])b=!1,d=l[n]();else throw new s("iterable",["Iterable"],l);const y=new u({objectMode:!0,highWaterMark:1,...c});let _=!1;y._read=function(){_||(_=!0,v())},y._destroy=function(x,S){e(E(x),()=>r.nextTick(S,x),m=>r.nextTick(S,m||x))};async function E(x){const S=x!=null,m=typeof d.throw=="function";if(S&&m){const{value:h,done:g}=await d.throw(x);if(await h,g)return}if(typeof d.return=="function"){const{value:h}=await d.return();await h}}async function v(){for(;;){try{const{value:x,done:S}=b?await d.next():d.next();if(S)y.push(null);else{const m=x&&typeof x.then=="function"?await x:x;if(m===null)throw _=!1,new a;if(y.push(m))continue;_=!1}}catch(x){y.destroy(x)}break}}return y}return Mi=o,Mi}var Bi,Ao;function fi(){if(Ao)return Bi;Ao=1;const r=pr(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:s,ObjectKeys:a,ObjectSetPrototypeOf:o,Promise:u,SafeSet:l,SymbolAsyncDispose:c,SymbolAsyncIterator:d,Symbol:b}=Be();Bi=le,le.ReadableState=ye;const{EventEmitter:y}=ci(),{Stream:_,prependListener:E}=xa(),{Buffer:v}=jt(),{addAbortSignal:x}=di(),S=Qt();let m=at().debuglog("stream",O=>{m=O});const h=Td(),g=$r(),{getHighWaterMark:N,getDefaultHighWaterMark:C}=hi(),{aggregateTwoErrors:A,codes:{ERR_INVALID_ARG_TYPE:B,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:F,ERR_STREAM_PUSH_AFTER_EOF:q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:D},AbortError:L}=it(),{validateObject:te}=Rn(),T=b("kPaused"),{StringDecoder:Z}=Dd(),k=sc();o(le.prototype,_.prototype),o(le,_);const Y=()=>{},{errorOrDestroy:w}=g,H=1,K=2,Q=4,ue=8,V=16,G=32,z=64,U=128,ee=256,re=512,fe=1024,ge=2048,j=4096,W=8192,se=16384,he=32768,pe=65536,me=1<<17,J=1<<18;function ce(O){return{enumerable:!1,get(){return(this.state&O)!==0},set(M){M?this.state|=O:this.state&=~O}}}s(ye.prototype,{objectMode:ce(H),ended:ce(K),endEmitted:ce(Q),reading:ce(ue),constructed:ce(V),sync:ce(G),needReadable:ce(z),emittedReadable:ce(U),readableListening:ce(ee),resumeScheduled:ce(re),errorEmitted:ce(fe),emitClose:ce(ge),autoDestroy:ce(j),destroyed:ce(W),closed:ce(se),closeEmitted:ce(he),multiAwaitDrain:ce(pe),readingMore:ce(me),dataEmitted:ce(J)});function ye(O,M,be){typeof be!="boolean"&&(be=M instanceof Ot()),this.state=ge|j|V|G,O&&O.objectMode&&(this.state|=H),be&&O&&O.readableObjectMode&&(this.state|=H),this.highWaterMark=O?N(this,O,"readableHighWaterMark",be):C(!1),this.buffer=new h,this.length=0,this.pipes=[],this.flowing=null,this[T]=null,O&&O.emitClose===!1&&(this.state&=~ge),O&&O.autoDestroy===!1&&(this.state&=~j),this.errored=null,this.defaultEncoding=O&&O.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,O&&O.encoding&&(this.decoder=new Z(O.encoding),this.encoding=O.encoding)}function le(O){if(!(this instanceof le))return new le(O);const M=this instanceof Ot();this._readableState=new ye(O,this,M),O&&(typeof O.read=="function"&&(this._read=O.read),typeof O.destroy=="function"&&(this._destroy=O.destroy),typeof O.construct=="function"&&(this._construct=O.construct),O.signal&&!M&&x(O.signal,this)),_.call(this,O),g.construct(this,()=>{this._readableState.needReadable&&X(this,this._readableState)})}le.prototype.destroy=g.destroy,le.prototype._undestroy=g.undestroy,le.prototype._destroy=function(O,M){M(O)},le.prototype[y.captureRejectionSymbol]=function(O){this.destroy(O)},le.prototype[c]=function(){let O;return this.destroyed||(O=this.readableEnded?null:new L,this.destroy(O)),new u((M,be)=>S(this,_e=>_e&&_e!==O?be(_e):M(null)))},le.prototype.push=function(O,M){return Re(this,O,M,!1)},le.prototype.unshift=function(O,M){return Re(this,O,M,!0)};function Re(O,M,be,_e){m("readableAddChunk",M);const ve=O._readableState;let Qe;if((ve.state&H)===0&&(typeof M=="string"?(be=be||ve.defaultEncoding,ve.encoding!==be&&(_e&&ve.encoding?M=v.from(M,be).toString(ve.encoding):(M=v.from(M,be),be=""))):M instanceof v?be="":_._isUint8Array(M)?(M=_._uint8ArrayToBuffer(M),be=""):M!=null&&(Qe=new B("chunk",["string","Buffer","Uint8Array"],M))),Qe)w(O,Qe);else if(M===null)ve.state&=~ue,f(O,ve);else if((ve.state&H)!==0||M&&M.length>0)if(_e)if((ve.state&Q)!==0)w(O,new D);else{if(ve.destroyed||ve.errored)return!1;ze(O,ve,M,!0)}else if(ve.ended)w(O,new q);else{if(ve.destroyed||ve.errored)return!1;ve.state&=~ue,ve.decoder&&!be?(M=ve.decoder.write(M),ve.objectMode||M.length!==0?ze(O,ve,M,!1):X(O,ve)):ze(O,ve,M,!1)}else _e||(ve.state&=~ue,X(O,ve));return!ve.ended&&(ve.length<ve.highWaterMark||ve.length===0)}function ze(O,M,be,_e){M.flowing&&M.length===0&&!M.sync&&O.listenerCount("data")>0?((M.state&pe)!==0?M.awaitDrainWriters.clear():M.awaitDrainWriters=null,M.dataEmitted=!0,O.emit("data",be)):(M.length+=M.objectMode?1:be.length,_e?M.buffer.unshift(be):M.buffer.push(be),(M.state&z)!==0&&p(O)),X(O,M)}le.prototype.isPaused=function(){const O=this._readableState;return O[T]===!0||O.flowing===!1},le.prototype.setEncoding=function(O){const M=new Z(O);this._readableState.decoder=M,this._readableState.encoding=this._readableState.decoder.encoding;const be=this._readableState.buffer;let _e="";for(const ve of be)_e+=M.write(ve);return be.clear(),_e!==""&&be.push(_e),this._readableState.length=_e.length,this};const Ie=1073741824;function Xe(O){if(O>Ie)throw new F("size","<= 1GiB",O);return O--,O|=O>>>1,O|=O>>>2,O|=O>>>4,O|=O>>>8,O|=O>>>16,O++,O}function I(O,M){return O<=0||M.length===0&&M.ended?0:(M.state&H)!==0?1:n(O)?M.flowing&&M.length?M.buffer.first().length:M.length:O<=M.length?O:M.ended?M.length:0}le.prototype.read=function(O){m("read",O),O===void 0?O=NaN:t(O)||(O=i(O,10));const M=this._readableState,be=O;if(O>M.highWaterMark&&(M.highWaterMark=Xe(O)),O!==0&&(M.state&=~U),O===0&&M.needReadable&&((M.highWaterMark!==0?M.length>=M.highWaterMark:M.length>0)||M.ended))return m("read: emitReadable",M.length,M.ended),M.length===0&&M.ended?He(this):p(this),null;if(O=I(O,M),O===0&&M.ended)return M.length===0&&He(this),null;let _e=(M.state&z)!==0;if(m("need readable",_e),(M.length===0||M.length-O<M.highWaterMark)&&(_e=!0,m("length less than watermark",_e)),M.ended||M.reading||M.destroyed||M.errored||!M.constructed)_e=!1,m("reading, ended or constructing",_e);else if(_e){m("do read"),M.state|=ue|G,M.length===0&&(M.state|=z);try{this._read(M.highWaterMark)}catch(Qe){w(this,Qe)}M.state&=~G,M.reading||(O=I(be,M))}let ve;return O>0?ve=qe(O,M):ve=null,ve===null?(M.needReadable=M.length<=M.highWaterMark,O=0):(M.length-=O,M.multiAwaitDrain?M.awaitDrainWriters.clear():M.awaitDrainWriters=null),M.length===0&&(M.ended||(M.needReadable=!0),be!==O&&M.ended&&He(this)),ve!==null&&!M.errorEmitted&&!M.closeEmitted&&(M.dataEmitted=!0,this.emit("data",ve)),ve};function f(O,M){if(m("onEofChunk"),!M.ended){if(M.decoder){const be=M.decoder.end();be&&be.length&&(M.buffer.push(be),M.length+=M.objectMode?1:be.length)}M.ended=!0,M.sync?p(O):(M.needReadable=!1,M.emittedReadable=!0,$(O))}}function p(O){const M=O._readableState;m("emitReadable",M.needReadable,M.emittedReadable),M.needReadable=!1,M.emittedReadable||(m("emitReadable",M.flowing),M.emittedReadable=!0,r.nextTick($,O))}function $(O){const M=O._readableState;m("emitReadable_",M.destroyed,M.length,M.ended),!M.destroyed&&!M.errored&&(M.length||M.ended)&&(O.emit("readable"),M.emittedReadable=!1),M.needReadable=!M.flowing&&!M.ended&&M.length<=M.highWaterMark,De(O)}function X(O,M){!M.readingMore&&M.constructed&&(M.readingMore=!0,r.nextTick(oe,O,M))}function oe(O,M){for(;!M.reading&&!M.ended&&(M.length<M.highWaterMark||M.flowing&&M.length===0);){const be=M.length;if(m("maybeReadMore read 0"),O.read(0),be===M.length)break}M.readingMore=!1}le.prototype._read=function(O){throw new R("_read()")},le.prototype.pipe=function(O,M){const be=this,_e=this._readableState;_e.pipes.length===1&&(_e.multiAwaitDrain||(_e.multiAwaitDrain=!0,_e.awaitDrainWriters=new l(_e.awaitDrainWriters?[_e.awaitDrainWriters]:[]))),_e.pipes.push(O),m("pipe count=%d opts=%j",_e.pipes.length,M);const Qe=(!M||M.end!==!1)&&O!==r.stdout&&O!==r.stderr?Cn:P;_e.endEmitted?r.nextTick(Qe):be.once("end",Qe),O.on("unpipe",Ye);function Ye(ne,ie){m("onunpipe"),ne===be&&ie&&ie.hasUnpiped===!1&&(ie.hasUnpiped=!0,Tt())}function Cn(){m("onend"),O.end()}let Rt,jn=!1;function Tt(){m("cleanup"),O.removeListener("close",qr),O.removeListener("finish",We),Rt&&O.removeListener("drain",Rt),O.removeListener("error",yr),O.removeListener("unpipe",Ye),be.removeListener("end",Cn),be.removeListener("end",P),be.removeListener("data",mr),jn=!0,Rt&&_e.awaitDrainWriters&&(!O._writableState||O._writableState.needDrain)&&Rt()}function Br(){jn||(_e.pipes.length===1&&_e.pipes[0]===O?(m("false write response, pause",0),_e.awaitDrainWriters=O,_e.multiAwaitDrain=!1):_e.pipes.length>1&&_e.pipes.includes(O)&&(m("false write response, pause",_e.awaitDrainWriters.size),_e.awaitDrainWriters.add(O)),be.pause()),Rt||(Rt=de(be,O),O.on("drain",Rt))}be.on("data",mr);function mr(ne){m("ondata");const ie=O.write(ne);m("dest.write",ie),ie===!1&&Br()}function yr(ne){if(m("onerror",ne),P(),O.removeListener("error",yr),O.listenerCount("error")===0){const ie=O._writableState||O._readableState;ie&&!ie.errorEmitted?w(O,ne):O.emit("error",ne)}}E(O,"error",yr);function qr(){O.removeListener("finish",We),P()}O.once("close",qr);function We(){m("onfinish"),O.removeListener("close",qr),P()}O.once("finish",We);function P(){m("unpipe"),be.unpipe(O)}return O.emit("pipe",be),O.writableNeedDrain===!0?Br():_e.flowing||(m("pipe resume"),be.resume()),O};function de(O,M){return function(){const _e=O._readableState;_e.awaitDrainWriters===M?(m("pipeOnDrain",1),_e.awaitDrainWriters=null):_e.multiAwaitDrain&&(m("pipeOnDrain",_e.awaitDrainWriters.size),_e.awaitDrainWriters.delete(M)),(!_e.awaitDrainWriters||_e.awaitDrainWriters.size===0)&&O.listenerCount("data")&&O.resume()}}le.prototype.unpipe=function(O){const M=this._readableState,be={hasUnpiped:!1};if(M.pipes.length===0)return this;if(!O){const ve=M.pipes;M.pipes=[],this.pause();for(let Qe=0;Qe<ve.length;Qe++)ve[Qe].emit("unpipe",this,{hasUnpiped:!1});return this}const _e=e(M.pipes,O);return _e===-1?this:(M.pipes.splice(_e,1),M.pipes.length===0&&this.pause(),O.emit("unpipe",this,be),this)},le.prototype.on=function(O,M){const be=_.prototype.on.call(this,O,M),_e=this._readableState;return O==="data"?(_e.readableListening=this.listenerCount("readable")>0,_e.flowing!==!1&&this.resume()):O==="readable"&&!_e.endEmitted&&!_e.readableListening&&(_e.readableListening=_e.needReadable=!0,_e.flowing=!1,_e.emittedReadable=!1,m("on readable",_e.length,_e.reading),_e.length?p(this):_e.reading||r.nextTick(ke,this)),be},le.prototype.addListener=le.prototype.on,le.prototype.removeListener=function(O,M){const be=_.prototype.removeListener.call(this,O,M);return O==="readable"&&r.nextTick(Ee,this),be},le.prototype.off=le.prototype.removeListener,le.prototype.removeAllListeners=function(O){const M=_.prototype.removeAllListeners.apply(this,arguments);return(O==="readable"||O===void 0)&&r.nextTick(Ee,this),M};function Ee(O){const M=O._readableState;M.readableListening=O.listenerCount("readable")>0,M.resumeScheduled&&M[T]===!1?M.flowing=!0:O.listenerCount("data")>0?O.resume():M.readableListening||(M.flowing=null)}function ke(O){m("readable nexttick read 0"),O.read(0)}le.prototype.resume=function(){const O=this._readableState;return O.flowing||(m("resume"),O.flowing=!O.readableListening,Le(this,O)),O[T]=!1,this};function Le(O,M){M.resumeScheduled||(M.resumeScheduled=!0,r.nextTick(Oe,O,M))}function Oe(O,M){m("resume",M.reading),M.reading||O.read(0),M.resumeScheduled=!1,O.emit("resume"),De(O),M.flowing&&!M.reading&&O.read(0)}le.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[T]=!0,this};function De(O){const M=O._readableState;for(m("flow",M.flowing);M.flowing&&O.read()!==null;);}le.prototype.wrap=function(O){let M=!1;O.on("data",_e=>{!this.push(_e)&&O.pause&&(M=!0,O.pause())}),O.on("end",()=>{this.push(null)}),O.on("error",_e=>{w(this,_e)}),O.on("close",()=>{this.destroy()}),O.on("destroy",()=>{this.destroy()}),this._read=()=>{M&&O.resume&&(M=!1,O.resume())};const be=a(O);for(let _e=1;_e<be.length;_e++){const ve=be[_e];this[ve]===void 0&&typeof O[ve]=="function"&&(this[ve]=O[ve].bind(O))}return this},le.prototype[d]=function(){return mt(this)},le.prototype.iterator=function(O){return O!==void 0&&te(O,"options"),mt(this,O)};function mt(O,M){typeof O.read!="function"&&(O=le.wrap(O,{objectMode:!0}));const be=Mt(O,M);return be.stream=O,be}async function*Mt(O,M){let be=Y;function _e(Ye){this===O?(be(),be=Y):be=Ye}O.on("readable",_e);let ve;const Qe=S(O,{writable:!1},Ye=>{ve=Ye?A(ve,Ye):null,be(),be=Y});try{for(;;){const Ye=O.destroyed?null:O.read();if(Ye!==null)yield Ye;else{if(ve)throw ve;if(ve===null)return;await new u(_e)}}}catch(Ye){throw ve=A(ve,Ye),ve}finally{(ve||M?.destroyOnReturn!==!1)&&(ve===void 0||O._readableState.autoDestroy)?g.destroyer(O,null):(O.off("readable",_e),Qe())}}s(le.prototype,{readable:{__proto__:null,get(){const O=this._readableState;return!!O&&O.readable!==!1&&!O.destroyed&&!O.errorEmitted&&!O.endEmitted},set(O){this._readableState&&(this._readableState.readable=!!O)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(O){this._readableState&&(this._readableState.flowing=O)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(O){this._readableState&&(this._readableState.destroyed=O)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),s(ye.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[T]!==!1},set(O){this[T]=!!O}}}),le._fromList=qe;function qe(O,M){if(M.length===0)return null;let be;return M.objectMode?be=M.buffer.shift():!O||O>=M.length?(M.decoder?be=M.buffer.join(""):M.buffer.length===1?be=M.buffer.first():be=M.buffer.concat(M.length),M.buffer.clear()):be=M.buffer.consume(O,M.decoder),be}function He(O){const M=O._readableState;m("endReadable",M.endEmitted),M.endEmitted||(M.ended=!0,r.nextTick(On,M,O))}function On(O,M){if(m("endReadableNT",O.endEmitted,O.length),!O.errored&&!O.closeEmitted&&!O.endEmitted&&O.length===0){if(O.endEmitted=!0,M.emit("end"),M.writable&&M.allowHalfOpen===!1)r.nextTick(Bt,M);else if(O.autoDestroy){const be=M._writableState;(!be||be.autoDestroy&&(be.finished||be.writable===!1))&&M.destroy()}}}function Bt(O){O.writable&&!O.writableEnded&&!O.destroyed&&O.end()}le.from=function(O,M){return k(le,O,M)};let gr;function Mr(){return gr===void 0&&(gr={}),gr}return le.fromWeb=function(O,M){return Mr().newStreamReadableFromReadableStream(O,M)},le.toWeb=function(O,M){return Mr().newReadableStreamFromStreamReadable(O,M)},le.wrap=function(O,M){var be,_e;return new le({objectMode:(be=(_e=O.readableObjectMode)!==null&&_e!==void 0?_e:O.objectMode)!==null&&be!==void 0?be:!0,...M,destroy(ve,Qe){g.destroyer(O,ve),Qe(ve)}}).wrap(O)},Bi}var qi,Do;function Ea(){if(Do)return qi;Do=1;const r=pr(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:s,ObjectSetPrototypeOf:a,StringPrototypeToLowerCase:o,Symbol:u,SymbolHasInstance:l}=Be();qi=te,te.WritableState=D;const{EventEmitter:c}=ci(),d=xa().Stream,{Buffer:b}=jt(),y=$r(),{addAbortSignal:_}=di(),{getHighWaterMark:E,getDefaultHighWaterMark:v}=hi(),{ERR_INVALID_ARG_TYPE:x,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:h,ERR_STREAM_DESTROYED:g,ERR_STREAM_ALREADY_FINISHED:N,ERR_STREAM_NULL_VALUES:C,ERR_STREAM_WRITE_AFTER_END:A,ERR_UNKNOWN_ENCODING:B}=it().codes,{errorOrDestroy:R}=y;a(te.prototype,d.prototype),a(te,d);function F(){}const q=u("kOnFinished");function D(j,W,se){typeof se!="boolean"&&(se=W instanceof Ot()),this.objectMode=!!(j&&j.objectMode),se&&(this.objectMode=this.objectMode||!!(j&&j.writableObjectMode)),this.highWaterMark=j?E(this,j,"writableHighWaterMark",se):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const he=!!(j&&j.decodeStrings===!1);this.decodeStrings=!he,this.defaultEncoding=j&&j.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=w.bind(void 0,W),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,L(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!j||j.emitClose!==!1,this.autoDestroy=!j||j.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[q]=[]}function L(j){j.buffered=[],j.bufferedIndex=0,j.allBuffers=!0,j.allNoop=!0}D.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(D.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function te(j){const W=this instanceof Ot();if(!W&&!n(te,this))return new te(j);this._writableState=new D(j,this,W),j&&(typeof j.write=="function"&&(this._write=j.write),typeof j.writev=="function"&&(this._writev=j.writev),typeof j.destroy=="function"&&(this._destroy=j.destroy),typeof j.final=="function"&&(this._final=j.final),typeof j.construct=="function"&&(this._construct=j.construct),j.signal&&_(j.signal,this)),d.call(this,j),y.construct(this,()=>{const se=this._writableState;se.writing||ue(this,se),U(this,se)})}i(te,l,{__proto__:null,value:function(j){return n(this,j)?!0:this!==te?!1:j&&j._writableState instanceof D}}),te.prototype.pipe=function(){R(this,new h)};function T(j,W,se,he){const pe=j._writableState;if(typeof se=="function")he=se,se=pe.defaultEncoding;else{if(!se)se=pe.defaultEncoding;else if(se!=="buffer"&&!b.isEncoding(se))throw new B(se);typeof he!="function"&&(he=F)}if(W===null)throw new C;if(!pe.objectMode)if(typeof W=="string")pe.decodeStrings!==!1&&(W=b.from(W,se),se="buffer");else if(W instanceof b)se="buffer";else if(d._isUint8Array(W))W=d._uint8ArrayToBuffer(W),se="buffer";else throw new x("chunk",["string","Buffer","Uint8Array"],W);let me;return pe.ending?me=new A:pe.destroyed&&(me=new g("write")),me?(r.nextTick(he,me),R(j,me,!0),me):(pe.pendingcb++,Z(j,pe,W,se,he))}te.prototype.write=function(j,W,se){return T(this,j,W,se)===!0},te.prototype.cork=function(){this._writableState.corked++},te.prototype.uncork=function(){const j=this._writableState;j.corked&&(j.corked--,j.writing||ue(this,j))},te.prototype.setDefaultEncoding=function(W){if(typeof W=="string"&&(W=o(W)),!b.isEncoding(W))throw new B(W);return this._writableState.defaultEncoding=W,this};function Z(j,W,se,he,pe){const me=W.objectMode?1:se.length;W.length+=me;const J=W.length<W.highWaterMark;return J||(W.needDrain=!0),W.writing||W.corked||W.errored||!W.constructed?(W.buffered.push({chunk:se,encoding:he,callback:pe}),W.allBuffers&&he!=="buffer"&&(W.allBuffers=!1),W.allNoop&&pe!==F&&(W.allNoop=!1)):(W.writelen=me,W.writecb=pe,W.writing=!0,W.sync=!0,j._write(se,he,W.onwrite),W.sync=!1),J&&!W.errored&&!W.destroyed}function k(j,W,se,he,pe,me,J){W.writelen=he,W.writecb=J,W.writing=!0,W.sync=!0,W.destroyed?W.onwrite(new g("write")):se?j._writev(pe,W.onwrite):j._write(pe,me,W.onwrite),W.sync=!1}function Y(j,W,se,he){--W.pendingcb,he(se),Q(W),R(j,se)}function w(j,W){const se=j._writableState,he=se.sync,pe=se.writecb;if(typeof pe!="function"){R(j,new m);return}se.writing=!1,se.writecb=null,se.length-=se.writelen,se.writelen=0,W?(W.stack,se.errored||(se.errored=W),j._readableState&&!j._readableState.errored&&(j._readableState.errored=W),he?r.nextTick(Y,j,se,W,pe):Y(j,se,W,pe)):(se.buffered.length>se.bufferedIndex&&ue(j,se),he?se.afterWriteTickInfo!==null&&se.afterWriteTickInfo.cb===pe?se.afterWriteTickInfo.count++:(se.afterWriteTickInfo={count:1,cb:pe,stream:j,state:se},r.nextTick(H,se.afterWriteTickInfo)):K(j,se,1,pe))}function H({stream:j,state:W,count:se,cb:he}){return W.afterWriteTickInfo=null,K(j,W,se,he)}function K(j,W,se,he){for(!W.ending&&!j.destroyed&&W.length===0&&W.needDrain&&(W.needDrain=!1,j.emit("drain"));se-- >0;)W.pendingcb--,he();W.destroyed&&Q(W),U(j,W)}function Q(j){if(j.writing)return;for(let pe=j.bufferedIndex;pe<j.buffered.length;++pe){var W;const{chunk:me,callback:J}=j.buffered[pe],ce=j.objectMode?1:me.length;j.length-=ce,J((W=j.errored)!==null&&W!==void 0?W:new g("write"))}const se=j[q].splice(0);for(let pe=0;pe<se.length;pe++){var he;se[pe]((he=j.errored)!==null&&he!==void 0?he:new g("end"))}L(j)}function ue(j,W){if(W.corked||W.bufferProcessing||W.destroyed||!W.constructed)return;const{buffered:se,bufferedIndex:he,objectMode:pe}=W,me=se.length-he;if(!me)return;let J=he;if(W.bufferProcessing=!0,me>1&&j._writev){W.pendingcb-=me-1;const ce=W.allNoop?F:le=>{for(let Re=J;Re<se.length;++Re)se[Re].callback(le)},ye=W.allNoop&&J===0?se:e(se,J);ye.allBuffers=W.allBuffers,k(j,W,!0,W.length,ye,"",ce),L(W)}else{do{const{chunk:ce,encoding:ye,callback:le}=se[J];se[J++]=null;const Re=pe?1:ce.length;k(j,W,!1,Re,ce,ye,le)}while(J<se.length&&!W.writing);J===se.length?L(W):J>256?(se.splice(0,J),W.bufferedIndex=0):W.bufferedIndex=J}W.bufferProcessing=!1}te.prototype._write=function(j,W,se){if(this._writev)this._writev([{chunk:j,encoding:W}],se);else throw new S("_write()")},te.prototype._writev=null,te.prototype.end=function(j,W,se){const he=this._writableState;typeof j=="function"?(se=j,j=null,W=null):typeof W=="function"&&(se=W,W=null);let pe;if(j!=null){const me=T(this,j,W);me instanceof t&&(pe=me)}return he.corked&&(he.corked=1,this.uncork()),pe||(!he.errored&&!he.ending?(he.ending=!0,U(this,he,!0),he.ended=!0):he.finished?pe=new N("end"):he.destroyed&&(pe=new g("end"))),typeof se=="function"&&(pe||he.finished?r.nextTick(se,pe):he[q].push(se)),this};function V(j){return j.ending&&!j.destroyed&&j.constructed&&j.length===0&&!j.errored&&j.buffered.length===0&&!j.finished&&!j.writing&&!j.errorEmitted&&!j.closeEmitted}function G(j,W){let se=!1;function he(pe){if(se){R(j,pe??m());return}if(se=!0,W.pendingcb--,pe){const me=W[q].splice(0);for(let J=0;J<me.length;J++)me[J](pe);R(j,pe,W.sync)}else V(W)&&(W.prefinished=!0,j.emit("prefinish"),W.pendingcb++,r.nextTick(ee,j,W))}W.sync=!0,W.pendingcb++;try{j._final(he)}catch(pe){he(pe)}W.sync=!1}function z(j,W){!W.prefinished&&!W.finalCalled&&(typeof j._final=="function"&&!W.destroyed?(W.finalCalled=!0,G(j,W)):(W.prefinished=!0,j.emit("prefinish")))}function U(j,W,se){V(W)&&(z(j,W),W.pendingcb===0&&(se?(W.pendingcb++,r.nextTick((he,pe)=>{V(pe)?ee(he,pe):pe.pendingcb--},j,W)):V(W)&&(W.pendingcb++,ee(j,W))))}function ee(j,W){W.pendingcb--,W.finished=!0;const se=W[q].splice(0);for(let he=0;he<se.length;he++)se[he]();if(j.emit("finish"),W.autoDestroy){const he=j._readableState;(!he||he.autoDestroy&&(he.endEmitted||he.readable===!1))&&j.destroy()}}s(te.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(j){this._writableState&&(this._writableState.destroyed=j)}},writable:{__proto__:null,get(){const j=this._writableState;return!!j&&j.writable!==!1&&!j.destroyed&&!j.errored&&!j.ending&&!j.ended},set(j){this._writableState&&(this._writableState.writable=!!j)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){const j=this._writableState;return j?!j.destroyed&&!j.ending&&j.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});const re=y.destroy;te.prototype.destroy=function(j,W){const se=this._writableState;return!se.destroyed&&(se.bufferedIndex<se.buffered.length||se[q].length)&&r.nextTick(Q,se),re.call(this,j,W),this},te.prototype._undestroy=y.undestroy,te.prototype._destroy=function(j,W){W(j)},te.prototype[c.captureRejectionSymbol]=function(j){this.destroy(j)};let fe;function ge(){return fe===void 0&&(fe={}),fe}return te.fromWeb=function(j,W){return ge().newStreamWritableFromWritableStream(j,W)},te.toWeb=function(j){return ge().newWritableStreamFromStreamWritable(j)},qi}var Ui,Lo;function Ld(){if(Lo)return Ui;Lo=1;const r=pr(),e=jt(),{isReadable:t,isWritable:n,isIterable:i,isNodeStream:s,isReadableNodeStream:a,isWritableNodeStream:o,isDuplexNodeStream:u,isReadableStream:l,isWritableStream:c}=$t(),d=Qt(),{AbortError:b,codes:{ERR_INVALID_ARG_TYPE:y,ERR_INVALID_RETURN_VALUE:_}}=it(),{destroyer:E}=$r(),v=Ot(),x=fi(),S=Ea(),{createDeferredPromise:m}=at(),h=sc(),g=globalThis.Blob||e.Blob,N=typeof g<"u"?function(D){return D instanceof g}:function(D){return!1},C=globalThis.AbortController||xn().AbortController,{FunctionPrototypeCall:A}=Be();class B extends v{constructor(D){super(D),D?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),D?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}Ui=function q(D,L){if(u(D))return D;if(a(D))return F({readable:D});if(o(D))return F({writable:D});if(s(D))return F({writable:!1,readable:!1});if(l(D))return F({readable:x.fromWeb(D)});if(c(D))return F({writable:S.fromWeb(D)});if(typeof D=="function"){const{value:T,write:Z,final:k,destroy:Y}=R(D);if(i(T))return h(B,T,{objectMode:!0,write:Z,final:k,destroy:Y});const w=T?.then;if(typeof w=="function"){let H;const K=A(w,T,Q=>{if(Q!=null)throw new _("nully","body",Q)},Q=>{E(H,Q)});return H=new B({objectMode:!0,readable:!1,write:Z,final(Q){k(async()=>{try{await K,r.nextTick(Q,null)}catch(ue){r.nextTick(Q,ue)}})},destroy:Y})}throw new _("Iterable, AsyncIterable or AsyncFunction",L,T)}if(N(D))return q(D.arrayBuffer());if(i(D))return h(B,D,{objectMode:!0,writable:!1});if(l(D?.readable)&&c(D?.writable))return B.fromWeb(D);if(typeof D?.writable=="object"||typeof D?.readable=="object"){const T=D!=null&&D.readable?a(D?.readable)?D?.readable:q(D.readable):void 0,Z=D!=null&&D.writable?o(D?.writable)?D?.writable:q(D.writable):void 0;return F({readable:T,writable:Z})}const te=D?.then;if(typeof te=="function"){let T;return A(te,D,Z=>{Z!=null&&T.push(Z),T.push(null)},Z=>{E(T,Z)}),T=new B({objectMode:!0,writable:!1,read(){}})}throw new y(L,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],D)};function R(q){let{promise:D,resolve:L}=m();const te=new C,T=te.signal;return{value:q((async function*(){for(;;){const k=D;D=null;const{chunk:Y,done:w,cb:H}=await k;if(r.nextTick(H),w)return;if(T.aborted)throw new b(void 0,{cause:T.reason});({promise:D,resolve:L}=m()),yield Y}})(),{signal:T}),write(k,Y,w){const H=L;L=null,H({chunk:k,done:!1,cb:w})},final(k){const Y=L;L=null,Y({done:!0,cb:k})},destroy(k,Y){te.abort(),Y(k)}}}function F(q){const D=q.readable&&typeof q.readable.read!="function"?x.wrap(q.readable):q.readable,L=q.writable;let te=!!t(D),T=!!n(L),Z,k,Y,w,H;function K(Q){const ue=w;w=null,ue?ue(Q):Q&&H.destroy(Q)}return H=new B({readableObjectMode:!!(D!=null&&D.readableObjectMode),writableObjectMode:!!(L!=null&&L.writableObjectMode),readable:te,writable:T}),T&&(d(L,Q=>{T=!1,Q&&E(D,Q),K(Q)}),H._write=function(Q,ue,V){L.write(Q,ue)?V():Z=V},H._final=function(Q){L.end(),k=Q},L.on("drain",function(){if(Z){const Q=Z;Z=null,Q()}}),L.on("finish",function(){if(k){const Q=k;k=null,Q()}})),te&&(d(D,Q=>{te=!1,Q&&E(D,Q),K(Q)}),D.on("readable",function(){if(Y){const Q=Y;Y=null,Q()}}),D.on("end",function(){H.push(null)}),H._read=function(){for(;;){const Q=D.read();if(Q===null){Y=H._read;return}if(!H.push(Q))return}}),H._destroy=function(Q,ue){!Q&&w!==null&&(Q=new b),Y=null,Z=null,k=null,w===null?ue(Q):(w=ue,E(L,Q),E(D,Q))},H}return Ui}var Hi,Oo;function Ot(){if(Oo)return Hi;Oo=1;const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:n}=Be();Hi=a;const i=fi(),s=Ea();n(a.prototype,i.prototype),n(a,i);{const c=t(s.prototype);for(let d=0;d<c.length;d++){const b=c[d];a.prototype[b]||(a.prototype[b]=s.prototype[b])}}function a(c){if(!(this instanceof a))return new a(c);i.call(this,c),s.call(this,c),c?(this.allowHalfOpen=c.allowHalfOpen!==!1,c.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),c.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}r(a.prototype,{writable:{__proto__:null,...e(s.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(s.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(s.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(s.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(s.prototype,"writableLength")},writableFinished:{__proto__:null,...e(s.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(s.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(s.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(s.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(c){this._readableState&&this._writableState&&(this._readableState.destroyed=c,this._writableState.destroyed=c)}}});let o;function u(){return o===void 0&&(o={}),o}a.fromWeb=function(c,d){return u().newStreamDuplexFromReadableWritablePair(c,d)},a.toWeb=function(c){return u().newReadableWritablePairFromDuplex(c)};let l;return a.from=function(c){return l||(l=Ld()),l(c,"body")},Hi}var Vi,Co;function ac(){if(Co)return Vi;Co=1;const{ObjectSetPrototypeOf:r,Symbol:e}=Be();Vi=a;const{ERR_METHOD_NOT_IMPLEMENTED:t}=it().codes,n=Ot(),{getHighWaterMark:i}=hi();r(a.prototype,n.prototype),r(a,n);const s=e("kCallback");function a(l){if(!(this instanceof a))return new a(l);const c=l?i(this,l,"readableHighWaterMark",!0):null;c===0&&(l={...l,highWaterMark:null,readableHighWaterMark:c,writableHighWaterMark:l.writableHighWaterMark||0}),n.call(this,l),this._readableState.sync=!1,this[s]=null,l&&(typeof l.transform=="function"&&(this._transform=l.transform),typeof l.flush=="function"&&(this._flush=l.flush)),this.on("prefinish",u)}function o(l){typeof this._flush=="function"&&!this.destroyed?this._flush((c,d)=>{if(c){l?l(c):this.destroy(c);return}d!=null&&this.push(d),this.push(null),l&&l()}):(this.push(null),l&&l())}function u(){this._final!==o&&o.call(this)}return a.prototype._final=o,a.prototype._transform=function(l,c,d){throw new t("_transform()")},a.prototype._write=function(l,c,d){const b=this._readableState,y=this._writableState,_=b.length;this._transform(l,c,(E,v)=>{if(E){d(E);return}v!=null&&this.push(v),y.ended||_===b.length||b.length<b.highWaterMark?d():this[s]=d})},a.prototype._read=function(){if(this[s]){const l=this[s];this[s]=null,l()}},Vi}var Gi,jo;function oc(){if(jo)return Gi;jo=1;const{ObjectSetPrototypeOf:r}=Be();Gi=t;const e=ac();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)},Gi}var Wi,$o;function Sa(){if($o)return Wi;$o=1;const r=pr(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:n,SymbolDispose:i}=Be(),s=Qt(),{once:a}=at(),o=$r(),u=Ot(),{aggregateTwoErrors:l,codes:{ERR_INVALID_ARG_TYPE:c,ERR_INVALID_RETURN_VALUE:d,ERR_MISSING_ARGS:b,ERR_STREAM_DESTROYED:y,ERR_STREAM_PREMATURE_CLOSE:_},AbortError:E}=it(),{validateFunction:v,validateAbortSignal:x}=Rn(),{isIterable:S,isReadable:m,isReadableNodeStream:h,isNodeStream:g,isTransformStream:N,isWebStream:C,isReadableStream:A,isReadableFinished:B}=$t(),R=globalThis.AbortController||xn().AbortController;let F,q,D;function L(Q,ue,V){let G=!1;Q.on("close",()=>{G=!0});const z=s(Q,{readable:ue,writable:V},U=>{G=!U});return{destroy:U=>{G||(G=!0,o.destroyer(Q,U||new y("pipe")))},cleanup:z}}function te(Q){return v(Q[Q.length-1],"streams[stream.length - 1]"),Q.pop()}function T(Q){if(S(Q))return Q;if(h(Q))return Z(Q);throw new c("val",["Readable","Iterable","AsyncIterable"],Q)}async function*Z(Q){q||(q=fi()),yield*q.prototype[n].call(Q)}async function k(Q,ue,V,{end:G}){let z,U=null;const ee=ge=>{if(ge&&(z=ge),U){const j=U;U=null,j()}},re=()=>new t((ge,j)=>{z?j(z):U=()=>{z?j(z):ge()}});ue.on("drain",ee);const fe=s(ue,{readable:!1},ee);try{ue.writableNeedDrain&&await re();for await(const ge of Q)ue.write(ge)||await re();G&&(ue.end(),await re()),V()}catch(ge){V(z!==ge?l(z,ge):ge)}finally{fe(),ue.off("drain",ee)}}async function Y(Q,ue,V,{end:G}){N(ue)&&(ue=ue.writable);const z=ue.getWriter();try{for await(const U of Q)await z.ready,z.write(U).catch(()=>{});await z.ready,G&&await z.close(),V()}catch(U){try{await z.abort(U),V(U)}catch(ee){V(ee)}}}function w(...Q){return H(Q,a(te(Q)))}function H(Q,ue,V){if(Q.length===1&&e(Q[0])&&(Q=Q[0]),Q.length<2)throw new b("streams");const G=new R,z=G.signal,U=V?.signal,ee=[];x(U,"options.signal");function re(){pe(new E)}D=D||at().addAbortListener;let fe;U&&(fe=D(U,re));let ge,j;const W=[];let se=0;function he(ye){pe(ye,--se===0)}function pe(ye,le){var Re;if(ye&&(!ge||ge.code==="ERR_STREAM_PREMATURE_CLOSE")&&(ge=ye),!(!ge&&!le)){for(;W.length;)W.shift()(ge);(Re=fe)===null||Re===void 0||Re[i](),G.abort(),le&&(ge||ee.forEach(ze=>ze()),r.nextTick(ue,ge,j))}}let me;for(let ye=0;ye<Q.length;ye++){const le=Q[ye],Re=ye<Q.length-1,ze=ye>0,Ie=Re||V?.end!==!1,Xe=ye===Q.length-1;if(g(le)){let I=function(f){f&&f.name!=="AbortError"&&f.code!=="ERR_STREAM_PREMATURE_CLOSE"&&he(f)};if(Ie){const{destroy:f,cleanup:p}=L(le,Re,ze);W.push(f),m(le)&&Xe&&ee.push(p)}le.on("error",I),m(le)&&Xe&&ee.push(()=>{le.removeListener("error",I)})}if(ye===0)if(typeof le=="function"){if(me=le({signal:z}),!S(me))throw new d("Iterable, AsyncIterable or Stream","source",me)}else S(le)||h(le)||N(le)?me=le:me=u.from(le);else if(typeof le=="function"){if(N(me)){var J;me=T((J=me)===null||J===void 0?void 0:J.readable)}else me=T(me);if(me=le(me,{signal:z}),Re){if(!S(me,!0))throw new d("AsyncIterable",`transform[${ye-1}]`,me)}else{var ce;F||(F=oc());const I=new F({objectMode:!0}),f=(ce=me)===null||ce===void 0?void 0:ce.then;if(typeof f=="function")se++,f.call(me,X=>{j=X,X!=null&&I.write(X),Ie&&I.end(),r.nextTick(he)},X=>{I.destroy(X),r.nextTick(he,X)});else if(S(me,!0))se++,k(me,I,he,{end:Ie});else if(A(me)||N(me)){const X=me.readable||me;se++,k(X,I,he,{end:Ie})}else throw new d("AsyncIterable or Promise","destination",me);me=I;const{destroy:p,cleanup:$}=L(me,!1,!0);W.push(p),Xe&&ee.push($)}}else if(g(le)){if(h(me)){se+=2;const I=K(me,le,he,{end:Ie});m(le)&&Xe&&ee.push(I)}else if(N(me)||A(me)){const I=me.readable||me;se++,k(I,le,he,{end:Ie})}else if(S(me))se++,k(me,le,he,{end:Ie});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else if(C(le)){if(h(me))se++,Y(T(me),le,he,{end:Ie});else if(A(me)||S(me))se++,Y(me,le,he,{end:Ie});else if(N(me))se++,Y(me.readable,le,he,{end:Ie});else throw new c("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],me);me=le}else me=u.from(le)}return(z!=null&&z.aborted||U!=null&&U.aborted)&&r.nextTick(re),me}function K(Q,ue,V,{end:G}){let z=!1;if(ue.on("close",()=>{z||V(new _)}),Q.pipe(ue,{end:!1}),G){let U=function(){z=!0,ue.end()};B(Q)?r.nextTick(U):Q.once("end",U)}else V();return s(Q,{readable:!0,writable:!1},U=>{const ee=Q._readableState;U&&U.code==="ERR_STREAM_PREMATURE_CLOSE"&&ee&&ee.ended&&!ee.errored&&!ee.errorEmitted?Q.once("end",V).once("error",V):V(U)}),s(ue,{readable:!1,writable:!0},V)}return Wi={pipelineImpl:H,pipeline:w},Wi}var zi,Fo;function lc(){if(Fo)return zi;Fo=1;const{pipeline:r}=Sa(),e=Ot(),{destroyer:t}=$r(),{isNodeStream:n,isReadable:i,isWritable:s,isWebStream:a,isTransformStream:o,isWritableStream:u,isReadableStream:l}=$t(),{AbortError:c,codes:{ERR_INVALID_ARG_VALUE:d,ERR_MISSING_ARGS:b}}=it(),y=Qt();return zi=function(...E){if(E.length===0)throw new b("streams");if(E.length===1)return e.from(E[0]);const v=[...E];if(typeof E[0]=="function"&&(E[0]=e.from(E[0])),typeof E[E.length-1]=="function"){const F=E.length-1;E[F]=e.from(E[F])}for(let F=0;F<E.length;++F)if(!(!n(E[F])&&!a(E[F]))){if(F<E.length-1&&!(i(E[F])||l(E[F])||o(E[F])))throw new d(`streams[${F}]`,v[F],"must be readable");if(F>0&&!(s(E[F])||u(E[F])||o(E[F])))throw new d(`streams[${F}]`,v[F],"must be writable")}let x,S,m,h,g;function N(F){const q=h;h=null,q?q(F):F?g.destroy(F):!R&&!B&&g.destroy()}const C=E[0],A=r(E,N),B=!!(s(C)||u(C)||o(C)),R=!!(i(A)||l(A)||o(A));if(g=new e({writableObjectMode:!!(C!=null&&C.writableObjectMode),readableObjectMode:!!(A!=null&&A.readableObjectMode),writable:B,readable:R}),B){if(n(C))g._write=function(q,D,L){C.write(q,D)?L():x=L},g._final=function(q){C.end(),S=q},C.on("drain",function(){if(x){const q=x;x=null,q()}});else if(a(C)){const D=(o(C)?C.writable:C).getWriter();g._write=async function(L,te,T){try{await D.ready,D.write(L).catch(()=>{}),T()}catch(Z){T(Z)}},g._final=async function(L){try{await D.ready,D.close().catch(()=>{}),S=L}catch(te){L(te)}}}const F=o(A)?A.readable:A;y(F,()=>{if(S){const q=S;S=null,q()}})}if(R){if(n(A))A.on("readable",function(){if(m){const F=m;m=null,F()}}),A.on("end",function(){g.push(null)}),g._read=function(){for(;;){const F=A.read();if(F===null){m=g._read;return}if(!g.push(F))return}};else if(a(A)){const q=(o(A)?A.readable:A).getReader();g._read=async function(){for(;;)try{const{value:D,done:L}=await q.read();if(!g.push(D))return;if(L){g.push(null);return}}catch{return}}}}return g._destroy=function(F,q){!F&&h!==null&&(F=new c),m=null,x=null,S=null,h===null?q(F):(h=q,n(A)&&t(A,F))},g},zi}var ko;function Od(){if(ko)return Bn;ko=1;const r=globalThis.AbortController||xn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:n,ERR_OUT_OF_RANGE:i},AbortError:s}=it(),{validateAbortSignal:a,validateInteger:o,validateObject:u}=Rn(),l=Be().Symbol("kWeak"),c=Be().Symbol("kResistStopPropagation"),{finished:d}=Qt(),b=lc(),{addAbortSignalNoValidate:y}=di(),{isWritable:_,isNodeStream:E}=$t(),{deprecate:v}=at(),{ArrayPrototypePush:x,Boolean:S,MathFloor:m,Number:h,NumberIsNaN:g,Promise:N,PromiseReject:C,PromiseResolve:A,PromisePrototypeThen:B,Symbol:R}=Be(),F=R("kEmpty"),q=R("kEof");function D(U,ee){if(ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),E(U)&&!_(U))throw new e("stream",U,"must be writable");const re=b(this,U);return ee!=null&&ee.signal&&y(ee.signal,re),re}function L(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal");let re=1;ee?.concurrency!=null&&(re=m(ee.concurrency));let fe=re-1;return ee?.highWaterMark!=null&&(fe=m(ee.highWaterMark)),o(re,"options.concurrency",1),o(fe,"options.highWaterMark",0),fe+=re,(async function*(){const j=at().AbortSignalAny([ee?.signal].filter(S)),W=this,se=[],he={signal:j};let pe,me,J=!1,ce=0;function ye(){J=!0,le()}function le(){ce-=1,Re()}function Re(){me&&!J&&ce<re&&se.length<fe&&(me(),me=null)}async function ze(){try{for await(let Ie of W){if(J)return;if(j.aborted)throw new s;try{if(Ie=U(Ie,he),Ie===F)continue;Ie=A(Ie)}catch(Xe){Ie=C(Xe)}ce+=1,B(Ie,le,ye),se.push(Ie),pe&&(pe(),pe=null),!J&&(se.length>=fe||ce>=re)&&await new N(Xe=>{me=Xe})}se.push(q)}catch(Ie){const Xe=C(Ie);B(Xe,le,ye),se.push(Xe)}finally{J=!0,pe&&(pe(),pe=null)}}ze();try{for(;;){for(;se.length>0;){const Ie=await se[0];if(Ie===q)return;if(j.aborted)throw new s;Ie!==F&&(yield Ie),se.shift(),Re()}await new N(Ie=>{pe=Ie})}}finally{J=!0,me&&(me(),me=null)}}).call(this)}function te(U=void 0){return U!=null&&u(U,"options"),U?.signal!=null&&a(U.signal,"options.signal"),(async function*(){let re=0;for await(const ge of this){var fe;if(U!=null&&(fe=U.signal)!==null&&fe!==void 0&&fe.aborted)throw new s({cause:U.signal.reason});yield[re++,ge]}}).call(this)}async function T(U,ee=void 0){for await(const re of w.call(this,U,ee))return!0;return!1}async function Z(U,ee=void 0){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);return!await T.call(this,async(...re)=>!await U(...re),ee)}async function k(U,ee){for await(const re of w.call(this,U,ee))return re}async function Y(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);async function re(fe,ge){return await U(fe,ge),F}for await(const fe of L.call(this,re,ee));}function w(U,ee){if(typeof U!="function")throw new t("fn",["Function","AsyncFunction"],U);async function re(fe,ge){return await U(fe,ge)?fe:F}return L.call(this,re,ee)}class H extends n{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function K(U,ee,re){var fe;if(typeof U!="function")throw new t("reducer",["Function","AsyncFunction"],U);re!=null&&u(re,"options"),re?.signal!=null&&a(re.signal,"options.signal");let ge=arguments.length>1;if(re!=null&&(fe=re.signal)!==null&&fe!==void 0&&fe.aborted){const pe=new s(void 0,{cause:re.signal.reason});throw this.once("error",()=>{}),await d(this.destroy(pe)),pe}const j=new r,W=j.signal;if(re!=null&&re.signal){const pe={once:!0,[l]:this,[c]:!0};re.signal.addEventListener("abort",()=>j.abort(),pe)}let se=!1;try{for await(const pe of this){var he;if(se=!0,re!=null&&(he=re.signal)!==null&&he!==void 0&&he.aborted)throw new s;ge?ee=await U(ee,pe,{signal:W}):(ee=pe,ge=!0)}if(!se&&!ge)throw new H}finally{j.abort()}return ee}async function Q(U){U!=null&&u(U,"options"),U?.signal!=null&&a(U.signal,"options.signal");const ee=[];for await(const fe of this){var re;if(U!=null&&(re=U.signal)!==null&&re!==void 0&&re.aborted)throw new s(void 0,{cause:U.signal.reason});x(ee,fe)}return ee}function ue(U,ee){const re=L.call(this,U,ee);return(async function*(){for await(const ge of re)yield*ge}).call(this)}function V(U){if(U=h(U),g(U))return 0;if(U<0)throw new i("number",">= 0",U);return U}function G(U,ee=void 0){return ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),U=V(U),(async function*(){var fe;if(ee!=null&&(fe=ee.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;for await(const j of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;U--<=0&&(yield j)}}).call(this)}function z(U,ee=void 0){return ee!=null&&u(ee,"options"),ee?.signal!=null&&a(ee.signal,"options.signal"),U=V(U),(async function*(){var fe;if(ee!=null&&(fe=ee.signal)!==null&&fe!==void 0&&fe.aborted)throw new s;for await(const j of this){var ge;if(ee!=null&&(ge=ee.signal)!==null&&ge!==void 0&&ge.aborted)throw new s;if(U-- >0&&(yield j),U<=0)return}}).call(this)}return Bn.streamReturningOperators={asIndexedPairs:v(te,"readable.asIndexedPairs will be removed in a future version."),drop:G,filter:w,flatMap:ue,map:L,take:z,compose:D},Bn.promiseReturningOperators={every:Z,forEach:Y,reduce:K,toArray:Q,some:T,find:k},Bn}var Qi,Po;function uc(){if(Po)return Qi;Po=1;const{ArrayPrototypePop:r,Promise:e}=Be(),{isIterable:t,isNodeStream:n,isWebStream:i}=$t(),{pipelineImpl:s}=Sa(),{finished:a}=Qt();cc();function o(...u){return new e((l,c)=>{let d,b;const y=u[u.length-1];if(y&&typeof y=="object"&&!n(y)&&!t(y)&&!i(y)){const _=r(u);d=_.signal,b=_.end}s(u,(_,E)=>{_?c(_):l(E)},{signal:d,end:b})})}return Qi={finished:a,pipeline:o},Qi}var Mo;function cc(){if(Mo)return Ii.exports;Mo=1;const{Buffer:r}=jt(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:n}=Be(),{promisify:{custom:i}}=at(),{streamReturningOperators:s,promiseReturningOperators:a}=Od(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=it(),u=lc(),{setDefaultHighWaterMark:l,getDefaultHighWaterMark:c}=hi(),{pipeline:d}=Sa(),{destroyer:b}=$r(),y=Qt(),_=uc(),E=$t(),v=Ii.exports=xa().Stream;v.isDestroyed=E.isDestroyed,v.isDisturbed=E.isDisturbed,v.isErrored=E.isErrored,v.isReadable=E.isReadable,v.isWritable=E.isWritable,v.Readable=fi();for(const S of t(s)){let h=function(...g){if(new.target)throw o();return v.Readable.from(n(m,this,g))};const m=s[S];e(h,"name",{__proto__:null,value:m.name}),e(h,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}for(const S of t(a)){let h=function(...g){if(new.target)throw o();return n(m,this,g)};const m=a[S];e(h,"name",{__proto__:null,value:m.name}),e(h,"length",{__proto__:null,value:m.length}),e(v.Readable.prototype,S,{__proto__:null,value:h,enumerable:!1,configurable:!0,writable:!0})}v.Writable=Ea(),v.Duplex=Ot(),v.Transform=ac(),v.PassThrough=oc(),v.pipeline=d;const{addAbortSignal:x}=di();return v.addAbortSignal=x,v.finished=y,v.destroy=b,v.compose=u,v.setDefaultHighWaterMark=l,v.getDefaultHighWaterMark=c,e(v,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return _}}),e(d,i,{__proto__:null,enumerable:!0,get(){return _.pipeline}}),e(y,i,{__proto__:null,enumerable:!0,get(){return _.finished}}),v.Stream=v,v._isUint8Array=function(m){return m instanceof Uint8Array},v._uint8ArrayToBuffer=function(m){return r.from(m.buffer,m.byteOffset,m.byteLength)},Ii.exports}var Bo;function dc(){return Bo||(Bo=1,(function(r){const e=cc(),t=uc(),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})(Si)),Si.exports}var Ia=dc();const Xi=Symbol("iter");function mn(r,e,t=4){if(t===0)return Object.assign(r,e);for(const n in e)r[n]=mn(r[n]||Object.create(null),e[n],t-1);return r}function hc(r,e,t=4){let n=!1;for(const i in r)if(i in e){const s=t===0?null:hc(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 fc(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:mn({},r[i],t-1);else if(t!==0){const s=fc(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 Cd{constructor(e={}){this._id=1,this._ids=Object.create(null),this._ids[""]=1,this._entities=Object.create(null),this._entities[1]="",this._blankNodeIndex=0,this._factory=e.factory||Ne}_termFromId(e){if(e[0]==="."){const t=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(t[n[1]]),this._termFromId(t[n[2]]),this._termFromId(t[n[3]]),n[4]&&this._termFromId(t[n[4]]))}return hn(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&&(ua(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${t}.${n}.${i}.${s}`:`.${t}.${n}.${i}`]}return this._ids[Ir(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ua(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ir(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,n;if(e)for(t=e=`_:${e}`,n=1;this._ids[t];)t=e+n++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}}class et{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||Ne,this._entityIndex=t.entityIndex||new Cd({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;const t=this._graphs;let n,i;for(const s in t)for(const a in n=t[s].subjects)for(const o in i=n[a])e+=Object.keys(i[o]).length;return this._size=e}_addToIndex(e,t,n,i){const s=e[t]||(e[t]={}),a=s[n]||(s[n]={}),o=i in a;return o||(a[i]=null),!o}_removeFromIndex(e,t,n,i){const s=e[t],a=s[n];delete a[i];for(const o in a)return;delete s[n];for(const o in s)return;delete e[t]}*_findInIndex(e,t,n,i,s,a,o,u){let l,c,d;const b=this._entities,y=this._termFromId(b[u]),_={subject:null,predicate:null,object:null};t&&((l=e,e={})[t]=l[t]);for(const E in e)if(c=e[E]){_[s]=this._termFromId(b[E]),n&&((l=c,c={})[n]=l[n]);for(const v in c)if(d=c[v]){_[a]=this._termFromId(b[v]);const x=i?i in d?[i]:[]:Object.keys(d);for(let S=0;S<x.length;S++)_[o]=this._termFromId(b[x[S]]),yield this._factory.quad(_.subject,_.predicate,_.object,y)}}}_loop(e,t){for(const n in e)t(n)}_loopByKey0(e,t,n){let i,s;if(i=e[t])for(s in i)n(s)}_loopByKey1(e,t,n){let i,s;for(i in e)s=e[i],s[t]&&n(i)}_loopBy2Keys(e,t,n,i){let s,a,o;if((s=e[t])&&(a=s[n]))for(o in a)i(o)}_countInIndex(e,t,n,i){let s=0,a,o,u;t&&((a=e,e={})[t]=a[t]);for(const l in e)if(o=e[l]){n&&((a=o,o={})[n]=a[n]);for(const c in o)(u=o[c])&&(i?i in u&&s++:s+=Object.keys(u).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return n=>{n in t||(t[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,n,i){t||(i=e.graph,n=e.object,t=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,t,n)?(this._addToIndex(s.predicates,t,n,e),this._addToIndex(s.objects,n,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,n,i){return e&&e.subject&&({subject:e,predicate:t,object:n,graph:i}=e),!this.readQuads(e,t,n,i).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,n,i){t||({subject:e,predicate:t,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;const s=this._graphs;let a,o,u;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(n=n&&this._termToNumericId(n))||!(a=s[i])||!(o=a.subjects[e])||!(u=o[t])||!(n in u))return!1;this._removeFromIndex(a.subjects,e,t,n),this._removeFromIndex(a.predicates,t,n,e),this._removeFromIndex(a.objects,n,e,t),this._size!==null&&this._size--;for(e in a.subjects)return!0;return delete s[i],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,n,i){const s=new Ia.Readable({objectMode:!0}),a=this.readQuads(e,t,n,i);return s._read=o=>{for(;--o>=0;){const{done:u,value:l}=a.next();if(u){s.push(null);return}s.push(l)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,n,i){return[...this.readQuads(e,t,n,i)]}*readQuads(e,t,n,i){const s=this._getGraphs(i);let a,o,u,l;if(!(e&&!(o=this._termToNumericId(e))||t&&!(u=this._termToNumericId(t))||n&&!(l=this._termToNumericId(n))))for(const c in s)(a=s[c])&&(o?l?yield*this._findInIndex(a.objects,l,o,u,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,o,u,null,"subject","predicate","object",c):u?yield*this._findInIndex(a.predicates,u,l,null,"predicate","object","subject",c):l?yield*this._findInIndex(a.objects,l,null,null,"object","subject","predicate",c):yield*this._findInIndex(a.subjects,null,null,null,"subject","predicate","object",c))}match(e,t,n,i){return new Ut(this,e,t,n,i,{entityIndex:this._entityIndex})}countQuads(e,t,n,i){const s=this._getGraphs(i);let a=0,o,u,l,c;if(e&&!(u=this._termToNumericId(e))||t&&!(l=this._termToNumericId(t))||n&&!(c=this._termToNumericId(n)))return 0;for(const d in s)(o=s[d])&&(e?n?a+=this._countInIndex(o.objects,c,u,l):a+=this._countInIndex(o.subjects,u,l,c):t?a+=this._countInIndex(o.predicates,l,c,u):a+=this._countInIndex(o.objects,c,u,l));return a}forEach(e,t,n,i,s){this.some(a=>(e(a,this),!1),t,n,i,s)}every(e,t,n,i,s){return!this.some(a=>!e(a,this),t,n,i,s)}some(e,t,n,i,s){for(const a of this.readQuads(t,n,i,s))if(e(a,this))return!0;return!1}getSubjects(e,t,n){const i=[];return this.forSubjects(s=>{i.push(s)},e,t,n),i}forSubjects(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.predicates,o,u,e):this._loopByKey1(a.subjects,o,e):u?this._loopByKey0(a.objects,u,e):this._loop(a.subjects,e))}getPredicates(e,t,n){const i=[];return this.forPredicates(s=>{i.push(s)},e,t,n),i}forPredicates(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.objects,u,o,e):this._loopByKey0(a.subjects,o,e):u?this._loopByKey1(a.predicates,u,e):this._loop(a.predicates,e))}getObjects(e,t,n){const i=[];return this.forObjects(s=>{i.push(s)},e,t,n),i}forObjects(e,t,n,i){const s=this._getGraphs(i);let a,o,u;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||n&&!(u=this._termToNumericId(n))))for(i in s)(a=s[i])&&(o?u?this._loopBy2Keys(a.subjects,o,u,e):this._loopByKey1(a.objects,o,e):u?this._loopByKey0(a.predicates,u,e):this._loop(a.objects,e))}getGraphs(e,t,n){const i=[];return this.forGraphs(s=>{i.push(s)},e,t,n),i}forGraphs(e,t,n,i){for(const s in this._graphs)this.some(a=>(e(a.graph),!0),t,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?(()=>!0):((o,u)=>{throw new Error(`${o.value} ${u}`)}),s=this.getQuads(null,Ke.rdf.rest,Ke.rdf.nil,null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,d;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=this.getQuads(null,null,y,null),E=this.getQuads(y,null,null,null);let v,x=null,S=null,m=null;for(let h=0;h<E.length&&!l;h++)v=E[h],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ke.rdf.first?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ke.rdf.rest?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,d="subject"):l=i(y,"not confined to single graph");for(let h=0;h<_.length&&!l;++h)v=_[h],c?l=i(y,"can't have coreferences"):v.predicate.value===Ke.rdf.rest?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,d="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[d].value]=u)}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof Ut&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof et&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=mn(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof Ut&&(e=e.filtered),e===this)return!0;if(!(e instanceof et)||this._entityIndex!==e._entityIndex)return e.every(l=>this.has(l));const t=this._graphs,n=e._graphs;let i,s,a,o,u;for(const l in n){if(!(i=t[l]))return!1;i=i.subjects;for(const c in s=n[l].subjects){if(!(a=i[c]))return!1;for(const d in o=s[c]){if(!(u=a[d]))return!1;for(const b in o[d])if(!(b in u))return!1}}}return!0}deleteMatches(e,t,n,i){for(const s of this.match(e,t,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof Ut&&(e=e.filtered),e===this)return new et({entityIndex:this._entityIndex});if(e instanceof et&&e._entityIndex===this._entityIndex){const t=new et({entityIndex:this._entityIndex}),n=fc(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 Ut&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new et({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&t.add(n);return t}intersection(e){if(e instanceof Ut&&(e=e.filtered),e===this){const t=new et({entityIndex:this._entityIndex});return t._graphs=mn(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof et&&this._entityIndex===e._entityIndex){const t=new et({entityIndex:this._entityIndex}),n=hc(e._graphs,this._graphs);return n&&(t._graphs=n,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new et({entityIndex:this._entityIndex});for(const n of this)t.add(e(n,this));return t}reduce(e,t){const n=this.readQuads();let i=t===void 0?n.next().value:t;for(const s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new va().quadsToString(this)}union(e){const t=new et({entityIndex:this._entityIndex});return t._graphs=mn(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function It(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:It(r[s],e,t+1);a!==!1&&(i=i||Object.create(null),i[s]=a)}return i}class Ut extends Ia.Readable{constructor(e,t,n,i,s,a){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:n,object:i,graph:s,options:a})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:n,predicate:i,subject:s}=this,a=this._filtered=new et({factory:e._factory,entityIndex:this.options.entityIndex});let o,u,l;if(s&&!(o=a._termToNumericId(s))||i&&!(u=a._termToNumericId(i))||n&&!(l=a._termToNumericId(n)))return a;const c=e._getGraphs(t);for(const d in c){let b,y,_,E;(E=c[d])&&(!o&&u?(y=It(E.predicates,[u,l,o]))&&(b=It(E.subjects,[o,u,l]),_=It(E.objects,[l,o,u])):l?(_=It(E.objects,[l,o,u]))&&(b=It(E.subjects,[o,u,l]),y=It(E.predicates,[u,l,o])):(b=It(E.subjects,[o,u,l]))&&(y=It(E.predicates,[u,l,o]),_=It(E.objects,[l,o,u])),b&&(a._graphs[d]={subjects:b,predicates:y,objects:_}))}a._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Xi]&&(this[Xi]=this[Symbol.iterator]());const t=this[Xi];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 va().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 Ut(this.filtered,e,t,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}class jd extends Ia.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;const t=new rc(e);let n,i;const s={onQuad:(a,o)=>{a&&this.emit("error",a)||o&&this.push(o)},onPrefix:(a,o)=>{this.emit("prefix",a,o)}};e&&e.comments&&(s.onComment=a=>{this.emit("comment",a)}),t.parse({on:(a,o)=>{switch(a){case"data":n=o;break;case"end":i=o;break}}},s),this._transform=(a,o,u)=>{n(a),u()},this._flush=a=>{i(),a()}}import(e){return e.on("data",t=>{this.write(t)}),e.on("end",()=>{this.end()}),e.on("error",t=>{this.emit("error",t)}),this}}const xe="http://www.w3.org/ns/shacl#",qo="http://datashapes.org/dash#",Wt="http://www.w3.org/2001/XMLSchema#",Ht="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Na="http://www.w3.org/2000/01/rdf-schema#",Ra="http://www.w3.org/2004/02/skos/core#",$d="http://www.w3.org/2002/07/owl#",Fd="http://www.w3.org/ns/oa#",kd="http://purl.org/dc/terms/",Pd="http://xmlns.com/foaf/0.1/",yn=Ne.namedNode("loaded-shapes"),Lt=Ne.namedNode("loaded-data"),tt=Ne.namedNode(Ht+"type"),ca=Ne.namedNode(kd+"conformsTo"),Uo=Ne.namedNode(Na+"subClassOf"),Ta=Ne.namedNode($d+"imports"),Md=Ne.namedNode(Ra+"broader"),Bd=Ne.namedNode(Ra+"narrower"),Hn=Ne.namedNode(xe+"NodeShape"),qd=Ne.namedNode(xe+"IRI"),ni=Ne.namedNode(xe+"property"),Aa=Ne.namedNode(xe+"class"),Ud=Ne.namedNode(xe+"node"),Rr=Ne.namedNode(xe+"targetClass"),Hd=Ne.namedNode(xe+"nodeKind");Ne.namedNode(Wt+"string");function bn(r,e,t=xe,n){let i="";const s=Vd(r,e,t,n);return s&&(i=s.value),i}function Vd(r,e,t=xe,n){let i;const s=t+e;if(n?.length){for(const a of n)for(const o of r)if(o.predicate.value===s){if(o.object.id.endsWith(`@${a}`))return o.object;o.object.id.indexOf("@")<0?i=o.object:i||(i=o.object)}}else for(const a of r)if(a.predicate.value===s)return a.object;return i}function Gd(r){r.querySelector(".editor")?.focus()}function Tn(r,e){return bn(r,"prefLabel",Ra,e)||bn(r,"label",Na,e)||bn(r,"name",Pd,e)}function pc(r,e,t){const n=[];for(const i of r)n.push({value:i,label:Tn(e.getQuads(i,null,null,null),t),children:[]});return n}function da(r,e){for(const t in e)r=r.replace(e[t],"");return r}function gc(r,e,t,n,i=new Set){for(const s of e.owlImports)i.has(s.id)||(i.add(s.id),n.push(...t.getSubjects(tt,r,s)));e.parent&&gc(r,e.parent,t,n,i)}function Da(r,e){if(e.shaclIn){const t=e.config.lists[e.shaclIn];return pc(t?.length?t:[],e.config.store,e.config.languages)}else{const t=e.config.store.getSubjects(tt,r,yn);t.push(...e.config.store.getSubjects(tt,r,Lt)),gc(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:Tn(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,Md,null))n.has(o.id)&&i.set(a.id,o.id);for(const o of e.config.store.getObjects(a,Bd,null))n.has(o.id)&&i.set(o.id,a.id);for(const o of e.config.store.getObjects(a,Uo,null))n.has(o.id)&&i.set(a.id,o.id)}for(const[a,o]of i.entries())n.get(o)?.children?.push(n.get(a));const s=[];for(const[a,o]of n.entries())i.has(a)||s.push(o);for(const a of e.config.store.getSubjects(Uo,r,null))s.push(...Da(a,e));return s}}function ha(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 Wd(r,{remove:e=!1,ignoreErrors:t=!1}={}){const n={},i=t?(()=>!0):((o,u)=>{throw new Error(`${o.value} ${u}`)}),s=r.getQuads(null,Ht+"rest",Ht+"nil",null),a=e?[...s]:[];return s.forEach(o=>{const u=[];let l=!1,c,d;const b=o.graph;let y=o.subject;for(;y&&!l;){const _=r.getQuads(null,null,y,null),E=r.getQuads(y,null,null,null).filter(h=>!h.predicate.equals(tt));let v,x=null,S=null,m=null;for(let h=0;h<E.length&&!l;h++)v=E[h],v.graph.equals(b)?c?l=i(y,"has non-list arcs out"):v.predicate.value===Ht+"first"?x?l=i(y,"has multiple rdf:first arcs"):a.push(x=v):v.predicate.value===Ht+"rest"?S?l=i(y,"has multiple rdf:rest arcs"):a.push(S=v):_.length?l=i(y,"can't be subject and object"):(c=v,d="subject"):l=i(y,"not confined to single graph");for(let h=0;h<_.length&&!l;++h)v=_[h],c?l=i(y,"can't have coreferences"):v.predicate.value===Ht+"rest"?m?l=i(y,"has incoming rdf:rest arcs"):m=v:(c=v,d="object");x?u.unshift(x.object):l=i(y,"has no list head"),y=m&&m.subject}l?e=!1:c&&(n[c[d].value]=u)}),e&&r.removeQuads(a),n}function mc(r,e,t){const n=document.createElement("div");n.classList.add("shacl-or-constraint");const i=[];if(e instanceof zt){const s=[];let a=!1;r.length&&(a=t.store.countQuads(r[0],ni,null,null)>0);for(let l=0;l<r.length;l++)if(a){const c=t.store.getObjects(r[l],ni,null),d=[];let b="";for(const y of c){const _=new ai(y,e,t);d.push(_),b+=(b.length>1?" / ":"")+_.template.label}s.push(d),i.push({label:b,value:l.toString()})}else{const c=new ai(r[l],e,t);s.push([c]),i.push({label:c.template.label,value:l.toString()})}const o=t.theme.createListEditor("Please choose",null,!1,i),u=o.querySelector(".editor");u.onchange=()=>{if(u.value){const l=s[parseInt(u.value)];let c;l.length&&(c=l[0],n.replaceWith(l[0]));for(let d=1;d<l.length;d++)c.after(l[d]),c=l[d]}},n.appendChild(o)}else{const s=[];for(let u=0;u<r.length;u++){const l=t.store.getQuads(r[u],null,null,null);l.length&&(s.push(l),i.push({label:Tn(l,t.languages)||da(l[0].predicate.value,t.prefixes)+" = "+da(l[0].object.value,t.prefixes),value:u.toString()}))}const a=t.theme.createListEditor(e.template.label+"?",null,!1,i,e.template),o=a.querySelector(".editor");o.onchange=()=>{o.value&&n.replaceWith(Zn(e.template.clone().merge(s[parseInt(o.value)]),void 0,!0))},n.appendChild(a)}return n}function zd(r,e,t){if(e instanceof _t){const n=e.datatype;for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(a.predicate.value===`${xe}datatype`&&a.object.equals(n))return s}}else{const n=t.store.getObjects(e,tt,null);for(const i of r){const s=t.store.getQuads(i,null,null,null);for(const a of s)if(n.length>0){if(a.predicate.value===`${xe}node`){for(const o of n)if(t.store.getQuads(a.object,Rr,o,null).length>0)return s}if(a.predicate.equals(Aa)){for(const o of n)if(a.object.equals(o))return s}}else if(a.predicate.equals(Hd)&&a.object.equals(qd))return s}}return console.error("couldn't resolve sh:or/sh:xone on property for value",e),[]}function Qd(r,e,t){for(const n of r){let i=!1;const s=t.store.getObjects(n,ni,null);for(const a of s){const o=t.store.getObjects(a,`${xe}path`,null);for(const u of o)if(i=t.store.countQuads(e,u,null,null)>0,i)break}if(i)return s}return console.error("couldn't resolve sh:or/sh:xone on node for value",e),[]}const Xd={[`${xe}name`]:(r,e)=>{const t=e;r.name=Ho(r.config.languages,r.name,t)},[`${xe}description`]:(r,e)=>{const t=e;r.description=Ho(r.config.languages,r.description,t)},[`${xe}path`]:(r,e)=>{r.path=e.value},[`${xe}node`]:(r,e)=>{r.node=e},[`${xe}datatype`]:(r,e)=>{r.datatype=e},[`${xe}nodeKind`]:(r,e)=>{r.nodeKind=e},[`${xe}minCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${xe}maxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[`${xe}minLength`]:(r,e)=>{r.minLength=parseInt(e.value)},[`${xe}maxLength`]:(r,e)=>{r.maxLength=parseInt(e.value)},[`${xe}minInclusive`]:(r,e)=>{r.minInclusive=parseInt(e.value)},[`${xe}maxInclusive`]:(r,e)=>{r.maxInclusive=parseInt(e.value)},[`${xe}minExclusive`]:(r,e)=>{r.minExclusive=parseInt(e.value)},[`${xe}maxExclusive`]:(r,e)=>{r.maxExclusive=parseInt(e.value)},[`${xe}pattern`]:(r,e)=>{r.pattern=e.value},[`${xe}order`]:(r,e)=>{r.order=parseInt(e.value)},[`${qo}singleLine`]:(r,e)=>{r.singleLine=e.value==="true"},[`${qo}readonly`]:(r,e)=>{r.readonly=e.value==="true"},[`${Fd}styleClass`]:(r,e)=>{r.cssClass=e.value},[`${xe}and`]:(r,e)=>{r.shaclAnd=e.value},[`${xe}in`]:(r,e)=>{r.shaclIn=e.value},[`${xe}languageIn`]:(r,e)=>{r.languageIn=r.config.lists[e.value],r.datatype=Ne.namedNode(Ht+"langString")},[`${xe}defaultValue`]:(r,e)=>{r.defaultValue=e},[`${xe}hasValue`]:(r,e)=>{r.hasValue=e},[`${xe}qualifiedValueShape`]:(r,e)=>{r.qualifiedValueShape=e},[`${xe}qualifiedMinCount`]:(r,e)=>{r.minCount=parseInt(e.value)},[`${xe}qualifiedMaxCount`]:(r,e)=>{r.maxCount=parseInt(e.value)},[Ta.id]:(r,e)=>{r.owlImports.push(e)},[Aa.id]:(r,e)=>{r.class=e;const t=r.config.store.getSubjects(Rr,e,null);t.length>0&&(r.node=t[0])},[`${xe}or`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclOr=t:console.error("list for sh:or not found:",e.value,"existing lists:",r.config.lists)},[`${xe}xone`]:(r,e)=>{const t=r.config.lists[e.value];t?.length?r.shaclXone=t:console.error("list for sh:xone not found:",e.value,"existing lists:",r.config.lists)}};class Jd{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)Xd[t.predicate.id]?.call(this,this,t.object);if(this.label=this.name?.value||Tn(e,this.config.languages),!this.label&&!this.shaclAnd&&(this.label=this.path?da(this.path,this.config.prefixes):"unknown"),this.node&&this.extendedShapes.push(this.node),this.shaclAnd){const t=this.config.lists[this.shaclAnd];if(t?.length)for(const n of t)this.extendedShapes.push(n)}return this}clone(){const e=Object.assign({},this);return e.extendedShapes=[...this.extendedShapes],e.owlImports=[...this.owlImports],this.languageIn&&(e.languageIn=[...this.languageIn]),this.shaclOr&&(e.shaclOr=[...this.shaclOr]),this.shaclXone&&(e.shaclXone=[...this.shaclXone]),e.merge=this.merge.bind(e),e.clone=this.clone.bind(e),e}}const Kd=`form { display:block; --label-width: 8em; --caret-size: 10px; }
28
+ form.mode-edit { padding-left: 1em; }
29
+ form, form * { box-sizing: border-box; }
30
+ shacl-node, .collapsible::part(content) { display: flex; flex-direction: column; width: 100%; position: relative; }
31
+ shacl-node .remove-button { margin-left: 4px; margin-top: 1px; }
32
+ shacl-node .add-button { color: #555; background-color: transparent; margin: 4px 24px 0 0; border: 0; }
33
+ shacl-node .add-button:hover { color:#222; }
34
+ shacl-node .add-button:focus { box-shadow: none; }
35
+ shacl-node h1 { font-size: 16px; border-bottom: 1px solid #AAA; margin-top: 4px; color: #555; }
36
+ shacl-property:not(:has(>.collapsible)), shacl-property>.collapsible::part(content) { display: flex; flex-direction: column; align-items: end; position: relative; }
37
+ shacl-property:not(.may-add) > .add-button { display: none; }
38
+ shacl-property:not(.may-remove) > .property-instance > .remove-button:not(.persistent) { visibility: hidden; }
39
+ shacl-property:not(.may-remove) > .shacl-or-constraint > .remove-button:not(.persistent) { visibility: hidden; }
40
+ .mode-view .shacl-group:not(:has(shacl-property)) { display: none; }
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; align-items: flex-start; }
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
+ .property-instance label[title] { cursor: help; text-decoration: underline dashed #AAA; }
45
+ .property-instance.linked label:after, label.linked:after { content: '\\1F517'; font-size: 0.6em; padding-left: 6px; }
46
+ .mode-edit .property-instance label.required::before { color: red; content: '\\2736'; font-size: 0.6rem; position: absolute; left: -1.4em; top: 0.15rem; }
47
+ .property-instance.valid::before { content: ''; position: absolute; left: calc(var(--label-width) - 1em); top:0.5em; width: 0.9em; height: 0.9em; background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1024 1024" fill="green" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M866.133333 258.133333L362.666667 761.6l-204.8-204.8L98.133333 618.666667 362.666667 881.066667l563.2-563.2z"/></svg>'); }
48
+ .editor:not([type='checkbox']) { flex-grow: 1; }
49
+ textarea.editor { resize: vertical; }
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); color: red; cursor: help; }
52
+ .validation-error::before { content: '\\26a0' }
53
+ .validation-error.node { left: -1em; }
54
+ .invalid > .editor { border-color: red !important; }
55
+ .ml-0 { margin-left: 0 !important; }
56
+ .pr-0 { padding-right: 0 !important; }
57
+ .mode-view .property-instance:not(:first-child) > label { visibility: hidden; }
58
+ .mode-view .property-instance label { width: var(--label-width); }
59
+
60
+ .d-flex { display: flex; }
61
+ .lang { opacity: 0.65; font-size: 0.6em; }
62
+ a, a:visited { color: inherit; }
63
+
64
+ .fadeIn, .fadeOut { animation: fadeIn 0.2s ease-out; }
65
+ .fadeOut { animation-direction: reverse; animation-timing-function: ease-out;}
66
+ @keyframes fadeIn {
67
+ 0% { opacity: 0; transform: scaleY(0.8); }
68
+ 100% { opacity: 1; transform: scaleY(1); }
69
+ }
70
+ .collapsible::part(label) { font-weight: 600; }
71
+ .collapsible > .property-instance:nth-child(even) { background-color: #F8F8F8; }
72
+ .collapsible > .property-instance > shacl-node > h1 { display: none; }
73
+ .ref-link { cursor: pointer; }
74
+ .ref-link:hover { text-decoration: underline; }
75
+ .node-id-display { color: #999; font-size: 11px; }`;class Yd{constructor(e){let t=Kd;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 Nr){const l=n.config.store.getQuads(a,null,null,null);if(l.length){const c=Tn(l,n.config.languages);c&&(a=c)}}else t instanceof _t&&(t.language?(o=document.createElement("span"),o.classList.add("lang"),o.innerText=`@${t.language}`):t.datatype.value===`${Wt}date`?a=new Date(Date.parse(t.value)).toDateString():t.datatype.value===`${Wt}dateTime`&&(a=new Date(Date.parse(t.value)).toLocaleString()));let u;return ha(t.value)?(u=document.createElement("a"),u.setAttribute("href",t.value)):u=document.createElement("div"),u.classList.add("d-flex"),u.innerText=a,o&&u.appendChild(o),i.appendChild(u),i}}function Zd(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,Da(r.class,r),r);if(r.shaclIn){const i=r.config.lists[r.shaclIn];if(i?.length){const s=pc(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===`${Ht}langString`||r.languageIn?.length)return r.config.theme.createLangStringEditor(r.label,e,n,r);switch(r.datatype?.value.replace(Wt,"")){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 eh(r,e,t){if(e==="application/ld+json")return th(r);{const n=new va({format:e,prefixes:t});n.addQuads(r);let i="";return n.end((s,a)=>{s&&console.error(s),i=a}),i}}function th(r){const e=[];for(const t of r){const n={"@id":t.subject.id};if(t.predicate===tt)n["@type"]=t.object.id;else{let i=t.object.value;t.object instanceof _t?t.object.language?i={"@language":t.object.language,"@value":t.object.value}:t.object.datatype&&t.object.datatype.value!==`${Wt}#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 rh(r){let e=r.shaclDatatype,t=r.value;if(t){if(t.startsWith("<")&&t.endsWith(">")&&t.indexOf(":")>-1)return Ne.namedNode(t.substring(1,t.length-1));if(r.dataset.class||r.dataset.nodeKind===xe+"IRI")return Ne.namedNode(t);if(r.dataset.link)return JSON.parse(r.dataset.link);if(r.dataset.lang?e=r.dataset.lang:r.type==="number"?t=parseFloat(t):r.type==="file"&&r.binaryData?t=r.binaryData:r.type==="datetime-local"&&(t=new Date(t).toISOString().slice(0,19)),!e&&typeof t=="string"){let n=t.split("^^");n.length===2&&n[0].startsWith('"')&&n[0].endsWith('"')&&n[1].split(":").length===2?(t=n[0].substring(1,n[0].length-1),e=Ne.namedNode(n[1])):(n=t.split("@"),n.length===2&&n[0].startsWith('"')&&n[0].endsWith('"')&&(t=n[0].substring(1,n[0].length-1),e=n[1]))}return Ne.literal(t,e)}else if((r.type==="checkbox"||r.getAttribute("type")==="checkbox")&&(r.checked||parseInt(r.dataset.minCount||"0")>0))return Ne.literal(r.checked?"true":"false",e)}const _n={};function nh(r){r.predicate===void 0&&r.datatype===void 0?console.warn('not registering plugin because it does neither define "predicate" nor "datatype"',r):_n[`${r.predicate}^${r.datatype}`]=r}function ih(){return Object.entries(_n).map(r=>r[1])}function sh(r,e){let t=_n[`${r}^${e}`];return t||(t=_n[`${r}^undefined`],t)?t:_n[`undefined^${e}`]}class Sy{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
+ * @license
78
+ * Copyright 2019 Google LLC
79
+ * SPDX-License-Identifier: BSD-3-Clause
80
+ */const Qn=globalThis,La=Qn.ShadowRoot&&(Qn.ShadyCSS===void 0||Qn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Oa=Symbol(),Vo=new WeakMap;let yc=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Oa)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(La&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=Vo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Vo.set(t,e))}return e}toString(){return this.cssText}};const ah=r=>new yc(typeof r=="string"?r:r+"",void 0,Oa),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 yc(t,r,Oa)},oh=(r,e)=>{if(La)r.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const t of e){const n=document.createElement("style"),i=Qn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Go=La?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return ah(t)})(r):r;/**
81
+ * @license
82
+ * Copyright 2017 Google LLC
83
+ * SPDX-License-Identifier: BSD-3-Clause
84
+ */const{is:lh,defineProperty:uh,getOwnPropertyDescriptor:ch,getOwnPropertyNames:dh,getOwnPropertySymbols:hh,getPrototypeOf:fh}=Object,pi=globalThis,Wo=pi.trustedTypes,ph=Wo?Wo.emptyScript:"",gh=pi.reactiveElementPolyfillSupport,wn=(r,e)=>r,fa={toAttribute(r,e){switch(e){case Boolean:r=r?ph: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}},bc=(r,e)=>!lh(r,e),zo={attribute:!0,type:String,converter:fa,reflect:!1,useDefault:!1,hasChanged:bc};Symbol.metadata??=Symbol("metadata"),pi.litPropertyMetadata??=new WeakMap;let vr=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=zo){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&&uh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=ch(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i?.call(this);s?.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??zo}static _$Ei(){if(this.hasOwnProperty(wn("elementProperties")))return;const e=fh(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(wn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(wn("properties"))){const t=this.properties,n=[...dh(t),...hh(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 oh(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:fa).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:fa;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??bc)(s,t)||n.useDefault&&n.reflect&&s===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[i,s]of this._$Ep)this[i]=s;this._$Ep=void 0}const n=this.constructor.elementProperties;if(n.size>0)for(const[i,s]of n){const{wrapped:a}=s,o=this[i];a!==!0||this._$AL.has(i)||o===void 0||this.C(i,void 0,s,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach((n=>n.hostUpdate?.())),this.update(t)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach((t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};vr.elementStyles=[],vr.shadowRootOptions={mode:"open"},vr[wn("elementProperties")]=new Map,vr[wn("finalized")]=new Map,gh?.({ReactiveElement:vr}),(pi.reactiveElementVersions??=[]).push("2.1.1");/**
85
+ * @license
86
+ * Copyright 2017 Google LLC
87
+ * SPDX-License-Identifier: BSD-3-Clause
88
+ */const Ca=globalThis,ii=Ca.trustedTypes,Qo=ii?ii.createPolicy("lit-html",{createHTML:r=>r}):void 0,_c="$lit$",Vt=`lit$${Math.random().toFixed(9).slice(2)}$`,wc="?"+Vt,mh=`<${wc}>`,ur=document,En=()=>ur.createComment(""),Sn=r=>r===null||typeof r!="object"&&typeof r!="function",ja=Array.isArray,yh=r=>ja(r)||typeof r?.[Symbol.iterator]=="function",Ji=`[
89
+ \f\r]`,Xr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Xo=/-->/g,Jo=/>/g,Kt=RegExp(`>|${Ji}(?:([^\\s"'>=/]+)(${Ji}*=${Ji}*(?:[^
90
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ko=/'/g,Yo=/"/g,vc=/^(?:script|style|textarea|title)$/i,bh=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),lt=bh(1),Tr=Symbol.for("lit-noChange"),Ve=Symbol.for("lit-nothing"),Zo=new WeakMap,or=ur.createTreeWalker(ur,129);function xc(r,e){if(!ja(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qo!==void 0?Qo.createHTML(e):e}const _h=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=Xr;for(let o=0;o<t;o++){const u=r[o];let l,c,d=-1,b=0;for(;b<u.length&&(a.lastIndex=b,c=a.exec(u),c!==null);)b=a.lastIndex,a===Xr?c[1]==="!--"?a=Xo:c[1]!==void 0?a=Jo:c[2]!==void 0?(vc.test(c[2])&&(i=RegExp("</"+c[2],"g")),a=Kt):c[3]!==void 0&&(a=Kt):a===Kt?c[0]===">"?(a=i??Xr,d=-1):c[1]===void 0?d=-2:(d=a.lastIndex-c[2].length,l=c[1],a=c[3]===void 0?Kt:c[3]==='"'?Yo:Ko):a===Yo||a===Ko?a=Kt:a===Xo||a===Jo?a=Xr:(a=Kt,i=void 0);const y=a===Kt&&r[o+1].startsWith("/>")?" ":"";s+=a===Xr?u+mh:d>=0?(n.push(l),u.slice(0,d)+_c+u.slice(d)+Vt+y):u+Vt+(d===-2?o:y)}return[xc(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let pa=class Ec{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,u=this.parts,[l,c]=_h(e,t);if(this.el=Ec.createElement(l,n),or.currentNode=this.el.content,t===2||t===3){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=or.nextNode())!==null&&u.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const d of i.getAttributeNames())if(d.endsWith(_c)){const b=c[a++],y=i.getAttribute(d).split(Vt),_=/([.?@])?(.*)/.exec(b);u.push({type:1,index:s,name:_[2],strings:y,ctor:_[1]==="."?vh:_[1]==="?"?xh:_[1]==="@"?Eh:gi}),i.removeAttribute(d)}else d.startsWith(Vt)&&(u.push({type:6,index:s}),i.removeAttribute(d));if(vc.test(i.tagName)){const d=i.textContent.split(Vt),b=d.length-1;if(b>0){i.textContent=ii?ii.emptyScript:"";for(let y=0;y<b;y++)i.append(d[y],En()),or.nextNode(),u.push({type:2,index:++s});i.append(d[b],En())}}}else if(i.nodeType===8)if(i.data===wc)u.push({type:2,index:s});else{let d=-1;for(;(d=i.data.indexOf(Vt,d+1))!==-1;)u.push({type:7,index:s}),d+=Vt.length-1}s++}}static createElement(e,t){const n=ur.createElement("template");return n.innerHTML=e,n}};function Ar(r,e,t=r,n){if(e===Tr)return e;let i=n!==void 0?t._$Co?.[n]:t._$Cl;const s=Sn(e)?void 0:e._$litDirective$;return i?.constructor!==s&&(i?._$AO?.(!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??=[])[n]=i:t._$Cl=i),i!==void 0&&(e=Ar(r,i._$AS(r,e.values),i,n)),e}class wh{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,i=(e?.creationScope??ur).importNode(t,!0);or.currentNode=i;let s=or.nextNode(),a=0,o=0,u=n[0];for(;u!==void 0;){if(a===u.index){let l;u.type===2?l=new $a(s,s.nextSibling,this,e):u.type===1?l=new u.ctor(s,u.name,u.strings,this,e):u.type===6&&(l=new Sh(s,this,e)),this._$AV.push(l),u=n[++o]}a!==u?.index&&(s=or.nextNode(),a++)}return or.currentNode=ur,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}let $a=class Sc{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Ve,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ar(this,e,t),Sn(e)?e===Ve||e==null||e===""?(this._$AH!==Ve&&this._$AR(),this._$AH=Ve):e!==this._$AH&&e!==Tr&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):yh(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Ve&&Sn(this._$AH)?this._$AA.nextSibling.data=e:this.T(ur.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=pa.createElement(xc(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(t);else{const s=new wh(i,this),a=s.u(this.options);s.p(t),this.T(a),this._$AH=s}}_$AC(e){let t=Zo.get(e.strings);return t===void 0&&Zo.set(e.strings,t=new pa(e)),t}k(e){ja(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 Sc(this.O(En()),this.O(En()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},gi=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=Ve,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ve}_$AI(e,t=this,n,i){const s=this.strings;let a=!1;if(s===void 0)e=Ar(this,e,t,0),a=!Sn(e)||e!==this._$AH&&e!==Tr,a&&(this._$AH=e);else{const o=e;let u,l;for(e=s[0],u=0;u<s.length-1;u++)l=Ar(this,o[n+u],t,u),l===Tr&&(l=this._$AH[u]),a||=!Sn(l)||l!==this._$AH[u],l===Ve?e=Ve:e!==Ve&&(e+=(l??"")+s[u+1]),this._$AH[u]=l}a&&!i&&this.j(e)}j(e){e===Ve?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},vh=class extends gi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ve?void 0:e}},xh=class extends gi{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Ve)}},Eh=class extends gi{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}_$AI(e,t=this){if((e=Ar(this,e,t,0)??Ve)===Tr)return;const n=this._$AH,i=e===Ve&&n!==Ve||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ve&&(n===Ve||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Sh=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){Ar(this,e)}};const Ih=Ca.litHtmlPolyfillSupport;Ih?.(pa,$a),(Ca.litHtmlVersions??=[]).push("3.3.1");const Nh=(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 $a(e.insertBefore(En(),s),s,void 0,t??{})}return i._$AI(r),i};/**
91
+ * @license
92
+ * Copyright 2017 Google LLC
93
+ * SPDX-License-Identifier: BSD-3-Clause
94
+ */const Fa=globalThis;class lr extends vr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Nh(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Tr}}lr._$litElement$=!0,lr.finalized=!0,Fa.litElementHydrateSupport?.({LitElement:lr});const Rh=Fa.litElementPolyfillSupport;Rh?.({LitElement:lr});(Fa.litElementVersions??=[]).push("4.2.1");var Ic=r=>{throw TypeError(r)},Nc=(r,e,t)=>e.has(r)||Ic("Cannot "+t),qt=(r,e,t)=>(Nc(r,e,"read from private field"),t?t.call(r):e.get(r)),Th=(r,e,t)=>e.has(r)?Ic("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Ah=(r,e,t,n)=>(Nc(r,e,"write to private field"),e.set(r,t),t);const Ft=r=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(r,e)}):customElements.define(r,e)},Xn=globalThis,ka=Xn.ShadowRoot&&(Xn.ShadyCSS===void 0||Xn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Rc=Symbol(),el=new WeakMap;let Dh=class{constructor(r,e,t){if(this._$cssResult$=!0,t!==Rc)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(ka&&r===void 0){const t=e!==void 0&&e.length===1;t&&(r=el.get(e)),r===void 0&&((this.o=r=new CSSStyleSheet).replaceSync(this.cssText),t&&el.set(e,r))}return r}toString(){return this.cssText}};const Lh=r=>new Dh(typeof r=="string"?r:r+"",void 0,Rc),Oh=(r,e)=>{if(ka)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=Xn.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},tl=ka?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return Lh(t)})(r):r,{is:Ch,defineProperty:jh,getOwnPropertyDescriptor:$h,getOwnPropertyNames:Fh,getOwnPropertySymbols:kh,getPrototypeOf:Ph}=Object,mi=globalThis,rl=mi.trustedTypes,Mh=rl?rl.emptyScript:"",Bh=mi.reactiveElementPolyfillSupport,vn=(r,e)=>r,si={toAttribute(r,e){switch(e){case Boolean:r=r?Mh: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}},Pa=(r,e)=>!Ch(r,e),nl={attribute:!0,type:String,converter:si,reflect:!1,useDefault:!1,hasChanged:Pa};Symbol.metadata??=Symbol("metadata"),mi.litPropertyMetadata??=new WeakMap;class Jr 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=nl){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&&jh(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=$h(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)??nl}static _$Ei(){if(this.hasOwnProperty(vn("elementProperties")))return;const e=Ph(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(vn("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(vn("properties"))){const t=this.properties,n=[...Fh(t),...kh(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(tl(i))}else e!==void 0&&t.push(tl(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 Oh(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:si).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:si;this._$Em=i,this[i]=a.fromAttribute(t,s.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(e,t,n){if(e!==void 0){const i=this.constructor,s=this[e];if(n??=i.getPropertyOptions(e),!((n.hasChanged??Pa)(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){}}Jr.elementStyles=[],Jr.shadowRootOptions={mode:"open"},Jr[vn("elementProperties")]=new Map,Jr[vn("finalized")]=new Map,Bh?.({ReactiveElement:Jr}),(mi.reactiveElementVersions??=[]).push("2.1.0");const qh={attribute:!0,type:String,converter:si,reflect:!1,hasChanged:Pa},Uh=(r=qh,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),s.set(t.name,r),n==="accessor"){const{name:a}=t;return{set(o){const u=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,u,r)},init(o){return o!==void 0&&this.C(a,void 0,r,o),o}}}if(n==="setter"){const{name:a}=t;return function(o){const u=this[a];e.call(this,o),this.requestUpdate(a,u,r)}}throw Error("Unsupported decorator location: "+n)};function Se(r){return(e,t)=>typeof t=="object"?Uh(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 Ma(r){return Se({...r,state:!0,attribute:!1})}const Hh=(r,e,t)=>(t.configurable=!0,t.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(r,e,t),t);function ut(r,e){return(t,n,i)=>{const s=a=>a.renderRoot?.querySelector(r)??null;return Hh(t,n,{get(){return s(this)}})}}var Vh=Object.defineProperty,Xt=(r,e,t,n)=>{for(var i=void 0,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=a(e,t,i)||i);return i&&Vh(e,t,i),i};const ga=class extends lr{constructor(){super(...arguments),this.dense=!1}};ga.shadowRootOptions={...lr.shadowRootOptions,delegatesFocus:!0},ga.styles=[vt`
95
+ :host {
96
+ /* color-scheme: light dark; */
97
+ --rokit-primary-color-inner: var(--rokit-primary-color, #008877);
98
+ --rokit-primary-color-transparent-inner: color-mix(in srgb, var(--rokit-primary-color-inner) 20%, transparent);
99
+ --rokit-error-color-inner: var(--rokit-error-color, #F03333);
100
+ /*--rokit-background-color-inner: var(--rokit-background-color, #242424);*/
101
+ --rokit-background-color-inner: var(--rokit-background-color, #FFF);
102
+ --rokit-light-background-color-inner: var(--rokit-light-background-color, color-mix(in srgb, var(--rokit-background-color-inner) 97%, currentColor));
103
+ --rokit-light-background-darker-color-inner: var(--rokit-light-background-darker-color, color-mix(in srgb, var(--rokit-light-background-color-inner) 80%, currentColor));
104
+ --rokit-shadow-color-inner: var(--rokit-shadow-color, color-mix(in srgb, currentColor 40%, transparent));
105
+ --rokit-list-indent-inner: var(--rokit-list-indent, 1em);
106
+ --rokit-list-max-height-inner: var(--rokit-list-max-height, 300);
107
+ --rokit-caret-size-inner: var(--rokit-caret-size, 0.5em);
108
+ --rokit-transition-duration-inner: var(--rokit-transition-duration, 0.2s);
109
+ }
110
+ /*
111
+ @media (prefers-color-scheme: light) {
112
+ :host {
113
+ --rokit-background-color-inner: var(--rokit-background-color, #FFF);
114
+ }
115
+ }
116
+ */
117
+ `];let xt=ga;Xt([Se({type:Boolean,reflect:!0})],xt.prototype,"dense");var yt;const ma=class extends xt{constructor(){super(),Th(this,yt),this.value="",this.clearable=!1,this.required=!1,this.disabled=!1,Ah(this,yt,this.attachInternals())}checkValidity(){return qt(this,yt).checkValidity()}reportValidity(){const e=qt(this,yt).reportValidity();return this.classList.toggle("invalid",!e),e}get validity(){return qt(this,yt).validity}get validationMessage(){return qt(this,yt).validationMessage}setCustomValidity(e,t){e?qt(this,yt).setValidity({customError:!0},e,t):qt(this,yt).setValidity(void 0)}updateValidity(e,t,n){qt(this,yt).setValidity(e,t,n)}setFormValue(e,t){qt(this,yt).setFormValue(e,t)}};yt=new WeakMap,ma.formAssociated=!0,ma.styles=[...xt.styles,vt`
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
+ :host(:focus) { border-color: var(--rokit-primary-color-inner); }
120
+ :host(.invalid) { border-color: var(--rokit-error-color-inner); }
121
+ `];let Et=ma;Xt([Se()],Et.prototype,"name");Xt([Se()],Et.prototype,"value");Xt([Se({type:Boolean})],Et.prototype,"clearable");Xt([Se({type:Boolean})],Et.prototype,"required");Xt([Se({type:Boolean})],Et.prototype,"disabled");Xt([Se()],Et.prototype,"label");Xt([Se()],Et.prototype,"placeholder");function Gh(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 Wh=Object.defineProperty,zh=Object.getOwnPropertyDescriptor,Tc=(r,e,t,n)=>{for(var i=n>1?void 0:n?zh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Wh(e,t,i),i};let Dr=class extends xt{constructor(){super(...arguments),this.icon=!1}render(){return lt`<a part="link"><slot><slot></a>`}};Dr.styles=[...xt.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); }
128
+ :host([dense]) { font-size: 0.65em; }
129
+ :host(.clear) a:before { content: '\u2715'; }
130
+ :host(.caret) a:before { content: ''; width: var(--rokit-caret-size-inner); height: var(--rokit-caret-size-inner); border-style: none solid solid none; border-width: calc(0.3 * var(--rokit-caret-size-inner)); transform: translate(0.15em, -0.15em) rotate(45deg); transition: transform var(--rokit-transition-duration-inner) ease-out; margin-right: calc(0.5 * var(--rokit-caret-size-inner)); }
131
+ :host(.caret.down) a:before { transform: translate(0.15em, 0.15em) rotate(225deg); }
132
+ :host(.caret.right) a:before { transform: translate(0em, 0em) rotate(-45deg); }
133
+ `];Tc([Se({type:Boolean,reflect:!0})],Dr.prototype,"icon",2);Dr=Tc([Ft("rokit-button")],Dr);var Qh=Object.defineProperty,Xh=Object.getOwnPropertyDescriptor,Ac=r=>{throw TypeError(r)},kt=(r,e,t,n)=>{for(var i=n>1?void 0:n?Xh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Qh(e,t,i),i},Jh=(r,e,t)=>e.has(r)||Ac("Cannot "+t),il=(r,e,t)=>(Jh(r,e,"read from private field"),t?t.call(r):e.get(r)),Kh=(r,e,t)=>e.has(r)?Ac("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Jn;let nt=class extends xt{constructor(){super(...arguments),this.open=!1,this.disabled=!1,this.transitioning=!1,this.closedBeforeTransition=!1,Kh(this,Jn,new MutationObserver(()=>this.updateContentHeight())),this.onMouseDown=(()=>{this.closedBeforeTransition=!this.open&&!this.transitioning}).bind(this),this.onClick=(()=>{this.toggle(this.closedBeforeTransition,!0)}).bind(this)}firstUpdated(){this.transitionDuration=Gh(getComputedStyle(this).getPropertyValue("--rokit-transition-duration-inner")),new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateContentHeight()}).observe(this)}updated(r){r.has("transitioning")&&this.classList.toggle("transitioning",this.transitioning),r.has("disabled")&&(this.disabled?(this.header.removeEventListener("mousedown",this.onMouseDown),this.header.removeEventListener("click",this.onClick)):(this.header.addEventListener("mousedown",this.onMouseDown),this.header.addEventListener("click",this.onClick))),r.has("open")&&!this.disabled&&(this.transitioning||this.toggle(this.open))}updateContentHeight(){setTimeout(()=>{this.content.style.maxHeight=(this.maxHeight!==void 0?Math.min(this.maxHeight,this.content.scrollHeight):this.content.scrollHeight)+"px",this.classList.toggle("has-content",this.content.style.maxHeight!=="0px")})}onSlotChange(){const r=this.shadowRoot.querySelector("#content > slot").assignedNodes();il(this,Jn).disconnect();for(const e of r)il(this,Jn).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0});this.updateContentHeight()}toggle(r=!this.open,e=!1){this.disabled||(this.transitioning=!0,this.open=r,this.toggleButton.classList.toggle("down",r),setTimeout(()=>{this.transitioning=!1,this.open&&e&&this.content.scrollIntoView({block:"nearest"})},this.transitionDuration))}render(){return lt`
134
+ <header part="header">
135
+ <slot name="prefix" part="prefix"></slot>
136
+ <span class="label"><slot name="label" part="label">${this.label}</slot></span>
137
+ <slot name="pre-suffix" part="suffix"></slot>
138
+ <rokit-button id="toggle" part="toggle" class="caret" icon ?dense="${this.dense}" title="${this.open?"Collapse":"Expand"}"></rokit-button>
139
+ <slot name="suffix" part="suffix"></slot>
140
+ </header>
141
+ <div id="content" part="content">
142
+ <slot @slotchange=${this.onSlotChange}></slot>
143
+ </div>
144
+ `}};Jn=new WeakMap;nt.styles=[...xt.styles,vt`
145
+ :host { display: flex; flex-direction: column; align-items: stretch; border-bottom: 2px solid var(--rokit-light-background-darker-color-inner); }
146
+ :host header { cursor: pointer; }
147
+ :host([dense]) header { padding: 2px 4px; }
148
+ :host([maxheight]) #content { overflow:auto }
149
+ :host(:not([open])) #content { max-height: 0 !important; }
150
+ :host(:not([open])) #content, :host(.transitioning) #content { overflow: hidden !important; }
151
+ :host([open]) #content, :host(.transitioning) #content { padding-top: 4px; }
152
+ header { display: flex; align-items: center; padding: 6px 8px; background-color: var(--rokit-light-background-color-inner); user-select: none; }
153
+ .label { flex-grow: 1; overflow: hidden; }
154
+ #content { display: flex; transition: max-height var(--rokit-transition-duration-inner) ease-in-out; position: relative; scrollbar-width: thin; }
155
+ #toggle { margin-left: 3px; }
156
+ `];kt([Se({type:Boolean,reflect:!0})],nt.prototype,"open",2);kt([Se()],nt.prototype,"label",2);kt([Se({reflect:!0})],nt.prototype,"maxHeight",2);kt([Se({type:Boolean})],nt.prototype,"disabled",2);kt([ut("#content")],nt.prototype,"content",2);kt([ut("#toggle")],nt.prototype,"toggleButton",2);kt([ut("header")],nt.prototype,"header",2);kt([Ma()],nt.prototype,"transitioning",2);nt=kt([Ft("rokit-collapsible")],nt);var Yh=Object.defineProperty,Zh=Object.getOwnPropertyDescriptor,Dc=r=>{throw TypeError(r)},ct=(r,e,t,n)=>{for(var i=n>1?void 0:n?Zh(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Yh(e,t,i),i},Lc=(r,e,t)=>e.has(r)||Dc("Cannot "+t),ef=(r,e,t)=>(Lc(r,e,"read from private field"),e.get(r)),tf=(r,e,t)=>e.has(r)?Dc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),sl=(r,e,t,n)=>(Lc(r,e,"write to private field"),e.set(r,t),t),pn;let Ue=class extends Et{constructor(){super(),this.type="text",this.readonly=!1,this.sticky=!1,this.minWidth=80,this.autoGrowLabelWidth=!1,tf(this,pn,""),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(){sl(this,pn,this.value),this.inputElement.addEventListener("change",()=>{this.value=this.inputElement.value}),this.autoGrowLabelWidth&&new IntersectionObserver(r=>{r.length&&r[0].isIntersecting&&this.updateMinWidth()}).observe(this)}updateMinWidth(){const r=this.shadowRoot.querySelector(".wrapper");if(r){const e=this.shadowRoot?.querySelector("label")?.scrollWidth||0,t=this.minWidth>e?this.minWidth:e;r.style.minWidth=t>0?t+"px":""}}updated(r){r.has("label")&&(this.classList.toggle("has-label",this.label!==void 0),this.autoGrowLabelWidth&&this.updateMinWidth()),r.has("min")&&(this.inputElement.min=this.min||""),r.has("max")&&(this.inputElement.max=this.max||""),r.has("step")&&(this.inputElement.step=this.step||""),r.has("placeholder")&&(this.inputElement.placeholder=this.placeholder||""),r.has("pattern")&&(this.inputElement.pattern=this.pattern||""),r.has("minLength")&&(this.inputElement.minLength=this.minLength===void 0?-1:this.minLength),r.has("maxLength")&&(this.inputElement.maxLength=this.maxLength===void 0?-1:this.maxLength),r.has("value")&&(this.classList.toggle("has-value",this.value!==""),this.setFormValue(this.value),this.updateValidity(this.inputElement.validity,this.inputElement.validationMessage,this.inputElement),this.value!==ef(this,pn)&&(sl(this,pn,this.value),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))))}clear(){this.inputElement.value="",this.value="",this.blur()}renderInput(){return lt`<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 lt`
157
+ <slot name="prefix" part="prefix"></slot>
158
+ <div class="wrapper">
159
+ <label for="input" part="label">${this.label}</label>
160
+ ${this.renderInput()}
161
+ ${this.clearable?lt`
162
+ <rokit-button class="clear" icon ?dense="${this.dense}" @mousedown="${r=>{r.preventDefault()}}" @click="${r=>{r.stopPropagation(),this.clear()}}" title="Clear"></rokit-button>
163
+ `:Ve}
164
+ </div>
165
+ <slot name="suffix" part="suffix"></slot>
166
+ `}};pn=new WeakMap;Ue.styles=[...Et.styles,vt`
167
+ :host { background-color: var(--rokit-light-background-color-inner); user-select: none; }
168
+ :host([dense]) { padding: 2px 4px; }
169
+ :host(.has-focus:not([readonly])) label, :host(.has-value) label, :host([sticky]) label { font-size: 0.75em; top: 0.5em; font-weight: 600; }
170
+ :host(.has-focus) label { color: var(--rokit-primary-color-inner); }
171
+ .wrapper { display: flex; position: relative; flex-grow: 1; align-items: center; }
172
+ label { position: absolute; top: 50%; transform: translate(0, -50%); transition-property: top, font-size; transition-duration: var(--rokit-transition-duration-inner); max-width: 100%; overflow: hidden; pointer-events: none; white-space: nowrap; }
173
+ #input { height: 1.3em; border: 0; outline: 0; flex-grow: 1; font-size: 1em; background: none; padding: 0; color: currentColor; font-family: inherit; text-overflow: ellipsis; }
174
+ #input[type='file'] { padding-bottom: 3px; }
175
+ #input[readonly] { caret-color: transparent; }
176
+ #input[readonly]::placeholder { color: transparent; }
177
+ :host(.has-label) #input { margin-top: 0.9em; }
178
+ :host(.has-label:not(.has-focus):not(.has-value):not([sticky])) #input { clip-path: polygon(0 0, 0 0, 0 0, 0 0); }
179
+ :host(:not(.has-value)) .clear { visibility: hidden; }
180
+ `];ct([Se()],Ue.prototype,"type",2);ct([Se({type:Boolean,reflect:!0})],Ue.prototype,"readonly",2);ct([Se({type:Boolean,reflect:!0})],Ue.prototype,"sticky",2);ct([Se()],Ue.prototype,"pattern",2);ct([Se()],Ue.prototype,"minLength",2);ct([Se()],Ue.prototype,"maxLength",2);ct([Se()],Ue.prototype,"min",2);ct([Se()],Ue.prototype,"max",2);ct([Se()],Ue.prototype,"step",2);ct([Se()],Ue.prototype,"minWidth",2);ct([Se({type:Boolean})],Ue.prototype,"autoGrowLabelWidth",2);ct([ut("#input")],Ue.prototype,"inputElement",2);Ue=ct([Ft("rokit-input")],Ue);var rf=Object.defineProperty,nf=Object.getOwnPropertyDescriptor,Oc=r=>{throw TypeError(r)},rt=(r,e,t,n)=>{for(var i=n>1?void 0:n?nf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&rf(e,t,i),i},Cc=(r,e,t)=>e.has(r)||Oc("Cannot "+t),Vn=(r,e,t)=>(Cc(r,e,"read from private field"),t?t.call(r):e.get(r)),Ki=(r,e,t)=>e.has(r)?Oc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Gn=(r,e,t,n)=>(Cc(r,e,"write to private field"),e.set(r,t),t),xr,Kn,Yn;let Ge=class extends Et{constructor(){super(),this.emptyMessage="Nothing to select",this.collapsibleOrientationLeft="0",this.collapsibleOrientationRight="0",this.collapsibleWidth="",this.autoGrowLabelWidth=!1,this.collapse=!1,this.filterableThreshold=15,this.itemCount=0,Ki(this,xr,""),Ki(this,Kn,""),Ki(this,Yn,new MutationObserver(()=>this.onSlotChange())),this.addEventListener("focus",()=>{this.collapsible.toggle(!0)}),this.addEventListener("blur",()=>{this.checkInputValue(),this.collapsible.toggle(!1)}),this.addEventListener("input",()=>{this.collapsible.toggle(!0)})}firstUpdated(){Gn(this,xr,this.value),Gn(this,Kn,getComputedStyle(this).getPropertyValue("--rokit-list-indent-inner")),this.input.placeholder=this.placeholder===void 0?"Type to filter list...":this.placeholder,this.input.label=this.label,this.inputMinWidth!==void 0&&(this.input.minWidth=this.inputMinWidth),setTimeout(()=>{this.collapsible.maxHeight=parseInt(this.collapsibleMaxHeight!==void 0?this.collapsibleMaxHeight:getComputedStyle(this).getPropertyValue("--rokit-list-max-height-inner")),this.collapsible.content.style.width=this.collapsibleWidth,this.collapsible.content.style.left=this.collapsibleOrientationLeft,this.collapsible.content.style.right=this.collapsibleOrientationRight})}updated(r){if(r.has("selectedItem")){const e=this.value;this.value=this.selectedItem?this.itemValue(this.selectedItem):"",this.input.value=this.selectedItem?this.itemText(this.selectedItem):this.value,this.input.title=this.input.value,this.classList.toggle("has-value",this.value!==""),this.setFormValue(this.value),this.required&&this.value===""?this.updateValidity({valueMissing:!0},"Please select a value",this.listContainer):this.updateValidity(),e!==this.value&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}r.has("value")&&this.selectItem(this.findItem(this.value)),r.has("disabled")&&(this.input.disabled=this.disabled,this.collapsible.disabled=this.disabled),(r.has("filterableThreshold")||r.has("itemCount"))&&(this.input.readonly=this.filterableThreshold<0||this.itemCount<this.filterableThreshold),this.collapsible?.toggleButton&&(this.collapsible.toggleButton.style.display=this.listContainer.childElementCount===0?"none":"")}checkInputValue(r=!0){if(this.input.value){const e=this.findItem(this.input.value);if(e){this.selectItem(e);return}}r&&(this.input.value="",this.input.title="",Gn(this,xr,""),this.selectItem(null,!1))}filter(r){r=r.toLowerCase();let e=!0;for(const t of this.listContainer.querySelectorAll("li"))if(t.id!=="noresult"){const n=this.itemText(t).toLowerCase().indexOf(r)==-1;t.classList.toggle("hidden",n),this.collapse&&(t.classList.remove("open"),t.querySelector("ul")?.classList.remove("open")),n||(e=!1)}for(const t of this.listContainer.querySelectorAll("li:has(li:not(.hidden))"))t.classList.remove("hidden"),r&&this.collapse&&(t.classList.add("open"),t.querySelector("ul")?.classList.add("open")),e=!1;this.highlightItem(null),this.listContainer.querySelector("#noresult")?.classList.toggle("hidden",!e)}selectItem(r,e=!0){r?.getAttribute("disabled")!==null&&(r=null),this.selectedItem=r,this.filter(""),this.highlightItem(r,!1),e&&this.value&&Gn(this,xr,this.value),setTimeout(()=>this.blur())}findItem(r){if(r){for(const e of this.listContainer.querySelectorAll("li"))if(this.itemValue(e)===r||this.itemText(e)===r)return e}return null}highlightItem(r,e=!0){if(this.listContainer.querySelector("li.active")?.classList.remove("active"),r){if(e&&this.listContainer.focus(),r.classList.add("active"),this.collapse)for(let t=r.closest("ul");t;t=t.parentElement.closest("ul"))t.classList.add("open"),t.closest("li")?.classList.add("open");this.collapsible.open&&r.scrollIntoView({block:"nearest"})}}highlightNextItem(){const r=this.listContainer.querySelector("li.active");let e=r;const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");if(r){for(let n=0;n<t.length;n++)if(t[n]===r&&n<t.length-1){e=t[n+1];break}}else t.length>0&&(e=t[0]);this.highlightItem(e)}highlightPreviousItem(){const r=this.listContainer.querySelector("li.active");let e=null;if(r){const t=this.listContainer.querySelectorAll("ul.open > li:not([disabled]):not(.hidden):not(.divider)");for(let n=0;n<t.length;n++)if(t[n]===r&&n>0){e=t[n-1];break}}this.highlightItem(e),e||this.input.focus()}itemValue(r){return r.dataset.value||this.itemText(r)||""}itemText(r){return r.querySelector("div > div")?.innerText||""}elementText(r){let e="";for(const t of r.childNodes)t.nodeType==3&&(e+=t.nodeValue?.trim());return e}onSlotChange(){this.listContainer.replaceChildren(),this.itemCount=0;let r=null;const e=this.shadowRoot.querySelector("#list-container-slot").assignedElements();if(e?.length===1&&(r=Array.prototype.slice.call(e[0].querySelectorAll(":scope > li")),this.copyItems(r,this.listContainer),Vn(this,Yn).disconnect(),Vn(this,Yn).observe(e[0],{subtree:!0,childList:!0,characterData:!0,attributes:!0})),this.emptyMessage){const t=document.createElement("li");t.id="noresult",t.setAttribute("disabled",""),t.innerText=this.emptyMessage,this.listContainer.appendChild(t),r&&r.length>0&&t.classList.add("hidden")}this.value=this.value||Vn(this,xr),this.selectItem(this.findItem(this.value))}copyItems(r,e,t=0){if(this.sort!==void 0){const i=this.sort||"asc";r=r.sort((s,a)=>i==="desc"?(this.elementText(a)||this.itemValue(a)).localeCompare(this.elementText(s)||this.itemValue(s)):(this.elementText(s)||this.itemValue(s)).localeCompare(this.elementText(a)||this.itemValue(a)))}let n="";t>0&&(n=`calc(0.3em + ${t}*${Vn(this,Kn)})`);for(const i of r){const s=i.cloneNode();s.replaceChildren();const a=document.createElement("div");n&&(a.style.paddingLeft=n);const o=document.createElement("div");a.appendChild(o);for(const l of i.childNodes)if(l.nodeName!=="UL"){const c=l.cloneNode(!0);c.nodeType===3&&c.nodeValue&&(c.nodeValue=c.nodeValue.trim()),o.appendChild(c)}s.appendChild(a),s.title=s.title||this.itemText(s);const u=i.querySelector("ul");if(u?.childElementCount){const l=document.createElement("ul");if(s.appendChild(l),this.copyItems(Array.prototype.slice.call(u.children),l,t+1),this.collapse){const c=new Dr;c.title="Open",c.dense=!0,c.icon=!0,c.classList.add("toggle-node","caret"),c.addEventListener("click",d=>{d.stopPropagation(),s.classList.toggle("open"),l.classList.toggle("open"),c.title=s.classList.contains("open")?"Close":"Open",this.collapsible.updateContentHeight()}),a.prepend(c)}else l.classList.add("open")}e.appendChild(s),this.itemCount++}}render(){return lt`
181
+ <rokit-collapsible ?dense="${this.dense}" part="collapsible">
182
+ <slot name="prefix" part="prefix" slot="prefix"></slot>
183
+ <slot name="suffix" part="suffix" slot="suffix"></slot>
184
+ <rokit-input id="input" slot="label"
185
+ ?clearable="${this.clearable}"
186
+ ?dense="${this.dense}"
187
+ @change="${()=>{this.checkInputValue(this.input.inputElement.value===""||!this.collapsible.open)}}"
188
+ @input="${()=>{this.filter(this.input.inputElement.value)}}"
189
+ @click="${()=>{this.collapsible.toggle(!0)}}"
190
+ ?autoGrowLabelWidth="${this.autoGrowLabelWidth}"
191
+ @keydown="${r=>{switch(r.code){case"ArrowDown":r.preventDefault(),this.highlightNextItem();break;case"Enter":{const e=this.findItem(this.input.value);e?this.selectItem(e):this.filter(this.input.value);break}}}}"
192
+ ></rokit-input>
193
+ <ul id="list-container" tabindex="-1" part="list" class="open"
194
+ @mousedown="${r=>{r.preventDefault()}}"
195
+ @click="${r=>{const e=r.target.closest("li");e&&e.getAttribute("disabled")===null&&!e.classList.contains("divider")&&this.selectItem(e)}}"
196
+ @keydown="${r=>{switch(r.code){case"Enter":this.selectItem(this.listContainer.querySelector("li.active"));break;case"ArrowDown":r.preventDefault(),this.highlightNextItem();break;case"ArrowUp":r.preventDefault(),this.highlightPreviousItem();break;case"ArrowRight":if(this.collapse){const e=this.listContainer.querySelector("li.active");e&&(r.preventDefault(),e.classList.add("open"),e.querySelector("ul")?.classList.add("open"),this.collapsible.updateContentHeight())}break;case"ArrowLeft":if(this.collapse){const e=this.listContainer.querySelector("li.active");e&&(r.preventDefault(),e.classList.remove("open"),e.querySelector("ul")?.classList.remove("open"),this.collapsible.updateContentHeight())}break;case"Escape":this.listContainer.blur();break}}}">
197
+ </ul>
198
+ <slot id="list-container-slot" @slotchange=${this.onSlotChange}></slot>
199
+ </rokit-collapsible>
200
+ `}};xr=new WeakMap;Kn=new WeakMap;Yn=new WeakMap;Ge.styles=[...Et.styles,vt`
201
+ :host { background-color: var(--rokit-light-background-color-inner); user-select: none; padding: 0; }
202
+ :host([dense]) li > div { padding: 4px 2px; }
203
+ :host([dense]) li.large > div, :host([dense]) li.header > div { padding-top: 6px; padding-bottom: 6px; }
204
+ #input { padding: 0; background-color: inherit; }
205
+ rokit-collapsible, #input { display: flex; flex-grow: 1; border: 0; }
206
+ rokit-collapsible::part(content) { display: flex; flex-direction: column; padding-top: 0; outline: 0; z-index: 1000; position: absolute; top: calc(100% + 2px); background-color: var(--rokit-background-color-inner); }
207
+ rokit-collapsible::part(header) { background-color: inherit !important; }
208
+ rokit-collapsible[open].has-content::part(content), rokit-collapsible.has-content.transitioning::part(content) { border: 2px solid var(--rokit-primary-color-transparent-inner); box-shadow: 0 0 10px var(--rokit-shadow-color-inner); clip-path: inset(0 -13px -13px 0); }
209
+ #list-container { outline: 0; }
210
+ #list-container-slot { display: none; }
211
+ ul { list-style-type: none; margin: 0; padding: 0; width: 100%; box-sizing: border-box; }
212
+ li > div, #noresult { display: flex; align-items:center; line-height: 1em; padding: 8px; white-space: nowrap; transition: all calc(0.5 * var(--rokit-transition-duration-inner)); }
213
+ li:not([disabled]):not(.divider) { cursor: pointer }
214
+ li:not([disabled]):not(.divider) > div:hover { background-color: var(--rokit-light-background-color-inner); }
215
+ li.active > div { color: var(--rokit-primary-color-inner); background-color: var(--rokit-light-background-color-inner); }
216
+ li.divider { border-top: 1px solid var(--rokit-light-background-darker-color-inner); height: 0; padding: 0; }
217
+ li.divider, li.header { pointer-events: none; }
218
+ li.header > div { font-size: 0.7rem; font-weight: bold; padding-top: 8px; }
219
+ li.large > div { padding-top: 10px; padding-bottom: 10px; }
220
+ .hidden { display: none !important; }
221
+ :host([collapse]) li > div { padding-left: 0; }
222
+ :host([collapse]) .toggle-node { position: absolute }
223
+ :host([collapse]) li > div > div { padding-left: 1.8em; }
224
+ :host([collapse]) ul:not(.open) { display: none; }
225
+ :host([collapse]) li:not(.open) > div > .toggle-node::part(link):before { transform: translate(0em, 0em) rotate(-45deg); }
226
+ `];rt([Se()],Ge.prototype,"emptyMessage",2);rt([Se()],Ge.prototype,"sort",2);rt([Se()],Ge.prototype,"collapsibleMaxHeight",2);rt([Se()],Ge.prototype,"collapsibleOrientationLeft",2);rt([Se()],Ge.prototype,"collapsibleOrientationRight",2);rt([Se()],Ge.prototype,"collapsibleWidth",2);rt([Se({type:Boolean})],Ge.prototype,"autoGrowLabelWidth",2);rt([Se()],Ge.prototype,"inputMinWidth",2);rt([Se({type:Boolean,reflect:!0})],Ge.prototype,"collapse",2);rt([Se()],Ge.prototype,"filterableThreshold",2);rt([ut("rokit-collapsible")],Ge.prototype,"collapsible",2);rt([ut("#input")],Ge.prototype,"input",2);rt([ut("#list-container")],Ge.prototype,"listContainer",2);rt([Ma()],Ge.prototype,"selectedItem",2);rt([Ma()],Ge.prototype,"itemCount",2);Ge=rt([Ft("rokit-select")],Ge);var sf=Object.defineProperty,af=Object.getOwnPropertyDescriptor,yi=(r,e,t,n)=>{for(var i=n>1?void 0:n?af(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&sf(e,t,i),i};let cr=class extends Ue{constructor(){super(...arguments),this.resize="none",this.rows=3}firstUpdated(){super.firstUpdated(),this.inputElement.rows=this.rows,this.cols!==void 0&&(this.inputElement.cols=this.cols),this.resize==="auto"?(this.inputElement.style.resize="none",this.inputElement.addEventListener("input",()=>this.autoResize())):this.inputElement.style.resize=this.resize}updated(r){super.updated(r),this.resize==="auto"&&r.has("resize")&&new IntersectionObserver(e=>{e.length&&e[0].isIntersecting&&this.autoResize()}).observe(this),this.resize==="auto"&&r.has("value")&&this.autoResize()}autoResize(){this.inputElement.style.height="",this.inputElement.style.height=this.inputElement.scrollHeight+"px"}onSlotChange(){const r=this.shadowRoot.querySelector("#content").assignedNodes().map(e=>e.textContent).join("");r.trim()!==""&&(this.value=r)}renderInput(){return lt`
227
+ <textarea id="input" part="input" autocomplete="off" name="${this.name}" ?disabled="${this.disabled}" ?readonly="${this.readonly}" ?required="${this.required}" .value="${this.value}"></textarea>
228
+ <slot id="content" @slotchange=${this.onSlotChange}></slot>
229
+ `}};cr.styles=[...Ue.styles,vt`
230
+ :host, .wrapper { align-items: flex-start; }
231
+ #input { height: initial; }
232
+ #content { display: none; }
233
+ `];yi([Se()],cr.prototype,"resize",2);yi([Se()],cr.prototype,"rows",2);yi([Se()],cr.prototype,"cols",2);cr=yi([Ft("rokit-textarea")],cr);var of=Object.defineProperty,lf=Object.getOwnPropertyDescriptor,jc=r=>{throw TypeError(r)},Nt=(r,e,t,n)=>{for(var i=n>1?void 0:n?lf(e,t):e,s=r.length-1,a;s>=0;s--)(a=r[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&of(e,t,i),i},$c=(r,e,t)=>e.has(r)||jc("Cannot "+t),je=(r,e,t)=>($c(r,e,"read from private field"),t?t.call(r):e.get(r)),Yi=(r,e,t)=>e.has(r)?jc("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Wn=(r,e,t,n)=>($c(r,e,"write to private field"),e.set(r,t),t),Me,Dt,Er;const Gt=18;let Ct=class extends Ue{constructor(){super(...arguments),this.labelFormatter=r=>String(r),Yi(this,Me,[0,1]),Yi(this,Dt,[je(this,Me)[0],je(this,Me)[1]]),Yi(this,Er)}firstUpdated(){super.firstUpdated(),this.sliderElement.addEventListener("mousedown",r=>this.onKnobDrag(r)),this.sliderElement.addEventListener("touchstart",r=>this.onKnobDrag(r)),new ResizeObserver(()=>{this.updateKnobPositions()}).observe(this.sliderElement)}updated(r){if(super.updated(r),r.has("min")&&(je(this,Me)[0]=parseFloat(this.min||"0"),je(this,Me)[1]=Math.max(je(this,Me)[0],je(this,Me)[1])),r.has("max")&&(je(this,Me)[1]=parseFloat(this.max||"1"),je(this,Me)[0]=Math.min(je(this,Me)[0],je(this,Me)[1])),r.has("step")&&Wn(this,Er,this.step?parseFloat(this.step):void 0),r.has("value")||r.has("min")||r.has("max"))if(this.value)if(this.range!==void 0){const e=JSON.parse(this.value);Wn(this,Dt,[this.applyConstraints(e[0]),this.applyConstraints(e[1])])}else Wn(this,Dt,[this.applyConstraints(parseFloat(this.value))]);else Wn(this,Dt,[je(this,Me)[0],je(this,Me)[1]]);this.updateKnobPositions()}updateValidity(r,e){super.updateValidity(r,e,this.sliderElement)}chooseKnob(r){if(!this.endKnob)return this.startKnob;let e=Math.abs(r-this.startKnob.offsetLeft)<Math.abs(r-this.endKnob.offsetLeft)?this.startKnob:this.endKnob;return this.startKnob.value===this.endKnob.value&&(e.id==="start"&&e.value===je(this,Me)[0]?e=this.endKnob:e.id==="end"&&e.value===je(this,Me)[1]&&(e=this.startKnob)),e}toScreenSpace(r){return(r-je(this,Me)[0])/(je(this,Me)[1]-je(this,Me)[0])*this.track.offsetWidth}toValueSpace(r){return r/this.track.offsetWidth*(je(this,Me)[1]-je(this,Me)[0])+je(this,Me)[0]}applyConstraints(r,e){let t=Math.min(Math.max(r,je(this,Me)[0]),je(this,Me)[1]);return je(this,Er)&&(t=Math.round(t/je(this,Er))*je(this,Er)),e!==void 0&&this.endKnob&&(t=e?Math.min(t,this.endKnob.value):Math.max(t,this.startKnob.value)),t}updateKnob(r,e){r.value=e,r.offset=this.toScreenSpace(e),r.label=this.labelFormatter(e),this.endKnob&&(r.id==="start"?this.track.style.borderLeftWidth=r.offset+"px":this.track.style.borderRightWidth=this.track.offsetWidth-r.offset+"px")}updateKnobPositions(){this.updateKnob(this.startKnob,je(this,Dt)[0]),this.endKnob&&this.updateKnob(this.endKnob,je(this,Dt)[1])}onKnobDrag(r){if(r.target instanceof Lr||this.classList.contains("has-value")||this.classList.contains("has-focus")){let e;const t=i=>{let s=0;i.type==="touchmove"||i.type==="touchstart"?s=i.touches[0].clientX:s=i.clientX,s=s-this.track.getBoundingClientRect().left,e||(e=this.chooseKnob(s),e.classList.add("focus")),this.updateKnob(e,this.applyConstraints(this.toValueSpace(s),e.id==="start"))},n=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("touchmove",t),document.removeEventListener("mouseup",n),document.removeEventListener("touchend",n),e&&(e.classList.remove("focus"),this.range!==void 0?e.id==="end"?this.value=JSON.stringify([je(this,Dt)[0],e.value]):this.value=JSON.stringify([e.value,je(this,Dt)[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 lt`
234
+ ${super.renderInput()}
235
+ <div id="slider" part="slider" tabindex="0" ?range="${this.range!==void 0}">
236
+ <div id="track"></div>
237
+ <rokit-slider-knob id="start"></rokit-slider-knob>
238
+ ${this.range===void 0?Ve:lt`
239
+ <rokit-slider-knob id="end"></rokit-slider-knob>
240
+ `}
241
+ </div>
242
+ `}};Me=new WeakMap;Dt=new WeakMap;Er=new WeakMap;Ct.styles=[...Ue.styles,vt`
243
+ :host(.has-label:not(:focus):not(.has-value):not([sticky])) #slider > * { visibility: hidden; }
244
+ :host(.has-label) .wrapper { padding-top: 1em; }
245
+ :host([sticky]) #slider { margin-top: ${.25*Gt+22}px; }
246
+ #input { display: none; }
247
+ #slider { display: flex; position: relative; align-items: center; width: 100%; height: ${Gt}px; padding: 0 ${Gt/2}px; outline: 0; }
248
+ :host(:not([sticky])) #slider:not(:focus) rokit-slider-knob::part(label) { color: transparent; background-color: transparent; border-color: transparent; top: 0; }
249
+ #track { height: 2px; flex-grow: 1; background-color: #CCC; }
250
+ #slider[range] #track { background-color: color-mix(in srgb, var(--rokit-primary-color-inner) 60%, transparent); border-width: 0; border-color: #CCC; border-style: solid; }
251
+ `];Nt([Se()],Ct.prototype,"range",2);Nt([Se()],Ct.prototype,"labelFormatter",2);Nt([ut("#slider")],Ct.prototype,"sliderElement",2);Nt([ut("#track")],Ct.prototype,"track",2);Nt([ut("#start")],Ct.prototype,"startKnob",2);Nt([ut("#end")],Ct.prototype,"endKnob",2);Ct=Nt([Ft("rokit-slider")],Ct);let Lr=class extends lr{constructor(){super(...arguments),this.offset=0,this.label="",this.value=0}updated(r){r.has("offset")&&(this.style.left=this.offset+"px")}render(){return lt`<label part="label">${this.label}</label>`}};Lr.styles=[vt`
252
+ :host { position: absolute; width: ${Gt}px; height: ${Gt}px; border-radius: ${Gt}px; background-color: var(--rokit-primary-color-inner); }
253
+ :host(.focus), :host(:hover) { box-shadow: 0 0 0 ${Gt/2}px var(--rokit-primary-color-transparent-inner); z-index: 1; }
254
+ label {
255
+ position: absolute;
256
+ top: calc(-2em - ${Gt/4}px);
257
+ left: 50%;
258
+ transform: translate(-50%, 0);
259
+ white-space: nowrap;
260
+ font-size: 0.75em;
261
+ font-weight: 500;
262
+ transition-property: top color background-color;
263
+ transition-duration: var(--rokit-transition-duration-inner);
264
+ pointer-events: none;
265
+ color: white;
266
+ background-color: var(--rokit-primary-color-inner);
267
+ padding: 0 4px;
268
+ border-radius: 3px;
269
+ }
270
+ label:after {
271
+ content: '';
272
+ width: 10px;
273
+ height: 10px;
274
+ position: absolute;
275
+ left: 50%;
276
+ bottom: -4px;
277
+ transform: translate(-50%, 0);
278
+ background-color: inherit;
279
+ clip-path: polygon(50% 50%, 100% 50%, 50% 100%, 0 50%);
280
+ }
281
+ `];Nt([Se()],Lr.prototype,"offset",2);Nt([Se()],Lr.prototype,"label",2);Lr=Nt([Ft("rokit-slider-knob")],Lr);var uf=Object.defineProperty,cf=Object.getOwnPropertyDescriptor,An=(r,e,t,n)=>{for(var i=n>1?void 0:n?cf(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&&uf(e,t,i),i};let dr=class extends xt{constructor(){super(...arguments),this.open=!1,this.closable=!1,this.title=""}firstUpdated(){this.dialogElement.addEventListener("close",()=>{this.open=!1,this.dispatchEvent(new Event("close"))})}updated(r){if(r.has("open"))if(this.open)document.body.style.left=`-${window.scrollX}px`,document.body.style.top=`-${window.scrollY}px`,document.body.style.position="fixed",this.dialogElement.showModal();else{const e=document.body.style.left,t=document.body.style.top;document.body.style.position="",document.body.style.left="",document.body.style.top="",window.scrollTo(parseInt(e||"0")*-1,parseInt(t||"0")*-1),this.dialogElement.close()}}render(){return lt`
282
+ <dialog id="dialog" part="dialog">
283
+ <header>
284
+ <div class="title" part="title">
285
+ <slot name="header">${this.title}</slot>
286
+ </div>
287
+ ${this.closable?lt`
288
+ <rokit-button class="clear" icon ?dense="${this.dense}" @click="${()=>{this.open=!1}}" title="Close"></rokit-button>
289
+ `:Ve}
290
+ </header>
291
+ <main>
292
+ <slot></slot>
293
+ </main>
294
+ </dialog>
295
+ `}};dr.styles=[...xt.styles,vt`
296
+ dialog[open] { display: flex; flex-direction: column; width: 100%; max-width: 90vw; max-height: 90vh; margin: auto; outline: 0; border: 0; border-radius: 1em; }
297
+ dialog::backdrop { background-color: #0007; }
298
+ header { display: flex; align-items: center; }
299
+ .title { font-weight: 600; flex-grow: 1; text-align: center; }
300
+ .clear { justify-self: flex-end; }
301
+ main { flex-grow: 1; overflow: auto; }
302
+ `];An([Se({type:Boolean,reflect:!0})],dr.prototype,"open",2);An([Se({type:Boolean})],dr.prototype,"closable",2);An([Se()],dr.prototype,"title",2);An([ut("#dialog")],dr.prototype,"dialogElement",2);dr=An([Ft("rokit-dialog")],dr);var df=Object.defineProperty,hf=Object.getOwnPropertyDescriptor,Ba=(r,e,t,n)=>{for(var i=n>1?void 0:n?hf(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&&df(e,t,i),i};let In=class extends xt{updated(r){r.has("percent")&&(this.bar.style.width=this.percent?this.percent+"%":"")}render(){return lt`<div class="bar"></div>`}};In.styles=[...xt.styles,vt`
303
+ :host { display: flex; }
304
+ .bar { height: 3px; background-color: var(--rokit-primary-color-inner); }
305
+ :host(:not([percent])) .bar { width: 100%; --c: no-repeat linear-gradient(var(--rokit-primary-color-inner) 0 0); background: var(--c), var(--c); background-size: 60% 100%; animation: indeterminate 3s infinite; }
306
+ @keyframes indeterminate {
307
+ 0% { background-position:-150% 0,-150% 0 }
308
+ 66% { background-position: 250% 0,-150% 0 }
309
+ 100% { background-position: 250% 0, 250% 0 }
310
+ }
311
+ `];Ba([Se({reflect:!0})],In.prototype,"percent",2);Ba([ut(".bar")],In.prototype,"bar",2);In=Ba([Ft("rokit-progressbar")],In);class ai extends HTMLElement{constructor(e,t,n,i){if(super(),this.template=new Jd(n.store.getQuads(e,null,null,null),t,n),this.container=this,this.template.extendedShapes.length&&this.template.config.attributes.collapse!==null&&(!this.template.maxCount||this.template.maxCount>1)){const s=new nt;s.classList.add("collapsible","shacl-group"),s.open=n.attributes.collapse==="open",s.label=this.template.label,this.container=s}if(this.template.order!==void 0&&(this.style.order=`${this.template.order}`),this.template.cssClass&&this.classList.add(this.template.cssClass),n.editMode&&!t.linked&&(this.addButton=this.createAddButton(),this.container.appendChild(this.addButton)),this.template.path){let s=[];i&&(t.linked?s=n.store.getQuads(i,this.template.path,null,null):s=n.store.getQuads(i,this.template.path,null,Lt));let a=!1;for(const o of s)this.isValueValid(o.object)&&(this.addPropertyInstance(o.object),this.template.hasValue&&o.object.equals(this.template.hasValue)&&(a=!0));n.editMode&&this.template.hasValue&&!a&&!t.linked&&this.addPropertyInstance(this.template.hasValue)}n.editMode&&!t.linked&&(this.addEventListener("change",()=>{this.updateControls()}),this.updateControls()),this.container instanceof nt&&(n.editMode&&!t.linked||this.container.childElementCount>0)&&this.appendChild(this.container)}addPropertyInstance(e){let t;if(this.template.shaclOr?.length||this.template.shaclXone?.length){const n=this.template.shaclOr?.length?this.template.shaclOr:this.template.shaclXone;let i=!1;if(e){const s=zd(n,e,this.template.config);s.length&&(t=Zn(this.template.clone().merge(s),e,!0),i=!0)}i||(t=mc(n,this,this.template.config),Fc(t,""))}else{let n=!1;if(e&&!(e instanceof _t)){const i=this.getRdfClassToLinkOrCreate();i&&this.template.config.store.countQuads(e,tt,i,Lt)===0&&(n=!0)}t=Zn(this.template,e,void 0,n||this.template.parent.linked)}return this.addButton?this.container.insertBefore(t,this.addButton):this.container.appendChild(t),t}updateControls(){let e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length;e===0&&(!this.template.extendedShapes.length||this.template.minCount!==void 0&&this.template.minCount>0)&&(this.addPropertyInstance(),e=this.querySelectorAll(":scope > .property-instance, :scope > .shacl-or-constraint, :scope > shacl-node").length);let t;this.template.minCount!==void 0?t=e>this.template.minCount:t=this.template.extendedShapes.length>0||e>1;const n=this.template.maxCount===void 0||e<this.template.maxCount;this.classList.toggle("may-remove",t),this.classList.toggle("may-add",n)}toRDF(e,t){for(const n of this.querySelectorAll(":scope > .property-instance, :scope > .collapsible > .property-instance")){const i=Ne.namedNode(n.dataset.path);if(n.firstChild instanceof zt){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=rh(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,Rr,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,Rr,null);for(const i of n)if(this.template.config.store.countQuads(e,tt,i,null)>0)return!0}return!1}createAddButton(){const e=new Ge;e.dense=!0,e.label="+ "+this.template.label,e.title="Add "+this.template.label,e.autoGrowLabelWidth=!0,e.classList.add("add-button");let t=[],n=this.getRdfClassToLinkOrCreate();if(n&&(t=Da(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(()=>{Gd(s),s.classList.remove("fadeIn")},200)});else{const i=document.createElement("ul"),s=document.createElement("li");s.innerHTML="&#xFF0B; Create new "+this.template.label+"...",s.dataset.value="new",s.classList.add("large"),i.appendChild(s);const a=document.createElement("li");a.classList.add("divider"),i.appendChild(a);const o=document.createElement("li");o.classList.add("header"),o.innerText="Or link existing:",i.appendChild(o);for(const u of t){const l=document.createElement("li"),c=typeof u.value=="string"?u.value:u.value.value;l.innerText=u.label?u.label:c,l.dataset.value=JSON.stringify(u.value),i.appendChild(l)}e.appendChild(i),e.collapsibleWidth="250px",e.collapsibleOrientationLeft="",e.addEventListener("change",()=>{if(e.value==="new")this.addPropertyInstance();else{const u=JSON.parse(e.value);this.container.insertBefore(Zn(this.template,u,!0,!0),e)}e.value=""})}return e}}function Zn(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 zt(s,r.config,e,r.parent,r.nodeKind,r.label,n))}else{const s=sh(r.path,r.datatype?.value);s?r.config.editMode&&!n?i=s.createEditor(r,e):i=s.createViewer(r,e):i=Zd(r,e||null,r.config.editMode&&!n),i.classList.add("property-instance"),n&&i.classList.add("linked")}return r.config.editMode&&Fc(i,r.label,t),i.dataset.path=r.path,i}function Fc(r,e,t=!1){const n=new Dr;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",ai);function ff(r,e){let t=r;const n=e.store.getQuads(r,null,null,null),i=bn(n,"label",Na,e.languages);i&&(t=i);let s;if(e.attributes.collapse!==null)s=new nt,s.classList.add("collapsible"),s.open=e.attributes.collapse==="open",s.label=t;else{s=document.createElement("div");const o=document.createElement("h1");o.innerText=t,s.appendChild(o)}s.dataset.subject=r,s.classList.add("shacl-group");const a=bn(n,"order");return a&&(s.style.order=a),s}const Je=[];for(let r=0;r<256;++r)Je.push((r+256).toString(16).slice(1));function pf(r,e=0){return(Je[r[e+0]]+Je[r[e+1]]+Je[r[e+2]]+Je[r[e+3]]+"-"+Je[r[e+4]]+Je[r[e+5]]+"-"+Je[r[e+6]]+Je[r[e+7]]+"-"+Je[r[e+8]]+Je[r[e+9]]+"-"+Je[r[e+10]]+Je[r[e+11]]+Je[r[e+12]]+Je[r[e+13]]+Je[r[e+14]]+Je[r[e+15]]).toLowerCase()}let Zi;const gf=new Uint8Array(16);function mf(){if(!Zi){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Zi=crypto.getRandomValues.bind(crypto)}return Zi(gf)}const yf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),al={randomUUID:yf};function bf(r,e,t){r=r||{};const n=r.random??r.rng?.()??mf();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,pf(n)}function ol(r,e,t){return al.randomUUID&&!r?al.randomUUID():bf(r)}class zt extends HTMLElement{constructor(e,t,n,i,s,a,o){super(),this.owlImports=[],this.parent=i,this.config=t,this.shaclSubject=e,this.linked=o||!1;let u=n;if(!u){if(!s){const c=t.store.getObjects(e,`${xe}nodeKind`,null);c.length&&(s=c[0])}s===void 0&&t.attributes.valuesNamespace||s?.value===`${xe}IRI`?u=Ne.namedNode(t.attributes.valuesNamespace+ol()):u=Ne.blankNode(ol())}this.nodeId=u;const l=JSON.stringify([e,n]);if(n&&t.renderedNodes.has(l)){a=a||"Link";const c=document.createElement("label");c.innerText=a,c.classList.add("linked"),this.appendChild(c);const d=document.createElement("a");let b=n.termType==="BlankNode"?"_:"+n.value:n.value;d.innerText=b,d.classList.add("ref-link"),d.onclick=()=>{this.config.form.querySelector(`shacl-node[data-node-id='${b}']`)?.scrollIntoView()},this.appendChild(d),this.style.flexDirection="row"}else{if(n&&t.renderedNodes.add(l),this.dataset.nodeId=this.nodeId.id,this.config.attributes.showNodeIds!==null){const c=document.createElement("div");c.innerText=`id: ${this.nodeId.id}`,c.classList.add("node-id-display"),this.appendChild(c)}for(const c of t.store.getQuads(e,Ta,null,null))this.owlImports.push(c.object);for(const c of t.store.getQuads(e,null,null,null))switch(c.predicate.id){case ni.id:this.addPropertyInstance(c.object,t,n);break;case`${xe}and`:const d=t.lists[c.object.value];if(d?.length)for(const b of d)this.prepend(new zt(b,t,n,this));else console.error("list not found:",c.object.value,"existing lists:",t.lists);break;case Ud.id:this.prepend(new zt(c.object,t,n,this));break;case`${xe}targetClass`:this.targetClass=c.object;break;case`${xe}or`:this.tryResolve(c.object,n,t);break;case`${xe}xone`:this.tryResolve(c.object,n,t);break}if(a){const c=document.createElement("h1");c.innerText=a,this.prepend(c)}}}toRDF(e,t){if(t||(t=this.nodeId),!this.linked){for(const n of this.querySelectorAll(":scope > shacl-node, :scope > .shacl-group > shacl-node, :scope > shacl-property, :scope > .shacl-group > shacl-property"))n.toRDF(e,t);this.targetClass&&e.addQuad(t,tt,this.targetClass,this.config.valuesGraphId),this.config.attributes.generateNodeShapeReference&&!this.parent&&e.addQuad(t,Ne.namedNode(this.config.attributes.generateNodeShapeReference),this.shaclSubject,this.config.valuesGraphId)}return t}addPropertyInstance(e,t,n){let i=this;const s=t.store.getQuads(e,`${xe}group`,null,null);if(s.length>0){const o=s[0].object.value;if(t.groups.indexOf(o)>-1){let u=this.querySelector(`:scope > .shacl-group[data-subject='${o}']`);u||(u=ff(o,t),this.appendChild(u)),i=u}else console.warn("ignoring unknown group reference",s[0],"existing groups:",t.groups)}const a=new ai(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=Qd(i,t,n);if(a.length){for(const o of a)this.addPropertyInstance(o,n,t);s=!0}}s||this.appendChild(mc(i,this,n))}else console.error("list for sh:or/sh:xone not found:",e,"existing lists:",n.lists)}}window.customElements.define("shacl-node",zt);var Yt={},Zt={},er={},At={},ll;function _f(){if(ll)return At;ll=1,Object.defineProperty(At,"__esModule",{value:!0}),At.removeDotSegmentsOfPath=At.removeDotSegments=At.resolve=void 0;function r(i,s){s=s||"";const a=s.indexOf("#");if(a>0&&(s=s.substr(0,a)),!i.length){if(s.indexOf(":")<0)throw new Error(`Found invalid baseIRI '${s}' for value '${i}'`);return s}if(i.startsWith("?")){const y=s.indexOf("?");return y>0&&(s=s.substr(0,y)),s+i}if(i.startsWith("#"))return s+i;if(!s.length){const y=i.indexOf(":");if(y<0)throw new Error(`Found invalid relative IRI '${i}' for a missing baseIRI`);return t(i,y)}const o=i.indexOf(":");if(o>=0)return t(i,o);const u=s.indexOf(":");if(u<0)throw new Error(`Found invalid baseIRI '${s}' for value '${i}'`);const l=s.substr(0,u+1);if(i.indexOf("//")===0)return l+t(i,o);let c;if(s.indexOf("//",u)===u+1){if(c=s.indexOf("/",u+3),c<0)return s.length>u+3?s+"/"+t(i,o):l+t(i,o)}else if(c=s.indexOf("/",u+1),c<0)return l+t(i,o);if(i.indexOf("/")===0)return s.substr(0,c)+e(i);let d=s.substr(c);const b=d.lastIndexOf("/");return b>=0&&b<d.length-1&&(d=d.substr(0,b+1),i[0]==="."&&i[1]!=="."&&i[1]!=="/"&&i[2]&&(i=i.substr(1))),i=d+i,i=e(i),s.substr(0,c)+i}At.resolve=r;function e(i){const s=[];let a=0;for(;a<i.length;)switch(i[a]){case"/":if(i[a+1]===".")if(i[a+2]==="."){if(!n(i[a+3])){s.push([]),a++;break}s.pop(),i[a+3]||s.push([]),a+=3}else{if(!n(i[a+2])){s.push([]),a++;break}i[a+2]||s.push([]),a+=2}else s.push([]),a++;break;case"#":case"?":s.length||s.push([]),s[s.length-1].push(i.substr(a)),a=i.length;break;default:s.length||s.push([]),s[s.length-1].push(i[a]),a++;break}return"/"+s.map(o=>o.join("")).join("/")}At.removeDotSegments=e;function t(i,s){let a=s+1;s>=0?i[s+1]==="/"&&i[s+2]==="/"&&(a=s+3):i[0]==="/"&&i[1]==="/"&&(a=2);const o=i.indexOf("/",a);if(o<0)return i;const u=i.substr(0,o),l=i.substr(o);return u+e(l)}At.removeDotSegmentsOfPath=t;function n(i){return!i||i==="#"||i==="?"||i==="/"}return At}var ul;function wf(){return ul||(ul=1,(function(r){var e=er&&er.__createBinding||(Object.create?(function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}):(function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]})),t=er&&er.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(_f(),r)})(er)),er}var tr={},es={},cl;function vf(){return cl||(cl=1,(function(r){/**
312
+ * Character classes and associated utilities for the 5th edition of XML 1.0.
313
+ *
314
+ * @author Louis-Dominique Dubeau
315
+ * @license MIT
316
+ * @copyright Louis-Dominique Dubeau
317
+ */Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR=`
318
+ \r -퟿-�𐀀-􏿿`,r.S=` \r
319
+ `,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,n=13,i=32;r.S_LIST=[i,t,n,e];function s(l){return l>=i&&l<=55295||l===t||l===n||l===e||l>=57344&&l<=65533||l>=65536&&l<=1114111}r.isChar=s;function a(l){return l===i||l===t||l===n||l===e}r.isS=a;function o(l){return l>=65&&l<=90||l>=97&&l<=122||l===58||l===95||l===8204||l===8205||l>=192&&l<=214||l>=216&&l<=246||l>=248&&l<=767||l>=880&&l<=893||l>=895&&l<=8191||l>=8304&&l<=8591||l>=11264&&l<=12271||l>=12289&&l<=55295||l>=63744&&l<=64975||l>=65008&&l<=65533||l>=65536&&l<=983039}r.isNameStartChar=o;function u(l){return o(l)||l>=48&&l<=57||l===45||l===46||l===183||l>=768&&l<=879||l>=8255&&l<=8256}r.isNameChar=u})(es)),es}var ts={},dl;function xf(){return dl||(dl=1,(function(r){/**
320
+ * Character classes and associated utilities for the 2nd edition of XML 1.1.
321
+ *
322
+ * @author Louis-Dominique Dubeau
323
+ * @license MIT
324
+ * @copyright Louis-Dominique Dubeau
325
+ */Object.defineProperty(r,"__esModule",{value:!0}),r.CHAR="-퟿-�𐀀-􏿿",r.RESTRICTED_CHAR="-\b\v\f--„†-Ÿ",r.S=` \r
326
+ `,r.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NAME_CHAR="-"+r.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.CHAR_RE=new RegExp("^["+r.CHAR+"]$","u"),r.RESTRICTED_CHAR_RE=new RegExp("^["+r.RESTRICTED_CHAR+"]$","u"),r.S_RE=new RegExp("^["+r.S+"]+$","u"),r.NAME_START_CHAR_RE=new RegExp("^["+r.NAME_START_CHAR+"]$","u"),r.NAME_CHAR_RE=new RegExp("^["+r.NAME_CHAR+"]$","u"),r.NAME_RE=new RegExp("^["+r.NAME_START_CHAR+"]["+r.NAME_CHAR+"]*$","u"),r.NMTOKEN_RE=new RegExp("^["+r.NAME_CHAR+"]+$","u");var e=9,t=10,n=13,i=32;r.S_LIST=[i,t,n,e];function s(d){return d>=1&&d<=55295||d>=57344&&d<=65533||d>=65536&&d<=1114111}r.isChar=s;function a(d){return d>=1&&d<=8||d===11||d===12||d>=14&&d<=31||d>=127&&d<=132||d>=134&&d<=159}r.isRestrictedChar=a;function o(d){return d===9||d===10||d===13||d>31&&d<127||d===133||d>159&&d<=55295||d>=57344&&d<=65533||d>=65536&&d<=1114111}r.isCharAndNotRestricted=o;function u(d){return d===i||d===t||d===n||d===e}r.isS=u;function l(d){return d>=65&&d<=90||d>=97&&d<=122||d===58||d===95||d===8204||d===8205||d>=192&&d<=214||d>=216&&d<=246||d>=248&&d<=767||d>=880&&d<=893||d>=895&&d<=8191||d>=8304&&d<=8591||d>=11264&&d<=12271||d>=12289&&d<=55295||d>=63744&&d<=64975||d>=65008&&d<=65533||d>=65536&&d<=983039}r.isNameStartChar=l;function c(d){return l(d)||d>=48&&d<=57||d===45||d===46||d===183||d>=768&&d<=879||d>=8255&&d<=8256}r.isNameChar=c})(ts)),ts}var rs={},hl;function Ef(){return hl||(hl=1,(function(r){/**
327
+ * Character class utilities for XML NS 1.0 edition 3.
328
+ *
329
+ * @author Louis-Dominique Dubeau
330
+ * @license MIT
331
+ * @copyright Louis-Dominique Dubeau
332
+ */Object.defineProperty(r,"__esModule",{value:!0}),r.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿",r.NC_NAME_CHAR="-"+r.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀",r.NC_NAME_START_CHAR_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]$","u"),r.NC_NAME_CHAR_RE=new RegExp("^["+r.NC_NAME_CHAR+"]$","u"),r.NC_NAME_RE=new RegExp("^["+r.NC_NAME_START_CHAR+"]["+r.NC_NAME_CHAR+"]*$","u");function e(n){return n>=65&&n<=90||n===95||n>=97&&n<=122||n>=192&&n<=214||n>=216&&n<=246||n>=248&&n<=767||n>=880&&n<=893||n>=895&&n<=8191||n>=8204&&n<=8205||n>=8304&&n<=8591||n>=11264&&n<=12271||n>=12289&&n<=55295||n>=63744&&n<=64975||n>=65008&&n<=65533||n>=65536&&n<=983039}r.isNCNameStartChar=e;function t(n){return e(n)||n===45||n===46||n>=48&&n<=57||n===183||n>=768&&n<=879||n>=8255&&n<=8256}r.isNCNameChar=t})(rs)),rs}var fl;function Sf(){if(fl)return tr;fl=1,Object.defineProperty(tr,"__esModule",{value:!0}),tr.SaxesParser=tr.EVENTS=void 0;const r=vf(),e=xf(),t=Ef();var n=r.isS,i=r.isChar,s=r.isNameStartChar,a=r.isNameChar,o=r.S_LIST,u=r.NAME_RE,l=e.isChar,c=t.isNCNameStartChar,d=t.isNCNameChar,b=t.NC_NAME_RE;const y="http://www.w3.org/XML/1998/namespace",_="http://www.w3.org/2000/xmlns/",E={__proto__:null,xml:y,xmlns:_},v={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},x=-1,S=-2,m=0,h=1,g=2,N=3,C=4,A=5,B=6,R=7,F=8,q=9,D=10,L=11,te=12,T=13,Z=14,k=15,Y=16,w=17,H=18,K=19,Q=20,ue=21,V=22,G=23,z=24,U=25,ee=26,re=27,fe=28,ge=29,j=30,W=31,se=32,he=33,pe=34,me=35,J=36,ce=37,ye=38,le=39,Re=40,ze=41,Ie=42,Xe=43,I=44,f=9,p=10,$=13,X=32,oe=33,de=34,Ee=38,ke=39,Le=45,Oe=47,De=59,mt=60,Mt=61,qe=62,He=63,On=91,Bt=93,gr=133,Mr=8232,O=We=>We===de||We===ke,M=[de,ke],be=[...M,On,qe],_e=[...M,mt,Bt],ve=[Mt,He,...o],Qe=[...o,qe,Ee,mt];function Ye(We,P,ne){switch(P){case"xml":ne!==y&&We.fail(`xml prefix must be bound to ${y}.`);break;case"xmlns":ne!==_&&We.fail(`xmlns prefix must be bound to ${_}.`);break}switch(ne){case _:We.fail(P===""?`the default namespace may not be set to ${ne}.`:`may not assign a prefix (even "xmlns") to the URI ${_}.`);break;case y:switch(P){case"xml":break;case"":We.fail(`the default namespace may not be set to ${ne}.`);break;default:We.fail("may not assign the xml namespace to another prefix.")}break}}function Cn(We,P){for(const ne of Object.keys(P))Ye(We,ne,P[ne])}const Rt=We=>b.test(We),jn=We=>u.test(We),Tt=0,Br=1,mr=2;tr.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];const yr={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class qr{get closed(){return this._closed}constructor(P){this.opt=P??{},this.fragmentOpt=!!this.opt.fragment;const ne=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,ne){this.nameStartCheck=c,this.nameCheck=d,this.isName=Rt,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},E);const ie=this.opt.additionalNamespaces;ie!=null&&(Cn(this,ie),Object.assign(this.ns,ie))}else this.nameStartCheck=s,this.nameCheck=a,this.isName=jn,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){var P;this.openWakaBang="",this.text="",this.name="",this.piTarget="",this.entity="",this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk="",this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=Tt,this.attribList=[];const{fragmentOpt:ne}=this;this.state=ne?T:m,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=ne,this.xmlDeclPossible=!ne,this.xmlDeclExpects=["version"],this.entityReturnState=void 0;let{defaultXMLVersion:ie}=this.opt;if(ie===void 0){if(this.opt.forceXMLVersion===!0)throw new Error("forceXMLVersion set but defaultXMLVersion is not set");ie="1.0"}this.setXMLVersion(ie),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(v),(P=this.readyHandler)===null||P===void 0||P.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(P,ne){this[yr[P]]=ne}off(P){this[yr[P]]=void 0}makeError(P){var ne;let ie=(ne=this.fileName)!==null&&ne!==void 0?ne:"";return this.trackPosition&&(ie.length>0&&(ie+=":"),ie+=`${this.line}:${this.column}`),ie.length>0&&(ie+=": "),new Error(ie+P)}fail(P){const ne=this.makeError(P),ie=this.errorHandler;if(ie===void 0)throw ne;return ie(ne),this}write(P){if(this.closed)return this.fail("cannot write after close; assign an onready handler.");let ne=!1;P===null?(ne=!0,P=""):typeof P=="object"&&(P=P.toString()),this.carriedFromPrevious!==void 0&&(P=`${this.carriedFromPrevious}${P}`,this.carriedFromPrevious=void 0);let ie=P.length;const we=P.charCodeAt(ie-1);!ne&&(we===$||we>=55296&&we<=56319)&&(this.carriedFromPrevious=P[ie-1],ie--,P=P.slice(0,ie));const{stateTable:Ae}=this;for(this.chunk=P,this.i=0;this.i<ie;)Ae[this.state].call(this);return this.chunkPosition+=ie,ne?this.end():this}close(){return this.write(null)}getCode10(){const{chunk:P,i:ne}=this;if(this.prevI=ne,this.i=ne+1,ne>=P.length)return x;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>=X||ie===f)return ie;switch(ie){case p:return this.line++,this.column=0,this.positionAtNewLine=this.position,p;case $:return P.charCodeAt(ne+1)===p&&(this.i=ne+2),this.line++,this.column=0,this.positionAtNewLine=this.position,S;default:return this.fail("disallowed character."),ie}}if(ie>56319)return ie>=57344&&ie<=65533||this.fail("disallowed character."),ie;const we=65536+(ie-55296)*1024+(P.charCodeAt(ne+1)-56320);return this.i=ne+2,we>1114111&&this.fail("disallowed character."),we}getCode11(){const{chunk:P,i:ne}=this;if(this.prevI=ne,this.i=ne+1,ne>=P.length)return x;const ie=P.charCodeAt(ne);if(this.column++,ie<55296){if(ie>31&&ie<127||ie>159&&ie!==Mr||ie===f)return ie;switch(ie){case p:return this.line++,this.column=0,this.positionAtNewLine=this.position,p;case $:{const Ae=P.charCodeAt(ne+1);(Ae===p||Ae===gr)&&(this.i=ne+2)}case gr:case Mr:return this.line++,this.column=0,this.positionAtNewLine=this.position,S;default:return this.fail("disallowed character."),ie}}if(ie>56319)return ie>=57344&&ie<=65533||this.fail("disallowed character."),ie;const we=65536+(ie-55296)*1024+(P.charCodeAt(ne+1)-56320);return this.i=ne+2,we>1114111&&this.fail("disallowed character."),we}getCodeNorm(){const P=this.getCode();return P===S?p:P}unget(){this.i=this.prevI,this.column--}captureTo(P){let{i:ne}=this;const{chunk:ie}=this;for(;;){const we=this.getCode(),Ae=we===S,Ce=Ae?p:we;if(Ce===x||P.includes(Ce))return this.text+=ie.slice(ne,this.prevI),Ce;Ae&&(this.text+=`${ie.slice(ne,this.prevI)}
333
+ `,ne=this.i)}}captureToChar(P){let{i:ne}=this;const{chunk:ie}=this;for(;;){let we=this.getCode();switch(we){case S:this.text+=`${ie.slice(ne,this.prevI)}
334
+ `,ne=this.i,we=p;break;case x:return this.text+=ie.slice(ne),!1}if(we===P)return this.text+=ie.slice(ne,this.prevI),!0}}captureNameChars(){const{chunk:P,i:ne}=this;for(;;){const ie=this.getCode();if(ie===x)return this.name+=P.slice(ne),x;if(!a(ie))return this.name+=P.slice(ne,this.prevI),ie===S?p:ie}}skipSpaces(){for(;;){const P=this.getCodeNorm();if(P===x||!n(P))return P}}setXMLVersion(P){this.currentXMLVersion=P,P==="1.0"?(this.isChar=i,this.getCode=this.getCode10):(this.isChar=l,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=h}sBeginWhitespace(){const P=this.i,ne=this.skipSpaces();switch(this.prevI!==P&&(this.xmlDeclPossible=!1),ne){case mt:if(this.state=k,this.text.length!==0)throw new Error("no-empty text at start");break;case x:break;default:this.unget(),this.state=T,this.xmlDeclPossible=!1}}sDoctype(){var P;const ne=this.captureTo(be);switch(ne){case qe:{(P=this.doctypeHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=T,this.doctype=!0;break}case x:break;default:this.text+=String.fromCodePoint(ne),ne===On?this.state=C:O(ne)&&(this.state=N,this.q=ne)}}sDoctypeQuote(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.q=null,this.state=g)}sDTD(){const P=this.captureTo(_e);P!==x&&(this.text+=String.fromCodePoint(P),P===Bt?this.state=g:P===mt?this.state=B:O(P)&&(this.state=A,this.q=P))}sDTDQuoted(){const P=this.q;this.captureToChar(P)&&(this.text+=String.fromCodePoint(P),this.state=C,this.q=null)}sDTDOpenWaka(){const P=this.getCodeNorm();switch(this.text+=String.fromCodePoint(P),P){case oe:this.state=R,this.openWakaBang="";break;case He:this.state=L;break;default:this.state=C}}sDTDOpenWakaBang(){const P=String.fromCodePoint(this.getCodeNorm()),ne=this.openWakaBang+=P;this.text+=P,ne!=="-"&&(this.state=ne==="--"?F:C,this.openWakaBang="")}sDTDComment(){this.captureToChar(Le)&&(this.text+="-",this.state=q)}sDTDCommentEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),this.state=P===Le?D:F}sDTDCommentEnded(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe?this.state=C:(this.fail("malformed comment."),this.state=F)}sDTDPI(){this.captureToChar(He)&&(this.text+="?",this.state=te)}sDTDPIEnding(){const P=this.getCodeNorm();this.text+=String.fromCodePoint(P),P===qe&&(this.state=C)}sText(){this.tags.length!==0?this.handleTextInRoot():this.handleTextOutsideRoot()}sEntity(){let{i:P}=this;const{chunk:ne}=this;e:for(;;)switch(this.getCode()){case S:this.entity+=`${ne.slice(P,this.prevI)}
335
+ `,P=this.i;break;case De:{const{entityReturnState:ie}=this,we=this.entity+ne.slice(P,this.prevI);this.state=ie;let Ae;we===""?(this.fail("empty entity name."),Ae="&;"):(Ae=this.parseEntity(we),this.entity=""),(ie!==T||this.textHandler!==void 0)&&(this.text+=Ae);break e}case x:this.entity+=ne.slice(P);break e}}sOpenWaka(){const P=this.getCode();if(s(P))this.state=pe,this.unget(),this.xmlDeclPossible=!1;else switch(P){case Oe:this.state=Xe,this.xmlDeclPossible=!1;break;case oe:this.state=Y,this.openWakaBang="",this.xmlDeclPossible=!1;break;case He:this.state=G;break;default:this.fail("disallowed character in tag name"),this.state=T,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0),this.state=Q,this.openWakaBang="";break;case"--":this.state=w,this.openWakaBang="";break;case"DOCTYPE":this.state=g,(this.doctype||this.sawRoot)&&this.fail("inappropriately located doctype declaration."),this.openWakaBang="";break;default:this.openWakaBang.length>=7&&this.fail("incorrect syntax.")}}sComment(){this.captureToChar(Le)&&(this.state=H)}sCommentEnding(){var P;const ne=this.getCodeNorm();ne===Le?(this.state=K,(P=this.commentHandler)===null||P===void 0||P.call(this,this.text),this.text=""):(this.text+=`-${String.fromCodePoint(ne)}`,this.state=w)}sCommentEnded(){const P=this.getCodeNorm();P!==qe?(this.fail("malformed comment."),this.text+=`--${String.fromCodePoint(P)}`,this.state=w):this.state=T}sCData(){this.captureToChar(Bt)&&(this.state=ue)}sCDataEnding(){const P=this.getCodeNorm();P===Bt?this.state=V:(this.text+=`]${String.fromCodePoint(P)}`,this.state=Q)}sCDataEnding2(){var P;const ne=this.getCodeNorm();switch(ne){case qe:{(P=this.cdataHandler)===null||P===void 0||P.call(this,this.text),this.text="",this.state=T;break}case Bt:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(ne)}`,this.state=Q}}sPIFirstChar(){const P=this.getCodeNorm();this.nameStartCheck(P)?(this.piTarget+=String.fromCodePoint(P),this.state=z):P===He||n(P)?(this.fail("processing instruction without a target."),this.state=P===He?ee:U):(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(P),this.state=z)}sPIRest(){const{chunk:P,i:ne}=this;for(;;){const ie=this.getCodeNorm();if(ie===x){this.piTarget+=P.slice(ne);return}if(!this.nameCheck(ie)){this.piTarget+=P.slice(ne,this.prevI);const we=ie===He;we||n(ie)?this.piTarget==="xml"?(this.xmlDeclPossible||this.fail("an XML declaration must be at the start of the document."),this.state=we?he:re):this.state=we?ee:U:(this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(ie));break}}}sPIBody(){if(this.text.length===0){const P=this.getCodeNorm();P===He?this.state=ee:n(P)||(this.text=String.fromCodePoint(P))}else this.captureToChar(He)&&(this.state=ee)}sPIEnding(){var P;const ne=this.getCodeNorm();if(ne===qe){const{piTarget:ie}=this;ie.toLowerCase()==="xml"&&this.fail("the XML declaration must appear at the start of the document."),(P=this.piHandler)===null||P===void 0||P.call(this,{target:ie,body:this.text}),this.piTarget=this.text="",this.state=T}else ne===He?this.text+="?":(this.text+=`?${String.fromCodePoint(ne)}`,this.state=U);this.xmlDeclPossible=!1}sXMLDeclNameStart(){const P=this.skipSpaces();if(P===He){this.state=he;return}P!==x&&(this.state=fe,this.name=String.fromCodePoint(P))}sXMLDeclName(){const P=this.captureTo(ve);if(P===He){this.state=he,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(n(P)||P===Mt){if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=P===Mt?j:ge}}sXMLDeclEq(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(P!==Mt&&this.fail("value required."),this.state=j)}sXMLDeclValueStart(){const P=this.getCodeNorm();if(P===He){this.state=he,this.fail("XML declaration is incomplete.");return}n(P)||(O(P)?this.q=P:(this.fail("value must be quoted."),this.q=X),this.state=W)}sXMLDeclValue(){const P=this.captureTo([this.q,He]);if(P===He){this.state=he,this.text="",this.fail("XML declaration is incomplete.");return}if(P===x)return;const ne=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];const ie=ne;this.xmlDecl.version=ie,/^1\.[0-9]+$/.test(ie)?this.opt.forceXMLVersion||this.setXMLVersion(ie):this.fail("version number must match /^1\\.[0-9]+$/.");break}case"encoding":/^[A-Za-z][A-Za-z0-9._-]*$/.test(ne)||this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."),this.xmlDeclExpects=["standalone"],this.xmlDecl.encoding=ne;break;case"standalone":ne!=="yes"&&ne!=="no"&&this.fail('standalone value must match "yes" or "no".'),this.xmlDeclExpects=[],this.xmlDecl.standalone=ne;break}this.name="",this.state=se}sXMLDeclSeparator(){const P=this.getCodeNorm();if(P===He){this.state=he;return}n(P)||(this.fail("whitespace required."),this.unget()),this.state=re}sXMLDeclEnding(){var P;this.getCodeNorm()===qe?(this.piTarget!=="xml"?this.fail("processing instructions are not allowed before root."):this.name!=="version"&&this.xmlDeclExpects.includes("version")&&this.fail("XML declaration must contain a version."),(P=this.xmldeclHandler)===null||P===void 0||P.call(this,this.xmlDecl),this.name="",this.piTarget=this.text="",this.state=T):this.fail("The character ? is disallowed anywhere in XML declarations."),this.xmlDeclPossible=!1}sOpenTag(){var P;const ne=this.captureNameChars();if(ne===x)return;const ie=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name="",this.xmlnsOpt&&(this.topNS=ie.ns=Object.create(null)),(P=this.openTagStartHandler)===null||P===void 0||P.call(this,ie),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail("documents may contain only one root."),ne){case qe:this.openTag();break;case Oe:this.state=me;break;default:n(ne)||this.fail("disallowed character in tag name."),this.state=J}}sOpenTagSlash(){this.getCode()===qe?this.openSelfClosingTag():(this.fail("forward-slash in opening tag not followed by >."),this.state=J)}sAttrib(){const P=this.skipSpaces();P!==x&&(s(P)?(this.unget(),this.state=ce):P===qe?this.openTag():P===Oe?this.state=me:this.fail("disallowed character in attribute name."))}sAttribName(){const P=this.captureNameChars();P===Mt?this.state=le:n(P)?this.state=ye:P===qe?(this.fail("attribute without value."),this.pushAttrib(this.name,this.name),this.name=this.text="",this.openTag()):P!==x&&this.fail("disallowed character in attribute name.")}sAttribNameSawWhite(){const P=this.skipSpaces();switch(P){case x:return;case Mt:this.state=le;break;default:this.fail("attribute without value."),this.text="",this.name="",P===qe?this.openTag():s(P)?(this.unget(),this.state=ce):(this.fail("disallowed character in attribute name."),this.state=J)}}sAttribValue(){const P=this.getCodeNorm();O(P)?(this.q=P,this.state=Re):n(P)||(this.fail("unquoted attribute value."),this.state=Ie,this.unget())}sAttribValueQuoted(){const{q:P,chunk:ne}=this;let{i:ie}=this;for(;;)switch(this.getCode()){case P:this.pushAttrib(this.name,this.text+ne.slice(ie,this.prevI)),this.name=this.text="",this.q=null,this.state=ze;return;case Ee:this.text+=ne.slice(ie,this.prevI),this.state=Z,this.entityReturnState=Re;return;case p:case S:case f:this.text+=`${ne.slice(ie,this.prevI)} `,ie=this.i;break;case mt:this.text+=ne.slice(ie,this.prevI),this.fail("disallowed character.");return;case x:this.text+=ne.slice(ie);return}}sAttribValueClosed(){const P=this.getCodeNorm();n(P)?this.state=J:P===qe?this.openTag():P===Oe?this.state=me:s(P)?(this.fail("no whitespace between attributes."),this.unget(),this.state=ce):this.fail("disallowed character in attribute name.")}sAttribValueUnquoted(){const P=this.captureTo(Qe);switch(P){case Ee:this.state=Z,this.entityReturnState=Ie;break;case mt:this.fail("disallowed character.");break;case x:break;default:this.text.includes("]]>")&&this.fail('the string "]]>" is disallowed in char data.'),this.pushAttrib(this.name,this.text),this.name=this.text="",P===qe?this.openTag():this.state=J}}sCloseTag(){const P=this.captureNameChars();P===qe?this.closeTag():n(P)?this.state=I:P!==x&&this.fail("disallowed character in closing tag.")}sCloseTagSawWhite(){switch(this.skipSpaces()){case qe:this.closeTag();break;case x:break;default:this.fail("disallowed character in closing tag.")}}handleTextInRoot(){let{i:P,forbiddenState:ne}=this;const{chunk:ie,textHandler:we}=this;e:for(;;)switch(this.getCode()){case mt:{if(this.state=k,we!==void 0){const{text:Ae}=this,Ce=ie.slice(P,this.prevI);Ae.length!==0?(we(Ae+Ce),this.text=""):Ce.length!==0&&we(Ce)}ne=Tt;break e}case Ee:this.state=Z,this.entityReturnState=T,we!==void 0&&(this.text+=ie.slice(P,this.prevI)),ne=Tt;break e;case Bt:switch(ne){case Tt:ne=Br;break;case Br:ne=mr;break;case mr:break;default:throw new Error("impossible state")}break;case qe:ne===mr&&this.fail('the string "]]>" is disallowed in char data.'),ne=Tt;break;case S:we!==void 0&&(this.text+=`${ie.slice(P,this.prevI)}
336
+ `),P=this.i,ne=Tt;break;case x:we!==void 0&&(this.text+=ie.slice(P));break e;default:ne=Tt}this.forbiddenState=ne}handleTextOutsideRoot(){let{i:P}=this;const{chunk:ne,textHandler:ie}=this;let we=!1;e:for(;;){const Ae=this.getCode();switch(Ae){case mt:{if(this.state=k,ie!==void 0){const{text:Ce}=this,Ze=ne.slice(P,this.prevI);Ce.length!==0?(ie(Ce+Ze),this.text=""):Ze.length!==0&&ie(Ze)}break e}case Ee:this.state=Z,this.entityReturnState=T,ie!==void 0&&(this.text+=ne.slice(P,this.prevI)),we=!0;break e;case S:ie!==void 0&&(this.text+=`${ne.slice(P,this.prevI)}
337
+ `),P=this.i;break;case x:ie!==void 0&&(this.text+=ne.slice(P));break e;default:n(Ae)||(we=!0)}}we&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0))}pushAttribNS(P,ne){var ie;const{prefix:we,local:Ae}=this.qname(P),Ce={name:P,prefix:we,local:Ae,value:ne};if(this.attribList.push(Ce),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,Ce),we==="xmlns"){const Ze=ne.trim();this.currentXMLVersion==="1.0"&&Ze===""&&this.fail("invalid attempt to undefine prefix in XML 1.0"),this.topNS[Ae]=Ze,Ye(this,Ae,Ze)}else if(P==="xmlns"){const Ze=ne.trim();this.topNS[""]=Ze,Ye(this,"",Ze)}}pushAttribPlain(P,ne){var ie;const we={name:P,value:ne};this.attribList.push(we),(ie=this.attributeHandler)===null||ie===void 0||ie.call(this,we)}end(){var P,ne;this.sawRoot||this.fail("document must contain a root element.");const{tags:ie}=this;for(;ie.length>0;){const Ae=ie.pop();this.fail(`unclosed tag: ${Ae.name}`)}this.state!==m&&this.state!==T&&this.fail("unexpected end.");const{text:we}=this;return we.length!==0&&((P=this.textHandler)===null||P===void 0||P.call(this,we),this.text=""),this._closed=!0,(ne=this.endHandler)===null||ne===void 0||ne.call(this),this._init(),this}resolve(P){var ne,ie;let we=this.topNS[P];if(we!==void 0)return we;const{tags:Ae}=this;for(let Ce=Ae.length-1;Ce>=0;Ce--)if(we=Ae[Ce].ns[P],we!==void 0)return we;return we=this.ns[P],we!==void 0?we:(ie=(ne=this.opt).resolvePrefix)===null||ie===void 0?void 0:ie.call(ne,P)}qname(P){const ne=P.indexOf(":");if(ne===-1)return{prefix:"",local:P};const ie=P.slice(ne+1),we=P.slice(0,ne);return(we===""||ie===""||ie.includes(":"))&&this.fail(`malformed name: ${P}.`),{prefix:we,local:ie}}processAttribsNS(){var P;const{attribList:ne}=this,ie=this.tag;{const{prefix:Ce,local:Ze}=this.qname(ie.name);ie.prefix=Ce,ie.local=Ze;const br=ie.uri=(P=this.resolve(Ce))!==null&&P!==void 0?P:"";Ce!==""&&(Ce==="xmlns"&&this.fail('tags may not have "xmlns" as prefix.'),br===""&&(this.fail(`unbound namespace prefix: ${JSON.stringify(Ce)}.`),ie.uri=Ce))}if(ne.length===0)return;const{attributes:we}=ie,Ae=new Set;for(const Ce of ne){const{name:Ze,prefix:br,local:ad}=Ce;let _r,Ur;br===""?(_r=Ze==="xmlns"?_:"",Ur=Ze):(_r=this.resolve(br),_r===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(br)}.`),_r=br),Ur=`{${_r}}${ad}`),Ae.has(Ur)&&this.fail(`duplicate attribute: ${Ur}.`),Ae.add(Ur),Ce.uri=_r,we[Ze]=Ce}this.attribList=[]}processAttribsPlain(){const{attribList:P}=this,ne=this.tag.attributes;for(const{name:ie,value:we}of P)ne[ie]!==void 0&&this.fail(`duplicate attribute: ${ie}.`),ne[ie]=we;this.attribList=[]}openTag(){var P;this.processAttribs();const{tags:ne}=this,ie=this.tag;ie.isSelfClosing=!1,(P=this.openTagHandler)===null||P===void 0||P.call(this,ie),ne.push(ie),this.state=T,this.name=""}openSelfClosingTag(){var P,ne,ie;this.processAttribs();const{tags:we}=this,Ae=this.tag;Ae.isSelfClosing=!0,(P=this.openTagHandler)===null||P===void 0||P.call(this,Ae),(ne=this.closeTagHandler)===null||ne===void 0||ne.call(this,Ae),(this.tag=(ie=we[we.length-1])!==null&&ie!==void 0?ie:null)===null&&(this.closedRoot=!0),this.state=T,this.name=""}closeTag(){const{tags:P,name:ne}=this;if(this.state=T,this.name="",ne===""){this.fail("weird empty close tag."),this.text+="</>";return}const ie=this.closeTagHandler;let we=P.length;for(;we-- >0;){const Ae=this.tag=P.pop();if(this.topNS=Ae.ns,ie?.(Ae),Ae.name===ne)break;this.fail("unexpected close tag.")}we===0?this.closedRoot=!0:we<0&&(this.fail(`unmatched closing tag: ${ne}.`),this.text+=`</${ne}>`)}parseEntity(P){if(P[0]!=="#"){const ie=this.ENTITIES[P];return ie!==void 0?ie:(this.fail(this.isName(P)?"undefined entity.":"disallowed character in entity name."),`&${P};`)}let ne=NaN;return P[1]==="x"&&/^#x[0-9a-f]+$/i.test(P)?ne=parseInt(P.slice(2),16):/^#[0-9]+$/.test(P)&&(ne=parseInt(P.slice(1),10)),this.isChar(ne)?String.fromCodePoint(ne):(this.fail("malformed character entity."),`&${P};`)}}return tr.SaxesParser=qr,tr}var Kr={},pl;function If(){if(pl)return Kr;pl=1,Object.defineProperty(Kr,"__esModule",{value:!0}),Kr.ParseError=void 0;let r=class extends Error{constructor(t,n){const i=t.saxParser;super(t.trackPosition?`Line ${i.line} column ${i.column+1}: ${n}`:n)}};return Kr.ParseError=r,Kr}var rr={},Yr={},gl;function kc(){if(gl)return Yr;gl=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.BlankNode=void 0;class r{constructor(t){this.termType="BlankNode",this.value=t}equals(t){return!!t&&t.termType==="BlankNode"&&t.value===this.value}}return Yr.BlankNode=r,Yr}var Zr={},en={},ml;function Pc(){if(ml)return en;ml=1,Object.defineProperty(en,"__esModule",{value:!0}),en.DefaultGraph=void 0;class r{constructor(){this.termType="DefaultGraph",this.value=""}equals(t){return!!t&&t.termType==="DefaultGraph"}}return en.DefaultGraph=r,r.INSTANCE=new r,en}var tn={},rn={},yl;function qa(){if(yl)return rn;yl=1,Object.defineProperty(rn,"__esModule",{value:!0}),rn.NamedNode=void 0;class r{constructor(t){this.termType="NamedNode",this.value=t}equals(t){return!!t&&t.termType==="NamedNode"&&t.value===this.value}}return rn.NamedNode=r,rn}var bl;function Mc(){if(bl)return tn;bl=1,Object.defineProperty(tn,"__esModule",{value:!0}),tn.Literal=void 0;const r=qa();class e{constructor(n,i){this.termType="Literal",this.value=n,typeof i=="string"?(this.language=i,this.datatype=e.RDF_LANGUAGE_STRING,this.direction=""):i?"termType"in i?(this.language="",this.datatype=i,this.direction=""):(this.language=i.language,this.datatype=i.direction?e.RDF_DIRECTIONAL_LANGUAGE_STRING:e.RDF_LANGUAGE_STRING,this.direction=i.direction||""):(this.language="",this.datatype=e.XSD_STRING,this.direction="")}equals(n){return!!n&&n.termType==="Literal"&&n.value===this.value&&n.language===this.language&&(n.direction===this.direction||!n.direction&&this.direction==="")&&this.datatype.equals(n.datatype)}}return tn.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"),tn}var nn={},_l;function Bc(){if(_l)return nn;_l=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.Quad=void 0;class r{constructor(t,n,i,s){this.termType="Quad",this.value="",this.subject=t,this.predicate=n,this.object=i,this.graph=s}equals(t){return!!t&&(t.termType==="Quad"||!t.termType)&&this.subject.equals(t.subject)&&this.predicate.equals(t.predicate)&&this.object.equals(t.object)&&this.graph.equals(t.graph)}}return nn.Quad=r,nn}var sn={},wl;function qc(){if(wl)return sn;wl=1,Object.defineProperty(sn,"__esModule",{value:!0}),sn.Variable=void 0;class r{constructor(t){this.termType="Variable",this.value=t}equals(t){return!!t&&t.termType==="Variable"&&t.value===this.value}}return sn.Variable=r,sn}var vl;function Nf(){if(vl)return Zr;vl=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.DataFactory=void 0;const r=kc(),e=Pc(),t=Mc(),n=qa(),i=Bc(),s=qc();let a=0;class o{constructor(l){this.blankNodeCounter=0,l=l||{},this.blankNodePrefix=l.blankNodePrefix||`df_${a++}_`}namedNode(l){return new n.NamedNode(l)}blankNode(l){return new r.BlankNode(l||`${this.blankNodePrefix}${this.blankNodeCounter++}`)}literal(l,c){return new t.Literal(l,c)}variable(l){return new s.Variable(l)}defaultGraph(){return e.DefaultGraph.INSTANCE}quad(l,c,d,b){return new i.Quad(l,c,d,b||this.defaultGraph())}fromTerm(l){switch(l.termType){case"NamedNode":return this.namedNode(l.value);case"BlankNode":return this.blankNode(l.value);case"Literal":return l.language?this.literal(l.value,l.language):l.datatype.equals(t.Literal.XSD_STRING)?this.literal(l.value):this.literal(l.value,this.fromTerm(l.datatype));case"Variable":return this.variable(l.value);case"DefaultGraph":return this.defaultGraph();case"Quad":return this.quad(this.fromTerm(l.subject),this.fromTerm(l.predicate),this.fromTerm(l.object),this.fromTerm(l.graph))}}fromQuad(l){return this.fromTerm(l)}resetBlankNodeCounter(){this.blankNodeCounter=0}}return Zr.DataFactory=o,Zr}var xl;function Uc(){return xl||(xl=1,(function(r){var e=rr&&rr.__createBinding||(Object.create?(function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}):(function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]})),t=rr&&rr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(kc(),r),t(Nf(),r),t(Pc(),r),t(Mc(),r),t(qa(),r),t(Bc(),r),t(qc(),r)})(rr)),rr}var nr={},ns={},El;function Rf(){return El||(El=1,(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.validateIri=r.IriValidationStrategy=void 0;function e(){const o="[!$&'()*+,;=]",u="%[a-fA-F0-9]{2}",l="([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",c=`${l}\\.${l}\\.${l}\\.${l}`,d="[a-fA-F0-9]{1,4}",b=`(${d}:${d}|${c})`,y=`((${d}:){6}${b}|::(${d}:){5}${b}|(${d})?::(${d}:){4}${b}|((${d}:){0,1}${d})?::(${d}:){3}${b}|((${d}:){0,2}${d})?::(${d}:){2}${b}|((${d}:){0,3}${d})?::${d}:${b}|((${d}:){0,4}${d})?::${b}|((${d}:){0,5}${d})?::${d}|((${d}:){0,6}${d})?::)`,_=`v[a-fA-F0-9]+\\.(${o}|${o}|":)+`,E=`\\[(${y}|${_})\\]`,v="[0-9]*",x="[a-zA-Z][a-zA-Z0-9+\\-.]*",m="[-󰀀-󿿽􀀀-􏿽]",N="[a-zA-Z0-9\\-._~ -퟿豈-﷏ﷰ-￯𐀀-🿽𠀀-𯿽𰀀-𿿽񀀀-񏿽񐀀-񟿽񠀀-񯿽񰀀-񿿽򀀀-򏿽򐀀-򟿽򠀀-򯿽򰀀-򿿽󀀀-󏿽󐀀-󟿽󡀀-󯿽]",C=`(${N}|${u}|${o}|[:@])*`,A=`(${C}|[\\/?])*`,B=`(${C}|${m}|[\\/?])*`,R=`(${C})+`,F=`(${C})*`,q="",D=`${R}(\\/${F})*`,L=`\\/(${R}(\\/${F})*)?`,te=`(\\/${F})*`,T=`(${N}|${u}|${o})*`,Z=`(${E}|${c}|${T})`,w=`(\\/\\/${`(${`(${N}|${u}|${o}|:)*`}@)?${Z}(:${v})?`}${te}|${L}|${D}|${q})`,H=`^${x}:${w}(\\?${B})?(#${A})?$`;return new RegExp(H,"u")}const t=e(),n=/^[A-Za-z][\d+-.A-Za-z]*:[^\u0000-\u0020"<>\\^`{|}]*$/u;var i;(function(a){a.Strict="strict",a.Pragmatic="pragmatic",a.None="none"})(i=r.IriValidationStrategy||(r.IriValidationStrategy={}));function s(a,o=i.Strict){switch(o){case i.Strict:return t.test(a)?void 0:new Error(`Invalid IRI according to RFC 3987: '${a}'`);case i.Pragmatic:return n.test(a)?void 0:new Error(`Invalid IRI according to RDF Turtle: '${a}'`);case i.None:return;default:return new Error(`Not supported validation strategy "${o}"`)}}r.validateIri=s})(ns)),ns}var Sl;function Tf(){return Sl||(Sl=1,(function(r){var e=nr&&nr.__createBinding||(Object.create?(function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}):(function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]})),t=nr&&nr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Rf(),r)})(nr)),nr}var Il;function Af(){if(Il)return Zt;Il=1,Object.defineProperty(Zt,"__esModule",{value:!0}),Zt.ParseType=Zt.RdfXmlParser=void 0;const r=wf(),e=Sf(),t=dc(),n=If(),i=Uc(),s=Tf();let a=class $e extends t.Transform{constructor(l){super({readableObjectMode:!0}),this.activeTagStack=[],this.nodeIds={},l&&(Object.assign(this,l),this.options=l),this.dataFactory||(this.dataFactory=new i.DataFactory),this.baseIRI||(this.baseIRI=""),this.defaultGraph||(this.defaultGraph=this.dataFactory.defaultGraph()),this.validateUri!==!1&&(this.validateUri=!0),this.iriValidationStrategy||(this.iriValidationStrategy=this.validateUri?s.IriValidationStrategy.Pragmatic:s.IriValidationStrategy.None),this.saxParser=new e.SaxesParser({xmlns:!0,position:this.trackPosition}),this.attachSaxListeners()}import(l){const c=new t.PassThrough({readableObjectMode:!0});l.on("error",b=>d.emit("error",b)),l.on("data",b=>c.push(b)),l.on("end",()=>c.push(null));const d=c.pipe(new $e(this.options));return d}_transform(l,c,d){try{this.saxParser.write(l)}catch(b){return d(b)}d()}newParseError(l){return new n.ParseError(this,l)}valueToUri(l,c){return this.uriToNamedNode((0,r.resolve)(l,c.baseIRI))}uriToNamedNode(l){const c=(0,s.validateIri)(l,this.iriValidationStrategy);if(c instanceof Error)throw this.newParseError(c.message);return this.dataFactory.namedNode(l)}validateNcname(l){if(!$e.NCNAME_MATCHER.test(l))throw this.newParseError(`Not a valid NCName: ${l}`)}createLiteral(l,c){return this.dataFactory.literal(l,c.datatype?c.datatype:c.language?{language:c.language,direction:c.rdfVersion?c.direction:void 0}:void 0)}attachSaxListeners(){this.saxParser.on("error",l=>this.emit("error",l)),this.saxParser.on("opentag",this.onTag.bind(this)),this.saxParser.on("text",this.onText.bind(this)),this.saxParser.on("cdata",this.onText.bind(this)),this.saxParser.on("closetag",this.onCloseTag.bind(this)),this.saxParser.on("doctype",this.onDoctype.bind(this))}onTag(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;let d=o.RESOURCE;if(c&&(c.hadChildren=!0,d=c.childrenParseType),c&&c.childrenStringTags){const y=l.name;let _="";for(const{key:S,value:m}of c.namespaces||[])_+=` ${S}="${m}"`;for(const S in l.attributes)_+=` ${S}="${l.attributes[S].value}"`;const v=`<${`${y}${_}`}>`;c.childrenStringTags.push(v);const x={childrenStringTags:c.childrenStringTags};x.childrenStringEmitClosingTag=`</${y}>`,this.activeTagStack.push(x);return}const b={};c?(b.language=c.language,b.direction=c.direction,b.baseIRI=c.baseIRI,b.childrenTripleTerms=c.childrenTripleTerms,b.rdfVersion=c.rdfVersion):b.baseIRI=this.baseIRI,this.activeTagStack.push(b),d===o.RESOURCE?this.onTagResource(l,b,c,!c):this.onTagProperty(l,b,c);for(const y in l.attributes){const _=l.attributes[y];_.prefix==="xmlns"&&(b.namespaces||(b.namespaces=[]),b.namespaces.push({key:`${_.prefix}:${_.local}`,value:_.value}))}c&&c.namespaces&&(b.namespaces=[...b.namespaces||[],...c.namespaces])}onTagResource(l,c,d,b){c.childrenParseType=o.PROPERTY;let y=!0;if(l.uri===$e.RDF){if(!b&&$e.FORBIDDEN_NODE_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal node element name: ${l.local}`);switch(l.local){case"RDF":c.childrenParseType=o.RESOURCE;case"Description":y=!1}}const _=[],E=[];let v=null,x=!1,S=!1,m=null;for(const h in l.attributes){const g=l.attributes[h];if(g.uri===$e.RDF&&g.local==="version"){this.setVersion(c,g.value);continue}else if(d&&g.uri===$e.RDF)switch(g.local){case"about":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);v=g.value;continue;case"ID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v="#"+g.value,x=!0;continue;case"nodeID":if(v)throw this.newParseError(`Only one of rdf:about, rdf:nodeID and rdf:ID can be present, while ${g.value} and ${v} where found.`);this.validateNcname(g.value),v=g.value,S=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"type":m=g.value;continue;case"aboutEach":throw this.newParseError("rdf:aboutEach is not supported.");case"aboutEachPrefix":throw this.newParseError("rdf:aboutEachPrefix is not supported.");case"li":throw this.newParseError("rdf:li on node elements are not supported.")}else if(g.uri===$e.XML){if(g.local==="lang"){c.language=g.value===""?null:g.value.toLowerCase();continue}else if(g.local==="base"){c.baseIRI=(0,r.resolve)(g.value,c.baseIRI);continue}}else if(g.uri===$e.ITS&&g.local==="dir"){this.setDirection(c,g.value);continue}g.prefix!=="xml"&&g.prefix!=="xmlns"&&(g.prefix!==""||g.local!=="xmlns")&&g.uri&&(_.push(this.uriToNamedNode(g.uri+g.local)),E.push(g.value))}if(v!==null&&(c.subject=S?this.dataFactory.blankNode(v):this.valueToUri(v,c),x&&this.claimNodeId(c.subject)),c.subject||(c.subject=this.dataFactory.blankNode()),y){const h=this.uriToNamedNode(l.uri+l.local);this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),h,d?d.reifiedStatementId:null,c.childrenTripleTerms,c.reifier)}if(d){if(d.predicate)if(d.childrenCollectionSubject){const h=this.dataFactory.blankNode(),g=this.dataFactory.namedNode($e.RDF+"rest"),N=d.childrenCollectionPredicate.equals(g);this.emitTriple(d.childrenCollectionSubject,d.childrenCollectionPredicate,h,N?null:d.reifiedStatementId,d.childrenTripleTerms,N?null:d.reifier),this.emitTriple(h,this.dataFactory.namedNode($e.RDF+"first"),c.subject,null,c.childrenTripleTerms),d.childrenCollectionSubject=h,d.childrenCollectionPredicate=g}else{d.childrenTagsToTripleTerms||(this.emitTriple(d.subject,d.predicate,c.subject,d.reifiedStatementId,d.childrenTripleTerms,d.reifier),d.predicateEmitted=!0);for(let h=0;h<d.predicateSubPredicates.length;h++)this.emitTriple(c.subject,d.predicateSubPredicates[h],d.predicateSubObjects[h],null,d.childrenTripleTerms,d.reifier);d.predicateSubPredicates=[],d.predicateSubObjects=[]}for(let h=0;h<_.length;h++){const g=this.createLiteral(E[h],c);this.emitTriple(c.subject,_[h],g,d.reifiedStatementId,d.childrenTripleTerms,d.reifier)}m&&this.emitTriple(c.subject,this.dataFactory.namedNode($e.RDF+"type"),this.uriToNamedNode(m),null,c.childrenTripleTerms,c.reifier)}}onTagProperty(l,c,d){if(c.childrenParseType=o.RESOURCE,c.subject=d.subject,l.uri===$e.RDF&&l.local==="li"?(d.listItemCounter||(d.listItemCounter=1),c.predicate=this.uriToNamedNode(l.uri+"_"+d.listItemCounter++)):c.predicate=this.uriToNamedNode(l.uri+l.local),l.uri===$e.RDF&&$e.FORBIDDEN_PROPERTY_ELEMENTS.indexOf(l.local)>=0)throw this.newParseError(`Illegal property element name: ${l.local}`);c.predicateSubPredicates=[],c.predicateSubObjects=[];let b=!1,y=!1,_=null,E=!0;const v=[],x=[];for(const S in l.attributes){const m=l.attributes[S];if(m.uri===$e.RDF&&m.local==="version"){this.setVersion(c,m.value);continue}else if(m.uri===$e.RDF)switch(m.local){case"resource":if(_)throw this.newParseError(`Found both rdf:resource (${m.value}) and rdf:nodeID (${_}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:resource (${m.value})`);c.hadChildren=!0,_=m.value,E=!1;continue;case"datatype":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:datatype (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${m.value})`);c.datatype=this.valueToUri(m.value,c);continue;case"nodeID":if(y)throw this.newParseError(`Found both non-rdf:* property attributes and rdf:nodeID (${m.value}).`);if(c.hadChildren)throw this.newParseError(`Found both rdf:resource and rdf:nodeID (${m.value}).`);if(b)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID (${m.value})`);this.validateNcname(m.value),c.hadChildren=!0,_=m.value,E=!0;continue;case"bagID":throw this.newParseError("rdf:bagID is not supported.");case"parseType":if(y)throw this.newParseError("rdf:parseType is not allowed when non-rdf:* property attributes are present");if(c.datatype)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:datatype (${c.datatype.value})`);if(_)throw this.newParseError(`rdf:parseType is not allowed on property elements with rdf:nodeID or rdf:resource (${_})`);if(m.value==="Resource"){b=!0,c.childrenParseType=o.PROPERTY;const h=this.dataFactory.blankNode();this.emitTriple(c.subject,c.predicate,h,c.reifiedStatementId,c.childrenTripleTerms,c.reifier),c.subject=h,c.predicate=null}else m.value==="Collection"?(b=!0,c.hadChildren=!0,c.childrenCollectionSubject=c.subject,c.childrenCollectionPredicate=c.predicate,E=!1):m.value==="Literal"?(b=!0,c.childrenTagsToString=!0,c.childrenStringTags=[]):m.value==="Triple"&&(b=!0,c.childrenTagsToTripleTerms=!0,c.childrenTripleTerms=[]);continue;case"ID":this.validateNcname(m.value),c.reifiedStatementId=this.valueToUri("#"+m.value,c),this.claimNodeId(c.reifiedStatementId);continue;case"annotation":c.reifier=this.dataFactory.namedNode(m.value);continue;case"annotationNodeID":c.reifier=this.dataFactory.blankNode(m.value);continue}else if(m.uri===$e.XML&&m.local==="lang"){c.language=m.value===""?null:m.value.toLowerCase();continue}else if(m.uri===$e.ITS&&m.local==="dir"){this.setDirection(c,m.value);continue}else if(m.uri===$e.ITS&&m.local==="version")continue;if(m.prefix!=="xml"&&m.prefix!=="xmlns"&&(m.prefix!==""||m.local!=="xmlns")&&m.uri){if(b||c.datatype)throw this.newParseError(`Found illegal rdf:* properties on property element with attribute: ${m.value}`);c.hadChildren=!0,y=!0,v.push(this.uriToNamedNode(m.uri+m.local)),x.push(this.createLiteral(m.value,c))}}if(_!==null){const S=c.subject;c.subject=E?this.dataFactory.blankNode(_):this.valueToUri(_,c),this.emitTriple(S,c.predicate,c.subject,c.reifiedStatementId,c.childrenTripleTerms,c.reifier);for(let m=0;m<v.length;m++)this.emitTriple(c.subject,v[m],x[m],null,c.childrenTripleTerms,c.reifier);c.predicateEmitted=!0}else E&&(c.predicateSubPredicates=v,c.predicateSubObjects=x,c.predicateEmitted=!1)}emitTriple(l,c,d,b,y,_){const E=this.dataFactory.quad(l,c,d,this.defaultGraph);y?y.push(E):this.push(E),_&&this.push(this.dataFactory.quad(_,this.dataFactory.namedNode($e.RDF+"reifies"),E)),b&&(this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"type"),this.dataFactory.namedNode($e.RDF+"Statement"),this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"subject"),l,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"predicate"),c,this.defaultGraph)),this.push(this.dataFactory.quad(b,this.dataFactory.namedNode($e.RDF+"object"),d,this.defaultGraph)))}claimNodeId(l){if(!this.allowDuplicateRdfIds){if(this.nodeIds[l.value])throw this.newParseError(`Found multiple occurrences of rdf:ID='${l.value}'.`);this.nodeIds[l.value]=!0}}onText(l){const c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;c&&(c.childrenStringTags?c.childrenStringTags.push(l):c.predicate&&(c.text=l))}onCloseTag(){const l=this.activeTagStack.pop(),c=this.activeTagStack.length?this.activeTagStack[this.activeTagStack.length-1]:null;if(l.childrenStringEmitClosingTag&&l.childrenStringTags.push(l.childrenStringEmitClosingTag),l.childrenTagsToString&&(l.datatype=this.dataFactory.namedNode($e.RDF+"XMLLiteral"),l.text=l.childrenStringTags.join(""),l.hadChildren=!1),l.childrenTagsToTripleTerms&&l.predicate&&l.rdfVersion){if(l.childrenTripleTerms.length!==1)throw this.newParseError(`Expected exactly one triple term in rdf:parseType="Triple" but got ${l.childrenTripleTerms.length}`);for(const d of l.childrenTripleTerms)this.emitTriple(l.subject,l.predicate,d,null,c.childrenTripleTerms,c.reifier);l.predicateEmitted=!0}if(l.childrenCollectionSubject)this.emitTriple(l.childrenCollectionSubject,l.childrenCollectionPredicate,this.dataFactory.namedNode($e.RDF+"nil"),null,l.childrenTripleTerms);else if(l.predicate){if(!l.hadChildren&&l.childrenParseType!==o.PROPERTY)this.emitTriple(l.subject,l.predicate,this.createLiteral(l.text||"",l),l.reifiedStatementId,l.childrenTripleTerms,l.reifier);else if(!l.predicateEmitted){const d=this.dataFactory.blankNode();this.emitTriple(l.subject,l.predicate,d,l.reifiedStatementId,l.childrenTripleTerms,l.reifier);for(let b=0;b<l.predicateSubPredicates.length;b++)this.emitTriple(d,l.predicateSubPredicates[b],l.predicateSubObjects[b],null,l.childrenTripleTerms)}}}onDoctype(l){l.replace(/<!ENTITY\s+([^\s]+)\s+["']([^"']+)["']\s*>/g,(c,d,b)=>(this.saxParser.ENTITIES[d]=b,""))}setDirection(l,c){if(c){if(c!=="ltr"&&c!=="rtl")throw this.newParseError(`Base directions must either be 'ltr' or 'rtl', while '${c}' was found.`);l.direction=c}else delete l.direction}setVersion(l,c){l.rdfVersion=c,this.emit("version",c)}};Zt.RdfXmlParser=a,a.MIME_TYPE="application/rdf+xml",a.RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#",a.XML="http://www.w3.org/XML/1998/namespace",a.ITS="http://www.w3.org/2005/11/its",a.FORBIDDEN_NODE_ELEMENTS=["RDF","ID","about","bagID","parseType","resource","nodeID","li","aboutEach","aboutEachPrefix"],a.FORBIDDEN_PROPERTY_ELEMENTS=["Description","RDF","ID","about","bagID","parseType","resource","nodeID","aboutEach","aboutEachPrefix"],a.NCNAME_MATCHER=/^([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_])([A-Za-z\xC0-\xD6\xD8-\xF6\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}_\-.0-9#xB7\u{0300}-\u{036F}\u{203F}-\u{2040}])*$/u;var o;return(function(u){u[u.RESOURCE=0]="RESOURCE",u[u.PROPERTY=1]="PROPERTY"})(o||(Zt.ParseType=o={})),Zt}var Nl;function Df(){return Nl||(Nl=1,(function(r){var e=Yt&&Yt.__createBinding||(Object.create?(function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}):(function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]})),t=Yt&&Yt.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Af(),r)})(Yt)),Yt}var Lf=Df(),is={},ss,Rl;function Ua(){return Rl||(Rl=1,ss=class Hc{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 Hc(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()]}}),ss}var as={},Tl;function Of(){return Tl||(Tl=1,(function(r,e){if(r.setImmediate)return;var t=1,n={},i=!1,s=r.document,a;function o(S){typeof S!="function"&&(S=new Function(""+S));for(var m=new Array(arguments.length-1),h=0;h<m.length;h++)m[h]=arguments[h+1];var g={callback:S,args:m};return n[t]=g,a(t),t++}function u(S){delete n[S]}function l(S){var m=S.callback,h=S.args;switch(h.length){case 0:m();break;case 1:m(h[0]);break;case 2:m(h[0],h[1]);break;case 3:m(h[0],h[1],h[2]);break;default:m.apply(e,h);break}}function c(S){if(i)setTimeout(c,0,S);else{var m=n[S];if(m){i=!0;try{l(m)}finally{u(S),i=!1}}}}function d(){a=function(S){process.nextTick(function(){c(S)})}}function b(){if(r.postMessage&&!r.importScripts){var S=!0,m=r.onmessage;return r.onmessage=function(){S=!1},r.postMessage("","*"),r.onmessage=m,S}}function y(){var S="setImmediate$"+Math.random()+"$",m=function(h){h.source===r&&typeof h.data=="string"&&h.data.indexOf(S)===0&&c(+h.data.slice(S.length))};r.addEventListener?r.addEventListener("message",m,!1):r.attachEvent("onmessage",m),a=function(h){r.postMessage(S+h,"*")}}function _(){var S=new MessageChannel;S.port1.onmessage=function(m){var h=m.data;c(h)},a=function(m){S.port2.postMessage(m)}}function E(){var S=s.documentElement;a=function(m){var h=s.createElement("script");h.onreadystatechange=function(){c(m),h.onreadystatechange=null,S.removeChild(h),h=null},S.appendChild(h)}}function v(){a=function(S){setTimeout(c,0,S)}}var x=Object.getPrototypeOf&&Object.getPrototypeOf(r);x=x&&x.setTimeout?x:r,{}.toString.call(r.process)==="[object process]"?d():b()?y():r.MessageChannel?_():s&&"onreadystatechange"in s.createElement("script")?E():v(),x.setImmediate=o,x.clearImmediate=u})(typeof self>"u"?typeof Sr>"u"?as:Sr:self)),as}/*!
338
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
339
+ */var os,Al;function bi(){if(Al)return os;Al=1,Of();const r=self.crypto||self.msCrypto;return os=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}},os}/*!
340
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
341
+ */var ls,Dl;function Vc(){return Dl||(Dl=1,ls=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,n=e.slice();let i=null,s=0;const a=e.length;for(let o=0;o<a;++o){const u=e[o],l=t.get(u);(i===null||u>i)&&(l&&o>0&&u>e[o-1]||!l&&o<a-1&&u>e[o+1])&&(i=u,s=o)}if(i===null)this.done=!0;else{const o=t.get(i)?s-1:s+1;e[s]=e[o],e[o]=i;for(const u of e)u>i&&t.set(u,!t.get(u))}return n}}),ls}/*!
342
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
343
+ */var us,Ll;function Ha(){if(Ll)return us;Ll=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#"+"langString",t="http://www.w3.org/2001/XMLSchema#string",n="NamedNode",i="BlankNode",s="Literal",a="DefaultGraph",o={};(()=>{const y="(?:<([^:]+:[^>]*)>)",E="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�"+"_",v=E+"0-9-·̀-ͯ‿-⁀",S="(_:(?:["+E+"0-9])(?:(?:["+v+".])*(?:["+v+"]))?)",m='"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"',h="(?:\\^\\^"+y+")",N="(?:"+m+"(?:"+h+"|"+"(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*))"+")?)",C="[ \\t]+",A="[ \\t]*",B="(?:"+y+"|"+S+")"+C,R=y+C,F="(?:"+y+"|"+S+"|"+N+")"+A,q="(?:\\.|(?:(?:"+y+"|"+S+")"+A+"\\.))";o.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,o.empty=new RegExp("^"+A+"$"),o.quad=new RegExp("^"+A+B+R+F+q+A+"$")})(),us=class ei{static parse(_){const E=[],v={},x=_.split(o.eoln);let S=0;for(const m of x){if(S++,o.empty.test(m))continue;const h=m.match(o.quad);if(h===null)throw new Error("N-Quads parse error on line "+S+".");const g={subject:null,predicate:null,object:null,graph:null};if(h[1]!==void 0?g.subject={termType:n,value:h[1]}:g.subject={termType:i,value:h[2]},g.predicate={termType:n,value:h[3]},h[4]!==void 0?g.object={termType:n,value:h[4]}:h[5]!==void 0?g.object={termType:i,value:h[5]}:(g.object={termType:s,value:void 0,datatype:{termType:n}},h[7]!==void 0?g.object.datatype.value=h[7]:h[8]!==void 0?(g.object.datatype.value=e,g.object.language=h[8]):g.object.datatype.value=t,g.object.value=b(h[6])),h[9]!==void 0?g.graph={termType:n,value:h[9]}:h[10]!==void 0?g.graph={termType:i,value:h[10]}:g.graph={termType:a,value:""},!(g.graph.value in v))v[g.graph.value]=[g],E.push(g);else{let N=!0;const C=v[g.graph.value];for(const A of C)if(u(A,g)){N=!1;break}N&&(C.push(g),E.push(g))}}return E}static serialize(_){Array.isArray(_)||(_=ei.legacyDatasetToQuads(_));const E=[];for(const v of _)E.push(ei.serializeQuad(v));return E.sort().join("")}static serializeQuadComponents(_,E,v,x){let S="";return _.termType===n?S+=`<${_.value}>`:S+=`${_.value}`,S+=` <${E.value}> `,v.termType===n?S+=`<${v.value}>`:v.termType===i?S+=v.value:(S+=`"${c(v.value)}"`,v.datatype.value===e?v.language&&(S+=`@${v.language}`):v.datatype.value!==t&&(S+=`^^<${v.datatype.value}>`)),x.termType===n?S+=` <${x.value}>`:x.termType===i&&(S+=` ${x.value}`),S+=` .
344
+ `,S}static serializeQuad(_){return ei.serializeQuadComponents(_.subject,_.predicate,_.object,_.graph)}static legacyDatasetToQuads(_){const E=[],v={"blank node":i,IRI:n,literal:s};for(const x in _)_[x].forEach(m=>{const h={};for(const g in m){const N=m[g],C={termType:v[N.type],value:N.value};C.termType===s&&(C.datatype={termType:n},"datatype"in N&&(C.datatype.value=N.datatype),"language"in N?("datatype"in N||(C.datatype.value=e),C.language=N.language):"datatype"in N||(C.datatype.value=t)),h[g]=C}x==="@default"?h.graph={termType:a,value:""}:h.graph={termType:x.startsWith("_:")?i:n,value:x},E.push(h)});return E}};function u(y,_){return!(y.subject.termType===_.subject.termType&&y.object.termType===_.object.termType)||!(y.subject.value===_.subject.value&&y.predicate.value===_.predicate.value&&y.object.value===_.object.value)?!1:y.object.termType!==s?!0:y.object.datatype.termType===_.object.datatype.termType&&y.object.language===_.object.language&&y.object.datatype.value===_.object.datatype.value}const l=/["\\\n\r]/g;function c(y){return y.replace(l,function(_){switch(_){case'"':return'\\"';case"\\":return"\\\\";case`
345
+ `:return"\\n";case"\r":return"\\r"}})}const d=/(?:\\([tbnrf"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function b(y){return y.replace(d,function(_,E,v,x){if(E)switch(E){case"t":return" ";case"b":return"\b";case"n":return`
346
+ `;case"r":return"\r";case"f":return"\f";case'"':return'"';case"'":return"'";case"\\":return"\\"}if(v)return String.fromCharCode(parseInt(v,16));if(x)throw new Error("Unsupported U escape")})}return us}/*!
347
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
348
+ */var cs,Ol;function Gc(){if(Ol)return cs;Ol=1;const r=Ua(),e=bi(),t=Vc(),n=Ha();cs=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:u=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=u,this.quads=null,this.deepIterations=null}async main(a){this.deepIterations=new Map,this.quads=a;for(const y of a)this._addBlankNodeQuadInfo({quad:y,component:y.subject}),this._addBlankNodeQuadInfo({quad:y,component:y.object}),this._addBlankNodeQuadInfo({quad:y,component:y.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];let l=0;for(const y of u)++l%100===0&&await this._yield(),await this._hashAndTrackBlankNode({id:y,hashToBlankNodes:o});const c=[...o.keys()].sort(),d=[];for(const y of c){const _=o.get(y);if(_.length>1){d.push(_);continue}const E=_[0];this.canonicalIssuer.getId(E)}for(const y of d){const _=[];for(const E of y){if(this.canonicalIssuer.hasId(E))continue;const v=new r("_:b");v.getId(E);const x=await this.hashNDegreeQuads(E,v);_.push(x)}_.sort(i);for(const E of _){const v=E.issuer.getOldIds();for(const x of v)this.canonicalIssuer.getId(x)}}const b=[];for(const y of this.quads){const _=n.serializeQuadComponents(this._componentWithCanonicalId(y.subject),y.predicate,this._componentWithCanonicalId(y.object),this._componentWithCanonicalId(y.graph));b.push(_)}return b.sort(),b.join("")}async hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const d of l){const b={subject:null,predicate:d.predicate,object:null,graph:null};b.subject=this.modifyFirstDegreeComponent(a,d.subject,"subject"),b.object=this.modifyFirstDegreeComponent(a,d.object,"object"),b.graph=this.modifyFirstDegreeComponent(a,d.graph,"graph"),o.push(n.serializeQuad(b))}o.sort();const c=this.createMessageDigest();for(const d of o)c.update(d);return u.hash=await c.digest(),u.hash}async hashRelatedBlankNode(a,o,u,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):u.hasId(a)?c=u.getId(a):c=this.blankNodeInfo.get(a).hash;const d=this.createMessageDigest();return d.update(l),l!=="g"&&d.update(this.getRelatedPredicate(o)),d.update(c),d.digest()}async hashNDegreeQuads(a,o){const u=this.deepIterations.get(a)||0;if(u>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,u+1);const l=this.createMessageDigest(),c=await this.createHashToRelated(a,o),d=[...c.keys()].sort();for(const b of d){l.update(b);let y="",_;const E=new t(c.get(b));let v=0;for(;E.hasNext();){const x=E.next();++v%3===0&&await this._yield();let S=o.clone(),m="";const h=[];let g=!1;for(const N of x)if(this.canonicalIssuer.hasId(N)?m+=this.canonicalIssuer.getId(N):(S.hasId(N)||h.push(N),m+=S.getId(N)),y.length!==0&&m>y){g=!0;break}if(!g){for(const N of h){const C=await this.hashNDegreeQuads(N,S);if(m+=S.getId(N),m+=`<${C.hash}>`,S=C.issuer,y.length!==0&&m>y){g=!0;break}}g||(y.length===0||m<y)&&(y=m,_=S)}}l.update(y),o=_}return{hash:await l.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}async createHashToRelated(a,o){const u=new Map,l=this.blankNodeInfo.get(a).quads;let c=0;for(const d of l)++c%100===0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:d,component:d.subject,position:"s",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:d,component:d.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:d,component:d.graph,position:"g",id:a,issuer:o,hashToRelated:u})]);return u}async _hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const u=await this.hashFirstDegreeQuads(a),l=o.get(u);l?l.push(a):o.set(u,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const u=o.value,l=this.blankNodeInfo.get(u);l?l.quads.add(a):this.blankNodeInfo.set(u,{quads:new Set([a]),hash:null})}async _addRelatedBlankNodeHash({quad:a,component:o,position:u,id:l,issuer:c,hashToRelated:d}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const b=o.value,y=await this.hashRelatedBlankNode(b,a,c,u),_=d.get(y);_?_.push(b):d.set(y,[b])}_componentWithCanonicalId(a){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}async _yield(){return new Promise(a=>setImmediate(a))}};function i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return cs}/*!
349
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
350
+ */var ds,Cl;function Cf(){if(Cl)return ds;Cl=1;const r=bi(),e=Gc();return ds=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}async createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;let o=0;for(const u of a){let l,c;if(u.subject.termType==="BlankNode"&&u.subject.value!==n)c=u.subject.value,l="p";else if(u.object.termType==="BlankNode"&&u.object.value!==n)c=u.object.value,l="r";else continue;++o%100===0&&await this._yield();const d=await this.hashRelatedBlankNode(c,u,i,l),b=s.get(d);b?b.push(c):s.set(d,[c])}return s}},ds}/*!
351
+ * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
352
+ */var hs,jl;function Wc(){if(jl)return hs;jl=1;const r=Ua(),e=bi(),t=Vc(),n=Ha();hs=class{constructor({createMessageDigest:a=()=>new e("sha256"),canonicalIdMap:o=new Map,maxDeepIterations:u=1/0}={}){this.name="URDNA2015",this.blankNodeInfo=new Map,this.canonicalIssuer=new r("_:c14n",o),this.createMessageDigest=a,this.maxDeepIterations=u,this.quads=null,this.deepIterations=null}main(a){this.deepIterations=new Map,this.quads=a;for(const b of a)this._addBlankNodeQuadInfo({quad:b,component:b.subject}),this._addBlankNodeQuadInfo({quad:b,component:b.object}),this._addBlankNodeQuadInfo({quad:b,component:b.graph});const o=new Map,u=[...this.blankNodeInfo.keys()];for(const b of u)this._hashAndTrackBlankNode({id:b,hashToBlankNodes:o});const l=[...o.keys()].sort(),c=[];for(const b of l){const y=o.get(b);if(y.length>1){c.push(y);continue}const _=y[0];this.canonicalIssuer.getId(_)}for(const b of c){const y=[];for(const _ of b){if(this.canonicalIssuer.hasId(_))continue;const E=new r("_:b");E.getId(_);const v=this.hashNDegreeQuads(_,E);y.push(v)}y.sort(i);for(const _ of y){const E=_.issuer.getOldIds();for(const v of E)this.canonicalIssuer.getId(v)}}const d=[];for(const b of this.quads){const y=n.serializeQuadComponents(this._componentWithCanonicalId({component:b.subject}),b.predicate,this._componentWithCanonicalId({component:b.object}),this._componentWithCanonicalId({component:b.graph}));d.push(y)}return d.sort(),d.join("")}hashFirstDegreeQuads(a){const o=[],u=this.blankNodeInfo.get(a),l=u.quads;for(const d of l){const b={subject:null,predicate:d.predicate,object:null,graph:null};b.subject=this.modifyFirstDegreeComponent(a,d.subject,"subject"),b.object=this.modifyFirstDegreeComponent(a,d.object,"object"),b.graph=this.modifyFirstDegreeComponent(a,d.graph,"graph"),o.push(n.serializeQuad(b))}o.sort();const c=this.createMessageDigest();for(const d of o)c.update(d);return u.hash=c.digest(),u.hash}hashRelatedBlankNode(a,o,u,l){let c;this.canonicalIssuer.hasId(a)?c=this.canonicalIssuer.getId(a):u.hasId(a)?c=u.getId(a):c=this.blankNodeInfo.get(a).hash;const d=this.createMessageDigest();return d.update(l),l!=="g"&&d.update(this.getRelatedPredicate(o)),d.update(c),d.digest()}hashNDegreeQuads(a,o){const u=this.deepIterations.get(a)||0;if(u>this.maxDeepIterations)throw new Error(`Maximum deep iterations (${this.maxDeepIterations}) exceeded.`);this.deepIterations.set(a,u+1);const l=this.createMessageDigest(),c=this.createHashToRelated(a,o),d=[...c.keys()].sort();for(const b of d){l.update(b);let y="",_;const E=new t(c.get(b));for(;E.hasNext();){const v=E.next();let x=o.clone(),S="";const m=[];let h=!1;for(const g of v)if(this.canonicalIssuer.hasId(g)?S+=this.canonicalIssuer.getId(g):(x.hasId(g)||m.push(g),S+=x.getId(g)),y.length!==0&&S>y){h=!0;break}if(!h){for(const g of m){const N=this.hashNDegreeQuads(g,x);if(S+=x.getId(g),S+=`<${N.hash}>`,x=N.issuer,y.length!==0&&S>y){h=!0;break}}h||(y.length===0||S<y)&&(y=S,_=x)}}l.update(y),o=_}return{hash:l.digest(),issuer:o}}modifyFirstDegreeComponent(a,o){return o.termType!=="BlankNode"?o:{termType:"BlankNode",value:o.value===a?"_:a":"_:z"}}getRelatedPredicate(a){return`<${a.predicate.value}>`}createHashToRelated(a,o){const u=new Map,l=this.blankNodeInfo.get(a).quads;for(const c of l)this._addRelatedBlankNodeHash({quad:c,component:c.subject,position:"s",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:c,component:c.object,position:"o",id:a,issuer:o,hashToRelated:u}),this._addRelatedBlankNodeHash({quad:c,component:c.graph,position:"g",id:a,issuer:o,hashToRelated:u});return u}_hashAndTrackBlankNode({id:a,hashToBlankNodes:o}){const u=this.hashFirstDegreeQuads(a),l=o.get(u);l?l.push(a):o.set(u,[a])}_addBlankNodeQuadInfo({quad:a,component:o}){if(o.termType!=="BlankNode")return;const u=o.value,l=this.blankNodeInfo.get(u);l?l.quads.add(a):this.blankNodeInfo.set(u,{quads:new Set([a]),hash:null})}_addRelatedBlankNodeHash({quad:a,component:o,position:u,id:l,issuer:c,hashToRelated:d}){if(!(o.termType==="BlankNode"&&o.value!==l))return;const b=o.value,y=this.hashRelatedBlankNode(b,a,c,u),_=d.get(y);_?_.push(b):d.set(y,[b])}_componentWithCanonicalId({component:a}){return a.termType==="BlankNode"&&!a.value.startsWith(this.canonicalIssuer.prefix)?{termType:"BlankNode",value:this.canonicalIssuer.getId(a.value)}:a}};function i(s,a){return s.hash<a.hash?-1:s.hash>a.hash?1:0}return hs}/*!
353
+ * Copyright (c) 2016-2021 Digital Bazaar, Inc. All rights reserved.
354
+ */var fs,$l;function jf(){if($l)return fs;$l=1;const r=bi(),e=Wc();return fs=class extends e{constructor(){super(),this.name="URGNA2012",this.createMessageDigest=()=>new r("sha1")}modifyFirstDegreeComponent(n,i,s){return i.termType!=="BlankNode"?i:s==="graph"?{termType:"BlankNode",value:"_:g"}:{termType:"BlankNode",value:i.value===n?"_:a":"_:z"}}getRelatedPredicate(n){return n.predicate.value}createHashToRelated(n,i){const s=new Map,a=this.blankNodeInfo.get(n).quads;for(const o of a){let u,l;if(o.subject.termType==="BlankNode"&&o.subject.value!==n)l=o.subject.value,u="p";else if(o.object.termType==="BlankNode"&&o.object.value!==n)l=o.object.value,u="r";else continue;const c=this.hashRelatedBlankNode(l,o,i,u),d=s.get(c);d?d.push(l):s.set(c,[l])}return s}},fs}const $f={},Ff=Object.freeze(Object.defineProperty({__proto__:null,default:$f},Symbol.toStringTag,{value:"Module"})),kf=ld(Ff);var Fl;function Pf(){return Fl||(Fl=1,(function(r){const e=Gc(),t=Cf(),n=Wc(),i=jf();let s;try{s=kf}catch{}function a(o){return Array.isArray(o)?o:r.NQuads.legacyDatasetToQuads(o)}r.NQuads=Ha(),r.IdentifierIssuer=Ua(),r._rdfCanonizeNative=function(o){return o&&(s=o),s},r.canonize=async function(o,u){const l=a(o);if(u.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return new Promise((c,d)=>s.canonize(l,u,(b,y)=>b?d(b):c(y)))}if(u.algorithm==="URDNA2015")return new e(u).main(l);if(u.algorithm==="URGNA2012"){if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new t(u).main(l)}throw"algorithm"in u?new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")},r._canonizeSync=function(o,u){const l=a(o);if(u.useNative){if(!s)throw new Error("rdf-canonize-native not available");if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "useNative".');return s.canonizeSync(l,u)}if(u.algorithm==="URDNA2015")return new n(u).main(l);if(u.algorithm==="URGNA2012"){if(u.createMessageDigest)throw new Error('"createMessageDigest" cannot be used with "URGNA2012".');return new i(u).main(l)}throw"algorithm"in u?new Error("Invalid RDF Dataset Canonicalization algorithm: "+u.algorithm):new Error("No RDF Dataset Canonicalization algorithm specified.")}})(is)),is}var ps,kl;function Va(){return kl||(kl=1,ps=Pf()),ps}var gs,Pl;function dt(){if(Pl)return gs;Pl=1;const r={};return gs=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",gs}var ms,Ml;function Pt(){if(Ml)return ms;Ml=1;const r=dt(),e={};return ms=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},ms}var ys,Bl;function pt(){return Bl||(Bl=1,ys=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}}),ys}var bs,ql;function ht(){if(ql)return bs;ql=1;const r=Pt(),e=dt(),t=Va().IdentifierIssuer,n=pt(),i=/^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/,s=/(?:<[^>]*?>|"[^"]*?"|[^,])+/g,a=/\s*<([^>]*?)>\s*(?:;\s*(.*))?/,o=/(.*?)=(?:(?:"([^"]*?)")|([^"]*?))\s*(?:(?:;\s*)|$)/g,u=/^@[a-zA-Z]+$/,l={headers:{accept:"application/ld+json, application/json"}},c={};bs=c,c.IdentifierIssuer=t,c.REGEX_BCP47=i,c.REGEX_KEYWORD=u,c.clone=function(b){if(b&&typeof b=="object"){let y;if(e.isArray(b)){y=[];for(let _=0;_<b.length;++_)y[_]=c.clone(b[_])}else if(b instanceof Map){y=new Map;for(const[_,E]of b)y.set(_,c.clone(E))}else if(b instanceof Set){y=new Set;for(const _ of b)y.add(c.clone(_))}else if(e.isObject(b)){y={};for(const _ in b)y[_]=c.clone(b[_])}else y=b.toString();return y}return b},c.asArray=function(b){return Array.isArray(b)?b:[b]},c.buildHeaders=(b={})=>{if(Object.keys(b).some(_=>_.toLowerCase()==="accept"))throw new RangeError('Accept header may not be specified; only "'+l.headers.accept+'" is supported.');return Object.assign({Accept:l.headers.accept},b)},c.parseLinkHeader=b=>{const y={},_=b.match(s);for(let E=0;E<_.length;++E){let v=_[E].match(a);if(!v)continue;const x={target:v[1]},S=v[2];for(;v=o.exec(S);)x[v[1]]=v[2]===void 0?v[3]:v[2];const m=x.rel||"";Array.isArray(y[m])?y[m].push(x):y.hasOwnProperty(m)?y[m]=[y[m],x]:y[m]=x}return y},c.validateTypeValue=(b,y)=>{if(!e.isString(b)&&!(e.isArray(b)&&b.every(_=>e.isString(_)))){if(y&&e.isObject(b))switch(Object.keys(b).length){case 0:return;case 1:if("@default"in b&&c.asArray(b["@default"]).every(_=>e.isString(_)))return}throw new n('Invalid JSON-LD syntax; "@type" value must a string, an array of strings, an empty object, or a default object.',"jsonld.SyntaxError",{code:"invalid type value",value:b})}},c.hasProperty=(b,y)=>{if(b.hasOwnProperty(y)){const _=b[y];return!e.isArray(_)||_.length>0}return!1},c.hasValue=(b,y,_)=>{if(c.hasProperty(b,y)){let E=b[y];const v=r.isList(E);if(e.isArray(E)||v){v&&(E=E["@list"]);for(let x=0;x<E.length;++x)if(c.compareValues(_,E[x]))return!0}else if(!e.isArray(_))return c.compareValues(_,E)}return!1},c.addValue=(b,y,_,E)=>{if(E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1),"valueIsArray"in E||(E.valueIsArray=!1),"allowDuplicate"in E||(E.allowDuplicate=!0),"prependValue"in E||(E.prependValue=!1),E.valueIsArray)b[y]=_;else if(e.isArray(_)){_.length===0&&E.propertyIsArray&&!b.hasOwnProperty(y)&&(b[y]=[]),E.prependValue&&(_=_.concat(b[y]),b[y]=[]);for(let v=0;v<_.length;++v)c.addValue(b,y,_[v],E)}else if(b.hasOwnProperty(y)){const v=!E.allowDuplicate&&c.hasValue(b,y,_);!e.isArray(b[y])&&(!v||E.propertyIsArray)&&(b[y]=[b[y]]),v||(E.prependValue?b[y].unshift(_):b[y].push(_))}else b[y]=E.propertyIsArray?[_]:_},c.getValues=(b,y)=>[].concat(b[y]||[]),c.removeProperty=(b,y)=>{delete b[y]},c.removeValue=(b,y,_,E)=>{E=E||{},"propertyIsArray"in E||(E.propertyIsArray=!1);const v=c.getValues(b,y).filter(x=>!c.compareValues(x,_));v.length===0?c.removeProperty(b,y):v.length===1&&!E.propertyIsArray?b[y]=v[0]:b[y]=v},c.relabelBlankNodes=(b,y)=>{y=y||{};const _=y.issuer||new t("_:b");return d(_,b)},c.compareValues=(b,y)=>b===y||r.isValue(b)&&r.isValue(y)&&b["@value"]===y["@value"]&&b["@type"]===y["@type"]&&b["@language"]===y["@language"]&&b["@index"]===y["@index"]?!0:e.isObject(b)&&"@id"in b&&e.isObject(y)&&"@id"in y?b["@id"]===y["@id"]:!1,c.compareShortestLeast=(b,y)=>b.length<y.length?-1:y.length<b.length?1:b===y?0:b<y?-1:1;function d(b,y){if(e.isArray(y))for(let _=0;_<y.length;++_)y[_]=d(b,y[_]);else if(r.isList(y))y["@list"]=d(b,y["@list"]);else if(e.isObject(y)){r.isBlankNode(y)&&(y["@id"]=b.getId(y["@id"]));const _=Object.keys(y).sort();for(let E=0;E<_.length;++E){const v=_[E];v!=="@id"&&(y[v]=d(b,y[v]))}}return y}return bs}var _s,Ul;function Ga(){if(Ul)return _s;Ul=1;const r="http://www.w3.org/1999/02/22-rdf-syntax-ns#",e="http://www.w3.org/2001/XMLSchema#";return _s={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"},_s}var ws,Hl;function zc(){return Hl||(Hl=1,ws=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]}}}),ws}var vs,Vl;function Jt(){if(Vl)return vs;Vl=1;const r=dt(),e={};vs=e,e.parsers={simple:{keys:["href","scheme","authority","path","query","fragment"],regex:/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/},full:{keys:["href","protocol","scheme","authority","auth","user","password","hostname","port","path","directory","file","query","fragment"],regex:/^(([a-zA-Z][a-zA-Z0-9+-.]*):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?(?:(((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/}},e.parse=(n,i)=>{const s={},a=e.parsers[i||"full"],o=a.regex.exec(n);let u=a.keys.length;for(;u--;)s[a.keys[u]]=o[u]===void 0?null:o[u];return(s.scheme==="https"&&s.port==="443"||s.scheme==="http"&&s.port==="80")&&(s.href=s.href.replace(":"+s.port,""),s.authority=s.authority.replace(":"+s.port,""),s.port=null),s.normalizedPath=e.removeDotSegments(s.path),s},e.prependBase=(n,i)=>{if(n===null||e.isAbsolute(i))return i;(!n||r.isString(n))&&(n=e.parse(n||""));const s=e.parse(i),a={protocol:n.protocol||""};if(s.authority!==null)a.authority=s.authority,a.path=s.path,a.query=s.query;else if(a.authority=n.authority,s.path==="")a.path=n.path,s.query!==null?a.query=s.query:a.query=n.query;else{if(s.path.indexOf("/")===0)a.path=s.path;else{let u=n.path;u=u.substr(0,u.lastIndexOf("/")+1),(u.length>0||n.authority)&&u.substr(-1)!=="/"&&(u+="/"),u+=s.path,a.path=u}a.query=s.query}s.path!==""&&(a.path=e.removeDotSegments(a.path));let o=a.protocol;return a.authority!==null&&(o+="//"+a.authority),o+=a.path,a.query!==null&&(o+="?"+a.query),s.fragment!==null&&(o+="#"+s.fragment),o===""&&(o="./"),o},e.removeBase=(n,i)=>{if(n===null)return i;(!n||r.isString(n))&&(n=e.parse(n||""));let s="";if(n.href!==""?s+=(n.protocol||"")+"//"+(n.authority||""):i.indexOf("//")&&(s+="//"),i.indexOf(s)!==0)return i;const a=e.parse(i.substr(s.length)),o=n.normalizedPath.split("/"),u=a.normalizedPath.split("/"),l=a.fragment||a.query?0:1;for(;o.length>0&&u.length>l&&o[0]===u[0];)o.shift(),u.shift();let c="";if(o.length>0){o.pop();for(let d=0;d<o.length;++d)c+="../"}return c+=u.join("/"),a.query!==null&&(c+="?"+a.query),a.fragment!==null&&(c+="#"+a.fragment),c===""&&(c="./"),c},e.removeDotSegments=n=>{if(n.length===0)return"";const i=n.split("/"),s=[];for(;i.length>0;){const a=i.shift(),o=i.length===0;if(a==="."){o&&s.push("");continue}if(a===".."){s.pop(),o&&s.push("");continue}s.push(a)}return n[0]==="/"&&s.length>0&&s[0]!==""&&s.unshift(""),s.length===1&&s[0]===""?"/":s.join("/")};const t=/^([A-Za-z][A-Za-z0-9+-.]*|_):[^\s]*$/;return e.isAbsolute=n=>r.isString(n)&&t.test(n),e.isRelative=n=>r.isString(n),vs}var xs,Gl;function Mf(){if(Gl)return xs;Gl=1;const{parseLinkHeader:r,buildHeaders:e}=ht(),{LINK_HEADER_CONTEXT:t}=Ga(),n=pt(),i=zc(),{prependBase:s}=Jt(),a=/(^|(\r\n))link:/i;xs=({secure:u,headers:l={},xhr:c}={headers:{}})=>{return l=e(l),new i().wrapLoader(b);async function b(y){if(y.indexOf("http:")!==0&&y.indexOf("https:")!==0)throw new n('URL could not be dereferenced; only "http" and "https" URLs are supported.',"jsonld.InvalidUrl",{code:"loading document failed",url:y});if(u&&y.indexOf("https")!==0)throw new n(`URL could not be dereferenced; secure mode is enabled and the URL's scheme is not "https".`,"jsonld.InvalidUrl",{code:"loading document failed",url:y});let _;try{_=await o(c,y,l)}catch(m){throw new n("URL could not be dereferenced, an error occurred.","jsonld.LoadDocumentError",{code:"loading document failed",url:y,cause:m})}if(_.status>=400)throw new n("URL could not be dereferenced: "+_.statusText,"jsonld.LoadDocumentError",{code:"loading document failed",url:y,httpStatusCode:_.status});let E={contextUrl:null,documentUrl:y,document:_.response},v=null;const x=_.getResponseHeader("Content-Type");let S;if(a.test(_.getAllResponseHeaders())&&(S=_.getResponseHeader("Link")),S&&x!=="application/ld+json"){const m=r(S),h=m[t];if(Array.isArray(h))throw new n("URL could not be dereferenced, it has more than one associated HTTP Link Header.","jsonld.InvalidUrl",{code:"multiple context link headers",url:y});h&&(E.contextUrl=h.target),v=m.alternate,v&&v.type=="application/ld+json"&&!(x||"").match(/^application\/(\w*\+)?json$/)&&(E=await b(s(y,v.target)))}return E}};function o(u,l,c){u=u||XMLHttpRequest;const d=new u;return new Promise((b,y)=>{d.onload=()=>b(d),d.onerror=_=>y(_),d.open("GET",l,!0);for(const _ in c)d.setRequestHeader(_,c[_]);d.send()})}return xs}var Es,Wl;function Bf(){if(Wl)return Es;Wl=1;const r=Mf(),e={};return Es=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})},Es}var Ss,zl;function qf(){return zl||(zl=1,Ss=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Ss}var Is,Ql;function Uf(){if(Ql)return Is;Ql=1,Is=r,r.Node=i,r.create=r;function r(s){var a=this;if(a instanceof r||(a=new r),a.tail=null,a.head=null,a.length=0,s&&typeof s.forEach=="function")s.forEach(function(l){a.push(l)});else if(arguments.length>0)for(var o=0,u=arguments.length;o<u;o++)a.push(arguments[o]);return a}r.prototype.removeNode=function(s){if(s.list!==this)throw new Error("removing node which does not belong to this list");var a=s.next,o=s.prev;return a&&(a.prev=o),o&&(o.next=a),s===this.head&&(this.head=a),s===this.tail&&(this.tail=o),s.list.length--,s.next=null,s.prev=null,s.list=null,a},r.prototype.unshiftNode=function(s){if(s!==this.head){s.list&&s.list.removeNode(s);var a=this.head;s.list=this,s.next=a,a&&(a.prev=s),this.head=s,this.tail||(this.tail=s),this.length++}},r.prototype.pushNode=function(s){if(s!==this.tail){s.list&&s.list.removeNode(s);var a=this.tail;s.list=this,s.prev=a,a&&(a.next=s),this.tail=s,this.head||(this.head=s),this.length++}},r.prototype.push=function(){for(var s=0,a=arguments.length;s<a;s++)t(this,arguments[s]);return this.length},r.prototype.unshift=function(){for(var s=0,a=arguments.length;s<a;s++)n(this,arguments[s]);return this.length},r.prototype.pop=function(){if(this.tail){var s=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,s}},r.prototype.shift=function(){if(this.head){var s=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,s}},r.prototype.forEach=function(s,a){a=a||this;for(var o=this.head,u=0;o!==null;u++)s.call(a,o.value,u,this),o=o.next},r.prototype.forEachReverse=function(s,a){a=a||this;for(var o=this.tail,u=this.length-1;o!==null;u--)s.call(a,o.value,u,this),o=o.prev},r.prototype.get=function(s){for(var a=0,o=this.head;o!==null&&a<s;a++)o=o.next;if(a===s&&o!==null)return o.value},r.prototype.getReverse=function(s){for(var a=0,o=this.tail;o!==null&&a<s;a++)o=o.prev;if(a===s&&o!==null)return o.value},r.prototype.map=function(s,a){a=a||this;for(var o=new r,u=this.head;u!==null;)o.push(s.call(a,u.value,this)),u=u.next;return o},r.prototype.mapReverse=function(s,a){a=a||this;for(var o=new r,u=this.tail;u!==null;)o.push(s.call(a,u.value,this)),u=u.prev;return o},r.prototype.reduce=function(s,a){var o,u=this.head;if(arguments.length>1)o=a;else if(this.head)u=this.head.next,o=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=0;u!==null;l++)o=s(o,u.value,l),u=u.next;return o},r.prototype.reduceReverse=function(s,a){var o,u=this.tail;if(arguments.length>1)o=a;else if(this.tail)u=this.tail.prev,o=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var l=this.length-1;u!==null;l--)o=s(o,u.value,l),u=u.prev;return o},r.prototype.toArray=function(){for(var s=new Array(this.length),a=0,o=this.head;o!==null;a++)s[a]=o.value,o=o.next;return s},r.prototype.toArrayReverse=function(){for(var s=new Array(this.length),a=0,o=this.tail;o!==null;a++)s[a]=o.value,o=o.prev;return s},r.prototype.slice=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var u=0,l=this.head;l!==null&&u<s;u++)l=l.next;for(;l!==null&&u<a;u++,l=l.next)o.push(l.value);return o},r.prototype.sliceReverse=function(s,a){a=a||this.length,a<0&&(a+=this.length),s=s||0,s<0&&(s+=this.length);var o=new r;if(a<s||a<0)return o;s<0&&(s=0),a>this.length&&(a=this.length);for(var u=this.length,l=this.tail;l!==null&&u>a;u--)l=l.prev;for(;l!==null&&u>s;u--,l=l.prev)o.push(l.value);return o},r.prototype.splice=function(s,a,...o){s>this.length&&(s=this.length-1),s<0&&(s=this.length+s);for(var u=0,l=this.head;l!==null&&u<s;u++)l=l.next;for(var c=[],u=0;l&&u<a;u++)c.push(l.value),l=this.removeNode(l);l===null&&(l=this.tail),l!==this.head&&l!==this.tail&&(l=l.prev);for(var u=0;u<o.length;u++)l=e(this,l,o[u]);return c},r.prototype.reverse=function(){for(var s=this.head,a=this.tail,o=s;o!==null;o=o.prev){var u=o.prev;o.prev=o.next,o.next=u}return this.head=a,this.tail=s,this};function e(s,a,o){var u=a===s.head?new i(o,null,a,s):new i(o,a,a.next,s);return u.next===null&&(s.tail=u),u.prev===null&&(s.head=u),s.length++,u}function t(s,a){s.tail=new i(a,s.tail,null,s),s.head||(s.head=s.tail),s.length++}function n(s,a){s.head=new i(a,null,s.head,s),s.tail||(s.tail=s.head),s.length++}function i(s,a,o,u){if(!(this instanceof i))return new i(s,a,o,u);this.list=u,this.value=s,a?(a.next=this,this.prev=a):this.prev=null,o?(o.prev=this,this.next=o):this.next=null}try{qf()(r)}catch{}return Is}var Ns,Xl;function Qc(){if(Xl)return Ns;Xl=1;const r=Uf(),e=Symbol("max"),t=Symbol("length"),n=Symbol("lengthCalculator"),i=Symbol("allowStale"),s=Symbol("maxAge"),a=Symbol("dispose"),o=Symbol("noDisposeOnSet"),u=Symbol("lruList"),l=Symbol("cache"),c=Symbol("updateAgeOnGet"),d=()=>1;class b{constructor(h){if(typeof h=="number"&&(h={max:h}),h||(h={}),h.max&&(typeof h.max!="number"||h.max<0))throw new TypeError("max must be a non-negative number");this[e]=h.max||1/0;const g=h.length||d;if(this[n]=typeof g!="function"?d:g,this[i]=h.stale||!1,h.maxAge&&typeof h.maxAge!="number")throw new TypeError("maxAge must be a number");this[s]=h.maxAge||0,this[a]=h.dispose,this[o]=h.noDisposeOnSet||!1,this[c]=h.updateAgeOnGet||!1,this.reset()}set max(h){if(typeof h!="number"||h<0)throw new TypeError("max must be a non-negative number");this[e]=h||1/0,E(this)}get max(){return this[e]}set allowStale(h){this[i]=!!h}get allowStale(){return this[i]}set maxAge(h){if(typeof h!="number")throw new TypeError("maxAge must be a non-negative number");this[s]=h,E(this)}get maxAge(){return this[s]}set lengthCalculator(h){typeof h!="function"&&(h=d),h!==this[n]&&(this[n]=h,this[t]=0,this[u].forEach(g=>{g.length=this[n](g.value,g.key),this[t]+=g.length})),E(this)}get lengthCalculator(){return this[n]}get length(){return this[t]}get itemCount(){return this[u].length}rforEach(h,g){g=g||this;for(let N=this[u].tail;N!==null;){const C=N.prev;S(this,h,N,g),N=C}}forEach(h,g){g=g||this;for(let N=this[u].head;N!==null;){const C=N.next;S(this,h,N,g),N=C}}keys(){return this[u].toArray().map(h=>h.key)}values(){return this[u].toArray().map(h=>h.value)}reset(){this[a]&&this[u]&&this[u].length&&this[u].forEach(h=>this[a](h.key,h.value)),this[l]=new Map,this[u]=new r,this[t]=0}dump(){return this[u].map(h=>_(this,h)?!1:{k:h.key,v:h.value,e:h.now+(h.maxAge||0)}).toArray().filter(h=>h)}dumpLru(){return this[u]}set(h,g,N){if(N=N||this[s],N&&typeof N!="number")throw new TypeError("maxAge must be a number");const C=N?Date.now():0,A=this[n](g,h);if(this[l].has(h)){if(A>this[e])return v(this,this[l].get(h)),!1;const F=this[l].get(h).value;return this[a]&&(this[o]||this[a](h,F.value)),F.now=C,F.maxAge=N,F.value=g,this[t]+=A-F.length,F.length=A,this.get(h),E(this),!0}const B=new x(h,g,A,C,N);return B.length>this[e]?(this[a]&&this[a](h,g),!1):(this[t]+=B.length,this[u].unshift(B),this[l].set(h,this[u].head),E(this),!0)}has(h){if(!this[l].has(h))return!1;const g=this[l].get(h).value;return!_(this,g)}get(h){return y(this,h,!0)}peek(h){return y(this,h,!1)}pop(){const h=this[u].tail;return h?(v(this,h),h.value):null}del(h){v(this,this[l].get(h))}load(h){this.reset();const g=Date.now();for(let N=h.length-1;N>=0;N--){const C=h[N],A=C.e||0;if(A===0)this.set(C.k,C.v);else{const B=A-g;B>0&&this.set(C.k,C.v,B)}}}prune(){this[l].forEach((h,g)=>y(this,g,!1))}}const y=(m,h,g)=>{const N=m[l].get(h);if(N){const C=N.value;if(_(m,C)){if(v(m,N),!m[i])return}else g&&(m[c]&&(N.value.now=Date.now()),m[u].unshiftNode(N));return C.value}},_=(m,h)=>{if(!h||!h.maxAge&&!m[s])return!1;const g=Date.now()-h.now;return h.maxAge?g>h.maxAge:m[s]&&g>m[s]},E=m=>{if(m[t]>m[e])for(let h=m[u].tail;m[t]>m[e]&&h!==null;){const g=h.prev;v(m,h),h=g}},v=(m,h)=>{if(h){const g=h.value;m[a]&&m[a](g.key,g.value),m[t]-=g.length,m[l].delete(g.key),m[u].removeNode(h)}};class x{constructor(h,g,N,C,A){this.key=h,this.value=g,this.length=N,this.now=C,this.maxAge=A||0}}const S=(m,h,g,N)=>{let C=g.value;_(m,C)&&(v(m,g),m[i]||(C=void 0)),C&&h.call(N,C.value,C.key,m)};return Ns=b,Ns}var Rs,Jl;function Hf(){if(Jl)return Rs;Jl=1;const r=Qc(),e=10;return Rs=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)}},Rs}var Ts,Kl;function Vf(){if(Kl)return Ts;Kl=1;const{isArray:r,isObject:e,isString:t}=dt(),{asArray:n}=ht(),{prependBase:i}=Jt(),s=pt(),a=Hf(),o=10;Ts=class{constructor({sharedCache:d}){this.perOpCache=new Map,this.sharedCache=d}async resolve({activeCtx:d,context:b,documentLoader:y,base:_,cycles:E=new Set}){b&&e(b)&&b["@context"]&&(b=b["@context"]),b=n(b);const v=[];for(const x of b){if(t(x)){let h=this._get(x);h||(h=await this._resolveRemoteContext({activeCtx:d,url:x,documentLoader:y,base:_,cycles:E})),r(h)?v.push(...h):v.push(h);continue}if(x===null){v.push(new a({document:null}));continue}e(x)||u(b);const S=JSON.stringify(x);let m=this._get(S);m||(m=new a({document:x}),this._cacheResolvedContext({key:S,resolved:m,tag:"static"})),v.push(m)}return v}_get(d){let b=this.perOpCache.get(d);if(!b){const y=this.sharedCache.get(d);y&&(b=y.get("static"),b&&this.perOpCache.set(d,b))}return b}_cacheResolvedContext({key:d,resolved:b,tag:y}){if(this.perOpCache.set(d,b),y!==void 0){let _=this.sharedCache.get(d);_||(_=new Map,this.sharedCache.set(d,_)),_.set(y,b)}return b}async _resolveRemoteContext({activeCtx:d,url:b,documentLoader:y,base:_,cycles:E}){b=i(_,b);const{context:v,remoteDoc:x}=await this._fetchContext({activeCtx:d,url:b,documentLoader:y,cycles:E});_=x.documentUrl||b,l({context:v,base:_});const S=await this.resolve({activeCtx:d,context:v,documentLoader:y,base:_,cycles:E});return this._cacheResolvedContext({key:b,resolved:S,tag:x.tag}),S}async _fetchContext({activeCtx:d,url:b,documentLoader:y,cycles:_}){if(_.size>o)throw new s("Maximum number of @context URLs exceeded.","jsonld.ContextUrlError",{code:d.processingMode==="json-ld-1.0"?"loading remote context failed":"context overflow",max:o});if(_.has(b))throw new s("Cyclical @context URLs detected.","jsonld.ContextUrlError",{code:d.processingMode==="json-ld-1.0"?"recursive context inclusion":"context overflow",url:b});_.add(b);let E,v;try{v=await y(b),E=v.document||null,t(E)&&(E=JSON.parse(E))}catch(x){throw new s(`Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context. URL: "${b}".`,"jsonld.InvalidUrl",{code:"loading remote context failed",url:b,cause:x})}if(!e(E))throw new s(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${b}".`,"jsonld.InvalidUrl",{code:"invalid remote context",url:b});return"@context"in E?E={"@context":E["@context"]}:E={"@context":{}},v.contextUrl&&(r(E["@context"])||(E["@context"]=[E["@context"]]),E["@context"].push(v.contextUrl)),{context:E,remoteDoc:v}}};function u(c){throw new s("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:c})}function l({context:c,base:d}){if(!c)return;const b=c["@context"];if(t(b)){c["@context"]=i(d,b);return}if(r(b)){for(let y=0;y<b.length;++y){const _=b[y];if(t(_)){b[y]=i(d,_);continue}e(_)&&l({context:{"@context":_},base:d})}return}if(e(b))for(const y in b)l({context:b[y],base:d})}return Ts}var As,Yl;function Gf(){return Yl||(Yl=1,As=Va().NQuads),As}var Ds,Zl;function Dn(){if(Zl)return Ds;Zl=1;const r=pt(),{isArray:e}=dt(),{asArray:t}=ht(),n={};Ds=n,n.defaultEventHandler=null,n.setupEventHandler=({options:a={}})=>{const o=[].concat(a.safe?n.safeEventHandler:[],a.eventHandler?t(a.eventHandler):[],n.defaultEventHandler?n.defaultEventHandler:[]);return o.length===0?null:o},n.handleEvent=({event:a,options:o})=>{i({event:a,handlers:o.eventHandler})};function i({event:a,handlers:o}){let u=!0;for(let l=0;u&&l<o.length;++l){u=!1;const c=o[l];if(e(c))u=i({event:a,handlers:c});else if(typeof c=="function")c({event:a,next:()=>{u=!0}});else if(typeof c=="object")a.code in c?c[a.code]({event:a,next:()=>{u=!0}}):u=!0;else throw new r("Invalid event handler.","jsonld.InvalidEventHandler",{event:a})}return u}const s=new Set(["empty object","free-floating scalar","invalid @language value","invalid property","null @id value","null @value value","object with only @id","object with only @language","object with only @list","object with only @value","relative @id reference","relative @type reference","relative @vocab reference","reserved @id value","reserved @reverse value","reserved term","blank node predicate","relative graph reference","relative object reference","relative predicate reference","relative subject reference","rdfDirection not set"]);return n.safeEventHandler=function({event:o,next:u}){if(o.level==="warning"&&s.has(o.code))throw new r("Safe mode validation error.","jsonld.ValidationError",{event:o});u()},n.logEventHandler=function({event:o,next:u}){console.log(`EVENT: ${o.message}`,{event:o}),u()},n.logWarningEventHandler=function({event:o,next:u}){o.level==="warning"&&console.warn(`WARNING: ${o.message}`,{event:o}),u()},n.unhandledEventHandler=function({event:o}){throw new r("No handler for event.","jsonld.UnhandledEvent",{event:o})},n.setDefaultEventHandler=function({eventHandler:a}={}){n.defaultEventHandler=a?t(a):null},Ds}var Ls,eu;function hr(){if(eu)return Ls;eu=1;const r=ht(),e=pt(),{isArray:t,isObject:n,isString:i,isUndefined:s}=dt(),{isAbsolute:a,isRelative:o,prependBase:u}=Jt(),{handleEvent:l}=Dn(),{REGEX_BCP47:c,REGEX_KEYWORD:d,asArray:b,compareShortestLeast:y}=ht(),_=new Map,E=1e4,v={};Ls=v,v.process=async({activeCtx:m,localCtx:h,options:g,propagate:N=!0,overrideProtected:C=!1,cycles:A=new Set})=>{if(n(h)&&"@context"in h&&t(h["@context"])&&(h=h["@context"]),b(h).length===0)return m;const R=[],F=[({event:te,next:T})=>{R.push(te),T()}];g.eventHandler&&F.push(g.eventHandler);const q=g;g={...g,eventHandler:F};const D=await g.contextResolver.resolve({activeCtx:m,context:h,documentLoader:g.documentLoader,base:g.base});n(D[0].document)&&typeof D[0].document["@propagate"]=="boolean"&&(N=D[0].document["@propagate"]);let L=m;!N&&!L.previousContext&&(L=L.clone(),L.previousContext=m);for(const te of D){let{document:T}=te;if(m=L,T===null){if(!C&&Object.keys(m.protected).length!==0)throw new e("Tried to nullify a context with protected terms outside of a term definition.","jsonld.SyntaxError",{code:"invalid context nullification"});L=m=v.getInitialContext(g).clone();continue}const Z=te.getProcessed(m);if(Z){if(q.eventHandler)for(const Y of Z.events)l({event:Y,options:q});L=m=Z.context;continue}if(n(T)&&"@context"in T&&(T=T["@context"]),!n(T))throw new e("Invalid JSON-LD syntax; @context must be an object.","jsonld.SyntaxError",{code:"invalid local context",context:T});L=L.clone();const k=new Map;if("@version"in T){if(T["@version"]!==1.1)throw new e("Unsupported JSON-LD version: "+T["@version"],"jsonld.UnsupportedVersion",{code:"invalid @version value",context:T});if(m.processingMode&&m.processingMode==="json-ld-1.0")throw new e("@version: "+T["@version"]+" not compatible with "+m.processingMode,"jsonld.ProcessingModeConflict",{code:"processing mode conflict",context:T});L.processingMode="json-ld-1.1",L["@version"]=T["@version"],k.set("@version",!0)}if(L.processingMode=L.processingMode||m.processingMode,"@base"in T){let Y=T["@base"];if(!(Y===null||a(Y)))if(o(Y))Y=u(L["@base"],Y);else throw new e('Invalid JSON-LD syntax; the value of "@base" in a @context must be an absolute IRI, a relative IRI, or null.',"jsonld.SyntaxError",{code:"invalid base IRI",context:T});L["@base"]=Y,k.set("@base",!0)}if("@vocab"in T){const Y=T["@vocab"];if(Y===null)delete L["@vocab"];else if(i(Y)){if(!a(Y)&&v.processingMode(L,1))throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be an absolute IRI.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:T});{const w=x(L,Y,{vocab:!0,base:!0},void 0,void 0,g);a(w)||g.eventHandler&&l({event:{type:["JsonLdEvent"],code:"relative @vocab reference",level:"warning",message:"Relative @vocab reference found.",details:{vocab:w}},options:g}),L["@vocab"]=w}}else throw new e('Invalid JSON-LD syntax; the value of "@vocab" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid vocab mapping",context:T});k.set("@vocab",!0)}if("@language"in T){const Y=T["@language"];if(Y===null)delete L["@language"];else if(i(Y))Y.match(c)||g.eventHandler&&l({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:g}),L["@language"]=Y.toLowerCase();else throw new e('Invalid JSON-LD syntax; the value of "@language" in a @context must be a string or null.',"jsonld.SyntaxError",{code:"invalid default language",context:T});k.set("@language",!0)}if("@direction"in T){const Y=T["@direction"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @direction not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context member",context:T});if(Y===null)delete L["@direction"];else{if(Y!=="ltr"&&Y!=="rtl")throw new e('Invalid JSON-LD syntax; the value of "@direction" in a @context must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:T});L["@direction"]=Y}k.set("@direction",!0)}if("@propagate"in T){const Y=T["@propagate"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @propagate not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(typeof Y!="boolean")throw new e("Invalid JSON-LD syntax; @propagate value must be a boolean.","jsonld.SyntaxError",{code:"invalid @propagate value",context:h});k.set("@propagate",!0)}if("@import"in T){const Y=T["@import"];if(m.processingMode==="json-ld-1.0")throw new e("Invalid JSON-LD syntax; @import not compatible with "+m.processingMode,"jsonld.SyntaxError",{code:"invalid context entry",context:T});if(!i(Y))throw new e("Invalid JSON-LD syntax; @import must be a string.","jsonld.SyntaxError",{code:"invalid @import value",context:h});const w=await g.contextResolver.resolve({activeCtx:m,context:Y,documentLoader:g.documentLoader,base:g.base});if(w.length!==1)throw new e("Invalid JSON-LD syntax; @import must reference a single context.","jsonld.SyntaxError",{code:"invalid remote context",context:h});const H=w[0].getProcessed(m);if(H)T=H;else{const K=w[0].document;if("@import"in K)throw new e("Invalid JSON-LD syntax: imported context must not include @import.","jsonld.SyntaxError",{code:"invalid context entry",context:h});for(const Q in K)T.hasOwnProperty(Q)||(T[Q]=K[Q]);w[0].setProcessed(m,T)}k.set("@import",!0)}k.set("@protected",T["@protected"]||!1);for(const Y in T)if(v.createTermDefinition({activeCtx:L,localCtx:T,term:Y,defined:k,options:g,overrideProtected:C}),n(T[Y])&&"@context"in T[Y]){const w=T[Y]["@context"];let H=!0;if(i(w)){const K=u(g.base,w);A.has(K)?H=!1:A.add(K)}if(H)try{await v.process({activeCtx:L.clone(),localCtx:T[Y]["@context"],overrideProtected:!0,options:g,cycles:A})}catch{throw new e("Invalid JSON-LD syntax; invalid scoped context.","jsonld.SyntaxError",{code:"invalid scoped context",context:T[Y]["@context"],term:Y})}}te.setProcessed(m,{context:L,events:R})}return L},v.createTermDefinition=({activeCtx:m,localCtx:h,term:g,defined:N,options:C,overrideProtected:A=!1})=>{if(N.has(g)){if(N.get(g))return;throw new e("Cyclical context definition detected.","jsonld.CyclicalContext",{code:"cyclic IRI mapping",context:h,term:g})}N.set(g,!1);let B;if(h.hasOwnProperty(g)&&(B=h[g]),g==="@type"&&n(B)&&(B["@container"]||"@set")==="@set"&&v.processingMode(m,1.1)){const T=["@container","@id","@protected"],Z=Object.keys(B);if(Z.length===0||Z.some(k=>!T.includes(k)))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:h,term:g})}else{if(v.isKeyword(g))throw new e("Invalid JSON-LD syntax; keywords cannot be overridden.","jsonld.SyntaxError",{code:"keyword redefinition",context:h,term:g});if(g.match(d)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved term",level:"warning",message:'Terms beginning with "@" are reserved for future use and dropped.',details:{term:g}},options:C});return}else if(g==="")throw new e("Invalid JSON-LD syntax; a term cannot be an empty string.","jsonld.SyntaxError",{code:"invalid term definition",context:h})}const R=m.mappings.get(g);m.mappings.has(g)&&m.mappings.delete(g);let F=!1;if((i(B)||B===null)&&(F=!0,B={"@id":B}),!n(B))throw new e("Invalid JSON-LD syntax; @context term values must be strings or objects.","jsonld.SyntaxError",{code:"invalid term definition",context:h});const q={};m.mappings.set(g,q),q.reverse=!1;const D=["@container","@id","@language","@reverse","@type"];v.processingMode(m,1.1)&&D.push("@context","@direction","@index","@nest","@prefix","@protected");for(const T in B)if(!D.includes(T))throw new e("Invalid JSON-LD syntax; a term definition must not contain "+T,"jsonld.SyntaxError",{code:"invalid term definition",context:h});const L=g.indexOf(":");if(q._termHasColon=L>0,"@reverse"in B){if("@id"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @id.","jsonld.SyntaxError",{code:"invalid reverse property",context:h});if("@nest"in B)throw new e("Invalid JSON-LD syntax; a @reverse term definition must not contain @nest.","jsonld.SyntaxError",{code:"invalid reverse property",context:h});const T=B["@reverse"];if(!i(T))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h});if(T.match(d)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @reverse value",level:"warning",message:'@reverse values beginning with "@" are reserved for future use and dropped.',details:{reverse:T}},options:C}),R?m.mappings.set(g,R):m.mappings.delete(g);return}const Z=x(m,T,{vocab:!0,base:!1},h,N,C);if(!a(Z))throw new e("Invalid JSON-LD syntax; a @context @reverse value must be an absolute IRI or a blank node identifier.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h});q["@id"]=Z,q.reverse=!0}else if("@id"in B){let T=B["@id"];if(T&&!i(T))throw new e("Invalid JSON-LD syntax; a @context @id value must be an array of strings or a string.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h});if(T===null)q["@id"]=null;else if(!v.isKeyword(T)&&T.match(d)){C.eventHandler&&l({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:'@id values beginning with "@" are reserved for future use and dropped.',details:{id:T}},options:C}),R?m.mappings.set(g,R):m.mappings.delete(g);return}else if(T!==g){if(T=x(m,T,{vocab:!0,base:!1},h,N,C),!a(T)&&!v.isKeyword(T))throw new e("Invalid JSON-LD syntax; a @context @id value must be an absolute IRI, a blank node identifier, or a keyword.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h});if(g.match(/(?::[^:])|\//)){const Z=new Map(N).set(g,!0);if(x(m,g,{vocab:!0,base:!1},h,Z,C)!==T)throw new e("Invalid JSON-LD syntax; term in form of IRI must expand to definition.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h})}q["@id"]=T,q._prefix=F&&!q._termHasColon&&T.match(/[:\/\?#\[\]@]$/)!==null}}if(!("@id"in q))if(q._termHasColon){const T=g.substr(0,L);if(h.hasOwnProperty(T)&&v.createTermDefinition({activeCtx:m,localCtx:h,term:T,defined:N,options:C}),m.mappings.has(T)){const Z=g.substr(L+1);q["@id"]=m.mappings.get(T)["@id"]+Z}else q["@id"]=g}else if(g==="@type")q["@id"]=g;else{if(!("@vocab"in m))throw new e("Invalid JSON-LD syntax; @context terms must define an @id.","jsonld.SyntaxError",{code:"invalid IRI mapping",context:h,term:g});q["@id"]=m["@vocab"]+g}if((B["@protected"]===!0||N.get("@protected")===!0&&B["@protected"]!==!1)&&(m.protected[g]=!0,q.protected=!0),N.set(g,!0),"@type"in B){let T=B["@type"];if(!i(T))throw new e("Invalid JSON-LD syntax; an @context @type value must be a string.","jsonld.SyntaxError",{code:"invalid type mapping",context:h});if(T==="@json"||T==="@none"){if(v.processingMode(m,1))throw new e(`Invalid JSON-LD syntax; an @context @type value must not be "${T}" in JSON-LD 1.0 mode.`,"jsonld.SyntaxError",{code:"invalid type mapping",context:h})}else if(T!=="@id"&&T!=="@vocab"){if(T=x(m,T,{vocab:!0,base:!1},h,N,C),!a(T))throw new e("Invalid JSON-LD syntax; an @context @type value must be an absolute IRI.","jsonld.SyntaxError",{code:"invalid type mapping",context:h});if(T.indexOf("_:")===0)throw new e("Invalid JSON-LD syntax; an @context @type value must be an IRI, not a blank node identifier.","jsonld.SyntaxError",{code:"invalid type mapping",context:h})}q["@type"]=T}if("@container"in B){const T=i(B["@container"])?[B["@container"]]:B["@container"]||[],Z=["@list","@set","@index","@language"];let k=!0;const Y=T.includes("@set");if(v.processingMode(m,1.1)){if(Z.push("@graph","@id","@type"),T.includes("@list")){if(T.length!==1)throw new e("Invalid JSON-LD syntax; @context @container with @list must have no other values","jsonld.SyntaxError",{code:"invalid container mapping",context:h})}else if(T.includes("@graph")){if(T.some(w=>w!=="@graph"&&w!=="@id"&&w!=="@index"&&w!=="@set"))throw new e("Invalid JSON-LD syntax; @context @container with @graph must have no other values other than @id, @index, and @set","jsonld.SyntaxError",{code:"invalid container mapping",context:h})}else k&=T.length<=(Y?2:1);if(T.includes("@type")&&(q["@type"]=q["@type"]||"@id",!["@id","@vocab"].includes(q["@type"])))throw new e("Invalid JSON-LD syntax; container: @type requires @type to be @id or @vocab.","jsonld.SyntaxError",{code:"invalid type mapping",context:h})}else k&=!t(B["@container"]),k&=T.length<=1;if(k&=T.every(w=>Z.includes(w)),k&=!(Y&&T.includes("@list")),!k)throw new e("Invalid JSON-LD syntax; @context @container value must be one of the following: "+Z.join(", "),"jsonld.SyntaxError",{code:"invalid container mapping",context:h});if(q.reverse&&!T.every(w=>["@index","@set"].includes(w)))throw new e("Invalid JSON-LD syntax; @context @container value for a @reverse type definition must be @index or @set.","jsonld.SyntaxError",{code:"invalid reverse property",context:h});q["@container"]=T}if("@index"in B){if(!("@container"in B)||!q["@container"].includes("@index"))throw new e(`Invalid JSON-LD syntax; @index without @index in @container: "${B["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:h});if(!i(B["@index"])||B["@index"].indexOf("@")===0)throw new e(`Invalid JSON-LD syntax; @index must expand to an IRI: "${B["@index"]}" on term "${g}".`,"jsonld.SyntaxError",{code:"invalid term definition",context:h});q["@index"]=B["@index"]}if("@context"in B&&(q["@context"]=B["@context"]),"@language"in B&&!("@type"in B)){let T=B["@language"];if(T!==null&&!i(T))throw new e("Invalid JSON-LD syntax; @context @language value must be a string or null.","jsonld.SyntaxError",{code:"invalid language mapping",context:h});T!==null&&(T=T.toLowerCase()),q["@language"]=T}if("@prefix"in B){if(g.match(/:|\//))throw new e("Invalid JSON-LD syntax; @context @prefix used on a compact IRI term","jsonld.SyntaxError",{code:"invalid term definition",context:h});if(v.isKeyword(q["@id"]))throw new e("Invalid JSON-LD syntax; keywords may not be used as prefixes","jsonld.SyntaxError",{code:"invalid term definition",context:h});if(typeof B["@prefix"]=="boolean")q._prefix=B["@prefix"]===!0;else throw new e("Invalid JSON-LD syntax; @context value for @prefix must be boolean","jsonld.SyntaxError",{code:"invalid @prefix value",context:h})}if("@direction"in B){const T=B["@direction"];if(T!==null&&T!=="ltr"&&T!=="rtl")throw new e('Invalid JSON-LD syntax; @direction value must be null, "ltr", or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",context:h});q["@direction"]=T}if("@nest"in B){const T=B["@nest"];if(!i(T)||T!=="@nest"&&T.indexOf("@")===0)throw new e("Invalid JSON-LD syntax; @context @nest value must be a string which is not a keyword other than @nest.","jsonld.SyntaxError",{code:"invalid @nest value",context:h});q["@nest"]=T}// disallow aliasing @context and @preserve
355
+ const te=q["@id"];if(te==="@context"||te==="@preserve")throw new e("Invalid JSON-LD syntax; @context and @preserve cannot be aliased.","jsonld.SyntaxError",{code:"invalid keyword alias",context:h});if(R&&R.protected&&!A&&(m.protected[g]=!0,q.protected=!0,!S(R,q)))throw new e("Invalid JSON-LD syntax; tried to redefine a protected term.","jsonld.SyntaxError",{code:"protected term redefinition",context:h,term:g})},v.expandIri=(m,h,g,N)=>x(m,h,g,void 0,void 0,N);function x(m,h,g,N,C,A){if(h===null||!i(h)||v.isKeyword(h))return h;if(h.match(d))return null;if(N&&N.hasOwnProperty(h)&&C.get(h)!==!0&&v.createTermDefinition({activeCtx:m,localCtx:N,term:h,defined:C,options:A}),g=g||{},g.vocab){const R=m.mappings.get(h);if(R===null)return null;if(n(R)&&"@id"in R)return R["@id"]}const B=h.indexOf(":");if(B>0){const R=h.substr(0,B),F=h.substr(B+1);if(R==="_"||F.indexOf("//")===0)return h;N&&N.hasOwnProperty(R)&&v.createTermDefinition({activeCtx:m,localCtx:N,term:R,defined:C,options:A});const q=m.mappings.get(R);if(q&&q._prefix)return q["@id"]+F;if(a(h))return h}if(g.vocab&&"@vocab"in m)h=m["@vocab"]+h;else if(g.base){let R,F;"@base"in m?m["@base"]?(F=u(A.base,m["@base"]),R=u(F,h)):(F=m["@base"],R=h):(F=A.base,R=u(A.base,h)),h=R}return h}v.getInitialContext=m=>{const h=JSON.stringify({processingMode:m.processingMode}),g=_.get(h);if(g)return g;const N={processingMode:m.processingMode,mappings:new Map,inverse:null,getInverse:C,clone:R,revertToPreviousContext:F,protected:{}};return _.size===E&&_.clear(),_.set(h,N),N;function C(){const q=this;if(q.inverse)return q.inverse;const D=q.inverse={},L=q.fastCurieMap={},te={},T=(q["@language"]||"@none").toLowerCase(),Z=q["@direction"],k=q.mappings,Y=[...k.keys()].sort(y);for(const w of Y){const H=k.get(w);if(H===null)continue;let K=H["@container"]||"@none";if(K=[].concat(K).sort().join(""),H["@id"]===null)continue;const Q=b(H["@id"]);for(const ue of Q){let V=D[ue];const G=v.isKeyword(ue);if(V)!G&&!H._termHasColon&&te[ue].push(w);else if(D[ue]=V={},!G&&!H._termHasColon){te[ue]=[w];const z={iri:ue,terms:te[ue]};ue[0]in L?L[ue[0]].push(z):L[ue[0]]=[z]}if(V[K]||(V[K]={"@language":{},"@type":{},"@any":{}}),V=V[K],B(w,V["@any"],"@none"),H.reverse)B(w,V["@type"],"@reverse");else if(H["@type"]==="@none")B(w,V["@any"],"@none"),B(w,V["@language"],"@none"),B(w,V["@type"],"@none");else if("@type"in H)B(w,V["@type"],H["@type"]);else if("@language"in H&&"@direction"in H){const z=H["@language"],U=H["@direction"];z&&U?B(w,V["@language"],`${z}_${U}`.toLowerCase()):z?B(w,V["@language"],z.toLowerCase()):U?B(w,V["@language"],`_${U}`):B(w,V["@language"],"@null")}else"@language"in H?B(w,V["@language"],(H["@language"]||"@null").toLowerCase()):"@direction"in H?H["@direction"]?B(w,V["@language"],`_${H["@direction"]}`):B(w,V["@language"],"@none"):Z?(B(w,V["@language"],`_${Z}`),B(w,V["@language"],"@none"),B(w,V["@type"],"@none")):(B(w,V["@language"],T),B(w,V["@language"],"@none"),B(w,V["@type"],"@none"))}}for(const w in L)A(L,w,1);return D}function A(q,D,L){const te=q[D],T=q[D]={};let Z,k;for(const Y of te)Z=Y.iri,L>=Z.length?k="":k=Z[L],k in T?T[k].push(Y):T[k]=[Y];for(const Y in T)Y!==""&&A(T,Y,L+1)}function B(q,D,L){D.hasOwnProperty(L)||(D[L]=q)}function R(){const q={};return q.mappings=r.clone(this.mappings),q.clone=this.clone,q.inverse=null,q.getInverse=this.getInverse,q.protected=r.clone(this.protected),this.previousContext&&(q.previousContext=this.previousContext.clone()),q.revertToPreviousContext=this.revertToPreviousContext,"@base"in this&&(q["@base"]=this["@base"]),"@language"in this&&(q["@language"]=this["@language"]),"@vocab"in this&&(q["@vocab"]=this["@vocab"]),q}function F(){return this.previousContext?this.previousContext.clone():this}},v.getContextValue=(m,h,g)=>{if(h===null)return g==="@context"?void 0:null;if(m.mappings.has(h)){const N=m.mappings.get(h);if(s(g))return N;if(N.hasOwnProperty(g))return N[g]}if(g==="@language"&&g in m||g==="@direction"&&g in m)return m[g];if(g!=="@context")return null},v.processingMode=(m,h)=>h.toString()>="1.1"?!m.processingMode||m.processingMode>="json-ld-"+h.toString():m.processingMode==="json-ld-1.0",v.isKeyword=m=>{if(!i(m)||m[0]!=="@")return!1;switch(m){case"@base":case"@container":case"@context":case"@default":case"@direction":case"@embed":case"@explicit":case"@graph":case"@id":case"@included":case"@index":case"@json":case"@language":case"@list":case"@nest":case"@none":case"@omitDefault":case"@prefix":case"@preserve":case"@protected":case"@requireAll":case"@reverse":case"@set":case"@type":case"@value":case"@version":case"@vocab":return!0}return!1};function S(m,h){if(!(m&&typeof m=="object")||!(h&&typeof h=="object"))return m===h;const g=Array.isArray(m);if(g!==Array.isArray(h))return!1;if(g){if(m.length!==h.length)return!1;for(let A=0;A<m.length;++A)if(!S(m[A],h[A]))return!1;return!0}const N=Object.keys(m),C=Object.keys(h);if(N.length!==C.length)return!1;for(const A in m){let B=m[A],R=h[A];if(A==="@container"&&Array.isArray(B)&&Array.isArray(R)&&(B=B.slice().sort(),R=R.slice().sort()),!S(B,R))return!1}return!0}return Ls}var Os,tu;function Wf(){if(tu)return Os;tu=1;const r=pt(),{isArray:e,isObject:t,isEmptyObject:n,isString:i,isUndefined:s}=dt(),{isList:a,isValue:o,isGraph:u,isSubject:l}=Pt(),{expandIri:c,getContextValue:d,isKeyword:b,process:y,processingMode:_}=hr(),{isAbsolute:E}=Jt(),{REGEX_BCP47:v,REGEX_KEYWORD:x,addValue:S,asArray:m,getValues:h,validateTypeValue:g}=ht(),{handleEvent:N}=Dn(),C={};Os=C,C.expand=async({activeCtx:D,activeProperty:L=null,element:te,options:T={},insideList:Z=!1,insideIndex:k=!1,typeScopedContext:Y=null})=>{if(te==null)return null;if(L==="@default"&&(T=Object.assign({},T,{isFrame:!1})),!e(te)&&!t(te))return!Z&&(L===null||c(D,L,{vocab:!0},T)==="@graph")?(T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"free-floating scalar",level:"warning",message:"Dropping free-floating scalar not in a list.",details:{value:te}},options:T}),null):R({activeCtx:D,activeProperty:L,value:te,options:T});if(e(te)){let z=[];const U=d(D,L,"@container")||[];Z=Z||U.includes("@list");for(let ee=0;ee<te.length;++ee){let re=await C.expand({activeCtx:D,activeProperty:L,element:te[ee],options:T,insideIndex:k,typeScopedContext:Y});Z&&e(re)&&(re={"@list":re}),re!==null&&(e(re)?z=z.concat(re):z.push(re))}return z}const w=c(D,L,{vocab:!0},T),H=d(D,L,"@context");Y=Y||(D.previousContext?D:null);let K=Object.keys(te).sort(),Q=!k;if(Q&&Y&&K.length<=2&&!K.includes("@context"))for(const z of K){const U=c(Y,z,{vocab:!0},T);if(U==="@value"){Q=!1,D=Y;break}if(U==="@id"&&K.length===1){Q=!1;break}}Q&&(D=D.revertToPreviousContext()),s(H)||(D=await y({activeCtx:D,localCtx:H,propagate:!0,overrideProtected:!0,options:T})),"@context"in te&&(D=await y({activeCtx:D,localCtx:te["@context"],options:T})),Y=D;let ue=null;for(const z of K)if(c(D,z,{vocab:!0},T)==="@type"){ue=ue||z;const ee=te[z],re=Array.isArray(ee)?ee.length>1?ee.slice().sort():ee:[ee];for(const fe of re){const ge=d(Y,fe,"@context");s(ge)||(D=await y({activeCtx:D,localCtx:ge,options:T,propagate:!1}))}}let V={};await B({activeCtx:D,activeProperty:L,expandedActiveProperty:w,element:te,expandedParent:V,options:T,insideList:Z,typeKey:ue,typeScopedContext:Y}),K=Object.keys(V);let G=K.length;if("@value"in V){if("@type"in V&&("@language"in V||"@direction"in V))throw new r('Invalid JSON-LD syntax; an element containing "@value" may not contain both "@type" and either "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:V});let z=G-1;if("@type"in V&&(z-=1),"@index"in V&&(z-=1),"@language"in V&&(z-=1),"@direction"in V&&(z-=1),z!==0)throw new r('Invalid JSON-LD syntax; an element containing "@value" may only have an "@index" property and either "@type" or either or both "@language" or "@direction".',"jsonld.SyntaxError",{code:"invalid value object",element:V});const U=V["@value"]===null?[]:m(V["@value"]),ee=h(V,"@type");if(!(_(D,1.1)&&ee.includes("@json")&&ee.length===1))if(U.length===0)T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"null @value value",level:"warning",message:"Dropping null @value value.",details:{value:V}},options:T}),V=null;else{if(!U.every(re=>i(re)||n(re))&&"@language"in V)throw new r("Invalid JSON-LD syntax; only strings may be language-tagged.","jsonld.SyntaxError",{code:"invalid language-tagged value",element:V});if(!ee.every(re=>E(re)&&!(i(re)&&re.indexOf("_:")===0)||n(re)))throw new r('Invalid JSON-LD syntax; an element containing "@value" and "@type" must have an absolute IRI for the value of "@type".',"jsonld.SyntaxError",{code:"invalid typed value",element:V})}}else if("@type"in V&&!e(V["@type"]))V["@type"]=[V["@type"]];else if("@set"in V||"@list"in V){if(G>1&&!(G===2&&"@index"in V))throw new r('Invalid JSON-LD syntax; if an element has the property "@set" or "@list", then it can have at most one other property that is "@index".',"jsonld.SyntaxError",{code:"invalid set or list object",element:V});"@set"in V&&(V=V["@set"],K=Object.keys(V),G=K.length)}else G===1&&"@language"in V&&(T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"object with only @language",level:"warning",message:"Dropping object with only @language.",details:{value:V}},options:T}),V=null);return t(V)&&!T.keepFreeFloatingNodes&&!Z&&(L===null||w==="@graph"||(d(D,L,"@container")||[]).includes("@graph"))&&(V=A({value:V,count:G,options:T})),V};function A({value:D,count:L,options:te}){if(L===0||"@value"in D||"@list"in D||L===1&&"@id"in D){if(te.eventHandler){let T,Z;L===0?(T="empty object",Z="Dropping empty object."):"@value"in D?(T="object with only @value",Z="Dropping object with only @value."):"@list"in D?(T="object with only @list",Z="Dropping object with only @list."):L===1&&"@id"in D&&(T="object with only @id",Z="Dropping object with only @id."),N({event:{type:["JsonLdEvent"],code:T,level:"warning",message:Z,details:{value:D}},options:te})}return null}return D}async function B({activeCtx:D,activeProperty:L,expandedActiveProperty:te,element:T,expandedParent:Z,options:k={},insideList:Y,typeKey:w,typeScopedContext:H}){const K=Object.keys(T).sort(),Q=[];let ue;const V=T[w]&&c(D,e(T[w])?T[w][0]:T[w],{vocab:!0},{...k,typeExpansion:!0})==="@json";for(const G of K){let z=T[G],U;if(G==="@context")continue;const ee=c(D,G,{vocab:!0},k);if(ee===null||!(E(ee)||b(ee))){k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid property",level:"warning",message:"Dropping property that did not expand into an absolute IRI or keyword.",details:{property:G,expandedProperty:ee}},options:k});continue}if(b(ee)){if(te==="@reverse")throw new r("Invalid JSON-LD syntax; a keyword cannot be used as a @reverse property.","jsonld.SyntaxError",{code:"invalid reverse property map",value:z});if(ee in Z&&ee!=="@included"&&ee!=="@type")throw new r("Invalid JSON-LD syntax; colliding keywords detected.","jsonld.SyntaxError",{code:"colliding keywords",keyword:ee})}if(ee==="@id"){if(!i(z)){if(!k.isFrame)throw new r('Invalid JSON-LD syntax; "@id" value must a string.',"jsonld.SyntaxError",{code:"invalid @id value",value:z});if(t(z)){if(!n(z))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}else if(e(z)){if(!z.every(j=>i(j)))throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}else throw new r('Invalid JSON-LD syntax; "@id" value an empty object or array of strings, if framing',"jsonld.SyntaxError",{code:"invalid @id value",value:z})}S(Z,"@id",m(z).map(j=>{if(i(j)){const W=c(D,j,{base:!0},k);return k.eventHandler&&(W===null?N(j===null?{event:{type:["JsonLdEvent"],code:"null @id value",level:"warning",message:"Null @id found.",details:{id:j}},options:k}:{event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:j}},options:k}):E(W)||N({event:{type:["JsonLdEvent"],code:"relative @id reference",level:"warning",message:"Relative @id reference found.",details:{id:j,expandedId:W}},options:k})),W}return j}),{propertyIsArray:k.isFrame});continue}if(ee==="@type"){t(z)&&(z=Object.fromEntries(Object.entries(z).map(([j,W])=>[c(H,j,{vocab:!0}),m(W).map(se=>c(H,se,{base:!0,vocab:!0},{...k,typeExpansion:!0}))]))),g(z,k.isFrame),S(Z,"@type",m(z).map(j=>{if(i(j)){const W=c(H,j,{base:!0,vocab:!0},{...k,typeExpansion:!0});return W!=="@json"&&!E(W)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"relative @type reference",level:"warning",message:"Relative @type reference found.",details:{type:j}},options:k}),W}return j}),{propertyIsArray:!!k.isFrame});continue}if(ee==="@included"&&_(D,1.1)){const j=m(await C.expand({activeCtx:D,activeProperty:L,element:z,options:k}));if(!j.every(W=>l(W)))throw new r("Invalid JSON-LD syntax; values of @included must expand to node objects.","jsonld.SyntaxError",{code:"invalid @included value",value:z});S(Z,"@included",j,{propertyIsArray:!0});continue}if(ee==="@graph"&&!(t(z)||e(z)))throw new r('Invalid JSON-LD syntax; "@graph" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid @graph value",value:z});if(ee==="@value"){ue=z,V&&_(D,1.1)?Z["@value"]=z:S(Z,"@value",z,{propertyIsArray:k.isFrame});continue}if(ee==="@language"){if(z===null)continue;if(!i(z)&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@language" value must be a string.',"jsonld.SyntaxError",{code:"invalid language-tagged string",value:z});z=m(z).map(j=>i(j)?j.toLowerCase():j);for(const j of z)i(j)&&!j.match(v)&&k.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:j}},options:k});S(Z,"@language",z,{propertyIsArray:k.isFrame});continue}if(ee==="@direction"){if(!i(z)&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@direction" value must be a string.',"jsonld.SyntaxError",{code:"invalid base direction",value:z});z=m(z);for(const j of z)if(i(j)&&j!=="ltr"&&j!=="rtl")throw new r('Invalid JSON-LD syntax; "@direction" must be "ltr" or "rtl".',"jsonld.SyntaxError",{code:"invalid base direction",value:z});S(Z,"@direction",z,{propertyIsArray:k.isFrame});continue}if(ee==="@index"){if(!i(z))throw new r('Invalid JSON-LD syntax; "@index" value must be a string.',"jsonld.SyntaxError",{code:"invalid @index value",value:z});S(Z,"@index",z);continue}if(ee==="@reverse"){if(!t(z))throw new r('Invalid JSON-LD syntax; "@reverse" value must be an object.',"jsonld.SyntaxError",{code:"invalid @reverse value",value:z});if(U=await C.expand({activeCtx:D,activeProperty:"@reverse",element:z,options:k}),"@reverse"in U)for(const W in U["@reverse"])S(Z,W,U["@reverse"][W],{propertyIsArray:!0});let j=Z["@reverse"]||null;for(const W in U){if(W==="@reverse")continue;j===null&&(j=Z["@reverse"]={}),S(j,W,[],{propertyIsArray:!0});const se=U[W];for(let he=0;he<se.length;++he){const pe=se[he];if(o(pe)||a(pe))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:U});S(j,W,pe,{propertyIsArray:!0})}}continue}if(ee==="@nest"){Q.push(G);continue}let re=D;const fe=d(D,G,"@context");s(fe)||(re=await y({activeCtx:D,localCtx:fe,propagate:!0,overrideProtected:!0,options:k}));const ge=d(D,G,"@container")||[];if(ge.includes("@language")&&t(z)){const j=d(re,G,"@direction");U=F(re,z,j,k)}else if(ge.includes("@index")&&t(z)){const j=ge.includes("@graph"),W=d(re,G,"@index")||"@index",se=W!=="@index"&&c(D,W,{vocab:!0},k);U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:j,indexKey:W,propertyIndex:se})}else if(ge.includes("@id")&&t(z)){const j=ge.includes("@graph");U=await q({activeCtx:re,options:k,activeProperty:G,value:z,asGraph:j,indexKey:"@id"})}else if(ge.includes("@type")&&t(z))U=await q({activeCtx:re.revertToPreviousContext(),options:k,activeProperty:G,value:z,asGraph:!1,indexKey:"@type"});else{const j=ee==="@list";if(j||ee==="@set"){let W=L;j&&te==="@graph"&&(W=null),U=await C.expand({activeCtx:re,activeProperty:W,element:z,options:k,insideList:j})}else d(D,G,"@type")==="@json"?U={"@type":"@json","@value":z}:U=await C.expand({activeCtx:re,activeProperty:G,element:z,options:k,insideList:!1})}if(!(U===null&&ee!=="@value")){if(ee!=="@list"&&!a(U)&&ge.includes("@list")&&(U={"@list":m(U)}),ge.includes("@graph")&&!ge.some(j=>j==="@id"||j==="@index")){if(U=m(U),k.isFrame||(U=U.filter(j=>{const W=Object.keys(j).length;return A({value:j,count:W,options:k})!==null})),U.length===0)continue;U=U.map(j=>({"@graph":m(j)}))}if(re.mappings.has(G)&&re.mappings.get(G).reverse){const j=Z["@reverse"]=Z["@reverse"]||{};U=m(U);for(let W=0;W<U.length;++W){const se=U[W];if(o(se)||a(se))throw new r('Invalid JSON-LD syntax; "@reverse" value must not be a @value or an @list.',"jsonld.SyntaxError",{code:"invalid reverse property value",value:U});S(j,ee,se,{propertyIsArray:!0})}continue}S(Z,ee,U,{propertyIsArray:!0})}}if("@value"in Z&&!(Z["@type"]==="@json"&&_(D,1.1))){if((t(ue)||e(ue))&&!k.isFrame)throw new r('Invalid JSON-LD syntax; "@value" value must not be an object or an array.',"jsonld.SyntaxError",{code:"invalid value object value",value:ue})}for(const G of Q){const z=e(T[G])?T[G]:[T[G]];for(const U of z){if(!t(U)||Object.keys(U).some(ee=>c(D,ee,{vocab:!0},k)==="@value"))throw new r("Invalid JSON-LD syntax; nested value must be a node object.","jsonld.SyntaxError",{code:"invalid @nest value",value:U});await B({activeCtx:D,activeProperty:L,expandedActiveProperty:te,element:U,expandedParent:Z,options:k,insideList:Y,typeScopedContext:H,typeKey:w})}}}function R({activeCtx:D,activeProperty:L,value:te,options:T}){if(te==null)return null;const Z=c(D,L,{vocab:!0},T);if(Z==="@id")return c(D,te,{base:!0},T);if(Z==="@type")return c(D,te,{vocab:!0,base:!0},{...T,typeExpansion:!0});const k=d(D,L,"@type");if((k==="@id"||Z==="@graph")&&i(te)){const w=c(D,te,{base:!0},T);return w===null&&te.match(x)&&T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"reserved @id value",level:"warning",message:"Reserved @id found.",details:{id:L}},options:T}),{"@id":w}}if(k==="@vocab"&&i(te))return{"@id":c(D,te,{vocab:!0,base:!0},T)};if(b(Z))return te;const Y={};if(k&&!["@id","@vocab","@none"].includes(k))Y["@type"]=k;else if(i(te)){const w=d(D,L,"@language");w!==null&&(Y["@language"]=w);const H=d(D,L,"@direction");H!==null&&(Y["@direction"]=H)}return["boolean","number","string"].includes(typeof te)||(te=te.toString()),Y["@value"]=te,Y}function F(D,L,te,T){const Z=[],k=Object.keys(L).sort();for(const Y of k){const w=c(D,Y,{vocab:!0},T);let H=L[Y];e(H)||(H=[H]);for(const K of H){if(K===null)continue;if(!i(K))throw new r("Invalid JSON-LD syntax; language map values must be strings.","jsonld.SyntaxError",{code:"invalid language map value",languageMap:L});const Q={"@value":K};w!=="@none"&&(Y.match(v)||T.eventHandler&&N({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:Y}},options:T}),Q["@language"]=Y.toLowerCase()),te&&(Q["@direction"]=te),Z.push(Q)}}return Z}async function q({activeCtx:D,options:L,activeProperty:te,value:T,asGraph:Z,indexKey:k,propertyIndex:Y}){const w=[],H=Object.keys(T).sort(),K=k==="@type";for(let Q of H){if(K){const G=d(D,Q,"@context");s(G)||(D=await y({activeCtx:D,localCtx:G,propagate:!1,options:L}))}let ue=T[Q];e(ue)||(ue=[ue]),ue=await C.expand({activeCtx:D,activeProperty:te,element:ue,options:L,insideList:!1,insideIndex:!0});let V;Y?Q==="@none"?V="@none":V=R({activeCtx:D,activeProperty:k,value:Q,options:L}):V=c(D,Q,{vocab:!0},L),k==="@id"?Q=c(D,Q,{base:!0},L):K&&(Q=V);for(let G of ue){if(Z&&!u(G)&&(G={"@graph":[G]}),k==="@type")V==="@none"||(G["@type"]?G["@type"]=[Q].concat(G["@type"]):G["@type"]=[Q]);else{if(o(G)&&!["@language","@type","@index"].includes(k))throw new r(`Invalid JSON-LD syntax; Attempt to add illegal key to value object: "${k}".`,"jsonld.SyntaxError",{code:"invalid value object",value:G});Y?V!=="@none"&&S(G,Y,V,{propertyIsArray:!0,prependValue:!0}):V!=="@none"&&!(k in G)&&(G[k]=Q)}w.push(G)}}return w}return Os}var Cs,ru;function _i(){if(ru)return Cs;ru=1;const{isKeyword:r}=hr(),e=Pt(),t=dt(),n=ht(),i=pt(),s={};return Cs=s,s.createMergedNodeMap=(a,o)=>{o=o||{};const u=o.issuer||new n.IdentifierIssuer("_:b"),l={"@default":{}};return s.createNodeMap(a,l,"@default",u),s.mergeNodeMaps(l)},s.createNodeMap=(a,o,u,l,c,d)=>{if(t.isArray(a)){for(const E of a)s.createNodeMap(E,o,u,l,void 0,d);return}if(!t.isObject(a)){d&&d.push(a);return}if(e.isValue(a)){if("@type"in a){let E=a["@type"];E.indexOf("_:")===0&&(a["@type"]=E=l.getId(E))}d&&d.push(a);return}else if(d&&e.isList(a)){const E=[];s.createNodeMap(a["@list"],o,u,l,c,E),d.push({"@list":E});return}if("@type"in a){const E=a["@type"];for(const v of E)v.indexOf("_:")===0&&l.getId(v)}t.isUndefined(c)&&(c=e.isBlankNode(a)?l.getId(a["@id"]):a["@id"]),d&&d.push({"@id":c});const b=o[u],y=b[c]=b[c]||{};y["@id"]=c;const _=Object.keys(a).sort();for(let E of _){if(E==="@id")continue;if(E==="@reverse"){const x={"@id":c},S=a["@reverse"];for(const m in S){const h=S[m];for(const g of h){let N=g["@id"];e.isBlankNode(g)&&(N=l.getId(N)),s.createNodeMap(g,o,u,l,N),n.addValue(b[N],m,x,{propertyIsArray:!0,allowDuplicate:!1})}}continue}if(E==="@graph"){c in o||(o[c]={}),s.createNodeMap(a[E],o,c,l);continue}if(E==="@included"){s.createNodeMap(a[E],o,u,l);continue}if(E!=="@type"&&r(E)){if(E==="@index"&&E in y&&(a[E]!==y[E]||a[E]["@id"]!==y[E]["@id"]))throw new i("Invalid JSON-LD syntax; conflicting @index property detected.","jsonld.SyntaxError",{code:"conflicting indexes",subject:y});y[E]=a[E];continue}const v=a[E];if(E.indexOf("_:")===0&&(E=l.getId(E)),v.length===0){n.addValue(y,E,[],{propertyIsArray:!0});continue}for(let x of v)if(E==="@type"&&(x=x.indexOf("_:")===0?l.getId(x):x),e.isSubject(x)||e.isSubjectReference(x)){if("@id"in x&&!x["@id"])continue;const S=e.isBlankNode(x)?l.getId(x["@id"]):x["@id"];n.addValue(y,E,{"@id":S},{propertyIsArray:!0,allowDuplicate:!1}),s.createNodeMap(x,o,u,l,S)}else if(e.isValue(x))n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1});else if(e.isList(x)){const S=[];s.createNodeMap(x["@list"],o,u,l,c,S),x={"@list":S},n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1})}else s.createNodeMap(x,o,u,l,c),n.addValue(y,E,x,{propertyIsArray:!0,allowDuplicate:!1})}},s.mergeNodeMapGraphs=a=>{const o={};for(const u of Object.keys(a).sort())for(const l of Object.keys(a[u]).sort()){const c=a[u][l];l in o||(o[l]={"@id":l});const d=o[l];for(const b of Object.keys(c).sort())if(r(b)&&b!=="@type")d[b]=n.clone(c[b]);else for(const y of c[b])n.addValue(d,b,n.clone(y),{propertyIsArray:!0,allowDuplicate:!1})}return o},s.mergeNodeMaps=a=>{const o=a["@default"],u=Object.keys(a).sort();for(const l of u){if(l==="@default")continue;const c=a[l];let d=o[l];d?"@graph"in d||(d["@graph"]=[]):o[l]=d={"@id":l,"@graph":[]};const b=d["@graph"];for(const y of Object.keys(c).sort()){const _=c[y];e.isSubjectReference(_)||b.push(_)}}return o},Cs}var js,nu;function zf(){if(nu)return js;nu=1;const{isSubjectReference:r}=Pt(),{createMergedNodeMap:e}=_i(),t={};return js=t,t.flatten=n=>{const i=e(n),s=[],a=Object.keys(i).sort();for(let o=0;o<a.length;++o){const u=i[a[o]];r(u)||s.push(u)}return s},js}var $s,iu;function Qf(){if(iu)return $s;iu=1;const r=pt(),e=Pt(),t=dt(),{REGEX_BCP47:n,addValue:i}=ht(),{handleEvent:s}=Dn(),{RDF_LIST:a,RDF_FIRST:o,RDF_REST:u,RDF_NIL:l,RDF_TYPE:c,RDF_JSON_LITERAL:d,XSD_BOOLEAN:b,XSD_DOUBLE:y,XSD_INTEGER:_,XSD_STRING:E}=Ga(),v={};$s=v,v.fromRDF=async(S,m)=>{const{useRdfType:h=!1,useNativeTypes:g=!1,rdfDirection:N=null}=m,C={},A={"@default":C},B={};if(N){if(N==="compound-literal")throw new r("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:N});if(N!=="i18n-datatype")throw new r("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:N})}for(const q of S){const D=q.graph.termType==="DefaultGraph"?"@default":q.graph.value;D in A||(A[D]={}),D!=="@default"&&!(D in C)&&(C[D]={"@id":D});const L=A[D],te=q.subject.value,T=q.predicate.value,Z=q.object;te in L||(L[te]={"@id":te});const k=L[te],Y=Z.termType.endsWith("Node");if(Y&&!(Z.value in L)&&(L[Z.value]={"@id":Z.value}),T===c&&!h&&Y){i(k,"@type",Z.value,{propertyIsArray:!0});continue}const w=x(Z,g,N,m);if(i(k,T,w,{propertyIsArray:!0}),Y)if(Z.value===l){const H=L[Z.value];"usages"in H||(H.usages=[]),H.usages.push({node:k,property:T,value:w})}else Z.value in B?B[Z.value]=!1:B[Z.value]={node:k,property:T,value:w}}for(const q in A){const D=A[q];if(!(l in D))continue;const L=D[l];if(L.usages){for(let te of L.usages){let T=te.node,Z=te.property,k=te.value;const Y=[],w=[];let H=Object.keys(T).length;for(;Z===u&&t.isObject(B[T["@id"]])&&t.isArray(T[o])&&T[o].length===1&&t.isArray(T[u])&&T[u].length===1&&(H===3||H===4&&t.isArray(T["@type"])&&T["@type"].length===1&&T["@type"][0]===a)&&(Y.push(T[o][0]),w.push(T["@id"]),te=B[T["@id"]],T=te.node,Z=te.property,k=te.value,H=Object.keys(T).length,!!e.isBlankNode(T)););delete k["@id"],k["@list"]=Y.reverse();for(const K of w)delete D[K]}delete L.usages}}const R=[],F=Object.keys(C).sort();for(const q of F){const D=C[q];if(q in A){const L=D["@graph"]=[],te=A[q],T=Object.keys(te).sort();for(const Z of T){const k=te[Z];e.isSubjectReference(k)||L.push(k)}}e.isSubjectReference(D)||R.push(D)}return R};function x(S,m,h,g){if(S.termType.endsWith("Node"))return{"@id":S.value};const N={"@value":S.value};if(S.language)S.language.match(n)||g.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:S.language}},options:g}),N["@language"]=S.language;else{let C=S.datatype.value;if(C||(C=E),C===d){C="@json";try{N["@value"]=JSON.parse(N["@value"])}catch(A){throw new r("JSON literal could not be parsed.","jsonld.InvalidJsonLiteral",{code:"invalid JSON literal",value:N["@value"],cause:A})}}if(m){if(C===b)N["@value"]==="true"?N["@value"]=!0:N["@value"]==="false"&&(N["@value"]=!1);else if(t.isNumeric(N["@value"]))if(C===_){const A=parseInt(N["@value"],10);A.toFixed(0)===N["@value"]&&(N["@value"]=A)}else C===y&&(N["@value"]=parseFloat(N["@value"]));[b,_,y,E].includes(C)||(N["@type"]=C)}else if(h==="i18n-datatype"&&C.startsWith("https://www.w3.org/ns/i18n#")){const[,A,B]=C.split(/[#_]/);A.length>0&&(N["@language"]=A,A.match(n)||g.eventHandler&&s({event:{type:["JsonLdEvent"],code:"invalid @language value",level:"warning",message:"@language value must be valid BCP47.",details:{language:A}},options:g})),N["@direction"]=B}else C!==E&&(N["@type"]=C)}return N}return $s}var Fs,su;function Xf(){return su||(su=1,Fs=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])},"")+"}"}),Fs}var ks,au;function Jf(){if(au)return ks;au=1;const{createNodeMap:r}=_i(),{isKeyword:e}=hr(),t=Pt(),n=Xf(),i=pt(),s=dt(),a=ht(),{handleEvent:o}=Dn(),{RDF_FIRST:u,RDF_REST:l,RDF_NIL:c,RDF_TYPE:d,RDF_JSON_LITERAL:b,RDF_LANGSTRING:y,XSD_BOOLEAN:_,XSD_DOUBLE:E,XSD_INTEGER:v,XSD_STRING:x}=Ga(),{isAbsolute:S}=Jt(),m={};ks=m,m.toRDF=(C,A)=>{const B=new a.IdentifierIssuer("_:b"),R={"@default":{}};r(C,R,"@default",B);const F=[],q=Object.keys(R).sort();for(const D of q){let L;if(D==="@default")L={termType:"DefaultGraph",value:""};else if(S(D))D.startsWith("_:")?L={termType:"BlankNode"}:L={termType:"NamedNode"},L.value=D;else{A.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative graph reference",level:"warning",message:"Relative graph reference found.",details:{graph:D}},options:A});continue}h(F,R[D],L,B,A)}return F};function h(C,A,B,R,F){const q=Object.keys(A).sort();for(const D of q){const L=A[D],te=Object.keys(L).sort();for(let T of te){const Z=L[T];if(T==="@type")T=d;else if(e(T))continue;for(const k of Z){const Y={termType:D.startsWith("_:")?"BlankNode":"NamedNode",value:D};if(!S(D)){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative subject reference",level:"warning",message:"Relative subject reference found.",details:{subject:D}},options:F});continue}const w={termType:T.startsWith("_:")?"BlankNode":"NamedNode",value:T};if(!S(T)){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative predicate reference",level:"warning",message:"Relative predicate reference found.",details:{predicate:T}},options:F});continue}if(w.termType==="BlankNode"&&!F.produceGeneralizedRdf){F.eventHandler&&o({event:{type:["JsonLdEvent"],code:"blank node predicate",level:"warning",message:"Dropping blank node predicate.",details:{property:R.getOldIds().find(K=>R.getId(K)===T)}},options:F});continue}const H=N(k,R,C,B,F.rdfDirection,F);H&&C.push({subject:Y,predicate:w,object:H,graph:B})}}}}function g(C,A,B,R,F,q){const D={termType:"NamedNode",value:u},L={termType:"NamedNode",value:l},te={termType:"NamedNode",value:c},T=C.pop(),Z=T?{termType:"BlankNode",value:A.getId()}:te;let k=Z;for(const Y of C){const w=N(Y,A,B,R,F,q),H={termType:"BlankNode",value:A.getId()};B.push({subject:k,predicate:D,object:w,graph:R}),B.push({subject:k,predicate:L,object:H,graph:R}),k=H}if(T){const Y=N(T,A,B,R,F,q);B.push({subject:k,predicate:D,object:Y,graph:R}),B.push({subject:k,predicate:L,object:te,graph:R})}return Z}function N(C,A,B,R,F,q){const D={};if(t.isValue(C)){D.termType="Literal",D.value=void 0,D.datatype={termType:"NamedNode"};let L=C["@value"];const te=C["@type"]||null;if(te==="@json")D.value=n(L),D.datatype.value=b;else if(s.isBoolean(L))D.value=L.toString(),D.datatype.value=te||_;else if(s.isDouble(L)||te===E)s.isDouble(L)||(L=parseFloat(L)),D.value=L.toExponential(15).replace(/(\d)0*e\+?/,"$1E"),D.datatype.value=te||E;else if(s.isNumber(L))D.value=L.toFixed(0),D.datatype.value=te||v;else if("@direction"in C&&F==="i18n-datatype"){const T=(C["@language"]||"").toLowerCase(),Z=C["@direction"],k=`https://www.w3.org/ns/i18n#${T}_${Z}`;D.datatype.value=k,D.value=L}else{if("@direction"in C&&F==="compound-literal")throw new i("Unsupported rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});if("@direction"in C&&F)throw new i("Unknown rdfDirection value.","jsonld.InvalidRdfDirection",{value:F});"@language"in C?("@direction"in C&&!F&&q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:D.value}},options:q}),D.value=L,D.datatype.value=te||y,D.language=C["@language"]):("@direction"in C&&!F&&q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"rdfDirection not set",level:"warning",message:"rdfDirection not set for @direction.",details:{object:D.value}},options:q}),D.value=L,D.datatype.value=te||x)}}else if(t.isList(C)){const L=g(C["@list"],A,B,R,F,q);D.termType=L.termType,D.value=L.value}else{const L=s.isObject(C)?C["@id"]:C;D.termType=L.startsWith("_:")?"BlankNode":"NamedNode",D.value=L}return D.termType==="NamedNode"&&!S(D.value)?(q.eventHandler&&o({event:{type:["JsonLdEvent"],code:"relative object reference",level:"warning",message:"Relative object reference found.",details:{object:D.value}},options:q}),null):D}return ks}var Ps,ou;function Kf(){if(ou)return Ps;ou=1;const{isKeyword:r}=hr(),e=Pt(),t=dt(),n=ht(),i=Jt(),s=pt(),{createNodeMap:a,mergeNodeMapGraphs:o}=_i(),u={};Ps=u,u.frameMergedOrDefault=(h,g,N)=>{const C={options:N,embedded:!1,graph:"@default",graphMap:{"@default":{}},subjectStack:[],link:{},bnodeMap:{}},A=new n.IdentifierIssuer("_:b");a(h,C.graphMap,"@default",A),N.merged&&(C.graphMap["@merged"]=o(C.graphMap),C.graph="@merged"),C.subjects=C.graphMap[C.graph];const B=[];u.frame(C,Object.keys(C.subjects).sort(),g,B),N.pruneBlankNodeIdentifiers&&(N.bnodesToClear=Object.keys(C.bnodeMap).filter(R=>C.bnodeMap[R].length===1));// remove @preserve from results
356
+ return N.link={},v(B,N)},u.frame=(h,g,N,C,A=null)=>{b(N),N=N[0];const B=h.options,R={embed:d(N,B,"embed"),explicit:d(N,B,"explicit"),requireAll:d(N,B,"requireAll")};h.link.hasOwnProperty(h.graph)||(h.link[h.graph]={});const F=h.link[h.graph],q=y(h,g,N,R),D=Object.keys(q).sort();for(const L of D){const te=q[L];if(A===null?h.uniqueEmbeds={[h.graph]:{}}:h.uniqueEmbeds[h.graph]=h.uniqueEmbeds[h.graph]||{},R.embed==="@link"&&L in F){x(C,A,F[L]);continue}const T={"@id":L};if(L.indexOf("_:")===0&&n.addValue(h.bnodeMap,L,T,{propertyIsArray:!0}),F[L]=T,(R.embed==="@first"||R.embed==="@last")&&h.is11)throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:N});if(!(!h.embedded&&h.uniqueEmbeds[h.graph].hasOwnProperty(L))){if(h.embedded&&(R.embed==="@never"||c(te,h.graph,h.subjectStack))){x(C,A,T);continue}if(h.embedded&&(R.embed=="@first"||R.embed=="@once")&&h.uniqueEmbeds[h.graph].hasOwnProperty(L)){x(C,A,T);continue}if(R.embed==="@last"&&L in h.uniqueEmbeds[h.graph]&&E(h,L),h.uniqueEmbeds[h.graph][L]={parent:C,property:A},h.subjectStack.push({subject:te,graph:h.graph}),L in h.graphMap){let Z=!1,k=null;"@graph"in N?(k=N["@graph"][0],Z=!(L==="@merged"||L==="@default"),t.isObject(k)||(k={})):(Z=h.graph!=="@merged",k={}),Z&&u.frame({...h,graph:L,embedded:!1},Object.keys(h.graphMap[L]).sort(),[k],T,"@graph")}"@included"in N&&u.frame({...h,embedded:!1},g,N["@included"],T,"@included");for(const Z of Object.keys(te).sort()){if(r(Z)){if(T[Z]=n.clone(te[Z]),Z==="@type")for(const k of te["@type"])k.indexOf("_:")===0&&n.addValue(h.bnodeMap,k,T,{propertyIsArray:!0});continue}if(!(R.explicit&&!(Z in N)))for(const k of te[Z]){const Y=Z in N?N[Z]:l(R);if(e.isList(k)){const w=N[Z]&&N[Z][0]&&N[Z][0]["@list"]?N[Z][0]["@list"]:l(R),H={"@list":[]};x(T,Z,H);const K=k["@list"];for(const Q of K)e.isSubjectReference(Q)?u.frame({...h,embedded:!0},[Q["@id"]],w,H,"@list"):x(H,"@list",n.clone(Q))}else e.isSubjectReference(k)?u.frame({...h,embedded:!0},[k["@id"]],Y,T,Z):m(Y[0],k)&&x(T,Z,n.clone(k))}}for(const Z of Object.keys(N).sort()){if(Z==="@type"){if(!t.isObject(N[Z][0])||!("@default"in N[Z][0]))continue}else if(r(Z))continue;const k=N[Z][0]||{};if(!d(k,B,"omitDefault")&&!(Z in T)){let w="@null";"@default"in k&&(w=n.clone(k["@default"])),t.isArray(w)||(w=[w]),T[Z]=[{"@preserve":w}]}}for(const Z of Object.keys(N["@reverse"]||{}).sort()){const k=N["@reverse"][Z];for(const Y of Object.keys(h.subjects))n.getValues(h.subjects[Y],Z).some(H=>H["@id"]===L)&&(T["@reverse"]=T["@reverse"]||{},n.addValue(T["@reverse"],Z,[],{propertyIsArray:!0}),u.frame({...h,embedded:!0},[Y],k,T["@reverse"][Z],A))}x(C,A,T),h.subjectStack.pop()}}},u.cleanupNull=(h,g)=>{if(t.isArray(h))return h.map(C=>u.cleanupNull(C,g)).filter(C=>C);if(h==="@null")return null;if(t.isObject(h)){if("@id"in h){const N=h["@id"];if(g.link.hasOwnProperty(N)){const C=g.link[N].indexOf(h);if(C!==-1)return g.link[N][C];g.link[N].push(h)}else g.link[N]=[h]}for(const N in h)h[N]=u.cleanupNull(h[N],g)}return h};function l(h){const g={};for(const N in h)h[N]!==void 0&&(g["@"+N]=[h[N]]);return[g]}function c(h,g,N){for(let C=N.length-1;C>=0;--C){const A=N[C];if(A.graph===g&&A.subject["@id"]===h["@id"])return!0}return!1}function d(h,g,N){const C="@"+N;let A=C in h?h[C][0]:g[N];if(N==="embed"){if(A===!0)A="@once";else if(A===!1)A="@never";else if(A!=="@always"&&A!=="@never"&&A!=="@link"&&A!=="@first"&&A!=="@last"&&A!=="@once")throw new s("Invalid JSON-LD syntax; invalid value of @embed.","jsonld.SyntaxError",{code:"invalid @embed value",frame:h})}return A}function b(h){if(!t.isArray(h)||h.length!==1||!t.isObject(h[0]))throw new s("Invalid JSON-LD syntax; a JSON-LD frame must be a single object.","jsonld.SyntaxError",{frame:h});if("@id"in h[0]){for(const g of n.asArray(h[0]["@id"]))if(!(t.isObject(g)||i.isAbsolute(g))||t.isString(g)&&g.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @id in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:h})}if("@type"in h[0]){for(const g of n.asArray(h[0]["@type"]))if(!(t.isObject(g)||i.isAbsolute(g)||g==="@json")||t.isString(g)&&g.indexOf("_:")===0)throw new s("Invalid JSON-LD syntax; invalid @type in frame.","jsonld.SyntaxError",{code:"invalid frame",frame:h})}}function y(h,g,N,C){const A={};for(const B of g){const R=h.graphMap[h.graph][B];_(h,R,N,C)&&(A[B]=R)}return A}function _(h,g,N,C){let A=!0,B=!1;for(const R in N){let F=!1;const q=n.getValues(g,R),D=n.getValues(N,R).length===0;if(R==="@id"){if(t.isEmptyObject(N["@id"][0]||{})?F=!0:N["@id"].length>=0&&(F=N["@id"].includes(q[0])),!C.requireAll)return F}else if(R==="@type"){if(A=!1,D){if(q.length>0)return!1;F=!0}else if(N["@type"].length===1&&t.isEmptyObject(N["@type"][0]))F=q.length>0;else for(const L of N["@type"])t.isObject(L)&&"@default"in L?F=!0:F=F||q.some(te=>te===L);if(!C.requireAll)return F}else{if(r(R))continue;{const L=n.getValues(N,R)[0];let te=!1;if(L&&(b([L]),te="@default"in L),A=!1,q.length===0&&te)continue;if(q.length>0&&D)return!1;if(L===void 0){if(q.length>0)return!1;F=!0}else if(e.isList(L)){const T=L["@list"][0];if(e.isList(q[0])){const Z=q[0]["@list"];e.isValue(T)?F=Z.some(k=>m(T,k)):(e.isSubject(T)||e.isSubjectReference(T))&&(F=Z.some(k=>S(h,T,k,C)))}}else e.isValue(L)?F=q.some(T=>m(L,T)):e.isSubjectReference(L)?F=q.some(T=>S(h,L,T,C)):t.isObject(L)?F=q.length>0:F=!1}}if(!F&&C.requireAll)return!1;B=B||F}return A||B}function E(h,g){const N=h.uniqueEmbeds[h.graph],C=N[g],A=C.parent,B=C.property,R={"@id":g};if(t.isArray(A)){for(let q=0;q<A.length;++q)if(n.compareValues(A[q],R)){A[q]=R;break}}else{const q=t.isArray(A[B]);n.removeValue(A,B,R,{propertyIsArray:q}),n.addValue(A,B,R,{propertyIsArray:q})}const F=q=>{const D=Object.keys(N);for(const L of D)L in N&&t.isObject(N[L].parent)&&N[L].parent["@id"]===q&&(delete N[L],F(L))};F(g)}/**
357
+ * Removes the @preserve keywords from expanded result of framing.
358
+ *
359
+ * @param input the framed, framed output.
360
+ * @param options the framing options used.
361
+ *
362
+ * @return the resulting output.
363
+ */function v(h,g){if(t.isArray(h))return h.map(N=>v(N,g));if(t.isObject(h)){// remove @preserve
364
+ if("@preserve"in h)return h["@preserve"][0];if(e.isValue(h))return h;if(e.isList(h))return h["@list"]=v(h["@list"],g),h;if("@id"in h){const N=h["@id"];if(g.link.hasOwnProperty(N)){const C=g.link[N].indexOf(h);if(C!==-1)return g.link[N][C];g.link[N].push(h)}else g.link[N]=[h]}for(const N in h){if(N==="@id"&&g.bnodesToClear.includes(h[N])){delete h["@id"];continue}h[N]=v(h[N],g)}}return h}function x(h,g,N){t.isObject(h)?n.addValue(h,g,N,{propertyIsArray:!0}):h.push(N)}function S(h,g,N,C){if(!("@id"in N))return!1;const A=h.subjects[N["@id"]];return A&&_(h,A,g,C)}function m(h,g){const N=g["@value"],C=g["@type"],A=g["@language"],B=h["@value"]?t.isArray(h["@value"])?h["@value"]:[h["@value"]]:[],R=h["@type"]?t.isArray(h["@type"])?h["@type"]:[h["@type"]]:[],F=h["@language"]?t.isArray(h["@language"])?h["@language"]:[h["@language"]]:[];return B.length===0&&R.length===0&&F.length===0?!0:!(!(B.includes(N)||t.isEmptyObject(B[0]))||!(!C&&R.length===0||R.includes(C)||C&&t.isEmptyObject(R[0]))||!(!A&&F.length===0||F.includes(A)||A&&t.isEmptyObject(F[0])))}return Ps}var Ms,lu;function Yf(){if(lu)return Ms;lu=1;const r=pt(),{isArray:e,isObject:t,isString:n,isUndefined:i}=dt(),{isList:s,isValue:a,isGraph:o,isSimpleGraph:u,isSubjectReference:l}=Pt(),{expandIri:c,getContextValue:d,isKeyword:b,process:y,processingMode:_}=hr(),{removeBase:E,prependBase:v}=Jt(),{REGEX_KEYWORD:x,addValue:S,asArray:m,compareShortestLeast:h}=ht(),g={};Ms=g,g.compact=async({activeCtx:A,activeProperty:B=null,element:R,options:F={}})=>{if(e(R)){let D=[];for(let L=0;L<R.length;++L){const te=await g.compact({activeCtx:A,activeProperty:B,element:R[L],options:F});te!==null&&D.push(te)}return F.compactArrays&&D.length===1&&(d(A,B,"@container")||[]).length===0&&(D=D[0]),D}const q=d(A,B,"@context");if(i(q)||(A=await y({activeCtx:A,localCtx:q,propagate:!0,overrideProtected:!0,options:F})),t(R)){if(F.link&&"@id"in R&&F.link.hasOwnProperty(R["@id"])){const w=F.link[R["@id"]];for(let H=0;H<w.length;++H)if(w[H].expanded===R)return w[H].compacted}if(a(R)||l(R)){const w=g.compactValue({activeCtx:A,activeProperty:B,value:R,options:F});return F.link&&l(R)&&(F.link.hasOwnProperty(R["@id"])||(F.link[R["@id"]]=[]),F.link[R["@id"]].push({expanded:R,compacted:w})),w}if(s(R)&&(d(A,B,"@container")||[]).includes("@list"))return g.compact({activeCtx:A,activeProperty:B,element:R["@list"],options:F});const D=B==="@reverse",L={},te=A;!a(R)&&!l(R)&&(A=A.revertToPreviousContext());const T=d(te,B,"@context");i(T)||(A=await y({activeCtx:A,localCtx:T,propagate:!0,overrideProtected:!0,options:F})),F.link&&"@id"in R&&(F.link.hasOwnProperty(R["@id"])||(F.link[R["@id"]]=[]),F.link[R["@id"]].push({expanded:R,compacted:L}));let Z=R["@type"]||[];Z.length>1&&(Z=Array.from(Z).sort());const k=A;for(const w of Z){const H=g.compactIri({activeCtx:k,iri:w,relativeTo:{vocab:!0}}),K=d(te,H,"@context");i(K)||(A=await y({activeCtx:A,localCtx:K,options:F,propagate:!1}))}const Y=Object.keys(R).sort();for(const w of Y){const H=R[w];if(w==="@id"){let K=m(H).map(ue=>g.compactIri({activeCtx:A,iri:ue,relativeTo:{vocab:!1},base:F.base}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});L[Q]=K;continue}if(w==="@type"){let K=m(H).map(z=>g.compactIri({activeCtx:te,iri:z,relativeTo:{vocab:!0}}));K.length===1&&(K=K[0]);const Q=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}}),G=(d(A,Q,"@container")||[]).includes("@set")&&_(A,1.1)||e(K)&&H.length===0;S(L,Q,K,{propertyIsArray:G});continue}if(w==="@reverse"){const K=await g.compact({activeCtx:A,activeProperty:"@reverse",element:H,options:F});for(const Q in K)if(A.mappings.has(Q)&&A.mappings.get(Q).reverse){const ue=K[Q],G=(d(A,Q,"@container")||[]).includes("@set")||!F.compactArrays;S(L,Q,ue,{propertyIsArray:G}),delete K[Q]}if(Object.keys(K).length>0){const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,Q,K)}continue}if(w==="@preserve"){const K=await g.compact({activeCtx:A,activeProperty:B,element:H,options:F});e(K)&&K.length===0||S(L,w,K);continue}if(w==="@index"){if((d(A,B,"@container")||[]).includes("@index"))continue;const Q=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,Q,H);continue}if(w!=="@graph"&&w!=="@list"&&w!=="@included"&&b(w)){const K=g.compactIri({activeCtx:A,iri:w,relativeTo:{vocab:!0}});S(L,K,H);continue}if(!e(H))throw new r("JSON-LD expansion error; expanded value must be an array.","jsonld.SyntaxError");if(H.length===0){const K=g.compactIri({activeCtx:A,iri:w,value:H,relativeTo:{vocab:!0},reverse:D}),Q=A.mappings.has(K)?A.mappings.get(K)["@nest"]:null;let ue=L;Q&&(C(A,Q,F),t(L[Q])||(L[Q]={}),ue=L[Q]),S(ue,K,H,{propertyIsArray:!0})}for(const K of H){const Q=g.compactIri({activeCtx:A,iri:w,value:K,relativeTo:{vocab:!0},reverse:D}),ue=A.mappings.has(Q)?A.mappings.get(Q)["@nest"]:null;let V=L;ue&&(C(A,ue,F),t(L[ue])||(L[ue]={}),V=L[ue]);const G=d(A,Q,"@container")||[],z=o(K),U=s(K);let ee;U?ee=K["@list"]:z&&(ee=K["@graph"]);let re=await g.compact({activeCtx:A,activeProperty:Q,element:U||z?ee:K,options:F});if(U)if(e(re)||(re=[re]),!G.includes("@list"))re={[g.compactIri({activeCtx:A,iri:"@list",relativeTo:{vocab:!0}})]:re},"@index"in K&&(re[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]);else{S(V,Q,re,{valueIsArray:!0,allowDuplicate:!0});continue}if(z)if(G.includes("@graph")&&(G.includes("@id")||G.includes("@index")&&u(K))){let fe;V.hasOwnProperty(Q)?fe=V[Q]:V[Q]=fe={};const ge=(G.includes("@id")?K["@id"]:K["@index"])||g.compactIri({activeCtx:A,iri:"@none",relativeTo:{vocab:!0}});S(fe,ge,re,{propertyIsArray:!F.compactArrays||G.includes("@set")})}else G.includes("@graph")&&u(K)?(e(re)&&re.length>1&&(re={"@included":re}),S(V,Q,re,{propertyIsArray:!F.compactArrays||G.includes("@set")})):(e(re)&&re.length===1&&F.compactArrays&&(re=re[0]),re={[g.compactIri({activeCtx:A,iri:"@graph",relativeTo:{vocab:!0}})]:re},"@id"in K&&(re[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]=K["@id"]),"@index"in K&&(re[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=K["@index"]),S(V,Q,re,{propertyIsArray:!F.compactArrays||G.includes("@set")}));else if(G.includes("@language")||G.includes("@index")||G.includes("@id")||G.includes("@type")){let fe;V.hasOwnProperty(Q)?fe=V[Q]:V[Q]=fe={};let ge;if(G.includes("@language"))a(re)&&(re=re["@value"]),ge=K["@language"];else if(G.includes("@index")){const j=d(A,Q,"@index")||"@index",W=g.compactIri({activeCtx:A,iri:j,relativeTo:{vocab:!0}});if(j==="@index")ge=K["@index"],delete re[W];else{let se;if([ge,...se]=m(re[j]||[]),!n(ge))ge=null;else switch(se.length){case 0:delete re[j];break;case 1:re[j]=se[0];break;default:re[j]=se;break}}}else if(G.includes("@id")){const j=g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}});ge=re[j],delete re[j]}else if(G.includes("@type")){const j=g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}});let W;switch([ge,...W]=m(re[j]||[]),W.length){case 0:delete re[j];break;case 1:re[j]=W[0];break;default:re[j]=W;break}Object.keys(re).length===1&&"@id"in K&&(re=await g.compact({activeCtx:A,activeProperty:Q,element:{"@id":K["@id"]},options:F}))}ge||(ge=g.compactIri({activeCtx:A,iri:"@none",relativeTo:{vocab:!0}})),S(fe,ge,re,{propertyIsArray:G.includes("@set")})}else{const fe=!F.compactArrays||G.includes("@set")||G.includes("@list")||e(re)&&re.length===0||w==="@list"||w==="@graph";S(V,Q,re,{propertyIsArray:fe})}}}return L}return R},g.compactIri=({activeCtx:A,iri:B,value:R=null,relativeTo:F={vocab:!1},reverse:q=!1,base:D=null})=>{if(B===null)return B;A.isPropertyTermScoped&&A.previousContext&&(A=A.previousContext);const L=A.getInverse();if(b(B)&&B in L&&"@none"in L[B]&&"@type"in L[B]["@none"]&&"@none"in L[B]["@none"]["@type"])return L[B]["@none"]["@type"]["@none"];if(F.vocab&&B in L){const Y=A["@language"]||"@none",w=[];t(R)&&"@index"in R&&!("@graph"in R)&&w.push("@index","@index@set"),t(R)&&"@preserve"in R&&(R=R["@preserve"][0]),o(R)?("@index"in R&&w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R&&w.push("@graph@id","@graph@id@set"),w.push("@graph","@graph@set","@set"),"@index"in R||w.push("@graph@index","@graph@index@set","@index","@index@set"),"@id"in R||w.push("@graph@id","@graph@id@set")):t(R)&&!a(R)&&w.push("@id","@id@set","@type","@set@type");let H="@language",K="@null";if(q)H="@type",K="@reverse",w.push("@set");else if(s(R)){"@index"in R||w.push("@list");const ue=R["@list"];if(ue.length===0)H="@any",K="@none";else{let V=ue.length===0?Y:null,G=null;for(let z=0;z<ue.length;++z){const U=ue[z];let ee="@none",re="@none";if(a(U))if("@direction"in U){const fe=(U["@language"]||"").toLowerCase(),ge=U["@direction"];ee=`${fe}_${ge}`}else"@language"in U?ee=U["@language"].toLowerCase():"@type"in U?re=U["@type"]:ee="@null";else re="@id";if(V===null?V=ee:ee!==V&&a(U)&&(V="@none"),G===null?G=re:re!==G&&(G="@none"),V==="@none"&&G==="@none")break}V=V||"@none",G=G||"@none",G!=="@none"?(H="@type",K=G):K=V}}else{if(a(R))if("@language"in R&&!("@index"in R)){w.push("@language","@language@set"),K=R["@language"];const ue=R["@direction"];ue&&(K=`${K}_${ue}`)}else"@direction"in R&&!("@index"in R)?K=`_${R["@direction"]}`:"@type"in R&&(H="@type",K=R["@type"]);else H="@type",K="@id";w.push("@set")}w.push("@none"),t(R)&&!("@index"in R)&&w.push("@index","@index@set"),a(R)&&Object.keys(R).length===1&&w.push("@language","@language@set");const Q=N(A,B,R,w,H,K);if(Q!==null)return Q}if(F.vocab&&"@vocab"in A){const Y=A["@vocab"];if(B.indexOf(Y)===0&&B!==Y){const w=B.substr(Y.length);if(!A.mappings.has(w))return w}}let te=null;const T=[];let Z=A.fastCurieMap;const k=B.length-1;for(let Y=0;Y<k&&B[Y]in Z;++Y)Z=Z[B[Y]],""in Z&&T.push(Z[""][0]);for(let Y=T.length-1;Y>=0;--Y){const w=T[Y],H=w.terms;for(const K of H){const Q=K+":"+B.substr(w.iri.length);A.mappings.get(K)._prefix&&(!A.mappings.has(Q)||R===null&&A.mappings.get(Q)["@id"]===B)&&(te===null||h(Q,te)<0)&&(te=Q)}}if(te!==null)return te;for(const[Y,w]of A.mappings)if(w&&w._prefix&&B.startsWith(Y+":"))throw new r(`Absolute IRI "${B}" confused with prefix "${Y}".`,"jsonld.SyntaxError",{code:"IRI confused with prefix",context:A});if(!F.vocab)if("@base"in A)if(A["@base"]){const Y=E(v(D,A["@base"]),B);return x.test(Y)?`./${Y}`:Y}else return B;else return E(D,B);return B},g.compactValue=({activeCtx:A,activeProperty:B,value:R,options:F})=>{if(a(R)){const te=d(A,B,"@type"),T=d(A,B,"@language"),Z=d(A,B,"@direction"),k=d(A,B,"@container")||[],Y="@index"in R&&!k.includes("@index");if(!Y&&te!=="@none"&&(R["@type"]===te||"@language"in R&&R["@language"]===T&&"@direction"in R&&R["@direction"]===Z||"@language"in R&&R["@language"]===T||"@direction"in R&&R["@direction"]===Z))return R["@value"];const w=Object.keys(R).length,H=w===1||w===2&&"@index"in R&&!Y,K="@language"in A,Q=n(R["@value"]),ue=A.mappings.has(B)&&A.mappings.get(B)["@language"]===null;if(H&&te!=="@none"&&(!K||!Q||ue))return R["@value"];const V={};return Y&&(V[g.compactIri({activeCtx:A,iri:"@index",relativeTo:{vocab:!0}})]=R["@index"]),"@type"in R?V[g.compactIri({activeCtx:A,iri:"@type",relativeTo:{vocab:!0}})]=g.compactIri({activeCtx:A,iri:R["@type"],relativeTo:{vocab:!0}}):"@language"in R&&(V[g.compactIri({activeCtx:A,iri:"@language",relativeTo:{vocab:!0}})]=R["@language"]),"@direction"in R&&(V[g.compactIri({activeCtx:A,iri:"@direction",relativeTo:{vocab:!0}})]=R["@direction"]),V[g.compactIri({activeCtx:A,iri:"@value",relativeTo:{vocab:!0}})]=R["@value"],V}const q=c(A,B,{vocab:!0},F),D=d(A,B,"@type"),L=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:D==="@vocab"},base:F.base});return D==="@id"||D==="@vocab"||q==="@graph"?L:{[g.compactIri({activeCtx:A,iri:"@id",relativeTo:{vocab:!0}})]:L}};function N(A,B,R,F,q,D){D===null&&(D="@null");const L=[];if((D==="@id"||D==="@reverse")&&t(R)&&"@id"in R){D==="@reverse"&&L.push("@reverse");const T=g.compactIri({activeCtx:A,iri:R["@id"],relativeTo:{vocab:!0}});A.mappings.has(T)&&A.mappings.get(T)&&A.mappings.get(T)["@id"]===R["@id"]?L.push.apply(L,["@vocab","@id"]):L.push.apply(L,["@id","@vocab"])}else{L.push(D);const T=L.find(Z=>Z.includes("_"));T&&L.push(T.replace(/^[^_]+_/,"_"))}L.push("@none");const te=A.inverse[B];for(const T of F){if(!(T in te))continue;const Z=te[T][q];for(const k of L)if(k in Z)return Z[k]}return null}function C(A,B,R){if(c(A,B,{vocab:!0},R)!=="@nest")throw new r("JSON-LD compact error; nested property must have an @nest value resolving to @nest.","jsonld.SyntaxError",{code:"invalid @nest value"})}return Ms}var Bs,uu;function Zf(){return uu||(uu=1,Bs=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}),Bs}/**
365
+ * A JavaScript implementation of the JSON-LD API.
366
+ *
367
+ * @author Dave Longley
368
+ *
369
+ * @license BSD 3-Clause License
370
+ * Copyright (c) 2011-2022 Digital Bazaar, Inc.
371
+ * All rights reserved.
372
+ *
373
+ * Redistribution and use in source and binary forms, with or without
374
+ * modification, are permitted provided that the following conditions are met:
375
+ *
376
+ * Redistributions of source code must retain the above copyright notice,
377
+ * this list of conditions and the following disclaimer.
378
+ *
379
+ * Redistributions in binary form must reproduce the above copyright
380
+ * notice, this list of conditions and the following disclaimer in the
381
+ * documentation and/or other materials provided with the distribution.
382
+ *
383
+ * Neither the name of the Digital Bazaar, Inc. nor the names of its
384
+ * contributors may be used to endorse or promote products derived from
385
+ * this software without specific prior written permission.
386
+ *
387
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
388
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
389
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
390
+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
391
+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
392
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
393
+ * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
394
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
395
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
396
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
397
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
398
+ */var qs,cu;function ep(){if(cu)return qs;cu=1;const r=Va(),e=Bf(),t=ht(),n=Vf(),i=t.IdentifierIssuer,s=pt(),a=Qc(),o=Gf(),{expand:u}=Wf(),{flatten:l}=zf(),{fromRDF:c}=Qf(),{toRDF:d}=Jf(),{frameMergedOrDefault:b,cleanupNull:y}=Kf(),{isArray:_,isObject:E,isString:v}=dt(),{isSubjectReference:x}=Pt(),{expandIri:S,getInitialContext:m,process:h,processingMode:g}=hr(),{compact:N,compactIri:C}=Yf(),{createNodeMap:A,createMergedNodeMap:B,mergeNodeMaps:R}=_i(),{logEventHandler:F,logWarningEventHandler:q,safeEventHandler:D,setDefaultEventHandler:L,setupEventHandler:te,strictEventHandler:T,unhandledEventHandler:Z}=Dn(),k=function(w){const H={},Q=new a({max:100});w.compact=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not compact, too few arguments.");if(G===null)throw new s("The compaction context must not be null.","jsonld.CompactError",{code:"invalid local context"});if(V===null)return null;z=ue(z,{base:v(V)?V:"",compactArrays:!0,compactToRelative:!0,graph:!1,skipExpansion:!1,link:!1,issuer:new i("_:b"),contextResolver:new n({sharedCache:Q})}),z.link&&(z.skipExpansion=!0),z.compactToRelative||delete z.base;let U;z.skipExpansion?U=V:U=await w.expand(V,z);const ee=await w.processContext(m(z),G,z);let re=await N({activeCtx:ee,element:U,options:z});z.compactArrays&&!z.graph&&_(re)?re.length===1?re=re[0]:re.length===0&&(re={}):z.graph&&E(re)&&(re=[re]),E(G)&&"@context"in G&&(G=G["@context"]),G=t.clone(G),_(G)||(G=[G]);const fe=G;G=[];for(let j=0;j<fe.length;++j)(!E(fe[j])||Object.keys(fe[j]).length>0)&&G.push(fe[j]);const ge=G.length>0;if(G.length===1&&(G=G[0]),_(re)){const j=C({activeCtx:ee,iri:"@graph",relativeTo:{vocab:!0}}),W=re;re={},ge&&(re["@context"]=G),re[j]=W}else if(E(re)&&ge){const j=re;re={"@context":G};for(const W in j)re[W]=j[W]}return re},w.expand=async function(V,G){if(arguments.length<1)throw new TypeError("Could not expand, too few arguments.");G=ue(G,{keepFreeFloatingNodes:!1,contextResolver:new n({sharedCache:Q})});const z={},U=[];if("expandContext"in G){const ge=t.clone(G.expandContext);E(ge)&&"@context"in ge?z.expandContext=ge:z.expandContext={"@context":ge},U.push(z.expandContext)}let ee;if(!v(V))z.input=t.clone(V);else{const ge=await w.get(V,G);ee=ge.documentUrl,z.input=ge.document,ge.contextUrl&&(z.remoteContext={"@context":ge.contextUrl},U.push(z.remoteContext))}"base"in G||(G.base=ee||"");let re=m(G);for(const ge of U)re=await h({activeCtx:re,localCtx:ge,options:G});let fe=await u({activeCtx:re,element:z.input,options:G});return E(fe)&&"@graph"in fe&&Object.keys(fe).length===1?fe=fe["@graph"]:fe===null&&(fe=[]),_(fe)||(fe=[fe]),fe},w.flatten=async function(V,G,z){if(arguments.length<1)return new TypeError("Could not flatten, too few arguments.");typeof G=="function"?G=null:G=G||null,z=ue(z,{base:v(V)?V:"",contextResolver:new n({sharedCache:Q})});const U=await w.expand(V,z),ee=l(U);return G===null?ee:(z.graph=!0,z.skipExpansion=!0,await w.compact(ee,G,z))},w.frame=async function(V,G,z){if(arguments.length<2)throw new TypeError("Could not frame, too few arguments.");if(z=ue(z,{base:v(V)?V:"",embed:"@once",explicit:!1,requireAll:!1,omitDefault:!1,bnodesToClear:[],contextResolver:new n({sharedCache:Q})}),v(G)){const he=await w.get(G,z);if(G=he.document,he.contextUrl){let pe=G["@context"];pe?_(pe)?pe.push(he.contextUrl):pe=[pe,he.contextUrl]:pe=he.contextUrl,G["@context"]=pe}}const U=G?G["@context"]||{}:{},ee=await w.processContext(m(z),U,z);z.hasOwnProperty("omitGraph")||(z.omitGraph=g(ee,1.1)),z.hasOwnProperty("pruneBlankNodeIdentifiers")||(z.pruneBlankNodeIdentifiers=g(ee,1.1));const re=await w.expand(V,z),fe={...z};fe.isFrame=!0,fe.keepFreeFloatingNodes=!0;const ge=await w.expand(G,fe),j=Object.keys(G).map(he=>S(ee,he,{vocab:!0}));fe.merged=!j.includes("@graph"),fe.is11=g(ee,1.1);const W=b(re,ge,fe);fe.graph=!z.omitGraph,fe.skipExpansion=!0,fe.link={},fe.framing=!0;let se=await w.compact(W,U,fe);return fe.link={},se=y(se,fe),se},w.link=async function(V,G,z){const U={};return G&&(U["@context"]=G),U["@embed"]="@link",w.frame(V,U,z)},w.normalize=w.canonize=async function(V,G){if(arguments.length<1)throw new TypeError("Could not canonize, too few arguments.");if(G=ue(G,{base:v(V)?V:null,algorithm:"URDNA2015",skipExpansion:!1,safe:!0,contextResolver:new n({sharedCache:Q})}),"inputFormat"in G){if(G.inputFormat!=="application/n-quads"&&G.inputFormat!=="application/nquads")throw new s("Unknown canonicalization input format.","jsonld.CanonizeError");const ee=o.parse(V);return r.canonize(ee,G)}const z={...G};delete z.format,z.produceGeneralizedRdf=!1;const U=await w.toRDF(V,z);return r.canonize(U,G)},w.fromRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert from RDF, too few arguments.");G=ue(G,{format:v(V)?"application/n-quads":void 0});const{format:z}=G;let{rdfParser:U}=G;if(z){if(U=U||H[z],!U)throw new s("Unknown input format.","jsonld.UnknownFormat",{format:z})}else U=()=>V;const ee=await U(V);return c(ee,G)},w.toRDF=async function(V,G){if(arguments.length<1)throw new TypeError("Could not convert to RDF, too few arguments.");G=ue(G,{base:v(V)?V:"",skipExpansion:!1,contextResolver:new n({sharedCache:Q})});let z;G.skipExpansion?z=V:z=await w.expand(V,G);const U=d(z,G);if(G.format){if(G.format==="application/n-quads"||G.format==="application/nquads")return o.serialize(U);throw new s("Unknown output format.","jsonld.UnknownFormat",{format:G.format})}return U},w.createNodeMap=async function(V,G){if(arguments.length<1)throw new TypeError("Could not create node map, too few arguments.");G=ue(G,{base:v(V)?V:"",contextResolver:new n({sharedCache:Q})});const z=await w.expand(V,G);return B(z,G)},w.merge=async function(V,G,z){if(arguments.length<1)throw new TypeError("Could not merge, too few arguments.");if(!_(V))throw new TypeError('Could not merge, "docs" must be an array.');typeof G=="function"?G=null:G=G||null,z=ue(z,{contextResolver:new n({sharedCache:Q})});const U=await Promise.all(V.map(he=>{const pe={...z};return w.expand(he,pe)}));let ee=!0;"mergeNodes"in z&&(ee=z.mergeNodes);const re=z.issuer||new i("_:b"),fe={"@default":{}};for(let he=0;he<U.length;++he){const pe=t.relabelBlankNodes(U[he],{issuer:new i("_:b"+he+"-")}),me=ee||he===0?fe:{"@default":{}};if(A(pe,me,"@default",re),me!==fe)for(const J in me){const ce=me[J];if(!(J in fe)){fe[J]=ce;continue}const ye=fe[J];for(const le in ce)le in ye||(ye[le]=ce[le])}}const ge=R(fe),j=[],W=Object.keys(ge).sort();for(let he=0;he<W.length;++he){const pe=ge[W[he]];x(pe)||j.push(pe)}return G===null?j:(z.graph=!0,z.skipExpansion=!0,await w.compact(j,G,z))},Object.defineProperty(w,"documentLoader",{get:()=>w._documentLoader,set:V=>w._documentLoader=V}),w.documentLoader=async V=>{throw new s("Could not retrieve a JSON-LD document from the URL. URL dereferencing not implemented.","jsonld.LoadDocumentError",{code:"loading document failed",url:V})},w.get=async function(V,G){let z;typeof G.documentLoader=="function"?z=G.documentLoader:z=w.documentLoader;const U=await z(V);try{if(!U.document)throw new s("No remote document found at the given URL.","jsonld.NullRemoteDocument");v(U.document)&&(U.document=JSON.parse(U.document))}catch(ee){throw new s("Could not retrieve a JSON-LD document from the URL.","jsonld.LoadDocumentError",{code:"loading document failed",cause:ee,remoteDoc:U})}return U},w.processContext=async function(V,G,z){return z=ue(z,{base:"",contextResolver:new n({sharedCache:Q})}),G===null?m(z):(G=t.clone(G),E(G)&&"@context"in G||(G={"@context":G}),h({activeCtx:V,localCtx:G,options:z}))},w.getContextValue=hr().getContextValue,w.documentLoaders={},w.useDocumentLoader=function(V){if(!(V in w.documentLoaders))throw new s('Unknown document loader type: "'+V+'"',"jsonld.UnknownDocumentLoader",{type:V});w.documentLoader=w.documentLoaders[V].apply(w,Array.prototype.slice.call(arguments,1))},w.registerRDFParser=function(V,G){H[V]=G},w.unregisterRDFParser=function(V){delete H[V]},w.registerRDFParser("application/n-quads",o.parse),w.registerRDFParser("application/nquads",o.parse),w.url=Jt(),w.logEventHandler=F,w.logWarningEventHandler=q,w.safeEventHandler=D,w.setDefaultEventHandler=L,w.strictEventHandler=T,w.unhandledEventHandler=Z,w.util=t,Object.assign(w,t),w.promises=w,w.RequestQueue=zc(),w.JsonLdProcessor=Zf()(w),e.setupGlobals(w),e.setupDocumentLoaders(w);function ue(V,{documentLoader:G=w.documentLoader,...z}){if(V&&"compactionMap"in V)throw new s('"compactionMap" not supported.',"jsonld.OptionsError");if(V&&"expansionMap"in V)throw new s('"expansionMap" not supported.',"jsonld.OptionsError");return Object.assign({},{documentLoader:G},z,V,{eventHandler:te({options:V})})}return w},Y=function(){return k(function(){return Y()})};return k(Y),qs=Y,qs}var tp=ep();const Us={},Hs={};class rp{constructor(e){this.loadedExternalUrls=[],this.loadedClasses=[],this.config=e}async loadGraphs(){this.loadedExternalUrls=[],this.loadedClasses=[],this.config.prefixes={};const e=[],t=new et;if(e.push(this.importRDF(this.config.attributes.shapes?this.config.attributes.shapes:this.config.attributes.shapesUrl?this.fetchRDF(this.config.attributes.shapesUrl):"",t,yn)),e.push(this.importRDF(this.config.attributes.values?this.config.attributes.values:this.config.attributes.valuesUrl?this.fetchRDF(this.config.attributes.valuesUrl):"",t,Lt)),await Promise.all(e),t.countQuads(null,null,null,yn)===0&&this.config.attributes.valuesSubject){const n=[...t.getObjects(this.config.attributes.valuesSubject,ca,Lt)],i=[];for(const s of n){const a=this.toURL(s.value);a&&this.loadedExternalUrls.indexOf(a)<0&&(this.loadedExternalUrls.push(a),i.push(this.importRDF(this.fetchRDF(a),t,yn)))}try{await Promise.allSettled(i)}catch(s){console.warn(s)}}this.config.store=t}async importRDF(e,t,n){const i=async s=>{const a=[];await new Promise((o,u)=>{const l=du(s)==="xml"?new Lf.RdfXmlParser:new jd;l.on("data",c=>{if(t.add(new ui(c.subject,c.predicate,c.object,n)),this.config.attributes.ignoreOwlImports===null&&Ta.equals(c.predicate)){const d=this.toURL(c.object.value);d&&this.loadedExternalUrls.indexOf(d)<0&&(this.loadedExternalUrls.push(d),a.push(this.importRDF(this.fetchRDF(d),t,Ne.namedNode(d))))}if(this.config.classInstanceProvider&&(Aa.equals(c.predicate)||Rr.equals(c.predicate))){const d=c.object.value;if(this.loadedClasses.indexOf(d)<0){let b;d in Hs?b=Hs[d]:(b=this.config.classInstanceProvider(d),Hs[d]=b),this.loadedClasses.push(d),a.push(this.importRDF(b,t,n))}}}).on("error",c=>{console.warn("failed parsing graph",n,c.message),u(c)}).on("prefix",(c,d)=>{c&&(this.config.prefixes[c]=d)}).on("end",()=>{o(null)}),l.write(s),l.end()});try{await Promise.allSettled(a)}catch(o){console.warn(o)}};if(e instanceof Promise&&(e=await e),e){if(du(e)==="json")try{e=await tp.toRDF(JSON.parse(e),{format:"application/n-quads"})}catch(s){console.error(s)}await i(e)}}toURL(e){if(ha(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),ha(e)))return e}}return null}async fetchRDF(e){if(e in Us)return Us[e];let t=e;this.config.attributes.proxy&&(t=this.config.attributes.proxy+encodeURIComponent(e));const n=fetch(t,{headers:{Accept:"text/turtle, application/trig, application/n-triples, application/n-quads, text/n3, application/ld+json"}}).then(i=>i.text());return Us[e]=n,n}}function du(r){return/^\s*\{/.test(r)?"json":/^\s*<\?xml/.test(r)?"xml":"ttl"}class Vs{constructor(){this.shapes=null,this.shapesUrl=null,this.shapeSubject=null,this.values=null,this.valuesUrl=null,this.valueSubject=null,this.valuesSubject=null,this.valuesNamespace="",this.valuesGraph=null,this.view=null,this.language=null,this.loading="Loading…",this.proxy=null,this.ignoreOwlImports=null,this.collapse=null,this.submitButton=null,this.generateNodeShapeReference=null,this.showNodeIds=null}}class hu{constructor(e,t){this.attributes=new Vs,this.loader=new rp(this),this.prefixes={},this.editMode=!0,this.lists={},this.groups=[],this.renderedNodes=new Set,this._store=new et,this.theme=e,this.form=t,this.languages=[...new Set(navigator.languages.flatMap(n=>n.length>2?[n.toLocaleLowerCase(),n.substring(0,2)]:n)),""]}updateAttributes(e){const t=new Vs;if(Object.keys(t).forEach(n=>{const i=e.dataset[n];i!==void 0&&(t[n]=i)}),this.editMode=t.view===null,this.attributes=t,this.attributes.valueSubject&&!this.attributes.valuesSubject&&(this.attributes.valuesSubject=this.attributes.valueSubject),t.language){const n=this.languages.indexOf(t.language);n>-1&&this.languages.splice(n,1),this.languages.unshift(t.language)}t.valuesGraph&&(this.valuesGraphId=Ne.namedNode(t.valuesGraph))}static dataAttributes(){const e=new Vs;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=Wd(e,{ignoreErrors:!0}),this.groups=[],e.forSubjects(t=>{this.groups.push(t.id)},tt,`${xe}PropertyGroup`,null)}}function np(r){return"_:"+r.value}function ip(r,e){return[...r].map(t=>e(t)).join(`
399
+ `)+`
400
+ `}function sp(){return""}function Xc(r){return"<"+r.value+">"}const ap=/["\\\\\n\r]/,op=/["\\\\\n\r]/g,lp={'"':'\\"',"\\":"\\\\","\n":"\\n","\r":"\\r"};function up(r){return lp[r]}function cp(r){return ap.test(r)?r.replace(op,up):r}function dp(r){const e=cp(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+'"^^'+Xc(r.datatype)}function hp(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 fp(r){return"?"+r.value}function ot(r){if(!r)return null;if(r.termType==="BlankNode")return np(r);if(r.termType==="DefaultGraph")return sp();if(r.termType==="Literal")return dp(r);if(r.termType==="NamedNode")return Xc(r);if(r.termType==="Quad"||r.subject&&r.predicate&&r.object&&r.graph)return hp(r,ot);if(r.termType==="Variable")return fp(r);if(r[Symbol.iterator])return ip(r,ot);throw new Error(`unknown termType ${r.termType}`)}class Fr{constructor(e){if(this.index=new Map,e)for(const[t,n]of e)this.set(t,n)}get size(){return this.index.size}clear(){this.index.clear()}delete(e){return this.index.delete(ot(e))}*entries(){for(const[,{term:e,value:t}]of this.index)yield[e,t]}forEach(e,t){for(const n of this.entries())e.call(t,n[1],n[0],this)}get(e){const t=this.index.get(ot(e));return t&&t.value}has(e){return this.index.has(ot(e))}*keys(){for(const[,{term:e}]of this.index)yield e}set(e,t){const n=ot(e);return this.index.set(n,{term:e,value:t}),this}*values(){for(const[,{value:e}]of this.index)yield e}[Symbol.iterator](){return this.entries()[Symbol.iterator]()}}class fu{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 pu(r){try{return ot(r)}catch{return null}}class ft{constructor(e){if(this.index=new Map,e)for(const t of e)this.add(t)}get size(){return this.index.size}add(e){const t=ot(e);return this.index.has(t)||this.index.set(t,e),this}clear(){this.index.clear()}delete(e){return e?this.index.delete(pu(e)):!1}entries(){return this.values().entries()}forEach(e,t){return this.values().forEach(e,t)}has(e){return e?this.index.has(pu(e)):!1}values(){return new Set(this.index.values())}keys(){return this.values()}[Symbol.iterator](){return this.index.values()}}class Jc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Jc.prototype.termType="BlankNode";class Wa{equals(e){return!!e&&e.termType===this.termType}}Wa.prototype.termType="DefaultGraph";Wa.prototype.value="";function gu(r,e){if(!e)return null;if(e.termType==="BlankNode")return r.blankNode(e.value);if(e.termType==="DefaultGraph")return r.defaultGraph();if(e.termType==="Literal")return r.literal(e.value,e.language||r.namedNode(e.datatype.value));if(e.termType==="NamedNode")return r.namedNode(e.value);if(e.termType==="Quad"){const t=r.fromTerm(e.subject),n=r.fromTerm(e.predicate),i=r.fromTerm(e.object),s=r.fromTerm(e.graph);return r.quad(t,n,i,s)}if(e.termType==="Variable")return r.variable(e.value);throw new Error(`unknown termType ${e.termType}`)}class ti{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}}ti.prototype.termType="Literal";class Ln{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Ln.prototype.termType="NamedNode";class za{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)}}za.prototype.termType="Quad";za.prototype.value="";class Kc{constructor(e){this.value=e}equals(e){return!!e&&e.termType===this.termType&&e.value===this.value}}Kc.prototype.termType="Variable";const pp=new Ln("http://www.w3.org/1999/02/22-rdf-syntax-ns#dirLangString"),mu=new Ln("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString"),gp=new Ln("http://www.w3.org/2001/XMLSchema#string");class Yc{constructor(){this.init()}init(){this._data={blankNodeCounter:0,defaultGraph:new Wa}}namedNode(e){return new Ln(e)}blankNode(e){return e=e||"b"+ ++this._data.blankNodeCounter,new Jc(e)}literal(e,t){return typeof t=="string"?new ti(e,t,mu):typeof t?.language=="string"?new ti(e,t.language,t.direction?pp:mu,t.direction):new ti(e,"",t||gp)}variable(e){return new Kc(e)}defaultGraph(){return this._data.defaultGraph}quad(e,t,n,i=this.defaultGraph()){return new za(e,t,n,i)}fromTerm(e){return gu(this,e)}fromQuad(e){return gu(this,e)}}Yc.exports=["blankNode","defaultGraph","fromQuad","fromTerm","literal","namedNode","quad","variable"];const Qa=new Yc,mp={apply:(r,e,t)=>r(t[0]),get:(r,e)=>r(e)};function gt(r,{factory:e=Qa}={}){const t=(n="")=>e.namedNode(`${r}${n.raw||n}`);return typeof Proxy>"u"?t:new Proxy(t,mp)}gt("http://www.w3.org/2001/XMLSchema#");const St=gt("http://www.w3.org/1999/02/22-rdf-syntax-ns#");gt("http://www.w3.org/2000/01/rdf-schema#");class Fe{static add({ptr:e,start:t,end:n,subjects:i=[null],predicates:s=[null],objects:a=[null],graphs:o,callback:u}={}){if(!e.factory)throw new Error("add operation requires a factory");let l=()=>{};u&&(l=c=>{u(new fu({dataset:e.dataset,start:t,end:n,quad:c}))});for(const c of i)for(const d of s)for(const b of a)for(const y of o){const _={subject:c,predicate:d,object:b,graph:y};_[t]=e.term;const E=e.factory.quad(_.subject,_.predicate,_.object,_.graph);e.dataset.add(E),l(E)}return e}static addList({ptr:e,predicates:t,items:n,graphs:i}){if(e.isAny())throw new Error("can't attach a list to an any ptr");for(const s of t)for(const a of i){const o=n.map(()=>e.factory.blankNode());e.dataset.add(e.factory.quad(e.term,s,o[0]||St.nil,a));for(let u=0;u<o.length;u++)e.dataset.add(e.factory.quad(o[u],St.first,n[u],a)),e.dataset.add(e.factory.quad(o[u],St.rest,o[u+1]||St.nil,a))}return e}static delete({ptr:e,start:t,subjects:n=[null],predicates:i=[null],objects:s=[null]}){for(const a of n)for(const o of i)for(const u of s){const l={subject:a,predicate:o,object:u};l[t]=e.term;const c=e.dataset.match(l.subject,l.predicate,l.object);for(const d of c)e.dataset.delete(d)}return e}static deleteList({ptr:e,predicates:t}){const n=[];for(const i of t)for(const s of e.dataset.match(e.term,i)){let a=s.object;for(n.push(s);!St.nil.equals(a);){a=n[n.length-1].object;const o=e.dataset.match(a);if(o.size===0)break;for(const u of o)n.push(u)}}for(const i of n)e.dataset.delete(i);return e}static execute({ptr:e,operation:t="traverse",quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,items:c,callback:d}={}){if(t==="add")return Fe.add({ptr:e,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l,callback:d});if(t==="addList")return Fe.addList({ptr:e,predicates:o,items:c,graphs:l});if(t==="delete")return Fe.delete({ptr:e,start:i,subjects:a,predicates:o,objects:u});if(t==="deleteList")return Fe.deleteList({ptr:e,predicates:o});if(t==="isList")return Fe.isList({ptr:e});if(t==="list")return Fe.list({ptr:e});if(t==="traverse")return Fe.traverse({ptr:e,quantifier:n,start:i,end:s,subjects:a,predicates:o,objects:u,graphs:l});throw new Error(`unknown operation ${t}`)}static isList({ptr:e}){return e.isAny()?!1:!!(St.nil.equals(e.term)||Fe.traverse({ptr:e,predicates:[St.first]}).length===1)}static list({ptr:e}){if(e.isList())return{*[Symbol.iterator](){for(;e&&!e.term.equals(St.nil);){const t=e.out([St.first]);if(t.length!==1)throw new Error(`Invalid list: rdf:first count not equals one on ${e.value}`);const n=e.out([St.rest]);if(n.length!==1)throw new Error(`Invalid list: rdf:rest count not equals one on ${e.value}`);yield t[0],e=n[0]}}}}static traverse({ptr:e,quantifier:t="one",start:n="subject",end:i="object",subjects:s=[null],predicates:a=[null],objects:o=[null],graphs:u=[null],callback:l}){if(t==="one")return Fe.traverseOne({ptr:e,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="oneOrMore"){const c=Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});return Fe.traverseMore({ptrs:c,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})}if(t==="zeroOrMore")return Fe.traverseMore({ptrs:[e],end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l});if(t==="zeroOrOne")return[e,...Fe.traverse({ptr:e,end:i,start:n,subjects:s,predicates:a,objects:o,graphs:u,callback:l})];throw new Error(`unknown quantifier ${t}`)}static traverseMore({ptrs:e,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u}={}){let l=[...e],c,d;do{c=[];for(const b of e)c=[...c,...Fe.traverseOne({ptr:b,end:t,start:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u})];d&&(c=c.filter(b=>!d.has(b.term))),e=c,l=[...l,...c],d=new ft(l.map(b=>b.term))}while(c.length>0);return l}static traverseOne({ptr:e,start:t,end:n,subjects:i,predicates:s,objects:a,graphs:o,callback:u=(l,c)=>c.extend(l)}={}){const l=[];for(const c of i)for(const d of s)for(const b of a)for(const y of o){const _={subject:c,predicate:d,object:b,graph:y};_[t]=e.term;for(const E of e.dataset.match(_.subject,_.predicate,_.object,_.graph))l.push(u(new fu({dataset:e.dataset,end:n,quad:E,start:t}),e))}return l}}function yu(r,e){return e?t=>e(r.extend(t)):()=>{}}class bu{constructor({dataset:e,edges:t=[],factory:n,graph:i,term:s}){if(!e&&t.length===0)throw new Error("dataset or edges is required");if(t.length===0&&typeof s>"u")throw new Error("edges or term must be given");if(t.length>0&&s)throw new Error("edges or term must be given");this.dataset=e||t[t.length-1].dataset,this.edges=t,this.factory=n,this._graph=i,t.length===0&&(this._term=s)}get edge(){return this.edges[this.edges.length-1]}get graph(){return typeof this._graph=="object"?this._graph:this.edge&&this.edge.graph}get length(){return this._term!==void 0?1:this.edges.length+1}get startTerm(){return this._term||this.edges[0].startTerm}get term(){return this._term!==void 0?this._term:this.edge.term}get value(){const e=this.term;return e===null?void 0:e.value}addIn(e,t,n){return Fe.add({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],callback:yu(this,n)})}addList(e,t){return Fe.addList({ptr:this,predicates:e,graphs:[this.graph||this.factory.defaultGraph()],items:t})}addOut(e,t,n){return Fe.add({ptr:this,start:"subject",end:"object",predicates:e,objects:t,graphs:[this.graph||this.factory.defaultGraph()],callback:yu(this,n)})}deleteIn(e,t){return Fe.delete({ptr:this,start:"object",subjects:t,predicates:e})}deleteList(e){return Fe.deleteList({ptr:this,predicates:e})}deleteOut(e,t){return Fe.delete({ptr:this,start:"subject",predicates:e,objects:t})}execute({operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c}){return Fe.execute({ptr:this,operation:e,quantifier:t,start:n,end:i,subjects:s,predicates:a,objects:o,graphs:u,items:l,callback:c})}extend(e){return new this.constructor({dataset:this.dataset,edges:[...this.edges,e],factory:this.factory,graph:this._graph})}hasIn(e,t){return Fe.traverse({ptr:this,start:"object",end:"object",subjects:t,predicates:e,graphs:[this.graph]})}hasOut(e,t){return Fe.traverse({ptr:this,start:"subject",end:"subject",predicates:e,objects:t,graphs:[this.graph]})}in(e,t){return Fe.traverse({ptr:this,start:"object",end:"subject",subjects:t,predicates:e,graphs:[this.graph]})}isAny(){return!this.term}isList(){return Fe.isList({ptr:this})}list(){return Fe.list({ptr:this})}*nodes(){for(let e=0;e<this.length;e++)this._term!==void 0?yield{dataset:this.dataset,term:this._term}:this.edges.length>e?yield{dataset:this.edges[e].dataset,term:this.edges[e].startTerm}:this.edges.length===e&&(yield{dataset:this.edges[e-1].dataset,term:this.edges[e-1].term})}out(e,t){return Fe.traverse({ptr:this,predicates:e,objects:t,graphs:[this.graph]})}*quads(){for(const{quad:e}of this.edges)yield e}trim(){return new this.constructor({dataset:this.dataset,factory:this.factory,graph:this.graph,term:this.term})}}function _u(r,e){return r?r.equals(e):r===e}function yp(r,e){return!(r.dataset!==e.dataset||!_u(r.graph,e.graph)||!_u(r.term,e.term))}function wu(r,e){return e?t=>e(new r.constructor({factory:r.factory,ptrs:[t]})):()=>{}}class oi{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 bu({dataset:e,factory:t,graph:o,term:a}))}}get dataset(){const e=new Set(this.datasets);return e.size!==1?null:e[Symbol.iterator]().next().value}get datasets(){return this.ptrs.map(e=>e.dataset)}get term(){const e=new ft(this.terms);if(e.size===1)return e[Symbol.iterator]().next().value}get terms(){return this.ptrs.map(e=>e.term)}get value(){const e=this.term;return e?.value}get values(){return this.ptrs.map(e=>e.value)}addIn(e,t,n){const i=wu(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=wu(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=>yp(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 bu({dataset:t,factory:this.factory,term:i}));return this.clone({ptrs:n})}out(e,t){return this.clone({ptrs:this.ptrs.flatMap(n=>n.out(e,t))})}*quads(){for(const{edges:e}of this.ptrs)for(const{quad:t}of e)yield t}trim(){return this.clone({ptrs:this.ptrs.map(e=>e.trim())})}*[Symbol.iterator](){for(const e of this.ptrs)yield this.clone({ptrs:[e]})}}gt("http://www.w3.org/2002/07/owl#");const fr=gt("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),bp=gt("http://www.w3.org/2000/01/rdf-schema#"),ae=gt("http://www.w3.org/ns/shacl#"),ya=gt("https://schemas.link/shacl-next#"),Xa=gt("http://www.w3.org/2001/XMLSchema#");function _p(r){return r?`{${[...r.quads()].map(e=>ot(e)).join(" ")}}`:"{}"}function wp(r){return r?`{${r.map(e=>_p(e)).join(" ")}}`:"{}"}var Gs,vu;function vp(){if(vu)return Gs;vu=1;var r=/\s/;function e(t){for(var n=t.length;n--&&r.test(t.charAt(n)););return n}return Gs=e,Gs}var Ws,xu;function xp(){if(xu)return Ws;xu=1;var r=vp(),e=/^\s+/;function t(n){return n&&n.slice(0,r(n)+1).replace(e,"")}return Ws=t,Ws}var zs,Eu;function Ep(){if(Eu)return zs;Eu=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return zs=r,zs}var Qs,Su;function Sp(){if(Su)return Qs;Su=1;var r=typeof Sr=="object"&&Sr&&Sr.Object===Object&&Sr;return Qs=r,Qs}var Xs,Iu;function Ip(){if(Iu)return Xs;Iu=1;var r=Sp(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Xs=t,Xs}var Js,Nu;function Zc(){if(Nu)return Js;Nu=1;var r=Ip(),e=r.Symbol;return Js=e,Js}var Ks,Ru;function Np(){if(Ru)return Ks;Ru=1;var r=Zc(),e=Object.prototype,t=e.hasOwnProperty,n=e.toString,i=r?r.toStringTag:void 0;function s(a){var o=t.call(a,i),u=a[i];try{a[i]=void 0;var l=!0}catch{}var c=n.call(a);return l&&(o?a[i]=u:delete a[i]),c}return Ks=s,Ks}var Ys,Tu;function Rp(){if(Tu)return Ys;Tu=1;var r=Object.prototype,e=r.toString;function t(n){return e.call(n)}return Ys=t,Ys}var Zs,Au;function Tp(){if(Au)return Zs;Au=1;var r=Zc(),e=Np(),t=Rp(),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 Zs=a,Zs}var ea,Du;function Ap(){if(Du)return ea;Du=1;function r(e){return e!=null&&typeof e=="object"}return ea=r,ea}var ta,Lu;function Dp(){if(Lu)return ta;Lu=1;var r=Tp(),e=Ap(),t="[object Symbol]";function n(i){return typeof i=="symbol"||e(i)&&r(i)==t}return ta=n,ta}var ra,Ou;function Lp(){if(Ou)return ra;Ou=1;var r=xp(),e=Ep(),t=Dp(),n=NaN,i=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(t(l))return n;if(e(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=e(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=r(l);var d=s.test(l);return d||a.test(l)?o(l.slice(2),d?2:8):i.test(l)?n:+l}return ra=u,ra}var na,Cu;function Op(){if(Cu)return na;Cu=1;var r=Lp(),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 na=n,na}var ia,ju;function Cp(){if(ju)return ia;ju=1;var r=Op();function e(t){var n=r(t),i=n%1;return n===n?i?n-i:n:0}return ia=e,ia}var sa,$u;function jp(){if($u)return sa;$u=1;var r=Cp(),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 sa=t,sa}var aa,Fu;function $p(){if(Fu)return aa;Fu=1;var r=jp();function e(t){return r(2,t)}return aa=e,aa}var Fp=$p();const bt=od(Fp);let ku=class{constructor({details:e,factory:t,options:n,results:i=[]}={}){this.details=e,this.factory=t,this.options=n,this.results=i,this._conforms=bt(()=>!this.results.some(s=>s.severity.equals(ae.Info)||s.severity.equals(ae.Violation)||s.severity.equals(ae.Warning))),this._ptr=bt(()=>this.build())}get conforms(){return this._conforms()}get dataset(){return this.ptr.dataset}get ptr(){return this._ptr()}get term(){return this.ptr.term}build(){const e=new oi({dataset:this.factory.dataset(),factory:this.factory,terms:[this.factory.blankNode()]});e.addOut([fr.type],[ae.ValidationReport]).addOut([ae.conforms],[this.factory.literal(this.conforms.toString(),Xa.boolean)]);for(const t of this.results)e.addOut([ae.result],[this.factory.blankNode()],n=>{t.build(n,this.options)});return e}coverage(){return this.results.flatMap(e=>e.coverage())}};function kp(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}let Pp=class{constructor({args:e={},constraintComponent:t,factory:n,focusNode:i,message:s=[],path:a,results:o=[],severity:u,shape:l,source:c=[],value:d,valuePaths:b=[]}={}){this.args=e,this.constraintComponent=t,this.factory=n,this.focusNode=i,this.path=a||l.path,this.results=o,this.severity=u,this.shape=l,this.source=c,this.value=d,this.valuePaths=b,this._message=bt(()=>(this.shape.message.length>0&&(s=this.shape.message),s.length===0&&(s=this.shape.ptr.node([this.constraintComponent]).out([ae.message]).terms),s.map(y=>n.literal(kp(y.value,e),y.language||null))))}get message(){return this._message()}build(e,{details:t}={}){e.addOut([fr.type],[ae.ValidationResult]).addOut([ae.focusNode],this.focusNode.terms).addOut([ae.resultSeverity],[this.severity]).addOut([ae.sourceConstraint],this.source).addOut([ae.sourceConstraintComponent],[this.constraintComponent]).addOut([ae.sourceShape],this.shape.ptr.terms),this.message&&e.addOut([ae.resultMessage],this.message);const n=i=>{if(i.quantifier==="one")return i.predicates.length>1?e.node([this.factory.blankNode()]).addList([ae.alternativePath],i.predicates):i.start==="object"?e.node([this.factory.blankNode()]).addOut([ae.inversePath],[i.predicates[0]]):e.node([i.predicates[0]]);if(i.quantifier==="oneOrMore")return e.node([this.factory.blankNode()]).addOut([ae.oneOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrMore")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrMorePath],[i.predicates[0]]);if(i.quantifier==="zeroOrOne")return e.node([this.factory.blankNode()]).addOut([ae.zeroOrOnePath],[i.predicates[0]])};if(this.path&&(this.path.length===1?e.addOut([ae.resultPath],n(this.path[0]).terms):e.addList([ae.resultPath],this.path.map(i=>n(i).term))),typeof this.value<"u"&&e.addOut([ae.value],this.value.terms),t)for(const i of this.results)e.addOut([ae.detail],[this.factory.blankNode()],s=>{i.build(s,{details:t})})}coverage(){return[...this.valuePaths.flatMap(e=>[...e.quads()]),...this.results.flatMap(e=>e.coverage())]}};class Ja{constructor({factory:e,focusNode:t,options:n={debug:!1,details:!1},processed:i=new Set,report:s=new ku({factory:e,options:n}),results:a=new Map,shape:o,value:u,valueOrNode:l,valuePaths:c,values:d}={}){this.factory=e,this.focusNode=t,this.options=n,this.processed=i,this.report=s,this.results=a,this.shape=o,this.value=u,this.valuePaths=c,this.valueOrNode=l,this.values=d}create({child:e,focusNode:t=this.focusNode,shape:n=this.shape,value:i=this.value,valueOrNode:s=this.valueOrNode,valuePaths:a=this.valuePaths,values:o=this.values}={}){return new Ja({factory:this.factory,focusNode:t,options:this.options,processed:this.processed,report:e?new ku({factory:this.factory,options:this.options}):this.report,results:this.results,shape:n,value:i,valueOrNode:s,valuePaths:a,values:o})}id({shape:e=this.shape}={}){return`${ot(e.ptr.term)} - ${ot(this.focusNode.term)} - ${wp(this.valuePaths)}`}result(e){const t=new Pp({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:ya.Debug,constraintComponent:e,...t})}trace(e,t){this.options.trace&&this.result({severity:ya.Trace,constraintComponent:e,...t})}test(e,t,n){e?this.debug(t,n):this.violation(t,n)}violation(e,t){this.result({constraintComponent:e,severity:this.shape.severity||ae.Violation,...t})}}function Mp(){return{generic:Bp()}}function Bp(){return r=>{r.trace(ya.TraversalConstraintComponent,{args:{},message:[r.factory.literal("Traversal")],value:r.valueOrNode})}}class qp{constructor(e){this.validations=new Fr(e)}compile(e){const t=e.validator.options.coverage;if(e.deactivated)return[];let n=!1;const i=new Set;for(const s of e.ptr.execute({start:"subject",end:"predicate"})){const a=this.validations.get(s.term);a&&(i.add(a),s.term.equals(ae.property)&&(n=!0))}return t&&e.isPropertyShape&&!n&&i.add(Mp),[...i].map(s=>s(e)).filter(Boolean)}}var ir={},sr={},an={},on={},Pu;function Or(){if(Pu)return on;Pu=1,Object.defineProperty(on,"__esModule",{value:!0}),on.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 on.Translator=r,on}var Mu;function Up(){if(Mu)return an;Mu=1,Object.defineProperty(an,"__esModule",{value:!0}),an.TypeHandlerBoolean=void 0;const r=Or();let e=class ed{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(ed.TYPE))}};return an.TypeHandlerBoolean=e,e.TYPE="http://www.w3.org/2001/XMLSchema#boolean",an}var ln={},Bu;function Hp(){if(Bu)return ln;Bu=1,Object.defineProperty(ln,"__esModule",{value:!0}),ln.TypeHandlerDate=void 0;const r=Or();let e=class ba{fromRdf(n,i){switch(i&&!n.value.match(ba.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(ba.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 ln.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]$/},ln}var un={},qu;function Vp(){if(qu)return un;qu=1,Object.defineProperty(un,"__esModule",{value:!0}),un.TypeHandlerNumberDouble=void 0;const r=Or();let e=class td{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(td.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 un.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"],un}var cn={},Uu;function Gp(){if(Uu)return cn;Uu=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.TypeHandlerNumberInteger=void 0;const r=Or();let e=class gn{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<=gn.MAX_INT&&n>=gn.MIN_INT?s.namedNode(gn.TYPES[0]):s.namedNode(gn.TYPES[1])))}};return cn.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,cn}var dn={},Hu;function Wp(){if(Hu)return dn;Hu=1,Object.defineProperty(dn,"__esModule",{value:!0}),dn.TypeHandlerString=void 0;let r=class{fromRdf(t){return t.value}toRdf(t,{datatype:n,dataFactory:i}){return i.literal(t,n)}};return dn.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"],dn}var Vu;function Gu(){return Vu||(Vu=1,(function(r){var e=sr&&sr.__createBinding||(Object.create?(function(n,i,s,a){a===void 0&&(a=s);var o=Object.getOwnPropertyDescriptor(i,s);(!o||("get"in o?!i.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,o)}):(function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]})),t=sr&&sr.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&e(i,n,s)};Object.defineProperty(r,"__esModule",{value:!0}),t(Up(),r),t(Hp(),r),t(Vp(),r),t(Gp(),r),t(Wp(),r)})(sr)),sr}var oa={},Wu;function zp(){return Wu||(Wu=1,Object.defineProperty(oa,"__esModule",{value:!0})),oa}var zu;function Qp(){return zu||(zu=1,(function(r){var e=ir&&ir.__createBinding||(Object.create?(function(y,_,E,v){v===void 0&&(v=E);var x=Object.getOwnPropertyDescriptor(_,E);(!x||("get"in x?!_.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return _[E]}}),Object.defineProperty(y,v,x)}):(function(y,_,E,v){v===void 0&&(v=E),y[v]=_[E]})),t=ir&&ir.__exportStar||function(y,_){for(var E in y)E!=="default"&&!Object.prototype.hasOwnProperty.call(_,E)&&e(_,y,E)};Object.defineProperty(r,"__esModule",{value:!0}),r.fromRdf=u,r.toRdf=l,r.getTermRaw=c,r.getSupportedRdfDatatypes=d,r.getSupportedJavaScriptPrimitives=b;const n=Uc(),i=Gu(),s=Or();t(Gu(),r),t(zp(),r),t(Or(),r);const a=new n.DataFactory,o=new s.Translator;o.registerHandler(new i.TypeHandlerString,i.TypeHandlerString.TYPES.map(y=>a.namedNode(y)),["string"]),o.registerHandler(new i.TypeHandlerBoolean,[i.TypeHandlerBoolean.TYPE].map(y=>a.namedNode(y)),["boolean"]),o.registerHandler(new i.TypeHandlerNumberDouble,i.TypeHandlerNumberDouble.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerNumberInteger,i.TypeHandlerNumberInteger.TYPES.map(y=>a.namedNode(y)),["number"]),o.registerHandler(new i.TypeHandlerDate,i.TypeHandlerDate.TYPES.map(y=>a.namedNode(y)),["object"]);function u(y,_){return o.fromRdf(y,_)}function l(y,_){return _&&"namedNode"in _&&(_={dataFactory:_}),_=_||{},_&&!_.dataFactory&&(_.dataFactory=a),o.toRdf(y,_)}function c(y,_){return y.termType==="Literal"?u(y,_):y.value}function d(){return o.getSupportedRdfDatatypes()}function b(){return o.getSupportedJavaScriptPrimitives()}})(ir)),ir}var Nn=Qp();function Qu(r){if(r.term.termType!=="BlankNode")return{quantifier:"one",start:"subject",end:"object",predicates:[r.term]};const e=r.out([ae.alternativePath]);if(e.ptrs.length===1&&e.ptrs[0].isList())return{quantifier:"one",start:"subject",end:"object",predicates:[...e.list()].map(a=>a.term)};const t=r.out([ae.inversePath]);if(t.term)return{quantifier:"one",start:"object",end:"subject",predicates:[t.term]};const n=r.out([ae.oneOrMorePath]);if(n.term)return{quantifier:"oneOrMore",start:"subject",end:"object",predicates:[n.term]};const i=r.out([ae.zeroOrMorePath]);if(i.term)return{quantifier:"zeroOrMore",start:"subject",end:"object",predicates:[i.term]};const s=r.out([ae.zeroOrOnePath]);if(s.term)return{quantifier:"zeroOrOne",start:"subject",end:"object",predicates:[s.term]}}function Xp(r){return r.terms.length===0?null:r.ptrs[0].isList()?[...r.list()].map(e=>Qu(e)):[Qu(r)]}class Jp{constructor(e){this.shape=e,this._compiled=bt(()=>this.shape.validator.registry.compile(e))}get compiled(){return this._compiled()}async validate(e){return e.focusNode.dataset.size===0||(this.shape.isPropertyShape?await this.validateProperty(e):await this.validateNode(e)),e}async validateNode(e){const t=e.create({shape:this.shape,valueOrNode:e.value||e.focusNode});for(const n of this.compiled)n.node&&await n.node(t),n.generic&&await n.generic(t)}async validateProperty(e){let t;this.shape.isSparqlShape?t=e.focusNode:t=e.focusNode.executeAll(this.shape.path);const n=t.node(new ft(t.terms)),i=[...t].reduce((a,o)=>{const u=o.term,l=t.node([u]);return a.has(u)||a.set(u,{value:l,valuePaths:[]}),a.get(u).valuePaths.push(o),a},new Fr).values(),s=e.create({shape:this.shape,values:n});for(const a of this.compiled)a.property&&await a.property(s);for(const{value:a,valuePaths:o}of i){const u=e.create({shape:this.shape,value:a,valueOrNode:a,valuePaths:o});for(const l of this.compiled)l.generic&&await l.generic(u)}}}function _a(r){const e=new ft,n=new oi({dataset:r.dataset,terms:r.terms}).execute({quantifier:"zeroOrMore",start:"object",end:"subject",predicates:[bp.subClassOf]});for(const i of n.ptrs)for(const{term:s}of i.nodes())e.add(s);return e}class Kp{constructor(e){this.targetClass=new ft([..._a(e.hasOut([fr.type],[ae.NodeShape])),..._a(e.out([ae.targetClass]))]),this.targetNode=e.out([ae.targetNode]).terms,this.targetObjectsOf=e.out([ae.targetObjectsOf]).terms,this.targetSubjectsOf=e.out([ae.targetSubjectsOf]).terms}resolve(e){const t=e.focusNode.node([null]),n=[...e.focusNode.hasOut([fr.type],this.targetClass).ptrs,...e.focusNode.node(this.targetNode).ptrs,...t.execute({start:"object",end:"object",predicates:this.targetObjectsOf}).ptrs,...t.execute({start:"subject",end:"subject",predicates:this.targetSubjectsOf}).ptrs],i=e.focusNode.clone({ptrs:n});return i.node([...new ft(i.terms)])}}class Yp{constructor(e,{validator:t}){this.ptr=e,this.validator=t,this._deactivated=bt(()=>{const n=this.ptr.out([ae.deactivated]).term;return n&&Nn.fromRdf(n)}),this._message=bt(()=>this.ptr.out([ae.message]).terms),this._path=bt(()=>Xp(this.ptr.out([ae.path]))),this._severity=bt(()=>this.ptr.out([ae.severity]).term),this._shapeValidator=bt(()=>new Jp(this)),this._sparql=bt(()=>this.ptr.out([ae.sparql])),this._targetResolver=bt(()=>new Kp(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 Zp(r){const e=parseInt(r.ptr.out([ae.maxCount]).value);return{property:eg(e)}}function eg(r){return e=>{e.test(e.values.terms.length<=r,ae.MaxCountConstraintComponent,{args:{maxCount:r},message:[e.factory.literal("More than {$maxCount} values")]})}}function tg(r){const e=parseInt(r.ptr.out([ae.minCount]).value);return{property:rg(e)}}function rg(r){return e=>{e.test(e.values.terms.length>=r,ae.MinCountConstraintComponent,{args:{minCount:r},message:[e.factory.literal("Less than {$minCount} values")]})}}async function ng(r,e){for(const t of r)if(!await e(t))return!1;return!0}async function ig(r,e){return(await Promise.all(r.map(t=>e(t)))).filter(Boolean)}async function wi(r,e){return Promise.all(r.map(e))}async function sg(r,e){for(const t of r)if(await e(t))return!0;return!1}function ag(r){const e=[...r.ptr.out([ae.and])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:og(e)}}function og(r){return async e=>{const t=await wi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.every(i=>i.conforms);e.test(n,ae.AndConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function lg(r){const e=r.validator.shape(r.ptr.out([ae.not]));return{generic:ug(e)}}function ug(r){return async e=>{const t=(await r.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report,n=!t.conforms;e.test(n,ae.NotConstraintComponent,{args:{not:r.ptr.term},message:[e.factory.literal("Value does have shape {$not}")],results:t.results,value:e.valueOrNode})}}function cg(r){const e=[...r.ptr.out([ae.or])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:dg(e)}}function dg(r){return async e=>{let t=[],n;if(e.options.debug||e.options.details){const i=await wi(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 sg(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report.conforms);e.test(n,ae.OrConstraintComponent,{results:t,value:e.valueOrNode})}}function hg(r){const e=[...r.ptr.out([ae.xone])].flatMap(t=>[...t.list()]).map(t=>r.validator.shape(t));return{generic:fg(e)}}function fg(r){return async e=>{const t=await wi(r,async i=>(await i.validate(e.create({child:!0,focusNode:e.valueOrNode}))).report),n=t.filter(i=>i.conforms).length===1;e.test(n,ae.XoneConstraintComponent,{results:t.flatMap(i=>i.results),value:e.valueOrNode})}}function pg(r){if(!Nn.fromRdf(r.ptr.out([ae.closed]).term))return null;const t=r.ptr.out([ae.property]).map(s=>r.validator.shape(s)),n=new ft(t.filter(s=>!s.deactivated).map(s=>s.path[0].predicates[0])),i=new ft([...r.ptr.out([ae.ignoredProperties]).list()||[]].map(s=>s.term));return{node:gg(n,i)}}function gg(r,e){return t=>{const n=t.focusNode.execute({start:"subject",end:"predicate"}).filter(i=>e.has(i.term)?!1:!r.has(i.term));if(n.ptrs.length>0)for(const i of n)t.violation(ae.ClosedConstraintComponent,{message:[t.factory.literal("Predicate is not allowed (closed shape)")],path:[{quantifier:"one",start:"subject",end:"object",predicates:[i.term]}],value:t.focusNode.node([[...i.quads()][0].object])});else t.debug(ae.ClosedConstraintComponent)}}function mg(r){const e=r.ptr.out([ae.hasValue]).term;return{node:yg(e),property:bg(e)}}function yg(r){return e=>{e.test(r.equals(e.valueOrNode.term),ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Value must be {$hasValue}")]})}}function bg(r){return e=>{const t=[...e.values].some(n=>r.equals(n.term));e.test(t,ae.HasValueConstraintComponent,{args:{hasValue:r},message:[e.factory.literal("Missing expected value {$hasValue}")]})}}function _g(r){const e=new ft([...r.ptr.out([ae.in]).list()].map(t=>t.term));return{generic:wg(e)}}function wg(r){return e=>{e.test(r.has(e.valueOrNode.term),ae.InConstraintComponent,{args:{in:[...r].map(t=>t.value).join(", ")},message:[e.factory.literal("Value is not in {$in}")],value:e.valueOrNode})}}function kr(r,e){if(!r||r.termType!=="Literal"||!e||e.termType!=="Literal"||Xu(r)!==Xu(e))return null;const t=Nn.fromRdf(r),n=Nn.fromRdf(e);return typeof t!=typeof n?null:typeof t=="string"?t.localeCompare(n):t-n}function Xu(r){const e=/^.*(((\+|-)\d{2}:\d{2})|Z)$/;return Xa.dateTime.equals(r.datatype)&&e.test(r.value)}function vg(r){const e=r.ptr.out([ae.disjoint]).term;return{generic:xg(e)}}function xg(r){return e=>{const t=e.focusNode.dataset.match(e.focusNode.term,r,e.valueOrNode.term);e.test(t.size===0,ae.DisjointConstraintComponent,{args:{disjoint:r},message:[e.factory.literal("Value node must not also be one of the values of {$disjoint}")],value:e.valueOrNode})}}function Eg(r){const e=r.ptr.out([ae.equals]).term;return{node:Sg(e),property:Ig(e)}}function Sg(r){return e=>{const t=e.focusNode.out([r]),n=t.filter(s=>!s.term.equals(e.focusNode.term)),i=t.terms.length!==0&&n.terms.length===0;e.test(i,ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:n.terms[0]&&e.focusNode.node([n.terms[0]])||e.focusNode})}}function Ig(r){return e=>{const t=new ft(e.focusNode.out([r]).terms),n=new ft(e.values.terms),i=[...n].filter(o=>!t.has(o)),s=[...t].filter(o=>!n.has(o)),a=[...i,...s];for(const o of a)e.violation(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")],value:e.focusNode.node([o])});a.length===0&&e.debug(ae.EqualsConstraintComponent,{args:{equals:r},message:[e.factory.literal("Must have same values as {$equals}")]})}}function Ng(r){const e=r.ptr.out([ae.lessThan]).term;return{property:Rg(e)}}function Rg(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=kr(n.term,i);s===null||s>=0?e.violation(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n}):e.debug(ae.LessThanConstraintComponent,{args:{lessThan:r},message:[e.factory.literal("Value is not less than value of {$lessThan}")],value:n})}}}function Tg(r){const e=r.ptr.out([ae.lessThanOrEquals]).term;return{property:Ag(e)}}function Ag(r){return e=>{const t=e.focusNode.out([r]).terms;for(const n of e.values)for(const i of t){const s=kr(n.term,i);s===null||s>0?e.violation(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n}):e.debug(ae.LessThanOrEqualsConstraintComponent,{args:{lessThanOrEquals:r},message:[e.factory.literal("Value is not less than or equal to value of {$lessThanOrEquals}")],value:n})}}}function Dg(r){const e=r.ptr.out([ae.maxExclusive]).term;return{generic:Lg(e)}}function Lg(r){return e=>{const t=kr(e.valueOrNode.term,r);e.test(t!==null&&t<0,ae.MaxExclusiveConstraintComponent,{args:{maxExclusive:r},message:[e.factory.literal("Value is not less than {$maxExclusive}")],value:e.valueOrNode})}}function Og(r){const e=r.ptr.out([ae.maxInclusive]).term;return{generic:Cg(e)}}function Cg(r){return e=>{const t=kr(e.valueOrNode.term,r);e.test(t!==null&&t<=0,ae.MaxInclusiveConstraintComponent,{args:{maxInclusive:r},message:[e.factory.literal("Value is not less than or equal to {$maxInclusive}")],value:e.valueOrNode})}}function jg(r){const e=r.ptr.out([ae.minExclusive]).term;return{generic:$g(e)}}function $g(r){return e=>{const t=kr(e.valueOrNode.term,r);e.test(t!==null&&t>0,ae.MinExclusiveConstraintComponent,{args:{minExclusive:r},message:[e.factory.literal("Value is not greater than {$minExclusive}")],value:e.valueOrNode})}}function Fg(r){const e=r.ptr.out([ae.minInclusive]).term;return{generic:kg(e)}}function kg(r){return e=>{const t=kr(e.valueOrNode.term,r);e.test(t!==null&&t>=0,ae.MinInclusiveConstraintComponent,{args:{minInclusive:r},message:[e.factory.literal("Value is not greater than or equal to {$minInclusive}")],value:e.valueOrNode})}}function Pg(r){const e=[...r.ptr.out([ae.node])].map(t=>r.validator.shape(t));return{generic:Mg(e)}}function Mg(r){return async e=>{for(const t of r){const n=await t.validate(e.create({child:!0,focusNode:e.valueOrNode}));e.test(n.report.conforms,ae.NodeConstraintComponent,{args:{node:t.ptr.term},message:[e.factory.literal("Value does not have shape {$node}")],results:n.report.results,value:e.valueOrNode})}}}function Bg(r){const e=[...r.ptr.out([ae.property])].map(t=>r.validator.shape(t));return{generic:qg(e)}}function qg(r){return async e=>{const t=e.create({focusNode:e.valueOrNode});for(const n of r)await n.validate(t)}}function Ug(r){const e=r.validator.shape(r.ptr.out([ae.qualifiedValueShape])),t=r.ptr.out([ae.qualifiedValueShapesDisjoint]).term,n=t?Nn.fromRdf(t):!1,i=r.ptr.out([ae.qualifiedMaxCount]).term,s=i?parseInt(i.value):null,a=r.ptr.out([ae.qualifiedMinCount]).term,o=a?parseInt(a.value):null;return{property:Hg(e,n,s,o)}}function Hg(r,e,t,n){return async i=>{const s=[];let a=[];e&&(a=new Set(i.shape.ptr.in([ae.property]).out([ae.property]).out([ae.qualifiedValueShape]).filter(u=>!u.term.equals(r.ptr.term)).map(u=>i.shape.validator.shape(u))));const o=(await ig(i.values,async u=>{const l=(await r.validate(i.create({child:!0,focusNode:u}))).report;if(s.push(l.results),!l.conforms)return!1;if(a.length===0)return!0;if(i.options.debug||i.options.details){const c=await wi([...a],async d=>(await d.validate(i.create({child:!0,focusNode:u}))).report);return s.push(c.flatMap(d=>d.results)),!c.every(d=>d.conforms)}else return!await ng([...a],async c=>(await c.validate(i.create({child:!0,focusNode:u}))).report.conforms)})).length;t!==null&&i.test(o<=t,ae.QualifiedMaxCountConstraintComponent,{args:{qualifiedMaxCount:t,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("More than {$qualifiedMaxCount} values have shape {$qualifiedValueShape}")],results:s.flat()}),n!==null&&i.test(o>=n,ae.QualifiedMinCountConstraintComponent,{args:{qualifiedMinCount:n,qualifiedValueShape:r.ptr.term,qualifiedValueShapesDisjoint:e},message:[i.factory.literal("Less than {$qualifiedMinCount} values have shape {$qualifiedValueShape}")],results:s.flat()})}}function Vg(r,e){return e?e.slice(0,r.length)===r:!1}function Gg(r){const e=[...new Set([...r.ptr.out([ae.languageIn]).list()].map(t=>t.value))];return{generic:Wg(e)}}function Wg(r){return e=>{const t=r.some(n=>Vg(n,e.valueOrNode.term.language));e.test(t,ae.LanguageInConstraintComponent,{args:{languageIn:r.join(", ")},message:[e.factory.literal("Language does not match any of {$languageIn}")],value:e.valueOrNode})}}function zg(r){const e=parseInt(r.ptr.out([ae.maxLength]).value);return{generic:Qg(e)}}function Qg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length<=r;e.test(t,ae.MaxLengthConstraintComponent,{args:{maxLength:r},message:[e.factory.literal("Value has more than {$maxLength} characters")],value:e.valueOrNode})}}function Xg(r){const e=parseInt(r.ptr.out([ae.minLength]).value);return{generic:Jg(e)}}function Jg(r){return e=>{const t=e.valueOrNode.term.termType!=="BlankNode"&&e.valueOrNode.value.length>=r;e.test(t,ae.MinLengthConstraintComponent,{args:{minLength:r},message:[e.factory.literal("Value has less than {$minLength} characters")],value:e.valueOrNode})}}function Kg(r){const e=r.ptr.out([ae.pattern]).value,t=r.ptr.out([ae.flags]).value,n=new RegExp(e,t);return{generic:Yg(e,t,n)}}function Yg(r,e,t){return n=>{n.test(t.test(n.valueOrNode.term.value),ae.PatternConstraintComponent,{args:{flags:e,pattern:r},message:[n.factory.literal('Value does not match pattern "{$pattern}"')],value:n.valueOrNode})}}function Zg(r){const e=r.ptr.out([ae.uniqueLang]).term;return e.value==="true"&&Xa.boolean.equals(e.datatype)?{property:em()}:null}function em(){return r=>{const t=Object.entries(r.values.terms.reduce((n,i)=>(i.language&&(n[i.language]=(n[i.language]||0)+1),n),{})).filter(([,n])=>n>1);for(const[n]of t)r.violation(ae.UniqueLangConstraintComponent,{args:{lang:n},message:[r.factory.literal('Language "{?lang}" used more than once')]});t.length===0&&r.debug(ae.UniqueLangConstraintComponent)}}const ri=gt("http://www.w3.org/ns/shacl#"),rd=gt("https://schemas.link/shacl-next#");class Cr{constructor({results:e=[]}={}){this.results=e}get conforms(){return!this.results.some(e=>e.severity.equals(ri.Info)||e.severity.equals(ri.Violation)||e.severity.equals(ri.Warning))}}function tm(r,e){return Object.entries(e).reduce((t,[n,i])=>(i&&i.termType&&(i=ot(i)),t.replace(`{$${n}}`,i).replace(`{?${n}}`,i)),r)}class li{constructor({args:e={},factory:t,message:n=[],severity:i=ri.Violation}={}){this.severity=i,this.message=n.map(s=>t.literal(tm(s.value,e),s.language||null))}}class Ka{constructor({factory:e=Qa}={}){this.factory=e}clone({factory:e}={}){return new Ka({factory:e||this.factory})}validate(){return new Cr}validateSimple(){return!0}}class Pr extends Ka{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 Pr({datatypes:this.datatypes,factory:e||this.factory})}}class rm{constructor({factory:e=Qa,validations:t}={}){if(this.factory=e,this.validations=new Fr,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 Cr}validateSimple(e){const t=this.validations.get(e.datatype);return t?t.validateSimple(e):!0}}class Pe extends Pr{constructor(e,t,{factory:n}={}){super({datatypes:t,factory:n}),this.message=[this.factory.literal("term value {$this} matches pattern {$pattern}")],this.patterns=Array.isArray(e)?e:[e]}clone({factory:e}={}){return new Pe(this.patterns,this.datatypes,{factory:e||this.factory})}validate(e){const t=this.patterns.map(n=>{let i;n.test(e.value)&&(i=rd.Debug);const s={pattern:this.factory.literal(n.toString()),this:e};return new li({args:s,factory:this.factory,message:this.message,severity:i})});return new Cr({results:t})}validateSimple(e){return this.patterns.every(t=>t.test(e.value))}}const nm=/^([-+]?[0-9]+)$/;class st extends Pe{constructor(e=null,t=null,n,{factory:i}={}){super(nm,n,{factory:i}),this.maxInclusive=null,this.minInclusive=null,typeof t=="string"&&(this.maxInclusive=BigInt(t)),typeof e=="string"&&(this.minInclusive=BigInt(e))}clone({factory:e}={}){return new st(this.minInclusive?.toString(),this.maxInclusive?.toString(),this.datatypes,{factory:e||this.factory})}validate(e){const t=super.validate(e).results;if(!rd.Debug.equals(t[0].severity))return new Cr({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 li({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 li({factory:this.factory,message:s}))}return new Cr({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 Pr{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 li({factory:this.factory,message:i}))}return new Cr({results:t})}validateSimple(e){return this.values.has(e.value)}}const Te={xsd:gt("http://www.w3.org/2001/XMLSchema#")},im=new Pr({datatypes:Te.xsd.anySimpleType}),sm=new Pr({datatypes:Te.xsd.anyAtomicType}),vi=/^([^\ud8ff-\udfff\ufffe-\uffff]*)$/,am=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+))$/,nd=/^((\+|-)?([0-9]+(\.[0-9]*)?|\.[0-9]+)([Ee](\+|-)?[0-9]+)?|(\+|-)?INF|NaN)$/,Za=/^(-?P((([0-9]+Y([0-9]+M)?([0-9]+D)?|([0-9]+M)([0-9]+D)?|([0-9]+D))(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))?)|(T(([0-9]+H)([0-9]+M)?([0-9]+(\.[0-9]+)?S)?|([0-9]+M)([0-9]+(\.[0-9]+)?S)?|([0-9]+(\.[0-9]+)?S)))))$/,id=/^(-?([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))?)$/,om=/^((([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))?)$/,lm=/^(-?([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))?)$/,um=/^(-?([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))?)$/,cm=/^(-?([1-9][0-9]{3,}|0[0-9]{3})(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,dm=/^(--(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))?)$/,hm=/^(---(0[1-9]|[12][0-9]|3[01])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,fm=/^(--(0[1-9]|1[0-2])(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))?)$/,pm=/^(([0-9a-fA-F]{2})*)$/,gm=/^(((([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] ?= ?=))?)$/,mm=new Pe(vi,Te.xsd.string),ym=new Ya(["1","true","0","false"],Te.xsd.boolean),bm=new Pe(am,Te.xsd.decimal),_m=new Pe(nd,Te.xsd.float),wm=new Pe(nd,Te.xsd.double),vm=new Pe(Za,Te.xsd.duration),xm=new Pe(id,Te.xsd.dateTime),Em=new Pe(om,Te.xsd.time),Sm=new Pe(lm,Te.xsd.date),Im=new Pe(um,Te.xsd.gYearMonth),Nm=new Pe(cm,Te.xsd.gYear),Rm=new Pe(dm,Te.xsd.gMonthDay),Tm=new Pe(hm,Te.xsd.gDay),Am=new Pe(fm,Te.xsd.gMonth),Dm=new Pe(pm,Te.xsd.hexBinary),Lm=new Pe(gm,Te.xsd.base64Binary),Om=new Pe(vi,Te.xsd.anyURI),sd=/^([^\u000d\u000a\u0009]*)$/,Cm=/^([^ ]+( [^ ]+)*)*$/,jm=/^([a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*)$/,$m=/^([^DT]*)$/,Fm=/^([^YM]*[DT].*)$/,km=/^(.*(Z|(\+|-)[0-9][0-9]:[0-9][0-9]))$/,Pm=new Pe([vi,sd],Te.xsd.normalizedString),Mm=new Pe([vi,sd,Cm],Te.xsd.token),Bm=new Pe(jm,Te.xsd.language),qm=new st(null,null,Te.xsd.integer),Um=new st(null,"0",Te.xsd.nonPositiveInteger),Hm=new st(null,"-1",Te.xsd.negativeInteger),Vm=new st("-9223372036854775808","9223372036854775807",Te.xsd.long),Gm=new st("-2147483648","2147483647",Te.xsd.int),Wm=new st("-32768","32767",Te.xsd.short),zm=new st("-128","127",Te.xsd.byte),Qm=new st("0",null,Te.xsd.nonNegativeInteger),Xm=new st("0","18446744073709551615",Te.xsd.unsignedLong),Jm=new st("0","4294967295",Te.xsd.unsignedInt),Km=new st("0","65535",Te.xsd.unsignedShort),Ym=new st("0","255",Te.xsd.unsignedByte),Zm=new st("1",null,Te.xsd.positiveInteger),ey=new Pe([Za,$m],Te.xsd.yearMonthDuration),ty=new Pe([Za,Fm],Te.xsd.dayTimeDuration),ry=new Pe([id,km],Te.xsd.dateTimeStamp),ny=Object.freeze(Object.defineProperty({__proto__:null,anyAtomicType:sm,anySimpleType:im,anyURI:Om,base64Binary:Lm,boolean:ym,byte:zm,date:Sm,dateTime:xm,dateTimeStamp:ry,dayTimeDuration:ty,decimal:bm,double:wm,duration:vm,float:_m,gDay:Tm,gMonth:Am,gMonthDay:Rm,gYear:Nm,gYearMonth:Im,hexBinary:Dm,int:Gm,integer:qm,language:Bm,long:Vm,negativeInteger:Hm,nonNegativeInteger:Qm,nonPositiveInteger:Um,normalizedString:Pm,positiveInteger:Zm,short:Wm,string:mm,time:Em,token:Mm,unsignedByte:Ym,unsignedInt:Jm,unsignedLong:Xm,unsignedShort:Km,yearMonthDuration:ey},Symbol.toStringTag,{value:"Module"}));class iy extends rm{constructor({factory:e}={}){super({factory:e,validations:{...ny}})}}const sy=new Fr([[ae.BlankNode,new Set(["BlankNode"])],[ae.BlankNodeOrIRI,new Set(["BlankNode","NamedNode"])],[ae.BlankNodeOrLiteral,new Set(["BlankNode","Literal"])],[ae.IRI,new Set(["NamedNode"])],[ae.IRIOrLiteral,new Set(["NamedNode","Literal"])],[ae.Literal,new Set(["Literal"])]]);function ay(r){const e=r.ptr.out([ae.class]).map(t=>_a(t));return{generic:oy(e)}}function oy(r){return e=>{const t=new ft(e.valueOrNode.out([fr.type]).terms);for(const n of r){const i=[...t].some(s=>n.has(s));e.test(i,ae.ClassConstraintComponent,{value:e.valueOrNode})}}}function ly(r){const e=r.ptr.out([ae.datatype]).term,t=new iy;return{generic:uy(e,t)}}function uy(r,e){return t=>{const n=r.equals(t.valueOrNode.term.datatype)&&e.validateSimple(t.valueOrNode.term);t.test(n,ae.DatatypeConstraintComponent,{args:{datatype:r},message:[t.factory.literal("Value does not have datatype {$datatype}")],value:t.valueOrNode})}}function cy(r){const e=r.ptr.out([ae.nodeKind]).term,t=sy.get(e);return{generic:dy(e,t)}}function dy(r,e){return t=>{t.test(e.has(t.valueOrNode.term.termType),ae.NodeKindConstraintComponent,{args:{nodeKind:r},message:[t.factory.literal("Value does not have node kind {$nodeKind}")],value:t.valueOrNode})}}const hy=new Fr([[ae.maxCount,Zp],[ae.minCount,tg],[ae.and,ag],[ae.not,lg],[ae.or,cg],[ae.xone,hg],[ae.closed,pg],[ae.hasValue,mg],[ae.in,_g],[ae.disjoint,vg],[ae.equals,Eg],[ae.lessThan,Ng],[ae.lessThanOrEquals,Tg],[ae.maxExclusive,Dg],[ae.maxInclusive,Og],[ae.minExclusive,jg],[ae.minInclusive,Fg],[ae.node,Pg],[ae.property,Bg],[ae.qualifiedValueShape,Ug],[ae.languageIn,Gg],[ae.maxLength,zg],[ae.minLength,Xg],[ae.pattern,Kg],[ae.uniqueLang,Zg],[ae.class,ay],[ae.datatype,ly],[ae.nodeKind,cy]]);class fy{constructor(e,{factory:t,...n}){if(this.factory=t,this.options=n,this.registry=new qp(hy),this.shapesPtr=new oi({dataset:e,factory:t}),this.shapes=new Fr,this.options.coverage&&(this.options.debug=!0,this.options.details=!0,this.options.trace=!0),this.options.validations)for(const[s,a]of this.options.validations)this.registry.validations.set(s,a);const i=[...this.shapesPtr.hasOut([ae.targetClass]),...this.shapesPtr.hasOut([ae.targetNode]),...this.shapesPtr.hasOut([ae.targetObjectsOf]),...this.shapesPtr.hasOut([ae.targetSubjectsOf]),...this.shapesPtr.hasOut([fr.type],[ae.NodeShape]),...this.shapesPtr.hasOut([fr.type],[ae.PropertyShape])];for(const s of i)this.shape(s)}shape(e){if(!e.term)return null;let t=this.shapes.get(e.term);return t||(t=new Yp(e,{validator:this}),this.shapes.set(e.term,t)),t}async validate(e,t){const n=new oi({...e,factory:this.factory}),i=new Ja({factory:this.factory,focusNode:n,options:this.options,validator:this});t?t=t.map(s=>this.shape(this.shapesPtr.node(s.terms))):t=this.shapes.values();for(const s of t){const a=i.create({shape:s});let o;n.isAny()?o=s.resolveTargets(a):o=n;for(const u of o)await s.validate(a.create({focusNode:u}))}return i.report}}const py=`
401
+ .editor:not([type='checkbox']) { border: 1px solid #DDD; }
402
+ .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; }
403
+ .property-instance:not(:first-child) > label:not(.persistent) { visibility: hidden; max-height: 0; }
404
+ .mode-edit .property-instance label { width: var(--label-width); }
405
+ `;class gy extends Yd{constructor(e){super(e||py),this.idCtr=0}createDefaultTemplate(e,t,n,i,s){i.id=`e${this.idCtr++}`,i.classList.add("editor"),s?.datatype?i.shaclDatatype=s.datatype:t instanceof _t&&(i.shaclDatatype=t.datatype),s?.minCount!==void 0&&(i.dataset.minCount=String(s.minCount)),s?.class&&(i.dataset.class=s.class.value),s?.nodeKind?i.dataset.nodeKind=s.nodeKind.value:t instanceof Nr&&(i.dataset.nodeKind=xe+"IRI"),(s?.hasValue||s?.readonly)&&(i.disabled=!0),i.value=t?.value||s?.defaultValue?.value||"";const a=document.createElement("label");a.htmlFor=i.id,a.innerText=e,s?.description&&a.setAttribute("title",s.description.value);const o=s?.description?s.description.value:s?.pattern?s.pattern:null;o&&i.setAttribute("placeholder",o),n&&(i.setAttribute("required","true"),a.classList.add("required"));const u=document.createElement("div");return u.appendChild(a),u.appendChild(i),u}createDateEditor(e,t,n,i){const s=new Ue;i.datatype?.value===Wt+"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===Wt+"dateTime"?o=o.slice(0,19):o=o.slice(0,10),s.value=o}catch(o){console.error(o,t)}return a}createTextEditor(e,t,n,i){let s;return i.singleLine===!1?(s=new cr,s.resize="auto"):s=new Ue,s.dense=!0,i.pattern&&(s.pattern=i.pattern),i.minLength&&(s.minLength=i.minLength),i.maxLength&&(s.maxLength=i.maxLength),this.createDefaultTemplate(e,t,n,s,i)}createLangStringEditor(e,t,n,i){const s=this.createTextEditor(e,t,n,i),a=s.querySelector(":scope .editor");let o;if(i.languageIn?.length){o=document.createElement("select");for(const u of i.languageIn){const l=document.createElement("option");l.innerText=u.value,o.appendChild(l)}}else o=document.createElement("input"),o.maxLength=5,o.size=5,o.placeholder="lang?";return o.title="Language of the text",o.classList.add("lang-chooser"),o.slot="suffix",o.addEventListener("change",u=>{u.stopPropagation(),a&&(a.dataset.lang=o.value,a.dispatchEvent(new Event("change",{bubbles:!0})))}),t instanceof _t&&(o.value=t.language),a.dataset.lang=o.value,a.appendChild(o),s}createBooleanEditor(e,t,n,i){const s=document.createElement("input");s.type="checkbox",s.classList.add("ml-0");const a=this.createDefaultTemplate(e,null,n,s,i);return s.removeAttribute("required"),a.querySelector(":scope label")?.classList.remove("required"),t instanceof _t&&(s.checked=t.value==="true"),a}createFileEditor(e,t,n,i){const s=document.createElement("input");return s.type="file",s.addEventListener("change",a=>{if(s.files?.length){a.stopPropagation();const o=new FileReader;o.readAsDataURL(s.files[0]),o.onload=()=>{s.binaryData=btoa(o.result),s.parentElement?.dispatchEvent(new Event("change",{bubbles:!0}))}}else s.binaryData=void 0}),this.createDefaultTemplate(e,t,n,s,i)}createNumberEditor(e,t,n,i){const s=new Ue;s.type="number",s.clearable=!0,s.dense=!0,s.classList.add("pr-0");const a=i.minInclusive!==void 0?i.minInclusive:i.minExclusive!==void 0?i.minExclusive+1:void 0,o=i.maxInclusive!==void 0?i.maxInclusive:i.maxExclusive!==void 0?i.maxExclusive-1:void 0;return a!==void 0&&(s.min=String(a)),o!==void 0&&(s.max=String(o)),i.datatype?.value!==Wt+"integer"&&(s.step="0.1"),this.createDefaultTemplate(e,t,n,s,i)}createListEditor(e,t,n,i,s){const a=new Ge;a.clearable=!0,a.dense=!0;const o=this.createDefaultTemplate(e,null,n,a,s),u=document.createElement("ul");let l=!0;const c=(d,b)=>{const y=document.createElement("li");if(typeof d.value=="string"?(y.dataset.value=d.value,y.innerText=d.label?d.label:d.value):(y.dataset.value=d.value.id,d.value instanceof Nr&&(y.dataset.value="<"+y.dataset.value+">"),y.innerText=d.label?d.label:d.value.value),b.appendChild(y),d.children?.length){l=!1;const _=document.createElement("ul");y.appendChild(_);for(const E of d.children)c(E,_)}};for(const d of i)c(d,u);return l||(a.collapse=!0),a.appendChild(u),t&&(a.value=t.id,t instanceof Nr&&(a.value="<"+a.value+">")),o}createButton(e,t){const n=document.createElement("rokit-button");return n.innerHTML=e,n}}class my extends HTMLElement{constructor(){super(),this.shape=null,this.attachShadow({mode:"open"}),this.form=document.createElement("form"),this.config=new hu(new gy,this.form),this.form.addEventListener("change",e=>{e.stopPropagation(),this.config.editMode&&this.validate(!0).then(t=>{this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,composed:!0,detail:{valid:t.conforms,report:t}}))}).catch(t=>{console.warn(t)})})}static get observedAttributes(){return hu.dataAttributes()}connectedCallback(){this.shadowRoot.prepend(this.form)}attributeChangedCallback(){this.config.updateAttributes(this),this.initialize()}initialize(){clearTimeout(this.initDebounceTimeout),this.setAttribute("loading",""),this.form.replaceChildren(document.createTextNode(this.config.attributes.loading)),this.initDebounceTimeout=setTimeout(async()=>{try{await this.config.loader.loadGraphs(),this.form.replaceChildren(),this.config.renderedNodes.clear();const e=this.findRootShaclShapeSubject();if(e){this.form.classList.forEach(n=>{this.form.classList.remove(n)}),this.form.classList.toggle("mode-edit",this.config.editMode),this.form.classList.toggle("mode-view",!this.config.editMode),this.config.theme.apply(this.form);const t=[this.config.theme.stylesheet];for(const n of ih())n.stylesheet&&t.push(n.stylesheet);if(this.shadowRoot.adoptedStyleSheets=t,this.shape=new zt(e,this.config,this.config.attributes.valuesSubject?Ne.namedNode(this.config.attributes.valuesSubject):void 0),this.form.appendChild(this.shape),this.config.editMode){if(this.config.attributes.submitButton!==null){const n=this.config.theme.createButton(this.config.attributes.submitButton||"Submit",!0);n.addEventListener("click",i=>{i.preventDefault(),this.form.reportValidity()&&this.validate().then(s=>{if(s?.conforms)this.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}));else{let a=this.form.querySelector(":scope .invalid > .editor");a?a.focus():this.form.querySelector(":scope .invalid")?.scrollIntoView()}})}),this.form.appendChild(n)}this.config.attributes.valuesSubject&&this.removeFromDataGraph(Ne.namedNode(this.config.attributes.valuesSubject)),await this.validate(!0)}}else if(this.config.store.countQuads(null,null,null,yn)>0)throw new Error("shacl root node shape not found")}catch(e){console.error(e);const t=document.createElement("div");t.innerText=String(e),this.form.replaceChildren(t)}this.removeAttribute("loading")},200)}serialize(e="text/turtle",t=this.toRDF()){const n=t.getQuads(null,null,null,null);return eh(n,e,this.config.prefixes)}toRDF(e=new et){return this.shape?.toRDF(e),e}registerPlugin(e){nh(e),this.initialize()}setTheme(e){this.config.theme=e,this.initialize()}setClassInstanceProvider(e){this.config.classInstanceProvider=e,this.initialize()}async validate(e=!1){for(const t of this.form.querySelectorAll(":scope .validation-error"))t.remove();for(const t of this.form.querySelectorAll(":scope .property-instance"))t.classList.remove("invalid"),t.querySelector(":scope > .editor")?.value?t.classList.add("valid"):t.classList.remove("valid");this.config.store.deleteGraph(this.config.valuesGraphId||""),this.shape&&(this.shape.toRDF(this.config.store),this.config.store.add(new ui(this.shape.shaclSubject,Ne.namedNode(xe+"targetNode"),this.shape.nodeId,this.config.valuesGraphId)));try{const t=this.config.store,n=await new fy(t,{details:!0,factory:Ne}).validate({dataset:t});for(const i of n.results)if(i.focusNode?.ptrs?.length)for(const s of i.focusNode.ptrs){const a=s._term;if(i.path?.length){const o=i.path[0].predicates[0];let u=this.form.querySelectorAll(`
406
+ :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
407
+ :scope shacl-node[data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor,
408
+ :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .property-instance[data-path='${o.id}'] > .editor,
409
+ :scope shacl-node[data-node-id='${a.id}'] > .shacl-group > shacl-property > .shacl-group > .property-instance[data-path='${o.id}'] > .editor`);u.length===0&&(u=this.form.querySelectorAll(`
410
+ :scope [data-node-id='${a.id}'] > shacl-property > .property-instance[data-path='${o.id}'],
411
+ :scope [data-node-id='${a.id}'] > shacl-property > .shacl-group > .property-instance[data-path='${o.id}']`));for(const l of u)if(l.classList.contains("editor")){if(!e||l.value){let c=l.parentElement;c.classList.add("invalid"),c.classList.remove("valid"),c.appendChild(this.createValidationErrorDisplay(i));do c instanceof nt&&(c.open=!0),c=c.parentElement;while(c)}}else e||(l.classList.add("invalid"),l.classList.remove("valid"),l.appendChild(this.createValidationErrorDisplay(i,"node")))}else e||this.form.querySelector(`:scope [data-node-id='${a.id}']`)?.prepend(this.createValidationErrorDisplay(i,"node"))}return n}catch(t){return console.error(t),!1}}createValidationErrorDisplay(e,t){const n=document.createElement("span");if(n.classList.add("validation-error"),t&&n.classList.add(t),e)if(e.message?.length>0)for(const i of e.message)n.title+=i.value+`
412
+ `;else n.title=e.sourceConstraintComponent?.value;return n}findRootShaclShapeSubject(){let e=null;if(this.config.attributes.shapeSubject){if(e=Ne.namedNode(this.config.attributes.shapeSubject),this.config.store.getQuads(e,tt,Hn,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,Lt)>0){const t=Ne.namedNode(this.config.attributes.valuesSubject),n=[...this.config.store.getQuads(t,tt,null,Lt),...this.config.store.getQuads(t,ca,null,Lt)];if(n.length===0){console.warn(`value subject '${this.config.attributes.valuesSubject}' has neither ${tt.id} nor ${ca.id} statement`);return}for(const i of n)if(this.config.store.getQuads(i.object,tt,Hn,null).length>0){e=i.object;break}if(!e){const i=this.config.store.getQuads(null,Rr,n[0].object,null);if(i.length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' has no shacl shape definition in the shapes graph`);return}if(i.length>1&&console.warn(`value subject '${this.config.attributes.valuesSubject}' has multiple shacl shape definitions in the shapes graph, choosing the first found (${i[0].subject})`),this.config.store.getQuads(i[0].subject,tt,Hn,null).length===0){console.error(`value subject '${this.config.attributes.valuesSubject}' references a shape which is not a NodeShape (${i[0].subject})`);return}e=i[0].subject}}else{const t=this.config.store.getQuads(null,tt,Hn,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,Lt))this.config.store.delete(t),(t.object.termType==="NamedNode"||t.object.termType==="BlankNode")&&this.removeFromDataGraph(t.object)}}window.customElements.define("shacl-form",my);export{hu as Config,rp as Loader,Sy as Plugin,my as ShaclForm,Jd as ShaclPropertyTemplate,Yd as Theme,Tn as findLabel,nh as registerPlugin};