n3 2.11.2 → 3.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,26 @@
1
- var kl=Object.create;var ir=Object.defineProperty,ql=Object.defineProperties,Ul=Object.getOwnPropertyDescriptor,Wl=Object.getOwnPropertyDescriptors,Gl=Object.getOwnPropertyNames,Fn=Object.getOwnPropertySymbols,Ql=Object.getPrototypeOf,On=Object.prototype.hasOwnProperty,zl=Object.prototype.propertyIsEnumerable;var ot=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Vl=t=>{throw TypeError(t)};var Cn=(t,e,r)=>e in t?ir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,D=(t,e)=>{for(var r in e||(e={}))On.call(e,r)&&Cn(t,r,e[r]);if(Fn)for(var r of Fn(e))zl.call(e,r)&&Cn(t,r,e[r]);return t},Be=(t,e)=>ql(t,Wl(e));var A=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Hl=(t,e)=>{for(var r in e)ir(t,r,{get:e[r],enumerable:!0})},Kl=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Gl(e))!On.call(t,n)&&n!==r&&ir(t,n,{get:()=>e[n],enumerable:!(i=Ul(e,n))||i.enumerable});return t};var nr=(t,e,r)=>(r=t!=null?kl(Ql(t)):{},Kl(e||!t||!t.__esModule?ir(r,"default",{value:t,enumerable:!0}):r,t));var G=function(t,e){this[0]=t,this[1]=e},ee=(t,e,r)=>{var i=(a,l,u,c)=>{try{var f=r[a](l),h=(l=f.value)instanceof G,d=f.done;Promise.resolve(h?l[0]:l).then(_=>h?i(a==="return"?a:"next",l[1]?{done:_.done,value:_.value}:_,u,c):u({value:_,done:d})).catch(_=>i("throw",_,u,c))}catch(_){c(_)}},n=(a,l,u,c)=>o[a]=f=>(l=new Promise((h,d,_)=>(_=()=>i(a,f,h,d),s?s.then(_):_())),c=()=>s===u&&(s=0),s=u=l.then(c,c),l),s,o={};return r=r.apply(t,e),o[ot("asyncIterator")]=()=>o,n("next"),n("throw"),n("return"),o},ne=t=>{var e=t[ot("asyncIterator")],r=!1,i,n={};return e==null?(e=t[ot("iterator")](),i=s=>n[s]=o=>e[s](o)):(e=e.call(t),i=s=>n[s]=o=>{if(r){if(r=!1,s==="throw")throw o;return o}return r=!0,{done:!1,value:new G(new Promise(a=>{var l=e[s](o);l instanceof Object||Vl("Object expected"),a(l)}),1)}}),n[ot("iterator")]=()=>n,i("next"),"throw"in e?i("throw"):n.throw=s=>{throw s},"return"in e&&i("return"),n},Y=(t,e,r)=>(e=t[ot("asyncIterator")])?e.call(t):(t=t[ot("iterator")](),e={},r=(i,n)=>(n=t[i])&&(e[i]=s=>new Promise((o,a,l)=>(s=n.call(t,s),l=s.done,Promise.resolve(s.value).then(u=>o({value:u,done:l}),a)))),r("next"),r("return"),e);var $n=A(sr=>{"use strict";sr.byteLength=Zl;sr.toByteArray=Jl;sr.fromByteArray=ru;var ae=[],te=[],Yl=typeof Uint8Array!="undefined"?Uint8Array:Array,Jr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ue=0,Dn=Jr.length;Ue<Dn;++Ue)ae[Ue]=Jr[Ue],te[Jr.charCodeAt(Ue)]=Ue;var Ue,Dn;te[45]=62;te[95]=63;function Mn(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Zl(t){var e=Mn(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Xl(t,e,r){return(e+r)*3/4-r}function Jl(t){var e,r=Mn(t),i=r[0],n=r[1],s=new Yl(Xl(t,i,n)),o=0,a=n>0?i-4:i,l;for(l=0;l<a;l+=4)e=te[t.charCodeAt(l)]<<18|te[t.charCodeAt(l+1)]<<12|te[t.charCodeAt(l+2)]<<6|te[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=te[t.charCodeAt(l)]<<2|te[t.charCodeAt(l+1)]>>4,s[o++]=e&255),n===1&&(e=te[t.charCodeAt(l)]<<10|te[t.charCodeAt(l+1)]<<4|te[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function eu(t){return ae[t>>18&63]+ae[t>>12&63]+ae[t>>6&63]+ae[t&63]}function tu(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(eu(i));return n.join("")}function ru(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(tu(t,o,o+s>a?a:o+s));return i===1?(e=t[r-1],n.push(ae[e>>2]+ae[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(ae[e>>10]+ae[e>>4&63]+ae[e<<2&63]+"=")),n.join("")}});var kn=A(ei=>{ei.read=function(t,e,r,i,n){var s,o,a=n*8-i-1,l=(1<<a)-1,u=l>>1,c=-7,f=r?n-1:0,h=r?-1:1,d=t[e+f];for(f+=h,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=s*256+t[e+f],f+=h,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=i;c>0;o=o*256+t[e+f],f+=h,c-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(d?-1:1)*o*Math.pow(2,s-i)};ei.write=function(t,e,r,i,n,s){var o,a,l,u=s*8-n-1,c=(1<<u)-1,f=c>>1,h=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,_=i?1:-1,p=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*l-1)*Math.pow(2,n),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=a&255,d+=_,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;t[r+d]=o&255,d+=_,o/=256,u-=8);t[r+d-_]|=p*128}});var ue=A(ft=>{"use strict";var ti=$n(),lt=kn(),qn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ft.Buffer=b;ft.SlowBuffer=lu;ft.INSPECT_MAX_BYTES=50;var or=2147483647;ft.kMaxLength=or;b.TYPED_ARRAY_SUPPORT=iu();!b.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&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 iu(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(b.prototype,"parent",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.buffer}});Object.defineProperty(b.prototype,"offset",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.byteOffset}});function xe(t){if(t>or)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,b.prototype),e}function b(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return si(t)}return Qn(t,e,r)}b.poolSize=8192;function Qn(t,e,r){if(typeof t=="string")return su(t,e);if(ArrayBuffer.isView(t))return ou(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(le(t,ArrayBuffer)||t&&le(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(le(t,SharedArrayBuffer)||t&&le(t.buffer,SharedArrayBuffer)))return ii(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return b.from(i,e,r);let n=au(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return b.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}b.from=function(t,e,r){return Qn(t,e,r)};Object.setPrototypeOf(b.prototype,Uint8Array.prototype);Object.setPrototypeOf(b,Uint8Array);function zn(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function nu(t,e,r){return zn(t),t<=0?xe(t):e!==void 0?typeof r=="string"?xe(t).fill(e,r):xe(t).fill(e):xe(t)}b.alloc=function(t,e,r){return nu(t,e,r)};function si(t){return zn(t),xe(t<0?0:oi(t)|0)}b.allocUnsafe=function(t){return si(t)};b.allocUnsafeSlow=function(t){return si(t)};function su(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!b.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Vn(t,e)|0,i=xe(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function ri(t){let e=t.length<0?0:oi(t.length)|0,r=xe(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function ou(t){if(le(t,Uint8Array)){let e=new Uint8Array(t);return ii(e.buffer,e.byteOffset,e.byteLength)}return ri(t)}function ii(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,b.prototype),i}function au(t){if(b.isBuffer(t)){let e=oi(t.length)|0,r=xe(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||li(t.length)?xe(0):ri(t);if(t.type==="Buffer"&&Array.isArray(t.data))return ri(t.data)}function oi(t){if(t>=or)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+or.toString(16)+" bytes");return t|0}function lu(t){return+t!=t&&(t=0),b.alloc(+t)}b.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==b.prototype};b.compare=function(e,r){if(le(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),le(r,Uint8Array)&&(r=b.from(r,r.offset,r.byteLength)),!b.isBuffer(e)||!b.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,o=Math.min(i,n);s<o;++s)if(e[s]!==r[s]){i=e[s],n=r[s];break}return i<n?-1:n<i?1:0};b.isEncoding=function(e){switch(String(e).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}};b.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return b.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=b.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){let o=e[i];if(le(o,Uint8Array))s+o.length>n.length?(b.isBuffer(o)||(o=b.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(b.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function Vn(t,e){if(b.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||le(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ni(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return rs(t).length;default:if(n)return i?-1:ni(t).length;e=(""+e).toLowerCase(),n=!0}}b.byteLength=Vn;function uu(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return mu(this,e,r);case"utf8":case"utf-8":return Kn(this,e,r);case"ascii":return yu(this,e,r);case"latin1":case"binary":return gu(this,e,r);case"base64":return pu(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wu(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}b.prototype._isBuffer=!0;function We(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}b.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)We(this,r,r+1);return this};b.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)We(this,r,r+3),We(this,r+1,r+2);return this};b.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)We(this,r,r+7),We(this,r+1,r+6),We(this,r+2,r+5),We(this,r+3,r+4);return this};b.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Kn(this,0,e):uu.apply(this,arguments)};b.prototype.toLocaleString=b.prototype.toString;b.prototype.equals=function(e){if(!b.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:b.compare(this,e)===0};b.prototype.inspect=function(){let e="",r=ft.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};qn&&(b.prototype[qn]=b.prototype.inspect);b.prototype.compare=function(e,r,i,n,s){if(le(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),!b.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-r,l=Math.min(o,a),u=this.slice(n,s),c=e.slice(r,i);for(let f=0;f<l;++f)if(u[f]!==c[f]){o=u[f],a=c[f];break}return o<a?-1:a<o?1:0};function Hn(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,li(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=b.from(e,i)),b.isBuffer(e))return e.length===0?-1:Un(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Un(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Un(t,e,r,i,n){let s=1,o=t.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(c,f){return s===1?c[f]:c.readUInt16BE(f*s)}let u;if(n){let c=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,c===-1?0:u-c)){if(c===-1&&(c=u),u-c+1===a)return c*s}else c!==-1&&(u-=u-c),c=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let c=!0;for(let f=0;f<a;f++)if(l(t,u+f)!==l(e,f)){c=!1;break}if(c)return u}return-1}b.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};b.prototype.indexOf=function(e,r,i){return Hn(this,e,r,i,!0)};b.prototype.lastIndexOf=function(e,r,i){return Hn(this,e,r,i,!1)};function fu(t,e,r,i){r=Number(r)||0;let n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o<i;++o){let a=parseInt(e.substr(o*2,2),16);if(li(a))return o;t[r+o]=a}return o}function cu(t,e,r,i){return ar(ni(e,t.length-r),t,r,i)}function du(t,e,r,i){return ar(Iu(e),t,r,i)}function hu(t,e,r,i){return ar(rs(e),t,r,i)}function _u(t,e,r,i){return ar(Ru(e,t.length-r),t,r,i)}b.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return fu(this,e,r,i);case"utf8":case"utf-8":return cu(this,e,r,i);case"ascii":case"latin1":case"binary":return du(this,e,r,i);case"base64":return hu(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _u(this,e,r,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function pu(t,e,r){return e===0&&r===t.length?ti.fromByteArray(t):ti.fromByteArray(t.slice(e,r))}function Kn(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let s=t[n],o=null,a=s>239?4:s>223?3:s>191?2:1;if(n+a<=r){let l,u,c,f;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[n+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(o=f));break;case 3:l=t[n+1],u=t[n+2],(l&192)===128&&(u&192)===128&&(f=(s&15)<<12|(l&63)<<6|u&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=t[n+1],u=t[n+2],c=t[n+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(f=(s&15)<<18|(l&63)<<12|(u&63)<<6|c&63,f>65535&&f<1114112&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return bu(i)}var Wn=4096;function bu(t){let e=t.length;if(e<=Wn)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=Wn));return r}function yu(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function gu(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function mu(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let s=e;s<r;++s)n+=Tu[t[s]];return n}function wu(t,e,r){let i=t.slice(e,r),n="";for(let s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}b.prototype.slice=function(e,r){let i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);let n=this.subarray(e,r);return Object.setPrototypeOf(n,b.prototype),n};function W(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}b.prototype.readUintLE=b.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||W(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return n};b.prototype.readUintBE=b.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||W(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};b.prototype.readUint8=b.prototype.readUInt8=function(e,r){return e=e>>>0,r||W(e,1,this.length),this[e]};b.prototype.readUint16LE=b.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||W(e,2,this.length),this[e]|this[e+1]<<8};b.prototype.readUint16BE=b.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||W(e,2,this.length),this[e]<<8|this[e+1]};b.prototype.readUint32LE=b.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||W(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};b.prototype.readUint32BE=b.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||W(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};b.prototype.readBigUInt64LE=Fe(function(e){e=e>>>0,ut(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Bt(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))});b.prototype.readBigUInt64BE=Fe(function(e){e=e>>>0,ut(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Bt(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(s)});b.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||W(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*r)),n};b.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||W(e,r,this.length);let n=r,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};b.prototype.readInt8=function(e,r){return e=e>>>0,r||W(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};b.prototype.readInt16LE=function(e,r){e=e>>>0,r||W(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};b.prototype.readInt16BE=function(e,r){e=e>>>0,r||W(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};b.prototype.readInt32LE=function(e,r){return e=e>>>0,r||W(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};b.prototype.readInt32BE=function(e,r){return e=e>>>0,r||W(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};b.prototype.readBigInt64LE=Fe(function(e){e=e>>>0,ut(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Bt(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});b.prototype.readBigInt64BE=Fe(function(e){e=e>>>0,ut(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Bt(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});b.prototype.readFloatLE=function(e,r){return e=e>>>0,r||W(e,4,this.length),lt.read(this,e,!0,23,4)};b.prototype.readFloatBE=function(e,r){return e=e>>>0,r||W(e,4,this.length),lt.read(this,e,!1,23,4)};b.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||W(e,8,this.length),lt.read(this,e,!0,52,8)};b.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||W(e,8,this.length),lt.read(this,e,!1,52,8)};function Z(t,e,r,i,n,s){if(!b.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}b.prototype.writeUintLE=b.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;Z(this,e,r,i,a,0)}let s=1,o=0;for(this[r]=e&255;++o<i&&(s*=256);)this[r+o]=e/s&255;return r+i};b.prototype.writeUintBE=b.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;Z(this,e,r,i,a,0)}let s=i-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+i};b.prototype.writeUint8=b.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,1,255,0),this[r]=e&255,r+1};b.prototype.writeUint16LE=b.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};b.prototype.writeUint16BE=b.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};b.prototype.writeUint32LE=b.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};b.prototype.writeUint32BE=b.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Yn(t,e,r,i,n){ts(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function Zn(t,e,r,i,n){ts(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}b.prototype.writeBigUInt64LE=Fe(function(e,r=0){return Yn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeBigUInt64BE=Fe(function(e,r=0){return Zn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);Z(this,e,r,i,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s<i&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};b.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);Z(this,e,r,i,l-1,-l)}let s=i-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};b.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};b.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};b.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};b.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};b.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Z(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};b.prototype.writeBigInt64LE=Fe(function(e,r=0){return Yn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});b.prototype.writeBigInt64BE=Fe(function(e,r=0){return Zn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Xn(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Jn(t,e,r,i,n){return e=+e,r=r>>>0,n||Xn(t,e,r,4,34028234663852886e22,-34028234663852886e22),lt.write(t,e,r,i,23,4),r+4}b.prototype.writeFloatLE=function(e,r,i){return Jn(this,e,r,!0,i)};b.prototype.writeFloatBE=function(e,r,i){return Jn(this,e,r,!1,i)};function es(t,e,r,i,n){return e=+e,r=r>>>0,n||Xn(t,e,r,8,17976931348623157e292,-17976931348623157e292),lt.write(t,e,r,i,52,8),r+8}b.prototype.writeDoubleLE=function(e,r,i){return es(this,e,r,!0,i)};b.prototype.writeDoubleBE=function(e,r,i){return es(this,e,r,!1,i)};b.prototype.copy=function(e,r,i,n){if(!b.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);let s=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),r),s};b.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!b.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let o=e.charCodeAt(0);(n==="utf8"&&o<128||n==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{let o=b.isBuffer(e)?e:b.from(e,n),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};var at={};function ai(t,e,r){at[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}ai("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ai("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ai("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=Gn(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Gn(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Gn(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function xu(t,e,r){ut(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Bt(e,t.length-(r+1))}function ts(t,e,r,i,n,s){if(t>r||t<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new at.ERR_OUT_OF_RANGE("value",a,t)}xu(i,n,s)}function ut(t,e){if(typeof t!="number")throw new at.ERR_INVALID_ARG_TYPE(e,"number",t)}function Bt(t,e,r){throw Math.floor(t)!==t?(ut(t,r),new at.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new at.ERR_BUFFER_OUT_OF_BOUNDS:new at.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Eu=/[^+/0-9A-Za-z-_]/g;function Su(t){if(t=t.split("=")[0],t=t.trim().replace(Eu,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ni(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Iu(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Ru(t,e){let r,i,n,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}function rs(t){return ti.toByteArray(Su(t))}function ar(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function le(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function li(t){return t!==t}var Tu=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e})();function Fe(t){return typeof BigInt=="undefined"?Au:t}function Au(){throw new Error("BigInt not supported")}});var j=A((Xp,xs)=>{"use strict";var _i=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
2
- `;super(r),this.name="AggregateError",this.errors=e}};xs.exports={AggregateError:_i,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}});var pi=A((Jp,Es)=>{"use strict";Es.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.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"{}"}}}});var z=A((eb,Rs)=>{"use strict";var{format:Yu,inspect:br}=pi(),{AggregateError:Zu}=j(),Xu=globalThis.AggregateError||Zu,Ju=Symbol("kIsNodeError"),ef=["string","function","number","object","Function","Object","boolean","bigint","symbol"],tf=/^([A-Z][a-z0-9]*)+$/,rf="__node_internal_",yr={};function He(t,e){if(!t)throw new yr.ERR_INTERNAL_ASSERTION(e)}function Ss(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function nf(t,e,r){if(typeof e=="function")return He(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return He(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:Yu(e,...r)}function Q(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(nf(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.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}}),i.prototype.code=t,i.prototype[Ju]=!0,yr[t]=i}function Is(t){let e=rf+t.name;return Object.defineProperty(t,"name",{value:e}),t}function sf(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Xu([e,t],e.message);return r.code=e.code,r}return t||e}var bi=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new yr.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Q("ERR_ASSERTION","%s",Error);Q("ERR_INVALID_ARG_TYPE",(t,e,r)=>{He(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],s=[],o=[];for(let l of e)He(typeof l=="string","All expected entries have to be of type string"),ef.includes(l)?n.push(l.toLowerCase()):tf.test(l)?s.push(l):(He(l!=="object",'The value "object" should be written as "Object"'),o.push(l));if(s.length>0){let l=n.indexOf("object");l!==-1&&(n.splice(n,l,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let l=n.pop();i+=`one of type ${n.join(", ")}, or ${l}`}}(s.length>0||o.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();i+=`an instance of ${s.join(", ")}, or ${l}`}}o.length>0&&(i+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(i+="an "),i+=`${o[0]}`;break;case 2:i+=`one of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();i+=`one of ${o.join(", ")}, or ${l}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else{let l=br(r,{depth:-1});i+=`. Received ${l}`}}else{let l=br(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);Q("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=br(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);Q("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);Q("ERR_MISSING_ARGS",(...t)=>{He(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);Q("ERR_OUT_OF_RANGE",(t,e,r)=>{He(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=Ss(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=Ss(i)),i+="n"}else i=br(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);Q("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Q("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Q("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Q("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Q("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Q("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Q("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Q("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Q("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Q("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Q("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Rs.exports={AbortError:bi,aggregateTwoErrors:Is(sf),hideStackFrames:Is,codes:yr}});var bt=A((tb,gr)=>{"use strict";var{AbortController:Ts,AbortSignal:of}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;gr.exports=Ts;gr.exports.AbortSignal=of;gr.exports.default=Ts});var $t=A((rb,yi)=>{"use strict";var yt=typeof Reflect=="object"?Reflect:null,As=yt&&typeof yt.apply=="function"?yt.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},mr;yt&&typeof yt.ownKeys=="function"?mr=yt.ownKeys:Object.getOwnPropertySymbols?mr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:mr=function(e){return Object.getOwnPropertyNames(e)};function af(t){console&&console.warn&&console.warn(t)}var Ns=Number.isNaN||function(e){return e!==e};function v(){v.init.call(this)}yi.exports=v;yi.exports.once=cf;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var vs=10;function wr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return vs},set:function(t){if(typeof t!="number"||t<0||Ns(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");vs=t}});v.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};v.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ns(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 Ps(t){return t._maxListeners===void 0?v.defaultMaxListeners:t._maxListeners}v.prototype.getMaxListeners=function(){return Ps(this)};v.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")As(l,this,r);else for(var u=l.length,c=Cs(l,u),i=0;i<u;++i)As(c[i],this,r);return!0};function js(t,e,r,i){var n,s,o;if(wr(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),n=Ps(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,af(a)}return t}v.prototype.addListener=function(e,r){return js(this,e,r,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(e,r){return js(this,e,r,!0)};function lf(){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 Ls(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=lf.bind(i);return n.listener=r,i.wrapFn=n,n}v.prototype.once=function(e,r){return wr(r),this.on(e,Ls(this,e,r)),this};v.prototype.prependOnceListener=function(e,r){return wr(r),this.prependListener(e,Ls(this,e,r)),this};v.prototype.removeListener=function(e,r){var i,n,s,o,a;if(wr(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===r||i[o].listener===r){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():uf(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};v.prototype.off=v.prototype.removeListener;v.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function Bs(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?ff(n):Cs(n,n.length)}v.prototype.listeners=function(e){return Bs(this,e,!0)};v.prototype.rawListeners=function(e){return Bs(this,e,!1)};v.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Fs.call(t,e)};v.prototype.listenerCount=Fs;function Fs(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}v.prototype.eventNames=function(){return this._eventsCount>0?mr(this._events):[]};function Cs(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function uf(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function ff(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function cf(t,e){return new Promise(function(r,i){function n(o){t.removeListener(e,s),i(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}Os(t,e,s,{once:!0}),e!=="error"&&df(t,n,{once:!0})})}function df(t,e,r){typeof t.on=="function"&&Os(t,"error",e,r)}function Os(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var K=A((ib,mi)=>{"use strict";var hf=ue(),{format:_f,inspect:pf}=pi(),{codes:{ERR_INVALID_ARG_TYPE:gi}}=z(),{kResistStopPropagation:bf,AggregateError:yf,SymbolDispose:gf}=j(),mf=globalThis.AbortSignal||bt().AbortSignal,wf=globalThis.AbortController||bt().AbortController,xf=Object.getPrototypeOf(async function(){}).constructor,Ds=globalThis.Blob||hf.Blob,Ef=typeof Ds!="undefined"?function(e){return e instanceof Ds}:function(e){return!1},Ms=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new gi(e,"AbortSignal",t)},Sf=(t,e)=>{if(typeof t!="function")throw new gi(e,"Function",t)};mi.exports={AggregateError:yf,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:_f,inspect:pf,types:{isAsyncFunction(t){return t instanceof xf},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Ef,deprecate(t,e){return t},addAbortListener:$t().addAbortListener||function(e,r){if(e===void 0)throw new gi("signal","AbortSignal",e);Ms(e,"signal"),Sf(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[bf]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[gf](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:mf.any||function(e){if(e.length===1)return e[0];let r=new wf,i=()=>r.abort();return e.forEach(n=>{Ms(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};mi.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var mt=A((nb,Hs)=>{"use strict";var{ArrayIsArray:xi,ArrayPrototypeIncludes:Us,ArrayPrototypeJoin:Ws,ArrayPrototypeMap:If,NumberIsInteger:Ei,NumberIsNaN:Rf,NumberMAX_SAFE_INTEGER:Tf,NumberMIN_SAFE_INTEGER:Af,NumberParseInt:vf,ObjectPrototypeHasOwnProperty:Nf,RegExpPrototypeExec:Gs,String:Pf,StringPrototypeToUpperCase:jf,StringPrototypeTrim:Lf}=j(),{hideStackFrames:re,codes:{ERR_SOCKET_BAD_PORT:Bf,ERR_INVALID_ARG_TYPE:V,ERR_INVALID_ARG_VALUE:gt,ERR_OUT_OF_RANGE:Ke,ERR_UNKNOWN_SIGNAL:$s}}=z(),{normalizeEncoding:Ff}=K(),{isAsyncFunction:Cf,isArrayBufferView:Of}=K().types,ks={};function Df(t){return t===(t|0)}function Mf(t){return t===t>>>0}var $f=/^[0-7]+$/,kf="must be a 32-bit unsigned integer or an octal string";function qf(t,e,r){if(typeof t=="undefined"&&(t=r),typeof t=="string"){if(Gs($f,t)===null)throw new gt(e,t,kf);t=vf(t,8)}return Qs(t,e),t}var Uf=re((t,e,r=Af,i=Tf)=>{if(typeof t!="number")throw new V(e,"number",t);if(!Ei(t))throw new Ke(e,"an integer",t);if(t<r||t>i)throw new Ke(e,`>= ${r} && <= ${i}`,t)}),Wf=re((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new V(e,"number",t);if(!Ei(t))throw new Ke(e,"an integer",t);if(t<r||t>i)throw new Ke(e,`>= ${r} && <= ${i}`,t)}),Qs=re((t,e,r=!1)=>{if(typeof t!="number")throw new V(e,"number",t);if(!Ei(t))throw new Ke(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new Ke(e,`>= ${i} && <= ${n}`,t)});function Si(t,e){if(typeof t!="string")throw new V(e,"string",t)}function Gf(t,e,r=void 0,i){if(typeof t!="number")throw new V(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&Rf(t))throw new Ke(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var Qf=re((t,e,r)=>{if(!Us(r,t)){let n="must be one of: "+Ws(If(r,s=>typeof s=="string"?`'${s}'`:Pf(s)),", ");throw new gt(e,t,n)}});function zs(t,e){if(typeof t!="boolean")throw new V(e,"boolean",t)}function wi(t,e,r){return t==null||!Nf(t,e)?r:t[e]}var zf=re((t,e,r=null)=>{let i=wi(r,"allowArray",!1),n=wi(r,"allowFunction",!1);if(!wi(r,"nullable",!1)&&t===null||!i&&xi(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new V(e,"Object",t)}),Vf=re((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new V(e,"a dictionary",t)}),xr=re((t,e,r=0)=>{if(!xi(t))throw new V(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new gt(e,t,i)}});function Hf(t,e){xr(t,e);for(let r=0;r<t.length;r++)Si(t[r],`${e}[${r}]`)}function Kf(t,e){xr(t,e);for(let r=0;r<t.length;r++)zs(t[r],`${e}[${r}]`)}function Yf(t,e){xr(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new V(n,"AbortSignal",i);Vs(i,n)}}function Zf(t,e="signal"){if(Si(t,e),ks[t]===void 0)throw ks[jf(t)]!==void 0?new $s(t+" (signals must use all capital letters)"):new $s(t)}var Xf=re((t,e="buffer")=>{if(!Of(t))throw new V(e,["Buffer","TypedArray","DataView"],t)});function Jf(t,e){let r=Ff(e),i=t.length;if(r==="hex"&&i%2!==0)throw new gt("encoding",e,`is invalid for data of length ${i}`)}function ec(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Lf(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Bf(e,t,r);return t|0}var Vs=re((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new V(e,"AbortSignal",t)}),tc=re((t,e)=>{if(typeof t!="function")throw new V(e,"Function",t)}),rc=re((t,e)=>{if(typeof t!="function"||Cf(t))throw new V(e,"Function",t)}),ic=re((t,e)=>{if(t!==void 0)throw new V(e,"undefined",t)});function nc(t,e,r){if(!Us(r,t))throw new V(e,`('${Ws(r,"|")}')`,t)}var sc=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function qs(t,e){if(typeof t=="undefined"||!Gs(sc,t))throw new gt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function oc(t){if(typeof t=="string")return qs(t,"hints"),t;if(xi(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];qs(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new gt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Hs.exports={isInt32:Df,isUint32:Mf,parseFileMode:qf,validateArray:xr,validateStringArray:Hf,validateBooleanArray:Kf,validateAbortSignalArray:Yf,validateBoolean:zs,validateBuffer:Xf,validateDictionary:Vf,validateEncoding:Jf,validateFunction:tc,validateInt32:Wf,validateInteger:Uf,validateNumber:Gf,validateObject:zf,validateOneOf:Qf,validatePlainFunction:rc,validatePort:ec,validateSignalName:Zf,validateString:Si,validateUint32:Qs,validateUndefined:ic,validateUnion:nc,validateAbortSignal:Vs,validateLinkHeaderValue:oc}});var De=A((sb,Xs)=>{var F=Xs.exports={},de,he;function Ii(){throw new Error("setTimeout has not been defined")}function Ri(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?de=setTimeout:de=Ii}catch(t){de=Ii}try{typeof clearTimeout=="function"?he=clearTimeout:he=Ri}catch(t){he=Ri}})();function Ks(t){if(de===setTimeout)return setTimeout(t,0);if((de===Ii||!de)&&setTimeout)return de=setTimeout,setTimeout(t,0);try{return de(t,0)}catch(e){try{return de.call(null,t,0)}catch(r){return de.call(this,t,0)}}}function ac(t){if(he===clearTimeout)return clearTimeout(t);if((he===Ri||!he)&&clearTimeout)return he=clearTimeout,clearTimeout(t);try{return he(t)}catch(e){try{return he.call(null,t)}catch(r){return he.call(this,t)}}}var Re=[],wt=!1,Ye,Er=-1;function lc(){!wt||!Ye||(wt=!1,Ye.length?Re=Ye.concat(Re):Er=-1,Re.length&&Ys())}function Ys(){if(!wt){var t=Ks(lc);wt=!0;for(var e=Re.length;e;){for(Ye=Re,Re=[];++Er<e;)Ye&&Ye[Er].run();Er=-1,e=Re.length}Ye=null,wt=!1,ac(t)}}F.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];Re.push(new Zs(t,e)),Re.length===1&&!wt&&Ks(Ys)};function Zs(t,e){this.fun=t,this.array=e}Zs.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Te(){}F.on=Te;F.addListener=Te;F.once=Te;F.off=Te;F.removeListener=Te;F.removeAllListeners=Te;F.emit=Te;F.prependListener=Te;F.prependOnceListener=Te;F.listeners=function(t){return[]};F.binding=function(t){throw new Error("process.binding is not supported")};F.cwd=function(){return"/"};F.chdir=function(t){throw new Error("process.chdir is not supported")};F.umask=function(){return 0}});var pe=A((ob,_o)=>{"use strict";var{SymbolAsyncIterator:Js,SymbolIterator:eo,SymbolFor:Ze}=j(),to=Ze("nodejs.stream.destroyed"),ro=Ze("nodejs.stream.errored"),Ti=Ze("nodejs.stream.readable"),Ai=Ze("nodejs.stream.writable"),io=Ze("nodejs.stream.disturbed"),uc=Ze("nodejs.webstream.isClosedPromise"),fc=Ze("nodejs.webstream.controllerErrorFunction");function Sr(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 Ir(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 cc(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function _e(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function no(t){return!!(t&&!_e(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function so(t){return!!(t&&!_e(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function oo(t){return!!(t&&!_e(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function dc(t){return no(t)||so(t)||oo(t)}function hc(t,e){return t==null?!1:e===!0?typeof t[Js]=="function":e===!1?typeof t[eo]=="function":typeof t[Js]=="function"||typeof t[eo]=="function"}function Rr(t){if(!_e(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[to]||i!=null&&i.destroyed)}function ao(t){if(!Ir(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function _c(t,e){if(!Ir(t))return null;if(t.writableFinished===!0)return!0;let 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 pc(t){if(!Sr(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function lo(t,e){if(!Sr(t))return null;let 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 uo(t){return t&&t[Ti]!=null?t[Ti]:typeof(t==null?void 0:t.readable)!="boolean"?null:Rr(t)?!1:Sr(t)&&t.readable&&!lo(t)}function fo(t){return t&&t[Ai]!=null?t[Ai]:typeof(t==null?void 0:t.writable)!="boolean"?null:Rr(t)?!1:Ir(t)&&t.writable&&!ao(t)}function bc(t,e){return _e(t)?Rr(t)?!0:!((e==null?void 0:e.readable)!==!1&&uo(t)||(e==null?void 0:e.writable)!==!1&&fo(t)):null}function yc(t){var e,r;return _e(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 gc(t){var e,r;return _e(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 mc(t){if(!_e(t))return null;if(typeof t.closed=="boolean")return t.closed;let 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"&&co(t)?t._closed:null}function co(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function ho(t){return typeof t._sent100=="boolean"&&co(t)}function wc(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 xc(t){if(!_e(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&ho(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function Ec(t){var e;return!!(t&&((e=t[io])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Sc(t){var e,r,i,n,s,o,a,l,u,c;return!!(t&&((e=(r=(i=(n=(s=(o=t[ro])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((c=t._writableState)===null||c===void 0)&&c.errored))}_o.exports={isDestroyed:Rr,kIsDestroyed:to,isDisturbed:Ec,kIsDisturbed:io,isErrored:Sc,kIsErrored:ro,isReadable:uo,kIsReadable:Ti,kIsClosedPromise:uc,kControllerErrorFunction:fc,kIsWritable:Ai,isClosed:mc,isDuplexNodeStream:cc,isFinished:bc,isIterable:hc,isReadableNodeStream:Sr,isReadableStream:no,isReadableEnded:pc,isReadableFinished:lo,isReadableErrored:gc,isNodeStream:_e,isWebStream:dc,isWritable:fo,isWritableNodeStream:Ir,isWritableStream:so,isWritableEnded:ao,isWritableFinished:_c,isWritableErrored:yc,isServerRequest:wc,isServerResponse:ho,willEmitClose:xc,isTransformStream:oo}});var Ae=A((ab,Li)=>{"use strict";var Me=De(),{AbortError:So,codes:Ic}=z(),{ERR_INVALID_ARG_TYPE:Rc,ERR_STREAM_PREMATURE_CLOSE:po}=Ic,{kEmptyObject:Ni,once:Pi}=K(),{validateAbortSignal:Tc,validateFunction:Ac,validateObject:vc,validateBoolean:Nc}=mt(),{Promise:Pc,PromisePrototypeThen:jc,SymbolDispose:Io}=j(),{isClosed:Lc,isReadable:bo,isReadableNodeStream:vi,isReadableStream:Bc,isReadableFinished:yo,isReadableErrored:go,isWritable:mo,isWritableNodeStream:wo,isWritableStream:Fc,isWritableFinished:xo,isWritableErrored:Eo,isNodeStream:Cc,willEmitClose:Oc,kIsClosedPromise:Dc}=pe(),xt;function Mc(t){return t.setHeader&&typeof t.abort=="function"}var ji=()=>{};function Ro(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Ni):e==null?e=Ni:vc(e,"options"),Ac(r,"callback"),Tc(e.signal,"options.signal"),r=Pi(r),Bc(t)||Fc(t))return $c(t,e,r);if(!Cc(t))throw new Rc("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:vi(t),o=(n=e.writable)!==null&&n!==void 0?n:wo(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||h()},c=Oc(t)&&vi(t)===s&&wo(t)===o,f=xo(t,!1),h=()=>{f=!0,t.destroyed&&(c=!1),!(c&&(!t.readable||s))&&(!s||d)&&r.call(t)},d=yo(t,!1),_=()=>{d=!0,t.destroyed&&(c=!1),!(c&&(!t.writable||o))&&(!o||f)&&r.call(t)},p=w=>{r.call(t,w)},y=Lc(t),m=()=>{y=!0;let w=Eo(t)||go(t);if(w&&typeof w!="boolean")return r.call(t,w);if(s&&!d&&vi(t,!0)&&!yo(t,!1))return r.call(t,new po);if(o&&!f&&!xo(t,!1))return r.call(t,new po);r.call(t)},S=()=>{y=!0;let w=Eo(t)||go(t);if(w&&typeof w!="boolean")return r.call(t,w);r.call(t)},x=()=>{t.req.on("finish",h)};Mc(t)?(t.on("complete",h),c||t.on("abort",m),t.req?x():t.on("request",x)):o&&!a&&(t.on("end",u),t.on("close",u)),!c&&typeof t.aborted=="boolean"&&t.on("aborted",m),t.on("end",_),t.on("finish",h),e.error!==!1&&t.on("error",p),t.on("close",m),y?Me.nextTick(m):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?c||Me.nextTick(S):(!s&&(!c||bo(t))&&(f||mo(t)===!1)||!o&&(!c||mo(t))&&(d||bo(t)===!1)||l&&t.req&&t.aborted)&&Me.nextTick(S);let g=()=>{r=ji,t.removeListener("aborted",m),t.removeListener("complete",h),t.removeListener("abort",m),t.removeListener("request",x),t.req&&t.req.removeListener("finish",h),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",h),t.removeListener("end",_),t.removeListener("error",p),t.removeListener("close",m)};if(e.signal&&!y){let w=()=>{let R=r;g(),R.call(t,new So(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Me.nextTick(w);else{xt=xt||K().addAbortListener;let R=xt(e.signal,w),T=r;r=Pi((...U)=>{R[Io](),T.apply(t,U)})}}return g}function $c(t,e,r){let i=!1,n=ji;if(e.signal)if(n=()=>{i=!0,r.call(t,new So(void 0,{cause:e.signal.reason}))},e.signal.aborted)Me.nextTick(n);else{xt=xt||K().addAbortListener;let o=xt(e.signal,n),a=r;r=Pi((...l)=>{o[Io](),a.apply(t,l)})}let s=(...o)=>{i||Me.nextTick(()=>r.apply(t,o))};return jc(t[Dc].promise,s,s),ji}function kc(t,e){var r;let i=!1;return e===null&&(e=Ni),(r=e)!==null&&r!==void 0&&r.cleanup&&(Nc(e.cleanup,"cleanup"),i=e.cleanup),new Pc((n,s)=>{let o=Ro(t,e,a=>{i&&o(),a?s(a):n()})})}Li.exports=Ro;Li.exports.finished=kc});var Xe=A((lb,Bo)=>{"use strict";var be=De(),{aggregateTwoErrors:qc,codes:{ERR_MULTIPLE_CALLBACK:Uc},AbortError:Wc}=z(),{Symbol:vo}=j(),{kIsDestroyed:Gc,isDestroyed:Qc,isFinished:zc,isServerRequest:Vc}=pe(),No=vo("kDestroy"),Bi=vo("kConstruct");function Po(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Hc(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(Po(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?To(this,t,e):this.once(No,function(s){To(this,qc(s,t),e)}),this)}function To(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,a=t._writableState;Po(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?be.nextTick(Kc,t,s):be.nextTick(jo,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function Kc(t,e){Fi(t,e),jo(t)}function jo(t){let 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 Fi(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Yc(){let 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 Ci(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?be.nextTick(Fi,t,e):Fi(t,e))}function Zc(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(Bi,e),!(t.listenerCount(Bi)>1)&&be.nextTick(Xc,t)}function Xc(t){let e=!1;function r(i){if(e){Ci(t,i!=null?i:new Uc);return}e=!0;let n=t._readableState,s=t._writableState,o=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(No,i):i?Ci(t,i,!0):be.nextTick(Jc,t)}try{t._construct(i=>{be.nextTick(r,i)})}catch(i){be.nextTick(r,i)}}function Jc(t){t.emit(Bi)}function Ao(t){return(t==null?void 0:t.setHeader)&&typeof t.abort=="function"}function Lo(t){t.emit("close")}function ed(t,e){t.emit("error",e),be.nextTick(Lo,t)}function td(t,e){!t||Qc(t)||(!e&&!zc(t)&&(e=new Wc),Vc(t)?(t.socket=null,t.destroy(e)):Ao(t)?t.abort():Ao(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?be.nextTick(ed,t,e):be.nextTick(Lo,t),t.destroyed||(t[Gc]=!0))}Bo.exports={construct:Zc,destroyer:td,destroy:Hc,undestroy:Yc,errorOrDestroy:Ci}});var vr=A((ub,Co)=>{"use strict";var{ArrayIsArray:rd,ObjectSetPrototypeOf:Fo}=j(),{EventEmitter:Tr}=$t();function Ar(t){Tr.call(this,t)}Fo(Ar.prototype,Tr.prototype);Fo(Ar,Tr);Ar.prototype.pipe=function(t,e){let r=this;function i(c){t.writable&&t.write(c)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",a));let s=!1;function o(){s||(s=!0,t.end())}function a(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}function l(c){u(),Tr.listenerCount(this,"error")===0&&this.emit("error",c)}Oi(r,"error",l),Oi(t,"error",l);function u(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",o),r.removeListener("close",a),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t};function Oi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):rd(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Co.exports={Stream:Ar,prependListener:Oi}});var kt=A((fb,Nr)=>{"use strict";var{SymbolDispose:id}=j(),{AbortError:Oo,codes:nd}=z(),{isNodeStream:Do,isWebStream:sd,kControllerErrorFunction:od}=pe(),ad=Ae(),{ERR_INVALID_ARG_TYPE:Mo}=nd,Di,ld=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Mo(e,"AbortSignal",t)};Nr.exports.addAbortSignal=function(e,r){if(ld(e,"signal"),!Do(r)&&!sd(r))throw new Mo("stream",["ReadableStream","WritableStream","Stream"],r);return Nr.exports.addAbortSignalNoValidate(e,r)};Nr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Do(e)?()=>{e.destroy(new Oo(void 0,{cause:t.reason}))}:()=>{e[od](new Oo(void 0,{cause:t.reason}))};if(t.aborted)r();else{Di=Di||K().addAbortListener;let i=Di(t,r);ad(e,i[id])}return e}});var qo=A((db,ko)=>{"use strict";var{StringPrototypeSlice:$o,SymbolIterator:ud,TypedArrayPrototypeSet:Pr,Uint8Array:fd}=j(),{Buffer:Mi}=ue(),{inspect:cd}=K();ko.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let 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,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return Mi.alloc(0);let r=Mi.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)Pr(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[ud](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let s=i.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=$o(s,0,e),this.head=i,i.data=$o(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Mi.allocUnsafe(e),i=e,n=this.head,s=0;do{let o=n.data;if(e>o.length)Pr(r,o,i-e),e-=o.length;else{e===o.length?(Pr(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(Pr(r,new fd(o.buffer,o.byteOffset,e),i-e),this.head=n,n.data=o.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return cd(this,Be(D({},r),{depth:0,customInspect:!1}))}}});var qt=A((_b,Qo)=>{"use strict";var{MathFloor:dd,NumberIsInteger:hd}=j(),{validateInteger:_d}=mt(),{ERR_INVALID_ARG_VALUE:pd}=z().codes,Uo=16*1024,Wo=16;function bd(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Go(t){return t?Wo:Uo}function yd(t,e){_d(e,"value",0),t?Wo=e:Uo=e}function gd(t,e,r,i){let n=bd(e,i,r);if(n!=null){if(!hd(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new pd(s,n)}return dd(n)}return Go(t.objectMode)}Qo.exports={getHighWaterMark:gd,getDefaultHighWaterMark:Go,setDefaultHighWaterMark:yd}});var Ho=A(($i,Vo)=>{var jr=ue(),ye=jr.Buffer;function zo(t,e){for(var r in t)e[r]=t[r]}ye.from&&ye.alloc&&ye.allocUnsafe&&ye.allocUnsafeSlow?Vo.exports=jr:(zo(jr,$i),$i.Buffer=Je);function Je(t,e,r){return ye(t,e,r)}Je.prototype=Object.create(ye.prototype);zo(ye,Je);Je.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ye(t,e,r)};Je.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=ye(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};Je.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ye(t)};Je.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return jr.SlowBuffer(t)}});var Zo=A(Yo=>{"use strict";var qi=Ho().Buffer,Ko=qi.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 md(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 wd(t){var e=md(t);if(typeof e!="string"&&(qi.isEncoding===Ko||!Ko(t)))throw new Error("Unknown encoding: "+t);return e||t}Yo.StringDecoder=Ut;function Ut(t){this.encoding=wd(t);var e;switch(this.encoding){case"utf16le":this.text=Td,this.end=Ad,e=4;break;case"utf8":this.fillLast=Sd,e=4;break;case"base64":this.text=vd,this.end=Nd,e=3;break;default:this.write=Pd,this.end=jd;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=qi.allocUnsafe(e)}Ut.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||""};Ut.prototype.end=Rd;Ut.prototype.text=Id;Ut.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 ki(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function xd(t,e,r){var i=e.length-1;if(i<r)return 0;var n=ki(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=ki(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=ki(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function Ed(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function Sd(t){var e=this.lastTotal-this.lastNeed,r=Ed(this,t,e);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 Id(t,e){var r=xd(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function Rd(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Td(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 Ad(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 vd(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 Nd(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Pd(t){return t.toString(this.encoding)}function jd(t){return t&&t.length?this.write(t):""}});var Ui=A((bb,ta)=>{"use strict";var Xo=De(),{PromisePrototypeThen:Ld,SymbolAsyncIterator:Jo,SymbolIterator:ea}=j(),{Buffer:Bd}=ue(),{ERR_INVALID_ARG_TYPE:Fd,ERR_STREAM_NULL_VALUES:Cd}=z().codes;function Od(t,e,r){let i;if(typeof e=="string"||e instanceof Bd)return new t(Be(D({objectMode:!0},r),{read(){this.push(e),this.push(null)}}));let n;if(e&&e[Jo])n=!0,i=e[Jo]();else if(e&&e[ea])n=!1,i=e[ea]();else throw new Fd("iterable",["Iterable"],e);let s=new t(D({objectMode:!0,highWaterMark:1},r)),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,c){Ld(a(u),()=>Xo.nextTick(c,u),f=>Xo.nextTick(c,f||u))};async function a(u){let c=u!=null,f=typeof i.throw=="function";if(c&&f){let{value:h,done:d}=await i.throw(u);if(await h,d)return}if(typeof i.return=="function"){let{value:h}=await i.return();await h}}async function l(){for(;;){try{let{value:u,done:c}=n?await i.next():i.next();if(c)s.push(null);else{let f=u&&typeof u.then=="function"?await u:u;if(f===null)throw o=!1,new Cd;if(s.push(f))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}ta.exports=Od});var Gt=A((gb,ma)=>{"use strict";var se=De(),{ArrayPrototypeIndexOf:Dd,NumberIsInteger:Md,NumberIsNaN:$d,NumberParseInt:kd,ObjectDefineProperties:Yi,ObjectKeys:qd,ObjectSetPrototypeOf:na,Promise:sa,SafeSet:Ud,SymbolAsyncDispose:Wd,SymbolAsyncIterator:Gd,Symbol:Qd}=j();ma.exports=E;E.ReadableState=Cr;var{EventEmitter:zd}=$t(),{Stream:$e,prependListener:Vd}=vr(),{Buffer:Wi}=ue(),{addAbortSignal:Hd}=kt(),oa=Ae(),I=K().debuglog("stream",t=>{I=t}),Kd=qo(),It=Xe(),{getHighWaterMark:Yd,getDefaultHighWaterMark:Zd}=qt(),{aggregateTwoErrors:ra,codes:{ERR_INVALID_ARG_TYPE:Xd,ERR_METHOD_NOT_IMPLEMENTED:Jd,ERR_OUT_OF_RANGE:eh,ERR_STREAM_PUSH_AFTER_EOF:th,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:rh},AbortError:ih}=z(),{validateObject:nh}=mt(),et=Qd("kPaused"),{StringDecoder:aa}=Zo(),sh=Ui();na(E.prototype,$e.prototype);na(E,$e);var Gi=()=>{},{errorOrDestroy:Et}=It,St=1,oh=2,la=4,Wt=8,ua=16,Lr=32,Br=64,fa=128,ah=256,lh=512,uh=1024,Hi=2048,Ki=4096,fh=8192,ch=16384,dh=32768,ca=65536,hh=1<<17,_h=1<<18;function k(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Yi(Cr.prototype,{objectMode:k(St),ended:k(oh),endEmitted:k(la),reading:k(Wt),constructed:k(ua),sync:k(Lr),needReadable:k(Br),emittedReadable:k(fa),readableListening:k(ah),resumeScheduled:k(lh),errorEmitted:k(uh),emitClose:k(Hi),autoDestroy:k(Ki),destroyed:k(fh),closed:k(ch),closeEmitted:k(dh),multiAwaitDrain:k(ca),readingMore:k(hh),dataEmitted:k(_h)});function Cr(t,e,r){typeof r!="boolean"&&(r=e instanceof ge()),this.state=Hi|Ki|ua|Lr,t&&t.objectMode&&(this.state|=St),r&&t&&t.readableObjectMode&&(this.state|=St),this.highWaterMark=t?Yd(this,t,"readableHighWaterMark",r):Zd(!1),this.buffer=new Kd,this.length=0,this.pipes=[],this.flowing=null,this[et]=null,t&&t.emitClose===!1&&(this.state&=~Hi),t&&t.autoDestroy===!1&&(this.state&=~Ki),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new aa(t.encoding),this.encoding=t.encoding)}function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof ge();this._readableState=new Cr(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Hd(t.signal,this)),$e.call(this,t),It.construct(this,()=>{this._readableState.needReadable&&Fr(this,this._readableState)})}E.prototype.destroy=It.destroy;E.prototype._undestroy=It.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[zd.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[Wd]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new ih,this.destroy(t)),new sa((e,r)=>oa(this,i=>i&&i!==t?r(i):e(null)))};E.prototype.push=function(t,e){return da(this,t,e,!1)};E.prototype.unshift=function(t,e){return da(this,t,e,!0)};function da(t,e,r,i){I("readableAddChunk",e);let n=t._readableState,s;if((n.state&St)===0&&(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=Wi.from(e,r).toString(n.encoding):(e=Wi.from(e,r),r=""))):e instanceof Wi?r="":$e._isUint8Array(e)?(e=$e._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Xd("chunk",["string","Buffer","Uint8Array"],e))),s)Et(t,s);else if(e===null)n.state&=~Wt,yh(t,n);else if((n.state&St)!==0||e&&e.length>0)if(i)if((n.state&la)!==0)Et(t,new rh);else{if(n.destroyed||n.errored)return!1;Qi(t,n,e,!0)}else if(n.ended)Et(t,new th);else{if(n.destroyed||n.errored)return!1;n.state&=~Wt,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Qi(t,n,e,!1):Fr(t,n)):Qi(t,n,e,!1)}else i||(n.state&=~Wt,Fr(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Qi(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&ca)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),(e.state&Br)!==0&&Or(t)),Fr(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[et]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new aa(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var ph=1073741824;function bh(t){if(t>ph)throw new eh("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function ia(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&St)!==0?1:$d(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}E.prototype.read=function(t){I("read",t),t===void 0?t=NaN:Md(t)||(t=kd(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=bh(t)),t!==0&&(e.state&=~fa),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return I("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?zi(this):Or(this),null;if(t=ia(t,e),t===0&&e.ended)return e.length===0&&zi(this),null;let i=(e.state&Br)!==0;if(I("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,I("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,I("reading, ended or constructing",i);else if(i){I("do read"),e.state|=Wt|Lr,e.length===0&&(e.state|=Br);try{this._read(e.highWaterMark)}catch(s){Et(this,s)}e.state&=~Lr,e.reading||(t=ia(r,e))}let n;return t>0?n=ya(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&zi(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function yh(t,e){if(I("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Or(t):(e.needReadable=!1,e.emittedReadable=!0,ha(t))}}function Or(t){let e=t._readableState;I("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(I("emitReadable",e.flowing),e.emittedReadable=!0,se.nextTick(ha,t))}function ha(t){let e=t._readableState;I("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,pa(t)}function Fr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,se.nextTick(gh,t,e))}function gh(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(I("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}E.prototype._read=function(t){throw new Jd("_read()")};E.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new Ud(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),I("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==se.stdout&&t!==se.stderr?a:y;i.endEmitted?se.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(m,S){I("onunpipe"),m===r&&S&&S.hasUnpiped===!1&&(S.hasUnpiped=!0,c())}function a(){I("onend"),t.end()}let l,u=!1;function c(){I("cleanup"),t.removeListener("close",_),t.removeListener("finish",p),l&&t.removeListener("drain",l),t.removeListener("error",d),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",h),u=!0,l&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function f(){u||(i.pipes.length===1&&i.pipes[0]===t?(I("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(I("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=mh(r,t),t.on("drain",l))}r.on("data",h);function h(m){I("ondata");let S=t.write(m);I("dest.write",S),S===!1&&f()}function d(m){if(I("onerror",m),y(),t.removeListener("error",d),t.listenerCount("error")===0){let S=t._writableState||t._readableState;S&&!S.errorEmitted?Et(t,m):t.emit("error",m)}}Vd(t,"error",d);function _(){t.removeListener("finish",p),y()}t.once("close",_);function p(){I("onfinish"),t.removeListener("close",_),y()}t.once("finish",p);function y(){I("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?f():i.flowing||(I("pipe resume"),r.resume()),t};function mh(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(I("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(I("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}E.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let i=Dd(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};E.prototype.on=function(t,e){let r=$e.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,I("on readable",i.length,i.reading),i.length?Or(this):i.reading||se.nextTick(wh,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=$e.prototype.removeListener.call(this,t,e);return t==="readable"&&se.nextTick(_a,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=$e.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&se.nextTick(_a,this),e};function _a(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[et]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function wh(t){I("readable nexttick read 0"),t.read(0)}E.prototype.resume=function(){let t=this._readableState;return t.flowing||(I("resume"),t.flowing=!t.readableListening,xh(this,t)),t[et]=!1,this};function xh(t,e){e.resumeScheduled||(e.resumeScheduled=!0,se.nextTick(Eh,t,e))}function Eh(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),pa(t),e.flowing&&!e.reading&&t.read(0)}E.prototype.pause=function(){return I("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(I("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[et]=!0,this};function pa(t){let e=t._readableState;for(I("flow",e.flowing);e.flowing&&t.read()!==null;);}E.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{Et(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=qd(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};E.prototype[Gd]=function(){return ba(this)};E.prototype.iterator=function(t){return t!==void 0&&nh(t,"options"),ba(this,t)};function ba(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=Sh(t,e);return r.stream=t,r}function Sh(t,e){return ee(this,null,function*(){let r=Gi;function i(o){this===t?(r(),r=Gi):r=o}t.on("readable",i);let n,s=oa(t,{writable:!1},o=>{n=o?ra(n,o):null,r(),r=Gi});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;yield new G(new sa(i))}}}catch(o){throw n=ra(n,o),n}finally{(n||(e==null?void 0:e.destroyOnReturn)!==!1)&&(n===void 0||t._readableState.autoDestroy)?It.destroyer(t,null):(t.off("readable",i),s())}})}Yi(E.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},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(t){this._readableState&&(this._readableState.flowing=t)}},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(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Yi(Cr.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[et]!==!1},set(t){this[et]=!!t}}});E._fromList=ya;function ya(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function zi(t){let e=t._readableState;I("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,se.nextTick(Ih,e,t))}function Ih(t,e){if(I("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)se.nextTick(Rh,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function Rh(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return sh(E,t,e)};var Vi;function ga(){return Vi===void 0&&(Vi={}),Vi}E.fromWeb=function(t,e){return ga().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return ga().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var r,i;return new E(Be(D({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0},e),{destroy(n,s){It.destroyer(t,n),s(n)}})).wrap(t)}});var qr=A((wb,ja)=>{"use strict";var tt=De(),{ArrayPrototypeSlice:Ea,Error:Th,FunctionPrototypeSymbolHasInstance:Sa,ObjectDefineProperty:Ia,ObjectDefineProperties:Ah,ObjectSetPrototypeOf:Ra,StringPrototypeToLowerCase:vh,Symbol:Nh,SymbolHasInstance:Ph}=j();ja.exports=L;L.WritableState=Vt;var{EventEmitter:jh}=$t(),Qt=vr().Stream,{Buffer:Dr}=ue(),kr=Xe(),{addAbortSignal:Lh}=kt(),{getHighWaterMark:Bh,getDefaultHighWaterMark:Fh}=qt(),{ERR_INVALID_ARG_TYPE:Ch,ERR_METHOD_NOT_IMPLEMENTED:Oh,ERR_MULTIPLE_CALLBACK:Ta,ERR_STREAM_CANNOT_PIPE:Dh,ERR_STREAM_DESTROYED:zt,ERR_STREAM_ALREADY_FINISHED:Mh,ERR_STREAM_NULL_VALUES:$h,ERR_STREAM_WRITE_AFTER_END:kh,ERR_UNKNOWN_ENCODING:Aa}=z().codes,{errorOrDestroy:Rt}=kr;Ra(L.prototype,Qt.prototype);Ra(L,Qt);function Ji(){}var Tt=Nh("kOnFinished");function Vt(t,e,r){typeof r!="boolean"&&(r=e instanceof ge()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Bh(this,t,"writableHighWaterMark",r):Fh(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=Uh.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,$r(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Tt]=[]}function $r(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Vt.prototype.getBuffer=function(){return Ea(this.buffered,this.bufferedIndex)};Ia(Vt.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function L(t){let e=this instanceof ge();if(!e&&!Sa(L,this))return new L(t);this._writableState=new Vt(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&Lh(t.signal,this)),Qt.call(this,t),kr.construct(this,()=>{let r=this._writableState;r.writing||tn(this,r),rn(this,r)})}Ia(L,Ph,{__proto__:null,value:function(t){return Sa(this,t)?!0:this!==L?!1:t&&t._writableState instanceof Vt}});L.prototype.pipe=function(){Rt(this,new Dh)};function va(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!Dr.isEncoding(r))throw new Aa(r);typeof i!="function"&&(i=Ji)}if(e===null)throw new $h;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Dr.from(e,r),r="buffer");else if(e instanceof Dr)r="buffer";else if(Qt._isUint8Array(e))e=Qt._uint8ArrayToBuffer(e),r="buffer";else throw new Ch("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new kh:n.destroyed&&(s=new zt("write")),s?(tt.nextTick(i,s),Rt(t,s,!0),s):(n.pendingcb++,qh(t,n,e,r,i))}L.prototype.write=function(t,e,r){return va(this,t,e,r)===!0};L.prototype.cork=function(){this._writableState.corked++};L.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||tn(this,t))};L.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=vh(e)),!Dr.isEncoding(e))throw new Aa(e);return this._writableState.defaultEncoding=e,this};function qh(t,e,r,i,n){let s=e.objectMode?1:r.length;e.length+=s;let o=e.length<e.highWaterMark;return o||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==Ji&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function wa(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new zt("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function xa(t,e,r,i){--e.pendingcb,i(r),en(e),Rt(t,r)}function Uh(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){Rt(t,new Ta);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?tt.nextTick(xa,t,r,e,n):xa(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&tn(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},tt.nextTick(Wh,r.afterWriteTickInfo)):Na(t,r,1,n))}function Wh({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,Na(t,e,r,i)}function Na(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&en(e),rn(t,e)}function en(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:o}=t.buffered[n],a=t.objectMode?1:s.length;t.length-=a,o((e=t.errored)!==null&&e!==void 0?e:new zt("write"))}let r=t[Tt].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new zt("end"))}$r(t)}function tn(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,s=r.length-i;if(!s)return;let o=i;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let a=e.allNoop?Ji:u=>{for(let c=o;c<r.length;++c)r[c].callback(u)},l=e.allNoop&&o===0?r:Ea(r,o);l.allBuffers=e.allBuffers,wa(t,e,!0,e.length,l,"",a),$r(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let c=n?1:a.length;wa(t,e,!1,c,a,l,u)}while(o<r.length&&!e.writing);o===r.length?$r(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}L.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Oh("_write()")};L.prototype._writev=null;L.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let s=va(this,t,e);s instanceof Th&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,rn(this,i,!0),i.ended=!0):i.finished?n=new Mh("end"):i.destroyed&&(n=new zt("end"))),typeof r=="function"&&(n||i.finished?tt.nextTick(r,n):i[Tt].push(r)),this};function Mr(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function Gh(t,e){let r=!1;function i(n){if(r){Rt(t,n!=null?n:Ta());return}if(r=!0,e.pendingcb--,n){let s=e[Tt].splice(0);for(let o=0;o<s.length;o++)s[o](n);Rt(t,n,e.sync)}else Mr(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,tt.nextTick(Xi,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function Qh(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Gh(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function rn(t,e,r){Mr(e)&&(Qh(t,e),e.pendingcb===0&&(r?(e.pendingcb++,tt.nextTick((i,n)=>{Mr(n)?Xi(i,n):n.pendingcb--},t,e)):Mr(e)&&(e.pendingcb++,Xi(t,e))))}function Xi(t,e){e.pendingcb--,e.finished=!0;let r=e[Tt].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}Ah(L.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},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(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.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)}}});var zh=kr.destroy;L.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Tt].length)&&tt.nextTick(en,r),zh.call(this,t,e),this};L.prototype._undestroy=kr.undestroy;L.prototype._destroy=function(t,e){e(t)};L.prototype[jh.captureRejectionSymbol]=function(t){this.destroy(t)};var Zi;function Pa(){return Zi===void 0&&(Zi={}),Zi}L.fromWeb=function(t,e){return Pa().newStreamWritableFromWritableStream(t,e)};L.toWeb=function(t){return Pa().newWritableStreamFromStreamWritable(t)}});var za=A((xb,Qa)=>{var nn=De(),Vh=ue(),{isReadable:Hh,isWritable:Kh,isIterable:La,isNodeStream:Yh,isReadableNodeStream:Ba,isWritableNodeStream:Fa,isDuplexNodeStream:Zh,isReadableStream:Ca,isWritableStream:Oa}=pe(),Da=Ae(),{AbortError:Wa,codes:{ERR_INVALID_ARG_TYPE:Xh,ERR_INVALID_RETURN_VALUE:Ma}}=z(),{destroyer:vt}=Xe(),Jh=ge(),Ga=Gt(),e_=qr(),{createDeferredPromise:$a}=K(),ka=Ui(),qa=globalThis.Blob||Vh.Blob,t_=typeof qa!="undefined"?function(e){return e instanceof qa}:function(e){return!1},r_=globalThis.AbortController||bt().AbortController,{FunctionPrototypeCall:Ua}=j(),ke=class extends Jh{constructor(e){super(e),(e==null?void 0:e.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(e==null?void 0:e.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Qa.exports=function t(e,r){if(Zh(e))return e;if(Ba(e))return At({readable:e});if(Fa(e))return At({writable:e});if(Yh(e))return At({writable:!1,readable:!1});if(Ca(e))return At({readable:Ga.fromWeb(e)});if(Oa(e))return At({writable:e_.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:a}=i_(e);if(La(n))return ka(ke,n,{objectMode:!0,write:s,final:o,destroy:a});let l=n==null?void 0:n.then;if(typeof l=="function"){let u,c=Ua(l,n,f=>{if(f!=null)throw new Ma("nully","body",f)},f=>{vt(u,f)});return u=new ke({objectMode:!0,readable:!1,write:s,final(f){o(async()=>{try{await c,nn.nextTick(f,null)}catch(h){nn.nextTick(f,h)}})},destroy:a})}throw new Ma("Iterable, AsyncIterable or AsyncFunction",r,n)}if(t_(e))return t(e.arrayBuffer());if(La(e))return ka(ke,e,{objectMode:!0,writable:!1});if(Ca(e==null?void 0:e.readable)&&Oa(e==null?void 0:e.writable))return ke.fromWeb(e);if(typeof(e==null?void 0:e.writable)=="object"||typeof(e==null?void 0:e.readable)=="object"){let n=e!=null&&e.readable?Ba(e==null?void 0:e.readable)?e==null?void 0:e.readable:t(e.readable):void 0,s=e!=null&&e.writable?Fa(e==null?void 0:e.writable)?e==null?void 0:e.writable:t(e.writable):void 0;return At({readable:n,writable:s})}let i=e==null?void 0:e.then;if(typeof i=="function"){let n;return Ua(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{vt(n,s)}),n=new ke({objectMode:!0,writable:!1,read(){}})}throw new Xh(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function i_(t){let{promise:e,resolve:r}=$a(),i=new r_,n=i.signal;return{value:t((function(){return ee(this,null,function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=yield new G(o);if(nn.nextTick(u),l)return;if(n.aborted)throw new Wa(void 0,{cause:n.reason});({promise:e,resolve:r}=$a()),yield a}})})(),{signal:n}),write(o,a,l){let u=r;r=null,u({chunk:o,done:!1,cb:l})},final(o){let a=r;r=null,a({done:!0,cb:o})},destroy(o,a){i.abort(),a(o)}}}function At(t){let e=t.readable&&typeof t.readable.read!="function"?Ga.wrap(t.readable):t.readable,r=t.writable,i=!!Hh(e),n=!!Kh(r),s,o,a,l,u;function c(f){let h=l;l=null,h?h(f):f&&u.destroy(f)}return u=new ke({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(Da(r,f=>{n=!1,f&&vt(e,f),c(f)}),u._write=function(f,h,d){r.write(f,h)?d():s=d},u._final=function(f){r.end(),o=f},r.on("drain",function(){if(s){let f=s;s=null,f()}}),r.on("finish",function(){if(o){let f=o;o=null,f()}})),i&&(Da(e,f=>{i=!1,f&&vt(e,f),c(f)}),e.on("readable",function(){if(a){let f=a;a=null,f()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let f=e.read();if(f===null){a=u._read;return}if(!u.push(f))return}}),u._destroy=function(f,h){!f&&l!==null&&(f=new Wa),a=null,s=null,o=null,l===null?h(f):(l=h,vt(r,f),vt(e,f))},u}});var ge=A((Sb,Ka)=>{"use strict";var{ObjectDefineProperties:n_,ObjectGetOwnPropertyDescriptor:ve,ObjectKeys:s_,ObjectSetPrototypeOf:Va}=j();Ka.exports=oe;var an=Gt(),ie=qr();Va(oe.prototype,an.prototype);Va(oe,an);{let t=s_(ie.prototype);for(let e=0;e<t.length;e++){let r=t[e];oe.prototype[r]||(oe.prototype[r]=ie.prototype[r])}}function oe(t){if(!(this instanceof oe))return new oe(t);an.call(this,t),ie.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}n_(oe.prototype,{writable:D({__proto__:null},ve(ie.prototype,"writable")),writableHighWaterMark:D({__proto__:null},ve(ie.prototype,"writableHighWaterMark")),writableObjectMode:D({__proto__:null},ve(ie.prototype,"writableObjectMode")),writableBuffer:D({__proto__:null},ve(ie.prototype,"writableBuffer")),writableLength:D({__proto__:null},ve(ie.prototype,"writableLength")),writableFinished:D({__proto__:null},ve(ie.prototype,"writableFinished")),writableCorked:D({__proto__:null},ve(ie.prototype,"writableCorked")),writableEnded:D({__proto__:null},ve(ie.prototype,"writableEnded")),writableNeedDrain:D({__proto__:null},ve(ie.prototype,"writableNeedDrain")),destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var sn;function Ha(){return sn===void 0&&(sn={}),sn}oe.fromWeb=function(t,e){return Ha().newStreamDuplexFromReadableWritablePair(t,e)};oe.toWeb=function(t){return Ha().newReadableWritablePairFromDuplex(t)};var on;oe.from=function(t){return on||(on=za()),on(t,"body")}});var fn=A((Rb,Za)=>{"use strict";var{ObjectSetPrototypeOf:Ya,Symbol:o_}=j();Za.exports=Ne;var{ERR_METHOD_NOT_IMPLEMENTED:a_}=z().codes,un=ge(),{getHighWaterMark:l_}=qt();Ya(Ne.prototype,un.prototype);Ya(Ne,un);var Ht=o_("kCallback");function Ne(t){if(!(this instanceof Ne))return new Ne(t);let e=t?l_(this,t,"readableHighWaterMark",!0):null;e===0&&(t=Be(D({},t),{highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0})),un.call(this,t),this._readableState.sync=!1,this[Ht]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",u_)}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 u_(){this._final!==ln&&ln.call(this)}Ne.prototype._final=ln;Ne.prototype._transform=function(t,e,r){throw new a_("_transform()")};Ne.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,s=i.length;this._transform(t,e,(o,a)=>{if(o){r(o);return}a!=null&&this.push(a),n.ended||s===i.length||i.length<i.highWaterMark?r():this[Ht]=r})};Ne.prototype._read=function(){if(this[Ht]){let t=this[Ht];this[Ht]=null,t()}}});var dn=A((Ab,Ja)=>{"use strict";var{ObjectSetPrototypeOf:Xa}=j();Ja.exports=Nt;var cn=fn();Xa(Nt.prototype,cn.prototype);Xa(Nt,cn);function Nt(t){if(!(this instanceof Nt))return new Nt(t);cn.call(this,t)}Nt.prototype._transform=function(t,e,r){r(null,t)}});var Qr=A((vb,nl)=>{var Kt=De(),{ArrayIsArray:f_,Promise:c_,SymbolAsyncIterator:d_,SymbolDispose:h_}=j(),Gr=Ae(),{once:__}=K(),p_=Xe(),el=ge(),{aggregateTwoErrors:b_,codes:{ERR_INVALID_ARG_TYPE:xn,ERR_INVALID_RETURN_VALUE:hn,ERR_MISSING_ARGS:y_,ERR_STREAM_DESTROYED:g_,ERR_STREAM_PREMATURE_CLOSE:m_},AbortError:w_}=z(),{validateFunction:x_,validateAbortSignal:E_}=mt(),{isIterable:rt,isReadable:_n,isReadableNodeStream:Wr,isNodeStream:tl,isTransformStream:Pt,isWebStream:S_,isReadableStream:pn,isReadableFinished:I_}=pe(),R_=globalThis.AbortController||bt().AbortController,bn,yn,gn;function rl(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=Gr(t,{readable:e,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,p_.destroyer(t,s||new g_("pipe")))},cleanup:n}}function T_(t){return x_(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function mn(t){if(rt(t))return t;if(Wr(t))return A_(t);throw new xn("val",["Readable","Iterable","AsyncIterable"],t)}function A_(t){return ee(this,null,function*(){yn||(yn=Gt()),yield*ne(yn.prototype[d_].call(t))})}async function Ur(t,e,r,{end:i}){let n,s=null,o=d=>{if(d&&(n=d),s){let _=s;s=null,_()}},a=()=>new c_((d,_)=>{n?_(n):s=()=>{n?_(n):d()}});e.on("drain",o);let l=Gr(e,{readable:!1},o);try{e.writableNeedDrain&&await a();try{for(var u=Y(t),c,f,h;c=!(f=await u.next()).done;c=!1){let d=f.value;e.write(d)||await a()}}catch(f){h=[f]}finally{try{c&&(f=u.return)&&await f.call(u)}finally{if(h)throw h[0]}}i&&(e.end(),await a()),r()}catch(d){r(n!==d?b_(n,d):d)}finally{l(),e.off("drain",o)}}async function wn(t,e,r,{end:i}){Pt(e)&&(e=e.writable);let n=e.getWriter();try{try{for(var s=Y(t),o,a,l;o=!(a=await s.next()).done;o=!1){let u=a.value;await n.ready,n.write(u).catch(()=>{})}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&await a.call(s)}finally{if(l)throw l[0]}}await n.ready,i&&await n.close(),r()}catch(u){try{await n.abort(u),r(u)}catch(c){r(c)}}}function v_(...t){return il(t,__(T_(t)))}function il(t,e,r){if(t.length===1&&f_(t[0])&&(t=t[0]),t.length<2)throw new y_("streams");let i=new R_,n=i.signal,s=r==null?void 0:r.signal,o=[];E_(s,"options.signal");function a(){_(new w_)}gn=gn||K().addAbortListener;let l;s&&(l=gn(s,a));let u,c,f=[],h=0;function d(x){_(x,--h===0)}function _(x,g){var w;if(x&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=x),!(!u&&!g)){for(;f.length;)f.shift()(u);(w=l)===null||w===void 0||w[h_](),i.abort(),g&&(u||o.forEach(R=>R()),Kt.nextTick(e,u,c))}}let p;for(let x=0;x<t.length;x++){let g=t[x],w=x<t.length-1,R=x>0,T=w||(r==null?void 0:r.end)!==!1,U=x===t.length-1;if(tl(g)){let O=function(J){J&&J.name!=="AbortError"&&J.code!=="ERR_STREAM_PREMATURE_CLOSE"&&d(J)};var S=O;if(T){let{destroy:J,cleanup:Xr}=rl(g,w,R);f.push(J),_n(g)&&U&&o.push(Xr)}g.on("error",O),_n(g)&&U&&o.push(()=>{g.removeListener("error",O)})}if(x===0)if(typeof g=="function"){if(p=g({signal:n}),!rt(p))throw new hn("Iterable, AsyncIterable or Stream","source",p)}else rt(g)||Wr(g)||Pt(g)?p=g:p=el.from(g);else if(typeof g=="function"){if(Pt(p)){var y;p=mn((y=p)===null||y===void 0?void 0:y.readable)}else p=mn(p);if(p=g(p,{signal:n}),w){if(!rt(p,!0))throw new hn("AsyncIterable",`transform[${x-1}]`,p)}else{var m;bn||(bn=dn());let O=new bn({objectMode:!0}),J=(m=p)===null||m===void 0?void 0:m.then;if(typeof J=="function")h++,J.call(p,Le=>{c=Le,Le!=null&&O.write(Le),T&&O.end(),Kt.nextTick(d)},Le=>{O.destroy(Le),Kt.nextTick(d,Le)});else if(rt(p,!0))h++,Ur(p,O,d,{end:T});else if(pn(p)||Pt(p)){let Le=p.readable||p;h++,Ur(Le,O,d,{end:T})}else throw new hn("AsyncIterable or Promise","destination",p);p=O;let{destroy:Xr,cleanup:$l}=rl(p,!1,!0);f.push(Xr),U&&o.push($l)}}else if(tl(g)){if(Wr(p)){h+=2;let O=N_(p,g,d,{end:T});_n(g)&&U&&o.push(O)}else if(Pt(p)||pn(p)){let O=p.readable||p;h++,Ur(O,g,d,{end:T})}else if(rt(p))h++,Ur(p,g,d,{end:T});else throw new xn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=g}else if(S_(g)){if(Wr(p))h++,wn(mn(p),g,d,{end:T});else if(pn(p)||rt(p))h++,wn(p,g,d,{end:T});else if(Pt(p))h++,wn(p.readable,g,d,{end:T});else throw new xn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=g}else p=el.from(g)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&Kt.nextTick(a),p}function N_(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new m_)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;I_(t)?Kt.nextTick(o):t.once("end",o)}else r();return Gr(t,{readable:!0,writable:!1},o=>{let a=t._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(o)}),Gr(e,{readable:!1,writable:!0},r)}nl.exports={pipelineImpl:il,pipeline:v_}});var Sn=A((Pb,fl)=>{"use strict";var{pipeline:P_}=Qr(),zr=ge(),{destroyer:j_}=Xe(),{isNodeStream:Vr,isReadable:sl,isWritable:ol,isWebStream:En,isTransformStream:it,isWritableStream:al,isReadableStream:ll}=pe(),{AbortError:L_,codes:{ERR_INVALID_ARG_VALUE:ul,ERR_MISSING_ARGS:B_}}=z(),F_=Ae();fl.exports=function(...e){if(e.length===0)throw new B_("streams");if(e.length===1)return zr.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=zr.from(e[0])),typeof e[e.length-1]=="function"){let d=e.length-1;e[d]=zr.from(e[d])}for(let d=0;d<e.length;++d)if(!(!Vr(e[d])&&!En(e[d]))){if(d<e.length-1&&!(sl(e[d])||ll(e[d])||it(e[d])))throw new ul(`streams[${d}]`,r[d],"must be readable");if(d>0&&!(ol(e[d])||al(e[d])||it(e[d])))throw new ul(`streams[${d}]`,r[d],"must be writable")}let i,n,s,o,a;function l(d){let _=o;o=null,_?_(d):d?a.destroy(d):!h&&!f&&a.destroy()}let u=e[0],c=P_(e,l),f=!!(ol(u)||al(u)||it(u)),h=!!(sl(c)||ll(c)||it(c));if(a=new zr({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(c!=null&&c.readableObjectMode),writable:f,readable:h}),f){if(Vr(u))a._write=function(_,p,y){u.write(_,p)?y():i=y},a._final=function(_){u.end(),n=_},u.on("drain",function(){if(i){let _=i;i=null,_()}});else if(En(u)){let p=(it(u)?u.writable:u).getWriter();a._write=async function(y,m,S){try{await p.ready,p.write(y).catch(()=>{}),S()}catch(x){S(x)}},a._final=async function(y){try{await p.ready,p.close().catch(()=>{}),n=y}catch(m){y(m)}}}let d=it(c)?c.readable:c;F_(d,()=>{if(n){let _=n;n=null,_()}})}if(h){if(Vr(c))c.on("readable",function(){if(s){let d=s;s=null,d()}}),c.on("end",function(){a.push(null)}),a._read=function(){for(;;){let d=c.read();if(d===null){s=a._read;return}if(!a.push(d))return}};else if(En(c)){let _=(it(c)?c.readable:c).getReader();a._read=async function(){for(;;)try{let{value:p,done:y}=await _.read();if(!a.push(p))return;if(y){a.push(null);return}}catch(p){return}}}}return a._destroy=function(d,_){!d&&o!==null&&(d=new L_),s=null,i=null,n=null,o===null?_(d):(o=_,Vr(c)&&j_(c,d))},a}});var wl=A((jb,Tn)=>{"use strict";var C_=globalThis.AbortController||bt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:O_,ERR_INVALID_ARG_TYPE:Yt,ERR_MISSING_ARGS:D_,ERR_OUT_OF_RANGE:M_},AbortError:me}=z(),{validateAbortSignal:nt,validateInteger:cl,validateObject:st}=mt(),$_=j().Symbol("kWeak"),k_=j().Symbol("kResistStopPropagation"),{finished:q_}=Ae(),U_=Sn(),{addAbortSignalNoValidate:W_}=kt(),{isWritable:G_,isNodeStream:Q_}=pe(),{deprecate:z_}=K(),{ArrayPrototypePush:V_,Boolean:H_,MathFloor:dl,Number:K_,NumberIsNaN:Y_,Promise:hl,PromiseReject:_l,PromiseResolve:Z_,PromisePrototypeThen:pl,Symbol:yl}=j(),Hr=yl("kEmpty"),bl=yl("kEof");function X_(t,e){if(e!=null&&st(e,"options"),(e==null?void 0:e.signal)!=null&&nt(e.signal,"options.signal"),Q_(t)&&!G_(t))throw new O_("stream",t,"must be writable");let r=U_(this,t);return e!=null&&e.signal&&W_(e.signal,r),r}function Kr(t,e){if(typeof t!="function")throw new Yt("fn",["Function","AsyncFunction"],t);e!=null&&st(e,"options"),(e==null?void 0:e.signal)!=null&&nt(e.signal,"options.signal");let r=1;(e==null?void 0:e.concurrency)!=null&&(r=dl(e.concurrency));let i=r-1;return(e==null?void 0:e.highWaterMark)!=null&&(i=dl(e.highWaterMark)),cl(r,"options.concurrency",1),cl(i,"options.highWaterMark",0),i+=r,function(){return ee(this,null,function*(){let s=K().AbortSignalAny([e==null?void 0:e.signal].filter(H_)),o=this,a=[],l={signal:s},u,c,f=!1,h=0;function d(){f=!0,_()}function _(){h-=1,p()}function p(){c&&!f&&h<r&&a.length<i&&(c(),c=null)}async function y(){try{try{for(var m=Y(o),S,x,g;S=!(x=await m.next()).done;S=!1){let w=x.value;if(f)return;if(s.aborted)throw new me;try{if(w=t(w,l),w===Hr)continue;w=Z_(w)}catch(R){w=_l(R)}h+=1,pl(w,_,d),a.push(w),u&&(u(),u=null),!f&&(a.length>=i||h>=r)&&await new hl(R=>{c=R})}}catch(x){g=[x]}finally{try{S&&(x=m.return)&&await x.call(m)}finally{if(g)throw g[0]}}a.push(bl)}catch(w){let R=_l(w);pl(R,_,d),a.push(R)}finally{f=!0,u&&(u(),u=null)}}y();try{for(;;){for(;a.length>0;){let m=yield new G(a[0]);if(m===bl)return;if(s.aborted)throw new me;m!==Hr&&(yield m),a.shift(),p()}yield new G(new hl(m=>{u=m}))}}finally{f=!0,c&&(c(),c=null)}})}.call(this)}function J_(t=void 0){return t!=null&&st(t,"options"),(t==null?void 0:t.signal)!=null&&nt(t.signal,"options.signal"),function(){return ee(this,null,function*(){let r=0;try{for(var n=Y(this),s,o,a;s=!(o=yield new G(n.next())).done;s=!1){let l=o.value;var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new me({cause:t.signal.reason});yield[r++,l]}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new G(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}async function gl(t,e=void 0){try{for(var r=Y(Rn.call(this,t,e)),i,n,s;i=!(n=await r.next()).done;i=!1){let o=n.value;return!0}}catch(n){s=[n]}finally{try{i&&(n=r.return)&&await n.call(r)}finally{if(s)throw s[0]}}return!1}async function ep(t,e=void 0){if(typeof t!="function")throw new Yt("fn",["Function","AsyncFunction"],t);return!await gl.call(this,async(...r)=>!await t(...r),e)}async function tp(t,e){try{for(var r=Y(Rn.call(this,t,e)),i,n,s;i=!(n=await r.next()).done;i=!1){let o=n.value;return o}}catch(n){s=[n]}finally{try{i&&(n=r.return)&&await n.call(r)}finally{if(s)throw s[0]}}}async function rp(t,e){if(typeof t!="function")throw new Yt("fn",["Function","AsyncFunction"],t);async function r(a,l){return await t(a,l),Hr}try{for(var i=Y(Kr.call(this,r,e)),n,s,o;n=!(s=await i.next()).done;n=!1){let a=s.value;;}}catch(s){o=[s]}finally{try{n&&(s=i.return)&&await s.call(i)}finally{if(o)throw o[0]}}}function Rn(t,e){if(typeof t!="function")throw new Yt("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Hr}return Kr.call(this,r,e)}var In=class extends D_{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function ip(t,e,r){var i;if(typeof t!="function")throw new Yt("reducer",["Function","AsyncFunction"],t);r!=null&&st(r,"options"),(r==null?void 0:r.signal)!=null&&nt(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let d=new me(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await q_(this.destroy(d)),d}let s=new C_,o=s.signal;if(r!=null&&r.signal){let d={once:!0,[$_]:this,[k_]:!0};r.signal.addEventListener("abort",()=>s.abort(),d)}let a=!1;try{try{for(var u=Y(this),c,f,h;c=!(f=await u.next()).done;c=!1){let d=f.value;var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new me;n?e=await t(e,d,{signal:o}):(e=d,n=!0)}}catch(f){h=[f]}finally{try{c&&(f=u.return)&&await f.call(u)}finally{if(h)throw h[0]}}if(!a&&!n)throw new In}finally{s.abort()}return e}async function np(t){t!=null&&st(t,"options"),(t==null?void 0:t.signal)!=null&&nt(t.signal,"options.signal");let e=[];try{for(var i=Y(this),n,s,o;n=!(s=await i.next()).done;n=!1){let a=s.value;var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new me(void 0,{cause:t.signal.reason});V_(e,a)}}catch(s){o=[s]}finally{try{n&&(s=i.return)&&await s.call(i)}finally{if(o)throw o[0]}}return e}function sp(t,e){let r=Kr.call(this,t,e);return function(){return ee(this,null,function*(){try{for(var n=Y(r),s,o,a;s=!(o=yield new G(n.next())).done;s=!1){let l=o.value;yield*ne(l)}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new G(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}function ml(t){if(t=K_(t),Y_(t))return 0;if(t<0)throw new M_("number",">= 0",t);return t}function op(t,e=void 0){return e!=null&&st(e,"options"),(e==null?void 0:e.signal)!=null&&nt(e.signal,"options.signal"),t=ml(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new me;try{for(var s=Y(this),o,a,l;o=!(a=yield new G(s.next())).done;o=!1){let u=a.value;var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new me;t--<=0&&(yield u)}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new G(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}function ap(t,e=void 0){return e!=null&&st(e,"options"),(e==null?void 0:e.signal)!=null&&nt(e.signal,"options.signal"),t=ml(t),function(){return ee(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new me;try{for(var s=Y(this),o,a,l;o=!(a=yield new G(s.next())).done;o=!1){let u=a.value;var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new me;if(t-- >0&&(yield u),t<=0)return}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new G(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}Tn.exports.streamReturningOperators={asIndexedPairs:z_(J_,"readable.asIndexedPairs will be removed in a future version."),drop:op,filter:Rn,flatMap:sp,map:Kr,take:ap,compose:X_};Tn.exports.promiseReturningOperators={every:ep,forEach:rp,reduce:ip,toArray:np,some:gl,find:tp}});var An=A((Bb,xl)=>{"use strict";var{ArrayPrototypePop:lp,Promise:up}=j(),{isIterable:fp,isNodeStream:cp,isWebStream:dp}=pe(),{pipelineImpl:hp}=Qr(),{finished:_p}=Ae();vn();function pp(...t){return new up((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!cp(s)&&!fp(s)&&!dp(s)){let o=lp(t);i=o.signal,n=o.end}hp(t,(o,a)=>{o?r(o):e(a)},{signal:i,end:n})})}xl.exports={finished:_p,pipeline:pp}});var vn=A((Fb,Pl)=>{"use strict";var{Buffer:bp}=ue(),{ObjectDefineProperty:Pe,ObjectKeys:Il,ReflectApply:Rl}=j(),{promisify:{custom:Tl}}=K(),{streamReturningOperators:El,promiseReturningOperators:Sl}=wl(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Al}}=z(),yp=Sn(),{setDefaultHighWaterMark:gp,getDefaultHighWaterMark:mp}=qt(),{pipeline:vl}=Qr(),{destroyer:wp}=Xe(),Nl=Ae(),Nn=An(),Zt=pe(),P=Pl.exports=vr().Stream;P.isDestroyed=Zt.isDestroyed;P.isDisturbed=Zt.isDisturbed;P.isErrored=Zt.isErrored;P.isReadable=Zt.isReadable;P.isWritable=Zt.isWritable;P.Readable=Gt();for(let t of Il(El)){let r=function(...i){if(new.target)throw Al();return P.Readable.from(Rl(e,this,i))},e=El[t];Pe(r,"name",{__proto__:null,value:e.name}),Pe(r,"length",{__proto__:null,value:e.length}),Pe(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Il(Sl)){let r=function(...i){if(new.target)throw Al();return Rl(e,this,i)},e=Sl[t];Pe(r,"name",{__proto__:null,value:e.name}),Pe(r,"length",{__proto__:null,value:e.length}),Pe(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}P.Writable=qr();P.Duplex=ge();P.Transform=fn();P.PassThrough=dn();P.pipeline=vl;var{addAbortSignal:xp}=kt();P.addAbortSignal=xp;P.finished=Nl;P.destroy=wp;P.compose=yp;P.setDefaultHighWaterMark=gp;P.getDefaultHighWaterMark=mp;Pe(P,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Nn}});Pe(vl,Tl,{__proto__:null,enumerable:!0,get(){return Nn.pipeline}});Pe(Nl,Tl,{__proto__:null,enumerable:!0,get(){return Nn.finished}});P.Stream=P;P._isUint8Array=function(e){return e instanceof Uint8Array};P._uint8ArrayToBuffer=function(e){return bp.from(e.buffer,e.byteOffset,e.byteLength)}});var Yr=A((Cb,C)=>{"use strict";var q=vn(),Ep=An(),Sp=q.Readable.destroy;C.exports=q.Readable;C.exports._uint8ArrayToBuffer=q._uint8ArrayToBuffer;C.exports._isUint8Array=q._isUint8Array;C.exports.isDisturbed=q.isDisturbed;C.exports.isErrored=q.isErrored;C.exports.isReadable=q.isReadable;C.exports.Readable=q.Readable;C.exports.Writable=q.Writable;C.exports.Duplex=q.Duplex;C.exports.Transform=q.Transform;C.exports.PassThrough=q.PassThrough;C.exports.addAbortSignal=q.addAbortSignal;C.exports.finished=q.finished;C.exports.destroy=q.destroy;C.exports.destroy=Sp;C.exports.pipeline=q.pipeline;C.exports.compose=q.compose;Object.defineProperty(q,"promises",{configurable:!0,enumerable:!0,get(){return Ep}});C.exports.Stream=q.Stream;C.exports.default=C.exports});var ss=nr(ue());var Ge="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ct="http://www.w3.org/2001/XMLSchema#",lr="http://www.w3.org/2000/10/swap/",N={xsd:{decimal:`${ct}decimal`,boolean:`${ct}boolean`,dateTime:`${ct}dateTime`,double:`${ct}double`,integer:`${ct}integer`,string:`${ct}string`},rdf:{type:`${Ge}type`,nil:`${Ge}nil`,first:`${Ge}first`,rest:`${Ge}rest`,langString:`${Ge}langString`,dirLangString:`${Ge}dirLangString`,reifies:`${Ge}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${lr}reify#forSome`,forAll:`${lr}reify#forAll`},log:{implies:`${lr}log#implies`,isImpliedBy:`${lr}log#isImpliedBy`}};var{xsd:ur}=N,fr=32,cr=9,is=10,dr=13,vu=35,ns={"\\":"\\","'":"'",'"':'"',n:`
3
- `,r:"\r",t:" ",f:"\f",b:"\b"},Nu={_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","'":"'","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Pu=/[\x00-\x20<>\\"\{\}\|\^\`]/,ju=/[\s<>"{}|^`]/g;function Lu(t){return t<=1114111&&(t<55296||t>57343)}var Bu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_commentLine:!0,_whitespace:!0},Fu=/$0^/,Cu=/\S*/y;function M(t,e,r){return t.lastIndex=r,t.exec(e)}function hr(t,e,r){return t.lastIndex=r,t.test(e)}function _r(t,e,r){return t.lastIndex=0,t.exec(`${e.slice(r)} `)}var Qe=class{constructor(e){if(this._iri=/<((?:[^ <>{}\\]|\\[uU])+)>[ \t]*/y,this._unescapedIri=/<([^\x00-\x20<>\\"\{\}\|\^\`]*)>[ \t]*/y,this._simpleQuotedString=/"([^"\\\r\n]*)"(?=[^"])/y,this._simpleApostropheString=/'([^'\\\r\n]*)'(?=[^'])/y,this._langcode=/@([a-z]+(?:-[a-z0-9]+)*)(?=[^a-z0-9])/iy,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<])/y,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-9: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-9: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-9: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#()\[\]\{\}"'<>]))/y,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-9: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#()\[\]\{\}"'<>])/y,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#()\[\]\{\}"'<>]))/y,this._number=/[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?\d+|(?=\.?\d)\d*(?:(\.)\d+)?)(?=\.?[,;:!\^\s#()\[\]\{\}"'<>])/y,this._boolean=/(?:true|false)(?=[.,;!\^\s#()\[\]\{\}"'<>])/y,this._atKeyword=/@[a-z]+(?=[\s#<:])/iy,this._keyword=/(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/iy,this._n3Verb=/(?:has|is|of)(?=[\s#()\[\]\{\}"'<>?_+\-0-9])/y,this._n3Id=/id(?=[\s#<])/y,this._shortPredicates=/a(?=[\s#()\[\]\{\}"'<>])/y,this._commentLine=/[ \t]*#([^\n\r]*)(?:\r\n|\n|\r)([ \t]*)/y,this._whitespace=/[ \t]+/y,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in Bu)&&this[r]instanceof RegExp&&(this[r]=Fu)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let i=this._input,n=0,s=this._linePosition+i.length;for(;;){for(;;){let R=i.charCodeAt(n),T=0;if(R===fr||R===cr){let U=i.charCodeAt(n+1);T=U===fr||U===cr?M(this._whitespace,i,n)[0].length:1,R=i.charCodeAt(n+T)}if(R===vu){let U=M(this._commentLine,i,n);if(U){let O=U[0].length;if(!r&&n+O===i.length&&i.charCodeAt(i.length-1)===dr)return this._suspend(i,n,s);this.comments&&o(U[1],this._line,s-(i.length-n)+T),n+=O,s=i.length-n+U[2].length,this._line++}else{if(n+=T,!r)return this._suspend(i,n,s);this.comments&&o(i.slice(n+1),this._line,s-(i.length-n)),n=i.length;break}}else if(R===is||R===dr){if(!r&&R===dr&&n+T+1===i.length)return this._suspend(i,n,s);T+=R===dr&&i.charCodeAt(n+T+1)===is?2:1;let U=0,O=i.charCodeAt(n+T);if(O===fr||O===cr){let J=i.charCodeAt(n+T+1);U=J===fr||J===cr?M(this._whitespace,i,n+T)[0].length:1}n+=T+U,s=i.length-n+U,this._line++}else{n+=T;break}}if(n>=i.length)return this._linePosition=s,r?(a("eof","","",this._line,s,0),this._input=null):this._input="";let u=this._line,c=i[n],f="",h="",d="",_=null,p=0,y=0,m=0,S=!1;switch(c){case"^":if(i.length-n<3)break;if(i[n+1]==="^"){if(this._previousMarker="^^",n+=2,i[n]!=="<"){S=!0;break}}else{this._n3Mode&&(p=1,f="^");break}case"<":if(_=M(this._unescapedIri,i,n))f="IRI",h=_[1],y=_[1].length+2;else if(_=M(this._iri,i,n)){if(h=this._unescape(_[1],ns),h===null||Pu.test(h))return l(this,i,n);f="IRI",y=_[1].length+2}else i.length-n>2&&i[n+1]==="<"&&i[n+2]==="("?(f="<<(",p=3):!this._lineMode&&i.length-n>(r?1:2)&&i[n+1]==="<"?(f="<<",p=2):this._n3Mode&&i.length-n>1&&i[n+1]==="="?(p=2,this._isImpliedBy?(f="abbreviation",h="<"):(f="inverse",h=">")):this._n3Mode&&i.length-n>1&&i[n+1]==="-"&&(f="inversePredicate",p=2);break;case">":i.length-n>1&&i[n+1]===">"&&(f=">>",p=2);break;case"_":((_=M(this._blank,i,n))||r&&(_=_r(this._blank,i,n)))&&(f="blank",d="_",h=_[1],y=_[1].length+2);break;case'"':if(_=M(this._simpleQuotedString,i,n))h=_[1];else if({value:h,matchLength:p,finalLineLength:m}=this._parseLiteral(i,n),h===null)return l(this,i,n);(_!==null||p!==0)&&(f="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(_=M(this._simpleApostropheString,i,n))h=_[1];else if({value:h,matchLength:p,finalLineLength:m}=this._parseLiteral(i,n),h===null)return l(this,i,n);(_!==null||p!==0)&&(f="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(_=M(this._variable,i,n))&&(f="var",h=_[0]);break;case"@":if(this._previousMarker==="literal"&&(_=M(this._langcode,i,n))&&_[1]!=="version"){let R=n+_[0].length;!r&&i[R]==="-"&&i[R+1]!=="-"?_=null:(f="langcode",h=_[1])}else(_=M(this._atKeyword,i,n))&&(f=_[0]);break;case".":if(i.length-n===1?r:i[n+1]<"0"||i[n+1]>"9"){f=".",p=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":if(i[n+1]==="-"){this._previousMarker==="langcode"&&(i.startsWith("--ltr",n)?(f="dircode",h="ltr",p=5):i.startsWith("--rtl",n)&&(f="dircode",h="rtl",p=5));break}(_=M(this._number,i,n)||r&&(_=_r(this._number,i,n)))&&(f="literal",h=_[0],d=typeof _[1]=="string"?ur.double:typeof _[2]=="string"?ur.decimal:ur.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(_=M(this._keyword,i,n))?f=_[0].toUpperCase():S=!0;break;case"f":case"t":hr(this._boolean,i,n)?(f="literal",h=c==="t"?"true":"false",d=ur.boolean,p=h.length):S=!0;break;case"a":hr(this._shortPredicates,i,n)?(f="abbreviation",h="a",p=1):S=!0;break;case"h":case"o":this._n3Mode&&(_=this._matchN3Verb(i,n,r))?f=_[0]:S=!0;break;case"i":this._n3Mode&&hr(this._n3Id,i,n)?(f="id",p=2):this._n3Mode&&(_=this._matchN3Verb(i,n,r))?f=_[0]:S=!0;break;case"=":this._n3Mode&&i.length-n>1&&(f="abbreviation",i[n+1]!==">"?(p=1,h="="):(p=2,h=">"));break;case"!":if(!this._n3Mode)break;case")":if(!r&&(i.length-n===1||i.length-n===2&&i[n+1]===">"))break;if(i.length-n>2&&i[n+1]===">"&&i[n+2]===">"){f=")>>",p=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(p=1,f=c);break;case"{":!this._lineMode&&i.length-n>=2&&(i[n+1]==="|"?(f="{|",p=2):(f=c,p=1));break;case"|":i.length-n>=2&&i[n+1]==="}"&&(f="|}",p=2);break;default:S=!0}if(S&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(_=M(this._prefix,i,n))?(f="prefix",h=_[1]||""):((_=M(this._prefixed,i,n))||r&&(_=_r(this._prefixed,i,n)))&&(f="prefixed",d=_[1]||"",h=this._unescape(_[2],Nu),y=d.length+_[2].length+1)),this._previousMarker==="^^")switch(f){case"prefixed":f="type";break;case"IRI":f="typeIRI";break;default:f=""}if(!f)return r||!i.startsWith("'''",n)&&!i.startsWith('"""',n)&&/\n|\r/.test(i.slice(n))?l(this,i,n):this._suspend(i,n,s);let x=p||_[0].length,g=s-(i.length-n),w;m?(w={type:f,value:h,prefix:d,line:u,start:g,end:m,endLine:this._line},e(null,w)):w=a(f,h,d,u,g,y||x),this.previousToken=w,this._previousMarker=f,n=Math.min(n+x,i.length),m&&(s=i.length-n+m)}function o(u,c,f){e(null,{type:"comment",value:u,prefix:"",line:c,start:f,end:f+u.length+1})}function a(u,c,f,h,d,_){let p={type:u,value:c,prefix:f,line:h,start:d,end:d+_};return e(null,p),p}function l(u,c,f){e(u._syntaxError(M(Cu,c,f)[0]))}}_suspend(e,r,i){return this._linePosition=i-(e.length-r),this._input=e.slice(r)}_matchN3Verb(e,r,i){let n=M(this._n3Verb,e,r);if(!n)return null;let s=e[r+n[0].length];return s!=="-"&&s!=="_"&&(s<"0"||s>"9")?n:M(this._prefixed,e,r)?null:hr(ju,e,r)?n:_r(this._prefixed,e,r)||!i&&M(this._prefix,`${e.slice(r)}: `,0)?null:n}_unescape(e,r){let i=e.indexOf("\\");if(i<0)return e;let n="",s=0;for(;i>=0&&i+1<e.length;){let o=e[i+1],a=i+2,l;if(o==="u"||o==="U"){if(a+=o==="u"?4:8,a>e.length)return null;let u=0;for(let c=i+2;c<a;c++){let f=e.charCodeAt(c);if(f>=48&&f<=57)f-=48;else if(f>=65&&f<=70)f-=55;else if(f>=97&&f<=102)f-=87;else return null;u=u*16+f}if(!Lu(u))return null;l=String.fromCodePoint(u)}else{if(!(o in r))return null;l=r[o]}n+=e.slice(s,i)+l,s=a,i=e.indexOf("\\",s)}return n+e.slice(s)}_parseLiteral(e,r){if(e.length-r>=3){let i=e[r],n=e[r+1]===i&&e[r+2]===i?3:1,s=i;n===3&&(s=i==='"'?'"""':"'''");let o=r+Math.max(this._literalClosingPos,n);for(;(o=e.indexOf(s,o))>r;){let a=0;for(;e[o-a-1]==="\\";)a++;if(a%2===0){let l=e.substring(r+n,o),u=l.split(/\r\n|\r|\n/),c=u.length-1,f=o-r+n;if(n===1&&c!==0||n===3&&this._lineMode)break;this._line+=c;let h=c===0?0:u[u.length-1].length+n;return{value:this._unescape(l,ns),matchLength:f,finalLineLength:h}}o++}this._literalClosingPos=e.length-r-n+1}return{value:"",matchLength:0,finalLineLength:0}}_syntaxError(e){this._input=null;let 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")?(this._linePosition=1,e.slice(1)):e}tokenize(e,r){let i=this._tokenization={};if(this._line=1,this._linePosition=0,this._previousMarker=void 0,this.previousToken=void 0,this._literalClosingPos=0,this._input=void 0,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>{this._tokenization===i&&this._tokenizeToEnd(r,!0)});else{let n=[],s;if(this._tokenizeToEnd((o,a)=>o?s=o:n.push(a),!0),s)throw s;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._tokenization===i&&this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=ss.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input=="undefined"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{this._tokenization===i&&typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",n=>{this._tokenization===i&&r(n)})}};var{rdf:os,xsd:Ee}=N,ht,Ou=0,ci="<>";var ui={namedNode:as,blankNode:ls,variable:fs,literal:us,defaultGraph:Du,quad:fi,triple:fi,fromTerm:Ft,fromQuad:cs},X=ui,H=class t{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof t?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},dt=class extends H{constructor(e){e!==""?super(e):(super(ci),Object.defineProperty(this,"value",{value:""}))}get termType(){return"NamedNode"}},Se=class t extends H{constructor(e){super(e)}get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,r=e.lastIndexOf('"')+1,i=e.lastIndexOf("--");return r<e.length&&e[r++]==="@"?(i>r?e.substr(0,i):e).substr(r).toLowerCase():""}get direction(){let e=this.id,r=e.lastIndexOf('"'),i=e.lastIndexOf("--");return i>r&&i+2<e.length?e.substr(i+2).toLowerCase():""}get datatype(){return new dt(this.datatypeString)}get datatypeString(){let e=this.id,r=e.lastIndexOf('"')+1,i=r<e.length?e[r]:"";return i==="^"?e.substr(r+2):i!=="@"?Ee.string:e.indexOf("--",r)>0?os.dirLangString:os.langString}equals(e){return e instanceof t?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&(this.direction===e.direction||this.direction===""&&!e.direction)&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,direction:this.direction,datatype:{termType:"NamedNode",value:this.datatypeString}}}},Ct=class extends H{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Ot=class extends H{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Dt=class extends H{constructor(){return super(""),ht||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};ht=new Dt;function Ce(t,e,r){if(e=e||ui,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===ui)return new Se(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let i=t.lastIndexOf('"',t.length-1),n;if(t[i+1]==="@"){n=t.substr(i+2);let s=n.lastIndexOf("--");s>0&&s<n.length&&(n={language:n.substr(0,s),direction:n.substr(s+2)})}else n=e.namedNode(t.substr(i+3));return e.literal(t.substr(1,i-1),n);case"[":t=JSON.parse(t);break;case"<":if(t===ci)return e.namedNode("");default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Ce(t[0],e,!0),Ce(t[1],e,!0),Ce(t[2],e,!0),t[3]&&Ce(t[3],e,!0))}function $(t,e){if(typeof t=="string")return t;if(t instanceof H&&t.termType!=="Quad")return t.id;if(!t)return ht.id;switch(t.termType){case"NamedNode":{let i=t.value;return i!==""?i:ci}case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}${t.direction?`--${t.direction}`:""}`:t.datatype&&t.datatype.value!==Ee.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[$(t.subject,!0),$(t.predicate,!0),$(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push($(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Oe=class extends H{constructor(e,r,i,n){super(""),this._subject=e,this._predicate=r,this._object=i,this._graph=n||ht}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 as(t){return new dt(t)}function ls(t){return new Ct(t||`n3-${Ou++}`)}function us(t,e){if(typeof e=="string")return new Se(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new Se(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=Ee.boolean:typeof t=="number"?Number.isFinite(t)?r=Number.isInteger(t)&&Math.abs(t)<1e21?Ee.integer:Ee.double:(r=Ee.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")):typeof t=="bigint"?r=Ee.integer:t instanceof Date&&!Number.isNaN(t.getTime())&&(r=Ee.dateTime,t=t.toISOString())),r===""||r===Ee.string?new Se(`"${t}"`):new Se(`"${t}"^^${r}`)}function fs(t){return new Ot(t)}function Du(){return ht}function fi(t,e,r,i){return new Oe(t,e,r,i)}function Ft(t){if(t instanceof H)return t;switch(t.termType){case"NamedNode":return as(t.value);case"BlankNode":return ls(t.value);case"Variable":return fs(t.value);case"DefaultGraph":return ht;case"Literal":return us(t.value,t.language?t.direction?{language:t.language,direction:t.direction}:t.language:t.datatype);case"Quad":return cs(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function cs(t){if(t instanceof Oe)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return fi(Ft(t.subject),Ft(t.predicate),Ft(t.object),Ft(t.graph))}var ds=0,Ie=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&_s(this,e.factory);let r=typeof e.format=="string"?e.format.match(/(?:^|\W)(\w*)$/)[1].toLowerCase():"",i=/turtle/.test(r),n=/trig/.test(r),s=/triple/.test(r),o=/quad/.test(r),a=this._n3Mode=/n3/.test(r),l=s||o;this._emitCurrent=this._emit,a&&(this._createQuad=this._createQuadInDirection,this._emit=this._emitInDirection,this._emitCurrent=this._emitCurrentInDirection),(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||n||s||a),this._isImpliedBy=e.isImpliedBy,this._implicitEmptyPrefix=!!e.implicitEmptyPrefix,this._emptyFormulaAsTrue=!!e.emptyFormulaAsTrue,l&&(this._resolveRelativeIRI=u=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Qe({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._formulaScopedBlankNodes=!!e.formulaScopedBlankNodes,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){ds=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e;let i=e.indexOf("?"),n=i<0?e:e.substr(0,i);this._basePath=e.indexOf("/")<0?e:n.substr(0,n.lastIndexOf("/")+1),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,r,i,n,s){if(!this._n3Mode){this._contextStack.push({type:e,subject:i,predicate:n,object:s,graph:r});return}let o={type:e,subject:i,predicate:n,object:s,graph:r,inverse:this._inversePredicate,expectOf:this._expectOf,blankPrefix:this._prefixes._,prefixChanges:this._prefixChanges,quantifiedChanges:this._quantifiedChanges,emptyFormula:this._emptyFormula};e==="formula"&&(o.base=[this._base,this._basePath,this._baseRoot,this._baseScheme],this._prefixChanges=[]),this._contextStack.push(o),this._inversePredicate=!1,this._expectOf=!1,(!this._formulaScopedBlankNodes||e==="formula")&&(this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantifiedChanges=[]),e==="formula"&&(this._subject=null,this._emptyFormula=!0)}_restoreContext(e,r){let i=this._contextStack.pop();if(!i||i.type!==e)return this._error(`Unexpected ${r.type}`,r);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._expectOf=i.expectOf,e==="formula"&&([this._base,this._basePath,this._baseRoot,this._baseScheme]=i.base),this._prefixChanges!==i.prefixChanges&&(hs(this._prefixes,this._prefixChanges),this._prefixChanges=i.prefixChanges),this._prefixes._=i.blankPrefix,this._quantifiedChanges!==i.quantifiedChanges&&(hs(this._quantified,this._quantifiedChanges),this._quantifiedChanges=i.quantifiedChanges),this._emptyFormula=i.emptyFormula)}_readBeforeTopContext(e){return this._version&&!this._isValidVersion(this._version)?this._error(`Detected unsupported version as media type parameter: "${this._version}"`,e):this._readInTopContext(e)}_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"VERSION":this._sparqlStyle=!0;case"@version":return this._readVersion;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)}}_readInFormulaContext(e){switch(e.type){case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;default:return this._readSubject(e)}}_getStatementReader(){let e=this._contextStack[this._contextStack.length-1];return e&&e.type==="formula"?this._readInFormulaContext:this._readInTopContext}_readEntity(e,r){let i;switch(e.type){case"IRI":case"typeIRI":let n=this._resolveIRI(e.value);if(n===null)return this._error("Invalid IRI",e);i=this._factory.namedNode(n);break;case"type":case"prefixed":let s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);i=this._factory.namedNode(s+e.value);break;case"blank":i=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":i=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!r&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readList(e,r,i,n){let s=this._contextStack;return(s.length&&s[s.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,r,i,n),this._subject=null,this._readListItem)}_readSubject(e){switch(this._predicate=null,e.type!=="}"&&(this._emptyFormula=!1),e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._readList(e,this.RDF_NIL,null,null);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readInFormulaContext):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":return this._n3Mode?e.prefix.length===0?(this._literalValue=e.value,this._completeSubjectLiteral):(this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),this._getPathReader(this._readPredicateOrNamedGraph)):this._error("Unexpected literal",e);case"<<(":return this._n3Mode?(this._saveContext("<<(",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Disallowed triple term as subject",e);case"<<":return this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject;default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type,i=!1;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case"has":return this._readPredicateAfterVerb;case"is":return this._inversePredicate=!0,this._expectOf=!0,this._readPredicateAfterVerb;case"inversePredicate":return this._inversePredicate=!0,this._readPredicateAfterVerb;case"|}":return this._subject=null,this._readAnnotationBlockPunctuation(e);case".":case"]":case"}":return this._predicate===null&&!this._n3Mode?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"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completePredicateLiteral;this._predicate=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=!0;break;case"(":return this._n3Mode?this._readList(e,this._subject,this.RDF_NIL,null):this._error(`Expected entity but got ${r}`,e);case"[":return this._n3Mode?(this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead):this._error("Disallowed blank node as predicate",e);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._graph=this._factory.blankNode(),null),this._readSubject):this._readEntity(e);case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return;i=this._n3Mode}return this._validAnnotation=!0,i?this._getPathReader(this._readObject,"predicate"):this._readObject}_readPredicateAfterVerb(e){return e.type==="has"||e.type==="is"||e.type==="of"||e.type==="inversePredicate"?this._error(`Expected expression but got ${e.type}`,e):this._readPredicate(e)}_readObject(e){if(this._expectOf)return e.type!=="of"?this._error(`Expected of but got ${e.type}`,e):(this._expectOf=!1,this._readObject);switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;if(this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),this._n3Mode)return this._getPathReader(this._getContextEndReader());break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._readList(e,this._subject,this._predicate,this.RDF_NIL);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readInFormulaContext):this._error("Unexpected graph",e);case"<<(":return this._saveContext("<<(",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;case"<<":return this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;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){if(e.type==="]")return this._subject=null,this._readBlankNodeTail(e);{let r=this._contextStack;return(r.length>1&&r[r.length-2]).type==="<<"?this._error("Unexpected compound blank node expression in reified triple",e):e.type==="id"?this._readIriPropertyListId:(this._predicate=null,this._readPredicate(e))}}_readIriPropertyListId(e){let r=this._readEntity(e);if(r===void 0)return;if(r.termType!=="NamedNode")return this._error(`Expected IRI after id but got ${e.type}`,e);let i=this._subject;this._subject=r;let n=this._contextStack[this._contextStack.length-1];return n.subject===i&&(n.subject=r),n.predicate===i&&(n.predicate=r),n.object===i&&(n.object=r),this._predicate=null,this._readIriPropertyListPredicate}_readIriPropertyListPredicate(e){return e.type===";"||e.type==="]"||e.type==="."||e.type==="}"?this._error(`Expected predicate but got ${e.type}`,e):this._readPredicate(e)}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emitCurrent(this._subject,this._predicate,this._object,this._graph);let r=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._getPathReader(this._readObject,"predicate"):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,i=null,n=this._readListItem,s=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=r=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),o.length!==0&&o[o.length-1].type==="list"){if(this._n3Mode)return s!==null&&this._emit(s,this.RDF_REST,this.RDF_NIL,this._graph),this._saveContext("item",this._graph,this._subject,this._predicate,this._object),this._subject=this._object,this._predicate=null,this._getPathReader(this._readListItem);this._emit(this._subject,this._predicate,this._object,this._graph)}if(this._predicate===null){if(n=this._n3Mode?this._getPathReader(this._readPredicate):this._readPredicate,this._subject===this.RDF_NIL)return n}else if(this._object===null){if(n=this._getPathReader(this._readObject,"predicate"),this._predicate===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._n3Mode&&(n=this._getPathReader(n)),this._object===this.RDF_NIL)return n;i=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(r=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(i=this._factory.blankNode(),r=this._factory.blankNode(),s===null?a.predicate===null?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),this._emit(i,this.RDF_FIRST,r,this._graph),this._saveContext("formula",this._graph,i,this.RDF_FIRST,this._graph=r),this._subject=null,this._readInFormulaContext):this._error("Unexpected graph",e);case"<<(":this._saveContext("<<(",this._graph,null,null,null),this._graph=null,n=this._readSubject;break;case"<<":this._saveContext("<<",this._graph,null,null,null),this._graph=null,n=this._readSubject;break;default:if((r=this._readEntity(e))===void 0)return}if(i===null&&(this._subject=i=this._factory.blankNode()),(e.type==="<<"||e.type==="<<(")&&(o[o.length-1].subject=this._subject),s===null?a.predicate===null?a.subject=i:a.object===null?a.predicate=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),r!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"||e.type==="var"||e.type==="blank"||e.type==="literal"))return this._saveContext("item",this._graph,i,this.RDF_FIRST,r),this._subject=r,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,r,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e,r){let i,n=!1;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===N.rdf.langString||s.value===N.rdf.dirLangString)return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype",e);i=this._factory.literal(this._literalValue,s),e=null;break;case"langcode":if(e.value.split("-").some(o=>o.length>8))return this._error("Detected language tag with subtag longer than 8 characters",e);i=this._factory.literal(this._literalValue,e.value),this._literalLanguage=e.value,e=null,this._literalComponent=r,n=!0;break;default:i=this._factory.literal(this._literalValue)}return{token:e,literal:i,readCb:n}}_readDirCode(e){let r=this._literalComponent,i=this._literalListItem;if(e.type==="dircode"){let n=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:e.value});r==="subject"?this._subject=n:r==="predicate"?this._predicate=n:this._object=n,this._literalLanguage=void 0,e=null}if(r==="subject"||r==="predicate"){let n=r==="subject"?this._readPredicateOrNamedGraph:this._readObject;return this._getPathEndReader(e,n,r)||n.call(this,e)}return this._completeObjectLiteralPost(e,i)}_completeTermLiteral(e,r){let i=this._completeLiteral(e,r);if(!i)return;let n;if(r==="subject"?(this._subject=i.literal,n=this._readPredicateOrNamedGraph):(this._predicate=i.literal,this._validAnnotation=!0,n=this._readObject),i.readCb)return this._literalListItem=!1,this._readDirCode;let s=this._getPathEndReader(i.token,n,r);return s||n.call(this,i.token)}_completeSubjectLiteral(e){return this._completeTermLiteral(e,"subject")}_completePredicateLiteral(e){return this._completeTermLiteral(e,"predicate")}_completeObjectLiteral(e,r){let i=this._completeLiteral(e,"object");if(i)return this._object=i.literal,i.readCb?(this._literalListItem=r,this._readDirCode):this._completeObjectLiteralPost(i.token,r)}_completeObjectLiteralPost(e,r){return this._n3Mode&&(e===null||e.type==="!"||e.type==="^")?r?(this._saveContext("item",this._graph,this._subject,this.RDF_FIRST,this._object),this._subject=this._object,this._predicate=null,this._getPathEndReader(e,this._readListItem)):this._getPathEndReader(e,this._getContextEndReader()):(r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),e===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(e)))}_readFormulaTail(e){if(e.type!=="}")return this._readPunctuation(e);this._subject!==null&&this._emitCurrent(this._subject,this._predicate,this._object,this._graph);let r=this._graph,i=this._emptyFormula;return this._restoreContext("formula",e),i&&this._emptyFormulaAsTrue&&(this._subject===r?this._subject=this.N3_TRUE:this._predicate===r?this._predicate=this.N3_TRUE:this._object=this.N3_TRUE),this._object!==null?this._getPathReader(this._getContextEndReader(),"object"):this._predicate!==null?this._getPathReader(this._readObject,"predicate"):this._getPathReader(this._readPredicate,"subject")}_readPunctuation(e){let r,i=this._graph,n=this._subject,s=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,this._tripleTerm=null,r=this._getStatementReader(),s&&(this._inversePredicate=!1);break;case";":s&&(this._inversePredicate=!1),r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":return this._readAnnotationStart(e);case"|}":return this._error("Unexpected annotation syntax closing",e);default:if(this._supportsQuads&&this._graph===null&&(i=this._readEntity(e))!==void 0){r=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(n!==null){let o=this._predicate,a=this._object;this._emit(n,o,a,i,s)}return r}_readBlankNodePunctuation(e){let r,i=!1;switch(e.type){case";":i=this._inversePredicate,r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":return this._readAnnotationStart(e);case"|}":return this._error("Unexpected annotation syntax closing",e);default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emitCurrent(this._subject,this._predicate,this._object,this._graph),i&&(this._inversePredicate=!1),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);let r=this._readEntity(e);return this._prefixChanges!==null&&this._prefixChanges.push(this._prefix,this._prefixes[this._prefix]),this._prefixes[this._prefix]=r.value,this._prefixCallback(this._prefix,r),this._readDeclarationPunctuation}_readBaseIRI(e){let 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)}_isValidVersion(e){return this._parseUnsupportedVersions||t.SUPPORTED_VERSIONS.includes(e)}_readVersion(e){return e.type!=="literal"?this._error("Expected literal to follow version declaration",e):e.end-e.start!==e.value.length+2?this._error("Version declarations must use single quotes",e):(this._versionCallback(e.value),this._isValidVersion(e.value)?this._readDeclarationPunctuation:this._error(`Detected unsupported version: "${e.value}"`,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._getStatementReader().call(this,e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._getStatementReader()}_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._quantifiedChanges!==null&&this._quantifiedChanges.push(r.id,this._quantified[r.id]),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,r){return this._afterPath=e,this._pathPosition=r||(this._predicate===null?"subject":"object"),this._readPath}_getPathEndReader(e,r,i){if(e!==null&&e.type!=="!"&&e.type!=="^")return null;let n=this._getPathReader(r,i);return e===null?n:n.call(this,e)}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._afterPath,i=this._contextStack,n=i.length&&i[i.length-1];if(n&&n.type==="item"){let s=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,s,this._graph)}return this._afterPath=null,this._pathPosition=null,r.call(this,e)}}_readForwardPath(e){let r,i,n=this._factory.blankNode();if((i=this._readEntity(e))!==void 0)return this._pathPosition==="subject"?(r=this._subject,this._subject=n):this._pathPosition==="predicate"?(r=this._predicate,this._predicate=n):(r=this._object,this._object=n),this._emit(r,i,n,this._graph),this._readPath}_readBackwardPath(e){let r=this._factory.blankNode(),i,n;if((i=this._readEntity(e))!==void 0)return this._pathPosition==="subject"?(n=this._subject,this._subject=r):this._pathPosition==="predicate"?(n=this._predicate,this._predicate=r):(n=this._object,this._object=r),this._emit(r,i,n,this._graph),this._readPath}_readTripleTermTail(e){if(e.type!==")>>")return this._error(`Expected )>> but got ${e.type}`,e);let r=this._createQuad(this._subject,this._predicate,this._object,this._graph,this._inversePredicate);this._restoreContext("<<(",e);let i=this._contextStack,n=i.length&&i[i.length-1];return n&&n.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicate):(this._object=r,this._getContextEndReader())}_readReifiedTripleTailOrReifier(e){return e.type==="~"?this._readReifier:this._readReifiedTripleTail(e)}_readReifiedTripleTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);this._tripleTerm=null;let r=this._readTripleTerm();this._restoreContext("<<",e);let i=this._contextStack,n=i.length&&i[i.length-1];return n&&n.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicateOrReifierTripleEnd):(this._object=r,this._getContextEndReader())}_readPredicateOrReifierTripleEnd(e){return e.type==="."?(this._subject=null,this._readPunctuation(e)):this._readPredicate(e)}_readReifier(e){return e.type===">>"?this._readReifiedTripleTail(e):(this._reifier=this._readEntity(e),this._readReifiedTripleTail)}_readAnnotationStart(e){return this._emitCurrent(this._subject,this._predicate,this._object,this._graph),this._tripleTerm=null,this._readAnnotation(e)}_readAnnotation(e){switch(e.type){case"~":return this._readReifierInAnnotation;case"{|":return this._readAnnotationBlockHead(e)}switch(this._tripleTerm=null,e.type){case";":return this._inversePredicate=!1,this._readPredicate;case",":return this._readObject;default:return this._subject=null,this._getContextEndReader().call(this,e)}}_readReifierInAnnotation(e){switch(e.type){case"IRI":case"typeIRI":case"type":case"prefixed":case"blank":case"var":return this._reifier=this._readEntity(e),this._readAnnotationBlockOrReifier}return this._reifier=this._factory.blankNode(),this._readAnnotationBlockOrReifier(e)}_readAnnotationBlockOrReifier(e){return e.type==="{|"?this._readAnnotationBlockHead(e):(this._readTripleTerm(),this._readAnnotation(e))}_readAnnotationBlockHead(e){let r=this._readTripleTerm();return this._saveContext("annotation",this._graph,this._subject,this._predicate,this._object),this._contextStack[this._contextStack.length-1].tripleTerm=this._tripleTerm,this._subject=r,this._predicate=this._object=this._tripleTerm=null,this._inversePredicate=!1,this._validAnnotation=!1,this._readPredicate}_readAnnotationBlockPunctuation(e){let r=this._contextStack;if(e.type==="|}"){if(!r.length||r[r.length-1].type!=="annotation")return this._error("Unexpected annotation syntax closing",e);if(!this._validAnnotation)return this._error("Annotation block can not be empty",e);this._subject!==null&&this._emitCurrent(this._subject,this._predicate,this._object,this._graph);let{tripleTerm:i}=r[r.length-1];return this._restoreContext("annotation",e),this._tripleTerm=i,this._readAnnotation}return this._readBlankNodePunctuation(e)}_readTripleTerm(){let e=this._contextStack,r=e.length&&e[e.length-1],i=r?r.graph:void 0,n=this._reifier||this._factory.blankNode();return this._reifier=null,this._tripleTerm=this._tripleTerm||this._createQuad(this._subject,this._predicate,this._object,null,this._inversePredicate),this._emit(n,this.RDF_REIFIES,this._tripleTerm,i||this._graph||this.DEFAULTGRAPH),n}_getContextEndReader(){let 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._readTripleTermTail;case"<<":return this._readReifiedTripleTailOrReifier;case"annotation":return this._readAnnotationBlockPunctuation}}_createQuad(e,r,i,n){return this._factory.quad(e,r,i,n||this.DEFAULTGRAPH)}_createQuadInDirection(e,r,i,n,s){return s?this._factory.quad(i,r,e,n||this.DEFAULTGRAPH):this._factory.quad(e,r,i,n||this.DEFAULTGRAPH)}_emitInDirection(e,r,i,n,s){this._callback(null,this._createQuad(e,r,i,n,s))}_emitCurrentInDirection(e,r,i,n){this._callback(null,this._createQuad(e,r,i,n,this._inversePredicate))}_emit(e,r,i,n){this._callback(null,this._factory.quad(e,r,i,n||this.DEFAULTGRAPH))}_error(e,r){let i=` on line ${r.line}.`;e.length+i.length>200&&(e=`${e.slice(0,199-i.length)}\u2026`);let n=new Error(`${e}${i}`);n.context={token:r,line:r.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=pr}_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"?":{let r=this._base.indexOf("?");return(r<0?this._base:this._base.substr(0,r))+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;let r=e.length,i="",n=-1,s=-1,o=0,a="/";for(;n<r;){switch(a){case":":if(s<0&&e[++n]==="/"&&e[++n]==="/")for(;(s=n+1)<r&&e[s]!=="/";)n=s;break;case"?":case"#":n=r;break;case"/":if(e[n+1]===".")switch(a=e[++n+1],a){case"/":i+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return i+e.substring(o,n)+e.substr(n+1);case".":if(a=e[++n+1],a===void 0||a==="/"||a==="?"||a==="#"){if(i+=e.substring(o,n-2),(o=i.lastIndexOf("/"))>=s&&(i=i.substr(0,o)),a!=="/")return`${i}/${e.substr(n+1)}`;o=n+1}}}a=e[++n]}return i+e.substring(o)}parse(e,r,i,n){let s,o,a,l,u,c;r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion||r.onToken||r.onTokenEnd)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion,u=r.onToken,c=r.onTokenEnd):(s=r,o=i,l=n),this._readCallback=this._readBeforeTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${ds++}_`,this._n3Mode&&this._implicitEmptyPrefix&&this._base&&(this._prefixes[""]=this._resolveIRI("#")),this._prefixCallback=o||pr,this._versionCallback=l||pr,this._inversePredicate=!1,this._expectOf=!1,this._quantified=Object.create(null),this._prefixChanges=null,this._quantifiedChanges=null,this._emptyFormula=!1;let f=d=>this._readCallback=this._readCallback(d);if(a||this._lexer.comments){this._lexer.comments=!0;let d=f;f=_=>_.type!=="comment"?d(_):(a&&a(_.value),this._readCallback)}if(u||c){let d=f;f=_=>{try{try{return u&&u(_),d(_)}finally{c&&c(_)}}catch(p){throw this._readCallback=null,p}}}if(!s){let d=[],_;if(this._callback=(p,y)=>{p?_=p:y&&d.push(y)},this._lexer.tokenize(e).every(f),_)throw _;return d}let h=(d,_)=>{d!==null?(this._callback(d),this._callback=pr):this._readCallback&&f(_)};this._callback=s,this._lexer.tokenize(e,h)}};function hs(t,e){for(let r=e.length-2;r>=0;r-=2)e[r+1]===void 0?delete t[e[r]]:t[e[r]]=e[r+1]}function pr(){}function _s(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(N.rdf.first),t.RDF_REST=e.namedNode(N.rdf.rest),t.RDF_NIL=e.namedNode(N.rdf.nil),t.RDF_REIFIES=e.namedNode(N.rdf.reifies),t.N3_FORALL=e.namedNode(N.r.forAll),t.N3_FORSOME=e.namedNode(N.r.forSome),t.N3_TRUE=e.literal("true",e.namedNode(N.xsd.boolean)),t.ABBREVIATIONS={a:e.namedNode(N.rdf.type),"=":e.namedNode(N.owl.sameAs),">":e.namedNode(N.log.implies),"<":e.namedNode(N.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Ie.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];_s(Ie.prototype,X);var di={};Hl(di,{inDefaultGraph:()=>Wu,isBlankNode:()=>$u,isDefaultGraph:()=>fe,isLiteral:()=>ku,isNamedNode:()=>Mu,isQuad:()=>Uu,isVariable:()=>qu,prefix:()=>Gu,prefixes:()=>ps});function Mu(t){return!!t&&t.termType==="NamedNode"}function $u(t){return!!t&&t.termType==="BlankNode"}function ku(t){return!!t&&t.termType==="Literal"}function qu(t){return!!t&&t.termType==="Variable"}function Uu(t){return!!t&&t.termType==="Quad"}function fe(t){return!!t&&t.termType==="DefaultGraph"}function Wu(t){return fe(t.graph)}function Gu(t,e){return ps({"":t.value||t},e)("")}function ps(t,e){let r=Object.create(null);for(let n in t)i(n,t[n]);e=e||X;function i(n,s){if(typeof s=="string"){let o=Object.create(null);r[n]=a=>o[a]||(o[a]=e.namedNode(s+a))}else if(!(n in r))throw new Error(`Unknown prefix: ${n}`);return r[n]}return i}function _t(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var Qu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,zu=/^(?:(?!\.\.?(?:[/?#]|$))[^/?#]+(?:\/[^/?#]{3,})*\/?)?(?:[?#]|$)/,bs="./",Vu="../",hi="?",ys="#",ze=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Qu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",_t(e)],i=[],n=[],s=/[^/?#]*([/?#])/y,o,a=0,l=0,u=s.lastIndex=e.length;for(;!a&&!l&&(o=s.exec(this.base));)o[1]===ys?l=s.lastIndex-1:(r.push(_t(o[0]),"(?:"),i.push(")?"),o[1]!==hi?n.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(ys,a),this._pathReplacements[a]=hi));for(let c=0;c<n.length;c++)this._pathReplacements[n[c]]=Vu.repeat(n.length-c-1);return this._pathReplacements[n[n.length-1]]=bs,this._baseLength=l>0?l:this.base.length,r.push(_t(this.base.substring(u,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...r,...i].join(""))}toRelative(e){let r=this._getBaseMatcher().exec(e);if(!r)return e;let i=r[0].length;if(i===this._baseLength&&i===e.length)return"";let n=this._pathReplacements[i];if(n){let s=e.substring(i);return n!==hi&&!zu.test(s)?e:n===bs&&/^[^?#]/.test(s)&&(s.indexOf(":")<0||!/^[^/?#]*:/.test(s))?s:n+s}return e.substring(i-1)}};var Mt=X.defaultGraph(),{rdf:Hu,xsd:pt}=N,gs=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ms=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Ku={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},Ve=class extends H{equals(e){return e===this}},ce=class{constructor(e,r){if(this._prefixRegex=/$0^/,this._hasPrefixes=!1,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 i="";this._outputStream={write(n,s,o){i+=n,o&&o()},end:n=>{n&&n(null,i)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Mt,this._prefixIRIs=Object.create(null),r.baseIRI&&(this._baseIri=new ze(r.baseIRI),r.writeBase&&this._write(`@base <${r.baseIRI}>.
4
- `)),r.prefixes&&this.addPrefixes(r.prefixes))}get _inDefaultGraph(){return Mt.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_writeQuad(e,r,i,n,s){try{n!==this._graph&&(!n.equals(this._graph)||n.termType!==this._graph.termType)&&(this._write((this._subject===null?"":this._inDefaultGraph?`.
1
+ var Dl=Object.create;var rr=Object.defineProperty,Ml=Object.defineProperties,$l=Object.getOwnPropertyDescriptor,kl=Object.getOwnPropertyDescriptors,ql=Object.getOwnPropertyNames,jn=Object.getOwnPropertySymbols,Ul=Object.getPrototypeOf,Bn=Object.prototype.hasOwnProperty,Wl=Object.prototype.propertyIsEnumerable;var st=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Gl=t=>{throw TypeError(t)};var Ln=(t,e,r)=>e in t?rr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,O=(t,e)=>{for(var r in e||(e={}))Bn.call(e,r)&&Ln(t,r,e[r]);if(jn)for(var r of jn(e))Wl.call(e,r)&&Ln(t,r,e[r]);return t},Le=(t,e)=>Ml(t,kl(e));var R=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Ql=(t,e)=>{for(var r in e)rr(t,r,{get:e[r],enumerable:!0})},zl=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ql(e))!Bn.call(t,n)&&n!==r&&rr(t,n,{get:()=>e[n],enumerable:!(i=$l(e,n))||i.enumerable});return t};var ir=(t,e,r)=>(r=t!=null?Dl(Ul(t)):{},zl(e||!t||!t.__esModule?rr(r,"default",{value:t,enumerable:!0}):r,t));var q=function(t,e){this[0]=t,this[1]=e},Z=(t,e,r)=>{var i=(a,l,f,u)=>{try{var c=r[a](l),_=(l=c.value)instanceof q,d=c.done;Promise.resolve(_?l[0]:l).then(p=>_?i(a==="return"?a:"next",l[1]?{done:p.done,value:p.value}:p,f,u):f({value:p,done:d})).catch(p=>i("throw",p,f,u))}catch(p){u(p)}},n=(a,l,f,u)=>o[a]=c=>(l=new Promise((_,d,p)=>(p=()=>i(a,c,_,d),s?s.then(p):p())),u=()=>s===f&&(s=0),s=f=l.then(u,u),l),s,o={};return r=r.apply(t,e),o[st("asyncIterator")]=()=>o,n("next"),n("throw"),n("return"),o},te=t=>{var e=t[st("asyncIterator")],r=!1,i,n={};return e==null?(e=t[st("iterator")](),i=s=>n[s]=o=>e[s](o)):(e=e.call(t),i=s=>n[s]=o=>{if(r){if(r=!1,s==="throw")throw o;return o}return r=!0,{done:!1,value:new q(new Promise(a=>{var l=e[s](o);l instanceof Object||Gl("Object expected"),a(l)}),1)}}),n[st("iterator")]=()=>n,i("next"),"throw"in e?i("throw"):n.throw=s=>{throw s},"return"in e&&i("return"),n},H=(t,e,r)=>(e=t[st("asyncIterator")])?e.call(t):(t=t[st("iterator")](),e={},r=(i,n)=>(n=t[i])&&(e[i]=s=>new Promise((o,a,l)=>(s=n.call(t,s),l=s.done,Promise.resolve(s.value).then(f=>o({value:f,done:l}),a)))),r("next"),r("return"),e);var On=R(nr=>{"use strict";nr.byteLength=Hl;nr.toByteArray=Yl;nr.fromByteArray=Jl;var ne=[],X=[],Vl=typeof Uint8Array!="undefined"?Uint8Array:Array,Yr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(qe=0,Fn=Yr.length;qe<Fn;++qe)ne[qe]=Yr[qe],X[Yr.charCodeAt(qe)]=qe;var qe,Fn;X[45]=62;X[95]=63;function Cn(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function Hl(t){var e=Cn(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Kl(t,e,r){return(e+r)*3/4-r}function Yl(t){var e,r=Cn(t),i=r[0],n=r[1],s=new Vl(Kl(t,i,n)),o=0,a=n>0?i-4:i,l;for(l=0;l<a;l+=4)e=X[t.charCodeAt(l)]<<18|X[t.charCodeAt(l+1)]<<12|X[t.charCodeAt(l+2)]<<6|X[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return n===2&&(e=X[t.charCodeAt(l)]<<2|X[t.charCodeAt(l+1)]>>4,s[o++]=e&255),n===1&&(e=X[t.charCodeAt(l)]<<10|X[t.charCodeAt(l+1)]<<4|X[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Zl(t){return ne[t>>18&63]+ne[t>>12&63]+ne[t>>6&63]+ne[t&63]}function Xl(t,e,r){for(var i,n=[],s=e;s<r;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),n.push(Zl(i));return n.join("")}function Jl(t){for(var e,r=t.length,i=r%3,n=[],s=16383,o=0,a=r-i;o<a;o+=s)n.push(Xl(t,o,o+s>a?a:o+s));return i===1?(e=t[r-1],n.push(ne[e>>2]+ne[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(ne[e>>10]+ne[e>>4&63]+ne[e<<2&63]+"=")),n.join("")}});var Dn=R(Zr=>{Zr.read=function(t,e,r,i,n){var s,o,a=n*8-i-1,l=(1<<a)-1,f=l>>1,u=-7,c=r?n-1:0,_=r?-1:1,d=t[e+c];for(c+=_,s=d&(1<<-u)-1,d>>=-u,u+=a;u>0;s=s*256+t[e+c],c+=_,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=i;u>0;o=o*256+t[e+c],c+=_,u-=8);if(s===0)s=1-f;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-f}return(d?-1:1)*o*Math.pow(2,s-i)};Zr.write=function(t,e,r,i,n,s){var o,a,l,f=s*8-n-1,u=(1<<f)-1,c=u>>1,_=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,p=i?1:-1,b=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?e+=_/l:e+=_*Math.pow(2,1-c),e*l>=2&&(o++,l/=2),o+c>=u?(a=0,o=u):o+c>=1?(a=(e*l-1)*Math.pow(2,n),o=o+c):(a=e*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=a&255,d+=p,a/=256,n-=8);for(o=o<<n|a,f+=n;f>0;t[r+d]=o&255,d+=p,o/=256,f-=8);t[r+d-p]|=b*128}});var oe=R(ut=>{"use strict";var Xr=On(),at=Dn(),Mn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ut.Buffer=h;ut.SlowBuffer=su;ut.INSPECT_MAX_BYTES=50;var sr=2147483647;ut.kMaxLength=sr;h.TYPED_ARRAY_SUPPORT=eu();!h.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&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 eu(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.buffer}});Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(h.isBuffer(this))return this.byteOffset}});function we(t){if(t>sr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,h.prototype),e}function h(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return ri(t)}return Un(t,e,r)}h.poolSize=8192;function Un(t,e,r){if(typeof t=="string")return ru(t,e);if(ArrayBuffer.isView(t))return iu(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(se(t,ArrayBuffer)||t&&se(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(se(t,SharedArrayBuffer)||t&&se(t.buffer,SharedArrayBuffer)))return ei(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return h.from(i,e,r);let n=nu(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return h.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}h.from=function(t,e,r){return Un(t,e,r)};Object.setPrototypeOf(h.prototype,Uint8Array.prototype);Object.setPrototypeOf(h,Uint8Array);function Wn(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function tu(t,e,r){return Wn(t),t<=0?we(t):e!==void 0?typeof r=="string"?we(t).fill(e,r):we(t).fill(e):we(t)}h.alloc=function(t,e,r){return tu(t,e,r)};function ri(t){return Wn(t),we(t<0?0:ii(t)|0)}h.allocUnsafe=function(t){return ri(t)};h.allocUnsafeSlow=function(t){return ri(t)};function ru(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!h.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Gn(t,e)|0,i=we(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function Jr(t){let e=t.length<0?0:ii(t.length)|0,r=we(e);for(let i=0;i<e;i+=1)r[i]=t[i]&255;return r}function iu(t){if(se(t,Uint8Array)){let e=new Uint8Array(t);return ei(e.buffer,e.byteOffset,e.byteLength)}return Jr(t)}function ei(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,h.prototype),i}function nu(t){if(h.isBuffer(t)){let e=ii(t.length)|0,r=we(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||si(t.length)?we(0):Jr(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Jr(t.data)}function ii(t){if(t>=sr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+sr.toString(16)+" bytes");return t|0}function su(t){return+t!=t&&(t=0),h.alloc(+t)}h.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==h.prototype};h.compare=function(e,r){if(se(e,Uint8Array)&&(e=h.from(e,e.offset,e.byteLength)),se(r,Uint8Array)&&(r=h.from(r,r.offset,r.byteLength)),!h.isBuffer(e)||!h.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,o=Math.min(i,n);s<o;++s)if(e[s]!==r[s]){i=e[s],n=r[s];break}return i<n?-1:n<i?1:0};h.isEncoding=function(e){switch(String(e).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}};h.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return h.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;let n=h.allocUnsafe(r),s=0;for(i=0;i<e.length;++i){let o=e[i];if(se(o,Uint8Array))s+o.length>n.length?(h.isBuffer(o)||(o=h.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(h.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function Gn(t,e){if(h.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||se(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ti(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Jn(t).length;default:if(n)return i?-1:ti(t).length;e=(""+e).toLowerCase(),n=!0}}h.byteLength=Gn;function ou(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return bu(this,e,r);case"utf8":case"utf-8":return zn(this,e,r);case"ascii":return _u(this,e,r);case"latin1":case"binary":return pu(this,e,r);case"base64":return du(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gu(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}h.prototype._isBuffer=!0;function Ue(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}h.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)Ue(this,r,r+1);return this};h.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)Ue(this,r,r+3),Ue(this,r+1,r+2);return this};h.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)Ue(this,r,r+7),Ue(this,r+1,r+6),Ue(this,r+2,r+5),Ue(this,r+3,r+4);return this};h.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?zn(this,0,e):ou.apply(this,arguments)};h.prototype.toLocaleString=h.prototype.toString;h.prototype.equals=function(e){if(!h.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:h.compare(this,e)===0};h.prototype.inspect=function(){let e="",r=ut.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Mn&&(h.prototype[Mn]=h.prototype.inspect);h.prototype.compare=function(e,r,i,n,s){if(se(e,Uint8Array)&&(e=h.from(e,e.offset,e.byteLength)),!h.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let o=s-n,a=i-r,l=Math.min(o,a),f=this.slice(n,s),u=e.slice(r,i);for(let c=0;c<l;++c)if(f[c]!==u[c]){o=f[c],a=u[c];break}return o<a?-1:a<o?1:0};function Qn(t,e,r,i,n){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,si(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=h.from(e,i)),h.isBuffer(e))return e.length===0?-1:$n(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):$n(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function $n(t,e,r,i,n){let s=1,o=t.length,a=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(u,c){return s===1?u[c]:u.readUInt16BE(c*s)}let f;if(n){let u=-1;for(f=r;f<o;f++)if(l(t,f)===l(e,u===-1?0:f-u)){if(u===-1&&(u=f),f-u+1===a)return u*s}else u!==-1&&(f-=f-u),u=-1}else for(r+a>o&&(r=o-a),f=r;f>=0;f--){let u=!0;for(let c=0;c<a;c++)if(l(t,f+c)!==l(e,c)){u=!1;break}if(u)return f}return-1}h.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};h.prototype.indexOf=function(e,r,i){return Qn(this,e,r,i,!0)};h.prototype.lastIndexOf=function(e,r,i){return Qn(this,e,r,i,!1)};function au(t,e,r,i){r=Number(r)||0;let n=t.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let o;for(o=0;o<i;++o){let a=parseInt(e.substr(o*2,2),16);if(si(a))return o;t[r+o]=a}return o}function lu(t,e,r,i){return or(ti(e,t.length-r),t,r,i)}function uu(t,e,r,i){return or(xu(e),t,r,i)}function fu(t,e,r,i){return or(Jn(e),t,r,i)}function cu(t,e,r,i){return or(Eu(e,t.length-r),t,r,i)}h.prototype.write=function(e,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return au(this,e,r,i);case"utf8":case"utf-8":return lu(this,e,r,i);case"ascii":case"latin1":case"binary":return uu(this,e,r,i);case"base64":return fu(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cu(this,e,r,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function du(t,e,r){return e===0&&r===t.length?Xr.fromByteArray(t):Xr.fromByteArray(t.slice(e,r))}function zn(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n<r;){let s=t[n],o=null,a=s>239?4:s>223?3:s>191?2:1;if(n+a<=r){let l,f,u,c;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[n+1],(l&192)===128&&(c=(s&31)<<6|l&63,c>127&&(o=c));break;case 3:l=t[n+1],f=t[n+2],(l&192)===128&&(f&192)===128&&(c=(s&15)<<12|(l&63)<<6|f&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:l=t[n+1],f=t[n+2],u=t[n+3],(l&192)===128&&(f&192)===128&&(u&192)===128&&(c=(s&15)<<18|(l&63)<<12|(f&63)<<6|u&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=a}return hu(i)}var kn=4096;function hu(t){let e=t.length;if(e<=kn)return String.fromCharCode.apply(String,t);let r="",i=0;for(;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=kn));return r}function _u(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]&127);return i}function pu(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;n<r;++n)i+=String.fromCharCode(t[n]);return i}function bu(t,e,r){let i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);let n="";for(let s=e;s<r;++s)n+=Su[t[s]];return n}function gu(t,e,r){let i=t.slice(e,r),n="";for(let s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}h.prototype.slice=function(e,r){let i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);let n=this.subarray(e,r);return Object.setPrototypeOf(n,h.prototype),n};function k(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}h.prototype.readUintLE=h.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||k(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return n};h.prototype.readUintBE=h.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||k(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};h.prototype.readUint8=h.prototype.readUInt8=function(e,r){return e=e>>>0,r||k(e,1,this.length),this[e]};h.prototype.readUint16LE=h.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||k(e,2,this.length),this[e]|this[e+1]<<8};h.prototype.readUint16BE=h.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||k(e,2,this.length),this[e]<<8|this[e+1]};h.prototype.readUint32LE=h.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||k(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};h.prototype.readUint32BE=h.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||k(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};h.prototype.readBigUInt64LE=Be(function(e){e=e>>>0,lt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Lt(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))});h.prototype.readBigUInt64BE=Be(function(e){e=e>>>0,lt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Lt(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(s)});h.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||k(e,r,this.length);let n=this[e],s=1,o=0;for(;++o<r&&(s*=256);)n+=this[e+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*r)),n};h.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||k(e,r,this.length);let n=r,s=1,o=this[e+--n];for(;n>0&&(s*=256);)o+=this[e+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};h.prototype.readInt8=function(e,r){return e=e>>>0,r||k(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};h.prototype.readInt16LE=function(e,r){e=e>>>0,r||k(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};h.prototype.readInt16BE=function(e,r){e=e>>>0,r||k(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};h.prototype.readInt32LE=function(e,r){return e=e>>>0,r||k(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};h.prototype.readInt32BE=function(e,r){return e=e>>>0,r||k(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};h.prototype.readBigInt64LE=Be(function(e){e=e>>>0,lt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Lt(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});h.prototype.readBigInt64BE=Be(function(e){e=e>>>0,lt(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&Lt(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i)});h.prototype.readFloatLE=function(e,r){return e=e>>>0,r||k(e,4,this.length),at.read(this,e,!0,23,4)};h.prototype.readFloatBE=function(e,r){return e=e>>>0,r||k(e,4,this.length),at.read(this,e,!1,23,4)};h.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||k(e,8,this.length),at.read(this,e,!0,52,8)};h.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||k(e,8,this.length),at.read(this,e,!1,52,8)};function K(t,e,r,i,n,s){if(!h.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||e<s)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}h.prototype.writeUintLE=h.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;K(this,e,r,i,a,0)}let s=1,o=0;for(this[r]=e&255;++o<i&&(s*=256);)this[r+o]=e/s&255;return r+i};h.prototype.writeUintBE=h.prototype.writeUIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let a=Math.pow(2,8*i)-1;K(this,e,r,i,a,0)}let s=i-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+i};h.prototype.writeUint8=h.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,1,255,0),this[r]=e&255,r+1};h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Vn(t,e,r,i,n){Xn(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,r}function Hn(t,e,r,i,n){Xn(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o=o>>8,t[r+2]=o,o=o>>8,t[r+1]=o,o=o>>8,t[r]=o,r+8}h.prototype.writeBigUInt64LE=Be(function(e,r=0){return Vn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});h.prototype.writeBigUInt64BE=Be(function(e,r=0){return Hn(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});h.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);K(this,e,r,i,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s<i&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};h.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);K(this,e,r,i,l-1,-l)}let s=i-1,o=1,a=0;for(this[r+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[r+s+1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+i};h.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};h.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};h.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};h.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};h.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||K(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};h.prototype.writeBigInt64LE=Be(function(e,r=0){return Vn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});h.prototype.writeBigInt64BE=Be(function(e,r=0){return Hn(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Kn(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Yn(t,e,r,i,n){return e=+e,r=r>>>0,n||Kn(t,e,r,4,34028234663852886e22,-34028234663852886e22),at.write(t,e,r,i,23,4),r+4}h.prototype.writeFloatLE=function(e,r,i){return Yn(this,e,r,!0,i)};h.prototype.writeFloatBE=function(e,r,i){return Yn(this,e,r,!1,i)};function Zn(t,e,r,i,n){return e=+e,r=r>>>0,n||Kn(t,e,r,8,17976931348623157e292,-17976931348623157e292),at.write(t,e,r,i,52,8),r+8}h.prototype.writeDoubleLE=function(e,r,i){return Zn(this,e,r,!0,i)};h.prototype.writeDoubleBE=function(e,r,i){return Zn(this,e,r,!1,i)};h.prototype.copy=function(e,r,i,n){if(!h.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);let s=n-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(e,this.subarray(i,n),r),s};h.prototype.fill=function(e,r,i,n){if(typeof e=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!h.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(e.length===1){let o=e.charCodeAt(0);(n==="utf8"&&o<128||n==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{let o=h.isBuffer(e)?e:h.from(e,n),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};var ot={};function ni(t,e,r){ot[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}ni("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ni("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ni("ERR_OUT_OF_RANGE",function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=qn(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=qn(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function qn(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function yu(t,e,r){lt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Lt(e,t.length-(r+1))}function Xn(t,e,r,i,n,s){if(t>r||t<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${r}${o}`,new ot.ERR_OUT_OF_RANGE("value",a,t)}yu(i,n,s)}function lt(t,e){if(typeof t!="number")throw new ot.ERR_INVALID_ARG_TYPE(e,"number",t)}function Lt(t,e,r){throw Math.floor(t)!==t?(lt(t,r),new ot.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new ot.ERR_BUFFER_OUT_OF_BOUNDS:new ot.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var mu=/[^+/0-9A-Za-z-_]/g;function wu(t){if(t=t.split("=")[0],t=t.trim().replace(mu,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ti(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function xu(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Eu(t,e){let r,i,n,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}function Jn(t){return Xr.toByteArray(wu(t))}function or(t,e,r,i){let n;for(n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function se(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function si(t){return t!==t}var Su=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e})();function Be(t){return typeof BigInt=="undefined"?Iu:t}function Iu(){throw new Error("BigInt not supported")}});var j=R((Hp,ys)=>{"use strict";var ci=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let i=0;i<e.length;i++)r+=` ${e[i].stack}
2
+ `;super(r),this.name="AggregateError",this.errors=e}};ys.exports={AggregateError:ci,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}});var di=R((Kp,ms)=>{"use strict";ms.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,i]){let n=e.shift();return i==="f"?n.toFixed(6):i==="j"?JSON.stringify(n):i==="s"&&typeof n=="object"?`${n.constructor!==Object?n.constructor.name:""} {}`.trim():n.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"{}"}}}});var W=R((Yp,Es)=>{"use strict";var{format:zu,inspect:hr}=di(),{AggregateError:Vu}=j(),Hu=globalThis.AggregateError||Vu,Ku=Symbol("kIsNodeError"),Yu=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Zu=/^([A-Z][a-z0-9]*)+$/,Xu="__node_internal_",_r={};function Ve(t,e){if(!t)throw new _r.ERR_INTERNAL_ASSERTION(e)}function ws(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Ju(t,e,r){if(typeof e=="function")return Ve(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let i=(e.match(/%[dfijoOs]/g)||[]).length;return Ve(i===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${i}).`),r.length===0?e:zu(e,...r)}function U(t,e,r){r||(r=Error);class i extends r{constructor(...s){super(Ju(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.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}}),i.prototype.code=t,i.prototype[Ku]=!0,_r[t]=i}function xs(t){let e=Xu+t.name;return Object.defineProperty(t,"name",{value:e}),t}function ef(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Hu([e,t],e.message);return r.code=e.code,r}return t||e}var hi=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new _r.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};U("ERR_ASSERTION","%s",Error);U("ERR_INVALID_ARG_TYPE",(t,e,r)=>{Ve(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let i="The ";t.endsWith(" argument")?i+=`${t} `:i+=`"${t}" ${t.includes(".")?"property":"argument"} `,i+="must be ";let n=[],s=[],o=[];for(let l of e)Ve(typeof l=="string","All expected entries have to be of type string"),Yu.includes(l)?n.push(l.toLowerCase()):Zu.test(l)?s.push(l):(Ve(l!=="object",'The value "object" should be written as "Object"'),o.push(l));if(s.length>0){let l=n.indexOf("object");l!==-1&&(n.splice(n,l,1),s.push("Object"))}if(n.length>0){switch(n.length){case 1:i+=`of type ${n[0]}`;break;case 2:i+=`one of type ${n[0]} or ${n[1]}`;break;default:{let l=n.pop();i+=`one of type ${n.join(", ")}, or ${l}`}}(s.length>0||o.length>0)&&(i+=" or ")}if(s.length>0){switch(s.length){case 1:i+=`an instance of ${s[0]}`;break;case 2:i+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();i+=`an instance of ${s.join(", ")}, or ${l}`}}o.length>0&&(i+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(i+="an "),i+=`${o[0]}`;break;case 2:i+=`one of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();i+=`one of ${o.join(", ")}, or ${l}`}}if(r==null)i+=`. Received ${r}`;else if(typeof r=="function"&&r.name)i+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)i+=`. Received an instance of ${r.constructor.name}`;else{let l=hr(r,{depth:-1});i+=`. Received ${l}`}}else{let l=hr(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),i+=`. Received type ${typeof r} (${l})`}return i},TypeError);U("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let i=hr(e);return i.length>128&&(i=i.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${i}`},TypeError);U("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var i;let n=r!=null&&(i=r.constructor)!==null&&i!==void 0&&i.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${n}.`},TypeError);U("ERR_MISSING_ARGS",(...t)=>{Ve(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(i=>`"${i}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let i=t.pop();e+=`The ${t.join(", ")}, and ${i} arguments`}break}return`${e} must be specified`},TypeError);U("ERR_OUT_OF_RANGE",(t,e,r)=>{Ve(e,'Missing "range" argument');let i;if(Number.isInteger(r)&&Math.abs(r)>2**32)i=ws(String(r));else if(typeof r=="bigint"){i=String(r);let n=BigInt(2)**BigInt(32);(r>n||r<-n)&&(i=ws(i)),i+="n"}else i=hr(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${i}`},RangeError);U("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);U("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);U("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);U("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);U("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);U("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);U("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);U("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);U("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);U("ERR_STREAM_WRITE_AFTER_END","write after end",Error);U("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Es.exports={AbortError:hi,aggregateTwoErrors:xs(ef),hideStackFrames:xs,codes:_r}});var pt=R((Zp,pr)=>{"use strict";var{AbortController:Ss,AbortSignal:tf}=typeof self!="undefined"?self:typeof window!="undefined"?window:void 0;pr.exports=Ss;pr.exports.AbortSignal=tf;pr.exports.default=Ss});var Mt=R((Xp,_i)=>{"use strict";var bt=typeof Reflect=="object"?Reflect:null,Is=bt&&typeof bt.apply=="function"?bt.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},br;bt&&typeof bt.ownKeys=="function"?br=bt.ownKeys:Object.getOwnPropertySymbols?br=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:br=function(e){return Object.getOwnPropertyNames(e)};function rf(t){console&&console.warn&&console.warn(t)}var Ts=Number.isNaN||function(e){return e!==e};function v(){v.init.call(this)}_i.exports=v;_i.exports.once=af;v.EventEmitter=v;v.prototype._events=void 0;v.prototype._eventsCount=0;v.prototype._maxListeners=void 0;var Rs=10;function gr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(v,"defaultMaxListeners",{enumerable:!0,get:function(){return Rs},set:function(t){if(typeof t!="number"||t<0||Ts(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Rs=t}});v.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};v.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ts(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 As(t){return t._maxListeners===void 0?v.defaultMaxListeners:t._maxListeners}v.prototype.getMaxListeners=function(){return As(this)};v.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);var n=e==="error",s=this._events;if(s!==void 0)n=n&&s.error===void 0;else if(!n)return!1;if(n){var o;if(r.length>0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")Is(l,this,r);else for(var f=l.length,u=Ls(l,f),i=0;i<f;++i)Is(u[i],this,r);return!0};function vs(t,e,r,i){var n,s,o;if(gr(r),s=t._events,s===void 0?(s=t._events=Object.create(null),t._eventsCount=0):(s.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),o===void 0)o=s[e]=r,++t._eventsCount;else if(typeof o=="function"?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),n=As(t),n>0&&o.length>n&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,rf(a)}return t}v.prototype.addListener=function(e,r){return vs(this,e,r,!1)};v.prototype.on=v.prototype.addListener;v.prototype.prependListener=function(e,r){return vs(this,e,r,!0)};function nf(){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 Ns(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=nf.bind(i);return n.listener=r,i.wrapFn=n,n}v.prototype.once=function(e,r){return gr(r),this.on(e,Ns(this,e,r)),this};v.prototype.prependOnceListener=function(e,r){return gr(r),this.prependListener(e,Ns(this,e,r)),this};v.prototype.removeListener=function(e,r){var i,n,s,o,a;if(gr(r),n=this._events,n===void 0)return this;if(i=n[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===r||i[o].listener===r){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():sf(i,s),i.length===1&&(n[e]=i[0]),n.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};v.prototype.off=v.prototype.removeListener;v.prototype.removeAllListeners=function(e){var r,i,n;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(n=0;n<s.length;++n)o=s[n],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=i[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(n=r.length-1;n>=0;n--)this.removeListener(e,r[n]);return this};function Ps(t,e,r){var i=t._events;if(i===void 0)return[];var n=i[e];return n===void 0?[]:typeof n=="function"?r?[n.listener||n]:[n]:r?of(n):Ls(n,n.length)}v.prototype.listeners=function(e){return Ps(this,e,!0)};v.prototype.rawListeners=function(e){return Ps(this,e,!1)};v.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):js.call(t,e)};v.prototype.listenerCount=js;function js(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}v.prototype.eventNames=function(){return this._eventsCount>0?br(this._events):[]};function Ls(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function sf(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function of(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function af(t,e){return new Promise(function(r,i){function n(o){t.removeListener(e,s),i(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",n),r([].slice.call(arguments))}Bs(t,e,s,{once:!0}),e!=="error"&&lf(t,n,{once:!0})})}function lf(t,e,r){typeof t.on=="function"&&Bs(t,"error",e,r)}function Bs(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function n(s){i.once&&t.removeEventListener(e,n),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var z=R((Jp,bi)=>{"use strict";var uf=oe(),{format:ff,inspect:cf}=di(),{codes:{ERR_INVALID_ARG_TYPE:pi}}=W(),{kResistStopPropagation:df,AggregateError:hf,SymbolDispose:_f}=j(),pf=globalThis.AbortSignal||pt().AbortSignal,bf=globalThis.AbortController||pt().AbortController,gf=Object.getPrototypeOf(async function(){}).constructor,Fs=globalThis.Blob||uf.Blob,yf=typeof Fs!="undefined"?function(e){return e instanceof Fs}:function(e){return!1},Cs=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new pi(e,"AbortSignal",t)},mf=(t,e)=>{if(typeof t!="function")throw new pi(e,"Function",t)};bi.exports={AggregateError:hf,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((i,n)=>{t=i,e=n}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((i,...n)=>i?r(i):e(...n))})},debuglog(){return function(){}},format:ff,inspect:cf,types:{isAsyncFunction(t){return t instanceof gf},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:yf,deprecate(t,e){return t},addAbortListener:Mt().addAbortListener||function(e,r){if(e===void 0)throw new pi("signal","AbortSignal",e);Cs(e,"signal"),mf(r,"listener");let i;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[df]:!0}),i=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[_f](){var n;(n=i)===null||n===void 0||n()}}},AbortSignalAny:pf.any||function(e){if(e.length===1)return e[0];let r=new bf,i=()=>r.abort();return e.forEach(n=>{Cs(n,"signals"),n.addEventListener("abort",i,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(n=>n.removeEventListener("abort",i))},{once:!0}),r.signal}};bi.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var yt=R((eb,Qs)=>{"use strict";var{ArrayIsArray:yi,ArrayPrototypeIncludes:$s,ArrayPrototypeJoin:ks,ArrayPrototypeMap:wf,NumberIsInteger:mi,NumberIsNaN:xf,NumberMAX_SAFE_INTEGER:Ef,NumberMIN_SAFE_INTEGER:Sf,NumberParseInt:If,ObjectPrototypeHasOwnProperty:Rf,RegExpPrototypeExec:qs,String:Tf,StringPrototypeToUpperCase:Af,StringPrototypeTrim:vf}=j(),{hideStackFrames:J,codes:{ERR_SOCKET_BAD_PORT:Nf,ERR_INVALID_ARG_TYPE:G,ERR_INVALID_ARG_VALUE:gt,ERR_OUT_OF_RANGE:He,ERR_UNKNOWN_SIGNAL:Os}}=W(),{normalizeEncoding:Pf}=z(),{isAsyncFunction:jf,isArrayBufferView:Lf}=z().types,Ds={};function Bf(t){return t===(t|0)}function Ff(t){return t===t>>>0}var Cf=/^[0-7]+$/,Of="must be a 32-bit unsigned integer or an octal string";function Df(t,e,r){if(typeof t=="undefined"&&(t=r),typeof t=="string"){if(qs(Cf,t)===null)throw new gt(e,t,Of);t=If(t,8)}return Us(t,e),t}var Mf=J((t,e,r=Sf,i=Ef)=>{if(typeof t!="number")throw new G(e,"number",t);if(!mi(t))throw new He(e,"an integer",t);if(t<r||t>i)throw new He(e,`>= ${r} && <= ${i}`,t)}),$f=J((t,e,r=-2147483648,i=2147483647)=>{if(typeof t!="number")throw new G(e,"number",t);if(!mi(t))throw new He(e,"an integer",t);if(t<r||t>i)throw new He(e,`>= ${r} && <= ${i}`,t)}),Us=J((t,e,r=!1)=>{if(typeof t!="number")throw new G(e,"number",t);if(!mi(t))throw new He(e,"an integer",t);let i=r?1:0,n=4294967295;if(t<i||t>n)throw new He(e,`>= ${i} && <= ${n}`,t)});function wi(t,e){if(typeof t!="string")throw new G(e,"string",t)}function kf(t,e,r=void 0,i){if(typeof t!="number")throw new G(e,"number",t);if(r!=null&&t<r||i!=null&&t>i||(r!=null||i!=null)&&xf(t))throw new He(e,`${r!=null?`>= ${r}`:""}${r!=null&&i!=null?" && ":""}${i!=null?`<= ${i}`:""}`,t)}var qf=J((t,e,r)=>{if(!$s(r,t)){let n="must be one of: "+ks(wf(r,s=>typeof s=="string"?`'${s}'`:Tf(s)),", ");throw new gt(e,t,n)}});function Ws(t,e){if(typeof t!="boolean")throw new G(e,"boolean",t)}function gi(t,e,r){return t==null||!Rf(t,e)?r:t[e]}var Uf=J((t,e,r=null)=>{let i=gi(r,"allowArray",!1),n=gi(r,"allowFunction",!1);if(!gi(r,"nullable",!1)&&t===null||!i&&yi(t)||typeof t!="object"&&(!n||typeof t!="function"))throw new G(e,"Object",t)}),Wf=J((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new G(e,"a dictionary",t)}),yr=J((t,e,r=0)=>{if(!yi(t))throw new G(e,"Array",t);if(t.length<r){let i=`must be longer than ${r}`;throw new gt(e,t,i)}});function Gf(t,e){yr(t,e);for(let r=0;r<t.length;r++)wi(t[r],`${e}[${r}]`)}function Qf(t,e){yr(t,e);for(let r=0;r<t.length;r++)Ws(t[r],`${e}[${r}]`)}function zf(t,e){yr(t,e);for(let r=0;r<t.length;r++){let i=t[r],n=`${e}[${r}]`;if(i==null)throw new G(n,"AbortSignal",i);Gs(i,n)}}function Vf(t,e="signal"){if(wi(t,e),Ds[t]===void 0)throw Ds[Af(t)]!==void 0?new Os(t+" (signals must use all capital letters)"):new Os(t)}var Hf=J((t,e="buffer")=>{if(!Lf(t))throw new G(e,["Buffer","TypedArray","DataView"],t)});function Kf(t,e){let r=Pf(e),i=t.length;if(r==="hex"&&i%2!==0)throw new gt("encoding",e,`is invalid for data of length ${i}`)}function Yf(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&vf(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Nf(e,t,r);return t|0}var Gs=J((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new G(e,"AbortSignal",t)}),Zf=J((t,e)=>{if(typeof t!="function")throw new G(e,"Function",t)}),Xf=J((t,e)=>{if(typeof t!="function"||jf(t))throw new G(e,"Function",t)}),Jf=J((t,e)=>{if(t!==void 0)throw new G(e,"undefined",t)});function ec(t,e,r){if(!$s(r,t))throw new G(e,`('${ks(r,"|")}')`,t)}var tc=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Ms(t,e){if(typeof t=="undefined"||!qs(tc,t))throw new gt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function rc(t){if(typeof t=="string")return Ms(t,"hints"),t;if(yi(t)){let e=t.length,r="";if(e===0)return r;for(let i=0;i<e;i++){let n=t[i];Ms(n,"hints"),r+=n,i!==e-1&&(r+=", ")}return r}throw new gt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Qs.exports={isInt32:Bf,isUint32:Ff,parseFileMode:Df,validateArray:yr,validateStringArray:Gf,validateBooleanArray:Qf,validateAbortSignalArray:zf,validateBoolean:Ws,validateBuffer:Hf,validateDictionary:Wf,validateEncoding:Kf,validateFunction:Zf,validateInt32:$f,validateInteger:Mf,validateNumber:kf,validateObject:Uf,validateOneOf:qf,validatePlainFunction:Xf,validatePort:Yf,validateSignalName:Vf,validateString:wi,validateUint32:Us,validateUndefined:Jf,validateUnion:ec,validateAbortSignal:Gs,validateLinkHeaderValue:rc}});var Oe=R((tb,Ks)=>{var F=Ks.exports={},ue,fe;function xi(){throw new Error("setTimeout has not been defined")}function Ei(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ue=setTimeout:ue=xi}catch(t){ue=xi}try{typeof clearTimeout=="function"?fe=clearTimeout:fe=Ei}catch(t){fe=Ei}})();function zs(t){if(ue===setTimeout)return setTimeout(t,0);if((ue===xi||!ue)&&setTimeout)return ue=setTimeout,setTimeout(t,0);try{return ue(t,0)}catch(e){try{return ue.call(null,t,0)}catch(r){return ue.call(this,t,0)}}}function ic(t){if(fe===clearTimeout)return clearTimeout(t);if((fe===Ei||!fe)&&clearTimeout)return fe=clearTimeout,clearTimeout(t);try{return fe(t)}catch(e){try{return fe.call(null,t)}catch(r){return fe.call(this,t)}}}var Ie=[],mt=!1,Ke,mr=-1;function nc(){!mt||!Ke||(mt=!1,Ke.length?Ie=Ke.concat(Ie):mr=-1,Ie.length&&Vs())}function Vs(){if(!mt){var t=zs(nc);mt=!0;for(var e=Ie.length;e;){for(Ke=Ie,Ie=[];++mr<e;)Ke&&Ke[mr].run();mr=-1,e=Ie.length}Ke=null,mt=!1,ic(t)}}F.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];Ie.push(new Hs(t,e)),Ie.length===1&&!mt&&zs(Vs)};function Hs(t,e){this.fun=t,this.array=e}Hs.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Re(){}F.on=Re;F.addListener=Re;F.once=Re;F.off=Re;F.removeListener=Re;F.removeAllListeners=Re;F.emit=Re;F.prependListener=Re;F.prependOnceListener=Re;F.listeners=function(t){return[]};F.binding=function(t){throw new Error("process.binding is not supported")};F.cwd=function(){return"/"};F.chdir=function(t){throw new Error("process.chdir is not supported")};F.umask=function(){return 0}});var de=R((rb,fo)=>{"use strict";var{SymbolAsyncIterator:Ys,SymbolIterator:Zs,SymbolFor:Ye}=j(),Xs=Ye("nodejs.stream.destroyed"),Js=Ye("nodejs.stream.errored"),Si=Ye("nodejs.stream.readable"),Ii=Ye("nodejs.stream.writable"),eo=Ye("nodejs.stream.disturbed"),sc=Ye("nodejs.webstream.isClosedPromise"),oc=Ye("nodejs.webstream.controllerErrorFunction");function wr(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 xr(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 ac(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function ce(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function to(t){return!!(t&&!ce(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function ro(t){return!!(t&&!ce(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function io(t){return!!(t&&!ce(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function lc(t){return to(t)||ro(t)||io(t)}function uc(t,e){return t==null?!1:e===!0?typeof t[Ys]=="function":e===!1?typeof t[Zs]=="function":typeof t[Ys]=="function"||typeof t[Zs]=="function"}function Er(t){if(!ce(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!!(t.destroyed||t[Xs]||i!=null&&i.destroyed)}function no(t){if(!xr(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function fc(t,e){if(!xr(t))return null;if(t.writableFinished===!0)return!0;let 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 cc(t){if(!wr(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof(e==null?void 0:e.ended)!="boolean"?null:e.ended}function so(t,e){if(!wr(t))return null;let 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 oo(t){return t&&t[Si]!=null?t[Si]:typeof(t==null?void 0:t.readable)!="boolean"?null:Er(t)?!1:wr(t)&&t.readable&&!so(t)}function ao(t){return t&&t[Ii]!=null?t[Ii]:typeof(t==null?void 0:t.writable)!="boolean"?null:Er(t)?!1:xr(t)&&t.writable&&!no(t)}function dc(t,e){return ce(t)?Er(t)?!0:!((e==null?void 0:e.readable)!==!1&&oo(t)||(e==null?void 0:e.writable)!==!1&&ao(t)):null}function hc(t){var e,r;return ce(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 _c(t){var e,r;return ce(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 pc(t){if(!ce(t))return null;if(typeof t.closed=="boolean")return t.closed;let 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"&&lo(t)?t._closed:null}function lo(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function uo(t){return typeof t._sent100=="boolean"&&lo(t)}function bc(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 gc(t){if(!ce(t))return null;let e=t._writableState,r=t._readableState,i=e||r;return!i&&uo(t)||!!(i&&i.autoDestroy&&i.emitClose&&i.closed===!1)}function yc(t){var e;return!!(t&&((e=t[eo])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function mc(t){var e,r,i,n,s,o,a,l,f,u;return!!(t&&((e=(r=(i=(n=(s=(o=t[Js])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&n!==void 0?n:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&i!==void 0?i:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(f=t._readableState)===null||f===void 0?void 0:f.errored)!==null&&e!==void 0?e:!((u=t._writableState)===null||u===void 0)&&u.errored))}fo.exports={isDestroyed:Er,kIsDestroyed:Xs,isDisturbed:yc,kIsDisturbed:eo,isErrored:mc,kIsErrored:Js,isReadable:oo,kIsReadable:Si,kIsClosedPromise:sc,kControllerErrorFunction:oc,kIsWritable:Ii,isClosed:pc,isDuplexNodeStream:ac,isFinished:dc,isIterable:uc,isReadableNodeStream:wr,isReadableStream:to,isReadableEnded:cc,isReadableFinished:so,isReadableErrored:_c,isNodeStream:ce,isWebStream:lc,isWritable:ao,isWritableNodeStream:xr,isWritableStream:ro,isWritableEnded:no,isWritableFinished:fc,isWritableErrored:hc,isServerRequest:bc,isServerResponse:uo,willEmitClose:gc,isTransformStream:io}});var Te=R((ib,Ni)=>{"use strict";var De=Oe(),{AbortError:wo,codes:wc}=W(),{ERR_INVALID_ARG_TYPE:xc,ERR_STREAM_PREMATURE_CLOSE:co}=wc,{kEmptyObject:Ti,once:Ai}=z(),{validateAbortSignal:Ec,validateFunction:Sc,validateObject:Ic,validateBoolean:Rc}=yt(),{Promise:Tc,PromisePrototypeThen:Ac,SymbolDispose:xo}=j(),{isClosed:vc,isReadable:ho,isReadableNodeStream:Ri,isReadableStream:Nc,isReadableFinished:_o,isReadableErrored:po,isWritable:bo,isWritableNodeStream:go,isWritableStream:Pc,isWritableFinished:yo,isWritableErrored:mo,isNodeStream:jc,willEmitClose:Lc,kIsClosedPromise:Bc}=de(),wt;function Fc(t){return t.setHeader&&typeof t.abort=="function"}var vi=()=>{};function Eo(t,e,r){var i,n;if(arguments.length===2?(r=e,e=Ti):e==null?e=Ti:Ic(e,"options"),Sc(r,"callback"),Ec(e.signal,"options.signal"),r=Ai(r),Nc(t)||Pc(t))return Cc(t,e,r);if(!jc(t))throw new xc("stream",["ReadableStream","WritableStream","Stream"],t);let s=(i=e.readable)!==null&&i!==void 0?i:Ri(t),o=(n=e.writable)!==null&&n!==void 0?n:go(t),a=t._writableState,l=t._readableState,f=()=>{t.writable||_()},u=Lc(t)&&Ri(t)===s&&go(t)===o,c=yo(t,!1),_=()=>{c=!0,t.destroyed&&(u=!1),!(u&&(!t.readable||s))&&(!s||d)&&r.call(t)},d=_o(t,!1),p=()=>{d=!0,t.destroyed&&(u=!1),!(u&&(!t.writable||o))&&(!o||c)&&r.call(t)},b=m=>{r.call(t,m)},y=vc(t),w=()=>{y=!0;let m=mo(t)||po(t);if(m&&typeof m!="boolean")return r.call(t,m);if(s&&!d&&Ri(t,!0)&&!_o(t,!1))return r.call(t,new co);if(o&&!c&&!yo(t,!1))return r.call(t,new co);r.call(t)},T=()=>{y=!0;let m=mo(t)||po(t);if(m&&typeof m!="boolean")return r.call(t,m);r.call(t)},x=()=>{t.req.on("finish",_)};Fc(t)?(t.on("complete",_),u||t.on("abort",w),t.req?x():t.on("request",x)):o&&!a&&(t.on("end",f),t.on("close",f)),!u&&typeof t.aborted=="boolean"&&t.on("aborted",w),t.on("end",p),t.on("finish",_),e.error!==!1&&t.on("error",b),t.on("close",w),y?De.nextTick(w):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?u||De.nextTick(T):(!s&&(!u||ho(t))&&(c||bo(t)===!1)||!o&&(!u||bo(t))&&(d||ho(t)===!1)||l&&t.req&&t.aborted)&&De.nextTick(T);let g=()=>{r=vi,t.removeListener("aborted",w),t.removeListener("complete",_),t.removeListener("abort",w),t.removeListener("request",x),t.req&&t.req.removeListener("finish",_),t.removeListener("end",f),t.removeListener("close",f),t.removeListener("finish",_),t.removeListener("end",p),t.removeListener("error",b),t.removeListener("close",w)};if(e.signal&&!y){let m=()=>{let I=r;g(),I.call(t,new wo(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)De.nextTick(m);else{wt=wt||z().addAbortListener;let I=wt(e.signal,m),A=r;r=Ai((...ye)=>{I[xo](),A.apply(t,ye)})}}return g}function Cc(t,e,r){let i=!1,n=vi;if(e.signal)if(n=()=>{i=!0,r.call(t,new wo(void 0,{cause:e.signal.reason}))},e.signal.aborted)De.nextTick(n);else{wt=wt||z().addAbortListener;let o=wt(e.signal,n),a=r;r=Ai((...l)=>{o[xo](),a.apply(t,l)})}let s=(...o)=>{i||De.nextTick(()=>r.apply(t,o))};return Ac(t[Bc].promise,s,s),vi}function Oc(t,e){var r;let i=!1;return e===null&&(e=Ti),(r=e)!==null&&r!==void 0&&r.cleanup&&(Rc(e.cleanup,"cleanup"),i=e.cleanup),new Tc((n,s)=>{let o=Eo(t,e,a=>{i&&o(),a?s(a):n()})})}Ni.exports=Eo;Ni.exports.finished=Oc});var Ze=R((nb,Po)=>{"use strict";var he=Oe(),{aggregateTwoErrors:Dc,codes:{ERR_MULTIPLE_CALLBACK:Mc},AbortError:$c}=W(),{Symbol:Ro}=j(),{kIsDestroyed:kc,isDestroyed:qc,isFinished:Uc,isServerRequest:Wc}=de(),To=Ro("kDestroy"),Pi=Ro("kConstruct");function Ao(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Gc(t,e){let r=this._readableState,i=this._writableState,n=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(Ao(t,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),n.constructed?So(this,t,e):this.once(To,function(s){So(this,Dc(s,t),e)}),this)}function So(t,e,r){let i=!1;function n(s){if(i)return;i=!0;let o=t._readableState,a=t._writableState;Ao(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?he.nextTick(Qc,t,s):he.nextTick(vo,t)}try{t._destroy(e||null,n)}catch(s){n(s)}}function Qc(t,e){ji(t,e),vo(t)}function vo(t){let 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 ji(t,e){let r=t._readableState,i=t._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function zc(){let 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 Li(t,e,r){let i=t._readableState,n=t._writableState;if(n!=null&&n.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||n!=null&&n.autoDestroy?t.destroy(e):e&&(e.stack,n&&!n.errored&&(n.errored=e),i&&!i.errored&&(i.errored=e),r?he.nextTick(ji,t,e):ji(t,e))}function Vc(t,e){if(typeof t._construct!="function")return;let r=t._readableState,i=t._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),t.once(Pi,e),!(t.listenerCount(Pi)>1)&&he.nextTick(Hc,t)}function Hc(t){let e=!1;function r(i){if(e){Li(t,i!=null?i:new Mc);return}e=!0;let n=t._readableState,s=t._writableState,o=s||n;n&&(n.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(To,i):i?Li(t,i,!0):he.nextTick(Kc,t)}try{t._construct(i=>{he.nextTick(r,i)})}catch(i){he.nextTick(r,i)}}function Kc(t){t.emit(Pi)}function Io(t){return(t==null?void 0:t.setHeader)&&typeof t.abort=="function"}function No(t){t.emit("close")}function Yc(t,e){t.emit("error",e),he.nextTick(No,t)}function Zc(t,e){!t||qc(t)||(!e&&!Uc(t)&&(e=new $c),Wc(t)?(t.socket=null,t.destroy(e)):Io(t)?t.abort():Io(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?he.nextTick(Yc,t,e):he.nextTick(No,t),t.destroyed||(t[kc]=!0))}Po.exports={construct:Vc,destroyer:Zc,destroy:Gc,undestroy:zc,errorOrDestroy:Li}});var Rr=R((sb,Lo)=>{"use strict";var{ArrayIsArray:Xc,ObjectSetPrototypeOf:jo}=j(),{EventEmitter:Sr}=Mt();function Ir(t){Sr.call(this,t)}jo(Ir.prototype,Sr.prototype);jo(Ir,Sr);Ir.prototype.pipe=function(t,e){let r=this;function i(u){t.writable&&t.write(u)===!1&&r.pause&&r.pause()}r.on("data",i);function n(){r.readable&&r.resume&&r.resume()}t.on("drain",n),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",o),r.on("close",a));let s=!1;function o(){s||(s=!0,t.end())}function a(){s||(s=!0,typeof t.destroy=="function"&&t.destroy())}function l(u){f(),Sr.listenerCount(this,"error")===0&&this.emit("error",u)}Bi(r,"error",l),Bi(t,"error",l);function f(){r.removeListener("data",i),t.removeListener("drain",n),r.removeListener("end",o),r.removeListener("close",a),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",f),r.removeListener("close",f),t.removeListener("close",f)}return r.on("end",f),r.on("close",f),t.on("close",f),t.emit("pipe",r),t};function Bi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Xc(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Lo.exports={Stream:Ir,prependListener:Bi}});var $t=R((ob,Tr)=>{"use strict";var{SymbolDispose:Jc}=j(),{AbortError:Bo,codes:ed}=W(),{isNodeStream:Fo,isWebStream:td,kControllerErrorFunction:rd}=de(),id=Te(),{ERR_INVALID_ARG_TYPE:Co}=ed,Fi,nd=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Co(e,"AbortSignal",t)};Tr.exports.addAbortSignal=function(e,r){if(nd(e,"signal"),!Fo(r)&&!td(r))throw new Co("stream",["ReadableStream","WritableStream","Stream"],r);return Tr.exports.addAbortSignalNoValidate(e,r)};Tr.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Fo(e)?()=>{e.destroy(new Bo(void 0,{cause:t.reason}))}:()=>{e[rd](new Bo(void 0,{cause:t.reason}))};if(t.aborted)r();else{Fi=Fi||z().addAbortListener;let i=Fi(t,r);id(e,i[Jc])}return e}});var Mo=R((lb,Do)=>{"use strict";var{StringPrototypeSlice:Oo,SymbolIterator:sd,TypedArrayPrototypeSet:Ar,Uint8Array:od}=j(),{Buffer:Ci}=oe(),{inspect:ad}=z();Do.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let 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,i=""+r.data;for(;(r=r.next)!==null;)i+=e+r.data;return i}concat(e){if(this.length===0)return Ci.alloc(0);let r=Ci.allocUnsafe(e>>>0),i=this.head,n=0;for(;i;)Ar(r,i.data,n),n+=i.data.length,i=i.next;return r}consume(e,r){let i=this.head.data;if(e<i.length){let n=i.slice(0,e);return this.head.data=i.slice(e),n}return e===i.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[sd](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",i=this.head,n=0;do{let s=i.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++n,i.next?this.head=i.next:this.head=this.tail=null):(r+=Oo(s,0,e),this.head=i,i.data=Oo(s,e));break}++n}while((i=i.next)!==null);return this.length-=n,r}_getBuffer(e){let r=Ci.allocUnsafe(e),i=e,n=this.head,s=0;do{let o=n.data;if(e>o.length)Ar(r,o,i-e),e-=o.length;else{e===o.length?(Ar(r,o,i-e),++s,n.next?this.head=n.next:this.head=this.tail=null):(Ar(r,new od(o.buffer,o.byteOffset,e),i-e),this.head=n,n.data=o.slice(e));break}++s}while((n=n.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return ad(this,Le(O({},r),{depth:0,customInspect:!1}))}}});var kt=R((fb,Uo)=>{"use strict";var{MathFloor:ld,NumberIsInteger:ud}=j(),{validateInteger:fd}=yt(),{ERR_INVALID_ARG_VALUE:cd}=W().codes,$o=16*1024,ko=16;function dd(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function qo(t){return t?ko:$o}function hd(t,e){fd(e,"value",0),t?ko=e:$o=e}function _d(t,e,r,i){let n=dd(e,i,r);if(n!=null){if(!ud(n)||n<0){let s=i?`options.${r}`:"options.highWaterMark";throw new cd(s,n)}return ld(n)}return qo(t.objectMode)}Uo.exports={getHighWaterMark:_d,getDefaultHighWaterMark:qo,setDefaultHighWaterMark:hd}});var Qo=R((Oi,Go)=>{var vr=oe(),_e=vr.Buffer;function Wo(t,e){for(var r in t)e[r]=t[r]}_e.from&&_e.alloc&&_e.allocUnsafe&&_e.allocUnsafeSlow?Go.exports=vr:(Wo(vr,Oi),Oi.Buffer=Xe);function Xe(t,e,r){return _e(t,e,r)}Xe.prototype=Object.create(_e.prototype);Wo(_e,Xe);Xe.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return _e(t,e,r)};Xe.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=_e(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};Xe.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return _e(t)};Xe.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return vr.SlowBuffer(t)}});var Ho=R(Vo=>{"use strict";var Mi=Qo().Buffer,zo=Mi.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 pd(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 bd(t){var e=pd(t);if(typeof e!="string"&&(Mi.isEncoding===zo||!zo(t)))throw new Error("Unknown encoding: "+t);return e||t}Vo.StringDecoder=qt;function qt(t){this.encoding=bd(t);var e;switch(this.encoding){case"utf16le":this.text=Ed,this.end=Sd,e=4;break;case"utf8":this.fillLast=md,e=4;break;case"base64":this.text=Id,this.end=Rd,e=3;break;default:this.write=Td,this.end=Ad;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Mi.allocUnsafe(e)}qt.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||""};qt.prototype.end=xd;qt.prototype.text=wd;qt.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 Di(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function gd(t,e,r){var i=e.length-1;if(i<r)return 0;var n=Di(e[i]);return n>=0?(n>0&&(t.lastNeed=n-1),n):--i<r||n===-2?0:(n=Di(e[i]),n>=0?(n>0&&(t.lastNeed=n-2),n):--i<r||n===-2?0:(n=Di(e[i]),n>=0?(n>0&&(n===2?n=0:t.lastNeed=n-3),n):0))}function yd(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function md(t){var e=this.lastTotal-this.lastNeed,r=yd(this,t,e);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 wd(t,e){var r=gd(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)}function xd(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Ed(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=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 Sd(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 Id(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 Rd(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Td(t){return t.toString(this.encoding)}function Ad(t){return t&&t.length?this.write(t):""}});var $i=R((db,Xo)=>{"use strict";var Ko=Oe(),{PromisePrototypeThen:vd,SymbolAsyncIterator:Yo,SymbolIterator:Zo}=j(),{Buffer:Nd}=oe(),{ERR_INVALID_ARG_TYPE:Pd,ERR_STREAM_NULL_VALUES:jd}=W().codes;function Ld(t,e,r){let i;if(typeof e=="string"||e instanceof Nd)return new t(Le(O({objectMode:!0},r),{read(){this.push(e),this.push(null)}}));let n;if(e&&e[Yo])n=!0,i=e[Yo]();else if(e&&e[Zo])n=!1,i=e[Zo]();else throw new Pd("iterable",["Iterable"],e);let s=new t(O({objectMode:!0,highWaterMark:1},r)),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(f,u){vd(a(f),()=>Ko.nextTick(u,f),c=>Ko.nextTick(u,c||f))};async function a(f){let u=f!=null,c=typeof i.throw=="function";if(u&&c){let{value:_,done:d}=await i.throw(f);if(await _,d)return}if(typeof i.return=="function"){let{value:_}=await i.return();await _}}async function l(){for(;;){try{let{value:f,done:u}=n?await i.next():i.next();if(u)s.push(null);else{let c=f&&typeof f.then=="function"?await f:f;if(c===null)throw o=!1,new jd;if(s.push(c))continue;o=!1}}catch(f){s.destroy(f)}break}}return s}Xo.exports=Ld});var Wt=R((_b,ba)=>{"use strict";var re=Oe(),{ArrayPrototypeIndexOf:Bd,NumberIsInteger:Fd,NumberIsNaN:Cd,NumberParseInt:Od,ObjectDefineProperties:Vi,ObjectKeys:Dd,ObjectSetPrototypeOf:ta,Promise:ra,SafeSet:Md,SymbolAsyncDispose:$d,SymbolAsyncIterator:kd,Symbol:qd}=j();ba.exports=E;E.ReadableState=Lr;var{EventEmitter:Ud}=Mt(),{Stream:Me,prependListener:Wd}=Rr(),{Buffer:ki}=oe(),{addAbortSignal:Gd}=$t(),ia=Te(),S=z().debuglog("stream",t=>{S=t}),Qd=Mo(),St=Ze(),{getHighWaterMark:zd,getDefaultHighWaterMark:Vd}=kt(),{aggregateTwoErrors:Jo,codes:{ERR_INVALID_ARG_TYPE:Hd,ERR_METHOD_NOT_IMPLEMENTED:Kd,ERR_OUT_OF_RANGE:Yd,ERR_STREAM_PUSH_AFTER_EOF:Zd,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Xd},AbortError:Jd}=W(),{validateObject:eh}=yt(),Je=qd("kPaused"),{StringDecoder:na}=Ho(),th=$i();ta(E.prototype,Me.prototype);ta(E,Me);var qi=()=>{},{errorOrDestroy:xt}=St,Et=1,rh=2,sa=4,Ut=8,oa=16,Nr=32,Pr=64,aa=128,ih=256,nh=512,sh=1024,Qi=2048,zi=4096,oh=8192,ah=16384,lh=32768,la=65536,uh=1<<17,fh=1<<18;function M(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Vi(Lr.prototype,{objectMode:M(Et),ended:M(rh),endEmitted:M(sa),reading:M(Ut),constructed:M(oa),sync:M(Nr),needReadable:M(Pr),emittedReadable:M(aa),readableListening:M(ih),resumeScheduled:M(nh),errorEmitted:M(sh),emitClose:M(Qi),autoDestroy:M(zi),destroyed:M(oh),closed:M(ah),closeEmitted:M(lh),multiAwaitDrain:M(la),readingMore:M(uh),dataEmitted:M(fh)});function Lr(t,e,r){typeof r!="boolean"&&(r=e instanceof pe()),this.state=Qi|zi|oa|Nr,t&&t.objectMode&&(this.state|=Et),r&&t&&t.readableObjectMode&&(this.state|=Et),this.highWaterMark=t?zd(this,t,"readableHighWaterMark",r):Vd(!1),this.buffer=new Qd,this.length=0,this.pipes=[],this.flowing=null,this[Je]=null,t&&t.emitClose===!1&&(this.state&=~Qi),t&&t.autoDestroy===!1&&(this.state&=~zi),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new na(t.encoding),this.encoding=t.encoding)}function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof pe();this._readableState=new Lr(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Gd(t.signal,this)),Me.call(this,t),St.construct(this,()=>{this._readableState.needReadable&&jr(this,this._readableState)})}E.prototype.destroy=St.destroy;E.prototype._undestroy=St.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[Ud.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[$d]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Jd,this.destroy(t)),new ra((e,r)=>ia(this,i=>i&&i!==t?r(i):e(null)))};E.prototype.push=function(t,e){return ua(this,t,e,!1)};E.prototype.unshift=function(t,e){return ua(this,t,e,!0)};function ua(t,e,r,i){S("readableAddChunk",e);let n=t._readableState,s;if((n.state&Et)===0&&(typeof e=="string"?(r=r||n.defaultEncoding,n.encoding!==r&&(i&&n.encoding?e=ki.from(e,r).toString(n.encoding):(e=ki.from(e,r),r=""))):e instanceof ki?r="":Me._isUint8Array(e)?(e=Me._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Hd("chunk",["string","Buffer","Uint8Array"],e))),s)xt(t,s);else if(e===null)n.state&=~Ut,hh(t,n);else if((n.state&Et)!==0||e&&e.length>0)if(i)if((n.state&sa)!==0)xt(t,new Xd);else{if(n.destroyed||n.errored)return!1;Ui(t,n,e,!0)}else if(n.ended)xt(t,new Zd);else{if(n.destroyed||n.errored)return!1;n.state&=~Ut,n.decoder&&!r?(e=n.decoder.write(e),n.objectMode||e.length!==0?Ui(t,n,e,!1):jr(t,n)):Ui(t,n,e,!1)}else i||(n.state&=~Ut,jr(t,n));return!n.ended&&(n.length<n.highWaterMark||n.length===0)}function Ui(t,e,r,i){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&la)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,i?e.buffer.unshift(r):e.buffer.push(r),(e.state&Pr)!==0&&Br(t)),jr(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[Je]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new na(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,i="";for(let n of r)i+=e.write(n);return r.clear(),i!==""&&r.push(i),this._readableState.length=i.length,this};var ch=1073741824;function dh(t){if(t>ch)throw new Yd("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function ea(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Et)!==0?1:Cd(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}E.prototype.read=function(t){S("read",t),t===void 0?t=NaN:Fd(t)||(t=Od(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=dh(t)),t!==0&&(e.state&=~aa),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return S("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Wi(this):Br(this),null;if(t=ea(t,e),t===0&&e.ended)return e.length===0&&Wi(this),null;let i=(e.state&Pr)!==0;if(S("need readable",i),(e.length===0||e.length-t<e.highWaterMark)&&(i=!0,S("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,S("reading, ended or constructing",i);else if(i){S("do read"),e.state|=Ut|Nr,e.length===0&&(e.state|=Pr);try{this._read(e.highWaterMark)}catch(s){xt(this,s)}e.state&=~Nr,e.reading||(t=ea(r,e))}let n;return t>0?n=_a(t,e):n=null,n===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&Wi(this)),n!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",n)),n};function hh(t,e){if(S("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?Br(t):(e.needReadable=!1,e.emittedReadable=!0,fa(t))}}function Br(t){let e=t._readableState;S("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(S("emitReadable",e.flowing),e.emittedReadable=!0,re.nextTick(fa,t))}function fa(t){let e=t._readableState;S("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,da(t)}function jr(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,re.nextTick(_h,t,e))}function _h(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(S("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}E.prototype._read=function(t){throw new Kd("_read()")};E.prototype.pipe=function(t,e){let r=this,i=this._readableState;i.pipes.length===1&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new Md(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),S("pipe count=%d opts=%j",i.pipes.length,e);let s=(!e||e.end!==!1)&&t!==re.stdout&&t!==re.stderr?a:y;i.endEmitted?re.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(w,T){S("onunpipe"),w===r&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,u())}function a(){S("onend"),t.end()}let l,f=!1;function u(){S("cleanup"),t.removeListener("close",p),t.removeListener("finish",b),l&&t.removeListener("drain",l),t.removeListener("error",d),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",_),f=!0,l&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){f||(i.pipes.length===1&&i.pipes[0]===t?(S("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(S("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),r.pause()),l||(l=ph(r,t),t.on("drain",l))}r.on("data",_);function _(w){S("ondata");let T=t.write(w);S("dest.write",T),T===!1&&c()}function d(w){if(S("onerror",w),y(),t.removeListener("error",d),t.listenerCount("error")===0){let T=t._writableState||t._readableState;T&&!T.errorEmitted?xt(t,w):t.emit("error",w)}}Wd(t,"error",d);function p(){t.removeListener("finish",b),y()}t.once("close",p);function b(){S("onfinish"),t.removeListener("close",p),y()}t.once("finish",b);function y(){S("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():i.flowing||(S("pipe resume"),r.resume()),t};function ph(t,e){return function(){let i=t._readableState;i.awaitDrainWriters===e?(S("pipeOnDrain",1),i.awaitDrainWriters=null):i.multiAwaitDrain&&(S("pipeOnDrain",i.awaitDrainWriters.size),i.awaitDrainWriters.delete(e)),(!i.awaitDrainWriters||i.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}E.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let n=e.pipes;e.pipes=[],this.pause();for(let s=0;s<n.length;s++)n[s].emit("unpipe",this,{hasUnpiped:!1});return this}let i=Bd(e.pipes,t);return i===-1?this:(e.pipes.splice(i,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};E.prototype.on=function(t,e){let r=Me.prototype.on.call(this,t,e),i=this._readableState;return t==="data"?(i.readableListening=this.listenerCount("readable")>0,i.flowing!==!1&&this.resume()):t==="readable"&&!i.endEmitted&&!i.readableListening&&(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S("on readable",i.length,i.reading),i.length?Br(this):i.reading||re.nextTick(bh,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=Me.prototype.removeListener.call(this,t,e);return t==="readable"&&re.nextTick(ca,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=Me.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&re.nextTick(ca,this),e};function ca(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Je]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function bh(t){S("readable nexttick read 0"),t.read(0)}E.prototype.resume=function(){let t=this._readableState;return t.flowing||(S("resume"),t.flowing=!t.readableListening,gh(this,t)),t[Je]=!1,this};function gh(t,e){e.resumeScheduled||(e.resumeScheduled=!0,re.nextTick(yh,t,e))}function yh(t,e){S("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),da(t),e.flowing&&!e.reading&&t.read(0)}E.prototype.pause=function(){return S("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(S("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Je]=!0,this};function da(t){let e=t._readableState;for(S("flow",e.flowing);e.flowing&&t.read()!==null;);}E.prototype.wrap=function(t){let e=!1;t.on("data",i=>{!this.push(i)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",i=>{xt(this,i)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Dd(t);for(let i=1;i<r.length;i++){let n=r[i];this[n]===void 0&&typeof t[n]=="function"&&(this[n]=t[n].bind(t))}return this};E.prototype[kd]=function(){return ha(this)};E.prototype.iterator=function(t){return t!==void 0&&eh(t,"options"),ha(this,t)};function ha(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=mh(t,e);return r.stream=t,r}function mh(t,e){return Z(this,null,function*(){let r=qi;function i(o){this===t?(r(),r=qi):r=o}t.on("readable",i);let n,s=ia(t,{writable:!1},o=>{n=o?Jo(n,o):null,r(),r=qi});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(n)throw n;if(n===null)return;yield new q(new ra(i))}}}catch(o){throw n=Jo(n,o),n}finally{(n||(e==null?void 0:e.destroyOnReturn)!==!1)&&(n===void 0||t._readableState.autoDestroy)?St.destroyer(t,null):(t.off("readable",i),s())}})}Vi(E.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},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(t){this._readableState&&(this._readableState.flowing=t)}},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(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Vi(Lr.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Je]!==!1},set(t){this[Je]=!!t}}});E._fromList=_a;function _a(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Wi(t){let e=t._readableState;S("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,re.nextTick(wh,e,t))}function wh(t,e){if(S("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)re.nextTick(xh,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function xh(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return th(E,t,e)};var Gi;function pa(){return Gi===void 0&&(Gi={}),Gi}E.fromWeb=function(t,e){return pa().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return pa().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var r,i;return new E(Le(O({objectMode:(r=(i=t.readableObjectMode)!==null&&i!==void 0?i:t.objectMode)!==null&&r!==void 0?r:!0},e),{destroy(n,s){St.destroyer(t,n),s(n)}})).wrap(t)}});var Mr=R((bb,va)=>{"use strict";var et=Oe(),{ArrayPrototypeSlice:ma,Error:Eh,FunctionPrototypeSymbolHasInstance:wa,ObjectDefineProperty:xa,ObjectDefineProperties:Sh,ObjectSetPrototypeOf:Ea,StringPrototypeToLowerCase:Ih,Symbol:Rh,SymbolHasInstance:Th}=j();va.exports=L;L.WritableState=zt;var{EventEmitter:Ah}=Mt(),Gt=Rr().Stream,{Buffer:Fr}=oe(),Dr=Ze(),{addAbortSignal:vh}=$t(),{getHighWaterMark:Nh,getDefaultHighWaterMark:Ph}=kt(),{ERR_INVALID_ARG_TYPE:jh,ERR_METHOD_NOT_IMPLEMENTED:Lh,ERR_MULTIPLE_CALLBACK:Sa,ERR_STREAM_CANNOT_PIPE:Bh,ERR_STREAM_DESTROYED:Qt,ERR_STREAM_ALREADY_FINISHED:Fh,ERR_STREAM_NULL_VALUES:Ch,ERR_STREAM_WRITE_AFTER_END:Oh,ERR_UNKNOWN_ENCODING:Ia}=W().codes,{errorOrDestroy:It}=Dr;Ea(L.prototype,Gt.prototype);Ea(L,Gt);function Yi(){}var Rt=Rh("kOnFinished");function zt(t,e,r){typeof r!="boolean"&&(r=e instanceof pe()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?Nh(this,t,"writableHighWaterMark",r):Ph(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let i=!!(t&&t.decodeStrings===!1);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=Mh.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Or(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[Rt]=[]}function Or(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}zt.prototype.getBuffer=function(){return ma(this.buffered,this.bufferedIndex)};xa(zt.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function L(t){let e=this instanceof pe();if(!e&&!wa(L,this))return new L(t);this._writableState=new zt(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&vh(t.signal,this)),Gt.call(this,t),Dr.construct(this,()=>{let r=this._writableState;r.writing||Xi(this,r),Ji(this,r)})}xa(L,Th,{__proto__:null,value:function(t){return wa(this,t)?!0:this!==L?!1:t&&t._writableState instanceof zt}});L.prototype.pipe=function(){It(this,new Bh)};function Ra(t,e,r,i){let n=t._writableState;if(typeof r=="function")i=r,r=n.defaultEncoding;else{if(!r)r=n.defaultEncoding;else if(r!=="buffer"&&!Fr.isEncoding(r))throw new Ia(r);typeof i!="function"&&(i=Yi)}if(e===null)throw new Ch;if(!n.objectMode)if(typeof e=="string")n.decodeStrings!==!1&&(e=Fr.from(e,r),r="buffer");else if(e instanceof Fr)r="buffer";else if(Gt._isUint8Array(e))e=Gt._uint8ArrayToBuffer(e),r="buffer";else throw new jh("chunk",["string","Buffer","Uint8Array"],e);let s;return n.ending?s=new Oh:n.destroyed&&(s=new Qt("write")),s?(et.nextTick(i,s),It(t,s,!0),s):(n.pendingcb++,Dh(t,n,e,r,i))}L.prototype.write=function(t,e,r){return Ra(this,t,e,r)===!0};L.prototype.cork=function(){this._writableState.corked++};L.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Xi(this,t))};L.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=Ih(e)),!Fr.isEncoding(e))throw new Ia(e);return this._writableState.defaultEncoding=e,this};function Dh(t,e,r,i,n){let s=e.objectMode?1:r.length;e.length+=s;let o=e.length<e.highWaterMark;return o||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:i,callback:n}),e.allBuffers&&i!=="buffer"&&(e.allBuffers=!1),e.allNoop&&n!==Yi&&(e.allNoop=!1)):(e.writelen=s,e.writecb=n,e.writing=!0,e.sync=!0,t._write(r,i,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function ga(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Qt("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function ya(t,e,r,i){--e.pendingcb,i(r),Zi(e),It(t,r)}function Mh(t,e){let r=t._writableState,i=r.sync,n=r.writecb;if(typeof n!="function"){It(t,new Sa);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?et.nextTick(ya,t,r,e,n):ya(t,r,e,n)):(r.buffered.length>r.bufferedIndex&&Xi(t,r),i?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===n?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:n,stream:t,state:r},et.nextTick($h,r.afterWriteTickInfo)):Ta(t,r,1,n))}function $h({stream:t,state:e,count:r,cb:i}){return e.afterWriteTickInfo=null,Ta(t,e,r,i)}function Ta(t,e,r,i){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,i();e.destroyed&&Zi(e),Ji(t,e)}function Zi(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;let{chunk:s,callback:o}=t.buffered[n],a=t.objectMode?1:s.length;t.length-=a,o((e=t.errored)!==null&&e!==void 0?e:new Qt("write"))}let r=t[Rt].splice(0);for(let n=0;n<r.length;n++){var i;r[n]((i=t.errored)!==null&&i!==void 0?i:new Qt("end"))}Or(t)}function Xi(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:i,objectMode:n}=e,s=r.length-i;if(!s)return;let o=i;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let a=e.allNoop?Yi:f=>{for(let u=o;u<r.length;++u)r[u].callback(f)},l=e.allNoop&&o===0?r:ma(r,o);l.allBuffers=e.allBuffers,ga(t,e,!0,e.length,l,"",a),Or(e)}else{do{let{chunk:a,encoding:l,callback:f}=r[o];r[o++]=null;let u=n?1:a.length;ga(t,e,!1,u,a,l,f)}while(o<r.length&&!e.writing);o===r.length?Or(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}L.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Lh("_write()")};L.prototype._writev=null;L.prototype.end=function(t,e,r){let i=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let n;if(t!=null){let s=Ra(this,t,e);s instanceof Eh&&(n=s)}return i.corked&&(i.corked=1,this.uncork()),n||(!i.errored&&!i.ending?(i.ending=!0,Ji(this,i,!0),i.ended=!0):i.finished?n=new Fh("end"):i.destroyed&&(n=new Qt("end"))),typeof r=="function"&&(n||i.finished?et.nextTick(r,n):i[Rt].push(r)),this};function Cr(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function kh(t,e){let r=!1;function i(n){if(r){It(t,n!=null?n:Sa());return}if(r=!0,e.pendingcb--,n){let s=e[Rt].splice(0);for(let o=0;o<s.length;o++)s[o](n);It(t,n,e.sync)}else Cr(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,et.nextTick(Ki,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(n){i(n)}e.sync=!1}function qh(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,kh(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Ji(t,e,r){Cr(e)&&(qh(t,e),e.pendingcb===0&&(r?(e.pendingcb++,et.nextTick((i,n)=>{Cr(n)?Ki(i,n):n.pendingcb--},t,e)):Cr(e)&&(e.pendingcb++,Ki(t,e))))}function Ki(t,e){e.pendingcb--,e.finished=!0;let r=e[Rt].splice(0);for(let i=0;i<r.length;i++)r[i]();if(t.emit("finish"),e.autoDestroy){let i=t._readableState;(!i||i.autoDestroy&&(i.endEmitted||i.readable===!1))&&t.destroy()}}Sh(L.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},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(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.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)}}});var Uh=Dr.destroy;L.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Rt].length)&&et.nextTick(Zi,r),Uh.call(this,t,e),this};L.prototype._undestroy=Dr.undestroy;L.prototype._destroy=function(t,e){e(t)};L.prototype[Ah.captureRejectionSymbol]=function(t){this.destroy(t)};var Hi;function Aa(){return Hi===void 0&&(Hi={}),Hi}L.fromWeb=function(t,e){return Aa().newStreamWritableFromWritableStream(t,e)};L.toWeb=function(t){return Aa().newWritableStreamFromStreamWritable(t)}});var Wa=R((gb,Ua)=>{var en=Oe(),Wh=oe(),{isReadable:Gh,isWritable:Qh,isIterable:Na,isNodeStream:zh,isReadableNodeStream:Pa,isWritableNodeStream:ja,isDuplexNodeStream:Vh,isReadableStream:La,isWritableStream:Ba}=de(),Fa=Te(),{AbortError:ka,codes:{ERR_INVALID_ARG_TYPE:Hh,ERR_INVALID_RETURN_VALUE:Ca}}=W(),{destroyer:At}=Ze(),Kh=pe(),qa=Wt(),Yh=Mr(),{createDeferredPromise:Oa}=z(),Da=$i(),Ma=globalThis.Blob||Wh.Blob,Zh=typeof Ma!="undefined"?function(e){return e instanceof Ma}:function(e){return!1},Xh=globalThis.AbortController||pt().AbortController,{FunctionPrototypeCall:$a}=j(),$e=class extends Kh{constructor(e){super(e),(e==null?void 0:e.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(e==null?void 0:e.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Ua.exports=function t(e,r){if(Vh(e))return e;if(Pa(e))return Tt({readable:e});if(ja(e))return Tt({writable:e});if(zh(e))return Tt({writable:!1,readable:!1});if(La(e))return Tt({readable:qa.fromWeb(e)});if(Ba(e))return Tt({writable:Yh.fromWeb(e)});if(typeof e=="function"){let{value:n,write:s,final:o,destroy:a}=Jh(e);if(Na(n))return Da($e,n,{objectMode:!0,write:s,final:o,destroy:a});let l=n==null?void 0:n.then;if(typeof l=="function"){let f,u=$a(l,n,c=>{if(c!=null)throw new Ca("nully","body",c)},c=>{At(f,c)});return f=new $e({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await u,en.nextTick(c,null)}catch(_){en.nextTick(c,_)}})},destroy:a})}throw new Ca("Iterable, AsyncIterable or AsyncFunction",r,n)}if(Zh(e))return t(e.arrayBuffer());if(Na(e))return Da($e,e,{objectMode:!0,writable:!1});if(La(e==null?void 0:e.readable)&&Ba(e==null?void 0:e.writable))return $e.fromWeb(e);if(typeof(e==null?void 0:e.writable)=="object"||typeof(e==null?void 0:e.readable)=="object"){let n=e!=null&&e.readable?Pa(e==null?void 0:e.readable)?e==null?void 0:e.readable:t(e.readable):void 0,s=e!=null&&e.writable?ja(e==null?void 0:e.writable)?e==null?void 0:e.writable:t(e.writable):void 0;return Tt({readable:n,writable:s})}let i=e==null?void 0:e.then;if(typeof i=="function"){let n;return $a(i,e,s=>{s!=null&&n.push(s),n.push(null)},s=>{At(n,s)}),n=new $e({objectMode:!0,writable:!1,read(){}})}throw new Hh(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Jh(t){let{promise:e,resolve:r}=Oa(),i=new Xh,n=i.signal;return{value:t((function(){return Z(this,null,function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:f}=yield new q(o);if(en.nextTick(f),l)return;if(n.aborted)throw new ka(void 0,{cause:n.reason});({promise:e,resolve:r}=Oa()),yield a}})})(),{signal:n}),write(o,a,l){let f=r;r=null,f({chunk:o,done:!1,cb:l})},final(o){let a=r;r=null,a({done:!0,cb:o})},destroy(o,a){i.abort(),a(o)}}}function Tt(t){let e=t.readable&&typeof t.readable.read!="function"?qa.wrap(t.readable):t.readable,r=t.writable,i=!!Gh(e),n=!!Qh(r),s,o,a,l,f;function u(c){let _=l;l=null,_?_(c):c&&f.destroy(c)}return f=new $e({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:i,writable:n}),n&&(Fa(r,c=>{n=!1,c&&At(e,c),u(c)}),f._write=function(c,_,d){r.write(c,_)?d():s=d},f._final=function(c){r.end(),o=c},r.on("drain",function(){if(s){let c=s;s=null,c()}}),r.on("finish",function(){if(o){let c=o;o=null,c()}})),i&&(Fa(e,c=>{i=!1,c&&At(e,c),u(c)}),e.on("readable",function(){if(a){let c=a;a=null,c()}}),e.on("end",function(){f.push(null)}),f._read=function(){for(;;){let c=e.read();if(c===null){a=f._read;return}if(!f.push(c))return}}),f._destroy=function(c,_){!c&&l!==null&&(c=new ka),a=null,s=null,o=null,l===null?_(c):(l=_,At(r,c),At(e,c))},f}});var pe=R((mb,za)=>{"use strict";var{ObjectDefineProperties:e_,ObjectGetOwnPropertyDescriptor:Ae,ObjectKeys:t_,ObjectSetPrototypeOf:Ga}=j();za.exports=ie;var nn=Wt(),ee=Mr();Ga(ie.prototype,nn.prototype);Ga(ie,nn);{let t=t_(ee.prototype);for(let e=0;e<t.length;e++){let r=t[e];ie.prototype[r]||(ie.prototype[r]=ee.prototype[r])}}function ie(t){if(!(this instanceof ie))return new ie(t);nn.call(this,t),ee.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}e_(ie.prototype,{writable:O({__proto__:null},Ae(ee.prototype,"writable")),writableHighWaterMark:O({__proto__:null},Ae(ee.prototype,"writableHighWaterMark")),writableObjectMode:O({__proto__:null},Ae(ee.prototype,"writableObjectMode")),writableBuffer:O({__proto__:null},Ae(ee.prototype,"writableBuffer")),writableLength:O({__proto__:null},Ae(ee.prototype,"writableLength")),writableFinished:O({__proto__:null},Ae(ee.prototype,"writableFinished")),writableCorked:O({__proto__:null},Ae(ee.prototype,"writableCorked")),writableEnded:O({__proto__:null},Ae(ee.prototype,"writableEnded")),writableNeedDrain:O({__proto__:null},Ae(ee.prototype,"writableNeedDrain")),destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var tn;function Qa(){return tn===void 0&&(tn={}),tn}ie.fromWeb=function(t,e){return Qa().newStreamDuplexFromReadableWritablePair(t,e)};ie.toWeb=function(t){return Qa().newReadableWritablePairFromDuplex(t)};var rn;ie.from=function(t){return rn||(rn=Wa()),rn(t,"body")}});var an=R((xb,Ha)=>{"use strict";var{ObjectSetPrototypeOf:Va,Symbol:r_}=j();Ha.exports=ve;var{ERR_METHOD_NOT_IMPLEMENTED:i_}=W().codes,on=pe(),{getHighWaterMark:n_}=kt();Va(ve.prototype,on.prototype);Va(ve,on);var Vt=r_("kCallback");function ve(t){if(!(this instanceof ve))return new ve(t);let e=t?n_(this,t,"readableHighWaterMark",!0):null;e===0&&(t=Le(O({},t),{highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0})),on.call(this,t),this._readableState.sync=!1,this[Vt]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",s_)}function sn(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 s_(){this._final!==sn&&sn.call(this)}ve.prototype._final=sn;ve.prototype._transform=function(t,e,r){throw new i_("_transform()")};ve.prototype._write=function(t,e,r){let i=this._readableState,n=this._writableState,s=i.length;this._transform(t,e,(o,a)=>{if(o){r(o);return}a!=null&&this.push(a),n.ended||s===i.length||i.length<i.highWaterMark?r():this[Vt]=r})};ve.prototype._read=function(){if(this[Vt]){let t=this[Vt];this[Vt]=null,t()}}});var un=R((Sb,Ya)=>{"use strict";var{ObjectSetPrototypeOf:Ka}=j();Ya.exports=vt;var ln=an();Ka(vt.prototype,ln.prototype);Ka(vt,ln);function vt(t){if(!(this instanceof vt))return new vt(t);ln.call(this,t)}vt.prototype._transform=function(t,e,r){r(null,t)}});var Ur=R((Ib,tl)=>{var Ht=Oe(),{ArrayIsArray:o_,Promise:a_,SymbolAsyncIterator:l_,SymbolDispose:u_}=j(),qr=Te(),{once:f_}=z(),c_=Ze(),Za=pe(),{aggregateTwoErrors:d_,codes:{ERR_INVALID_ARG_TYPE:yn,ERR_INVALID_RETURN_VALUE:fn,ERR_MISSING_ARGS:h_,ERR_STREAM_DESTROYED:__,ERR_STREAM_PREMATURE_CLOSE:p_},AbortError:b_}=W(),{validateFunction:g_,validateAbortSignal:y_}=yt(),{isIterable:tt,isReadable:cn,isReadableNodeStream:kr,isNodeStream:Xa,isTransformStream:Nt,isWebStream:m_,isReadableStream:dn,isReadableFinished:w_}=de(),x_=globalThis.AbortController||pt().AbortController,hn,_n,pn;function Ja(t,e,r){let i=!1;t.on("close",()=>{i=!0});let n=qr(t,{readable:e,writable:r},s=>{i=!s});return{destroy:s=>{i||(i=!0,c_.destroyer(t,s||new __("pipe")))},cleanup:n}}function E_(t){return g_(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function bn(t){if(tt(t))return t;if(kr(t))return S_(t);throw new yn("val",["Readable","Iterable","AsyncIterable"],t)}function S_(t){return Z(this,null,function*(){_n||(_n=Wt()),yield*te(_n.prototype[l_].call(t))})}async function $r(t,e,r,{end:i}){let n,s=null,o=d=>{if(d&&(n=d),s){let p=s;s=null,p()}},a=()=>new a_((d,p)=>{n?p(n):s=()=>{n?p(n):d()}});e.on("drain",o);let l=qr(e,{readable:!1},o);try{e.writableNeedDrain&&await a();try{for(var f=H(t),u,c,_;u=!(c=await f.next()).done;u=!1){let d=c.value;e.write(d)||await a()}}catch(c){_=[c]}finally{try{u&&(c=f.return)&&await c.call(f)}finally{if(_)throw _[0]}}i&&(e.end(),await a()),r()}catch(d){r(n!==d?d_(n,d):d)}finally{l(),e.off("drain",o)}}async function gn(t,e,r,{end:i}){Nt(e)&&(e=e.writable);let n=e.getWriter();try{try{for(var s=H(t),o,a,l;o=!(a=await s.next()).done;o=!1){let f=a.value;await n.ready,n.write(f).catch(()=>{})}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&await a.call(s)}finally{if(l)throw l[0]}}await n.ready,i&&await n.close(),r()}catch(f){try{await n.abort(f),r(f)}catch(u){r(u)}}}function I_(...t){return el(t,f_(E_(t)))}function el(t,e,r){if(t.length===1&&o_(t[0])&&(t=t[0]),t.length<2)throw new h_("streams");let i=new x_,n=i.signal,s=r==null?void 0:r.signal,o=[];y_(s,"options.signal");function a(){p(new b_)}pn=pn||z().addAbortListener;let l;s&&(l=pn(s,a));let f,u,c=[],_=0;function d(x){p(x,--_===0)}function p(x,g){var m;if(x&&(!f||f.code==="ERR_STREAM_PREMATURE_CLOSE")&&(f=x),!(!f&&!g)){for(;c.length;)c.shift()(f);(m=l)===null||m===void 0||m[u_](),i.abort(),g&&(f||o.forEach(I=>I()),Ht.nextTick(e,f,u))}}let b;for(let x=0;x<t.length;x++){let g=t[x],m=x<t.length-1,I=x>0,A=m||(r==null?void 0:r.end)!==!1,ye=x===t.length-1;if(Xa(g)){let V=function(me){me&&me.name!=="AbortError"&&me.code!=="ERR_STREAM_PREMATURE_CLOSE"&&d(me)};var T=V;if(A){let{destroy:me,cleanup:Kr}=Ja(g,m,I);c.push(me),cn(g)&&ye&&o.push(Kr)}g.on("error",V),cn(g)&&ye&&o.push(()=>{g.removeListener("error",V)})}if(x===0)if(typeof g=="function"){if(b=g({signal:n}),!tt(b))throw new fn("Iterable, AsyncIterable or Stream","source",b)}else tt(g)||kr(g)||Nt(g)?b=g:b=Za.from(g);else if(typeof g=="function"){if(Nt(b)){var y;b=bn((y=b)===null||y===void 0?void 0:y.readable)}else b=bn(b);if(b=g(b,{signal:n}),m){if(!tt(b,!0))throw new fn("AsyncIterable",`transform[${x-1}]`,b)}else{var w;hn||(hn=un());let V=new hn({objectMode:!0}),me=(w=b)===null||w===void 0?void 0:w.then;if(typeof me=="function")_++,me.call(b,je=>{u=je,je!=null&&V.write(je),A&&V.end(),Ht.nextTick(d)},je=>{V.destroy(je),Ht.nextTick(d,je)});else if(tt(b,!0))_++,$r(b,V,d,{end:A});else if(dn(b)||Nt(b)){let je=b.readable||b;_++,$r(je,V,d,{end:A})}else throw new fn("AsyncIterable or Promise","destination",b);b=V;let{destroy:Kr,cleanup:Ol}=Ja(b,!1,!0);c.push(Kr),ye&&o.push(Ol)}}else if(Xa(g)){if(kr(b)){_+=2;let V=R_(b,g,d,{end:A});cn(g)&&ye&&o.push(V)}else if(Nt(b)||dn(b)){let V=b.readable||b;_++,$r(V,g,d,{end:A})}else if(tt(b))_++,$r(b,g,d,{end:A});else throw new yn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],b);b=g}else if(m_(g)){if(kr(b))_++,gn(bn(b),g,d,{end:A});else if(dn(b)||tt(b))_++,gn(b,g,d,{end:A});else if(Nt(b))_++,gn(b.readable,g,d,{end:A});else throw new yn("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],b);b=g}else b=Za.from(g)}return(n!=null&&n.aborted||s!=null&&s.aborted)&&Ht.nextTick(a),b}function R_(t,e,r,{end:i}){let n=!1;if(e.on("close",()=>{n||r(new p_)}),t.pipe(e,{end:!1}),i){let o=function(){n=!0,e.end()};var s=o;w_(t)?Ht.nextTick(o):t.once("end",o)}else r();return qr(t,{readable:!0,writable:!1},o=>{let a=t._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(o)}),qr(e,{readable:!1,writable:!0},r)}tl.exports={pipelineImpl:el,pipeline:I_}});var wn=R((Tb,al)=>{"use strict";var{pipeline:T_}=Ur(),Wr=pe(),{destroyer:A_}=Ze(),{isNodeStream:Gr,isReadable:rl,isWritable:il,isWebStream:mn,isTransformStream:rt,isWritableStream:nl,isReadableStream:sl}=de(),{AbortError:v_,codes:{ERR_INVALID_ARG_VALUE:ol,ERR_MISSING_ARGS:N_}}=W(),P_=Te();al.exports=function(...e){if(e.length===0)throw new N_("streams");if(e.length===1)return Wr.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Wr.from(e[0])),typeof e[e.length-1]=="function"){let d=e.length-1;e[d]=Wr.from(e[d])}for(let d=0;d<e.length;++d)if(!(!Gr(e[d])&&!mn(e[d]))){if(d<e.length-1&&!(rl(e[d])||sl(e[d])||rt(e[d])))throw new ol(`streams[${d}]`,r[d],"must be readable");if(d>0&&!(il(e[d])||nl(e[d])||rt(e[d])))throw new ol(`streams[${d}]`,r[d],"must be writable")}let i,n,s,o,a;function l(d){let p=o;o=null,p?p(d):d?a.destroy(d):!_&&!c&&a.destroy()}let f=e[0],u=T_(e,l),c=!!(il(f)||nl(f)||rt(f)),_=!!(rl(u)||sl(u)||rt(u));if(a=new Wr({writableObjectMode:!!(f!=null&&f.writableObjectMode),readableObjectMode:!!(u!=null&&u.readableObjectMode),writable:c,readable:_}),c){if(Gr(f))a._write=function(p,b,y){f.write(p,b)?y():i=y},a._final=function(p){f.end(),n=p},f.on("drain",function(){if(i){let p=i;i=null,p()}});else if(mn(f)){let b=(rt(f)?f.writable:f).getWriter();a._write=async function(y,w,T){try{await b.ready,b.write(y).catch(()=>{}),T()}catch(x){T(x)}},a._final=async function(y){try{await b.ready,b.close().catch(()=>{}),n=y}catch(w){y(w)}}}let d=rt(u)?u.readable:u;P_(d,()=>{if(n){let p=n;n=null,p()}})}if(_){if(Gr(u))u.on("readable",function(){if(s){let d=s;s=null,d()}}),u.on("end",function(){a.push(null)}),a._read=function(){for(;;){let d=u.read();if(d===null){s=a._read;return}if(!a.push(d))return}};else if(mn(u)){let p=(rt(u)?u.readable:u).getReader();a._read=async function(){for(;;)try{let{value:b,done:y}=await p.read();if(!a.push(b))return;if(y){a.push(null);return}}catch(b){return}}}}return a._destroy=function(d,p){!d&&o!==null&&(d=new v_),s=null,i=null,n=null,o===null?p(d):(o=p,Gr(u)&&A_(u,d))},a}});var gl=R((Ab,Sn)=>{"use strict";var j_=globalThis.AbortController||pt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:L_,ERR_INVALID_ARG_TYPE:Kt,ERR_MISSING_ARGS:B_,ERR_OUT_OF_RANGE:F_},AbortError:be}=W(),{validateAbortSignal:it,validateInteger:ll,validateObject:nt}=yt(),C_=j().Symbol("kWeak"),O_=j().Symbol("kResistStopPropagation"),{finished:D_}=Te(),M_=wn(),{addAbortSignalNoValidate:$_}=$t(),{isWritable:k_,isNodeStream:q_}=de(),{deprecate:U_}=z(),{ArrayPrototypePush:W_,Boolean:G_,MathFloor:ul,Number:Q_,NumberIsNaN:z_,Promise:fl,PromiseReject:cl,PromiseResolve:V_,PromisePrototypeThen:dl,Symbol:_l}=j(),Qr=_l("kEmpty"),hl=_l("kEof");function H_(t,e){if(e!=null&&nt(e,"options"),(e==null?void 0:e.signal)!=null&&it(e.signal,"options.signal"),q_(t)&&!k_(t))throw new L_("stream",t,"must be writable");let r=M_(this,t);return e!=null&&e.signal&&$_(e.signal,r),r}function zr(t,e){if(typeof t!="function")throw new Kt("fn",["Function","AsyncFunction"],t);e!=null&&nt(e,"options"),(e==null?void 0:e.signal)!=null&&it(e.signal,"options.signal");let r=1;(e==null?void 0:e.concurrency)!=null&&(r=ul(e.concurrency));let i=r-1;return(e==null?void 0:e.highWaterMark)!=null&&(i=ul(e.highWaterMark)),ll(r,"options.concurrency",1),ll(i,"options.highWaterMark",0),i+=r,function(){return Z(this,null,function*(){let s=z().AbortSignalAny([e==null?void 0:e.signal].filter(G_)),o=this,a=[],l={signal:s},f,u,c=!1,_=0;function d(){c=!0,p()}function p(){_-=1,b()}function b(){u&&!c&&_<r&&a.length<i&&(u(),u=null)}async function y(){try{try{for(var w=H(o),T,x,g;T=!(x=await w.next()).done;T=!1){let m=x.value;if(c)return;if(s.aborted)throw new be;try{if(m=t(m,l),m===Qr)continue;m=V_(m)}catch(I){m=cl(I)}_+=1,dl(m,p,d),a.push(m),f&&(f(),f=null),!c&&(a.length>=i||_>=r)&&await new fl(I=>{u=I})}}catch(x){g=[x]}finally{try{T&&(x=w.return)&&await x.call(w)}finally{if(g)throw g[0]}}a.push(hl)}catch(m){let I=cl(m);dl(I,p,d),a.push(I)}finally{c=!0,f&&(f(),f=null)}}y();try{for(;;){for(;a.length>0;){let w=yield new q(a[0]);if(w===hl)return;if(s.aborted)throw new be;w!==Qr&&(yield w),a.shift(),b()}yield new q(new fl(w=>{f=w}))}}finally{c=!0,u&&(u(),u=null)}})}.call(this)}function K_(t=void 0){return t!=null&&nt(t,"options"),(t==null?void 0:t.signal)!=null&&it(t.signal,"options.signal"),function(){return Z(this,null,function*(){let r=0;try{for(var n=H(this),s,o,a;s=!(o=yield new q(n.next())).done;s=!1){let l=o.value;var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new be({cause:t.signal.reason});yield[r++,l]}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new q(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}async function pl(t,e=void 0){try{for(var r=H(En.call(this,t,e)),i,n,s;i=!(n=await r.next()).done;i=!1){let o=n.value;return!0}}catch(n){s=[n]}finally{try{i&&(n=r.return)&&await n.call(r)}finally{if(s)throw s[0]}}return!1}async function Y_(t,e=void 0){if(typeof t!="function")throw new Kt("fn",["Function","AsyncFunction"],t);return!await pl.call(this,async(...r)=>!await t(...r),e)}async function Z_(t,e){try{for(var r=H(En.call(this,t,e)),i,n,s;i=!(n=await r.next()).done;i=!1){let o=n.value;return o}}catch(n){s=[n]}finally{try{i&&(n=r.return)&&await n.call(r)}finally{if(s)throw s[0]}}}async function X_(t,e){if(typeof t!="function")throw new Kt("fn",["Function","AsyncFunction"],t);async function r(a,l){return await t(a,l),Qr}try{for(var i=H(zr.call(this,r,e)),n,s,o;n=!(s=await i.next()).done;n=!1){let a=s.value;;}}catch(s){o=[s]}finally{try{n&&(s=i.return)&&await s.call(i)}finally{if(o)throw o[0]}}}function En(t,e){if(typeof t!="function")throw new Kt("fn",["Function","AsyncFunction"],t);async function r(i,n){return await t(i,n)?i:Qr}return zr.call(this,r,e)}var xn=class extends B_{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function J_(t,e,r){var i;if(typeof t!="function")throw new Kt("reducer",["Function","AsyncFunction"],t);r!=null&&nt(r,"options"),(r==null?void 0:r.signal)!=null&&it(r.signal,"options.signal");let n=arguments.length>1;if(r!=null&&(i=r.signal)!==null&&i!==void 0&&i.aborted){let d=new be(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await D_(this.destroy(d)),d}let s=new j_,o=s.signal;if(r!=null&&r.signal){let d={once:!0,[C_]:this,[O_]:!0};r.signal.addEventListener("abort",()=>s.abort(),d)}let a=!1;try{try{for(var f=H(this),u,c,_;u=!(c=await f.next()).done;u=!1){let d=c.value;var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new be;n?e=await t(e,d,{signal:o}):(e=d,n=!0)}}catch(c){_=[c]}finally{try{u&&(c=f.return)&&await c.call(f)}finally{if(_)throw _[0]}}if(!a&&!n)throw new xn}finally{s.abort()}return e}async function ep(t){t!=null&&nt(t,"options"),(t==null?void 0:t.signal)!=null&&it(t.signal,"options.signal");let e=[];try{for(var i=H(this),n,s,o;n=!(s=await i.next()).done;n=!1){let a=s.value;var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new be(void 0,{cause:t.signal.reason});W_(e,a)}}catch(s){o=[s]}finally{try{n&&(s=i.return)&&await s.call(i)}finally{if(o)throw o[0]}}return e}function tp(t,e){let r=zr.call(this,t,e);return function(){return Z(this,null,function*(){try{for(var n=H(r),s,o,a;s=!(o=yield new q(n.next())).done;s=!1){let l=o.value;yield*te(l)}}catch(o){a=[o]}finally{try{s&&(o=n.return)&&(yield new q(o.call(n)))}finally{if(a)throw a[0]}}})}.call(this)}function bl(t){if(t=Q_(t),z_(t))return 0;if(t<0)throw new F_("number",">= 0",t);return t}function rp(t,e=void 0){return e!=null&&nt(e,"options"),(e==null?void 0:e.signal)!=null&&it(e.signal,"options.signal"),t=bl(t),function(){return Z(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new be;try{for(var s=H(this),o,a,l;o=!(a=yield new q(s.next())).done;o=!1){let f=a.value;var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new be;t--<=0&&(yield f)}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new q(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}function ip(t,e=void 0){return e!=null&&nt(e,"options"),(e==null?void 0:e.signal)!=null&&it(e.signal,"options.signal"),t=bl(t),function(){return Z(this,null,function*(){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new be;try{for(var s=H(this),o,a,l;o=!(a=yield new q(s.next())).done;o=!1){let f=a.value;var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new be;if(t-- >0&&(yield f),t<=0)return}}catch(a){l=[a]}finally{try{o&&(a=s.return)&&(yield new q(a.call(s)))}finally{if(l)throw l[0]}}})}.call(this)}Sn.exports.streamReturningOperators={asIndexedPairs:U_(K_,"readable.asIndexedPairs will be removed in a future version."),drop:rp,filter:En,flatMap:tp,map:zr,take:ip,compose:H_};Sn.exports.promiseReturningOperators={every:Y_,forEach:X_,reduce:J_,toArray:ep,some:pl,find:Z_}});var In=R((Nb,yl)=>{"use strict";var{ArrayPrototypePop:np,Promise:sp}=j(),{isIterable:op,isNodeStream:ap,isWebStream:lp}=de(),{pipelineImpl:up}=Ur(),{finished:fp}=Te();Rn();function cp(...t){return new sp((e,r)=>{let i,n,s=t[t.length-1];if(s&&typeof s=="object"&&!ap(s)&&!op(s)&&!lp(s)){let o=np(t);i=o.signal,n=o.end}up(t,(o,a)=>{o?r(o):e(a)},{signal:i,end:n})})}yl.exports={finished:fp,pipeline:cp}});var Rn=R((Pb,Al)=>{"use strict";var{Buffer:dp}=oe(),{ObjectDefineProperty:Ne,ObjectKeys:xl,ReflectApply:El}=j(),{promisify:{custom:Sl}}=z(),{streamReturningOperators:ml,promiseReturningOperators:wl}=gl(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Il}}=W(),hp=wn(),{setDefaultHighWaterMark:_p,getDefaultHighWaterMark:pp}=kt(),{pipeline:Rl}=Ur(),{destroyer:bp}=Ze(),Tl=Te(),Tn=In(),Yt=de(),P=Al.exports=Rr().Stream;P.isDestroyed=Yt.isDestroyed;P.isDisturbed=Yt.isDisturbed;P.isErrored=Yt.isErrored;P.isReadable=Yt.isReadable;P.isWritable=Yt.isWritable;P.Readable=Wt();for(let t of xl(ml)){let r=function(...i){if(new.target)throw Il();return P.Readable.from(El(e,this,i))},e=ml[t];Ne(r,"name",{__proto__:null,value:e.name}),Ne(r,"length",{__proto__:null,value:e.length}),Ne(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of xl(wl)){let r=function(...i){if(new.target)throw Il();return El(e,this,i)},e=wl[t];Ne(r,"name",{__proto__:null,value:e.name}),Ne(r,"length",{__proto__:null,value:e.length}),Ne(P.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}P.Writable=Mr();P.Duplex=pe();P.Transform=an();P.PassThrough=un();P.pipeline=Rl;var{addAbortSignal:gp}=$t();P.addAbortSignal=gp;P.finished=Tl;P.destroy=bp;P.compose=hp;P.setDefaultHighWaterMark=_p;P.getDefaultHighWaterMark=pp;Ne(P,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Tn}});Ne(Rl,Sl,{__proto__:null,enumerable:!0,get(){return Tn.pipeline}});Ne(Tl,Sl,{__proto__:null,enumerable:!0,get(){return Tn.finished}});P.Stream=P;P._isUint8Array=function(e){return e instanceof Uint8Array};P._uint8ArrayToBuffer=function(e){return dp.from(e.buffer,e.byteOffset,e.byteLength)}});var Vr=R((jb,C)=>{"use strict";var $=Rn(),yp=In(),mp=$.Readable.destroy;C.exports=$.Readable;C.exports._uint8ArrayToBuffer=$._uint8ArrayToBuffer;C.exports._isUint8Array=$._isUint8Array;C.exports.isDisturbed=$.isDisturbed;C.exports.isErrored=$.isErrored;C.exports.isReadable=$.isReadable;C.exports.Readable=$.Readable;C.exports.Writable=$.Writable;C.exports.Duplex=$.Duplex;C.exports.Transform=$.Transform;C.exports.PassThrough=$.PassThrough;C.exports.addAbortSignal=$.addAbortSignal;C.exports.finished=$.finished;C.exports.destroy=$.destroy;C.exports.destroy=mp;C.exports.pipeline=$.pipeline;C.exports.compose=$.compose;Object.defineProperty($,"promises",{configurable:!0,enumerable:!0,get(){return yp}});C.exports.Stream=$.Stream;C.exports.default=C.exports});var rs=ir(oe());var We="http://www.w3.org/1999/02/22-rdf-syntax-ns#",ft="http://www.w3.org/2001/XMLSchema#",ar="http://www.w3.org/2000/10/swap/",N={xsd:{decimal:`${ft}decimal`,boolean:`${ft}boolean`,dateTime:`${ft}dateTime`,double:`${ft}double`,integer:`${ft}integer`,string:`${ft}string`},rdf:{type:`${We}type`,nil:`${We}nil`,first:`${We}first`,rest:`${We}rest`,langString:`${We}langString`,dirLangString:`${We}dirLangString`,reifies:`${We}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${ar}reify#forSome`,forAll:`${ar}reify#forAll`},log:{implies:`${ar}log#implies`,isImpliedBy:`${ar}log#isImpliedBy`}};var{xsd:lr}=N,ur=32,fr=9,es=10,cr=13,Ru=35,ts={"\\":"\\","'":"'",'"':'"',n:`
3
+ `,r:"\r",t:" ",f:"\f",b:"\b"},Tu={_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","'":"'","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Au=/[\x00-\x20<>\\"\{\}\|\^\`]/,vu=/[\s<>"{}|^`]/;function Nu(t){return t<=1114111&&(t<55296||t>57343)}var Pu={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_commentLine:!0,_whitespace:!0},ju=/$0^/,Ge=class{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-9: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-9: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-9: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-9: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)\d*(?:(\.)\d+)?)(?=\.?[,;:!\^\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._atKeyword=/^@[a-z]+(?=[\s#<:])/i,this._keyword=/^(?:PREFIX|BASE|VERSION|GRAPH)(?=[\s#<])/i,this._n3Verb=/^(?:has|is|of)(?=[\s#()\[\]\{\}"'<>?_+\-0-9])/,this._n3Id=/^id(?=[\s#<])/,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._commentLine=/^[ \t]*#([^\n\r]*)(?:\r\n|\n|\r)([ \t]*)/,this._whitespace=/^[ \t]+/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in Pu)&&this[r]instanceof RegExp&&(this[r]=ju)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let i=this._input,n=this._linePosition+i.length;for(;;){for(;;){let g=i.charCodeAt(0),m=0;if(g===ur||g===fr){let I=i.charCodeAt(1);m=I===ur||I===fr?this._whitespace.exec(i)[0].length:1,g=i.charCodeAt(m)}if(g===Ru){let I=this._commentLine.exec(i);if(I){let A=I[0].length;if(!r&&A===i.length&&i.charCodeAt(A-1)===cr)return this._linePosition=n-i.length,this._input=i;this.comments&&s(I[1],this._line,m),i=i.slice(A),n=i.length+I[2].length,this._line++}else{if(i=i.slice(m),!r)return this._linePosition=n-i.length,this._input=i;this.comments&&s(i.slice(1),this._line,0),i="";break}}else if(g===es||g===cr){if(!r&&g===cr&&m+1===i.length)return this._linePosition=n-i.length,this._input=i;m+=g===cr&&i.charCodeAt(m+1)===es?2:1;let I=0,A=i.charCodeAt(m);if(A===ur||A===fr){let ye=i.charCodeAt(m+1);I=ye===ur||ye===fr?this._whitespace.exec(i.slice(m))[0].length:1}i=i.slice(m+I),n=i.length+I,this._line++}else{m!==0&&(i=i.slice(m));break}}if(i.length===0)return r&&(i=null,o("eof","","",this._line,0)),this._linePosition=n,this._input=i;let l=this._line,f=i[0],u="",c="",_="",d=null,p=0,b=0,y=0,w=!1;switch(f){case"^":if(i.length<3)break;if(i[1]==="^"){if(this._previousMarker="^^",i=i.slice(2),i[0]!=="<"){w=!0;break}}else{this._n3Mode&&(p=1,u="^");break}case"<":if(d=this._unescapedIri.exec(i))u="IRI",c=d[1],b=d[1].length+2;else if(d=this._iri.exec(i)){if(c=this._unescape(d[1],ts),c===null||Au.test(c))return a(this);u="IRI",b=d[1].length+2}else i.length>2&&i[1]==="<"&&i[2]==="("?(u="<<(",p=3):!this._lineMode&&i.length>(r?1:2)&&i[1]==="<"?(u="<<",p=2):this._n3Mode&&i.length>1&&i[1]==="="?(p=2,this._isImpliedBy?(u="abbreviation",c="<"):(u="inverse",c=">")):this._n3Mode&&i.length>1&&i[1]==="-"&&(u="inversePredicate",p=2);break;case">":i.length>1&&i[1]===">"&&(u=">>",p=2);break;case"_":((d=this._blank.exec(i))||r&&(d=this._blank.exec(`${i} `)))&&(u="blank",_="_",c=d[1],b=d[1].length+2);break;case'"':if(d=this._simpleQuotedString.exec(i))c=d[1];else if({value:c,matchLength:p,finalLineLength:y}=this._parseLiteral(i),c===null)return a(this);(d!==null||p!==0)&&(u="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(d=this._simpleApostropheString.exec(i))c=d[1];else if({value:c,matchLength:p,finalLineLength:y}=this._parseLiteral(i),c===null)return a(this);(d!==null||p!==0)&&(u="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(d=this._variable.exec(i))&&(u="var",c=d[0]);break;case"@":this._previousMarker==="literal"&&(d=this._langcode.exec(i))&&d[1]!=="version"?!r&&i[d[0].length]==="-"&&i[d[0].length+1]!=="-"?d=null:(u="langcode",c=d[1]):(d=this._atKeyword.exec(i))&&(u=d[0]);break;case".":if(i.length===1?r:i[1]<"0"||i[1]>"9"){u=".",p=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":if(i[1]==="-"){this._previousMarker==="langcode"&&(i.startsWith("--ltr")?(u="dircode",c="ltr",p=5):i.startsWith("--rtl")&&(u="dircode",c="rtl",p=5));break}(d=this._number.exec(i)||r&&(d=this._number.exec(`${i} `)))&&(u="literal",c=d[0],_=typeof d[1]=="string"?lr.double:typeof d[2]=="string"?lr.decimal:lr.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(d=this._keyword.exec(i))?u=d[0].toUpperCase():w=!0;break;case"f":case"t":this._boolean.test(i)?(u="literal",c=f==="t"?"true":"false",_=lr.boolean,p=c.length):w=!0;break;case"a":this._shortPredicates.test(i)?(u="abbreviation",c="a",p=1):w=!0;break;case"h":case"o":this._n3Mode&&(d=this._matchN3Verb(i,r))?u=d[0]:w=!0;break;case"i":this._n3Mode&&this._n3Id.test(i)?(u="id",p=2):this._n3Mode&&(d=this._matchN3Verb(i,r))?u=d[0]:w=!0;break;case"=":this._n3Mode&&i.length>1&&(u="abbreviation",i[1]!==">"?(p=1,c="="):(p=2,c=">"));break;case"!":if(!this._n3Mode)break;case")":if(!r&&(i.length===1||i.length===2&&i[1]===">"))break;if(i.length>2&&i[1]===">"&&i[2]===">"){u=")>>",p=3;break}case",":case";":case"[":case"]":case"(":case"}":case"~":this._lineMode||(p=1,u=f);break;case"{":!this._lineMode&&i.length>=2&&(i[1]==="|"?(u="{|",p=2):(u=f,p=1));break;case"|":i.length>=2&&i[1]==="}"&&(u="|}",p=2);break;default:w=!0}if(w&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(d=this._prefix.exec(i))?(u="prefix",c=d[1]||""):((d=this._prefixed.exec(i))||r&&(d=this._prefixed.exec(`${i} `)))&&(u="prefixed",_=d[1]||"",c=this._unescape(d[2],Tu),b=_.length+d[2].length+1)),this._previousMarker==="^^")switch(u){case"prefixed":u="type";break;case"IRI":u="typeIRI";break;default:u=""}if(!u)return r||!/^'''|^"""/.test(i)&&/\n|\r/.test(i)?a(this):(this._linePosition=n-i.length,this._input=i);let T=p||d[0].length,x;y?(x={type:u,value:c,prefix:_,line:l,start:n-i.length,end:y,endLine:this._line},e(null,x)):x=o(u,c,_,l,b||T),this.previousToken=x,this._previousMarker=u,i=i.slice(T),y&&(n=i.length+y)}function s(l,f,u){let c=n-i.length+u;e(null,{type:"comment",value:l,prefix:"",line:f,start:c,end:c+l.length+1})}function o(l,f,u,c,_){let d=i?n-i.length:n,p=d+_,b={type:l,value:f,prefix:u,line:c,start:d,end:p};return e(null,b),b}function a(l){e(l._syntaxError(/^\S*/.exec(i)[0]))}}_matchN3Verb(e,r){let i=this._n3Verb.exec(e);if(!i)return null;let n=e[i[0].length];return n!=="-"&&n!=="_"&&(n<"0"||n>"9")?i:this._prefixed.exec(e)?null:vu.test(e)?i:this._prefixed.exec(`${e} `)||!r&&this._prefix.exec(`${e}: `)?null:i}_unescape(e,r){let i=e.indexOf("\\");if(i<0)return e;let n="",s=0;for(;i>=0&&i+1<e.length;){let o=e[i+1],a=i+2,l;if(o==="u"||o==="U"){if(a+=o==="u"?4:8,a>e.length)return null;let f=0;for(let u=i+2;u<a;u++){let c=e.charCodeAt(u);if(c>=48&&c<=57)c-=48;else if(c>=65&&c<=70)c-=55;else if(c>=97&&c<=102)c-=87;else return null;f=f*16+c}if(!Nu(f))return null;l=String.fromCodePoint(f)}else{if(!(o in r))return null;l=r[o]}n+=e.slice(s,i)+l,s=a,i=e.indexOf("\\",s)}return n+e.slice(s)}_parseLiteral(e){if(e.length>=3){let r=e[0],i=e[1]===r&&e[2]===r?3:1,n=r;i===3&&(n=r==='"'?'"""':"'''");let s=Math.max(this._literalClosingPos,i);for(;(s=e.indexOf(n,s))>0;){let o=0;for(;e[s-o-1]==="\\";)o++;if(o%2===0){let a=e.substring(i,s),l=a.split(/\r\n|\r|\n/),f=l.length-1,u=s+i;if(i===1&&f!==0||i===3&&this._lineMode)break;this._line+=f;let c=f===0?0:l[l.length-1].length+i;return{value:this._unescape(a,ts),matchLength:u,finalLineLength:c}}s++}this._literalClosingPos=e.length-i+1}return{value:"",matchLength:0,finalLineLength:0}}_syntaxError(e){this._input=null;let 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")?(this._linePosition=1,e.slice(1)):e}tokenize(e,r){let i=this._tokenization={};if(this._line=1,this._linePosition=0,this._previousMarker=void 0,this.previousToken=void 0,this._literalClosingPos=0,this._input=void 0,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>{this._tokenization===i&&this._tokenizeToEnd(r,!0)});else{let n=[],s;if(this._tokenizeToEnd((o,a)=>o?s=o:n.push(a),!0),s)throw s;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._tokenization===i&&this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=rs.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input=="undefined"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{this._tokenization===i&&typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",n=>{this._tokenization===i&&r(n)})}};var{rdf:is,xsd:xe}=N,dt,Lu=0,li="<>";var oi={namedNode:ns,blankNode:ss,variable:as,literal:os,defaultGraph:Bu,quad:ai,triple:ai,fromTerm:Bt,fromQuad:ls},Y=oi,Q=class t{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof t?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},ct=class extends Q{constructor(e){e!==""?super(e):(super(li),Object.defineProperty(this,"value",{value:""}))}get termType(){return"NamedNode"}},Ee=class t extends Q{constructor(e){super(e)}get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,r=e.lastIndexOf('"')+1,i=e.lastIndexOf("--");return r<e.length&&e[r++]==="@"?(i>r?e.substr(0,i):e).substr(r).toLowerCase():""}get direction(){let e=this.id,r=e.lastIndexOf('"'),i=e.lastIndexOf("--");return i>r&&i+2<e.length?e.substr(i+2).toLowerCase():""}get datatype(){return new ct(this.datatypeString)}get datatypeString(){let e=this.id,r=e.lastIndexOf('"')+1,i=r<e.length?e[r]:"";return i==="^"?e.substr(r+2):i!=="@"?xe.string:e.indexOf("--",r)>0?is.dirLangString:is.langString}equals(e){return e instanceof t?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&(this.direction===e.direction||this.direction===""&&!e.direction)&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,direction:this.direction,datatype:{termType:"NamedNode",value:this.datatypeString}}}},Ft=class extends Q{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},Ct=class extends Q{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},Ot=class extends Q{constructor(){return super(""),dt||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};dt=new Ot;function Fe(t,e,r){if(e=e||oi,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===oi)return new Ee(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let i=t.lastIndexOf('"',t.length-1),n;if(t[i+1]==="@"){n=t.substr(i+2);let s=n.lastIndexOf("--");s>0&&s<n.length&&(n={language:n.substr(0,s),direction:n.substr(s+2)})}else n=e.namedNode(t.substr(i+3));return e.literal(t.substr(1,i-1),n);case"[":t=JSON.parse(t);break;case"<":if(t===li)return e.namedNode("");default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Fe(t[0],e,!0),Fe(t[1],e,!0),Fe(t[2],e,!0),t[3]&&Fe(t[3],e,!0))}function D(t,e){if(typeof t=="string")return t;if(t instanceof Q&&t.termType!=="Quad")return t.id;if(!t)return dt.id;switch(t.termType){case"NamedNode":{let i=t.value;return i!==""?i:li}case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}${t.direction?`--${t.direction}`:""}`:t.datatype&&t.datatype.value!==xe.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[D(t.subject,!0),D(t.predicate,!0),D(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(D(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Ce=class extends Q{constructor(e,r,i,n){super(""),this._subject=e,this._predicate=r,this._object=i,this._graph=n||dt}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 ns(t){return new ct(t)}function ss(t){return new Ft(t||`n3-${Lu++}`)}function os(t,e){if(typeof e=="string")return new Ee(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new Ee(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=xe.boolean:typeof t=="number"?Number.isFinite(t)?r=Number.isInteger(t)&&Math.abs(t)<1e21?xe.integer:xe.double:(r=xe.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")):typeof t=="bigint"?r=xe.integer:t instanceof Date&&!Number.isNaN(t.getTime())&&(r=xe.dateTime,t=t.toISOString())),r===""||r===xe.string?new Ee(`"${t}"`):new Ee(`"${t}"^^${r}`)}function as(t){return new Ct(t)}function Bu(){return dt}function ai(t,e,r,i){return new Ce(t,e,r,i)}function Bt(t){if(t instanceof Q)return t;switch(t.termType){case"NamedNode":return ns(t.value);case"BlankNode":return ss(t.value);case"Variable":return as(t.value);case"DefaultGraph":return dt;case"Literal":return os(t.value,t.language?t.direction?{language:t.language,direction:t.direction}:t.language:t.datatype);case"Quad":return ls(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function ls(t){if(t instanceof Ce)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return ai(Bt(t.subject),Bt(t.predicate),Bt(t.object),Bt(t.graph))}var us=0,Se=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&cs(this,e.factory);let r=typeof e.format=="string"?e.format.match(/(?:^|\W)(\w*)$/)[1].toLowerCase():"",i=/turtle/.test(r),n=/trig/.test(r),s=/triple/.test(r),o=/quad/.test(r),a=this._n3Mode=/n3/.test(r),l=s||o;this._emitCurrent=this._emit,a&&(this._createQuad=this._createQuadInDirection,this._emit=this._emitInDirection,this._emitCurrent=this._emitCurrentInDirection),(this._supportsNamedGraphs=!(i||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(i||n||s||a),this._isImpliedBy=e.isImpliedBy,this._implicitEmptyPrefix=e.implicitEmptyPrefix!==!1,this._emptyFormulaAsTrue=!!e.emptyFormulaAsTrue,l&&(this._resolveRelativeIRI=f=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new Ge({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._formulaScopedBlankNodes=!!e.formulaScopedBlankNodes,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){us=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e;let i=e.indexOf("?"),n=i<0?e:e.substr(0,i);this._basePath=e.indexOf("/")<0?e:n.substr(0,n.lastIndexOf("/")+1),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,r,i,n,s){if(!this._n3Mode){this._contextStack.push({type:e,subject:i,predicate:n,object:s,graph:r});return}let o={type:e,subject:i,predicate:n,object:s,graph:r,inverse:this._inversePredicate,expectOf:this._expectOf,blankPrefix:this._prefixes._,prefixChanges:this._prefixChanges,quantifiedChanges:this._quantifiedChanges,emptyFormula:this._emptyFormula};e==="formula"&&(o.base=[this._base,this._basePath,this._baseRoot,this._baseScheme],this._prefixChanges=[]),this._contextStack.push(o),this._inversePredicate=!1,this._expectOf=!1,(!this._formulaScopedBlankNodes||e==="formula")&&(this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantifiedChanges=[]),e==="formula"&&(this._subject=null,this._emptyFormula=!0)}_restoreContext(e,r){let i=this._contextStack.pop();if(!i||i.type!==e)return this._error(`Unexpected ${r.type}`,r);this._subject=i.subject,this._predicate=i.predicate,this._object=i.object,this._graph=i.graph,this._n3Mode&&(this._inversePredicate=i.inverse,this._expectOf=i.expectOf,e==="formula"&&([this._base,this._basePath,this._baseRoot,this._baseScheme]=i.base),this._prefixChanges!==i.prefixChanges&&(fs(this._prefixes,this._prefixChanges),this._prefixChanges=i.prefixChanges),this._prefixes._=i.blankPrefix,this._quantifiedChanges!==i.quantifiedChanges&&(fs(this._quantified,this._quantifiedChanges),this._quantifiedChanges=i.quantifiedChanges),this._emptyFormula=i.emptyFormula)}_readBeforeTopContext(e){return this._version&&!this._isValidVersion(this._version)?this._error(`Detected unsupported version as media type parameter: "${this._version}"`,e):this._readInTopContext(e)}_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"VERSION":this._sparqlStyle=!0;case"@version":return this._readVersion;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)}}_readInFormulaContext(e){switch(e.type){case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;default:return this._readSubject(e)}}_getStatementReader(){let e=this._contextStack[this._contextStack.length-1];return e&&e.type==="formula"?this._readInFormulaContext:this._readInTopContext}_readEntity(e,r){let i;switch(e.type){case"IRI":case"typeIRI":let n=this._resolveIRI(e.value);if(n===null)return this._error("Invalid IRI",e);i=this._factory.namedNode(n);break;case"type":case"prefixed":let s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);i=this._factory.namedNode(s+e.value);break;case"blank":i=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":i=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!r&&this._n3Mode&&i.id in this._quantified&&(i=this._quantified[i.id]),i}_readList(e,r,i,n){let s=this._contextStack;return(s.length&&s[s.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(this._saveContext("list",this._graph,r,i,n),this._subject=null,this._readListItem)}_readSubject(e){switch(this._predicate=null,e.type!=="}"&&(this._emptyFormula=!1),e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._readList(e,this.RDF_NIL,null,null);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readInFormulaContext):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":return this._n3Mode?e.prefix.length===0?(this._literalValue=e.value,this._completeSubjectLiteral):(this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),this._getPathReader(this._readPredicateOrNamedGraph)):this._error("Unexpected literal",e);case"<<(":return this._n3Mode?(this._saveContext("<<(",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Disallowed triple term as subject",e);case"<<":return this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject;default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type,i=!1;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case"has":return this._readPredicateAfterVerb;case"is":return this._inversePredicate=!0,this._expectOf=!0,this._readPredicateAfterVerb;case"inversePredicate":return this._inversePredicate=!0,this._readPredicateAfterVerb;case"|}":return this._subject=null,this._readAnnotationBlockPunctuation(e);case".":case"]":case"}":return this._predicate===null&&!this._n3Mode?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"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completePredicateLiteral;this._predicate=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=!0;break;case"(":return this._n3Mode?this._readList(e,this._subject,this.RDF_NIL,null):this._error(`Expected entity but got ${r}`,e);case"[":return this._n3Mode?(this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead):this._error("Disallowed blank node as predicate",e);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._graph=this._factory.blankNode(),null),this._readSubject):this._readEntity(e);case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return;i=this._n3Mode}return this._validAnnotation=!0,i?this._getPathReader(this._readObject,"predicate"):this._readObject}_readPredicateAfterVerb(e){return e.type==="has"||e.type==="is"||e.type==="of"||e.type==="inversePredicate"?this._error(`Expected expression but got ${e.type}`,e):this._readPredicate(e)}_readObject(e){if(this._expectOf)return e.type!=="of"?this._error(`Expected of but got ${e.type}`,e):(this._expectOf=!1,this._readObject);switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;if(this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),this._n3Mode)return this._getPathReader(this._getContextEndReader());break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._readList(e,this._subject,this._predicate,this.RDF_NIL);case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readInFormulaContext):this._error("Unexpected graph",e);case"<<(":return this._saveContext("<<(",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;case"<<":return this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;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){if(e.type==="]")return this._subject=null,this._readBlankNodeTail(e);{let r=this._contextStack;return(r.length>1&&r[r.length-2]).type==="<<"?this._error("Unexpected compound blank node expression in reified triple",e):e.type==="id"?this._readIriPropertyListId:(this._predicate=null,this._readPredicate(e))}}_readIriPropertyListId(e){let r=this._readEntity(e);if(r===void 0)return;if(r.termType!=="NamedNode")return this._error(`Expected IRI after id but got ${e.type}`,e);let i=this._subject;this._subject=r;let n=this._contextStack[this._contextStack.length-1];return n.subject===i&&(n.subject=r),n.predicate===i&&(n.predicate=r),n.object===i&&(n.object=r),this._predicate=null,this._readIriPropertyListPredicate}_readIriPropertyListPredicate(e){return e.type===";"||e.type==="]"||e.type==="."||e.type==="}"?this._error(`Expected predicate but got ${e.type}`,e):this._readPredicate(e)}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emitCurrent(this._subject,this._predicate,this._object,this._graph);let r=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._getPathReader(this._readObject,"predicate"):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,i=null,n=this._readListItem,s=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this._subject=r=this._factory.blankNode()),n=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,i=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),o.length!==0&&o[o.length-1].type==="list"){if(this._n3Mode)return s!==null&&this._emit(s,this.RDF_REST,this.RDF_NIL,this._graph),this._saveContext("item",this._graph,this._subject,this._predicate,this._object),this._subject=this._object,this._predicate=null,this._getPathReader(this._readListItem);this._emit(this._subject,this._predicate,this._object,this._graph)}if(this._predicate===null){if(n=this._n3Mode?this._getPathReader(this._readPredicate):this._readPredicate,this._subject===this.RDF_NIL)return n}else if(this._object===null){if(n=this._getPathReader(this._readObject,"predicate"),this._predicate===this.RDF_NIL)return n}else if(n=this._getContextEndReader(),this._n3Mode&&(n=this._getPathReader(n)),this._object===this.RDF_NIL)return n;i=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,n=this._readListItemDataTypeOrLang):(r=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),n=this._getContextEndReader());break;case"{":return this._n3Mode?(i=this._factory.blankNode(),r=this._factory.blankNode(),s===null?a.predicate===null?a.subject=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),this._emit(i,this.RDF_FIRST,r,this._graph),this._saveContext("formula",this._graph,i,this.RDF_FIRST,this._graph=r),this._subject=null,this._readInFormulaContext):this._error("Unexpected graph",e);case"<<(":this._saveContext("<<(",this._graph,null,null,null),this._graph=null,n=this._readSubject;break;case"<<":this._saveContext("<<",this._graph,null,null,null),this._graph=null,n=this._readSubject;break;default:if((r=this._readEntity(e))===void 0)return}if(i===null&&(this._subject=i=this._factory.blankNode()),(e.type==="<<"||e.type==="<<(")&&(o[o.length-1].subject=this._subject),s===null?a.predicate===null?a.subject=i:a.object===null?a.predicate=i:a.object=i:this._emit(s,this.RDF_REST,i,this._graph),r!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"||e.type==="var"||e.type==="blank"||e.type==="literal"))return this._saveContext("item",this._graph,i,this.RDF_FIRST,r),this._subject=r,this._predicate=null,this._getPathReader(this._readListItem);this._emit(i,this.RDF_FIRST,r,this._graph)}return n}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e,r){let i,n=!1;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===N.rdf.langString||s.value===N.rdf.dirLangString)return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype",e);i=this._factory.literal(this._literalValue,s),e=null;break;case"langcode":if(e.value.split("-").some(o=>o.length>8))return this._error("Detected language tag with subtag longer than 8 characters",e);i=this._factory.literal(this._literalValue,e.value),this._literalLanguage=e.value,e=null,this._literalComponent=r,n=!0;break;default:i=this._factory.literal(this._literalValue)}return{token:e,literal:i,readCb:n}}_readDirCode(e){let r=this._literalComponent,i=this._literalListItem;if(e.type==="dircode"){let n=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:e.value});r==="subject"?this._subject=n:r==="predicate"?this._predicate=n:this._object=n,this._literalLanguage=void 0,e=null}if(r==="subject"||r==="predicate"){let n=r==="subject"?this._readPredicateOrNamedGraph:this._readObject;return this._getPathEndReader(e,n,r)||n.call(this,e)}return this._completeObjectLiteralPost(e,i)}_completeTermLiteral(e,r){let i=this._completeLiteral(e,r);if(!i)return;let n;if(r==="subject"?(this._subject=i.literal,n=this._readPredicateOrNamedGraph):(this._predicate=i.literal,this._validAnnotation=!0,n=this._readObject),i.readCb)return this._literalListItem=!1,this._readDirCode;let s=this._getPathEndReader(i.token,n,r);return s||n.call(this,i.token)}_completeSubjectLiteral(e){return this._completeTermLiteral(e,"subject")}_completePredicateLiteral(e){return this._completeTermLiteral(e,"predicate")}_completeObjectLiteral(e,r){let i=this._completeLiteral(e,"object");if(i)return this._object=i.literal,i.readCb?(this._literalListItem=r,this._readDirCode):this._completeObjectLiteralPost(i.token,r)}_completeObjectLiteralPost(e,r){return this._n3Mode&&(e===null||e.type==="!"||e.type==="^")?r?(this._saveContext("item",this._graph,this._subject,this.RDF_FIRST,this._object),this._subject=this._object,this._predicate=null,this._getPathEndReader(e,this._readListItem)):this._getPathEndReader(e,this._getContextEndReader()):(r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),e===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(e)))}_readFormulaTail(e){if(e.type!=="}")return this._readPunctuation(e);this._subject!==null&&this._emitCurrent(this._subject,this._predicate,this._object,this._graph);let r=this._graph,i=this._emptyFormula;return this._restoreContext("formula",e),i&&this._emptyFormulaAsTrue&&(this._subject===r?this._subject=this.N3_TRUE:this._predicate===r?this._predicate=this.N3_TRUE:this._object=this.N3_TRUE),this._object!==null?this._getPathReader(this._getContextEndReader(),"object"):this._predicate!==null?this._getPathReader(this._readObject,"predicate"):this._getPathReader(this._readPredicate,"subject")}_readPunctuation(e){let r,i=this._graph,n=this._subject,s=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,this._tripleTerm=null,r=this._getStatementReader(),s&&(this._inversePredicate=!1);break;case";":s&&(this._inversePredicate=!1),r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":return this._readAnnotationStart(e);case"|}":return this._error("Unexpected annotation syntax closing",e);default:if(this._supportsQuads&&this._graph===null&&(i=this._readEntity(e))!==void 0){r=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(n!==null){let o=this._predicate,a=this._object;this._emit(n,o,a,i,s)}return r}_readBlankNodePunctuation(e){let r,i=!1;switch(e.type){case";":i=this._inversePredicate,r=this._readPredicate;break;case",":r=this._readObject;break;case"~":case"{|":return this._readAnnotationStart(e);case"|}":return this._error("Unexpected annotation syntax closing",e);default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emitCurrent(this._subject,this._predicate,this._object,this._graph),i&&(this._inversePredicate=!1),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);let r=this._readEntity(e);return this._prefixChanges!==null&&this._prefixChanges.push(this._prefix,this._prefixes[this._prefix]),this._prefixes[this._prefix]=r.value,this._prefixCallback(this._prefix,r),this._readDeclarationPunctuation}_readBaseIRI(e){let 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)}_isValidVersion(e){return this._parseUnsupportedVersions||t.SUPPORTED_VERSIONS.includes(e)}_readVersion(e){return e.type!=="literal"?this._error("Expected literal to follow version declaration",e):e.end-e.start!==e.value.length+2?this._error("Version declarations must use single quotes",e):(this._versionCallback(e.value),this._isValidVersion(e.value)?this._readDeclarationPunctuation:this._error(`Detected unsupported version: "${e.value}"`,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._getStatementReader().call(this,e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._getStatementReader()}_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._quantifiedChanges!==null&&this._quantifiedChanges.push(r.id,this._quantified[r.id]),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,r){return this._afterPath=e,this._pathPosition=r||(this._predicate===null?"subject":"object"),this._readPath}_getPathEndReader(e,r,i){if(e!==null&&e.type!=="!"&&e.type!=="^")return null;let n=this._getPathReader(r,i);return e===null?n:n.call(this,e)}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._afterPath,i=this._contextStack,n=i.length&&i[i.length-1];if(n&&n.type==="item"){let s=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,s,this._graph)}return this._afterPath=null,this._pathPosition=null,r.call(this,e)}}_readForwardPath(e){let r,i,n=this._factory.blankNode();if((i=this._readEntity(e))!==void 0)return this._pathPosition==="subject"?(r=this._subject,this._subject=n):this._pathPosition==="predicate"?(r=this._predicate,this._predicate=n):(r=this._object,this._object=n),this._emit(r,i,n,this._graph),this._readPath}_readBackwardPath(e){let r=this._factory.blankNode(),i,n;if((i=this._readEntity(e))!==void 0)return this._pathPosition==="subject"?(n=this._subject,this._subject=r):this._pathPosition==="predicate"?(n=this._predicate,this._predicate=r):(n=this._object,this._object=r),this._emit(r,i,n,this._graph),this._readPath}_readTripleTermTail(e){if(e.type!==")>>")return this._error(`Expected )>> but got ${e.type}`,e);let r=this._createQuad(this._subject,this._predicate,this._object,this._graph,this._inversePredicate);this._restoreContext("<<(",e);let i=this._contextStack,n=i.length&&i[i.length-1];return n&&n.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicate):(this._object=r,this._getContextEndReader())}_readReifiedTripleTailOrReifier(e){return e.type==="~"?this._readReifier:this._readReifiedTripleTail(e)}_readReifiedTripleTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);this._tripleTerm=null;let r=this._readTripleTerm();this._restoreContext("<<",e);let i=this._contextStack,n=i.length&&i[i.length-1];return n&&n.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicateOrReifierTripleEnd):(this._object=r,this._getContextEndReader())}_readPredicateOrReifierTripleEnd(e){return e.type==="."?(this._subject=null,this._readPunctuation(e)):this._readPredicate(e)}_readReifier(e){return e.type===">>"?this._readReifiedTripleTail(e):(this._reifier=this._readEntity(e),this._readReifiedTripleTail)}_readAnnotationStart(e){return this._emitCurrent(this._subject,this._predicate,this._object,this._graph),this._tripleTerm=null,this._readAnnotation(e)}_readAnnotation(e){switch(e.type){case"~":return this._readReifierInAnnotation;case"{|":return this._readAnnotationBlockHead(e)}switch(this._tripleTerm=null,e.type){case";":return this._inversePredicate=!1,this._readPredicate;case",":return this._readObject;default:return this._subject=null,this._getContextEndReader().call(this,e)}}_readReifierInAnnotation(e){switch(e.type){case"IRI":case"typeIRI":case"type":case"prefixed":case"blank":case"var":return this._reifier=this._readEntity(e),this._readAnnotationBlockOrReifier}return this._reifier=this._factory.blankNode(),this._readAnnotationBlockOrReifier(e)}_readAnnotationBlockOrReifier(e){return e.type==="{|"?this._readAnnotationBlockHead(e):(this._readTripleTerm(),this._readAnnotation(e))}_readAnnotationBlockHead(e){let r=this._readTripleTerm();return this._saveContext("annotation",this._graph,this._subject,this._predicate,this._object),this._contextStack[this._contextStack.length-1].tripleTerm=this._tripleTerm,this._subject=r,this._predicate=this._object=this._tripleTerm=null,this._inversePredicate=!1,this._validAnnotation=!1,this._readPredicate}_readAnnotationBlockPunctuation(e){let r=this._contextStack;if(e.type==="|}"){if(!r.length||r[r.length-1].type!=="annotation")return this._error("Unexpected annotation syntax closing",e);if(!this._validAnnotation)return this._error("Annotation block can not be empty",e);this._subject!==null&&this._emitCurrent(this._subject,this._predicate,this._object,this._graph);let{tripleTerm:i}=r[r.length-1];return this._restoreContext("annotation",e),this._tripleTerm=i,this._readAnnotation}return this._readBlankNodePunctuation(e)}_readTripleTerm(){let e=this._contextStack,r=e.length&&e[e.length-1],i=r?r.graph:void 0,n=this._reifier||this._factory.blankNode();return this._reifier=null,this._tripleTerm=this._tripleTerm||this._createQuad(this._subject,this._predicate,this._object,null,this._inversePredicate),this._emit(n,this.RDF_REIFIES,this._tripleTerm,i||this._graph||this.DEFAULTGRAPH),n}_getContextEndReader(){let 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._readTripleTermTail;case"<<":return this._readReifiedTripleTailOrReifier;case"annotation":return this._readAnnotationBlockPunctuation}}_createQuad(e,r,i,n){return this._factory.quad(e,r,i,n||this.DEFAULTGRAPH)}_createQuadInDirection(e,r,i,n,s){return s?this._factory.quad(i,r,e,n||this.DEFAULTGRAPH):this._factory.quad(e,r,i,n||this.DEFAULTGRAPH)}_emitInDirection(e,r,i,n,s){this._callback(null,this._createQuad(e,r,i,n,s))}_emitCurrentInDirection(e,r,i,n){this._callback(null,this._createQuad(e,r,i,n,this._inversePredicate))}_emit(e,r,i,n){this._callback(null,this._factory.quad(e,r,i,n||this.DEFAULTGRAPH))}_error(e,r){let i=` on line ${r.line}.`;e.length+i.length>200&&(e=`${e.slice(0,199-i.length)}\u2026`);let n=new Error(`${e}${i}`);n.context={token:r,line:r.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=dr}_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"?":{let r=this._base.indexOf("?");return(r<0?this._base:this._base.substr(0,r))+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;let r=e.length,i="",n=-1,s=-1,o=0,a="/";for(;n<r;){switch(a){case":":if(s<0&&e[++n]==="/"&&e[++n]==="/")for(;(s=n+1)<r&&e[s]!=="/";)n=s;break;case"?":case"#":n=r;break;case"/":if(e[n+1]===".")switch(a=e[++n+1],a){case"/":i+=e.substring(o,n-1),o=n+1;break;case void 0:case"?":case"#":return i+e.substring(o,n)+e.substr(n+1);case".":if(a=e[++n+1],a===void 0||a==="/"||a==="?"||a==="#"){if(i+=e.substring(o,n-2),(o=i.lastIndexOf("/"))>=s&&(i=i.substr(0,o)),a!=="/")return`${i}/${e.substr(n+1)}`;o=n+1}}}a=e[++n]}return i+e.substring(o)}parse(e,r,i,n){let s,o,a,l,f,u;r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion||r.onToken||r.onTokenEnd)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion,f=r.onToken,u=r.onTokenEnd):(s=r,o=i,l=n),this._readCallback=this._readBeforeTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${us++}_`,this._n3Mode&&this._implicitEmptyPrefix&&this._base&&(this._prefixes[""]=this._resolveIRI("#")),this._prefixCallback=o||dr,this._versionCallback=l||dr,this._inversePredicate=!1,this._expectOf=!1,this._quantified=Object.create(null),this._prefixChanges=null,this._quantifiedChanges=null,this._emptyFormula=!1;let c=d=>this._readCallback=this._readCallback(d);if(a||this._lexer.comments){this._lexer.comments=!0;let d=c;c=p=>p.type!=="comment"?d(p):(a&&a(p.value),this._readCallback)}if(f||u){let d=c;c=p=>{try{try{return f&&f(p),d(p)}finally{u&&u(p)}}catch(b){throw this._readCallback=null,b}}}if(!s){let d=[],p;if(this._callback=(b,y)=>{b?p=b:y&&d.push(y)},this._lexer.tokenize(e).every(c),p)throw p;return d}let _=(d,p)=>{d!==null?(this._callback(d),this._callback=dr):this._readCallback&&c(p)};this._callback=s,this._lexer.tokenize(e,_)}};function fs(t,e){for(let r=e.length-2;r>=0;r-=2)e[r+1]===void 0?delete t[e[r]]:t[e[r]]=e[r+1]}function dr(){}function cs(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(N.rdf.first),t.RDF_REST=e.namedNode(N.rdf.rest),t.RDF_NIL=e.namedNode(N.rdf.nil),t.RDF_REIFIES=e.namedNode(N.rdf.reifies),t.N3_FORALL=e.namedNode(N.r.forAll),t.N3_FORSOME=e.namedNode(N.r.forSome),t.N3_TRUE=e.literal("true",e.namedNode(N.xsd.boolean)),t.ABBREVIATIONS={a:e.namedNode(N.rdf.type),"=":e.namedNode(N.owl.sameAs),">":e.namedNode(N.log.implies),"<":e.namedNode(N.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Se.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];cs(Se.prototype,Y);var ui={};Ql(ui,{inDefaultGraph:()=>$u,isBlankNode:()=>Cu,isDefaultGraph:()=>ae,isLiteral:()=>Ou,isNamedNode:()=>Fu,isQuad:()=>Mu,isVariable:()=>Du,prefix:()=>ku,prefixes:()=>ds});function Fu(t){return!!t&&t.termType==="NamedNode"}function Cu(t){return!!t&&t.termType==="BlankNode"}function Ou(t){return!!t&&t.termType==="Literal"}function Du(t){return!!t&&t.termType==="Variable"}function Mu(t){return!!t&&t.termType==="Quad"}function ae(t){return!!t&&t.termType==="DefaultGraph"}function $u(t){return ae(t.graph)}function ku(t,e){return ds({"":t.value||t},e)("")}function ds(t,e){let r=Object.create(null);for(let n in t)i(n,t[n]);e=e||Y;function i(n,s){if(typeof s=="string"){let o=Object.create(null);r[n]=a=>o[a]||(o[a]=e.namedNode(s+a))}else if(!(n in r))throw new Error(`Unknown prefix: ${n}`);return r[n]}return i}function ht(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var qu=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Uu=/^(?:(?!\.\.?(?:[/?#]|$))[^/?#]+(?:\/[^/?#]{3,})*\/?)?(?:[?#]|$)/,hs="./",Wu="../",fi="?",_s="#",Qe=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!qu.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",ht(e)],i=[],n=[],s=/[^/?#]*([/?#])/y,o,a=0,l=0,f=s.lastIndex=e.length;for(;!a&&!l&&(o=s.exec(this.base));)o[1]===_s?l=s.lastIndex-1:(r.push(ht(o[0]),"(?:"),i.push(")?"),o[1]!==fi?n.push(f=s.lastIndex):(a=f=s.lastIndex,l=this.base.indexOf(_s,a),this._pathReplacements[a]=fi));for(let u=0;u<n.length;u++)this._pathReplacements[n[u]]=Wu.repeat(n.length-u-1);return this._pathReplacements[n[n.length-1]]=hs,this._baseLength=l>0?l:this.base.length,r.push(ht(this.base.substring(f,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...r,...i].join(""))}toRelative(e){let r=this._getBaseMatcher().exec(e);if(!r)return e;let i=r[0].length;if(i===this._baseLength&&i===e.length)return"";let n=this._pathReplacements[i];if(n){let s=e.substring(i);return n!==fi&&!Uu.test(s)?e:n===hs&&/^[^?#]/.test(s)&&(s.indexOf(":")<0||!/^[^/?#]*:/.test(s))?s:n+s}return e.substring(i-1)}};var Dt=Y.defaultGraph(),{rdf:Gu,xsd:_t}=N,ps=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,bs=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Qu={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},ze=class extends Q{equals(e){return e===this}},le=class{constructor(e,r){if(this._prefixRegex=/$0^/,this._hasPrefixes=!1,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 i="";this._outputStream={write(n,s,o){i+=n,o&&o()},end:n=>{n&&n(null,i)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=Dt,this._prefixIRIs=Object.create(null),r.baseIRI&&(this._baseIri=new Qe(r.baseIRI),r.writeBase&&this._write(`@base <${r.baseIRI}>.
4
+ `)),r.prefixes&&this.addPrefixes(r.prefixes))}get _inDefaultGraph(){return Dt.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_writeQuad(e,r,i,n,s){try{n!==this._graph&&(!n.equals(this._graph)||n.termType!==this._graph.termType)&&(this._write((this._subject===null?"":this._inDefaultGraph?`.
5
5
  `:`
6
6
  }
7
- `)+(Mt.equals(n)?"":`${this._encodeIriOrBlank(n)} {
7
+ `)+(Dt.equals(n)?"":`${this._encodeIriOrBlank(n)} {
8
8
  `)),this._graph=n,this._subject=null),e===this._subject||e.equals(this._subject)?r===this._predicate||r.equals(this._predicate)?this._write(`, ${this._encodeObject(i)}`,s):this._write(`;
9
9
  ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(i)}`,s):this._write(`${(this._subject===null?"":`.
10
- `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(i)}`,s)}catch(o){s&&s(o)}}_writeQuadLine(e,r,i,n,s){delete this._prefixMatch,this._write(this.quadToString(e,r,i,n),s)}quadToString(e,r,i,n){return`${this._encodeSubject(e)} ${r.termType==="Literal"?this._encodeLiteral(r):this._encodeIriOrBlank(r)} ${this._encodeObject(i)}${n&&!fe(n)?` ${this._encodeIriOrBlank(n)} .
10
+ `)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(i)}`,s)}catch(o){s&&s(o)}}_writeQuadLine(e,r,i,n,s){delete this._prefixMatch,this._write(this.quadToString(e,r,i,n),s)}quadToString(e,r,i,n){return`${this._encodeSubject(e)} ${r.termType==="Literal"?this._encodeLiteral(r):this._encodeIriOrBlank(r)} ${this._encodeObject(i)}${n&&!ae(n)?` ${this._encodeIriOrBlank(n)} .
11
11
  `:` .
12
- `}`}quadsToString(e){let r="";for(let i of e)r+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return r}_encodeSubject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),e instanceof H?e.id:e.termType==="Variable"?`?${e.value}`:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),gs.test(r)&&(r=r.replace(ms,ws));let i=this._hasPrefixes?this._prefixRegex.exec(r):null;return i?i[1]?this._prefixIRIs[i[1]]+i[2]:r:`<${r}>`}_encodeLiteral(e){let r=e.value;gs.test(r)&&(r=r.replace(ms,ws));let i=e.language;if(i){let n=e.direction,s=n?`--${n}`:"";return`"${r}"@${i}${s}`}if(this._lineMode){if(e.datatype.value===pt.string)return`"${r}"`}else switch(e.datatype.value){case pt.string:return`"${r}"`;case pt.boolean:if(r==="true"||r==="false")return r;break;case pt.integer:if(/^[+-]?\d+$/.test(r))return r;break;case pt.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case pt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){switch(e.termType){case"NamedNode":return e.value===Hu.type?"a":this._encodeIriOrBlank(e);case"Literal":return this._encodeLiteral(e);default:return 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:r,object:i,graph:n}){return`<<(${this._encodeSubject(e)} ${this._encodePredicate(r)} ${this._encodeObject(i)}${fe(n)?"":` ${this._encodeIriOrBlank(n)}`})>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,r,i,n,s){i===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,r):typeof n=="function"?this._writeQuad(e,r,i,Mt,n):this._writeQuad(e,r,i,n||Mt,s)}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}addPrefix(e,r,i){let n={};n[e]=r,this.addPrefixes(n,i)}addPrefixes(e,r){if(!this._prefixIRIs)return r&&r();let i=!1;for(let n in e){let s=e[n];typeof s!="string"&&(s=s.value),i=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
12
+ `}`}quadsToString(e){let r="";for(let i of e)r+=this.quadToString(i.subject,i.predicate,i.object,i.graph);return r}_encodeSubject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),e instanceof Q?e.id:e.termType==="Variable"?`?${e.value}`:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),ps.test(r)&&(r=r.replace(bs,gs));let i=this._hasPrefixes?this._prefixRegex.exec(r):null;return i?i[1]?this._prefixIRIs[i[1]]+i[2]:r:`<${r}>`}_encodeLiteral(e){let r=e.value;ps.test(r)&&(r=r.replace(bs,gs));let i=e.language;if(i){let n=e.direction,s=n?`--${n}`:"";return`"${r}"@${i}${s}`}if(this._lineMode){if(e.datatype.value===_t.string)return`"${r}"`}else switch(e.datatype.value){case _t.string:return`"${r}"`;case _t.boolean:if(r==="true"||r==="false")return r;break;case _t.integer:if(/^[+-]?\d+$/.test(r))return r;break;case _t.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case _t.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){switch(e.termType){case"NamedNode":return e.value===Gu.type?"a":this._encodeIriOrBlank(e);case"Literal":return this._encodeLiteral(e);default:return 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:r,object:i,graph:n}){return`<<(${this._encodeSubject(e)} ${this._encodePredicate(r)} ${this._encodeObject(i)}${ae(n)?"":` ${this._encodeIriOrBlank(n)}`})>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,r,i,n,s){i===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,r):typeof n=="function"?this._writeQuad(e,r,i,Dt,n):this._writeQuad(e,r,i,n||Dt,s)}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}addPrefix(e,r,i){let n={};n[e]=r,this.addPrefixes(n,i)}addPrefixes(e,r){if(!this._prefixIRIs)return r&&r();let i=!1;for(let n in e){let s=e[n];typeof s!="string"&&(s=s.value),i=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
13
13
  `:`
14
14
  }
15
15
  `),this._subject=null,this._graph=""),this._prefixIRIs[s]=n+=":",this._write(`@prefix ${n} <${s}>.
16
- `)}if(i){this._hasPrefixes=!0;let n="",s="";for(let o in this._prefixIRIs)n+=n?`|${o}`:o,s+=(s?"|":"")+this._prefixIRIs[o];n=_t(n,/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${n})([_a-zA-Z0-9](?:\\.?[\\-_a-zA-Z0-9])*)$`)}this._write(i?`
17
- `:"",r)}blank(e,r){let i=e,n,s;switch(e===void 0?i=[]:e.termType?i=[{predicate:e,object:r}]:"length"in e||(i=[e]),s=i.length){case 0:return new Ve("[]");case 1:if(n=i[0],!(n.object instanceof Ve))return new Ve(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let o="[";for(let a=0;a<s;a++)n=i[a],n.predicate.equals(e)?o+=`, ${this._encodeObject(n.object)}`:(o+=`${(a?`;
16
+ `)}if(i){this._hasPrefixes=!0;let n="",s="";for(let o in this._prefixIRIs)n+=n?`|${o}`:o,s+=(s?"|":"")+this._prefixIRIs[o];n=ht(n,/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${n})([_a-zA-Z0-9](?:\\.?[\\-_a-zA-Z0-9])*)$`)}this._write(i?`
17
+ `:"",r)}blank(e,r){let i=e,n,s;switch(e===void 0?i=[]:e.termType?i=[{predicate:e,object:r}]:"length"in e||(i=[e]),s=i.length){case 0:return new ze("[]");case 1:if(n=i[0],!(n.object instanceof ze))return new ze(`[ ${this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)} ]`);default:let o="[";for(let a=0;a<s;a++)n=i[a],n.predicate.equals(e)?o+=`, ${this._encodeObject(n.object)}`:(o+=`${(a?`;
18
18
  `:`
19
- `)+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new Ve(`${o}
20
- ]`)}}list(e){let r=e&&e.length||0,i=new Array(r);for(let n=0;n<r;n++)i[n]=this._encodeObject(e[n]);return new Ve(`(${i.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
19
+ `)+this._encodePredicate(n.predicate)} ${this._encodeObject(n.object)}`,e=n.predicate);return new ze(`${o}
20
+ ]`)}}list(e){let r=e&&e.length||0,i=new Array(r);for(let n=0;n<r;n++)i[n]=this._encodeObject(e[n]);return new ze(`(${i.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
21
21
  `:`
22
22
  }
23
- `),this._subject=null),this._write=this._blockedWrite;let r=e&&((i,n)=>{r=null,e(i,n)});if(this._endStream)try{return this._outputStream.end(r)}catch(i){}r&&r()}};function ws(t){let e=Ku[t];return e===void 0&&(t.length===1?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((t.charCodeAt(0)-55296)*1024+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Zr=nr(Yr());var jt=Symbol("iter"),B=Symbol("size"),Pn;function Ip({store:t,observer:e}){let r=t.deref();r&&r._removeObserver(e)}function jn(t,e,r,i){let n=t&&t[e],s=n&&n[r];return!!s&&i in s}function Lt(t,e,r=4){let i=t[B]||0;for(let n in e)n in t?r!==0&&Lt(t[n],e[n],r-1):(i++,t[n]=r===0?null:Lt(Object.create(null),e[n],r-1));return r<=2&&(t[B]=i),t}function Bl(t,e,r=4){let i=!1,n=0;r<=2&&e[B]<t[B]&&([t,e]=[e,t]);for(let s in t)if(s in e){let o=r===0?null:Bl(t[s],e[s],r-1);if(o!==!1)i=i||Object.create(null),i[s]=o,n++;else if(r===3)return!1}return r<=2&&i&&(i[B]=n),i}function Fl(t,e,r=4){let i=!1,n=0;for(let s in t)if(!(s in e))i=i||Object.create(null),i[s]=r===0?null:Lt({},t[s],r-1),n++;else if(r!==0){let o=Fl(t[s],e[s],r-1);if(o!==!1)i=i||Object.create(null),i[s]=o,n++;else if(r===3)return!1}return r<=2&&i&&(i[B]=n),i}var Xt=class{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||X}_termFromId(e){if(e[0]==="."){let r=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(r[i[1]]),this._termFromId(r[i[2]]),this._termFromId(r[i[3]]),i[4]&&this._termFromId(r[i[4]]))}return Ce(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),i=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object),s;return r&&i&&n&&(fe(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${i}.${n}.${s}`:`.${r}.${i}.${n}`]}return this._ids[$(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${fe(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:$(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,i;if(e)for(r=e=`_:${e}`,i=1;this._ids[r];)r=e+i++;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))}},je=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),this._observers=null,!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||X,this._matchSemantics=Ln(r.matchSemantics),this._entityIndex=r.entityIndex||new Xt({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;let r=this._graphs,i,n;for(let s in r)for(let o in i=r[s].subjects)for(let a in n=i[o])e+=n[a][B];return this._size=e}_addToIndex(e,r,i,n){let s=e[r];s||(e[r]=s={[B]:0},e[B]++);let o=s[i];o||(s[i]=o={[B]:0},s[B]++);let a=n in o;return a||(o[n]=null,o[B]++),!a}_removeFromIndex(e,r,i,n){let s=e[r],o=s[i];delete o[n],--o[B]===0&&(delete s[i],--s[B]===0&&(delete e[r],e[B]--))}*_findInIndex(e,r,i,n,s,o,a,l){let u=this._entities,c=this._termFromId(u[l]),f={subject:null,predicate:null,object:null};if(n){let d=e[r],_=d&&d[i];if(!_||!(n in _))return;f[s]=this._termFromId(u[r]),f[o]=this._termFromId(u[i]),f[a]=this._termFromId(u[n]),yield this._factory.quad(f.subject,f.predicate,f.object,c);return}if(r&&!(r in e))return;let h=r?null:Object.keys(e);for(let d=0,_=r||h[0];_;_=h&&h[++d]){let p=e[_];if(!p)continue;if(f[s]=this._termFromId(u[_]),i&&!(i in p))return;let y=i?null:Object.keys(p);for(let m=0,S=i||y[0];S;S=y&&y[++m]){let x=p[S];if(!x)continue;f[o]=this._termFromId(u[S]);let g=Object.keys(x);for(let w=0;w<g.length;w++)f[a]=this._termFromId(u[g[w]]),yield this._factory.quad(f.subject,f.predicate,f.object,c)}}}_loop(e,r){for(let i in e)r(i)}_loopByKey0(e,r,i){let n,s;if(n=e[r])for(s in n)i(s)}_loopByKey1(e,r,i){let n,s;for(n in e)s=e[n],s[r]&&i(n)}_loopBy2Keys(e,r,i,n){let s,o,a;if((s=e[r])&&(o=s[i]))for(a in o)n(a)}_loopByKey0Deep(e,r,i){let n,s,o,a;if(n=e[r])for(o in n){s=n[o];for(a in s)i(a)}}_countInIndex(e,r,i,n){let s=0,o,a;if(r){if(!(o=e[r]))return 0;if(i)return(a=o[i])?n?n in a?1:0:a[B]:0;let u=Object.keys(o);for(let c=0;c<u.length;c++)s+=o[u[c]][B];return s}let l=Object.keys(e);for(let u=0;u<l.length;u++){o=e[l[u]];let c=Object.keys(o);for(let f=0;f<c.length;f++)s+=o[c[f]][B]}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_addObserver(e){let r=new WeakRef(e);return(Pn||(Pn=new FinalizationRegistry(Ip))).register(e,{store:new WeakRef(this),observer:r},r),(this._observers||(this._observers=new Set)).add(r),r}_removeObserver(e){Pn.unregister(e),this._observers&&(this._observers.delete(e),this._observers.size===0&&(this._observers=null))}_notifyObservers(e,r,i,n,s){for(let o of this._observers){let a=o.deref();a?a._onParentMutation(e,r,i,n,s):this._removeObserver(o)}}_uniqueEntities(e){let r=Object.create(null);return i=>{i in r||(r[i]=!0,e(this._termFromId(this._entities[i],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,i,n){return r||(n=e.graph,i=e.object,r=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1,e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),i=this._termToNewNumericId(i),this._addQuad(e,r,i,n)}_addQuad(e,r,i,n){let s=this._graphs[n];if(s||(s=this._graphs[n]={subjects:{[B]:0},predicates:{[B]:0},objects:{[B]:0}},Object.freeze(s)),this._observers!==null){if(jn(s.subjects,e,r,i))return!1;this._notifyObservers(e,r,i,n,!0)}return this._addToIndex(s.subjects,e,r,i)?(this._addToIndex(s.predicates,r,i,e),this._addToIndex(s.objects,i,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,i,n){if(e&&e.subject&&({subject:e,predicate:r,object:i,graph:n}=e),e&&r&&i&&n!==void 0&&n!==null){let s=this._termToNumericId(e),o=this._termToNumericId(r),a=this._termToNumericId(i),l=n===""||fe(n)?1:this._termToNumericId(n),u=l&&this._graphs[l];return!!s&&!!o&&!!a&&!!u&&jn(u.subjects,s,o,a)}return!this.readQuads(e,r,i,n).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,i,n){return r||({subject:e,predicate:r,object:i,graph:n}=e),n=n?this._termToNumericId(n):1,!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(i=i&&this._termToNumericId(i))?!1:this._removeQuad(e,r,i,n)}_removeQuad(e,r,i,n){let s=this._graphs,o=s[n];return!o||!jn(o.subjects,e,r,i)?!1:(this._observers!==null&&this._notifyObservers(e,r,i,n,!1),this._removeFromIndex(o.subjects,e,r,i),this._removeFromIndex(o.predicates,r,i,e),this._removeFromIndex(o.objects,i,e,r),this._size!==null&&this._size--,o.subjects[B]===0&&delete s[n],!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,i,n){let s=new Zr.Readable({objectMode:!0}),o=this.readQuads(e,r,i,n);return s._read=a=>{for(;--a>=0;){let{done:l,value:u}=o.next();if(l){s.push(null);return}s.push(u)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,r,i,n){return[...this.readQuads(e,r,i,n)]}*readQuads(e,r,i,n){let s=this._getGraphs(n),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||i&&!(u=this._termToNumericId(i))))for(let c in s)(o=s[c])&&(a?u?yield*ne(this._findInIndex(o.objects,u,a,l,"object","subject","predicate",c)):yield*ne(this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",c)):l?yield*ne(this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",c)):u?yield*ne(this._findInIndex(o.objects,u,null,null,"object","subject","predicate",c)):yield*ne(this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",c)))}match(e,r,i,n,s=null){return new qe(this,e,r,i,n,{entityIndex:this._entityIndex,matchSemantics:s&&s.matchSemantics!==void 0?s.matchSemantics:this._matchSemantics})}countQuads(e,r,i,n){let s=this._getGraphs(n),o=0,a,l,u,c;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||i&&!(c=this._termToNumericId(i)))return 0;for(let f in s)(a=s[f])&&(e?i?o+=this._countInIndex(a.objects,c,l,u):o+=this._countInIndex(a.subjects,l,u,c):r?o+=this._countInIndex(a.predicates,u,c,l):o+=this._countInIndex(a.objects,c,l,u));return o}forEach(e,r,i,n,s){this.some(o=>(e(o,this),!1),r,i,n,s)}every(e,r,i,n,s){return!this.some(o=>!e(o,this),r,i,n,s)}some(e,r,i,n,s){for(let o of this.readQuads(r,i,n,s))if(e(o,this))return!0;return!1}getSubjects(e,r,i){let n=[];return this.forSubjects(s=>{n.push(s)},e,r,i),n}forSubjects(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.predicates,a,l,e):this._loopByKey1(o.subjects,a,e):l?this._loopByKey0(o.objects,l,e):this._loop(o.subjects,e))}getPredicates(e,r,i){let n=[];return this.forPredicates(s=>{n.push(s)},e,r,i),n}forPredicates(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.objects,l,a,e):this._loopByKey0(o.subjects,a,e):l?this._loopByKey1(o.predicates,l,e):this._loop(o.predicates,e))}getObjects(e,r,i){let n=[];return this.forObjects(s=>{n.push(s)},e,r,i),n}forObjects(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey0Deep(o.subjects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,i){let n=[];return this.forGraphs(s=>{n.push(s)},e,r,i),n}forGraphs(e,r,i,n){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,i,n,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1,allowExtraArcs:i=!1}={}){let n=Object.create(null),s=r?(()=>!0):((l,u)=>{throw new Error(`${l.value} ${u}`)}),o=this.getQuads(null,N.rdf.rest,N.rdf.nil,null),a=[];return o.forEach(l=>{let u=[],c=!1,f=!1,h,d,_=l.graph,p=[],y=l.subject;for(;y&&!c;){let m=this.getQuads(null,null,y,null),S=this.getQuads(y,null,null,null),x,g=null,w=null,R=null;for(let T=0;T<S.length&&!c;T++)x=S[T],x.graph.equals(_)?h?c=s(y,"has non-list arcs out"):x.predicate.value===N.rdf.first?(g?c=s(y,"has multiple rdf:first arcs"):g=x,e&&g===x&&p.push(x)):x.predicate.value===N.rdf.rest?(w?c=s(y,"has multiple rdf:rest arcs"):w=x,e&&w===x&&p.push(x)):m.length?i?f=!0:c=s(y,`has non-list arc ${x.predicate.value}`):(h=x,d="subject"):c=s(y,"not confined to single graph");for(let T=0;T<m.length&&!c;++T)x=m[T],h?c=s(y,"can't have coreferences"):x.predicate.value===N.rdf.rest?R?c=s(y,"has incoming rdf:rest arcs"):R=x:(h=x,d="object");g?u.push(g.object):c=s(y,"has no list head"),y=R&&R.subject}if(c)e=!1;else if(u.reverse(),h&&(n[h[d].value]=u),e&&!f)for(let m=0;m<p.length;m++)a.push(p[m])}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof qe&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(this._observers===null&&e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Lt(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof qe&&(e=e.filtered),e===this)return!0;if(!(e instanceof t)||this._entityIndex!==e._entityIndex)return e.every(u=>this.has(u));let r=this._graphs,i=e._graphs,n,s,o,a,l;for(let u in i){if(!(n=r[u]))return!1;n=n.subjects;for(let c in s=i[u].subjects){if(!(o=n[c]))return!1;for(let f in a=s[c]){if(!(l=o[f]))return!1;for(let h in a[f])if(!(h in l))return!1}}}return!0}deleteMatches(e,r,i,n){for(let s of this.match(e,r,i,n,{matchSemantics:"lazy"}))this.removeQuad(s);return this}difference(e){if(e&&e instanceof qe&&(e=e.filtered),e===this)return new t({entityIndex:this._entityIndex});if(e instanceof t&&e._entityIndex===this._entityIndex){let r=new t({entityIndex:this._entityIndex}),i=Fl(this._graphs,e._graphs);return i&&(r._graphs=i,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof qe&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let i of this)e(i,this)&&r.add(i);return r}intersection(e){if(e instanceof qe&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Lt(Object.create(null),this._graphs),r._size=this._size,r}else if(e instanceof t&&this._entityIndex===e._entityIndex){let r=new t({entityIndex:this._entityIndex}),i=Bl(e._graphs,this._graphs);return i&&(r._graphs=i,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let i of this)r.add(e(i,this));return r}reduce(e,r){let i=this.readQuads(),n=r===void 0?i.next().value:r;for(let s of i)n=e(n,s,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match(null,null,null,null,{matchSemantics:"lazy"})}toString(){return new ce().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Lt(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}[Symbol.iterator](){return this.readQuads()}};function we(t,e,r=0){let i=e[r];if(i&&!(i in t))return!1;let n=!1,s=0;for(let o in i?{[i]:t[i]}:t){let a=r===2?null:we(t[o],e,r+1);a!==!1&&(n=n||Object.create(null),n[o]=a,s++)}return n&&(n[B]=s),n}function jl(t,e,r,i,n){let s={store:t,ids:[]},o=e&&t._termToNumericId(e),a=r&&t._termToNumericId(r),l=i&&t._termToNumericId(i),u,c,f,h,d;l&&(o||!a)?(u="objects",[c,f,h]=[l,o,a],d=[2,0,1]):!o&&a?(u="predicates",[c,f,h]=[a,l,o],d=[1,2,0]):(u="subjects",[c,f,h]=[o,a,l],d=[0,1,2]);let _=t._getGraphs(n),p=[];for(let y in _){let m=_[y][u],S=Number(y);for(let x in c?{[c]:m[c]}:m){let g=m[x];if(g){p[d[0]]=Number(x);for(let w in f?{[f]:g[f]}:g){let R=g[w];if(R){p[d[1]]=Number(w);for(let T in h?h in R?{[h]:null}:{}:R)p[d[2]]=Number(T),s.ids.push(p[0],p[1],p[2],S)}}}}}return s}function*Rp({store:t,ids:e},r){let i=t._entities,n,s,o,a,l,u,c,f;for(let h=r*4;h<e.length;h+=4)l!==e[h]&&(n=t._termFromId(i[l=e[h]])),u!==e[h+1]&&(s=t._termFromId(i[u=e[h+1]])),c!==e[h+2]&&(o=t._termFromId(i[c=e[h+2]])),f!==e[h+3]&&(a=t._termFromId(i[f=e[h+3]])),yield t._factory.quad(n,s,o,a)}function Ln(t="lazy"){if(t!=="lazy"&&t!=="snapshot"&&t!=="forwarded")throw new Error(`Unknown matchSemantics: ${t}`);if(t!=="lazy"&&(typeof WeakRef!="function"||typeof FinalizationRegistry!="function"))throw new Error("Non-lazy matchSemantics requires WeakRef and FinalizationRegistry support");return t}function Ll(t,e){let r=new Array(4);for(let i=0;i<4;i++){let n=t[i],s=e[i];if(n==null)r[i]=s;else if(s==null||$(n)===$(s))r[i]=n;else return!1}return r}var qe=class t extends Zr.Readable{constructor(e,r,i,n,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:i,object:n,graph:s,options:o});let a=this._semantics=Ln(o.matchSemantics);o.matchesNothing&&(this._matchesNothing=!0,this._filtered=new je({factory:e._factory,entityIndex:o.entityIndex})),a!=="lazy"&&(this._readers=null,this._subjectId=this._predicateId=this._objectId=this._graphId=void 0,this._matchesNothing||(this._observer=e._addObserver(this)))}_matchesPattern(e,r,i,n){let{subject:s,predicate:o,object:a,graph:l,n3Store:u}=this;return s&&e!==(this._subjectId||(this._subjectId=u._termToNumericId(s)))||o&&r!==(this._predicateId||(this._predicateId=u._termToNumericId(o)))||a&&i!==(this._objectId||(this._objectId=u._termToNumericId(a)))?!1:l==null||n===(this._graphId||(this._graphId=l===""||fe(l)?1:u._termToNumericId(l)))}_matchesQuad(e){let{subject:r,predicate:i,object:n,graph:s}=this;return!this._matchesNothing&&(r==null||$(r)===$(e.subject))&&(i==null||$(i)===$(e.predicate))&&(n==null||$(n)===$(e.object))&&(s==null||$(s)===$(e.graph))}_assertMatchesPattern(e){if(!this._matchesQuad(e))throw new Error("Quad does not match the forwarded view pattern")}_sourceIterator(){return this._filtered?this._filtered[Symbol.iterator]():this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}_freezeCurrentIterators(){this._readers&&(this._readers.snapshot=this._filtered?jl(this._filtered):jl(this.n3Store,this.subject,this.predicate,this.object,this.graph),this._readers=null)}_onParentMutation(e,r,i,n,s){if(this._matchesPattern(e,r,i,n)){if(this._freezeCurrentIterators(),this._semantics==="forwarded"){this._filtered&&(s?this._filtered._addQuad(e,r,i,n):this._filtered._removeQuad(e,r,i,n));return}this._filtered=this.filtered}}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:i,predicate:n,subject:s}=this;this._semantics!=="lazy"&&this._freezeCurrentIterators();let o=this._filtered=new je({factory:e._factory,entityIndex:this.options.entityIndex});this._semantics==="snapshot"&&this._detachObserver();let a,l,u;if(s&&!(a=o._termToNumericId(s))||n&&!(l=o._termToNumericId(n))||i&&!(u=o._termToNumericId(i)))return o;let c=e._getGraphs(r);for(let f in c){let h,d,_,p;(p=c[f])&&(!a&&l?(d=we(p.predicates,[l,u,a]))&&(h=we(p.subjects,[a,l,u]),_=we(p.objects,[u,a,l])):u?(_=we(p.objects,[u,a,l]))&&(h=we(p.subjects,[a,l,u]),d=we(p.predicates,[l,u,a])):(h=we(p.subjects,[a,l,u]))&&(d=we(p.predicates,[l,u,a]),_=we(p.objects,[u,a,l])),h&&(o._graphs[f]={subjects:h,predicates:d,objects:_}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[jt]&&(this[jt]=this[Symbol.iterator]());let r=this[jt];for(;--e>=0;){let{done:i,value:n}=r.next();if(i){this.push(null);return}this.push(n)}}_destroy(e,r){this[jt]&&(this[jt].return(),this[jt]=null),r(e)}_detachObserver(){this._observer&&(this.n3Store._removeObserver(this._observer),this._observer=null)}_detach(){return this._filtered=this.filtered,this._detachObserver(),this._semantics==="lazy"&&(this._readers=null),this._semantics="snapshot",this}addAll(e){if(this._semantics==="forwarded"){for(let r of e)this._assertMatchesPattern(r),this.n3Store.addQuad(r);return this}return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,i,n){if(this._semantics==="forwarded"){if(this._matchesNothing)throw new Error("Cannot delete from a conflicting forwarded view pattern");let s=Ll([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]);if(!s)throw new Error("Deletion pattern does not match the forwarded view pattern");return this.n3Store.deleteMatches(...s),this}return this.filtered.deleteMatches(e,r,i,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,i,n,s){return this.filtered.every(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}filter(e){return this.filtered.filter(this._semantics==="forwarded"?r=>e(r,this):e)}forEach(e,r,i,n,s){return this.filtered.forEach(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}import(e){if(this._semantics!=="forwarded")return this.filtered.import(e);let r=this;function i(n){try{r._assertMatchesPattern(n),r.n3Store.addQuad(n)}catch(s){e.removeListener("data",i),typeof e.destroy=="function"?e.destroy(s):e.emit("error",s)}}return e.on("data",i),e}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(this._semantics==="forwarded"?r=>e(r,this):e)}some(e,r,i,n,s){return this.filtered.some(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._semantics!=="lazy"?Zr.Readable.from(this[Symbol.iterator]()):this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph,{matchSemantics:"lazy"})}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph,{matchSemantics:"lazy"}).addAll(e)}toArray(){return this._semantics!=="lazy"?[...this]:this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(this._semantics==="forwarded"?(i,n)=>e(i,n,this):e,r)}toString(){return new ce().quadsToString(this)}add(e){return this._semantics==="forwarded"?(this._assertMatchesPattern(e),this.n3Store.addQuad(e),this):this.filtered.add(e)}delete(e){return this._semantics==="forwarded"?(this._assertMatchesPattern(e),this.n3Store.removeQuad(e),this):this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,i,n,s=null){let o=s&&s.matchSemantics;if(s&&o!==void 0&&(Ln(o),o!==this._semantics))throw new Error(`Cannot override matchSemantics on a view: inherited "${this._semantics}", received "${o}"`);if(this._semantics!=="forwarded")return new t(this.filtered,e,r,i,n,{entityIndex:this.options.entityIndex,matchSemantics:this._semantics});let a=!this._matchesNothing&&Ll([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]),[l,u,c,f]=a||[null,null,null,null];return new t(this.n3Store,l,u,c,f,{entityIndex:this.options.entityIndex,matchSemantics:"forwarded",matchesNothing:!a})}[Symbol.iterator](){return this._semantics==="lazy"?this._sourceIterator():this._iterateStable()}*_iterateStable(){let e=this._readers||(this._readers={count:0,snapshot:null}),r=this._sourceIterator(),i=0;e.count++;try{for(;!e.snapshot;){let{value:n,done:s}=r.next();if(e.snapshot||s)break;i++,yield n}e.snapshot&&(yield*ne(Rp(e.snapshot,i)))}finally{r.return(),--e.count===0&&(e.snapshot=null,this._readers===e&&(this._readers=null))}}};var Jt=class{dataset(e){return new je(e)}};function Ol(t){let e=[];for(let{subject:r,object:i}of t.match(null,X.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,X.defaultGraph())){let n=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,i)];e.push({premise:n,conclusion:s})}return e}var er=class{constructor(e,r={}){this._store=e,this._maxDerivations=r.maxDerivations===void 0?1/0:r.maxDerivations,this._maxPremiseDepth=r.maxPremiseDepth===void 0?1/0:r.maxPremiseDepth}_add(e,r,i,n,s,o){let a=this._store;if(a._observers){if(!a._addQuad(e,r,i,this._graphId))return}else{if(!a._addToIndex(n.subjects,e,r,i))return;a._addToIndex(n.predicates,r,i,e),a._addToIndex(n.objects,i,e,r)}if(++this._derivations>this._maxDerivations)throw new Error(`Reasoning exceeded the maximum of ${this._maxDerivations} derivations`);o(s)}_emit(e,r,i){let n=e.conclusion;for(let s=0;s<n.length;s++){let o=n[s];this._add(o.subject.value,o.predicate.value,o.object.value,r,o,i)}}_evaluatePremise(e,r,i,n=0){let s,o,[a,l,u]=e.premise[n].value,c=r[e.premise[n].content],f=n===e.premise.length-1;if(!(s=a.value)){for(s in c)o=c[s],a.value=Number(s),this._evaluateLevel1(e,r,i,n,f,l,u,o);a.value=null}else(o=c[s])&&this._evaluateLevel1(e,r,i,n,f,l,u,o)}_evaluateLevel1(e,r,i,n,s,o,a,l){let u,c;if(!(u=o.value)){for(u in l)c=l[u],o.value=Number(u),this._evaluateLevel2(e,r,i,n,s,a,c);o.value=null}else(c=l[u])&&this._evaluateLevel2(e,r,i,n,s,a,c)}_evaluateLevel2(e,r,i,n,s,o,a){let l;if(!(l=o.value)){for(l in a)o.value=Number(l),s?this._emit(e,r,i):this._evaluatePremise(e,r,i,n+1);o.value=null}else s?this._emit(e,r,i):this._evaluatePremise(e,r,i,n+1)}_evaluateRules(e,r,i){for(let n=0;n<e.length;n++)this._evaluatePremise(e[n],r,i)}_reasonGraphNaive(e,r){let i=[];function n(a){a.next&&a.next.forEach(l=>{i.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{for(let l=0;l<a.length;l++){let u=a[l];this._add(u.subject.value,u.predicate.value,u.object.value,r,u,n)}};this._evaluateRules(e,r,n);let o;for(;(o=i.pop())!==void 0;){let[a,l,u,c]=o,f=c.basePremise.subject.value;f||(c.basePremise.subject.value=a);let h=c.basePremise.predicate.value;h||(c.basePremise.predicate.value=l);let d=c.basePremise.object.value;d||(c.basePremise.object.value=u),c.premise.length===0?s(c.conclusion):this._evaluatePremise(c,r,n),f||(c.basePremise.subject.value=null),h||(c.basePremise.predicate.value=null),d||(c.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let i={},n=o=>o.termType==="Variable"?i[o.value]=i[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:n(o.subject),predicate:n(o.predicate),object:n(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(i)}}reason(e){this._derivations=0,Array.isArray(e)||(e=Ol(e)),e=e.map(i=>this._createRule(i));for(let i of e)if(i.premise.length>this._maxPremiseDepth)throw new Error(`Reasoning rule exceeds the maximum premise depth of ${this._maxPremiseDepth}`);for(let i of e)for(let n of e)for(let s=0;s<n.premise.length;s++){let o=n.premise[s];for(let a of i.conclusion){if(Bn(o.subject,a.subject)&&Bn(o.predicate,a.predicate)&&Bn(o.object,a.object)){let l=new Set,u=[];o.subject.value=o.subject.value||1,o.object.value=o.object.value||1,o.predicate.value=o.predicate.value||1;for(let c=0;c<n.premise.length;c++)c!==s&&u.push(Cl(n.premise[c],l));(a.next=a.next||[]).push({premise:u,conclusion:n.conclusion,basePremise:o})}for(let l=0;l<n.variables.length;l++)n.variables[l].value=null}}for(let i of e){let n=new Set;i.premise=i.premise.map(s=>Cl(s,n))}let r=this._store._getGraphs();try{for(let i in r)this._graphId=Number(i),this._reasonGraphNaive(e,r[i])}finally{this._store._size=null}}};function Cl({subject:t,predicate:e,object:r},i){let n=t.value||i.has(t)||(i.add(t),!1),s=e.value||i.has(e)||(i.add(e),!1),o=r.value||i.has(r)||(i.add(r),!1);return!n&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function Bn(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var Dl=nr(Yr());var tr=class extends Dl.Transform{constructor(e){super({decodeStrings:!0,readableObjectMode:!0});let r=new Ie(e),i,n,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),r.parse({on:(o,a)=>{switch(o){case"data":i=a;break;case"end":n=a;break}}},s),this._transform=(o,a,l)=>{i(o),l()},this._flush=o=>{n(),o()}}import(e){return e.on("error",r=>{this.emit("error",r)}),typeof e.pipe=="function"?e.pipe(this):(e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()})),this}};var Ml=nr(Yr());var Tp=16*1024,Ap=20,rr=class extends Ml.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0}),this._buffer="",this._flushTimer=null,this._flushDelay=e&&e.flushDelay!==void 0?e.flushDelay:Ap;let r=this._writer=new ce({write:(s,o,a)=>{this._buffer+=s,this._buffer.length>=Tp?this._pushBuffer():this._flushTimer===null&&this._armFlushTimer(),a&&a()},end:s=>{this._pushBuffer(),this.push(null),s&&s()}},e),i=null,n=s=>{let o=i;i=null,s&&this._pushBuffer(),o(s)};this._transform=(s,o,a)=>{i=a,r.addQuad(s,n)},this._flush=s=>{r.end(s)}}_pushBuffer(){this._clearFlushTimer(),this._buffer!==""&&(this.push(this._buffer),this._buffer="")}_armFlushTimer(){this._flushTimer=setTimeout(()=>{this._flushTimer=null,this._pushBuffer()},this._flushDelay),this._flushTimer.unref&&this._flushTimer.unref()}_clearFlushTimer(){this._flushTimer!==null&&(clearTimeout(this._flushTimer),this._flushTimer=null)}_destroy(e,r){this._clearFlushTimer(),super._destroy(e,r)}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this._pushBuffer(),this.emit("error",r)}),e.on("prefix",(r,i)=>{this._writer.addPrefix(r,i)}),this}};var oy={Lexer:Qe,Parser:Ie,Writer:ce,Store:je,StoreFactory:Jt,EntityIndex:Xt,StreamParser:tr,StreamWriter:rr,Util:di,Reasoner:er,BaseIRI:ze,DataFactory:X,Term:H,NamedNode:dt,Literal:Se,BlankNode:Ct,Variable:Ot,DefaultGraph:Dt,Quad:Oe,Triple:Oe,termFromId:Ce,termToId:$};export{ze as BaseIRI,Ct as BlankNode,X as DataFactory,Dt as DefaultGraph,Xt as EntityIndex,Qe as Lexer,Se as Literal,dt as NamedNode,Ie as Parser,Oe as Quad,er as Reasoner,je as Store,Jt as StoreFactory,tr as StreamParser,rr as StreamWriter,H as Term,Oe as Triple,di as Util,Ot as Variable,ce as Writer,oy as default,Ol as getRulesFromDataset,Ce as termFromId,$ as termToId};
23
+ `),this._subject=null),this._write=this._blockedWrite;let r=e&&((i,n)=>{r=null,e(i,n)});if(this._endStream)try{return this._outputStream.end(r)}catch(i){}r&&r()}};function gs(t){let e=Qu[t];return e===void 0&&(t.length===1?(e=t.charCodeAt(0).toString(16),e="\\u0000".substr(0,6-e.length)+e):(e=((t.charCodeAt(0)-55296)*1024+t.charCodeAt(1)+9216).toString(16),e="\\U00000000".substr(0,10-e.length)+e)),e}var Hr=ir(Vr());var Pt=Symbol("iter"),B=Symbol("size"),An;function wp({store:t,observer:e}){let r=t.deref();r&&r._removeObserver(e)}function vn(t,e,r,i){let n=t&&t[e],s=n&&n[r];return!!s&&i in s}function jt(t,e,r=4){let i=t[B]||0;for(let n in e)n in t?r!==0&&jt(t[n],e[n],r-1):(i++,t[n]=r===0?null:jt(Object.create(null),e[n],r-1));return r<=2&&(t[B]=i),t}function Pl(t,e,r=4){let i=!1,n=0;r<=2&&e[B]<t[B]&&([t,e]=[e,t]);for(let s in t)if(s in e){let o=r===0?null:Pl(t[s],e[s],r-1);if(o!==!1)i=i||Object.create(null),i[s]=o,n++;else if(r===3)return!1}return r<=2&&i&&(i[B]=n),i}function jl(t,e,r=4){let i=!1,n=0;for(let s in t)if(!(s in e))i=i||Object.create(null),i[s]=r===0?null:jt({},t[s],r-1),n++;else if(r!==0){let o=jl(t[s],e[s],r-1);if(o!==!1)i=i||Object.create(null),i[s]=o,n++;else if(r===3)return!1}return r<=2&&i&&(i[B]=n),i}var Zt=class{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||Y}_termFromId(e){if(e[0]==="."){let r=this._entities,i=e.split(".");return this._factory.quad(this._termFromId(r[i[1]]),this._termFromId(r[i[2]]),this._termFromId(r[i[3]]),i[4]&&this._termFromId(r[i[4]]))}return Fe(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),i=this._termToNumericId(e.predicate),n=this._termToNumericId(e.object),s;return r&&i&&n&&(ae(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${i}.${n}.${s}`:`.${r}.${i}.${n}`]}return this._ids[D(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ae(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:D(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,i;if(e)for(r=e=`_:${e}`,i=1;this._ids[r];)r=e+i++;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))}},Pe=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),this._observers=null,!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||Y,this._matchSemantics=Nn(r.matchSemantics),this._entityIndex=r.entityIndex||new Zt({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;let r=this._graphs,i,n;for(let s in r)for(let o in i=r[s].subjects)for(let a in n=i[o])e+=n[a][B];return this._size=e}_addToIndex(e,r,i,n){let s=e[r];s||(e[r]=s={[B]:0},e[B]++);let o=s[i];o||(s[i]=o={[B]:0},s[B]++);let a=n in o;return a||(o[n]=null,o[B]++),!a}_removeFromIndex(e,r,i,n){let s=e[r],o=s[i];delete o[n],--o[B]===0&&(delete s[i],--s[B]===0&&(delete e[r],e[B]--))}*_findInIndex(e,r,i,n,s,o,a,l){let f=this._entities,u=this._termFromId(f[l]),c={subject:null,predicate:null,object:null};if(n){let d=e[r],p=d&&d[i];if(!p||!(n in p))return;c[s]=this._termFromId(f[r]),c[o]=this._termFromId(f[i]),c[a]=this._termFromId(f[n]),yield this._factory.quad(c.subject,c.predicate,c.object,u);return}if(r&&!(r in e))return;let _=r?null:Object.keys(e);for(let d=0,p=r||_[0];p;p=_&&_[++d]){let b=e[p];if(!b)continue;if(c[s]=this._termFromId(f[p]),i&&!(i in b))return;let y=i?null:Object.keys(b);for(let w=0,T=i||y[0];T;T=y&&y[++w]){let x=b[T];if(!x)continue;c[o]=this._termFromId(f[T]);let g=Object.keys(x);for(let m=0;m<g.length;m++)c[a]=this._termFromId(f[g[m]]),yield this._factory.quad(c.subject,c.predicate,c.object,u)}}}_loop(e,r){for(let i in e)r(i)}_loopByKey0(e,r,i){let n,s;if(n=e[r])for(s in n)i(s)}_loopByKey1(e,r,i){let n,s;for(n in e)s=e[n],s[r]&&i(n)}_loopBy2Keys(e,r,i,n){let s,o,a;if((s=e[r])&&(o=s[i]))for(a in o)n(a)}_loopByKey0Deep(e,r,i){let n,s,o,a;if(n=e[r])for(o in n){s=n[o];for(a in s)i(a)}}_countInIndex(e,r,i,n){let s=0,o,a;if(r){if(!(o=e[r]))return 0;if(i)return(a=o[i])?n?n in a?1:0:a[B]:0;let f=Object.keys(o);for(let u=0;u<f.length;u++)s+=o[f[u]][B];return s}let l=Object.keys(e);for(let f=0;f<l.length;f++){o=e[l[f]];let u=Object.keys(o);for(let c=0;c<u.length;c++)s+=o[u[c]][B]}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_addObserver(e){let r=new WeakRef(e);return(An||(An=new FinalizationRegistry(wp))).register(e,{store:new WeakRef(this),observer:r},r),(this._observers||(this._observers=new Set)).add(r),r}_removeObserver(e){An.unregister(e),this._observers&&(this._observers.delete(e),this._observers.size===0&&(this._observers=null))}_notifyObservers(e,r,i,n,s){for(let o of this._observers){let a=o.deref();a?a._onParentMutation(e,r,i,n,s):this._removeObserver(o)}}_uniqueEntities(e){let r=Object.create(null);return i=>{i in r||(r[i]=!0,e(this._termFromId(this._entities[i],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,i,n){return r||(n=e.graph,i=e.object,r=e.predicate,e=e.subject),n=n?this._termToNewNumericId(n):1,e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),i=this._termToNewNumericId(i),this._addQuad(e,r,i,n)}_addQuad(e,r,i,n){let s=this._graphs[n];if(s||(s=this._graphs[n]={subjects:{[B]:0},predicates:{[B]:0},objects:{[B]:0}},Object.freeze(s)),this._observers!==null){if(vn(s.subjects,e,r,i))return!1;this._notifyObservers(e,r,i,n,!0)}return this._addToIndex(s.subjects,e,r,i)?(this._addToIndex(s.predicates,r,i,e),this._addToIndex(s.objects,i,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,i,n){if(e&&e.subject&&({subject:e,predicate:r,object:i,graph:n}=e),e&&r&&i&&n!==void 0&&n!==null){let s=this._termToNumericId(e),o=this._termToNumericId(r),a=this._termToNumericId(i),l=n===""||ae(n)?1:this._termToNumericId(n),f=l&&this._graphs[l];return!!s&&!!o&&!!a&&!!f&&vn(f.subjects,s,o,a)}return!this.readQuads(e,r,i,n).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,i,n){return r||({subject:e,predicate:r,object:i,graph:n}=e),n=n?this._termToNumericId(n):1,!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(i=i&&this._termToNumericId(i))?!1:this._removeQuad(e,r,i,n)}_removeQuad(e,r,i,n){let s=this._graphs,o=s[n];return!o||!vn(o.subjects,e,r,i)?!1:(this._observers!==null&&this._notifyObservers(e,r,i,n,!1),this._removeFromIndex(o.subjects,e,r,i),this._removeFromIndex(o.predicates,r,i,e),this._removeFromIndex(o.objects,i,e,r),this._size!==null&&this._size--,o.subjects[B]===0&&delete s[n],!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,i,n){let s=new Hr.Readable({objectMode:!0}),o=this.readQuads(e,r,i,n);return s._read=a=>{for(;--a>=0;){let{done:l,value:f}=o.next();if(l){s.push(null);return}s.push(f)}},this.remove(s)}deleteGraph(e){return this.removeMatches(null,null,null,e)}getQuads(e,r,i,n){return[...this.readQuads(e,r,i,n)]}*readQuads(e,r,i,n){let s=this._getGraphs(n),o,a,l,f;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||i&&!(f=this._termToNumericId(i))))for(let u in s)(o=s[u])&&(a?f?yield*te(this._findInIndex(o.objects,f,a,l,"object","subject","predicate",u)):yield*te(this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",u)):l?yield*te(this._findInIndex(o.predicates,l,f,null,"predicate","object","subject",u)):f?yield*te(this._findInIndex(o.objects,f,null,null,"object","subject","predicate",u)):yield*te(this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",u)))}match(e,r,i,n,s=null){return new ke(this,e,r,i,n,{entityIndex:this._entityIndex,matchSemantics:s&&s.matchSemantics!==void 0?s.matchSemantics:this._matchSemantics})}countQuads(e,r,i,n){let s=this._getGraphs(n),o=0,a,l,f,u;if(e&&!(l=this._termToNumericId(e))||r&&!(f=this._termToNumericId(r))||i&&!(u=this._termToNumericId(i)))return 0;for(let c in s)(a=s[c])&&(e?i?o+=this._countInIndex(a.objects,u,l,f):o+=this._countInIndex(a.subjects,l,f,u):r?o+=this._countInIndex(a.predicates,f,u,l):o+=this._countInIndex(a.objects,u,l,f));return o}forEach(e,r,i,n,s){this.some(o=>(e(o,this),!1),r,i,n,s)}every(e,r,i,n,s){return!this.some(o=>!e(o,this),r,i,n,s)}some(e,r,i,n,s){for(let o of this.readQuads(r,i,n,s))if(e(o,this))return!0;return!1}getSubjects(e,r,i){let n=[];return this.forSubjects(s=>{n.push(s)},e,r,i),n}forSubjects(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.predicates,a,l,e):this._loopByKey1(o.subjects,a,e):l?this._loopByKey0(o.objects,l,e):this._loop(o.subjects,e))}getPredicates(e,r,i){let n=[];return this.forPredicates(s=>{n.push(s)},e,r,i),n}forPredicates(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.objects,l,a,e):this._loopByKey0(o.subjects,a,e):l?this._loopByKey1(o.predicates,l,e):this._loop(o.predicates,e))}getObjects(e,r,i){let n=[];return this.forObjects(s=>{n.push(s)},e,r,i),n}forObjects(e,r,i,n){let s=this._getGraphs(n),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||i&&!(l=this._termToNumericId(i))))for(n in s)(o=s[n])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey0Deep(o.subjects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,i){let n=[];return this.forGraphs(s=>{n.push(s)},e,r,i),n}forGraphs(e,r,i,n){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,i,n,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1,allowExtraArcs:i=!1}={}){let n=Object.create(null),s=r?(()=>!0):((l,f)=>{throw new Error(`${l.value} ${f}`)}),o=this.getQuads(null,N.rdf.rest,N.rdf.nil,null),a=[];return o.forEach(l=>{let f=[],u=!1,c=!1,_,d,p=l.graph,b=[],y=l.subject;for(;y&&!u;){let w=this.getQuads(null,null,y,null),T=this.getQuads(y,null,null,null),x,g=null,m=null,I=null;for(let A=0;A<T.length&&!u;A++)x=T[A],x.graph.equals(p)?_?u=s(y,"has non-list arcs out"):x.predicate.value===N.rdf.first?(g?u=s(y,"has multiple rdf:first arcs"):g=x,e&&g===x&&b.push(x)):x.predicate.value===N.rdf.rest?(m?u=s(y,"has multiple rdf:rest arcs"):m=x,e&&m===x&&b.push(x)):w.length?i?c=!0:u=s(y,`has non-list arc ${x.predicate.value}`):(_=x,d="subject"):u=s(y,"not confined to single graph");for(let A=0;A<w.length&&!u;++A)x=w[A],_?u=s(y,"can't have coreferences"):x.predicate.value===N.rdf.rest?I?u=s(y,"has incoming rdf:rest arcs"):I=x:(_=x,d="object");g?f.push(g.object):u=s(y,"has no list head"),y=I&&I.subject}if(u)e=!1;else if(f.reverse(),_&&(n[_[d].value]=f),e&&!c)for(let w=0;w<b.length;w++)a.push(b[w])}),e&&this.removeQuads(a),n}addAll(e){if(e instanceof ke&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(this._observers===null&&e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=jt(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof ke&&(e=e.filtered),e===this)return!0;if(!(e instanceof t)||this._entityIndex!==e._entityIndex)return e.every(f=>this.has(f));let r=this._graphs,i=e._graphs,n,s,o,a,l;for(let f in i){if(!(n=r[f]))return!1;n=n.subjects;for(let u in s=i[f].subjects){if(!(o=n[u]))return!1;for(let c in a=s[u]){if(!(l=o[c]))return!1;for(let _ in a[c])if(!(_ in l))return!1}}}return!0}deleteMatches(e,r,i,n){for(let s of this.match(e,r,i,n,{matchSemantics:"lazy"}))this.removeQuad(s);return this}difference(e){if(e&&e instanceof ke&&(e=e.filtered),e===this)return new t({entityIndex:this._entityIndex});if(e instanceof t&&e._entityIndex===this._entityIndex){let r=new t({entityIndex:this._entityIndex}),i=jl(this._graphs,e._graphs);return i&&(r._graphs=i,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof ke&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let i of this)e(i,this)&&r.add(i);return r}intersection(e){if(e instanceof ke&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=jt(Object.create(null),this._graphs),r._size=this._size,r}else if(e instanceof t&&this._entityIndex===e._entityIndex){let r=new t({entityIndex:this._entityIndex}),i=Pl(e._graphs,this._graphs);return i&&(r._graphs=i,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let i of this)r.add(e(i,this));return r}reduce(e,r){let i=this.readQuads(),n=r===void 0?i.next().value:r;for(let s of i)n=e(n,s,this);return n}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match(null,null,null,null,{matchSemantics:"lazy"})}toString(){return new le().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=jt(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}[Symbol.iterator](){return this.readQuads()}};function ge(t,e,r=0){let i=e[r];if(i&&!(i in t))return!1;let n=!1,s=0;for(let o in i?{[i]:t[i]}:t){let a=r===2?null:ge(t[o],e,r+1);a!==!1&&(n=n||Object.create(null),n[o]=a,s++)}return n&&(n[B]=s),n}function vl(t,e,r,i,n){let s={store:t,ids:[]},o=e&&t._termToNumericId(e),a=r&&t._termToNumericId(r),l=i&&t._termToNumericId(i),f,u,c,_,d;l&&(o||!a)?(f="objects",[u,c,_]=[l,o,a],d=[2,0,1]):!o&&a?(f="predicates",[u,c,_]=[a,l,o],d=[1,2,0]):(f="subjects",[u,c,_]=[o,a,l],d=[0,1,2]);let p=t._getGraphs(n),b=[];for(let y in p){let w=p[y][f],T=Number(y);for(let x in u?{[u]:w[u]}:w){let g=w[x];if(g){b[d[0]]=Number(x);for(let m in c?{[c]:g[c]}:g){let I=g[m];if(I){b[d[1]]=Number(m);for(let A in _?_ in I?{[_]:null}:{}:I)b[d[2]]=Number(A),s.ids.push(b[0],b[1],b[2],T)}}}}}return s}function*xp({store:t,ids:e},r){let i=t._entities,n,s,o,a,l,f,u,c;for(let _=r*4;_<e.length;_+=4)l!==e[_]&&(n=t._termFromId(i[l=e[_]])),f!==e[_+1]&&(s=t._termFromId(i[f=e[_+1]])),u!==e[_+2]&&(o=t._termFromId(i[u=e[_+2]])),c!==e[_+3]&&(a=t._termFromId(i[c=e[_+3]])),yield t._factory.quad(n,s,o,a)}function Nn(t="lazy"){if(t!=="lazy"&&t!=="snapshot"&&t!=="forwarded")throw new Error(`Unknown matchSemantics: ${t}`);if(t!=="lazy"&&(typeof WeakRef!="function"||typeof FinalizationRegistry!="function"))throw new Error("Non-lazy matchSemantics requires WeakRef and FinalizationRegistry support");return t}function Nl(t,e){let r=new Array(4);for(let i=0;i<4;i++){let n=t[i],s=e[i];if(n==null)r[i]=s;else if(s==null||D(n)===D(s))r[i]=n;else return!1}return r}var ke=class t extends Hr.Readable{constructor(e,r,i,n,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:i,object:n,graph:s,options:o});let a=this._semantics=Nn(o.matchSemantics);o.matchesNothing&&(this._matchesNothing=!0,this._filtered=new Pe({factory:e._factory,entityIndex:o.entityIndex})),a!=="lazy"&&(this._readers=null,this._subjectId=this._predicateId=this._objectId=this._graphId=void 0,this._matchesNothing||(this._observer=e._addObserver(this)))}_matchesPattern(e,r,i,n){let{subject:s,predicate:o,object:a,graph:l,n3Store:f}=this;return s&&e!==(this._subjectId||(this._subjectId=f._termToNumericId(s)))||o&&r!==(this._predicateId||(this._predicateId=f._termToNumericId(o)))||a&&i!==(this._objectId||(this._objectId=f._termToNumericId(a)))?!1:l==null||n===(this._graphId||(this._graphId=l===""||ae(l)?1:f._termToNumericId(l)))}_matchesQuad(e){let{subject:r,predicate:i,object:n,graph:s}=this;return!this._matchesNothing&&(r==null||D(r)===D(e.subject))&&(i==null||D(i)===D(e.predicate))&&(n==null||D(n)===D(e.object))&&(s==null||D(s)===D(e.graph))}_assertMatchesPattern(e){if(!this._matchesQuad(e))throw new Error("Quad does not match the forwarded view pattern")}_sourceIterator(){return this._filtered?this._filtered[Symbol.iterator]():this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}_freezeCurrentIterators(){this._readers&&(this._readers.snapshot=this._filtered?vl(this._filtered):vl(this.n3Store,this.subject,this.predicate,this.object,this.graph),this._readers=null)}_onParentMutation(e,r,i,n,s){if(this._matchesPattern(e,r,i,n)){if(this._freezeCurrentIterators(),this._semantics==="forwarded"){this._filtered&&(s?this._filtered._addQuad(e,r,i,n):this._filtered._removeQuad(e,r,i,n));return}this._filtered=this.filtered}}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:i,predicate:n,subject:s}=this;this._semantics!=="lazy"&&this._freezeCurrentIterators();let o=this._filtered=new Pe({factory:e._factory,entityIndex:this.options.entityIndex});this._semantics==="snapshot"&&this._detachObserver();let a,l,f;if(s&&!(a=o._termToNumericId(s))||n&&!(l=o._termToNumericId(n))||i&&!(f=o._termToNumericId(i)))return o;let u=e._getGraphs(r);for(let c in u){let _,d,p,b;(b=u[c])&&(!a&&l?(d=ge(b.predicates,[l,f,a]))&&(_=ge(b.subjects,[a,l,f]),p=ge(b.objects,[f,a,l])):f?(p=ge(b.objects,[f,a,l]))&&(_=ge(b.subjects,[a,l,f]),d=ge(b.predicates,[l,f,a])):(_=ge(b.subjects,[a,l,f]))&&(d=ge(b.predicates,[l,f,a]),p=ge(b.objects,[f,a,l])),_&&(o._graphs[c]={subjects:_,predicates:d,objects:p}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Pt]&&(this[Pt]=this[Symbol.iterator]());let r=this[Pt];for(;--e>=0;){let{done:i,value:n}=r.next();if(i){this.push(null);return}this.push(n)}}_destroy(e,r){this[Pt]&&(this[Pt].return(),this[Pt]=null),r(e)}_detachObserver(){this._observer&&(this.n3Store._removeObserver(this._observer),this._observer=null)}_detach(){return this._filtered=this.filtered,this._detachObserver(),this._semantics==="lazy"&&(this._readers=null),this._semantics="snapshot",this}addAll(e){if(this._semantics==="forwarded"){for(let r of e)this._assertMatchesPattern(r),this.n3Store.addQuad(r);return this}return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,i,n){if(this._semantics==="forwarded"){if(this._matchesNothing)throw new Error("Cannot delete from a conflicting forwarded view pattern");let s=Nl([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]);if(!s)throw new Error("Deletion pattern does not match the forwarded view pattern");return this.n3Store.deleteMatches(...s),this}return this.filtered.deleteMatches(e,r,i,n)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,i,n,s){return this.filtered.every(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}filter(e){return this.filtered.filter(this._semantics==="forwarded"?r=>e(r,this):e)}forEach(e,r,i,n,s){return this.filtered.forEach(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}import(e){if(this._semantics!=="forwarded")return this.filtered.import(e);let r=this;function i(n){try{r._assertMatchesPattern(n),r.n3Store.addQuad(n)}catch(s){e.removeListener("data",i),typeof e.destroy=="function"?e.destroy(s):e.emit("error",s)}}return e.on("data",i),e}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(this._semantics==="forwarded"?r=>e(r,this):e)}some(e,r,i,n,s){return this.filtered.some(this._semantics==="forwarded"?o=>e(o,this):e,r,i,n,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._semantics!=="lazy"?Hr.Readable.from(this[Symbol.iterator]()):this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph,{matchSemantics:"lazy"})}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph,{matchSemantics:"lazy"}).addAll(e)}toArray(){return this._semantics!=="lazy"?[...this]:this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(this._semantics==="forwarded"?(i,n)=>e(i,n,this):e,r)}toString(){return new le().quadsToString(this)}add(e){return this._semantics==="forwarded"?(this._assertMatchesPattern(e),this.n3Store.addQuad(e),this):this.filtered.add(e)}delete(e){return this._semantics==="forwarded"?(this._assertMatchesPattern(e),this.n3Store.removeQuad(e),this):this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,i,n,s=null){let o=s&&s.matchSemantics;if(s&&o!==void 0&&(Nn(o),o!==this._semantics))throw new Error(`Cannot override matchSemantics on a view: inherited "${this._semantics}", received "${o}"`);if(this._semantics!=="forwarded")return new t(this.filtered,e,r,i,n,{entityIndex:this.options.entityIndex,matchSemantics:this._semantics});let a=!this._matchesNothing&&Nl([this.subject,this.predicate,this.object,this.graph],[e,r,i,n]),[l,f,u,c]=a||[null,null,null,null];return new t(this.n3Store,l,f,u,c,{entityIndex:this.options.entityIndex,matchSemantics:"forwarded",matchesNothing:!a})}[Symbol.iterator](){return this._semantics==="lazy"?this._sourceIterator():this._iterateStable()}*_iterateStable(){let e=this._readers||(this._readers={count:0,snapshot:null}),r=this._sourceIterator(),i=0;e.count++;try{for(;!e.snapshot;){let{value:n,done:s}=r.next();if(e.snapshot||s)break;i++,yield n}e.snapshot&&(yield*te(xp(e.snapshot,i)))}finally{r.return(),--e.count===0&&(e.snapshot=null,this._readers===e&&(this._readers=null))}}};var Xt=class{dataset(e){return new Pe(e)}};function Bl(t){let e=[];for(let{subject:r,object:i}of t.match(null,Y.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,Y.defaultGraph())){let n=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,i)];e.push({premise:n,conclusion:s})}return e}var Jt=class{constructor(e,r={}){this._store=e,this._maxDerivations=r.maxDerivations===void 0?1/0:r.maxDerivations,this._maxPremiseDepth=r.maxPremiseDepth===void 0?1/0:r.maxPremiseDepth}_add(e,r,i,n,s,o){let a=this._store;if(a._observers){if(!a._addQuad(e,r,i,this._graphId))return}else{if(!a._addToIndex(n.subjects,e,r,i))return;a._addToIndex(n.predicates,r,i,e),a._addToIndex(n.objects,i,e,r)}if(++this._derivations>this._maxDerivations)throw new Error(`Reasoning exceeded the maximum of ${this._maxDerivations} derivations`);o(s)}_emit(e,r,i){let n=e.conclusion;for(let s=0;s<n.length;s++){let o=n[s];this._add(o.subject.value,o.predicate.value,o.object.value,r,o,i)}}_evaluatePremise(e,r,i,n=0){let s,o,[a,l,f]=e.premise[n].value,u=r[e.premise[n].content],c=n===e.premise.length-1;if(!(s=a.value)){for(s in u)o=u[s],a.value=Number(s),this._evaluateLevel1(e,r,i,n,c,l,f,o);a.value=null}else(o=u[s])&&this._evaluateLevel1(e,r,i,n,c,l,f,o)}_evaluateLevel1(e,r,i,n,s,o,a,l){let f,u;if(!(f=o.value)){for(f in l)u=l[f],o.value=Number(f),this._evaluateLevel2(e,r,i,n,s,a,u);o.value=null}else(u=l[f])&&this._evaluateLevel2(e,r,i,n,s,a,u)}_evaluateLevel2(e,r,i,n,s,o,a){let l;if(!(l=o.value)){for(l in a)o.value=Number(l),s?this._emit(e,r,i):this._evaluatePremise(e,r,i,n+1);o.value=null}else s?this._emit(e,r,i):this._evaluatePremise(e,r,i,n+1)}_evaluateRules(e,r,i){for(let n=0;n<e.length;n++)this._evaluatePremise(e[n],r,i)}_reasonGraphNaive(e,r){let i=[];function n(a){a.next&&a.next.forEach(l=>{i.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{for(let l=0;l<a.length;l++){let f=a[l];this._add(f.subject.value,f.predicate.value,f.object.value,r,f,n)}};this._evaluateRules(e,r,n);let o;for(;(o=i.pop())!==void 0;){let[a,l,f,u]=o,c=u.basePremise.subject.value;c||(u.basePremise.subject.value=a);let _=u.basePremise.predicate.value;_||(u.basePremise.predicate.value=l);let d=u.basePremise.object.value;d||(u.basePremise.object.value=f),u.premise.length===0?s(u.conclusion):this._evaluatePremise(u,r,n),c||(u.basePremise.subject.value=null),_||(u.basePremise.predicate.value=null),d||(u.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let i={},n=o=>o.termType==="Variable"?i[o.value]=i[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:n(o.subject),predicate:n(o.predicate),object:n(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(i)}}reason(e){this._derivations=0,Array.isArray(e)||(e=Bl(e)),e=e.map(i=>this._createRule(i));for(let i of e)if(i.premise.length>this._maxPremiseDepth)throw new Error(`Reasoning rule exceeds the maximum premise depth of ${this._maxPremiseDepth}`);for(let i of e)for(let n of e)for(let s=0;s<n.premise.length;s++){let o=n.premise[s];for(let a of i.conclusion){if(Pn(o.subject,a.subject)&&Pn(o.predicate,a.predicate)&&Pn(o.object,a.object)){let l=new Set,f=[];o.subject.value=o.subject.value||1,o.object.value=o.object.value||1,o.predicate.value=o.predicate.value||1;for(let u=0;u<n.premise.length;u++)u!==s&&f.push(Ll(n.premise[u],l));(a.next=a.next||[]).push({premise:f,conclusion:n.conclusion,basePremise:o})}for(let l=0;l<n.variables.length;l++)n.variables[l].value=null}}for(let i of e){let n=new Set;i.premise=i.premise.map(s=>Ll(s,n))}let r=this._store._getGraphs();try{for(let i in r)this._graphId=Number(i),this._reasonGraphNaive(e,r[i])}finally{this._store._size=null}}};function Ll({subject:t,predicate:e,object:r},i){let n=t.value||i.has(t)||(i.add(t),!1),s=e.value||i.has(e)||(i.add(e),!1),o=r.value||i.has(r)||(i.add(r),!1);return!n&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function Pn(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var Fl=ir(Vr());var er=class extends Fl.Transform{constructor(e){super({decodeStrings:!0,readableObjectMode:!0});let r=new Se(e),i,n,s={onQuad:(o,a)=>{o&&this.emit("error",o)||a&&this.push(a)},onPrefix:(o,a)=>{this.emit("prefix",o,a)}};e&&e.comments&&(s.onComment=o=>{this.emit("comment",o)}),r.parse({on:(o,a)=>{switch(o){case"data":i=a;break;case"end":n=a;break}}},s),this._transform=(o,a,l)=>{i(o),l()},this._flush=o=>{n(),o()}}import(e){return e.on("error",r=>{this.emit("error",r)}),typeof e.pipe=="function"?e.pipe(this):(e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()})),this}};var Cl=ir(Vr());var Ep=16*1024,Sp=20,tr=class extends Cl.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0}),this._buffer="",this._flushTimer=null,this._flushDelay=e&&e.flushDelay!==void 0?e.flushDelay:Sp;let r=this._writer=new le({write:(s,o,a)=>{this._buffer+=s,this._buffer.length>=Ep?this._pushBuffer():this._flushTimer===null&&this._armFlushTimer(),a&&a()},end:s=>{this._pushBuffer(),this.push(null),s&&s()}},e),i=null,n=s=>{let o=i;i=null,s&&this._pushBuffer(),o(s)};this._transform=(s,o,a)=>{i=a,r.addQuad(s,n)},this._flush=s=>{r.end(s)}}_pushBuffer(){this._clearFlushTimer(),this._buffer!==""&&(this.push(this._buffer),this._buffer="")}_armFlushTimer(){this._flushTimer=setTimeout(()=>{this._flushTimer=null,this._pushBuffer()},this._flushDelay),this._flushTimer.unref&&this._flushTimer.unref()}_clearFlushTimer(){this._flushTimer!==null&&(clearTimeout(this._flushTimer),this._flushTimer=null)}_destroy(e,r){this._clearFlushTimer(),super._destroy(e,r)}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this._pushBuffer(),this.emit("error",r)}),e.on("prefix",(r,i)=>{this._writer.addPrefix(r,i)}),this}};var rg={Lexer:Ge,Parser:Se,Writer:le,Store:Pe,StoreFactory:Xt,EntityIndex:Zt,StreamParser:er,StreamWriter:tr,Util:ui,Reasoner:Jt,BaseIRI:Qe,DataFactory:Y,Term:Q,NamedNode:ct,Literal:Ee,BlankNode:Ft,Variable:Ct,DefaultGraph:Ot,Quad:Ce,Triple:Ce,termFromId:Fe,termToId:D};export{Qe as BaseIRI,Ft as BlankNode,Y as DataFactory,Ot as DefaultGraph,Zt as EntityIndex,Ge as Lexer,Ee as Literal,ct as NamedNode,Se as Parser,Ce as Quad,Jt as Reasoner,Pe as Store,Xt as StoreFactory,er as StreamParser,tr as StreamWriter,Q as Term,Ce as Triple,ui as Util,Ct as Variable,le as Writer,rg as default,Bl as getRulesFromDataset,Fe as termFromId,D as termToId};
24
24
  /*! Bundled license information:
25
25
 
26
26
  ieee754/index.js: