prez-lib 4.1.3 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/prez-lib.js +5413 -5244
- package/dist/prez-lib.umd.cjs +17 -17
- package/dist/store.d.ts +1 -0
- package/dist/types.d.ts +1 -1
- package/package.json +13 -13
package/dist/prez-lib.umd.cjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(me,et){typeof exports=="object"&&typeof module<"u"?et(exports):typeof define=="function"&&define.amd?define(["exports"],et):(me=typeof globalThis<"u"?globalThis:me||self,et(me["prez-lib"]={}))})(this,(function(me){"use strict";function et(l){return l.value!==void 0}function Ft(l){const e={value:typeof l=="string"?l:l.value,termType:"NamedNode",equals:t=>!!t&&e.termType===t.termType&&e.value===t.value};return typeof l!="string"&&Object.assign(e,l),e}function yt(l){const e={value:typeof l=="string"?l:l.value,termType:"Literal",equals:t=>t&&e.termType===t.termType&&e.value===t.value?e.language!==t.language?!1:e.datatype===t.datatype:!1};return typeof l!="string"&&Object.assign(e,l),e}function gt(l){const e={value:typeof l=="string"?l:l.value,properties:{},termType:"BlankNode",equals:t=>!!t&&e.termType===t.termType&&e.value===t.value&&e.properties===t.properties};return typeof l!="string"&&Object.assign(e,l),e}var kt={},tt={},xr;function Mn(){if(xr)return tt;xr=1,tt.byteLength=o,tt.toByteArray=h,tt.fromByteArray=j;for(var l=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=r.length;s<a;++s)l[s]=r[s],e[r.charCodeAt(s)]=s;e[45]=62,e[95]=63;function u(L){var v=L.length;if(v%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var A=L.indexOf("=");A===-1&&(A=v);var g=A===v?0:4-A%4;return[A,g]}function o(L){var v=u(L),A=v[0],g=v[1];return(A+g)*3/4-g}function b(L,v,A){return(v+A)*3/4-A}function h(L){var v,A=u(L),g=A[0],_=A[1],m=new t(b(L,g,_)),w=0,P=_>0?g-4:g,I;for(I=0;I<P;I+=4)v=e[L.charCodeAt(I)]<<18|e[L.charCodeAt(I+1)]<<12|e[L.charCodeAt(I+2)]<<6|e[L.charCodeAt(I+3)],m[w++]=v>>16&255,m[w++]=v>>8&255,m[w++]=v&255;return _===2&&(v=e[L.charCodeAt(I)]<<2|e[L.charCodeAt(I+1)]>>4,m[w++]=v&255),_===1&&(v=e[L.charCodeAt(I)]<<10|e[L.charCodeAt(I+1)]<<4|e[L.charCodeAt(I+2)]>>2,m[w++]=v>>8&255,m[w++]=v&255),m}function x(L){return l[L>>18&63]+l[L>>12&63]+l[L>>6&63]+l[L&63]}function T(L,v,A){for(var g,_=[],m=v;m<A;m+=3)g=(L[m]<<16&16711680)+(L[m+1]<<8&65280)+(L[m+2]&255),_.push(x(g));return _.join("")}function j(L){for(var v,A=L.length,g=A%3,_=[],m=16383,w=0,P=A-g;w<P;w+=m)_.push(T(L,w,w+m>P?P:w+m));return g===1?(v=L[A-1],_.push(l[v>>2]+l[v<<4&63]+"==")):g===2&&(v=(L[A-2]<<8)+L[A-1],_.push(l[v>>10]+l[v>>4&63]+l[v<<2&63]+"=")),_.join("")}return tt}var wt={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var Er;function Dn(){return Er||(Er=1,wt.read=function(l,e,t,r,s){var a,u,o=s*8-r-1,b=(1<<o)-1,h=b>>1,x=-7,T=t?s-1:0,j=t?-1:1,L=l[e+T];for(T+=j,a=L&(1<<-x)-1,L>>=-x,x+=o;x>0;a=a*256+l[e+T],T+=j,x-=8);for(u=a&(1<<-x)-1,a>>=-x,x+=r;x>0;u=u*256+l[e+T],T+=j,x-=8);if(a===0)a=1-h;else{if(a===b)return u?NaN:(L?-1:1)*(1/0);u=u+Math.pow(2,r),a=a-h}return(L?-1:1)*u*Math.pow(2,a-r)},wt.write=function(l,e,t,r,s,a){var u,o,b,h=a*8-s-1,x=(1<<h)-1,T=x>>1,j=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=r?0:a-1,v=r?1:-1,A=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,u=x):(u=Math.floor(Math.log(e)/Math.LN2),e*(b=Math.pow(2,-u))<1&&(u--,b*=2),u+T>=1?e+=j/b:e+=j*Math.pow(2,1-T),e*b>=2&&(u++,b/=2),u+T>=x?(o=0,u=x):u+T>=1?(o=(e*b-1)*Math.pow(2,s),u=u+T):(o=e*Math.pow(2,T-1)*Math.pow(2,s),u=0));s>=8;l[t+L]=o&255,L+=v,o/=256,s-=8);for(u=u<<s|o,h+=s;h>0;l[t+L]=u&255,L+=v,u/=256,h-=8);l[t+L-v]|=A*128}),wt}/*!
|
|
2
2
|
* The buffer module from node.js, for the browser.
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/(function(t){const e=Xt,r=vr,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=B,t.INSPECT_MAX_BYTES=50;const i=2147483647;t.kMaxLength=i,u.TYPED_ARRAY_SUPPORT=a(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{const f=new Uint8Array(1),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(f,s),f.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function l(f){if(f>i)throw new RangeError('The value "'+f+'" is invalid for option "size"');const s=new Uint8Array(f);return Object.setPrototypeOf(s,u.prototype),s}function u(f,s,o){if(typeof f=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return x(f)}return p(f,s,o)}u.poolSize=8192;function p(f,s,o){if(typeof f=="string")return I(f,s);if(ArrayBuffer.isView(f))return R(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(O(f,ArrayBuffer)||f&&O(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(O(f,SharedArrayBuffer)||f&&O(f.buffer,SharedArrayBuffer)))return w(f,s,o);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const d=f.valueOf&&f.valueOf();if(d!=null&&d!==f)return u.from(d,s,o);const b=A(f);if(b)return b;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return u.from(f[Symbol.toPrimitive]("string"),s,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}u.from=function(f,s,o){return p(f,s,o)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function _(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function y(f,s,o){return _(f),f<=0?l(f):s!==void 0?typeof o=="string"?l(f).fill(s,o):l(f).fill(s):l(f)}u.alloc=function(f,s,o){return y(f,s,o)};function x(f){return _(f),l(f<0?0:$(f)|0)}u.allocUnsafe=function(f){return x(f)},u.allocUnsafeSlow=function(f){return x(f)};function I(f,s){if((typeof s!="string"||s==="")&&(s="utf8"),!u.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const o=T(f,s)|0;let d=l(o);const b=d.write(f,s);return b!==o&&(d=d.slice(0,b)),d}function S(f){const s=f.length<0?0:$(f.length)|0,o=l(s);for(let d=0;d<s;d+=1)o[d]=f[d]&255;return o}function R(f){if(O(f,Uint8Array)){const s=new Uint8Array(f);return w(s.buffer,s.byteOffset,s.byteLength)}return S(f)}function w(f,s,o){if(s<0||f.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<s+(o||0))throw new RangeError('"length" is outside of buffer bounds');let d;return s===void 0&&o===void 0?d=new Uint8Array(f):o===void 0?d=new Uint8Array(f,s):d=new Uint8Array(f,s,o),Object.setPrototypeOf(d,u.prototype),d}function A(f){if(u.isBuffer(f)){const s=$(f.length)|0,o=l(s);return o.length===0||f.copy(o,0,0,s),o}if(f.length!==void 0)return typeof f.length!="number"||Le(f.length)?l(0):S(f);if(f.type==="Buffer"&&Array.isArray(f.data))return S(f.data)}function $(f){if(f>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return f|0}function B(f){return+f!=f&&(f=0),u.alloc(+f)}u.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==u.prototype},u.compare=function(s,o){if(O(s,Uint8Array)&&(s=u.from(s,s.offset,s.byteLength)),O(o,Uint8Array)&&(o=u.from(o,o.offset,o.byteLength)),!u.isBuffer(s)||!u.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===o)return 0;let d=s.length,b=o.length;for(let E=0,v=Math.min(d,b);E<v;++E)if(s[E]!==o[E]){d=s[E],b=o[E];break}return d<b?-1:b<d?1:0},u.isEncoding=function(s){switch(String(s).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}},u.concat=function(s,o){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return u.alloc(0);let d;if(o===void 0)for(o=0,d=0;d<s.length;++d)o+=s[d].length;const b=u.allocUnsafe(o);let E=0;for(d=0;d<s.length;++d){let v=s[d];if(O(v,Uint8Array))E+v.length>b.length?(u.isBuffer(v)||(v=u.from(v)),v.copy(b,E)):Uint8Array.prototype.set.call(b,v,E);else if(u.isBuffer(v))v.copy(b,E);else throw new TypeError('"list" argument must be an Array of Buffers');E+=v.length}return b};function T(f,s){if(u.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||O(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const o=f.length,d=arguments.length>2&&arguments[2]===!0;if(!d&&o===0)return 0;let b=!1;for(;;)switch(s){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return F(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Y(f).length;default:if(b)return d?-1:F(f).length;s=(""+s).toLowerCase(),b=!0}}u.byteLength=T;function q(f,s,o){let d=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,s>>>=0,o<=s))return"";for(f||(f="utf8");;)switch(f){case"hex":return re(this,s,o);case"utf8":case"utf-8":return K(this,s,o);case"ascii":return ue(this,s,o);case"latin1":case"binary":return fe(this,s,o);case"base64":return P(this,s,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ce(this,s,o);default:if(d)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),d=!0}}u.prototype._isBuffer=!0;function U(f,s,o){const d=f[s];f[s]=f[o],f[o]=d}u.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let o=0;o<s;o+=2)U(this,o,o+1);return this},u.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let o=0;o<s;o+=4)U(this,o,o+3),U(this,o+1,o+2);return this},u.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let o=0;o<s;o+=8)U(this,o,o+7),U(this,o+1,o+6),U(this,o+2,o+5),U(this,o+3,o+4);return this},u.prototype.toString=function(){const s=this.length;return s===0?"":arguments.length===0?K(this,0,s):q.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(s){if(!u.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:u.compare(this,s)===0},u.prototype.inspect=function(){let s="";const o=t.INSPECT_MAX_BYTES;return s=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(s+=" ... "),"<Buffer "+s+">"},n&&(u.prototype[n]=u.prototype.inspect),u.prototype.compare=function(s,o,d,b,E){if(O(s,Uint8Array)&&(s=u.from(s,s.offset,s.byteLength)),!u.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(o===void 0&&(o=0),d===void 0&&(d=s?s.length:0),b===void 0&&(b=0),E===void 0&&(E=this.length),o<0||d>s.length||b<0||E>this.length)throw new RangeError("out of range index");if(b>=E&&o>=d)return 0;if(b>=E)return-1;if(o>=d)return 1;if(o>>>=0,d>>>=0,b>>>=0,E>>>=0,this===s)return 0;let v=E-b,W=d-o;const ie=Math.min(v,W),J=this.slice(b,E),se=s.slice(o,d);for(let V=0;V<ie;++V)if(J[V]!==se[V]){v=J[V],W=se[V];break}return v<W?-1:W<v?1:0};function ae(f,s,o,d,b){if(f.length===0)return-1;if(typeof o=="string"?(d=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Le(o)&&(o=b?0:f.length-1),o<0&&(o=f.length+o),o>=f.length){if(b)return-1;o=f.length-1}else if(o<0)if(b)o=0;else return-1;if(typeof s=="string"&&(s=u.from(s,d)),u.isBuffer(s))return s.length===0?-1:Ee(f,s,o,d,b);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?b?Uint8Array.prototype.indexOf.call(f,s,o):Uint8Array.prototype.lastIndexOf.call(f,s,o):Ee(f,[s],o,d,b);throw new TypeError("val must be string, number or Buffer")}function Ee(f,s,o,d,b){let E=1,v=f.length,W=s.length;if(d!==void 0&&(d=String(d).toLowerCase(),d==="ucs2"||d==="ucs-2"||d==="utf16le"||d==="utf-16le")){if(f.length<2||s.length<2)return-1;E=2,v/=2,W/=2,o/=2}function ie(se,V){return E===1?se[V]:se.readUInt16BE(V*E)}let J;if(b){let se=-1;for(J=o;J<v;J++)if(ie(f,J)===ie(s,se===-1?0:J-se)){if(se===-1&&(se=J),J-se+1===W)return se*E}else se!==-1&&(J-=J-se),se=-1}else for(o+W>v&&(o=v-W),J=o;J>=0;J--){let se=!0;for(let V=0;V<W;V++)if(ie(f,J+V)!==ie(s,V)){se=!1;break}if(se)return J}return-1}u.prototype.includes=function(s,o,d){return this.indexOf(s,o,d)!==-1},u.prototype.indexOf=function(s,o,d){return ae(this,s,o,d,!0)},u.prototype.lastIndexOf=function(s,o,d){return ae(this,s,o,d,!1)};function ee(f,s,o,d){o=Number(o)||0;const b=f.length-o;d?(d=Number(d),d>b&&(d=b)):d=b;const E=s.length;d>E/2&&(d=E/2);let v;for(v=0;v<d;++v){const W=parseInt(s.substr(v*2,2),16);if(Le(W))return v;f[o+v]=W}return v}function le(f,s,o,d){return Re(F(s,f.length-o),f,o,d)}function ge(f,s,o,d){return Re(Z(s),f,o,d)}function we(f,s,o,d){return Re(Y(s),f,o,d)}function Q(f,s,o,d){return Re(te(s,f.length-o),f,o,d)}u.prototype.write=function(s,o,d,b){if(o===void 0)b="utf8",d=this.length,o=0;else if(d===void 0&&typeof o=="string")b=o,d=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(d)?(d=d>>>0,b===void 0&&(b="utf8")):(b=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const E=this.length-o;if((d===void 0||d>E)&&(d=E),s.length>0&&(d<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");b||(b="utf8");let v=!1;for(;;)switch(b){case"hex":return ee(this,s,o,d);case"utf8":case"utf-8":return le(this,s,o,d);case"ascii":case"latin1":case"binary":return ge(this,s,o,d);case"base64":return we(this,s,o,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Q(this,s,o,d);default:if(v)throw new TypeError("Unknown encoding: "+b);b=(""+b).toLowerCase(),v=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(f,s,o){return s===0&&o===f.length?e.fromByteArray(f):e.fromByteArray(f.slice(s,o))}function K(f,s,o){o=Math.min(f.length,o);const d=[];let b=s;for(;b<o;){const E=f[b];let v=null,W=E>239?4:E>223?3:E>191?2:1;if(b+W<=o){let ie,J,se,V;switch(W){case 1:E<128&&(v=E);break;case 2:ie=f[b+1],(ie&192)===128&&(V=(E&31)<<6|ie&63,V>127&&(v=V));break;case 3:ie=f[b+1],J=f[b+2],(ie&192)===128&&(J&192)===128&&(V=(E&15)<<12|(ie&63)<<6|J&63,V>2047&&(V<55296||V>57343)&&(v=V));break;case 4:ie=f[b+1],J=f[b+2],se=f[b+3],(ie&192)===128&&(J&192)===128&&(se&192)===128&&(V=(E&15)<<18|(ie&63)<<12|(J&63)<<6|se&63,V>65535&&V<1114112&&(v=V))}}v===null?(v=65533,W=1):v>65535&&(v-=65536,d.push(v>>>10&1023|55296),v=56320|v&1023),d.push(v),b+=W}return H(d)}const G=4096;function H(f){const s=f.length;if(s<=G)return String.fromCharCode.apply(String,f);let o="",d=0;for(;d<s;)o+=String.fromCharCode.apply(String,f.slice(d,d+=G));return o}function ue(f,s,o){let d="";o=Math.min(f.length,o);for(let b=s;b<o;++b)d+=String.fromCharCode(f[b]&127);return d}function fe(f,s,o){let d="";o=Math.min(f.length,o);for(let b=s;b<o;++b)d+=String.fromCharCode(f[b]);return d}function re(f,s,o){const d=f.length;(!s||s<0)&&(s=0),(!o||o<0||o>d)&&(o=d);let b="";for(let E=s;E<o;++E)b+=Kt[f[E]];return b}function ce(f,s,o){const d=f.slice(s,o);let b="";for(let E=0;E<d.length-1;E+=2)b+=String.fromCharCode(d[E]+d[E+1]*256);return b}u.prototype.slice=function(s,o){const d=this.length;s=~~s,o=o===void 0?d:~~o,s<0?(s+=d,s<0&&(s=0)):s>d&&(s=d),o<0?(o+=d,o<0&&(o=0)):o>d&&(o=d),o<s&&(o=s);const b=this.subarray(s,o);return Object.setPrototypeOf(b,u.prototype),b};function D(f,s,o){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+s>o)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(s,o,d){s=s>>>0,o=o>>>0,d||D(s,o,this.length);let b=this[s],E=1,v=0;for(;++v<o&&(E*=256);)b+=this[s+v]*E;return b},u.prototype.readUintBE=u.prototype.readUIntBE=function(s,o,d){s=s>>>0,o=o>>>0,d||D(s,o,this.length);let b=this[s+--o],E=1;for(;o>0&&(E*=256);)b+=this[s+--o]*E;return b},u.prototype.readUint8=u.prototype.readUInt8=function(s,o){return s=s>>>0,o||D(s,1,this.length),this[s]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(s,o){return s=s>>>0,o||D(s,2,this.length),this[s]|this[s+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(s,o){return s=s>>>0,o||D(s,2,this.length),this[s]<<8|this[s+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(s,o){return s=s>>>0,o||D(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(s,o){return s=s>>>0,o||D(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},u.prototype.readBigUInt64LE=Ge(function(s){s=s>>>0,g(s,"offset");const o=this[s],d=this[s+7];(o===void 0||d===void 0)&&m(s,this.length-8);const b=o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,E=this[++s]+this[++s]*2**8+this[++s]*2**16+d*2**24;return BigInt(b)+(BigInt(E)<<BigInt(32))}),u.prototype.readBigUInt64BE=Ge(function(s){s=s>>>0,g(s,"offset");const o=this[s],d=this[s+7];(o===void 0||d===void 0)&&m(s,this.length-8);const b=o*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],E=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+d;return(BigInt(b)<<BigInt(32))+BigInt(E)}),u.prototype.readIntLE=function(s,o,d){s=s>>>0,o=o>>>0,d||D(s,o,this.length);let b=this[s],E=1,v=0;for(;++v<o&&(E*=256);)b+=this[s+v]*E;return E*=128,b>=E&&(b-=Math.pow(2,8*o)),b},u.prototype.readIntBE=function(s,o,d){s=s>>>0,o=o>>>0,d||D(s,o,this.length);let b=o,E=1,v=this[s+--b];for(;b>0&&(E*=256);)v+=this[s+--b]*E;return E*=128,v>=E&&(v-=Math.pow(2,8*o)),v},u.prototype.readInt8=function(s,o){return s=s>>>0,o||D(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},u.prototype.readInt16LE=function(s,o){s=s>>>0,o||D(s,2,this.length);const d=this[s]|this[s+1]<<8;return d&32768?d|4294901760:d},u.prototype.readInt16BE=function(s,o){s=s>>>0,o||D(s,2,this.length);const d=this[s+1]|this[s]<<8;return d&32768?d|4294901760:d},u.prototype.readInt32LE=function(s,o){return s=s>>>0,o||D(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},u.prototype.readInt32BE=function(s,o){return s=s>>>0,o||D(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},u.prototype.readBigInt64LE=Ge(function(s){s=s>>>0,g(s,"offset");const o=this[s],d=this[s+7];(o===void 0||d===void 0)&&m(s,this.length-8);const b=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(d<<24);return(BigInt(b)<<BigInt(32))+BigInt(o+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),u.prototype.readBigInt64BE=Ge(function(s){s=s>>>0,g(s,"offset");const o=this[s],d=this[s+7];(o===void 0||d===void 0)&&m(s,this.length-8);const b=(o<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(b)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+d)}),u.prototype.readFloatLE=function(s,o){return s=s>>>0,o||D(s,4,this.length),r.read(this,s,!0,23,4)},u.prototype.readFloatBE=function(s,o){return s=s>>>0,o||D(s,4,this.length),r.read(this,s,!1,23,4)},u.prototype.readDoubleLE=function(s,o){return s=s>>>0,o||D(s,8,this.length),r.read(this,s,!0,52,8)},u.prototype.readDoubleBE=function(s,o){return s=s>>>0,o||D(s,8,this.length),r.read(this,s,!1,52,8)};function ne(f,s,o,d,b,E){if(!u.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>b||s<E)throw new RangeError('"value" argument is out of bounds');if(o+d>f.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(s,o,d,b){if(s=+s,o=o>>>0,d=d>>>0,!b){const W=Math.pow(2,8*d)-1;ne(this,s,o,d,W,0)}let E=1,v=0;for(this[o]=s&255;++v<d&&(E*=256);)this[o+v]=s/E&255;return o+d},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(s,o,d,b){if(s=+s,o=o>>>0,d=d>>>0,!b){const W=Math.pow(2,8*d)-1;ne(this,s,o,d,W,0)}let E=d-1,v=1;for(this[o+E]=s&255;--E>=0&&(v*=256);)this[o+E]=s/v&255;return o+d},u.prototype.writeUint8=u.prototype.writeUInt8=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,1,255,0),this[o]=s&255,o+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,2,65535,0),this[o]=s&255,this[o+1]=s>>>8,o+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,2,65535,0),this[o]=s>>>8,this[o+1]=s&255,o+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,4,4294967295,0),this[o+3]=s>>>24,this[o+2]=s>>>16,this[o+1]=s>>>8,this[o]=s&255,o+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,4,4294967295,0),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4};function M(f,s,o,d,b){rt(s,d,b,f,o,7);let E=Number(s&BigInt(4294967295));f[o++]=E,E=E>>8,f[o++]=E,E=E>>8,f[o++]=E,E=E>>8,f[o++]=E;let v=Number(s>>BigInt(32)&BigInt(4294967295));return f[o++]=v,v=v>>8,f[o++]=v,v=v>>8,f[o++]=v,v=v>>8,f[o++]=v,o}function _e(f,s,o,d,b){rt(s,d,b,f,o,7);let E=Number(s&BigInt(4294967295));f[o+7]=E,E=E>>8,f[o+6]=E,E=E>>8,f[o+5]=E,E=E>>8,f[o+4]=E;let v=Number(s>>BigInt(32)&BigInt(4294967295));return f[o+3]=v,v=v>>8,f[o+2]=v,v=v>>8,f[o+1]=v,v=v>>8,f[o]=v,o+8}u.prototype.writeBigUInt64LE=Ge(function(s,o=0){return M(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Ge(function(s,o=0){return _e(this,s,o,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(s,o,d,b){if(s=+s,o=o>>>0,!b){const ie=Math.pow(2,8*d-1);ne(this,s,o,d,ie-1,-ie)}let E=0,v=1,W=0;for(this[o]=s&255;++E<d&&(v*=256);)s<0&&W===0&&this[o+E-1]!==0&&(W=1),this[o+E]=(s/v>>0)-W&255;return o+d},u.prototype.writeIntBE=function(s,o,d,b){if(s=+s,o=o>>>0,!b){const ie=Math.pow(2,8*d-1);ne(this,s,o,d,ie-1,-ie)}let E=d-1,v=1,W=0;for(this[o+E]=s&255;--E>=0&&(v*=256);)s<0&&W===0&&this[o+E+1]!==0&&(W=1),this[o+E]=(s/v>>0)-W&255;return o+d},u.prototype.writeInt8=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,1,127,-128),s<0&&(s=255+s+1),this[o]=s&255,o+1},u.prototype.writeInt16LE=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,2,32767,-32768),this[o]=s&255,this[o+1]=s>>>8,o+2},u.prototype.writeInt16BE=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,2,32767,-32768),this[o]=s>>>8,this[o+1]=s&255,o+2},u.prototype.writeInt32LE=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,4,2147483647,-2147483648),this[o]=s&255,this[o+1]=s>>>8,this[o+2]=s>>>16,this[o+3]=s>>>24,o+4},u.prototype.writeInt32BE=function(s,o,d){return s=+s,o=o>>>0,d||ne(this,s,o,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[o]=s>>>24,this[o+1]=s>>>16,this[o+2]=s>>>8,this[o+3]=s&255,o+4},u.prototype.writeBigInt64LE=Ge(function(s,o=0){return M(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Ge(function(s,o=0){return _e(this,s,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Te(f,s,o,d,b,E){if(o+d>f.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function tt(f,s,o,d,b){return s=+s,o=o>>>0,b||Te(f,s,o,4),r.write(f,s,o,d,23,4),o+4}u.prototype.writeFloatLE=function(s,o,d){return tt(this,s,o,!0,d)},u.prototype.writeFloatBE=function(s,o,d){return tt(this,s,o,!1,d)};function Ke(f,s,o,d,b){return s=+s,o=o>>>0,b||Te(f,s,o,8),r.write(f,s,o,d,52,8),o+8}u.prototype.writeDoubleLE=function(s,o,d){return Ke(this,s,o,!0,d)},u.prototype.writeDoubleBE=function(s,o,d){return Ke(this,s,o,!1,d)},u.prototype.copy=function(s,o,d,b){if(!u.isBuffer(s))throw new TypeError("argument should be a Buffer");if(d||(d=0),!b&&b!==0&&(b=this.length),o>=s.length&&(o=s.length),o||(o=0),b>0&&b<d&&(b=d),b===d||s.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(d<0||d>=this.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("sourceEnd out of bounds");b>this.length&&(b=this.length),s.length-o<b-d&&(b=s.length-o+d);const E=b-d;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(o,d,b):Uint8Array.prototype.set.call(s,this.subarray(d,b),o),E},u.prototype.fill=function(s,o,d,b){if(typeof s=="string"){if(typeof o=="string"?(b=o,o=0,d=this.length):typeof d=="string"&&(b=d,d=this.length),b!==void 0&&typeof b!="string")throw new TypeError("encoding must be a string");if(typeof b=="string"&&!u.isEncoding(b))throw new TypeError("Unknown encoding: "+b);if(s.length===1){const v=s.charCodeAt(0);(b==="utf8"&&v<128||b==="latin1")&&(s=v)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));if(o<0||this.length<o||this.length<d)throw new RangeError("Out of range index");if(d<=o)return this;o=o>>>0,d=d===void 0?this.length:d>>>0,s||(s=0);let E;if(typeof s=="number")for(E=o;E<d;++E)this[E]=s;else{const v=u.isBuffer(s)?s:u.from(s,b),W=v.length;if(W===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(E=0;E<d-o;++E)this[E+o]=v[E%W]}return this};const je={};function Ye(f,s,o){je[f]=class extends o{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${f}]`,this.stack,delete this.name}get code(){return f}set code(b){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:b,writable:!0})}toString(){return`${this.name} [${f}]: ${this.message}`}}}Ye("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ye("ERR_INVALID_ARG_TYPE",function(f,s){return`The "${f}" argument must be of type number. Received type ${typeof s}`},TypeError),Ye("ERR_OUT_OF_RANGE",function(f,s,o){let d=`The value of "${f}" is out of range.`,b=o;return Number.isInteger(o)&&Math.abs(o)>2**32?b=Pt(String(o)):typeof o=="bigint"&&(b=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(b=Pt(b)),b+="n"),d+=` It must be ${s}. Received ${b}`,d},RangeError);function Pt(f){let s="",o=f.length;const d=f[0]==="-"?1:0;for(;o>=d+4;o-=3)s=`_${f.slice(o-3,o)}${s}`;return`${f.slice(0,o)}${s}`}function _t(f,s,o){g(s,"offset"),(f[s]===void 0||f[s+o]===void 0)&&m(s,f.length-(o+1))}function rt(f,s,o,d,b,E){if(f>o||f<s){const v=typeof s=="bigint"?"n":"";let W;throw s===0||s===BigInt(0)?W=`>= 0${v} and < 2${v} ** ${(E+1)*8}${v}`:W=`>= -(2${v} ** ${(E+1)*8-1}${v}) and < 2 ** ${(E+1)*8-1}${v}`,new je.ERR_OUT_OF_RANGE("value",W,f)}_t(d,b,E)}function g(f,s){if(typeof f!="number")throw new je.ERR_INVALID_ARG_TYPE(s,"number",f)}function m(f,s,o){throw Math.floor(f)!==f?(g(f,o),new je.ERR_OUT_OF_RANGE("offset","an integer",f)):s<0?new je.ERR_BUFFER_OUT_OF_BOUNDS:new je.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${s}`,f)}const N=/[^+/0-9A-Za-z-_]/g;function C(f){if(f=f.split("=")[0],f=f.trim().replace(N,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function F(f,s){s=s||1/0;let o;const d=f.length;let b=null;const E=[];for(let v=0;v<d;++v){if(o=f.charCodeAt(v),o>55295&&o<57344){if(!b){if(o>56319){(s-=3)>-1&&E.push(239,191,189);continue}else if(v+1===d){(s-=3)>-1&&E.push(239,191,189);continue}b=o;continue}if(o<56320){(s-=3)>-1&&E.push(239,191,189),b=o;continue}o=(b-55296<<10|o-56320)+65536}else b&&(s-=3)>-1&&E.push(239,191,189);if(b=null,o<128){if((s-=1)<0)break;E.push(o)}else if(o<2048){if((s-=2)<0)break;E.push(o>>6|192,o&63|128)}else if(o<65536){if((s-=3)<0)break;E.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((s-=4)<0)break;E.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return E}function Z(f){const s=[];for(let o=0;o<f.length;++o)s.push(f.charCodeAt(o)&255);return s}function te(f,s){let o,d,b;const E=[];for(let v=0;v<f.length&&!((s-=2)<0);++v)o=f.charCodeAt(v),d=o>>8,b=o%256,E.push(b),E.push(d);return E}function Y(f){return e.toByteArray(C(f))}function Re(f,s,o,d){let b;for(b=0;b<d&&!(b+o>=s.length||b>=f.length);++b)s[b+o]=f[b];return b}function O(f,s){return f instanceof s||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===s.name}function Le(f){return f!==f}const Kt=function(){const f="0123456789abcdef",s=new Array(256);for(let o=0;o<16;++o){const d=o*16;for(let b=0;b<16;++b)s[d+b]=f[o]+f[b]}return s}();function Ge(f){return typeof BigInt>"u"?Rn:f}function Rn(){throw new Error("BigInt not supported")}})(Fe);const jt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",Lt="http://www.w3.org/2001/XMLSchema#",Zt="http://www.w3.org/2000/10/swap/",be={xsd:{decimal:`${Lt}decimal`,boolean:`${Lt}boolean`,double:`${Lt}double`,integer:`${Lt}integer`,string:`${Lt}string`},rdf:{type:`${jt}type`,nil:`${jt}nil`,first:`${jt}first`,rest:`${jt}rest`,langString:`${jt}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Zt}reify#forSome`,forAll:`${Zt}reify#forAll`},log:{implies:`${Zt}log#implies`,isImpliedBy:`${Zt}log#isImpliedBy`}},{xsd:Jt}=be,no=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ln={"\\":"\\","'":"'",'"':'"',n:`
|
|
7
|
-
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},io=/[\x00-\x20<>\\"\{\}\|\^\`]/,so={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},oo=/$0^/;class ao{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 r in this)!(r in so)&&this[r]instanceof RegExp&&(this[r]=oo)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let n=this._input,i=n.length;for(;;){let u,p;for(;u=this._newline.exec(n);)this.comments&&(p=this._comment.exec(u[0]))&&a("comment",p[1],"",this._line,u[0].length),n=n.substr(u[0].length,n.length),i=n.length,this._line++;if(!u&&(u=this._whitespace.exec(n))&&(n=n.substr(u[0].length,n.length)),this._endOfFile.test(n))return r&&(this.comments&&(p=this._comment.exec(n))&&a("comment",p[1],"",this._line,n.length),n=null,a("eof","","",this._line,0)),this._input=n;const _=this._line,y=n[0];let x="",I="",S="",R=null,w=0,A=!1;switch(y){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){A=!0;break}}else{this._n3Mode&&(w=1,x="^");break}case"<":if(R=this._unescapedIri.exec(n))x="IRI",I=R[1];else if(R=this._iri.exec(n)){if(I=this._unescape(R[1]),I===null||io.test(I))return l(this);x="IRI"}else n.length>1&&n[1]==="<"?(x="<<",w=2):this._n3Mode&&n.length>1&&n[1]==="="&&(w=2,this._isImpliedBy?(x="abbreviation",I="<"):(x="inverse",I=">"));break;case">":n.length>1&&n[1]===">"&&(x=">>",w=2);break;case"_":((R=this._blank.exec(n))||r&&(R=this._blank.exec(`${n} `)))&&(x="blank",S="_",I=R[1]);break;case'"':if(R=this._simpleQuotedString.exec(n))I=R[1];else if({value:I,matchLength:w}=this._parseLiteral(n),I===null)return l(this);(R!==null||w!==0)&&(x="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(R=this._simpleApostropheString.exec(n))I=R[1];else if({value:I,matchLength:w}=this._parseLiteral(n),I===null)return l(this);(R!==null||w!==0)&&(x="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(R=this._variable.exec(n))&&(x="var",I=R[0]);break;case"@":this._previousMarker==="literal"&&(R=this._langcode.exec(n))?(x="langcode",I=R[1]):(R=this._keyword.exec(n))&&(x=R[0]);break;case".":if(n.length===1?r:n[1]<"0"||n[1]>"9"){x=".",w=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(R=this._number.exec(n)||r&&(R=this._number.exec(`${n} `)))&&(x="literal",I=R[0],S=typeof R[1]=="string"?Jt.double:typeof R[2]=="string"?Jt.decimal:Jt.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(R=this._sparqlKeyword.exec(n))?x=R[0].toUpperCase():A=!0;break;case"f":case"t":(R=this._boolean.exec(n))?(x="literal",I=R[0],S=Jt.boolean):A=!0;break;case"a":(R=this._shortPredicates.exec(n))?(x="abbreviation",I="a"):A=!0;break;case"=":this._n3Mode&&n.length>1&&(x="abbreviation",n[1]!==">"?(w=1,I="="):(w=2,I=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(w=1,x=y);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(x="{|",w=2):(x=y,w=1));break;case"|":n.length>=2&&n[1]==="}"&&(x="|}",w=2);break;default:A=!0}if(A&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(R=this._prefix.exec(n))?(x="prefix",I=R[1]||""):((R=this._prefixed.exec(n))||r&&(R=this._prefixed.exec(`${n} `)))&&(x="prefixed",S=R[1]||"",I=this._unescape(R[2]))),this._previousMarker==="^^")switch(x){case"prefixed":x="type";break;case"IRI":x="typeIRI";break;default:x=""}if(!x)return r||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?l(this):this._input=n;const $=w||R[0].length,B=a(x,I,S,_,$);this.previousToken=B,this._previousMarker=x,n=n.substr($,n.length)}function a(u,p,_,y,x){const I=n?i-n.length:i,S=I+x,R={type:u,value:p,prefix:_,line:y,start:I,end:S};return e(null,R),R}function l(u){e(u._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let r=!1;const n=e.replace(no,(i,a,l,u)=>{if(typeof a=="string")return String.fromCharCode(Number.parseInt(a,16));if(typeof l=="string"){let p=Number.parseInt(l,16);return p<=65535?String.fromCharCode(Number.parseInt(l,16)):String.fromCharCode(55296+((p-=65536)>>10),56320+(p&1023))}return u in Ln?Ln[u]:(r=!0,"")});return r?null:n}_parseLiteral(e){if(e.length>=3){const r=e.match(/^(?:"""|"|'''|'|)/)[0],n=r.length;let i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(r,i))>0;){let a=0;for(;e[i-a-1]==="\\";)a++;if(a%2===0){const l=e.substring(n,i),u=l.split(/\r\n|\r|\n/).length-1,p=i+n;if(n===1&&u!==0||n===3&&this._lineMode)break;return this._line+=u,{value:this._unescape(l),matchLength:p}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const r=new Error(`Unexpected "${e}" on line ${this._line}.`);return r.context={token:void 0,line:this._line,previousToken:this.previousToken},r}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,r){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>this._tokenizeToEnd(r,!0));else{const n=[];let i;if(this._tokenizeToEnd((a,l)=>a?i=a:n.push(l),!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=Fe.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(r,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",r)}}const{rdf:lo,xsd:st}=be;let wt,uo=0;const ot={namedNode:Fn,blankNode:kn,variable:On,literal:Cn,defaultGraph:po,quad:Nr,triple:Nr,fromTerm:Bt,fromQuad:Mn};class Be{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof Be?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}class $n extends Be{get termType(){return"NamedNode"}}class mt extends Be{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){const e=this.id;let r=e.lastIndexOf('"')+1;return r<e.length&&e[r++]==="@"?e.substr(r).toLowerCase():""}get datatype(){return new $n(this.datatypeString)}get datatypeString(){const e=this.id,r=e.lastIndexOf('"')+1,n=r<e.length?e[r]:"";return n==="^"?e.substr(r+2):n!=="@"?st.string:lo.langString}equals(e){return e instanceof mt?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}}}}class fo extends Be{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}}class co extends Be{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}}class ho extends Be{constructor(){return super(""),wt||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}}wt=new ho;function $t(t,e,r){if(e=e||ot,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===ot)return new mt(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));const n=t.lastIndexOf('"',t.length-1);return e.literal(t.substr(1,n-1),t[n+1]==="@"?t.substr(n+2):e.namedNode(t.substr(n+3)));case"[":t=JSON.parse(t);break;default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad($t(t[0],e,!0),$t(t[1],e,!0),$t(t[2],e,!0),t[3]&&$t(t[3],e,!0))}function xt(t,e){if(typeof t=="string")return t;if(t instanceof Be&&t.termType!=="Quad")return t.id;if(!t)return wt.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}`:t.datatype&&t.datatype.value!==st.string?`^^${t.datatype.value}`:""}`;case"Quad":const r=[xt(t.subject,!0),xt(t.predicate,!0),xt(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(xt(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}class Bn extends Be{constructor(e,r,n,i){super(""),this._subject=e,this._predicate=r,this._object=n,this._graph=i||wt}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 Fn(t){return new $n(t)}function kn(t){return new fo(t||`n3-${uo++}`)}function Cn(t,e){if(typeof e=="string")return new mt(`"${t}"@${e.toLowerCase()}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=st.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?st.integer:st.double:(r=st.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===st.string?new mt(`"${t}"`):new mt(`"${t}"^^${r}`)}function On(t){return new co(t)}function po(){return wt}function Nr(t,e,r,n){return new Bn(t,e,r,n)}function Bt(t){if(t instanceof Be)return t;switch(t.termType){case"NamedNode":return Fn(t.value);case"BlankNode":return kn(t.value);case"Variable":return On(t.value);case"DefaultGraph":return wt;case"Literal":return Cn(t.value,t.language||t.datatype);case"Quad":return Mn(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Mn(t){if(t instanceof Bn)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return Nr(Bt(t.subject),Bt(t.predicate),Bt(t.object),Bt(t.graph))}let Dn=0;class Un{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Wn(this,e.factory);const r=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(r),i=/trig/.test(r),a=/triple/.test(r),l=/quad/.test(r),u=this._n3Mode=/n3/.test(r),p=a||l;(this._supportsNamedGraphs=!(n||u))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||a||u),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=r===""||/star|\*$/.test(r),p&&(this._resolveRelativeIRI=_=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new ao({lineMode:p,n3:u,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Dn=0}_setBase(e){if(!e)this._base="",this._basePath="";else{const r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),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,r,n,i,a){const l=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:i,object:a,graph:r,inverse:l?this._inversePredicate:!1,blankPrefix:l?this._prefixes._:"",quantified:l?this._quantified:null}),l&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,r){const n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${r.type}`,r);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,r){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 a=this._prefixes[e.prefix];if(a===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(a+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!r&&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 r=e.type;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return this._predicate===null?this._error(`Unexpected ${r}`,e):(this._subject=null,r==="]"?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 r=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:r?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 r=null,n=null,i=this._readListItem;const a=this._subject,l=this._contextStack,u=l[l.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=r=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),l.length!==0&&l[l.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):(r=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((r=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),a===null?u.predicate===null?u.subject=n:u.object=n:this._emit(a,this.RDF_REST,n,this._graph),r!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,n,this.RDF_FIRST,r),this._subject=r,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,r,this._graph)}return i}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let r=this._factory.literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const n=this._readEntity(e);if(n===void 0)return;r=this._factory.literal(this._literalValue,n),e=null;break;case"langcode":r=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:r}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,r){const n=this._completeLiteral(e);if(n)return this._object=n.literal,r&&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 r,n=this._graph;const i=this._subject,a=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,r=this._contextStack.length?this._readSubject:this._readInTopContext,a&&(this._inversePredicate=!1);break;case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",e);const l=this._predicate,u=this._object;this._subject=this._factory.quad(i,l,u,this.DEFAULTGRAPH),r=this._readPredicate;break;case"|}":if(this._subject.termType!=="Quad")return this._error("Unexpected asserted triple closing",e);this._subject=null,r=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(n=this._readEntity(e))!==void 0){r=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(i!==null){const l=this._predicate,u=this._object;a?this._emit(u,l,i,n):this._emit(i,l,u,n)}return r}_readBlankNodePunctuation(e){let r;switch(e.type){case";":r=this._readPredicate;break;case",":r=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),r}_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 r=this._readEntity(e);return this._prefixes[this._prefix]=r.value,this._prefixCallback(this._prefix,r),this._readDeclarationPunctuation}_readBaseIRI(e){const r=e.type==="IRI"&&this._resolveIRI(e.value);return r?(this._setBase(r),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 r;switch(e.type){case"IRI":case"prefixed":if((r=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,r,this.QUANTIFIERS_GRAPH)):this._quantified[r.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 r=this._contextStack,n=r.length&&r[r.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 r,n;const i=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=i):(r=this._object,this._object=i),this._emit(r,n,i,this._graph),this._readPath}_readBackwardPath(e){const r=this._factory.blankNode();let n,i;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=r):(i=this._object,this._object=r),this._emit(r,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 r=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),this._subject===null?(this._subject=r,this._readPredicate):(this._object=r,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,r,n,i){this._callback(null,this._factory.quad(e,r,n,i||this.DEFAULTGRAPH))}_error(e,r){const n=new Error(`${e} on line ${r.line}.`);n.context={token:r,line:r.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=er}_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 r=e.length;let n="",i=-1,a=-1,l=0,u="/";for(;i<r;){switch(u){case":":if(a<0&&e[++i]==="/"&&e[++i]==="/")for(;(a=i+1)<r&&e[a]!=="/";)i=a;break;case"?":case"#":i=r;break;case"/":if(e[i+1]===".")switch(u=e[++i+1],u){case"/":n+=e.substring(l,i-1),l=i+1;break;case void 0:case"?":case"#":return n+e.substring(l,i)+e.substr(i+1);case".":if(u=e[++i+1],u===void 0||u==="/"||u==="?"||u==="#"){if(n+=e.substring(l,i-2),(l=n.lastIndexOf("/"))>=a&&(n=n.substr(0,l)),u!=="/")return`${n}/${e.substr(i+1)}`;l=i+1}}}u=e[++i]}return n+e.substring(l)}parse(e,r,n){let i,a,l;if(r&&(r.onQuad||r.onPrefix||r.onComment)?(i=r.onQuad,a=r.onPrefix,l=r.onComment):(i=r,a=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Dn++}_`,this._prefixCallback=a||er,this._inversePredicate=!1,this._quantified=Object.create(null),!i){const p=[];let _;if(this._callback=(y,x)=>{y?_=y:x&&p.push(x)},this._lexer.tokenize(e).every(y=>this._readCallback=this._readCallback(y)),_)throw _;return p}let u=(p,_)=>{p!==null?(this._callback(p),this._callback=er):this._readCallback&&(this._readCallback=this._readCallback(_))};l&&(this._lexer.comments=!0,u=(p,_)=>{p!==null?(this._callback(p),this._callback=er):this._readCallback&&(_.type==="comment"?l(_.value):this._readCallback=this._readCallback(_))}),this._callback=i,this._lexer.tokenize(e,u)}}function er(){}function Wn(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(be.rdf.first),t.RDF_REST=e.namedNode(be.rdf.rest),t.RDF_NIL=e.namedNode(be.rdf.nil),t.N3_FORALL=e.namedNode(be.r.forAll),t.N3_FORSOME=e.namedNode(be.r.forSome),t.ABBREVIATIONS={a:e.namedNode(be.rdf.type),"=":e.namedNode(be.owl.sameAs),">":e.namedNode(be.log.implies),"<":e.namedNode(be.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Wn(Un.prototype,ot);function Pr(t){return!!t&&t.termType==="DefaultGraph"}function tr(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const _o=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,bo=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Gn="./",yo="../",jr="?",zn="#";class Lr{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!_o.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!Lr.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",tr(e)],n=[],i=[],a=/[^/?#]*([/?#])/y;let l,u=0,p=0,_=a.lastIndex=e.length;for(;!u&&!p&&(l=a.exec(this.base));)l[1]===zn?p=a.lastIndex-1:(r.push(tr(l[0]),"(?:"),n.push(")?"),l[1]!==jr?i.push(_=a.lastIndex):(u=_=a.lastIndex,p=this.base.indexOf(zn,u),this._pathReplacements[u]=jr));for(let y=0;y<i.length;y++)this._pathReplacements[i[y]]=yo.repeat(i.length-y-1);return this._pathReplacements[i[i.length-1]]=Gn,this._baseLength=p>0?p:this.base.length,r.push(tr(this.base.substring(_,this._baseLength)),u?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...r,...n].join(""))}toRelative(e){const r=this._getBaseMatcher().exec(e);if(!r)return e;const n=r[0].length;if(n===this._baseLength&&n===e.length)return"";const i=this._pathReplacements[n];if(i){const a=e.substring(n);return i!==jr&&!bo.test(a)?e:i===Gn&&/^[^?#]/.test(a)?a:i+a}return e.substring(n-1)}}const Ft=ot.defaultGraph(),{rdf:go,xsd:Et}=be,qn=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Hn=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,wo={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class kt extends Be{equals(e){return e===this}}class Qn{constructor(e,r){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(r=e,e=null),r=r||{},this._lists=r.lists,e)this._outputStream=e,this._endStream=r.end===void 0?!0:!!r.end;else{let n="";this._outputStream={write(i,a,l){n+=i,l&&l()},end:i=>{i&&i(null,n)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Ft,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new Lr(r.baseIRI)))}get _inDefaultGraph(){return Ft.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_writeQuad(e,r,n,i,a){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
|
|
6
|
+
*/var Sr;function Me(){return Sr||(Sr=1,(function(l){const e=Mn(),t=Dn(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;l.Buffer=o,l.SlowBuffer=m,l.INSPECT_MAX_BYTES=50;const s=2147483647;l.kMaxLength=s,o.TYPED_ARRAY_SUPPORT=a(),!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 a(){try{const f=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(f,n),f.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 u(f){if(f>s)throw new RangeError('The value "'+f+'" is invalid for option "size"');const n=new Uint8Array(f);return Object.setPrototypeOf(n,o.prototype),n}function o(f,n,i){if(typeof f=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return T(f)}return b(f,n,i)}o.poolSize=8192;function b(f,n,i){if(typeof f=="string")return j(f,n);if(ArrayBuffer.isView(f))return v(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if($(f,ArrayBuffer)||f&&$(f.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&($(f,SharedArrayBuffer)||f&&$(f.buffer,SharedArrayBuffer)))return A(f,n,i);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const d=f.valueOf&&f.valueOf();if(d!=null&&d!==f)return o.from(d,n,i);const E=g(f);if(E)return E;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return o.from(f[Symbol.toPrimitive]("string"),n,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}o.from=function(f,n,i){return b(f,n,i)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function h(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function x(f,n,i){return h(f),f<=0?u(f):n!==void 0?typeof i=="string"?u(f).fill(n,i):u(f).fill(n):u(f)}o.alloc=function(f,n,i){return x(f,n,i)};function T(f){return h(f),u(f<0?0:_(f)|0)}o.allocUnsafe=function(f){return T(f)},o.allocUnsafeSlow=function(f){return T(f)};function j(f,n){if((typeof n!="string"||n==="")&&(n="utf8"),!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);const i=w(f,n)|0;let d=u(i);const E=d.write(f,n);return E!==i&&(d=d.slice(0,E)),d}function L(f){const n=f.length<0?0:_(f.length)|0,i=u(n);for(let d=0;d<n;d+=1)i[d]=f[d]&255;return i}function v(f){if($(f,Uint8Array)){const n=new Uint8Array(f);return A(n.buffer,n.byteOffset,n.byteLength)}return L(f)}function A(f,n,i){if(n<0||f.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<n+(i||0))throw new RangeError('"length" is outside of buffer bounds');let d;return n===void 0&&i===void 0?d=new Uint8Array(f):i===void 0?d=new Uint8Array(f,n):d=new Uint8Array(f,n,i),Object.setPrototypeOf(d,o.prototype),d}function g(f){if(o.isBuffer(f)){const n=_(f.length)|0,i=u(n);return i.length===0||f.copy(i,0,0,n),i}if(f.length!==void 0)return typeof f.length!="number"||we(f.length)?u(0):L(f);if(f.type==="Buffer"&&Array.isArray(f.data))return L(f.data)}function _(f){if(f>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return f|0}function m(f){return+f!=f&&(f=0),o.alloc(+f)}o.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==o.prototype},o.compare=function(n,i){if($(n,Uint8Array)&&(n=o.from(n,n.offset,n.byteLength)),$(i,Uint8Array)&&(i=o.from(i,i.offset,i.byteLength)),!o.isBuffer(n)||!o.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===i)return 0;let d=n.length,E=i.length;for(let k=0,q=Math.min(d,E);k<q;++k)if(n[k]!==i[k]){d=n[k],E=i[k];break}return d<E?-1:E<d?1:0},o.isEncoding=function(n){switch(String(n).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(n,i){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return o.alloc(0);let d;if(i===void 0)for(i=0,d=0;d<n.length;++d)i+=n[d].length;const E=o.allocUnsafe(i);let k=0;for(d=0;d<n.length;++d){let q=n[d];if($(q,Uint8Array))k+q.length>E.length?(o.isBuffer(q)||(q=o.from(q)),q.copy(E,k)):Uint8Array.prototype.set.call(E,q,k);else if(o.isBuffer(q))q.copy(E,k);else throw new TypeError('"list" argument must be an Array of Buffers');k+=q.length}return E};function w(f,n){if(o.isBuffer(f))return f.length;if(ArrayBuffer.isView(f)||$(f,ArrayBuffer))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const i=f.length,d=arguments.length>2&&arguments[2]===!0;if(!d&&i===0)return 0;let E=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return J(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return Q(f).length;default:if(E)return d?-1:J(f).length;n=(""+n).toLowerCase(),E=!0}}o.byteLength=w;function P(f,n,i){let d=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,n>>>=0,i<=n))return"";for(f||(f="utf8");;)switch(f){case"hex":return ae(this,n,i);case"utf8":case"utf-8":return ne(this,n,i);case"ascii":return be(this,n,i);case"latin1":case"binary":return W(this,n,i);case"base64":return B(this,n,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y(this,n,i);default:if(d)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),d=!0}}o.prototype._isBuffer=!0;function I(f,n,i){const d=f[n];f[n]=f[i],f[i]=d}o.prototype.swap16=function(){const n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let i=0;i<n;i+=2)I(this,i,i+1);return this},o.prototype.swap32=function(){const n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let i=0;i<n;i+=4)I(this,i,i+3),I(this,i+1,i+2);return this},o.prototype.swap64=function(){const n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let i=0;i<n;i+=8)I(this,i,i+7),I(this,i+1,i+6),I(this,i+2,i+5),I(this,i+3,i+4);return this},o.prototype.toString=function(){const n=this.length;return n===0?"":arguments.length===0?ne(this,0,n):P.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(n){if(!o.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:o.compare(this,n)===0},o.prototype.inspect=function(){let n="";const i=l.INSPECT_MAX_BYTES;return n=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(n+=" ... "),"<Buffer "+n+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(n,i,d,E,k){if($(n,Uint8Array)&&(n=o.from(n,n.offset,n.byteLength)),!o.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(i===void 0&&(i=0),d===void 0&&(d=n?n.length:0),E===void 0&&(E=0),k===void 0&&(k=this.length),i<0||d>n.length||E<0||k>this.length)throw new RangeError("out of range index");if(E>=k&&i>=d)return 0;if(E>=k)return-1;if(i>=d)return 1;if(i>>>=0,d>>>=0,E>>>=0,k>>>=0,this===n)return 0;let q=k-E,_e=d-i;const Se=Math.min(q,_e),Ee=this.slice(E,k),Ie=n.slice(i,d);for(let xe=0;xe<Se;++xe)if(Ee[xe]!==Ie[xe]){q=Ee[xe],_e=Ie[xe];break}return q<_e?-1:_e<q?1:0};function H(f,n,i,d,E){if(f.length===0)return-1;if(typeof i=="string"?(d=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,we(i)&&(i=E?0:f.length-1),i<0&&(i=f.length+i),i>=f.length){if(E)return-1;i=f.length-1}else if(i<0)if(E)i=0;else return-1;if(typeof n=="string"&&(n=o.from(n,d)),o.isBuffer(n))return n.length===0?-1:K(f,n,i,d,E);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?E?Uint8Array.prototype.indexOf.call(f,n,i):Uint8Array.prototype.lastIndexOf.call(f,n,i):K(f,[n],i,d,E);throw new TypeError("val must be string, number or Buffer")}function K(f,n,i,d,E){let k=1,q=f.length,_e=n.length;if(d!==void 0&&(d=String(d).toLowerCase(),d==="ucs2"||d==="ucs-2"||d==="utf16le"||d==="utf-16le")){if(f.length<2||n.length<2)return-1;k=2,q/=2,_e/=2,i/=2}function Se(Ie,xe){return k===1?Ie[xe]:Ie.readUInt16BE(xe*k)}let Ee;if(E){let Ie=-1;for(Ee=i;Ee<q;Ee++)if(Se(f,Ee)===Se(n,Ie===-1?0:Ee-Ie)){if(Ie===-1&&(Ie=Ee),Ee-Ie+1===_e)return Ie*k}else Ie!==-1&&(Ee-=Ee-Ie),Ie=-1}else for(i+_e>q&&(i=q-_e),Ee=i;Ee>=0;Ee--){let Ie=!0;for(let xe=0;xe<_e;xe++)if(Se(f,Ee+xe)!==Se(n,xe)){Ie=!1;break}if(Ie)return Ee}return-1}o.prototype.includes=function(n,i,d){return this.indexOf(n,i,d)!==-1},o.prototype.indexOf=function(n,i,d){return H(this,n,i,d,!0)},o.prototype.lastIndexOf=function(n,i,d){return H(this,n,i,d,!1)};function G(f,n,i,d){i=Number(i)||0;const E=f.length-i;d?(d=Number(d),d>E&&(d=E)):d=E;const k=n.length;d>k/2&&(d=k/2);let q;for(q=0;q<d;++q){const _e=parseInt(n.substr(q*2,2),16);if(we(_e))return q;f[i+q]=_e}return q}function fe(f,n,i,d){return Y(J(n,f.length-i),f,i,d)}function F(f,n,i,d){return Y(Z(n),f,i,d)}function C(f,n,i,d){return Y(Q(n),f,i,d)}function V(f,n,i,d){return Y(R(n,f.length-i),f,i,d)}o.prototype.write=function(n,i,d,E){if(i===void 0)E="utf8",d=this.length,i=0;else if(d===void 0&&typeof i=="string")E=i,d=this.length,i=0;else if(isFinite(i))i=i>>>0,isFinite(d)?(d=d>>>0,E===void 0&&(E="utf8")):(E=d,d=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const k=this.length-i;if((d===void 0||d>k)&&(d=k),n.length>0&&(d<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");E||(E="utf8");let q=!1;for(;;)switch(E){case"hex":return G(this,n,i,d);case"utf8":case"utf-8":return fe(this,n,i,d);case"ascii":case"latin1":case"binary":return F(this,n,i,d);case"base64":return C(this,n,i,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,n,i,d);default:if(q)throw new TypeError("Unknown encoding: "+E);E=(""+E).toLowerCase(),q=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function B(f,n,i){return n===0&&i===f.length?e.fromByteArray(f):e.fromByteArray(f.slice(n,i))}function ne(f,n,i){i=Math.min(f.length,i);const d=[];let E=n;for(;E<i;){const k=f[E];let q=null,_e=k>239?4:k>223?3:k>191?2:1;if(E+_e<=i){let Se,Ee,Ie,xe;switch(_e){case 1:k<128&&(q=k);break;case 2:Se=f[E+1],(Se&192)===128&&(xe=(k&31)<<6|Se&63,xe>127&&(q=xe));break;case 3:Se=f[E+1],Ee=f[E+2],(Se&192)===128&&(Ee&192)===128&&(xe=(k&15)<<12|(Se&63)<<6|Ee&63,xe>2047&&(xe<55296||xe>57343)&&(q=xe));break;case 4:Se=f[E+1],Ee=f[E+2],Ie=f[E+3],(Se&192)===128&&(Ee&192)===128&&(Ie&192)===128&&(xe=(k&15)<<18|(Se&63)<<12|(Ee&63)<<6|Ie&63,xe>65535&&xe<1114112&&(q=xe))}}q===null?(q=65533,_e=1):q>65535&&(q-=65536,d.push(q>>>10&1023|55296),q=56320|q&1023),d.push(q),E+=_e}return ue(d)}const se=4096;function ue(f){const n=f.length;if(n<=se)return String.fromCharCode.apply(String,f);let i="",d=0;for(;d<n;)i+=String.fromCharCode.apply(String,f.slice(d,d+=se));return i}function be(f,n,i){let d="";i=Math.min(f.length,i);for(let E=n;E<i;++E)d+=String.fromCharCode(f[E]&127);return d}function W(f,n,i){let d="";i=Math.min(f.length,i);for(let E=n;E<i;++E)d+=String.fromCharCode(f[E]);return d}function ae(f,n,i){const d=f.length;(!n||n<0)&&(n=0),(!i||i<0||i>d)&&(i=d);let E="";for(let k=n;k<i;++k)E+=Ne[f[k]];return E}function y(f,n,i){const d=f.slice(n,i);let E="";for(let k=0;k<d.length-1;k+=2)E+=String.fromCharCode(d[k]+d[k+1]*256);return E}o.prototype.slice=function(n,i){const d=this.length;n=~~n,i=i===void 0?d:~~i,n<0?(n+=d,n<0&&(n=0)):n>d&&(n=d),i<0?(i+=d,i<0&&(i=0)):i>d&&(i=d),i<n&&(i=n);const E=this.subarray(n,i);return Object.setPrototypeOf(E,o.prototype),E};function M(f,n,i){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+n>i)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(n,i,d){n=n>>>0,i=i>>>0,d||M(n,i,this.length);let E=this[n],k=1,q=0;for(;++q<i&&(k*=256);)E+=this[n+q]*k;return E},o.prototype.readUintBE=o.prototype.readUIntBE=function(n,i,d){n=n>>>0,i=i>>>0,d||M(n,i,this.length);let E=this[n+--i],k=1;for(;i>0&&(k*=256);)E+=this[n+--i]*k;return E},o.prototype.readUint8=o.prototype.readUInt8=function(n,i){return n=n>>>0,i||M(n,1,this.length),this[n]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(n,i){return n=n>>>0,i||M(n,2,this.length),this[n]|this[n+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(n,i){return n=n>>>0,i||M(n,2,this.length),this[n]<<8|this[n+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(n,i){return n=n>>>0,i||M(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(n,i){return n=n>>>0,i||M(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},o.prototype.readBigUInt64LE=ge(function(n){n=n>>>0,S(n,"offset");const i=this[n],d=this[n+7];(i===void 0||d===void 0)&&N(n,this.length-8);const E=i+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24,k=this[++n]+this[++n]*2**8+this[++n]*2**16+d*2**24;return BigInt(E)+(BigInt(k)<<BigInt(32))}),o.prototype.readBigUInt64BE=ge(function(n){n=n>>>0,S(n,"offset");const i=this[n],d=this[n+7];(i===void 0||d===void 0)&&N(n,this.length-8);const E=i*2**24+this[++n]*2**16+this[++n]*2**8+this[++n],k=this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+d;return(BigInt(E)<<BigInt(32))+BigInt(k)}),o.prototype.readIntLE=function(n,i,d){n=n>>>0,i=i>>>0,d||M(n,i,this.length);let E=this[n],k=1,q=0;for(;++q<i&&(k*=256);)E+=this[n+q]*k;return k*=128,E>=k&&(E-=Math.pow(2,8*i)),E},o.prototype.readIntBE=function(n,i,d){n=n>>>0,i=i>>>0,d||M(n,i,this.length);let E=i,k=1,q=this[n+--E];for(;E>0&&(k*=256);)q+=this[n+--E]*k;return k*=128,q>=k&&(q-=Math.pow(2,8*i)),q},o.prototype.readInt8=function(n,i){return n=n>>>0,i||M(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},o.prototype.readInt16LE=function(n,i){n=n>>>0,i||M(n,2,this.length);const d=this[n]|this[n+1]<<8;return d&32768?d|4294901760:d},o.prototype.readInt16BE=function(n,i){n=n>>>0,i||M(n,2,this.length);const d=this[n+1]|this[n]<<8;return d&32768?d|4294901760:d},o.prototype.readInt32LE=function(n,i){return n=n>>>0,i||M(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},o.prototype.readInt32BE=function(n,i){return n=n>>>0,i||M(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},o.prototype.readBigInt64LE=ge(function(n){n=n>>>0,S(n,"offset");const i=this[n],d=this[n+7];(i===void 0||d===void 0)&&N(n,this.length-8);const E=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(d<<24);return(BigInt(E)<<BigInt(32))+BigInt(i+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)}),o.prototype.readBigInt64BE=ge(function(n){n=n>>>0,S(n,"offset");const i=this[n],d=this[n+7];(i===void 0||d===void 0)&&N(n,this.length-8);const E=(i<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(E)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+d)}),o.prototype.readFloatLE=function(n,i){return n=n>>>0,i||M(n,4,this.length),t.read(this,n,!0,23,4)},o.prototype.readFloatBE=function(n,i){return n=n>>>0,i||M(n,4,this.length),t.read(this,n,!1,23,4)},o.prototype.readDoubleLE=function(n,i){return n=n>>>0,i||M(n,8,this.length),t.read(this,n,!0,52,8)},o.prototype.readDoubleBE=function(n,i){return n=n>>>0,i||M(n,8,this.length),t.read(this,n,!1,52,8)};function X(f,n,i,d,E,k){if(!o.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>E||n<k)throw new RangeError('"value" argument is out of bounds');if(i+d>f.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(n,i,d,E){if(n=+n,i=i>>>0,d=d>>>0,!E){const _e=Math.pow(2,8*d)-1;X(this,n,i,d,_e,0)}let k=1,q=0;for(this[i]=n&255;++q<d&&(k*=256);)this[i+q]=n/k&255;return i+d},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(n,i,d,E){if(n=+n,i=i>>>0,d=d>>>0,!E){const _e=Math.pow(2,8*d)-1;X(this,n,i,d,_e,0)}let k=d-1,q=1;for(this[i+k]=n&255;--k>=0&&(q*=256);)this[i+k]=n/q&255;return i+d},o.prototype.writeUint8=o.prototype.writeUInt8=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,1,255,0),this[i]=n&255,i+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,2,65535,0),this[i]=n&255,this[i+1]=n>>>8,i+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,2,65535,0),this[i]=n>>>8,this[i+1]=n&255,i+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,4,4294967295,0),this[i+3]=n>>>24,this[i+2]=n>>>16,this[i+1]=n>>>8,this[i]=n&255,i+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,4,4294967295,0),this[i]=n>>>24,this[i+1]=n>>>16,this[i+2]=n>>>8,this[i+3]=n&255,i+4};function U(f,n,i,d,E){de(n,d,E,f,i,7);let k=Number(n&BigInt(4294967295));f[i++]=k,k=k>>8,f[i++]=k,k=k>>8,f[i++]=k,k=k>>8,f[i++]=k;let q=Number(n>>BigInt(32)&BigInt(4294967295));return f[i++]=q,q=q>>8,f[i++]=q,q=q>>8,f[i++]=q,q=q>>8,f[i++]=q,i}function oe(f,n,i,d,E){de(n,d,E,f,i,7);let k=Number(n&BigInt(4294967295));f[i+7]=k,k=k>>8,f[i+6]=k,k=k>>8,f[i+5]=k,k=k>>8,f[i+4]=k;let q=Number(n>>BigInt(32)&BigInt(4294967295));return f[i+3]=q,q=q>>8,f[i+2]=q,q=q>>8,f[i+1]=q,q=q>>8,f[i]=q,i+8}o.prototype.writeBigUInt64LE=ge(function(n,i=0){return U(this,n,i,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=ge(function(n,i=0){return oe(this,n,i,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(n,i,d,E){if(n=+n,i=i>>>0,!E){const Se=Math.pow(2,8*d-1);X(this,n,i,d,Se-1,-Se)}let k=0,q=1,_e=0;for(this[i]=n&255;++k<d&&(q*=256);)n<0&&_e===0&&this[i+k-1]!==0&&(_e=1),this[i+k]=(n/q>>0)-_e&255;return i+d},o.prototype.writeIntBE=function(n,i,d,E){if(n=+n,i=i>>>0,!E){const Se=Math.pow(2,8*d-1);X(this,n,i,d,Se-1,-Se)}let k=d-1,q=1,_e=0;for(this[i+k]=n&255;--k>=0&&(q*=256);)n<0&&_e===0&&this[i+k+1]!==0&&(_e=1),this[i+k]=(n/q>>0)-_e&255;return i+d},o.prototype.writeInt8=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,1,127,-128),n<0&&(n=255+n+1),this[i]=n&255,i+1},o.prototype.writeInt16LE=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,2,32767,-32768),this[i]=n&255,this[i+1]=n>>>8,i+2},o.prototype.writeInt16BE=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,2,32767,-32768),this[i]=n>>>8,this[i+1]=n&255,i+2},o.prototype.writeInt32LE=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,4,2147483647,-2147483648),this[i]=n&255,this[i+1]=n>>>8,this[i+2]=n>>>16,this[i+3]=n>>>24,i+4},o.prototype.writeInt32BE=function(n,i,d){return n=+n,i=i>>>0,d||X(this,n,i,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[i]=n>>>24,this[i+1]=n>>>16,this[i+2]=n>>>8,this[i+3]=n&255,i+4},o.prototype.writeBigInt64LE=ge(function(n,i=0){return U(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=ge(function(n,i=0){return oe(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ce(f,n,i,d,E,k){if(i+d>f.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function ye(f,n,i,d,E){return n=+n,i=i>>>0,E||ce(f,n,i,4),t.write(f,n,i,d,23,4),i+4}o.prototype.writeFloatLE=function(n,i,d){return ye(this,n,i,!0,d)},o.prototype.writeFloatBE=function(n,i,d){return ye(this,n,i,!1,d)};function pe(f,n,i,d,E){return n=+n,i=i>>>0,E||ce(f,n,i,8),t.write(f,n,i,d,52,8),i+8}o.prototype.writeDoubleLE=function(n,i,d){return pe(this,n,i,!0,d)},o.prototype.writeDoubleBE=function(n,i,d){return pe(this,n,i,!1,d)},o.prototype.copy=function(n,i,d,E){if(!o.isBuffer(n))throw new TypeError("argument should be a Buffer");if(d||(d=0),!E&&E!==0&&(E=this.length),i>=n.length&&(i=n.length),i||(i=0),E>0&&E<d&&(E=d),E===d||n.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(d<0||d>=this.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("sourceEnd out of bounds");E>this.length&&(E=this.length),n.length-i<E-d&&(E=n.length-i+d);const k=E-d;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(i,d,E):Uint8Array.prototype.set.call(n,this.subarray(d,E),i),k},o.prototype.fill=function(n,i,d,E){if(typeof n=="string"){if(typeof i=="string"?(E=i,i=0,d=this.length):typeof d=="string"&&(E=d,d=this.length),E!==void 0&&typeof E!="string")throw new TypeError("encoding must be a string");if(typeof E=="string"&&!o.isEncoding(E))throw new TypeError("Unknown encoding: "+E);if(n.length===1){const q=n.charCodeAt(0);(E==="utf8"&&q<128||E==="latin1")&&(n=q)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(i<0||this.length<i||this.length<d)throw new RangeError("Out of range index");if(d<=i)return this;i=i>>>0,d=d===void 0?this.length:d>>>0,n||(n=0);let k;if(typeof n=="number")for(k=i;k<d;++k)this[k]=n;else{const q=o.isBuffer(n)?n:o.from(n,E),_e=q.length;if(_e===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(k=0;k<d-i;++k)this[k+i]=q[k%_e]}return this};const D={};function z(f,n,i){D[f]=class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${f}]`,this.stack,delete this.name}get code(){return f}set code(E){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:E,writable:!0})}toString(){return`${this.name} [${f}]: ${this.message}`}}}z("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),z("ERR_INVALID_ARG_TYPE",function(f,n){return`The "${f}" argument must be of type number. Received type ${typeof n}`},TypeError),z("ERR_OUT_OF_RANGE",function(f,n,i){let d=`The value of "${f}" is out of range.`,E=i;return Number.isInteger(i)&&Math.abs(i)>2**32?E=ie(String(i)):typeof i=="bigint"&&(E=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(E=ie(E)),E+="n"),d+=` It must be ${n}. Received ${E}`,d},RangeError);function ie(f){let n="",i=f.length;const d=f[0]==="-"?1:0;for(;i>=d+4;i-=3)n=`_${f.slice(i-3,i)}${n}`;return`${f.slice(0,i)}${n}`}function he(f,n,i){S(n,"offset"),(f[n]===void 0||f[n+i]===void 0)&&N(n,f.length-(i+1))}function de(f,n,i,d,E,k){if(f>i||f<n){const q=typeof n=="bigint"?"n":"";let _e;throw n===0||n===BigInt(0)?_e=`>= 0${q} and < 2${q} ** ${(k+1)*8}${q}`:_e=`>= -(2${q} ** ${(k+1)*8-1}${q}) and < 2 ** ${(k+1)*8-1}${q}`,new D.ERR_OUT_OF_RANGE("value",_e,f)}he(d,E,k)}function S(f,n){if(typeof f!="number")throw new D.ERR_INVALID_ARG_TYPE(n,"number",f)}function N(f,n,i){throw Math.floor(f)!==f?(S(f,i),new D.ERR_OUT_OF_RANGE("offset","an integer",f)):n<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${n}`,f)}const O=/[^+/0-9A-Za-z-_]/g;function ee(f){if(f=f.split("=")[0],f=f.trim().replace(O,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function J(f,n){n=n||1/0;let i;const d=f.length;let E=null;const k=[];for(let q=0;q<d;++q){if(i=f.charCodeAt(q),i>55295&&i<57344){if(!E){if(i>56319){(n-=3)>-1&&k.push(239,191,189);continue}else if(q+1===d){(n-=3)>-1&&k.push(239,191,189);continue}E=i;continue}if(i<56320){(n-=3)>-1&&k.push(239,191,189),E=i;continue}i=(E-55296<<10|i-56320)+65536}else E&&(n-=3)>-1&&k.push(239,191,189);if(E=null,i<128){if((n-=1)<0)break;k.push(i)}else if(i<2048){if((n-=2)<0)break;k.push(i>>6|192,i&63|128)}else if(i<65536){if((n-=3)<0)break;k.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((n-=4)<0)break;k.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return k}function Z(f){const n=[];for(let i=0;i<f.length;++i)n.push(f.charCodeAt(i)&255);return n}function R(f,n){let i,d,E;const k=[];for(let q=0;q<f.length&&!((n-=2)<0);++q)i=f.charCodeAt(q),d=i>>8,E=i%256,k.push(E),k.push(d);return k}function Q(f){return e.toByteArray(ee(f))}function Y(f,n,i,d){let E;for(E=0;E<d&&!(E+i>=n.length||E>=f.length);++E)n[E+i]=f[E];return E}function $(f,n){return f instanceof n||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===n.name}function we(f){return f!==f}const Ne=(function(){const f="0123456789abcdef",n=new Array(256);for(let i=0;i<16;++i){const d=i*16;for(let E=0;E<16;++E)n[d+E]=f[i]+f[E]}return n})();function ge(f){return typeof BigInt>"u"?Le:f}function Le(){throw new Error("BigInt not supported")}})(kt)),kt}var $n=Me();const rt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",nt="http://www.w3.org/2001/XMLSchema#",mt="http://www.w3.org/2000/10/swap/",ve={xsd:{decimal:`${nt}decimal`,boolean:`${nt}boolean`,double:`${nt}double`,integer:`${nt}integer`,string:`${nt}string`},rdf:{type:`${rt}type`,nil:`${rt}nil`,first:`${rt}first`,rest:`${rt}rest`,langString:`${rt}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${mt}reify#forSome`,forAll:`${mt}reify#forAll`},log:{implies:`${mt}log#implies`,isImpliedBy:`${mt}log#isImpliedBy`}},{xsd:xt}=ve,Un=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Ir={"\\":"\\","'":"'",'"':'"',n:`
|
|
7
|
+
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Wn=/[\x00-\x20<>\\"\{\}\|\^\`]/,qn={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Gn=/$0^/;class zn{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 qn)&&this[t]instanceof RegExp&&(this[t]=Gn)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,t){let r=this._input,s=r.length;for(;;){let o,b;for(;o=this._newline.exec(r);)this.comments&&(b=this._comment.exec(o[0]))&&a("comment",b[1],"",this._line,o[0].length),r=r.substr(o[0].length,r.length),s=r.length,this._line++;if(!o&&(o=this._whitespace.exec(r))&&(r=r.substr(o[0].length,r.length)),this._endOfFile.test(r))return t&&(this.comments&&(b=this._comment.exec(r))&&a("comment",b[1],"",this._line,r.length),r=null,a("eof","","",this._line,0)),this._input=r;const h=this._line,x=r[0];let T="",j="",L="",v=null,A=0,g=!1;switch(x){case"^":if(r.length<3)break;if(r[1]==="^"){if(this._previousMarker="^^",r=r.substr(2),r[0]!=="<"){g=!0;break}}else{this._n3Mode&&(A=1,T="^");break}case"<":if(v=this._unescapedIri.exec(r))T="IRI",j=v[1];else if(v=this._iri.exec(r)){if(j=this._unescape(v[1]),j===null||Wn.test(j))return u(this);T="IRI"}else r.length>1&&r[1]==="<"?(T="<<",A=2):this._n3Mode&&r.length>1&&r[1]==="="&&(A=2,this._isImpliedBy?(T="abbreviation",j="<"):(T="inverse",j=">"));break;case">":r.length>1&&r[1]===">"&&(T=">>",A=2);break;case"_":((v=this._blank.exec(r))||t&&(v=this._blank.exec(`${r} `)))&&(T="blank",L="_",j=v[1]);break;case'"':if(v=this._simpleQuotedString.exec(r))j=v[1];else if({value:j,matchLength:A}=this._parseLiteral(r),j===null)return u(this);(v!==null||A!==0)&&(T="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(v=this._simpleApostropheString.exec(r))j=v[1];else if({value:j,matchLength:A}=this._parseLiteral(r),j===null)return u(this);(v!==null||A!==0)&&(T="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(v=this._variable.exec(r))&&(T="var",j=v[0]);break;case"@":this._previousMarker==="literal"&&(v=this._langcode.exec(r))?(T="langcode",j=v[1]):(v=this._keyword.exec(r))&&(T=v[0]);break;case".":if(r.length===1?t:r[1]<"0"||r[1]>"9"){T=".",A=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(v=this._number.exec(r)||t&&(v=this._number.exec(`${r} `)))&&(T="literal",j=v[0],L=typeof v[1]=="string"?xt.double:typeof v[2]=="string"?xt.decimal:xt.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(v=this._sparqlKeyword.exec(r))?T=v[0].toUpperCase():g=!0;break;case"f":case"t":(v=this._boolean.exec(r))?(T="literal",j=v[0],L=xt.boolean):g=!0;break;case"a":(v=this._shortPredicates.exec(r))?(T="abbreviation",j="a"):g=!0;break;case"=":this._n3Mode&&r.length>1&&(T="abbreviation",r[1]!==">"?(A=1,j="="):(A=2,j=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(A=1,T=x);break;case"{":!this._lineMode&&r.length>=2&&(r[1]==="|"?(T="{|",A=2):(T=x,A=1));break;case"|":r.length>=2&&r[1]==="}"&&(T="|}",A=2);break;default:g=!0}if(g&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(v=this._prefix.exec(r))?(T="prefix",j=v[1]||""):((v=this._prefixed.exec(r))||t&&(v=this._prefixed.exec(`${r} `)))&&(T="prefixed",L=v[1]||"",j=this._unescape(v[2]))),this._previousMarker==="^^")switch(T){case"prefixed":T="type";break;case"IRI":T="typeIRI";break;default:T=""}if(!T)return t||!/^'''|^"""/.test(r)&&/\n|\r/.test(r)?u(this):this._input=r;const _=A||v[0].length,m=a(T,j,L,h,_);this.previousToken=m,this._previousMarker=T,r=r.substr(_,r.length)}function a(o,b,h,x,T){const j=r?s-r.length:s,L=j+T,v={type:o,value:b,prefix:h,line:x,start:j,end:L};return e(null,v),v}function u(o){e(o._syntaxError(/^\S*/.exec(r)[0]))}}_unescape(e){let t=!1;const r=e.replace(Un,(s,a,u,o)=>{if(typeof a=="string")return String.fromCharCode(Number.parseInt(a,16));if(typeof u=="string"){let b=Number.parseInt(u,16);return b<=65535?String.fromCharCode(Number.parseInt(u,16)):String.fromCharCode(55296+((b-=65536)>>10),56320+(b&1023))}return o in Ir?Ir[o]:(t=!0,"")});return t?null:r}_parseLiteral(e){if(e.length>=3){const t=e.match(/^(?:"""|"|'''|'|)/)[0],r=t.length;let s=Math.max(this._literalClosingPos,r);for(;(s=e.indexOf(t,s))>0;){let a=0;for(;e[s-a-1]==="\\";)a++;if(a%2===0){const u=e.substring(r,s),o=u.split(/\r\n|\r|\n/).length-1,b=s+r;if(r===1&&o!==0||r===3&&this._lineMode)break;return this._line+=o,{value:this._unescape(u),matchLength:b}}s++}this._literalClosingPos=e.length-r+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;const t=new Error(`Unexpected "${e}" on line ${this._line}.`);return t.context={token:void 0,line:this._line,previousToken:this.previousToken},t}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,t){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof t=="function")queueMicrotask(()=>this._tokenizeToEnd(t,!0));else{const r=[];let s;if(this._tokenizeToEnd((a,u)=>a?s=a:r.push(u),!0),s)throw s;return r}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",r=>{this._input!==null&&r.length!==0&&(this._pendingBuffer&&(r=$n.Buffer.concat([this._pendingBuffer,r]),this._pendingBuffer=null),r[r.length-1]&128?this._pendingBuffer=r:(typeof this._input>"u"?this._input=this._readStartingBom(typeof r=="string"?r:r.toString()):this._input+=r,this._tokenizeToEnd(t,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(t,!0)}),e.on("error",t)}}const{rdf:Hn,xsd:Ge}=ve;let Ke,Qn=0;const ze={namedNode:Ar,blankNode:vr,variable:Pr,literal:Nr,defaultGraph:Xn,quad:Ct,triple:Ct,fromTerm:st,fromQuad:jr};class Ce{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof Ce?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}}class Rr extends Ce{get termType(){return"NamedNode"}}class Ye extends Ce{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 Rr(this.datatypeString)}get datatypeString(){const e=this.id,t=e.lastIndexOf('"')+1,r=t<e.length?e[t]:"";return r==="^"?e.substr(t+2):r!=="@"?Ge.string:Hn.langString}equals(e){return e instanceof Ye?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}}}}class Vn extends Ce{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}}class Kn extends Ce{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}}class Yn extends Ce{constructor(){return super(""),Ke||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}}Ke=new Yn;function it(l,e,t){if(e=e||ze,!l)return e.defaultGraph();switch(l[0]){case"?":return e.variable(l.substr(1));case"_":return e.blankNode(l.substr(2));case'"':if(e===ze)return new Ye(l);if(l[l.length-1]==='"')return e.literal(l.substr(1,l.length-2));const r=l.lastIndexOf('"',l.length-1);return e.literal(l.substr(1,r-1),l[r+1]==="@"?l.substr(r+2):e.namedNode(l.substr(r+3)));case"[":l=JSON.parse(l);break;default:if(!t||!Array.isArray(l))return e.namedNode(l)}return e.quad(it(l[0],e,!0),it(l[1],e,!0),it(l[2],e,!0),l[3]&&it(l[3],e,!0))}function Xe(l,e){if(typeof l=="string")return l;if(l instanceof Ce&&l.termType!=="Quad")return l.id;if(!l)return Ke.id;switch(l.termType){case"NamedNode":return l.value;case"BlankNode":return`_:${l.value}`;case"Variable":return`?${l.value}`;case"DefaultGraph":return"";case"Literal":return`"${l.value}"${l.language?`@${l.language}`:l.datatype&&l.datatype.value!==Ge.string?`^^${l.datatype.value}`:""}`;case"Quad":const t=[Xe(l.subject,!0),Xe(l.predicate,!0),Xe(l.object,!0)];return l.graph&&l.graph.termType!=="DefaultGraph"&&t.push(Xe(l.graph,!0)),e?t:JSON.stringify(t);default:throw new Error(`Unexpected termType: ${l.termType}`)}}class Tr extends Ce{constructor(e,t,r,s){super(""),this._subject=e,this._predicate=t,this._object=r,this._graph=s||Ke}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 Ar(l){return new Rr(l)}function vr(l){return new Vn(l||`n3-${Qn++}`)}function Nr(l,e){if(typeof e=="string")return new Ye(`"${l}"@${e.toLowerCase()}`);let t=e?e.value:"";return t===""&&(typeof l=="boolean"?t=Ge.boolean:typeof l=="number"&&(Number.isFinite(l)?t=Number.isInteger(l)?Ge.integer:Ge.double:(t=Ge.double,Number.isNaN(l)||(l=l>0?"INF":"-INF")))),t===""||t===Ge.string?new Ye(`"${l}"`):new Ye(`"${l}"^^${t}`)}function Pr(l){return new Kn(l)}function Xn(){return Ke}function Ct(l,e,t,r){return new Tr(l,e,t,r)}function st(l){if(l instanceof Ce)return l;switch(l.termType){case"NamedNode":return Ar(l.value);case"BlankNode":return vr(l.value);case"Variable":return Pr(l.value);case"DefaultGraph":return Ke;case"Literal":return Nr(l.value,l.language||l.datatype);case"Quad":return jr(l);default:throw new Error(`Unexpected termType: ${l.termType}`)}}function jr(l){if(l instanceof Tr)return l;if(l.termType!=="Quad")throw new Error(`Unexpected termType: ${l.termType}`);return Ct(st(l.subject),st(l.predicate),st(l.object),st(l.graph))}let Lr=0;class Br{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Fr(this,e.factory);const t=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",r=/turtle/.test(t),s=/trig/.test(t),a=/triple/.test(t),u=/quad/.test(t),o=this._n3Mode=/n3/.test(t),b=a||u;(this._supportsNamedGraphs=!(r||o))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(r||s||a||o),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=t===""||/star|\*$/.test(t),b&&(this._resolveRelativeIRI=h=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new zn({lineMode:b,n3:o,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Lr=0}_setBase(e){if(!e)this._base="",this._basePath="";else{const t=e.indexOf("#");t>=0&&(e=e.substr(0,t)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,t,r,s,a){const u=this._n3Mode;this._contextStack.push({type:e,subject:r,predicate:s,object:a,graph:t,inverse:u?this._inversePredicate:!1,blankPrefix:u?this._prefixes._:"",quantified:u?this._quantified:null}),u&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,t){const r=this._contextStack.pop();if(!r||r.type!==e)return this._error(`Unexpected ${t.type}`,t);this._subject=r.subject,this._predicate=r.predicate,this._object=r.object,this._graph=r.graph,this._n3Mode&&(this._inversePredicate=r.inverse,this._prefixes._=r.blankPrefix,this._quantified=r.quantified)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,t){let r;switch(e.type){case"IRI":case"typeIRI":const s=this._resolveIRI(e.value);if(s===null)return this._error("Invalid IRI",e);r=this._factory.namedNode(s);break;case"type":case"prefixed":const a=this._prefixes[e.prefix];if(a===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);r=this._factory.namedNode(a+e.value);break;case"blank":r=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":r=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!t&&this._n3Mode&&r.id in this._quantified&&(r=this._quantified[r.id]),r}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){const t=e.type;switch(t){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return this._predicate===null?this._error(`Unexpected ${t}`,e):(this._subject=null,t==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return e.type==="]"?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);const t=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:t?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let t=null,r=null,s=this._readListItem;const a=this._subject,u=this._contextStack,o=u[u.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this._subject=t=this._factory.blankNode()),s=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,r=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),u.length!==0&&u[u.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(s=this._readPredicate,this._subject===this.RDF_NIL)return s}else if(s=this._getContextEndReader(),this._object===this.RDF_NIL)return s;r=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,s=this._readListItemDataTypeOrLang):(t=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),s=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if((t=this._readEntity(e))===void 0)return}if(r===null&&(this._subject=r=this._factory.blankNode()),a===null?o.predicate===null?o.subject=r:o.object=r:this._emit(a,this.RDF_REST,r,this._graph),t!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,r,this.RDF_FIRST,t),this._subject=t,this._predicate=null,this._getPathReader(this._readListItem);this._emit(r,this.RDF_FIRST,t,this._graph)}return s}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let t=this._factory.literal(this._literalValue);switch(e.type){case"type":case"typeIRI":const r=this._readEntity(e);if(r===void 0)return;t=this._factory.literal(this._literalValue,r),e=null;break;case"langcode":t=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:t}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,t){const r=this._completeLiteral(e);if(r)return this._object=r.literal,t&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),r.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(r.token))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let t,r=this._graph;const s=this._subject,a=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,a&&(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 u=this._predicate,o=this._object;this._subject=this._factory.quad(s,u,o,this.DEFAULTGRAPH),t=this._readPredicate;break;case"|}":if(this._subject.termType!=="Quad")return this._error("Unexpected asserted triple closing",e);this._subject=null,t=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(r=this._readEntity(e))!==void 0){t=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(s!==null){const u=this._predicate,o=this._object;a?this._emit(o,u,s,r):this._emit(s,u,o,r)}return t}_readBlankNodePunctuation(e){let t;switch(e.type){case";":t=this._readPredicate;break;case",":t=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),t}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);const t=this._readEntity(e);return this._prefixes[this._prefix]=t.value,this._prefixCallback(this._prefix,t),this._readDeclarationPunctuation}_readBaseIRI(e){const t=e.type==="IRI"&&this._resolveIRI(e.value);return t?(this._setBase(t),this._readDeclarationPunctuation):this._error("Expected valid IRI to follow base declaration",e)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let t;switch(e.type){case"IRI":case"prefixed":if((t=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,t,this.QUANTIFIERS_GRAPH)):this._quantified[t.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:const t=this._contextStack,r=t.length&&t[t.length-1];if(r&&r.type==="item"){const s=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,s,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let t,r;const s=this._factory.blankNode();if((r=this._readEntity(e))!==void 0)return this._predicate===null?(t=this._subject,this._subject=s):(t=this._object,this._object=s),this._emit(t,r,s,this._graph),this._readPath}_readBackwardPath(e){const t=this._factory.blankNode();let r,s;if((r=this._readEntity(e))!==void 0)return this._predicate===null?(s=this._subject,this._subject=t):(s=this._object,this._object=t),this._emit(t,r,s,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);const t=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),this._subject===null?(this._subject=t,this._readPredicate):(this._object=t,this._getContextEndReader())}_getContextEndReader(){const e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<":return this._readRDFStarTailOrGraph}}_emit(e,t,r,s){this._callback(null,this._factory.quad(e,t,r,s||this.DEFAULTGRAPH))}_error(e,t){const r=new Error(`${e} on line ${t.line}.`);r.context={token:t,line:t.line,previousToken:this._lexer.previousToken},this._callback(r),this._callback=Et}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;const t=e.length;let r="",s=-1,a=-1,u=0,o="/";for(;s<t;){switch(o){case":":if(a<0&&e[++s]==="/"&&e[++s]==="/")for(;(a=s+1)<t&&e[a]!=="/";)s=a;break;case"?":case"#":s=t;break;case"/":if(e[s+1]===".")switch(o=e[++s+1],o){case"/":r+=e.substring(u,s-1),u=s+1;break;case void 0:case"?":case"#":return r+e.substring(u,s)+e.substr(s+1);case".":if(o=e[++s+1],o===void 0||o==="/"||o==="?"||o==="#"){if(r+=e.substring(u,s-2),(u=r.lastIndexOf("/"))>=a&&(r=r.substr(0,u)),o!=="/")return`${r}/${e.substr(s+1)}`;u=s+1}}}o=e[++s]}return r+e.substring(u)}parse(e,t,r){let s,a,u;if(t&&(t.onQuad||t.onPrefix||t.onComment)?(s=t.onQuad,a=t.onPrefix,u=t.onComment):(s=t,a=r),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Lr++}_`,this._prefixCallback=a||Et,this._inversePredicate=!1,this._quantified=Object.create(null),!s){const b=[];let h;if(this._callback=(x,T)=>{x?h=x:T&&b.push(T)},this._lexer.tokenize(e).every(x=>this._readCallback=this._readCallback(x)),h)throw h;return b}let o=(b,h)=>{b!==null?(this._callback(b),this._callback=Et):this._readCallback&&(this._readCallback=this._readCallback(h))};u&&(this._lexer.comments=!0,o=(b,h)=>{b!==null?(this._callback(b),this._callback=Et):this._readCallback&&(h.type==="comment"?u(h.value):this._readCallback=this._readCallback(h))}),this._callback=s,this._lexer.tokenize(e,o)}}function Et(){}function Fr(l,e){l._factory=e,l.DEFAULTGRAPH=e.defaultGraph(),l.RDF_FIRST=e.namedNode(ve.rdf.first),l.RDF_REST=e.namedNode(ve.rdf.rest),l.RDF_NIL=e.namedNode(ve.rdf.nil),l.N3_FORALL=e.namedNode(ve.r.forAll),l.N3_FORSOME=e.namedNode(ve.r.forSome),l.ABBREVIATIONS={a:e.namedNode(ve.rdf.type),"=":e.namedNode(ve.owl.sameAs),">":e.namedNode(ve.log.implies),"<":e.namedNode(ve.log.isImpliedBy)},l.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Fr(Br.prototype,ze);function Ot(l){return!!l&&l.termType==="DefaultGraph"}function St(l){return l.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}const Jn=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Zn=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,kr="./",ei="../",Mt="?",Cr="#";class Dt{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Jn.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!Dt.supports(this.base))return this._baseMatcher=/.^/;const e=/^[^:]*:\/*/.exec(this.base)[0],t=["^",St(e)],r=[],s=[],a=/[^/?#]*([/?#])/y;let u,o=0,b=0,h=a.lastIndex=e.length;for(;!o&&!b&&(u=a.exec(this.base));)u[1]===Cr?b=a.lastIndex-1:(t.push(St(u[0]),"(?:"),r.push(")?"),u[1]!==Mt?s.push(h=a.lastIndex):(o=h=a.lastIndex,b=this.base.indexOf(Cr,o),this._pathReplacements[o]=Mt));for(let x=0;x<s.length;x++)this._pathReplacements[s[x]]=ei.repeat(s.length-x-1);return this._pathReplacements[s[s.length-1]]=kr,this._baseLength=b>0?b:this.base.length,t.push(St(this.base.substring(h,this._baseLength)),o?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...t,...r].join(""))}toRelative(e){const t=this._getBaseMatcher().exec(e);if(!t)return e;const r=t[0].length;if(r===this._baseLength&&r===e.length)return"";const s=this._pathReplacements[r];if(s){const a=e.substring(r);return s!==Mt&&!Zn.test(a)?e:s===kr&&/^[^?#]/.test(a)?a:s+a}return e.substring(r-1)}}const ot=ze.defaultGraph(),{rdf:ti,xsd:Je}=ve,Or=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Mr=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,ri={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"};class at extends Ce{equals(e){return e===this}}class Dr{constructor(e,t){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(t=e,e=null),t=t||{},this._lists=t.lists,e)this._outputStream=e,this._endStream=t.end===void 0?!0:!!t.end;else{let r="";this._outputStream={write(s,a,u){r+=s,u&&u()},end:s=>{s&&s(null,r)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(t.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=ot,this._prefixIRIs=Object.create(null),t.prefixes&&this.addPrefixes(t.prefixes),t.baseIRI&&(this._baseIri=new Dt(t.baseIRI)))}get _inDefaultGraph(){return ot.equals(this._graph)}_write(e,t){this._outputStream.write(e,"utf8",t)}_writeQuad(e,t,r,s,a){try{s.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
|
|
8
8
|
`:`
|
|
9
9
|
}
|
|
10
|
-
`)+(
|
|
11
|
-
`)),this._graph=
|
|
12
|
-
${this._encodePredicate(this._predicate=
|
|
13
|
-
`)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=
|
|
10
|
+
`)+(ot.equals(s)?"":`${this._encodeIriOrBlank(s)} {
|
|
11
|
+
`)),this._graph=s,this._subject=null),e.equals(this._subject)?t.equals(this._predicate)?this._write(`, ${this._encodeObject(r)}`,a):this._write(`;
|
|
12
|
+
${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,a):this._write(`${(this._subject===null?"":`.
|
|
13
|
+
`)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=t)} ${this._encodeObject(r)}`,a)}catch(u){a&&a(u)}}_writeQuadLine(e,t,r,s,a){delete this._prefixMatch,this._write(this.quadToString(e,t,r,s),a)}quadToString(e,t,r,s){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(t)} ${this._encodeObject(r)}${s&&s.value?` ${this._encodeIriOrBlank(s)} .
|
|
14
14
|
`:` .
|
|
15
|
-
`}`}quadsToString(e){let
|
|
15
|
+
`}`}quadsToString(e){let t="";for(const r of e)t+=this.quadToString(r.subject,r.predicate,r.object,r.graph);return t}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let t=e.value;this._baseIri&&(t=this._baseIri.toRelative(t)),Or.test(t)&&(t=t.replace(Mr,$r));const r=this._prefixRegex.exec(t);return r?r[1]?this._prefixIRIs[r[1]]+r[2]:t:`<${t}>`}_encodeLiteral(e){let t=e.value;if(Or.test(t)&&(t=t.replace(Mr,$r)),e.language)return`"${t}"@${e.language}`;if(this._lineMode){if(e.datatype.value===Je.string)return`"${t}"`}else switch(e.datatype.value){case Je.string:return`"${t}"`;case Je.boolean:if(t==="true"||t==="false")return t;break;case Je.integer:if(/^[+-]?\d+$/.test(t))return t;break;case Je.decimal:if(/^[+-]?\d*\.\d+$/.test(t))return t;break;case Je.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(t))return t;break}return`"${t}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===ti.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:t,object:r,graph:s}){return`<<${this._encodeSubject(e)} ${this._encodePredicate(t)} ${this._encodeObject(r)}${Ot(s)?"":` ${this._encodeIriOrBlank(s)}`}>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,t,r,s,a){r===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,t):typeof s=="function"?this._writeQuad(e,t,r,ot,s):this._writeQuad(e,t,r,s||ot,a)}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}addPrefix(e,t,r){const s={};s[e]=t,this.addPrefixes(s,r)}addPrefixes(e,t){if(!this._prefixIRIs)return t&&t();let r=!1;for(let s in e){let a=e[s];typeof a!="string"&&(a=a.value),r=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
16
16
|
`:`
|
|
17
17
|
}
|
|
18
|
-
`),this._subject=null,this._graph=""),this._prefixIRIs[a]=
|
|
19
|
-
`)}if(
|
|
20
|
-
`:"",
|
|
18
|
+
`),this._subject=null,this._graph=""),this._prefixIRIs[a]=s+=":",this._write(`@prefix ${s} <${a}>.
|
|
19
|
+
`)}if(r){let s="",a="";for(const u in this._prefixIRIs)s+=s?`|${u}`:u,a+=(a?"|":"")+this._prefixIRIs[u];s=St(s),this._prefixRegex=new RegExp(`^(?:${a})[^/]*$|^(${s})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(r?`
|
|
20
|
+
`:"",t)}blank(e,t){let r=e,s,a;switch(e===void 0?r=[]:e.termType?r=[{predicate:e,object:t}]:"length"in e||(r=[e]),a=r.length){case 0:return new at("[]");case 1:if(s=r[0],!(s.object instanceof at))return new at(`[ ${this._encodePredicate(s.predicate)} ${this._encodeObject(s.object)} ]`);default:let u="[";for(let o=0;o<a;o++)s=r[o],s.predicate.equals(e)?u+=`, ${this._encodeObject(s.object)}`:(u+=`${(o?`;
|
|
21
21
|
`:`
|
|
22
|
-
`)+this._encodePredicate(
|
|
23
|
-
]`)}}list(e){const
|
|
22
|
+
`)+this._encodePredicate(s.predicate)} ${this._encodeObject(s.object)}`,e=s.predicate);return new at(`${u}
|
|
23
|
+
]`)}}list(e){const t=e&&e.length||0,r=new Array(t);for(let s=0;s<t;s++)r[s]=this._encodeObject(e[s]);return new at(`(${r.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
24
24
|
`:`
|
|
25
25
|
}
|
|
26
|
-
`),this._subject=null),this._write=this._blockedWrite;let
|
|
27
|
-
`;super(r),this.name="AggregateError",this.errors=e}},ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},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(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.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(t,e,r){return t.set(e,r)},Boolean,Uint8Array},Yn={exports:{}},Xn={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,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(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}};const{format:mo,inspect:rr}=Xn,{AggregateError:xo}=oe,Eo=globalThis.AggregateError||xo,So=Symbol("kIsNodeError"),Io=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Ro=/^([A-Z][a-z0-9]*)+$/,Ao="__node_internal_",nr={};function at(t,e){if(!t)throw new nr.ERR_INTERNAL_ASSERTION(e)}function Zn(t){let e="",r=t.length;const n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function To(t,e,r){if(typeof e=="function")return at(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);const n=(e.match(/%[dfijoOs]/g)||[]).length;return at(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:mo(e,...r)}function ye(t,e,r){r||(r=Error);class n extends r{constructor(...a){super(To(t,e,a))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[So]=!0,nr[t]=n}function Jn(t){const e=Ao+t.name;return Object.defineProperty(t,"name",{value:e}),t}function vo(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;const r=new Eo([e,t],e.message);return r.code=e.code,r}return t||e}let No=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new nr.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};ye("ERR_ASSERTION","%s",Error),ye("ERR_INVALID_ARG_TYPE",(t,e,r)=>{at(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";const i=[],a=[],l=[];for(const p of e)at(typeof p=="string","All expected entries have to be of type string"),Io.includes(p)?i.push(p.toLowerCase()):Ro.test(p)?a.push(p):(at(p!=="object",'The value "object" should be written as "Object"'),l.push(p));if(a.length>0){const p=i.indexOf("object");p!==-1&&(i.splice(i,p,1),a.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{const p=i.pop();n+=`one of type ${i.join(", ")}, or ${p}`}}(a.length>0||l.length>0)&&(n+=" or ")}if(a.length>0){switch(a.length){case 1:n+=`an instance of ${a[0]}`;break;case 2:n+=`an instance of ${a[0]} or ${a[1]}`;break;default:{const p=a.pop();n+=`an instance of ${a.join(", ")}, or ${p}`}}l.length>0&&(n+=" or ")}switch(l.length){case 0:break;case 1:l[0].toLowerCase()!==l[0]&&(n+="an "),n+=`${l[0]}`;break;case 2:n+=`one of ${l[0]} or ${l[1]}`;break;default:{const p=l.pop();n+=`one of ${l.join(", ")}, or ${p}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var u;if((u=r.constructor)!==null&&u!==void 0&&u.name)n+=`. Received an instance of ${r.constructor.name}`;else{const p=rr(r,{depth:-1});n+=`. Received ${p}`}}else{let p=rr(r,{colors:!1});p.length>25&&(p=`${p.slice(0,25)}...`),n+=`. Received type ${typeof r} (${p})`}return n},TypeError),ye("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=rr(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError),ye("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;const i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError),ye("ERR_MISSING_ARGS",(...t)=>{at(t.length>0,"At least one arg needs to be specified");let e;const r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{const n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError),ye("ERR_OUT_OF_RANGE",(t,e,r)=>{at(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=Zn(String(r));else if(typeof r=="bigint"){n=String(r);const i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=Zn(n)),n+="n"}else n=rr(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError),ye("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),ye("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),ye("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),ye("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),ye("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),ye("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),ye("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),ye("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),ye("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),ye("ERR_STREAM_WRITE_AFTER_END","write after end",Error),ye("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var xe={AbortError:No,aggregateTwoErrors:Jn(vo),hideStackFrames:Jn,codes:nr},Ct={exports:{}},ei;function Ot(){if(ei)return Ct.exports;ei=1;const{AbortController:t,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return Ct.exports=t,Ct.exports.AbortSignal=e,Ct.exports.default=t,Ct.exports}var Br={exports:{}},St=typeof Reflect=="object"?Reflect:null,ti=St&&typeof St.apply=="function"?St.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},ir;St&&typeof St.ownKeys=="function"?ir=St.ownKeys:Object.getOwnPropertySymbols?ir=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ir=function(e){return Object.getOwnPropertyNames(e)};function Po(t){console&&console.warn&&console.warn(t)}var ri=Number.isNaN||function(e){return e!==e};function X(){X.init.call(this)}Br.exports=X,Br.exports.once=Bo,X.EventEmitter=X,X.prototype._events=void 0,X.prototype._eventsCount=0,X.prototype._maxListeners=void 0;var ni=10;function sr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(X,"defaultMaxListeners",{enumerable:!0,get:function(){return ni},set:function(t){if(typeof t!="number"||t<0||ri(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ni=t}}),X.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},X.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||ri(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function ii(t){return t._maxListeners===void 0?X.defaultMaxListeners:t._maxListeners}X.prototype.getMaxListeners=function(){return ii(this)},X.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",a=this._events;if(a!==void 0)i=i&&a.error===void 0;else if(!i)return!1;if(i){var l;if(r.length>0&&(l=r[0]),l instanceof Error)throw l;var u=new Error("Unhandled error."+(l?" ("+l.message+")":""));throw u.context=l,u}var p=a[e];if(p===void 0)return!1;if(typeof p=="function")ti(p,this,r);else for(var _=p.length,y=ui(p,_),n=0;n<_;++n)ti(y[n],this,r);return!0};function si(t,e,r,n){var i,a,l;if(sr(r),a=t._events,a===void 0?(a=t._events=Object.create(null),t._eventsCount=0):(a.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),a=t._events),l=a[e]),l===void 0)l=a[e]=r,++t._eventsCount;else if(typeof l=="function"?l=a[e]=n?[r,l]:[l,r]:n?l.unshift(r):l.push(r),i=ii(t),i>0&&l.length>i&&!l.warned){l.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=l.length,Po(u)}return t}X.prototype.addListener=function(e,r){return si(this,e,r,!1)},X.prototype.on=X.prototype.addListener,X.prototype.prependListener=function(e,r){return si(this,e,r,!0)};function jo(){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 oi(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=jo.bind(n);return i.listener=r,n.wrapFn=i,i}X.prototype.once=function(e,r){return sr(r),this.on(e,oi(this,e,r)),this},X.prototype.prependOnceListener=function(e,r){return sr(r),this.prependListener(e,oi(this,e,r)),this},X.prototype.removeListener=function(e,r){var n,i,a,l,u;if(sr(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(a=-1,l=n.length-1;l>=0;l--)if(n[l]===r||n[l].listener===r){u=n[l].listener,a=l;break}if(a<0)return this;a===0?n.shift():Lo(n,a),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||r)}return this},X.prototype.off=X.prototype.removeListener,X.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var a=Object.keys(n),l;for(i=0;i<a.length;++i)l=a[i],l!=="removeListener"&&this.removeAllListeners(l);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function ai(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?$o(i):ui(i,i.length)}X.prototype.listeners=function(e){return ai(this,e,!0)},X.prototype.rawListeners=function(e){return ai(this,e,!1)},X.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):li.call(t,e)},X.prototype.listenerCount=li;function li(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}X.prototype.eventNames=function(){return this._eventsCount>0?ir(this._events):[]};function ui(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Lo(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function $o(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Bo(t,e){return new Promise(function(r,n){function i(l){t.removeListener(e,a),n(l)}function a(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}fi(t,e,a,{once:!0}),e!=="error"&&Fo(t,i,{once:!0})})}function Fo(t,e,r){typeof t.on=="function"&&fi(t,"error",e,r)}function fi(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(a){n.once&&t.removeEventListener(e,i),r(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var or=Br.exports;(function(t){const e=Fe,{format:r,inspect:n}=Xn,{codes:{ERR_INVALID_ARG_TYPE:i}}=xe,{kResistStopPropagation:a,AggregateError:l,SymbolDispose:u}=oe,p=globalThis.AbortSignal||Ot().AbortSignal,_=globalThis.AbortController||Ot().AbortController,y=Object.getPrototypeOf(async function(){}).constructor,x=globalThis.Blob||e.Blob,I=typeof x<"u"?function(A){return A instanceof x}:function(A){return!1},S=(w,A)=>{if(w!==void 0&&(w===null||typeof w!="object"||!("aborted"in w)))throw new i(A,"AbortSignal",w)},R=(w,A)=>{if(typeof w!="function")throw new i(A,"Function",w)};t.exports={AggregateError:l,kEmptyObject:Object.freeze({}),once(w){let A=!1;return function(...$){A||(A=!0,w.apply(this,$))}},createDeferredPromise:function(){let w,A;return{promise:new Promise((B,T)=>{w=B,A=T}),resolve:w,reject:A}},promisify(w){return new Promise((A,$)=>{w((B,...T)=>B?$(B):A(...T))})},debuglog(){return function(){}},format:r,inspect:n,types:{isAsyncFunction(w){return w instanceof y},isArrayBufferView(w){return ArrayBuffer.isView(w)}},isBlob:I,deprecate(w,A){return w},addAbortListener:or.addAbortListener||function(A,$){if(A===void 0)throw new i("signal","AbortSignal",A);S(A,"signal"),R($,"listener");let B;return A.aborted?queueMicrotask(()=>$()):(A.addEventListener("abort",$,{__proto__:null,once:!0,[a]:!0}),B=()=>{A.removeEventListener("abort",$)}),{__proto__:null,[u](){var T;(T=B)===null||T===void 0||T()}}},AbortSignalAny:p.any||function(A){if(A.length===1)return A[0];const $=new _,B=()=>$.abort();return A.forEach(T=>{S(T,"signals"),T.addEventListener("abort",B,{once:!0})}),$.signal.addEventListener("abort",()=>{A.forEach(T=>T.removeEventListener("abort",B))},{once:!0}),$.signal}},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(Yn);var Se=Yn.exports,Fr={};const{ArrayIsArray:ci,ArrayPrototypeIncludes:ko,ArrayPrototypeJoin:Co,ArrayPrototypeMap:Oo,NumberIsInteger:kr,NumberMAX_SAFE_INTEGER:Mo,NumberMIN_SAFE_INTEGER:Do,ObjectPrototypeHasOwnProperty:Uo,String:Wo}=oe,{hideStackFrames:Ne,codes:{ERR_INVALID_ARG_TYPE:Pe,ERR_INVALID_ARG_VALUE:di,ERR_OUT_OF_RANGE:It}}=xe,{normalizeEncoding:Xu}=Se,{isAsyncFunction:Go,isArrayBufferView:zo}=Se.types,qo=Ne((t,e,r=Do,n=Mo)=>{if(typeof t!="number")throw new Pe(e,"number",t);if(!kr(t))throw new It(e,"an integer",t);if(t<r||t>n)throw new It(e,`>= ${r} && <= ${n}`,t)});Ne((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Pe(e,"number",t);if(!kr(t))throw new It(e,"an integer",t);if(t<r||t>n)throw new It(e,`>= ${r} && <= ${n}`,t)}),Ne((t,e,r=!1)=>{if(typeof t!="number")throw new Pe(e,"number",t);if(!kr(t))throw new It(e,"an integer",t);const n=r?1:0,i=4294967295;if(t<n||t>i)throw new It(e,`>= ${n} && <= ${i}`,t)}),Ne((t,e,r)=>{if(!ko(r,t)){const i="must be one of: "+Co(Oo(r,a=>typeof a=="string"?`'${a}'`:Wo(a)),", ");throw new di(e,t,i)}});function Ho(t,e){if(typeof t!="boolean")throw new Pe(e,"boolean",t)}function Cr(t,e,r){return t==null||!Uo(t,e)?r:t[e]}const Qo=Ne((t,e,r=null)=>{const n=Cr(r,"allowArray",!1),i=Cr(r,"allowFunction",!1);if(!Cr(r,"nullable",!1)&&t===null||!n&&ci(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new Pe(e,"Object",t)});Ne((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Pe(e,"a dictionary",t)}),Ne((t,e,r=0)=>{if(!ci(t))throw new Pe(e,"Array",t);if(t.length<r){const n=`must be longer than ${r}`;throw new di(e,t,n)}}),Ne((t,e="buffer")=>{if(!zo(t))throw new Pe(e,["Buffer","TypedArray","DataView"],t)});const Vo=Ne((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Pe(e,"AbortSignal",t)}),Ko=Ne((t,e)=>{if(typeof t!="function")throw new Pe(e,"Function",t)});Ne((t,e)=>{if(typeof t!="function"||Go(t))throw new Pe(e,"Function",t)}),Ne((t,e)=>{if(t!==void 0)throw new Pe(e,"undefined",t)});var Mt={validateBoolean:Ho,validateFunction:Ko,validateInteger:qo,validateObject:Qo,validateAbortSignal:Vo},Or={exports:{}},hi={exports:{}},he=hi.exports={},Ce,Oe;function Mr(){throw new Error("setTimeout has not been defined")}function Dr(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Ce=setTimeout:Ce=Mr}catch{Ce=Mr}try{typeof clearTimeout=="function"?Oe=clearTimeout:Oe=Dr}catch{Oe=Dr}})();function pi(t){if(Ce===setTimeout)return setTimeout(t,0);if((Ce===Mr||!Ce)&&setTimeout)return Ce=setTimeout,setTimeout(t,0);try{return Ce(t,0)}catch{try{return Ce.call(null,t,0)}catch{return Ce.call(this,t,0)}}}function Yo(t){if(Oe===clearTimeout)return clearTimeout(t);if((Oe===Dr||!Oe)&&clearTimeout)return Oe=clearTimeout,clearTimeout(t);try{return Oe(t)}catch{try{return Oe.call(null,t)}catch{return Oe.call(this,t)}}}var ze=[],Rt=!1,lt,ar=-1;function Xo(){!Rt||!lt||(Rt=!1,lt.length?ze=lt.concat(ze):ar=-1,ze.length&&_i())}function _i(){if(!Rt){var t=pi(Xo);Rt=!0;for(var e=ze.length;e;){for(lt=ze,ze=[];++ar<e;)lt&<[ar].run();ar=-1,e=ze.length}lt=null,Rt=!1,Yo(t)}}he.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];ze.push(new bi(t,e)),ze.length===1&&!Rt&&pi(_i)};function bi(t,e){this.fun=t,this.array=e}bi.prototype.run=function(){this.fun.apply(null,this.array)},he.title="browser",he.browser=!0,he.env={},he.argv=[],he.version="",he.versions={};function qe(){}he.on=qe,he.addListener=qe,he.once=qe,he.off=qe,he.removeListener=qe,he.removeAllListeners=qe,he.emit=qe,he.prependListener=qe,he.prependOnceListener=qe,he.listeners=function(t){return[]},he.binding=function(t){throw new Error("process.binding is not supported")},he.cwd=function(){return"/"},he.chdir=function(t){throw new Error("process.chdir is not supported")},he.umask=function(){return 0};var ut=hi.exports;const{SymbolAsyncIterator:yi,SymbolIterator:gi,SymbolFor:ft}=oe,wi=ft("nodejs.stream.destroyed"),Zo=ft("nodejs.stream.errored"),mi=ft("nodejs.stream.readable"),xi=ft("nodejs.stream.writable"),Jo=ft("nodejs.stream.disturbed"),ea=ft("nodejs.webstream.isClosedPromise"),ta=ft("nodejs.webstream.controllerErrorFunction");function Ur(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function lr(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function ra(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Me(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Ei(t){return!!(t&&!Me(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Si(t){return!!(t&&!Me(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Ii(t){return!!(t&&!Me(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function na(t){return Ei(t)||Si(t)||Ii(t)}function ia(t,e){return t==null?!1:e===!0?typeof t[yi]=="function":e===!1?typeof t[gi]=="function":typeof t[yi]=="function"||typeof t[gi]=="function"}function ur(t){if(!Me(t))return null;const e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[wi]||n!=null&&n.destroyed)}function sa(t){if(!lr(t))return null;if(t.writableEnded===!0)return!0;const e=t._writableState;return e!=null&&e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function oa(t,e){if(!lr(t))return null;if(t.writableFinished===!0)return!0;const r=t._writableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.finished)!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Ri(t,e){if(!Ur(t))return null;const r=t._readableState;return r!=null&&r.errored?!1:typeof(r==null?void 0:r.endEmitted)!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Ai(t){return t&&t[mi]!=null?t[mi]:typeof(t==null?void 0:t.readable)!="boolean"?null:ur(t)?!1:Ur(t)&&t.readable&&!Ri(t)}function Ti(t){return t&&t[xi]!=null?t[xi]:typeof(t==null?void 0:t.writable)!="boolean"?null:ur(t)?!1:lr(t)&&t.writable&&!sa(t)}function aa(t,e){return Me(t)?ur(t)?!0:!((e==null?void 0:e.readable)!==!1&&Ai(t)||(e==null?void 0:e.writable)!==!1&&Ti(t)):null}function la(t){var e,r;return Me(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function ua(t){var e,r;return Me(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function fa(t){if(!Me(t))return null;if(typeof t.closed=="boolean")return t.closed;const e=t._writableState,r=t._readableState;return typeof(e==null?void 0:e.closed)=="boolean"||typeof(r==null?void 0:r.closed)=="boolean"?(e==null?void 0:e.closed)||(r==null?void 0:r.closed):typeof t._closed=="boolean"&&vi(t)?t._closed:null}function vi(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function ca(t){return typeof t._sent100=="boolean"&&vi(t)}function da(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function ha(t){if(!Me(t))return null;const e=t._writableState,r=t._readableState,n=e||r;return!n&&ca(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function pa(t){var e;return!!(t&&((e=t[Jo])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function _a(t){var e,r,n,i,a,l,u,p,_,y;return!!(t&&((e=(r=(n=(i=(a=(l=t[Zo])!==null&&l!==void 0?l:t.readableErrored)!==null&&a!==void 0?a:t.writableErrored)!==null&&i!==void 0?i:(u=t._readableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&n!==void 0?n:(p=t._writableState)===null||p===void 0?void 0:p.errorEmitted)!==null&&r!==void 0?r:(_=t._readableState)===null||_===void 0?void 0:_.errored)!==null&&e!==void 0?e:!((y=t._writableState)===null||y===void 0)&&y.errored))}var He={isDestroyed:ur,kIsDestroyed:wi,isDisturbed:pa,isErrored:_a,isReadable:Ai,kIsClosedPromise:ea,kControllerErrorFunction:ta,isClosed:fa,isDuplexNodeStream:ra,isFinished:aa,isIterable:ia,isReadableNodeStream:Ur,isReadableStream:Ei,isReadableFinished:Ri,isReadableErrored:ua,isNodeStream:Me,isWebStream:na,isWritable:Ti,isWritableNodeStream:lr,isWritableStream:Si,isWritableFinished:oa,isWritableErrored:la,isServerRequest:da,willEmitClose:ha,isTransformStream:Ii};const Ze=ut,{AbortError:Ni,codes:ba}=xe,{ERR_INVALID_ARG_TYPE:ya,ERR_STREAM_PREMATURE_CLOSE:Pi}=ba,{kEmptyObject:Wr,once:Gr}=Se,{validateAbortSignal:ga,validateFunction:wa,validateObject:ma,validateBoolean:xa}=Mt,{Promise:Ea,PromisePrototypeThen:Sa,SymbolDispose:ji}=oe,{isClosed:Ia,isReadable:Li,isReadableNodeStream:zr,isReadableStream:Ra,isReadableFinished:$i,isReadableErrored:Bi,isWritable:Fi,isWritableNodeStream:ki,isWritableStream:Aa,isWritableFinished:Ci,isWritableErrored:Oi,isNodeStream:Ta,willEmitClose:va,kIsClosedPromise:Na}=He;let At;function Pa(t){return t.setHeader&&typeof t.abort=="function"}const qr=()=>{};function Mi(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Wr):e==null?e=Wr:ma(e,"options"),wa(r,"callback"),ga(e.signal,"options.signal"),r=Gr(r),Ra(t)||Aa(t))return ja(t,e,r);if(!Ta(t))throw new ya("stream",["ReadableStream","WritableStream","Stream"],t);const a=(n=e.readable)!==null&&n!==void 0?n:zr(t),l=(i=e.writable)!==null&&i!==void 0?i:ki(t),u=t._writableState,p=t._readableState,_=()=>{t.writable||I()};let y=va(t)&&zr(t)===a&&ki(t)===l,x=Ci(t,!1);const I=()=>{x=!0,t.destroyed&&(y=!1),!(y&&(!t.readable||a))&&(!a||S)&&r.call(t)};let S=$i(t,!1);const R=()=>{S=!0,t.destroyed&&(y=!1),!(y&&(!t.writable||l))&&(!l||x)&&r.call(t)},w=U=>{r.call(t,U)};let A=Ia(t);const $=()=>{A=!0;const U=Oi(t)||Bi(t);if(U&&typeof U!="boolean")return r.call(t,U);if(a&&!S&&zr(t,!0)&&!$i(t,!1))return r.call(t,new Pi);if(l&&!x&&!Ci(t,!1))return r.call(t,new Pi);r.call(t)},B=()=>{A=!0;const U=Oi(t)||Bi(t);if(U&&typeof U!="boolean")return r.call(t,U);r.call(t)},T=()=>{t.req.on("finish",I)};Pa(t)?(t.on("complete",I),y||t.on("abort",$),t.req?T():t.on("request",T)):l&&!u&&(t.on("end",_),t.on("close",_)),!y&&typeof t.aborted=="boolean"&&t.on("aborted",$),t.on("end",R),t.on("finish",I),e.error!==!1&&t.on("error",w),t.on("close",$),A?Ze.nextTick($):u!=null&&u.errorEmitted||p!=null&&p.errorEmitted?y||Ze.nextTick(B):(!a&&(!y||Li(t))&&(x||Fi(t)===!1)||!l&&(!y||Fi(t))&&(S||Li(t)===!1)||p&&t.req&&t.aborted)&&Ze.nextTick(B);const q=()=>{r=qr,t.removeListener("aborted",$),t.removeListener("complete",I),t.removeListener("abort",$),t.removeListener("request",T),t.req&&t.req.removeListener("finish",I),t.removeListener("end",_),t.removeListener("close",_),t.removeListener("finish",I),t.removeListener("end",R),t.removeListener("error",w),t.removeListener("close",$)};if(e.signal&&!A){const U=()=>{const ae=r;q(),ae.call(t,new Ni(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Ze.nextTick(U);else{At=At||Se.addAbortListener;const ae=At(e.signal,U),Ee=r;r=Gr((...ee)=>{ae[ji](),Ee.apply(t,ee)})}}return q}function ja(t,e,r){let n=!1,i=qr;if(e.signal)if(i=()=>{n=!0,r.call(t,new Ni(void 0,{cause:e.signal.reason}))},e.signal.aborted)Ze.nextTick(i);else{At=At||Se.addAbortListener;const l=At(e.signal,i),u=r;r=Gr((...p)=>{l[ji](),u.apply(t,p)})}const a=(...l)=>{n||Ze.nextTick(()=>r.apply(t,l))};return Sa(t[Na].promise,a,a),qr}function La(t,e){var r;let n=!1;return e===null&&(e=Wr),(r=e)!==null&&r!==void 0&&r.cleanup&&(xa(e.cleanup,"cleanup"),n=e.cleanup),new Ea((i,a)=>{const l=Mi(t,e,u=>{n&&l(),u?a(u):i()})})}Or.exports=Mi,Or.exports.finished=La;var Je=Or.exports;const De=ut,{aggregateTwoErrors:$a,codes:{ERR_MULTIPLE_CALLBACK:Ba},AbortError:Fa}=xe,{Symbol:Di}=oe,{kIsDestroyed:ka,isDestroyed:Ca,isFinished:Oa,isServerRequest:Ma}=He,Ui=Di("kDestroy"),Hr=Di("kConstruct");function Wi(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Da(t,e){const r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(Wi(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Gi(this,t,e):this.once(Ui,function(a){Gi(this,$a(a,t),e)}),this)}function Gi(t,e,r){let n=!1;function i(a){if(n)return;n=!0;const l=t._readableState,u=t._writableState;Wi(a,u,l),u&&(u.closed=!0),l&&(l.closed=!0),typeof r=="function"&&r(a),a?De.nextTick(Ua,t,a):De.nextTick(zi,t)}try{t._destroy(e||null,i)}catch(a){i(a)}}function Ua(t,e){Qr(t,e),zi(t)}function zi(t){const e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function Qr(t,e){const r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Wa(){const t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function Vr(t,e,r){const n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?De.nextTick(Qr,t,e):Qr(t,e))}function Ga(t,e){if(typeof t._construct!="function")return;const r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(Hr,e),!(t.listenerCount(Hr)>1)&&De.nextTick(za,t)}function za(t){let e=!1;function r(n){if(e){Vr(t,n??new Ba);return}e=!0;const i=t._readableState,a=t._writableState,l=a||i;i&&(i.constructed=!0),a&&(a.constructed=!0),l.destroyed?t.emit(Ui,n):n?Vr(t,n,!0):De.nextTick(qa,t)}try{t._construct(n=>{De.nextTick(r,n)})}catch(n){De.nextTick(r,n)}}function qa(t){t.emit(Hr)}function qi(t){return(t==null?void 0:t.setHeader)&&typeof t.abort=="function"}function Hi(t){t.emit("close")}function Ha(t,e){t.emit("error",e),De.nextTick(Hi,t)}function Qa(t,e){!t||Ca(t)||(!e&&!Oa(t)&&(e=new Fa),Ma(t)?(t.socket=null,t.destroy(e)):qi(t)?t.abort():qi(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?De.nextTick(Ha,t,e):De.nextTick(Hi,t),t.destroyed||(t[ka]=!0))}var Tt={construct:Ga,destroyer:Qa,destroy:Da,undestroy:Wa,errorOrDestroy:Vr};const{ArrayIsArray:Va,ObjectSetPrototypeOf:Qi}=oe,{EventEmitter:fr}=or;function cr(t){fr.call(this,t)}Qi(cr.prototype,fr.prototype),Qi(cr,fr),cr.prototype.pipe=function(t,e){const r=this;function n(y){t.writable&&t.write(y)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",l),r.on("close",u));let a=!1;function l(){a||(a=!0,t.end())}function u(){a||(a=!0,typeof t.destroy=="function"&&t.destroy())}function p(y){_(),fr.listenerCount(this,"error")===0&&this.emit("error",y)}Kr(r,"error",p),Kr(t,"error",p);function _(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",l),r.removeListener("close",u),r.removeListener("error",p),t.removeListener("error",p),r.removeListener("end",_),r.removeListener("close",_),t.removeListener("close",_)}return r.on("end",_),r.on("close",_),t.on("close",_),t.emit("pipe",r),t};function Kr(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Va(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}var Yr={Stream:cr,prependListener:Kr},Vi={exports:{}};(function(t){const{SymbolDispose:e}=oe,{AbortError:r,codes:n}=xe,{isNodeStream:i,isWebStream:a,kControllerErrorFunction:l}=He,u=Je,{ERR_INVALID_ARG_TYPE:p}=n;let _;const y=(x,I)=>{if(typeof x!="object"||!("aborted"in x))throw new p(I,"AbortSignal",x)};t.exports.addAbortSignal=function(I,S){if(y(I,"signal"),!i(S)&&!a(S))throw new p("stream",["ReadableStream","WritableStream","Stream"],S);return t.exports.addAbortSignalNoValidate(I,S)},t.exports.addAbortSignalNoValidate=function(x,I){if(typeof x!="object"||!("aborted"in x))return I;const S=i(I)?()=>{I.destroy(new r(void 0,{cause:x.reason}))}:()=>{I[l](new r(void 0,{cause:x.reason}))};if(x.aborted)S();else{_=_||Se.addAbortListener;const R=_(x,S);u(I,R[e])}return I}})(Vi);var dr=Vi.exports;const{StringPrototypeSlice:Ki,SymbolIterator:Ka,TypedArrayPrototypeSet:hr,Uint8Array:Ya}=oe,{Buffer:Xr}=Fe,{inspect:Xa}=Se;var Za=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){const r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){const r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;const e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return Xr.alloc(0);const r=Xr.allocUnsafe(e>>>0);let n=this.head,i=0;for(;n;)hr(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){const n=this.head.data;if(e<n.length){const i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Ka](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{const a=n.data;if(e>a.length)r+=a,e-=a.length;else{e===a.length?(r+=a,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=Ki(a,0,e),this.head=n,n.data=Ki(a,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){const r=Xr.allocUnsafe(e),n=e;let i=this.head,a=0;do{const l=i.data;if(e>l.length)hr(r,l,n-e),e-=l.length;else{e===l.length?(hr(r,l,n-e),++a,i.next?this.head=i.next:this.head=this.tail=null):(hr(r,new Ya(l.buffer,l.byteOffset,e),n-e),this.head=i,i.data=l.slice(e));break}++a}while((i=i.next)!==null);return this.length-=a,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return Xa(this,{...r,depth:0,customInspect:!1})}};const{MathFloor:Ja,NumberIsInteger:el}=oe,{validateInteger:tl}=Mt,{ERR_INVALID_ARG_VALUE:rl}=xe.codes;let Yi=16*1024,Xi=16;function nl(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Zi(t){return t?Xi:Yi}function il(t,e){tl(e,"value",0),t?Xi=e:Yi=e}function sl(t,e,r,n){const i=nl(e,n,r);if(i!=null){if(!el(i)||i<0){const a=n?`options.${r}`:"options.highWaterMark";throw new rl(a,i)}return Ja(i)}return Zi(t.objectMode)}var pr={getHighWaterMark:sl,getDefaultHighWaterMark:Zi,setDefaultHighWaterMark:il},Ji={},Zr={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(t,e){var r=Fe,n=r.Buffer;function i(l,u){for(var p in l)u[p]=l[p]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=a);function a(l,u,p){return n(l,u,p)}a.prototype=Object.create(n.prototype),i(n,a),a.from=function(l,u,p){if(typeof l=="number")throw new TypeError("Argument must not be a number");return n(l,u,p)},a.alloc=function(l,u,p){if(typeof l!="number")throw new TypeError("Argument must be a number");var _=n(l);return u!==void 0?typeof p=="string"?_.fill(u,p):_.fill(u):_.fill(0),_},a.allocUnsafe=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return n(l)},a.allocUnsafeSlow=function(l){if(typeof l!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(l)}})(Zr,Zr.exports);var ol=Zr.exports,Jr=ol.Buffer,es=Jr.isEncoding||function(t){switch(t=""+t,t&&t.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 al(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function ll(t){var e=al(t);if(typeof e!="string"&&(Jr.isEncoding===es||!es(t)))throw new Error("Unknown encoding: "+t);return e||t}Ji.StringDecoder=Dt;function Dt(t){this.encoding=ll(t);var e;switch(this.encoding){case"utf16le":this.text=pl,this.end=_l,e=4;break;case"utf8":this.fillLast=cl,e=4;break;case"base64":this.text=bl,this.end=yl,e=3;break;default:this.write=gl,this.end=wl;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Jr.allocUnsafe(e)}Dt.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""},Dt.prototype.end=hl,Dt.prototype.text=dl,Dt.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function en(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function ul(t,e,r){var n=e.length-1;if(n<r)return 0;var i=en(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=en(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=en(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function fl(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"�"}}function cl(t){var e=this.lastTotal-this.lastNeed,r=fl(this,t);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function dl(t,e){var r=ul(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function hl(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e}function pl(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function _l(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function bl(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function yl(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function gl(t){return t.toString(this.encoding)}function wl(t){return t&&t.length?this.write(t):""}const ts=ut,{PromisePrototypeThen:ml,SymbolAsyncIterator:rs,SymbolIterator:ns}=oe,{Buffer:xl}=Fe,{ERR_INVALID_ARG_TYPE:El,ERR_STREAM_NULL_VALUES:Sl}=xe.codes;function Il(t,e,r){let n;if(typeof e=="string"||e instanceof xl)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[rs])i=!0,n=e[rs]();else if(e&&e[ns])i=!1,n=e[ns]();else throw new El("iterable",["Iterable"],e);const a=new t({objectMode:!0,highWaterMark:1,...r});let l=!1;a._read=function(){l||(l=!0,p())},a._destroy=function(_,y){ml(u(_),()=>ts.nextTick(y,_),x=>ts.nextTick(y,x||_))};async function u(_){const y=_!=null,x=typeof n.throw=="function";if(y&&x){const{value:I,done:S}=await n.throw(_);if(await I,S)return}if(typeof n.return=="function"){const{value:I}=await n.return();await I}}async function p(){for(;;){try{const{value:_,done:y}=i?await n.next():n.next();if(y)a.push(null);else{const x=_&&typeof _.then=="function"?await _:_;if(x===null)throw l=!1,new Sl;if(a.push(x))continue;l=!1}}catch(_){a.destroy(_)}break}}return a}var is=Il,tn,ss;function _r(){if(ss)return tn;ss=1;const t=ut,{ArrayPrototypeIndexOf:e,NumberIsInteger:r,NumberIsNaN:n,NumberParseInt:i,ObjectDefineProperties:a,ObjectKeys:l,ObjectSetPrototypeOf:u,Promise:p,SafeSet:_,SymbolAsyncDispose:y,SymbolAsyncIterator:x,Symbol:I}=oe;tn=O,O.ReadableState=Re;const{EventEmitter:S}=or,{Stream:R,prependListener:w}=Yr,{Buffer:A}=Fe,{addAbortSignal:$}=dr,B=Je;let T=Se.debuglog("stream",c=>{T=c});const q=Za,U=Tt,{getHighWaterMark:ae,getDefaultHighWaterMark:Ee}=pr,{aggregateTwoErrors:ee,codes:{ERR_INVALID_ARG_TYPE:le,ERR_METHOD_NOT_IMPLEMENTED:ge,ERR_OUT_OF_RANGE:we,ERR_STREAM_PUSH_AFTER_EOF:Q,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:P},AbortError:K}=xe,{validateObject:G}=Mt,H=I("kPaused"),{StringDecoder:ue}=Ji,fe=is;u(O.prototype,R.prototype),u(O,R);const re=()=>{},{errorOrDestroy:ce}=U,D=1,ne=2,M=4,_e=8,Te=16,tt=32,Ke=64,je=128,Ye=256,Pt=512,_t=1024,rt=2048,g=4096,m=8192,N=16384,C=32768,F=65536,Z=1<<17,te=1<<18;function Y(c){return{enumerable:!1,get(){return(this.state&c)!==0},set(h){h?this.state|=c:this.state&=~c}}}a(Re.prototype,{objectMode:Y(D),ended:Y(ne),endEmitted:Y(M),reading:Y(_e),constructed:Y(Te),sync:Y(tt),needReadable:Y(Ke),emittedReadable:Y(je),readableListening:Y(Ye),resumeScheduled:Y(Pt),errorEmitted:Y(_t),emitClose:Y(rt),autoDestroy:Y(g),destroyed:Y(m),closed:Y(N),closeEmitted:Y(C),multiAwaitDrain:Y(F),readingMore:Y(Z),dataEmitted:Y(te)});function Re(c,h,j){typeof j!="boolean"&&(j=h instanceof Qe()),this.state=rt|g|Te|tt,c&&c.objectMode&&(this.state|=D),j&&c&&c.readableObjectMode&&(this.state|=D),this.highWaterMark=c?ae(this,c,"readableHighWaterMark",j):Ee(!1),this.buffer=new q,this.length=0,this.pipes=[],this.flowing=null,this[H]=null,c&&c.emitClose===!1&&(this.state&=-2049),c&&c.autoDestroy===!1&&(this.state&=-4097),this.errored=null,this.defaultEncoding=c&&c.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,c&&c.encoding&&(this.decoder=new ue(c.encoding),this.encoding=c.encoding)}function O(c){if(!(this instanceof O))return new O(c);const h=this instanceof Qe();this._readableState=new Re(c,this,h),c&&(typeof c.read=="function"&&(this._read=c.read),typeof c.destroy=="function"&&(this._destroy=c.destroy),typeof c.construct=="function"&&(this._construct=c.construct),c.signal&&!h&&$(c.signal,this)),R.call(this,c),U.construct(this,()=>{this._readableState.needReadable&&b(this,this._readableState)})}O.prototype.destroy=U.destroy,O.prototype._undestroy=U.undestroy,O.prototype._destroy=function(c,h){h(c)},O.prototype[S.captureRejectionSymbol]=function(c){this.destroy(c)},O.prototype[y]=function(){let c;return this.destroyed||(c=this.readableEnded?null:new K,this.destroy(c)),new p((h,j)=>B(this,L=>L&&L!==c?j(L):h(null)))},O.prototype.push=function(c,h){return Le(this,c,h,!1)},O.prototype.unshift=function(c,h){return Le(this,c,h,!0)};function Le(c,h,j,L){T("readableAddChunk",h);const k=c._readableState;let me;if((k.state&D)===0&&(typeof h=="string"?(j=j||k.defaultEncoding,k.encoding!==j&&(L&&k.encoding?h=A.from(h,j).toString(k.encoding):(h=A.from(h,j),j=""))):h instanceof A?j="":R._isUint8Array(h)?(h=R._uint8ArrayToBuffer(h),j=""):h!=null&&(me=new le("chunk",["string","Buffer","Uint8Array"],h))),me)ce(c,me);else if(h===null)k.state&=-9,s(c,k);else if((k.state&D)!==0||h&&h.length>0)if(L)if((k.state&M)!==0)ce(c,new P);else{if(k.destroyed||k.errored)return!1;Kt(c,k,h,!0)}else if(k.ended)ce(c,new Q);else{if(k.destroyed||k.errored)return!1;k.state&=-9,k.decoder&&!j?(h=k.decoder.write(h),k.objectMode||h.length!==0?Kt(c,k,h,!1):b(c,k)):Kt(c,k,h,!1)}else L||(k.state&=-9,b(c,k));return!k.ended&&(k.length<k.highWaterMark||k.length===0)}function Kt(c,h,j,L){h.flowing&&h.length===0&&!h.sync&&c.listenerCount("data")>0?((h.state&F)!==0?h.awaitDrainWriters.clear():h.awaitDrainWriters=null,h.dataEmitted=!0,c.emit("data",j)):(h.length+=h.objectMode?1:j.length,L?h.buffer.unshift(j):h.buffer.push(j),(h.state&Ke)!==0&&o(c)),b(c,h)}O.prototype.isPaused=function(){const c=this._readableState;return c[H]===!0||c.flowing===!1},O.prototype.setEncoding=function(c){const h=new ue(c);this._readableState.decoder=h,this._readableState.encoding=this._readableState.decoder.encoding;const j=this._readableState.buffer;let L="";for(const k of j)L+=h.write(k);return j.clear(),L!==""&&j.push(L),this._readableState.length=L.length,this};const Ge=1073741824;function Rn(c){if(c>Ge)throw new we("size","<= 1GiB",c);return c--,c|=c>>>1,c|=c>>>2,c|=c>>>4,c|=c>>>8,c|=c>>>16,c++,c}function f(c,h){return c<=0||h.length===0&&h.ended?0:(h.state&D)!==0?1:n(c)?h.flowing&&h.length?h.buffer.first().length:h.length:c<=h.length?c:h.ended?h.length:0}O.prototype.read=function(c){T("read",c),c===void 0?c=NaN:r(c)||(c=i(c,10));const h=this._readableState,j=c;if(c>h.highWaterMark&&(h.highWaterMark=Rn(c)),c!==0&&(h.state&=-129),c===0&&h.needReadable&&((h.highWaterMark!==0?h.length>=h.highWaterMark:h.length>0)||h.ended))return T("read: emitReadable",h.length,h.ended),h.length===0&&h.ended?An(this):o(this),null;if(c=f(c,h),c===0&&h.ended)return h.length===0&&An(this),null;let L=(h.state&Ke)!==0;if(T("need readable",L),(h.length===0||h.length-c<h.highWaterMark)&&(L=!0,T("length less than watermark",L)),h.ended||h.reading||h.destroyed||h.errored||!h.constructed)L=!1,T("reading, ended or constructing",L);else if(L){T("do read"),h.state|=_e|tt,h.length===0&&(h.state|=Ke);try{this._read(h.highWaterMark)}catch(me){ce(this,me)}h.state&=-33,h.reading||(c=f(j,h))}let k;return c>0?k=Gs(c,h):k=null,k===null?(h.needReadable=h.length<=h.highWaterMark,c=0):(h.length-=c,h.multiAwaitDrain?h.awaitDrainWriters.clear():h.awaitDrainWriters=null),h.length===0&&(h.ended||(h.needReadable=!0),j!==c&&h.ended&&An(this)),k!==null&&!h.errorEmitted&&!h.closeEmitted&&(h.dataEmitted=!0,this.emit("data",k)),k};function s(c,h){if(T("onEofChunk"),!h.ended){if(h.decoder){const j=h.decoder.end();j&&j.length&&(h.buffer.push(j),h.length+=h.objectMode?1:j.length)}h.ended=!0,h.sync?o(c):(h.needReadable=!1,h.emittedReadable=!0,d(c))}}function o(c){const h=c._readableState;T("emitReadable",h.needReadable,h.emittedReadable),h.needReadable=!1,h.emittedReadable||(T("emitReadable",h.flowing),h.emittedReadable=!0,t.nextTick(d,c))}function d(c){const h=c._readableState;T("emitReadable_",h.destroyed,h.length,h.ended),!h.destroyed&&!h.errored&&(h.length||h.ended)&&(c.emit("readable"),h.emittedReadable=!1),h.needReadable=!h.flowing&&!h.ended&&h.length<=h.highWaterMark,V(c)}function b(c,h){!h.readingMore&&h.constructed&&(h.readingMore=!0,t.nextTick(E,c,h))}function E(c,h){for(;!h.reading&&!h.ended&&(h.length<h.highWaterMark||h.flowing&&h.length===0);){const j=h.length;if(T("maybeReadMore read 0"),c.read(0),j===h.length)break}h.readingMore=!1}O.prototype._read=function(c){throw new ge("_read()")},O.prototype.pipe=function(c,h){const j=this,L=this._readableState;L.pipes.length===1&&(L.multiAwaitDrain||(L.multiAwaitDrain=!0,L.awaitDrainWriters=new _(L.awaitDrainWriters?[L.awaitDrainWriters]:[]))),L.pipes.push(c),T("pipe count=%d opts=%j",L.pipes.length,h);const me=(!h||h.end!==!1)&&c!==t.stdout&&c!==t.stderr?qs:Yt;L.endEmitted?t.nextTick(me):j.once("end",me),c.on("unpipe",$e);function $e(yt,Xe){T("onunpipe"),yt===j&&Xe&&Xe.hasUnpiped===!1&&(Xe.hasUnpiped=!0,Qu())}function qs(){T("onend"),c.end()}let bt,Hs=!1;function Qu(){T("cleanup"),c.removeListener("close",Nn),c.removeListener("finish",Pn),bt&&c.removeListener("drain",bt),c.removeListener("error",vn),c.removeListener("unpipe",$e),j.removeListener("end",qs),j.removeListener("end",Yt),j.removeListener("data",Vs),Hs=!0,bt&&L.awaitDrainWriters&&(!c._writableState||c._writableState.needDrain)&&bt()}function Qs(){Hs||(L.pipes.length===1&&L.pipes[0]===c?(T("false write response, pause",0),L.awaitDrainWriters=c,L.multiAwaitDrain=!1):L.pipes.length>1&&L.pipes.includes(c)&&(T("false write response, pause",L.awaitDrainWriters.size),L.awaitDrainWriters.add(c)),j.pause()),bt||(bt=v(j,c),c.on("drain",bt))}j.on("data",Vs);function Vs(yt){T("ondata");const Xe=c.write(yt);T("dest.write",Xe),Xe===!1&&Qs()}function vn(yt){if(T("onerror",yt),Yt(),c.removeListener("error",vn),c.listenerCount("error")===0){const Xe=c._writableState||c._readableState;Xe&&!Xe.errorEmitted?ce(c,yt):c.emit("error",yt)}}w(c,"error",vn);function Nn(){c.removeListener("finish",Pn),Yt()}c.once("close",Nn);function Pn(){T("onfinish"),c.removeListener("close",Nn),Yt()}c.once("finish",Pn);function Yt(){T("unpipe"),j.unpipe(c)}return c.emit("pipe",j),c.writableNeedDrain===!0?Qs():L.flowing||(T("pipe resume"),j.resume()),c};function v(c,h){return function(){const L=c._readableState;L.awaitDrainWriters===h?(T("pipeOnDrain",1),L.awaitDrainWriters=null):L.multiAwaitDrain&&(T("pipeOnDrain",L.awaitDrainWriters.size),L.awaitDrainWriters.delete(h)),(!L.awaitDrainWriters||L.awaitDrainWriters.size===0)&&c.listenerCount("data")&&c.resume()}}O.prototype.unpipe=function(c){const h=this._readableState,j={hasUnpiped:!1};if(h.pipes.length===0)return this;if(!c){const k=h.pipes;h.pipes=[],this.pause();for(let me=0;me<k.length;me++)k[me].emit("unpipe",this,{hasUnpiped:!1});return this}const L=e(h.pipes,c);return L===-1?this:(h.pipes.splice(L,1),h.pipes.length===0&&this.pause(),c.emit("unpipe",this,j),this)},O.prototype.on=function(c,h){const j=R.prototype.on.call(this,c,h),L=this._readableState;return c==="data"?(L.readableListening=this.listenerCount("readable")>0,L.flowing!==!1&&this.resume()):c==="readable"&&!L.endEmitted&&!L.readableListening&&(L.readableListening=L.needReadable=!0,L.flowing=!1,L.emittedReadable=!1,T("on readable",L.length,L.reading),L.length?o(this):L.reading||t.nextTick(ie,this)),j},O.prototype.addListener=O.prototype.on,O.prototype.removeListener=function(c,h){const j=R.prototype.removeListener.call(this,c,h);return c==="readable"&&t.nextTick(W,this),j},O.prototype.off=O.prototype.removeListener,O.prototype.removeAllListeners=function(c){const h=R.prototype.removeAllListeners.apply(this,arguments);return(c==="readable"||c===void 0)&&t.nextTick(W,this),h};function W(c){const h=c._readableState;h.readableListening=c.listenerCount("readable")>0,h.resumeScheduled&&h[H]===!1?h.flowing=!0:c.listenerCount("data")>0?c.resume():h.readableListening||(h.flowing=null)}function ie(c){T("readable nexttick read 0"),c.read(0)}O.prototype.resume=function(){const c=this._readableState;return c.flowing||(T("resume"),c.flowing=!c.readableListening,J(this,c)),c[H]=!1,this};function J(c,h){h.resumeScheduled||(h.resumeScheduled=!0,t.nextTick(se,c,h))}function se(c,h){T("resume",h.reading),h.reading||c.read(0),h.resumeScheduled=!1,c.emit("resume"),V(c),h.flowing&&!h.reading&&c.read(0)}O.prototype.pause=function(){return T("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(T("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[H]=!0,this};function V(c){const h=c._readableState;for(T("flow",h.flowing);h.flowing&&c.read()!==null;);}O.prototype.wrap=function(c){let h=!1;c.on("data",L=>{!this.push(L)&&c.pause&&(h=!0,c.pause())}),c.on("end",()=>{this.push(null)}),c.on("error",L=>{ce(this,L)}),c.on("close",()=>{this.destroy()}),c.on("destroy",()=>{this.destroy()}),this._read=()=>{h&&c.resume&&(h=!1,c.resume())};const j=l(c);for(let L=1;L<j.length;L++){const k=j[L];this[k]===void 0&&typeof c[k]=="function"&&(this[k]=c[k].bind(c))}return this},O.prototype[x]=function(){return Ws(this)},O.prototype.iterator=function(c){return c!==void 0&&G(c,"options"),Ws(this,c)};function Ws(c,h){typeof c.read!="function"&&(c=O.wrap(c,{objectMode:!0}));const j=zu(c,h);return j.stream=c,j}async function*zu(c,h){let j=re;function L($e){this===c?(j(),j=re):j=$e}c.on("readable",L);let k;const me=B(c,{writable:!1},$e=>{k=$e?ee(k,$e):null,j(),j=re});try{for(;;){const $e=c.destroyed?null:c.read();if($e!==null)yield $e;else{if(k)throw k;if(k===null)return;await new p(L)}}}catch($e){throw k=ee(k,$e),k}finally{(k||(h==null?void 0:h.destroyOnReturn)!==!1)&&(k===void 0||c._readableState.autoDestroy)?U.destroyer(c,null):(c.off("readable",L),me())}}a(O.prototype,{readable:{__proto__:null,get(){const c=this._readableState;return!!c&&c.readable!==!1&&!c.destroyed&&!c.errorEmitted&&!c.endEmitted},set(c){this._readableState&&(this._readableState.readable=!!c)}},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(c){this._readableState&&(this._readableState.flowing=c)}},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(c){this._readableState&&(this._readableState.destroyed=c)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),a(Re.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[H]!==!1},set(c){this[H]=!!c}}}),O._fromList=Gs;function Gs(c,h){if(h.length===0)return null;let j;return h.objectMode?j=h.buffer.shift():!c||c>=h.length?(h.decoder?j=h.buffer.join(""):h.buffer.length===1?j=h.buffer.first():j=h.buffer.concat(h.length),h.buffer.clear()):j=h.buffer.consume(c,h.decoder),j}function An(c){const h=c._readableState;T("endReadable",h.endEmitted),h.endEmitted||(h.ended=!0,t.nextTick(qu,h,c))}function qu(c,h){if(T("endReadableNT",c.endEmitted,c.length),!c.errored&&!c.closeEmitted&&!c.endEmitted&&c.length===0){if(c.endEmitted=!0,h.emit("end"),h.writable&&h.allowHalfOpen===!1)t.nextTick(Hu,h);else if(c.autoDestroy){const j=h._writableState;(!j||j.autoDestroy&&(j.finished||j.writable===!1))&&h.destroy()}}}function Hu(c){c.writable&&!c.writableEnded&&!c.destroyed&&c.end()}O.from=function(c,h){return fe(O,c,h)};let Tn;function zs(){return Tn===void 0&&(Tn={}),Tn}return O.fromWeb=function(c,h){return zs().newStreamReadableFromReadableStream(c,h)},O.toWeb=function(c,h){return zs().newReadableStreamFromStreamReadable(c,h)},O.wrap=function(c,h){var j,L;return new O({objectMode:(j=(L=c.readableObjectMode)!==null&&L!==void 0?L:c.objectMode)!==null&&j!==void 0?j:!0,...h,destroy(k,me){U.destroyer(c,k),me(k)}}).wrap(c)},tn}var rn,os;function nn(){if(os)return rn;os=1;const t=ut,{ArrayPrototypeSlice:e,Error:r,FunctionPrototypeSymbolHasInstance:n,ObjectDefineProperty:i,ObjectDefineProperties:a,ObjectSetPrototypeOf:l,StringPrototypeToLowerCase:u,Symbol:p,SymbolHasInstance:_}=oe;rn=G,G.WritableState=P;const{EventEmitter:y}=or,x=Yr.Stream,{Buffer:I}=Fe,S=Tt,{addAbortSignal:R}=dr,{getHighWaterMark:w,getDefaultHighWaterMark:A}=pr,{ERR_INVALID_ARG_TYPE:$,ERR_METHOD_NOT_IMPLEMENTED:B,ERR_MULTIPLE_CALLBACK:T,ERR_STREAM_CANNOT_PIPE:q,ERR_STREAM_DESTROYED:U,ERR_STREAM_ALREADY_FINISHED:ae,ERR_STREAM_NULL_VALUES:Ee,ERR_STREAM_WRITE_AFTER_END:ee,ERR_UNKNOWN_ENCODING:le}=xe.codes,{errorOrDestroy:ge}=S;l(G.prototype,x.prototype),l(G,x);function we(){}const Q=p("kOnFinished");function P(g,m,N){typeof N!="boolean"&&(N=m instanceof Qe()),this.objectMode=!!(g&&g.objectMode),N&&(this.objectMode=this.objectMode||!!(g&&g.writableObjectMode)),this.highWaterMark=g?w(this,g,"writableHighWaterMark",N):A(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const C=!!(g&&g.decodeStrings===!1);this.decodeStrings=!C,this.defaultEncoding=g&&g.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=ce.bind(void 0,m),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,K(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!g||g.emitClose!==!1,this.autoDestroy=!g||g.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Q]=[]}function K(g){g.buffered=[],g.bufferedIndex=0,g.allBuffers=!0,g.allNoop=!0}P.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},i(P.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function G(g){const m=this instanceof Qe();if(!m&&!n(G,this))return new G(g);this._writableState=new P(g,this,m),g&&(typeof g.write=="function"&&(this._write=g.write),typeof g.writev=="function"&&(this._writev=g.writev),typeof g.destroy=="function"&&(this._destroy=g.destroy),typeof g.final=="function"&&(this._final=g.final),typeof g.construct=="function"&&(this._construct=g.construct),g.signal&&R(g.signal,this)),x.call(this,g),S.construct(this,()=>{const N=this._writableState;N.writing||_e(this,N),je(this,N)})}i(G,_,{__proto__:null,value:function(g){return n(this,g)?!0:this!==G?!1:g&&g._writableState instanceof P}}),G.prototype.pipe=function(){ge(this,new q)};function H(g,m,N,C){const F=g._writableState;if(typeof N=="function")C=N,N=F.defaultEncoding;else{if(!N)N=F.defaultEncoding;else if(N!=="buffer"&&!I.isEncoding(N))throw new le(N);typeof C!="function"&&(C=we)}if(m===null)throw new Ee;if(!F.objectMode)if(typeof m=="string")F.decodeStrings!==!1&&(m=I.from(m,N),N="buffer");else if(m instanceof I)N="buffer";else if(x._isUint8Array(m))m=x._uint8ArrayToBuffer(m),N="buffer";else throw new $("chunk",["string","Buffer","Uint8Array"],m);let Z;return F.ending?Z=new ee:F.destroyed&&(Z=new U("write")),Z?(t.nextTick(C,Z),ge(g,Z,!0),Z):(F.pendingcb++,ue(g,F,m,N,C))}G.prototype.write=function(g,m,N){return H(this,g,m,N)===!0},G.prototype.cork=function(){this._writableState.corked++},G.prototype.uncork=function(){const g=this._writableState;g.corked&&(g.corked--,g.writing||_e(this,g))},G.prototype.setDefaultEncoding=function(m){if(typeof m=="string"&&(m=u(m)),!I.isEncoding(m))throw new le(m);return this._writableState.defaultEncoding=m,this};function ue(g,m,N,C,F){const Z=m.objectMode?1:N.length;m.length+=Z;const te=m.length<m.highWaterMark;return te||(m.needDrain=!0),m.writing||m.corked||m.errored||!m.constructed?(m.buffered.push({chunk:N,encoding:C,callback:F}),m.allBuffers&&C!=="buffer"&&(m.allBuffers=!1),m.allNoop&&F!==we&&(m.allNoop=!1)):(m.writelen=Z,m.writecb=F,m.writing=!0,m.sync=!0,g._write(N,C,m.onwrite),m.sync=!1),te&&!m.errored&&!m.destroyed}function fe(g,m,N,C,F,Z,te){m.writelen=C,m.writecb=te,m.writing=!0,m.sync=!0,m.destroyed?m.onwrite(new U("write")):N?g._writev(F,m.onwrite):g._write(F,Z,m.onwrite),m.sync=!1}function re(g,m,N,C){--m.pendingcb,C(N),M(m),ge(g,N)}function ce(g,m){const N=g._writableState,C=N.sync,F=N.writecb;if(typeof F!="function"){ge(g,new T);return}N.writing=!1,N.writecb=null,N.length-=N.writelen,N.writelen=0,m?(m.stack,N.errored||(N.errored=m),g._readableState&&!g._readableState.errored&&(g._readableState.errored=m),C?t.nextTick(re,g,N,m,F):re(g,N,m,F)):(N.buffered.length>N.bufferedIndex&&_e(g,N),C?N.afterWriteTickInfo!==null&&N.afterWriteTickInfo.cb===F?N.afterWriteTickInfo.count++:(N.afterWriteTickInfo={count:1,cb:F,stream:g,state:N},t.nextTick(D,N.afterWriteTickInfo)):ne(g,N,1,F))}function D({stream:g,state:m,count:N,cb:C}){return m.afterWriteTickInfo=null,ne(g,m,N,C)}function ne(g,m,N,C){for(!m.ending&&!g.destroyed&&m.length===0&&m.needDrain&&(m.needDrain=!1,g.emit("drain"));N-- >0;)m.pendingcb--,C();m.destroyed&&M(m),je(g,m)}function M(g){if(g.writing)return;for(let F=g.bufferedIndex;F<g.buffered.length;++F){var m;const{chunk:Z,callback:te}=g.buffered[F],Y=g.objectMode?1:Z.length;g.length-=Y,te((m=g.errored)!==null&&m!==void 0?m:new U("write"))}const N=g[Q].splice(0);for(let F=0;F<N.length;F++){var C;N[F]((C=g.errored)!==null&&C!==void 0?C:new U("end"))}K(g)}function _e(g,m){if(m.corked||m.bufferProcessing||m.destroyed||!m.constructed)return;const{buffered:N,bufferedIndex:C,objectMode:F}=m,Z=N.length-C;if(!Z)return;let te=C;if(m.bufferProcessing=!0,Z>1&&g._writev){m.pendingcb-=Z-1;const Y=m.allNoop?we:O=>{for(let Le=te;Le<N.length;++Le)N[Le].callback(O)},Re=m.allNoop&&te===0?N:e(N,te);Re.allBuffers=m.allBuffers,fe(g,m,!0,m.length,Re,"",Y),K(m)}else{do{const{chunk:Y,encoding:Re,callback:O}=N[te];N[te++]=null;const Le=F?1:Y.length;fe(g,m,!1,Le,Y,Re,O)}while(te<N.length&&!m.writing);te===N.length?K(m):te>256?(N.splice(0,te),m.bufferedIndex=0):m.bufferedIndex=te}m.bufferProcessing=!1}G.prototype._write=function(g,m,N){if(this._writev)this._writev([{chunk:g,encoding:m}],N);else throw new B("_write()")},G.prototype._writev=null,G.prototype.end=function(g,m,N){const C=this._writableState;typeof g=="function"?(N=g,g=null,m=null):typeof m=="function"&&(N=m,m=null);let F;if(g!=null){const Z=H(this,g,m);Z instanceof r&&(F=Z)}return C.corked&&(C.corked=1,this.uncork()),F||(!C.errored&&!C.ending?(C.ending=!0,je(this,C,!0),C.ended=!0):C.finished?F=new ae("end"):C.destroyed&&(F=new U("end"))),typeof N=="function"&&(F||C.finished?t.nextTick(N,F):C[Q].push(N)),this};function Te(g){return g.ending&&!g.destroyed&&g.constructed&&g.length===0&&!g.errored&&g.buffered.length===0&&!g.finished&&!g.writing&&!g.errorEmitted&&!g.closeEmitted}function tt(g,m){let N=!1;function C(F){if(N){ge(g,F??T());return}if(N=!0,m.pendingcb--,F){const Z=m[Q].splice(0);for(let te=0;te<Z.length;te++)Z[te](F);ge(g,F,m.sync)}else Te(m)&&(m.prefinished=!0,g.emit("prefinish"),m.pendingcb++,t.nextTick(Ye,g,m))}m.sync=!0,m.pendingcb++;try{g._final(C)}catch(F){C(F)}m.sync=!1}function Ke(g,m){!m.prefinished&&!m.finalCalled&&(typeof g._final=="function"&&!m.destroyed?(m.finalCalled=!0,tt(g,m)):(m.prefinished=!0,g.emit("prefinish")))}function je(g,m,N){Te(m)&&(Ke(g,m),m.pendingcb===0&&(N?(m.pendingcb++,t.nextTick((C,F)=>{Te(F)?Ye(C,F):F.pendingcb--},g,m)):Te(m)&&(m.pendingcb++,Ye(g,m))))}function Ye(g,m){m.pendingcb--,m.finished=!0;const N=m[Q].splice(0);for(let C=0;C<N.length;C++)N[C]();if(g.emit("finish"),m.autoDestroy){const C=g._readableState;(!C||C.autoDestroy&&(C.endEmitted||C.readable===!1))&&g.destroy()}}a(G.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(g){this._writableState&&(this._writableState.destroyed=g)}},writable:{__proto__:null,get(){const g=this._writableState;return!!g&&g.writable!==!1&&!g.destroyed&&!g.errored&&!g.ending&&!g.ended},set(g){this._writableState&&(this._writableState.writable=!!g)}},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 g=this._writableState;return g?!g.destroyed&&!g.ending&&g.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 Pt=S.destroy;G.prototype.destroy=function(g,m){const N=this._writableState;return!N.destroyed&&(N.bufferedIndex<N.buffered.length||N[Q].length)&&t.nextTick(M,N),Pt.call(this,g,m),this},G.prototype._undestroy=S.undestroy,G.prototype._destroy=function(g,m){m(g)},G.prototype[y.captureRejectionSymbol]=function(g){this.destroy(g)};let _t;function rt(){return _t===void 0&&(_t={}),_t}return G.fromWeb=function(g,m){return rt().newStreamWritableFromWritableStream(g,m)},G.toWeb=function(g){return rt().newWritableStreamFromStreamWritable(g)},rn}var sn,as;function Rl(){if(as)return sn;as=1;const t=ut,e=Fe,{isReadable:r,isWritable:n,isIterable:i,isNodeStream:a,isReadableNodeStream:l,isWritableNodeStream:u,isDuplexNodeStream:p,isReadableStream:_,isWritableStream:y}=He,x=Je,{AbortError:I,codes:{ERR_INVALID_ARG_TYPE:S,ERR_INVALID_RETURN_VALUE:R}}=xe,{destroyer:w}=Tt,A=Qe(),$=_r(),B=nn(),{createDeferredPromise:T}=Se,q=is,U=globalThis.Blob||e.Blob,ae=typeof U<"u"?function(P){return P instanceof U}:function(P){return!1},Ee=globalThis.AbortController||Ot().AbortController,{FunctionPrototypeCall:ee}=oe;class le extends A{constructor(P){super(P),(P==null?void 0:P.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(P==null?void 0:P.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}sn=function Q(P,K){if(p(P))return P;if(l(P))return we({readable:P});if(u(P))return we({writable:P});if(a(P))return we({writable:!1,readable:!1});if(_(P))return we({readable:$.fromWeb(P)});if(y(P))return we({writable:B.fromWeb(P)});if(typeof P=="function"){const{value:H,write:ue,final:fe,destroy:re}=ge(P);if(i(H))return q(le,H,{objectMode:!0,write:ue,final:fe,destroy:re});const ce=H==null?void 0:H.then;if(typeof ce=="function"){let D;const ne=ee(ce,H,M=>{if(M!=null)throw new R("nully","body",M)},M=>{w(D,M)});return D=new le({objectMode:!0,readable:!1,write:ue,final(M){fe(async()=>{try{await ne,t.nextTick(M,null)}catch(_e){t.nextTick(M,_e)}})},destroy:re})}throw new R("Iterable, AsyncIterable or AsyncFunction",K,H)}if(ae(P))return Q(P.arrayBuffer());if(i(P))return q(le,P,{objectMode:!0,writable:!1});if(_(P==null?void 0:P.readable)&&y(P==null?void 0:P.writable))return le.fromWeb(P);if(typeof(P==null?void 0:P.writable)=="object"||typeof(P==null?void 0:P.readable)=="object"){const H=P!=null&&P.readable?l(P==null?void 0:P.readable)?P==null?void 0:P.readable:Q(P.readable):void 0,ue=P!=null&&P.writable?u(P==null?void 0:P.writable)?P==null?void 0:P.writable:Q(P.writable):void 0;return we({readable:H,writable:ue})}const G=P==null?void 0:P.then;if(typeof G=="function"){let H;return ee(G,P,ue=>{ue!=null&&H.push(ue),H.push(null)},ue=>{w(H,ue)}),H=new le({objectMode:!0,writable:!1,read(){}})}throw new S(K,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],P)};function ge(Q){let{promise:P,resolve:K}=T();const G=new Ee,H=G.signal;return{value:Q(async function*(){for(;;){const fe=P;P=null;const{chunk:re,done:ce,cb:D}=await fe;if(t.nextTick(D),ce)return;if(H.aborted)throw new I(void 0,{cause:H.reason});({promise:P,resolve:K}=T()),yield re}}(),{signal:H}),write(fe,re,ce){const D=K;K=null,D({chunk:fe,done:!1,cb:ce})},final(fe){const re=K;K=null,re({done:!0,cb:fe})},destroy(fe,re){G.abort(),re(fe)}}}function we(Q){const P=Q.readable&&typeof Q.readable.read!="function"?$.wrap(Q.readable):Q.readable,K=Q.writable;let G=!!r(P),H=!!n(K),ue,fe,re,ce,D;function ne(M){const _e=ce;ce=null,_e?_e(M):M&&D.destroy(M)}return D=new le({readableObjectMode:!!(P!=null&&P.readableObjectMode),writableObjectMode:!!(K!=null&&K.writableObjectMode),readable:G,writable:H}),H&&(x(K,M=>{H=!1,M&&w(P,M),ne(M)}),D._write=function(M,_e,Te){K.write(M,_e)?Te():ue=Te},D._final=function(M){K.end(),fe=M},K.on("drain",function(){if(ue){const M=ue;ue=null,M()}}),K.on("finish",function(){if(fe){const M=fe;fe=null,M()}})),G&&(x(P,M=>{G=!1,M&&w(P,M),ne(M)}),P.on("readable",function(){if(re){const M=re;re=null,M()}}),P.on("end",function(){D.push(null)}),D._read=function(){for(;;){const M=P.read();if(M===null){re=D._read;return}if(!D.push(M))return}}),D._destroy=function(M,_e){!M&&ce!==null&&(M=new I),re=null,ue=null,fe=null,ce===null?_e(M):(ce=_e,w(K,M),w(P,M))},D}return sn}var on,ls;function Qe(){if(ls)return on;ls=1;const{ObjectDefineProperties:t,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:r,ObjectSetPrototypeOf:n}=oe;on=l;const i=_r(),a=nn();n(l.prototype,i.prototype),n(l,i);{const y=r(a.prototype);for(let x=0;x<y.length;x++){const I=y[x];l.prototype[I]||(l.prototype[I]=a.prototype[I])}}function l(y){if(!(this instanceof l))return new l(y);i.call(this,y),a.call(this,y),y?(this.allowHalfOpen=y.allowHalfOpen!==!1,y.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),y.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}t(l.prototype,{writable:{__proto__:null,...e(a.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(a.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(a.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(a.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(a.prototype,"writableLength")},writableFinished:{__proto__:null,...e(a.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(a.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(a.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(a.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(y){this._readableState&&this._writableState&&(this._readableState.destroyed=y,this._writableState.destroyed=y)}}});let u;function p(){return u===void 0&&(u={}),u}l.fromWeb=function(y,x){return p().newStreamDuplexFromReadableWritablePair(y,x)},l.toWeb=function(y){return p().newReadableWritablePairFromDuplex(y)};let _;return l.from=function(y){return _||(_=Rl()),_(y,"body")},on}const{ObjectSetPrototypeOf:us,Symbol:Al}=oe;var fs=Ve;const{ERR_METHOD_NOT_IMPLEMENTED:Tl}=xe.codes,an=Qe(),{getHighWaterMark:vl}=pr;us(Ve.prototype,an.prototype),us(Ve,an);const Ut=Al("kCallback");function Ve(t){if(!(this instanceof Ve))return new Ve(t);const e=t?vl(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),an.call(this,t),this._readableState.sync=!1,this[Ut]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Nl)}function ln(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function Nl(){this._final!==ln&&ln.call(this)}Ve.prototype._final=ln,Ve.prototype._transform=function(t,e,r){throw new Tl("_transform()")},Ve.prototype._write=function(t,e,r){const n=this._readableState,i=this._writableState,a=n.length;this._transform(t,e,(l,u)=>{if(l){r(l);return}u!=null&&this.push(u),i.ended||a===n.length||n.length<n.highWaterMark?r():this[Ut]=r})},Ve.prototype._read=function(){if(this[Ut]){const t=this[Ut];this[Ut]=null,t()}};const{ObjectSetPrototypeOf:cs}=oe;var ds=vt;const un=fs;cs(vt.prototype,un.prototype),cs(vt,un);function vt(t){if(!(this instanceof vt))return new vt(t);un.call(this,t)}vt.prototype._transform=function(t,e,r){r(null,t)};const Wt=ut,{ArrayIsArray:Pl,Promise:jl,SymbolAsyncIterator:Ll,SymbolDispose:$l}=oe,br=Je,{once:Bl}=Se,Fl=Tt,hs=Qe(),{aggregateTwoErrors:kl,codes:{ERR_INVALID_ARG_TYPE:fn,ERR_INVALID_RETURN_VALUE:cn,ERR_MISSING_ARGS:Cl,ERR_STREAM_DESTROYED:Ol,ERR_STREAM_PREMATURE_CLOSE:Ml},AbortError:Dl}=xe,{validateFunction:Ul,validateAbortSignal:Wl}=Mt,{isIterable:ct,isReadable:dn,isReadableNodeStream:yr,isNodeStream:ps,isTransformStream:Nt,isWebStream:Gl,isReadableStream:hn,isReadableFinished:zl}=He,ql=globalThis.AbortController||Ot().AbortController;let pn,_n,bn;function _s(t,e,r){let n=!1;t.on("close",()=>{n=!0});const i=br(t,{readable:e,writable:r},a=>{n=!a});return{destroy:a=>{n||(n=!0,Fl.destroyer(t,a||new Ol("pipe")))},cleanup:i}}function Hl(t){return Ul(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function yn(t){if(ct(t))return t;if(yr(t))return Ql(t);throw new fn("val",["Readable","Iterable","AsyncIterable"],t)}async function*Ql(t){_n||(_n=_r()),yield*_n.prototype[Ll].call(t)}async function gr(t,e,r,{end:n}){let i,a=null;const l=_=>{if(_&&(i=_),a){const y=a;a=null,y()}},u=()=>new jl((_,y)=>{i?y(i):a=()=>{i?y(i):_()}});e.on("drain",l);const p=br(e,{readable:!1},l);try{e.writableNeedDrain&&await u();for await(const _ of t)e.write(_)||await u();n&&(e.end(),await u()),r()}catch(_){r(i!==_?kl(i,_):_)}finally{p(),e.off("drain",l)}}async function gn(t,e,r,{end:n}){Nt(e)&&(e=e.writable);const i=e.getWriter();try{for await(const a of t)await i.ready,i.write(a).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(a){try{await i.abort(a),r(a)}catch(l){r(l)}}}function Vl(...t){return bs(t,Bl(Hl(t)))}function bs(t,e,r){if(t.length===1&&Pl(t[0])&&(t=t[0]),t.length<2)throw new Cl("streams");const n=new ql,i=n.signal,a=r==null?void 0:r.signal,l=[];Wl(a,"options.signal");function u(){R(new Dl)}bn=bn||Se.addAbortListener;let p;a&&(p=bn(a,u));let _,y;const x=[];let I=0;function S(B){R(B,--I===0)}function R(B,T){var q;if(B&&(!_||_.code==="ERR_STREAM_PREMATURE_CLOSE")&&(_=B),!(!_&&!T)){for(;x.length;)x.shift()(_);(q=p)===null||q===void 0||q[$l](),n.abort(),T&&(_||l.forEach(U=>U()),Wt.nextTick(e,_,y))}}let w;for(let B=0;B<t.length;B++){const T=t[B],q=B<t.length-1,U=B>0,ae=q||(r==null?void 0:r.end)!==!1,Ee=B===t.length-1;if(ps(T)){let ee=function(le){le&&le.name!=="AbortError"&&le.code!=="ERR_STREAM_PREMATURE_CLOSE"&&S(le)};if(ae){const{destroy:le,cleanup:ge}=_s(T,q,U);x.push(le),dn(T)&&Ee&&l.push(ge)}T.on("error",ee),dn(T)&&Ee&&l.push(()=>{T.removeListener("error",ee)})}if(B===0)if(typeof T=="function"){if(w=T({signal:i}),!ct(w))throw new cn("Iterable, AsyncIterable or Stream","source",w)}else ct(T)||yr(T)||Nt(T)?w=T:w=hs.from(T);else if(typeof T=="function"){if(Nt(w)){var A;w=yn((A=w)===null||A===void 0?void 0:A.readable)}else w=yn(w);if(w=T(w,{signal:i}),q){if(!ct(w,!0))throw new cn("AsyncIterable",`transform[${B-1}]`,w)}else{var $;pn||(pn=ds);const ee=new pn({objectMode:!0}),le=($=w)===null||$===void 0?void 0:$.then;if(typeof le=="function")I++,le.call(w,Q=>{y=Q,Q!=null&&ee.write(Q),ae&&ee.end(),Wt.nextTick(S)},Q=>{ee.destroy(Q),Wt.nextTick(S,Q)});else if(ct(w,!0))I++,gr(w,ee,S,{end:ae});else if(hn(w)||Nt(w)){const Q=w.readable||w;I++,gr(Q,ee,S,{end:ae})}else throw new cn("AsyncIterable or Promise","destination",w);w=ee;const{destroy:ge,cleanup:we}=_s(w,!1,!0);x.push(ge),Ee&&l.push(we)}}else if(ps(T)){if(yr(w)){I+=2;const ee=Kl(w,T,S,{end:ae});dn(T)&&Ee&&l.push(ee)}else if(Nt(w)||hn(w)){const ee=w.readable||w;I++,gr(ee,T,S,{end:ae})}else if(ct(w))I++,gr(w,T,S,{end:ae});else throw new fn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=T}else if(Gl(T)){if(yr(w))I++,gn(yn(w),T,S,{end:ae});else if(hn(w)||ct(w))I++,gn(w,T,S,{end:ae});else if(Nt(w))I++,gn(w.readable,T,S,{end:ae});else throw new fn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=T}else w=hs.from(T)}return(i!=null&&i.aborted||a!=null&&a.aborted)&&Wt.nextTick(u),w}function Kl(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new Ml)}),t.pipe(e,{end:!1}),n){let a=function(){i=!0,e.end()};zl(t)?Wt.nextTick(a):t.once("end",a)}else r();return br(t,{readable:!0,writable:!1},a=>{const l=t._readableState;a&&a.code==="ERR_STREAM_PREMATURE_CLOSE"&&l&&l.ended&&!l.errored&&!l.errorEmitted?t.once("end",r).once("error",r):r(a)}),br(e,{readable:!1,writable:!0},r)}var wn={pipelineImpl:bs,pipeline:Vl};const{pipeline:Yl}=wn,wr=Qe(),{destroyer:Xl}=Tt,{isNodeStream:mr,isReadable:ys,isWritable:gs,isWebStream:mn,isTransformStream:dt,isWritableStream:ws,isReadableStream:ms}=He,{AbortError:Zl,codes:{ERR_INVALID_ARG_VALUE:xs,ERR_MISSING_ARGS:Jl}}=xe,eu=Je;var Es=function(...e){if(e.length===0)throw new Jl("streams");if(e.length===1)return wr.from(e[0]);const r=[...e];if(typeof e[0]=="function"&&(e[0]=wr.from(e[0])),typeof e[e.length-1]=="function"){const S=e.length-1;e[S]=wr.from(e[S])}for(let S=0;S<e.length;++S)if(!(!mr(e[S])&&!mn(e[S]))){if(S<e.length-1&&!(ys(e[S])||ms(e[S])||dt(e[S])))throw new xs(`streams[${S}]`,r[S],"must be readable");if(S>0&&!(gs(e[S])||ws(e[S])||dt(e[S])))throw new xs(`streams[${S}]`,r[S],"must be writable")}let n,i,a,l,u;function p(S){const R=l;l=null,R?R(S):S?u.destroy(S):!I&&!x&&u.destroy()}const _=e[0],y=Yl(e,p),x=!!(gs(_)||ws(_)||dt(_)),I=!!(ys(y)||ms(y)||dt(y));if(u=new wr({writableObjectMode:!!(_!=null&&_.writableObjectMode),readableObjectMode:!!(y!=null&&y.readableObjectMode),writable:x,readable:I}),x){if(mr(_))u._write=function(R,w,A){_.write(R,w)?A():n=A},u._final=function(R){_.end(),i=R},_.on("drain",function(){if(n){const R=n;n=null,R()}});else if(mn(_)){const w=(dt(_)?_.writable:_).getWriter();u._write=async function(A,$,B){try{await w.ready,w.write(A).catch(()=>{}),B()}catch(T){B(T)}},u._final=async function(A){try{await w.ready,w.close().catch(()=>{}),i=A}catch($){A($)}}}const S=dt(y)?y.readable:y;eu(S,()=>{if(i){const R=i;i=null,R()}})}if(I){if(mr(y))y.on("readable",function(){if(a){const S=a;a=null,S()}}),y.on("end",function(){u.push(null)}),u._read=function(){for(;;){const S=y.read();if(S===null){a=u._read;return}if(!u.push(S))return}};else if(mn(y)){const R=(dt(y)?y.readable:y).getReader();u._read=async function(){for(;;)try{const{value:w,done:A}=await R.read();if(!u.push(w))return;if(A){u.push(null);return}}catch{return}}}}return u._destroy=function(S,R){!S&&l!==null&&(S=new Zl),a=null,n=null,i=null,l===null?R(S):(l=R,mr(y)&&Xl(y,S))},u};const tu=globalThis.AbortController||Ot().AbortController,{codes:{ERR_INVALID_ARG_VALUE:ru,ERR_INVALID_ARG_TYPE:Gt,ERR_MISSING_ARGS:nu,ERR_OUT_OF_RANGE:iu},AbortError:Ue}=xe,{validateAbortSignal:ht,validateInteger:Ss,validateObject:pt}=Mt,su=oe.Symbol("kWeak"),ou=oe.Symbol("kResistStopPropagation"),{finished:au}=Je,lu=Es,{addAbortSignalNoValidate:uu}=dr,{isWritable:fu,isNodeStream:cu}=He,{deprecate:du}=Se,{ArrayPrototypePush:hu,Boolean:pu,MathFloor:Is,Number:_u,NumberIsNaN:bu,Promise:Rs,PromiseReject:As,PromiseResolve:yu,PromisePrototypeThen:Ts,Symbol:vs}=oe,xr=vs("kEmpty"),Ns=vs("kEof");function gu(t,e){if(e!=null&&pt(e,"options"),(e==null?void 0:e.signal)!=null&&ht(e.signal,"options.signal"),cu(t)&&!fu(t))throw new ru("stream",t,"must be writable");const r=lu(this,t);return e!=null&&e.signal&&uu(e.signal,r),r}function Er(t,e){if(typeof t!="function")throw new Gt("fn",["Function","AsyncFunction"],t);e!=null&&pt(e,"options"),(e==null?void 0:e.signal)!=null&&ht(e.signal,"options.signal");let r=1;(e==null?void 0:e.concurrency)!=null&&(r=Is(e.concurrency));let n=r-1;return(e==null?void 0:e.highWaterMark)!=null&&(n=Is(e.highWaterMark)),Ss(r,"options.concurrency",1),Ss(n,"options.highWaterMark",0),n+=r,(async function*(){const a=Se.AbortSignalAny([e==null?void 0:e.signal].filter(pu)),l=this,u=[],p={signal:a};let _,y,x=!1,I=0;function S(){x=!0,R()}function R(){I-=1,w()}function w(){y&&!x&&I<r&&u.length<n&&(y(),y=null)}async function A(){try{for await(let $ of l){if(x)return;if(a.aborted)throw new Ue;try{if($=t($,p),$===xr)continue;$=yu($)}catch(B){$=As(B)}I+=1,Ts($,R,S),u.push($),_&&(_(),_=null),!x&&(u.length>=n||I>=r)&&await new Rs(B=>{y=B})}u.push(Ns)}catch($){const B=As($);Ts(B,R,S),u.push(B)}finally{x=!0,_&&(_(),_=null)}}A();try{for(;;){for(;u.length>0;){const $=await u[0];if($===Ns)return;if(a.aborted)throw new Ue;$!==xr&&(yield $),u.shift(),w()}await new Rs($=>{_=$})}}finally{x=!0,y&&(y(),y=null)}}).call(this)}function wu(t=void 0){return t!=null&&pt(t,"options"),(t==null?void 0:t.signal)!=null&&ht(t.signal,"options.signal"),(async function*(){let r=0;for await(const i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Ue({cause:t.signal.reason});yield[r++,i]}}).call(this)}async function Ps(t,e=void 0){for await(const r of xn.call(this,t,e))return!0;return!1}async function mu(t,e=void 0){if(typeof t!="function")throw new Gt("fn",["Function","AsyncFunction"],t);return!await Ps.call(this,async(...r)=>!await t(...r),e)}async function xu(t,e){for await(const r of xn.call(this,t,e))return r}async function Eu(t,e){if(typeof t!="function")throw new Gt("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),xr}for await(const n of Er.call(this,r,e));}function xn(t,e){if(typeof t!="function")throw new Gt("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:xr}return Er.call(this,r,e)}class Su extends nu{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function Iu(t,e,r){var n;if(typeof t!="function")throw new Gt("reducer",["Function","AsyncFunction"],t);r!=null&&pt(r,"options"),(r==null?void 0:r.signal)!=null&&ht(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){const _=new Ue(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await au(this.destroy(_)),_}const a=new tu,l=a.signal;if(r!=null&&r.signal){const _={once:!0,[su]:this,[ou]:!0};r.signal.addEventListener("abort",()=>a.abort(),_)}let u=!1;try{for await(const _ of this){var p;if(u=!0,r!=null&&(p=r.signal)!==null&&p!==void 0&&p.aborted)throw new Ue;i?e=await t(e,_,{signal:l}):(e=_,i=!0)}if(!u&&!i)throw new Su}finally{a.abort()}return e}async function Ru(t){t!=null&&pt(t,"options"),(t==null?void 0:t.signal)!=null&&ht(t.signal,"options.signal");const e=[];for await(const n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ue(void 0,{cause:t.signal.reason});hu(e,n)}return e}function Au(t,e){const r=Er.call(this,t,e);return(async function*(){for await(const i of r)yield*i}).call(this)}function js(t){if(t=_u(t),bu(t))return 0;if(t<0)throw new iu("number",">= 0",t);return t}function Tu(t,e=void 0){return e!=null&&pt(e,"options"),(e==null?void 0:e.signal)!=null&&ht(e.signal,"options.signal"),t=js(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ue;for await(const a of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ue;t--<=0&&(yield a)}}).call(this)}function vu(t,e=void 0){return e!=null&&pt(e,"options"),(e==null?void 0:e.signal)!=null&&ht(e.signal,"options.signal"),t=js(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ue;for await(const a of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ue;if(t-- >0&&(yield a),t<=0)return}}).call(this)}Fr.streamReturningOperators={asIndexedPairs:du(wu,"readable.asIndexedPairs will be removed in a future version."),drop:Tu,filter:xn,flatMap:Au,map:Er,take:vu,compose:gu},Fr.promiseReturningOperators={every:mu,forEach:Eu,reduce:Iu,toArray:Ru,some:Ps,find:xu};var En,Ls;function $s(){if(Ls)return En;Ls=1;const{ArrayPrototypePop:t,Promise:e}=oe,{isIterable:r,isNodeStream:n,isWebStream:i}=He,{pipelineImpl:a}=wn,{finished:l}=Je;Fs();function u(...p){return new e((_,y)=>{let x,I;const S=p[p.length-1];if(S&&typeof S=="object"&&!n(S)&&!r(S)&&!i(S)){const R=t(p);x=R.signal,I=R.end}a(p,(R,w)=>{R?y(R):_(w)},{signal:x,end:I})})}return En={finished:l,pipeline:u},En}var Bs;function Fs(){if(Bs)return $r.exports;Bs=1;const{Buffer:t}=Fe,{ObjectDefineProperty:e,ObjectKeys:r,ReflectApply:n}=oe,{promisify:{custom:i}}=Se,{streamReturningOperators:a,promiseReturningOperators:l}=Fr,{codes:{ERR_ILLEGAL_CONSTRUCTOR:u}}=xe,p=Es,{setDefaultHighWaterMark:_,getDefaultHighWaterMark:y}=pr,{pipeline:x}=wn,{destroyer:I}=Tt,S=Je,R=$s(),w=He,A=$r.exports=Yr.Stream;A.isDestroyed=w.isDestroyed,A.isDisturbed=w.isDisturbed,A.isErrored=w.isErrored,A.isReadable=w.isReadable,A.isWritable=w.isWritable,A.Readable=_r();for(const B of r(a)){let q=function(...U){if(new.target)throw u();return A.Readable.from(n(T,this,U))};const T=a[B];e(q,"name",{__proto__:null,value:T.name}),e(q,"length",{__proto__:null,value:T.length}),e(A.Readable.prototype,B,{__proto__:null,value:q,enumerable:!1,configurable:!0,writable:!0})}for(const B of r(l)){let q=function(...U){if(new.target)throw u();return n(T,this,U)};const T=l[B];e(q,"name",{__proto__:null,value:T.name}),e(q,"length",{__proto__:null,value:T.length}),e(A.Readable.prototype,B,{__proto__:null,value:q,enumerable:!1,configurable:!0,writable:!0})}A.Writable=nn(),A.Duplex=Qe(),A.Transform=fs,A.PassThrough=ds,A.pipeline=x;const{addAbortSignal:$}=dr;return A.addAbortSignal=$,A.finished=S,A.destroy=I,A.compose=p,A.setDefaultHighWaterMark=_,A.getDefaultHighWaterMark=y,e(A,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return R}}),e(x,i,{__proto__:null,enumerable:!0,get(){return R.pipeline}}),e(S,i,{__proto__:null,enumerable:!0,get(){return R.finished}}),A.Stream=A,A._isUint8Array=function(T){return T instanceof Uint8Array},A._uint8ArrayToBuffer=function(T){return t.from(T.buffer,T.byteOffset,T.byteLength)},$r.exports}(function(t){const e=Fs(),r=$s(),n=e.Readable.destroy;t.exports=e.Readable,t.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,t.exports._isUint8Array=e._isUint8Array,t.exports.isDisturbed=e.isDisturbed,t.exports.isErrored=e.isErrored,t.exports.isReadable=e.isReadable,t.exports.Readable=e.Readable,t.exports.Writable=e.Writable,t.exports.Duplex=e.Duplex,t.exports.Transform=e.Transform,t.exports.PassThrough=e.PassThrough,t.exports.addAbortSignal=e.addAbortSignal,t.exports.finished=e.finished,t.exports.destroy=e.destroy,t.exports.destroy=n,t.exports.pipeline=e.pipeline,t.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return r}}),t.exports.Stream=e.Stream,t.exports.default=t.exports})(Kn);var ks=Kn.exports;const Sn=Symbol("iter");function zt(t,e,r=4){if(r===0)return Object.assign(t,e);for(const n in e)t[n]=zt(t[n]||Object.create(null),e[n],r-1);return t}function Cs(t,e,r=4){let n=!1;for(const i in t)if(i in e){const a=r===0?null:Cs(t[i],e[i],r-1);if(a!==!1)n=n||Object.create(null),n[i]=a;else if(r===3)return!1}return n}function Os(t,e,r=4){let n=!1;for(const i in t)if(!(i in e))n=n||Object.create(null),n[i]=r===0?null:zt({},t[i],r-1);else if(r!==0){const a=Os(t[i],e[i],r-1);if(a!==!1)n=n||Object.create(null),n[i]=a;else if(r===3)return!1}return n}class Nu{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||ot}_termFromId(e){if(e[0]==="."){const r=this._entities,n=e.split(".");return this._factory.quad(this._termFromId(r[n[1]]),this._termFromId(r[n[2]]),this._termFromId(r[n[3]]),n[4]&&this._termFromId(r[n[4]]))}return $t(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const r=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object);let a;return r&&n&&i&&(Pr(e.graph)||(a=this._termToNumericId(e.graph)))&&this._ids[a?`.${r}.${n}.${i}.${a}`:`.${r}.${n}.${i}`]}return this._ids[xt(e)]}_termToNewNumericId(e){const r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${Pr(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:xt(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,n;if(e)for(r=e=`_:${e}`,n=1;this._ids[r];)r=e+n++;else do r=`_:b${this._blankNodeIndex++}`;while(this._ids[r]);return this._ids[r]=++this._id,this._entities[this._id]=r,this._factory.blankNode(r.substr(2))}}class Ie{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||ot,this._entityIndex=r.entityIndex||new Nu({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 r=this._graphs;let n,i;for(const a in r)for(const l in n=r[a].subjects)for(const u in i=n[l])e+=Object.keys(i[u]).length;return this._size=e}_addToIndex(e,r,n,i){const a=e[r]||(e[r]={}),l=a[n]||(a[n]={}),u=i in l;return u||(l[i]=null),!u}_removeFromIndex(e,r,n,i){const a=e[r],l=a[n];delete l[i];for(const u in l)return;delete a[n];for(const u in a)return;delete e[r]}*_findInIndex(e,r,n,i,a,l,u,p){let _,y,x;const I=this._entities,S=this._termFromId(I[p]),R={subject:null,predicate:null,object:null};r&&((_=e,e={})[r]=_[r]);for(const w in e)if(y=e[w]){R[a]=this._termFromId(I[w]),n&&((_=y,y={})[n]=_[n]);for(const A in y)if(x=y[A]){R[l]=this._termFromId(I[A]);const $=i?i in x?[i]:[]:Object.keys(x);for(let B=0;B<$.length;B++)R[u]=this._termFromId(I[$[B]]),yield this._factory.quad(R.subject,R.predicate,R.object,S)}}}_loop(e,r){for(const n in e)r(n)}_loopByKey0(e,r,n){let i,a;if(i=e[r])for(a in i)n(a)}_loopByKey1(e,r,n){let i,a;for(i in e)a=e[i],a[r]&&n(i)}_loopBy2Keys(e,r,n,i){let a,l,u;if((a=e[r])&&(l=a[n]))for(u in l)i(u)}_countInIndex(e,r,n,i){let a=0,l,u,p;r&&((l=e,e={})[r]=l[r]);for(const _ in e)if(u=e[_]){n&&((l=u,u={})[n]=l[n]);for(const y in u)(p=u[y])&&(i?i in p&&a++:a+=Object.keys(p).length)}return a}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const r=Object.create(null);return n=>{n in r||(r[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,n,i){r||(i=e.graph,n=e.object,r=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let a=this._graphs[i];return a||(a=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(a)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),n=this._termToNewNumericId(n),this._addToIndex(a.subjects,e,r,n)?(this._addToIndex(a.predicates,r,n,e),this._addToIndex(a.objects,n,e,r),this._size=null,!0):!1}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}delete(e){return this.removeQuad(e),this}has(e,r,n,i){return e&&e.subject&&({subject:e,predicate:r,object:n,graph:i}=e),!this.readQuads(e,r,n,i).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,n,i){r||({subject:e,predicate:r,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;const a=this._graphs;let l,u,p;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(n=n&&this._termToNumericId(n))||!(l=a[i])||!(u=l.subjects[e])||!(p=u[r])||!(n in p))return!1;this._removeFromIndex(l.subjects,e,r,n),this._removeFromIndex(l.predicates,r,n,e),this._removeFromIndex(l.objects,n,e,r),this._size!==null&&this._size--;for(e in l.subjects)return!0;return delete a[i],!0}removeQuads(e){for(let r=0;r<e.length;r++)this.removeQuad(e[r])}remove(e){return e.on("data",r=>{this.removeQuad(r)}),e}removeMatches(e,r,n,i){const a=new ks.Readable({objectMode:!0}),l=this.readQuads(e,r,n,i);return a._read=u=>{for(;--u>=0;){const{done:p,value:_}=l.next();if(p){a.push(null);return}a.push(_)}},this.remove(a)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,r,n,i){return[...this.readQuads(e,r,n,i)]}*readQuads(e,r,n,i){const a=this._getGraphs(i);let l,u,p,_;if(!(e&&!(u=this._termToNumericId(e))||r&&!(p=this._termToNumericId(r))||n&&!(_=this._termToNumericId(n))))for(const y in a)(l=a[y])&&(u?_?yield*this._findInIndex(l.objects,_,u,p,"object","subject","predicate",y):yield*this._findInIndex(l.subjects,u,p,null,"subject","predicate","object",y):p?yield*this._findInIndex(l.predicates,p,_,null,"predicate","object","subject",y):_?yield*this._findInIndex(l.objects,_,null,null,"object","subject","predicate",y):yield*this._findInIndex(l.subjects,null,null,null,"subject","predicate","object",y))}match(e,r,n,i){return new et(this,e,r,n,i,{entityIndex:this._entityIndex})}countQuads(e,r,n,i){const a=this._getGraphs(i);let l=0,u,p,_,y;if(e&&!(p=this._termToNumericId(e))||r&&!(_=this._termToNumericId(r))||n&&!(y=this._termToNumericId(n)))return 0;for(const x in a)(u=a[x])&&(e?n?l+=this._countInIndex(u.objects,y,p,_):l+=this._countInIndex(u.subjects,p,_,y):r?l+=this._countInIndex(u.predicates,_,y,p):l+=this._countInIndex(u.objects,y,p,_));return l}forEach(e,r,n,i,a){this.some(l=>(e(l,this),!1),r,n,i,a)}every(e,r,n,i,a){return!this.some(l=>!e(l,this),r,n,i,a)}some(e,r,n,i,a){for(const l of this.readQuads(r,n,i,a))if(e(l,this))return!0;return!1}getSubjects(e,r,n){const i=[];return this.forSubjects(a=>{i.push(a)},e,r,n),i}forSubjects(e,r,n,i){const a=this._getGraphs(i);let l,u,p;if(e=this._uniqueEntities(e),!(r&&!(u=this._termToNumericId(r))||n&&!(p=this._termToNumericId(n))))for(i in a)(l=a[i])&&(u?p?this._loopBy2Keys(l.predicates,u,p,e):this._loopByKey1(l.subjects,u,e):p?this._loopByKey0(l.objects,p,e):this._loop(l.subjects,e))}getPredicates(e,r,n){const i=[];return this.forPredicates(a=>{i.push(a)},e,r,n),i}forPredicates(e,r,n,i){const a=this._getGraphs(i);let l,u,p;if(e=this._uniqueEntities(e),!(r&&!(u=this._termToNumericId(r))||n&&!(p=this._termToNumericId(n))))for(i in a)(l=a[i])&&(u?p?this._loopBy2Keys(l.objects,p,u,e):this._loopByKey0(l.subjects,u,e):p?this._loopByKey1(l.predicates,p,e):this._loop(l.predicates,e))}getObjects(e,r,n){const i=[];return this.forObjects(a=>{i.push(a)},e,r,n),i}forObjects(e,r,n,i){const a=this._getGraphs(i);let l,u,p;if(e=this._uniqueEntities(e),!(r&&!(u=this._termToNumericId(r))||n&&!(p=this._termToNumericId(n))))for(i in a)(l=a[i])&&(u?p?this._loopBy2Keys(l.subjects,u,p,e):this._loopByKey1(l.objects,u,e):p?this._loopByKey0(l.predicates,p,e):this._loop(l.objects,e))}getGraphs(e,r,n){const i=[];return this.forGraphs(a=>{i.push(a)},e,r,n),i}forGraphs(e,r,n,i){for(const a in this._graphs)this.some(l=>(e(l.graph),!0),r,n,i,this._termFromId(this._entities[a]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){const n={},i=r?()=>!0:(u,p)=>{throw new Error(`${u.value} ${p}`)},a=this.getQuads(null,be.rdf.rest,be.rdf.nil,null),l=e?[...a]:[];return a.forEach(u=>{const p=[];let _=!1,y,x;const I=u.graph;let S=u.subject;for(;S&&!_;){const R=this.getQuads(null,null,S,null),w=this.getQuads(S,null,null,null);let A,$=null,B=null,T=null;for(let q=0;q<w.length&&!_;q++)A=w[q],A.graph.equals(I)?y?_=i(S,"has non-list arcs out"):A.predicate.value===be.rdf.first?$?_=i(S,"has multiple rdf:first arcs"):l.push($=A):A.predicate.value===be.rdf.rest?B?_=i(S,"has multiple rdf:rest arcs"):l.push(B=A):R.length?_=i(S,"can't be subject and object"):(y=A,x="subject"):_=i(S,"not confined to single graph");for(let q=0;q<R.length&&!_;++q)A=R[q],y?_=i(S,"can't have coreferences"):A.predicate.value===be.rdf.rest?T?_=i(S,"has incoming rdf:rest arcs"):T=A:(y=A,x="object");$?p.unshift($.object):_=i(S,"has no list head"),S=T&&T.subject}_?e=!1:y&&(n[y[x].value]=p)}),e&&this.removeQuads(l),n}addAll(e){if(e instanceof et&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof Ie&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=zt(this._graphs,e._graphs),this._size=null);else for(const r of e)this.add(r);return this}contains(e){if(e instanceof et&&(e=e.filtered),e===this)return!0;if(!(e instanceof Ie)||this._entityIndex!==e._entityIndex)return e.every(_=>this.has(_));const r=this._graphs,n=e._graphs;let i,a,l,u,p;for(const _ in n){if(!(i=r[_]))return!1;i=i.subjects;for(const y in a=n[_].subjects){if(!(l=i[y]))return!1;for(const x in u=a[y]){if(!(p=l[x]))return!1;for(const I in u[x])if(!(I in p))return!1}}}return!0}deleteMatches(e,r,n,i){for(const a of this.match(e,r,n,i))this.removeQuad(a);return this}difference(e){if(e&&e instanceof et&&(e=e.filtered),e===this)return new Ie({entityIndex:this._entityIndex});if(e instanceof Ie&&e._entityIndex===this._entityIndex){const r=new Ie({entityIndex:this._entityIndex}),n=Os(this._graphs,e._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof et&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const r=new Ie({entityIndex:this._entityIndex});for(const n of this)e(n,this)&&r.add(n);return r}intersection(e){if(e instanceof et&&(e=e.filtered),e===this){const r=new Ie({entityIndex:this._entityIndex});return r._graphs=zt(Object.create(null),this._graphs),r._size=this._size,r}else if(e instanceof Ie&&this._entityIndex===e._entityIndex){const r=new Ie({entityIndex:this._entityIndex}),n=Cs(e._graphs,this._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>e.has(r))}map(e){const r=new Ie({entityIndex:this._entityIndex});for(const n of this)r.add(e(n,this));return r}reduce(e,r){const n=this.readQuads();let i=r===void 0?n.next().value:r;for(const a of n)i=e(i,a,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new Qn().quadsToString(this)}union(e){const r=new Ie({entityIndex:this._entityIndex});return r._graphs=zt(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}}function We(t,e,r=0){const n=e[r];if(n&&!(n in t))return!1;let i=!1;for(const a in n?{[n]:t[n]}:t){const l=r===2?null:We(t[a],e,r+1);l!==!1&&(i=i||Object.create(null),i[a]=l)}return i}class et extends ks.Readable{constructor(e,r,n,i,a,l){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:n,object:i,graph:a,options:l})}get filtered(){if(!this._filtered){const{n3Store:e,graph:r,object:n,predicate:i,subject:a}=this,l=this._filtered=new Ie({factory:e._factory,entityIndex:this.options.entityIndex});let u,p,_;if(a&&!(u=l._termToNumericId(a))||i&&!(p=l._termToNumericId(i))||n&&!(_=l._termToNumericId(n)))return l;const y=e._getGraphs(r);for(const x in y){let I,S,R,w;(w=y[x])&&(!u&&p?(S=We(w.predicates,[p,_,u]))&&(I=We(w.subjects,[u,p,_]),R=We(w.objects,[_,u,p])):_?(R=We(w.objects,[_,u,p]))&&(I=We(w.subjects,[u,p,_]),S=We(w.predicates,[p,_,u])):(I=We(w.subjects,[u,p,_]))&&(S=We(w.predicates,[p,_,u]),R=We(w.objects,[_,u,p])),I&&(l._graphs[x]={subjects:I,predicates:S,objects:R}))}l._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Sn]&&(this[Sn]=this[Symbol.iterator]());const r=this[Sn];for(;--e>=0;){const{done:n,value:i}=r.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,r,n,i){return this.filtered.deleteMatches(e,r,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,n,i,a){return this.filtered.every(e,r,n,i,a)}filter(e){return this.filtered.filter(e)}forEach(e,r,n,i,a){return this.filtered.forEach(e,r,n,i,a)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,n,i,a){return this.filtered.some(e,r,n,i,a)}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,r){return this.filtered.reduce(e,r)}toString(){return new Qn().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,r,n,i){return new et(this.filtered,e,r,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}const Sr={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#"},de={namespace:"https://prez.dev/",label:"https://prez.dev/label",description:"https://prez.dev/description",provenance:"https://prez.dev/provenance",focusNode:"https://prez.dev/FocusNode",link:"https://prez.dev/link",members:"https://prez.dev/members",identifier:"https://prez.dev/identifier",count:"https://prez.dev/count",searchResult:"https://prez.dev/SearchResult",searchResultWeight:"https://prez.dev/searchResultWeight",searchResultPredicate:"https://prez.dev/searchResultPredicate",searchResultURI:"https://prez.dev/searchResultURI",searchResultMatch:"https://prez.dev/searchResultMatch",hasChildren:"https://prez.dev/hasChildren",facetCount:"https://prez.dev/facetCount",facetName:"https://prez.dev/facetName",facetValue:"https://prez.dev/facetValue",profile:"https://prez.dev/profile"},pe={skosConceptScheme:"http://www.w3.org/2004/02/skos/core#ConceptScheme",skosConcept:"http://www.w3.org/2004/02/skos/core#Concept",a:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",rdfLangString:"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",xmlString:"http://www.w3.org/2001/XMLSchema#string",w3Html:"http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML",w3Markdown:"https://www.w3.org/ns/iana/media-types/text/markdown",w3token:"http://www.w3.org/2001/XMLSchema#token",shaclAllPredicates:"http://example.com/shacl-extension#allPredicateValues",shaclPathAlias:"http://example.com/shacl-extension#pathAlias",shaclProperty:"http://www.w3.org/ns/shacl#property",shaclPath:"http://www.w3.org/ns/shacl#path",shaclUnion:"http://www.w3.org/ns/shacl#union",dctermsIdentifier:"http://purl.org/dc/terms/identifier"},Pu={label:["https://prez.dev/label"],description:["https://prez.dev/description"],provenance:["https://prez.dev/provenance"]};function Ms(t,e=Sr){if(t==="a")return e.rdf+"type";{const[r,n]=t.split(":");return r?[r]+n:t}}function Ds(t,e=Sr){let r="";return Object.entries(e).forEach(([n,i])=>{t.startsWith(i)&&(r=n+":"+t.split(i)[1])}),r}const Us=t=>{const e=new URL(t);return`${e.protocol}//${e.hostname}`},ju=t=>new URL(t).pathname,Lu=(t,e)=>{var n,i;const r=(i=(n=e.identifiers)==null?void 0:n.find(a=>a.value))==null?void 0:i.value;return r?t+`/concept-hierarchy/${r}/narrowers`:""},$u=(t,e)=>{var l;const r=e?Us(e):"",n=(l=t.identifiers)==null?void 0:l.find(u=>u.value),i=n?n.value:"";return i?r+`/concept-hierarchy/${i}/top-concepts`:""},Ir=t=>t.flatMap(e=>{var r;if(e["@id"])return e["@id"];if(e["@list"]&&e["@list"].length>0){const n=e["@list"][0];return(n==null?void 0:n["@id"])===pe.shaclUnion?Ir(((r=e["@list"][1])==null?void 0:r["@list"])||[]).filter(Boolean):Ir(e["@list"]).flat()}return[]}).filter(e=>!!e),Bu=t=>t.reduce((e,r)=>{if(pe.shaclProperty in r)for(const n of r[pe.shaclProperty]){const i=t.find(a=>a["@id"]===n["@id"]);i&&pe.shaclPath in i&&(e[r["@id"]]=Ir(i[pe.shaclPath]).filter(a=>a!==pe.shaclAllPredicates))}return e},{});function qt(t){if(Array.isArray(t))return t.reduce((e,r)=>{const n=qt(r);return typeof n=="object"&&!Array.isArray(n)&&Object.assign(e,n),e},{});if(typeof t=="object"&&t!==null){if(t.hasOwnProperty("value"))return t.value;if(t.hasOwnProperty("node")&&t.hasOwnProperty("list")){const e={};return e[t.node.value]=t.list.length>0?qt(t.list):"",e}else{const e={};for(const r in t)e[r]=qt(t[r]);return e}}return t}function In(t,e=""){let r="";const n=Object.entries(t),i=n.length;return n.forEach(([a,l],u)=>{const p=a.replace(/https?:\/\/(www\.)?/,""),[_,y]=p.split("#"),x=_.split("/"),I=x[x.length-1],S=y?`(${x[0]})/${I}#${y}`:`(${x[0]})/${I}`,R=u===i-1;r+=`${e}${R?"└── ":"├── "}${S}
|
|
28
|
-
`,typeof
|
|
29
|
-
`+e;const r=this.parser.parse(e,null,(n,i)=>{this.prefixes[n]=i.value});this.store.addQuads(r),this.linkedLists=this.store.extractLists(),this.buildLists()}buildLists(){this.lists={};const e=this.linkedLists;this.store.getQuads(null,pe.shaclPath,null,null).forEach(r=>{const n=r.object;if(n.termType==="BlankNode"){const i=this.store.getQuads(n,pe.shaclUnion,null,null);if(i.length>0){const a=i[0].object;if(a.termType==="BlankNode"&&a.value in e){const l=e[a.value],u=n.value;this.lists[u]=this.buildSubList(l)}else console.warn(`[buildLists] Found sh:union for ${n.value}, but its object ${a.value} is not a valid list head in linkedLists.`)}}})}buildSubList(e){var n;const r=[];for(const i of e)if(i.termType=="BlankNode"){const a=i.value;if(a in this.linkedLists){const l=this.buildSubList(this.linkedLists[a]);if(l.length>1){const u=r.find(p=>p.node.value==l[0].node.value);u?(u.list??(u.list=[])).push(...l.slice(1)):r.push({node:l[0].node,list:l.slice(1)})}else r.push(...l)}else{const l=(n=this.store.getObjects(i,pe.shaclPathAlias,null))==null?void 0:n[0];if(l){const u=this.toPrezTerm(l);r.push({node:u,list:[]})}}}else if(i.termType=="NamedNode"&&i.value!=pe.shaclUnion){const a=this.toPrezTerm(i);r.push({node:a,list:[]})}return r}setBaseUrl(e){this.baseUrl=e,this.basePath=new URL(e).pathname}toIri(e){return Ms(e,this.prefixes)}fromIri(e){return Ds(e,this.prefixes)}getObjectLiteral(e,r){return this.getObjects(e,r).map(n=>this.toPrezTerm(n))[0]||void 0}getProperties(e,r){const n={};return this.store.forEach(i=>{var a;r!=null&&r.excludePrefix&&i.predicate.value.startsWith(r.excludePrefix)||r!=null&&r.includePrefix&&!i.predicate.value.startsWith(r.includePrefix)||(n[a=i.predicate.value]??(n[a]={predicate:this.toPrezTerm(i.predicate),objects:[]}),n[i.predicate.value].objects.push(this.toPrezTerm(i.object)))},e,null,null,null),e.termType,n}getParents(e){e.startsWith(this.basePath)&&(e=e.substring(this.basePath.length));const r=e.split("/"),n=[];let i="";for(const a of r){if(a=="")continue;i+="/"+a;const l={url:i,segment:a};if(a.includes(":")){const u=a.split(":"),p=this.prefixes[u[0]];if(p){const _=this.getObjects(p+u[1],de.label);_.length>0&&(l.label=Rr(_[0].value))}}n.push(l)}return n}toPrezTerm(e){switch(e.termType){case"NamedNode":const r=it(e.value);r.label=this.getObjectLiteral(e.value,de.label),r.description=this.getObjectLiteral(e.value,de.description),r.provenance=this.getObjectLiteral(e.value,de.provenance);const n=this.getObjects(e.value,de.identifier);n.length>0&&(r.identifiers=n.map(_=>this.toPrezTerm(_)));const i=this.getObjects(e.value,de.link);i.length>0&&(r.links=i.map(_=>({value:_.value,parents:this.getParents(_.value)})));const a=this.getObjects(e.value,de.members);a.length>0&&(r.members={value:a[0].value,parents:this.getParents(a[0].value)});const l=this.getObjects(e.value,pe.a);return l.length>0&&(r.rdfTypes=l.map(_=>this.toPrezTerm(_))),r;case"Literal":const u=Rr(e.value);return e.datatype&&(u.datatype=this.toPrezTerm(e.datatype)),e.language&&(u.language=e.language),u;case"BlankNode":const p=Ar(e.value);return p.properties=this.getProperties(e),e.value in this.lists&&(p.list=this.lists[e.value]),p;default:throw"Invalid n3 Term object"}}toPrezFocusNode(e){var n,i,a,l,u;const r=this.toPrezTerm(e);return r.properties=this.getProperties(e,{excludePrefix:de.namespace}),r.systemProperties=this.getProperties(e,{includePrefix:de.namespace}),(n=r.rdfTypes)!=null&&n.map(p=>p.value).includes(pe.skosConcept)&&(r.hasChildren=((u=(l=(a=(i=r.systemProperties)==null?void 0:i[de.hasChildren])==null?void 0:a.objects)==null?void 0:l[0])==null?void 0:u.value)=="true"),r}getSubjects(e,r){return this.store.getSubjects(e,r,null)}getObjects(e,r){if(typeof r=="string")return this.store.getObjects(Ht(e),Ht(r),null);{const n=[];return r.forEach(i=>{n.push(...this.store.getObjects(Ht(e),Ht(i),null))}),n}}getMembers(e){this.getObjects(e,this.toIri("prez:members")).forEach(n=>({value:n.value,parents:[]}))}getConcepts(e){const r=this.getSubjects(this.toIri("skos:inScheme"),e.value);function n(_){return r.map(y=>y.value).includes(_.value)}const i=this.getObjects(e.value,this.toIri("skos:hasTopConcept")),a=this.getObjects(e.value,this.toIri("skos:topConceptOf")),l={},u=[...i,...a].filter(_=>n(_));r.forEach(_=>{l[_.value]=[]}),r.forEach(_=>{this.getObjects(_.value,this.toIri("skos:broader")).forEach(I=>{n(I)&&l[I.value].push(_)}),this.getObjects(_.value,this.toIri("skos:narrower")).forEach(I=>{n(I)&&l[_.value].push(I)})});const p=[];return u.forEach(_=>{p.push(this.createHierarchy(_,l))}),p}createHierarchy(e,r){const n=r[e.value].map(i=>this.createHierarchy(i,r));return{...this.toPrezTerm(e),hasChildren:n.length>0,narrowers:n}}getByPrezId(e){const r=[];return this.store.forEach(n=>{r.push(n)},null,null,Ht("https://prez.dev/FocusNode"),null),e?r.find(n=>n.object.value===e).subject:r.map(n=>n.subject)}getCount(){const e=this.store.getObjects(null,de.count,null);return e.length>0?Number(e[0].value.replace(">","")):0}getMaxReached(){const e=this.store.getObjects(null,de.count,null);return e.length>0?!e[0].value.includes(">"):!1}getList(){const e=[];return this.getByPrezId().forEach(n=>{e.push(this.toPrezFocusNode(n))}),e}getSkosCollections(e){const r=this.getSubjects("http://www.w3.org/2004/02/skos/core#inScheme",e.value);return this.getSubjects("http://www.w3.org/1999/02/22-rdf-syntax-ns#type","http://www.w3.org/2004/02/skos/core#Collection").filter(a=>r.find(l=>l.value===a.value)).map(a=>this.toPrezTerm(a)).sort((a,l)=>a.label&&l.label?a.label.value.localeCompare(l.label.value):a.label?-1:l.label?1:a.value.localeCompare(l.value))}getItem(){var n;const e=this.getByPrezId();if(e.length==0)throw new Error("Unable to find item");const r=this.toPrezFocusNode(e[0]);if((n=r.rdfTypes)!=null&&n.map(i=>i.value).includes(pe.skosConceptScheme)){const i=this.getSkosCollections(e[0]);return{...r,collections:i}}return r}getSubItems(e){const r=this.store.getQuads(null,e,null,null),n=[];return r.forEach(i=>{const a=this.toPrezFocusNode(i.object);a&&n.push(a)}),n}search(){return this.getSubjects(pe.a,de.searchResult).map(n=>({hash:n.value.split("urn:hash:").slice(-1)[0],weight:Number(this.getObjects(n.value,de.searchResultWeight)[0].value),predicate:this.toPrezTerm(this.getObjects(n.value,de.searchResultPredicate)[0]),match:this.toPrezTerm(this.getObjects(n.value,de.searchResultMatch)[0]),resource:this.toPrezFocusNode(this.getObjects(n.value,de.searchResultURI)[0])}))}getFacets(){const e=[];return this.store.getQuads(null,de.facetName,null,null).forEach(r=>{var n,i,a,l,u,p,_,y,x;if(r.subject.termType=="BlankNode"){const I=Ar(r.subject.value);I.properties=this.getProperties(r.subject);const S=Number((a=(i=(n=I.properties)==null?void 0:n[de.facetCount])==null?void 0:i.objects)==null?void 0:a[0].value)||0,R=(p=(u=(l=I.properties)==null?void 0:l[de.facetName])==null?void 0:u.objects)==null?void 0:p[0],w=(x=(y=(_=I.properties)==null?void 0:_[de.facetValue])==null?void 0:y.objects)==null?void 0:x[0],A=R,$=e.find(B=>B.facetName.value==(A==null?void 0:A.value));if(S>0&&A!==void 0&&w!==void 0){const B=this.toPrezTerm(w);if(B.termType==="Literal"||B.termType==="NamedNode"){const T={term:B,count:S};$?$.facetValues.push(T):e.push({facetName:A,facetValues:[T]})}}}}),e}}class ku extends Error{constructor(e){super(e),this.name="NetworkError"}}function Cu(t){let e={};const r=t.split(",").map(i=>{const[,a,l]=i.trim().match(/<(.+)>; (.+)/),u={uri:a};return l.split("; ").forEach(p=>{const[,_,y]=p.match(/(.+)=[\"<](.+)[\">]/);u[_]=y}),u});r.filter(i=>i.rel==="type").forEach(i=>{e[i.anchor]={default:!1,current:!1,token:i.token,mediatypes:[],title:i.title,description:"",uri:i.anchor}});const n=r.find(i=>i.rel==="self");return n.format in e&&(e[n.format].current=!0),r.filter(i=>i.rel==="alternate"&&i.format).forEach(i=>{e[i.format].mediatypes.map(a=>a.mediatype).includes(i.type)||e[i.format].mediatypes.push({title:"",mediatype:i.type,default:!1})}),Object.values(e)}async function Vt(t){const e=await fetch(t,{method:"GET",headers:{Accept:"text/anot+turtle"}});if(!e.ok)throw new ku(`Network error - status code ${e.status}: ${e.statusText}`);const r=e.headers.get("link")||e.headers.get("Link"),n=r?Cu(r):[];return{data:await e.text(),profiles:n}}async function Ou(t,e){const r=t+e,n=new URL(r).pathname,{data:i,profiles:a}=await Vt(r),l=new Qt;return l.setBaseUrl(t),l.load(i),{type:"list",data:l.getList(),profiles:a,maxReached:l.getMaxReached(),count:l.getCount(),parents:l.getParents(n),facets:l.getFacets()}}async function Mu(t,e){const r=t+e,n=new URL(r).pathname,{data:i,profiles:a}=await Vt(r),l=new Qt;return l.setBaseUrl(t),l.load(i),{type:"item",data:l.getItem(),profiles:a,parents:l.getParents(n),store:l,facets:l.getFacets()}}async function Du(t,e){const r=t+e,n=new URL(r).pathname,{data:i,profiles:a}=await Vt(r),l=new Qt;return l.setBaseUrl(t),l.load(i),{type:"search",data:l.search(),profiles:a,maxReached:l.getMaxReached(),count:l.getCount(),parents:l.getParents(n),facets:l.getFacets()}}async function Uu(t){var l,u,p,_,y,x;const e=t+"/profiles?page=1&limit=999&_mediatype=application/anot%2Bturtle",{data:r}=await Vt(e),n=new Qt;n.setBaseUrl(t),n.load(r);const i=n.getList(),a={};for(const I of i){let S=[];if(I.properties&&((u=(l=I.properties)==null?void 0:l[pe.shaclProperty])!=null&&u.objects)){const R=I.properties[pe.shaclProperty].objects;for(const w of R){const A=w;if(A.properties&&A.properties[pe.shaclPath])for(const $ of A.properties[pe.shaclPath].objects){const B=$.list;B&&(S=B)}}}(x=(y=(_=(p=I.properties)==null?void 0:p[pe.dctermsIdentifier])==null?void 0:_.objects)==null?void 0:y.filter(R=>{var w;return(R==null?void 0:R.termType)=="Literal"&&((w=R==null?void 0:R.datatype)==null?void 0:w.value)==pe.w3token}))==null||x.map(R=>R.value).forEach(R=>{a[R]=S,a[I.value]=S;const w=n.fromIri(I.value);w!=I.value&&(a[w]=S)})}return a}function Wu(t,e){const r={},n=Object.keys(t),i=[...(e||[]).filter(a=>n.includes(a.node.value)).map(a=>a.node.value),...n.filter(a=>!(e||[]).find(l=>l.node.value==a))].filter(a=>a in(t||{})).map(a=>t[a]);for(const a of i)e.find(l=>l.node.value==a.predicate.value&&l.list&&l.list.length>0),r[a.predicate.value]=t[a.predicate.value];return r}function Gu(t,e){t.data.properties=Wu(t.data.properties||{},e)}z.ANNOTATION_PREDICATES=Pu,z.DEFAULT_PREFIXES=Sr,z.PREZ_PREDICATES=de,z.RDFStore=Qt,z.SYSTEM_PREDICATES=pe,z.apiGet=Vt,z.applyProfileToItem=Gu,z.bnode=Ar,z.buildProfiles=Bu,z.defaultFromIri=Ds,z.defaultToIri=Ms,z.dumpNodeArray=Fu,z.getBaseUrl=Us,z.getItem=Mu,z.getList=Ou,z.getNarrowersUrl=Lu,z.getProfiles=Uu,z.getTopConceptsUrl=$u,z.getUrlPath=ju,z.isTypePrezTerm=Ae,z.literal=Rr,z.node=it,z.nodeArrayToTree=In,z.processShaclPath=Ir,z.search=Du,z.simplifyNodeArray=qt,Object.defineProperty(z,Symbol.toStringTag,{value:"Module"})});
|
|
26
|
+
`),this._subject=null),this._write=this._blockedWrite;let t=e&&((r,s)=>{t=null,e(r,s)});if(this._endStream)try{return this._outputStream.end(t)}catch{}t&&t()}}function $r(l){let e=ri[l];return e===void 0&&(l.length===1?(e=l.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((l.charCodeAt(0)-55296)*1024+l.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var $t={exports:{}},Ut={exports:{}},Wt,Ur;function Re(){if(Ur)return Wt;Ur=1;class l extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let r="";for(let s=0;s<t.length;s++)r+=` ${t[s].stack}
|
|
27
|
+
`;super(r),this.name="AggregateError",this.errors=t}}return Wt={AggregateError:l,ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,r){return e.slice(t,r)},Error,FunctionPrototypeCall(e,t,...r){return e.call(t,...r)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,r){return Object.defineProperty(e,t,r)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,r){return e.then(t,r)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,r){return e.slice(t,r)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(e,t,r){return e.set(t,r)},Boolean,Uint8Array},Wt}var qt={exports:{}},Gt,Wr;function qr(){return Wr||(Wr=1,Gt={format(l,...e){return l.replace(/%([sdifj])/g,function(...[t,r]){const s=e.shift();return r==="f"?s.toFixed(6):r==="j"?JSON.stringify(s):r==="s"&&typeof s=="object"?`${s.constructor!==Object?s.constructor.name:""} {}`.trim():s.toString()})},inspect(l){switch(typeof l){case"string":if(l.includes("'"))if(l.includes('"')){if(!l.includes("`")&&!l.includes("${"))return`\`${l}\``}else return`"${l}"`;return`'${l}'`;case"number":return isNaN(l)?"NaN":Object.is(l,-0)?String(l):l;case"bigint":return`${String(l)}n`;case"boolean":case"undefined":return String(l);case"object":return"{}"}}}),Gt}var zt,Gr;function je(){if(Gr)return zt;Gr=1;const{format:l,inspect:e}=qr(),{AggregateError:t}=Re(),r=globalThis.AggregateError||t,s=Symbol("kIsNodeError"),a=["string","function","number","object","Function","Object","boolean","bigint","symbol"],u=/^([A-Z][a-z0-9]*)+$/,o="__node_internal_",b={};function h(g,_){if(!g)throw new b.ERR_INTERNAL_ASSERTION(_)}function x(g){let _="",m=g.length;const w=g[0]==="-"?1:0;for(;m>=w+4;m-=3)_=`_${g.slice(m-3,m)}${_}`;return`${g.slice(0,m)}${_}`}function T(g,_,m){if(typeof _=="function")return h(_.length<=m.length,`Code: ${g}; The provided arguments length (${m.length}) does not match the required ones (${_.length}).`),_(...m);const w=(_.match(/%[dfijoOs]/g)||[]).length;return h(w===m.length,`Code: ${g}; The provided arguments length (${m.length}) does not match the required ones (${w}).`),m.length===0?_:l(_,...m)}function j(g,_,m){m||(m=Error);class w extends m{constructor(...I){super(T(g,_,I))}toString(){return`${this.name} [${g}]: ${this.message}`}}Object.defineProperties(w.prototype,{name:{value:m.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${g}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),w.prototype.code=g,w.prototype[s]=!0,b[g]=w}function L(g){const _=o+g.name;return Object.defineProperty(g,"name",{value:_}),g}function v(g,_){if(g&&_&&g!==_){if(Array.isArray(_.errors))return _.errors.push(g),_;const m=new r([_,g],_.message);return m.code=_.code,m}return g||_}class A extends Error{constructor(_="The operation was aborted",m=void 0){if(m!==void 0&&typeof m!="object")throw new b.ERR_INVALID_ARG_TYPE("options","Object",m);super(_,m),this.code="ABORT_ERR",this.name="AbortError"}}return j("ERR_ASSERTION","%s",Error),j("ERR_INVALID_ARG_TYPE",(g,_,m)=>{h(typeof g=="string","'name' must be a string"),Array.isArray(_)||(_=[_]);let w="The ";g.endsWith(" argument")?w+=`${g} `:w+=`"${g}" ${g.includes(".")?"property":"argument"} `,w+="must be ";const P=[],I=[],H=[];for(const G of _)h(typeof G=="string","All expected entries have to be of type string"),a.includes(G)?P.push(G.toLowerCase()):u.test(G)?I.push(G):(h(G!=="object",'The value "object" should be written as "Object"'),H.push(G));if(I.length>0){const G=P.indexOf("object");G!==-1&&(P.splice(P,G,1),I.push("Object"))}if(P.length>0){switch(P.length){case 1:w+=`of type ${P[0]}`;break;case 2:w+=`one of type ${P[0]} or ${P[1]}`;break;default:{const G=P.pop();w+=`one of type ${P.join(", ")}, or ${G}`}}(I.length>0||H.length>0)&&(w+=" or ")}if(I.length>0){switch(I.length){case 1:w+=`an instance of ${I[0]}`;break;case 2:w+=`an instance of ${I[0]} or ${I[1]}`;break;default:{const G=I.pop();w+=`an instance of ${I.join(", ")}, or ${G}`}}H.length>0&&(w+=" or ")}switch(H.length){case 0:break;case 1:H[0].toLowerCase()!==H[0]&&(w+="an "),w+=`${H[0]}`;break;case 2:w+=`one of ${H[0]} or ${H[1]}`;break;default:{const G=H.pop();w+=`one of ${H.join(", ")}, or ${G}`}}if(m==null)w+=`. Received ${m}`;else if(typeof m=="function"&&m.name)w+=`. Received function ${m.name}`;else if(typeof m=="object"){var K;if((K=m.constructor)!==null&&K!==void 0&&K.name)w+=`. Received an instance of ${m.constructor.name}`;else{const G=e(m,{depth:-1});w+=`. Received ${G}`}}else{let G=e(m,{colors:!1});G.length>25&&(G=`${G.slice(0,25)}...`),w+=`. Received type ${typeof m} (${G})`}return w},TypeError),j("ERR_INVALID_ARG_VALUE",(g,_,m="is invalid")=>{let w=e(_);return w.length>128&&(w=w.slice(0,128)+"..."),`The ${g.includes(".")?"property":"argument"} '${g}' ${m}. Received ${w}`},TypeError),j("ERR_INVALID_RETURN_VALUE",(g,_,m)=>{var w;const P=m!=null&&(w=m.constructor)!==null&&w!==void 0&&w.name?`instance of ${m.constructor.name}`:`type ${typeof m}`;return`Expected ${g} to be returned from the "${_}" function but got ${P}.`},TypeError),j("ERR_MISSING_ARGS",(...g)=>{h(g.length>0,"At least one arg needs to be specified");let _;const m=g.length;switch(g=(Array.isArray(g)?g:[g]).map(w=>`"${w}"`).join(" or "),m){case 1:_+=`The ${g[0]} argument`;break;case 2:_+=`The ${g[0]} and ${g[1]} arguments`;break;default:{const w=g.pop();_+=`The ${g.join(", ")}, and ${w} arguments`}break}return`${_} must be specified`},TypeError),j("ERR_OUT_OF_RANGE",(g,_,m)=>{h(_,'Missing "range" argument');let w;if(Number.isInteger(m)&&Math.abs(m)>2**32)w=x(String(m));else if(typeof m=="bigint"){w=String(m);const P=BigInt(2)**BigInt(32);(m>P||m<-P)&&(w=x(w)),w+="n"}else w=e(m);return`The value of "${g}" is out of range. It must be ${_}. Received ${w}`},RangeError),j("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),j("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),j("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),j("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),j("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),j("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),j("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),j("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),j("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),j("ERR_STREAM_WRITE_AFTER_END","write after end",Error),j("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),zt={AbortError:A,aggregateTwoErrors:L(v),hideStackFrames:L,codes:b},zt}var lt={exports:{}},zr;function ut(){if(zr)return lt.exports;zr=1;const{AbortController:l,AbortSignal:e}=typeof self<"u"?self:typeof window<"u"?window:void 0;return lt.exports=l,lt.exports.AbortSignal=e,lt.exports.default=l,lt.exports}var It={exports:{}},Hr;function Rt(){if(Hr)return It.exports;Hr=1;var l=typeof Reflect=="object"?Reflect:null,e=l&&typeof l.apply=="function"?l.apply:function(I,H,K){return Function.prototype.apply.call(I,H,K)},t;l&&typeof l.ownKeys=="function"?t=l.ownKeys:Object.getOwnPropertySymbols?t=function(I){return Object.getOwnPropertyNames(I).concat(Object.getOwnPropertySymbols(I))}:t=function(I){return Object.getOwnPropertyNames(I)};function r(P){console&&console.warn&&console.warn(P)}var s=Number.isNaN||function(I){return I!==I};function a(){a.init.call(this)}It.exports=a,It.exports.once=_,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function o(P){if(typeof P!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof P)}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(P){if(typeof P!="number"||P<0||s(P))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+P+".");u=P}}),a.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},a.prototype.setMaxListeners=function(I){if(typeof I!="number"||I<0||s(I))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+I+".");return this._maxListeners=I,this};function b(P){return P._maxListeners===void 0?a.defaultMaxListeners:P._maxListeners}a.prototype.getMaxListeners=function(){return b(this)},a.prototype.emit=function(I){for(var H=[],K=1;K<arguments.length;K++)H.push(arguments[K]);var G=I==="error",fe=this._events;if(fe!==void 0)G=G&&fe.error===void 0;else if(!G)return!1;if(G){var F;if(H.length>0&&(F=H[0]),F instanceof Error)throw F;var C=new Error("Unhandled error."+(F?" ("+F.message+")":""));throw C.context=F,C}var V=fe[I];if(V===void 0)return!1;if(typeof V=="function")e(V,this,H);else for(var B=V.length,ne=v(V,B),K=0;K<B;++K)e(ne[K],this,H);return!0};function h(P,I,H,K){var G,fe,F;if(o(H),fe=P._events,fe===void 0?(fe=P._events=Object.create(null),P._eventsCount=0):(fe.newListener!==void 0&&(P.emit("newListener",I,H.listener?H.listener:H),fe=P._events),F=fe[I]),F===void 0)F=fe[I]=H,++P._eventsCount;else if(typeof F=="function"?F=fe[I]=K?[H,F]:[F,H]:K?F.unshift(H):F.push(H),G=b(P),G>0&&F.length>G&&!F.warned){F.warned=!0;var C=new Error("Possible EventEmitter memory leak detected. "+F.length+" "+String(I)+" listeners added. Use emitter.setMaxListeners() to increase limit");C.name="MaxListenersExceededWarning",C.emitter=P,C.type=I,C.count=F.length,r(C)}return P}a.prototype.addListener=function(I,H){return h(this,I,H,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(I,H){return h(this,I,H,!0)};function x(){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 T(P,I,H){var K={fired:!1,wrapFn:void 0,target:P,type:I,listener:H},G=x.bind(K);return G.listener=H,K.wrapFn=G,G}a.prototype.once=function(I,H){return o(H),this.on(I,T(this,I,H)),this},a.prototype.prependOnceListener=function(I,H){return o(H),this.prependListener(I,T(this,I,H)),this},a.prototype.removeListener=function(I,H){var K,G,fe,F,C;if(o(H),G=this._events,G===void 0)return this;if(K=G[I],K===void 0)return this;if(K===H||K.listener===H)--this._eventsCount===0?this._events=Object.create(null):(delete G[I],G.removeListener&&this.emit("removeListener",I,K.listener||H));else if(typeof K!="function"){for(fe=-1,F=K.length-1;F>=0;F--)if(K[F]===H||K[F].listener===H){C=K[F].listener,fe=F;break}if(fe<0)return this;fe===0?K.shift():A(K,fe),K.length===1&&(G[I]=K[0]),G.removeListener!==void 0&&this.emit("removeListener",I,C||H)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(I){var H,K,G;if(K=this._events,K===void 0)return this;if(K.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):K[I]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete K[I]),this;if(arguments.length===0){var fe=Object.keys(K),F;for(G=0;G<fe.length;++G)F=fe[G],F!=="removeListener"&&this.removeAllListeners(F);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(H=K[I],typeof H=="function")this.removeListener(I,H);else if(H!==void 0)for(G=H.length-1;G>=0;G--)this.removeListener(I,H[G]);return this};function j(P,I,H){var K=P._events;if(K===void 0)return[];var G=K[I];return G===void 0?[]:typeof G=="function"?H?[G.listener||G]:[G]:H?g(G):v(G,G.length)}a.prototype.listeners=function(I){return j(this,I,!0)},a.prototype.rawListeners=function(I){return j(this,I,!1)},a.listenerCount=function(P,I){return typeof P.listenerCount=="function"?P.listenerCount(I):L.call(P,I)},a.prototype.listenerCount=L;function L(P){var I=this._events;if(I!==void 0){var H=I[P];if(typeof H=="function")return 1;if(H!==void 0)return H.length}return 0}a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function v(P,I){for(var H=new Array(I),K=0;K<I;++K)H[K]=P[K];return H}function A(P,I){for(;I+1<P.length;I++)P[I]=P[I+1];P.pop()}function g(P){for(var I=new Array(P.length),H=0;H<I.length;++H)I[H]=P[H].listener||P[H];return I}function _(P,I){return new Promise(function(H,K){function G(F){P.removeListener(I,fe),K(F)}function fe(){typeof P.removeListener=="function"&&P.removeListener("error",G),H([].slice.call(arguments))}w(P,I,fe,{once:!0}),I!=="error"&&m(P,G,{once:!0})})}function m(P,I,H){typeof P.on=="function"&&w(P,"error",I,H)}function w(P,I,H,K){if(typeof P.on=="function")K.once?P.once(I,H):P.on(I,H);else if(typeof P.addEventListener=="function")P.addEventListener(I,function G(fe){K.once&&P.removeEventListener(I,G),H(fe)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof P)}return It.exports}var Qr;function Be(){return Qr||(Qr=1,(function(l){const e=Me(),{format:t,inspect:r}=qr(),{codes:{ERR_INVALID_ARG_TYPE:s}}=je(),{kResistStopPropagation:a,AggregateError:u,SymbolDispose:o}=Re(),b=globalThis.AbortSignal||ut().AbortSignal,h=globalThis.AbortController||ut().AbortController,x=Object.getPrototypeOf(async function(){}).constructor,T=globalThis.Blob||e.Blob,j=typeof T<"u"?function(g){return g instanceof T}:function(g){return!1},L=(A,g)=>{if(A!==void 0&&(A===null||typeof A!="object"||!("aborted"in A)))throw new s(g,"AbortSignal",A)},v=(A,g)=>{if(typeof A!="function")throw new s(g,"Function",A)};l.exports={AggregateError:u,kEmptyObject:Object.freeze({}),once(A){let g=!1;return function(..._){g||(g=!0,A.apply(this,_))}},createDeferredPromise:function(){let A,g;return{promise:new Promise((m,w)=>{A=m,g=w}),resolve:A,reject:g}},promisify(A){return new Promise((g,_)=>{A((m,...w)=>m?_(m):g(...w))})},debuglog(){return function(){}},format:t,inspect:r,types:{isAsyncFunction(A){return A instanceof x},isArrayBufferView(A){return ArrayBuffer.isView(A)}},isBlob:j,deprecate(A,g){return A},addAbortListener:Rt().addAbortListener||function(g,_){if(g===void 0)throw new s("signal","AbortSignal",g);L(g,"signal"),v(_,"listener");let m;return g.aborted?queueMicrotask(()=>_()):(g.addEventListener("abort",_,{__proto__:null,once:!0,[a]:!0}),m=()=>{g.removeEventListener("abort",_)}),{__proto__:null,[o](){var w;(w=m)===null||w===void 0||w()}}},AbortSignalAny:b.any||function(g){if(g.length===1)return g[0];const _=new h,m=()=>_.abort();return g.forEach(w=>{L(w,"signals"),w.addEventListener("abort",m,{once:!0})}),_.signal.addEventListener("abort",()=>{g.forEach(w=>w.removeEventListener("abort",m))},{once:!0}),_.signal}},l.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(qt)),qt.exports}var Tt={},Ht,Vr;function ft(){if(Vr)return Ht;Vr=1;const{ArrayIsArray:l,ArrayPrototypeIncludes:e,ArrayPrototypeJoin:t,ArrayPrototypeMap:r,NumberIsInteger:s,NumberIsNaN:a,NumberMAX_SAFE_INTEGER:u,NumberMIN_SAFE_INTEGER:o,NumberParseInt:b,ObjectPrototypeHasOwnProperty:h,RegExpPrototypeExec:x,String:T,StringPrototypeToUpperCase:j,StringPrototypeTrim:L}=Re(),{hideStackFrames:v,codes:{ERR_SOCKET_BAD_PORT:A,ERR_INVALID_ARG_TYPE:g,ERR_INVALID_ARG_VALUE:_,ERR_OUT_OF_RANGE:m,ERR_UNKNOWN_SIGNAL:w}}=je(),{normalizeEncoding:P}=Be(),{isAsyncFunction:I,isArrayBufferView:H}=Be().types,K={};function G(R){return R===(R|0)}function fe(R){return R===R>>>0}const F=/^[0-7]+$/,C="must be a 32-bit unsigned integer or an octal string";function V(R,Q,Y){if(typeof R>"u"&&(R=Y),typeof R=="string"){if(x(F,R)===null)throw new _(Q,R,C);R=b(R,8)}return se(R,Q),R}const B=v((R,Q,Y=o,$=u)=>{if(typeof R!="number")throw new g(Q,"number",R);if(!s(R))throw new m(Q,"an integer",R);if(R<Y||R>$)throw new m(Q,`>= ${Y} && <= ${$}`,R)}),ne=v((R,Q,Y=-2147483648,$=2147483647)=>{if(typeof R!="number")throw new g(Q,"number",R);if(!s(R))throw new m(Q,"an integer",R);if(R<Y||R>$)throw new m(Q,`>= ${Y} && <= ${$}`,R)}),se=v((R,Q,Y=!1)=>{if(typeof R!="number")throw new g(Q,"number",R);if(!s(R))throw new m(Q,"an integer",R);const $=Y?1:0,we=4294967295;if(R<$||R>we)throw new m(Q,`>= ${$} && <= ${we}`,R)});function ue(R,Q){if(typeof R!="string")throw new g(Q,"string",R)}function be(R,Q,Y=void 0,$){if(typeof R!="number")throw new g(Q,"number",R);if(Y!=null&&R<Y||$!=null&&R>$||(Y!=null||$!=null)&&a(R))throw new m(Q,`${Y!=null?`>= ${Y}`:""}${Y!=null&&$!=null?" && ":""}${$!=null?`<= ${$}`:""}`,R)}const W=v((R,Q,Y)=>{if(!e(Y,R)){const we="must be one of: "+t(r(Y,Ne=>typeof Ne=="string"?`'${Ne}'`:T(Ne)),", ");throw new _(Q,R,we)}});function ae(R,Q){if(typeof R!="boolean")throw new g(Q,"boolean",R)}function y(R,Q,Y){return R==null||!h(R,Q)?Y:R[Q]}const M=v((R,Q,Y=null)=>{const $=y(Y,"allowArray",!1),we=y(Y,"allowFunction",!1);if(!y(Y,"nullable",!1)&&R===null||!$&&l(R)||typeof R!="object"&&(!we||typeof R!="function"))throw new g(Q,"Object",R)}),X=v((R,Q)=>{if(R!=null&&typeof R!="object"&&typeof R!="function")throw new g(Q,"a dictionary",R)}),U=v((R,Q,Y=0)=>{if(!l(R))throw new g(Q,"Array",R);if(R.length<Y){const $=`must be longer than ${Y}`;throw new _(Q,R,$)}});function oe(R,Q){U(R,Q);for(let Y=0;Y<R.length;Y++)ue(R[Y],`${Q}[${Y}]`)}function ce(R,Q){U(R,Q);for(let Y=0;Y<R.length;Y++)ae(R[Y],`${Q}[${Y}]`)}function ye(R,Q){U(R,Q);for(let Y=0;Y<R.length;Y++){const $=R[Y],we=`${Q}[${Y}]`;if($==null)throw new g(we,"AbortSignal",$);he($,we)}}function pe(R,Q="signal"){if(ue(R,Q),K[R]===void 0)throw K[j(R)]!==void 0?new w(R+" (signals must use all capital letters)"):new w(R)}const D=v((R,Q="buffer")=>{if(!H(R))throw new g(Q,["Buffer","TypedArray","DataView"],R)});function z(R,Q){const Y=P(Q),$=R.length;if(Y==="hex"&&$%2!==0)throw new _("encoding",Q,`is invalid for data of length ${$}`)}function ie(R,Q="Port",Y=!0){if(typeof R!="number"&&typeof R!="string"||typeof R=="string"&&L(R).length===0||+R!==+R>>>0||R>65535||R===0&&!Y)throw new A(Q,R,Y);return R|0}const he=v((R,Q)=>{if(R!==void 0&&(R===null||typeof R!="object"||!("aborted"in R)))throw new g(Q,"AbortSignal",R)}),de=v((R,Q)=>{if(typeof R!="function")throw new g(Q,"Function",R)}),S=v((R,Q)=>{if(typeof R!="function"||I(R))throw new g(Q,"Function",R)}),N=v((R,Q)=>{if(R!==void 0)throw new g(Q,"undefined",R)});function O(R,Q,Y){if(!e(Y,R))throw new g(Q,`('${t(Y,"|")}')`,R)}const ee=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function J(R,Q){if(typeof R>"u"||!x(ee,R))throw new _(Q,R,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Z(R){if(typeof R=="string")return J(R,"hints"),R;if(l(R)){const Q=R.length;let Y="";if(Q===0)return Y;for(let $=0;$<Q;$++){const we=R[$];J(we,"hints"),Y+=we,$!==Q-1&&(Y+=", ")}return Y}throw new _("hints",R,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return Ht={isInt32:G,isUint32:fe,parseFileMode:V,validateArray:U,validateStringArray:oe,validateBooleanArray:ce,validateAbortSignalArray:ye,validateBoolean:ae,validateBuffer:D,validateDictionary:X,validateEncoding:z,validateFunction:de,validateInt32:ne,validateInteger:B,validateNumber:be,validateObject:M,validateOneOf:W,validatePlainFunction:S,validatePort:ie,validateSignalName:pe,validateString:ue,validateUint32:se,validateUndefined:N,validateUnion:O,validateAbortSignal:he,validateLinkHeaderValue:Z},Ht}var At={exports:{}},Qt={exports:{}},Kr;function He(){if(Kr)return Qt.exports;Kr=1;var l=Qt.exports={},e,t;function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?e=setTimeout:e=r}catch{e=r}try{typeof clearTimeout=="function"?t=clearTimeout:t=s}catch{t=s}})();function a(A){if(e===setTimeout)return setTimeout(A,0);if((e===r||!e)&&setTimeout)return e=setTimeout,setTimeout(A,0);try{return e(A,0)}catch{try{return e.call(null,A,0)}catch{return e.call(this,A,0)}}}function u(A){if(t===clearTimeout)return clearTimeout(A);if((t===s||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(A);try{return t(A)}catch{try{return t.call(null,A)}catch{return t.call(this,A)}}}var o=[],b=!1,h,x=-1;function T(){!b||!h||(b=!1,h.length?o=h.concat(o):x=-1,o.length&&j())}function j(){if(!b){var A=a(T);b=!0;for(var g=o.length;g;){for(h=o,o=[];++x<g;)h&&h[x].run();x=-1,g=o.length}h=null,b=!1,u(A)}}l.nextTick=function(A){var g=new Array(arguments.length-1);if(arguments.length>1)for(var _=1;_<arguments.length;_++)g[_-1]=arguments[_];o.push(new L(A,g)),o.length===1&&!b&&a(j)};function L(A,g){this.fun=A,this.array=g}L.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={};function v(){}return l.on=v,l.addListener=v,l.once=v,l.off=v,l.removeListener=v,l.removeAllListeners=v,l.emit=v,l.prependListener=v,l.prependOnceListener=v,l.listeners=function(A){return[]},l.binding=function(A){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(A){throw new Error("process.chdir is not supported")},l.umask=function(){return 0},Qt.exports}var Vt,Yr;function De(){if(Yr)return Vt;Yr=1;const{SymbolAsyncIterator:l,SymbolIterator:e,SymbolFor:t}=Re(),r=t("nodejs.stream.destroyed"),s=t("nodejs.stream.errored"),a=t("nodejs.stream.readable"),u=t("nodejs.stream.writable"),o=t("nodejs.stream.disturbed"),b=t("nodejs.webstream.isClosedPromise"),h=t("nodejs.webstream.controllerErrorFunction");function x(y,M=!1){var X;return!!(y&&typeof y.pipe=="function"&&typeof y.on=="function"&&(!M||typeof y.pause=="function"&&typeof y.resume=="function")&&(!y._writableState||((X=y._readableState)===null||X===void 0?void 0:X.readable)!==!1)&&(!y._writableState||y._readableState))}function T(y){var M;return!!(y&&typeof y.write=="function"&&typeof y.on=="function"&&(!y._readableState||((M=y._writableState)===null||M===void 0?void 0:M.writable)!==!1))}function j(y){return!!(y&&typeof y.pipe=="function"&&y._readableState&&typeof y.on=="function"&&typeof y.write=="function")}function L(y){return y&&(y._readableState||y._writableState||typeof y.write=="function"&&typeof y.on=="function"||typeof y.pipe=="function"&&typeof y.on=="function")}function v(y){return!!(y&&!L(y)&&typeof y.pipeThrough=="function"&&typeof y.getReader=="function"&&typeof y.cancel=="function")}function A(y){return!!(y&&!L(y)&&typeof y.getWriter=="function"&&typeof y.abort=="function")}function g(y){return!!(y&&!L(y)&&typeof y.readable=="object"&&typeof y.writable=="object")}function _(y){return v(y)||A(y)||g(y)}function m(y,M){return y==null?!1:M===!0?typeof y[l]=="function":M===!1?typeof y[e]=="function":typeof y[l]=="function"||typeof y[e]=="function"}function w(y){if(!L(y))return null;const M=y._writableState,X=y._readableState,U=M||X;return!!(y.destroyed||y[r]||U!=null&&U.destroyed)}function P(y){if(!T(y))return null;if(y.writableEnded===!0)return!0;const M=y._writableState;return M!=null&&M.errored?!1:typeof M?.ended!="boolean"?null:M.ended}function I(y,M){if(!T(y))return null;if(y.writableFinished===!0)return!0;const X=y._writableState;return X!=null&&X.errored?!1:typeof X?.finished!="boolean"?null:!!(X.finished||M===!1&&X.ended===!0&&X.length===0)}function H(y){if(!x(y))return null;if(y.readableEnded===!0)return!0;const M=y._readableState;return!M||M.errored?!1:typeof M?.ended!="boolean"?null:M.ended}function K(y,M){if(!x(y))return null;const X=y._readableState;return X!=null&&X.errored?!1:typeof X?.endEmitted!="boolean"?null:!!(X.endEmitted||M===!1&&X.ended===!0&&X.length===0)}function G(y){return y&&y[a]!=null?y[a]:typeof y?.readable!="boolean"?null:w(y)?!1:x(y)&&y.readable&&!K(y)}function fe(y){return y&&y[u]!=null?y[u]:typeof y?.writable!="boolean"?null:w(y)?!1:T(y)&&y.writable&&!P(y)}function F(y,M){return L(y)?w(y)?!0:!(M?.readable!==!1&&G(y)||M?.writable!==!1&&fe(y)):null}function C(y){var M,X;return L(y)?y.writableErrored?y.writableErrored:(M=(X=y._writableState)===null||X===void 0?void 0:X.errored)!==null&&M!==void 0?M:null:null}function V(y){var M,X;return L(y)?y.readableErrored?y.readableErrored:(M=(X=y._readableState)===null||X===void 0?void 0:X.errored)!==null&&M!==void 0?M:null:null}function B(y){if(!L(y))return null;if(typeof y.closed=="boolean")return y.closed;const M=y._writableState,X=y._readableState;return typeof M?.closed=="boolean"||typeof X?.closed=="boolean"?M?.closed||X?.closed:typeof y._closed=="boolean"&&ne(y)?y._closed:null}function ne(y){return typeof y._closed=="boolean"&&typeof y._defaultKeepAlive=="boolean"&&typeof y._removedConnection=="boolean"&&typeof y._removedContLen=="boolean"}function se(y){return typeof y._sent100=="boolean"&&ne(y)}function ue(y){var M;return typeof y._consuming=="boolean"&&typeof y._dumped=="boolean"&&((M=y.req)===null||M===void 0?void 0:M.upgradeOrConnect)===void 0}function be(y){if(!L(y))return null;const M=y._writableState,X=y._readableState,U=M||X;return!U&&se(y)||!!(U&&U.autoDestroy&&U.emitClose&&U.closed===!1)}function W(y){var M;return!!(y&&((M=y[o])!==null&&M!==void 0?M:y.readableDidRead||y.readableAborted))}function ae(y){var M,X,U,oe,ce,ye,pe,D,z,ie;return!!(y&&((M=(X=(U=(oe=(ce=(ye=y[s])!==null&&ye!==void 0?ye:y.readableErrored)!==null&&ce!==void 0?ce:y.writableErrored)!==null&&oe!==void 0?oe:(pe=y._readableState)===null||pe===void 0?void 0:pe.errorEmitted)!==null&&U!==void 0?U:(D=y._writableState)===null||D===void 0?void 0:D.errorEmitted)!==null&&X!==void 0?X:(z=y._readableState)===null||z===void 0?void 0:z.errored)!==null&&M!==void 0?M:!((ie=y._writableState)===null||ie===void 0)&&ie.errored))}return Vt={isDestroyed:w,kIsDestroyed:r,isDisturbed:W,kIsDisturbed:o,isErrored:ae,kIsErrored:s,isReadable:G,kIsReadable:a,kIsClosedPromise:b,kControllerErrorFunction:h,kIsWritable:u,isClosed:B,isDuplexNodeStream:j,isFinished:F,isIterable:m,isReadableNodeStream:x,isReadableStream:v,isReadableEnded:H,isReadableFinished:K,isReadableErrored:V,isNodeStream:L,isWebStream:_,isWritable:fe,isWritableNodeStream:T,isWritableStream:A,isWritableEnded:P,isWritableFinished:I,isWritableErrored:C,isServerRequest:ue,isServerResponse:se,willEmitClose:be,isTransformStream:g},Vt}var Xr;function We(){if(Xr)return At.exports;Xr=1;const l=He(),{AbortError:e,codes:t}=je(),{ERR_INVALID_ARG_TYPE:r,ERR_STREAM_PREMATURE_CLOSE:s}=t,{kEmptyObject:a,once:u}=Be(),{validateAbortSignal:o,validateFunction:b,validateObject:h,validateBoolean:x}=ft(),{Promise:T,PromisePrototypeThen:j,SymbolDispose:L}=Re(),{isClosed:v,isReadable:A,isReadableNodeStream:g,isReadableStream:_,isReadableFinished:m,isReadableErrored:w,isWritable:P,isWritableNodeStream:I,isWritableStream:H,isWritableFinished:K,isWritableErrored:G,isNodeStream:fe,willEmitClose:F,kIsClosedPromise:C}=De();let V;function B(W){return W.setHeader&&typeof W.abort=="function"}const ne=()=>{};function se(W,ae,y){var M,X;if(arguments.length===2?(y=ae,ae=a):ae==null?ae=a:h(ae,"options"),b(y,"callback"),o(ae.signal,"options.signal"),y=u(y),_(W)||H(W))return ue(W,ae,y);if(!fe(W))throw new r("stream",["ReadableStream","WritableStream","Stream"],W);const U=(M=ae.readable)!==null&&M!==void 0?M:g(W),oe=(X=ae.writable)!==null&&X!==void 0?X:I(W),ce=W._writableState,ye=W._readableState,pe=()=>{W.writable||ie()};let D=F(W)&&g(W)===U&&I(W)===oe,z=K(W,!1);const ie=()=>{z=!0,W.destroyed&&(D=!1),!(D&&(!W.readable||U))&&(!U||he)&&y.call(W)};let he=m(W,!1);const de=()=>{he=!0,W.destroyed&&(D=!1),!(D&&(!W.writable||oe))&&(!oe||z)&&y.call(W)},S=R=>{y.call(W,R)};let N=v(W);const O=()=>{N=!0;const R=G(W)||w(W);if(R&&typeof R!="boolean")return y.call(W,R);if(U&&!he&&g(W,!0)&&!m(W,!1))return y.call(W,new s);if(oe&&!z&&!K(W,!1))return y.call(W,new s);y.call(W)},ee=()=>{N=!0;const R=G(W)||w(W);if(R&&typeof R!="boolean")return y.call(W,R);y.call(W)},J=()=>{W.req.on("finish",ie)};B(W)?(W.on("complete",ie),D||W.on("abort",O),W.req?J():W.on("request",J)):oe&&!ce&&(W.on("end",pe),W.on("close",pe)),!D&&typeof W.aborted=="boolean"&&W.on("aborted",O),W.on("end",de),W.on("finish",ie),ae.error!==!1&&W.on("error",S),W.on("close",O),N?l.nextTick(O):ce!=null&&ce.errorEmitted||ye!=null&&ye.errorEmitted?D||l.nextTick(ee):(!U&&(!D||A(W))&&(z||P(W)===!1)||!oe&&(!D||P(W))&&(he||A(W)===!1)||ye&&W.req&&W.aborted)&&l.nextTick(ee);const Z=()=>{y=ne,W.removeListener("aborted",O),W.removeListener("complete",ie),W.removeListener("abort",O),W.removeListener("request",J),W.req&&W.req.removeListener("finish",ie),W.removeListener("end",pe),W.removeListener("close",pe),W.removeListener("finish",ie),W.removeListener("end",de),W.removeListener("error",S),W.removeListener("close",O)};if(ae.signal&&!N){const R=()=>{const Q=y;Z(),Q.call(W,new e(void 0,{cause:ae.signal.reason}))};if(ae.signal.aborted)l.nextTick(R);else{V=V||Be().addAbortListener;const Q=V(ae.signal,R),Y=y;y=u((...$)=>{Q[L](),Y.apply(W,$)})}}return Z}function ue(W,ae,y){let M=!1,X=ne;if(ae.signal)if(X=()=>{M=!0,y.call(W,new e(void 0,{cause:ae.signal.reason}))},ae.signal.aborted)l.nextTick(X);else{V=V||Be().addAbortListener;const oe=V(ae.signal,X),ce=y;y=u((...ye)=>{oe[L](),ce.apply(W,ye)})}const U=(...oe)=>{M||l.nextTick(()=>y.apply(W,oe))};return j(W[C].promise,U,U),ne}function be(W,ae){var y;let M=!1;return ae===null&&(ae=a),(y=ae)!==null&&y!==void 0&&y.cleanup&&(x(ae.cleanup,"cleanup"),M=ae.cleanup),new T((X,U)=>{const oe=se(W,ae,ce=>{M&&oe(),ce?U(ce):X()})})}return At.exports=se,At.exports.finished=be,At.exports}var Kt,Jr;function Ze(){if(Jr)return Kt;Jr=1;const l=He(),{aggregateTwoErrors:e,codes:{ERR_MULTIPLE_CALLBACK:t},AbortError:r}=je(),{Symbol:s}=Re(),{kIsDestroyed:a,isDestroyed:u,isFinished:o,isServerRequest:b}=De(),h=s("kDestroy"),x=s("kConstruct");function T(F,C,V){F&&(F.stack,C&&!C.errored&&(C.errored=F),V&&!V.errored&&(V.errored=F))}function j(F,C){const V=this._readableState,B=this._writableState,ne=B||V;return B!=null&&B.destroyed||V!=null&&V.destroyed?(typeof C=="function"&&C(),this):(T(F,B,V),B&&(B.destroyed=!0),V&&(V.destroyed=!0),ne.constructed?L(this,F,C):this.once(h,function(se){L(this,e(se,F),C)}),this)}function L(F,C,V){let B=!1;function ne(se){if(B)return;B=!0;const ue=F._readableState,be=F._writableState;T(se,be,ue),be&&(be.closed=!0),ue&&(ue.closed=!0),typeof V=="function"&&V(se),se?l.nextTick(v,F,se):l.nextTick(A,F)}try{F._destroy(C||null,ne)}catch(se){ne(se)}}function v(F,C){g(F,C),A(F)}function A(F){const C=F._readableState,V=F._writableState;V&&(V.closeEmitted=!0),C&&(C.closeEmitted=!0),(V!=null&&V.emitClose||C!=null&&C.emitClose)&&F.emit("close")}function g(F,C){const V=F._readableState,B=F._writableState;B!=null&&B.errorEmitted||V!=null&&V.errorEmitted||(B&&(B.errorEmitted=!0),V&&(V.errorEmitted=!0),F.emit("error",C))}function _(){const F=this._readableState,C=this._writableState;F&&(F.constructed=!0,F.closed=!1,F.closeEmitted=!1,F.destroyed=!1,F.errored=null,F.errorEmitted=!1,F.reading=!1,F.ended=F.readable===!1,F.endEmitted=F.readable===!1),C&&(C.constructed=!0,C.destroyed=!1,C.closed=!1,C.closeEmitted=!1,C.errored=null,C.errorEmitted=!1,C.finalCalled=!1,C.prefinished=!1,C.ended=C.writable===!1,C.ending=C.writable===!1,C.finished=C.writable===!1)}function m(F,C,V){const B=F._readableState,ne=F._writableState;if(ne!=null&&ne.destroyed||B!=null&&B.destroyed)return this;B!=null&&B.autoDestroy||ne!=null&&ne.autoDestroy?F.destroy(C):C&&(C.stack,ne&&!ne.errored&&(ne.errored=C),B&&!B.errored&&(B.errored=C),V?l.nextTick(g,F,C):g(F,C))}function w(F,C){if(typeof F._construct!="function")return;const V=F._readableState,B=F._writableState;V&&(V.constructed=!1),B&&(B.constructed=!1),F.once(x,C),!(F.listenerCount(x)>1)&&l.nextTick(P,F)}function P(F){let C=!1;function V(B){if(C){m(F,B??new t);return}C=!0;const ne=F._readableState,se=F._writableState,ue=se||ne;ne&&(ne.constructed=!0),se&&(se.constructed=!0),ue.destroyed?F.emit(h,B):B?m(F,B,!0):l.nextTick(I,F)}try{F._construct(B=>{l.nextTick(V,B)})}catch(B){l.nextTick(V,B)}}function I(F){F.emit(x)}function H(F){return F?.setHeader&&typeof F.abort=="function"}function K(F){F.emit("close")}function G(F,C){F.emit("error",C),l.nextTick(K,F)}function fe(F,C){!F||u(F)||(!C&&!o(F)&&(C=new r),b(F)?(F.socket=null,F.destroy(C)):H(F)?F.abort():H(F.req)?F.req.abort():typeof F.destroy=="function"?F.destroy(C):typeof F.close=="function"?F.close():C?l.nextTick(G,F,C):l.nextTick(K,F),F.destroyed||(F[a]=!0))}return Kt={construct:w,destroyer:fe,destroy:j,undestroy:_,errorOrDestroy:m},Kt}var Yt,Zr;function Xt(){if(Zr)return Yt;Zr=1;const{ArrayIsArray:l,ObjectSetPrototypeOf:e}=Re(),{EventEmitter:t}=Rt();function r(a){t.call(this,a)}e(r.prototype,t.prototype),e(r,t),r.prototype.pipe=function(a,u){const o=this;function b(A){a.writable&&a.write(A)===!1&&o.pause&&o.pause()}o.on("data",b);function h(){o.readable&&o.resume&&o.resume()}a.on("drain",h),!a._isStdio&&(!u||u.end!==!1)&&(o.on("end",T),o.on("close",j));let x=!1;function T(){x||(x=!0,a.end())}function j(){x||(x=!0,typeof a.destroy=="function"&&a.destroy())}function L(A){v(),t.listenerCount(this,"error")===0&&this.emit("error",A)}s(o,"error",L),s(a,"error",L);function v(){o.removeListener("data",b),a.removeListener("drain",h),o.removeListener("end",T),o.removeListener("close",j),o.removeListener("error",L),a.removeListener("error",L),o.removeListener("end",v),o.removeListener("close",v),a.removeListener("close",v)}return o.on("end",v),o.on("close",v),a.on("close",v),a.emit("pipe",o),a};function s(a,u,o){if(typeof a.prependListener=="function")return a.prependListener(u,o);!a._events||!a._events[u]?a.on(u,o):l(a._events[u])?a._events[u].unshift(o):a._events[u]=[o,a._events[u]]}return Yt={Stream:r,prependListener:s},Yt}var Jt={exports:{}},en;function vt(){return en||(en=1,(function(l){const{SymbolDispose:e}=Re(),{AbortError:t,codes:r}=je(),{isNodeStream:s,isWebStream:a,kControllerErrorFunction:u}=De(),o=We(),{ERR_INVALID_ARG_TYPE:b}=r;let h;const x=(T,j)=>{if(typeof T!="object"||!("aborted"in T))throw new b(j,"AbortSignal",T)};l.exports.addAbortSignal=function(j,L){if(x(j,"signal"),!s(L)&&!a(L))throw new b("stream",["ReadableStream","WritableStream","Stream"],L);return l.exports.addAbortSignalNoValidate(j,L)},l.exports.addAbortSignalNoValidate=function(T,j){if(typeof T!="object"||!("aborted"in T))return j;const L=s(j)?()=>{j.destroy(new t(void 0,{cause:T.reason}))}:()=>{j[u](new t(void 0,{cause:T.reason}))};if(T.aborted)L();else{h=h||Be().addAbortListener;const v=h(T,L);o(j,v[e])}return j}})(Jt)),Jt.exports}var Zt,tn;function ni(){if(tn)return Zt;tn=1;const{StringPrototypeSlice:l,SymbolIterator:e,TypedArrayPrototypeSet:t,Uint8Array:r}=Re(),{Buffer:s}=Me(),{inspect:a}=Be();return Zt=class{constructor(){this.head=null,this.tail=null,this.length=0}push(o){const b={data:o,next:null};this.length>0?this.tail.next=b:this.head=b,this.tail=b,++this.length}unshift(o){const b={data:o,next:this.head};this.length===0&&(this.tail=b),this.head=b,++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 b=this.head,h=""+b.data;for(;(b=b.next)!==null;)h+=o+b.data;return h}concat(o){if(this.length===0)return s.alloc(0);const b=s.allocUnsafe(o>>>0);let h=this.head,x=0;for(;h;)t(b,h.data,x),x+=h.data.length,h=h.next;return b}consume(o,b){const h=this.head.data;if(o<h.length){const x=h.slice(0,o);return this.head.data=h.slice(o),x}return o===h.length?this.shift():b?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 b="",h=this.head,x=0;do{const T=h.data;if(o>T.length)b+=T,o-=T.length;else{o===T.length?(b+=T,++x,h.next?this.head=h.next:this.head=this.tail=null):(b+=l(T,0,o),this.head=h,h.data=l(T,o));break}++x}while((h=h.next)!==null);return this.length-=x,b}_getBuffer(o){const b=s.allocUnsafe(o),h=o;let x=this.head,T=0;do{const j=x.data;if(o>j.length)t(b,j,h-o),o-=j.length;else{o===j.length?(t(b,j,h-o),++T,x.next?this.head=x.next:this.head=this.tail=null):(t(b,new r(j.buffer,j.byteOffset,o),h-o),this.head=x,x.data=j.slice(o));break}++T}while((x=x.next)!==null);return this.length-=T,b}[Symbol.for("nodejs.util.inspect.custom")](o,b){return a(this,{...b,depth:0,customInspect:!1})}},Zt}var er,rn;function Nt(){if(rn)return er;rn=1;const{MathFloor:l,NumberIsInteger:e}=Re(),{validateInteger:t}=ft(),{ERR_INVALID_ARG_VALUE:r}=je().codes;let s=16*1024,a=16;function u(x,T,j){return x.highWaterMark!=null?x.highWaterMark:T?x[j]:null}function o(x){return x?a:s}function b(x,T){t(T,"value",0),x?a=T:s=T}function h(x,T,j,L){const v=u(T,L,j);if(v!=null){if(!e(v)||v<0){const A=L?`options.${j}`:"options.highWaterMark";throw new r(A,v)}return l(v)}return o(x.objectMode)}return er={getHighWaterMark:h,getDefaultHighWaterMark:o,setDefaultHighWaterMark:b},er}var tr={},Pt={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var nn;function ii(){return nn||(nn=1,(function(l,e){var t=Me(),r=t.Buffer;function s(u,o){for(var b in u)o[b]=u[b]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?l.exports=t:(s(t,e),e.Buffer=a);function a(u,o,b){return r(u,o,b)}a.prototype=Object.create(r.prototype),s(r,a),a.from=function(u,o,b){if(typeof u=="number")throw new TypeError("Argument must not be a number");return r(u,o,b)},a.alloc=function(u,o,b){if(typeof u!="number")throw new TypeError("Argument must be a number");var h=r(u);return o!==void 0?typeof b=="string"?h.fill(o,b):h.fill(o):h.fill(0),h},a.allocUnsafe=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return r(u)},a.allocUnsafeSlow=function(u){if(typeof u!="number")throw new TypeError("Argument must be a number");return t.SlowBuffer(u)}})(Pt,Pt.exports)),Pt.exports}var sn;function si(){if(sn)return tr;sn=1;var l=ii().Buffer,e=l.isEncoding||function(_){switch(_=""+_,_&&_.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(_){if(!_)return"utf8";for(var m;;)switch(_){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 _;default:if(m)return;_=(""+_).toLowerCase(),m=!0}}function r(_){var m=t(_);if(typeof m!="string"&&(l.isEncoding===e||!e(_)))throw new Error("Unknown encoding: "+_);return m||_}tr.StringDecoder=s;function s(_){this.encoding=r(_);var m;switch(this.encoding){case"utf16le":this.text=T,this.end=j,m=4;break;case"utf8":this.fillLast=b,m=4;break;case"base64":this.text=L,this.end=v,m=3;break;default:this.write=A,this.end=g;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=l.allocUnsafe(m)}s.prototype.write=function(_){if(_.length===0)return"";var m,w;if(this.lastNeed){if(m=this.fillLast(_),m===void 0)return"";w=this.lastNeed,this.lastNeed=0}else w=0;return w<_.length?m?m+this.text(_,w):this.text(_,w):m||""},s.prototype.end=x,s.prototype.text=h,s.prototype.fillLast=function(_){if(this.lastNeed<=_.length)return _.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,this.lastTotal-this.lastNeed,0,_.length),this.lastNeed-=_.length};function a(_){return _<=127?0:_>>5===6?2:_>>4===14?3:_>>3===30?4:_>>6===2?-1:-2}function u(_,m,w){var P=m.length-1;if(P<w)return 0;var I=a(m[P]);return I>=0?(I>0&&(_.lastNeed=I-1),I):--P<w||I===-2?0:(I=a(m[P]),I>=0?(I>0&&(_.lastNeed=I-2),I):--P<w||I===-2?0:(I=a(m[P]),I>=0?(I>0&&(I===2?I=0:_.lastNeed=I-3),I):0))}function o(_,m,w){if((m[0]&192)!==128)return _.lastNeed=0,"�";if(_.lastNeed>1&&m.length>1){if((m[1]&192)!==128)return _.lastNeed=1,"�";if(_.lastNeed>2&&m.length>2&&(m[2]&192)!==128)return _.lastNeed=2,"�"}}function b(_){var m=this.lastTotal-this.lastNeed,w=o(this,_);if(w!==void 0)return w;if(this.lastNeed<=_.length)return _.copy(this.lastChar,m,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);_.copy(this.lastChar,m,0,_.length),this.lastNeed-=_.length}function h(_,m){var w=u(this,_,m);if(!this.lastNeed)return _.toString("utf8",m);this.lastTotal=w;var P=_.length-(w-this.lastNeed);return _.copy(this.lastChar,0,P),_.toString("utf8",m,P)}function x(_){var m=_&&_.length?this.write(_):"";return this.lastNeed?m+"�":m}function T(_,m){if((_.length-m)%2===0){var w=_.toString("utf16le",m);if(w){var P=w.charCodeAt(w.length-1);if(P>=55296&&P<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1],w.slice(0,-1)}return w}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=_[_.length-1],_.toString("utf16le",m,_.length-1)}function j(_){var m=_&&_.length?this.write(_):"";if(this.lastNeed){var w=this.lastTotal-this.lastNeed;return m+this.lastChar.toString("utf16le",0,w)}return m}function L(_,m){var w=(_.length-m)%3;return w===0?_.toString("base64",m):(this.lastNeed=3-w,this.lastTotal=3,w===1?this.lastChar[0]=_[_.length-1]:(this.lastChar[0]=_[_.length-2],this.lastChar[1]=_[_.length-1]),_.toString("base64",m,_.length-w))}function v(_){var m=_&&_.length?this.write(_):"";return this.lastNeed?m+this.lastChar.toString("base64",0,3-this.lastNeed):m}function A(_){return _.toString(this.encoding)}function g(_){return _&&_.length?this.write(_):""}return tr}var rr,on;function an(){if(on)return rr;on=1;const l=He(),{PromisePrototypeThen:e,SymbolAsyncIterator:t,SymbolIterator:r}=Re(),{Buffer:s}=Me(),{ERR_INVALID_ARG_TYPE:a,ERR_STREAM_NULL_VALUES:u}=je().codes;function o(b,h,x){let T;if(typeof h=="string"||h instanceof s)return new b({objectMode:!0,...x,read(){this.push(h),this.push(null)}});let j;if(h&&h[t])j=!0,T=h[t]();else if(h&&h[r])j=!1,T=h[r]();else throw new a("iterable",["Iterable"],h);const L=new b({objectMode:!0,highWaterMark:1,...x});let v=!1;L._read=function(){v||(v=!0,g())},L._destroy=function(_,m){e(A(_),()=>l.nextTick(m,_),w=>l.nextTick(m,w||_))};async function A(_){const m=_!=null,w=typeof T.throw=="function";if(m&&w){const{value:P,done:I}=await T.throw(_);if(await P,I)return}if(typeof T.return=="function"){const{value:P}=await T.return();await P}}async function g(){for(;;){try{const{value:_,done:m}=j?await T.next():T.next();if(m)L.push(null);else{const w=_&&typeof _.then=="function"?await _:_;if(w===null)throw v=!1,new u;if(L.push(w))continue;v=!1}}catch(_){L.destroy(_)}break}}return L}return rr=o,rr}var nr,ln;function jt(){if(ln)return nr;ln=1;const l=He(),{ArrayPrototypeIndexOf:e,NumberIsInteger:t,NumberIsNaN:r,NumberParseInt:s,ObjectDefineProperties:a,ObjectKeys:u,ObjectSetPrototypeOf:o,Promise:b,SafeSet:h,SymbolAsyncDispose:x,SymbolAsyncIterator:T,Symbol:j}=Re();nr=$,$.ReadableState=Y;const{EventEmitter:L}=Rt(),{Stream:v,prependListener:A}=Xt(),{Buffer:g}=Me(),{addAbortSignal:_}=vt(),m=We();let w=Be().debuglog("stream",c=>{w=c});const P=ni(),I=Ze(),{getHighWaterMark:H,getDefaultHighWaterMark:K}=Nt(),{aggregateTwoErrors:G,codes:{ERR_INVALID_ARG_TYPE:fe,ERR_METHOD_NOT_IMPLEMENTED:F,ERR_OUT_OF_RANGE:C,ERR_STREAM_PUSH_AFTER_EOF:V,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:B},AbortError:ne}=je(),{validateObject:se}=ft(),ue=j("kPaused"),{StringDecoder:be}=si(),W=an();o($.prototype,v.prototype),o($,v);const ae=()=>{},{errorOrDestroy:y}=I,M=1,X=2,U=4,oe=8,ce=16,ye=32,pe=64,D=128,z=256,ie=512,he=1024,de=2048,S=4096,N=8192,O=16384,ee=32768,J=65536,Z=1<<17,R=1<<18;function Q(c){return{enumerable:!1,get(){return(this.state&c)!==0},set(p){p?this.state|=c:this.state&=~c}}}a(Y.prototype,{objectMode:Q(M),ended:Q(X),endEmitted:Q(U),reading:Q(oe),constructed:Q(ce),sync:Q(ye),needReadable:Q(pe),emittedReadable:Q(D),readableListening:Q(z),resumeScheduled:Q(ie),errorEmitted:Q(he),emitClose:Q(de),autoDestroy:Q(S),destroyed:Q(N),closed:Q(O),closeEmitted:Q(ee),multiAwaitDrain:Q(J),readingMore:Q(Z),dataEmitted:Q(R)});function Y(c,p,te){typeof te!="boolean"&&(te=p instanceof $e()),this.state=de|S|ce|ye,c&&c.objectMode&&(this.state|=M),te&&c&&c.readableObjectMode&&(this.state|=M),this.highWaterMark=c?H(this,c,"readableHighWaterMark",te):K(!1),this.buffer=new P,this.length=0,this.pipes=[],this.flowing=null,this[ue]=null,c&&c.emitClose===!1&&(this.state&=~de),c&&c.autoDestroy===!1&&(this.state&=~S),this.errored=null,this.defaultEncoding=c&&c.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,c&&c.encoding&&(this.decoder=new be(c.encoding),this.encoding=c.encoding)}function $(c){if(!(this instanceof $))return new $(c);const p=this instanceof $e();this._readableState=new Y(c,this,p),c&&(typeof c.read=="function"&&(this._read=c.read),typeof c.destroy=="function"&&(this._destroy=c.destroy),typeof c.construct=="function"&&(this._construct=c.construct),c.signal&&!p&&_(c.signal,this)),v.call(this,c),I.construct(this,()=>{this._readableState.needReadable&&E(this,this._readableState)})}$.prototype.destroy=I.destroy,$.prototype._undestroy=I.undestroy,$.prototype._destroy=function(c,p){p(c)},$.prototype[L.captureRejectionSymbol]=function(c){this.destroy(c)},$.prototype[x]=function(){let c;return this.destroyed||(c=this.readableEnded?null:new ne,this.destroy(c)),new b((p,te)=>m(this,re=>re&&re!==c?te(re):p(null)))},$.prototype.push=function(c,p){return we(this,c,p,!1)},$.prototype.unshift=function(c,p){return we(this,c,p,!0)};function we(c,p,te,re){w("readableAddChunk",p);const le=c._readableState;let Pe;if((le.state&M)===0&&(typeof p=="string"?(te=te||le.defaultEncoding,le.encoding!==te&&(re&&le.encoding?p=g.from(p,te).toString(le.encoding):(p=g.from(p,te),te=""))):p instanceof g?te="":v._isUint8Array(p)?(p=v._uint8ArrayToBuffer(p),te=""):p!=null&&(Pe=new fe("chunk",["string","Buffer","Uint8Array"],p))),Pe)y(c,Pe);else if(p===null)le.state&=~oe,n(c,le);else if((le.state&M)!==0||p&&p.length>0)if(re)if((le.state&U)!==0)y(c,new B);else{if(le.destroyed||le.errored)return!1;Ne(c,le,p,!0)}else if(le.ended)y(c,new V);else{if(le.destroyed||le.errored)return!1;le.state&=~oe,le.decoder&&!te?(p=le.decoder.write(p),le.objectMode||p.length!==0?Ne(c,le,p,!1):E(c,le)):Ne(c,le,p,!1)}else re||(le.state&=~oe,E(c,le));return!le.ended&&(le.length<le.highWaterMark||le.length===0)}function Ne(c,p,te,re){p.flowing&&p.length===0&&!p.sync&&c.listenerCount("data")>0?((p.state&J)!==0?p.awaitDrainWriters.clear():p.awaitDrainWriters=null,p.dataEmitted=!0,c.emit("data",te)):(p.length+=p.objectMode?1:te.length,re?p.buffer.unshift(te):p.buffer.push(te),(p.state&pe)!==0&&i(c)),E(c,p)}$.prototype.isPaused=function(){const c=this._readableState;return c[ue]===!0||c.flowing===!1},$.prototype.setEncoding=function(c){const p=new be(c);this._readableState.decoder=p,this._readableState.encoding=this._readableState.decoder.encoding;const te=this._readableState.buffer;let re="";for(const le of te)re+=p.write(le);return te.clear(),re!==""&&te.push(re),this._readableState.length=re.length,this};const ge=1073741824;function Le(c){if(c>ge)throw new C("size","<= 1GiB",c);return c--,c|=c>>>1,c|=c>>>2,c|=c>>>4,c|=c>>>8,c|=c>>>16,c++,c}function f(c,p){return c<=0||p.length===0&&p.ended?0:(p.state&M)!==0?1:r(c)?p.flowing&&p.length?p.buffer.first().length:p.length:c<=p.length?c:p.ended?p.length:0}$.prototype.read=function(c){w("read",c),c===void 0?c=NaN:t(c)||(c=s(c,10));const p=this._readableState,te=c;if(c>p.highWaterMark&&(p.highWaterMark=Le(c)),c!==0&&(p.state&=~D),c===0&&p.needReadable&&((p.highWaterMark!==0?p.length>=p.highWaterMark:p.length>0)||p.ended))return w("read: emitReadable",p.length,p.ended),p.length===0&&p.ended?br(this):i(this),null;if(c=f(c,p),c===0&&p.ended)return p.length===0&&br(this),null;let re=(p.state&pe)!==0;if(w("need readable",re),(p.length===0||p.length-c<p.highWaterMark)&&(re=!0,w("length less than watermark",re)),p.ended||p.reading||p.destroyed||p.errored||!p.constructed)re=!1,w("reading, ended or constructing",re);else if(re){w("do read"),p.state|=oe|ye,p.length===0&&(p.state|=pe);try{this._read(p.highWaterMark)}catch(Pe){y(this,Pe)}p.state&=~ye,p.reading||(c=f(te,p))}let le;return c>0?le=Ln(c,p):le=null,le===null?(p.needReadable=p.length<=p.highWaterMark,c=0):(p.length-=c,p.multiAwaitDrain?p.awaitDrainWriters.clear():p.awaitDrainWriters=null),p.length===0&&(p.ended||(p.needReadable=!0),te!==c&&p.ended&&br(this)),le!==null&&!p.errorEmitted&&!p.closeEmitted&&(p.dataEmitted=!0,this.emit("data",le)),le};function n(c,p){if(w("onEofChunk"),!p.ended){if(p.decoder){const te=p.decoder.end();te&&te.length&&(p.buffer.push(te),p.length+=p.objectMode?1:te.length)}p.ended=!0,p.sync?i(c):(p.needReadable=!1,p.emittedReadable=!0,d(c))}}function i(c){const p=c._readableState;w("emitReadable",p.needReadable,p.emittedReadable),p.needReadable=!1,p.emittedReadable||(w("emitReadable",p.flowing),p.emittedReadable=!0,l.nextTick(d,c))}function d(c){const p=c._readableState;w("emitReadable_",p.destroyed,p.length,p.ended),!p.destroyed&&!p.errored&&(p.length||p.ended)&&(c.emit("readable"),p.emittedReadable=!1),p.needReadable=!p.flowing&&!p.ended&&p.length<=p.highWaterMark,xe(c)}function E(c,p){!p.readingMore&&p.constructed&&(p.readingMore=!0,l.nextTick(k,c,p))}function k(c,p){for(;!p.reading&&!p.ended&&(p.length<p.highWaterMark||p.flowing&&p.length===0);){const te=p.length;if(w("maybeReadMore read 0"),c.read(0),te===p.length)break}p.readingMore=!1}$.prototype._read=function(c){throw new F("_read()")},$.prototype.pipe=function(c,p){const te=this,re=this._readableState;re.pipes.length===1&&(re.multiAwaitDrain||(re.multiAwaitDrain=!0,re.awaitDrainWriters=new h(re.awaitDrainWriters?[re.awaitDrainWriters]:[]))),re.pipes.push(c),w("pipe count=%d opts=%j",re.pipes.length,p);const Pe=(!p||p.end!==!1)&&c!==l.stdout&&c!==l.stderr?Fn:bt;re.endEmitted?l.nextTick(Pe):te.once("end",Pe),c.on("unpipe",ke);function ke(Ve,Ue){w("onunpipe"),Ve===te&&Ue&&Ue.hasUnpiped===!1&&(Ue.hasUnpiped=!0,Ai())}function Fn(){w("onend"),c.end()}let Qe,kn=!1;function Ai(){w("cleanup"),c.removeListener("close",wr),c.removeListener("finish",mr),Qe&&c.removeListener("drain",Qe),c.removeListener("error",gr),c.removeListener("unpipe",ke),te.removeListener("end",Fn),te.removeListener("end",bt),te.removeListener("data",On),kn=!0,Qe&&re.awaitDrainWriters&&(!c._writableState||c._writableState.needDrain)&&Qe()}function Cn(){kn||(re.pipes.length===1&&re.pipes[0]===c?(w("false write response, pause",0),re.awaitDrainWriters=c,re.multiAwaitDrain=!1):re.pipes.length>1&&re.pipes.includes(c)&&(w("false write response, pause",re.awaitDrainWriters.size),re.awaitDrainWriters.add(c)),te.pause()),Qe||(Qe=q(te,c),c.on("drain",Qe))}te.on("data",On);function On(Ve){w("ondata");const Ue=c.write(Ve);w("dest.write",Ue),Ue===!1&&Cn()}function gr(Ve){if(w("onerror",Ve),bt(),c.removeListener("error",gr),c.listenerCount("error")===0){const Ue=c._writableState||c._readableState;Ue&&!Ue.errorEmitted?y(c,Ve):c.emit("error",Ve)}}A(c,"error",gr);function wr(){c.removeListener("finish",mr),bt()}c.once("close",wr);function mr(){w("onfinish"),c.removeListener("close",wr),bt()}c.once("finish",mr);function bt(){w("unpipe"),te.unpipe(c)}return c.emit("pipe",te),c.writableNeedDrain===!0?Cn():re.flowing||(w("pipe resume"),te.resume()),c};function q(c,p){return function(){const re=c._readableState;re.awaitDrainWriters===p?(w("pipeOnDrain",1),re.awaitDrainWriters=null):re.multiAwaitDrain&&(w("pipeOnDrain",re.awaitDrainWriters.size),re.awaitDrainWriters.delete(p)),(!re.awaitDrainWriters||re.awaitDrainWriters.size===0)&&c.listenerCount("data")&&c.resume()}}$.prototype.unpipe=function(c){const p=this._readableState,te={hasUnpiped:!1};if(p.pipes.length===0)return this;if(!c){const le=p.pipes;p.pipes=[],this.pause();for(let Pe=0;Pe<le.length;Pe++)le[Pe].emit("unpipe",this,{hasUnpiped:!1});return this}const re=e(p.pipes,c);return re===-1?this:(p.pipes.splice(re,1),p.pipes.length===0&&this.pause(),c.emit("unpipe",this,te),this)},$.prototype.on=function(c,p){const te=v.prototype.on.call(this,c,p),re=this._readableState;return c==="data"?(re.readableListening=this.listenerCount("readable")>0,re.flowing!==!1&&this.resume()):c==="readable"&&!re.endEmitted&&!re.readableListening&&(re.readableListening=re.needReadable=!0,re.flowing=!1,re.emittedReadable=!1,w("on readable",re.length,re.reading),re.length?i(this):re.reading||l.nextTick(Se,this)),te},$.prototype.addListener=$.prototype.on,$.prototype.removeListener=function(c,p){const te=v.prototype.removeListener.call(this,c,p);return c==="readable"&&l.nextTick(_e,this),te},$.prototype.off=$.prototype.removeListener,$.prototype.removeAllListeners=function(c){const p=v.prototype.removeAllListeners.apply(this,arguments);return(c==="readable"||c===void 0)&&l.nextTick(_e,this),p};function _e(c){const p=c._readableState;p.readableListening=c.listenerCount("readable")>0,p.resumeScheduled&&p[ue]===!1?p.flowing=!0:c.listenerCount("data")>0?c.resume():p.readableListening||(p.flowing=null)}function Se(c){w("readable nexttick read 0"),c.read(0)}$.prototype.resume=function(){const c=this._readableState;return c.flowing||(w("resume"),c.flowing=!c.readableListening,Ee(this,c)),c[ue]=!1,this};function Ee(c,p){p.resumeScheduled||(p.resumeScheduled=!0,l.nextTick(Ie,c,p))}function Ie(c,p){w("resume",p.reading),p.reading||c.read(0),p.resumeScheduled=!1,c.emit("resume"),xe(c),p.flowing&&!p.reading&&c.read(0)}$.prototype.pause=function(){return w("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(w("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[ue]=!0,this};function xe(c){const p=c._readableState;for(w("flow",p.flowing);p.flowing&&c.read()!==null;);}$.prototype.wrap=function(c){let p=!1;c.on("data",re=>{!this.push(re)&&c.pause&&(p=!0,c.pause())}),c.on("end",()=>{this.push(null)}),c.on("error",re=>{y(this,re)}),c.on("close",()=>{this.destroy()}),c.on("destroy",()=>{this.destroy()}),this._read=()=>{p&&c.resume&&(p=!1,c.resume())};const te=u(c);for(let re=1;re<te.length;re++){const le=te[re];this[le]===void 0&&typeof c[le]=="function"&&(this[le]=c[le].bind(c))}return this},$.prototype[T]=function(){return jn(this)},$.prototype.iterator=function(c){return c!==void 0&&se(c,"options"),jn(this,c)};function jn(c,p){typeof c.read!="function"&&(c=$.wrap(c,{objectMode:!0}));const te=Ii(c,p);return te.stream=c,te}async function*Ii(c,p){let te=ae;function re(ke){this===c?(te(),te=ae):te=ke}c.on("readable",re);let le;const Pe=m(c,{writable:!1},ke=>{le=ke?G(le,ke):null,te(),te=ae});try{for(;;){const ke=c.destroyed?null:c.read();if(ke!==null)yield ke;else{if(le)throw le;if(le===null)return;await new b(re)}}}catch(ke){throw le=G(le,ke),le}finally{(le||p?.destroyOnReturn!==!1)&&(le===void 0||c._readableState.autoDestroy)?I.destroyer(c,null):(c.off("readable",re),Pe())}}a($.prototype,{readable:{__proto__:null,get(){const c=this._readableState;return!!c&&c.readable!==!1&&!c.destroyed&&!c.errorEmitted&&!c.endEmitted},set(c){this._readableState&&(this._readableState.readable=!!c)}},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(c){this._readableState&&(this._readableState.flowing=c)}},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(c){this._readableState&&(this._readableState.destroyed=c)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),a(Y.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[ue]!==!1},set(c){this[ue]=!!c}}}),$._fromList=Ln;function Ln(c,p){if(p.length===0)return null;let te;return p.objectMode?te=p.buffer.shift():!c||c>=p.length?(p.decoder?te=p.buffer.join(""):p.buffer.length===1?te=p.buffer.first():te=p.buffer.concat(p.length),p.buffer.clear()):te=p.buffer.consume(c,p.decoder),te}function br(c){const p=c._readableState;w("endReadable",p.endEmitted),p.endEmitted||(p.ended=!0,l.nextTick(Ri,p,c))}function Ri(c,p){if(w("endReadableNT",c.endEmitted,c.length),!c.errored&&!c.closeEmitted&&!c.endEmitted&&c.length===0){if(c.endEmitted=!0,p.emit("end"),p.writable&&p.allowHalfOpen===!1)l.nextTick(Ti,p);else if(c.autoDestroy){const te=p._writableState;(!te||te.autoDestroy&&(te.finished||te.writable===!1))&&p.destroy()}}}function Ti(c){c.writable&&!c.writableEnded&&!c.destroyed&&c.end()}$.from=function(c,p){return W($,c,p)};let yr;function Bn(){return yr===void 0&&(yr={}),yr}return $.fromWeb=function(c,p){return Bn().newStreamReadableFromReadableStream(c,p)},$.toWeb=function(c,p){return Bn().newReadableStreamFromStreamReadable(c,p)},$.wrap=function(c,p){var te,re;return new $({objectMode:(te=(re=c.readableObjectMode)!==null&&re!==void 0?re:c.objectMode)!==null&&te!==void 0?te:!0,...p,destroy(le,Pe){I.destroyer(c,le),Pe(le)}}).wrap(c)},nr}var ir,un;function sr(){if(un)return ir;un=1;const l=He(),{ArrayPrototypeSlice:e,Error:t,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:s,ObjectDefineProperties:a,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:o,Symbol:b,SymbolHasInstance:h}=Re();ir=se,se.WritableState=B;const{EventEmitter:x}=Rt(),T=Xt().Stream,{Buffer:j}=Me(),L=Ze(),{addAbortSignal:v}=vt(),{getHighWaterMark:A,getDefaultHighWaterMark:g}=Nt(),{ERR_INVALID_ARG_TYPE:_,ERR_METHOD_NOT_IMPLEMENTED:m,ERR_MULTIPLE_CALLBACK:w,ERR_STREAM_CANNOT_PIPE:P,ERR_STREAM_DESTROYED:I,ERR_STREAM_ALREADY_FINISHED:H,ERR_STREAM_NULL_VALUES:K,ERR_STREAM_WRITE_AFTER_END:G,ERR_UNKNOWN_ENCODING:fe}=je().codes,{errorOrDestroy:F}=L;u(se.prototype,T.prototype),u(se,T);function C(){}const V=b("kOnFinished");function B(S,N,O){typeof O!="boolean"&&(O=N instanceof $e()),this.objectMode=!!(S&&S.objectMode),O&&(this.objectMode=this.objectMode||!!(S&&S.writableObjectMode)),this.highWaterMark=S?A(this,S,"writableHighWaterMark",O):g(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const ee=!!(S&&S.decodeStrings===!1);this.decodeStrings=!ee,this.defaultEncoding=S&&S.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=y.bind(void 0,N),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,ne(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!S||S.emitClose!==!1,this.autoDestroy=!S||S.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[V]=[]}function ne(S){S.buffered=[],S.bufferedIndex=0,S.allBuffers=!0,S.allNoop=!0}B.prototype.getBuffer=function(){return e(this.buffered,this.bufferedIndex)},s(B.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function se(S){const N=this instanceof $e();if(!N&&!r(se,this))return new se(S);this._writableState=new B(S,this,N),S&&(typeof S.write=="function"&&(this._write=S.write),typeof S.writev=="function"&&(this._writev=S.writev),typeof S.destroy=="function"&&(this._destroy=S.destroy),typeof S.final=="function"&&(this._final=S.final),typeof S.construct=="function"&&(this._construct=S.construct),S.signal&&v(S.signal,this)),T.call(this,S),L.construct(this,()=>{const O=this._writableState;O.writing||oe(this,O),D(this,O)})}s(se,h,{__proto__:null,value:function(S){return r(this,S)?!0:this!==se?!1:S&&S._writableState instanceof B}}),se.prototype.pipe=function(){F(this,new P)};function ue(S,N,O,ee){const J=S._writableState;if(typeof O=="function")ee=O,O=J.defaultEncoding;else{if(!O)O=J.defaultEncoding;else if(O!=="buffer"&&!j.isEncoding(O))throw new fe(O);typeof ee!="function"&&(ee=C)}if(N===null)throw new K;if(!J.objectMode)if(typeof N=="string")J.decodeStrings!==!1&&(N=j.from(N,O),O="buffer");else if(N instanceof j)O="buffer";else if(T._isUint8Array(N))N=T._uint8ArrayToBuffer(N),O="buffer";else throw new _("chunk",["string","Buffer","Uint8Array"],N);let Z;return J.ending?Z=new G:J.destroyed&&(Z=new I("write")),Z?(l.nextTick(ee,Z),F(S,Z,!0),Z):(J.pendingcb++,be(S,J,N,O,ee))}se.prototype.write=function(S,N,O){return ue(this,S,N,O)===!0},se.prototype.cork=function(){this._writableState.corked++},se.prototype.uncork=function(){const S=this._writableState;S.corked&&(S.corked--,S.writing||oe(this,S))},se.prototype.setDefaultEncoding=function(N){if(typeof N=="string"&&(N=o(N)),!j.isEncoding(N))throw new fe(N);return this._writableState.defaultEncoding=N,this};function be(S,N,O,ee,J){const Z=N.objectMode?1:O.length;N.length+=Z;const R=N.length<N.highWaterMark;return R||(N.needDrain=!0),N.writing||N.corked||N.errored||!N.constructed?(N.buffered.push({chunk:O,encoding:ee,callback:J}),N.allBuffers&&ee!=="buffer"&&(N.allBuffers=!1),N.allNoop&&J!==C&&(N.allNoop=!1)):(N.writelen=Z,N.writecb=J,N.writing=!0,N.sync=!0,S._write(O,ee,N.onwrite),N.sync=!1),R&&!N.errored&&!N.destroyed}function W(S,N,O,ee,J,Z,R){N.writelen=ee,N.writecb=R,N.writing=!0,N.sync=!0,N.destroyed?N.onwrite(new I("write")):O?S._writev(J,N.onwrite):S._write(J,Z,N.onwrite),N.sync=!1}function ae(S,N,O,ee){--N.pendingcb,ee(O),U(N),F(S,O)}function y(S,N){const O=S._writableState,ee=O.sync,J=O.writecb;if(typeof J!="function"){F(S,new w);return}O.writing=!1,O.writecb=null,O.length-=O.writelen,O.writelen=0,N?(N.stack,O.errored||(O.errored=N),S._readableState&&!S._readableState.errored&&(S._readableState.errored=N),ee?l.nextTick(ae,S,O,N,J):ae(S,O,N,J)):(O.buffered.length>O.bufferedIndex&&oe(S,O),ee?O.afterWriteTickInfo!==null&&O.afterWriteTickInfo.cb===J?O.afterWriteTickInfo.count++:(O.afterWriteTickInfo={count:1,cb:J,stream:S,state:O},l.nextTick(M,O.afterWriteTickInfo)):X(S,O,1,J))}function M({stream:S,state:N,count:O,cb:ee}){return N.afterWriteTickInfo=null,X(S,N,O,ee)}function X(S,N,O,ee){for(!N.ending&&!S.destroyed&&N.length===0&&N.needDrain&&(N.needDrain=!1,S.emit("drain"));O-- >0;)N.pendingcb--,ee();N.destroyed&&U(N),D(S,N)}function U(S){if(S.writing)return;for(let J=S.bufferedIndex;J<S.buffered.length;++J){var N;const{chunk:Z,callback:R}=S.buffered[J],Q=S.objectMode?1:Z.length;S.length-=Q,R((N=S.errored)!==null&&N!==void 0?N:new I("write"))}const O=S[V].splice(0);for(let J=0;J<O.length;J++){var ee;O[J]((ee=S.errored)!==null&&ee!==void 0?ee:new I("end"))}ne(S)}function oe(S,N){if(N.corked||N.bufferProcessing||N.destroyed||!N.constructed)return;const{buffered:O,bufferedIndex:ee,objectMode:J}=N,Z=O.length-ee;if(!Z)return;let R=ee;if(N.bufferProcessing=!0,Z>1&&S._writev){N.pendingcb-=Z-1;const Q=N.allNoop?C:$=>{for(let we=R;we<O.length;++we)O[we].callback($)},Y=N.allNoop&&R===0?O:e(O,R);Y.allBuffers=N.allBuffers,W(S,N,!0,N.length,Y,"",Q),ne(N)}else{do{const{chunk:Q,encoding:Y,callback:$}=O[R];O[R++]=null;const we=J?1:Q.length;W(S,N,!1,we,Q,Y,$)}while(R<O.length&&!N.writing);R===O.length?ne(N):R>256?(O.splice(0,R),N.bufferedIndex=0):N.bufferedIndex=R}N.bufferProcessing=!1}se.prototype._write=function(S,N,O){if(this._writev)this._writev([{chunk:S,encoding:N}],O);else throw new m("_write()")},se.prototype._writev=null,se.prototype.end=function(S,N,O){const ee=this._writableState;typeof S=="function"?(O=S,S=null,N=null):typeof N=="function"&&(O=N,N=null);let J;if(S!=null){const Z=ue(this,S,N);Z instanceof t&&(J=Z)}return ee.corked&&(ee.corked=1,this.uncork()),J||(!ee.errored&&!ee.ending?(ee.ending=!0,D(this,ee,!0),ee.ended=!0):ee.finished?J=new H("end"):ee.destroyed&&(J=new I("end"))),typeof O=="function"&&(J||ee.finished?l.nextTick(O,J):ee[V].push(O)),this};function ce(S){return S.ending&&!S.destroyed&&S.constructed&&S.length===0&&!S.errored&&S.buffered.length===0&&!S.finished&&!S.writing&&!S.errorEmitted&&!S.closeEmitted}function ye(S,N){let O=!1;function ee(J){if(O){F(S,J??w());return}if(O=!0,N.pendingcb--,J){const Z=N[V].splice(0);for(let R=0;R<Z.length;R++)Z[R](J);F(S,J,N.sync)}else ce(N)&&(N.prefinished=!0,S.emit("prefinish"),N.pendingcb++,l.nextTick(z,S,N))}N.sync=!0,N.pendingcb++;try{S._final(ee)}catch(J){ee(J)}N.sync=!1}function pe(S,N){!N.prefinished&&!N.finalCalled&&(typeof S._final=="function"&&!N.destroyed?(N.finalCalled=!0,ye(S,N)):(N.prefinished=!0,S.emit("prefinish")))}function D(S,N,O){ce(N)&&(pe(S,N),N.pendingcb===0&&(O?(N.pendingcb++,l.nextTick((ee,J)=>{ce(J)?z(ee,J):J.pendingcb--},S,N)):ce(N)&&(N.pendingcb++,z(S,N))))}function z(S,N){N.pendingcb--,N.finished=!0;const O=N[V].splice(0);for(let ee=0;ee<O.length;ee++)O[ee]();if(S.emit("finish"),N.autoDestroy){const ee=S._readableState;(!ee||ee.autoDestroy&&(ee.endEmitted||ee.readable===!1))&&S.destroy()}}a(se.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(S){this._writableState&&(this._writableState.destroyed=S)}},writable:{__proto__:null,get(){const S=this._writableState;return!!S&&S.writable!==!1&&!S.destroyed&&!S.errored&&!S.ending&&!S.ended},set(S){this._writableState&&(this._writableState.writable=!!S)}},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 S=this._writableState;return S?!S.destroyed&&!S.ending&&S.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 ie=L.destroy;se.prototype.destroy=function(S,N){const O=this._writableState;return!O.destroyed&&(O.bufferedIndex<O.buffered.length||O[V].length)&&l.nextTick(U,O),ie.call(this,S,N),this},se.prototype._undestroy=L.undestroy,se.prototype._destroy=function(S,N){N(S)},se.prototype[x.captureRejectionSymbol]=function(S){this.destroy(S)};let he;function de(){return he===void 0&&(he={}),he}return se.fromWeb=function(S,N){return de().newStreamWritableFromWritableStream(S,N)},se.toWeb=function(S){return de().newWritableStreamFromStreamWritable(S)},ir}var or,fn;function oi(){if(fn)return or;fn=1;const l=He(),e=Me(),{isReadable:t,isWritable:r,isIterable:s,isNodeStream:a,isReadableNodeStream:u,isWritableNodeStream:o,isDuplexNodeStream:b,isReadableStream:h,isWritableStream:x}=De(),T=We(),{AbortError:j,codes:{ERR_INVALID_ARG_TYPE:L,ERR_INVALID_RETURN_VALUE:v}}=je(),{destroyer:A}=Ze(),g=$e(),_=jt(),m=sr(),{createDeferredPromise:w}=Be(),P=an(),I=globalThis.Blob||e.Blob,H=typeof I<"u"?function(B){return B instanceof I}:function(B){return!1},K=globalThis.AbortController||ut().AbortController,{FunctionPrototypeCall:G}=Re();class fe extends g{constructor(B){super(B),B?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),B?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}or=function V(B,ne){if(b(B))return B;if(u(B))return C({readable:B});if(o(B))return C({writable:B});if(a(B))return C({writable:!1,readable:!1});if(h(B))return C({readable:_.fromWeb(B)});if(x(B))return C({writable:m.fromWeb(B)});if(typeof B=="function"){const{value:ue,write:be,final:W,destroy:ae}=F(B);if(s(ue))return P(fe,ue,{objectMode:!0,write:be,final:W,destroy:ae});const y=ue?.then;if(typeof y=="function"){let M;const X=G(y,ue,U=>{if(U!=null)throw new v("nully","body",U)},U=>{A(M,U)});return M=new fe({objectMode:!0,readable:!1,write:be,final(U){W(async()=>{try{await X,l.nextTick(U,null)}catch(oe){l.nextTick(U,oe)}})},destroy:ae})}throw new v("Iterable, AsyncIterable or AsyncFunction",ne,ue)}if(H(B))return V(B.arrayBuffer());if(s(B))return P(fe,B,{objectMode:!0,writable:!1});if(h(B?.readable)&&x(B?.writable))return fe.fromWeb(B);if(typeof B?.writable=="object"||typeof B?.readable=="object"){const ue=B!=null&&B.readable?u(B?.readable)?B?.readable:V(B.readable):void 0,be=B!=null&&B.writable?o(B?.writable)?B?.writable:V(B.writable):void 0;return C({readable:ue,writable:be})}const se=B?.then;if(typeof se=="function"){let ue;return G(se,B,be=>{be!=null&&ue.push(be),ue.push(null)},be=>{A(ue,be)}),ue=new fe({objectMode:!0,writable:!1,read(){}})}throw new L(ne,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],B)};function F(V){let{promise:B,resolve:ne}=w();const se=new K,ue=se.signal;return{value:V((async function*(){for(;;){const W=B;B=null;const{chunk:ae,done:y,cb:M}=await W;if(l.nextTick(M),y)return;if(ue.aborted)throw new j(void 0,{cause:ue.reason});({promise:B,resolve:ne}=w()),yield ae}})(),{signal:ue}),write(W,ae,y){const M=ne;ne=null,M({chunk:W,done:!1,cb:y})},final(W){const ae=ne;ne=null,ae({done:!0,cb:W})},destroy(W,ae){se.abort(),ae(W)}}}function C(V){const B=V.readable&&typeof V.readable.read!="function"?_.wrap(V.readable):V.readable,ne=V.writable;let se=!!t(B),ue=!!r(ne),be,W,ae,y,M;function X(U){const oe=y;y=null,oe?oe(U):U&&M.destroy(U)}return M=new fe({readableObjectMode:!!(B!=null&&B.readableObjectMode),writableObjectMode:!!(ne!=null&&ne.writableObjectMode),readable:se,writable:ue}),ue&&(T(ne,U=>{ue=!1,U&&A(B,U),X(U)}),M._write=function(U,oe,ce){ne.write(U,oe)?ce():be=ce},M._final=function(U){ne.end(),W=U},ne.on("drain",function(){if(be){const U=be;be=null,U()}}),ne.on("finish",function(){if(W){const U=W;W=null,U()}})),se&&(T(B,U=>{se=!1,U&&A(B,U),X(U)}),B.on("readable",function(){if(ae){const U=ae;ae=null,U()}}),B.on("end",function(){M.push(null)}),M._read=function(){for(;;){const U=B.read();if(U===null){ae=M._read;return}if(!M.push(U))return}}),M._destroy=function(U,oe){!U&&y!==null&&(U=new j),ae=null,be=null,W=null,y===null?oe(U):(y=oe,A(ne,U),A(B,U))},M}return or}var ar,cn;function $e(){if(cn)return ar;cn=1;const{ObjectDefineProperties:l,ObjectGetOwnPropertyDescriptor:e,ObjectKeys:t,ObjectSetPrototypeOf:r}=Re();ar=u;const s=jt(),a=sr();r(u.prototype,s.prototype),r(u,s);{const x=t(a.prototype);for(let T=0;T<x.length;T++){const j=x[T];u.prototype[j]||(u.prototype[j]=a.prototype[j])}}function u(x){if(!(this instanceof u))return new u(x);s.call(this,x),a.call(this,x),x?(this.allowHalfOpen=x.allowHalfOpen!==!1,x.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),x.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}l(u.prototype,{writable:{__proto__:null,...e(a.prototype,"writable")},writableHighWaterMark:{__proto__:null,...e(a.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...e(a.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...e(a.prototype,"writableBuffer")},writableLength:{__proto__:null,...e(a.prototype,"writableLength")},writableFinished:{__proto__:null,...e(a.prototype,"writableFinished")},writableCorked:{__proto__:null,...e(a.prototype,"writableCorked")},writableEnded:{__proto__:null,...e(a.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...e(a.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(x){this._readableState&&this._writableState&&(this._readableState.destroyed=x,this._writableState.destroyed=x)}}});let o;function b(){return o===void 0&&(o={}),o}u.fromWeb=function(x,T){return b().newStreamDuplexFromReadableWritablePair(x,T)},u.toWeb=function(x){return b().newReadableWritablePairFromDuplex(x)};let h;return u.from=function(x){return h||(h=oi()),h(x,"body")},ar}var lr,dn;function hn(){if(dn)return lr;dn=1;const{ObjectSetPrototypeOf:l,Symbol:e}=Re();lr=u;const{ERR_METHOD_NOT_IMPLEMENTED:t}=je().codes,r=$e(),{getHighWaterMark:s}=Nt();l(u.prototype,r.prototype),l(u,r);const a=e("kCallback");function u(h){if(!(this instanceof u))return new u(h);const x=h?s(this,h,"readableHighWaterMark",!0):null;x===0&&(h={...h,highWaterMark:null,readableHighWaterMark:x,writableHighWaterMark:h.writableHighWaterMark||0}),r.call(this,h),this._readableState.sync=!1,this[a]=null,h&&(typeof h.transform=="function"&&(this._transform=h.transform),typeof h.flush=="function"&&(this._flush=h.flush)),this.on("prefinish",b)}function o(h){typeof this._flush=="function"&&!this.destroyed?this._flush((x,T)=>{if(x){h?h(x):this.destroy(x);return}T!=null&&this.push(T),this.push(null),h&&h()}):(this.push(null),h&&h())}function b(){this._final!==o&&o.call(this)}return u.prototype._final=o,u.prototype._transform=function(h,x,T){throw new t("_transform()")},u.prototype._write=function(h,x,T){const j=this._readableState,L=this._writableState,v=j.length;this._transform(h,x,(A,g)=>{if(A){T(A);return}g!=null&&this.push(g),L.ended||v===j.length||j.length<j.highWaterMark?T():this[a]=T})},u.prototype._read=function(){if(this[a]){const h=this[a];this[a]=null,h()}},lr}var ur,pn;function _n(){if(pn)return ur;pn=1;const{ObjectSetPrototypeOf:l}=Re();ur=t;const e=hn();l(t.prototype,e.prototype),l(t,e);function t(r){if(!(this instanceof t))return new t(r);e.call(this,r)}return t.prototype._transform=function(r,s,a){a(null,r)},ur}var fr,bn;function cr(){if(bn)return fr;bn=1;const l=He(),{ArrayIsArray:e,Promise:t,SymbolAsyncIterator:r,SymbolDispose:s}=Re(),a=We(),{once:u}=Be(),o=Ze(),b=$e(),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:x,ERR_INVALID_RETURN_VALUE:T,ERR_MISSING_ARGS:j,ERR_STREAM_DESTROYED:L,ERR_STREAM_PREMATURE_CLOSE:v},AbortError:A}=je(),{validateFunction:g,validateAbortSignal:_}=ft(),{isIterable:m,isReadable:w,isReadableNodeStream:P,isNodeStream:I,isTransformStream:H,isWebStream:K,isReadableStream:G,isReadableFinished:fe}=De(),F=globalThis.AbortController||ut().AbortController;let C,V,B;function ne(U,oe,ce){let ye=!1;U.on("close",()=>{ye=!0});const pe=a(U,{readable:oe,writable:ce},D=>{ye=!D});return{destroy:D=>{ye||(ye=!0,o.destroyer(U,D||new L("pipe")))},cleanup:pe}}function se(U){return g(U[U.length-1],"streams[stream.length - 1]"),U.pop()}function ue(U){if(m(U))return U;if(P(U))return be(U);throw new x("val",["Readable","Iterable","AsyncIterable"],U)}async function*be(U){V||(V=jt()),yield*V.prototype[r].call(U)}async function W(U,oe,ce,{end:ye}){let pe,D=null;const z=de=>{if(de&&(pe=de),D){const S=D;D=null,S()}},ie=()=>new t((de,S)=>{pe?S(pe):D=()=>{pe?S(pe):de()}});oe.on("drain",z);const he=a(oe,{readable:!1},z);try{oe.writableNeedDrain&&await ie();for await(const de of U)oe.write(de)||await ie();ye&&(oe.end(),await ie()),ce()}catch(de){ce(pe!==de?h(pe,de):de)}finally{he(),oe.off("drain",z)}}async function ae(U,oe,ce,{end:ye}){H(oe)&&(oe=oe.writable);const pe=oe.getWriter();try{for await(const D of U)await pe.ready,pe.write(D).catch(()=>{});await pe.ready,ye&&await pe.close(),ce()}catch(D){try{await pe.abort(D),ce(D)}catch(z){ce(z)}}}function y(...U){return M(U,u(se(U)))}function M(U,oe,ce){if(U.length===1&&e(U[0])&&(U=U[0]),U.length<2)throw new j("streams");const ye=new F,pe=ye.signal,D=ce?.signal,z=[];_(D,"options.signal");function ie(){J(new A)}B=B||Be().addAbortListener;let he;D&&(he=B(D,ie));let de,S;const N=[];let O=0;function ee(Y){J(Y,--O===0)}function J(Y,$){var we;if(Y&&(!de||de.code==="ERR_STREAM_PREMATURE_CLOSE")&&(de=Y),!(!de&&!$)){for(;N.length;)N.shift()(de);(we=he)===null||we===void 0||we[s](),ye.abort(),$&&(de||z.forEach(Ne=>Ne()),l.nextTick(oe,de,S))}}let Z;for(let Y=0;Y<U.length;Y++){const $=U[Y],we=Y<U.length-1,Ne=Y>0,ge=we||ce?.end!==!1,Le=Y===U.length-1;if(I($)){let f=function(n){n&&n.name!=="AbortError"&&n.code!=="ERR_STREAM_PREMATURE_CLOSE"&&ee(n)};if(ge){const{destroy:n,cleanup:i}=ne($,we,Ne);N.push(n),w($)&&Le&&z.push(i)}$.on("error",f),w($)&&Le&&z.push(()=>{$.removeListener("error",f)})}if(Y===0)if(typeof $=="function"){if(Z=$({signal:pe}),!m(Z))throw new T("Iterable, AsyncIterable or Stream","source",Z)}else m($)||P($)||H($)?Z=$:Z=b.from($);else if(typeof $=="function"){if(H(Z)){var R;Z=ue((R=Z)===null||R===void 0?void 0:R.readable)}else Z=ue(Z);if(Z=$(Z,{signal:pe}),we){if(!m(Z,!0))throw new T("AsyncIterable",`transform[${Y-1}]`,Z)}else{var Q;C||(C=_n());const f=new C({objectMode:!0}),n=(Q=Z)===null||Q===void 0?void 0:Q.then;if(typeof n=="function")O++,n.call(Z,E=>{S=E,E!=null&&f.write(E),ge&&f.end(),l.nextTick(ee)},E=>{f.destroy(E),l.nextTick(ee,E)});else if(m(Z,!0))O++,W(Z,f,ee,{end:ge});else if(G(Z)||H(Z)){const E=Z.readable||Z;O++,W(E,f,ee,{end:ge})}else throw new T("AsyncIterable or Promise","destination",Z);Z=f;const{destroy:i,cleanup:d}=ne(Z,!1,!0);N.push(i),Le&&z.push(d)}}else if(I($)){if(P(Z)){O+=2;const f=X(Z,$,ee,{end:ge});w($)&&Le&&z.push(f)}else if(H(Z)||G(Z)){const f=Z.readable||Z;O++,W(f,$,ee,{end:ge})}else if(m(Z))O++,W(Z,$,ee,{end:ge});else throw new x("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Z);Z=$}else if(K($)){if(P(Z))O++,ae(ue(Z),$,ee,{end:ge});else if(G(Z)||m(Z))O++,ae(Z,$,ee,{end:ge});else if(H(Z))O++,ae(Z.readable,$,ee,{end:ge});else throw new x("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],Z);Z=$}else Z=b.from($)}return(pe!=null&&pe.aborted||D!=null&&D.aborted)&&l.nextTick(ie),Z}function X(U,oe,ce,{end:ye}){let pe=!1;if(oe.on("close",()=>{pe||ce(new v)}),U.pipe(oe,{end:!1}),ye){let D=function(){pe=!0,oe.end()};fe(U)?l.nextTick(D):U.once("end",D)}else ce();return a(U,{readable:!0,writable:!1},D=>{const z=U._readableState;D&&D.code==="ERR_STREAM_PREMATURE_CLOSE"&&z&&z.ended&&!z.errored&&!z.errorEmitted?U.once("end",ce).once("error",ce):ce(D)}),a(oe,{readable:!1,writable:!0},ce)}return fr={pipelineImpl:M,pipeline:y},fr}var dr,yn;function gn(){if(yn)return dr;yn=1;const{pipeline:l}=cr(),e=$e(),{destroyer:t}=Ze(),{isNodeStream:r,isReadable:s,isWritable:a,isWebStream:u,isTransformStream:o,isWritableStream:b,isReadableStream:h}=De(),{AbortError:x,codes:{ERR_INVALID_ARG_VALUE:T,ERR_MISSING_ARGS:j}}=je(),L=We();return dr=function(...A){if(A.length===0)throw new j("streams");if(A.length===1)return e.from(A[0]);const g=[...A];if(typeof A[0]=="function"&&(A[0]=e.from(A[0])),typeof A[A.length-1]=="function"){const C=A.length-1;A[C]=e.from(A[C])}for(let C=0;C<A.length;++C)if(!(!r(A[C])&&!u(A[C]))){if(C<A.length-1&&!(s(A[C])||h(A[C])||o(A[C])))throw new T(`streams[${C}]`,g[C],"must be readable");if(C>0&&!(a(A[C])||b(A[C])||o(A[C])))throw new T(`streams[${C}]`,g[C],"must be writable")}let _,m,w,P,I;function H(C){const V=P;P=null,V?V(C):C?I.destroy(C):!F&&!fe&&I.destroy()}const K=A[0],G=l(A,H),fe=!!(a(K)||b(K)||o(K)),F=!!(s(G)||h(G)||o(G));if(I=new e({writableObjectMode:!!(K!=null&&K.writableObjectMode),readableObjectMode:!!(G!=null&&G.readableObjectMode),writable:fe,readable:F}),fe){if(r(K))I._write=function(V,B,ne){K.write(V,B)?ne():_=ne},I._final=function(V){K.end(),m=V},K.on("drain",function(){if(_){const V=_;_=null,V()}});else if(u(K)){const B=(o(K)?K.writable:K).getWriter();I._write=async function(ne,se,ue){try{await B.ready,B.write(ne).catch(()=>{}),ue()}catch(be){ue(be)}},I._final=async function(ne){try{await B.ready,B.close().catch(()=>{}),m=ne}catch(se){ne(se)}}}const C=o(G)?G.readable:G;L(C,()=>{if(m){const V=m;m=null,V()}})}if(F){if(r(G))G.on("readable",function(){if(w){const C=w;w=null,C()}}),G.on("end",function(){I.push(null)}),I._read=function(){for(;;){const C=G.read();if(C===null){w=I._read;return}if(!I.push(C))return}};else if(u(G)){const V=(o(G)?G.readable:G).getReader();I._read=async function(){for(;;)try{const{value:B,done:ne}=await V.read();if(!I.push(B))return;if(ne){I.push(null);return}}catch{return}}}}return I._destroy=function(C,V){!C&&P!==null&&(C=new x),w=null,_=null,m=null,P===null?V(C):(P=V,r(G)&&t(G,C))},I},dr}var wn;function ai(){if(wn)return Tt;wn=1;const l=globalThis.AbortController||ut().AbortController,{codes:{ERR_INVALID_ARG_VALUE:e,ERR_INVALID_ARG_TYPE:t,ERR_MISSING_ARGS:r,ERR_OUT_OF_RANGE:s},AbortError:a}=je(),{validateAbortSignal:u,validateInteger:o,validateObject:b}=ft(),h=Re().Symbol("kWeak"),x=Re().Symbol("kResistStopPropagation"),{finished:T}=We(),j=gn(),{addAbortSignalNoValidate:L}=vt(),{isWritable:v,isNodeStream:A}=De(),{deprecate:g}=Be(),{ArrayPrototypePush:_,Boolean:m,MathFloor:w,Number:P,NumberIsNaN:I,Promise:H,PromiseReject:K,PromiseResolve:G,PromisePrototypeThen:fe,Symbol:F}=Re(),C=F("kEmpty"),V=F("kEof");function B(D,z){if(z!=null&&b(z,"options"),z?.signal!=null&&u(z.signal,"options.signal"),A(D)&&!v(D))throw new e("stream",D,"must be writable");const ie=j(this,D);return z!=null&&z.signal&&L(z.signal,ie),ie}function ne(D,z){if(typeof D!="function")throw new t("fn",["Function","AsyncFunction"],D);z!=null&&b(z,"options"),z?.signal!=null&&u(z.signal,"options.signal");let ie=1;z?.concurrency!=null&&(ie=w(z.concurrency));let he=ie-1;return z?.highWaterMark!=null&&(he=w(z.highWaterMark)),o(ie,"options.concurrency",1),o(he,"options.highWaterMark",0),he+=ie,(async function*(){const S=Be().AbortSignalAny([z?.signal].filter(m)),N=this,O=[],ee={signal:S};let J,Z,R=!1,Q=0;function Y(){R=!0,$()}function $(){Q-=1,we()}function we(){Z&&!R&&Q<ie&&O.length<he&&(Z(),Z=null)}async function Ne(){try{for await(let ge of N){if(R)return;if(S.aborted)throw new a;try{if(ge=D(ge,ee),ge===C)continue;ge=G(ge)}catch(Le){ge=K(Le)}Q+=1,fe(ge,$,Y),O.push(ge),J&&(J(),J=null),!R&&(O.length>=he||Q>=ie)&&await new H(Le=>{Z=Le})}O.push(V)}catch(ge){const Le=K(ge);fe(Le,$,Y),O.push(Le)}finally{R=!0,J&&(J(),J=null)}}Ne();try{for(;;){for(;O.length>0;){const ge=await O[0];if(ge===V)return;if(S.aborted)throw new a;ge!==C&&(yield ge),O.shift(),we()}await new H(ge=>{J=ge})}}finally{R=!0,Z&&(Z(),Z=null)}}).call(this)}function se(D=void 0){return D!=null&&b(D,"options"),D?.signal!=null&&u(D.signal,"options.signal"),(async function*(){let ie=0;for await(const de of this){var he;if(D!=null&&(he=D.signal)!==null&&he!==void 0&&he.aborted)throw new a({cause:D.signal.reason});yield[ie++,de]}}).call(this)}async function ue(D,z=void 0){for await(const ie of y.call(this,D,z))return!0;return!1}async function be(D,z=void 0){if(typeof D!="function")throw new t("fn",["Function","AsyncFunction"],D);return!await ue.call(this,async(...ie)=>!await D(...ie),z)}async function W(D,z){for await(const ie of y.call(this,D,z))return ie}async function ae(D,z){if(typeof D!="function")throw new t("fn",["Function","AsyncFunction"],D);async function ie(he,de){return await D(he,de),C}for await(const he of ne.call(this,ie,z));}function y(D,z){if(typeof D!="function")throw new t("fn",["Function","AsyncFunction"],D);async function ie(he,de){return await D(he,de)?he:C}return ne.call(this,ie,z)}class M extends r{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function X(D,z,ie){var he;if(typeof D!="function")throw new t("reducer",["Function","AsyncFunction"],D);ie!=null&&b(ie,"options"),ie?.signal!=null&&u(ie.signal,"options.signal");let de=arguments.length>1;if(ie!=null&&(he=ie.signal)!==null&&he!==void 0&&he.aborted){const J=new a(void 0,{cause:ie.signal.reason});throw this.once("error",()=>{}),await T(this.destroy(J)),J}const S=new l,N=S.signal;if(ie!=null&&ie.signal){const J={once:!0,[h]:this,[x]:!0};ie.signal.addEventListener("abort",()=>S.abort(),J)}let O=!1;try{for await(const J of this){var ee;if(O=!0,ie!=null&&(ee=ie.signal)!==null&&ee!==void 0&&ee.aborted)throw new a;de?z=await D(z,J,{signal:N}):(z=J,de=!0)}if(!O&&!de)throw new M}finally{S.abort()}return z}async function U(D){D!=null&&b(D,"options"),D?.signal!=null&&u(D.signal,"options.signal");const z=[];for await(const he of this){var ie;if(D!=null&&(ie=D.signal)!==null&&ie!==void 0&&ie.aborted)throw new a(void 0,{cause:D.signal.reason});_(z,he)}return z}function oe(D,z){const ie=ne.call(this,D,z);return(async function*(){for await(const de of ie)yield*de}).call(this)}function ce(D){if(D=P(D),I(D))return 0;if(D<0)throw new s("number",">= 0",D);return D}function ye(D,z=void 0){return z!=null&&b(z,"options"),z?.signal!=null&&u(z.signal,"options.signal"),D=ce(D),(async function*(){var he;if(z!=null&&(he=z.signal)!==null&&he!==void 0&&he.aborted)throw new a;for await(const S of this){var de;if(z!=null&&(de=z.signal)!==null&&de!==void 0&&de.aborted)throw new a;D--<=0&&(yield S)}}).call(this)}function pe(D,z=void 0){return z!=null&&b(z,"options"),z?.signal!=null&&u(z.signal,"options.signal"),D=ce(D),(async function*(){var he;if(z!=null&&(he=z.signal)!==null&&he!==void 0&&he.aborted)throw new a;for await(const S of this){var de;if(z!=null&&(de=z.signal)!==null&&de!==void 0&&de.aborted)throw new a;if(D-- >0&&(yield S),D<=0)return}}).call(this)}return Tt.streamReturningOperators={asIndexedPairs:g(se,"readable.asIndexedPairs will be removed in a future version."),drop:ye,filter:y,flatMap:oe,map:ne,take:pe,compose:B},Tt.promiseReturningOperators={every:be,forEach:ae,reduce:X,toArray:U,some:ue,find:W},Tt}var hr,mn;function xn(){if(mn)return hr;mn=1;const{ArrayPrototypePop:l,Promise:e}=Re(),{isIterable:t,isNodeStream:r,isWebStream:s}=De(),{pipelineImpl:a}=cr(),{finished:u}=We();Sn();function o(...b){return new e((h,x)=>{let T,j;const L=b[b.length-1];if(L&&typeof L=="object"&&!r(L)&&!t(L)&&!s(L)){const v=l(b);T=v.signal,j=v.end}a(b,(v,A)=>{v?x(v):h(A)},{signal:T,end:j})})}return hr={finished:u,pipeline:o},hr}var En;function Sn(){if(En)return Ut.exports;En=1;const{Buffer:l}=Me(),{ObjectDefineProperty:e,ObjectKeys:t,ReflectApply:r}=Re(),{promisify:{custom:s}}=Be(),{streamReturningOperators:a,promiseReturningOperators:u}=ai(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:o}}=je(),b=gn(),{setDefaultHighWaterMark:h,getDefaultHighWaterMark:x}=Nt(),{pipeline:T}=cr(),{destroyer:j}=Ze(),L=We(),v=xn(),A=De(),g=Ut.exports=Xt().Stream;g.isDestroyed=A.isDestroyed,g.isDisturbed=A.isDisturbed,g.isErrored=A.isErrored,g.isReadable=A.isReadable,g.isWritable=A.isWritable,g.Readable=jt();for(const m of t(a)){let P=function(...I){if(new.target)throw o();return g.Readable.from(r(w,this,I))};const w=a[m];e(P,"name",{__proto__:null,value:w.name}),e(P,"length",{__proto__:null,value:w.length}),e(g.Readable.prototype,m,{__proto__:null,value:P,enumerable:!1,configurable:!0,writable:!0})}for(const m of t(u)){let P=function(...I){if(new.target)throw o();return r(w,this,I)};const w=u[m];e(P,"name",{__proto__:null,value:w.name}),e(P,"length",{__proto__:null,value:w.length}),e(g.Readable.prototype,m,{__proto__:null,value:P,enumerable:!1,configurable:!0,writable:!0})}g.Writable=sr(),g.Duplex=$e(),g.Transform=hn(),g.PassThrough=_n(),g.pipeline=T;const{addAbortSignal:_}=vt();return g.addAbortSignal=_,g.finished=L,g.destroy=j,g.compose=b,g.setDefaultHighWaterMark=h,g.getDefaultHighWaterMark=x,e(g,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return v}}),e(T,s,{__proto__:null,enumerable:!0,get(){return v.pipeline}}),e(L,s,{__proto__:null,enumerable:!0,get(){return v.finished}}),g.Stream=g,g._isUint8Array=function(w){return w instanceof Uint8Array},g._uint8ArrayToBuffer=function(w){return l.from(w.buffer,w.byteOffset,w.byteLength)},Ut.exports}var In;function li(){return In||(In=1,(function(l){const e=Sn(),t=xn(),r=e.Readable.destroy;l.exports=e.Readable,l.exports._uint8ArrayToBuffer=e._uint8ArrayToBuffer,l.exports._isUint8Array=e._isUint8Array,l.exports.isDisturbed=e.isDisturbed,l.exports.isErrored=e.isErrored,l.exports.isReadable=e.isReadable,l.exports.Readable=e.Readable,l.exports.Writable=e.Writable,l.exports.Duplex=e.Duplex,l.exports.Transform=e.Transform,l.exports.PassThrough=e.PassThrough,l.exports.addAbortSignal=e.addAbortSignal,l.exports.finished=e.finished,l.exports.destroy=e.destroy,l.exports.destroy=r,l.exports.pipeline=e.pipeline,l.exports.compose=e.compose,Object.defineProperty(e,"promises",{configurable:!0,enumerable:!0,get(){return t}}),l.exports.Stream=e.Stream,l.exports.default=l.exports})($t)),$t.exports}var Rn=li();const pr=Symbol("iter");function ct(l,e,t=4){if(t===0)return Object.assign(l,e);for(const r in e)l[r]=ct(l[r]||Object.create(null),e[r],t-1);return l}function Tn(l,e,t=4){let r=!1;for(const s in l)if(s in e){const a=t===0?null:Tn(l[s],e[s],t-1);if(a!==!1)r=r||Object.create(null),r[s]=a;else if(t===3)return!1}return r}function An(l,e,t=4){let r=!1;for(const s in l)if(!(s in e))r=r||Object.create(null),r[s]=t===0?null:ct({},l[s],t-1);else if(t!==0){const a=An(l[s],e[s],t-1);if(a!==!1)r=r||Object.create(null),r[s]=a;else if(t===3)return!1}return r}class ui{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||ze}_termFromId(e){if(e[0]==="."){const t=this._entities,r=e.split(".");return this._factory.quad(this._termFromId(t[r[1]]),this._termFromId(t[r[2]]),this._termFromId(t[r[3]]),r[4]&&this._termFromId(t[r[4]]))}return it(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){const t=this._termToNumericId(e.subject),r=this._termToNumericId(e.predicate),s=this._termToNumericId(e.object);let a;return t&&r&&s&&(Ot(e.graph)||(a=this._termToNumericId(e.graph)))&&this._ids[a?`.${t}.${r}.${s}.${a}`:`.${t}.${r}.${s}`]}return this._ids[Xe(e)]}_termToNewNumericId(e){const t=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${Ot(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Xe(e);return this._ids[t]||(this._ids[this._entities[++this._id]=t]=this._id)}createBlankNode(e){let t,r;if(e)for(t=e=`_:${e}`,r=1;this._ids[t];)t=e+r++;else do t=`_:b${this._blankNodeIndex++}`;while(this._ids[t]);return this._ids[t]=++this._id,this._entities[this._id]=t,this._factory.blankNode(t.substr(2))}}class Fe{constructor(e,t){this._size=0,this._graphs=Object.create(null),!t&&e&&!e[0]&&typeof e.match!="function"&&(t=e,e=null),t=t||{},this._factory=t.factory||ze,this._entityIndex=t.entityIndex||new ui({factory:this._factory}),this._entities=this._entityIndex._entities,this._termFromId=this._entityIndex._termFromId.bind(this._entityIndex),this._termToNumericId=this._entityIndex._termToNumericId.bind(this._entityIndex),this._termToNewNumericId=this._entityIndex._termToNewNumericId.bind(this._entityIndex),e&&this.addAll(e)}get size(){let e=this._size;if(e!==null)return e;e=0;const t=this._graphs;let r,s;for(const a in t)for(const u in r=t[a].subjects)for(const o in s=r[u])e+=Object.keys(s[o]).length;return this._size=e}_addToIndex(e,t,r,s){const a=e[t]||(e[t]={}),u=a[r]||(a[r]={}),o=s in u;return o||(u[s]=null),!o}_removeFromIndex(e,t,r,s){const a=e[t],u=a[r];delete u[s];for(const o in u)return;delete a[r];for(const o in a)return;delete e[t]}*_findInIndex(e,t,r,s,a,u,o,b){let h,x,T;const j=this._entities,L=this._termFromId(j[b]),v={subject:null,predicate:null,object:null};t&&((h=e,e={})[t]=h[t]);for(const A in e)if(x=e[A]){v[a]=this._termFromId(j[A]),r&&((h=x,x={})[r]=h[r]);for(const g in x)if(T=x[g]){v[u]=this._termFromId(j[g]);const _=s?s in T?[s]:[]:Object.keys(T);for(let m=0;m<_.length;m++)v[o]=this._termFromId(j[_[m]]),yield this._factory.quad(v.subject,v.predicate,v.object,L)}}}_loop(e,t){for(const r in e)t(r)}_loopByKey0(e,t,r){let s,a;if(s=e[t])for(a in s)r(a)}_loopByKey1(e,t,r){let s,a;for(s in e)a=e[s],a[t]&&r(s)}_loopBy2Keys(e,t,r,s){let a,u,o;if((a=e[t])&&(u=a[r]))for(o in u)s(o)}_countInIndex(e,t,r,s){let a=0,u,o,b;t&&((u=e,e={})[t]=u[t]);for(const h in e)if(o=e[h]){r&&((u=o,o={})[r]=u[r]);for(const x in o)(b=o[x])&&(s?s in b&&a++:a+=Object.keys(b).length)}return a}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){const t=Object.create(null);return r=>{r in t||(t[r]=!0,e(this._termFromId(this._entities[r],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,t,r,s){t||(s=e.graph,r=e.object,t=e.predicate,e=e.subject),s=s?this._termToNewNumericId(s):1;let a=this._graphs[s];return a||(a=this._graphs[s]={subjects:{},predicates:{},objects:{}},Object.freeze(a)),e=this._termToNewNumericId(e),t=this._termToNewNumericId(t),r=this._termToNewNumericId(r),this._addToIndex(a.subjects,e,t,r)?(this._addToIndex(a.predicates,t,r,e),this._addToIndex(a.objects,r,e,t),this._size=null,!0):!1}addQuads(e){for(let t=0;t<e.length;t++)this.addQuad(e[t])}delete(e){return this.removeQuad(e),this}has(e,t,r,s){return e&&e.subject&&({subject:e,predicate:t,object:r,graph:s}=e),!this.readQuads(e,t,r,s).next().done}import(e){return e.on("data",t=>{this.addQuad(t)}),e}removeQuad(e,t,r,s){t||({subject:e,predicate:t,object:r,graph:s}=e),s=s?this._termToNumericId(s):1;const a=this._graphs;let u,o,b;if(!(e=e&&this._termToNumericId(e))||!(t=t&&this._termToNumericId(t))||!(r=r&&this._termToNumericId(r))||!(u=a[s])||!(o=u.subjects[e])||!(b=o[t])||!(r in b))return!1;this._removeFromIndex(u.subjects,e,t,r),this._removeFromIndex(u.predicates,t,r,e),this._removeFromIndex(u.objects,r,e,t),this._size!==null&&this._size--;for(e in u.subjects)return!0;return delete a[s],!0}removeQuads(e){for(let t=0;t<e.length;t++)this.removeQuad(e[t])}remove(e){return e.on("data",t=>{this.removeQuad(t)}),e}removeMatches(e,t,r,s){const a=new Rn.Readable({objectMode:!0}),u=this.readQuads(e,t,r,s);return a._read=o=>{for(;--o>=0;){const{done:b,value:h}=u.next();if(b){a.push(null);return}a.push(h)}},this.remove(a)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,t,r,s){return[...this.readQuads(e,t,r,s)]}*readQuads(e,t,r,s){const a=this._getGraphs(s);let u,o,b,h;if(!(e&&!(o=this._termToNumericId(e))||t&&!(b=this._termToNumericId(t))||r&&!(h=this._termToNumericId(r))))for(const x in a)(u=a[x])&&(o?h?yield*this._findInIndex(u.objects,h,o,b,"object","subject","predicate",x):yield*this._findInIndex(u.subjects,o,b,null,"subject","predicate","object",x):b?yield*this._findInIndex(u.predicates,b,h,null,"predicate","object","subject",x):h?yield*this._findInIndex(u.objects,h,null,null,"object","subject","predicate",x):yield*this._findInIndex(u.subjects,null,null,null,"subject","predicate","object",x))}match(e,t,r,s){return new qe(this,e,t,r,s,{entityIndex:this._entityIndex})}countQuads(e,t,r,s){const a=this._getGraphs(s);let u=0,o,b,h,x;if(e&&!(b=this._termToNumericId(e))||t&&!(h=this._termToNumericId(t))||r&&!(x=this._termToNumericId(r)))return 0;for(const T in a)(o=a[T])&&(e?r?u+=this._countInIndex(o.objects,x,b,h):u+=this._countInIndex(o.subjects,b,h,x):t?u+=this._countInIndex(o.predicates,h,x,b):u+=this._countInIndex(o.objects,x,b,h));return u}forEach(e,t,r,s,a){this.some(u=>(e(u,this),!1),t,r,s,a)}every(e,t,r,s,a){return!this.some(u=>!e(u,this),t,r,s,a)}some(e,t,r,s,a){for(const u of this.readQuads(t,r,s,a))if(e(u,this))return!0;return!1}getSubjects(e,t,r){const s=[];return this.forSubjects(a=>{s.push(a)},e,t,r),s}forSubjects(e,t,r,s){const a=this._getGraphs(s);let u,o,b;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||r&&!(b=this._termToNumericId(r))))for(s in a)(u=a[s])&&(o?b?this._loopBy2Keys(u.predicates,o,b,e):this._loopByKey1(u.subjects,o,e):b?this._loopByKey0(u.objects,b,e):this._loop(u.subjects,e))}getPredicates(e,t,r){const s=[];return this.forPredicates(a=>{s.push(a)},e,t,r),s}forPredicates(e,t,r,s){const a=this._getGraphs(s);let u,o,b;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||r&&!(b=this._termToNumericId(r))))for(s in a)(u=a[s])&&(o?b?this._loopBy2Keys(u.objects,b,o,e):this._loopByKey0(u.subjects,o,e):b?this._loopByKey1(u.predicates,b,e):this._loop(u.predicates,e))}getObjects(e,t,r){const s=[];return this.forObjects(a=>{s.push(a)},e,t,r),s}forObjects(e,t,r,s){const a=this._getGraphs(s);let u,o,b;if(e=this._uniqueEntities(e),!(t&&!(o=this._termToNumericId(t))||r&&!(b=this._termToNumericId(r))))for(s in a)(u=a[s])&&(o?b?this._loopBy2Keys(u.subjects,o,b,e):this._loopByKey1(u.objects,o,e):b?this._loopByKey0(u.predicates,b,e):this._loop(u.objects,e))}getGraphs(e,t,r){const s=[];return this.forGraphs(a=>{s.push(a)},e,t,r),s}forGraphs(e,t,r,s){for(const a in this._graphs)this.some(u=>(e(u.graph),!0),t,r,s,this._termFromId(this._entities[a]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:t=!1}={}){const r={},s=t?(()=>!0):((o,b)=>{throw new Error(`${o.value} ${b}`)}),a=this.getQuads(null,ve.rdf.rest,ve.rdf.nil,null),u=e?[...a]:[];return a.forEach(o=>{const b=[];let h=!1,x,T;const j=o.graph;let L=o.subject;for(;L&&!h;){const v=this.getQuads(null,null,L,null),A=this.getQuads(L,null,null,null);let g,_=null,m=null,w=null;for(let P=0;P<A.length&&!h;P++)g=A[P],g.graph.equals(j)?x?h=s(L,"has non-list arcs out"):g.predicate.value===ve.rdf.first?_?h=s(L,"has multiple rdf:first arcs"):u.push(_=g):g.predicate.value===ve.rdf.rest?m?h=s(L,"has multiple rdf:rest arcs"):u.push(m=g):v.length?h=s(L,"can't be subject and object"):(x=g,T="subject"):h=s(L,"not confined to single graph");for(let P=0;P<v.length&&!h;++P)g=v[P],x?h=s(L,"can't have coreferences"):g.predicate.value===ve.rdf.rest?w?h=s(L,"has incoming rdf:rest arcs"):w=g:(x=g,T="object");_?b.unshift(_.object):h=s(L,"has no list head"),L=w&&w.subject}h?e=!1:x&&(r[x[T].value]=b)}),e&&this.removeQuads(u),r}addAll(e){if(e instanceof qe&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof Fe&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=ct(this._graphs,e._graphs),this._size=null);else for(const t of e)this.add(t);return this}contains(e){if(e instanceof qe&&(e=e.filtered),e===this)return!0;if(!(e instanceof Fe)||this._entityIndex!==e._entityIndex)return e.every(h=>this.has(h));const t=this._graphs,r=e._graphs;let s,a,u,o,b;for(const h in r){if(!(s=t[h]))return!1;s=s.subjects;for(const x in a=r[h].subjects){if(!(u=s[x]))return!1;for(const T in o=a[x]){if(!(b=u[T]))return!1;for(const j in o[T])if(!(j in b))return!1}}}return!0}deleteMatches(e,t,r,s){for(const a of this.match(e,t,r,s))this.removeQuad(a);return this}difference(e){if(e&&e instanceof qe&&(e=e.filtered),e===this)return new Fe({entityIndex:this._entityIndex});if(e instanceof Fe&&e._entityIndex===this._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),r=An(this._graphs,e._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter(t=>!e.has(t))}equals(e){return e instanceof qe&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){const t=new Fe({entityIndex:this._entityIndex});for(const r of this)e(r,this)&&t.add(r);return t}intersection(e){if(e instanceof qe&&(e=e.filtered),e===this){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=ct(Object.create(null),this._graphs),t._size=this._size,t}else if(e instanceof Fe&&this._entityIndex===e._entityIndex){const t=new Fe({entityIndex:this._entityIndex}),r=Tn(e._graphs,this._graphs);return r&&(t._graphs=r,t._size=null),t}return this.filter(t=>e.has(t))}map(e){const t=new Fe({entityIndex:this._entityIndex});for(const r of this)t.add(e(r,this));return t}reduce(e,t){const r=this.readQuads();let s=t===void 0?r.next().value:t;for(const a of r)s=e(s,a,this);return s}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new Dr().quadsToString(this)}union(e){const t=new Fe({entityIndex:this._entityIndex});return t._graphs=ct(Object.create(null),this._graphs),t._size=this._size,t.addAll(e),t}*[Symbol.iterator](){yield*this.readQuads()}}function Oe(l,e,t=0){const r=e[t];if(r&&!(r in l))return!1;let s=!1;for(const a in r?{[r]:l[r]}:l){const u=t===2?null:Oe(l[a],e,t+1);u!==!1&&(s=s||Object.create(null),s[a]=u)}return s}class qe extends Rn.Readable{constructor(e,t,r,s,a,u){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:t,predicate:r,object:s,graph:a,options:u})}get filtered(){if(!this._filtered){const{n3Store:e,graph:t,object:r,predicate:s,subject:a}=this,u=this._filtered=new Fe({factory:e._factory,entityIndex:this.options.entityIndex});let o,b,h;if(a&&!(o=u._termToNumericId(a))||s&&!(b=u._termToNumericId(s))||r&&!(h=u._termToNumericId(r)))return u;const x=e._getGraphs(t);for(const T in x){let j,L,v,A;(A=x[T])&&(!o&&b?(L=Oe(A.predicates,[b,h,o]))&&(j=Oe(A.subjects,[o,b,h]),v=Oe(A.objects,[h,o,b])):h?(v=Oe(A.objects,[h,o,b]))&&(j=Oe(A.subjects,[o,b,h]),L=Oe(A.predicates,[b,h,o])):(j=Oe(A.subjects,[o,b,h]))&&(L=Oe(A.predicates,[b,h,o]),v=Oe(A.objects,[h,o,b])),j&&(u._graphs[T]={subjects:j,predicates:L,objects:v}))}u._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[pr]&&(this[pr]=this[Symbol.iterator]());const t=this[pr];for(;--e>=0;){const{done:r,value:s}=t.next();if(r){this.push(null);return}this.push(s)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,t,r,s){return this.filtered.deleteMatches(e,t,r,s)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,t,r,s,a){return this.filtered.every(e,t,r,s,a)}filter(e){return this.filtered.filter(e)}forEach(e,t,r,s,a){return this.filtered.forEach(e,t,r,s,a)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,t,r,s,a){return this.filtered.some(e,t,r,s,a)}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 Dr().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,t,r,s){return new qe(this.filtered,e,t,r,s,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}}const Lt={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#"},Te={namespace:"https://prez.dev/",label:"https://prez.dev/label",description:"https://prez.dev/description",provenance:"https://prez.dev/provenance",focusNode:"https://prez.dev/FocusNode",link:"https://prez.dev/link",members:"https://prez.dev/members",identifier:"https://prez.dev/identifier",count:"https://prez.dev/count",searchResult:"https://prez.dev/SearchResult",searchResultWeight:"https://prez.dev/searchResultWeight",searchResultPredicate:"https://prez.dev/searchResultPredicate",searchResultURI:"https://prez.dev/searchResultURI",searchResultMatch:"https://prez.dev/searchResultMatch",hasChildren:"https://prez.dev/hasChildren",facetCount:"https://prez.dev/facetCount",facetName:"https://prez.dev/facetName",facetValue:"https://prez.dev/facetValue",profile:"https://prez.dev/profile"},Ae={skosConceptScheme:"http://www.w3.org/2004/02/skos/core#ConceptScheme",skosConcept:"http://www.w3.org/2004/02/skos/core#Concept",a:"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",rdfLangString:"http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",xmlString:"http://www.w3.org/2001/XMLSchema#string",w3Html:"http://www.w3.org/1999/02/22-rdf-syntax-ns#HTML",w3Markdown:"https://www.w3.org/ns/iana/media-types/text/markdown",w3token:"http://www.w3.org/2001/XMLSchema#token",shaclAllPredicates:"http://example.com/shacl-extension#allPredicateValues",shaclPathAlias:"http://example.com/shacl-extension#pathAlias",shaclProperty:"http://www.w3.org/ns/shacl#property",shaclPath:"http://www.w3.org/ns/shacl#path",shaclUnion:"http://www.w3.org/ns/shacl#union",dctermsIdentifier:"http://purl.org/dc/terms/identifier"},fi={label:["https://prez.dev/label"],description:["https://prez.dev/description"],provenance:["https://prez.dev/provenance"]};function vn(l,e=Lt){if(l==="a")return e.rdf+"type";{const[t,r]=l.split(":");return t?[t]+r:l}}function Nn(l,e=Lt){let t="";return Object.entries(e).forEach(([r,s])=>{l.startsWith(s)&&(t=r+":"+l.split(s)[1])}),t}const Pn=l=>{const e=new URL(l);return`${e.protocol}//${e.hostname}`},ci=l=>new URL(l).pathname,di=(l,e)=>{const t=e.identifiers?.find(r=>r.value)?.value;return t?l+`/concept-hierarchy/${t}/narrowers`:""},hi=(l,e)=>{const t=e?Pn(e):"",r=l.identifiers?.find(u=>u.value),s=r?r.value:"";return s?t+`/concept-hierarchy/${s}/top-concepts`:""},Bt=l=>l.flatMap(e=>e["@id"]?e["@id"]:e["@list"]&&e["@list"].length>0?e["@list"][0]?.["@id"]===Ae.shaclUnion?Bt(e["@list"][1]?.["@list"]||[]).filter(Boolean):Bt(e["@list"]).flat():[]).filter(e=>!!e),pi=l=>l.reduce((e,t)=>{if(Ae.shaclProperty in t)for(const r of t[Ae.shaclProperty]){const s=l.find(a=>a["@id"]===r["@id"]);s&&Ae.shaclPath in s&&(e[t["@id"]]=Bt(s[Ae.shaclPath]).filter(a=>a!==Ae.shaclAllPredicates))}return e},{});function dt(l){if(Array.isArray(l))return l.reduce((e,t)=>{const r=dt(t);return typeof r=="object"&&!Array.isArray(r)&&Object.assign(e,r),e},{});if(typeof l=="object"&&l!==null){if(l.hasOwnProperty("value"))return l.value;if(l.hasOwnProperty("node")&&l.hasOwnProperty("list")){const e={};return e[l.node.value]=l.list.length>0?dt(l.list):"",e}else{const e={};for(const t in l)e[t]=dt(l[t]);return e}}return l}function _r(l,e=""){let t="";const r=Object.entries(l),s=r.length;return r.forEach(([a,u],o)=>{const b=a.replace(/https?:\/\/(www\.)?/,""),[h,x]=b.split("#"),T=h.split("/"),j=T[T.length-1],L=x?`(${T[0]})/${j}#${x}`:`(${T[0]})/${j}`,v=o===s-1;t+=`${e}${v?"└── ":"├── "}${L}
|
|
28
|
+
`,typeof u=="object"&&u!==null&&(t+=_r(u,e+(v?" ":"│ ")))}),t}function _i(l){return l?_r(dt(l)):""}const{namedNode:ht}=ze;class pt{store;parser;prefixes;basePath;baseUrl;linkedLists;lists;processedTerms;constructor(){this.store=new Fe,this.baseUrl="",this.basePath="",this.parser=new Br,this.prefixes=Lt,this.linkedLists={},this.lists={},this.processedTerms=new Set}load(e){this.processedTerms.clear(),e=`PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
|
29
|
+
`+e;const t=this.parser.parse(e,null,(r,s)=>{this.prefixes[r]=s.value});this.store.addQuads(t),this.linkedLists=this.store.extractLists(),this.buildLists()}buildLists(){this.lists={};const e=this.linkedLists;this.store.getQuads(null,Ae.shaclPath,null,null).forEach(t=>{const r=t.object;if(r.termType==="BlankNode"){const s=this.store.getQuads(r,Ae.shaclUnion,null,null);if(s.length>0){const a=s[0].object;if(a.termType==="BlankNode"&&a.value in e){const u=e[a.value],o=r.value;this.lists[o]=this.buildSubList(u)}else console.warn(`[buildLists] Found sh:union for ${r.value}, but its object ${a.value} is not a valid list head in linkedLists.`)}}})}buildSubList(e){const t=[];for(const r of e)if(r.termType=="BlankNode"){const s=r.value;if(s in this.linkedLists){const a=this.buildSubList(this.linkedLists[s]);if(a.length>1){const u=t.find(o=>o.node.value==a[0].node.value);u?(u.list??=[]).push(...a.slice(1)):t.push({node:a[0].node,list:a.slice(1)})}else t.push(...a)}else{const a=this.store.getObjects(r,Ae.shaclPathAlias,null)?.[0];if(a){const u=this.toPrezTerm(a);t.push({node:u,list:[]})}}}else if(r.termType=="NamedNode"&&r.value!=Ae.shaclUnion){const s=this.toPrezTerm(r);t.push({node:s,list:[]})}return t}setBaseUrl(e){this.baseUrl=e,this.basePath=new URL(e).pathname}toIri(e){return vn(e,this.prefixes)}fromIri(e){return Nn(e,this.prefixes)}getObjectLiteral(e,t){return this.getObjects(e,t).map(r=>this.toPrezTerm(r))[0]||void 0}getProperties(e,t){const r={};return this.store.forEach(s=>{t?.excludePrefix&&s.predicate.value.startsWith(t.excludePrefix)||t?.includePrefix&&!s.predicate.value.startsWith(t.includePrefix)||(r[s.predicate.value]??={predicate:this.toPrezTerm(s.predicate),objects:[]},r[s.predicate.value].objects.push(this.toPrezTerm(s.object)))},e,null,null,null),e.termType,r}getParents(e){e.startsWith(this.basePath)&&(e=e.substring(this.basePath.length));const t=e.split("/"),r=[];let s="";for(const a of t){if(a=="")continue;s+="/"+a;const u={url:s,segment:a};if(a.includes(":")){const o=a.split(":"),b=this.prefixes[o[0]];if(b){const h=this.getObjects(b+o[1],Te.label);h.length>0&&(u.label=yt(h[0].value))}}r.push(u)}return r}toPrezTerm(e){const t=`${e.termType}:${e.value}`;if(this.processedTerms.has(t))switch(e.termType){case"NamedNode":return Ft(e.value);case"Literal":return yt(e.value);case"BlankNode":return gt(e.value);default:throw new Error("Invalid n3 Term object")}this.processedTerms.add(t);try{switch(e.termType){case"NamedNode":const r=Ft(e.value);r.label=this.getObjectLiteral(e.value,Te.label),r.description=this.getObjectLiteral(e.value,Te.description),r.provenance=this.getObjectLiteral(e.value,Te.provenance);const s=this.getObjects(e.value,Te.identifier);s.length>0&&(r.identifiers=s.map(x=>this.toPrezTerm(x)));const a=this.getObjects(e.value,Te.link);a.length>0&&(r.links=a.map(x=>({value:x.value,parents:this.getParents(x.value)})));const u=this.getObjects(e.value,Te.members);u.length>0&&(r.members={value:u[0].value,parents:this.getParents(u[0].value)});const o=this.getObjects(e.value,Ae.a);return o.length>0&&(r.rdfTypes=o.map(x=>this.toPrezTerm(x))),r;case"Literal":const b=yt(e.value);return e.datatype&&(b.datatype=this.toPrezTerm(e.datatype)),e.language&&(b.language=e.language),b;case"BlankNode":const h=gt(e.value);return h.properties=this.getProperties(e,void 0),e.value in this.lists&&(h.list=this.lists[e.value]),h;default:throw"Invalid n3 Term object"}}finally{this.processedTerms.delete(t)}}toPrezFocusNode(e){const t=this.toPrezTerm(e);return t.properties=this.getProperties(e,{excludePrefix:Te.namespace}),t.systemProperties=this.getProperties(e,{includePrefix:Te.namespace}),t.rdfTypes?.map(r=>r.value).includes(Ae.skosConcept)&&(t.hasChildren=t.systemProperties?.[Te.hasChildren]?.objects?.[0]?.value=="true"),t}getSubjects(e,t){return this.store.getSubjects(e,t,null)}getObjects(e,t){if(typeof t=="string")return this.store.getObjects(ht(e),ht(t),null);{const r=[];return t.forEach(s=>{r.push(...this.store.getObjects(ht(e),ht(s),null))}),r}}getMembers(e){this.getObjects(e,this.toIri("prez:members")).forEach(r=>({value:r.value,parents:[]}))}getConcepts(e){const t=this.getSubjects(this.toIri("skos:inScheme"),e.value);function r(h){return t.map(x=>x.value).includes(h.value)}const s=this.getObjects(e.value,this.toIri("skos:hasTopConcept")),a=this.getObjects(e.value,this.toIri("skos:topConceptOf")),u={},o=[...s,...a].filter(h=>r(h));t.forEach(h=>{u[h.value]=[]}),t.forEach(h=>{this.getObjects(h.value,this.toIri("skos:broader")).forEach(j=>{r(j)&&u[j.value].push(h)}),this.getObjects(h.value,this.toIri("skos:narrower")).forEach(j=>{r(j)&&u[h.value].push(j)})});const b=[];return o.forEach(h=>{b.push(this.createHierarchy(h,u))}),b}createHierarchy(e,t){const r=t[e.value].map(s=>this.createHierarchy(s,t));return{...this.toPrezTerm(e),hasChildren:r.length>0,narrowers:r}}getByPrezId(e){const t=[];return this.store.forEach(r=>{t.push(r)},null,null,ht("https://prez.dev/FocusNode"),null),e?t.find(r=>r.object.value===e).subject:t.map(r=>r.subject)}getCount(){const e=this.store.getObjects(null,Te.count,null);return e.length>0?Number(e[0].value.replace(">","")):0}getMaxReached(){const e=this.store.getObjects(null,Te.count,null);return e.length>0?!e[0].value.includes(">"):!1}getList(){const e=[];return this.getByPrezId().forEach(r=>{e.push(this.toPrezFocusNode(r))}),e}getSkosCollections(e){const t=this.getSubjects("http://www.w3.org/2004/02/skos/core#inScheme",e.value);return this.getSubjects("http://www.w3.org/1999/02/22-rdf-syntax-ns#type","http://www.w3.org/2004/02/skos/core#Collection").filter(a=>t.find(u=>u.value===a.value)).map(a=>this.toPrezTerm(a)).sort((a,u)=>a.label&&u.label?a.label.value.localeCompare(u.label.value):a.label?-1:u.label?1:a.value.localeCompare(u.value))}getItem(){const e=this.getByPrezId();if(e.length==0)throw new Error("Unable to find item");const t=this.toPrezFocusNode(e[0]);if(t.rdfTypes?.map(r=>r.value).includes(Ae.skosConceptScheme)){const r=this.getSkosCollections(e[0]);return{...t,collections:r}}return t}getSubItems(e){const t=this.store.getQuads(null,e,null,null),r=[];return t.forEach(s=>{const a=this.toPrezFocusNode(s.object);a&&r.push(a)}),r}search(){return this.getSubjects(Ae.a,Te.searchResult).map(r=>({hash:r.value.split("urn:hash:").slice(-1)[0],weight:Number(this.getObjects(r.value,Te.searchResultWeight)[0].value),predicate:this.toPrezTerm(this.getObjects(r.value,Te.searchResultPredicate)[0]),match:this.toPrezTerm(this.getObjects(r.value,Te.searchResultMatch)[0]),resource:this.toPrezFocusNode(this.getObjects(r.value,Te.searchResultURI)[0])}))}getFacets(){const e=[];return this.store.getQuads(null,Te.facetName,null,null).forEach(t=>{if(t.subject.termType=="BlankNode"){const r=gt(t.subject.value);r.properties=this.getProperties(t.subject);const s=Number(r.properties?.[Te.facetCount]?.objects?.[0].value)||0,a=r.properties?.[Te.facetName]?.objects?.[0],u=r.properties?.[Te.facetValue]?.objects?.[0],o=a,b=e.find(h=>h.facetName.value==o?.value);if(s>0&&o!==void 0&&u!==void 0){const h=this.toPrezTerm(u);if(h.termType==="Literal"||h.termType==="NamedNode"){const x={term:h,count:s};b?b.facetValues.push(x):e.push({facetName:o,facetValues:[x]})}}}}),e}}class bi extends Error{constructor(e){super(e),this.name="NetworkError"}}function yi(l){let e={};const t=l.split(",").map(s=>{const[,a,u]=s.trim().match(/<(.+)>; (.+)/),o={uri:a};return u.split("; ").forEach(b=>{const[,h,x]=b.match(/(.+)=[\"<](.+)[\">]/);o[h]=x}),o});t.filter(s=>s.rel==="type").forEach(s=>{e[s.anchor]={default:!1,current:!1,token:s.token,mediatypes:[],title:s.title,description:"",uri:s.anchor}});const r=t.find(s=>s.rel==="self");return r.format in e&&(e[r.format].current=!0),t.filter(s=>s.rel==="alternate"&&s.format).forEach(s=>{e[s.format].mediatypes.map(a=>a.mediatype).includes(s.type)||e[s.format].mediatypes.push({title:"",mediatype:s.type,default:!1})}),Object.values(e)}async function _t(l){const e=await fetch(l,{method:"GET",headers:{Accept:"text/anot+turtle"}});if(!e.ok)throw new bi(`Network error - status code ${e.status}: ${e.statusText}`);const t=e.headers.get("link")||e.headers.get("Link"),r=t?yi(t):[];return{data:await e.text(),profiles:r}}async function gi(l,e){const t=l+e,r=new URL(t).pathname,{data:s,profiles:a}=await _t(t),u=new pt;return u.setBaseUrl(l),u.load(s),{type:"list",data:u.getList(),profiles:a,maxReached:u.getMaxReached(),count:u.getCount(),parents:u.getParents(r),facets:u.getFacets()}}async function wi(l,e){const t=l+e,r=new URL(t).pathname,{data:s,profiles:a}=await _t(t),u=new pt;return u.setBaseUrl(l),u.load(s),{type:"item",data:u.getItem(),profiles:a,parents:u.getParents(r),store:u,facets:u.getFacets()}}async function mi(l,e){const t=l+e,r=new URL(t).pathname,{data:s,profiles:a}=await _t(t),u=new pt;return u.setBaseUrl(l),u.load(s),{type:"search",data:u.search(),profiles:a,maxReached:u.getMaxReached(),count:u.getCount(),parents:u.getParents(r),facets:u.getFacets()}}async function xi(l){const e=l+"/profiles?page=1&limit=999&_mediatype=application/anot%2Bturtle",{data:t}=await _t(e),r=new pt;r.setBaseUrl(l),r.load(t);const s=r.getList(),a={};for(const u of s){let o=[];if(u.properties&&u.properties?.[Ae.shaclProperty]?.objects){const b=u.properties[Ae.shaclProperty].objects;for(const h of b){const x=h;if(x.properties&&x.properties[Ae.shaclPath])for(const T of x.properties[Ae.shaclPath].objects){const j=T.list;j&&(o=j)}}}u.properties?.[Ae.dctermsIdentifier]?.objects?.filter(b=>b?.termType=="Literal"&&b?.datatype?.value==Ae.w3token)?.map(b=>b.value).forEach(b=>{a[b]=o,a[u.value]=o;const h=r.fromIri(u.value);h!=u.value&&(a[h]=o)})}return a}function Ei(l,e){const t={},r=Object.keys(l),s=[...(e||[]).filter(a=>r.includes(a.node.value)).map(a=>a.node.value),...r.filter(a=>!(e||[]).find(u=>u.node.value==a))].filter(a=>a in(l||{})).map(a=>l[a]);for(const a of s)e.find(u=>u.node.value==a.predicate.value&&u.list&&u.list.length>0),t[a.predicate.value]=l[a.predicate.value];return t}function Si(l,e){l.data.properties=Ei(l.data.properties||{},e)}me.ANNOTATION_PREDICATES=fi,me.DEFAULT_PREFIXES=Lt,me.PREZ_PREDICATES=Te,me.RDFStore=pt,me.SYSTEM_PREDICATES=Ae,me.apiGet=_t,me.applyProfileToItem=Si,me.bnode=gt,me.buildProfiles=pi,me.defaultFromIri=Nn,me.defaultToIri=vn,me.dumpNodeArray=_i,me.getBaseUrl=Pn,me.getItem=wi,me.getList=gi,me.getNarrowersUrl=di,me.getProfiles=xi,me.getTopConceptsUrl=hi,me.getUrlPath=ci,me.isTypePrezTerm=et,me.literal=yt,me.node=Ft,me.nodeArrayToTree=_r,me.processShaclPath=Bt,me.search=mi,me.simplifyNodeArray=dt,Object.defineProperty(me,Symbol.toStringTag,{value:"Module"})}));
|