@muze-nl/jsfs-solid 0.2.0 → 0.2.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,5 +1,5 @@
1
- (()=>{var rf=Object.create;var Fn=Object.defineProperty;var nf=Object.getOwnPropertyDescriptor;var sf=Object.getOwnPropertyNames;var of=Object.getPrototypeOf,af=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cn=(t,e)=>{for(var r in e)Fn(t,r,{get:e[r],enumerable:!0})},lf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sf(e))!af.call(t,i)&&i!==r&&Fn(t,i,{get:()=>e[i],enumerable:!(n=nf(e,i))||n.enumerable});return t};var Cr=(t,e,r)=>(r=t!=null?rf(of(t)):{},lf(e||!t||!t.__esModule?Fn(r,"default",{value:t,enumerable:!0}):r,t));var Xs=T(Wr=>{"use strict";Wr.byteLength=Cf;Wr.toByteArray=Mf;Wr.fromByteArray=qf;var de=[],re=[],Ff=typeof Uint8Array<"u"?Uint8Array:Array,Kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(rt=0,Ys=Kn.length;rt<Ys;++rt)de[rt]=Kn[rt],re[Kn.charCodeAt(rt)]=rt;var rt,Ys;re[45]=62;re[95]=63;function Zs(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 n=r===e?0:4-r%4;return[r,n]}function Cf(t){var e=Zs(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Df(t,e,r){return(e+r)*3/4-r}function Mf(t){var e,r=Zs(t),n=r[0],i=r[1],s=new Ff(Df(t,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=re[t.charCodeAt(l)]<<18|re[t.charCodeAt(l+1)]<<12|re[t.charCodeAt(l+2)]<<6|re[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=re[t.charCodeAt(l)]<<2|re[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=re[t.charCodeAt(l)]<<10|re[t.charCodeAt(l+1)]<<4|re[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Uf(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function $f(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(Uf(n));return i.join("")}function qf(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push($f(t,o,o+s>a?a:o+s));return n===1?(e=t[r-1],i.push(de[e>>2]+de[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(de[e>>10]+de[e>>4&63]+de[e<<2&63]+"=")),i.join("")}});var eo=T(Vn=>{Vn.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,u=l>>1,f=-7,c=r?i-1:0,d=r?-1:1,h=t[e+c];for(c+=d,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=s*256+t[e+c],c+=d,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+c],c+=d,f-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(h?-1:1)*o*Math.pow(2,s-n)};Vn.write=function(t,e,r,n,i,s){var o,a,l,u=s*8-i-1,f=(1<<u)-1,c=f>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,y=n?1:-1,_=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=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?e+=d/l:e+=d*Math.pow(2,1-c),e*l>=2&&(o++,l/=2),o+c>=f?(a=0,o=f):o+c>=1?(a=(e*l-1)*Math.pow(2,i),o=o+c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+h]=a&255,h+=y,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[r+h]=o&255,h+=y,o/=256,u-=8);t[r+h-y]|=_*128}});var pe=T(Lt=>{"use strict";var Jn=Xs(),kt=eo(),to=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Lt.Buffer=p;Lt.SlowBuffer=Kf;Lt.INSPECT_MAX_BYTES=50;var Gr=2147483647;Lt.kMaxLength=Gr;p.TYPED_ARRAY_SUPPORT=Wf();!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Wf(){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{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function ve(t){if(t>Gr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,p.prototype),e}function p(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 ei(t)}return so(t,e,r)}p.poolSize=8192;function so(t,e,r){if(typeof t=="string")return zf(t,e);if(ArrayBuffer.isView(t))return Hf(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(he(t,ArrayBuffer)||t&&he(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(t,SharedArrayBuffer)||t&&he(t.buffer,SharedArrayBuffer)))return Zn(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return p.from(n,e,r);let i=Qf(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return p.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)}p.from=function(t,e,r){return so(t,e,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function oo(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 Gf(t,e,r){return oo(t),t<=0?ve(t):e!==void 0?typeof r=="string"?ve(t).fill(e,r):ve(t).fill(e):ve(t)}p.alloc=function(t,e,r){return Gf(t,e,r)};function ei(t){return oo(t),ve(t<0?0:ti(t)|0)}p.allocUnsafe=function(t){return ei(t)};p.allocUnsafeSlow=function(t){return ei(t)};function zf(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ao(t,e)|0,n=ve(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Yn(t){let e=t.length<0?0:ti(t.length)|0,r=ve(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Hf(t){if(he(t,Uint8Array)){let e=new Uint8Array(t);return Zn(e.buffer,e.byteOffset,e.byteLength)}return Yn(t)}function Zn(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 n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,p.prototype),n}function Qf(t){if(p.isBuffer(t)){let e=ti(t.length)|0,r=ve(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ni(t.length)?ve(0):Yn(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Yn(t.data)}function ti(t){if(t>=Gr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Gr.toString(16)+" bytes");return t|0}function Kf(t){return+t!=t&&(t=0),p.alloc(+t)}p.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==p.prototype};p.compare=function(e,r){if(he(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),he(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),!p.isBuffer(e)||!p.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==r[s]){n=e[s],i=r[s];break}return n<i?-1:i<n?1:0};p.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}};p.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=p.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){let o=e[n];if(he(o,Uint8Array))s+o.length>i.length?(p.isBuffer(o)||(o=p.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(p.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function ao(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||he(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,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Xn(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return bo(t).length;default:if(i)return n?-1:Xn(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=ao;function Vf(t,e,r){let n=!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 sc(this,e,r);case"utf8":case"utf-8":return uo(this,e,r);case"ascii":return nc(this,e,r);case"latin1":case"binary":return ic(this,e,r);case"base64":return tc(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oc(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function nt(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}p.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)nt(this,r,r+1);return this};p.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)nt(this,r,r+3),nt(this,r+1,r+2);return this};p.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)nt(this,r,r+7),nt(this,r+1,r+6),nt(this,r+2,r+5),nt(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?uo(this,0,e):Vf.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0};p.prototype.inspect=function(){let e="",r=Lt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};to&&(p.prototype[to]=p.prototype.inspect);p.prototype.compare=function(e,r,n,i,s){if(he(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.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),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,l=Math.min(o,a),u=this.slice(i,s),f=e.slice(r,n);for(let c=0;c<l;++c)if(u[c]!==f[c]){o=u[c],a=f[c];break}return o<a?-1:a<o?1:0};function lo(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ni(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),p.isBuffer(e))return e.length===0?-1:ro(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ro(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ro(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(f,c){return s===1?f[c]:f.readUInt16BE(c*s)}let u;if(i){let f=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===a)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let f=!0;for(let c=0;c<a;c++)if(l(t,u+c)!==l(e,c)){f=!1;break}if(f)return u}return-1}p.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};p.prototype.indexOf=function(e,r,n){return lo(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return lo(this,e,r,n,!1)};function Jf(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let a=parseInt(e.substr(o*2,2),16);if(ni(a))return o;t[r+o]=a}return o}function Yf(t,e,r,n){return zr(Xn(e,t.length-r),t,r,n)}function Zf(t,e,r,n){return zr(fc(e),t,r,n)}function Xf(t,e,r,n){return zr(bo(e),t,r,n)}function ec(t,e,r,n){return zr(cc(e,t.length-r),t,r,n)}p.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return Jf(this,e,r,n);case"utf8":case"utf-8":return Yf(this,e,r,n);case"ascii":case"latin1":case"binary":return Zf(this,e,r,n);case"base64":return Xf(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ec(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function tc(t,e,r){return e===0&&r===t.length?Jn.fromByteArray(t):Jn.fromByteArray(t.slice(e,r))}function uo(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let s=t[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=r){let l,u,f,c;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[i+1],(l&192)===128&&(c=(s&31)<<6|l&63,c>127&&(o=c));break;case 3:l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(c=(s&15)<<12|(l&63)<<6|u&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:l=t[i+1],u=t[i+2],f=t[i+3],(l&192)===128&&(u&192)===128&&(f&192)===128&&(c=(s&15)<<18|(l&63)<<12|(u&63)<<6|f&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return rc(n)}var no=4096;function rc(t){let e=t.length;if(e<=no)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=no));return r}function nc(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function ic(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function sc(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=e;s<r;++s)i+=dc[t[s]];return i}function oc(t,e,r){let n=t.slice(e,r),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}p.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,p.prototype),i};function q(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")}p.prototype.readUintLE=p.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return i};p.prototype.readUintBE=p.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};p.prototype.readUint8=p.prototype.readUInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readBigUInt64LE=$e(function(e){e=e>>>0,Pt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&lr(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});p.prototype.readBigUInt64BE=$e(function(e){e=e>>>0,Pt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&lr(e,this.length-8);let i=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+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});p.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};p.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};p.prototype.readInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,r){e=e>>>0,r||q(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(e,r){e=e>>>0,r||q(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};p.prototype.readInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readBigInt64LE=$e(function(e){e=e>>>0,Pt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&lr(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});p.prototype.readBigInt64BE=$e(function(e){e=e>>>0,Pt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&lr(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});p.prototype.readFloatLE=function(e,r){return e=e>>>0,r||q(e,4,this.length),kt.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||q(e,4,this.length),kt.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||q(e,8,this.length),kt.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||q(e,8,this.length),kt.read(this,e,!1,52,8)};function Y(t,e,r,n,i,s){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Y(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o<n&&(s*=256);)this[r+o]=e/s&255;return r+n};p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Y(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};p.prototype.writeUint8=p.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,1,255,0),this[r]=e&255,r+1};p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(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};p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(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 fo(t,e,r,n,i){yo(e,n,i,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 co(t,e,r,n,i){yo(e,n,i,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}p.prototype.writeBigUInt64LE=$e(function(e,r=0){return fo(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=$e(function(e,r=0){return co(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Y(this,e,r,n,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s<n&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};p.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Y(this,e,r,n,l-1,-l)}let s=n-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+n};p.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};p.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(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};p.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(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};p.prototype.writeBigInt64LE=$e(function(e,r=0){return fo(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=$e(function(e,r=0){return co(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ho(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function po(t,e,r,n,i){return e=+e,r=r>>>0,i||ho(t,e,r,4,34028234663852886e22,-34028234663852886e22),kt.write(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return po(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return po(this,e,r,!1,n)};function _o(t,e,r,n,i){return e=+e,r=r>>>0,i||ho(t,e,r,8,17976931348623157e292,-17976931348623157e292),kt.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return _o(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return _o(this,e,r,!1,n)};p.prototype.copy=function(e,r,n,i){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),s};p.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{let o=p.isBuffer(e)?e:p.from(e,i),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=o[s%a]}return this};var jt={};function ri(t,e,r){jt[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(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}ri("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ri("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ri("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=io(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=io(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function io(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function ac(t,e,r){Pt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&lr(e,t.length-(r+1))}function yo(t,e,r,n,i,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 jt.ERR_OUT_OF_RANGE("value",a,t)}ac(n,i,s)}function Pt(t,e){if(typeof t!="number")throw new jt.ERR_INVALID_ARG_TYPE(e,"number",t)}function lr(t,e,r){throw Math.floor(t)!==t?(Pt(t,r),new jt.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new jt.ERR_BUFFER_OUT_OF_BOUNDS:new jt.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var lc=/[^+/0-9A-Za-z-_]/g;function uc(t){if(t=t.split("=")[0],t=t.trim().replace(lc,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Xn(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o<n;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=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 fc(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function cc(t,e){let r,n,i,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function bo(t){return Jn.toByteArray(uc(t))}function zr(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function he(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function ni(t){return t!==t}var dc=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e})();function $e(t){return typeof BigInt>"u"?hc:t}function hc(){throw new Error("BigInt not supported")}});var L=T((Kg,Lo)=>{"use strict";var li=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 n=0;n<e.length;n++)r+=` ${e[n].stack}
2
- `;super(r),this.name="AggregateError",this.errors=e}};Lo.exports={AggregateError:li,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 ui=T((Vg,Oo)=>{"use strict";Oo.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var z=T((Jg,Co)=>{"use strict";var{format:Lc,inspect:Vr}=ui(),{AggregateError:Oc}=L(),Bc=globalThis.AggregateError||Oc,Fc=Symbol("kIsNodeError"),Cc=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Dc=/^([A-Z][a-z0-9]*)+$/,Mc="__node_internal_",Jr={};function ut(t,e){if(!t)throw new Jr.ERR_INTERNAL_ASSERTION(e)}function Bo(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Uc(t,e,r){if(typeof e=="function")return ut(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return ut(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Lc(e,...r)}function G(t,e,r){r||(r=Error);class n extends r{constructor(...s){super(Uc(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[Fc]=!0,Jr[t]=n}function Fo(t){let e=Mc+t.name;return Object.defineProperty(t,"name",{value:e}),t}function $c(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Bc([e,t],e.message);return r.code=e.code,r}return t||e}var fi=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Jr.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};G("ERR_ASSERTION","%s",Error);G("ERR_INVALID_ARG_TYPE",(t,e,r)=>{ut(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],s=[],o=[];for(let l of e)ut(typeof l=="string","All expected entries have to be of type string"),Cc.includes(l)?i.push(l.toLowerCase()):Dc.test(l)?s.push(l):(ut(l!=="object",'The value "object" should be written as "Object"'),o.push(l));if(s.length>0){let l=i.indexOf("object");l!==-1&&(i.splice(i,l,1),s.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let l=i.pop();n+=`one of type ${i.join(", ")}, or ${l}`}}(s.length>0||o.length>0)&&(n+=" or ")}if(s.length>0){switch(s.length){case 1:n+=`an instance of ${s[0]}`;break;case 2:n+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();n+=`an instance of ${s.join(", ")}, or ${l}`}}o.length>0&&(n+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(n+="an "),n+=`${o[0]}`;break;case 2:n+=`one of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();n+=`one of ${o.join(", ")}, or ${l}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let l=Vr(r,{depth:-1});n+=`. Received ${l}`}}else{let l=Vr(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),n+=`. Received type ${typeof r} (${l})`}return n},TypeError);G("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=Vr(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);G("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);G("ERR_MISSING_ARGS",(...t)=>{ut(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);G("ERR_OUT_OF_RANGE",(t,e,r)=>{ut(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=Bo(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=Bo(n)),n+="n"}else n=Vr(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);G("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);G("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);G("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);G("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);G("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);G("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);G("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);G("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);G("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);G("ERR_STREAM_WRITE_AFTER_END","write after end",Error);G("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Co.exports={AbortError:fi,aggregateTwoErrors:Fo($c),hideStackFrames:Fo,codes:Jr}});var Dt=T((Yg,Yr)=>{"use strict";var{AbortController:Do,AbortSignal:qc}=typeof self<"u"?self:typeof window<"u"?window:void 0;Yr.exports=Do;Yr.exports.AbortSignal=qc;Yr.exports.default=Do});var yr=T((Zg,ci)=>{"use strict";var Mt=typeof Reflect=="object"?Reflect:null,Mo=Mt&&typeof Mt.apply=="function"?Mt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Zr;Mt&&typeof Mt.ownKeys=="function"?Zr=Mt.ownKeys:Object.getOwnPropertySymbols?Zr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Zr=function(e){return Object.getOwnPropertyNames(e)};function Wc(t){console&&console.warn&&console.warn(t)}var $o=Number.isNaN||function(e){return e!==e};function N(){N.init.call(this)}ci.exports=N;ci.exports.once=Qc;N.EventEmitter=N;N.prototype._events=void 0;N.prototype._eventsCount=0;N.prototype._maxListeners=void 0;var Uo=10;function Xr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(N,"defaultMaxListeners",{enumerable:!0,get:function(){return Uo},set:function(t){if(typeof t!="number"||t<0||$o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Uo=t}});N.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};N.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||$o(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 qo(t){return t._maxListeners===void 0?N.defaultMaxListeners:t._maxListeners}N.prototype.getMaxListeners=function(){return qo(this)};N.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){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")Mo(l,this,r);else for(var u=l.length,f=Qo(l,u),n=0;n<u;++n)Mo(f[n],this,r);return!0};function Wo(t,e,r,n){var i,s,o;if(Xr(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]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=qo(t),i>0&&o.length>i&&!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,Wc(a)}return t}N.prototype.addListener=function(e,r){return Wo(this,e,r,!1)};N.prototype.on=N.prototype.addListener;N.prototype.prependListener=function(e,r){return Wo(this,e,r,!0)};function Gc(){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 Go(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Gc.bind(n);return i.listener=r,n.wrapFn=i,i}N.prototype.once=function(e,r){return Xr(r),this.on(e,Go(this,e,r)),this};N.prototype.prependOnceListener=function(e,r){return Xr(r),this.prependListener(e,Go(this,e,r)),this};N.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xr(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():zc(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};N.prototype.off=N.prototype.removeListener;N.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function zo(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Hc(i):Qo(i,i.length)}N.prototype.listeners=function(e){return zo(this,e,!0)};N.prototype.rawListeners=function(e){return zo(this,e,!1)};N.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ho.call(t,e)};N.prototype.listenerCount=Ho;function Ho(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}N.prototype.eventNames=function(){return this._eventsCount>0?Zr(this._events):[]};function Qo(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function zc(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Hc(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Qc(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Ko(t,e,s,{once:!0}),e!=="error"&&Kc(t,i,{once:!0})})}function Kc(t,e,r){typeof t.on=="function"&&Ko(t,"error",e,r)}function Ko(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var K=T((Xg,hi)=>{"use strict";var Vc=pe(),{format:Jc,inspect:Yc}=ui(),{codes:{ERR_INVALID_ARG_TYPE:di}}=z(),{kResistStopPropagation:Zc,AggregateError:Xc,SymbolDispose:ed}=L(),td=globalThis.AbortSignal||Dt().AbortSignal,rd=globalThis.AbortController||Dt().AbortController,nd=Object.getPrototypeOf(async function(){}).constructor,Vo=globalThis.Blob||Vc.Blob,id=typeof Vo<"u"?function(e){return e instanceof Vo}:function(e){return!1},Jo=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new di(e,"AbortSignal",t)},sd=(t,e)=>{if(typeof t!="function")throw new di(e,"Function",t)};hi.exports={AggregateError:Xc,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((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format:Jc,inspect:Yc,types:{isAsyncFunction(t){return t instanceof nd},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:id,deprecate(t,e){return t},addAbortListener:yr().addAbortListener||function(e,r){if(e===void 0)throw new di("signal","AbortSignal",e);Jo(e,"signal"),sd(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Zc]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[ed](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:td.any||function(e){if(e.length===1)return e[0];let r=new rd,n=()=>r.abort();return e.forEach(i=>{Jo(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};hi.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var $t=T((em,oa)=>{"use strict";var{ArrayIsArray:_i,ArrayPrototypeIncludes:ea,ArrayPrototypeJoin:ta,ArrayPrototypeMap:od,NumberIsInteger:yi,NumberIsNaN:ad,NumberMAX_SAFE_INTEGER:ld,NumberMIN_SAFE_INTEGER:ud,NumberParseInt:fd,ObjectPrototypeHasOwnProperty:cd,RegExpPrototypeExec:ra,String:dd,StringPrototypeToUpperCase:hd,StringPrototypeTrim:pd}=L(),{hideStackFrames:ne,codes:{ERR_SOCKET_BAD_PORT:_d,ERR_INVALID_ARG_TYPE:H,ERR_INVALID_ARG_VALUE:Ut,ERR_OUT_OF_RANGE:ft,ERR_UNKNOWN_SIGNAL:Yo}}=z(),{normalizeEncoding:yd}=K(),{isAsyncFunction:bd,isArrayBufferView:gd}=K().types,Zo={};function md(t){return t===(t|0)}function wd(t){return t===t>>>0}var xd=/^[0-7]+$/,Sd="must be a 32-bit unsigned integer or an octal string";function Ed(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(ra(xd,t)===null)throw new Ut(e,t,Sd);t=fd(t,8)}return na(t,e),t}var Rd=ne((t,e,r=ud,n=ld)=>{if(typeof t!="number")throw new H(e,"number",t);if(!yi(t))throw new ft(e,"an integer",t);if(t<r||t>n)throw new ft(e,`>= ${r} && <= ${n}`,t)}),Id=ne((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new H(e,"number",t);if(!yi(t))throw new ft(e,"an integer",t);if(t<r||t>n)throw new ft(e,`>= ${r} && <= ${n}`,t)}),na=ne((t,e,r=!1)=>{if(typeof t!="number")throw new H(e,"number",t);if(!yi(t))throw new ft(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new ft(e,`>= ${n} && <= ${i}`,t)});function bi(t,e){if(typeof t!="string")throw new H(e,"string",t)}function Ad(t,e,r=void 0,n){if(typeof t!="number")throw new H(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&ad(t))throw new ft(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Td=ne((t,e,r)=>{if(!ea(r,t)){let i="must be one of: "+ta(od(r,s=>typeof s=="string"?`'${s}'`:dd(s)),", ");throw new Ut(e,t,i)}});function ia(t,e){if(typeof t!="boolean")throw new H(e,"boolean",t)}function pi(t,e,r){return t==null||!cd(t,e)?r:t[e]}var vd=ne((t,e,r=null)=>{let n=pi(r,"allowArray",!1),i=pi(r,"allowFunction",!1);if(!pi(r,"nullable",!1)&&t===null||!n&&_i(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new H(e,"Object",t)}),Nd=ne((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new H(e,"a dictionary",t)}),en=ne((t,e,r=0)=>{if(!_i(t))throw new H(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Ut(e,t,n)}});function jd(t,e){en(t,e);for(let r=0;r<t.length;r++)bi(t[r],`${e}[${r}]`)}function kd(t,e){en(t,e);for(let r=0;r<t.length;r++)ia(t[r],`${e}[${r}]`)}function Pd(t,e){en(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new H(i,"AbortSignal",n);sa(n,i)}}function Ld(t,e="signal"){if(bi(t,e),Zo[t]===void 0)throw Zo[hd(t)]!==void 0?new Yo(t+" (signals must use all capital letters)"):new Yo(t)}var Od=ne((t,e="buffer")=>{if(!gd(t))throw new H(e,["Buffer","TypedArray","DataView"],t)});function Bd(t,e){let r=yd(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Ut("encoding",e,`is invalid for data of length ${n}`)}function Fd(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&pd(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new _d(e,t,r);return t|0}var sa=ne((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new H(e,"AbortSignal",t)}),Cd=ne((t,e)=>{if(typeof t!="function")throw new H(e,"Function",t)}),Dd=ne((t,e)=>{if(typeof t!="function"||bd(t))throw new H(e,"Function",t)}),Md=ne((t,e)=>{if(t!==void 0)throw new H(e,"undefined",t)});function Ud(t,e,r){if(!ea(r,t))throw new H(e,`('${ta(r,"|")}')`,t)}var $d=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Xo(t,e){if(typeof t>"u"||!ra($d,t))throw new Ut(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function qd(t){if(typeof t=="string")return Xo(t,"hints"),t;if(_i(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];Xo(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Ut("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}oa.exports={isInt32:md,isUint32:wd,parseFileMode:Ed,validateArray:en,validateStringArray:jd,validateBooleanArray:kd,validateAbortSignalArray:Pd,validateBoolean:ia,validateBuffer:Od,validateDictionary:Nd,validateEncoding:Bd,validateFunction:Cd,validateInt32:Id,validateInteger:Rd,validateNumber:Ad,validateObject:vd,validateOneOf:Td,validatePlainFunction:Dd,validatePort:Fd,validateSignalName:Ld,validateString:bi,validateUint32:na,validateUndefined:Md,validateUnion:Ud,validateAbortSignal:sa,validateLinkHeaderValue:qd}});var He=T((tm,fa)=>{var F=fa.exports={},ye,be;function gi(){throw new Error("setTimeout has not been defined")}function mi(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ye=setTimeout:ye=gi}catch{ye=gi}try{typeof clearTimeout=="function"?be=clearTimeout:be=mi}catch{be=mi}})();function aa(t){if(ye===setTimeout)return setTimeout(t,0);if((ye===gi||!ye)&&setTimeout)return ye=setTimeout,setTimeout(t,0);try{return ye(t,0)}catch{try{return ye.call(null,t,0)}catch{return ye.call(this,t,0)}}}function Wd(t){if(be===clearTimeout)return clearTimeout(t);if((be===mi||!be)&&clearTimeout)return be=clearTimeout,clearTimeout(t);try{return be(t)}catch{try{return be.call(null,t)}catch{return be.call(this,t)}}}var je=[],qt=!1,ct,tn=-1;function Gd(){!qt||!ct||(qt=!1,ct.length?je=ct.concat(je):tn=-1,je.length&&la())}function la(){if(!qt){var t=aa(Gd);qt=!0;for(var e=je.length;e;){for(ct=je,je=[];++tn<e;)ct&&ct[tn].run();tn=-1,e=je.length}ct=null,qt=!1,Wd(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];je.push(new ua(t,e)),je.length===1&&!qt&&aa(la)};function ua(t,e){this.fun=t,this.array=e}ua.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function ke(){}F.on=ke;F.addListener=ke;F.once=ke;F.off=ke;F.removeListener=ke;F.removeAllListeners=ke;F.emit=ke;F.prependListener=ke;F.prependOnceListener=ke;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 me=T((rm,Ia)=>{"use strict";var{SymbolAsyncIterator:ca,SymbolIterator:da,SymbolFor:dt}=L(),ha=dt("nodejs.stream.destroyed"),pa=dt("nodejs.stream.errored"),wi=dt("nodejs.stream.readable"),xi=dt("nodejs.stream.writable"),_a=dt("nodejs.stream.disturbed"),zd=dt("nodejs.webstream.isClosedPromise"),Hd=dt("nodejs.webstream.controllerErrorFunction");function rn(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 nn(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 Qd(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function ge(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function ya(t){return!!(t&&!ge(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function ba(t){return!!(t&&!ge(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function ga(t){return!!(t&&!ge(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Kd(t){return ya(t)||ba(t)||ga(t)}function Vd(t,e){return t==null?!1:e===!0?typeof t[ca]=="function":e===!1?typeof t[da]=="function":typeof t[ca]=="function"||typeof t[da]=="function"}function sn(t){if(!ge(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[ha]||n!=null&&n.destroyed)}function ma(t){if(!nn(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Jd(t,e){if(!nn(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Yd(t){if(!rn(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function wa(t,e){if(!rn(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function xa(t){return t&&t[wi]!=null?t[wi]:typeof t?.readable!="boolean"?null:sn(t)?!1:rn(t)&&t.readable&&!wa(t)}function Sa(t){return t&&t[xi]!=null?t[xi]:typeof t?.writable!="boolean"?null:sn(t)?!1:nn(t)&&t.writable&&!ma(t)}function Zd(t,e){return ge(t)?sn(t)?!0:!(e?.readable!==!1&&xa(t)||e?.writable!==!1&&Sa(t)):null}function Xd(t){var e,r;return ge(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 eh(t){var e,r;return ge(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 th(t){if(!ge(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Ea(t)?t._closed:null}function Ea(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Ra(t){return typeof t._sent100=="boolean"&&Ea(t)}function rh(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 nh(t){if(!ge(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Ra(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function ih(t){var e;return!!(t&&((e=t[_a])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function sh(t){var e,r,n,i,s,o,a,l,u,f;return!!(t&&((e=(r=(n=(i=(s=(o=t[pa])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(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:!((f=t._writableState)===null||f===void 0)&&f.errored))}Ia.exports={isDestroyed:sn,kIsDestroyed:ha,isDisturbed:ih,kIsDisturbed:_a,isErrored:sh,kIsErrored:pa,isReadable:xa,kIsReadable:wi,kIsClosedPromise:zd,kControllerErrorFunction:Hd,kIsWritable:xi,isClosed:th,isDuplexNodeStream:Qd,isFinished:Zd,isIterable:Vd,isReadableNodeStream:rn,isReadableStream:ya,isReadableEnded:Yd,isReadableFinished:wa,isReadableErrored:eh,isNodeStream:ge,isWebStream:Kd,isWritable:Sa,isWritableNodeStream:nn,isWritableStream:ba,isWritableEnded:ma,isWritableFinished:Jd,isWritableErrored:Xd,isServerRequest:rh,isServerResponse:Ra,willEmitClose:nh,isTransformStream:ga}});var Pe=T((nm,Ai)=>{"use strict";var Qe=He(),{AbortError:Oa,codes:oh}=z(),{ERR_INVALID_ARG_TYPE:ah,ERR_STREAM_PREMATURE_CLOSE:Aa}=oh,{kEmptyObject:Ei,once:Ri}=K(),{validateAbortSignal:lh,validateFunction:uh,validateObject:fh,validateBoolean:ch}=$t(),{Promise:dh,PromisePrototypeThen:hh,SymbolDispose:Ba}=L(),{isClosed:ph,isReadable:Ta,isReadableNodeStream:Si,isReadableStream:_h,isReadableFinished:va,isReadableErrored:Na,isWritable:ja,isWritableNodeStream:ka,isWritableStream:yh,isWritableFinished:Pa,isWritableErrored:La,isNodeStream:bh,willEmitClose:gh,kIsClosedPromise:mh}=me(),Wt;function wh(t){return t.setHeader&&typeof t.abort=="function"}var Ii=()=>{};function Fa(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Ei):e==null?e=Ei:fh(e,"options"),uh(r,"callback"),lh(e.signal,"options.signal"),r=Ri(r),_h(t)||yh(t))return xh(t,e,r);if(!bh(t))throw new ah("stream",["ReadableStream","WritableStream","Stream"],t);let s=(n=e.readable)!==null&&n!==void 0?n:Si(t),o=(i=e.writable)!==null&&i!==void 0?i:ka(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=gh(t)&&Si(t)===s&&ka(t)===o,c=Pa(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=va(t,!1),y=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},_=A=>{r.call(t,A)},x=ph(t),b=()=>{x=!0;let A=La(t)||Na(t);if(A&&typeof A!="boolean")return r.call(t,A);if(s&&!h&&Si(t,!0)&&!va(t,!1))return r.call(t,new Aa);if(o&&!c&&!Pa(t,!1))return r.call(t,new Aa);r.call(t)},g=()=>{x=!0;let A=La(t)||Na(t);if(A&&typeof A!="boolean")return r.call(t,A);r.call(t)},S=()=>{t.req.on("finish",d)};wh(t)?(t.on("complete",d),f||t.on("abort",b),t.req?S():t.on("request",S)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",y),t.on("finish",d),e.error!==!1&&t.on("error",_),t.on("close",b),x?Qe.nextTick(b):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Qe.nextTick(g):(!s&&(!f||Ta(t))&&(c||ja(t)===!1)||!o&&(!f||ja(t))&&(h||Ta(t)===!1)||l&&t.req&&t.aborted)&&Qe.nextTick(g);let m=()=>{r=Ii,t.removeListener("aborted",b),t.removeListener("complete",d),t.removeListener("abort",b),t.removeListener("request",S),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",y),t.removeListener("error",_),t.removeListener("close",b)};if(e.signal&&!x){let A=()=>{let Ae=r;m(),Ae.call(t,new Oa(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Qe.nextTick(A);else{Wt=Wt||K().addAbortListener;let Ae=Wt(e.signal,A),D=r;r=Ri((...St)=>{Ae[Ba](),D.apply(t,St)})}}return m}function xh(t,e,r){let n=!1,i=Ii;if(e.signal)if(i=()=>{n=!0,r.call(t,new Oa(void 0,{cause:e.signal.reason}))},e.signal.aborted)Qe.nextTick(i);else{Wt=Wt||K().addAbortListener;let o=Wt(e.signal,i),a=r;r=Ri((...l)=>{o[Ba](),a.apply(t,l)})}let s=(...o)=>{n||Qe.nextTick(()=>r.apply(t,o))};return hh(t[mh].promise,s,s),Ii}function Sh(t,e){var r;let n=!1;return e===null&&(e=Ei),(r=e)!==null&&r!==void 0&&r.cleanup&&(ch(e.cleanup,"cleanup"),n=e.cleanup),new dh((i,s)=>{let o=Fa(t,e,a=>{n&&o(),a?s(a):i()})})}Ai.exports=Fa;Ai.exports.finished=Sh});var ht=T((im,Ga)=>{"use strict";var we=He(),{aggregateTwoErrors:Eh,codes:{ERR_MULTIPLE_CALLBACK:Rh},AbortError:Ih}=z(),{Symbol:Ma}=L(),{kIsDestroyed:Ah,isDestroyed:Th,isFinished:vh,isServerRequest:Nh}=me(),Ua=Ma("kDestroy"),Ti=Ma("kConstruct");function $a(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function jh(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):($a(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Ca(this,t,e):this.once(Ua,function(s){Ca(this,Eh(s,t),e)}),this)}function Ca(t,e,r){let n=!1;function i(s){if(n)return;n=!0;let o=t._readableState,a=t._writableState;$a(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?we.nextTick(kh,t,s):we.nextTick(qa,t)}try{t._destroy(e||null,i)}catch(s){i(s)}}function kh(t,e){vi(t,e),qa(t)}function qa(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 vi(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Ph(){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 Ni(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?we.nextTick(vi,t,e):vi(t,e))}function Lh(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(Ti,e),!(t.listenerCount(Ti)>1)&&we.nextTick(Oh,t)}function Oh(t){let e=!1;function r(n){if(e){Ni(t,n??new Rh);return}e=!0;let i=t._readableState,s=t._writableState,o=s||i;i&&(i.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(Ua,n):n?Ni(t,n,!0):we.nextTick(Bh,t)}try{t._construct(n=>{we.nextTick(r,n)})}catch(n){we.nextTick(r,n)}}function Bh(t){t.emit(Ti)}function Da(t){return t?.setHeader&&typeof t.abort=="function"}function Wa(t){t.emit("close")}function Fh(t,e){t.emit("error",e),we.nextTick(Wa,t)}function Ch(t,e){!t||Th(t)||(!e&&!vh(t)&&(e=new Ih),Nh(t)?(t.socket=null,t.destroy(e)):Da(t)?t.abort():Da(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?we.nextTick(Fh,t,e):we.nextTick(Wa,t),t.destroyed||(t[Ah]=!0))}Ga.exports={construct:Lh,destroyer:Ch,destroy:jh,undestroy:Ph,errorOrDestroy:Ni}});var ln=T((sm,Ha)=>{"use strict";var{ArrayIsArray:Dh,ObjectSetPrototypeOf:za}=L(),{EventEmitter:on}=yr();function an(t){on.call(this,t)}za(an.prototype,on.prototype);za(an,on);an.prototype.pipe=function(t,e){let r=this;function n(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",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(f){u(),on.listenerCount(this,"error")===0&&this.emit("error",f)}ji(r,"error",l),ji(t,"error",l);function u(){r.removeListener("data",n),t.removeListener("drain",i),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 ji(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Dh(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Ha.exports={Stream:an,prependListener:ji}});var br=T((om,un)=>{"use strict";var{SymbolDispose:Mh}=L(),{AbortError:Qa,codes:Uh}=z(),{isNodeStream:Ka,isWebStream:$h,kControllerErrorFunction:qh}=me(),Wh=Pe(),{ERR_INVALID_ARG_TYPE:Va}=Uh,ki,Gh=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Va(e,"AbortSignal",t)};un.exports.addAbortSignal=function(e,r){if(Gh(e,"signal"),!Ka(r)&&!$h(r))throw new Va("stream",["ReadableStream","WritableStream","Stream"],r);return un.exports.addAbortSignalNoValidate(e,r)};un.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Ka(e)?()=>{e.destroy(new Qa(void 0,{cause:t.reason}))}:()=>{e[qh](new Qa(void 0,{cause:t.reason}))};if(t.aborted)r();else{ki=ki||K().addAbortListener;let n=ki(t,r);Wh(e,n[Mh])}return e}});var Za=T((lm,Ya)=>{"use strict";var{StringPrototypeSlice:Ja,SymbolIterator:zh,TypedArrayPrototypeSet:fn,Uint8Array:Hh}=L(),{Buffer:Pi}=pe(),{inspect:Qh}=K();Ya.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,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return Pi.alloc(0);let r=Pi.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)fn(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[zh](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let s=n.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=Ja(s,0,e),this.head=n,n.data=Ja(s,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Pi.allocUnsafe(e),n=e,i=this.head,s=0;do{let o=i.data;if(e>o.length)fn(r,o,n-e),e-=o.length;else{e===o.length?(fn(r,o,n-e),++s,i.next?this.head=i.next:this.head=this.tail=null):(fn(r,new Hh(o.buffer,o.byteOffset,e),n-e),this.head=i,i.data=o.slice(e));break}++s}while((i=i.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return Qh(this,{...r,depth:0,customInspect:!1})}}});var gr=T((um,rl)=>{"use strict";var{MathFloor:Kh,NumberIsInteger:Vh}=L(),{validateInteger:Jh}=$t(),{ERR_INVALID_ARG_VALUE:Yh}=z().codes,Xa=16*1024,el=16;function Zh(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function tl(t){return t?el:Xa}function Xh(t,e){Jh(e,"value",0),t?el=e:Xa=e}function ep(t,e,r,n){let i=Zh(e,n,r);if(i!=null){if(!Vh(i)||i<0){let s=n?`options.${r}`:"options.highWaterMark";throw new Yh(s,i)}return Kh(i)}return tl(t.objectMode)}rl.exports={getHighWaterMark:ep,getDefaultHighWaterMark:tl,setDefaultHighWaterMark:Xh}});var sl=T((Li,il)=>{var cn=pe(),xe=cn.Buffer;function nl(t,e){for(var r in t)e[r]=t[r]}xe.from&&xe.alloc&&xe.allocUnsafe&&xe.allocUnsafeSlow?il.exports=cn:(nl(cn,Li),Li.Buffer=pt);function pt(t,e,r){return xe(t,e,r)}pt.prototype=Object.create(xe.prototype);nl(xe,pt);pt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xe(t,e,r)};pt.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=xe(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};pt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xe(t)};pt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return cn.SlowBuffer(t)}});var ll=T(al=>{"use strict";var Bi=sl().Buffer,ol=Bi.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 tp(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 rp(t){var e=tp(t);if(typeof e!="string"&&(Bi.isEncoding===ol||!ol(t)))throw new Error("Unknown encoding: "+t);return e||t}al.StringDecoder=mr;function mr(t){this.encoding=rp(t);var e;switch(this.encoding){case"utf16le":this.text=lp,this.end=up,e=4;break;case"utf8":this.fillLast=sp,e=4;break;case"base64":this.text=fp,this.end=cp,e=3;break;default:this.write=dp,this.end=hp;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Bi.allocUnsafe(e)}mr.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||""};mr.prototype.end=ap;mr.prototype.text=op;mr.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 Oi(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function np(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Oi(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Oi(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Oi(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function ip(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 sp(t){var e=this.lastTotal-this.lastNeed,r=ip(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 op(t,e){var r=np(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function ap(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function lp(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function up(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 fp(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 cp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function dp(t){return t.toString(this.encoding)}function hp(t){return t&&t.length?this.write(t):""}});var Fi=T((cm,dl)=>{"use strict";var ul=He(),{PromisePrototypeThen:pp,SymbolAsyncIterator:fl,SymbolIterator:cl}=L(),{Buffer:_p}=pe(),{ERR_INVALID_ARG_TYPE:yp,ERR_STREAM_NULL_VALUES:bp}=z().codes;function gp(t,e,r){let n;if(typeof e=="string"||e instanceof _p)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[fl])i=!0,n=e[fl]();else if(e&&e[cl])i=!1,n=e[cl]();else throw new yp("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,f){pp(a(u),()=>ul.nextTick(f,u),c=>ul.nextTick(f,c||u))};async function a(u){let f=u!=null,c=typeof n.throw=="function";if(f&&c){let{value:d,done:h}=await n.throw(u);if(await d,h)return}if(typeof n.return=="function"){let{value:d}=await n.return();await d}}async function l(){for(;;){try{let{value:u,done:f}=i?await n.next():n.next();if(f)s.push(null);else{let c=u&&typeof u.then=="function"?await u:u;if(c===null)throw o=!1,new bp;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}dl.exports=gp});var xr=T((dm,jl)=>{"use strict";var ae=He(),{ArrayPrototypeIndexOf:mp,NumberIsInteger:wp,NumberIsNaN:xp,NumberParseInt:Sp,ObjectDefineProperties:Gi,ObjectKeys:Ep,ObjectSetPrototypeOf:_l,Promise:yl,SafeSet:Rp,SymbolAsyncDispose:Ip,SymbolAsyncIterator:Ap,Symbol:Tp}=L();jl.exports=E;E.ReadableState=_n;var{EventEmitter:vp}=yr(),{Stream:Ke,prependListener:Np}=ln(),{Buffer:Ci}=pe(),{addAbortSignal:jp}=br(),bl=Pe(),I=K().debuglog("stream",t=>{I=t}),kp=Za(),Ht=ht(),{getHighWaterMark:Pp,getDefaultHighWaterMark:Lp}=gr(),{aggregateTwoErrors:hl,codes:{ERR_INVALID_ARG_TYPE:Op,ERR_METHOD_NOT_IMPLEMENTED:Bp,ERR_OUT_OF_RANGE:Fp,ERR_STREAM_PUSH_AFTER_EOF:Cp,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Dp},AbortError:Mp}=z(),{validateObject:Up}=$t(),_t=Tp("kPaused"),{StringDecoder:gl}=ll(),$p=Fi();_l(E.prototype,Ke.prototype);_l(E,Ke);var Di=()=>{},{errorOrDestroy:Gt}=Ht,zt=1,qp=2,ml=4,wr=8,wl=16,dn=32,hn=64,xl=128,Wp=256,Gp=512,zp=1024,qi=2048,Wi=4096,Hp=8192,Qp=16384,Kp=32768,Sl=65536,Vp=1<<17,Jp=1<<18;function M(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Gi(_n.prototype,{objectMode:M(zt),ended:M(qp),endEmitted:M(ml),reading:M(wr),constructed:M(wl),sync:M(dn),needReadable:M(hn),emittedReadable:M(xl),readableListening:M(Wp),resumeScheduled:M(Gp),errorEmitted:M(zp),emitClose:M(qi),autoDestroy:M(Wi),destroyed:M(Hp),closed:M(Qp),closeEmitted:M(Kp),multiAwaitDrain:M(Sl),readingMore:M(Vp),dataEmitted:M(Jp)});function _n(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.state=qi|Wi|wl|dn,t&&t.objectMode&&(this.state|=zt),r&&t&&t.readableObjectMode&&(this.state|=zt),this.highWaterMark=t?Pp(this,t,"readableHighWaterMark",r):Lp(!1),this.buffer=new kp,this.length=0,this.pipes=[],this.flowing=null,this[_t]=null,t&&t.emitClose===!1&&(this.state&=~qi),t&&t.autoDestroy===!1&&(this.state&=~Wi),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new gl(t.encoding),this.encoding=t.encoding)}function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof Se();this._readableState=new _n(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&&jp(t.signal,this)),Ke.call(this,t),Ht.construct(this,()=>{this._readableState.needReadable&&pn(this,this._readableState)})}E.prototype.destroy=Ht.destroy;E.prototype._undestroy=Ht.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[vp.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[Ip]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Mp,this.destroy(t)),new yl((e,r)=>bl(this,n=>n&&n!==t?r(n):e(null)))};E.prototype.push=function(t,e){return El(this,t,e,!1)};E.prototype.unshift=function(t,e){return El(this,t,e,!0)};function El(t,e,r,n){I("readableAddChunk",e);let i=t._readableState,s;if((i.state&zt)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Ci.from(e,r).toString(i.encoding):(e=Ci.from(e,r),r=""))):e instanceof Ci?r="":Ke._isUint8Array(e)?(e=Ke._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Op("chunk",["string","Buffer","Uint8Array"],e))),s)Gt(t,s);else if(e===null)i.state&=~wr,Xp(t,i);else if((i.state&zt)!==0||e&&e.length>0)if(n)if((i.state&ml)!==0)Gt(t,new Dp);else{if(i.destroyed||i.errored)return!1;Mi(t,i,e,!0)}else if(i.ended)Gt(t,new Cp);else{if(i.destroyed||i.errored)return!1;i.state&=~wr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Mi(t,i,e,!1):pn(t,i)):Mi(t,i,e,!1)}else n||(i.state&=~wr,pn(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function Mi(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Sl)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),(e.state&hn)!==0&&yn(t)),pn(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[_t]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new gl(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var Yp=1073741824;function Zp(t){if(t>Yp)throw new Fp("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function pl(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&zt)!==0?1:xp(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:wp(t)||(t=Sp(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Zp(t)),t!==0&&(e.state&=~xl),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?Ui(this):yn(this),null;if(t=pl(t,e),t===0&&e.ended)return e.length===0&&Ui(this),null;let n=(e.state&hn)!==0;if(I("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,I("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,I("reading, ended or constructing",n);else if(n){I("do read"),e.state|=wr|dn,e.length===0&&(e.state|=hn);try{this._read(e.highWaterMark)}catch(s){Gt(this,s)}e.state&=~dn,e.reading||(t=pl(r,e))}let i;return t>0?i=vl(t,e):i=null,i===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&&Ui(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function Xp(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?yn(t):(e.needReadable=!1,e.emittedReadable=!0,Rl(t))}}function yn(t){let e=t._readableState;I("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(I("emitReadable",e.flowing),e.emittedReadable=!0,ae.nextTick(Rl,t))}function Rl(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,Al(t)}function pn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ae.nextTick(e_,t,e))}function e_(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 Bp("_read()")};E.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new Rp(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),I("pipe count=%d opts=%j",n.pipes.length,e);let s=(!e||e.end!==!1)&&t!==ae.stdout&&t!==ae.stderr?a:x;n.endEmitted?ae.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(b,g){I("onunpipe"),b===r&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,f())}function a(){I("onend"),t.end()}let l,u=!1;function f(){I("cleanup"),t.removeListener("close",y),t.removeListener("finish",_),l&&t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",x),r.removeListener("data",d),u=!0,l&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){u||(n.pipes.length===1&&n.pipes[0]===t?(I("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(I("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),l||(l=t_(r,t),t.on("drain",l))}r.on("data",d);function d(b){I("ondata");let g=t.write(b);I("dest.write",g),g===!1&&c()}function h(b){if(I("onerror",b),x(),t.removeListener("error",h),t.listenerCount("error")===0){let g=t._writableState||t._readableState;g&&!g.errorEmitted?Gt(t,b):t.emit("error",b)}}Np(t,"error",h);function y(){t.removeListener("finish",_),x()}t.once("close",y);function _(){I("onfinish"),t.removeListener("close",y),x()}t.once("finish",_);function x(){I("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():n.flowing||(I("pipe resume"),r.resume()),t};function t_(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(I("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(I("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.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 i=e.pipes;e.pipes=[],this.pause();for(let s=0;s<i.length;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}let n=mp(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};E.prototype.on=function(t,e){let r=Ke.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,I("on readable",n.length,n.reading),n.length?yn(this):n.reading||ae.nextTick(r_,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=Ke.prototype.removeListener.call(this,t,e);return t==="readable"&&ae.nextTick(Il,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=Ke.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ae.nextTick(Il,this),e};function Il(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[_t]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function r_(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,n_(this,t)),t[_t]=!1,this};function n_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ae.nextTick(i_,t,e))}function i_(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Al(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[_t]=!0,this};function Al(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",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{Gt(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Ep(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};E.prototype[Ap]=function(){return Tl(this)};E.prototype.iterator=function(t){return t!==void 0&&Up(t,"options"),Tl(this,t)};function Tl(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=s_(t,e);return r.stream=t,r}async function*s_(t,e){let r=Di;function n(o){this===t?(r(),r=Di):r=o}t.on("readable",n);let i,s=bl(t,{writable:!1},o=>{i=o?hl(i,o):null,r(),r=Di});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(i)throw i;if(i===null)return;await new yl(n)}}}catch(o){throw i=hl(i,o),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Ht.destroyer(t,null):(t.off("readable",n),s())}}Gi(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}}});Gi(_n.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[_t]!==!1},set(t){this[_t]=!!t}}});E._fromList=vl;function vl(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 Ui(t){let e=t._readableState;I("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,ae.nextTick(o_,e,t))}function o_(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)ae.nextTick(a_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function a_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return $p(E,t,e)};var $i;function Nl(){return $i===void 0&&($i={}),$i}E.fromWeb=function(t,e){return Nl().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return Nl().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var r,n;return new E({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,s){Ht.destroyer(t,i),s(i)}}).wrap(t)}});var xn=T((hm,ql)=>{"use strict";var yt=He(),{ArrayPrototypeSlice:Ll,Error:l_,FunctionPrototypeSymbolHasInstance:Ol,ObjectDefineProperty:Bl,ObjectDefineProperties:u_,ObjectSetPrototypeOf:Fl,StringPrototypeToLowerCase:f_,Symbol:c_,SymbolHasInstance:d_}=L();ql.exports=O;O.WritableState=Rr;var{EventEmitter:h_}=yr(),Sr=ln().Stream,{Buffer:bn}=pe(),wn=ht(),{addAbortSignal:p_}=br(),{getHighWaterMark:__,getDefaultHighWaterMark:y_}=gr(),{ERR_INVALID_ARG_TYPE:b_,ERR_METHOD_NOT_IMPLEMENTED:g_,ERR_MULTIPLE_CALLBACK:Cl,ERR_STREAM_CANNOT_PIPE:m_,ERR_STREAM_DESTROYED:Er,ERR_STREAM_ALREADY_FINISHED:w_,ERR_STREAM_NULL_VALUES:x_,ERR_STREAM_WRITE_AFTER_END:S_,ERR_UNKNOWN_ENCODING:Dl}=z().codes,{errorOrDestroy:Qt}=wn;Fl(O.prototype,Sr.prototype);Fl(O,Sr);function Qi(){}var Kt=c_("kOnFinished");function Rr(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?__(this,t,"writableHighWaterMark",r):y_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=R_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,mn(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[Kt]=[]}function mn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Rr.prototype.getBuffer=function(){return Ll(this.buffered,this.bufferedIndex)};Bl(Rr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function O(t){let e=this instanceof Se();if(!e&&!Ol(O,this))return new O(t);this._writableState=new Rr(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&&p_(t.signal,this)),Sr.call(this,t),wn.construct(this,()=>{let r=this._writableState;r.writing||Vi(this,r),Ji(this,r)})}Bl(O,d_,{__proto__:null,value:function(t){return Ol(this,t)?!0:this!==O?!1:t&&t._writableState instanceof Rr}});O.prototype.pipe=function(){Qt(this,new m_)};function Ml(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!bn.isEncoding(r))throw new Dl(r);typeof n!="function"&&(n=Qi)}if(e===null)throw new x_;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=bn.from(e,r),r="buffer");else if(e instanceof bn)r="buffer";else if(Sr._isUint8Array(e))e=Sr._uint8ArrayToBuffer(e),r="buffer";else throw new b_("chunk",["string","Buffer","Uint8Array"],e);let s;return i.ending?s=new S_:i.destroyed&&(s=new Er("write")),s?(yt.nextTick(n,s),Qt(t,s,!0),s):(i.pendingcb++,E_(t,i,e,r,n))}O.prototype.write=function(t,e,r){return Ml(this,t,e,r)===!0};O.prototype.cork=function(){this._writableState.corked++};O.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Vi(this,t))};O.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=f_(e)),!bn.isEncoding(e))throw new Dl(e);return this._writableState.defaultEncoding=e,this};function E_(t,e,r,n,i){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:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==Qi&&(e.allNoop=!1)):(e.writelen=s,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function kl(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Er("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function Pl(t,e,r,n){--e.pendingcb,n(r),Ki(e),Qt(t,r)}function R_(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Qt(t,new Cl);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),n?yt.nextTick(Pl,t,r,e,i):Pl(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&Vi(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},yt.nextTick(I_,r.afterWriteTickInfo)):Ul(t,r,1,i))}function I_({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,Ul(t,e,r,n)}function Ul(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&Ki(e),Ji(t,e)}function Ki(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:s,callback:o}=t.buffered[i],a=t.objectMode?1:s.length;t.length-=a,o((e=t.errored)!==null&&e!==void 0?e:new Er("write"))}let r=t[Kt].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Er("end"))}mn(t)}function Vi(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,s=r.length-n;if(!s)return;let o=n;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let a=e.allNoop?Qi:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:Ll(r,o);l.allBuffers=e.allBuffers,kl(t,e,!0,e.length,l,"",a),mn(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=i?1:a.length;kl(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?mn(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}O.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new g_("_write()")};O.prototype._writev=null;O.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let s=Ml(this,t,e);s instanceof l_&&(i=s)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Ji(this,n,!0),n.ended=!0):n.finished?i=new w_("end"):n.destroyed&&(i=new Er("end"))),typeof r=="function"&&(i||n.finished?yt.nextTick(r,i):n[Kt].push(r)),this};function gn(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 A_(t,e){let r=!1;function n(i){if(r){Qt(t,i??Cl());return}if(r=!0,e.pendingcb--,i){let s=e[Kt].splice(0);for(let o=0;o<s.length;o++)s[o](i);Qt(t,i,e.sync)}else gn(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,yt.nextTick(Hi,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function T_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,A_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Ji(t,e,r){gn(e)&&(T_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,yt.nextTick((n,i)=>{gn(i)?Hi(n,i):i.pendingcb--},t,e)):gn(e)&&(e.pendingcb++,Hi(t,e))))}function Hi(t,e){e.pendingcb--,e.finished=!0;let r=e[Kt].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}u_(O.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 v_=wn.destroy;O.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Kt].length)&&yt.nextTick(Ki,r),v_.call(this,t,e),this};O.prototype._undestroy=wn.undestroy;O.prototype._destroy=function(t,e){e(t)};O.prototype[h_.captureRejectionSymbol]=function(t){this.destroy(t)};var zi;function $l(){return zi===void 0&&(zi={}),zi}O.fromWeb=function(t,e){return $l().newStreamWritableFromWritableStream(t,e)};O.toWeb=function(t){return $l().newWritableStreamFromStreamWritable(t)}});var nu=T((pm,ru)=>{var Yi=He(),N_=pe(),{isReadable:j_,isWritable:k_,isIterable:Wl,isNodeStream:P_,isReadableNodeStream:Gl,isWritableNodeStream:zl,isDuplexNodeStream:L_,isReadableStream:Hl,isWritableStream:Ql}=me(),Kl=Pe(),{AbortError:eu,codes:{ERR_INVALID_ARG_TYPE:O_,ERR_INVALID_RETURN_VALUE:Vl}}=z(),{destroyer:Jt}=ht(),B_=Se(),tu=xr(),F_=xn(),{createDeferredPromise:Jl}=K(),Yl=Fi(),Zl=globalThis.Blob||N_.Blob,C_=typeof Zl<"u"?function(e){return e instanceof Zl}:function(e){return!1},D_=globalThis.AbortController||Dt().AbortController,{FunctionPrototypeCall:Xl}=L(),Ve=class extends B_{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};ru.exports=function t(e,r){if(L_(e))return e;if(Gl(e))return Vt({readable:e});if(zl(e))return Vt({writable:e});if(P_(e))return Vt({writable:!1,readable:!1});if(Hl(e))return Vt({readable:tu.fromWeb(e)});if(Ql(e))return Vt({writable:F_.fromWeb(e)});if(typeof e=="function"){let{value:i,write:s,final:o,destroy:a}=M_(e);if(Wl(i))return Yl(Ve,i,{objectMode:!0,write:s,final:o,destroy:a});let l=i?.then;if(typeof l=="function"){let u,f=Xl(l,i,c=>{if(c!=null)throw new Vl("nully","body",c)},c=>{Jt(u,c)});return u=new Ve({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,Yi.nextTick(c,null)}catch(d){Yi.nextTick(c,d)}})},destroy:a})}throw new Vl("Iterable, AsyncIterable or AsyncFunction",r,i)}if(C_(e))return t(e.arrayBuffer());if(Wl(e))return Yl(Ve,e,{objectMode:!0,writable:!1});if(Hl(e?.readable)&&Ql(e?.writable))return Ve.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?Gl(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?zl(e?.writable)?e?.writable:t(e.writable):void 0;return Vt({readable:i,writable:s})}let n=e?.then;if(typeof n=="function"){let i;return Xl(n,e,s=>{s!=null&&i.push(s),i.push(null)},s=>{Jt(i,s)}),i=new Ve({objectMode:!0,writable:!1,read(){}})}throw new O_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function M_(t){let{promise:e,resolve:r}=Jl(),n=new D_,i=n.signal;return{value:t((async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(Yi.nextTick(u),l)return;if(i.aborted)throw new eu(void 0,{cause:i.reason});({promise:e,resolve:r}=Jl()),yield a}})(),{signal:i}),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){n.abort(),a(o)}}}function Vt(t){let e=t.readable&&typeof t.readable.read!="function"?tu.wrap(t.readable):t.readable,r=t.writable,n=!!j_(e),i=!!k_(r),s,o,a,l,u;function f(c){let d=l;l=null,d?d(c):c&&u.destroy(c)}return u=new Ve({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(Kl(r,c=>{i=!1,c&&Jt(e,c),f(c)}),u._write=function(c,d,h){r.write(c,d)?h():s=h},u._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()}})),n&&(Kl(e,c=>{n=!1,c&&Jt(e,c),f(c)}),e.on("readable",function(){if(a){let c=a;a=null,c()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let c=e.read();if(c===null){a=u._read;return}if(!u.push(c))return}}),u._destroy=function(c,d){!c&&l!==null&&(c=new eu),a=null,s=null,o=null,l===null?d(c):(l=d,Jt(r,c),Jt(e,c))},u}});var Se=T((_m,ou)=>{"use strict";var{ObjectDefineProperties:U_,ObjectGetOwnPropertyDescriptor:Le,ObjectKeys:$_,ObjectSetPrototypeOf:iu}=L();ou.exports=le;var es=xr(),ie=xn();iu(le.prototype,es.prototype);iu(le,es);{let t=$_(ie.prototype);for(let e=0;e<t.length;e++){let r=t[e];le.prototype[r]||(le.prototype[r]=ie.prototype[r])}}function le(t){if(!(this instanceof le))return new le(t);es.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}U_(le.prototype,{writable:{__proto__:null,...Le(ie.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Le(ie.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Le(ie.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Le(ie.prototype,"writableBuffer")},writableLength:{__proto__:null,...Le(ie.prototype,"writableLength")},writableFinished:{__proto__:null,...Le(ie.prototype,"writableFinished")},writableCorked:{__proto__:null,...Le(ie.prototype,"writableCorked")},writableEnded:{__proto__:null,...Le(ie.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Le(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 Zi;function su(){return Zi===void 0&&(Zi={}),Zi}le.fromWeb=function(t,e){return su().newStreamDuplexFromReadableWritablePair(t,e)};le.toWeb=function(t){return su().newReadableWritablePairFromDuplex(t)};var Xi;le.from=function(t){return Xi||(Xi=nu()),Xi(t,"body")}});var ns=T((ym,lu)=>{"use strict";var{ObjectSetPrototypeOf:au,Symbol:q_}=L();lu.exports=Oe;var{ERR_METHOD_NOT_IMPLEMENTED:W_}=z().codes,rs=Se(),{getHighWaterMark:G_}=gr();au(Oe.prototype,rs.prototype);au(Oe,rs);var Ir=q_("kCallback");function Oe(t){if(!(this instanceof Oe))return new Oe(t);let e=t?G_(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),rs.call(this,t),this._readableState.sync=!1,this[Ir]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",z_)}function ts(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 z_(){this._final!==ts&&ts.call(this)}Oe.prototype._final=ts;Oe.prototype._transform=function(t,e,r){throw new W_("_transform()")};Oe.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,s=n.length;this._transform(t,e,(o,a)=>{if(o){r(o);return}a!=null&&this.push(a),i.ended||s===n.length||n.length<n.highWaterMark?r():this[Ir]=r})};Oe.prototype._read=function(){if(this[Ir]){let t=this[Ir];this[Ir]=null,t()}}});var ss=T((bm,fu)=>{"use strict";var{ObjectSetPrototypeOf:uu}=L();fu.exports=Yt;var is=ns();uu(Yt.prototype,is.prototype);uu(Yt,is);function Yt(t){if(!(this instanceof Yt))return new Yt(t);is.call(this,t)}Yt.prototype._transform=function(t,e,r){r(null,t)}});var In=T((gm,_u)=>{var Ar=He(),{ArrayIsArray:H_,Promise:Q_,SymbolAsyncIterator:K_,SymbolDispose:V_}=L(),Rn=Pe(),{once:J_}=K(),Y_=ht(),cu=Se(),{aggregateTwoErrors:Z_,codes:{ERR_INVALID_ARG_TYPE:ps,ERR_INVALID_RETURN_VALUE:os,ERR_MISSING_ARGS:X_,ERR_STREAM_DESTROYED:ey,ERR_STREAM_PREMATURE_CLOSE:ty},AbortError:ry}=z(),{validateFunction:ny,validateAbortSignal:iy}=$t(),{isIterable:bt,isReadable:as,isReadableNodeStream:En,isNodeStream:du,isTransformStream:Zt,isWebStream:sy,isReadableStream:ls,isReadableFinished:oy}=me(),ay=globalThis.AbortController||Dt().AbortController,us,fs,cs;function hu(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=Rn(t,{readable:e,writable:r},s=>{n=!s});return{destroy:s=>{n||(n=!0,Y_.destroyer(t,s||new ey("pipe")))},cleanup:i}}function ly(t){return ny(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function ds(t){if(bt(t))return t;if(En(t))return uy(t);throw new ps("val",["Readable","Iterable","AsyncIterable"],t)}async function*uy(t){fs||(fs=xr()),yield*fs.prototype[K_].call(t)}async function Sn(t,e,r,{end:n}){let i,s=null,o=u=>{if(u&&(i=u),s){let f=s;s=null,f()}},a=()=>new Q_((u,f)=>{i?f(i):s=()=>{i?f(i):u()}});e.on("drain",o);let l=Rn(e,{readable:!1},o);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();n&&(e.end(),await a()),r()}catch(u){r(i!==u?Z_(i,u):u)}finally{l(),e.off("drain",o)}}async function hs(t,e,r,{end:n}){Zt(e)&&(e=e.writable);let i=e.getWriter();try{for await(let s of t)await i.ready,i.write(s).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(s){try{await i.abort(s),r(s)}catch(o){r(o)}}}function fy(...t){return pu(t,J_(ly(t)))}function pu(t,e,r){if(t.length===1&&H_(t[0])&&(t=t[0]),t.length<2)throw new X_("streams");let n=new ay,i=n.signal,s=r?.signal,o=[];iy(s,"options.signal");function a(){y(new ry)}cs=cs||K().addAbortListener;let l;s&&(l=cs(s,a));let u,f,c=[],d=0;function h(S){y(S,--d===0)}function y(S,m){var A;if(S&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=S),!(!u&&!m)){for(;c.length;)c.shift()(u);(A=l)===null||A===void 0||A[V_](),n.abort(),m&&(u||o.forEach(Ae=>Ae()),Ar.nextTick(e,u,f))}}let _;for(let S=0;S<t.length;S++){let m=t[S],A=S<t.length-1,Ae=S>0,D=A||r?.end!==!1,St=S===t.length-1;if(du(m)){let V=function(Te){Te&&Te.name!=="AbortError"&&Te.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(Te)};var g=V;if(D){let{destroy:Te,cleanup:Bn}=hu(m,A,Ae);c.push(Te),as(m)&&St&&o.push(Bn)}m.on("error",V),as(m)&&St&&o.push(()=>{m.removeListener("error",V)})}if(S===0)if(typeof m=="function"){if(_=m({signal:i}),!bt(_))throw new os("Iterable, AsyncIterable or Stream","source",_)}else bt(m)||En(m)||Zt(m)?_=m:_=cu.from(m);else if(typeof m=="function"){if(Zt(_)){var x;_=ds((x=_)===null||x===void 0?void 0:x.readable)}else _=ds(_);if(_=m(_,{signal:i}),A){if(!bt(_,!0))throw new os("AsyncIterable",`transform[${S-1}]`,_)}else{var b;us||(us=ss());let V=new us({objectMode:!0}),Te=(b=_)===null||b===void 0?void 0:b.then;if(typeof Te=="function")d++,Te.call(_,Ce=>{f=Ce,Ce!=null&&V.write(Ce),D&&V.end(),Ar.nextTick(h)},Ce=>{V.destroy(Ce),Ar.nextTick(h,Ce)});else if(bt(_,!0))d++,Sn(_,V,h,{end:D});else if(ls(_)||Zt(_)){let Ce=_.readable||_;d++,Sn(Ce,V,h,{end:D})}else throw new os("AsyncIterable or Promise","destination",_);_=V;let{destroy:Bn,cleanup:tf}=hu(_,!1,!0);c.push(Bn),St&&o.push(tf)}}else if(du(m)){if(En(_)){d+=2;let V=cy(_,m,h,{end:D});as(m)&&St&&o.push(V)}else if(Zt(_)||ls(_)){let V=_.readable||_;d++,Sn(V,m,h,{end:D})}else if(bt(_))d++,Sn(_,m,h,{end:D});else throw new ps("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=m}else if(sy(m)){if(En(_))d++,hs(ds(_),m,h,{end:D});else if(ls(_)||bt(_))d++,hs(_,m,h,{end:D});else if(Zt(_))d++,hs(_.readable,m,h,{end:D});else throw new ps("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=m}else _=cu.from(m)}return(i!=null&&i.aborted||s!=null&&s.aborted)&&Ar.nextTick(a),_}function cy(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new ty)}),t.pipe(e,{end:!1}),n){let o=function(){i=!0,e.end()};var s=o;oy(t)?Ar.nextTick(o):t.once("end",o)}else r();return Rn(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)}),Rn(e,{readable:!1,writable:!0},r)}_u.exports={pipelineImpl:pu,pipeline:fy}});var ys=T((mm,xu)=>{"use strict";var{pipeline:dy}=In(),An=Se(),{destroyer:hy}=ht(),{isNodeStream:Tn,isReadable:yu,isWritable:bu,isWebStream:_s,isTransformStream:gt,isWritableStream:gu,isReadableStream:mu}=me(),{AbortError:py,codes:{ERR_INVALID_ARG_VALUE:wu,ERR_MISSING_ARGS:_y}}=z(),yy=Pe();xu.exports=function(...e){if(e.length===0)throw new _y("streams");if(e.length===1)return An.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=An.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=An.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Tn(e[h])&&!_s(e[h]))){if(h<e.length-1&&!(yu(e[h])||mu(e[h])||gt(e[h])))throw new wu(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(bu(e[h])||gu(e[h])||gt(e[h])))throw new wu(`streams[${h}]`,r[h],"must be writable")}let n,i,s,o,a;function l(h){let y=o;o=null,y?y(h):h?a.destroy(h):!d&&!c&&a.destroy()}let u=e[0],f=dy(e,l),c=!!(bu(u)||gu(u)||gt(u)),d=!!(yu(f)||mu(f)||gt(f));if(a=new An({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(Tn(u))a._write=function(y,_,x){u.write(y,_)?x():n=x},a._final=function(y){u.end(),i=y},u.on("drain",function(){if(n){let y=n;n=null,y()}});else if(_s(u)){let _=(gt(u)?u.writable:u).getWriter();a._write=async function(x,b,g){try{await _.ready,_.write(x).catch(()=>{}),g()}catch(S){g(S)}},a._final=async function(x){try{await _.ready,_.close().catch(()=>{}),i=x}catch(b){x(b)}}}let h=gt(f)?f.readable:f;yy(h,()=>{if(i){let y=i;i=null,y()}})}if(d){if(Tn(f))f.on("readable",function(){if(s){let h=s;s=null,h()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=f.read();if(h===null){s=a._read;return}if(!a.push(h))return}};else if(_s(f)){let y=(gt(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:_,done:x}=await y.read();if(!a.push(_))return;if(x){a.push(null);return}}catch{return}}}}return a._destroy=function(h,y){!h&&o!==null&&(h=new py),s=null,n=null,i=null,o===null?y(h):(o=y,Tn(f)&&hy(f,h))},a}});var ku=T((wm,ms)=>{"use strict";var by=globalThis.AbortController||Dt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:gy,ERR_INVALID_ARG_TYPE:Tr,ERR_MISSING_ARGS:my,ERR_OUT_OF_RANGE:wy},AbortError:Ee}=z(),{validateAbortSignal:mt,validateInteger:Su,validateObject:wt}=$t(),xy=L().Symbol("kWeak"),Sy=L().Symbol("kResistStopPropagation"),{finished:Ey}=Pe(),Ry=ys(),{addAbortSignalNoValidate:Iy}=br(),{isWritable:Ay,isNodeStream:Ty}=me(),{deprecate:vy}=K(),{ArrayPrototypePush:Ny,Boolean:jy,MathFloor:Eu,Number:ky,NumberIsNaN:Py,Promise:Ru,PromiseReject:Iu,PromiseResolve:Ly,PromisePrototypeThen:Au,Symbol:vu}=L(),vn=vu("kEmpty"),Tu=vu("kEof");function Oy(t,e){if(e!=null&&wt(e,"options"),e?.signal!=null&&mt(e.signal,"options.signal"),Ty(t)&&!Ay(t))throw new gy("stream",t,"must be writable");let r=Ry(this,t);return e!=null&&e.signal&&Iy(e.signal,r),r}function Nn(t,e){if(typeof t!="function")throw new Tr("fn",["Function","AsyncFunction"],t);e!=null&&wt(e,"options"),e?.signal!=null&&mt(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Eu(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Eu(e.highWaterMark)),Su(r,"options.concurrency",1),Su(n,"options.highWaterMark",0),n+=r,async function*(){let s=K().AbortSignalAny([e?.signal].filter(jy)),o=this,a=[],l={signal:s},u,f,c=!1,d=0;function h(){c=!0,y()}function y(){d-=1,_()}function _(){f&&!c&&d<r&&a.length<n&&(f(),f=null)}async function x(){try{for await(let b of o){if(c)return;if(s.aborted)throw new Ee;try{if(b=t(b,l),b===vn)continue;b=Ly(b)}catch(g){b=Iu(g)}d+=1,Au(b,y,h),a.push(b),u&&(u(),u=null),!c&&(a.length>=n||d>=r)&&await new Ru(g=>{f=g})}a.push(Tu)}catch(b){let g=Iu(b);Au(g,y,h),a.push(g)}finally{c=!0,u&&(u(),u=null)}}x();try{for(;;){for(;a.length>0;){let b=await a[0];if(b===Tu)return;if(s.aborted)throw new Ee;b!==vn&&(yield b),a.shift(),_()}await new Ru(b=>{u=b})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function By(t=void 0){return t!=null&&wt(t,"options"),t?.signal!=null&&mt(t.signal,"options.signal"),async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Ee({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function Nu(t,e=void 0){for await(let r of gs.call(this,t,e))return!0;return!1}async function Fy(t,e=void 0){if(typeof t!="function")throw new Tr("fn",["Function","AsyncFunction"],t);return!await Nu.call(this,async(...r)=>!await t(...r),e)}async function Cy(t,e){for await(let r of gs.call(this,t,e))return r}async function Dy(t,e){if(typeof t!="function")throw new Tr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),vn}for await(let n of Nn.call(this,r,e));}function gs(t,e){if(typeof t!="function")throw new Tr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:vn}return Nn.call(this,r,e)}var bs=class extends my{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function My(t,e,r){var n;if(typeof t!="function")throw new Tr("reducer",["Function","AsyncFunction"],t);r!=null&&wt(r,"options"),r?.signal!=null&&mt(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let u=new Ee(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await Ey(this.destroy(u)),u}let s=new by,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[xy]:this,[Sy]:!0};r.signal.addEventListener("abort",()=>s.abort(),u)}let a=!1;try{for await(let u of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new Ee;i?e=await t(e,u,{signal:o}):(e=u,i=!0)}if(!a&&!i)throw new bs}finally{s.abort()}return e}async function Uy(t){t!=null&&wt(t,"options"),t?.signal!=null&&mt(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ee(void 0,{cause:t.signal.reason});Ny(e,n)}return e}function $y(t,e){let r=Nn.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function ju(t){if(t=ky(t),Py(t))return 0;if(t<0)throw new wy("number",">= 0",t);return t}function qy(t,e=void 0){return e!=null&&wt(e,"options"),e?.signal!=null&&mt(e.signal,"options.signal"),t=ju(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;t--<=0&&(yield s)}}.call(this)}function Wy(t,e=void 0){return e!=null&&wt(e,"options"),e?.signal!=null&&mt(e.signal,"options.signal"),t=ju(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;if(t-- >0&&(yield s),t<=0)return}}.call(this)}ms.exports.streamReturningOperators={asIndexedPairs:vy(By,"readable.asIndexedPairs will be removed in a future version."),drop:qy,filter:gs,flatMap:$y,map:Nn,take:Wy,compose:Oy};ms.exports.promiseReturningOperators={every:Fy,forEach:Dy,reduce:My,toArray:Uy,some:Nu,find:Cy}});var ws=T((xm,Pu)=>{"use strict";var{ArrayPrototypePop:Gy,Promise:zy}=L(),{isIterable:Hy,isNodeStream:Qy,isWebStream:Ky}=me(),{pipelineImpl:Vy}=In(),{finished:Jy}=Pe();xs();function Yy(...t){return new zy((e,r)=>{let n,i,s=t[t.length-1];if(s&&typeof s=="object"&&!Qy(s)&&!Hy(s)&&!Ky(s)){let o=Gy(t);n=o.signal,i=o.end}Vy(t,(o,a)=>{o?r(o):e(a)},{signal:n,end:i})})}Pu.exports={finished:Jy,pipeline:Yy}});var xs=T((Sm,$u)=>{"use strict";var{Buffer:Zy}=pe(),{ObjectDefineProperty:Be,ObjectKeys:Bu,ReflectApply:Fu}=L(),{promisify:{custom:Cu}}=K(),{streamReturningOperators:Lu,promiseReturningOperators:Ou}=ku(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Du}}=z(),Xy=ys(),{setDefaultHighWaterMark:eb,getDefaultHighWaterMark:tb}=gr(),{pipeline:Mu}=In(),{destroyer:rb}=ht(),Uu=Pe(),Ss=ws(),vr=me(),k=$u.exports=ln().Stream;k.isDestroyed=vr.isDestroyed;k.isDisturbed=vr.isDisturbed;k.isErrored=vr.isErrored;k.isReadable=vr.isReadable;k.isWritable=vr.isWritable;k.Readable=xr();for(let t of Bu(Lu)){let r=function(...n){if(new.target)throw Du();return k.Readable.from(Fu(e,this,n))},e=Lu[t];Be(r,"name",{__proto__:null,value:e.name}),Be(r,"length",{__proto__:null,value:e.length}),Be(k.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Bu(Ou)){let r=function(...n){if(new.target)throw Du();return Fu(e,this,n)},e=Ou[t];Be(r,"name",{__proto__:null,value:e.name}),Be(r,"length",{__proto__:null,value:e.length}),Be(k.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}k.Writable=xn();k.Duplex=Se();k.Transform=ns();k.PassThrough=ss();k.pipeline=Mu;var{addAbortSignal:nb}=br();k.addAbortSignal=nb;k.finished=Uu;k.destroy=rb;k.compose=Xy;k.setDefaultHighWaterMark=eb;k.getDefaultHighWaterMark=tb;Be(k,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Ss}});Be(Mu,Cu,{__proto__:null,enumerable:!0,get(){return Ss.pipeline}});Be(Uu,Cu,{__proto__:null,enumerable:!0,get(){return Ss.finished}});k.Stream=k;k._isUint8Array=function(e){return e instanceof Uint8Array};k._uint8ArrayToBuffer=function(e){return Zy.from(e.buffer,e.byteOffset,e.byteLength)}});var jn=T((Em,C)=>{"use strict";var U=xs(),ib=ws(),sb=U.Readable.destroy;C.exports=U.Readable;C.exports._uint8ArrayToBuffer=U._uint8ArrayToBuffer;C.exports._isUint8Array=U._isUint8Array;C.exports.isDisturbed=U.isDisturbed;C.exports.isErrored=U.isErrored;C.exports.isReadable=U.isReadable;C.exports.Readable=U.Readable;C.exports.Writable=U.Writable;C.exports.Duplex=U.Duplex;C.exports.Transform=U.Transform;C.exports.PassThrough=U.PassThrough;C.exports.addAbortSignal=U.addAbortSignal;C.exports.finished=U.finished;C.exports.destroy=U.destroy;C.exports.destroy=sb;C.exports.pipeline=U.pipeline;C.exports.compose=U.compose;Object.defineProperty(U,"promises",{configurable:!0,enumerable:!0,get(){return ib}});C.exports.Stream=U.Stream;C.exports.default=C.exports});var R=class t{#e;constructor(e){this.#e=t.collapse(e)}get value(){return this.#e}toString(){return this.#e}get length(){return this.#e.length}static collapse(e,r=""){if(e instanceof t)return e.value;if(typeof e!="string")throw new TypeError("path argument must be a string or an instance of Path");if(r&&!(r instanceof t)&&(r=new t(r)),e=e.trim(),e.length===0)return r.value;t.isRelative(e)&&(e=r+e);let n=t.reduce(e,(s,o)=>(o==".."?s.pop():o!=="."&&s.push(o),s),[]),i="/";return n.length&&(i+=n.join("/"),t.isFolder(e)&&(i+="/")),i}static isAbsolute(e){return e instanceof t?!0:e.length&&e[0]==="/"}static isRelative(e){return!t.isAbsolute(e)}static isFolder(e){return e instanceof t&&(e=e.value),e.length&&e[e.length-1]=="/"}static isPath(e){return e instanceof t?!0:typeof e!="string"?!1:(e=e.trim(),new URL(e,document.location).pathname==e)}static reduce(e,r,n){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).reduce(r,n)}static map(e,r){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).map(r)}static parent(e){e instanceof t&&(e=e.value),e=e.split("/").filter(Boolean),e.pop();let r="/";return e.length&&(r+=e.join("/")+"/"),r}static filename(e){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).pop()}static head(e){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).shift()}static tail(e){e instanceof t&&(e=e.value),e=e.split("/").filter(Boolean),e.shift();let r="/";return e.length&&(r+=e.join("/")+"/"),r}};var er=class t{#e;#t="/";constructor(e){this.#e=e,this.#t=this.#e.path}get path(){return this.#t}cd(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),new t(this.#e.cd(e))}async read(e,r=null){if(e instanceof R||(e=new R(R.collapse(e,this.#t))),typeof r=="function"){if(!this.#e.supportsStreamingRead())throw new Error("Adapter "+this.#e.name+" does not support streaming reading.");return this.#e.readStream(e,r)}else return this.#e.read(e)}async write(e,r,n=null){if(e instanceof R||(e=new R(R.collapse(e,this.#t))),!this.#e.supportsWrite())throw new Error("Adapter "+this.#e.name+" is read only.");if(typeof r=="function"){if(!this.#e.supportsStreamingWrite())throw new Error("Adapter "+this.#e.name+" does not support streaming writing.");return this.#e.writeStream(e,r,n)}else{if(typeof r=="string")return this.#e.write(e,r,n);throw new TypeError("Cannot write contents of type "+typeof r)}}async delete(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.delete(e)}async exists(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.exists(e)}async list(e=""){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.list(e)}};var Rt={};Cn(Rt,{Client:()=>se,client:()=>ee,deepClone:()=>De,formdata:()=>Ps,metroError:()=>W,request:()=>Xe,response:()=>Et,trace:()=>ff,url:()=>$});var Ze="https://metro.muze.nl/details/";Symbol.metroProxy||(Symbol.metroProxy=Symbol("isProxy"));Symbol.metroSource||(Symbol.metroSource=Symbol("source"));var se=class t{clientOptions={url:$(typeof window<"u"?window.location:"https://localhost"),verbs:["get","post","put","delete","patch","head","options","query"]};static tracers={};constructor(...e){for(let r of e)if(typeof r=="string"||r instanceof String)this.clientOptions.url=$(this.clientOptions.url.href,r);else if(r instanceof t)Object.assign(this.clientOptions,r.clientOptions);else if(r instanceof Function)this.#e([r]);else if(r&&typeof r=="object")for(let n in r)n=="middlewares"?this.#e(r[n]):n=="url"?this.clientOptions.url=$(this.clientOptions.url.href,r[n]):typeof r[n]=="function"?this.clientOptions[n]=r[n](this.clientOptions[n],this.clientOptions):this.clientOptions[n]=r[n];for(let r of this.clientOptions.verbs)this[r]=async function(...n){return this.fetch(Xe(this.clientOptions,...n,{method:r.toUpperCase()}))}}#e(e){typeof e=="function"&&(e=[e]);let r=e.findIndex(n=>typeof n!="function");if(r>=0)throw W("metro.client: middlewares must be a function or an array of functions "+Ze+"client/invalid-middlewares/",e[r]);Array.isArray(this.clientOptions.middlewares)||(this.clientOptions.middlewares=[]),this.clientOptions.middlewares=this.clientOptions.middlewares.concat(e)}fetch(e,r){if(e=Xe(e,r),!e.url)throw W("metro.client."+e.method.toLowerCase()+": Missing url parameter "+Ze+"client/fetch-missing-url/",e);if(r||(r={}),typeof r!="object"||r instanceof String)throw W("metro.client.fetch: Invalid options parameter "+Ze+"client/fetch-invalid-options/",r);let i=[async function(a){a[Symbol.metroProxy]&&(a=a[Symbol.metroSource]);let l=await fetch(a);return Et(l)}].concat(this.clientOptions?.middlewares?.slice()||[]);r=Object.assign({},this.clientOptions,r);let s;for(let o of i)s=(function(a,l){return async function(u){let f,c=Object.values(t.tracers);for(let d of c)d.request&&d.request.call(d,u,l);f=await l(u,a);for(let d of c)d.response&&d.response.call(d,f,l);return f}})(s,o);return s(e)}with(...e){return new t(De(this.clientOptions),...e)}get location(){return this.clientOptions.url}};function ee(...t){return new se(...De(t))}function uf(t,e){let r=e||{};!r.url&&e.url&&(r.url=e.url);for(let n of["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","priority","url"]){let i=t[n];if(!(typeof i>"u"||i==null))if(i?.[Symbol.metroProxy]&&(i=i[Symbol.metroSource]),typeof i=="function")r[n]=i(r[n],r);else if(n=="url")r.url=$(r.url,i);else if(n=="headers"){r.headers=new Headers(e.headers),i instanceof Headers||(i=new Headers(t.headers));for(let[s,o]of i.entries())r.headers.set(s,o)}else r[n]=i}return t instanceof Request&&t.data&&(r.body=t.data),r}function Xe(...t){let e={url:$(typeof window<"u"?window.location:"https://localhost/"),duplex:"half"};for(let i of t)typeof i=="string"||i instanceof URL||i instanceof URLSearchParams?e.url=$(e.url,i):i&&(i instanceof FormData||i instanceof ReadableStream||i instanceof Blob||i instanceof ArrayBuffer||i instanceof DataView)?e.body=i:i&&typeof i=="object"&&Object.assign(e,uf(i,e));let r=new Request(e.url,e),n=e.body;return n&&typeof n=="object"&&!(n instanceof String)&&!(n instanceof ReadableStream)&&!(n instanceof Blob)&&!(n instanceof ArrayBuffer)&&!(n instanceof DataView)&&!(n instanceof FormData)&&!(n instanceof URLSearchParams)&&(typeof globalThis.TypedArray>"u"||!(n instanceof globalThis.TypedArray))&&typeof n.toString=="function"&&(e.body=n.toString({headers:r.headers}),r=new Request(e.url,e)),Object.freeze(r),new Proxy(r,{get(i,s){let o;switch(s){case Symbol.metroSource:o=i;break;case Symbol.metroProxy:o=!0;break;case"with":o=function(...a){return n&&a.unshift({body:n}),Xe(i,...a)};break;case"data":o=n;break;default:i[s]instanceof Function?o=i[s].bind(i):o=i[s];break}return o}})}function js(t,e){let r=e||{};!r.url&&e.url&&(r.url=e.url);for(let n of["status","statusText","headers","body","url","type","redirected"]){let i=t[n];typeof i>"u"||i==null||(i?.[Symbol.metroProxy]&&(i=i[Symbol.metroSource]),typeof i=="function"?r[n]=i(r[n],r):n=="url"?r.url=new URL(i,r.url||"https://localhost/"):r[n]=i)}return t instanceof Response&&t.data&&(r.body=t.data),r}function Et(...t){let e={};for(let i of t)typeof i=="string"?e.body=i:i instanceof Response?Object.assign(e,js(i,e)):i&&typeof i=="object"&&(i instanceof FormData||i instanceof Blob||i instanceof ArrayBuffer||i instanceof DataView||i instanceof ReadableStream||i instanceof URLSearchParams||i instanceof String||typeof globalThis.TypedArray<"u"&&i instanceof globalThis.TypedArray?e.body=i:Object.assign(e,js(i,e)));let r;e.body&&(r=e.body),[101,204,205,304].includes(e.status)&&(e.body=null);let n=new Response(e.body,e);return Object.freeze(n),new Proxy(n,{get(i,s){let o;switch(s){case Symbol.metroProxy:o=!0;break;case Symbol.metroSource:o=i;break;case"with":o=function(...a){return Et(i,...a)};break;case"data":o=r;break;case"ok":o=i.status>=200&&i.status<400;break;default:typeof i[s]=="function"?o=i[s].bind(i):o=i[s];break}return o}})}function ks(t,e){typeof e=="function"?e(t.searchParams,t):(e=new URLSearchParams(e),e.forEach((r,n)=>{t.searchParams.append(n,r)}))}function $(...t){let e=["hash","host","hostname","href","password","pathname","port","protocol","username","search","searchParams"],r=new URL("https://localhost/");for(let n of t)if(typeof n=="string"||n instanceof String)r=new URL(n,r);else if(n instanceof URL||typeof Location<"u"&&n instanceof Location)r=new URL(n);else if(n instanceof URLSearchParams)ks(r,n);else if(n&&typeof n=="object")for(let i in n)switch(i){case"search":typeof n.search=="function"?n.search(r.search,r):r.search=new URLSearchParams(n.search);break;case"searchParams":ks(r,n.searchParams);break;default:if(!e.includes(i))throw W("metro.url: unknown url parameter "+Ze+"url/unknown-param-name/",i);if(typeof n[i]=="function")n[i](r[i],r);else if(typeof n[i]=="string"||n[i]instanceof String||typeof n[i]=="number"||n[i]instanceof Number||typeof n[i]=="boolean"||n[i]instanceof Boolean)r[i]=""+n[i];else if(typeof n[i]=="object"&&n[i].toString)r[i]=n[i].toString();else throw W("metro.url: unsupported value for "+i+" "+Ze+"url/unsupported-param-value/",t[i]);break}else throw W("metro.url: unsupported option value "+Ze+"url/unsupported-option-value/",n);return Object.freeze(r),new Proxy(r,{get(n,i){let s;switch(i){case Symbol.metroProxy:s=!0;break;case Symbol.metroSource:s=n;break;case"with":s=function(...o){return $(n,...o)};break;case"filename":s=n.pathname.split("/").pop();break;case"folderpath":s=n.pathname.substring(0,n.pathname.lastIndexOf("\\")+1);break;case"authority":s=n.username??"",s+=n.password?":"+n.password:"",s+=s?"@":"",s+=n.hostname,s+=n.port?":"+n.port:"",s+="/",s=n.protocol+"//"+s;break;case"origin":s=n.protocol+"//"+n.hostname,s+=n.port?":"+n.port:"",s+="/";break;case"fragment":s=n.hash.substring(1);break;case"scheme":n.protocol?s=n.protocol.substring(0,n.protocol.length-1):s="";break;default:n[i]instanceof Function?s=n[i].bind(n):s=n[i];break}return s}})}function Ps(...t){var e=new FormData;for(let r of t)if(r instanceof HTMLFormElement&&(r=new FormData(r)),r instanceof FormData)for(let n of r.entries())e.append(n[0],n[1]);else if(r&&typeof r=="object")for(let n of Object.entries(r))if(Array.isArray(n[1]))for(let i of n[1])e.append(n[0],i);else e.append(n[0],n[1]);else throw new W("metro.formdata: unknown option type "+Ze+"formdata/unknown-option-value/",r);return Object.freeze(e),new Proxy(e,{get(r,n){let i;switch(n){case Symbol.metroProxy:i=!0;break;case Symbol.metroSource:i=r;break;case"with":i=function(...s){return Ps(r,...s)};break;default:r[n]instanceof Function?i=r[n].bind(r):i=r[n];break}return i}})}var tr={error:(t,...e)=>{console.error("\u24C2\uFE0F ",t,...e)},info:(t,...e)=>{console.info("\u24C2\uFE0F ",t,...e)},group:t=>{console.group("\u24C2\uFE0F "+t)},groupEnd:t=>{console.groupEnd("\u24C2\uFE0F "+t)}};function W(t,...e){return tr.error(t,...e),new Error(t,...e)}var ff={add(t,e){se.tracers[t]=e},delete(t){delete se.tracers[t]},clear(){se.tracers={}},group(){let t=0;return{request:(e,r)=>{t++,tr.group(t),tr.info(e?.url,e,r)},response:(e,r)=>{tr.info(e?.body?e.body[Symbol.metroSource]:null,e,r),tr.groupEnd(t),t--}}}};function De(t){if(Array.isArray(t))return t.slice().map(De);if(t&&typeof t=="object")if(t.__proto__.constructor==Object||!t.__proto__){let e=Object.assign({},t);return Object.keys(e).forEach(r=>{e[r]=De(t[r])}),e}else return t;return t}var et=class{#e;#t;constructor(e,r="/"){this.#e=ee(e),this.#t=new R(r)}get name(){return"HttpAdapter"}get path(){return this.#t}supportsWrite(){return!0}supportsStreamingWrite(){return cf}supportsStreamingRead(){return!0}cd(e){if(!R.isPath(e))throw new TypeError(e+" is not a valid path");return R.isRelative(e)&&(e=R.collapse(e,this.#t)),new this.constructor(this.#e,e)}async write(e,r,n=null){return this.#e.put({body:r})}writeStream(e,r,n=null){throw new Error("Not yet implemented")}async read(e){let r=await this.#e.get(e),n={type:this.getMimetype(r),name:R.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}readStream(e,r){throw new Error("Not yet implemented")}async exists(e){return this.#e.head(e)}async delete(e){return this.#e.delete(e)}async list(e){let r=["text/html","text/xhtml","text/xhtml+xml","text/xml"],n=await this.read(e);if(r.includes(n.type.split(";")[0]))var i=n.contents;else{let u=this.getUrl(e);throw new TypeError("URL "+u+" is not of a supported content type",{cause:n})}let s=$(this.#e.clientOptions.url).pathname,o=this.getUrl(e),a=document.createElement("template");a.innerHTML=i;let l=a.content.querySelectorAll("a[href]");return Array.from(l).map(u=>{let f=new URL(u.getAttribute("href"),o.href);return u.href=f.href,{filename:R.filename(u.pathname),path:u.pathname,name:u.innerText,href:u.href}}).filter(u=>{let f=new URL(u.href);return f.pathname=R.parent(f.pathname),f.href===o.href}).map(u=>({filename:u.filename,path:u.path.substring(s.length-1),name:u.name}))}getUrl(e){let r=$(this.#e.clientOptions.url).pathname;return e=R.collapse(r+R.collapse(e)),new URL(e,this.#e.clientOptions.url)}getMimetype(e){return e.headers.has("Content-Type")?e.headers.get("Content-Type"):null}},cf=(async()=>new Request("",{body:new ReadableStream,method:"POST",duplex:"half"}).headers.has("Content-Type")?!1:fetch("data:a/a;charset=utf-8,",{method:"POST",body:new ReadableStream,duplex:"half"}).then(()=>!0,()=>!1))();var df={fs:er,adapters:{https:et},path:R};globalThis.jsfs=df;function ue(t){return t=Object.assign({contentType:"application/json",reviver:null,replacer:null,space:""},t),async function(r,n){if(r.headers.get("Accept")||(r=r.with({headers:{Accept:t.accept??t.contentType}})),r.method!=="GET"&&r.method!=="HEAD"&&r.data&&typeof r.data=="object"&&!(r.data instanceof ReadableStream)){let s=r.headers.get("Content-Type");(!s||pf(s))&&(r=r.with({headers:{"Content-Type":t.contentType}})),Ls(r.headers.get("Content-Type"))&&(r=r.with({body:JSON.stringify(r.data,t.replacer,t.space)}))}let i=await n(r);if(i&&Ls(i.headers?.get("Content-Type"))){let o=await i.clone().text();try{let a=JSON.parse(o,t.reviver);return i.with({body:a})}catch{}}return i}}var hf=/^application\/([a-zA-Z0-9\-_]+\+)?json\b/;function Ls(t){return hf.exec(t)}function pf(t){return/^text\/plain\b/.exec(t)}function fe(t){return async function(r,n){let i=await n(r);if(!i.ok)if(t&&typeof t[i.status]=="function")i=t[i.status].apply(i,r);else throw new Error(i.status+": "+i.statusText,{cause:i});return i}}function It(){return async function(e,r){let n=await r(e);return n.ok&&n.data?n.data:n}}var Dr=class extends se{constructor(e,r,n=null){e instanceof se?super(e.clientOptions,fe(),It()):super(e,fe(),It()),n||(n=this);for(let i in r)typeof r[i]=="function"?this[i]=r[i].bind(n):r[i]&&typeof r[i]=="object"?this[i]=new this.constructor(e,r[i],n):this[i]=r[i]}},Dn=class extends Dr{constructor(e,r,n=null){e instanceof se?super(e.with(ue()),r,n):super(ee(e,ue()),r,n)}};function Os(...t){return new Dr(...De(t))}function Bs(...t){return new Dn(...De(t))}var Fs=Object.assign({},Rt,{mw:{json:ue,thrower:fe,getdata:It},api:Os,jsonApi:Bs});globalThis.metro||(globalThis.metro=Fs);var ce=Fs;globalThis.assertEnabled=!1;function Q(t,e){if(globalThis.assertEnabled){let r=te(t,e);if(r)throw console.error("\u{1F170}\uFE0F Assertions failed because of:",r,"in this source:",t),new Error("Assertions failed",{cause:{problems:r,source:t}})}}function w(t){return function(r,n,i){if(typeof r<"u"&&r!=null&&typeof t<"u")return te(r,t,n,i)}}function j(t){return function(r,n,i){return r==null||typeof r>"u"?P("data is required",r,t||"any value",i):typeof t<"u"?te(r,t,n,i):!1}}function rr(t){return function(r,n,i){return r==null||typeof r>"u"?(_f("data does not contain recommended value",r,t,i),!1):te(r,t,n,i)}}function J(...t){return function(r,n,i){for(let s of t)if(!te(r,s,n,i))return!1;return P("data does not match oneOf patterns",r,t,i)}}function At(...t){return function(r,n,i){if(!Array.isArray(r))return P("data is not an array",r,"anyOf",i);for(let s of r)if(J(...t)(s))return P("data does not match anyOf patterns",s,t,i);return!1}}function Cs(...t){return function(r,n,i){let s=[];for(let o of t)s=s.concat(te(r,o,n,i));if(s=s.filter(Boolean),s.length)return P("data does not match all given patterns",r,t,i,s)}}function v(t,e,r){try{t instanceof URL&&(t=t.href);let n=new URL(t);if(n.href!=t&&!(n.href+"/"==t||n.href==t+"/"))return P("data is not a valid url",t,"validURL",r)}catch{return P("data is not a valid url",t,"validURL",r)}}function Ds(t,e,r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return P("data is not a valid email",t,"validEmail",r)}function Tt(t){return function(r,n,i){if(!(r instanceof t))return P("data is not an instanceof pattern",r,t,i)}}function nr(t){return function(r,n,i){if(!te(r,t,n,i))return P("data matches pattern, when required not to",r,t,i)}}function te(t,e,r,n=""){r||(r=t);let i=[];if(e===Boolean)typeof t!="boolean"&&!(t instanceof Boolean)&&i.push(P("data is not a boolean",t,e,n));else if(e===Number)typeof t!="number"&&!(t instanceof Number)&&i.push(P("data is not a number",t,e,n));else if(e===String)typeof t!="string"&&!(t instanceof String)&&i.push(P("data is not a string",t,e,n)),t==""&&i.push(P("data is an empty string, which is not allowed",t,e,n));else if(e instanceof RegExp)if(Array.isArray(t)){let s=t.findIndex((o,a)=>te(o,e,r,n+"["+a+"]"));s>-1&&i.push(P("data["+s+"] does not match pattern",t[s],e,n+"["+s+"]"))}else typeof t>"u"?i.push(P("data is undefined, should match pattern",t,e,n)):e.test(t)||i.push(P("data does not match pattern",t,e,n));else if(e instanceof Function){let s=e(t,r,n);s&&(Array.isArray(s)?i=i.concat(s):i.push(s))}else if(Array.isArray(e)){Array.isArray(t)||i.push(P("data is not an array",t,[],n));for(let s of e)for(let o of t.keys()){let a=te(t[o],s,r,n+"["+o+"]");Array.isArray(a)?i=i.concat(a):a&&i.push(a)}}else if(e&&typeof e=="object")if(Array.isArray(t)){let s=t.findIndex((o,a)=>te(o,e,r,n+"["+a+"]"));s>-1&&i.push(P("data["+s+"] does not match pattern",t[s],e,n+"["+s+"]"))}else if(!t||typeof t!="object")i.push(P("data is not an object, pattern is",t,e,n));else if(t instanceof URLSearchParams&&(t=Object.fromEntries(t)),e instanceof Function){let s=te(t,e,r,n);s&&(i=i.concat(s))}else for(let[s,o]of Object.entries(e)){let a=te(t[s],o,r,n+"."+s);a&&(i=i.concat(a))}else e!=t&&i.push(P("data and pattern are not equal",t,e,n));return i.length?i:!1}function P(t,e,r,n,i){let s={path:n,message:t,found:e,expected:r};return i&&(s.problems=i),s}function _f(t,e,r,n){console.warn("\u{1F170}\uFE0F Assert: "+n,t,r,e)}function Ms(t){let e,r;if(typeof localStorage<"u")e={get:()=>localStorage.getItem("metro/state:"+t),set:n=>localStorage.setItem("metro/state:"+t,n),has:()=>localStorage.getItem("metro/state:"+t)!==null,delete:()=>localStorage.remoteItem("metro/state:"+t)},r={get:n=>JSON.parse(localStorage.getItem(t+":"+n)),set:(n,i)=>localStorage.setItem(t+":"+n,JSON.stringify(i)),has:n=>localStorage.getItem(t+":"+n)!==null,delete:n=>localStorage.removeItem(t+":"+n)};else{let n=new Map;e={get:()=>n.get("metro/state:"+t),set:i=>n.set("metro/state:"+t,i),has:()=>n.has("metro/state:"+t),delete:()=>n.delete("metro/state:"+t)},r=new Map}return{state:e,tokens:r}}function Mn(t){let e={client:ee(),force_authorization:!1,site:"default",oauth2_configuration:{authorization_endpoint:"/authorize",token_endpoint:"/token",redirect_uri:globalThis.document?.location.href,grant_type:"authorization_code",code_verifier:bf(64)},authorize_callback:async f=>(window.location.href!=f.href&&window.location.replace(f.href),!1)};Q(t,{});let r=Object.assign({},e.oauth2_configuration,t?.oauth2_configuration);t=Object.assign({},e,t),t.oauth2_configuration=r;let n=Ms(t.site);t.tokens||(t.tokens=n.tokens),t.state||(t.state=n.state),Q(t,{oauth2_configuration:{client_id:j(/.+/),grant_type:"authorization_code",authorization_endpoint:j(v),token_endpoint:j(v),redirect_uri:j(v)}});for(let f in r)switch(f){case"access_token":case"authorization_code":case"refresh_token":t.tokens.set(f,r[f]);break}return async function(f,c){if(t.force_authorization)return i(f,c);let d;try{if(d=await c(f),d.ok)return d}catch(h){switch(d?.status){case 400:case 401:return i(f,c)}throw h}if(!d.ok)switch(d.status){case 400:case 401:return i(f,c)}return d};async function i(f,c){s();let d=t.tokens.get("access_token"),h=t.tokens.get("refresh_token"),y=yf(d);if(!d||y&&!h){try{if(!await o())return Et("false")}catch(_){throw _}return i(f,c)}else if(y&&h){try{if(!await a())return Et("false")}catch(_){throw _}return i(f,c)}else return f=Xe(f,{headers:{Authorization:d.type+" "+d.value}}),c(f)}function s(){if(typeof window<"u"&&window?.location){let f=$(window.location),c,d,h;if(f.searchParams.has("code"))h=f.searchParams,f=f.with({search:""}),history.pushState({},"",f.href);else if(f.hash){let y=f.hash.substr(1);h=new URLSearchParams("?"+y),f=f.with({hash:""}),history.pushState({},"",f.href)}if(h){c=h.get("code"),d=h.get("state");let y=t.state.get("metro/state");if(!d||d!==y)return;c&&t.tokens.set("authorization_code",c)}}}async function o(){if(r.grant_type==="authorization_code"&&!t.tokens.has("authorization_code")){let h=await l();if(!t.authorize_callback||typeof t.authorize_callback!="function")throw W("oauth2mw: oauth2 with grant_type:authorization_code requires a callback function in client options.authorize_callback");let y=await t.authorize_callback(h);if(y)t.tokens.set("authorization_code",y);else return!1}let f=u(),c=await t.client.post(f);if(!c.ok){let h=await c.text();throw W("OAuth2mw: fetch access_token: "+c.status+": "+c.statusText,{cause:f})}let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Us(d.expires_in),type:d.token_type,scope:d.scope}),d.refresh_token){let h={value:d.refresh_token};t.tokens.set("refresh_token",h)}return t.tokens.delete("authorization_code"),d}async function a(){let f=u("refresh_token"),c=await t.client.post(f);if(!c.ok)throw W("OAuth2mw: refresh access_token: "+c.status+": "+c.statusText,{cause:f});let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Us(d.expires_in),type:d.token_type,scope:d.scope}),d.refresh_token){let h={value:d.refresh_token};t.tokens.set("refresh_token",h)}else return!1;return d}async function l(){if(!r.authorization_endpoint)throw W("oauth2mw: Missing options.oauth2_configuration.authorization_endpoint");let f=$(r.authorization_endpoint,{hash:""});Q(r,{client_id:/.+/,redirect_uri:/.+/,scope:/.*/});let c={response_type:"code",client_id:r.client_id,redirect_uri:r.redirect_uri,state:r.state||mf(40)};return r.response_type&&(c.response_type=r.response_type),r.response_mode&&(c.response_mode=r.response_mode),t.state.set(c.state),r.client_secret&&(c.client_secret=r.client_secret),r.code_verifier&&(t.tokens.set("code_verifier",r.code_verifier),c.code_challenge=await gf(r.code_verifier),c.code_challenge_method="S256"),r.scope&&(c.scope=r.scope),r.prompt&&(c.prompt=r.prompt),$(f,{search:c})}function u(f=null){if(Q(r,{client_id:/.+/,redirect_uri:/.+/}),!r.token_endpoint)throw W("oauth2mw: Missing options.endpoints.token url");let c=$(r.token_endpoint,{hash:""}),d={grant_type:f||r.grant_type,client_id:r.client_id};switch(r.client_secret&&(d.client_secret=r.client_secret),r.scope&&(d.scope=r.scope),d.grant_type){case"authorization_code":d.redirect_uri=r.redirect_uri,d.code=t.tokens.get("authorization_code");let h=t.tokens.get("code_verifier");h&&(d.code_verifier=h);break;case"client_credentials":break;case"refresh_token":let y=t.tokens.get("refresh_token");d.refresh_token=y.value;break;default:throw new Error("Unknown grant_type: ".oauth2.grant_type)}return Xe(c,{method:"POST",body:new URLSearchParams(d)})}}function yf(t){if(!t)return!0;let e=new Date(t.expires);return new Date().getTime()>e.getTime()}function Us(t){if(t instanceof Date)return new Date(t.getTime());if(typeof t=="number"){let e=new Date;return e.setSeconds(e.getSeconds()+t),e}throw new TypeError("Unknown expires type "+t)}function bf(t=64){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),$s(e)}async function gf(t){let r=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",r);return $s(n)}function $s(t){let e=Array.from(new Uint8Array(t),r=>String.fromCharCode(r)).join("");return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function mf(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",n=0;for(;n<t;)r+=e.charAt(Math.floor(Math.random()*e.length)),n++;return r}function qs(){let t=new URL(document.location.href);if(!t.searchParams.has("code")){if(t.hash){let e=t.hash.substr(1);if(params=new URLSearchParams("?"+e),params.has("code"))return!0}return!1}return!0}function Un(){return new Promise((t,e)=>{let r=globalThis.indexedDB.open("metro",1);r.onupgradeneeded=()=>r.result.createObjectStore("keyPairs",{keyPath:"domain"}),r.onerror=n=>{e(n)},r.onsuccess=n=>{let i=n.target.result;t({set:function(s,o){return new Promise((a,l)=>{let u=i.transaction("keyPairs","readwrite",{durability:"strict"}),f=u.objectStore("keyPairs");u.oncomplete=()=>{a()},u.onerror=l,f.put(s,o)})},get:function(s){return new Promise((o,a)=>{let l=i.transaction("keyPairs","readonly"),f=l.objectStore("keyPairs").get(s);f.onsuccess=()=>{o(f.result)},f.onerror=a,l.onerror=a})},clear:function(){return new Promise((s,o)=>{let a=i.transaction("keyPairs","readwrite"),u=a.objectStore("keyPairs").clear();u.onsuccess=()=>{s()},u.onerror=o,a.onerror=o})}})}})}var xf=new TextEncoder,Sf=new TextDecoder;function Mr(t){return typeof t=="string"?xf.encode(t):Sf.decode(t)}function Ws(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new $n(`${t.name} modulusLength must be at least 2048 bits`)}function Ef(t){switch(t.algorithm.name){case"ECDSA":return{name:t.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return Ws(t.algorithm),{name:t.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return Ws(t.algorithm),{name:t.algorithm.name};case"Ed25519":return{name:t.algorithm.name}}throw new Me}async function Rf(t,e,r){if(r.usages.includes("sign")===!1)throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');let n=`${ir(Mr(JSON.stringify(t)))}.${ir(Mr(JSON.stringify(e)))}`,i=ir(await crypto.subtle.sign(Ef(r),r,Mr(n)));return`${n}.${i}`}var Gs=32768;function If(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));let e=[];for(let r=0;r<t.byteLength;r+=Gs)e.push(String.fromCharCode.apply(null,t.subarray(r,r+Gs)));return btoa(e.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ir(t){return If(t)}function Af(){return ir(crypto.getRandomValues(new Uint8Array(32)))}var Me=class extends Error{constructor(e){super(e??"operation not supported"),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},$n=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};function Tf(t){switch(t.algorithm.hash.name){case"SHA-256":return"PS256";default:throw new Me("unsupported RsaHashedKeyAlgorithm hash name")}}function vf(t){switch(t.algorithm.hash.name){case"SHA-256":return"RS256";default:throw new Me("unsupported RsaHashedKeyAlgorithm hash name")}}function Nf(t){switch(t.algorithm.namedCurve){case"P-256":return"ES256";default:throw new Me("unsupported EcKeyAlgorithm namedCurve")}}function jf(t){switch(t.algorithm.name){case"RSA-PSS":return Tf(t);case"RSASSA-PKCS1-v1_5":return vf(t);case"ECDSA":return Nf(t);case"Ed25519":return"EdDSA";default:throw new Me("unsupported CryptoKey algorithm name")}}function zs(t){return t instanceof CryptoKey}function kf(t){return zs(t)&&t.type==="private"}function Pf(t){return zs(t)&&t.type==="public"}function Lf(){return Math.floor(Date.now()/1e3)}async function Ur(t,e,r,n,i,s){let o=t?.privateKey,a=t?.publicKey;if(!kf(o))throw new TypeError('"keypair.privateKey" must be a private CryptoKey');if(!Pf(a))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(a.extractable!==!0)throw new TypeError('"keypair.publicKey.extractable" must be true');if(typeof e!="string")throw new TypeError('"htu" must be a string');if(typeof r!="string")throw new TypeError('"htm" must be a string');if(n!==void 0&&typeof n!="string")throw new TypeError('"nonce" must be a string or undefined');if(i!==void 0&&typeof i!="string")throw new TypeError('"accessToken" must be a string or undefined');if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw new TypeError('"additional" must be an object');return Rf({alg:jf(o),typ:"dpop+jwt",jwk:await Of(a)},{...s,iat:Lf(),jti:Af(),htm:r,nonce:n,htu:e,ath:i?ir(await crypto.subtle.digest("SHA-256",Mr(i))):void 0},o)}async function Of(t){let{kty:e,e:r,n,x:i,y:s,crv:o}=await crypto.subtle.exportKey("jwk",t);return{kty:e,crv:o,e:r,n,x:i,y:s}}async function Hs(t,e){let r;if(typeof t!="string"||t.length===0)throw new TypeError('"alg" must be a non-empty string');switch(t){case"PS256":r={name:"RSA-PSS",hash:"SHA-256",modulusLength:e?.modulusLength??2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":r={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:e?.modulusLength??2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":r={name:"ECDSA",namedCurve:"P-256"};break;case"EdDSA":r={name:"Ed25519"};break;default:throw new Me}return crypto.subtle.generateKey(r,e?.extractable??!1,["sign","verify"])}function qn(t){return Q(t,{site:j(v),authorization_endpoint:j(v),token_endpoint:j(v),dpop_signing_alg_values_supported:w([])}),async(e,r)=>{let n=await Un(),i=await n.get(t.site);if(!i){let a=await Hs("ES256");i={domain:t.site,keyPair:a},await n.set(i)}let s=ce.url(e.url);if(e.url.startsWith(t.authorization_endpoint)){let a=e.body;a instanceof URLSearchParams||a instanceof FormData?a.set("dpop_jkt",i.keyPair.publicKey):a.dpop_jkt=i.keyPair.publicKey}else if(e.url.startsWith(t.token_endpoint)){let a=await Ur(i.keyPair,e.url,e.method);e=e.with({headers:{DPoP:a}})}else if(e.headers.has("Authorization")){let a=localStorage.getItem(s.host+":nonce")||void 0,l=e.headers.get("Authorization").split(" ")[1],u=await Ur(i.keyPair,e.url,e.method,a,l);e=e.with({headers:{Authorization:"DPoP "+l,DPoP:u}})}let o=await r(e);return o.headers.get("DPoP-Nonce")&&localStorage.setItem(s.host+":nonce",o.headers.get("DPoP-Nonce")),o}}var sr=(...t)=>(e,r)=>t.filter(n=>r.hasOwnKey(n)).length>0?!1:P("root data must have all of",r,t),Ue=(...t)=>e=>Array.isArray(e)&&t.filter(r=>!e.includes(r)).length==0?!1:P("data must be an array which includes",e,t);var oe=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],$r=["client_secret_post","client_secret_basic","client_secret_jwt","private_key_jwt"];async function or(t={}){Q(t,{client:w(Tt(ce.client().constructor)),issuer:j(v)});let e={client:ce.client().with(fe()).with(ue()),requireDynamicRegistration:!1};t=Object.assign({},e,t);let r=!1;function n(l){return r}let i={issuer:j(Cs(t.issuer,n)),authorization_endpoint:j(v),token_endpoint:j(v),userinfo_endpoint:rr(v),jwks_uri:j(v),registration_endpoint:t.requireDynamicRegistration?j(v):rr(v),scopes_supported:rr(Ue("openid")),response_types_supported:t.requireDynamicRegistration?j(Ue("code","id_token","id_token token")):j([]),response_modes_supported:w([]),grant_types_supported:t.requireDynamicRegistration?w(Ue("authorization_code")):w([]),acr_values_supported:w([]),subject_types_supported:j([]),id_token_signing_alg_values_supported:j(Ue("RS256")),id_token_encryption_alg_values_supported:w([]),id_token_encryption_enc_values_supported:w([]),userinfo_signing_alg_values_supported:w([]),userinfo_encryption_alg_values_supported:w([]),userinfo_encryption_enc_values_supported:w([]),request_object_signing_alg_values_supported:w(Ue("RS256")),request_object_encryption_alg_values_supported:w([]),request_object_encryption_enc_values_supported:w([]),token_endpoint_auth_methods_supported:w(At(...$r)),token_endpoint_auth_signing_alg_values_supported:w(Ue("RS256"),nr(Ue("none"))),display_values_supported:w(At("page","popup","touch","wap")),claim_types_supported:w(At("normal","aggregated","distributed")),claims_supported:rr([]),service_documentation:w(v),claims_locales_supported:w([]),ui_locales_supported:w([]),claims_parameter_supported:w(Boolean),request_parameter_supported:w(Boolean),request_uri_parameter_supported:w(Boolean),op_policy_uri:w(v),op_tos_uri:w(v)},s=ce.url(t.issuer,".well-known/openid-configuration"),a=(await t.client.get(s)).data;return Q(a,i),Q(a.issuer,t.issuer),a}async function ar(t){let e={redirect_uris:j([v]),response_types:w([]),grant_types:w(At("authorization_code","refresh_token")),application_type:w(J("native","web")),contacts:w([Ds]),client_name:w(String),logo_uri:w(v),client_uri:w(v),policy_uri:w(v),tos_uri:w(v),jwks_uri:w(v,nr(sr("jwks"))),jwks:w(v,nr(sr("jwks_uri"))),sector_identifier_uri:w(v),subject_type:w(String),id_token_signed_response_alg:w(J(...oe)),id_token_encrypted_response_alg:w(J(...oe)),id_token_encrypted_response_enc:w(J(...oe),sr("id_token_encrypted_response_alg")),userinfo_signed_response_alg:w(J(...oe)),userinfo_encrypted_response_alg:w(J(...oe)),userinfo_encrypted_response_enc:w(J(...oe),sr("userinfo_encrypted_response_alg")),request_object_signing_alg:w(J(...oe)),request_object_encryption_alg:w(J(...oe)),request_object_encryption_enc:w(J(...oe)),token_endpoint_auth_method:w(J(...$r)),token_endpoint_auth_signing_alg:w(J(...oe)),default_max_age:w(Number),require_auth_time:w(Boolean),default_acr_values:w([String]),initiate_login_uri:w([v]),request_uris:w([v])};Q(t,{client:w(Tt(ce.client().constructor)),registration_endpoint:v,client_info:e});let r={client:ce.client().with(fe()).with(ue()),client_info:{redirect_uris:[globalThis.document?.location.href]}};t=Object.assign({},r,t),t.client_info||(t.client_info={}),t.client_info.redirect_uris||(t.client_info.redirect_uris=[globalThis.document?.location.href]);let n=await t.client.post(t.registration_endpoint,{body:t.client_info}),i=n.data;if(!i.client_id||!i.client_secret)throw ce.metroError("metro.oidc: Error: dynamic registration of client failed, no client_id or client_secret returned",n);return t.client_info=Object.assign(t.client_info,i),t.client_info}function qr(t){let e;if(typeof localStorage<"u")e={get:r=>JSON.parse(localStorage.getItem("metro/oidc:"+t+":"+r)),set:(r,n)=>localStorage.setItem("metro/oidc:"+t+":"+r,JSON.stringify(n)),has:r=>localStorage.getItem("metro/oidc:"+t+":"+r)!==null};else{let r=new Map;e={get:n=>JSON.parse(r.get("metro/oidc:"+t+":"+n)||null),set:(n,i)=>r.set("metro/oidc:"+t+":"+n,JSON.stringify(i)),has:n=>r.has("metro/oidc:"+t+":"+n)}}return e}function Wn(t={}){let e={client:ee(),force_authorization:!1,use_dpop:!0,authorize_callback:async r=>(window.location.href!=r.href&&window.location.replace(r.href),!1)};return t=Object.assign({},e,t),Q(t,{client:j(Tt(ee().constructor)),client_info:j(),issuer:j(v),oauth2:w({}),openid_configuration:w()}),t.store||(t.store=qr(t.issuer)),!t.openid_configuration&&t.store.has("openid_configuration")&&(t.openid_configuration=t.store.get("openid_configuration")),!t.client_info?.client_id&&t.store.has("client_info")&&(t.client_info=t.store.get("client_info")),async(r,n)=>{let i;if(!t.force_authorization){try{i=await n(r)}catch(u){if(i.status!=401&&i.status!=403)throw u}if(i.ok||i.status!=401&&i.status!=403)return i}if(t.openid_configuration||(t.openid_configuration=await or({issuer:t.issuer}),t.store.set("openid_configuration",t.openid_configuration)),!t.client_info?.client_id){if(!t.openid_configuration.registration_endpoint)throw W("metro.oidcmw: Error: issuer "+t.issuer+" does not support dynamic client registration, but you haven't specified a client_id");t.client_info=await ar({registration_endpoint:t.openid_configuration.registration_endpoint,client_info:t.client_info}),t.store.set("client_info",t.client_info)}let s=t.scope||"openid",o=Object.assign({site:t.issuer,client:t.client,force_authorization:!0,authorize_callback:t.authorize_callback,oauth2_configuration:{client_id:t.client_info?.client_id,client_secret:t.client_info?.client_secret,grant_type:"authorization_code",response_type:"code",response_mode:"query",authorization_endpoint:t.openid_configuration.authorization_endpoint,token_endpoint:t.openid_configuration.token_endpoint,scope:s,redirect_uri:t.client_info.redirect_uris[0]}}),a=async(u,f)=>{let c=await f(u);if(c.headers.get("content-type")?.startsWith("application/json")){let h=c.data?.id_token;if(!h){let y=c.clone();try{let _=await y.json();_&&_.id_token&&(h=_.id_token)}catch{}}h&&t.store.set("id_token",h)}return c},l=t.client.with(t.issuer).with(a);if(t.use_dpop){let u={site:t.issuer,authorization_endpoint:t.openid_configuration.authorization_endpoint,token_endpoint:t.openid_configuration.token_endpoint,dpop_signing_alg_values_supported:t.openid_configuration.dpop_signing_alg_values_supported};l=l.with(qn(u)),o.client=l}return l=l.with(Mn(o)),i=await l.fetch(r),i}}function Qs(){return qs()}function Ks(t){if(!t.store){if(!t.issuer)throw W("Must supply options.issuer or options.store to get the id_token");t.store=qr(t.issuer)}return t.store.get("id_token")}var Vs={oidcmw:Wn,discover:or,register:ar,isRedirected:Qs,idToken:Ks};globalThis.metro.oidc||(globalThis.metro.oidc=Vs);var Js=Vs;function Hn(t){return new Gn(t)}var Qn="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Bf={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",solid:"http://www.w3.org/ns/solid/terms#",schema:"http://schema.org/",vcard:"http://www.w3.org/2006/vcard/ns#"},Gn=class{constructor(e){this.prefixes={...Bf,...e?.prefixes},this.prefixes.xsd||(this.prefixes.xsd="http://www.w3.org/2001/XMLSchema#"),this.parser=e?.parser,this.writer=e?.writer,this.sources=Object.create(null),this.separator=e?.separator??"$"}parse(e,r,n){let{quads:i,prefixes:s}=this.parser(e,r,n);if(s)for(let o in s){let a=s[o];if(a.match(/^http(s?):\/\/$/i))a+=r.substring(a.length);else try{a=new URL(s[o],r).href}catch(l){console.error("Could not parse prefix",s[o],l.message)}this.prefixes[o]||(this.prefixes[o]=a)}return this.sources[r]=new zn(i,r,n,s,this),this.sources[r]}setType(e,r){if(!r)return e;if(typeof e=="string"?e=new String(e):typeof result=="number"&&(e=new Number(e)),typeof e!="object")throw new Error("cannot set type on ",e,r);return e.type=r,e}getType(e){return e&&typeof e=="object"?e.type:null}},zn=class{#e=Object.create(null);constructor(e,r,n,i,s){this.mimetype=n,this.url=r,this.prefixes=i,this.context=s,this.subjects=Object.create(null);for(let o of e){let a;if(o.subject.termType=="BlankNode"){let l=this.shortURI(o.predicate.id,":"),u;switch(l){case"rdf:first":if(a=this.addCollection(o.subject.id),u=this.shortURI(o.object.id,":"),u!="rdf:nil"){let f=this.getValue(o.object);f&&a.push(f)}continue;case"rdf:rest":this.#e[o.object.id]=this.#e[o.subject.id];continue;default:a=this.addBlankNode(o.subject.id);break}}else a=this.addNamedNode(o.subject.id);a.addPredicate(o.predicate.id,o.object)}this.subjects[r]?this.primary=this.subjects[r]:this.primary=null,Object.defineProperty(this,"data",{get(){return Object.values(this.subjects)}})}addNamedNode(e){let r=new URL(e,this.url).href;return this.subjects[r]||(this.subjects[r]=new vt(r,this)),this.subjects[r]}addBlankNode(e){return this.#e[e]||(this.#e[e]=new tt(this)),this.#e[e]}addCollection(e){return this.#e[e]||(this.#e[e]=new Nt(this)),this.#e[e]}write(){return this.context.writer(this)}get(e){return this.subjects[this.fullURI(e)]}fullURI(e,r=null){r||(r=this.context.separator);let[n,i]=e.split(r);return i?this.prefixes[n]+i:e}shortURI(e,r=null){r||(r=this.context.separator);for(let n in this.context.prefixes)if(e.startsWith(this.context.prefixes[n]))return n+r+e.substring(this.context.prefixes[n].length);return this.url&&e.startsWith(this.url)?e.substring(this.url.length):e}setType(e,r){let n=this.shortURI(r);return this.context.setType(e,n)}getType(e){return this.context.getType(e)}setLanguage(e,r){if(typeof e=="string"?e=new String(e):typeof result=="number"&&(e=new Number(e)),typeof e!="object")throw new Error("cannot set language on ",e);return e.language=r,e}getValue(e){let r;if(e.termType=="Literal"){r=e.value;let n=e.datatype?.id;n&&(r=this.setType(r,n));let i=e.language;i&&(r=this.setLanguage(r,i))}else e.termType=="BlankNode"?r=this.addBlankNode(e.id):r=this.addNamedNode(e.id);return r}},tt=class{constructor(e){Object.defineProperty(this,"graph",{value:e,writable:!1,enumerable:!1})}addPredicate(e,r){if(e.id&&(e=e.id),e==Qn){let n=this.graph.shortURI(r.id);this.addType(n)}else{let n=this.graph.getValue(r);e=this.graph.shortURI(e),this[e]?Array.isArray(this[e])?this[e].push(n):this[e]=[this[e],n]:this[e]=n}}addType(e){this.a?(Array.isArray(this.a)||(this.a=[this.a]),this.a.push(e)):this.a=e}},vt=class extends tt{constructor(e,r){super(r),Object.defineProperty(this,"id",{value:e,writable:!1,enumerable:!0})}},Nt=class extends Array{constructor(e,r){super(),Object.defineProperty(this,"graph",{value:r,writable:!1,enumerable:!1})}};var As={};Cn(As,{n3Parser:()=>ob,n3Writer:()=>ab});var mo=Cr(pe());var ur="http://www.w3.org/1999/02/22-rdf-syntax-ns#",fr="http://www.w3.org/2001/XMLSchema#",Hr="http://www.w3.org/2000/10/swap/",B={xsd:{decimal:`${fr}decimal`,boolean:`${fr}boolean`,double:`${fr}double`,integer:`${fr}integer`,string:`${fr}string`},rdf:{type:`${ur}type`,nil:`${ur}nil`,first:`${ur}first`,rest:`${ur}rest`,langString:`${ur}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Hr}reify#forSome`,forAll:`${Hr}reify#forAll`},log:{implies:`${Hr}log#implies`,isImpliedBy:`${Hr}log#isImpliedBy`}};var{xsd:Qr}=B,pc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,go={"\\":"\\","'":"'",'"':'"',n:`
1
+ (()=>{var rf=Object.create;var Fn=Object.defineProperty;var nf=Object.getOwnPropertyDescriptor;var sf=Object.getOwnPropertyNames;var of=Object.getPrototypeOf,af=Object.prototype.hasOwnProperty;var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Cn=(t,e)=>{for(var r in e)Fn(t,r,{get:e[r],enumerable:!0})},lf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of sf(e))!af.call(t,i)&&i!==r&&Fn(t,i,{get:()=>e[i],enumerable:!(n=nf(e,i))||n.enumerable});return t};var Cr=(t,e,r)=>(r=t!=null?rf(of(t)):{},lf(e||!t||!t.__esModule?Fn(r,"default",{value:t,enumerable:!0}):r,t));var Xs=T(Wr=>{"use strict";Wr.byteLength=Cf;Wr.toByteArray=Mf;Wr.fromByteArray=qf;var de=[],re=[],Ff=typeof Uint8Array<"u"?Uint8Array:Array,Kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(rt=0,Ys=Kn.length;rt<Ys;++rt)de[rt]=Kn[rt],re[Kn.charCodeAt(rt)]=rt;var rt,Ys;re[45]=62;re[95]=63;function Zs(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 n=r===e?0:4-r%4;return[r,n]}function Cf(t){var e=Zs(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Df(t,e,r){return(e+r)*3/4-r}function Mf(t){var e,r=Zs(t),n=r[0],i=r[1],s=new Ff(Df(t,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=re[t.charCodeAt(l)]<<18|re[t.charCodeAt(l+1)]<<12|re[t.charCodeAt(l+2)]<<6|re[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=re[t.charCodeAt(l)]<<2|re[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=re[t.charCodeAt(l)]<<10|re[t.charCodeAt(l+1)]<<4|re[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Uf(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function $f(t,e,r){for(var n,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(t[s+2]&255),i.push(Uf(n));return i.join("")}function qf(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push($f(t,o,o+s>a?a:o+s));return n===1?(e=t[r-1],i.push(de[e>>2]+de[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(de[e>>10]+de[e>>4&63]+de[e<<2&63]+"=")),i.join("")}});var eo=T(Vn=>{Vn.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,u=l>>1,f=-7,c=r?i-1:0,d=r?-1:1,h=t[e+c];for(c+=d,s=h&(1<<-f)-1,h>>=-f,f+=a;f>0;s=s*256+t[e+c],c+=d,f-=8);for(o=s&(1<<-f)-1,s>>=-f,f+=n;f>0;o=o*256+t[e+c],c+=d,f-=8);if(s===0)s=1-u;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(h?-1:1)*o*Math.pow(2,s-n)};Vn.write=function(t,e,r,n,i,s){var o,a,l,u=s*8-i-1,f=(1<<u)-1,c=f>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,y=n?1:-1,_=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=f):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?e+=d/l:e+=d*Math.pow(2,1-c),e*l>=2&&(o++,l/=2),o+c>=f?(a=0,o=f):o+c>=1?(a=(e*l-1)*Math.pow(2,i),o=o+c):(a=e*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;t[r+h]=a&255,h+=y,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[r+h]=o&255,h+=y,o/=256,u-=8);t[r+h-y]|=_*128}});var pe=T(Lt=>{"use strict";var Jn=Xs(),kt=eo(),to=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Lt.Buffer=p;Lt.SlowBuffer=Kf;Lt.INSPECT_MAX_BYTES=50;var Gr=2147483647;Lt.kMaxLength=Gr;p.TYPED_ARRAY_SUPPORT=Wf();!p.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Wf(){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{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function ve(t){if(t>Gr)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,p.prototype),e}function p(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 ei(t)}return so(t,e,r)}p.poolSize=8192;function so(t,e,r){if(typeof t=="string")return zf(t,e);if(ArrayBuffer.isView(t))return Hf(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(he(t,ArrayBuffer)||t&&he(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he(t,SharedArrayBuffer)||t&&he(t.buffer,SharedArrayBuffer)))return Zn(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return p.from(n,e,r);let i=Qf(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return p.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)}p.from=function(t,e,r){return so(t,e,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function oo(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 Gf(t,e,r){return oo(t),t<=0?ve(t):e!==void 0?typeof r=="string"?ve(t).fill(e,r):ve(t).fill(e):ve(t)}p.alloc=function(t,e,r){return Gf(t,e,r)};function ei(t){return oo(t),ve(t<0?0:ti(t)|0)}p.allocUnsafe=function(t){return ei(t)};p.allocUnsafeSlow=function(t){return ei(t)};function zf(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ao(t,e)|0,n=ve(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Yn(t){let e=t.length<0?0:ti(t.length)|0,r=ve(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Hf(t){if(he(t,Uint8Array)){let e=new Uint8Array(t);return Zn(e.buffer,e.byteOffset,e.byteLength)}return Yn(t)}function Zn(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 n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,p.prototype),n}function Qf(t){if(p.isBuffer(t)){let e=ti(t.length)|0,r=ve(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||ni(t.length)?ve(0):Yn(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Yn(t.data)}function ti(t){if(t>=Gr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Gr.toString(16)+" bytes");return t|0}function Kf(t){return+t!=t&&(t=0),p.alloc(+t)}p.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==p.prototype};p.compare=function(e,r){if(he(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),he(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),!p.isBuffer(e)||!p.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==r[s]){n=e[s],i=r[s];break}return n<i?-1:i<n?1:0};p.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}};p.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=p.allocUnsafe(r),s=0;for(n=0;n<e.length;++n){let o=e[n];if(he(o,Uint8Array))s+o.length>i.length?(p.isBuffer(o)||(o=p.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(p.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function ao(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||he(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,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Xn(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return bo(t).length;default:if(i)return n?-1:Xn(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=ao;function Vf(t,e,r){let n=!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 sc(this,e,r);case"utf8":case"utf-8":return uo(this,e,r);case"ascii":return nc(this,e,r);case"latin1":case"binary":return ic(this,e,r);case"base64":return tc(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oc(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function nt(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}p.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)nt(this,r,r+1);return this};p.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)nt(this,r,r+3),nt(this,r+1,r+2);return this};p.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)nt(this,r,r+7),nt(this,r+1,r+6),nt(this,r+2,r+5),nt(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?uo(this,0,e):Vf.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0};p.prototype.inspect=function(){let e="",r=Lt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};to&&(p.prototype[to]=p.prototype.inspect);p.prototype.compare=function(e,r,n,i,s){if(he(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.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),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-r,l=Math.min(o,a),u=this.slice(i,s),f=e.slice(r,n);for(let c=0;c<l;++c)if(u[c]!==f[c]){o=u[c],a=f[c];break}return o<a?-1:a<o?1:0};function lo(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,ni(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),p.isBuffer(e))return e.length===0?-1:ro(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ro(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ro(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(f,c){return s===1?f[c]:f.readUInt16BE(c*s)}let u;if(i){let f=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===a)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let f=!0;for(let c=0;c<a;c++)if(l(t,u+c)!==l(e,c)){f=!1;break}if(f)return u}return-1}p.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};p.prototype.indexOf=function(e,r,n){return lo(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return lo(this,e,r,n,!1)};function Jf(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let a=parseInt(e.substr(o*2,2),16);if(ni(a))return o;t[r+o]=a}return o}function Yf(t,e,r,n){return zr(Xn(e,t.length-r),t,r,n)}function Zf(t,e,r,n){return zr(fc(e),t,r,n)}function Xf(t,e,r,n){return zr(bo(e),t,r,n)}function ec(t,e,r,n){return zr(cc(e,t.length-r),t,r,n)}p.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return Jf(this,e,r,n);case"utf8":case"utf-8":return Yf(this,e,r,n);case"ascii":case"latin1":case"binary":return Zf(this,e,r,n);case"base64":return Xf(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ec(this,e,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function tc(t,e,r){return e===0&&r===t.length?Jn.fromByteArray(t):Jn.fromByteArray(t.slice(e,r))}function uo(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let s=t[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=r){let l,u,f,c;switch(a){case 1:s<128&&(o=s);break;case 2:l=t[i+1],(l&192)===128&&(c=(s&31)<<6|l&63,c>127&&(o=c));break;case 3:l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(c=(s&15)<<12|(l&63)<<6|u&63,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:l=t[i+1],u=t[i+2],f=t[i+3],(l&192)===128&&(u&192)===128&&(f&192)===128&&(c=(s&15)<<18|(l&63)<<12|(u&63)<<6|f&63,c>65535&&c<1114112&&(o=c))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return rc(n)}var no=4096;function rc(t){let e=t.length;if(e<=no)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=no));return r}function nc(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function ic(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function sc(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let s=e;s<r;++s)i+=dc[t[s]];return i}function oc(t,e,r){let n=t.slice(e,r),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}p.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,p.prototype),i};function q(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")}p.prototype.readUintLE=p.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return i};p.prototype.readUintBE=p.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e+--r],s=1;for(;r>0&&(s*=256);)i+=this[e+--r]*s;return i};p.prototype.readUint8=p.prototype.readUInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readBigUInt64LE=$e(function(e){e=e>>>0,Pt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&lr(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});p.prototype.readBigUInt64BE=$e(function(e){e=e>>>0,Pt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&lr(e,this.length-8);let i=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+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});p.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e],s=1,o=0;for(;++o<r&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*r)),i};p.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=r,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o};p.prototype.readInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,r){e=e>>>0,r||q(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(e,r){e=e>>>0,r||q(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};p.prototype.readInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readBigInt64LE=$e(function(e){e=e>>>0,Pt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&lr(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});p.prototype.readBigInt64BE=$e(function(e){e=e>>>0,Pt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&lr(e,this.length-8);let i=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});p.prototype.readFloatLE=function(e,r){return e=e>>>0,r||q(e,4,this.length),kt.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||q(e,4,this.length),kt.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||q(e,8,this.length),kt.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||q(e,8,this.length),kt.read(this,e,!1,52,8)};function Y(t,e,r,n,i,s){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Y(this,e,r,n,a,0)}let s=1,o=0;for(this[r]=e&255;++o<n&&(s*=256);)this[r+o]=e/s&255;return r+n};p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Y(this,e,r,n,a,0)}let s=n-1,o=1;for(this[r+s]=e&255;--s>=0&&(o*=256);)this[r+s]=e/o&255;return r+n};p.prototype.writeUint8=p.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,1,255,0),this[r]=e&255,r+1};p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(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};p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(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 fo(t,e,r,n,i){yo(e,n,i,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 co(t,e,r,n,i){yo(e,n,i,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}p.prototype.writeBigUInt64LE=$e(function(e,r=0){return fo(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=$e(function(e,r=0){return co(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Y(this,e,r,n,l-1,-l)}let s=0,o=1,a=0;for(this[r]=e&255;++s<n&&(o*=256);)e<0&&a===0&&this[r+s-1]!==0&&(a=1),this[r+s]=(e/o>>0)-a&255;return r+n};p.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Y(this,e,r,n,l-1,-l)}let s=n-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+n};p.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};p.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(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};p.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(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};p.prototype.writeBigInt64LE=$e(function(e,r=0){return fo(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=$e(function(e,r=0){return co(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ho(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function po(t,e,r,n,i){return e=+e,r=r>>>0,i||ho(t,e,r,4,34028234663852886e22,-34028234663852886e22),kt.write(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return po(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return po(this,e,r,!1,n)};function _o(t,e,r,n,i){return e=+e,r=r>>>0,i||ho(t,e,r,8,17976931348623157e292,-17976931348623157e292),kt.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return _o(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return _o(this,e,r,!1,n)};p.prototype.copy=function(e,r,n,i){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-r<i-n&&(i=e.length-r+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),s};p.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s<n;++s)this[s]=e;else{let o=p.isBuffer(e)?e:p.from(e,i),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-r;++s)this[s+r]=o[s%a]}return this};var jt={};function ri(t,e,r){jt[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(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}ri("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ri("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ri("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=io(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=io(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function io(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function ac(t,e,r){Pt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&lr(e,t.length-(r+1))}function yo(t,e,r,n,i,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 jt.ERR_OUT_OF_RANGE("value",a,t)}ac(n,i,s)}function Pt(t,e){if(typeof t!="number")throw new jt.ERR_INVALID_ARG_TYPE(e,"number",t)}function lr(t,e,r){throw Math.floor(t)!==t?(Pt(t,r),new jt.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new jt.ERR_BUFFER_OUT_OF_BOUNDS:new jt.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var lc=/[^+/0-9A-Za-z-_]/g;function uc(t){if(t=t.split("=")[0],t=t.trim().replace(lc,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Xn(t,e){e=e||1/0;let r,n=t.length,i=null,s=[];for(let o=0;o<n;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=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 fc(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function cc(t,e){let r,n,i,s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,s.push(i),s.push(n);return s}function bo(t){return Jn.toByteArray(uc(t))}function zr(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function he(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function ni(t){return t!==t}var dc=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e})();function $e(t){return typeof BigInt>"u"?hc:t}function hc(){throw new Error("BigInt not supported")}});var L=T((Vg,Lo)=>{"use strict";var li=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 n=0;n<e.length;n++)r+=` ${e[n].stack}
2
+ `;super(r),this.name="AggregateError",this.errors=e}};Lo.exports={AggregateError:li,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 ui=T((Jg,Oo)=>{"use strict";Oo.exports={format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}}}});var z=T((Yg,Co)=>{"use strict";var{format:Lc,inspect:Vr}=ui(),{AggregateError:Oc}=L(),Bc=globalThis.AggregateError||Oc,Fc=Symbol("kIsNodeError"),Cc=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Dc=/^([A-Z][a-z0-9]*)+$/,Mc="__node_internal_",Jr={};function ut(t,e){if(!t)throw new Jr.ERR_INTERNAL_ASSERTION(e)}function Bo(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Uc(t,e,r){if(typeof e=="function")return ut(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return ut(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Lc(e,...r)}function G(t,e,r){r||(r=Error);class n extends r{constructor(...s){super(Uc(t,e,s))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[Fc]=!0,Jr[t]=n}function Fo(t){let e=Mc+t.name;return Object.defineProperty(t,"name",{value:e}),t}function $c(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Bc([e,t],e.message);return r.code=e.code,r}return t||e}var fi=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Jr.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};G("ERR_ASSERTION","%s",Error);G("ERR_INVALID_ARG_TYPE",(t,e,r)=>{ut(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],s=[],o=[];for(let l of e)ut(typeof l=="string","All expected entries have to be of type string"),Cc.includes(l)?i.push(l.toLowerCase()):Dc.test(l)?s.push(l):(ut(l!=="object",'The value "object" should be written as "Object"'),o.push(l));if(s.length>0){let l=i.indexOf("object");l!==-1&&(i.splice(i,l,1),s.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let l=i.pop();n+=`one of type ${i.join(", ")}, or ${l}`}}(s.length>0||o.length>0)&&(n+=" or ")}if(s.length>0){switch(s.length){case 1:n+=`an instance of ${s[0]}`;break;case 2:n+=`an instance of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();n+=`an instance of ${s.join(", ")}, or ${l}`}}o.length>0&&(n+=" or ")}switch(o.length){case 0:break;case 1:o[0].toLowerCase()!==o[0]&&(n+="an "),n+=`${o[0]}`;break;case 2:n+=`one of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();n+=`one of ${o.join(", ")}, or ${l}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let l=Vr(r,{depth:-1});n+=`. Received ${l}`}}else{let l=Vr(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),n+=`. Received type ${typeof r} (${l})`}return n},TypeError);G("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=Vr(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);G("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);G("ERR_MISSING_ARGS",(...t)=>{ut(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);G("ERR_OUT_OF_RANGE",(t,e,r)=>{ut(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=Bo(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=Bo(n)),n+="n"}else n=Vr(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);G("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);G("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);G("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);G("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);G("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);G("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);G("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);G("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);G("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);G("ERR_STREAM_WRITE_AFTER_END","write after end",Error);G("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Co.exports={AbortError:fi,aggregateTwoErrors:Fo($c),hideStackFrames:Fo,codes:Jr}});var Dt=T((Zg,Yr)=>{"use strict";var{AbortController:Do,AbortSignal:qc}=typeof self<"u"?self:typeof window<"u"?window:void 0;Yr.exports=Do;Yr.exports.AbortSignal=qc;Yr.exports.default=Do});var yr=T((Xg,ci)=>{"use strict";var Mt=typeof Reflect=="object"?Reflect:null,Mo=Mt&&typeof Mt.apply=="function"?Mt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Zr;Mt&&typeof Mt.ownKeys=="function"?Zr=Mt.ownKeys:Object.getOwnPropertySymbols?Zr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Zr=function(e){return Object.getOwnPropertyNames(e)};function Wc(t){console&&console.warn&&console.warn(t)}var $o=Number.isNaN||function(e){return e!==e};function N(){N.init.call(this)}ci.exports=N;ci.exports.once=Qc;N.EventEmitter=N;N.prototype._events=void 0;N.prototype._eventsCount=0;N.prototype._maxListeners=void 0;var Uo=10;function Xr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(N,"defaultMaxListeners",{enumerable:!0,get:function(){return Uo},set:function(t){if(typeof t!="number"||t<0||$o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Uo=t}});N.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};N.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||$o(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 qo(t){return t._maxListeners===void 0?N.defaultMaxListeners:t._maxListeners}N.prototype.getMaxListeners=function(){return qo(this)};N.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){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")Mo(l,this,r);else for(var u=l.length,f=Qo(l,u),n=0;n<u;++n)Mo(f[n],this,r);return!0};function Wo(t,e,r,n){var i,s,o;if(Xr(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]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),i=qo(t),i>0&&o.length>i&&!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,Wc(a)}return t}N.prototype.addListener=function(e,r){return Wo(this,e,r,!1)};N.prototype.on=N.prototype.addListener;N.prototype.prependListener=function(e,r){return Wo(this,e,r,!0)};function Gc(){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 Go(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Gc.bind(n);return i.listener=r,n.wrapFn=i,i}N.prototype.once=function(e,r){return Xr(r),this.on(e,Go(this,e,r)),this};N.prototype.prependOnceListener=function(e,r){return Xr(r),this.prependListener(e,Go(this,e,r)),this};N.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Xr(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():zc(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};N.prototype.off=N.prototype.removeListener;N.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function zo(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Hc(i):Qo(i,i.length)}N.prototype.listeners=function(e){return zo(this,e,!0)};N.prototype.rawListeners=function(e){return zo(this,e,!1)};N.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Ho.call(t,e)};N.prototype.listenerCount=Ho;function Ho(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}N.prototype.eventNames=function(){return this._eventsCount>0?Zr(this._events):[]};function Qo(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function zc(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Hc(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Qc(t,e){return new Promise(function(r,n){function i(o){t.removeListener(e,s),n(o)}function s(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}Ko(t,e,s,{once:!0}),e!=="error"&&Kc(t,i,{once:!0})})}function Kc(t,e,r){typeof t.on=="function"&&Ko(t,"error",e,r)}function Ko(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(s){n.once&&t.removeEventListener(e,i),r(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var K=T((em,hi)=>{"use strict";var Vc=pe(),{format:Jc,inspect:Yc}=ui(),{codes:{ERR_INVALID_ARG_TYPE:di}}=z(),{kResistStopPropagation:Zc,AggregateError:Xc,SymbolDispose:ed}=L(),td=globalThis.AbortSignal||Dt().AbortSignal,rd=globalThis.AbortController||Dt().AbortController,nd=Object.getPrototypeOf(async function(){}).constructor,Vo=globalThis.Blob||Vc.Blob,id=typeof Vo<"u"?function(e){return e instanceof Vo}:function(e){return!1},Jo=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new di(e,"AbortSignal",t)},sd=(t,e)=>{if(typeof t!="function")throw new di(e,"Function",t)};hi.exports={AggregateError:Xc,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((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format:Jc,inspect:Yc,types:{isAsyncFunction(t){return t instanceof nd},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:id,deprecate(t,e){return t},addAbortListener:yr().addAbortListener||function(e,r){if(e===void 0)throw new di("signal","AbortSignal",e);Jo(e,"signal"),sd(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Zc]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[ed](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:td.any||function(e){if(e.length===1)return e[0];let r=new rd,n=()=>r.abort();return e.forEach(i=>{Jo(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};hi.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var $t=T((tm,oa)=>{"use strict";var{ArrayIsArray:_i,ArrayPrototypeIncludes:ea,ArrayPrototypeJoin:ta,ArrayPrototypeMap:od,NumberIsInteger:yi,NumberIsNaN:ad,NumberMAX_SAFE_INTEGER:ld,NumberMIN_SAFE_INTEGER:ud,NumberParseInt:fd,ObjectPrototypeHasOwnProperty:cd,RegExpPrototypeExec:ra,String:dd,StringPrototypeToUpperCase:hd,StringPrototypeTrim:pd}=L(),{hideStackFrames:ne,codes:{ERR_SOCKET_BAD_PORT:_d,ERR_INVALID_ARG_TYPE:H,ERR_INVALID_ARG_VALUE:Ut,ERR_OUT_OF_RANGE:ft,ERR_UNKNOWN_SIGNAL:Yo}}=z(),{normalizeEncoding:yd}=K(),{isAsyncFunction:bd,isArrayBufferView:gd}=K().types,Zo={};function md(t){return t===(t|0)}function wd(t){return t===t>>>0}var xd=/^[0-7]+$/,Sd="must be a 32-bit unsigned integer or an octal string";function Ed(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(ra(xd,t)===null)throw new Ut(e,t,Sd);t=fd(t,8)}return na(t,e),t}var Rd=ne((t,e,r=ud,n=ld)=>{if(typeof t!="number")throw new H(e,"number",t);if(!yi(t))throw new ft(e,"an integer",t);if(t<r||t>n)throw new ft(e,`>= ${r} && <= ${n}`,t)}),Id=ne((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new H(e,"number",t);if(!yi(t))throw new ft(e,"an integer",t);if(t<r||t>n)throw new ft(e,`>= ${r} && <= ${n}`,t)}),na=ne((t,e,r=!1)=>{if(typeof t!="number")throw new H(e,"number",t);if(!yi(t))throw new ft(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new ft(e,`>= ${n} && <= ${i}`,t)});function bi(t,e){if(typeof t!="string")throw new H(e,"string",t)}function Ad(t,e,r=void 0,n){if(typeof t!="number")throw new H(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&ad(t))throw new ft(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Td=ne((t,e,r)=>{if(!ea(r,t)){let i="must be one of: "+ta(od(r,s=>typeof s=="string"?`'${s}'`:dd(s)),", ");throw new Ut(e,t,i)}});function ia(t,e){if(typeof t!="boolean")throw new H(e,"boolean",t)}function pi(t,e,r){return t==null||!cd(t,e)?r:t[e]}var vd=ne((t,e,r=null)=>{let n=pi(r,"allowArray",!1),i=pi(r,"allowFunction",!1);if(!pi(r,"nullable",!1)&&t===null||!n&&_i(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new H(e,"Object",t)}),Nd=ne((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new H(e,"a dictionary",t)}),en=ne((t,e,r=0)=>{if(!_i(t))throw new H(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Ut(e,t,n)}});function jd(t,e){en(t,e);for(let r=0;r<t.length;r++)bi(t[r],`${e}[${r}]`)}function kd(t,e){en(t,e);for(let r=0;r<t.length;r++)ia(t[r],`${e}[${r}]`)}function Pd(t,e){en(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new H(i,"AbortSignal",n);sa(n,i)}}function Ld(t,e="signal"){if(bi(t,e),Zo[t]===void 0)throw Zo[hd(t)]!==void 0?new Yo(t+" (signals must use all capital letters)"):new Yo(t)}var Od=ne((t,e="buffer")=>{if(!gd(t))throw new H(e,["Buffer","TypedArray","DataView"],t)});function Bd(t,e){let r=yd(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Ut("encoding",e,`is invalid for data of length ${n}`)}function Fd(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&pd(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new _d(e,t,r);return t|0}var sa=ne((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new H(e,"AbortSignal",t)}),Cd=ne((t,e)=>{if(typeof t!="function")throw new H(e,"Function",t)}),Dd=ne((t,e)=>{if(typeof t!="function"||bd(t))throw new H(e,"Function",t)}),Md=ne((t,e)=>{if(t!==void 0)throw new H(e,"undefined",t)});function Ud(t,e,r){if(!ea(r,t))throw new H(e,`('${ta(r,"|")}')`,t)}var $d=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Xo(t,e){if(typeof t>"u"||!ra($d,t))throw new Ut(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function qd(t){if(typeof t=="string")return Xo(t,"hints"),t;if(_i(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];Xo(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Ut("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}oa.exports={isInt32:md,isUint32:wd,parseFileMode:Ed,validateArray:en,validateStringArray:jd,validateBooleanArray:kd,validateAbortSignalArray:Pd,validateBoolean:ia,validateBuffer:Od,validateDictionary:Nd,validateEncoding:Bd,validateFunction:Cd,validateInt32:Id,validateInteger:Rd,validateNumber:Ad,validateObject:vd,validateOneOf:Td,validatePlainFunction:Dd,validatePort:Fd,validateSignalName:Ld,validateString:bi,validateUint32:na,validateUndefined:Md,validateUnion:Ud,validateAbortSignal:sa,validateLinkHeaderValue:qd}});var He=T((rm,fa)=>{var F=fa.exports={},ye,be;function gi(){throw new Error("setTimeout has not been defined")}function mi(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ye=setTimeout:ye=gi}catch{ye=gi}try{typeof clearTimeout=="function"?be=clearTimeout:be=mi}catch{be=mi}})();function aa(t){if(ye===setTimeout)return setTimeout(t,0);if((ye===gi||!ye)&&setTimeout)return ye=setTimeout,setTimeout(t,0);try{return ye(t,0)}catch{try{return ye.call(null,t,0)}catch{return ye.call(this,t,0)}}}function Wd(t){if(be===clearTimeout)return clearTimeout(t);if((be===mi||!be)&&clearTimeout)return be=clearTimeout,clearTimeout(t);try{return be(t)}catch{try{return be.call(null,t)}catch{return be.call(this,t)}}}var je=[],qt=!1,ct,tn=-1;function Gd(){!qt||!ct||(qt=!1,ct.length?je=ct.concat(je):tn=-1,je.length&&la())}function la(){if(!qt){var t=aa(Gd);qt=!0;for(var e=je.length;e;){for(ct=je,je=[];++tn<e;)ct&&ct[tn].run();tn=-1,e=je.length}ct=null,qt=!1,Wd(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];je.push(new ua(t,e)),je.length===1&&!qt&&aa(la)};function ua(t,e){this.fun=t,this.array=e}ua.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function ke(){}F.on=ke;F.addListener=ke;F.once=ke;F.off=ke;F.removeListener=ke;F.removeAllListeners=ke;F.emit=ke;F.prependListener=ke;F.prependOnceListener=ke;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 me=T((nm,Ia)=>{"use strict";var{SymbolAsyncIterator:ca,SymbolIterator:da,SymbolFor:dt}=L(),ha=dt("nodejs.stream.destroyed"),pa=dt("nodejs.stream.errored"),wi=dt("nodejs.stream.readable"),xi=dt("nodejs.stream.writable"),_a=dt("nodejs.stream.disturbed"),zd=dt("nodejs.webstream.isClosedPromise"),Hd=dt("nodejs.webstream.controllerErrorFunction");function rn(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 nn(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 Qd(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function ge(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function ya(t){return!!(t&&!ge(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function ba(t){return!!(t&&!ge(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function ga(t){return!!(t&&!ge(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Kd(t){return ya(t)||ba(t)||ga(t)}function Vd(t,e){return t==null?!1:e===!0?typeof t[ca]=="function":e===!1?typeof t[da]=="function":typeof t[ca]=="function"||typeof t[da]=="function"}function sn(t){if(!ge(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[ha]||n!=null&&n.destroyed)}function ma(t){if(!nn(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Jd(t,e){if(!nn(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Yd(t){if(!rn(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function wa(t,e){if(!rn(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function xa(t){return t&&t[wi]!=null?t[wi]:typeof t?.readable!="boolean"?null:sn(t)?!1:rn(t)&&t.readable&&!wa(t)}function Sa(t){return t&&t[xi]!=null?t[xi]:typeof t?.writable!="boolean"?null:sn(t)?!1:nn(t)&&t.writable&&!ma(t)}function Zd(t,e){return ge(t)?sn(t)?!0:!(e?.readable!==!1&&xa(t)||e?.writable!==!1&&Sa(t)):null}function Xd(t){var e,r;return ge(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 eh(t){var e,r;return ge(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 th(t){if(!ge(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Ea(t)?t._closed:null}function Ea(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Ra(t){return typeof t._sent100=="boolean"&&Ea(t)}function rh(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 nh(t){if(!ge(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Ra(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function ih(t){var e;return!!(t&&((e=t[_a])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function sh(t){var e,r,n,i,s,o,a,l,u,f;return!!(t&&((e=(r=(n=(i=(s=(o=t[pa])!==null&&o!==void 0?o:t.readableErrored)!==null&&s!==void 0?s:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(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:!((f=t._writableState)===null||f===void 0)&&f.errored))}Ia.exports={isDestroyed:sn,kIsDestroyed:ha,isDisturbed:ih,kIsDisturbed:_a,isErrored:sh,kIsErrored:pa,isReadable:xa,kIsReadable:wi,kIsClosedPromise:zd,kControllerErrorFunction:Hd,kIsWritable:xi,isClosed:th,isDuplexNodeStream:Qd,isFinished:Zd,isIterable:Vd,isReadableNodeStream:rn,isReadableStream:ya,isReadableEnded:Yd,isReadableFinished:wa,isReadableErrored:eh,isNodeStream:ge,isWebStream:Kd,isWritable:Sa,isWritableNodeStream:nn,isWritableStream:ba,isWritableEnded:ma,isWritableFinished:Jd,isWritableErrored:Xd,isServerRequest:rh,isServerResponse:Ra,willEmitClose:nh,isTransformStream:ga}});var Pe=T((im,Ai)=>{"use strict";var Qe=He(),{AbortError:Oa,codes:oh}=z(),{ERR_INVALID_ARG_TYPE:ah,ERR_STREAM_PREMATURE_CLOSE:Aa}=oh,{kEmptyObject:Ei,once:Ri}=K(),{validateAbortSignal:lh,validateFunction:uh,validateObject:fh,validateBoolean:ch}=$t(),{Promise:dh,PromisePrototypeThen:hh,SymbolDispose:Ba}=L(),{isClosed:ph,isReadable:Ta,isReadableNodeStream:Si,isReadableStream:_h,isReadableFinished:va,isReadableErrored:Na,isWritable:ja,isWritableNodeStream:ka,isWritableStream:yh,isWritableFinished:Pa,isWritableErrored:La,isNodeStream:bh,willEmitClose:gh,kIsClosedPromise:mh}=me(),Wt;function wh(t){return t.setHeader&&typeof t.abort=="function"}var Ii=()=>{};function Fa(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Ei):e==null?e=Ei:fh(e,"options"),uh(r,"callback"),lh(e.signal,"options.signal"),r=Ri(r),_h(t)||yh(t))return xh(t,e,r);if(!bh(t))throw new ah("stream",["ReadableStream","WritableStream","Stream"],t);let s=(n=e.readable)!==null&&n!==void 0?n:Si(t),o=(i=e.writable)!==null&&i!==void 0?i:ka(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=gh(t)&&Si(t)===s&&ka(t)===o,c=Pa(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=va(t,!1),y=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},_=A=>{r.call(t,A)},x=ph(t),b=()=>{x=!0;let A=La(t)||Na(t);if(A&&typeof A!="boolean")return r.call(t,A);if(s&&!h&&Si(t,!0)&&!va(t,!1))return r.call(t,new Aa);if(o&&!c&&!Pa(t,!1))return r.call(t,new Aa);r.call(t)},g=()=>{x=!0;let A=La(t)||Na(t);if(A&&typeof A!="boolean")return r.call(t,A);r.call(t)},S=()=>{t.req.on("finish",d)};wh(t)?(t.on("complete",d),f||t.on("abort",b),t.req?S():t.on("request",S)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",y),t.on("finish",d),e.error!==!1&&t.on("error",_),t.on("close",b),x?Qe.nextTick(b):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Qe.nextTick(g):(!s&&(!f||Ta(t))&&(c||ja(t)===!1)||!o&&(!f||ja(t))&&(h||Ta(t)===!1)||l&&t.req&&t.aborted)&&Qe.nextTick(g);let m=()=>{r=Ii,t.removeListener("aborted",b),t.removeListener("complete",d),t.removeListener("abort",b),t.removeListener("request",S),t.req&&t.req.removeListener("finish",d),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",d),t.removeListener("end",y),t.removeListener("error",_),t.removeListener("close",b)};if(e.signal&&!x){let A=()=>{let Ae=r;m(),Ae.call(t,new Oa(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Qe.nextTick(A);else{Wt=Wt||K().addAbortListener;let Ae=Wt(e.signal,A),D=r;r=Ri((...St)=>{Ae[Ba](),D.apply(t,St)})}}return m}function xh(t,e,r){let n=!1,i=Ii;if(e.signal)if(i=()=>{n=!0,r.call(t,new Oa(void 0,{cause:e.signal.reason}))},e.signal.aborted)Qe.nextTick(i);else{Wt=Wt||K().addAbortListener;let o=Wt(e.signal,i),a=r;r=Ri((...l)=>{o[Ba](),a.apply(t,l)})}let s=(...o)=>{n||Qe.nextTick(()=>r.apply(t,o))};return hh(t[mh].promise,s,s),Ii}function Sh(t,e){var r;let n=!1;return e===null&&(e=Ei),(r=e)!==null&&r!==void 0&&r.cleanup&&(ch(e.cleanup,"cleanup"),n=e.cleanup),new dh((i,s)=>{let o=Fa(t,e,a=>{n&&o(),a?s(a):i()})})}Ai.exports=Fa;Ai.exports.finished=Sh});var ht=T((sm,Ga)=>{"use strict";var we=He(),{aggregateTwoErrors:Eh,codes:{ERR_MULTIPLE_CALLBACK:Rh},AbortError:Ih}=z(),{Symbol:Ma}=L(),{kIsDestroyed:Ah,isDestroyed:Th,isFinished:vh,isServerRequest:Nh}=me(),Ua=Ma("kDestroy"),Ti=Ma("kConstruct");function $a(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function jh(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):($a(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Ca(this,t,e):this.once(Ua,function(s){Ca(this,Eh(s,t),e)}),this)}function Ca(t,e,r){let n=!1;function i(s){if(n)return;n=!0;let o=t._readableState,a=t._writableState;$a(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?we.nextTick(kh,t,s):we.nextTick(qa,t)}try{t._destroy(e||null,i)}catch(s){i(s)}}function kh(t,e){vi(t,e),qa(t)}function qa(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 vi(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Ph(){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 Ni(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?we.nextTick(vi,t,e):vi(t,e))}function Lh(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(Ti,e),!(t.listenerCount(Ti)>1)&&we.nextTick(Oh,t)}function Oh(t){let e=!1;function r(n){if(e){Ni(t,n??new Rh);return}e=!0;let i=t._readableState,s=t._writableState,o=s||i;i&&(i.constructed=!0),s&&(s.constructed=!0),o.destroyed?t.emit(Ua,n):n?Ni(t,n,!0):we.nextTick(Bh,t)}try{t._construct(n=>{we.nextTick(r,n)})}catch(n){we.nextTick(r,n)}}function Bh(t){t.emit(Ti)}function Da(t){return t?.setHeader&&typeof t.abort=="function"}function Wa(t){t.emit("close")}function Fh(t,e){t.emit("error",e),we.nextTick(Wa,t)}function Ch(t,e){!t||Th(t)||(!e&&!vh(t)&&(e=new Ih),Nh(t)?(t.socket=null,t.destroy(e)):Da(t)?t.abort():Da(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?we.nextTick(Fh,t,e):we.nextTick(Wa,t),t.destroyed||(t[Ah]=!0))}Ga.exports={construct:Lh,destroyer:Ch,destroy:jh,undestroy:Ph,errorOrDestroy:Ni}});var ln=T((om,Ha)=>{"use strict";var{ArrayIsArray:Dh,ObjectSetPrototypeOf:za}=L(),{EventEmitter:on}=yr();function an(t){on.call(this,t)}za(an.prototype,on.prototype);za(an,on);an.prototype.pipe=function(t,e){let r=this;function n(f){t.writable&&t.write(f)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",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(f){u(),on.listenerCount(this,"error")===0&&this.emit("error",f)}ji(r,"error",l),ji(t,"error",l);function u(){r.removeListener("data",n),t.removeListener("drain",i),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 ji(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Dh(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Ha.exports={Stream:an,prependListener:ji}});var br=T((am,un)=>{"use strict";var{SymbolDispose:Mh}=L(),{AbortError:Qa,codes:Uh}=z(),{isNodeStream:Ka,isWebStream:$h,kControllerErrorFunction:qh}=me(),Wh=Pe(),{ERR_INVALID_ARG_TYPE:Va}=Uh,ki,Gh=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Va(e,"AbortSignal",t)};un.exports.addAbortSignal=function(e,r){if(Gh(e,"signal"),!Ka(r)&&!$h(r))throw new Va("stream",["ReadableStream","WritableStream","Stream"],r);return un.exports.addAbortSignalNoValidate(e,r)};un.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Ka(e)?()=>{e.destroy(new Qa(void 0,{cause:t.reason}))}:()=>{e[qh](new Qa(void 0,{cause:t.reason}))};if(t.aborted)r();else{ki=ki||K().addAbortListener;let n=ki(t,r);Wh(e,n[Mh])}return e}});var Za=T((um,Ya)=>{"use strict";var{StringPrototypeSlice:Ja,SymbolIterator:zh,TypedArrayPrototypeSet:fn,Uint8Array:Hh}=L(),{Buffer:Pi}=pe(),{inspect:Qh}=K();Ya.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,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return Pi.alloc(0);let r=Pi.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)fn(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[zh](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let s=n.data;if(e>s.length)r+=s,e-=s.length;else{e===s.length?(r+=s,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=Ja(s,0,e),this.head=n,n.data=Ja(s,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Pi.allocUnsafe(e),n=e,i=this.head,s=0;do{let o=i.data;if(e>o.length)fn(r,o,n-e),e-=o.length;else{e===o.length?(fn(r,o,n-e),++s,i.next?this.head=i.next:this.head=this.tail=null):(fn(r,new Hh(o.buffer,o.byteOffset,e),n-e),this.head=i,i.data=o.slice(e));break}++s}while((i=i.next)!==null);return this.length-=s,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return Qh(this,{...r,depth:0,customInspect:!1})}}});var gr=T((fm,rl)=>{"use strict";var{MathFloor:Kh,NumberIsInteger:Vh}=L(),{validateInteger:Jh}=$t(),{ERR_INVALID_ARG_VALUE:Yh}=z().codes,Xa=16*1024,el=16;function Zh(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function tl(t){return t?el:Xa}function Xh(t,e){Jh(e,"value",0),t?el=e:Xa=e}function ep(t,e,r,n){let i=Zh(e,n,r);if(i!=null){if(!Vh(i)||i<0){let s=n?`options.${r}`:"options.highWaterMark";throw new Yh(s,i)}return Kh(i)}return tl(t.objectMode)}rl.exports={getHighWaterMark:ep,getDefaultHighWaterMark:tl,setDefaultHighWaterMark:Xh}});var sl=T((Li,il)=>{var cn=pe(),xe=cn.Buffer;function nl(t,e){for(var r in t)e[r]=t[r]}xe.from&&xe.alloc&&xe.allocUnsafe&&xe.allocUnsafeSlow?il.exports=cn:(nl(cn,Li),Li.Buffer=pt);function pt(t,e,r){return xe(t,e,r)}pt.prototype=Object.create(xe.prototype);nl(xe,pt);pt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xe(t,e,r)};pt.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=xe(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};pt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xe(t)};pt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return cn.SlowBuffer(t)}});var ll=T(al=>{"use strict";var Bi=sl().Buffer,ol=Bi.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 tp(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 rp(t){var e=tp(t);if(typeof e!="string"&&(Bi.isEncoding===ol||!ol(t)))throw new Error("Unknown encoding: "+t);return e||t}al.StringDecoder=mr;function mr(t){this.encoding=rp(t);var e;switch(this.encoding){case"utf16le":this.text=lp,this.end=up,e=4;break;case"utf8":this.fillLast=sp,e=4;break;case"base64":this.text=fp,this.end=cp,e=3;break;default:this.write=dp,this.end=hp;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Bi.allocUnsafe(e)}mr.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||""};mr.prototype.end=ap;mr.prototype.text=op;mr.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 Oi(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function np(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Oi(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Oi(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Oi(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function ip(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 sp(t){var e=this.lastTotal-this.lastNeed,r=ip(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 op(t,e){var r=np(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function ap(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function lp(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function up(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 fp(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 cp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function dp(t){return t.toString(this.encoding)}function hp(t){return t&&t.length?this.write(t):""}});var Fi=T((dm,dl)=>{"use strict";var ul=He(),{PromisePrototypeThen:pp,SymbolAsyncIterator:fl,SymbolIterator:cl}=L(),{Buffer:_p}=pe(),{ERR_INVALID_ARG_TYPE:yp,ERR_STREAM_NULL_VALUES:bp}=z().codes;function gp(t,e,r){let n;if(typeof e=="string"||e instanceof _p)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[fl])i=!0,n=e[fl]();else if(e&&e[cl])i=!1,n=e[cl]();else throw new yp("iterable",["Iterable"],e);let s=new t({objectMode:!0,highWaterMark:1,...r}),o=!1;s._read=function(){o||(o=!0,l())},s._destroy=function(u,f){pp(a(u),()=>ul.nextTick(f,u),c=>ul.nextTick(f,c||u))};async function a(u){let f=u!=null,c=typeof n.throw=="function";if(f&&c){let{value:d,done:h}=await n.throw(u);if(await d,h)return}if(typeof n.return=="function"){let{value:d}=await n.return();await d}}async function l(){for(;;){try{let{value:u,done:f}=i?await n.next():n.next();if(f)s.push(null);else{let c=u&&typeof u.then=="function"?await u:u;if(c===null)throw o=!1,new bp;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}dl.exports=gp});var xr=T((hm,jl)=>{"use strict";var ae=He(),{ArrayPrototypeIndexOf:mp,NumberIsInteger:wp,NumberIsNaN:xp,NumberParseInt:Sp,ObjectDefineProperties:Gi,ObjectKeys:Ep,ObjectSetPrototypeOf:_l,Promise:yl,SafeSet:Rp,SymbolAsyncDispose:Ip,SymbolAsyncIterator:Ap,Symbol:Tp}=L();jl.exports=E;E.ReadableState=_n;var{EventEmitter:vp}=yr(),{Stream:Ke,prependListener:Np}=ln(),{Buffer:Ci}=pe(),{addAbortSignal:jp}=br(),bl=Pe(),I=K().debuglog("stream",t=>{I=t}),kp=Za(),Ht=ht(),{getHighWaterMark:Pp,getDefaultHighWaterMark:Lp}=gr(),{aggregateTwoErrors:hl,codes:{ERR_INVALID_ARG_TYPE:Op,ERR_METHOD_NOT_IMPLEMENTED:Bp,ERR_OUT_OF_RANGE:Fp,ERR_STREAM_PUSH_AFTER_EOF:Cp,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Dp},AbortError:Mp}=z(),{validateObject:Up}=$t(),_t=Tp("kPaused"),{StringDecoder:gl}=ll(),$p=Fi();_l(E.prototype,Ke.prototype);_l(E,Ke);var Di=()=>{},{errorOrDestroy:Gt}=Ht,zt=1,qp=2,ml=4,wr=8,wl=16,dn=32,hn=64,xl=128,Wp=256,Gp=512,zp=1024,qi=2048,Wi=4096,Hp=8192,Qp=16384,Kp=32768,Sl=65536,Vp=1<<17,Jp=1<<18;function M(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Gi(_n.prototype,{objectMode:M(zt),ended:M(qp),endEmitted:M(ml),reading:M(wr),constructed:M(wl),sync:M(dn),needReadable:M(hn),emittedReadable:M(xl),readableListening:M(Wp),resumeScheduled:M(Gp),errorEmitted:M(zp),emitClose:M(qi),autoDestroy:M(Wi),destroyed:M(Hp),closed:M(Qp),closeEmitted:M(Kp),multiAwaitDrain:M(Sl),readingMore:M(Vp),dataEmitted:M(Jp)});function _n(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.state=qi|Wi|wl|dn,t&&t.objectMode&&(this.state|=zt),r&&t&&t.readableObjectMode&&(this.state|=zt),this.highWaterMark=t?Pp(this,t,"readableHighWaterMark",r):Lp(!1),this.buffer=new kp,this.length=0,this.pipes=[],this.flowing=null,this[_t]=null,t&&t.emitClose===!1&&(this.state&=~qi),t&&t.autoDestroy===!1&&(this.state&=~Wi),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new gl(t.encoding),this.encoding=t.encoding)}function E(t){if(!(this instanceof E))return new E(t);let e=this instanceof Se();this._readableState=new _n(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&&jp(t.signal,this)),Ke.call(this,t),Ht.construct(this,()=>{this._readableState.needReadable&&pn(this,this._readableState)})}E.prototype.destroy=Ht.destroy;E.prototype._undestroy=Ht.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[vp.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[Ip]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Mp,this.destroy(t)),new yl((e,r)=>bl(this,n=>n&&n!==t?r(n):e(null)))};E.prototype.push=function(t,e){return El(this,t,e,!1)};E.prototype.unshift=function(t,e){return El(this,t,e,!0)};function El(t,e,r,n){I("readableAddChunk",e);let i=t._readableState,s;if((i.state&zt)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Ci.from(e,r).toString(i.encoding):(e=Ci.from(e,r),r=""))):e instanceof Ci?r="":Ke._isUint8Array(e)?(e=Ke._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Op("chunk",["string","Buffer","Uint8Array"],e))),s)Gt(t,s);else if(e===null)i.state&=~wr,Xp(t,i);else if((i.state&zt)!==0||e&&e.length>0)if(n)if((i.state&ml)!==0)Gt(t,new Dp);else{if(i.destroyed||i.errored)return!1;Mi(t,i,e,!0)}else if(i.ended)Gt(t,new Cp);else{if(i.destroyed||i.errored)return!1;i.state&=~wr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Mi(t,i,e,!1):pn(t,i)):Mi(t,i,e,!1)}else n||(i.state&=~wr,pn(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function Mi(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Sl)!==0?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),(e.state&hn)!==0&&yn(t)),pn(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[_t]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new gl(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var Yp=1073741824;function Zp(t){if(t>Yp)throw new Fp("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function pl(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&zt)!==0?1:xp(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:wp(t)||(t=Sp(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Zp(t)),t!==0&&(e.state&=~xl),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?Ui(this):yn(this),null;if(t=pl(t,e),t===0&&e.ended)return e.length===0&&Ui(this),null;let n=(e.state&hn)!==0;if(I("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,I("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,I("reading, ended or constructing",n);else if(n){I("do read"),e.state|=wr|dn,e.length===0&&(e.state|=hn);try{this._read(e.highWaterMark)}catch(s){Gt(this,s)}e.state&=~dn,e.reading||(t=pl(r,e))}let i;return t>0?i=vl(t,e):i=null,i===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&&Ui(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function Xp(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?yn(t):(e.needReadable=!1,e.emittedReadable=!0,Rl(t))}}function yn(t){let e=t._readableState;I("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(I("emitReadable",e.flowing),e.emittedReadable=!0,ae.nextTick(Rl,t))}function Rl(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,Al(t)}function pn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ae.nextTick(e_,t,e))}function e_(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 Bp("_read()")};E.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new Rp(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),I("pipe count=%d opts=%j",n.pipes.length,e);let s=(!e||e.end!==!1)&&t!==ae.stdout&&t!==ae.stderr?a:x;n.endEmitted?ae.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(b,g){I("onunpipe"),b===r&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,f())}function a(){I("onend"),t.end()}let l,u=!1;function f(){I("cleanup"),t.removeListener("close",y),t.removeListener("finish",_),l&&t.removeListener("drain",l),t.removeListener("error",h),t.removeListener("unpipe",o),r.removeListener("end",a),r.removeListener("end",x),r.removeListener("data",d),u=!0,l&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function c(){u||(n.pipes.length===1&&n.pipes[0]===t?(I("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(I("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),l||(l=t_(r,t),t.on("drain",l))}r.on("data",d);function d(b){I("ondata");let g=t.write(b);I("dest.write",g),g===!1&&c()}function h(b){if(I("onerror",b),x(),t.removeListener("error",h),t.listenerCount("error")===0){let g=t._writableState||t._readableState;g&&!g.errorEmitted?Gt(t,b):t.emit("error",b)}}Np(t,"error",h);function y(){t.removeListener("finish",_),x()}t.once("close",y);function _(){I("onfinish"),t.removeListener("close",y),x()}t.once("finish",_);function x(){I("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():n.flowing||(I("pipe resume"),r.resume()),t};function t_(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(I("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(I("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.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 i=e.pipes;e.pipes=[],this.pause();for(let s=0;s<i.length;s++)i[s].emit("unpipe",this,{hasUnpiped:!1});return this}let n=mp(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};E.prototype.on=function(t,e){let r=Ke.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,I("on readable",n.length,n.reading),n.length?yn(this):n.reading||ae.nextTick(r_,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=Ke.prototype.removeListener.call(this,t,e);return t==="readable"&&ae.nextTick(Il,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=Ke.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ae.nextTick(Il,this),e};function Il(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[_t]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function r_(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,n_(this,t)),t[_t]=!1,this};function n_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ae.nextTick(i_,t,e))}function i_(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Al(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[_t]=!0,this};function Al(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",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{Gt(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Ep(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};E.prototype[Ap]=function(){return Tl(this)};E.prototype.iterator=function(t){return t!==void 0&&Up(t,"options"),Tl(this,t)};function Tl(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=s_(t,e);return r.stream=t,r}async function*s_(t,e){let r=Di;function n(o){this===t?(r(),r=Di):r=o}t.on("readable",n);let i,s=bl(t,{writable:!1},o=>{i=o?hl(i,o):null,r(),r=Di});try{for(;;){let o=t.destroyed?null:t.read();if(o!==null)yield o;else{if(i)throw i;if(i===null)return;await new yl(n)}}}catch(o){throw i=hl(i,o),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Ht.destroyer(t,null):(t.off("readable",n),s())}}Gi(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}}});Gi(_n.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[_t]!==!1},set(t){this[_t]=!!t}}});E._fromList=vl;function vl(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 Ui(t){let e=t._readableState;I("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,ae.nextTick(o_,e,t))}function o_(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)ae.nextTick(a_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function a_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return $p(E,t,e)};var $i;function Nl(){return $i===void 0&&($i={}),$i}E.fromWeb=function(t,e){return Nl().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return Nl().newReadableStreamFromStreamReadable(t,e)};E.wrap=function(t,e){var r,n;return new E({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,s){Ht.destroyer(t,i),s(i)}}).wrap(t)}});var xn=T((pm,ql)=>{"use strict";var yt=He(),{ArrayPrototypeSlice:Ll,Error:l_,FunctionPrototypeSymbolHasInstance:Ol,ObjectDefineProperty:Bl,ObjectDefineProperties:u_,ObjectSetPrototypeOf:Fl,StringPrototypeToLowerCase:f_,Symbol:c_,SymbolHasInstance:d_}=L();ql.exports=O;O.WritableState=Rr;var{EventEmitter:h_}=yr(),Sr=ln().Stream,{Buffer:bn}=pe(),wn=ht(),{addAbortSignal:p_}=br(),{getHighWaterMark:__,getDefaultHighWaterMark:y_}=gr(),{ERR_INVALID_ARG_TYPE:b_,ERR_METHOD_NOT_IMPLEMENTED:g_,ERR_MULTIPLE_CALLBACK:Cl,ERR_STREAM_CANNOT_PIPE:m_,ERR_STREAM_DESTROYED:Er,ERR_STREAM_ALREADY_FINISHED:w_,ERR_STREAM_NULL_VALUES:x_,ERR_STREAM_WRITE_AFTER_END:S_,ERR_UNKNOWN_ENCODING:Dl}=z().codes,{errorOrDestroy:Qt}=wn;Fl(O.prototype,Sr.prototype);Fl(O,Sr);function Qi(){}var Kt=c_("kOnFinished");function Rr(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?__(this,t,"writableHighWaterMark",r):y_(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=R_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,mn(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[Kt]=[]}function mn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Rr.prototype.getBuffer=function(){return Ll(this.buffered,this.bufferedIndex)};Bl(Rr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function O(t){let e=this instanceof Se();if(!e&&!Ol(O,this))return new O(t);this._writableState=new Rr(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&&p_(t.signal,this)),Sr.call(this,t),wn.construct(this,()=>{let r=this._writableState;r.writing||Vi(this,r),Ji(this,r)})}Bl(O,d_,{__proto__:null,value:function(t){return Ol(this,t)?!0:this!==O?!1:t&&t._writableState instanceof Rr}});O.prototype.pipe=function(){Qt(this,new m_)};function Ml(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!bn.isEncoding(r))throw new Dl(r);typeof n!="function"&&(n=Qi)}if(e===null)throw new x_;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=bn.from(e,r),r="buffer");else if(e instanceof bn)r="buffer";else if(Sr._isUint8Array(e))e=Sr._uint8ArrayToBuffer(e),r="buffer";else throw new b_("chunk",["string","Buffer","Uint8Array"],e);let s;return i.ending?s=new S_:i.destroyed&&(s=new Er("write")),s?(yt.nextTick(n,s),Qt(t,s,!0),s):(i.pendingcb++,E_(t,i,e,r,n))}O.prototype.write=function(t,e,r){return Ml(this,t,e,r)===!0};O.prototype.cork=function(){this._writableState.corked++};O.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Vi(this,t))};O.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=f_(e)),!bn.isEncoding(e))throw new Dl(e);return this._writableState.defaultEncoding=e,this};function E_(t,e,r,n,i){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:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==Qi&&(e.allNoop=!1)):(e.writelen=s,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),o&&!e.errored&&!e.destroyed}function kl(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Er("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function Pl(t,e,r,n){--e.pendingcb,n(r),Ki(e),Qt(t,r)}function R_(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Qt(t,new Cl);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),n?yt.nextTick(Pl,t,r,e,i):Pl(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&Vi(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},yt.nextTick(I_,r.afterWriteTickInfo)):Ul(t,r,1,i))}function I_({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,Ul(t,e,r,n)}function Ul(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&Ki(e),Ji(t,e)}function Ki(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:s,callback:o}=t.buffered[i],a=t.objectMode?1:s.length;t.length-=a,o((e=t.errored)!==null&&e!==void 0?e:new Er("write"))}let r=t[Kt].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Er("end"))}mn(t)}function Vi(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,s=r.length-n;if(!s)return;let o=n;if(e.bufferProcessing=!0,s>1&&t._writev){e.pendingcb-=s-1;let a=e.allNoop?Qi:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:Ll(r,o);l.allBuffers=e.allBuffers,kl(t,e,!0,e.length,l,"",a),mn(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=i?1:a.length;kl(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?mn(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}O.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new g_("_write()")};O.prototype._writev=null;O.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let s=Ml(this,t,e);s instanceof l_&&(i=s)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Ji(this,n,!0),n.ended=!0):n.finished?i=new w_("end"):n.destroyed&&(i=new Er("end"))),typeof r=="function"&&(i||n.finished?yt.nextTick(r,i):n[Kt].push(r)),this};function gn(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 A_(t,e){let r=!1;function n(i){if(r){Qt(t,i??Cl());return}if(r=!0,e.pendingcb--,i){let s=e[Kt].splice(0);for(let o=0;o<s.length;o++)s[o](i);Qt(t,i,e.sync)}else gn(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,yt.nextTick(Hi,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function T_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,A_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Ji(t,e,r){gn(e)&&(T_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,yt.nextTick((n,i)=>{gn(i)?Hi(n,i):i.pendingcb--},t,e)):gn(e)&&(e.pendingcb++,Hi(t,e))))}function Hi(t,e){e.pendingcb--,e.finished=!0;let r=e[Kt].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}u_(O.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 v_=wn.destroy;O.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Kt].length)&&yt.nextTick(Ki,r),v_.call(this,t,e),this};O.prototype._undestroy=wn.undestroy;O.prototype._destroy=function(t,e){e(t)};O.prototype[h_.captureRejectionSymbol]=function(t){this.destroy(t)};var zi;function $l(){return zi===void 0&&(zi={}),zi}O.fromWeb=function(t,e){return $l().newStreamWritableFromWritableStream(t,e)};O.toWeb=function(t){return $l().newWritableStreamFromStreamWritable(t)}});var nu=T((_m,ru)=>{var Yi=He(),N_=pe(),{isReadable:j_,isWritable:k_,isIterable:Wl,isNodeStream:P_,isReadableNodeStream:Gl,isWritableNodeStream:zl,isDuplexNodeStream:L_,isReadableStream:Hl,isWritableStream:Ql}=me(),Kl=Pe(),{AbortError:eu,codes:{ERR_INVALID_ARG_TYPE:O_,ERR_INVALID_RETURN_VALUE:Vl}}=z(),{destroyer:Jt}=ht(),B_=Se(),tu=xr(),F_=xn(),{createDeferredPromise:Jl}=K(),Yl=Fi(),Zl=globalThis.Blob||N_.Blob,C_=typeof Zl<"u"?function(e){return e instanceof Zl}:function(e){return!1},D_=globalThis.AbortController||Dt().AbortController,{FunctionPrototypeCall:Xl}=L(),Ve=class extends B_{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};ru.exports=function t(e,r){if(L_(e))return e;if(Gl(e))return Vt({readable:e});if(zl(e))return Vt({writable:e});if(P_(e))return Vt({writable:!1,readable:!1});if(Hl(e))return Vt({readable:tu.fromWeb(e)});if(Ql(e))return Vt({writable:F_.fromWeb(e)});if(typeof e=="function"){let{value:i,write:s,final:o,destroy:a}=M_(e);if(Wl(i))return Yl(Ve,i,{objectMode:!0,write:s,final:o,destroy:a});let l=i?.then;if(typeof l=="function"){let u,f=Xl(l,i,c=>{if(c!=null)throw new Vl("nully","body",c)},c=>{Jt(u,c)});return u=new Ve({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,Yi.nextTick(c,null)}catch(d){Yi.nextTick(c,d)}})},destroy:a})}throw new Vl("Iterable, AsyncIterable or AsyncFunction",r,i)}if(C_(e))return t(e.arrayBuffer());if(Wl(e))return Yl(Ve,e,{objectMode:!0,writable:!1});if(Hl(e?.readable)&&Ql(e?.writable))return Ve.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?Gl(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?zl(e?.writable)?e?.writable:t(e.writable):void 0;return Vt({readable:i,writable:s})}let n=e?.then;if(typeof n=="function"){let i;return Xl(n,e,s=>{s!=null&&i.push(s),i.push(null)},s=>{Jt(i,s)}),i=new Ve({objectMode:!0,writable:!1,read(){}})}throw new O_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function M_(t){let{promise:e,resolve:r}=Jl(),n=new D_,i=n.signal;return{value:t((async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(Yi.nextTick(u),l)return;if(i.aborted)throw new eu(void 0,{cause:i.reason});({promise:e,resolve:r}=Jl()),yield a}})(),{signal:i}),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){n.abort(),a(o)}}}function Vt(t){let e=t.readable&&typeof t.readable.read!="function"?tu.wrap(t.readable):t.readable,r=t.writable,n=!!j_(e),i=!!k_(r),s,o,a,l,u;function f(c){let d=l;l=null,d?d(c):c&&u.destroy(c)}return u=new Ve({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(Kl(r,c=>{i=!1,c&&Jt(e,c),f(c)}),u._write=function(c,d,h){r.write(c,d)?h():s=h},u._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()}})),n&&(Kl(e,c=>{n=!1,c&&Jt(e,c),f(c)}),e.on("readable",function(){if(a){let c=a;a=null,c()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let c=e.read();if(c===null){a=u._read;return}if(!u.push(c))return}}),u._destroy=function(c,d){!c&&l!==null&&(c=new eu),a=null,s=null,o=null,l===null?d(c):(l=d,Jt(r,c),Jt(e,c))},u}});var Se=T((ym,ou)=>{"use strict";var{ObjectDefineProperties:U_,ObjectGetOwnPropertyDescriptor:Le,ObjectKeys:$_,ObjectSetPrototypeOf:iu}=L();ou.exports=le;var es=xr(),ie=xn();iu(le.prototype,es.prototype);iu(le,es);{let t=$_(ie.prototype);for(let e=0;e<t.length;e++){let r=t[e];le.prototype[r]||(le.prototype[r]=ie.prototype[r])}}function le(t){if(!(this instanceof le))return new le(t);es.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}U_(le.prototype,{writable:{__proto__:null,...Le(ie.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Le(ie.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Le(ie.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Le(ie.prototype,"writableBuffer")},writableLength:{__proto__:null,...Le(ie.prototype,"writableLength")},writableFinished:{__proto__:null,...Le(ie.prototype,"writableFinished")},writableCorked:{__proto__:null,...Le(ie.prototype,"writableCorked")},writableEnded:{__proto__:null,...Le(ie.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Le(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 Zi;function su(){return Zi===void 0&&(Zi={}),Zi}le.fromWeb=function(t,e){return su().newStreamDuplexFromReadableWritablePair(t,e)};le.toWeb=function(t){return su().newReadableWritablePairFromDuplex(t)};var Xi;le.from=function(t){return Xi||(Xi=nu()),Xi(t,"body")}});var ns=T((bm,lu)=>{"use strict";var{ObjectSetPrototypeOf:au,Symbol:q_}=L();lu.exports=Oe;var{ERR_METHOD_NOT_IMPLEMENTED:W_}=z().codes,rs=Se(),{getHighWaterMark:G_}=gr();au(Oe.prototype,rs.prototype);au(Oe,rs);var Ir=q_("kCallback");function Oe(t){if(!(this instanceof Oe))return new Oe(t);let e=t?G_(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),rs.call(this,t),this._readableState.sync=!1,this[Ir]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",z_)}function ts(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 z_(){this._final!==ts&&ts.call(this)}Oe.prototype._final=ts;Oe.prototype._transform=function(t,e,r){throw new W_("_transform()")};Oe.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,s=n.length;this._transform(t,e,(o,a)=>{if(o){r(o);return}a!=null&&this.push(a),i.ended||s===n.length||n.length<n.highWaterMark?r():this[Ir]=r})};Oe.prototype._read=function(){if(this[Ir]){let t=this[Ir];this[Ir]=null,t()}}});var ss=T((gm,fu)=>{"use strict";var{ObjectSetPrototypeOf:uu}=L();fu.exports=Yt;var is=ns();uu(Yt.prototype,is.prototype);uu(Yt,is);function Yt(t){if(!(this instanceof Yt))return new Yt(t);is.call(this,t)}Yt.prototype._transform=function(t,e,r){r(null,t)}});var In=T((mm,_u)=>{var Ar=He(),{ArrayIsArray:H_,Promise:Q_,SymbolAsyncIterator:K_,SymbolDispose:V_}=L(),Rn=Pe(),{once:J_}=K(),Y_=ht(),cu=Se(),{aggregateTwoErrors:Z_,codes:{ERR_INVALID_ARG_TYPE:ps,ERR_INVALID_RETURN_VALUE:os,ERR_MISSING_ARGS:X_,ERR_STREAM_DESTROYED:ey,ERR_STREAM_PREMATURE_CLOSE:ty},AbortError:ry}=z(),{validateFunction:ny,validateAbortSignal:iy}=$t(),{isIterable:bt,isReadable:as,isReadableNodeStream:En,isNodeStream:du,isTransformStream:Zt,isWebStream:sy,isReadableStream:ls,isReadableFinished:oy}=me(),ay=globalThis.AbortController||Dt().AbortController,us,fs,cs;function hu(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=Rn(t,{readable:e,writable:r},s=>{n=!s});return{destroy:s=>{n||(n=!0,Y_.destroyer(t,s||new ey("pipe")))},cleanup:i}}function ly(t){return ny(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function ds(t){if(bt(t))return t;if(En(t))return uy(t);throw new ps("val",["Readable","Iterable","AsyncIterable"],t)}async function*uy(t){fs||(fs=xr()),yield*fs.prototype[K_].call(t)}async function Sn(t,e,r,{end:n}){let i,s=null,o=u=>{if(u&&(i=u),s){let f=s;s=null,f()}},a=()=>new Q_((u,f)=>{i?f(i):s=()=>{i?f(i):u()}});e.on("drain",o);let l=Rn(e,{readable:!1},o);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();n&&(e.end(),await a()),r()}catch(u){r(i!==u?Z_(i,u):u)}finally{l(),e.off("drain",o)}}async function hs(t,e,r,{end:n}){Zt(e)&&(e=e.writable);let i=e.getWriter();try{for await(let s of t)await i.ready,i.write(s).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(s){try{await i.abort(s),r(s)}catch(o){r(o)}}}function fy(...t){return pu(t,J_(ly(t)))}function pu(t,e,r){if(t.length===1&&H_(t[0])&&(t=t[0]),t.length<2)throw new X_("streams");let n=new ay,i=n.signal,s=r?.signal,o=[];iy(s,"options.signal");function a(){y(new ry)}cs=cs||K().addAbortListener;let l;s&&(l=cs(s,a));let u,f,c=[],d=0;function h(S){y(S,--d===0)}function y(S,m){var A;if(S&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=S),!(!u&&!m)){for(;c.length;)c.shift()(u);(A=l)===null||A===void 0||A[V_](),n.abort(),m&&(u||o.forEach(Ae=>Ae()),Ar.nextTick(e,u,f))}}let _;for(let S=0;S<t.length;S++){let m=t[S],A=S<t.length-1,Ae=S>0,D=A||r?.end!==!1,St=S===t.length-1;if(du(m)){let V=function(Te){Te&&Te.name!=="AbortError"&&Te.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(Te)};var g=V;if(D){let{destroy:Te,cleanup:Bn}=hu(m,A,Ae);c.push(Te),as(m)&&St&&o.push(Bn)}m.on("error",V),as(m)&&St&&o.push(()=>{m.removeListener("error",V)})}if(S===0)if(typeof m=="function"){if(_=m({signal:i}),!bt(_))throw new os("Iterable, AsyncIterable or Stream","source",_)}else bt(m)||En(m)||Zt(m)?_=m:_=cu.from(m);else if(typeof m=="function"){if(Zt(_)){var x;_=ds((x=_)===null||x===void 0?void 0:x.readable)}else _=ds(_);if(_=m(_,{signal:i}),A){if(!bt(_,!0))throw new os("AsyncIterable",`transform[${S-1}]`,_)}else{var b;us||(us=ss());let V=new us({objectMode:!0}),Te=(b=_)===null||b===void 0?void 0:b.then;if(typeof Te=="function")d++,Te.call(_,Ce=>{f=Ce,Ce!=null&&V.write(Ce),D&&V.end(),Ar.nextTick(h)},Ce=>{V.destroy(Ce),Ar.nextTick(h,Ce)});else if(bt(_,!0))d++,Sn(_,V,h,{end:D});else if(ls(_)||Zt(_)){let Ce=_.readable||_;d++,Sn(Ce,V,h,{end:D})}else throw new os("AsyncIterable or Promise","destination",_);_=V;let{destroy:Bn,cleanup:tf}=hu(_,!1,!0);c.push(Bn),St&&o.push(tf)}}else if(du(m)){if(En(_)){d+=2;let V=cy(_,m,h,{end:D});as(m)&&St&&o.push(V)}else if(Zt(_)||ls(_)){let V=_.readable||_;d++,Sn(V,m,h,{end:D})}else if(bt(_))d++,Sn(_,m,h,{end:D});else throw new ps("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=m}else if(sy(m)){if(En(_))d++,hs(ds(_),m,h,{end:D});else if(ls(_)||bt(_))d++,hs(_,m,h,{end:D});else if(Zt(_))d++,hs(_.readable,m,h,{end:D});else throw new ps("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=m}else _=cu.from(m)}return(i!=null&&i.aborted||s!=null&&s.aborted)&&Ar.nextTick(a),_}function cy(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new ty)}),t.pipe(e,{end:!1}),n){let o=function(){i=!0,e.end()};var s=o;oy(t)?Ar.nextTick(o):t.once("end",o)}else r();return Rn(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)}),Rn(e,{readable:!1,writable:!0},r)}_u.exports={pipelineImpl:pu,pipeline:fy}});var ys=T((wm,xu)=>{"use strict";var{pipeline:dy}=In(),An=Se(),{destroyer:hy}=ht(),{isNodeStream:Tn,isReadable:yu,isWritable:bu,isWebStream:_s,isTransformStream:gt,isWritableStream:gu,isReadableStream:mu}=me(),{AbortError:py,codes:{ERR_INVALID_ARG_VALUE:wu,ERR_MISSING_ARGS:_y}}=z(),yy=Pe();xu.exports=function(...e){if(e.length===0)throw new _y("streams");if(e.length===1)return An.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=An.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=An.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Tn(e[h])&&!_s(e[h]))){if(h<e.length-1&&!(yu(e[h])||mu(e[h])||gt(e[h])))throw new wu(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(bu(e[h])||gu(e[h])||gt(e[h])))throw new wu(`streams[${h}]`,r[h],"must be writable")}let n,i,s,o,a;function l(h){let y=o;o=null,y?y(h):h?a.destroy(h):!d&&!c&&a.destroy()}let u=e[0],f=dy(e,l),c=!!(bu(u)||gu(u)||gt(u)),d=!!(yu(f)||mu(f)||gt(f));if(a=new An({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(Tn(u))a._write=function(y,_,x){u.write(y,_)?x():n=x},a._final=function(y){u.end(),i=y},u.on("drain",function(){if(n){let y=n;n=null,y()}});else if(_s(u)){let _=(gt(u)?u.writable:u).getWriter();a._write=async function(x,b,g){try{await _.ready,_.write(x).catch(()=>{}),g()}catch(S){g(S)}},a._final=async function(x){try{await _.ready,_.close().catch(()=>{}),i=x}catch(b){x(b)}}}let h=gt(f)?f.readable:f;yy(h,()=>{if(i){let y=i;i=null,y()}})}if(d){if(Tn(f))f.on("readable",function(){if(s){let h=s;s=null,h()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=f.read();if(h===null){s=a._read;return}if(!a.push(h))return}};else if(_s(f)){let y=(gt(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:_,done:x}=await y.read();if(!a.push(_))return;if(x){a.push(null);return}}catch{return}}}}return a._destroy=function(h,y){!h&&o!==null&&(h=new py),s=null,n=null,i=null,o===null?y(h):(o=y,Tn(f)&&hy(f,h))},a}});var ku=T((xm,ms)=>{"use strict";var by=globalThis.AbortController||Dt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:gy,ERR_INVALID_ARG_TYPE:Tr,ERR_MISSING_ARGS:my,ERR_OUT_OF_RANGE:wy},AbortError:Ee}=z(),{validateAbortSignal:mt,validateInteger:Su,validateObject:wt}=$t(),xy=L().Symbol("kWeak"),Sy=L().Symbol("kResistStopPropagation"),{finished:Ey}=Pe(),Ry=ys(),{addAbortSignalNoValidate:Iy}=br(),{isWritable:Ay,isNodeStream:Ty}=me(),{deprecate:vy}=K(),{ArrayPrototypePush:Ny,Boolean:jy,MathFloor:Eu,Number:ky,NumberIsNaN:Py,Promise:Ru,PromiseReject:Iu,PromiseResolve:Ly,PromisePrototypeThen:Au,Symbol:vu}=L(),vn=vu("kEmpty"),Tu=vu("kEof");function Oy(t,e){if(e!=null&&wt(e,"options"),e?.signal!=null&&mt(e.signal,"options.signal"),Ty(t)&&!Ay(t))throw new gy("stream",t,"must be writable");let r=Ry(this,t);return e!=null&&e.signal&&Iy(e.signal,r),r}function Nn(t,e){if(typeof t!="function")throw new Tr("fn",["Function","AsyncFunction"],t);e!=null&&wt(e,"options"),e?.signal!=null&&mt(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Eu(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Eu(e.highWaterMark)),Su(r,"options.concurrency",1),Su(n,"options.highWaterMark",0),n+=r,async function*(){let s=K().AbortSignalAny([e?.signal].filter(jy)),o=this,a=[],l={signal:s},u,f,c=!1,d=0;function h(){c=!0,y()}function y(){d-=1,_()}function _(){f&&!c&&d<r&&a.length<n&&(f(),f=null)}async function x(){try{for await(let b of o){if(c)return;if(s.aborted)throw new Ee;try{if(b=t(b,l),b===vn)continue;b=Ly(b)}catch(g){b=Iu(g)}d+=1,Au(b,y,h),a.push(b),u&&(u(),u=null),!c&&(a.length>=n||d>=r)&&await new Ru(g=>{f=g})}a.push(Tu)}catch(b){let g=Iu(b);Au(g,y,h),a.push(g)}finally{c=!0,u&&(u(),u=null)}}x();try{for(;;){for(;a.length>0;){let b=await a[0];if(b===Tu)return;if(s.aborted)throw new Ee;b!==vn&&(yield b),a.shift(),_()}await new Ru(b=>{u=b})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function By(t=void 0){return t!=null&&wt(t,"options"),t?.signal!=null&&mt(t.signal,"options.signal"),async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new Ee({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function Nu(t,e=void 0){for await(let r of gs.call(this,t,e))return!0;return!1}async function Fy(t,e=void 0){if(typeof t!="function")throw new Tr("fn",["Function","AsyncFunction"],t);return!await Nu.call(this,async(...r)=>!await t(...r),e)}async function Cy(t,e){for await(let r of gs.call(this,t,e))return r}async function Dy(t,e){if(typeof t!="function")throw new Tr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),vn}for await(let n of Nn.call(this,r,e));}function gs(t,e){if(typeof t!="function")throw new Tr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:vn}return Nn.call(this,r,e)}var bs=class extends my{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function My(t,e,r){var n;if(typeof t!="function")throw new Tr("reducer",["Function","AsyncFunction"],t);r!=null&&wt(r,"options"),r?.signal!=null&&mt(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let u=new Ee(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await Ey(this.destroy(u)),u}let s=new by,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[xy]:this,[Sy]:!0};r.signal.addEventListener("abort",()=>s.abort(),u)}let a=!1;try{for await(let u of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new Ee;i?e=await t(e,u,{signal:o}):(e=u,i=!0)}if(!a&&!i)throw new bs}finally{s.abort()}return e}async function Uy(t){t!=null&&wt(t,"options"),t?.signal!=null&&mt(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ee(void 0,{cause:t.signal.reason});Ny(e,n)}return e}function $y(t,e){let r=Nn.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function ju(t){if(t=ky(t),Py(t))return 0;if(t<0)throw new wy("number",">= 0",t);return t}function qy(t,e=void 0){return e!=null&&wt(e,"options"),e?.signal!=null&&mt(e.signal,"options.signal"),t=ju(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;t--<=0&&(yield s)}}.call(this)}function Wy(t,e=void 0){return e!=null&&wt(e,"options"),e?.signal!=null&&mt(e.signal,"options.signal"),t=ju(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;if(t-- >0&&(yield s),t<=0)return}}.call(this)}ms.exports.streamReturningOperators={asIndexedPairs:vy(By,"readable.asIndexedPairs will be removed in a future version."),drop:qy,filter:gs,flatMap:$y,map:Nn,take:Wy,compose:Oy};ms.exports.promiseReturningOperators={every:Fy,forEach:Dy,reduce:My,toArray:Uy,some:Nu,find:Cy}});var ws=T((Sm,Pu)=>{"use strict";var{ArrayPrototypePop:Gy,Promise:zy}=L(),{isIterable:Hy,isNodeStream:Qy,isWebStream:Ky}=me(),{pipelineImpl:Vy}=In(),{finished:Jy}=Pe();xs();function Yy(...t){return new zy((e,r)=>{let n,i,s=t[t.length-1];if(s&&typeof s=="object"&&!Qy(s)&&!Hy(s)&&!Ky(s)){let o=Gy(t);n=o.signal,i=o.end}Vy(t,(o,a)=>{o?r(o):e(a)},{signal:n,end:i})})}Pu.exports={finished:Jy,pipeline:Yy}});var xs=T((Em,$u)=>{"use strict";var{Buffer:Zy}=pe(),{ObjectDefineProperty:Be,ObjectKeys:Bu,ReflectApply:Fu}=L(),{promisify:{custom:Cu}}=K(),{streamReturningOperators:Lu,promiseReturningOperators:Ou}=ku(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Du}}=z(),Xy=ys(),{setDefaultHighWaterMark:eb,getDefaultHighWaterMark:tb}=gr(),{pipeline:Mu}=In(),{destroyer:rb}=ht(),Uu=Pe(),Ss=ws(),vr=me(),k=$u.exports=ln().Stream;k.isDestroyed=vr.isDestroyed;k.isDisturbed=vr.isDisturbed;k.isErrored=vr.isErrored;k.isReadable=vr.isReadable;k.isWritable=vr.isWritable;k.Readable=xr();for(let t of Bu(Lu)){let r=function(...n){if(new.target)throw Du();return k.Readable.from(Fu(e,this,n))},e=Lu[t];Be(r,"name",{__proto__:null,value:e.name}),Be(r,"length",{__proto__:null,value:e.length}),Be(k.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Bu(Ou)){let r=function(...n){if(new.target)throw Du();return Fu(e,this,n)},e=Ou[t];Be(r,"name",{__proto__:null,value:e.name}),Be(r,"length",{__proto__:null,value:e.length}),Be(k.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}k.Writable=xn();k.Duplex=Se();k.Transform=ns();k.PassThrough=ss();k.pipeline=Mu;var{addAbortSignal:nb}=br();k.addAbortSignal=nb;k.finished=Uu;k.destroy=rb;k.compose=Xy;k.setDefaultHighWaterMark=eb;k.getDefaultHighWaterMark=tb;Be(k,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Ss}});Be(Mu,Cu,{__proto__:null,enumerable:!0,get(){return Ss.pipeline}});Be(Uu,Cu,{__proto__:null,enumerable:!0,get(){return Ss.finished}});k.Stream=k;k._isUint8Array=function(e){return e instanceof Uint8Array};k._uint8ArrayToBuffer=function(e){return Zy.from(e.buffer,e.byteOffset,e.byteLength)}});var jn=T((Rm,C)=>{"use strict";var U=xs(),ib=ws(),sb=U.Readable.destroy;C.exports=U.Readable;C.exports._uint8ArrayToBuffer=U._uint8ArrayToBuffer;C.exports._isUint8Array=U._isUint8Array;C.exports.isDisturbed=U.isDisturbed;C.exports.isErrored=U.isErrored;C.exports.isReadable=U.isReadable;C.exports.Readable=U.Readable;C.exports.Writable=U.Writable;C.exports.Duplex=U.Duplex;C.exports.Transform=U.Transform;C.exports.PassThrough=U.PassThrough;C.exports.addAbortSignal=U.addAbortSignal;C.exports.finished=U.finished;C.exports.destroy=U.destroy;C.exports.destroy=sb;C.exports.pipeline=U.pipeline;C.exports.compose=U.compose;Object.defineProperty(U,"promises",{configurable:!0,enumerable:!0,get(){return ib}});C.exports.Stream=U.Stream;C.exports.default=C.exports});var R=class t{#e;constructor(e){this.#e=t.collapse(e)}get value(){return this.#e}toString(){return this.#e}get length(){return this.#e.length}static collapse(e,r=""){if(e instanceof t)return e.value;if(typeof e!="string")throw new TypeError("path argument must be a string or an instance of Path");if(r&&!(r instanceof t)&&(r=new t(r)),e=e.trim(),e.length===0)return r.value;t.isRelative(e)&&(e=r+e);let n=t.reduce(e,(s,o)=>(o==".."?s.pop():o!=="."&&s.push(o),s),[]),i="/";return n.length&&(i+=n.join("/"),t.isFolder(e)&&(i+="/")),""+i}static isAbsolute(e){return e instanceof t?!0:e.length&&e[0]==="/"}static isRelative(e){return!t.isAbsolute(e)}static isFolder(e){return e instanceof t&&(e=e.value),e.length&&e[e.length-1]=="/"}static isPath(e){return e instanceof t?!0:typeof e!="string"?!1:(e=e.trim(),new URL(e,document.location).pathname==e)}static reduce(e,r,n){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).reduce(r,n)}static map(e,r){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).map(r)}static parent(e){e instanceof t&&(e=e.value),e=e.split("/").filter(Boolean),e.pop();let r="/";return e.length&&(r+=e.join("/")+"/"),r}static filename(e){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).pop()}static head(e){return e instanceof t&&(e=e.value),e.split("/").filter(Boolean).shift()}static tail(e){e instanceof t&&(e=e.value),e=e.split("/").filter(Boolean),e.shift();let r="/";return e.length&&(r+=e.join("/")+"/"),r}};var er=class t{#e;#t="/";constructor(e){this.#e=e,this.#t=this.#e.path}get path(){return this.#t}cd(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),new t(this.#e.cd(e))}async read(e,r=null){if(e instanceof R||(e=new R(R.collapse(e,this.#t))),typeof r=="function"){if(!this.#e.supportsStreamingRead())throw new Error("Adapter "+this.#e.name+" does not support streaming reading.");return this.#e.readStream(e,r)}else return this.#e.read(e)}async write(e,r,n=null){if(e instanceof R||(e=new R(R.collapse(e,this.#t))),!this.#e.supportsWrite())throw new Error("Adapter "+this.#e.name+" is read only.");if(typeof r=="function"){if(!this.#e.supportsStreamingWrite())throw new Error("Adapter "+this.#e.name+" does not support streaming writing.");return this.#e.writeStream(e,r,n)}else{if(typeof r=="string")return this.#e.write(e,r,n);throw new TypeError("Cannot write contents of type "+typeof r)}}async delete(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.delete(e)}async exists(e){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.exists(e)}async list(e=""){return e instanceof R||(e=new R(R.collapse(e,this.#t))),this.#e.list(e)}};var Rt={};Cn(Rt,{Client:()=>se,client:()=>ee,deepClone:()=>De,formdata:()=>Ps,metroError:()=>W,request:()=>Xe,response:()=>Et,trace:()=>ff,url:()=>$});var Ze="https://metro.muze.nl/details/";Symbol.metroProxy||(Symbol.metroProxy=Symbol("isProxy"));Symbol.metroSource||(Symbol.metroSource=Symbol("source"));var se=class t{clientOptions={url:$(typeof window<"u"?window.location:"https://localhost"),verbs:["get","post","put","delete","patch","head","options","query"]};static tracers={};constructor(...e){for(let r of e)if(typeof r=="string"||r instanceof String)this.clientOptions.url=$(this.clientOptions.url.href,r);else if(r instanceof t)Object.assign(this.clientOptions,r.clientOptions);else if(r instanceof Function)this.#e([r]);else if(r&&typeof r=="object")for(let n in r)n=="middlewares"?this.#e(r[n]):n=="url"?this.clientOptions.url=$(this.clientOptions.url.href,r[n]):typeof r[n]=="function"?this.clientOptions[n]=r[n](this.clientOptions[n],this.clientOptions):this.clientOptions[n]=r[n];for(let r of this.clientOptions.verbs)this[r]=async function(...n){return this.fetch(Xe(this.clientOptions,...n,{method:r.toUpperCase()}))}}#e(e){typeof e=="function"&&(e=[e]);let r=e.findIndex(n=>typeof n!="function");if(r>=0)throw W("metro.client: middlewares must be a function or an array of functions "+Ze+"client/invalid-middlewares/",e[r]);Array.isArray(this.clientOptions.middlewares)||(this.clientOptions.middlewares=[]),this.clientOptions.middlewares=this.clientOptions.middlewares.concat(e)}fetch(e,r){if(e=Xe(e,r),!e.url)throw W("metro.client."+e.method.toLowerCase()+": Missing url parameter "+Ze+"client/fetch-missing-url/",e);if(r||(r={}),typeof r!="object"||r instanceof String)throw W("metro.client.fetch: Invalid options parameter "+Ze+"client/fetch-invalid-options/",r);let i=[async function(a){a[Symbol.metroProxy]&&(a=a[Symbol.metroSource]);let l=await fetch(a);return Et(l)}].concat(this.clientOptions?.middlewares?.slice()||[]);r=Object.assign({},this.clientOptions,r);let s;for(let o of i)s=(function(a,l){return async function(u){let f,c=Object.values(t.tracers);for(let d of c)d.request&&d.request.call(d,u,l);f=await l(u,a);for(let d of c)d.response&&d.response.call(d,f,l);return f}})(s,o);return s(e)}with(...e){return new t(De(this.clientOptions),...e)}get location(){return this.clientOptions.url}};function ee(...t){return new se(...De(t))}function uf(t,e){let r=e||{};!r.url&&e.url&&(r.url=e.url);for(let n of["method","headers","body","mode","credentials","cache","redirect","referrer","referrerPolicy","integrity","keepalive","signal","priority","url"]){let i=t[n];if(!(typeof i>"u"||i==null))if(i?.[Symbol.metroProxy]&&(i=i[Symbol.metroSource]),typeof i=="function")r[n]=i(r[n],r);else if(n=="url")r.url=$(r.url,i);else if(n=="headers"){r.headers=new Headers(e.headers),i instanceof Headers||(i=new Headers(t.headers));for(let[s,o]of i.entries())r.headers.set(s,o)}else r[n]=i}return t instanceof Request&&t.data&&(r.body=t.data),r}function Xe(...t){let e={url:$(typeof window<"u"?window.location:"https://localhost/"),duplex:"half"};for(let i of t)typeof i=="string"||i instanceof URL||i instanceof URLSearchParams?e.url=$(e.url,i):i&&(i instanceof FormData||i instanceof ReadableStream||i instanceof Blob||i instanceof ArrayBuffer||i instanceof DataView)?e.body=i:i&&typeof i=="object"&&Object.assign(e,uf(i,e));let r=new Request(e.url,e),n=e.body;return n&&typeof n=="object"&&!(n instanceof String)&&!(n instanceof ReadableStream)&&!(n instanceof Blob)&&!(n instanceof ArrayBuffer)&&!(n instanceof DataView)&&!(n instanceof FormData)&&!(n instanceof URLSearchParams)&&(typeof globalThis.TypedArray>"u"||!(n instanceof globalThis.TypedArray))&&typeof n.toString=="function"&&(e.body=n.toString({headers:r.headers}),r=new Request(e.url,e)),Object.freeze(r),new Proxy(r,{get(i,s){let o;switch(s){case Symbol.metroSource:o=i;break;case Symbol.metroProxy:o=!0;break;case"with":o=function(...a){return n&&a.unshift({body:n}),Xe(i,...a)};break;case"data":o=n;break;default:i[s]instanceof Function?o=i[s].bind(i):o=i[s];break}return o}})}function js(t,e){let r=e||{};!r.url&&e.url&&(r.url=e.url);for(let n of["status","statusText","headers","body","url","type","redirected"]){let i=t[n];typeof i>"u"||i==null||(i?.[Symbol.metroProxy]&&(i=i[Symbol.metroSource]),typeof i=="function"?r[n]=i(r[n],r):n=="url"?r.url=new URL(i,r.url||"https://localhost/"):r[n]=i)}return t instanceof Response&&t.data&&(r.body=t.data),r}function Et(...t){let e={};for(let i of t)typeof i=="string"?e.body=i:i instanceof Response?Object.assign(e,js(i,e)):i&&typeof i=="object"&&(i instanceof FormData||i instanceof Blob||i instanceof ArrayBuffer||i instanceof DataView||i instanceof ReadableStream||i instanceof URLSearchParams||i instanceof String||typeof globalThis.TypedArray<"u"&&i instanceof globalThis.TypedArray?e.body=i:Object.assign(e,js(i,e)));let r;e.body&&(r=e.body),[101,204,205,304].includes(e.status)&&(e.body=null);let n=new Response(e.body,e);return Object.freeze(n),new Proxy(n,{get(i,s){let o;switch(s){case Symbol.metroProxy:o=!0;break;case Symbol.metroSource:o=i;break;case"with":o=function(...a){return Et(i,...a)};break;case"data":o=r;break;case"ok":o=i.status>=200&&i.status<400;break;default:typeof i[s]=="function"?o=i[s].bind(i):o=i[s];break}return o}})}function ks(t,e){typeof e=="function"?e(t.searchParams,t):(e=new URLSearchParams(e),e.forEach((r,n)=>{t.searchParams.append(n,r)}))}function $(...t){let e=["hash","host","hostname","href","password","pathname","port","protocol","username","search","searchParams"],r=new URL("https://localhost/");for(let n of t)if(typeof n=="string"||n instanceof String)r=new URL(n,r);else if(n instanceof URL||typeof Location<"u"&&n instanceof Location)r=new URL(n);else if(n instanceof URLSearchParams)ks(r,n);else if(n&&typeof n=="object")for(let i in n)switch(i){case"search":typeof n.search=="function"?n.search(r.search,r):r.search=new URLSearchParams(n.search);break;case"searchParams":ks(r,n.searchParams);break;default:if(!e.includes(i))throw W("metro.url: unknown url parameter "+Ze+"url/unknown-param-name/",i);if(typeof n[i]=="function")n[i](r[i],r);else if(typeof n[i]=="string"||n[i]instanceof String||typeof n[i]=="number"||n[i]instanceof Number||typeof n[i]=="boolean"||n[i]instanceof Boolean)r[i]=""+n[i];else if(typeof n[i]=="object"&&n[i].toString)r[i]=n[i].toString();else throw W("metro.url: unsupported value for "+i+" "+Ze+"url/unsupported-param-value/",t[i]);break}else throw W("metro.url: unsupported option value "+Ze+"url/unsupported-option-value/",n);return Object.freeze(r),new Proxy(r,{get(n,i){let s;switch(i){case Symbol.metroProxy:s=!0;break;case Symbol.metroSource:s=n;break;case"with":s=function(...o){return $(n,...o)};break;case"filename":s=n.pathname.split("/").pop();break;case"folderpath":s=n.pathname.substring(0,n.pathname.lastIndexOf("\\")+1);break;case"authority":s=n.username??"",s+=n.password?":"+n.password:"",s+=s?"@":"",s+=n.hostname,s+=n.port?":"+n.port:"",s+="/",s=n.protocol+"//"+s;break;case"origin":s=n.protocol+"//"+n.hostname,s+=n.port?":"+n.port:"",s+="/";break;case"fragment":s=n.hash.substring(1);break;case"scheme":n.protocol?s=n.protocol.substring(0,n.protocol.length-1):s="";break;default:n[i]instanceof Function?s=n[i].bind(n):s=n[i];break}return s}})}function Ps(...t){var e=new FormData;for(let r of t)if(r instanceof HTMLFormElement&&(r=new FormData(r)),r instanceof FormData)for(let n of r.entries())e.append(n[0],n[1]);else if(r&&typeof r=="object")for(let n of Object.entries(r))if(Array.isArray(n[1]))for(let i of n[1])e.append(n[0],i);else e.append(n[0],n[1]);else throw new W("metro.formdata: unknown option type "+Ze+"formdata/unknown-option-value/",r);return Object.freeze(e),new Proxy(e,{get(r,n){let i;switch(n){case Symbol.metroProxy:i=!0;break;case Symbol.metroSource:i=r;break;case"with":i=function(...s){return Ps(r,...s)};break;default:r[n]instanceof Function?i=r[n].bind(r):i=r[n];break}return i}})}var tr={error:(t,...e)=>{console.error("\u24C2\uFE0F ",t,...e)},info:(t,...e)=>{console.info("\u24C2\uFE0F ",t,...e)},group:t=>{console.group("\u24C2\uFE0F "+t)},groupEnd:t=>{console.groupEnd("\u24C2\uFE0F "+t)}};function W(t,...e){return tr.error(t,...e),new Error(t,...e)}var ff={add(t,e){se.tracers[t]=e},delete(t){delete se.tracers[t]},clear(){se.tracers={}},group(){let t=0;return{request:(e,r)=>{t++,tr.group(t),tr.info(e?.url,e,r)},response:(e,r)=>{tr.info(e?.body?e.body[Symbol.metroSource]:null,e,r),tr.groupEnd(t),t--}}}};function De(t){if(Array.isArray(t))return t.slice().map(De);if(t&&typeof t=="object")if(t.__proto__.constructor==Object||!t.__proto__){let e=Object.assign({},t);return Object.keys(e).forEach(r=>{e[r]=De(t[r])}),e}else return t;return t}var et=class{#e;#t;constructor(e,r="/"){this.#e=ee(e),this.#t=new R(r)}get name(){return"HttpAdapter"}get path(){return this.#t}supportsWrite(){return!0}supportsStreamingWrite(){return cf}supportsStreamingRead(){return!0}cd(e){if(!R.isPath(e))throw new TypeError(e+" is not a valid path");return R.isRelative(e)&&(e=R.collapse(e,this.#t)),new this.constructor(this.#e,e)}async write(e,r,n=null){return this.#e.put({body:r})}writeStream(e,r,n=null){throw new Error("Not yet implemented")}async read(e){let r=await this.#e.get(e),n={type:this.getMimetype(r),name:R.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}readStream(e,r){throw new Error("Not yet implemented")}async exists(e){return this.#e.head(e)}async delete(e){return this.#e.delete(e)}async list(e){let r=["text/html","text/xhtml","text/xhtml+xml","text/xml"],n=await this.read(e);if(r.includes(n.type.split(";")[0]))var i=n.contents;else{let u=this.getUrl(e);throw new TypeError("URL "+u+" is not of a supported content type",{cause:n})}let s=$(this.#e.clientOptions.url).pathname,o=this.getUrl(e),a=document.createElement("template");a.innerHTML=i;let l=a.content.querySelectorAll("a[href]");return Array.from(l).map(u=>{let f=new URL(u.getAttribute("href"),o.href);return u.href=f.href,{filename:R.filename(u.pathname),path:u.pathname,name:u.innerText,href:u.href}}).filter(u=>{let f=new URL(u.href);return f.pathname=R.parent(f.pathname),f.href===o.href}).map(u=>({filename:u.filename,path:u.path.substring(s.length-1),name:u.name}))}getUrl(e){let r=$(this.#e.clientOptions.url).pathname;return e=R.collapse(r+R.collapse(e)),new URL(e,this.#e.clientOptions.url)}getMimetype(e){return e.headers.has("Content-Type")?e.headers.get("Content-Type"):null}},cf=(async()=>new Request("",{body:new ReadableStream,method:"POST",duplex:"half"}).headers.has("Content-Type")?!1:fetch("data:a/a;charset=utf-8,",{method:"POST",body:new ReadableStream,duplex:"half"}).then(()=>!0,()=>!1))();var df={fs:er,adapters:{https:et},path:R};globalThis.jsfs=df;function ue(t){return t=Object.assign({contentType:"application/json",reviver:null,replacer:null,space:""},t),async function(r,n){if(r.headers.get("Accept")||(r=r.with({headers:{Accept:t.accept??t.contentType}})),r.method!=="GET"&&r.method!=="HEAD"&&r.data&&typeof r.data=="object"&&!(r.data instanceof ReadableStream)){let s=r.headers.get("Content-Type");(!s||pf(s))&&(r=r.with({headers:{"Content-Type":t.contentType}})),Ls(r.headers.get("Content-Type"))&&(r=r.with({body:JSON.stringify(r.data,t.replacer,t.space)}))}let i=await n(r);if(i&&Ls(i.headers?.get("Content-Type"))){let o=await i.clone().text();try{let a=JSON.parse(o,t.reviver);return i.with({body:a})}catch{}}return i}}var hf=/^application\/([a-zA-Z0-9\-_]+\+)?json\b/;function Ls(t){return hf.exec(t)}function pf(t){return/^text\/plain\b/.exec(t)}function fe(t){return async function(r,n){let i=await n(r);if(!i.ok)if(t&&typeof t[i.status]=="function")i=t[i.status].apply(i,r);else throw new Error(i.status+": "+i.statusText,{cause:i});return i}}function It(){return async function(e,r){let n=await r(e);return n.ok&&n.data?n.data:n}}var Dr=class extends se{constructor(e,r,n=null){e instanceof se?super(e.clientOptions,fe(),It()):super(e,fe(),It()),n||(n=this);for(let i in r)typeof r[i]=="function"?this[i]=r[i].bind(n):r[i]&&typeof r[i]=="object"?this[i]=new this.constructor(e,r[i],n):this[i]=r[i]}},Dn=class extends Dr{constructor(e,r,n=null){e instanceof se?super(e.with(ue()),r,n):super(ee(e,ue()),r,n)}};function Os(...t){return new Dr(...De(t))}function Bs(...t){return new Dn(...De(t))}var Fs=Object.assign({},Rt,{mw:{json:ue,thrower:fe,getdata:It},api:Os,jsonApi:Bs});globalThis.metro||(globalThis.metro=Fs);var ce=Fs;globalThis.assertEnabled=!1;function Q(t,e){if(globalThis.assertEnabled){let r=te(t,e);if(r)throw console.error("\u{1F170}\uFE0F Assertions failed because of:",r,"in this source:",t),new Error("Assertions failed",{cause:{problems:r,source:t}})}}function w(t){return function(r,n,i){if(typeof r<"u"&&r!=null&&typeof t<"u")return te(r,t,n,i)}}function j(t){return function(r,n,i){return r==null||typeof r>"u"?P("data is required",r,t||"any value",i):typeof t<"u"?te(r,t,n,i):!1}}function rr(t){return function(r,n,i){return r==null||typeof r>"u"?(_f("data does not contain recommended value",r,t,i),!1):te(r,t,n,i)}}function J(...t){return function(r,n,i){for(let s of t)if(!te(r,s,n,i))return!1;return P("data does not match oneOf patterns",r,t,i)}}function At(...t){return function(r,n,i){if(!Array.isArray(r))return P("data is not an array",r,"anyOf",i);for(let s of r)if(J(...t)(s))return P("data does not match anyOf patterns",s,t,i);return!1}}function Cs(...t){return function(r,n,i){let s=[];for(let o of t)s=s.concat(te(r,o,n,i));if(s=s.filter(Boolean),s.length)return P("data does not match all given patterns",r,t,i,s)}}function v(t,e,r){try{t instanceof URL&&(t=t.href);let n=new URL(t);if(n.href!=t&&!(n.href+"/"==t||n.href==t+"/"))return P("data is not a valid url",t,"validURL",r)}catch{return P("data is not a valid url",t,"validURL",r)}}function Ds(t,e,r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return P("data is not a valid email",t,"validEmail",r)}function Tt(t){return function(r,n,i){if(!(r instanceof t))return P("data is not an instanceof pattern",r,t,i)}}function nr(t){return function(r,n,i){if(!te(r,t,n,i))return P("data matches pattern, when required not to",r,t,i)}}function te(t,e,r,n=""){r||(r=t);let i=[];if(e===Boolean)typeof t!="boolean"&&!(t instanceof Boolean)&&i.push(P("data is not a boolean",t,e,n));else if(e===Number)typeof t!="number"&&!(t instanceof Number)&&i.push(P("data is not a number",t,e,n));else if(e===String)typeof t!="string"&&!(t instanceof String)&&i.push(P("data is not a string",t,e,n)),t==""&&i.push(P("data is an empty string, which is not allowed",t,e,n));else if(e instanceof RegExp)if(Array.isArray(t)){let s=t.findIndex((o,a)=>te(o,e,r,n+"["+a+"]"));s>-1&&i.push(P("data["+s+"] does not match pattern",t[s],e,n+"["+s+"]"))}else typeof t>"u"?i.push(P("data is undefined, should match pattern",t,e,n)):e.test(t)||i.push(P("data does not match pattern",t,e,n));else if(e instanceof Function){let s=e(t,r,n);s&&(Array.isArray(s)?i=i.concat(s):i.push(s))}else if(Array.isArray(e)){Array.isArray(t)||i.push(P("data is not an array",t,[],n));for(let s of e)for(let o of t.keys()){let a=te(t[o],s,r,n+"["+o+"]");Array.isArray(a)?i=i.concat(a):a&&i.push(a)}}else if(e&&typeof e=="object")if(Array.isArray(t)){let s=t.findIndex((o,a)=>te(o,e,r,n+"["+a+"]"));s>-1&&i.push(P("data["+s+"] does not match pattern",t[s],e,n+"["+s+"]"))}else if(!t||typeof t!="object")i.push(P("data is not an object, pattern is",t,e,n));else if(t instanceof URLSearchParams&&(t=Object.fromEntries(t)),e instanceof Function){let s=te(t,e,r,n);s&&(i=i.concat(s))}else for(let[s,o]of Object.entries(e)){let a=te(t[s],o,r,n+"."+s);a&&(i=i.concat(a))}else e!=t&&i.push(P("data and pattern are not equal",t,e,n));return i.length?i:!1}function P(t,e,r,n,i){let s={path:n,message:t,found:e,expected:r};return i&&(s.problems=i),s}function _f(t,e,r,n){console.warn("\u{1F170}\uFE0F Assert: "+n,t,r,e)}function Ms(t){let e,r;if(typeof localStorage<"u")e={get:()=>localStorage.getItem("metro/state:"+t),set:n=>localStorage.setItem("metro/state:"+t,n),has:()=>localStorage.getItem("metro/state:"+t)!==null,delete:()=>localStorage.remoteItem("metro/state:"+t)},r={get:n=>JSON.parse(localStorage.getItem(t+":"+n)),set:(n,i)=>localStorage.setItem(t+":"+n,JSON.stringify(i)),has:n=>localStorage.getItem(t+":"+n)!==null,delete:n=>localStorage.removeItem(t+":"+n)};else{let n=new Map;e={get:()=>n.get("metro/state:"+t),set:i=>n.set("metro/state:"+t,i),has:()=>n.has("metro/state:"+t),delete:()=>n.delete("metro/state:"+t)},r=new Map}return{state:e,tokens:r}}function Mn(t){let e={client:ee(),force_authorization:!1,site:"default",oauth2_configuration:{authorization_endpoint:"/authorize",token_endpoint:"/token",redirect_uri:globalThis.document?.location.href,grant_type:"authorization_code",code_verifier:bf(64)},authorize_callback:async f=>(window.location.href!=f.href&&window.location.replace(f.href),!1)};Q(t,{});let r=Object.assign({},e.oauth2_configuration,t?.oauth2_configuration);t=Object.assign({},e,t),t.oauth2_configuration=r;let n=Ms(t.site);t.tokens||(t.tokens=n.tokens),t.state||(t.state=n.state),Q(t,{oauth2_configuration:{client_id:j(/.+/),grant_type:"authorization_code",authorization_endpoint:j(v),token_endpoint:j(v),redirect_uri:j(v)}});for(let f in r)switch(f){case"access_token":case"authorization_code":case"refresh_token":t.tokens.set(f,r[f]);break}return async function(f,c){if(t.force_authorization)return i(f,c);let d;try{if(d=await c(f),d.ok)return d}catch(h){switch(d?.status){case 400:case 401:return i(f,c)}throw h}if(!d.ok)switch(d.status){case 400:case 401:return i(f,c)}return d};async function i(f,c){s();let d=t.tokens.get("access_token"),h=t.tokens.get("refresh_token"),y=yf(d);if(!d||y&&!h){try{if(!await o())return Et("false")}catch(_){throw _}return i(f,c)}else if(y&&h){try{if(!await a())return Et("false")}catch(_){throw _}return i(f,c)}else return f=Xe(f,{headers:{Authorization:d.type+" "+d.value}}),c(f)}function s(){if(typeof window<"u"&&window?.location){let f=$(window.location),c,d,h;if(f.searchParams.has("code"))h=f.searchParams,f=f.with({search:""}),history.pushState({},"",f.href);else if(f.hash){let y=f.hash.substr(1);h=new URLSearchParams("?"+y),f=f.with({hash:""}),history.pushState({},"",f.href)}if(h){c=h.get("code"),d=h.get("state");let y=t.state.get("metro/state");if(!d||d!==y)return;c&&t.tokens.set("authorization_code",c)}}}async function o(){if(r.grant_type==="authorization_code"&&!t.tokens.has("authorization_code")){let h=await l();if(!t.authorize_callback||typeof t.authorize_callback!="function")throw W("oauth2mw: oauth2 with grant_type:authorization_code requires a callback function in client options.authorize_callback");let y=await t.authorize_callback(h);if(y)t.tokens.set("authorization_code",y);else return!1}let f=u(),c=await t.client.post(f);if(!c.ok){let h=await c.text();throw W("OAuth2mw: fetch access_token: "+c.status+": "+c.statusText,{cause:f})}let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Us(d.expires_in),type:d.token_type,scope:d.scope}),d.refresh_token){let h={value:d.refresh_token};t.tokens.set("refresh_token",h)}return t.tokens.delete("authorization_code"),d}async function a(){let f=u("refresh_token"),c=await t.client.post(f);if(!c.ok)throw W("OAuth2mw: refresh access_token: "+c.status+": "+c.statusText,{cause:f});let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Us(d.expires_in),type:d.token_type,scope:d.scope}),d.refresh_token){let h={value:d.refresh_token};t.tokens.set("refresh_token",h)}else return!1;return d}async function l(){if(!r.authorization_endpoint)throw W("oauth2mw: Missing options.oauth2_configuration.authorization_endpoint");let f=$(r.authorization_endpoint,{hash:""});Q(r,{client_id:/.+/,redirect_uri:/.+/,scope:/.*/});let c={response_type:"code",client_id:r.client_id,redirect_uri:r.redirect_uri,state:r.state||mf(40)};return r.response_type&&(c.response_type=r.response_type),r.response_mode&&(c.response_mode=r.response_mode),t.state.set(c.state),r.client_secret&&(c.client_secret=r.client_secret),r.code_verifier&&(t.tokens.set("code_verifier",r.code_verifier),c.code_challenge=await gf(r.code_verifier),c.code_challenge_method="S256"),r.scope&&(c.scope=r.scope),r.prompt&&(c.prompt=r.prompt),$(f,{search:c})}function u(f=null){if(Q(r,{client_id:/.+/,redirect_uri:/.+/}),!r.token_endpoint)throw W("oauth2mw: Missing options.endpoints.token url");let c=$(r.token_endpoint,{hash:""}),d={grant_type:f||r.grant_type,client_id:r.client_id};switch(r.client_secret&&(d.client_secret=r.client_secret),r.scope&&(d.scope=r.scope),d.grant_type){case"authorization_code":d.redirect_uri=r.redirect_uri,d.code=t.tokens.get("authorization_code");let h=t.tokens.get("code_verifier");h&&(d.code_verifier=h);break;case"client_credentials":break;case"refresh_token":let y=t.tokens.get("refresh_token");d.refresh_token=y.value;break;default:throw new Error("Unknown grant_type: ".oauth2.grant_type)}return Xe(c,{method:"POST",body:new URLSearchParams(d)})}}function yf(t){if(!t)return!0;let e=new Date(t.expires);return new Date().getTime()>e.getTime()}function Us(t){if(t instanceof Date)return new Date(t.getTime());if(typeof t=="number"){let e=new Date;return e.setSeconds(e.getSeconds()+t),e}throw new TypeError("Unknown expires type "+t)}function bf(t=64){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),$s(e)}async function gf(t){let r=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",r);return $s(n)}function $s(t){let e=Array.from(new Uint8Array(t),r=>String.fromCharCode(r)).join("");return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function mf(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",n=0;for(;n<t;)r+=e.charAt(Math.floor(Math.random()*e.length)),n++;return r}function qs(){let t=new URL(document.location.href);if(!t.searchParams.has("code")){if(t.hash){let e=t.hash.substr(1);if(params=new URLSearchParams("?"+e),params.has("code"))return!0}return!1}return!0}function Un(){return new Promise((t,e)=>{let r=globalThis.indexedDB.open("metro",1);r.onupgradeneeded=()=>r.result.createObjectStore("keyPairs",{keyPath:"domain"}),r.onerror=n=>{e(n)},r.onsuccess=n=>{let i=n.target.result;t({set:function(s,o){return new Promise((a,l)=>{let u=i.transaction("keyPairs","readwrite",{durability:"strict"}),f=u.objectStore("keyPairs");u.oncomplete=()=>{a()},u.onerror=l,f.put(s,o)})},get:function(s){return new Promise((o,a)=>{let l=i.transaction("keyPairs","readonly"),f=l.objectStore("keyPairs").get(s);f.onsuccess=()=>{o(f.result)},f.onerror=a,l.onerror=a})},clear:function(){return new Promise((s,o)=>{let a=i.transaction("keyPairs","readwrite"),u=a.objectStore("keyPairs").clear();u.onsuccess=()=>{s()},u.onerror=o,a.onerror=o})}})}})}var xf=new TextEncoder,Sf=new TextDecoder;function Mr(t){return typeof t=="string"?xf.encode(t):Sf.decode(t)}function Ws(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new $n(`${t.name} modulusLength must be at least 2048 bits`)}function Ef(t){switch(t.algorithm.name){case"ECDSA":return{name:t.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return Ws(t.algorithm),{name:t.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return Ws(t.algorithm),{name:t.algorithm.name};case"Ed25519":return{name:t.algorithm.name}}throw new Me}async function Rf(t,e,r){if(r.usages.includes("sign")===!1)throw new TypeError('private CryptoKey instances used for signing assertions must include "sign" in their "usages"');let n=`${ir(Mr(JSON.stringify(t)))}.${ir(Mr(JSON.stringify(e)))}`,i=ir(await crypto.subtle.sign(Ef(r),r,Mr(n)));return`${n}.${i}`}var Gs=32768;function If(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));let e=[];for(let r=0;r<t.byteLength;r+=Gs)e.push(String.fromCharCode.apply(null,t.subarray(r,r+Gs)));return btoa(e.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function ir(t){return If(t)}function Af(){return ir(crypto.getRandomValues(new Uint8Array(32)))}var Me=class extends Error{constructor(e){super(e??"operation not supported"),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},$n=class extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};function Tf(t){switch(t.algorithm.hash.name){case"SHA-256":return"PS256";default:throw new Me("unsupported RsaHashedKeyAlgorithm hash name")}}function vf(t){switch(t.algorithm.hash.name){case"SHA-256":return"RS256";default:throw new Me("unsupported RsaHashedKeyAlgorithm hash name")}}function Nf(t){switch(t.algorithm.namedCurve){case"P-256":return"ES256";default:throw new Me("unsupported EcKeyAlgorithm namedCurve")}}function jf(t){switch(t.algorithm.name){case"RSA-PSS":return Tf(t);case"RSASSA-PKCS1-v1_5":return vf(t);case"ECDSA":return Nf(t);case"Ed25519":return"EdDSA";default:throw new Me("unsupported CryptoKey algorithm name")}}function zs(t){return t instanceof CryptoKey}function kf(t){return zs(t)&&t.type==="private"}function Pf(t){return zs(t)&&t.type==="public"}function Lf(){return Math.floor(Date.now()/1e3)}async function Ur(t,e,r,n,i,s){let o=t?.privateKey,a=t?.publicKey;if(!kf(o))throw new TypeError('"keypair.privateKey" must be a private CryptoKey');if(!Pf(a))throw new TypeError('"keypair.publicKey" must be a public CryptoKey');if(a.extractable!==!0)throw new TypeError('"keypair.publicKey.extractable" must be true');if(typeof e!="string")throw new TypeError('"htu" must be a string');if(typeof r!="string")throw new TypeError('"htm" must be a string');if(n!==void 0&&typeof n!="string")throw new TypeError('"nonce" must be a string or undefined');if(i!==void 0&&typeof i!="string")throw new TypeError('"accessToken" must be a string or undefined');if(s!==void 0&&(typeof s!="object"||s===null||Array.isArray(s)))throw new TypeError('"additional" must be an object');return Rf({alg:jf(o),typ:"dpop+jwt",jwk:await Of(a)},{...s,iat:Lf(),jti:Af(),htm:r,nonce:n,htu:e,ath:i?ir(await crypto.subtle.digest("SHA-256",Mr(i))):void 0},o)}async function Of(t){let{kty:e,e:r,n,x:i,y:s,crv:o}=await crypto.subtle.exportKey("jwk",t);return{kty:e,crv:o,e:r,n,x:i,y:s}}async function Hs(t,e){let r;if(typeof t!="string"||t.length===0)throw new TypeError('"alg" must be a non-empty string');switch(t){case"PS256":r={name:"RSA-PSS",hash:"SHA-256",modulusLength:e?.modulusLength??2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":r={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:e?.modulusLength??2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":r={name:"ECDSA",namedCurve:"P-256"};break;case"EdDSA":r={name:"Ed25519"};break;default:throw new Me}return crypto.subtle.generateKey(r,e?.extractable??!1,["sign","verify"])}function qn(t){return Q(t,{site:j(v),authorization_endpoint:j(v),token_endpoint:j(v),dpop_signing_alg_values_supported:w([])}),async(e,r)=>{let n=await Un(),i=await n.get(t.site);if(!i){let a=await Hs("ES256");i={domain:t.site,keyPair:a},await n.set(i)}let s=ce.url(e.url);if(e.url.startsWith(t.authorization_endpoint)){let a=e.body;a instanceof URLSearchParams||a instanceof FormData?a.set("dpop_jkt",i.keyPair.publicKey):a.dpop_jkt=i.keyPair.publicKey}else if(e.url.startsWith(t.token_endpoint)){let a=await Ur(i.keyPair,e.url,e.method);e=e.with({headers:{DPoP:a}})}else if(e.headers.has("Authorization")){let a=localStorage.getItem(s.host+":nonce")||void 0,l=e.headers.get("Authorization").split(" ")[1],u=await Ur(i.keyPair,e.url,e.method,a,l);e=e.with({headers:{Authorization:"DPoP "+l,DPoP:u}})}let o=await r(e);return o.headers.get("DPoP-Nonce")&&localStorage.setItem(s.host+":nonce",o.headers.get("DPoP-Nonce")),o}}var sr=(...t)=>(e,r)=>t.filter(n=>r.hasOwnKey(n)).length>0?!1:P("root data must have all of",r,t),Ue=(...t)=>e=>Array.isArray(e)&&t.filter(r=>!e.includes(r)).length==0?!1:P("data must be an array which includes",e,t);var oe=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],$r=["client_secret_post","client_secret_basic","client_secret_jwt","private_key_jwt"];async function or(t={}){Q(t,{client:w(Tt(ce.client().constructor)),issuer:j(v)});let e={client:ce.client().with(fe()).with(ue()),requireDynamicRegistration:!1};t=Object.assign({},e,t);let r=!1;function n(l){return r}let i={issuer:j(Cs(t.issuer,n)),authorization_endpoint:j(v),token_endpoint:j(v),userinfo_endpoint:rr(v),jwks_uri:j(v),registration_endpoint:t.requireDynamicRegistration?j(v):rr(v),scopes_supported:rr(Ue("openid")),response_types_supported:t.requireDynamicRegistration?j(Ue("code","id_token","id_token token")):j([]),response_modes_supported:w([]),grant_types_supported:t.requireDynamicRegistration?w(Ue("authorization_code")):w([]),acr_values_supported:w([]),subject_types_supported:j([]),id_token_signing_alg_values_supported:j(Ue("RS256")),id_token_encryption_alg_values_supported:w([]),id_token_encryption_enc_values_supported:w([]),userinfo_signing_alg_values_supported:w([]),userinfo_encryption_alg_values_supported:w([]),userinfo_encryption_enc_values_supported:w([]),request_object_signing_alg_values_supported:w(Ue("RS256")),request_object_encryption_alg_values_supported:w([]),request_object_encryption_enc_values_supported:w([]),token_endpoint_auth_methods_supported:w(At(...$r)),token_endpoint_auth_signing_alg_values_supported:w(Ue("RS256"),nr(Ue("none"))),display_values_supported:w(At("page","popup","touch","wap")),claim_types_supported:w(At("normal","aggregated","distributed")),claims_supported:rr([]),service_documentation:w(v),claims_locales_supported:w([]),ui_locales_supported:w([]),claims_parameter_supported:w(Boolean),request_parameter_supported:w(Boolean),request_uri_parameter_supported:w(Boolean),op_policy_uri:w(v),op_tos_uri:w(v)},s=ce.url(t.issuer,".well-known/openid-configuration"),a=(await t.client.get(s)).data;return Q(a,i),Q(a.issuer,t.issuer),a}async function ar(t){let e={redirect_uris:j([v]),response_types:w([]),grant_types:w(At("authorization_code","refresh_token")),application_type:w(J("native","web")),contacts:w([Ds]),client_name:w(String),logo_uri:w(v),client_uri:w(v),policy_uri:w(v),tos_uri:w(v),jwks_uri:w(v,nr(sr("jwks"))),jwks:w(v,nr(sr("jwks_uri"))),sector_identifier_uri:w(v),subject_type:w(String),id_token_signed_response_alg:w(J(...oe)),id_token_encrypted_response_alg:w(J(...oe)),id_token_encrypted_response_enc:w(J(...oe),sr("id_token_encrypted_response_alg")),userinfo_signed_response_alg:w(J(...oe)),userinfo_encrypted_response_alg:w(J(...oe)),userinfo_encrypted_response_enc:w(J(...oe),sr("userinfo_encrypted_response_alg")),request_object_signing_alg:w(J(...oe)),request_object_encryption_alg:w(J(...oe)),request_object_encryption_enc:w(J(...oe)),token_endpoint_auth_method:w(J(...$r)),token_endpoint_auth_signing_alg:w(J(...oe)),default_max_age:w(Number),require_auth_time:w(Boolean),default_acr_values:w([String]),initiate_login_uri:w([v]),request_uris:w([v])};Q(t,{client:w(Tt(ce.client().constructor)),registration_endpoint:v,client_info:e});let r={client:ce.client().with(fe()).with(ue()),client_info:{redirect_uris:[globalThis.document?.location.href]}};t=Object.assign({},r,t),t.client_info||(t.client_info={}),t.client_info.redirect_uris||(t.client_info.redirect_uris=[globalThis.document?.location.href]);let n=await t.client.post(t.registration_endpoint,{body:t.client_info}),i=n.data;if(!i.client_id||!i.client_secret)throw ce.metroError("metro.oidc: Error: dynamic registration of client failed, no client_id or client_secret returned",n);return t.client_info=Object.assign(t.client_info,i),t.client_info}function qr(t){let e;if(typeof localStorage<"u")e={get:r=>JSON.parse(localStorage.getItem("metro/oidc:"+t+":"+r)),set:(r,n)=>localStorage.setItem("metro/oidc:"+t+":"+r,JSON.stringify(n)),has:r=>localStorage.getItem("metro/oidc:"+t+":"+r)!==null};else{let r=new Map;e={get:n=>JSON.parse(r.get("metro/oidc:"+t+":"+n)||null),set:(n,i)=>r.set("metro/oidc:"+t+":"+n,JSON.stringify(i)),has:n=>r.has("metro/oidc:"+t+":"+n)}}return e}function Wn(t={}){let e={client:ee(),force_authorization:!1,use_dpop:!0,authorize_callback:async r=>(window.location.href!=r.href&&window.location.replace(r.href),!1)};return t=Object.assign({},e,t),Q(t,{client:j(Tt(ee().constructor)),client_info:j(),issuer:j(v),oauth2:w({}),openid_configuration:w()}),t.store||(t.store=qr(t.issuer)),!t.openid_configuration&&t.store.has("openid_configuration")&&(t.openid_configuration=t.store.get("openid_configuration")),!t.client_info?.client_id&&t.store.has("client_info")&&(t.client_info=t.store.get("client_info")),async(r,n)=>{let i;if(!t.force_authorization){try{i=await n(r)}catch(u){if(i.status!=401&&i.status!=403)throw u}if(i.ok||i.status!=401&&i.status!=403)return i}if(t.openid_configuration||(t.openid_configuration=await or({issuer:t.issuer}),t.store.set("openid_configuration",t.openid_configuration)),!t.client_info?.client_id){if(!t.openid_configuration.registration_endpoint)throw W("metro.oidcmw: Error: issuer "+t.issuer+" does not support dynamic client registration, but you haven't specified a client_id");t.client_info=await ar({registration_endpoint:t.openid_configuration.registration_endpoint,client_info:t.client_info}),t.store.set("client_info",t.client_info)}let s=t.scope||"openid",o=Object.assign({site:t.issuer,client:t.client,force_authorization:!0,authorize_callback:t.authorize_callback,oauth2_configuration:{client_id:t.client_info?.client_id,client_secret:t.client_info?.client_secret,grant_type:"authorization_code",response_type:"code",response_mode:"query",authorization_endpoint:t.openid_configuration.authorization_endpoint,token_endpoint:t.openid_configuration.token_endpoint,scope:s,redirect_uri:t.client_info.redirect_uris[0]}}),a=async(u,f)=>{let c=await f(u);if(c.headers.get("content-type")?.startsWith("application/json")){let h=c.data?.id_token;if(!h){let y=c.clone();try{let _=await y.json();_&&_.id_token&&(h=_.id_token)}catch{}}h&&t.store.set("id_token",h)}return c},l=t.client.with(t.issuer).with(a);if(t.use_dpop){let u={site:t.issuer,authorization_endpoint:t.openid_configuration.authorization_endpoint,token_endpoint:t.openid_configuration.token_endpoint,dpop_signing_alg_values_supported:t.openid_configuration.dpop_signing_alg_values_supported};l=l.with(qn(u)),o.client=l}return l=l.with(Mn(o)),i=await l.fetch(r),i}}function Qs(){return qs()}function Ks(t){if(!t.store){if(!t.issuer)throw W("Must supply options.issuer or options.store to get the id_token");t.store=qr(t.issuer)}return t.store.get("id_token")}var Vs={oidcmw:Wn,discover:or,register:ar,isRedirected:Qs,idToken:Ks};globalThis.metro.oidc||(globalThis.metro.oidc=Vs);var Js=Vs;function Hn(t){return new Gn(t)}var Qn="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Bf={rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",solid:"http://www.w3.org/ns/solid/terms#",schema:"http://schema.org/",vcard:"http://www.w3.org/2006/vcard/ns#"},Gn=class{constructor(e){this.prefixes={...Bf,...e?.prefixes},this.prefixes.xsd||(this.prefixes.xsd="http://www.w3.org/2001/XMLSchema#"),this.parser=e?.parser,this.writer=e?.writer,this.sources=Object.create(null),this.separator=e?.separator??"$"}parse(e,r,n){let{quads:i,prefixes:s}=this.parser(e,r,n);if(s)for(let o in s){let a=s[o];if(a.match(/^http(s?):\/\/$/i))a+=r.substring(a.length);else try{a=new URL(s[o],r).href}catch(l){console.error("Could not parse prefix",s[o],l.message)}this.prefixes[o]||(this.prefixes[o]=a)}return this.sources[r]=new zn(i,r,n,s,this),this.sources[r]}setType(e,r){if(!r)return e;if(typeof e=="string"?e=new String(e):typeof result=="number"&&(e=new Number(e)),typeof e!="object")throw new Error("cannot set type on ",e,r);return e.type=r,e}getType(e){return e&&typeof e=="object"?e.type:null}},zn=class{#e=Object.create(null);constructor(e,r,n,i,s){this.mimetype=n,this.url=r,this.prefixes=i,this.context=s,this.subjects=Object.create(null);for(let o of e){let a;if(o.subject.termType=="BlankNode"){let l=this.shortURI(o.predicate.id,":"),u;switch(l){case"rdf:first":if(a=this.addCollection(o.subject.id),u=this.shortURI(o.object.id,":"),u!="rdf:nil"){let f=this.getValue(o.object);f&&a.push(f)}continue;case"rdf:rest":this.#e[o.object.id]=this.#e[o.subject.id];continue;default:a=this.addBlankNode(o.subject.id);break}}else a=this.addNamedNode(o.subject.id);a.addPredicate(o.predicate.id,o.object)}this.subjects[r]?this.primary=this.subjects[r]:this.primary=null,Object.defineProperty(this,"data",{get(){return Object.values(this.subjects)}})}addNamedNode(e){let r=new URL(e,this.url).href;return this.subjects[r]||(this.subjects[r]=new vt(r,this)),this.subjects[r]}addBlankNode(e){return this.#e[e]||(this.#e[e]=new tt(this)),this.#e[e]}addCollection(e){return this.#e[e]||(this.#e[e]=new Nt(this)),this.#e[e]}write(){return this.context.writer(this)}get(e){return this.subjects[this.fullURI(e)]}fullURI(e,r=null){r||(r=this.context.separator);let[n,i]=e.split(r);return i?this.prefixes[n]+i:e}shortURI(e,r=null){r||(r=this.context.separator);for(let n in this.context.prefixes)if(e.startsWith(this.context.prefixes[n]))return n+r+e.substring(this.context.prefixes[n].length);return this.url&&e.startsWith(this.url)?e.substring(this.url.length):e}setType(e,r){let n=this.shortURI(r);return this.context.setType(e,n)}getType(e){return this.context.getType(e)}setLanguage(e,r){if(typeof e=="string"?e=new String(e):typeof result=="number"&&(e=new Number(e)),typeof e!="object")throw new Error("cannot set language on ",e);return e.language=r,e}getValue(e){let r;if(e.termType=="Literal"){r=e.value;let n=e.datatype?.id;n&&(r=this.setType(r,n));let i=e.language;i&&(r=this.setLanguage(r,i))}else e.termType=="BlankNode"?r=this.addBlankNode(e.id):r=this.addNamedNode(e.id);return r}},tt=class{constructor(e){Object.defineProperty(this,"graph",{value:e,writable:!1,enumerable:!1})}addPredicate(e,r){if(e.id&&(e=e.id),e==Qn){let n=this.graph.shortURI(r.id);this.addType(n)}else{let n=this.graph.getValue(r);e=this.graph.shortURI(e),this[e]?Array.isArray(this[e])?this[e].push(n):this[e]=[this[e],n]:this[e]=n}}addType(e){this.a?(Array.isArray(this.a)||(this.a=[this.a]),this.a.push(e)):this.a=e}},vt=class extends tt{constructor(e,r){super(r),Object.defineProperty(this,"id",{value:e,writable:!1,enumerable:!0})}},Nt=class extends Array{constructor(e,r){super(),Object.defineProperty(this,"graph",{value:r,writable:!1,enumerable:!1})}};var As={};Cn(As,{n3Parser:()=>ob,n3Writer:()=>ab});var mo=Cr(pe());var ur="http://www.w3.org/1999/02/22-rdf-syntax-ns#",fr="http://www.w3.org/2001/XMLSchema#",Hr="http://www.w3.org/2000/10/swap/",B={xsd:{decimal:`${fr}decimal`,boolean:`${fr}boolean`,double:`${fr}double`,integer:`${fr}integer`,string:`${fr}string`},rdf:{type:`${ur}type`,nil:`${ur}nil`,first:`${ur}first`,rest:`${ur}rest`,langString:`${ur}langString`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${Hr}reify#forSome`,forAll:`${Hr}reify#forAll`},log:{implies:`${Hr}log#implies`,isImpliedBy:`${Hr}log#isImpliedBy`}};var{xsd:Qr}=B,pc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,go={"\\":"\\","'":"'",'"':'"',n:`
3
3
  `,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},_c=/[\x00-\x20<>\\"\{\}\|\^\`]/,yc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},bc=/$0^/,it=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-:A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])(?:(?:[\.\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~])*(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff]|%[0-9a-fA-F]{2}|\\[!#-\/;=?\-@_~]))?)?)(?:[ \t]+|(?=\.?[,;!\^\s#()\[\]\{\}"'<>]))/,this._variable=/^\?(?:(?:[A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:[\-0-:A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?=[.,;!\^\s#()\[\]\{\}"'<>])/,this._blank=/^_:((?:[0-9A-Z_a-z\xc0-\xd6\xd8-\xf6\xf8-\u02ff\u0370-\u037d\u037f-\u1fff\u200c\u200d\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])(?:\.?[\-0-9A-Z_a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c\u200d\u203f\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]|[\ud800-\udb7f][\udc00-\udfff])*)(?:[ \t]+|(?=\.?[,;:\s#()\[\]\{\}"'<>]))/,this._number=/^[\-+]?(?:(\d+\.\d*|\.?\d+)[eE][\-+]?|\d*(\.)?)\d+(?=\.?[,;:\s#()\[\]\{\}"'<>])/,this._boolean=/^(?:true|false)(?=[.,;\s#()\[\]\{\}"'<>])/,this._keyword=/^@[a-z]+(?=[\s#<:])/i,this._sparqlKeyword=/^(?:PREFIX|BASE|GRAPH)(?=[\s#<])/i,this._shortPredicates=/^a(?=[\s#()\[\]\{\}"'<>])/,this._newline=/^[ \t]*(?:#[^\n\r]*)?(?:\r\n|\n|\r)[ \t]*/,this._comment=/#([^\n\r]*)/,this._whitespace=/^[ \t]+/,this._endOfFile=/^(?:#[^\n\r]*)?$/,e=e||{},this._isImpliedBy=e.isImpliedBy,this._lineMode=!!e.lineMode){this._n3Mode=!1;for(let r in this)!(r in yc)&&this[r]instanceof RegExp&&(this[r]=bc)}else this._n3Mode=e.n3!==!1;this.comments=!!e.comments,this._literalClosingPos=0}_tokenizeToEnd(e,r){let n=this._input,i=n.length;for(;;){let a,l;for(;a=this._newline.exec(n);)this.comments&&(l=this._comment.exec(a[0]))&&s("comment",l[1],"",this._line,a[0].length),n=n.substr(a[0].length,n.length),i=n.length,this._line++;if(!a&&(a=this._whitespace.exec(n))&&(n=n.substr(a[0].length,n.length)),this._endOfFile.test(n))return r&&(this.comments&&(l=this._comment.exec(n))&&s("comment",l[1],"",this._line,n.length),n=null,s("eof","","",this._line,0)),this._input=n;let u=this._line,f=n[0],c="",d="",h="",y=null,_=0,x=!1;switch(f){case"^":if(n.length<3)break;if(n[1]==="^"){if(this._previousMarker="^^",n=n.substr(2),n[0]!=="<"){x=!0;break}}else{this._n3Mode&&(_=1,c="^");break}case"<":if(y=this._unescapedIri.exec(n))c="IRI",d=y[1];else if(y=this._iri.exec(n)){if(d=this._unescape(y[1]),d===null||_c.test(d))return o(this);c="IRI"}else n.length>1&&n[1]==="<"?(c="<<",_=2):this._n3Mode&&n.length>1&&n[1]==="="&&(_=2,this._isImpliedBy?(c="abbreviation",d="<"):(c="inverse",d=">"));break;case">":n.length>1&&n[1]===">"&&(c=">>",_=2);break;case"_":((y=this._blank.exec(n))||r&&(y=this._blank.exec(`${n} `)))&&(c="blank",h="_",d=y[1]);break;case'"':if(y=this._simpleQuotedString.exec(n))d=y[1];else if({value:d,matchLength:_}=this._parseLiteral(n),d===null)return o(this);(y!==null||_!==0)&&(c="literal",this._literalClosingPos=0);break;case"'":if(!this._lineMode){if(y=this._simpleApostropheString.exec(n))d=y[1];else if({value:d,matchLength:_}=this._parseLiteral(n),d===null)return o(this);(y!==null||_!==0)&&(c="literal",this._literalClosingPos=0)}break;case"?":this._n3Mode&&(y=this._variable.exec(n))&&(c="var",d=y[0]);break;case"@":this._previousMarker==="literal"&&(y=this._langcode.exec(n))?(c="langcode",d=y[1]):(y=this._keyword.exec(n))&&(c=y[0]);break;case".":if(n.length===1?r:n[1]<"0"||n[1]>"9"){c=".",_=1;break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"+":case"-":(y=this._number.exec(n)||r&&(y=this._number.exec(`${n} `)))&&(c="literal",d=y[0],h=typeof y[1]=="string"?Qr.double:typeof y[2]=="string"?Qr.decimal:Qr.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":(y=this._sparqlKeyword.exec(n))?c=y[0].toUpperCase():x=!0;break;case"f":case"t":(y=this._boolean.exec(n))?(c="literal",d=y[0],h=Qr.boolean):x=!0;break;case"a":(y=this._shortPredicates.exec(n))?(c="abbreviation",d="a"):x=!0;break;case"=":this._n3Mode&&n.length>1&&(c="abbreviation",n[1]!==">"?(_=1,d="="):(_=2,d=">"));break;case"!":if(!this._n3Mode)break;case",":case";":case"[":case"]":case"(":case")":case"}":this._lineMode||(_=1,c=f);break;case"{":!this._lineMode&&n.length>=2&&(n[1]==="|"?(c="{|",_=2):(c=f,_=1));break;case"|":n.length>=2&&n[1]==="}"&&(c="|}",_=2);break;default:x=!0}if(x&&((this._previousMarker==="@prefix"||this._previousMarker==="PREFIX")&&(y=this._prefix.exec(n))?(c="prefix",d=y[1]||""):((y=this._prefixed.exec(n))||r&&(y=this._prefixed.exec(`${n} `)))&&(c="prefixed",h=y[1]||"",d=this._unescape(y[2]))),this._previousMarker==="^^")switch(c){case"prefixed":c="type";break;case"IRI":c="typeIRI";break;default:c=""}if(!c)return r||!/^'''|^"""/.test(n)&&/\n|\r/.test(n)?o(this):this._input=n;let b=_||y[0].length,g=s(c,d,h,u,b);this.previousToken=g,this._previousMarker=c,n=n.substr(b,n.length)}function s(a,l,u,f,c){let d=n?i-n.length:i,h=d+c,y={type:a,value:l,prefix:u,line:f,start:d,end:h};return e(null,y),y}function o(a){e(a._syntaxError(/^\S*/.exec(n)[0]))}}_unescape(e){let r=!1,n=e.replace(pc,(i,s,o,a)=>{if(typeof s=="string")return String.fromCharCode(Number.parseInt(s,16));if(typeof o=="string"){let l=Number.parseInt(o,16);return l<=65535?String.fromCharCode(Number.parseInt(o,16)):String.fromCharCode(55296+((l-=65536)>>10),56320+(l&1023))}return a in go?go[a]:(r=!0,"")});return r?null:n}_parseLiteral(e){if(e.length>=3){let r=e.match(/^(?:"""|"|'''|'|)/)[0],n=r.length,i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(r,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){let o=e.substring(n,i),a=o.split(/\r\n|\r|\n/).length-1,l=i+n;if(n===1&&a!==0||n===3&&this._lineMode)break;return this._line+=a,{value:this._unescape(o),matchLength:l}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength: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")?e.substr(1):e}tokenize(e,r){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>this._tokenizeToEnd(r,!0));else{let n=[],i;if(this._tokenizeToEnd((s,o)=>s?i=s:n.push(o),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=mo.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input>"u"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",r)}};var{rdf:gc,xsd:st}=B,Bt,mc=0;var ii={namedNode:wo,blankNode:xo,variable:Eo,literal:So,defaultGraph:wc,quad:si,triple:si,fromTerm:cr,fromQuad:Ro},X=ii,Z=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}}},Ot=class extends Z{get termType(){return"NamedNode"}},We=class t extends Z{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,r=e.lastIndexOf('"')+1;return r<e.length&&e[r++]==="@"?e.substr(r).toLowerCase():""}get datatype(){return new Ot(this.datatypeString)}get datatypeString(){let e=this.id,r=e.lastIndexOf('"')+1,n=r<e.length?e[r]:"";return n==="^"?e.substr(r+2):n!=="@"?st.string:gc.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.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,datatype:{termType:"NamedNode",value:this.datatypeString}}}},dr=class extends Z{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},hr=class extends Z{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},pr=class extends Z{constructor(){return super(""),Bt||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Bt=new pr;function qe(t,e,r){if(e=e||ii,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===ii)return new We(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let n=t.lastIndexOf('"',t.length-1);return e.literal(t.substr(1,n-1),t[n+1]==="@"?t.substr(n+2):e.namedNode(t.substr(n+3)));case"[":t=JSON.parse(t);break;default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(qe(t[0],e,!0),qe(t[1],e,!0),qe(t[2],e,!0),t[3]&&qe(t[3],e,!0))}function Ne(t,e){if(typeof t=="string")return t;if(t instanceof Z&&t.termType!=="Quad")return t.id;if(!t)return Bt.id;switch(t.termType){case"NamedNode":return t.value;case"BlankNode":return`_:${t.value}`;case"Variable":return`?${t.value}`;case"DefaultGraph":return"";case"Literal":return`"${t.value}"${t.language?`@${t.language}`:t.datatype&&t.datatype.value!==st.string?`^^${t.datatype.value}`:""}`;case"Quad":let r=[Ne(t.subject,!0),Ne(t.predicate,!0),Ne(t.object,!0)];return t.graph&&t.graph.termType!=="DefaultGraph"&&r.push(Ne(t.graph,!0)),e?r:JSON.stringify(r);default:throw new Error(`Unexpected termType: ${t.termType}`)}}var Ge=class extends Z{constructor(e,r,n,i){super(""),this._subject=e,this._predicate=r,this._object=n,this._graph=i||Bt}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 wo(t){return new Ot(t)}function xo(t){return new dr(t||`n3-${mc++}`)}function So(t,e){if(typeof e=="string")return new We(`"${t}"@${e.toLowerCase()}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=st.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?st.integer:st.double:(r=st.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===st.string?new We(`"${t}"`):new We(`"${t}"^^${r}`)}function Eo(t){return new hr(t)}function wc(){return Bt}function si(t,e,r,n){return new Ge(t,e,r,n)}function cr(t){if(t instanceof Z)return t;switch(t.termType){case"NamedNode":return wo(t.value);case"BlankNode":return xo(t.value);case"Variable":return Eo(t.value);case"DefaultGraph":return Bt;case"Literal":return So(t.value,t.language||t.datatype);case"Quad":return Ro(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Ro(t){if(t instanceof Ge)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return si(cr(t.subject),cr(t.predicate),cr(t.object),cr(t.graph))}var Io=0,ze=class{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Ao(this,e.factory);let r=typeof e.format=="string"?e.format.match(/\w*$/)[0].toLowerCase():"",n=/turtle/.test(r),i=/trig/.test(r),s=/triple/.test(r),o=/quad/.test(r),a=this._n3Mode=/n3/.test(r),l=s||o;(this._supportsNamedGraphs=!(n||a))||(this._readPredicateOrNamedGraph=this._readPredicate),this._supportsQuads=!(n||i||s||a),this._isImpliedBy=e.isImpliedBy,this._supportsRDFStar=r===""||/star|\*$/.test(r),l&&(this._resolveRelativeIRI=u=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new it({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers}static _resetBlankNodePrefix(){Io=0}_setBase(e){if(!e)this._base="",this._basePath="";else{let r=e.indexOf("#");r>=0&&(e=e.substr(0,r)),this._base=e,this._basePath=e.indexOf("/")<0?e:e.replace(/[^\/?]*(?:\?.*)?$/,""),e=e.match(/^(?:([a-z][a-z0-9+.-]*:))?(?:\/\/[^\/]*)?/i),this._baseRoot=e[0],this._baseScheme=e[1]}}_saveContext(e,r,n,i,s){let o=this._n3Mode;this._contextStack.push({type:e,subject:n,predicate:i,object:s,graph:r,inverse:o?this._inversePredicate:!1,blankPrefix:o?this._prefixes._:"",quantified:o?this._quantified:null}),o&&(this._inversePredicate=!1,this._prefixes._=this._graph?`${this._graph.value}.`:".",this._quantified=Object.create(this._quantified))}_restoreContext(e,r){let n=this._contextStack.pop();if(!n||n.type!==e)return this._error(`Unexpected ${r.type}`,r);this._subject=n.subject,this._predicate=n.predicate,this._object=n.object,this._graph=n.graph,this._n3Mode&&(this._inversePredicate=n.inverse,this._prefixes._=n.blankPrefix,this._quantified=n.quantified)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_readEntity(e,r){let n;switch(e.type){case"IRI":case"typeIRI":let i=this._resolveIRI(e.value);if(i===null)return this._error("Invalid IRI",e);n=this._factory.namedNode(i);break;case"type":case"prefixed":let s=this._prefixes[e.prefix];if(s===void 0)return this._error(`Undefined prefix "${e.prefix}:"`,e);n=this._factory.namedNode(s+e.value);break;case"blank":n=this._factory.blankNode(this._prefixes[e.prefix]+e.value);break;case"var":n=this._factory.variable(e.value.substr(1));break;default:return this._error(`Expected entity but got ${e.type}`,e)}return!r&&this._n3Mode&&n.id in this._quantified&&(n=this._quantified[n.id]),n}_readSubject(e){switch(this._predicate=null,e.type){case"[":return this._saveContext("blank",this._graph,this._subject=this._factory.blankNode(),null,null),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this.RDF_NIL,null,null),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._graph=this._factory.blankNode(),null,null),this._readSubject):this._error("Unexpected graph",e);case"}":return this._readPunctuation(e);case"@forSome":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORSOME,this._quantifier="blankNode",this._readQuantifierList):this._error('Unexpected "@forSome"',e);case"@forAll":return this._n3Mode?(this._subject=null,this._predicate=this.N3_FORALL,this._quantifier="variable",this._readQuantifierList):this._error('Unexpected "@forAll"',e);case"literal":if(!this._n3Mode)return this._error("Unexpected literal",e);if(e.prefix.length===0)return this._literalValue=e.value,this._completeSubjectLiteral;this._subject=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":case"]":case"}":return this._predicate===null?this._error(`Unexpected ${r}`,e):(this._subject=null,r==="]"?this._readBlankNodeTail(e):this._readPunctuation(e));case";":return this._predicate!==null?this._readPredicate:this._error("Expected predicate but got ;",e);case"[":if(this._n3Mode)return this._saveContext("blank",this._graph,this._subject,this._subject=this._factory.blankNode(),null),this._readBlankNodeHead;case"blank":if(!this._n3Mode)return this._error("Disallowed blank node as predicate",e);default:if((this._predicate=this._readEntity(e))===void 0)return}return this._readObject}_readObject(e){switch(e.type){case"literal":if(e.prefix.length===0)return this._literalValue=e.value,this._readDataTypeOrLang;this._object=this._factory.literal(e.value,this._factory.namedNode(e.prefix));break;case"[":return this._saveContext("blank",this._graph,this._subject,this._predicate,this._subject=this._factory.blankNode()),this._readBlankNodeHead;case"(":return this._saveContext("list",this._graph,this._subject,this._predicate,this.RDF_NIL),this._subject=null,this._readListItem;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);case"<<":return this._supportsRDFStar?(this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject):this._error("Unexpected RDF-star syntax",e);default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){return e.type==="]"?(this._subject=null,this._readBlankNodeTail(e)):(this._predicate=null,this._readPredicate(e))}_readBlankNodeTail(e){if(e.type!=="]")return this._readBlankNodePunctuation(e);this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph);let r=this._predicate===null;return this._restoreContext("blank",e),this._object!==null?this._getContextEndReader():this._predicate!==null?this._readObject:r?this._readPredicateOrNamedGraph:this._readPredicateAfterBlank}_readPredicateAfterBlank(e){switch(e.type){case".":case"}":return this._subject=null,this._readPunctuation(e);default:return this._readPredicate(e)}}_readListItem(e){let r=null,n=null,i=this._readListItem,s=this._subject,o=this._contextStack,a=o[o.length-1];switch(e.type){case"[":this._saveContext("blank",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this._subject=r=this._factory.blankNode()),i=this._readBlankNodeHead;break;case"(":this._saveContext("list",this._graph,n=this._factory.blankNode(),this.RDF_FIRST,this.RDF_NIL),this._subject=null;break;case")":if(this._restoreContext("list",e),o.length!==0&&o[o.length-1].type==="list"&&this._emit(this._subject,this._predicate,this._object,this._graph),this._predicate===null){if(i=this._readPredicate,this._subject===this.RDF_NIL)return i}else if(i=this._getContextEndReader(),this._object===this.RDF_NIL)return i;n=this.RDF_NIL;break;case"literal":e.prefix.length===0?(this._literalValue=e.value,i=this._readListItemDataTypeOrLang):(r=this._factory.literal(e.value,this._factory.namedNode(e.prefix)),i=this._getContextEndReader());break;case"{":return this._n3Mode?(this._saveContext("formula",this._graph,this._subject,this._predicate,this._graph=this._factory.blankNode()),this._readSubject):this._error("Unexpected graph",e);default:if((r=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),s===null?a.predicate===null?a.subject=n:a.object=n:this._emit(s,this.RDF_REST,n,this._graph),r!==null){if(this._n3Mode&&(e.type==="IRI"||e.type==="prefixed"))return this._saveContext("item",this._graph,n,this.RDF_FIRST,r),this._subject=r,this._predicate=null,this._getPathReader(this._readListItem);this._emit(n,this.RDF_FIRST,r,this._graph)}return i}_readDataTypeOrLang(e){return this._completeObjectLiteral(e,!1)}_readListItemDataTypeOrLang(e){return this._completeObjectLiteral(e,!0)}_completeLiteral(e){let r=this._factory.literal(this._literalValue);switch(e.type){case"type":case"typeIRI":let n=this._readEntity(e);if(n===void 0)return;r=this._factory.literal(this._literalValue,n),e=null;break;case"langcode":r=this._factory.literal(this._literalValue,e.value),e=null;break}return{token:e,literal:r}}_completeSubjectLiteral(e){return this._subject=this._completeLiteral(e).literal,this._readPredicateOrNamedGraph}_completeObjectLiteral(e,r){let n=this._completeLiteral(e);if(n)return this._object=n.literal,r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),n.token===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(n.token))}_readFormulaTail(e){return e.type!=="}"?this._readPunctuation(e):(this._subject!==null&&this._emit(this._subject,this._predicate,this._object,this._graph),this._restoreContext("formula",e),this._object===null?this._readPredicate:this._getContextEndReader())}_readPunctuation(e){let r,n=this._graph,i=this._subject,s=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,r=this._contextStack.length?this._readSubject:this._readInTopContext,s&&(this._inversePredicate=!1);break;case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"{|":if(!this._supportsRDFStar)return this._error("Unexpected RDF-star syntax",e);let o=this._predicate,a=this._object;this._subject=this._factory.quad(i,o,a,this.DEFAULTGRAPH),r=this._readPredicate;break;case"|}":if(this._subject.termType!=="Quad")return this._error("Unexpected asserted triple closing",e);this._subject=null,r=this._readPunctuation;break;default:if(this._supportsQuads&&this._graph===null&&(n=this._readEntity(e))!==void 0){r=this._readQuadPunctuation;break}return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}if(i!==null){let o=this._predicate,a=this._object;s?this._emit(a,o,i,n):this._emit(i,o,a,n)}return r}_readBlankNodePunctuation(e){let r;switch(e.type){case";":r=this._readPredicate;break;case",":r=this._readObject;break;default:return this._error(`Expected punctuation to follow "${this._object.id}"`,e)}return this._emit(this._subject,this._predicate,this._object,this._graph),r}_readQuadPunctuation(e){return e.type!=="."?this._error("Expected dot to follow quad",e):this._readInTopContext}_readPrefix(e){return e.type!=="prefix"?this._error("Expected prefix to follow @prefix",e):(this._prefix=e.value,this._readPrefixIRI)}_readPrefixIRI(e){if(e.type!=="IRI")return this._error(`Expected IRI to follow prefix "${this._prefix}:"`,e);let r=this._readEntity(e);return 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)}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._readInTopContext(e)):e.type!=="."?this._error("Expected declaration to end with a dot",e):this._readInTopContext}_readQuantifierList(e){let r;switch(e.type){case"IRI":case"prefixed":if((r=this._readEntity(e,!0))!==void 0)break;default:return this._error(`Unexpected ${e.type}`,e)}return this._explicitQuantifiers?(this._subject===null?this._emit(this._graph||this.DEFAULTGRAPH,this._predicate,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH):this._emit(this._subject,this.RDF_REST,this._subject=this._factory.blankNode(),this.QUANTIFIERS_GRAPH),this._emit(this._subject,this.RDF_FIRST,r,this.QUANTIFIERS_GRAPH)):this._quantified[r.id]=this._factory[this._quantifier](this._factory.blankNode().value),this._readQuantifierPunctuation}_readQuantifierPunctuation(e){return e.type===","?this._readQuantifierList:(this._explicitQuantifiers&&(this._emit(this._subject,this.RDF_REST,this.RDF_NIL,this.QUANTIFIERS_GRAPH),this._subject=null),this._readCallback=this._getContextEndReader(),this._readCallback(e))}_getPathReader(e){return this._afterPath=e,this._readPath}_readPath(e){switch(e.type){case"!":return this._readForwardPath;case"^":return this._readBackwardPath;default:let r=this._contextStack,n=r.length&&r[r.length-1];if(n&&n.type==="item"){let i=this._subject;this._restoreContext("item",e),this._emit(this._subject,this.RDF_FIRST,i,this._graph)}return this._afterPath(e)}}_readForwardPath(e){let r,n,i=this._factory.blankNode();if((n=this._readEntity(e))!==void 0)return this._predicate===null?(r=this._subject,this._subject=i):(r=this._object,this._object=i),this._emit(r,n,i,this._graph),this._readPath}_readBackwardPath(e){let r=this._factory.blankNode(),n,i;if((n=this._readEntity(e))!==void 0)return this._predicate===null?(i=this._subject,this._subject=r):(i=this._object,this._object=r),this._emit(r,n,i,this._graph),this._readPath}_readRDFStarTailOrGraph(e){return e.type!==">>"?this._supportsQuads&&this._graph===null&&(this._graph=this._readEntity(e))!==void 0?this._readRDFStarTail:this._error(`Expected >> to follow "${this._object.id}"`,e):this._readRDFStarTail(e)}_readRDFStarTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);let r=this._factory.quad(this._subject,this._predicate,this._object,this._graph||this.DEFAULTGRAPH);return this._restoreContext("<<",e),this._subject===null?(this._subject=r,this._readPredicate):(this._object=r,this._getContextEndReader())}_getContextEndReader(){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._readRDFStarTailOrGraph}}_emit(e,r,n,i){this._callback(null,this._factory.quad(e,r,n,i||this.DEFAULTGRAPH))}_error(e,r){let n=new Error(`${e} on line ${r.line}.`);n.context={token:r,line:r.line,previousToken:this._lexer.previousToken},this._callback(n),this._callback=Kr}_resolveIRI(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)?e:this._resolveRelativeIRI(e)}_resolveRelativeIRI(e){if(!e.length)return this._base;switch(e[0]){case"#":return this._base+e;case"?":return this._base.replace(/(?:\?.*)?$/,e);case"/":return(e[1]==="/"?this._baseScheme:this._baseRoot)+this._removeDotSegments(e);default:return/^[^/:]*:/.test(e)?null:this._removeDotSegments(this._basePath+e)}}_removeDotSegments(e){if(!/(^|\/)\.\.?($|[/#?])/.test(e))return e;let r=e.length,n="",i=-1,s=-1,o=0,a="/";for(;i<r;){switch(a){case":":if(s<0&&e[++i]==="/"&&e[++i]==="/")for(;(s=i+1)<r&&e[s]!=="/";)i=s;break;case"?":case"#":i=r;break;case"/":if(e[i+1]===".")switch(a=e[++i+1],a){case"/":n+=e.substring(o,i-1),o=i+1;break;case void 0:case"?":case"#":return n+e.substring(o,i)+e.substr(i+1);case".":if(a=e[++i+1],a===void 0||a==="/"||a==="?"||a==="#"){if(n+=e.substring(o,i-2),(o=n.lastIndexOf("/"))>=s&&(n=n.substr(0,o)),a!=="/")return`${n}/${e.substr(i+1)}`;o=i+1}}}a=e[++i]}return n+e.substring(o)}parse(e,r,n){let i,s,o;if(r&&(r.onQuad||r.onPrefix||r.onComment)?(i=r.onQuad,s=r.onPrefix,o=r.onComment):(i=r,s=n),this._readCallback=this._readInTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${Io++}_`,this._prefixCallback=s||Kr,this._inversePredicate=!1,this._quantified=Object.create(null),!i){let l=[],u;if(this._callback=(f,c)=>{f?u=f:c&&l.push(c)},this._lexer.tokenize(e).every(f=>this._readCallback=this._readCallback(f)),u)throw u;return l}let a=(l,u)=>{l!==null?(this._callback(l),this._callback=Kr):this._readCallback&&(this._readCallback=this._readCallback(u))};o&&(this._lexer.comments=!0,a=(l,u)=>{l!==null?(this._callback(l),this._callback=Kr):this._readCallback&&(u.type==="comment"?o(u.value):this._readCallback=this._readCallback(u))}),this._callback=i,this._lexer.tokenize(e,a)}};function Kr(){}function Ao(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(B.rdf.first),t.RDF_REST=e.namedNode(B.rdf.rest),t.RDF_NIL=e.namedNode(B.rdf.nil),t.N3_FORALL=e.namedNode(B.r.forAll),t.N3_FORSOME=e.namedNode(B.r.forSome),t.ABBREVIATIONS={a:e.namedNode(B.rdf.type),"=":e.namedNode(B.owl.sameAs),">":e.namedNode(B.log.implies),"<":e.namedNode(B.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Ao(ze.prototype,X);var oi={};Cn(oi,{inDefaultGraph:()=>Ac,isBlankNode:()=>Sc,isDefaultGraph:()=>ot,isLiteral:()=>Ec,isNamedNode:()=>xc,isQuad:()=>Ic,isVariable:()=>Rc,prefix:()=>Tc,prefixes:()=>To});function xc(t){return!!t&&t.termType==="NamedNode"}function Sc(t){return!!t&&t.termType==="BlankNode"}function Ec(t){return!!t&&t.termType==="Literal"}function Rc(t){return!!t&&t.termType==="Variable"}function Ic(t){return!!t&&t.termType==="Quad"}function ot(t){return!!t&&t.termType==="DefaultGraph"}function Ac(t){return ot(t.graph)}function Tc(t,e){return To({"":t.value||t},e)("")}function To(t,e){let r=Object.create(null);for(let i in t)n(i,t[i]);e=e||X;function n(i,s){if(typeof s=="string"){let o=Object.create(null);r[i]=a=>o[a]||(o[a]=e.namedNode(s+a))}else if(!(i in r))throw new Error(`Unknown prefix: ${i}`);return r[i]}return n}function Ft(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var vc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Nc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,vo="./",jc="../",ai="?",No="#",at=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!vc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",Ft(e)],n=[],i=[],s=/[^/?#]*([/?#])/y,o,a=0,l=0,u=s.lastIndex=e.length;for(;!a&&!l&&(o=s.exec(this.base));)o[1]===No?l=s.lastIndex-1:(r.push(Ft(o[0]),"(?:"),n.push(")?"),o[1]!==ai?i.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(No,a),this._pathReplacements[a]=ai));for(let f=0;f<i.length;f++)this._pathReplacements[i[f]]=jc.repeat(i.length-f-1);return this._pathReplacements[i[i.length-1]]=vo,this._baseLength=l>0?l:this.base.length,r.push(Ft(this.base.substring(u,this._baseLength)),a?"(?:#|$)":"(?:[?#]|$)"),this._baseMatcher=new RegExp([...r,...n].join(""))}toRelative(e){let r=this._getBaseMatcher().exec(e);if(!r)return e;let n=r[0].length;if(n===this._baseLength&&n===e.length)return"";let i=this._pathReplacements[n];if(i){let s=e.substring(n);return i!==ai&&!Nc.test(s)?e:i===vo&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}};var _r=X.defaultGraph(),{rdf:kc,xsd:Ct}=B,jo=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,ko=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Pc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},lt=class extends Z{equals(e){return e===this}},_e=class{constructor(e,r){if(this._prefixRegex=/$0^/,e&&typeof e.write!="function"&&(r=e,e=null),r=r||{},this._lists=r.lists,e)this._outputStream=e,this._endStream=r.end===void 0?!0:!!r.end;else{let n="";this._outputStream={write(i,s,o){n+=i,o&&o()},end:i=>{i&&i(null,n)}},this._endStream=!0}this._subject=null,/triple|quad/i.test(r.format)?(this._lineMode=!0,this._writeQuad=this._writeQuadLine):(this._lineMode=!1,this._graph=_r,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new at(r.baseIRI)))}get _inDefaultGraph(){return _r.equals(this._graph)}_write(e,r){this._outputStream.write(e,"utf8",r)}_writeQuad(e,r,n,i,s){try{i.equals(this._graph)||(this._write((this._subject===null?"":this._inDefaultGraph?`.
4
4
  `:`
5
5
  }
@@ -19,7 +19,7 @@
19
19
  ]`)}}list(e){let r=e&&e.length||0,n=new Array(r);for(let i=0;i<r;i++)n[i]=this._encodeObject(e[i]);return new lt(`(${n.join(" ")})`)}end(e){this._subject!==null&&(this._write(this._inDefaultGraph?`.
20
20
  `:`
21
21
  }
22
- `),this._subject=null),this._write=this._blockedWrite;let r=e&&((n,i)=>{r=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(r)}catch{}r&&r()}};function Po(t){let e=Pc[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 Rs=Cr(jn());var Es=Symbol("iter");function Nr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Nr(t[n]||Object.create(null),e[n],r-1);return t}function qu(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:qu(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}function Wu(t,e,r=4){let n=!1;for(let i in t)if(!(i in e))n=n||Object.create(null),n[i]=r===0?null:Nr({},t[i],r-1);else if(r!==0){let s=Wu(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}var jr=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,n=e.split(".");return this._factory.quad(this._termFromId(r[n[1]]),this._termFromId(r[n[2]]),this._termFromId(r[n[3]]),n[4]&&this._termFromId(r[n[4]]))}return qe(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object),s;return r&&n&&i&&(ot(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${n}.${i}.${s}`:`.${r}.${n}.${i}`]}return this._ids[Ne(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ot(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ne(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,n;if(e)for(r=e=`_:${e}`,n=1;this._ids[r];)r=e+n++;else do r=`_:b${this._blankNodeIndex++}`;while(this._ids[r]);return this._ids[r]=++this._id,this._entities[this._id]=r,this._factory.blankNode(r.substr(2))}},Ye=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||X,this._entityIndex=r.entityIndex||new jr({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,n,i;for(let s in r)for(let o in n=r[s].subjects)for(let a in i=n[o])e+=Object.keys(i[a]).length;return this._size=e}_addToIndex(e,r,n,i){let s=e[r]||(e[r]={}),o=s[n]||(s[n]={}),a=i in o;return a||(o[i]=null),!a}_removeFromIndex(e,r,n,i){let s=e[r],o=s[n];delete o[i];for(let a in o)return;delete s[n];for(let a in s)return;delete e[r]}*_findInIndex(e,r,n,i,s,o,a,l){let u,f,c,d=this._entities,h=this._termFromId(d[l]),y={subject:null,predicate:null,object:null};r&&((u=e,e={})[r]=u[r]);for(let _ in e)if(f=e[_]){y[s]=this._termFromId(d[_]),n&&((u=f,f={})[n]=u[n]);for(let x in f)if(c=f[x]){y[o]=this._termFromId(d[x]);let b=i?i in c?[i]:[]:Object.keys(c);for(let g=0;g<b.length;g++)y[a]=this._termFromId(d[b[g]]),yield this._factory.quad(y.subject,y.predicate,y.object,h)}}}_loop(e,r){for(let n in e)r(n)}_loopByKey0(e,r,n){let i,s;if(i=e[r])for(s in i)n(s)}_loopByKey1(e,r,n){let i,s;for(i in e)s=e[i],s[r]&&n(i)}_loopBy2Keys(e,r,n,i){let s,o,a;if((s=e[r])&&(o=s[n]))for(a in o)i(a)}_countInIndex(e,r,n,i){let s=0,o,a,l;r&&((o=e,e={})[r]=o[r]);for(let u in e)if(a=e[u]){n&&((o=a,a={})[n]=o[n]);for(let f in a)(l=a[f])&&(i?i in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){let r=Object.create(null);return n=>{n in r||(r[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,n,i){r||(i=e.graph,n=e.object,r=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,r,n)?(this._addToIndex(s.predicates,r,n,e),this._addToIndex(s.objects,n,e,r),this._size=null,!0):!1}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}delete(e){return this.removeQuad(e),this}has(e,r,n,i){return e&&e.subject&&({subject:e,predicate:r,object:n,graph:i}=e),!this.readQuads(e,r,n,i).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,n,i){r||({subject:e,predicate:r,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;let s=this._graphs,o,a,l;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(n=n&&this._termToNumericId(n))||!(o=s[i])||!(a=o.subjects[e])||!(l=a[r])||!(n in l))return!1;this._removeFromIndex(o.subjects,e,r,n),this._removeFromIndex(o.predicates,r,n,e),this._removeFromIndex(o.objects,n,e,r),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[i],!0}removeQuads(e){for(let r=0;r<e.length;r++)this.removeQuad(e[r])}remove(e){return e.on("data",r=>{this.removeQuad(r)}),e}removeMatches(e,r,n,i){let s=new Rs.Readable({objectMode:!0}),o=this.readQuads(e,r,n,i);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,n,i){return[...this.readQuads(e,r,n,i)]}*readQuads(e,r,n,i){let s=this._getGraphs(i),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||n&&!(u=this._termToNumericId(n))))for(let f in s)(o=s[f])&&(a?u?yield*this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f):l?yield*this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f):u?yield*this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f))}match(e,r,n,i){return new Je(this,e,r,n,i,{entityIndex:this._entityIndex})}countQuads(e,r,n,i){let s=this._getGraphs(i),o=0,a,l,u,f;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||n&&!(f=this._termToNumericId(n)))return 0;for(let c in s)(a=s[c])&&(e?n?o+=this._countInIndex(a.objects,f,l,u):o+=this._countInIndex(a.subjects,l,u,f):r?o+=this._countInIndex(a.predicates,u,f,l):o+=this._countInIndex(a.objects,f,l,u));return o}forEach(e,r,n,i,s){this.some(o=>(e(o,this),!1),r,n,i,s)}every(e,r,n,i,s){return!this.some(o=>!e(o,this),r,n,i,s)}some(e,r,n,i,s){for(let o of this.readQuads(r,n,i,s))if(e(o,this))return!0;return!1}getSubjects(e,r,n){let i=[];return this.forSubjects(s=>{i.push(s)},e,r,n),i}forSubjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(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,n){let i=[];return this.forPredicates(s=>{i.push(s)},e,r,n),i}forPredicates(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(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,n){let i=[];return this.forObjects(s=>{i.push(s)},e,r,n),i}forObjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey1(o.objects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,n){let i=[];return this.forGraphs(s=>{i.push(s)},e,r,n),i}forGraphs(e,r,n,i){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){let n={},i=r?(()=>!0):((a,l)=>{throw new Error(`${a.value} ${l}`)}),s=this.getQuads(null,B.rdf.rest,B.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{let l=[],u=!1,f,c,d=a.graph,h=a.subject;for(;h&&!u;){let y=this.getQuads(null,null,h,null),_=this.getQuads(h,null,null,null),x,b=null,g=null,S=null;for(let m=0;m<_.length&&!u;m++)x=_[m],x.graph.equals(d)?f?u=i(h,"has non-list arcs out"):x.predicate.value===B.rdf.first?b?u=i(h,"has multiple rdf:first arcs"):o.push(b=x):x.predicate.value===B.rdf.rest?g?u=i(h,"has multiple rdf:rest arcs"):o.push(g=x):y.length?u=i(h,"can't be subject and object"):(f=x,c="subject"):u=i(h,"not confined to single graph");for(let m=0;m<y.length&&!u;++m)x=y[m],f?u=i(h,"can't have coreferences"):x.predicate.value===B.rdf.rest?S?u=i(h,"has incoming rdf:rest arcs"):S=x:(f=x,c="object");b?l.unshift(b.object):u=i(h,"has no list head"),h=S&&S.subject}u?e=!1:f&&(n[f[c].value]=l)}),e&&this.removeQuads(o),n}addAll(e){if(e instanceof Je&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Nr(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof Je&&(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,n=e._graphs,i,s,o,a,l;for(let u in n){if(!(i=r[u]))return!1;i=i.subjects;for(let f in s=n[u].subjects){if(!(o=i[f]))return!1;for(let c in a=s[f]){if(!(l=o[c]))return!1;for(let d in a[c])if(!(d in l))return!1}}}return!0}deleteMatches(e,r,n,i){for(let s of this.match(e,r,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof Je&&(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}),n=Wu(this._graphs,e._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof Je&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)e(n,this)&&r.add(n);return r}intersection(e){if(e instanceof Je&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Nr(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}),n=qu(e._graphs,this._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)r.add(e(n,this));return r}reduce(e,r){let n=this.readQuads(),i=r===void 0?n.next().value:r;for(let s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new _e().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Nr(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}};function Re(t,e,r=0){let n=e[r];if(n&&!(n in t))return!1;let i=!1;for(let s in n?{[n]:t[n]}:t){let o=r===2?null:Re(t[s],e,r+1);o!==!1&&(i=i||Object.create(null),i[s]=o)}return i}var Je=class t extends Rs.Readable{constructor(e,r,n,i,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:n,object:i,graph:s,options:o})}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:n,predicate:i,subject:s}=this,o=this._filtered=new Ye({factory:e._factory,entityIndex:this.options.entityIndex}),a,l,u;if(s&&!(a=o._termToNumericId(s))||i&&!(l=o._termToNumericId(i))||n&&!(u=o._termToNumericId(n)))return o;let f=e._getGraphs(r);for(let c in f){let d,h,y,_;(_=f[c])&&(!a&&l?(h=Re(_.predicates,[l,u,a]))&&(d=Re(_.subjects,[a,l,u]),y=Re(_.objects,[u,a,l])):u?(y=Re(_.objects,[u,a,l]))&&(d=Re(_.subjects,[a,l,u]),h=Re(_.predicates,[l,u,a])):(d=Re(_.subjects,[a,l,u]))&&(h=Re(_.predicates,[l,u,a]),y=Re(_.objects,[u,a,l])),d&&(o._graphs[c]={subjects:d,predicates:h,objects:y}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Es]&&(this[Es]=this[Symbol.iterator]());let r=this[Es];for(;--e>=0;){let{done:n,value:i}=r.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,n,i){return this.filtered.deleteMatches(e,r,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,n,i,s){return this.filtered.every(e,r,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,r,n,i,s){return this.filtered.forEach(e,r,n,i,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,n,i,s){return this.filtered.some(e,r,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(e,r)}toString(){return new _e().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,n,i){return new t(this.filtered,e,r,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}};var kr=class{dataset(e){return new Ye(e)}};function zu(t){let e=[];for(let{subject:r,object:n}of t.match(null,X.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,X.defaultGraph())){let i=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,n)];e.push({premise:i,conclusion:s})}return e}var Pr=class{constructor(e){this._store=e}_add(e,r,n,i,s){this._store._addToIndex(i.subjects,e,r,n)&&(this._store._addToIndex(i.predicates,r,n,e),this._store._addToIndex(i.objects,n,e,r),s())}_evaluatePremise(e,r,n,i=0){let s,o,a,l,u,[f,c,d]=e.premise[i].value,h=r[e.premise[i].content],y=!(a=f.value);for(a in y?h:{[a]:h[a]})if(l=h[a]){y&&(f.value=Number(a)),s=!(a=c.value);for(a in s?l:{[a]:l[a]})if(u=l[a]){s&&(c.value=Number(a)),o=!(a=d.value);for(a in o?u:{[a]:u[a]})o&&(d.value=Number(a)),i===e.premise.length-1?e.conclusion.forEach(_=>{this._add(_.subject.value,_.predicate.value,_.object.value,r,()=>{n(_)})}):this._evaluatePremise(e,r,n,i+1);o&&(d.value=null)}s&&(c.value=null)}y&&(f.value=null)}_evaluateRules(e,r,n){for(let i=0;i<e.length;i++)this._evaluatePremise(e[i],r,n)}_reasonGraphNaive(e,r){let n=[];function i(a){a.next&&a.next.forEach(l=>{n.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{a.forEach(l=>{this._add(l.subject.value,l.predicate.value,l.object.value,r,()=>{i(l)})})};this._evaluateRules(e,r,i);let o;for(;(o=n.pop())!==void 0;){let[a,l,u,f]=o,c=f.basePremise.subject.value;c||(f.basePremise.subject.value=a);let d=f.basePremise.predicate.value;d||(f.basePremise.predicate.value=l);let h=f.basePremise.object.value;h||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,i),c||(f.basePremise.subject.value=null),d||(f.basePremise.predicate.value=null),h||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let n={},i=o=>o.termType==="Variable"?n[o.value]=n[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:i(o.subject),predicate:i(o.predicate),object:i(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(n)}}reason(e){Array.isArray(e)||(e=zu(e)),e=e.map(n=>this._createRule(n));for(let n of e)for(let i of e)for(let s=0;s<i.premise.length;s++){let o=i.premise[s];for(let a of n.conclusion){if(Is(o.subject,a.subject)&&Is(o.predicate,a.predicate)&&Is(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 f=0;f<i.premise.length;f++)f!==s&&u.push(Gu(i.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:i.conclusion,basePremise:o})}i.variables.forEach(l=>{l.value=null})}}for(let n of e){let i=new Set;n.premise=n.premise.map(s=>Gu(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function Gu({subject:t,predicate:e,object:r},n){let i=t.value||n.has(t)||(n.add(t),!1),s=e.value||n.has(e)||(n.add(e),!1),o=r.value||n.has(r)||(n.add(r),!1);return!i&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function Is(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var Hu=Cr(jn());var Lr=class extends Hu.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new ze(e),n,i,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":n=a;break;case"end":i=a;break}}},s),this._transform=(o,a,l)=>{n(o),l()},this._flush=o=>{i(),o()}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),this}};var Qu=Cr(jn());var Or=class extends Qu.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});let r=this._writer=new _e({write:(n,i,s)=>{this.push(n),s&&s()},end:n=>{this.push(null),n&&n()}},e);this._transform=(n,i,s)=>{r.addQuad(n,s)},this._flush=n=>{r.end(n)}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),e.on("prefix",(r,n)=>{this._writer.addPrefix(r,n)}),this}};var kn={Lexer:it,Parser:ze,Writer:_e,Store:Ye,StoreFactory:kr,EntityIndex:jr,StreamParser:Lr,StreamWriter:Or,Util:oi,Reasoner:Pr,BaseIRI:at,DataFactory:X,Term:Z,NamedNode:Ot,Literal:We,BlankNode:dr,Variable:hr,DefaultGraph:pr,Quad:Ge,Triple:Ge,termFromId:qe,termToId:Ne};var ob=(t,e,r)=>{let n=new kn.Parser({blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},ab=t=>new Promise((e,r)=>{let n=new kn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=kn.DataFactory,u=(b,g)=>{let S=g.a;if(Array.isArray(S)||(S=[S]),S?.length)for(let m of S)m=t.fullURI(m),n.addQuad(s(o(b),o(Qn),o(m)))},f=(b,g)=>{if(!g)return;let S=c(g);for(let m of S){Array.isArray(m.object)||(m.object=[m.object]);for(let A of m.object)n.addQuad(s(o(b),m.predicate,A))}},c=b=>{let g=[];return Object.entries(b).forEach(S=>{let m=S[0],A=S[1],Ae=t.fullURI(m),D={predicate:o(Ae)};A instanceof Nt?D.object=y(A):Array.isArray(A)?D.object=x(A):A instanceof vt?D.object=o(A.id):A instanceof tt?D.object=_(A):h(A)?D.object=d(A):console.log("weird object",A,m),g.push(D)}),g},d=b=>{let g=t.getType(b)||null;if(g)g==i+t.context.separator+"string"||g==i+t.context.separator+"number"?g=null:g=t.fullURI(g),g=o(g);else{let S=b?.language;S&&(g=S)}return b instanceof String?b=""+b:b instanceof Number&&(b=+b),a(b,g)},h=b=>b instanceof String||b instanceof Number||typeof b=="boolean"||typeof b=="string"||typeof b=="number",y=b=>{let g=[];for(let S of b)h(S)?g.push(d(S)):S.id?g.push(o(S.id)):g.push(_(S));return n.list(g)},_=b=>n.blank(c(b)),x=(b,g)=>{let S=[];for(let m of g)h(m)?S.push(d(m)):m instanceof vt?S.push(o(m.id)):m instanceof tt?S.push(_(m)):m instanceof Nt&&S.push(y(m));return S};Object.entries(t.subjects).forEach(([b,g])=>{b=t.shortURI(b,":"),u(b,g),f(b,g)}),n.end((b,g)=>{g?e(g):r(b)})});var Ku={context:Hn,...As};globalThis.oldm=Ku;var Pn=Ku;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function Ts(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push(i=>({[r]:n(i,r,"select")})):Ie(n)?e.push(()=>({[r]:n})):e.push(i=>({[r]:Fr(i[r]).select(n)}));return e.length==1?e[0]:r=>{let n={};for(let i of e)Object.assign(n,i(r));return n}}function vs(t){let e=[];if(Array.isArray(t))e.push(cb(...t));else if(t instanceof RegExp)e.push(r=>t.test(r));else if(t instanceof Function)e.push(r=>t(r));else if(Ie(t))e.push(r=>Array.isArray(r)?r.filter(n=>t==n).length>0:t==r);else{let r={};for(let[i,s]of Object.entries(t))r[i]=vs(s);let n=i=>{if(Array.isArray(i))return i.filter(s=>n(s)).length>0;if(Ie(i))return!1;for(let s in r){let o=r[s];if(!o(i?.[s]))return!1}return!0};e.push(n)}return e.length==1?e[0]:r=>{for(let n of e)if(!n(r))return!1;return!0}}var lb=Symbol("asc"),ub=Symbol("desc");function Vu(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===lb)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===ub)r.push((s,o)=>s[n]<o[n]?1:s[n]>o[n]?-1:0);else{if(Ie(i))throw new Error("Unknown sort order",i);{let s=Vu(i);r.push((o,a)=>s(o[n],a[n]))}}return r.length==1?r[0]:(n,i)=>{for(let s of r){let o=s(n,i);if(o!==0)return o}return 0}}function Ju(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push((i,s,o,a)=>(Ie(i)&&(i={}),s.reduce?i[r]=s.reduce(n,i[r]||[]):i[r]=n(i[r]||[],s,o,a),i)):Ie(n)?e.push(i=>(Ie(i)&&(i={}),i[r]=n,i)):e.push((i,s)=>(Ie(i)&&(i={}),i[r]=Fr(s[r]).reduce(n,[]),i));return e.length==1?e[0]:(r,n,i,s)=>{let o={};for(let a of e)Object.assign(o,a(r,n,i,s));return o}}function fb(t,e){let r={};for(let n of t){let i=e(n);Array.isArray(i)||(i=[i]);for(let s of i){if(typeof s!="string"&&!(s instanceof String)){console.warn("JAQT: groupBy(selector) can only handle string values, got:",s);continue}r[s]||(r[s]=[]),r[s].push(n)}}return r}function Yu(t,e){let r=e.shift(),n=fb(t,r);if(e.length)for(let i in n)n[i]=Yu(n[i],e);return n}function cb(...t){let e=t.map(r=>vs(r));return r=>e.some(n=>n(r))}var db={apply(t,e,r){let n=t.apply(e,r);return typeof n=="object"?new Proxy(n,Fe):n}},Fe={get(t,e){let r=null;if(typeof e=="symbol"&&(r=t[e]),Array.isArray(t))switch(e){case"where":r=function(n){let i=vs(n);return new Proxy(t.filter(s=>i(s)),Fe)};break;case"select":r=function(n){let i=Ts(n);return new Proxy(t.map(i),Fe)};break;case"reduce":r=function(n,i=[]){let s=Ju(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,Fe):Ie(o)?o:new Proxy(o,Br)};break;case"orderBy":r=function(n){let i=Vu(n);return new Proxy(t.toSorted(i),Fe)};break;case"groupBy":r=function(...n){let i=Yu(t,n);return new Proxy(i,Br)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=Ts(n);return new Proxy(i(t),Fe)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],db)),r||(r=t[e]),r}},Br={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=Ts(n),s={};for(let o in t)Array.isArray(t[o])?s[o]=new Proxy(t[o].map(i),Fe):s[o]=new Proxy(t[o],Br);return s};break;case"reduce":r=function(n,i=[]){let s=Ju(n),o={};for(let a in t)if(Array.isArray(t[a])){let l=t[a].reduce(s,i);Array.isArray(l)?o[a]=new Proxy(l,Fe):Ie(l)?o[a]=l:o[a]=new Proxy(l,Br)}else o[a]=new Proxy(t[a],Br);return o};break;default:Array.isArray(t[e])?r=Fr(t[e]):r=t[e];break}return r}},Ln={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new Xt,Ln)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new Xt,Ln)};break;case"groupBy":r=function(){return new Proxy(new Xt,Ln)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},Xt=class{toJSON(){return null}};function Fr(t){return!t||typeof t!="object"?new Proxy(new Xt,Ln):new Proxy(t,Fe)}function Ns(t){return(e,r)=>{if(t?.length>0){let n=t.slice(),i=n.shift();for(;i;){if(Array.isArray(e)&&parseInt(i)!=i)return n.unshift(i),e.map(Ns(n));typeof e?.[i]<"u"?e=e[i]:e=null,i=n.shift()}return e}else return r?typeof e?.[r]<"u"?e[r]:null:e}}var Zu=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(Ns(n),Zu(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),Zm=new Proxy(Ns(),Zu());function On(t){t=Object.assign({contentType:"text/turtle",prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schem:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",pims:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:Pn.n3Parser,writer:Pn.n3Writer},t),t.prefixes.ldp||(t.prefixes.ldp="http://www.w3.org/ns/ldp#");let e=Pn.context(t);return async function(n,i){if(n.headers.get("Accept")||(n=n.with({headers:{Accept:t.accept??t.contentType}})),n.method!=="GET"&&n.method!=="HEAD"&&n.data&&typeof n.data=="object"&&!(n.data instanceof ReadableStream)){let o=n.headers.get("Content-Type");(!o||isPlainText(o))&&(n=n.with({headers:{"Content-Type":t.contentType}})),Xu(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&Xu(s.headers?.get("Content-Type"))){let a=await s.clone().text();try{let l=e.parse(a,n.url,s.headers.get("Content-Type"));return s.with({body:l})}catch{}}return s}}var hb=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function Xu(t){for(let e of hb)if(e.exec(t))return!0;return!1}globalThis.oldmmw=On;var ef=On;var xt=class extends et{#e;#t;constructor(e,r="/",n={}){e=ee(e).with(Js.oidcmw(n)).with(ef(n)),r=new R(r),super(e,r),this.#e=e,this.#t=r}get name(){return"SolidAdapter"}async read(e){let r=await this.#e.get(e),n={type:this.getMimetype(r),name:R.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return r.data&&(n.data=r.data),n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}async list(e){let r=await this.read(e);if(r.data){if(!r.data.primary?.ldp$contains)throw new Error(e+" could not find ldp container",{cause:r});return Fr(r.data.primary.ldp$contains).where({a:"ldp$Resource"}).select({filename:n=>jsfs.path.filename(metro.url(n.id).pathname),path:n=>metro.url(n.id).pathname,type:n=>n.a.includes("ldp$Container")?"folder":"file"})}else throw new Error(e+" could not be parsed",{cause:r})}};function pb(...t){return new jsfs.fs(new xt(...t))}var mw=xt;globalThis.solidClient=pb;globalThis.SolidAdapter=xt;})();
22
+ `),this._subject=null),this._write=this._blockedWrite;let r=e&&((n,i)=>{r=null,e(n,i)});if(this._endStream)try{return this._outputStream.end(r)}catch{}r&&r()}};function Po(t){let e=Pc[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 Rs=Cr(jn());var Es=Symbol("iter");function Nr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Nr(t[n]||Object.create(null),e[n],r-1);return t}function qu(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:qu(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}function Wu(t,e,r=4){let n=!1;for(let i in t)if(!(i in e))n=n||Object.create(null),n[i]=r===0?null:Nr({},t[i],r-1);else if(r!==0){let s=Wu(t[i],e[i],r-1);if(s!==!1)n=n||Object.create(null),n[i]=s;else if(r===3)return!1}return n}var jr=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,n=e.split(".");return this._factory.quad(this._termFromId(r[n[1]]),this._termFromId(r[n[2]]),this._termFromId(r[n[3]]),n[4]&&this._termFromId(r[n[4]]))}return qe(e,this._factory)}_termToNumericId(e){if(e.termType==="Quad"){let r=this._termToNumericId(e.subject),n=this._termToNumericId(e.predicate),i=this._termToNumericId(e.object),s;return r&&n&&i&&(ot(e.graph)||(s=this._termToNumericId(e.graph)))&&this._ids[s?`.${r}.${n}.${i}.${s}`:`.${r}.${n}.${i}`]}return this._ids[Ne(e)]}_termToNewNumericId(e){let r=e&&e.termType==="Quad"?`.${this._termToNewNumericId(e.subject)}.${this._termToNewNumericId(e.predicate)}.${this._termToNewNumericId(e.object)}${ot(e.graph)?"":`.${this._termToNewNumericId(e.graph)}`}`:Ne(e);return this._ids[r]||(this._ids[this._entities[++this._id]=r]=this._id)}createBlankNode(e){let r,n;if(e)for(r=e=`_:${e}`,n=1;this._ids[r];)r=e+n++;else do r=`_:b${this._blankNodeIndex++}`;while(this._ids[r]);return this._ids[r]=++this._id,this._entities[this._id]=r,this._factory.blankNode(r.substr(2))}},Ye=class t{constructor(e,r){this._size=0,this._graphs=Object.create(null),!r&&e&&!e[0]&&typeof e.match!="function"&&(r=e,e=null),r=r||{},this._factory=r.factory||X,this._entityIndex=r.entityIndex||new jr({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,n,i;for(let s in r)for(let o in n=r[s].subjects)for(let a in i=n[o])e+=Object.keys(i[a]).length;return this._size=e}_addToIndex(e,r,n,i){let s=e[r]||(e[r]={}),o=s[n]||(s[n]={}),a=i in o;return a||(o[i]=null),!a}_removeFromIndex(e,r,n,i){let s=e[r],o=s[n];delete o[i];for(let a in o)return;delete s[n];for(let a in s)return;delete e[r]}*_findInIndex(e,r,n,i,s,o,a,l){let u,f,c,d=this._entities,h=this._termFromId(d[l]),y={subject:null,predicate:null,object:null};r&&((u=e,e={})[r]=u[r]);for(let _ in e)if(f=e[_]){y[s]=this._termFromId(d[_]),n&&((u=f,f={})[n]=u[n]);for(let x in f)if(c=f[x]){y[o]=this._termFromId(d[x]);let b=i?i in c?[i]:[]:Object.keys(c);for(let g=0;g<b.length;g++)y[a]=this._termFromId(d[b[g]]),yield this._factory.quad(y.subject,y.predicate,y.object,h)}}}_loop(e,r){for(let n in e)r(n)}_loopByKey0(e,r,n){let i,s;if(i=e[r])for(s in i)n(s)}_loopByKey1(e,r,n){let i,s;for(i in e)s=e[i],s[r]&&n(i)}_loopBy2Keys(e,r,n,i){let s,o,a;if((s=e[r])&&(o=s[n]))for(a in o)i(a)}_countInIndex(e,r,n,i){let s=0,o,a,l;r&&((o=e,e={})[r]=o[r]);for(let u in e)if(a=e[u]){n&&((o=a,a={})[n]=o[n]);for(let f in a)(l=a[f])&&(i?i in l&&s++:s+=Object.keys(l).length)}return s}_getGraphs(e){return e=e===""?1:e&&(this._termToNumericId(e)||-1),typeof e!="number"?this._graphs:{[e]:this._graphs[e]}}_uniqueEntities(e){let r=Object.create(null);return n=>{n in r||(r[n]=!0,e(this._termFromId(this._entities[n],this._factory)))}}add(e){return this.addQuad(e),this}addQuad(e,r,n,i){r||(i=e.graph,n=e.object,r=e.predicate,e=e.subject),i=i?this._termToNewNumericId(i):1;let s=this._graphs[i];return s||(s=this._graphs[i]={subjects:{},predicates:{},objects:{}},Object.freeze(s)),e=this._termToNewNumericId(e),r=this._termToNewNumericId(r),n=this._termToNewNumericId(n),this._addToIndex(s.subjects,e,r,n)?(this._addToIndex(s.predicates,r,n,e),this._addToIndex(s.objects,n,e,r),this._size=null,!0):!1}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}delete(e){return this.removeQuad(e),this}has(e,r,n,i){return e&&e.subject&&({subject:e,predicate:r,object:n,graph:i}=e),!this.readQuads(e,r,n,i).next().done}import(e){return e.on("data",r=>{this.addQuad(r)}),e}removeQuad(e,r,n,i){r||({subject:e,predicate:r,object:n,graph:i}=e),i=i?this._termToNumericId(i):1;let s=this._graphs,o,a,l;if(!(e=e&&this._termToNumericId(e))||!(r=r&&this._termToNumericId(r))||!(n=n&&this._termToNumericId(n))||!(o=s[i])||!(a=o.subjects[e])||!(l=a[r])||!(n in l))return!1;this._removeFromIndex(o.subjects,e,r,n),this._removeFromIndex(o.predicates,r,n,e),this._removeFromIndex(o.objects,n,e,r),this._size!==null&&this._size--;for(e in o.subjects)return!0;return delete s[i],!0}removeQuads(e){for(let r=0;r<e.length;r++)this.removeQuad(e[r])}remove(e){return e.on("data",r=>{this.removeQuad(r)}),e}removeMatches(e,r,n,i){let s=new Rs.Readable({objectMode:!0}),o=this.readQuads(e,r,n,i);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,n,i){return[...this.readQuads(e,r,n,i)]}*readQuads(e,r,n,i){let s=this._getGraphs(i),o,a,l,u;if(!(e&&!(a=this._termToNumericId(e))||r&&!(l=this._termToNumericId(r))||n&&!(u=this._termToNumericId(n))))for(let f in s)(o=s[f])&&(a?u?yield*this._findInIndex(o.objects,u,a,l,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,a,l,null,"subject","predicate","object",f):l?yield*this._findInIndex(o.predicates,l,u,null,"predicate","object","subject",f):u?yield*this._findInIndex(o.objects,u,null,null,"object","subject","predicate",f):yield*this._findInIndex(o.subjects,null,null,null,"subject","predicate","object",f))}match(e,r,n,i){return new Je(this,e,r,n,i,{entityIndex:this._entityIndex})}countQuads(e,r,n,i){let s=this._getGraphs(i),o=0,a,l,u,f;if(e&&!(l=this._termToNumericId(e))||r&&!(u=this._termToNumericId(r))||n&&!(f=this._termToNumericId(n)))return 0;for(let c in s)(a=s[c])&&(e?n?o+=this._countInIndex(a.objects,f,l,u):o+=this._countInIndex(a.subjects,l,u,f):r?o+=this._countInIndex(a.predicates,u,f,l):o+=this._countInIndex(a.objects,f,l,u));return o}forEach(e,r,n,i,s){this.some(o=>(e(o,this),!1),r,n,i,s)}every(e,r,n,i,s){return!this.some(o=>!e(o,this),r,n,i,s)}some(e,r,n,i,s){for(let o of this.readQuads(r,n,i,s))if(e(o,this))return!0;return!1}getSubjects(e,r,n){let i=[];return this.forSubjects(s=>{i.push(s)},e,r,n),i}forSubjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(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,n){let i=[];return this.forPredicates(s=>{i.push(s)},e,r,n),i}forPredicates(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(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,n){let i=[];return this.forObjects(s=>{i.push(s)},e,r,n),i}forObjects(e,r,n,i){let s=this._getGraphs(i),o,a,l;if(e=this._uniqueEntities(e),!(r&&!(a=this._termToNumericId(r))||n&&!(l=this._termToNumericId(n))))for(i in s)(o=s[i])&&(a?l?this._loopBy2Keys(o.subjects,a,l,e):this._loopByKey1(o.objects,a,e):l?this._loopByKey0(o.predicates,l,e):this._loop(o.objects,e))}getGraphs(e,r,n){let i=[];return this.forGraphs(s=>{i.push(s)},e,r,n),i}forGraphs(e,r,n,i){for(let s in this._graphs)this.some(o=>(e(o.graph),!0),r,n,i,this._termFromId(this._entities[s]))}createBlankNode(e){return this._entityIndex.createBlankNode(e)}extractLists({remove:e=!1,ignoreErrors:r=!1}={}){let n={},i=r?(()=>!0):((a,l)=>{throw new Error(`${a.value} ${l}`)}),s=this.getQuads(null,B.rdf.rest,B.rdf.nil,null),o=e?[...s]:[];return s.forEach(a=>{let l=[],u=!1,f,c,d=a.graph,h=a.subject;for(;h&&!u;){let y=this.getQuads(null,null,h,null),_=this.getQuads(h,null,null,null),x,b=null,g=null,S=null;for(let m=0;m<_.length&&!u;m++)x=_[m],x.graph.equals(d)?f?u=i(h,"has non-list arcs out"):x.predicate.value===B.rdf.first?b?u=i(h,"has multiple rdf:first arcs"):o.push(b=x):x.predicate.value===B.rdf.rest?g?u=i(h,"has multiple rdf:rest arcs"):o.push(g=x):y.length?u=i(h,"can't be subject and object"):(f=x,c="subject"):u=i(h,"not confined to single graph");for(let m=0;m<y.length&&!u;++m)x=y[m],f?u=i(h,"can't have coreferences"):x.predicate.value===B.rdf.rest?S?u=i(h,"has incoming rdf:rest arcs"):S=x:(f=x,c="object");b?l.unshift(b.object):u=i(h,"has no list head"),h=S&&S.subject}u?e=!1:f&&(n[f[c].value]=l)}),e&&this.removeQuads(o),n}addAll(e){if(e instanceof Je&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Nr(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof Je&&(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,n=e._graphs,i,s,o,a,l;for(let u in n){if(!(i=r[u]))return!1;i=i.subjects;for(let f in s=n[u].subjects){if(!(o=i[f]))return!1;for(let c in a=s[f]){if(!(l=o[c]))return!1;for(let d in a[c])if(!(d in l))return!1}}}return!0}deleteMatches(e,r,n,i){for(let s of this.match(e,r,n,i))this.removeQuad(s);return this}difference(e){if(e&&e instanceof Je&&(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}),n=Wu(this._graphs,e._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof Je&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)e(n,this)&&r.add(n);return r}intersection(e){if(e instanceof Je&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Nr(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}),n=qu(e._graphs,this._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>e.has(r))}map(e){let r=new t({entityIndex:this._entityIndex});for(let n of this)r.add(e(n,this));return r}reduce(e,r){let n=this.readQuads(),i=r===void 0?n.next().value:r;for(let s of n)i=e(i,s,this);return i}toArray(){return this.getQuads()}toCanonical(){throw new Error("not implemented")}toStream(){return this.match()}toString(){return new _e().quadsToString(this)}union(e){let r=new t({entityIndex:this._entityIndex});return r._graphs=Nr(Object.create(null),this._graphs),r._size=this._size,r.addAll(e),r}*[Symbol.iterator](){yield*this.readQuads()}};function Re(t,e,r=0){let n=e[r];if(n&&!(n in t))return!1;let i=!1;for(let s in n?{[n]:t[n]}:t){let o=r===2?null:Re(t[s],e,r+1);o!==!1&&(i=i||Object.create(null),i[s]=o)}return i}var Je=class t extends Rs.Readable{constructor(e,r,n,i,s,o){super({objectMode:!0}),Object.assign(this,{n3Store:e,subject:r,predicate:n,object:i,graph:s,options:o})}get filtered(){if(!this._filtered){let{n3Store:e,graph:r,object:n,predicate:i,subject:s}=this,o=this._filtered=new Ye({factory:e._factory,entityIndex:this.options.entityIndex}),a,l,u;if(s&&!(a=o._termToNumericId(s))||i&&!(l=o._termToNumericId(i))||n&&!(u=o._termToNumericId(n)))return o;let f=e._getGraphs(r);for(let c in f){let d,h,y,_;(_=f[c])&&(!a&&l?(h=Re(_.predicates,[l,u,a]))&&(d=Re(_.subjects,[a,l,u]),y=Re(_.objects,[u,a,l])):u?(y=Re(_.objects,[u,a,l]))&&(d=Re(_.subjects,[a,l,u]),h=Re(_.predicates,[l,u,a])):(d=Re(_.subjects,[a,l,u]))&&(h=Re(_.predicates,[l,u,a]),y=Re(_.objects,[u,a,l])),d&&(o._graphs[c]={subjects:d,predicates:h,objects:y}))}o._size=null}return this._filtered}get size(){return this.filtered.size}_read(e){e>0&&!this[Es]&&(this[Es]=this[Symbol.iterator]());let r=this[Es];for(;--e>=0;){let{done:n,value:i}=r.next();if(n){this.push(null);return}this.push(i)}}addAll(e){return this.filtered.addAll(e)}contains(e){return this.filtered.contains(e)}deleteMatches(e,r,n,i){return this.filtered.deleteMatches(e,r,n,i)}difference(e){return this.filtered.difference(e)}equals(e){return this.filtered.equals(e)}every(e,r,n,i,s){return this.filtered.every(e,r,n,i,s)}filter(e){return this.filtered.filter(e)}forEach(e,r,n,i,s){return this.filtered.forEach(e,r,n,i,s)}import(e){return this.filtered.import(e)}intersection(e){return this.filtered.intersection(e)}map(e){return this.filtered.map(e)}some(e,r,n,i,s){return this.filtered.some(e,r,n,i,s)}toCanonical(){return this.filtered.toCanonical()}toStream(){return this._filtered?this._filtered.toStream():this.n3Store.match(this.subject,this.predicate,this.object,this.graph)}union(e){return this._filtered?this._filtered.union(e):this.n3Store.match(this.subject,this.predicate,this.object,this.graph).addAll(e)}toArray(){return this._filtered?this._filtered.toArray():this.n3Store.getQuads(this.subject,this.predicate,this.object,this.graph)}reduce(e,r){return this.filtered.reduce(e,r)}toString(){return new _e().quadsToString(this)}add(e){return this.filtered.add(e)}delete(e){return this.filtered.delete(e)}has(e){return this.filtered.has(e)}match(e,r,n,i){return new t(this.filtered,e,r,n,i,this.options)}*[Symbol.iterator](){yield*this._filtered||this.n3Store.readQuads(this.subject,this.predicate,this.object,this.graph)}};var kr=class{dataset(e){return new Ye(e)}};function zu(t){let e=[];for(let{subject:r,object:n}of t.match(null,X.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,X.defaultGraph())){let i=[...t.match(null,null,null,r)],s=[...t.match(null,null,null,n)];e.push({premise:i,conclusion:s})}return e}var Pr=class{constructor(e){this._store=e}_add(e,r,n,i,s){this._store._addToIndex(i.subjects,e,r,n)&&(this._store._addToIndex(i.predicates,r,n,e),this._store._addToIndex(i.objects,n,e,r),s())}_evaluatePremise(e,r,n,i=0){let s,o,a,l,u,[f,c,d]=e.premise[i].value,h=r[e.premise[i].content],y=!(a=f.value);for(a in y?h:{[a]:h[a]})if(l=h[a]){y&&(f.value=Number(a)),s=!(a=c.value);for(a in s?l:{[a]:l[a]})if(u=l[a]){s&&(c.value=Number(a)),o=!(a=d.value);for(a in o?u:{[a]:u[a]})o&&(d.value=Number(a)),i===e.premise.length-1?e.conclusion.forEach(_=>{this._add(_.subject.value,_.predicate.value,_.object.value,r,()=>{n(_)})}):this._evaluatePremise(e,r,n,i+1);o&&(d.value=null)}s&&(c.value=null)}y&&(f.value=null)}_evaluateRules(e,r,n){for(let i=0;i<e.length;i++)this._evaluatePremise(e[i],r,n)}_reasonGraphNaive(e,r){let n=[];function i(a){a.next&&a.next.forEach(l=>{n.push([a.subject.value,a.predicate.value,a.object.value,l])})}let s=a=>{a.forEach(l=>{this._add(l.subject.value,l.predicate.value,l.object.value,r,()=>{i(l)})})};this._evaluateRules(e,r,i);let o;for(;(o=n.pop())!==void 0;){let[a,l,u,f]=o,c=f.basePremise.subject.value;c||(f.basePremise.subject.value=a);let d=f.basePremise.predicate.value;d||(f.basePremise.predicate.value=l);let h=f.basePremise.object.value;h||(f.basePremise.object.value=u),f.premise.length===0?s(f.conclusion):this._evaluatePremise(f,r,i),c||(f.basePremise.subject.value=null),d||(f.basePremise.predicate.value=null),h||(f.basePremise.object.value=null)}}_createRule({premise:e,conclusion:r}){let n={},i=o=>o.termType==="Variable"?n[o.value]=n[o.value]||{}:{value:this._store._termToNewNumericId(o)},s=o=>({subject:i(o.subject),predicate:i(o.predicate),object:i(o.object)});return{premise:e.map(o=>s(o)),conclusion:r.map(o=>s(o)),variables:Object.values(n)}}reason(e){Array.isArray(e)||(e=zu(e)),e=e.map(n=>this._createRule(n));for(let n of e)for(let i of e)for(let s=0;s<i.premise.length;s++){let o=i.premise[s];for(let a of n.conclusion){if(Is(o.subject,a.subject)&&Is(o.predicate,a.predicate)&&Is(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 f=0;f<i.premise.length;f++)f!==s&&u.push(Gu(i.premise[f],l));(a.next=a.next||[]).push({premise:u,conclusion:i.conclusion,basePremise:o})}i.variables.forEach(l=>{l.value=null})}}for(let n of e){let i=new Set;n.premise=n.premise.map(s=>Gu(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function Gu({subject:t,predicate:e,object:r},n){let i=t.value||n.has(t)||(n.add(t),!1),s=e.value||n.has(e)||(n.add(e),!1),o=r.value||n.has(r)||(n.add(r),!1);return!i&&s?{content:"predicates",value:[e,r,t]}:o?{content:"objects",value:[r,t,e]}:{content:"subjects",value:[t,e,r]}}function Is(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var Hu=Cr(jn());var Lr=class extends Hu.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new ze(e),n,i,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":n=a;break;case"end":i=a;break}}},s),this._transform=(o,a,l)=>{n(o),l()},this._flush=o=>{i(),o()}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),this}};var Qu=Cr(jn());var Or=class extends Qu.Transform{constructor(e){super({encoding:"utf8",writableObjectMode:!0});let r=this._writer=new _e({write:(n,i,s)=>{this.push(n),s&&s()},end:n=>{this.push(null),n&&n()}},e);this._transform=(n,i,s)=>{r.addQuad(n,s)},this._flush=n=>{r.end(n)}}import(e){return e.on("data",r=>{this.write(r)}),e.on("end",()=>{this.end()}),e.on("error",r=>{this.emit("error",r)}),e.on("prefix",(r,n)=>{this._writer.addPrefix(r,n)}),this}};var kn={Lexer:it,Parser:ze,Writer:_e,Store:Ye,StoreFactory:kr,EntityIndex:jr,StreamParser:Lr,StreamWriter:Or,Util:oi,Reasoner:Pr,BaseIRI:at,DataFactory:X,Term:Z,NamedNode:Ot,Literal:We,BlankNode:dr,Variable:hr,DefaultGraph:pr,Quad:Ge,Triple:Ge,termFromId:qe,termToId:Ne};var ob=(t,e,r)=>{let n=new kn.Parser({blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},ab=t=>new Promise((e,r)=>{let n=new kn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=kn.DataFactory,u=(b,g)=>{let S=g.a;if(Array.isArray(S)||(S=[S]),S?.length)for(let m of S)m=t.fullURI(m),n.addQuad(s(o(b),o(Qn),o(m)))},f=(b,g)=>{if(!g)return;let S=c(g);for(let m of S){Array.isArray(m.object)||(m.object=[m.object]);for(let A of m.object)n.addQuad(s(o(b),m.predicate,A))}},c=b=>{let g=[];return Object.entries(b).forEach(S=>{let m=S[0],A=S[1],Ae=t.fullURI(m),D={predicate:o(Ae)};A instanceof Nt?D.object=y(A):Array.isArray(A)?D.object=x(A):A instanceof vt?D.object=o(A.id):A instanceof tt?D.object=_(A):h(A)?D.object=d(A):console.log("weird object",A,m),g.push(D)}),g},d=b=>{let g=t.getType(b)||null;if(g)g==i+t.context.separator+"string"||g==i+t.context.separator+"number"?g=null:g=t.fullURI(g),g=o(g);else{let S=b?.language;S&&(g=S)}return b instanceof String?b=""+b:b instanceof Number&&(b=+b),a(b,g)},h=b=>b instanceof String||b instanceof Number||typeof b=="boolean"||typeof b=="string"||typeof b=="number",y=b=>{let g=[];for(let S of b)h(S)?g.push(d(S)):S.id?g.push(o(S.id)):g.push(_(S));return n.list(g)},_=b=>n.blank(c(b)),x=(b,g)=>{let S=[];for(let m of g)h(m)?S.push(d(m)):m instanceof vt?S.push(o(m.id)):m instanceof tt?S.push(_(m)):m instanceof Nt&&S.push(y(m));return S};Object.entries(t.subjects).forEach(([b,g])=>{b=t.shortURI(b,":"),u(b,g),f(b,g)}),n.end((b,g)=>{g?e(g):r(b)})});var Ku={context:Hn,...As};globalThis.oldm=Ku;var Pn=Ku;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function Ts(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push(i=>({[r]:n(i,r,"select")})):Ie(n)?e.push(()=>({[r]:n})):e.push(i=>({[r]:Fr(i[r]).select(n)}));return e.length==1?e[0]:r=>{let n={};for(let i of e)Object.assign(n,i(r));return n}}function vs(t){let e=[];if(Array.isArray(t))e.push(cb(...t));else if(t instanceof RegExp)e.push(r=>t.test(r));else if(t instanceof Function)e.push(r=>t(r));else if(Ie(t))e.push(r=>Array.isArray(r)?r.filter(n=>t==n).length>0:t==r);else{let r={};for(let[i,s]of Object.entries(t))r[i]=vs(s);let n=i=>{if(Array.isArray(i))return i.filter(s=>n(s)).length>0;if(Ie(i))return!1;for(let s in r){let o=r[s];if(!o(i?.[s]))return!1}return!0};e.push(n)}return e.length==1?e[0]:r=>{for(let n of e)if(!n(r))return!1;return!0}}var lb=Symbol("asc"),ub=Symbol("desc");function Vu(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===lb)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===ub)r.push((s,o)=>s[n]<o[n]?1:s[n]>o[n]?-1:0);else{if(Ie(i))throw new Error("Unknown sort order",i);{let s=Vu(i);r.push((o,a)=>s(o[n],a[n]))}}return r.length==1?r[0]:(n,i)=>{for(let s of r){let o=s(n,i);if(o!==0)return o}return 0}}function Ju(t){let e=[];if(t instanceof Function)e.push(t);else for(let[r,n]of Object.entries(t))n instanceof Function?e.push((i,s,o,a)=>(Ie(i)&&(i={}),s.reduce?i[r]=s.reduce(n,i[r]||[]):i[r]=n(i[r]||[],s,o,a),i)):Ie(n)?e.push(i=>(Ie(i)&&(i={}),i[r]=n,i)):e.push((i,s)=>(Ie(i)&&(i={}),i[r]=Fr(s[r]).reduce(n,[]),i));return e.length==1?e[0]:(r,n,i,s)=>{let o={};for(let a of e)Object.assign(o,a(r,n,i,s));return o}}function fb(t,e){let r={};for(let n of t){let i=e(n);Array.isArray(i)||(i=[i]);for(let s of i){if(typeof s!="string"&&!(s instanceof String)){console.warn("JAQT: groupBy(selector) can only handle string values, got:",s);continue}r[s]||(r[s]=[]),r[s].push(n)}}return r}function Yu(t,e){let r=e.shift();if(typeof r=="string"&&(r=hb[r]),typeof r!="function")throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");let n=fb(t,r);if(e.length)for(let i in n)n[i]=Yu(n[i],e);return n}function cb(...t){let e=t.map(r=>vs(r));return r=>e.some(n=>n(r))}var db={apply(t,e,r){let n=t.apply(e,r);return typeof n=="object"?new Proxy(n,Fe):n}},Fe={get(t,e){let r=null;if(typeof e=="symbol"&&(r=t[e]),Array.isArray(t))switch(e){case"where":r=function(n){let i=vs(n);return new Proxy(t.filter(s=>i(s)),Fe)};break;case"select":r=function(n){let i=Ts(n);return new Proxy(t.map(i),Fe)};break;case"reduce":r=function(n,i=[]){let s=Ju(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,Fe):Ie(o)?o:new Proxy(o,Br)};break;case"orderBy":r=function(n){let i=Vu(n);return new Proxy(t.toSorted(i),Fe)};break;case"groupBy":r=function(...n){let i=Yu(t,n);return new Proxy(i,Br)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=Ts(n);return new Proxy(i(t),Fe)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],db)),r||(r=t[e]),r}},Br={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=Ts(n),s={};for(let o in t)Array.isArray(t[o])?s[o]=new Proxy(t[o].map(i),Fe):s[o]=new Proxy(t[o],Br);return s};break;case"reduce":r=function(n,i=[]){let s=Ju(n),o={};for(let a in t)if(Array.isArray(t[a])){let l=t[a].reduce(s,i);Array.isArray(l)?o[a]=new Proxy(l,Fe):Ie(l)?o[a]=l:o[a]=new Proxy(l,Br)}else o[a]=new Proxy(t[a],Br);return o};break;default:Array.isArray(t[e])?r=Fr(t[e]):r=t[e];break}return r}},Ln={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new Xt,Ln)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new Xt,Ln)};break;case"groupBy":r=function(){return new Proxy(new Xt,Ln)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},Xt=class{toJSON(){return null}};function Fr(t){return!t||typeof t!="object"?new Proxy(new Xt,Ln):new Proxy(t,Fe)}function Ns(t){return(e,r)=>{if(t?.length>0){let n=t.slice(),i=n.shift();for(;i;){if(Array.isArray(e)&&parseInt(i)!=i)return n.unshift(i),e.map(Ns(n));typeof e?.[i]<"u"?e=e[i]:e=null,i=n.shift()}return e}else return r?typeof e?.[r]<"u"?e[r]:null:e}}var Zu=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(Ns(n),Zu(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),hb=new Proxy(Ns(),Zu());function On(t){t=Object.assign({contentType:"text/turtle",prefixes:{ldp:"http://www.w3.org/ns/ldp#",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",dct:"http://purl.org/dc/terms/",stat:"http://www.w3.org/ns/posix/stat#",turtle:"http://www.w3.org/ns/iana/media-types/text/turtle#",schem:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",pims:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:Pn.n3Parser,writer:Pn.n3Writer},t),t.prefixes.ldp||(t.prefixes.ldp="http://www.w3.org/ns/ldp#");let e=Pn.context(t);return async function(n,i){if(n.headers.get("Accept")||(n=n.with({headers:{Accept:t.accept??t.contentType}})),n.method!=="GET"&&n.method!=="HEAD"&&n.data&&typeof n.data=="object"&&!(n.data instanceof ReadableStream)){let o=n.headers.get("Content-Type");(!o||isPlainText(o))&&(n=n.with({headers:{"Content-Type":t.contentType}})),Xu(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&Xu(s.headers?.get("Content-Type"))){let a=await s.clone().text();try{let l=e.parse(a,n.url,s.headers.get("Content-Type"));return s.with({body:l})}catch{}}return s}}var pb=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function Xu(t){for(let e of pb)if(e.exec(t))return!0;return!1}globalThis.oldmmw=On;var ef=On;var xt=class extends et{#e;#t;constructor(e,r="/",n={}){e=ee(e).with(Js.oidcmw(n)).with(ef(n)),r=new R(r),super(e,r),this.#e=e,this.#t=r}get name(){return"SolidAdapter"}async read(e){let r=await this.#e.get(e),n={type:this.getMimetype(r),name:R.filename(e),http:{headers:r.headers,status:r.status,url:r.url}};return r.data&&(n.data=r.data),n.type.match(/text\/.*/)?n.contents=await r.text():n.type.match(/application\/json.*/)?n.contents=await r.json():n.contents=await r.blob(),n}async list(e){let r=await this.read(e);if(r.data){if(!r.data.primary?.ldp$contains)throw new Error(e+" could not find ldp container",{cause:r});return Fr(r.data.primary.ldp$contains).where({a:"ldp$Resource"}).select({filename:n=>jsfs.path.filename(metro.url(n.id).pathname),path:n=>metro.url(n.id).pathname,type:n=>n.a.includes("ldp$Container")?"folder":"file"})}else throw new Error(e+" could not be parsed",{cause:r})}};function _b(...t){return new jsfs.fs(new xt(...t))}var xw=xt;globalThis.solidClient=_b;globalThis.SolidAdapter=xt;})();
23
23
  /*! Bundled license information:
24
24
 
25
25
  ieee754/index.js: