@muze-nl/jsfs-solid 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/hugo-build.yaml +73 -0
- package/dist/browser.js +473 -124
- package/dist/browser.js.map +4 -4
- package/dist/browser.min.js +10 -10
- package/dist/browser.min.js.map +4 -4
- package/package.json +2 -2
- package/package.json~ +2 -2
- package/src/SolidAdapter.js +12 -0
- package/src/SolidClient.js +47 -7
- package/src/browser.js +12 -1
package/dist/browser.min.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
(()=>{var sf=Object.create;var Bn=Object.defineProperty;var of=Object.getOwnPropertyDescriptor;var af=Object.getOwnPropertyNames;var lf=Object.getPrototypeOf,uf=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Fn=(t,e)=>{for(var r in e)Bn(t,r,{get:e[r],enumerable:!0})},ff=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of af(e))!uf.call(t,i)&&i!==r&&Bn(t,i,{get:()=>e[i],enumerable:!(n=of(e,i))||n.enumerable});return t};var Cr=(t,e,r)=>(r=t!=null?sf(lf(t)):{},ff(e||!t||!t.__esModule?Bn(r,"default",{value:t,enumerable:!0}):r,t));var eo=v(Wr=>{"use strict";Wr.byteLength=Df;Wr.toByteArray=$f;Wr.fromByteArray=Gf;var de=[],re=[],Mf=typeof Uint8Array<"u"?Uint8Array:Array,Yn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(it=0,Zs=Yn.length;it<Zs;++it)de[it]=Yn[it],re[Yn.charCodeAt(it)]=it;var it,Zs;re[45]=62;re[95]=63;function Xs(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 Df(t){var e=Xs(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Uf(t,e,r){return(e+r)*3/4-r}function $f(t){var e,r=Xs(t),n=r[0],i=r[1],s=new Mf(Uf(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 qf(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function Wf(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(qf(n));return i.join("")}function Gf(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(Wf(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 to=v(Zn=>{Zn.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)};Zn.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=v(Ft=>{"use strict";var Xn=eo(),Lt=to(),ro=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ft.Buffer=p;Ft.SlowBuffer=Jf;Ft.INSPECT_MAX_BYTES=50;var Gr=2147483647;Ft.kMaxLength=Gr;p.TYPED_ARRAY_SUPPORT=zf();!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 zf(){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 ni(t)}return oo(t,e,r)}p.poolSize=8192;function oo(t,e,r){if(typeof t=="string")return Vf(t,e);if(ArrayBuffer.isView(t))return Qf(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 ti(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=Kf(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 oo(t,e,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function ao(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 Hf(t,e,r){return ao(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 Hf(t,e,r)};function ni(t){return ao(t),ve(t<0?0:ii(t)|0)}p.allocUnsafe=function(t){return ni(t)};p.allocUnsafeSlow=function(t){return ni(t)};function Vf(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=lo(t,e)|0,n=ve(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function ei(t){let e=t.length<0?0:ii(t.length)|0,r=ve(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Qf(t){if(he(t,Uint8Array)){let e=new Uint8Array(t);return ti(e.buffer,e.byteOffset,e.byteLength)}return ei(t)}function ti(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 Kf(t){if(p.isBuffer(t)){let e=ii(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"||oi(t.length)?ve(0):ei(t);if(t.type==="Buffer"&&Array.isArray(t.data))return ei(t.data)}function ii(t){if(t>=Gr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Gr.toString(16)+" bytes");return t|0}function Jf(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 lo(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 ri(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return go(t).length;default:if(i)return n?-1:ri(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=lo;function Yf(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 ac(this,e,r);case"utf8":case"utf-8":return fo(this,e,r);case"ascii":return sc(this,e,r);case"latin1":case"binary":return oc(this,e,r);case"base64":return nc(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return lc(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function st(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)st(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)st(this,r,r+3),st(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)st(this,r,r+7),st(this,r+1,r+6),st(this,r+2,r+5),st(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?fo(this,0,e):Yf.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=Ft.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};ro&&(p.prototype[ro]=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 uo(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,oi(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:no(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):no(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function no(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 uo(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return uo(this,e,r,n,!1)};function Zf(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(oi(a))return o;t[r+o]=a}return o}function Xf(t,e,r,n){return zr(ri(e,t.length-r),t,r,n)}function ec(t,e,r,n){return zr(dc(e),t,r,n)}function tc(t,e,r,n){return zr(go(e),t,r,n)}function rc(t,e,r,n){return zr(hc(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 Zf(this,e,r,n);case"utf8":case"utf-8":return Xf(this,e,r,n);case"ascii":case"latin1":case"binary":return ec(this,e,r,n);case"base64":return tc(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rc(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 nc(t,e,r){return e===0&&r===t.length?Xn.fromByteArray(t):Xn.fromByteArray(t.slice(e,r))}function fo(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 ic(n)}var io=4096;function ic(t){let e=t.length;if(e<=io)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=io));return r}function sc(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 oc(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 ac(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+=pc[t[s]];return i}function lc(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=We(function(e){e=e>>>0,Bt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ur(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=We(function(e){e=e>>>0,Bt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ur(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=We(function(e){e=e>>>0,Bt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ur(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=We(function(e){e=e>>>0,Bt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ur(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),Lt.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||q(e,4,this.length),Lt.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||q(e,8,this.length),Lt.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||q(e,8,this.length),Lt.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 co(t,e,r,n,i){bo(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 ho(t,e,r,n,i){bo(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=We(function(e,r=0){return co(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=We(function(e,r=0){return ho(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=We(function(e,r=0){return co(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=We(function(e,r=0){return ho(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function po(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 _o(t,e,r,n,i){return e=+e,r=r>>>0,i||po(t,e,r,4,34028234663852886e22,-34028234663852886e22),Lt.write(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return _o(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return _o(this,e,r,!1,n)};function yo(t,e,r,n,i){return e=+e,r=r>>>0,i||po(t,e,r,8,17976931348623157e292,-17976931348623157e292),Lt.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return yo(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return yo(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 Ot={};function si(t,e,r){Ot[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}si("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);si("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);si("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=so(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=so(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function so(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){Bt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&ur(e,t.length-(r+1))}function bo(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 Ot.ERR_OUT_OF_RANGE("value",a,t)}uc(n,i,s)}function Bt(t,e){if(typeof t!="number")throw new Ot.ERR_INVALID_ARG_TYPE(e,"number",t)}function ur(t,e,r){throw Math.floor(t)!==t?(Bt(t,r),new Ot.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ot.ERR_BUFFER_OUT_OF_BOUNDS:new Ot.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var fc=/[^+/0-9A-Za-z-_]/g;function cc(t){if(t=t.split("=")[0],t=t.trim().replace(fc,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ri(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 dc(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function hc(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 go(t){return Xn.toByteArray(cc(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 oi(t){return t!==t}var pc=(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 We(t){return typeof BigInt>"u"?_c:t}function _c(){throw new Error("BigInt not supported")}});var L=v((Jg,Bo)=>{"use strict";var ci=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
|
|
2
|
-
`;super(r),this.name="AggregateError",this.errors=e}};Bo.exports={AggregateError:ci,ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var di=v((Yg,Fo)=>{"use strict";Fo.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 H=v((Zg,Do)=>{"use strict";var{format:Lc,inspect:Qr}=di(),{AggregateError:Bc}=L(),Fc=globalThis.AggregateError||Bc,Cc=Symbol("kIsNodeError"),Mc=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Dc=/^([A-Z][a-z0-9]*)+$/,Uc="__node_internal_",Kr={};function dt(t,e){if(!t)throw new Kr.ERR_INTERNAL_ASSERTION(e)}function Co(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 $c(t,e,r){if(typeof e=="function")return dt(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 dt(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($c(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[Cc]=!0,Kr[t]=n}function Mo(t){let e=Uc+t.name;return Object.defineProperty(t,"name",{value:e}),t}function qc(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Fc([e,t],e.message);return r.code=e.code,r}return t||e}var hi=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Kr.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)=>{dt(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)dt(typeof l=="string","All expected entries have to be of type string"),Mc.includes(l)?i.push(l.toLowerCase()):Dc.test(l)?s.push(l):(dt(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=Qr(r,{depth:-1});n+=`. Received ${l}`}}else{let l=Qr(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=Qr(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)=>{dt(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)=>{dt(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=Co(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=Co(n)),n+="n"}else n=Qr(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);Do.exports={AbortError:hi,aggregateTwoErrors:Mo(qc),hideStackFrames:Mo,codes:Kr}});var $t=v((Xg,Jr)=>{"use strict";var{AbortController:Uo,AbortSignal:Wc}=typeof self<"u"?self:typeof window<"u"?window:void 0;Jr.exports=Uo;Jr.exports.AbortSignal=Wc;Jr.exports.default=Uo});var br=v((em,pi)=>{"use strict";var qt=typeof Reflect=="object"?Reflect:null,$o=qt&&typeof qt.apply=="function"?qt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},Yr;qt&&typeof qt.ownKeys=="function"?Yr=qt.ownKeys:Object.getOwnPropertySymbols?Yr=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Yr=function(e){return Object.getOwnPropertyNames(e)};function Gc(t){console&&console.warn&&console.warn(t)}var Wo=Number.isNaN||function(e){return e!==e};function j(){j.init.call(this)}pi.exports=j;pi.exports.once=Qc;j.EventEmitter=j;j.prototype._events=void 0;j.prototype._eventsCount=0;j.prototype._maxListeners=void 0;var qo=10;function Zr(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(j,"defaultMaxListeners",{enumerable:!0,get:function(){return qo},set:function(t){if(typeof t!="number"||t<0||Wo(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");qo=t}});j.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};j.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Wo(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 Go(t){return t._maxListeners===void 0?j.defaultMaxListeners:t._maxListeners}j.prototype.getMaxListeners=function(){return Go(this)};j.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")$o(l,this,r);else for(var u=l.length,f=Ko(l,u),n=0;n<u;++n)$o(f[n],this,r);return!0};function zo(t,e,r,n){var i,s,o;if(Zr(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=Go(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,Gc(a)}return t}j.prototype.addListener=function(e,r){return zo(this,e,r,!1)};j.prototype.on=j.prototype.addListener;j.prototype.prependListener=function(e,r){return zo(this,e,r,!0)};function zc(){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 Ho(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=zc.bind(n);return i.listener=r,n.wrapFn=i,i}j.prototype.once=function(e,r){return Zr(r),this.on(e,Ho(this,e,r)),this};j.prototype.prependOnceListener=function(e,r){return Zr(r),this.prependListener(e,Ho(this,e,r)),this};j.prototype.removeListener=function(e,r){var n,i,s,o,a;if(Zr(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():Hc(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};j.prototype.off=j.prototype.removeListener;j.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 Vo(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?Vc(i):Ko(i,i.length)}j.prototype.listeners=function(e){return Vo(this,e,!0)};j.prototype.rawListeners=function(e){return Vo(this,e,!1)};j.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Qo.call(t,e)};j.prototype.listenerCount=Qo;function Qo(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}j.prototype.eventNames=function(){return this._eventsCount>0?Yr(this._events):[]};function Ko(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Hc(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Vc(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))}Jo(t,e,s,{once:!0}),e!=="error"&&Kc(t,i,{once:!0})})}function Kc(t,e,r){typeof t.on=="function"&&Jo(t,"error",e,r)}function Jo(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=v((tm,yi)=>{"use strict";var Jc=pe(),{format:Yc,inspect:Zc}=di(),{codes:{ERR_INVALID_ARG_TYPE:_i}}=H(),{kResistStopPropagation:Xc,AggregateError:ed,SymbolDispose:td}=L(),rd=globalThis.AbortSignal||$t().AbortSignal,nd=globalThis.AbortController||$t().AbortController,id=Object.getPrototypeOf(async function(){}).constructor,Yo=globalThis.Blob||Jc.Blob,sd=typeof Yo<"u"?function(e){return e instanceof Yo}:function(e){return!1},Zo=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new _i(e,"AbortSignal",t)},od=(t,e)=>{if(typeof t!="function")throw new _i(e,"Function",t)};yi.exports={AggregateError:ed,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:Yc,inspect:Zc,types:{isAsyncFunction(t){return t instanceof id},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:sd,deprecate(t,e){return t},addAbortListener:br().addAbortListener||function(e,r){if(e===void 0)throw new _i("signal","AbortSignal",e);Zo(e,"signal"),od(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Xc]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[td](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:rd.any||function(e){if(e.length===1)return e[0];let r=new nd,n=()=>r.abort();return e.forEach(i=>{Zo(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};yi.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Gt=v((rm,la)=>{"use strict";var{ArrayIsArray:gi,ArrayPrototypeIncludes:ra,ArrayPrototypeJoin:na,ArrayPrototypeMap:ad,NumberIsInteger:mi,NumberIsNaN:ld,NumberMAX_SAFE_INTEGER:ud,NumberMIN_SAFE_INTEGER:fd,NumberParseInt:cd,ObjectPrototypeHasOwnProperty:dd,RegExpPrototypeExec:ia,String:hd,StringPrototypeToUpperCase:pd,StringPrototypeTrim:_d}=L(),{hideStackFrames:ne,codes:{ERR_SOCKET_BAD_PORT:yd,ERR_INVALID_ARG_TYPE:V,ERR_INVALID_ARG_VALUE:Wt,ERR_OUT_OF_RANGE:ht,ERR_UNKNOWN_SIGNAL:Xo}}=H(),{normalizeEncoding:bd}=K(),{isAsyncFunction:gd,isArrayBufferView:md}=K().types,ea={};function wd(t){return t===(t|0)}function xd(t){return t===t>>>0}var Sd=/^[0-7]+$/,Ed="must be a 32-bit unsigned integer or an octal string";function Rd(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(ia(Sd,t)===null)throw new Wt(e,t,Ed);t=cd(t,8)}return sa(t,e),t}var Id=ne((t,e,r=fd,n=ud)=>{if(typeof t!="number")throw new V(e,"number",t);if(!mi(t))throw new ht(e,"an integer",t);if(t<r||t>n)throw new ht(e,`>= ${r} && <= ${n}`,t)}),Ad=ne((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new V(e,"number",t);if(!mi(t))throw new ht(e,"an integer",t);if(t<r||t>n)throw new ht(e,`>= ${r} && <= ${n}`,t)}),sa=ne((t,e,r=!1)=>{if(typeof t!="number")throw new V(e,"number",t);if(!mi(t))throw new ht(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new ht(e,`>= ${n} && <= ${i}`,t)});function wi(t,e){if(typeof t!="string")throw new V(e,"string",t)}function Td(t,e,r=void 0,n){if(typeof t!="number")throw new V(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&ld(t))throw new ht(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var vd=ne((t,e,r)=>{if(!ra(r,t)){let i="must be one of: "+na(ad(r,s=>typeof s=="string"?`'${s}'`:hd(s)),", ");throw new Wt(e,t,i)}});function oa(t,e){if(typeof t!="boolean")throw new V(e,"boolean",t)}function bi(t,e,r){return t==null||!dd(t,e)?r:t[e]}var jd=ne((t,e,r=null)=>{let n=bi(r,"allowArray",!1),i=bi(r,"allowFunction",!1);if(!bi(r,"nullable",!1)&&t===null||!n&&gi(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new V(e,"Object",t)}),Nd=ne((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new V(e,"a dictionary",t)}),Xr=ne((t,e,r=0)=>{if(!gi(t))throw new V(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Wt(e,t,n)}});function Pd(t,e){Xr(t,e);for(let r=0;r<t.length;r++)wi(t[r],`${e}[${r}]`)}function kd(t,e){Xr(t,e);for(let r=0;r<t.length;r++)oa(t[r],`${e}[${r}]`)}function Od(t,e){Xr(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new V(i,"AbortSignal",n);aa(n,i)}}function Ld(t,e="signal"){if(wi(t,e),ea[t]===void 0)throw ea[pd(t)]!==void 0?new Xo(t+" (signals must use all capital letters)"):new Xo(t)}var Bd=ne((t,e="buffer")=>{if(!md(t))throw new V(e,["Buffer","TypedArray","DataView"],t)});function Fd(t,e){let r=bd(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Wt("encoding",e,`is invalid for data of length ${n}`)}function Cd(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&_d(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new yd(e,t,r);return t|0}var aa=ne((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new V(e,"AbortSignal",t)}),Md=ne((t,e)=>{if(typeof t!="function")throw new V(e,"Function",t)}),Dd=ne((t,e)=>{if(typeof t!="function"||gd(t))throw new V(e,"Function",t)}),Ud=ne((t,e)=>{if(t!==void 0)throw new V(e,"undefined",t)});function $d(t,e,r){if(!ra(r,t))throw new V(e,`('${na(r,"|")}')`,t)}var qd=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ta(t,e){if(typeof t>"u"||!ia(qd,t))throw new Wt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Wd(t){if(typeof t=="string")return ta(t,"hints"),t;if(gi(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];ta(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Wt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}la.exports={isInt32:wd,isUint32:xd,parseFileMode:Rd,validateArray:Xr,validateStringArray:Pd,validateBooleanArray:kd,validateAbortSignalArray:Od,validateBoolean:oa,validateBuffer:Bd,validateDictionary:Nd,validateEncoding:Fd,validateFunction:Md,validateInt32:Ad,validateInteger:Id,validateNumber:Td,validateObject:jd,validateOneOf:vd,validatePlainFunction:Dd,validatePort:Cd,validateSignalName:Ld,validateString:wi,validateUint32:sa,validateUndefined:Ud,validateUnion:$d,validateAbortSignal:aa,validateLinkHeaderValue:Wd}});var He=v((nm,da)=>{var F=da.exports={},ye,be;function xi(){throw new Error("setTimeout has not been defined")}function Si(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ye=setTimeout:ye=xi}catch{ye=xi}try{typeof clearTimeout=="function"?be=clearTimeout:be=Si}catch{be=Si}})();function ua(t){if(ye===setTimeout)return setTimeout(t,0);if((ye===xi||!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 Gd(t){if(be===clearTimeout)return clearTimeout(t);if((be===Si||!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 ke=[],zt=!1,pt,en=-1;function zd(){!zt||!pt||(zt=!1,pt.length?ke=pt.concat(ke):en=-1,ke.length&&fa())}function fa(){if(!zt){var t=ua(zd);zt=!0;for(var e=ke.length;e;){for(pt=ke,ke=[];++en<e;)pt&&pt[en].run();en=-1,e=ke.length}pt=null,zt=!1,Gd(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];ke.push(new ca(t,e)),ke.length===1&&!zt&&ua(fa)};function ca(t,e){this.fun=t,this.array=e}ca.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Oe(){}F.on=Oe;F.addListener=Oe;F.once=Oe;F.off=Oe;F.removeListener=Oe;F.removeAllListeners=Oe;F.emit=Oe;F.prependListener=Oe;F.prependOnceListener=Oe;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=v((im,Ta)=>{"use strict";var{SymbolAsyncIterator:ha,SymbolIterator:pa,SymbolFor:_t}=L(),_a=_t("nodejs.stream.destroyed"),ya=_t("nodejs.stream.errored"),Ei=_t("nodejs.stream.readable"),Ri=_t("nodejs.stream.writable"),ba=_t("nodejs.stream.disturbed"),Hd=_t("nodejs.webstream.isClosedPromise"),Vd=_t("nodejs.webstream.controllerErrorFunction");function tn(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 rn(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 ga(t){return!!(t&&!ge(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function ma(t){return!!(t&&!ge(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function wa(t){return!!(t&&!ge(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Kd(t){return ga(t)||ma(t)||wa(t)}function Jd(t,e){return t==null?!1:e===!0?typeof t[ha]=="function":e===!1?typeof t[pa]=="function":typeof t[ha]=="function"||typeof t[pa]=="function"}function nn(t){if(!ge(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[_a]||n!=null&&n.destroyed)}function xa(t){if(!rn(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 Yd(t,e){if(!rn(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 Zd(t){if(!tn(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 Sa(t,e){if(!tn(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 Ea(t){return t&&t[Ei]!=null?t[Ei]:typeof t?.readable!="boolean"?null:nn(t)?!1:tn(t)&&t.readable&&!Sa(t)}function Ra(t){return t&&t[Ri]!=null?t[Ri]:typeof t?.writable!="boolean"?null:nn(t)?!1:rn(t)&&t.writable&&!xa(t)}function Xd(t,e){return ge(t)?nn(t)?!0:!(e?.readable!==!1&&Ea(t)||e?.writable!==!1&&Ra(t)):null}function eh(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 th(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 rh(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"&&Ia(t)?t._closed:null}function Ia(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Aa(t){return typeof t._sent100=="boolean"&&Ia(t)}function nh(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 ih(t){if(!ge(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Aa(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function sh(t){var e;return!!(t&&((e=t[ba])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function oh(t){var e,r,n,i,s,o,a,l,u,f;return!!(t&&((e=(r=(n=(i=(s=(o=t[ya])!==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))}Ta.exports={isDestroyed:nn,kIsDestroyed:_a,isDisturbed:sh,kIsDisturbed:ba,isErrored:oh,kIsErrored:ya,isReadable:Ea,kIsReadable:Ei,kIsClosedPromise:Hd,kControllerErrorFunction:Vd,kIsWritable:Ri,isClosed:rh,isDuplexNodeStream:Qd,isFinished:Xd,isIterable:Jd,isReadableNodeStream:tn,isReadableStream:ga,isReadableEnded:Zd,isReadableFinished:Sa,isReadableErrored:th,isNodeStream:ge,isWebStream:Kd,isWritable:Ra,isWritableNodeStream:rn,isWritableStream:ma,isWritableEnded:xa,isWritableFinished:Yd,isWritableErrored:eh,isServerRequest:nh,isServerResponse:Aa,willEmitClose:ih,isTransformStream:wa}});var Le=v((sm,ji)=>{"use strict";var Ve=He(),{AbortError:Fa,codes:ah}=H(),{ERR_INVALID_ARG_TYPE:lh,ERR_STREAM_PREMATURE_CLOSE:va}=ah,{kEmptyObject:Ai,once:Ti}=K(),{validateAbortSignal:uh,validateFunction:fh,validateObject:ch,validateBoolean:dh}=Gt(),{Promise:hh,PromisePrototypeThen:ph,SymbolDispose:Ca}=L(),{isClosed:_h,isReadable:ja,isReadableNodeStream:Ii,isReadableStream:yh,isReadableFinished:Na,isReadableErrored:Pa,isWritable:ka,isWritableNodeStream:Oa,isWritableStream:bh,isWritableFinished:La,isWritableErrored:Ba,isNodeStream:gh,willEmitClose:mh,kIsClosedPromise:wh}=me(),Ht;function xh(t){return t.setHeader&&typeof t.abort=="function"}var vi=()=>{};function Ma(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Ai):e==null?e=Ai:ch(e,"options"),fh(r,"callback"),uh(e.signal,"options.signal"),r=Ti(r),yh(t)||bh(t))return Sh(t,e,r);if(!gh(t))throw new lh("stream",["ReadableStream","WritableStream","Stream"],t);let s=(n=e.readable)!==null&&n!==void 0?n:Ii(t),o=(i=e.writable)!==null&&i!==void 0?i:Oa(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=mh(t)&&Ii(t)===s&&Oa(t)===o,c=La(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=Na(t,!1),y=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},_=A=>{r.call(t,A)},x=_h(t),b=()=>{x=!0;let A=Ba(t)||Pa(t);if(A&&typeof A!="boolean")return r.call(t,A);if(s&&!h&&Ii(t,!0)&&!Na(t,!1))return r.call(t,new va);if(o&&!c&&!La(t,!1))return r.call(t,new va);r.call(t)},g=()=>{x=!0;let A=Ba(t)||Pa(t);if(A&&typeof A!="boolean")return r.call(t,A);r.call(t)},S=()=>{t.req.on("finish",d)};xh(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?Ve.nextTick(b):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Ve.nextTick(g):(!s&&(!f||ja(t))&&(c||ka(t)===!1)||!o&&(!f||ka(t))&&(h||ja(t)===!1)||l&&t.req&&t.aborted)&&Ve.nextTick(g);let m=()=>{r=vi,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 Fa(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Ve.nextTick(A);else{Ht=Ht||K().addAbortListener;let Ae=Ht(e.signal,A),M=r;r=Ti((...It)=>{Ae[Ca](),M.apply(t,It)})}}return m}function Sh(t,e,r){let n=!1,i=vi;if(e.signal)if(i=()=>{n=!0,r.call(t,new Fa(void 0,{cause:e.signal.reason}))},e.signal.aborted)Ve.nextTick(i);else{Ht=Ht||K().addAbortListener;let o=Ht(e.signal,i),a=r;r=Ti((...l)=>{o[Ca](),a.apply(t,l)})}let s=(...o)=>{n||Ve.nextTick(()=>r.apply(t,o))};return ph(t[wh].promise,s,s),vi}function Eh(t,e){var r;let n=!1;return e===null&&(e=Ai),(r=e)!==null&&r!==void 0&&r.cleanup&&(dh(e.cleanup,"cleanup"),n=e.cleanup),new hh((i,s)=>{let o=Ma(t,e,a=>{n&&o(),a?s(a):i()})})}ji.exports=Ma;ji.exports.finished=Eh});var yt=v((om,Ha)=>{"use strict";var we=He(),{aggregateTwoErrors:Rh,codes:{ERR_MULTIPLE_CALLBACK:Ih},AbortError:Ah}=H(),{Symbol:$a}=L(),{kIsDestroyed:Th,isDestroyed:vh,isFinished:jh,isServerRequest:Nh}=me(),qa=$a("kDestroy"),Ni=$a("kConstruct");function Wa(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Ph(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):(Wa(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Da(this,t,e):this.once(qa,function(s){Da(this,Rh(s,t),e)}),this)}function Da(t,e,r){let n=!1;function i(s){if(n)return;n=!0;let o=t._readableState,a=t._writableState;Wa(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?we.nextTick(kh,t,s):we.nextTick(Ga,t)}try{t._destroy(e||null,i)}catch(s){i(s)}}function kh(t,e){Pi(t,e),Ga(t)}function Ga(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 Pi(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 Oh(){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 ki(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(Pi,t,e):Pi(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(Ni,e),!(t.listenerCount(Ni)>1)&&we.nextTick(Bh,t)}function Bh(t){let e=!1;function r(n){if(e){ki(t,n??new Ih);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(qa,n):n?ki(t,n,!0):we.nextTick(Fh,t)}try{t._construct(n=>{we.nextTick(r,n)})}catch(n){we.nextTick(r,n)}}function Fh(t){t.emit(Ni)}function Ua(t){return t?.setHeader&&typeof t.abort=="function"}function za(t){t.emit("close")}function Ch(t,e){t.emit("error",e),we.nextTick(za,t)}function Mh(t,e){!t||vh(t)||(!e&&!jh(t)&&(e=new Ah),Nh(t)?(t.socket=null,t.destroy(e)):Ua(t)?t.abort():Ua(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?we.nextTick(Ch,t,e):we.nextTick(za,t),t.destroyed||(t[Th]=!0))}Ha.exports={construct:Lh,destroyer:Mh,destroy:Ph,undestroy:Oh,errorOrDestroy:ki}});var an=v((am,Qa)=>{"use strict";var{ArrayIsArray:Dh,ObjectSetPrototypeOf:Va}=L(),{EventEmitter:sn}=br();function on(t){sn.call(this,t)}Va(on.prototype,sn.prototype);Va(on,sn);on.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(),sn.listenerCount(this,"error")===0&&this.emit("error",f)}Oi(r,"error",l),Oi(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 Oi(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]]}Qa.exports={Stream:on,prependListener:Oi}});var gr=v((lm,ln)=>{"use strict";var{SymbolDispose:Uh}=L(),{AbortError:Ka,codes:$h}=H(),{isNodeStream:Ja,isWebStream:qh,kControllerErrorFunction:Wh}=me(),Gh=Le(),{ERR_INVALID_ARG_TYPE:Ya}=$h,Li,zh=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Ya(e,"AbortSignal",t)};ln.exports.addAbortSignal=function(e,r){if(zh(e,"signal"),!Ja(r)&&!qh(r))throw new Ya("stream",["ReadableStream","WritableStream","Stream"],r);return ln.exports.addAbortSignalNoValidate(e,r)};ln.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Ja(e)?()=>{e.destroy(new Ka(void 0,{cause:t.reason}))}:()=>{e[Wh](new Ka(void 0,{cause:t.reason}))};if(t.aborted)r();else{Li=Li||K().addAbortListener;let n=Li(t,r);Gh(e,n[Uh])}return e}});var el=v((fm,Xa)=>{"use strict";var{StringPrototypeSlice:Za,SymbolIterator:Hh,TypedArrayPrototypeSet:un,Uint8Array:Vh}=L(),{Buffer:Bi}=pe(),{inspect:Qh}=K();Xa.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 Bi.alloc(0);let r=Bi.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)un(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}*[Hh](){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+=Za(s,0,e),this.head=n,n.data=Za(s,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Bi.allocUnsafe(e),n=e,i=this.head,s=0;do{let o=i.data;if(e>o.length)un(r,o,n-e),e-=o.length;else{e===o.length?(un(r,o,n-e),++s,i.next?this.head=i.next:this.head=this.tail=null):(un(r,new Vh(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 mr=v((cm,il)=>{"use strict";var{MathFloor:Kh,NumberIsInteger:Jh}=L(),{validateInteger:Yh}=Gt(),{ERR_INVALID_ARG_VALUE:Zh}=H().codes,tl=16*1024,rl=16;function Xh(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function nl(t){return t?rl:tl}function ep(t,e){Yh(e,"value",0),t?rl=e:tl=e}function tp(t,e,r,n){let i=Xh(e,n,r);if(i!=null){if(!Jh(i)||i<0){let s=n?`options.${r}`:"options.highWaterMark";throw new Zh(s,i)}return Kh(i)}return nl(t.objectMode)}il.exports={getHighWaterMark:tp,getDefaultHighWaterMark:nl,setDefaultHighWaterMark:ep}});var al=v((Fi,ol)=>{var fn=pe(),xe=fn.Buffer;function sl(t,e){for(var r in t)e[r]=t[r]}xe.from&&xe.alloc&&xe.allocUnsafe&&xe.allocUnsafeSlow?ol.exports=fn:(sl(fn,Fi),Fi.Buffer=bt);function bt(t,e,r){return xe(t,e,r)}bt.prototype=Object.create(xe.prototype);sl(xe,bt);bt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xe(t,e,r)};bt.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};bt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xe(t)};bt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return fn.SlowBuffer(t)}});var fl=v(ul=>{"use strict";var Mi=al().Buffer,ll=Mi.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function rp(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 np(t){var e=rp(t);if(typeof e!="string"&&(Mi.isEncoding===ll||!ll(t)))throw new Error("Unknown encoding: "+t);return e||t}ul.StringDecoder=wr;function wr(t){this.encoding=np(t);var e;switch(this.encoding){case"utf16le":this.text=up,this.end=fp,e=4;break;case"utf8":this.fillLast=op,e=4;break;case"base64":this.text=cp,this.end=dp,e=3;break;default:this.write=hp,this.end=pp;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Mi.allocUnsafe(e)}wr.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||""};wr.prototype.end=lp;wr.prototype.text=ap;wr.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 Ci(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function ip(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Ci(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Ci(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Ci(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function sp(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 op(t){var e=this.lastTotal-this.lastNeed,r=sp(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 ap(t,e){var r=ip(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 lp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function up(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 fp(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 cp(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 dp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function hp(t){return t.toString(this.encoding)}function pp(t){return t&&t.length?this.write(t):""}});var Di=v((hm,pl)=>{"use strict";var cl=He(),{PromisePrototypeThen:_p,SymbolAsyncIterator:dl,SymbolIterator:hl}=L(),{Buffer:yp}=pe(),{ERR_INVALID_ARG_TYPE:bp,ERR_STREAM_NULL_VALUES:gp}=H().codes;function mp(t,e,r){let n;if(typeof e=="string"||e instanceof yp)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[dl])i=!0,n=e[dl]();else if(e&&e[hl])i=!1,n=e[hl]();else throw new bp("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){_p(a(u),()=>cl.nextTick(f,u),c=>cl.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 gp;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}pl.exports=mp});var Sr=v((pm,kl)=>{"use strict";var ae=He(),{ArrayPrototypeIndexOf:wp,NumberIsInteger:xp,NumberIsNaN:Sp,NumberParseInt:Ep,ObjectDefineProperties:Vi,ObjectKeys:Rp,ObjectSetPrototypeOf:bl,Promise:gl,SafeSet:Ip,SymbolAsyncDispose:Ap,SymbolAsyncIterator:Tp,Symbol:vp}=L();kl.exports=E;E.ReadableState=pn;var{EventEmitter:jp}=br(),{Stream:Qe,prependListener:Np}=an(),{Buffer:Ui}=pe(),{addAbortSignal:Pp}=gr(),ml=Le(),I=K().debuglog("stream",t=>{I=t}),kp=el(),Kt=yt(),{getHighWaterMark:Op,getDefaultHighWaterMark:Lp}=mr(),{aggregateTwoErrors:_l,codes:{ERR_INVALID_ARG_TYPE:Bp,ERR_METHOD_NOT_IMPLEMENTED:Fp,ERR_OUT_OF_RANGE:Cp,ERR_STREAM_PUSH_AFTER_EOF:Mp,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Dp},AbortError:Up}=H(),{validateObject:$p}=Gt(),gt=vp("kPaused"),{StringDecoder:wl}=fl(),qp=Di();bl(E.prototype,Qe.prototype);bl(E,Qe);var $i=()=>{},{errorOrDestroy:Vt}=Kt,Qt=1,Wp=2,xl=4,xr=8,Sl=16,cn=32,dn=64,El=128,Gp=256,zp=512,Hp=1024,zi=2048,Hi=4096,Vp=8192,Qp=16384,Kp=32768,Rl=65536,Jp=1<<17,Yp=1<<18;function D(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Vi(pn.prototype,{objectMode:D(Qt),ended:D(Wp),endEmitted:D(xl),reading:D(xr),constructed:D(Sl),sync:D(cn),needReadable:D(dn),emittedReadable:D(El),readableListening:D(Gp),resumeScheduled:D(zp),errorEmitted:D(Hp),emitClose:D(zi),autoDestroy:D(Hi),destroyed:D(Vp),closed:D(Qp),closeEmitted:D(Kp),multiAwaitDrain:D(Rl),readingMore:D(Jp),dataEmitted:D(Yp)});function pn(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.state=zi|Hi|Sl|cn,t&&t.objectMode&&(this.state|=Qt),r&&t&&t.readableObjectMode&&(this.state|=Qt),this.highWaterMark=t?Op(this,t,"readableHighWaterMark",r):Lp(!1),this.buffer=new kp,this.length=0,this.pipes=[],this.flowing=null,this[gt]=null,t&&t.emitClose===!1&&(this.state&=~zi),t&&t.autoDestroy===!1&&(this.state&=~Hi),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new wl(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 pn(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&&Pp(t.signal,this)),Qe.call(this,t),Kt.construct(this,()=>{this._readableState.needReadable&&hn(this,this._readableState)})}E.prototype.destroy=Kt.destroy;E.prototype._undestroy=Kt.undestroy;E.prototype._destroy=function(t,e){e(t)};E.prototype[jp.captureRejectionSymbol]=function(t){this.destroy(t)};E.prototype[Ap]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Up,this.destroy(t)),new gl((e,r)=>ml(this,n=>n&&n!==t?r(n):e(null)))};E.prototype.push=function(t,e){return Il(this,t,e,!1)};E.prototype.unshift=function(t,e){return Il(this,t,e,!0)};function Il(t,e,r,n){I("readableAddChunk",e);let i=t._readableState,s;if((i.state&Qt)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Ui.from(e,r).toString(i.encoding):(e=Ui.from(e,r),r=""))):e instanceof Ui?r="":Qe._isUint8Array(e)?(e=Qe._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Bp("chunk",["string","Buffer","Uint8Array"],e))),s)Vt(t,s);else if(e===null)i.state&=~xr,e_(t,i);else if((i.state&Qt)!==0||e&&e.length>0)if(n)if((i.state&xl)!==0)Vt(t,new Dp);else{if(i.destroyed||i.errored)return!1;qi(t,i,e,!0)}else if(i.ended)Vt(t,new Mp);else{if(i.destroyed||i.errored)return!1;i.state&=~xr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?qi(t,i,e,!1):hn(t,i)):qi(t,i,e,!1)}else n||(i.state&=~xr,hn(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function qi(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Rl)!==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&dn)!==0&&_n(t)),hn(t,e)}E.prototype.isPaused=function(){let t=this._readableState;return t[gt]===!0||t.flowing===!1};E.prototype.setEncoding=function(t){let e=new wl(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 Zp=1073741824;function Xp(t){if(t>Zp)throw new Cp("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function yl(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Qt)!==0?1:Sp(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:xp(t)||(t=Ep(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Xp(t)),t!==0&&(e.state&=~El),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?Wi(this):_n(this),null;if(t=yl(t,e),t===0&&e.ended)return e.length===0&&Wi(this),null;let n=(e.state&dn)!==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|=xr|cn,e.length===0&&(e.state|=dn);try{this._read(e.highWaterMark)}catch(s){Vt(this,s)}e.state&=~cn,e.reading||(t=yl(r,e))}let i;return t>0?i=Nl(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&&Wi(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function e_(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?_n(t):(e.needReadable=!1,e.emittedReadable=!0,Al(t))}}function _n(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(Al,t))}function Al(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,vl(t)}function hn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,ae.nextTick(t_,t,e))}function t_(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 Fp("_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 Ip(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=r_(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?Vt(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 r_(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=wp(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=Qe.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?_n(this):n.reading||ae.nextTick(n_,this)),r};E.prototype.addListener=E.prototype.on;E.prototype.removeListener=function(t,e){let r=Qe.prototype.removeListener.call(this,t,e);return t==="readable"&&ae.nextTick(Tl,this),r};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(t){let e=Qe.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&ae.nextTick(Tl,this),e};function Tl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[gt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function n_(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,i_(this,t)),t[gt]=!1,this};function i_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,ae.nextTick(s_,t,e))}function s_(t,e){I("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),vl(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[gt]=!0,this};function vl(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=>{Vt(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Rp(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[Tp]=function(){return jl(this)};E.prototype.iterator=function(t){return t!==void 0&&$p(t,"options"),jl(this,t)};function jl(t,e){typeof t.read!="function"&&(t=E.wrap(t,{objectMode:!0}));let r=o_(t,e);return r.stream=t,r}async function*o_(t,e){let r=$i;function n(o){this===t?(r(),r=$i):r=o}t.on("readable",n);let i,s=ml(t,{writable:!1},o=>{i=o?_l(i,o):null,r(),r=$i});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 gl(n)}}}catch(o){throw i=_l(i,o),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Kt.destroyer(t,null):(t.off("readable",n),s())}}Vi(E.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});Vi(pn.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[gt]!==!1},set(t){this[gt]=!!t}}});E._fromList=Nl;function Nl(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function Wi(t){let e=t._readableState;I("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,ae.nextTick(a_,e,t))}function a_(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(l_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function l_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}E.from=function(t,e){return qp(E,t,e)};var Gi;function Pl(){return Gi===void 0&&(Gi={}),Gi}E.fromWeb=function(t,e){return Pl().newStreamReadableFromReadableStream(t,e)};E.toWeb=function(t,e){return Pl().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){Kt.destroyer(t,i),s(i)}}).wrap(t)}});var wn=v((_m,Gl)=>{"use strict";var mt=He(),{ArrayPrototypeSlice:Bl,Error:u_,FunctionPrototypeSymbolHasInstance:Fl,ObjectDefineProperty:Cl,ObjectDefineProperties:f_,ObjectSetPrototypeOf:Ml,StringPrototypeToLowerCase:c_,Symbol:d_,SymbolHasInstance:h_}=L();Gl.exports=B;B.WritableState=Ir;var{EventEmitter:p_}=br(),Er=an().Stream,{Buffer:yn}=pe(),mn=yt(),{addAbortSignal:__}=gr(),{getHighWaterMark:y_,getDefaultHighWaterMark:b_}=mr(),{ERR_INVALID_ARG_TYPE:g_,ERR_METHOD_NOT_IMPLEMENTED:m_,ERR_MULTIPLE_CALLBACK:Dl,ERR_STREAM_CANNOT_PIPE:w_,ERR_STREAM_DESTROYED:Rr,ERR_STREAM_ALREADY_FINISHED:x_,ERR_STREAM_NULL_VALUES:S_,ERR_STREAM_WRITE_AFTER_END:E_,ERR_UNKNOWN_ENCODING:Ul}=H().codes,{errorOrDestroy:Jt}=mn;Ml(B.prototype,Er.prototype);Ml(B,Er);function Ji(){}var Yt=d_("kOnFinished");function Ir(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?y_(this,t,"writableHighWaterMark",r):b_(!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=I_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,gn(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[Yt]=[]}function gn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Ir.prototype.getBuffer=function(){return Bl(this.buffered,this.bufferedIndex)};Cl(Ir.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function B(t){let e=this instanceof Se();if(!e&&!Fl(B,this))return new B(t);this._writableState=new Ir(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&&__(t.signal,this)),Er.call(this,t),mn.construct(this,()=>{let r=this._writableState;r.writing||Zi(this,r),Xi(this,r)})}Cl(B,h_,{__proto__:null,value:function(t){return Fl(this,t)?!0:this!==B?!1:t&&t._writableState instanceof Ir}});B.prototype.pipe=function(){Jt(this,new w_)};function $l(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"&&!yn.isEncoding(r))throw new Ul(r);typeof n!="function"&&(n=Ji)}if(e===null)throw new S_;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=yn.from(e,r),r="buffer");else if(e instanceof yn)r="buffer";else if(Er._isUint8Array(e))e=Er._uint8ArrayToBuffer(e),r="buffer";else throw new g_("chunk",["string","Buffer","Uint8Array"],e);let s;return i.ending?s=new E_:i.destroyed&&(s=new Rr("write")),s?(mt.nextTick(n,s),Jt(t,s,!0),s):(i.pendingcb++,R_(t,i,e,r,n))}B.prototype.write=function(t,e,r){return $l(this,t,e,r)===!0};B.prototype.cork=function(){this._writableState.corked++};B.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Zi(this,t))};B.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=c_(e)),!yn.isEncoding(e))throw new Ul(e);return this._writableState.defaultEncoding=e,this};function R_(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!==Ji&&(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 Ol(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Rr("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function Ll(t,e,r,n){--e.pendingcb,n(r),Yi(e),Jt(t,r)}function I_(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Jt(t,new Dl);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?mt.nextTick(Ll,t,r,e,i):Ll(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&Zi(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},mt.nextTick(A_,r.afterWriteTickInfo)):ql(t,r,1,i))}function A_({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,ql(t,e,r,n)}function ql(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&&Yi(e),Xi(t,e)}function Yi(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 Rr("write"))}let r=t[Yt].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Rr("end"))}gn(t)}function Zi(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?Ji:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:Bl(r,o);l.allBuffers=e.allBuffers,Ol(t,e,!0,e.length,l,"",a),gn(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=i?1:a.length;Ol(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?gn(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}B.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new m_("_write()")};B.prototype._writev=null;B.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=$l(this,t,e);s instanceof u_&&(i=s)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Xi(this,n,!0),n.ended=!0):n.finished?i=new x_("end"):n.destroyed&&(i=new Rr("end"))),typeof r=="function"&&(i||n.finished?mt.nextTick(r,i):n[Yt].push(r)),this};function bn(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 T_(t,e){let r=!1;function n(i){if(r){Jt(t,i??Dl());return}if(r=!0,e.pendingcb--,i){let s=e[Yt].splice(0);for(let o=0;o<s.length;o++)s[o](i);Jt(t,i,e.sync)}else bn(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,mt.nextTick(Ki,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function v_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,T_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Xi(t,e,r){bn(e)&&(v_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,mt.nextTick((n,i)=>{bn(i)?Ki(n,i):i.pendingcb--},t,e)):bn(e)&&(e.pendingcb++,Ki(t,e))))}function Ki(t,e){e.pendingcb--,e.finished=!0;let r=e[Yt].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()}}f_(B.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 j_=mn.destroy;B.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Yt].length)&&mt.nextTick(Yi,r),j_.call(this,t,e),this};B.prototype._undestroy=mn.undestroy;B.prototype._destroy=function(t,e){e(t)};B.prototype[p_.captureRejectionSymbol]=function(t){this.destroy(t)};var Qi;function Wl(){return Qi===void 0&&(Qi={}),Qi}B.fromWeb=function(t,e){return Wl().newStreamWritableFromWritableStream(t,e)};B.toWeb=function(t){return Wl().newWritableStreamFromStreamWritable(t)}});var su=v((ym,iu)=>{var es=He(),N_=pe(),{isReadable:P_,isWritable:k_,isIterable:zl,isNodeStream:O_,isReadableNodeStream:Hl,isWritableNodeStream:Vl,isDuplexNodeStream:L_,isReadableStream:Ql,isWritableStream:Kl}=me(),Jl=Le(),{AbortError:ru,codes:{ERR_INVALID_ARG_TYPE:B_,ERR_INVALID_RETURN_VALUE:Yl}}=H(),{destroyer:Xt}=yt(),F_=Se(),nu=Sr(),C_=wn(),{createDeferredPromise:Zl}=K(),Xl=Di(),eu=globalThis.Blob||N_.Blob,M_=typeof eu<"u"?function(e){return e instanceof eu}:function(e){return!1},D_=globalThis.AbortController||$t().AbortController,{FunctionPrototypeCall:tu}=L(),Ke=class extends F_{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)}};iu.exports=function t(e,r){if(L_(e))return e;if(Hl(e))return Zt({readable:e});if(Vl(e))return Zt({writable:e});if(O_(e))return Zt({writable:!1,readable:!1});if(Ql(e))return Zt({readable:nu.fromWeb(e)});if(Kl(e))return Zt({writable:C_.fromWeb(e)});if(typeof e=="function"){let{value:i,write:s,final:o,destroy:a}=U_(e);if(zl(i))return Xl(Ke,i,{objectMode:!0,write:s,final:o,destroy:a});let l=i?.then;if(typeof l=="function"){let u,f=tu(l,i,c=>{if(c!=null)throw new Yl("nully","body",c)},c=>{Xt(u,c)});return u=new Ke({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,es.nextTick(c,null)}catch(d){es.nextTick(c,d)}})},destroy:a})}throw new Yl("Iterable, AsyncIterable or AsyncFunction",r,i)}if(M_(e))return t(e.arrayBuffer());if(zl(e))return Xl(Ke,e,{objectMode:!0,writable:!1});if(Ql(e?.readable)&&Kl(e?.writable))return Ke.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?Hl(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?Vl(e?.writable)?e?.writable:t(e.writable):void 0;return Zt({readable:i,writable:s})}let n=e?.then;if(typeof n=="function"){let i;return tu(n,e,s=>{s!=null&&i.push(s),i.push(null)},s=>{Xt(i,s)}),i=new Ke({objectMode:!0,writable:!1,read(){}})}throw new B_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function U_(t){let{promise:e,resolve:r}=Zl(),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(es.nextTick(u),l)return;if(i.aborted)throw new ru(void 0,{cause:i.reason});({promise:e,resolve:r}=Zl()),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 Zt(t){let e=t.readable&&typeof t.readable.read!="function"?nu.wrap(t.readable):t.readable,r=t.writable,n=!!P_(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 Ke({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(Jl(r,c=>{i=!1,c&&Xt(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&&(Jl(e,c=>{n=!1,c&&Xt(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 ru),a=null,s=null,o=null,l===null?d(c):(l=d,Xt(r,c),Xt(e,c))},u}});var Se=v((bm,lu)=>{"use strict";var{ObjectDefineProperties:$_,ObjectGetOwnPropertyDescriptor:Be,ObjectKeys:q_,ObjectSetPrototypeOf:ou}=L();lu.exports=le;var ns=Sr(),ie=wn();ou(le.prototype,ns.prototype);ou(le,ns);{let t=q_(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);ns.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}$_(le.prototype,{writable:{__proto__:null,...Be(ie.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Be(ie.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Be(ie.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Be(ie.prototype,"writableBuffer")},writableLength:{__proto__:null,...Be(ie.prototype,"writableLength")},writableFinished:{__proto__:null,...Be(ie.prototype,"writableFinished")},writableCorked:{__proto__:null,...Be(ie.prototype,"writableCorked")},writableEnded:{__proto__:null,...Be(ie.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Be(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 ts;function au(){return ts===void 0&&(ts={}),ts}le.fromWeb=function(t,e){return au().newStreamDuplexFromReadableWritablePair(t,e)};le.toWeb=function(t){return au().newReadableWritablePairFromDuplex(t)};var rs;le.from=function(t){return rs||(rs=su()),rs(t,"body")}});var os=v((gm,fu)=>{"use strict";var{ObjectSetPrototypeOf:uu,Symbol:W_}=L();fu.exports=Fe;var{ERR_METHOD_NOT_IMPLEMENTED:G_}=H().codes,ss=Se(),{getHighWaterMark:z_}=mr();uu(Fe.prototype,ss.prototype);uu(Fe,ss);var Ar=W_("kCallback");function Fe(t){if(!(this instanceof Fe))return new Fe(t);let e=t?z_(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ss.call(this,t),this._readableState.sync=!1,this[Ar]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",H_)}function is(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 H_(){this._final!==is&&is.call(this)}Fe.prototype._final=is;Fe.prototype._transform=function(t,e,r){throw new G_("_transform()")};Fe.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[Ar]=r})};Fe.prototype._read=function(){if(this[Ar]){let t=this[Ar];this[Ar]=null,t()}}});var ls=v((mm,du)=>{"use strict";var{ObjectSetPrototypeOf:cu}=L();du.exports=er;var as=os();cu(er.prototype,as.prototype);cu(er,as);function er(t){if(!(this instanceof er))return new er(t);as.call(this,t)}er.prototype._transform=function(t,e,r){r(null,t)}});var Rn=v((wm,bu)=>{var Tr=He(),{ArrayIsArray:V_,Promise:Q_,SymbolAsyncIterator:K_,SymbolDispose:J_}=L(),En=Le(),{once:Y_}=K(),Z_=yt(),hu=Se(),{aggregateTwoErrors:X_,codes:{ERR_INVALID_ARG_TYPE:bs,ERR_INVALID_RETURN_VALUE:us,ERR_MISSING_ARGS:ey,ERR_STREAM_DESTROYED:ty,ERR_STREAM_PREMATURE_CLOSE:ry},AbortError:ny}=H(),{validateFunction:iy,validateAbortSignal:sy}=Gt(),{isIterable:wt,isReadable:fs,isReadableNodeStream:Sn,isNodeStream:pu,isTransformStream:tr,isWebStream:oy,isReadableStream:cs,isReadableFinished:ay}=me(),ly=globalThis.AbortController||$t().AbortController,ds,hs,ps;function _u(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=En(t,{readable:e,writable:r},s=>{n=!s});return{destroy:s=>{n||(n=!0,Z_.destroyer(t,s||new ty("pipe")))},cleanup:i}}function uy(t){return iy(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function _s(t){if(wt(t))return t;if(Sn(t))return fy(t);throw new bs("val",["Readable","Iterable","AsyncIterable"],t)}async function*fy(t){hs||(hs=Sr()),yield*hs.prototype[K_].call(t)}async function xn(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=En(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?X_(i,u):u)}finally{l(),e.off("drain",o)}}async function ys(t,e,r,{end:n}){tr(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 cy(...t){return yu(t,Y_(uy(t)))}function yu(t,e,r){if(t.length===1&&V_(t[0])&&(t=t[0]),t.length<2)throw new ey("streams");let n=new ly,i=n.signal,s=r?.signal,o=[];sy(s,"options.signal");function a(){y(new ny)}ps=ps||K().addAbortListener;let l;s&&(l=ps(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[J_](),n.abort(),m&&(u||o.forEach(Ae=>Ae()),Tr.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,M=A||r?.end!==!1,It=S===t.length-1;if(pu(m)){let J=function(Te){Te&&Te.name!=="AbortError"&&Te.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(Te)};var g=J;if(M){let{destroy:Te,cleanup:Ln}=_u(m,A,Ae);c.push(Te),fs(m)&&It&&o.push(Ln)}m.on("error",J),fs(m)&&It&&o.push(()=>{m.removeListener("error",J)})}if(S===0)if(typeof m=="function"){if(_=m({signal:i}),!wt(_))throw new us("Iterable, AsyncIterable or Stream","source",_)}else wt(m)||Sn(m)||tr(m)?_=m:_=hu.from(m);else if(typeof m=="function"){if(tr(_)){var x;_=_s((x=_)===null||x===void 0?void 0:x.readable)}else _=_s(_);if(_=m(_,{signal:i}),A){if(!wt(_,!0))throw new us("AsyncIterable",`transform[${S-1}]`,_)}else{var b;ds||(ds=ls());let J=new ds({objectMode:!0}),Te=(b=_)===null||b===void 0?void 0:b.then;if(typeof Te=="function")d++,Te.call(_,De=>{f=De,De!=null&&J.write(De),M&&J.end(),Tr.nextTick(h)},De=>{J.destroy(De),Tr.nextTick(h,De)});else if(wt(_,!0))d++,xn(_,J,h,{end:M});else if(cs(_)||tr(_)){let De=_.readable||_;d++,xn(De,J,h,{end:M})}else throw new us("AsyncIterable or Promise","destination",_);_=J;let{destroy:Ln,cleanup:nf}=_u(_,!1,!0);c.push(Ln),It&&o.push(nf)}}else if(pu(m)){if(Sn(_)){d+=2;let J=dy(_,m,h,{end:M});fs(m)&&It&&o.push(J)}else if(tr(_)||cs(_)){let J=_.readable||_;d++,xn(J,m,h,{end:M})}else if(wt(_))d++,xn(_,m,h,{end:M});else throw new bs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=m}else if(oy(m)){if(Sn(_))d++,ys(_s(_),m,h,{end:M});else if(cs(_)||wt(_))d++,ys(_,m,h,{end:M});else if(tr(_))d++,ys(_.readable,m,h,{end:M});else throw new bs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=m}else _=hu.from(m)}return(i!=null&&i.aborted||s!=null&&s.aborted)&&Tr.nextTick(a),_}function dy(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new ry)}),t.pipe(e,{end:!1}),n){let o=function(){i=!0,e.end()};var s=o;ay(t)?Tr.nextTick(o):t.once("end",o)}else r();return En(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)}),En(e,{readable:!1,writable:!0},r)}bu.exports={pipelineImpl:yu,pipeline:cy}});var ms=v((xm,Eu)=>{"use strict";var{pipeline:hy}=Rn(),In=Se(),{destroyer:py}=yt(),{isNodeStream:An,isReadable:gu,isWritable:mu,isWebStream:gs,isTransformStream:xt,isWritableStream:wu,isReadableStream:xu}=me(),{AbortError:_y,codes:{ERR_INVALID_ARG_VALUE:Su,ERR_MISSING_ARGS:yy}}=H(),by=Le();Eu.exports=function(...e){if(e.length===0)throw new yy("streams");if(e.length===1)return In.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=In.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=In.from(e[h])}for(let h=0;h<e.length;++h)if(!(!An(e[h])&&!gs(e[h]))){if(h<e.length-1&&!(gu(e[h])||xu(e[h])||xt(e[h])))throw new Su(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(mu(e[h])||wu(e[h])||xt(e[h])))throw new Su(`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=hy(e,l),c=!!(mu(u)||wu(u)||xt(u)),d=!!(gu(f)||xu(f)||xt(f));if(a=new In({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(An(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(gs(u)){let _=(xt(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=xt(f)?f.readable:f;by(h,()=>{if(i){let y=i;i=null,y()}})}if(d){if(An(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(gs(f)){let y=(xt(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 _y),s=null,n=null,i=null,o===null?y(h):(o=y,An(f)&&py(f,h))},a}});var Ou=v((Sm,Ss)=>{"use strict";var gy=globalThis.AbortController||$t().AbortController,{codes:{ERR_INVALID_ARG_VALUE:my,ERR_INVALID_ARG_TYPE:vr,ERR_MISSING_ARGS:wy,ERR_OUT_OF_RANGE:xy},AbortError:Ee}=H(),{validateAbortSignal:St,validateInteger:Ru,validateObject:Et}=Gt(),Sy=L().Symbol("kWeak"),Ey=L().Symbol("kResistStopPropagation"),{finished:Ry}=Le(),Iy=ms(),{addAbortSignalNoValidate:Ay}=gr(),{isWritable:Ty,isNodeStream:vy}=me(),{deprecate:jy}=K(),{ArrayPrototypePush:Ny,Boolean:Py,MathFloor:Iu,Number:ky,NumberIsNaN:Oy,Promise:Au,PromiseReject:Tu,PromiseResolve:Ly,PromisePrototypeThen:vu,Symbol:Nu}=L(),Tn=Nu("kEmpty"),ju=Nu("kEof");function By(t,e){if(e!=null&&Et(e,"options"),e?.signal!=null&&St(e.signal,"options.signal"),vy(t)&&!Ty(t))throw new my("stream",t,"must be writable");let r=Iy(this,t);return e!=null&&e.signal&&Ay(e.signal,r),r}function vn(t,e){if(typeof t!="function")throw new vr("fn",["Function","AsyncFunction"],t);e!=null&&Et(e,"options"),e?.signal!=null&&St(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Iu(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Iu(e.highWaterMark)),Ru(r,"options.concurrency",1),Ru(n,"options.highWaterMark",0),n+=r,async function*(){let s=K().AbortSignalAny([e?.signal].filter(Py)),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===Tn)continue;b=Ly(b)}catch(g){b=Tu(g)}d+=1,vu(b,y,h),a.push(b),u&&(u(),u=null),!c&&(a.length>=n||d>=r)&&await new Au(g=>{f=g})}a.push(ju)}catch(b){let g=Tu(b);vu(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===ju)return;if(s.aborted)throw new Ee;b!==Tn&&(yield b),a.shift(),_()}await new Au(b=>{u=b})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function Fy(t=void 0){return t!=null&&Et(t,"options"),t?.signal!=null&&St(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 Pu(t,e=void 0){for await(let r of xs.call(this,t,e))return!0;return!1}async function Cy(t,e=void 0){if(typeof t!="function")throw new vr("fn",["Function","AsyncFunction"],t);return!await Pu.call(this,async(...r)=>!await t(...r),e)}async function My(t,e){for await(let r of xs.call(this,t,e))return r}async function Dy(t,e){if(typeof t!="function")throw new vr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),Tn}for await(let n of vn.call(this,r,e));}function xs(t,e){if(typeof t!="function")throw new vr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:Tn}return vn.call(this,r,e)}var ws=class extends wy{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Uy(t,e,r){var n;if(typeof t!="function")throw new vr("reducer",["Function","AsyncFunction"],t);r!=null&&Et(r,"options"),r?.signal!=null&&St(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 Ry(this.destroy(u)),u}let s=new gy,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[Sy]:this,[Ey]:!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 ws}finally{s.abort()}return e}async function $y(t){t!=null&&Et(t,"options"),t?.signal!=null&&St(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 qy(t,e){let r=vn.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function ku(t){if(t=ky(t),Oy(t))return 0;if(t<0)throw new xy("number",">= 0",t);return t}function Wy(t,e=void 0){return e!=null&&Et(e,"options"),e?.signal!=null&&St(e.signal,"options.signal"),t=ku(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 Gy(t,e=void 0){return e!=null&&Et(e,"options"),e?.signal!=null&&St(e.signal,"options.signal"),t=ku(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)}Ss.exports.streamReturningOperators={asIndexedPairs:jy(Fy,"readable.asIndexedPairs will be removed in a future version."),drop:Wy,filter:xs,flatMap:qy,map:vn,take:Gy,compose:By};Ss.exports.promiseReturningOperators={every:Cy,forEach:Dy,reduce:Uy,toArray:$y,some:Pu,find:My}});var Es=v((Em,Lu)=>{"use strict";var{ArrayPrototypePop:zy,Promise:Hy}=L(),{isIterable:Vy,isNodeStream:Qy,isWebStream:Ky}=me(),{pipelineImpl:Jy}=Rn(),{finished:Yy}=Le();Rs();function Zy(...t){return new Hy((e,r)=>{let n,i,s=t[t.length-1];if(s&&typeof s=="object"&&!Qy(s)&&!Vy(s)&&!Ky(s)){let o=zy(t);n=o.signal,i=o.end}Jy(t,(o,a)=>{o?r(o):e(a)},{signal:n,end:i})})}Lu.exports={finished:Yy,pipeline:Zy}});var Rs=v((Rm,Wu)=>{"use strict";var{Buffer:Xy}=pe(),{ObjectDefineProperty:Ce,ObjectKeys:Cu,ReflectApply:Mu}=L(),{promisify:{custom:Du}}=K(),{streamReturningOperators:Bu,promiseReturningOperators:Fu}=Ou(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Uu}}=H(),eb=ms(),{setDefaultHighWaterMark:tb,getDefaultHighWaterMark:rb}=mr(),{pipeline:$u}=Rn(),{destroyer:nb}=yt(),qu=Le(),Is=Es(),jr=me(),O=Wu.exports=an().Stream;O.isDestroyed=jr.isDestroyed;O.isDisturbed=jr.isDisturbed;O.isErrored=jr.isErrored;O.isReadable=jr.isReadable;O.isWritable=jr.isWritable;O.Readable=Sr();for(let t of Cu(Bu)){let r=function(...n){if(new.target)throw Uu();return O.Readable.from(Mu(e,this,n))},e=Bu[t];Ce(r,"name",{__proto__:null,value:e.name}),Ce(r,"length",{__proto__:null,value:e.length}),Ce(O.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Cu(Fu)){let r=function(...n){if(new.target)throw Uu();return Mu(e,this,n)},e=Fu[t];Ce(r,"name",{__proto__:null,value:e.name}),Ce(r,"length",{__proto__:null,value:e.length}),Ce(O.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}O.Writable=wn();O.Duplex=Se();O.Transform=os();O.PassThrough=ls();O.pipeline=$u;var{addAbortSignal:ib}=gr();O.addAbortSignal=ib;O.finished=qu;O.destroy=nb;O.compose=eb;O.setDefaultHighWaterMark=tb;O.getDefaultHighWaterMark=rb;Ce(O,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Is}});Ce($u,Du,{__proto__:null,enumerable:!0,get(){return Is.pipeline}});Ce(qu,Du,{__proto__:null,enumerable:!0,get(){return Is.finished}});O.Stream=O;O._isUint8Array=function(e){return e instanceof Uint8Array};O._uint8ArrayToBuffer=function(e){return Xy.from(e.buffer,e.byteOffset,e.byteLength)}});var jn=v((Im,C)=>{"use strict";var U=Rs(),sb=Es(),ob=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=ob;C.exports.pipeline=U.pipeline;C.exports.compose=U.compose;Object.defineProperty(U,"promises",{configurable:!0,enumerable:!0,get(){return sb}});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 ir=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 Tt={};Fn(Tt,{Client:()=>se,client:()=>te,deepClone:()=>Ue,formdata:()=>Bs,metroError:()=>W,request:()=>Xe,response:()=>At,trace:()=>df,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 At(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(Ue(this.clientOptions),...e)}get location(){return this.clientOptions.url}};function te(...t){return new se(...Ue(t))}function cf(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,cf(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 Os(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 At(...t){let e={};for(let i of t)typeof i=="string"?e.body=i:i instanceof Response?Object.assign(e,Os(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,Os(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 At(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 Ls(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)Ls(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":Ls(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 Bs(...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 Bs(r,...s)};break;default:r[n]instanceof Function?i=r[n].bind(r):i=r[n];break}return i}})}var sr={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 sr.error(t,...e),new Error(t,...e)}var df={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++,sr.group(t),sr.info(e?.url,e,r)},response:(e,r)=>{sr.info(e?.body?e.body[Symbol.metroSource]:null,e,r),sr.groupEnd(t),t--}}}};function Ue(t){if(Array.isArray(t))return t.slice().map(Ue);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]=Ue(t[r])}),e}else return t;return t}var et=class{#e;#t;constructor(e,r="/"){this.#e=te(e),this.#t=new R(r)}get name(){return"HttpAdapter"}get path(){return this.#t}supportsWrite(){return!0}supportsStreamingWrite(){return hf}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}},hf=(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 pf={fs:ir,adapters:{https:et},path:R};globalThis.jsfs=pf;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||yf(s))&&(r=r.with({headers:{"Content-Type":t.contentType}})),Fs(r.headers.get("Content-Type"))&&(r=r.with({body:JSON.stringify(r.data,t.replacer,t.space)}))}let i=await n(r);if(i&&Fs(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 _f=/^application\/([a-zA-Z0-9\-_]+\+)?json\b/;function Fs(t){return _f.exec(t)}function yf(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 vt(){return async function(e,r){let n=await r(e);return n.ok&&n.data?n.data:n}}var Mr=class extends se{constructor(e,r,n=null){e instanceof se?super(e.clientOptions,fe(),vt()):super(e,fe(),vt()),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]}},Cn=class extends Mr{constructor(e,r,n=null){e instanceof se?super(e.with(ue()),r,n):super(te(e,ue()),r,n)}};function Cs(...t){return new Mr(...Ue(t))}function Ms(...t){return new Cn(...Ue(t))}var Ds=Object.assign({},Tt,{mw:{json:ue,thrower:fe,getdata:vt},api:Cs,jsonApi:Ms});globalThis.metro||(globalThis.metro=Ds);var ce=Ds;globalThis.assertEnabled=!1;function bf(){globalThis.assertEnabled=!0}function gf(){globalThis.assertEnabled=!1}function z(t,e){if(globalThis.assertEnabled){let r=ee(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 ee(r,t,n,i)}}function N(t){return function(r,n,i){return r==null||typeof r>"u"?P("data is required",r,t||"any value",i):typeof t<"u"?ee(r,t,n,i):!1}}function jt(t){return function(r,n,i){return r==null||typeof r>"u"?(Us("data does not contain recommended value",r,t,i),!1):ee(r,t,n,i)}}function Q(...t){return function(r,n,i){for(let s of t)if(!ee(r,s,n,i))return!1;return P("data does not match oneOf patterns",r,t,i)}}function tt(...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(Q(...t)(s))return P("data does not match anyOf patterns",s,t,i);return!1}}function Mn(...t){return function(r,n,i){let s=[];for(let o of t)s=s.concat(ee(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 T(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 Dn(t,e,r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return P("data is not a valid email",t,"validEmail",r)}function rt(t){return function(r,n,i){if(!(r instanceof t))return P("data is not an instanceof pattern",r,t,i)}}function Nt(t){return function(r,n,i){if(!ee(r,t,n,i))return P("data matches pattern, when required not to",r,t,i)}}function ee(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)=>ee(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=ee(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)=>ee(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=ee(t,e,r,n);s&&(i=i.concat(s))}else for(let[s,o]of Object.entries(e)){let a=ee(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 Us(t,e,r,n){console.warn("\u{1F170}\uFE0F Assert: "+n,t,r,e)}globalThis.assert={warn:Us,error:P,assert:z,enable:bf,disable:gf,Required:N,Recommended:jt,Optional:w,oneOf:Q,anyOf:tt,allOf:Mn,validURL:T,validEmail:Dn,instanceOf:rt,not:Nt,fails:ee};function $s(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 Un(t){let e={client:te(),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:wf(64)},authorize_callback:async f=>(window.location.href!=f.href&&window.location.replace(f.href),!1)};z(t,{});let r=Object.assign({},e.oauth2_configuration,t?.oauth2_configuration);t=Object.assign({},e,t),t.oauth2_configuration=r;let n=$s(t.site);t.tokens||(t.tokens=n.tokens),t.state||(t.state=n.state),z(t,{oauth2_configuration:{client_id:N(/.+/),grant_type:"authorization_code",authorization_endpoint:N(T),token_endpoint:N(T),redirect_uri:N(T)}});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=mf(d);if(!d||y&&!h){try{if(!await o())return At("false")}catch(_){throw _}return i(f,c)}else if(y&&h){try{if(!await a())return At("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+" ("+h+")",{cause:f})}let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:qs(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:qs(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:""});z(r,{client_id:/.+/,redirect_uri:/.+/,scope:/.*/});let c={response_type:"code",client_id:r.client_id,redirect_uri:r.redirect_uri,state:r.state||Sf(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 xf(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(z(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":d.refresh_token=t.tokens.get("refresh_token");break;default:throw new Error("Unknown grant_type: ".oauth2.grant_type)}return Xe(c,{method:"POST",body:new URLSearchParams(d)})}}function mf(t){if(!t)return!0;let e=new Date(t.expires);return new Date().getTime()>e.getTime()}function qs(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 wf(t=64){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),Ws(e)}async function xf(t){let r=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",r);return Ws(n)}function Ws(t){let e=Array.from(new Uint8Array(t),r=>String.fromCharCode(r)).join("");return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Sf(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",n=0;for(;n<t;)r+=e.charAt(Math.floor(Math.random()*e.length)),n++;return r}function Gs(){let t=new URL(document.location.href);if(!t.searchParams.has("code")){if(t.hash){let e=t.hash.substr(1);if(new URLSearchParams("?"+e).has("code"))return!0}return!1}return!0}function $n(){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 Rf=new TextEncoder,If=new TextDecoder;function Dr(t){return typeof t=="string"?Rf.encode(t):If.decode(t)}function zs(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new Wn(`${t.name} modulusLength must be at least 2048 bits`)}function Af(t){switch(t.algorithm.name){case"ECDSA":return{name:t.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return zs(t.algorithm),{name:t.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return zs(t.algorithm),{name:t.algorithm.name};case"Ed25519":return{name:t.algorithm.name}}throw new $e}async function Tf(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=`${Ur(Dr(JSON.stringify(t)))}.${Ur(Dr(JSON.stringify(e)))}`,i=Ur(await crypto.subtle.sign(Af(r),r,Dr(n)));return`${n}.${i}`}var qn;Uint8Array.prototype.toBase64?qn=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):qn=e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let r=[];for(let n=0;n<e.byteLength;n+=32768)r.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(r.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};function Ur(t){return qn(t)}var $e=class extends Error{constructor(e){var r;super(e??"operation not supported"),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}},Wn=class extends Error{constructor(e){var r;super(e),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}};function vf(t){switch(t.algorithm.hash.name){case"SHA-256":return"PS256";default:throw new $e("unsupported RsaHashedKeyAlgorithm hash name")}}function jf(t){switch(t.algorithm.hash.name){case"SHA-256":return"RS256";default:throw new $e("unsupported RsaHashedKeyAlgorithm hash name")}}function Nf(t){switch(t.algorithm.namedCurve){case"P-256":return"ES256";default:throw new $e("unsupported EcKeyAlgorithm namedCurve")}}function Pf(t){switch(t.algorithm.name){case"RSA-PSS":return vf(t);case"RSASSA-PKCS1-v1_5":return jf(t);case"ECDSA":return Nf(t);case"Ed25519":return"Ed25519";default:throw new $e("unsupported CryptoKey algorithm name")}}function Hs(t){return t instanceof CryptoKey}function kf(t){return Hs(t)&&t.type==="private"}function Of(t){return Hs(t)&&t.type==="public"}function Lf(){return Math.floor(Date.now()/1e3)}async function Gn(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(!Of(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 Tf({alg:Pf(o),typ:"dpop+jwt",jwk:await Bf(a)},Object.assign(Object.assign({},s),{iat:Lf(),jti:crypto.randomUUID(),htm:r,nonce:n,htu:e,ath:i?Ur(await crypto.subtle.digest("SHA-256",Dr(i))):void 0}),o)}async function Bf(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 Vs(t,e){var r;let n;if(typeof t!="string"||t.length===0)throw new TypeError('"alg" must be a non-empty string');switch(t){case"PS256":n={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":n={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":n={name:"Ed25519"};break;default:throw new $e}return crypto.subtle.generateKey(n,(r=e?.extractable)!==null&&r!==void 0?r:!1,["sign","verify"])}function zn(t){return z(t,{site:N(T),authorization_endpoint:N(T),token_endpoint:N(T),dpop_signing_alg_values_supported:w([])}),async(e,r)=>{let n=await $n(),i=await n.get(t.site);if(!i){let a=await Vs("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 Gn(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 Gn(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 or=(...t)=>(e,r)=>t.filter(n=>r.hasOwnKey(n)).length>0?!1:P("root data must have all of",r,t),qe=(...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 ar(t={}){z(t,{client:w(rt(ce.client().constructor)),issuer:N(T)});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:N(Mn(t.issuer,n)),authorization_endpoint:N(T),token_endpoint:N(T),userinfo_endpoint:jt(T),jwks_uri:N(T),registration_endpoint:t.requireDynamicRegistration?N(T):jt(T),scopes_supported:jt(qe("openid")),response_types_supported:t.requireDynamicRegistration?N(qe("code","id_token","id_token token")):N([]),response_modes_supported:w([]),grant_types_supported:t.requireDynamicRegistration?w(qe("authorization_code")):w([]),acr_values_supported:w([]),subject_types_supported:N([]),id_token_signing_alg_values_supported:N(qe("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(qe("RS256")),request_object_encryption_alg_values_supported:w([]),request_object_encryption_enc_values_supported:w([]),token_endpoint_auth_methods_supported:w(tt(...$r)),token_endpoint_auth_signing_alg_values_supported:w(qe("RS256"),Nt(qe("none"))),display_values_supported:w(tt("page","popup","touch","wap")),claim_types_supported:w(tt("normal","aggregated","distributed")),claims_supported:jt([]),service_documentation:w(T),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(T),op_tos_uri:w(T)},s=ce.url(t.issuer,".well-known/openid-configuration"),a=(await t.client.get(s)).data;return z(a,i),z(a.issuer,t.issuer),a}async function lr(t){let e={redirect_uris:N([T]),response_types:w([]),grant_types:w(tt("authorization_code","refresh_token")),application_type:w(Q("native","web")),contacts:w([Dn]),client_name:w(String),logo_uri:w(T),client_uri:w(T),policy_uri:w(T),tos_uri:w(T),jwks_uri:w(T,Nt(or("jwks"))),jwks:w(T,Nt(or("jwks_uri"))),sector_identifier_uri:w(T),subject_type:w(String),id_token_signed_response_alg:w(Q(...oe)),id_token_encrypted_response_alg:w(Q(...oe)),id_token_encrypted_response_enc:w(Q(...oe),or("id_token_encrypted_response_alg")),userinfo_signed_response_alg:w(Q(...oe)),userinfo_encrypted_response_alg:w(Q(...oe)),userinfo_encrypted_response_enc:w(Q(...oe),or("userinfo_encrypted_response_alg")),request_object_signing_alg:w(Q(...oe)),request_object_encryption_alg:w(Q(...oe)),request_object_encryption_enc:w(Q(...oe)),token_endpoint_auth_method:w(Q(...$r)),token_endpoint_auth_signing_alg:w(Q(...oe)),default_max_age:w(Number),require_auth_time:w(Boolean),default_acr_values:w([String]),initiate_login_uri:w([T]),request_uris:w([T])};z(t,{client:w(rt(ce.client().constructor)),registration_endpoint:T,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 Hn(t={}){let e={client:te(),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),z(t,{client:N(rt(te().constructor)),client_info:N(),issuer:N(T),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 ar({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 lr({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(zn(u)),o.client=l}return l=l.with(Un(o)),i=await l.fetch(r),i}}function Qs(){return Gs()}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 Js={oidcmw:Hn,discover:ar,register:lr,isRedirected:Qs,idToken:Ks};globalThis.metro.oidc||(globalThis.metro.oidc=Js);var Ys=Js;function Kn(t){return new Vn(t)}var Jn="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Cf={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#"};var Vn=class{constructor(e){this.prefixes={...Cf,...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 Qn(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}},Qn=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 Pt(r,this)),this.subjects[r]}addBlankNode(e){return this.#e[e]||(this.#e[e]=new nt(this)),this.#e[e]}addCollection(e){return this.#e[e]||(this.#e[e]=new kt(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}},nt=class{constructor(e){Object.defineProperty(this,"graph",{value:e,writable:!1,enumerable:!1})}addPredicate(e,r){if(e.id&&(e=e.id),e==Jn){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}},Pt=class extends nt{constructor(e,r){super(r),Object.defineProperty(this,"id",{value:e,writable:!1,enumerable:!0})}},kt=class extends Array{constructor(e,r){super(),Object.defineProperty(this,"graph",{value:r,writable:!1,enumerable:!1})}};var js={};Fn(js,{n3Parser:()=>ab,n3Writer:()=>lb});var wo=Cr(pe());var ot="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/",k={xsd:{decimal:`${fr}decimal`,boolean:`${fr}boolean`,double:`${fr}double`,integer:`${fr}integer`,string:`${fr}string`},rdf:{type:`${ot}type`,nil:`${ot}nil`,first:`${ot}first`,rest:`${ot}rest`,langString:`${ot}langString`,dirLangString:`${ot}dirLangString`,reifies:`${ot}reifies`},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:Vr}=k,yc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,mo={"\\":"\\","'":"'",'"':'"',n:`
|
|
3
|
-
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},bc=/[\x00-\x20<>\\"\{\}\|\^\`]/,gc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_dircode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},mc=/$0^/,at=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._dircode=/^--(ltr)|(rtl)/,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._atKeyword=/^@[a-z]+(?=[\s#<:])/i,this._keyword=/^(?:PREFIX|BASE|VERSION|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 gc)&&this[r]instanceof RegExp&&(this[r]=mc)}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||bc.test(d))return o(this);c="IRI"}else n.length>2&&n[1]==="<"&&n[2]==="("?(c="<<(",_=3):!this._lineMode&&n.length>(r?1:2)&&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))&&y[1]!=="version"?(c="langcode",d=y[1]):(y=this._atKeyword.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"-":if(n[1]==="-"){this._previousMarker==="langcode"&&(y=this._dircode.exec(n))&&(c="dircode",_=2,d=y[1]||y[2],_=d.length+2);break}(y=this._number.exec(n)||r&&(y=this._number.exec(`${n} `)))&&(c="literal",d=y[0],h=typeof y[1]=="string"?Vr.double:typeof y[2]=="string"?Vr.decimal:Vr.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(y=this._keyword.exec(n))?c=y[0].toUpperCase():x=!0;break;case"f":case"t":(y=this._boolean.exec(n))?(c="literal",d=y[0],h=Vr.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")":if(!r&&(n.length===1||n.length===2&&n[1]===">"))break;if(n.length>2&&n[1]===">"&&n[2]===">"){c=")>>",_=3;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(yc,(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 mo?mo[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=wo.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:xo,xsd:lt}=k,Mt,wc=0;var ai={namedNode:So,blankNode:Eo,variable:Io,literal:Ro,defaultGraph:xc,quad:li,triple:li,fromTerm:cr,fromQuad:Ao},X=ai,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}}},Ct=class extends Z{get termType(){return"NamedNode"}},je=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,n=e.lastIndexOf("--");return r<e.length&&e[r++]==="@"?(n>r?e.substr(0,n):e).substr(r).toLowerCase():""}get direction(){let e=this.id,r=e.lastIndexOf('"'),n=e.lastIndexOf("--");return n>r&&n+2<e.length?e.substr(n+2).toLowerCase():""}get datatype(){return new Ct(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!=="@"?lt.string:e.indexOf("--",r)>0?xo.dirLangString:xo.langString}equals(e){return e instanceof t?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&(this.direction===e.direction||this.direction===""&&!e.direction)&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,direction:this.direction,datatype:{termType:"NamedNode",value:this.datatypeString}}}},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(""),Mt||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Mt=new pr;function Ge(t,e,r){if(e=e||ai,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===ai)return new je(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let n=t.lastIndexOf('"',t.length-1),i;if(t[n+1]==="@"){i=t.substr(n+2);let s=i.lastIndexOf("--");s>0&&s<i.length&&(i={language:i.substr(0,s),direction:i.substr(s+2)})}else i=e.namedNode(t.substr(n+3));return e.literal(t.substr(1,n-1),i);case"[":t=JSON.parse(t);break;default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Ge(t[0],e,!0),Ge(t[1],e,!0),Ge(t[2],e,!0),t[3]&&Ge(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 Mt.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.direction?`--${t.direction}`:""}`:t.datatype&&t.datatype.value!==lt.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 ze=class extends Z{constructor(e,r,n,i){super(""),this._subject=e,this._predicate=r,this._object=n,this._graph=i||Mt}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 So(t){return new Ct(t)}function Eo(t){return new dr(t||`n3-${wc++}`)}function Ro(t,e){if(typeof e=="string")return new je(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new je(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=lt.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?lt.integer:lt.double:(r=lt.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===lt.string?new je(`"${t}"`):new je(`"${t}"^^${r}`)}function Io(t){return new hr(t)}function xc(){return Mt}function li(t,e,r,n){return new ze(t,e,r,n)}function cr(t){if(t instanceof Z)return t;switch(t.termType){case"NamedNode":return So(t.value);case"BlankNode":return Eo(t.value);case"Variable":return Io(t.value);case"DefaultGraph":return Mt;case"Literal":return Ro(t.value,t.language||t.datatype);case"Quad":return Ao(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Ao(t){if(t instanceof ze)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return li(cr(t.subject),cr(t.predicate),cr(t.object),cr(t.graph))}var To=0,Pe=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&vo(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,l&&(this._resolveRelativeIRI=u=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new at({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){To=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)}_readBeforeTopContext(e){return this._version&&!this._isValidVersion(this._version)?this._error(`Detected unsupported version as media type parameter: "${this._version}"`,e):this._readInTopContext(e)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"VERSION":this._sparqlStyle=!0;case"@version":return this._readVersion;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_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"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(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._n3Mode?(this._saveContext("<<(",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Disallowed triple term as subject",e);case"<<":return this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject;default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":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._validAnnotation=!0,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"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(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._saveContext("<<(",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;case"<<":return this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){if(e.type==="]")return this._subject=null,this._readBlankNodeTail(e);{let r=this._contextStack;return(r.length>1&&r[r.length-2]).type==="<<"?this._error("Unexpected compound blank node expression in reified triple",e):(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);case"<<":this._saveContext("<<",this._graph,null,null,null),this._graph=null,i=this._readSubject;break;default:if((r=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),e.type==="<<"&&(o[o.length-1].subject=this._subject),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,r){let n=this._factory.literal(this._literalValue),i;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===k.rdf.langString||s.value===k.rdf.dirLangString)return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype",e);n=this._factory.literal(this._literalValue,s),e=null;break;case"langcode":if(e.value.split("-").some(o=>o.length>8))return this._error("Detected language tag with subtag longer than 8 characters",e);n=this._factory.literal(this._literalValue,e.value),this._literalLanguage=e.value,e=null,i=this._readDirCode.bind(this,r);break}return{token:e,literal:n,readCb:i}}_readDirCode(e,r,n){if(n.type==="dircode"){let i=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:n.value});e==="subject"?this._subject=i:this._object=i,this._literalLanguage=void 0,n=null}return e==="subject"?n===null?this._readPredicateOrNamedGraph:this._readPredicateOrNamedGraph(n):this._completeObjectLiteralPost(n,r)}_completeSubjectLiteral(e){let r=this._completeLiteral(e,"subject");return this._subject=r.literal,r.readCb?r.readCb.bind(this,!1):this._readPredicateOrNamedGraph}_completeObjectLiteral(e,r){let n=this._completeLiteral(e,"object");if(n)return this._object=n.literal,n.readCb?n.readCb.bind(this,r):this._completeObjectLiteralPost(n.token,r)}_completeObjectLiteralPost(e,r){return r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),e===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(e))}_readFormulaTail(e){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=!1,s=this._subject,o=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,this._tripleTerm=null,r=this._contextStack.length?this._readSubject:this._readInTopContext,o&&(this._inversePredicate=!1);break;case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"~":r=this._readReifierInAnnotation,i=!0;break;case"{|":this._subject=this._readTripleTerm(),this._validAnnotation=!1,i=!0,r=this._readPredicate;break;case"|}":if(!this._annotation)return this._error("Unexpected annotation syntax closing",e);if(!this._validAnnotation)return this._error("Annotation block can not be empty",e);this._subject=null,this._annotation=!1,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(s!==null&&(!i||i&&!this._annotation)){let a=this._predicate,l=this._object;o?this._emit(l,a,s,n):this._emit(s,a,l,n)}return i&&(this._annotation=!0),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)}_isValidVersion(e){return this._parseUnsupportedVersions||t.SUPPORTED_VERSIONS.includes(e)}_readVersion(e){return e.type!=="literal"?this._error("Expected literal to follow version declaration",e):e.end-e.start!==e.value.length+2?this._error("Version declarations must use single quotes",e):(this._versionCallback(e.value),this._isValidVersion(e.value)?this._readDeclarationPunctuation:this._error(`Detected unsupported version: "${e.value}"`,e))}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._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}_readTripleTermTail(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())}_readReifiedTripleTailOrReifier(e){return e.type==="~"?this._readReifier:this._readReifiedTripleTail(e)}_readReifiedTripleTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);this._tripleTerm=null;let r=this._readTripleTerm();this._restoreContext("<<",e);let n=this._contextStack,i=n.length&&n[n.length-1];return i&&i.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicateOrReifierTripleEnd):(this._object=r,this._getContextEndReader())}_readPredicateOrReifierTripleEnd(e){return e.type==="."?(this._subject=null,this._readPunctuation(e)):this._readPredicate(e)}_readReifier(e){return this._reifier=this._readEntity(e),this._readReifiedTripleTail}_readReifierInAnnotation(e){return e.type==="IRI"||e.type==="typeIRI"||e.type==="type"||e.type==="prefixed"||e.type==="blank"||e.type==="var"?(this._reifier=this._readEntity(e),this._readPunctuation):(this._readTripleTerm(),this._subject=null,this._readPunctuation(e))}_readTripleTerm(){let e=this._contextStack,r=e.length&&e[e.length-1],n=r?r.graph:void 0,i=this._reifier||this._factory.blankNode();return this._reifier=null,this._tripleTerm=this._tripleTerm||this._factory.quad(this._subject,this._predicate,this._object),this._emit(i,this.RDF_REIFIES,this._tripleTerm,n||this.DEFAULTGRAPH),i}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<(":return this._readTripleTermTail;case"<<":return this._readReifiedTripleTailOrReifier}}_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=_r}_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,i){let s,o,a,l;if(r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion):(s=r,o=n,l=i),this._readCallback=this._readBeforeTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${To++}_`,this._prefixCallback=o||_r,this._versionCallback=l||_r,this._inversePredicate=!1,this._quantified=Object.create(null),!s){let f=[],c;if(this._callback=(d,h)=>{d?c=d:h&&f.push(h)},this._lexer.tokenize(e).every(d=>this._readCallback=this._readCallback(d)),c)throw c;return f}let u=(f,c)=>{f!==null?(this._callback(f),this._callback=_r):this._readCallback&&(this._readCallback=this._readCallback(c))};a&&(this._lexer.comments=!0,u=(f,c)=>{f!==null?(this._callback(f),this._callback=_r):this._readCallback&&(c.type==="comment"?a(c.value):this._readCallback=this._readCallback(c))}),this._callback=s,this._lexer.tokenize(e,u)}};function _r(){}function vo(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(k.rdf.first),t.RDF_REST=e.namedNode(k.rdf.rest),t.RDF_NIL=e.namedNode(k.rdf.nil),t.RDF_REIFIES=e.namedNode(k.rdf.reifies),t.N3_FORALL=e.namedNode(k.r.forAll),t.N3_FORSOME=e.namedNode(k.r.forSome),t.ABBREVIATIONS={a:e.namedNode(k.rdf.type),"=":e.namedNode(k.owl.sameAs),">":e.namedNode(k.log.implies),"<":e.namedNode(k.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Pe.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];vo(Pe.prototype,X);var ui={};Fn(ui,{inDefaultGraph:()=>Tc,isBlankNode:()=>Ec,isDefaultGraph:()=>ut,isLiteral:()=>Rc,isNamedNode:()=>Sc,isQuad:()=>Ac,isVariable:()=>Ic,prefix:()=>vc,prefixes:()=>jo});function Sc(t){return!!t&&t.termType==="NamedNode"}function Ec(t){return!!t&&t.termType==="BlankNode"}function Rc(t){return!!t&&t.termType==="Literal"}function Ic(t){return!!t&&t.termType==="Variable"}function Ac(t){return!!t&&t.termType==="Quad"}function ut(t){return!!t&&t.termType==="DefaultGraph"}function Tc(t){return ut(t.graph)}function vc(t,e){return jo({"":t.value||t},e)("")}function jo(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 Dt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var jc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Nc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,No="./",Pc="../",fi="?",Po="#",ft=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!jc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",Dt(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]===Po?l=s.lastIndex-1:(r.push(Dt(o[0]),"(?:"),n.push(")?"),o[1]!==fi?i.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Po,a),this._pathReplacements[a]=fi));for(let f=0;f<i.length;f++)this._pathReplacements[i[f]]=Pc.repeat(i.length-f-1);return this._pathReplacements[i[i.length-1]]=No,this._baseLength=l>0?l:this.base.length,r.push(Dt(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!==fi&&!Nc.test(s)?e:i===No&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}};var yr=X.defaultGraph(),{rdf:kc,xsd:Ut}=k,ko=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Oo=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Oc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},ct=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=yr,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new ft(r.baseIRI)))}get _inDefaultGraph(){return yr.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?`.
|
|
1
|
+
(()=>{var Sf=Object.create;var zn=Object.defineProperty;var Ef=Object.getOwnPropertyDescriptor;var Rf=Object.getOwnPropertyNames;var If=Object.getPrototypeOf,Af=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Tt=(t,e)=>{for(var r in e)zn(t,r,{get:e[r],enumerable:!0})},Tf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rf(e))!Af.call(t,i)&&i!==r&&zn(t,i,{get:()=>e[i],enumerable:!(n=Ef(e,i))||n.enumerable});return t};var zr=(t,e,r)=>(r=t!=null?Sf(If(t)):{},Tf(e||!t||!t.__esModule?zn(r,"default",{value:t,enumerable:!0}):r,t));var mo=v(Zr=>{"use strict";Zr.byteLength=rc;Zr.toByteArray=ic;Zr.fromByteArray=ac;var de=[],ne=[],tc=typeof Uint8Array<"u"?Uint8Array:Array,li="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ot=0,yo=li.length;ot<yo;++ot)de[ot]=li[ot],ne[li.charCodeAt(ot)]=ot;var ot,yo;ne[45]=62;ne[95]=63;function bo(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 rc(t){var e=bo(t),r=e[0],n=e[1];return(r+n)*3/4-n}function nc(t,e,r){return(e+r)*3/4-r}function ic(t){var e,r=bo(t),n=r[0],i=r[1],s=new tc(nc(t,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=ne[t.charCodeAt(l)]<<18|ne[t.charCodeAt(l+1)]<<12|ne[t.charCodeAt(l+2)]<<6|ne[t.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=ne[t.charCodeAt(l)]<<2|ne[t.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=ne[t.charCodeAt(l)]<<10|ne[t.charCodeAt(l+1)]<<4|ne[t.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function sc(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function oc(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(sc(n));return i.join("")}function ac(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(oc(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 go=v(ui=>{ui.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)};ui.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=v(Mt=>{"use strict";var fi=mo(),Ct=go(),wo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Mt.Buffer=p;Mt.SlowBuffer=hc;Mt.INSPECT_MAX_BYTES=50;var Xr=2147483647;Mt.kMaxLength=Xr;p.TYPED_ARRAY_SUPPORT=lc();!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 lc(){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 ke(t){if(t>Xr)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 pi(t)}return Ro(t,e,r)}p.poolSize=8192;function Ro(t,e,r){if(typeof t=="string")return fc(t,e);if(ArrayBuffer.isView(t))return cc(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 di(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=dc(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 Ro(t,e,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function Io(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 uc(t,e,r){return Io(t),t<=0?ke(t):e!==void 0?typeof r=="string"?ke(t).fill(e,r):ke(t).fill(e):ke(t)}p.alloc=function(t,e,r){return uc(t,e,r)};function pi(t){return Io(t),ke(t<0?0:_i(t)|0)}p.allocUnsafe=function(t){return pi(t)};p.allocUnsafeSlow=function(t){return pi(t)};function fc(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=ke(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function ci(t){let e=t.length<0?0:_i(t.length)|0,r=ke(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function cc(t){if(he(t,Uint8Array)){let e=new Uint8Array(t);return di(e.buffer,e.byteOffset,e.byteLength)}return ci(t)}function di(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 dc(t){if(p.isBuffer(t)){let e=_i(t.length)|0,r=ke(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||bi(t.length)?ke(0):ci(t);if(t.type==="Buffer"&&Array.isArray(t.data))return ci(t.data)}function _i(t){if(t>=Xr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xr.toString(16)+" bytes");return t|0}function hc(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 hi(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:hi(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=Ao;function pc(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 Rc(this,e,r);case"utf8":case"utf-8":return vo(this,e,r);case"ascii":return Sc(this,e,r);case"latin1":case"binary":return Ec(this,e,r);case"base64":return wc(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ic(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function at(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)at(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)at(this,r,r+3),at(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)at(this,r,r+7),at(this,r+1,r+6),at(this,r+2,r+5),at(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?vo(this,0,e):pc.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=Mt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};wo&&(p.prototype[wo]=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 To(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,bi(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:xo(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):xo(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function xo(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 To(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return To(this,e,r,n,!1)};function _c(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(bi(a))return o;t[r+o]=a}return o}function yc(t,e,r,n){return en(hi(e,t.length-r),t,r,n)}function bc(t,e,r,n){return en(kc(e),t,r,n)}function mc(t,e,r,n){return en(Bo(e),t,r,n)}function gc(t,e,r,n){return en(jc(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 _c(this,e,r,n);case"utf8":case"utf-8":return yc(this,e,r,n);case"ascii":case"latin1":case"binary":return bc(this,e,r,n);case"base64":return mc(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gc(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 wc(t,e,r){return e===0&&r===t.length?fi.fromByteArray(t):fi.fromByteArray(t.slice(e,r))}function vo(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 xc(n)}var So=4096;function xc(t){let e=t.length;if(e<=So)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=So));return r}function Sc(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 Ec(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 Rc(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+=Nc[t[s]];return i}function Ic(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 H(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||H(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||H(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||H(e,1,this.length),this[e]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||H(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||H(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||H(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||H(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readBigUInt64LE=He(function(e){e=e>>>0,Ft(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&_r(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=He(function(e){e=e>>>0,Ft(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&_r(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||H(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||H(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||H(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,r){e=e>>>0,r||H(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||H(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||H(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||H(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readBigInt64LE=He(function(e){e=e>>>0,Ft(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&_r(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=He(function(e){e=e>>>0,Ft(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&_r(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||H(e,4,this.length),Ct.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||H(e,4,this.length),Ct.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ct.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ct.read(this,e,!1,52,8)};function X(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;X(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;X(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||X(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||X(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||X(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||X(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||X(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 ko(t,e,r,n,i){Lo(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 jo(t,e,r,n,i){Lo(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=He(function(e,r=0){return ko(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=He(function(e,r=0){return jo(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);X(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);X(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||X(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||X(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||X(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||X(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||X(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=He(function(e,r=0){return ko(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=He(function(e,r=0){return jo(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function No(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||No(t,e,r,4,34028234663852886e22,-34028234663852886e22),Ct.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 Oo(t,e,r,n,i){return e=+e,r=r>>>0,i||No(t,e,r,8,17976931348623157e292,-17976931348623157e292),Ct.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return Oo(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return Oo(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 Bt={};function yi(t,e,r){Bt[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}`}}}yi("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);yi("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);yi("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=Eo(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Eo(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Eo(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){Ft(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&_r(e,t.length-(r+1))}function Lo(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 Bt.ERR_OUT_OF_RANGE("value",a,t)}Ac(n,i,s)}function Ft(t,e){if(typeof t!="number")throw new Bt.ERR_INVALID_ARG_TYPE(e,"number",t)}function _r(t,e,r){throw Math.floor(t)!==t?(Ft(t,r),new Bt.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Bt.ERR_BUFFER_OUT_OF_BOUNDS:new Bt.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Tc=/[^+/0-9A-Za-z-_]/g;function vc(t){if(t=t.split("=")[0],t=t.trim().replace(Tc,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function hi(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 kc(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function jc(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 fi.toByteArray(vc(t))}function en(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 bi(t){return t!==t}var Nc=(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 He(t){return typeof BigInt>"u"?Pc:t}function Pc(){throw new Error("BigInt not supported")}});var B=v((Ig,Zo)=>{"use strict";var Si=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}};Zo.exports={AggregateError:Si,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 Ei=v((Ag,Xo)=>{"use strict";Xo.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 Q=v((Tg,ra)=>{"use strict";var{format:Yc,inspect:nn}=Ei(),{AggregateError:Zc}=B(),Xc=globalThis.AggregateError||Zc,ed=Symbol("kIsNodeError"),td=["string","function","number","object","Function","Object","boolean","bigint","symbol"],rd=/^([A-Z][a-z0-9]*)+$/,nd="__node_internal_",sn={};function pt(t,e){if(!t)throw new sn.ERR_INTERNAL_ASSERTION(e)}function ea(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 id(t,e,r){if(typeof e=="function")return pt(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 pt(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Yc(e,...r)}function K(t,e,r){r||(r=Error);class n extends r{constructor(...s){super(id(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[ed]=!0,sn[t]=n}function ta(t){let e=nd+t.name;return Object.defineProperty(t,"name",{value:e}),t}function sd(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Xc([e,t],e.message);return r.code=e.code,r}return t||e}var Ri=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new sn.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};K("ERR_ASSERTION","%s",Error);K("ERR_INVALID_ARG_TYPE",(t,e,r)=>{pt(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)pt(typeof l=="string","All expected entries have to be of type string"),td.includes(l)?i.push(l.toLowerCase()):rd.test(l)?s.push(l):(pt(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=nn(r,{depth:-1});n+=`. Received ${l}`}}else{let l=nn(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),n+=`. Received type ${typeof r} (${l})`}return n},TypeError);K("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=nn(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);K("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);K("ERR_MISSING_ARGS",(...t)=>{pt(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);K("ERR_OUT_OF_RANGE",(t,e,r)=>{pt(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=ea(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=ea(n)),n+="n"}else n=nn(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);K("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);K("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);K("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);K("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);K("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);K("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);K("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);K("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);K("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);K("ERR_STREAM_WRITE_AFTER_END","write after end",Error);K("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);ra.exports={AbortError:Ri,aggregateTwoErrors:ta(sd),hideStackFrames:ta,codes:sn}});var Wt=v((vg,on)=>{"use strict";var{AbortController:na,AbortSignal:od}=typeof self<"u"?self:typeof window<"u"?window:void 0;on.exports=na;on.exports.AbortSignal=od;on.exports.default=na});var Er=v((kg,Ii)=>{"use strict";var zt=typeof Reflect=="object"?Reflect:null,ia=zt&&typeof zt.apply=="function"?zt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},an;zt&&typeof zt.ownKeys=="function"?an=zt.ownKeys:Object.getOwnPropertySymbols?an=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:an=function(e){return Object.getOwnPropertyNames(e)};function ad(t){console&&console.warn&&console.warn(t)}var oa=Number.isNaN||function(e){return e!==e};function j(){j.init.call(this)}Ii.exports=j;Ii.exports.once=cd;j.EventEmitter=j;j.prototype._events=void 0;j.prototype._eventsCount=0;j.prototype._maxListeners=void 0;var sa=10;function ln(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(j,"defaultMaxListeners",{enumerable:!0,get:function(){return sa},set:function(t){if(typeof t!="number"||t<0||oa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");sa=t}});j.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};j.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||oa(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 aa(t){return t._maxListeners===void 0?j.defaultMaxListeners:t._maxListeners}j.prototype.getMaxListeners=function(){return aa(this)};j.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")ia(l,this,r);else for(var u=l.length,f=da(l,u),n=0;n<u;++n)ia(f[n],this,r);return!0};function la(t,e,r,n){var i,s,o;if(ln(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=aa(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,ad(a)}return t}j.prototype.addListener=function(e,r){return la(this,e,r,!1)};j.prototype.on=j.prototype.addListener;j.prototype.prependListener=function(e,r){return la(this,e,r,!0)};function ld(){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 ua(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ld.bind(n);return i.listener=r,n.wrapFn=i,i}j.prototype.once=function(e,r){return ln(r),this.on(e,ua(this,e,r)),this};j.prototype.prependOnceListener=function(e,r){return ln(r),this.prependListener(e,ua(this,e,r)),this};j.prototype.removeListener=function(e,r){var n,i,s,o,a;if(ln(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():ud(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};j.prototype.off=j.prototype.removeListener;j.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 fa(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?fd(i):da(i,i.length)}j.prototype.listeners=function(e){return fa(this,e,!0)};j.prototype.rawListeners=function(e){return fa(this,e,!1)};j.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ca.call(t,e)};j.prototype.listenerCount=ca;function ca(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}j.prototype.eventNames=function(){return this._eventsCount>0?an(this._events):[]};function da(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function ud(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function fd(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function cd(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))}ha(t,e,s,{once:!0}),e!=="error"&&dd(t,i,{once:!0})})}function dd(t,e,r){typeof t.on=="function"&&ha(t,"error",e,r)}function ha(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 Y=v((jg,Ti)=>{"use strict";var hd=pe(),{format:pd,inspect:_d}=Ei(),{codes:{ERR_INVALID_ARG_TYPE:Ai}}=Q(),{kResistStopPropagation:yd,AggregateError:bd,SymbolDispose:md}=B(),gd=globalThis.AbortSignal||Wt().AbortSignal,wd=globalThis.AbortController||Wt().AbortController,xd=Object.getPrototypeOf(async function(){}).constructor,pa=globalThis.Blob||hd.Blob,Sd=typeof pa<"u"?function(e){return e instanceof pa}:function(e){return!1},_a=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Ai(e,"AbortSignal",t)},Ed=(t,e)=>{if(typeof t!="function")throw new Ai(e,"Function",t)};Ti.exports={AggregateError:bd,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:pd,inspect:_d,types:{isAsyncFunction(t){return t instanceof xd},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Sd,deprecate(t,e){return t},addAbortListener:Er().addAbortListener||function(e,r){if(e===void 0)throw new Ai("signal","AbortSignal",e);_a(e,"signal"),Ed(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[yd]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[md](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:gd.any||function(e){if(e.length===1)return e[0];let r=new wd,n=()=>r.abort();return e.forEach(i=>{_a(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};Ti.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Ht=v((Ng,Ia)=>{"use strict";var{ArrayIsArray:ki,ArrayPrototypeIncludes:ga,ArrayPrototypeJoin:wa,ArrayPrototypeMap:Rd,NumberIsInteger:ji,NumberIsNaN:Id,NumberMAX_SAFE_INTEGER:Ad,NumberMIN_SAFE_INTEGER:Td,NumberParseInt:vd,ObjectPrototypeHasOwnProperty:kd,RegExpPrototypeExec:xa,String:jd,StringPrototypeToUpperCase:Nd,StringPrototypeTrim:Pd}=B(),{hideStackFrames:ie,codes:{ERR_SOCKET_BAD_PORT:Od,ERR_INVALID_ARG_TYPE:J,ERR_INVALID_ARG_VALUE:Gt,ERR_OUT_OF_RANGE:_t,ERR_UNKNOWN_SIGNAL:ya}}=Q(),{normalizeEncoding:Ld}=Y(),{isAsyncFunction:Bd,isArrayBufferView:Cd}=Y().types,ba={};function Fd(t){return t===(t|0)}function Md(t){return t===t>>>0}var Dd=/^[0-7]+$/,Ud="must be a 32-bit unsigned integer or an octal string";function $d(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(xa(Dd,t)===null)throw new Gt(e,t,Ud);t=vd(t,8)}return Sa(t,e),t}var qd=ie((t,e,r=Td,n=Ad)=>{if(typeof t!="number")throw new J(e,"number",t);if(!ji(t))throw new _t(e,"an integer",t);if(t<r||t>n)throw new _t(e,`>= ${r} && <= ${n}`,t)}),Wd=ie((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new J(e,"number",t);if(!ji(t))throw new _t(e,"an integer",t);if(t<r||t>n)throw new _t(e,`>= ${r} && <= ${n}`,t)}),Sa=ie((t,e,r=!1)=>{if(typeof t!="number")throw new J(e,"number",t);if(!ji(t))throw new _t(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new _t(e,`>= ${n} && <= ${i}`,t)});function Ni(t,e){if(typeof t!="string")throw new J(e,"string",t)}function zd(t,e,r=void 0,n){if(typeof t!="number")throw new J(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&Id(t))throw new _t(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Gd=ie((t,e,r)=>{if(!ga(r,t)){let i="must be one of: "+wa(Rd(r,s=>typeof s=="string"?`'${s}'`:jd(s)),", ");throw new Gt(e,t,i)}});function Ea(t,e){if(typeof t!="boolean")throw new J(e,"boolean",t)}function vi(t,e,r){return t==null||!kd(t,e)?r:t[e]}var Hd=ie((t,e,r=null)=>{let n=vi(r,"allowArray",!1),i=vi(r,"allowFunction",!1);if(!vi(r,"nullable",!1)&&t===null||!n&&ki(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new J(e,"Object",t)}),Vd=ie((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new J(e,"a dictionary",t)}),un=ie((t,e,r=0)=>{if(!ki(t))throw new J(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Gt(e,t,n)}});function Kd(t,e){un(t,e);for(let r=0;r<t.length;r++)Ni(t[r],`${e}[${r}]`)}function Qd(t,e){un(t,e);for(let r=0;r<t.length;r++)Ea(t[r],`${e}[${r}]`)}function Jd(t,e){un(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new J(i,"AbortSignal",n);Ra(n,i)}}function Yd(t,e="signal"){if(Ni(t,e),ba[t]===void 0)throw ba[Nd(t)]!==void 0?new ya(t+" (signals must use all capital letters)"):new ya(t)}var Zd=ie((t,e="buffer")=>{if(!Cd(t))throw new J(e,["Buffer","TypedArray","DataView"],t)});function Xd(t,e){let r=Ld(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Gt("encoding",e,`is invalid for data of length ${n}`)}function eh(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 Od(e,t,r);return t|0}var Ra=ie((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new J(e,"AbortSignal",t)}),th=ie((t,e)=>{if(typeof t!="function")throw new J(e,"Function",t)}),rh=ie((t,e)=>{if(typeof t!="function"||Bd(t))throw new J(e,"Function",t)}),nh=ie((t,e)=>{if(t!==void 0)throw new J(e,"undefined",t)});function ih(t,e,r){if(!ga(r,t))throw new J(e,`('${wa(r,"|")}')`,t)}var sh=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ma(t,e){if(typeof t>"u"||!xa(sh,t))throw new Gt(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function oh(t){if(typeof t=="string")return ma(t,"hints"),t;if(ki(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];ma(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Gt("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ia.exports={isInt32:Fd,isUint32:Md,parseFileMode:$d,validateArray:un,validateStringArray:Kd,validateBooleanArray:Qd,validateAbortSignalArray:Jd,validateBoolean:Ea,validateBuffer:Zd,validateDictionary:Vd,validateEncoding:Xd,validateFunction:th,validateInt32:Wd,validateInteger:qd,validateNumber:zd,validateObject:Hd,validateOneOf:Gd,validatePlainFunction:rh,validatePort:eh,validateSignalName:Yd,validateString:Ni,validateUint32:Sa,validateUndefined:nh,validateUnion:ih,validateAbortSignal:Ra,validateLinkHeaderValue:oh}});var Qe=v((Pg,ka)=>{var F=ka.exports={},ye,be;function Pi(){throw new Error("setTimeout has not been defined")}function Oi(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ye=setTimeout:ye=Pi}catch{ye=Pi}try{typeof clearTimeout=="function"?be=clearTimeout:be=Oi}catch{be=Oi}})();function Aa(t){if(ye===setTimeout)return setTimeout(t,0);if((ye===Pi||!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 ah(t){if(be===clearTimeout)return clearTimeout(t);if((be===Oi||!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 Oe=[],Vt=!1,yt,fn=-1;function lh(){!Vt||!yt||(Vt=!1,yt.length?Oe=yt.concat(Oe):fn=-1,Oe.length&&Ta())}function Ta(){if(!Vt){var t=Aa(lh);Vt=!0;for(var e=Oe.length;e;){for(yt=Oe,Oe=[];++fn<e;)yt&&yt[fn].run();fn=-1,e=Oe.length}yt=null,Vt=!1,ah(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];Oe.push(new va(t,e)),Oe.length===1&&!Vt&&Aa(Ta)};function va(t,e){this.fun=t,this.array=e}va.prototype.run=function(){this.fun.apply(null,this.array)};F.title="browser";F.browser=!0;F.env={};F.argv=[];F.version="";F.versions={};function Le(){}F.on=Le;F.addListener=Le;F.once=Le;F.off=Le;F.removeListener=Le;F.removeAllListeners=Le;F.emit=Le;F.prependListener=Le;F.prependOnceListener=Le;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 ge=v((Og,za)=>{"use strict";var{SymbolAsyncIterator:ja,SymbolIterator:Na,SymbolFor:bt}=B(),Pa=bt("nodejs.stream.destroyed"),Oa=bt("nodejs.stream.errored"),Li=bt("nodejs.stream.readable"),Bi=bt("nodejs.stream.writable"),La=bt("nodejs.stream.disturbed"),uh=bt("nodejs.webstream.isClosedPromise"),fh=bt("nodejs.webstream.controllerErrorFunction");function cn(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 dn(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 ch(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function me(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Ba(t){return!!(t&&!me(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Ca(t){return!!(t&&!me(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Fa(t){return!!(t&&!me(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function dh(t){return Ba(t)||Ca(t)||Fa(t)}function hh(t,e){return t==null?!1:e===!0?typeof t[ja]=="function":e===!1?typeof t[Na]=="function":typeof t[ja]=="function"||typeof t[Na]=="function"}function hn(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Pa]||n!=null&&n.destroyed)}function Ma(t){if(!dn(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 ph(t,e){if(!dn(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 _h(t){if(!cn(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 Da(t,e){if(!cn(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 Ua(t){return t&&t[Li]!=null?t[Li]:typeof t?.readable!="boolean"?null:hn(t)?!1:cn(t)&&t.readable&&!Da(t)}function $a(t){return t&&t[Bi]!=null?t[Bi]:typeof t?.writable!="boolean"?null:hn(t)?!1:dn(t)&&t.writable&&!Ma(t)}function yh(t,e){return me(t)?hn(t)?!0:!(e?.readable!==!1&&Ua(t)||e?.writable!==!1&&$a(t)):null}function bh(t){var e,r;return me(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function mh(t){var e,r;return me(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function gh(t){if(!me(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"&&qa(t)?t._closed:null}function qa(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Wa(t){return typeof t._sent100=="boolean"&&qa(t)}function wh(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 xh(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Wa(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Sh(t){var e;return!!(t&&((e=t[La])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Eh(t){var e,r,n,i,s,o,a,l,u,f;return!!(t&&((e=(r=(n=(i=(s=(o=t[Oa])!==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))}za.exports={isDestroyed:hn,kIsDestroyed:Pa,isDisturbed:Sh,kIsDisturbed:La,isErrored:Eh,kIsErrored:Oa,isReadable:Ua,kIsReadable:Li,kIsClosedPromise:uh,kControllerErrorFunction:fh,kIsWritable:Bi,isClosed:gh,isDuplexNodeStream:ch,isFinished:yh,isIterable:hh,isReadableNodeStream:cn,isReadableStream:Ba,isReadableEnded:_h,isReadableFinished:Da,isReadableErrored:mh,isNodeStream:me,isWebStream:dh,isWritable:$a,isWritableNodeStream:dn,isWritableStream:Ca,isWritableEnded:Ma,isWritableFinished:ph,isWritableErrored:bh,isServerRequest:wh,isServerResponse:Wa,willEmitClose:xh,isTransformStream:Fa}});var Be=v((Lg,Ui)=>{"use strict";var Je=Qe(),{AbortError:Xa,codes:Rh}=Q(),{ERR_INVALID_ARG_TYPE:Ih,ERR_STREAM_PREMATURE_CLOSE:Ga}=Rh,{kEmptyObject:Fi,once:Mi}=Y(),{validateAbortSignal:Ah,validateFunction:Th,validateObject:vh,validateBoolean:kh}=Ht(),{Promise:jh,PromisePrototypeThen:Nh,SymbolDispose:el}=B(),{isClosed:Ph,isReadable:Ha,isReadableNodeStream:Ci,isReadableStream:Oh,isReadableFinished:Va,isReadableErrored:Ka,isWritable:Qa,isWritableNodeStream:Ja,isWritableStream:Lh,isWritableFinished:Ya,isWritableErrored:Za,isNodeStream:Bh,willEmitClose:Ch,kIsClosedPromise:Fh}=ge(),Kt;function Mh(t){return t.setHeader&&typeof t.abort=="function"}var Di=()=>{};function tl(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Fi):e==null?e=Fi:vh(e,"options"),Th(r,"callback"),Ah(e.signal,"options.signal"),r=Mi(r),Oh(t)||Lh(t))return Dh(t,e,r);if(!Bh(t))throw new Ih("stream",["ReadableStream","WritableStream","Stream"],t);let s=(n=e.readable)!==null&&n!==void 0?n:Ci(t),o=(i=e.writable)!==null&&i!==void 0?i:Ja(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=Ch(t)&&Ci(t)===s&&Ja(t)===o,c=Ya(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)},_=T=>{r.call(t,T)},x=Ph(t),b=()=>{x=!0;let T=Za(t)||Ka(t);if(T&&typeof T!="boolean")return r.call(t,T);if(s&&!h&&Ci(t,!0)&&!Va(t,!1))return r.call(t,new Ga);if(o&&!c&&!Ya(t,!1))return r.call(t,new Ga);r.call(t)},g=()=>{x=!0;let T=Za(t)||Ka(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},S=()=>{t.req.on("finish",d)};Mh(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?Je.nextTick(b):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Je.nextTick(g):(!s&&(!f||Ha(t))&&(c||Qa(t)===!1)||!o&&(!f||Qa(t))&&(h||Ha(t)===!1)||l&&t.req&&t.aborted)&&Je.nextTick(g);let w=()=>{r=Di,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 T=()=>{let Ae=r;w(),Ae.call(t,new Xa(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Je.nextTick(T);else{Kt=Kt||Y().addAbortListener;let Ae=Kt(e.signal,T),U=r;r=Mi((...At)=>{Ae[el](),U.apply(t,At)})}}return w}function Dh(t,e,r){let n=!1,i=Di;if(e.signal)if(i=()=>{n=!0,r.call(t,new Xa(void 0,{cause:e.signal.reason}))},e.signal.aborted)Je.nextTick(i);else{Kt=Kt||Y().addAbortListener;let o=Kt(e.signal,i),a=r;r=Mi((...l)=>{o[el](),a.apply(t,l)})}let s=(...o)=>{n||Je.nextTick(()=>r.apply(t,o))};return Nh(t[Fh].promise,s,s),Di}function Uh(t,e){var r;let n=!1;return e===null&&(e=Fi),(r=e)!==null&&r!==void 0&&r.cleanup&&(kh(e.cleanup,"cleanup"),n=e.cleanup),new jh((i,s)=>{let o=tl(t,e,a=>{n&&o(),a?s(a):i()})})}Ui.exports=tl;Ui.exports.finished=Uh});var mt=v((Bg,ul)=>{"use strict";var we=Qe(),{aggregateTwoErrors:$h,codes:{ERR_MULTIPLE_CALLBACK:qh},AbortError:Wh}=Q(),{Symbol:il}=B(),{kIsDestroyed:zh,isDestroyed:Gh,isFinished:Hh,isServerRequest:Vh}=ge(),sl=il("kDestroy"),$i=il("kConstruct");function ol(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Kh(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):(ol(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?rl(this,t,e):this.once(sl,function(s){rl(this,$h(s,t),e)}),this)}function rl(t,e,r){let n=!1;function i(s){if(n)return;n=!0;let o=t._readableState,a=t._writableState;ol(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?we.nextTick(Qh,t,s):we.nextTick(al,t)}try{t._destroy(e||null,i)}catch(s){i(s)}}function Qh(t,e){qi(t,e),al(t)}function al(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 qi(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 Jh(){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 Wi(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(qi,t,e):qi(t,e))}function Yh(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($i,e),!(t.listenerCount($i)>1)&&we.nextTick(Zh,t)}function Zh(t){let e=!1;function r(n){if(e){Wi(t,n??new qh);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(sl,n):n?Wi(t,n,!0):we.nextTick(Xh,t)}try{t._construct(n=>{we.nextTick(r,n)})}catch(n){we.nextTick(r,n)}}function Xh(t){t.emit($i)}function nl(t){return t?.setHeader&&typeof t.abort=="function"}function ll(t){t.emit("close")}function ep(t,e){t.emit("error",e),we.nextTick(ll,t)}function tp(t,e){!t||Gh(t)||(!e&&!Hh(t)&&(e=new Wh),Vh(t)?(t.socket=null,t.destroy(e)):nl(t)?t.abort():nl(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?we.nextTick(ep,t,e):we.nextTick(ll,t),t.destroyed||(t[zh]=!0))}ul.exports={construct:Yh,destroyer:tp,destroy:Kh,undestroy:Jh,errorOrDestroy:Wi}});var yn=v((Cg,cl)=>{"use strict";var{ArrayIsArray:rp,ObjectSetPrototypeOf:fl}=B(),{EventEmitter:pn}=Er();function _n(t){pn.call(this,t)}fl(_n.prototype,pn.prototype);fl(_n,pn);_n.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(),pn.listenerCount(this,"error")===0&&this.emit("error",f)}zi(r,"error",l),zi(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 zi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):rp(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}cl.exports={Stream:_n,prependListener:zi}});var Rr=v((Fg,bn)=>{"use strict";var{SymbolDispose:np}=B(),{AbortError:dl,codes:ip}=Q(),{isNodeStream:hl,isWebStream:sp,kControllerErrorFunction:op}=ge(),ap=Be(),{ERR_INVALID_ARG_TYPE:pl}=ip,Gi,lp=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new pl(e,"AbortSignal",t)};bn.exports.addAbortSignal=function(e,r){if(lp(e,"signal"),!hl(r)&&!sp(r))throw new pl("stream",["ReadableStream","WritableStream","Stream"],r);return bn.exports.addAbortSignalNoValidate(e,r)};bn.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=hl(e)?()=>{e.destroy(new dl(void 0,{cause:t.reason}))}:()=>{e[op](new dl(void 0,{cause:t.reason}))};if(t.aborted)r();else{Gi=Gi||Y().addAbortListener;let n=Gi(t,r);ap(e,n[np])}return e}});var bl=v((Dg,yl)=>{"use strict";var{StringPrototypeSlice:_l,SymbolIterator:up,TypedArrayPrototypeSet:mn,Uint8Array:fp}=B(),{Buffer:Hi}=pe(),{inspect:cp}=Y();yl.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 Hi.alloc(0);let r=Hi.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)mn(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}*[up](){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+=_l(s,0,e),this.head=n,n.data=_l(s,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Hi.allocUnsafe(e),n=e,i=this.head,s=0;do{let o=i.data;if(e>o.length)mn(r,o,n-e),e-=o.length;else{e===o.length?(mn(r,o,n-e),++s,i.next?this.head=i.next:this.head=this.tail=null):(mn(r,new fp(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 cp(this,{...r,depth:0,customInspect:!1})}}});var Ir=v((Ug,xl)=>{"use strict";var{MathFloor:dp,NumberIsInteger:hp}=B(),{validateInteger:pp}=Ht(),{ERR_INVALID_ARG_VALUE:_p}=Q().codes,ml=16*1024,gl=16;function yp(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function wl(t){return t?gl:ml}function bp(t,e){pp(e,"value",0),t?gl=e:ml=e}function mp(t,e,r,n){let i=yp(e,n,r);if(i!=null){if(!hp(i)||i<0){let s=n?`options.${r}`:"options.highWaterMark";throw new _p(s,i)}return dp(i)}return wl(t.objectMode)}xl.exports={getHighWaterMark:mp,getDefaultHighWaterMark:wl,setDefaultHighWaterMark:bp}});var Rl=v((Vi,El)=>{var gn=pe(),xe=gn.Buffer;function Sl(t,e){for(var r in t)e[r]=t[r]}xe.from&&xe.alloc&&xe.allocUnsafe&&xe.allocUnsafeSlow?El.exports=gn:(Sl(gn,Vi),Vi.Buffer=gt);function gt(t,e,r){return xe(t,e,r)}gt.prototype=Object.create(xe.prototype);Sl(xe,gt);gt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xe(t,e,r)};gt.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};gt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xe(t)};gt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gn.SlowBuffer(t)}});var Tl=v(Al=>{"use strict";var Qi=Rl().Buffer,Il=Qi.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function gp(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 wp(t){var e=gp(t);if(typeof e!="string"&&(Qi.isEncoding===Il||!Il(t)))throw new Error("Unknown encoding: "+t);return e||t}Al.StringDecoder=Ar;function Ar(t){this.encoding=wp(t);var e;switch(this.encoding){case"utf16le":this.text=Ap,this.end=Tp,e=4;break;case"utf8":this.fillLast=Ep,e=4;break;case"base64":this.text=vp,this.end=kp,e=3;break;default:this.write=jp,this.end=Np;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Qi.allocUnsafe(e)}Ar.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||""};Ar.prototype.end=Ip;Ar.prototype.text=Rp;Ar.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function Ki(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function xp(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Ki(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Ki(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Ki(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Sp(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 Ep(t){var e=this.lastTotal-this.lastNeed,r=Sp(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 Rp(t,e){var r=xp(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 Ip(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Ap(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 Tp(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 vp(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 kp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function jp(t){return t.toString(this.encoding)}function Np(t){return t&&t.length?this.write(t):""}});var Ji=v((qg,Nl)=>{"use strict";var vl=Qe(),{PromisePrototypeThen:Pp,SymbolAsyncIterator:kl,SymbolIterator:jl}=B(),{Buffer:Op}=pe(),{ERR_INVALID_ARG_TYPE:Lp,ERR_STREAM_NULL_VALUES:Bp}=Q().codes;function Cp(t,e,r){let n;if(typeof e=="string"||e instanceof Op)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[kl])i=!0,n=e[kl]();else if(e&&e[jl])i=!1,n=e[jl]();else throw new Lp("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),()=>vl.nextTick(f,u),c=>vl.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}Nl.exports=Cp});var vr=v((Wg,Ql)=>{"use strict";var le=Qe(),{ArrayPrototypeIndexOf:Fp,NumberIsInteger:Mp,NumberIsNaN:Dp,NumberParseInt:Up,ObjectDefineProperties:is,ObjectKeys:$p,ObjectSetPrototypeOf:Ll,Promise:Bl,SafeSet:qp,SymbolAsyncDispose:Wp,SymbolAsyncIterator:zp,Symbol:Gp}=B();Ql.exports=I;I.ReadableState=En;var{EventEmitter:Hp}=Er(),{Stream:Ye,prependListener:Vp}=yn(),{Buffer:Yi}=pe(),{addAbortSignal:Kp}=Rr(),Cl=Be(),A=Y().debuglog("stream",t=>{A=t}),Qp=bl(),Yt=mt(),{getHighWaterMark:Jp,getDefaultHighWaterMark:Yp}=Ir(),{aggregateTwoErrors:Pl,codes:{ERR_INVALID_ARG_TYPE:Zp,ERR_METHOD_NOT_IMPLEMENTED:Xp,ERR_OUT_OF_RANGE:e_,ERR_STREAM_PUSH_AFTER_EOF:t_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:r_},AbortError:n_}=Q(),{validateObject:i_}=Ht(),wt=Gp("kPaused"),{StringDecoder:Fl}=Tl(),s_=Ji();Ll(I.prototype,Ye.prototype);Ll(I,Ye);var Zi=()=>{},{errorOrDestroy:Qt}=Yt,Jt=1,o_=2,Ml=4,Tr=8,Dl=16,wn=32,xn=64,Ul=128,a_=256,l_=512,u_=1024,rs=2048,ns=4096,f_=8192,c_=16384,d_=32768,$l=65536,h_=1<<17,p_=1<<18;function q(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}is(En.prototype,{objectMode:q(Jt),ended:q(o_),endEmitted:q(Ml),reading:q(Tr),constructed:q(Dl),sync:q(wn),needReadable:q(xn),emittedReadable:q(Ul),readableListening:q(a_),resumeScheduled:q(l_),errorEmitted:q(u_),emitClose:q(rs),autoDestroy:q(ns),destroyed:q(f_),closed:q(c_),closeEmitted:q(d_),multiAwaitDrain:q($l),readingMore:q(h_),dataEmitted:q(p_)});function En(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.state=rs|ns|Dl|wn,t&&t.objectMode&&(this.state|=Jt),r&&t&&t.readableObjectMode&&(this.state|=Jt),this.highWaterMark=t?Jp(this,t,"readableHighWaterMark",r):Yp(!1),this.buffer=new Qp,this.length=0,this.pipes=[],this.flowing=null,this[wt]=null,t&&t.emitClose===!1&&(this.state&=~rs),t&&t.autoDestroy===!1&&(this.state&=~ns),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Fl(t.encoding),this.encoding=t.encoding)}function I(t){if(!(this instanceof I))return new I(t);let e=this instanceof Se();this._readableState=new En(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&&Kp(t.signal,this)),Ye.call(this,t),Yt.construct(this,()=>{this._readableState.needReadable&&Sn(this,this._readableState)})}I.prototype.destroy=Yt.destroy;I.prototype._undestroy=Yt.undestroy;I.prototype._destroy=function(t,e){e(t)};I.prototype[Hp.captureRejectionSymbol]=function(t){this.destroy(t)};I.prototype[Wp]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new n_,this.destroy(t)),new Bl((e,r)=>Cl(this,n=>n&&n!==t?r(n):e(null)))};I.prototype.push=function(t,e){return ql(this,t,e,!1)};I.prototype.unshift=function(t,e){return ql(this,t,e,!0)};function ql(t,e,r,n){A("readableAddChunk",e);let i=t._readableState,s;if((i.state&Jt)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Yi.from(e,r).toString(i.encoding):(e=Yi.from(e,r),r=""))):e instanceof Yi?r="":Ye._isUint8Array(e)?(e=Ye._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Zp("chunk",["string","Buffer","Uint8Array"],e))),s)Qt(t,s);else if(e===null)i.state&=~Tr,b_(t,i);else if((i.state&Jt)!==0||e&&e.length>0)if(n)if((i.state&Ml)!==0)Qt(t,new r_);else{if(i.destroyed||i.errored)return!1;Xi(t,i,e,!0)}else if(i.ended)Qt(t,new t_);else{if(i.destroyed||i.errored)return!1;i.state&=~Tr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Xi(t,i,e,!1):Sn(t,i)):Xi(t,i,e,!1)}else n||(i.state&=~Tr,Sn(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function Xi(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&$l)!==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&xn)!==0&&Rn(t)),Sn(t,e)}I.prototype.isPaused=function(){let t=this._readableState;return t[wt]===!0||t.flowing===!1};I.prototype.setEncoding=function(t){let e=new Fl(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 __=1073741824;function y_(t){if(t>__)throw new e_("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Ol(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Jt)!==0?1:Dp(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}I.prototype.read=function(t){A("read",t),t===void 0?t=NaN:Mp(t)||(t=Up(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=y_(t)),t!==0&&(e.state&=~Ul),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return A("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?es(this):Rn(this),null;if(t=Ol(t,e),t===0&&e.ended)return e.length===0&&es(this),null;let n=(e.state&xn)!==0;if(A("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,A("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,A("reading, ended or constructing",n);else if(n){A("do read"),e.state|=Tr|wn,e.length===0&&(e.state|=xn);try{this._read(e.highWaterMark)}catch(s){Qt(this,s)}e.state&=~wn,e.reading||(t=Ol(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&&es(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function b_(t,e){if(A("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?Rn(t):(e.needReadable=!1,e.emittedReadable=!0,Wl(t))}}function Rn(t){let e=t._readableState;A("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(A("emitReadable",e.flowing),e.emittedReadable=!0,le.nextTick(Wl,t))}function Wl(t){let e=t._readableState;A("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,Gl(t)}function Sn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,le.nextTick(m_,t,e))}function m_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(A("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}I.prototype._read=function(t){throw new Xp("_read()")};I.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new qp(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),A("pipe count=%d opts=%j",n.pipes.length,e);let s=(!e||e.end!==!1)&&t!==le.stdout&&t!==le.stderr?a:x;n.endEmitted?le.nextTick(s):r.once("end",s),t.on("unpipe",o);function o(b,g){A("onunpipe"),b===r&&g&&g.hasUnpiped===!1&&(g.hasUnpiped=!0,f())}function a(){A("onend"),t.end()}let l,u=!1;function f(){A("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?(A("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(A("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),l||(l=g_(r,t),t.on("drain",l))}r.on("data",d);function d(b){A("ondata");let g=t.write(b);A("dest.write",g),g===!1&&c()}function h(b){if(A("onerror",b),x(),t.removeListener("error",h),t.listenerCount("error")===0){let g=t._writableState||t._readableState;g&&!g.errorEmitted?Qt(t,b):t.emit("error",b)}}Vp(t,"error",h);function y(){t.removeListener("finish",_),x()}t.once("close",y);function _(){A("onfinish"),t.removeListener("close",y),x()}t.once("finish",_);function x(){A("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?c():n.flowing||(A("pipe resume"),r.resume()),t};function g_(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(A("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(A("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}I.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=Fp(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};I.prototype.on=function(t,e){let r=Ye.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,A("on readable",n.length,n.reading),n.length?Rn(this):n.reading||le.nextTick(w_,this)),r};I.prototype.addListener=I.prototype.on;I.prototype.removeListener=function(t,e){let r=Ye.prototype.removeListener.call(this,t,e);return t==="readable"&&le.nextTick(zl,this),r};I.prototype.off=I.prototype.removeListener;I.prototype.removeAllListeners=function(t){let e=Ye.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&le.nextTick(zl,this),e};function zl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[wt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function w_(t){A("readable nexttick read 0"),t.read(0)}I.prototype.resume=function(){let t=this._readableState;return t.flowing||(A("resume"),t.flowing=!t.readableListening,x_(this,t)),t[wt]=!1,this};function x_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,le.nextTick(S_,t,e))}function S_(t,e){A("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Gl(t),e.flowing&&!e.reading&&t.read(0)}I.prototype.pause=function(){return A("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(A("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[wt]=!0,this};function Gl(t){let e=t._readableState;for(A("flow",e.flowing);e.flowing&&t.read()!==null;);}I.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=>{Qt(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=$p(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};I.prototype[zp]=function(){return Hl(this)};I.prototype.iterator=function(t){return t!==void 0&&i_(t,"options"),Hl(this,t)};function Hl(t,e){typeof t.read!="function"&&(t=I.wrap(t,{objectMode:!0}));let r=E_(t,e);return r.stream=t,r}async function*E_(t,e){let r=Zi;function n(o){this===t?(r(),r=Zi):r=o}t.on("readable",n);let i,s=Cl(t,{writable:!1},o=>{i=o?Pl(i,o):null,r(),r=Zi});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 Bl(n)}}}catch(o){throw i=Pl(i,o),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Yt.destroyer(t,null):(t.off("readable",n),s())}}is(I.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}}});is(En.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[wt]!==!1},set(t){this[wt]=!!t}}});I._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 es(t){let e=t._readableState;A("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,le.nextTick(R_,e,t))}function R_(t,e){if(A("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)le.nextTick(I_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function I_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}I.from=function(t,e){return s_(I,t,e)};var ts;function Kl(){return ts===void 0&&(ts={}),ts}I.fromWeb=function(t,e){return Kl().newStreamReadableFromReadableStream(t,e)};I.toWeb=function(t,e){return Kl().newReadableStreamFromStreamReadable(t,e)};I.wrap=function(t,e){var r,n;return new I({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,s){Yt.destroyer(t,i),s(i)}}).wrap(t)}});var kn=v((zg,au)=>{"use strict";var xt=Qe(),{ArrayPrototypeSlice:Zl,Error:A_,FunctionPrototypeSymbolHasInstance:Xl,ObjectDefineProperty:eu,ObjectDefineProperties:T_,ObjectSetPrototypeOf:tu,StringPrototypeToLowerCase:v_,Symbol:k_,SymbolHasInstance:j_}=B();au.exports=C;C.WritableState=Nr;var{EventEmitter:N_}=Er(),kr=yn().Stream,{Buffer:In}=pe(),vn=mt(),{addAbortSignal:P_}=Rr(),{getHighWaterMark:O_,getDefaultHighWaterMark:L_}=Ir(),{ERR_INVALID_ARG_TYPE:B_,ERR_METHOD_NOT_IMPLEMENTED:C_,ERR_MULTIPLE_CALLBACK:ru,ERR_STREAM_CANNOT_PIPE:F_,ERR_STREAM_DESTROYED:jr,ERR_STREAM_ALREADY_FINISHED:M_,ERR_STREAM_NULL_VALUES:D_,ERR_STREAM_WRITE_AFTER_END:U_,ERR_UNKNOWN_ENCODING:nu}=Q().codes,{errorOrDestroy:Zt}=vn;tu(C.prototype,kr.prototype);tu(C,kr);function as(){}var Xt=k_("kOnFinished");function Nr(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?O_(this,t,"writableHighWaterMark",r):L_(!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=q_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Tn(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[Xt]=[]}function Tn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Nr.prototype.getBuffer=function(){return Zl(this.buffered,this.bufferedIndex)};eu(Nr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function C(t){let e=this instanceof Se();if(!e&&!Xl(C,this))return new C(t);this._writableState=new Nr(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)),kr.call(this,t),vn.construct(this,()=>{let r=this._writableState;r.writing||us(this,r),fs(this,r)})}eu(C,j_,{__proto__:null,value:function(t){return Xl(this,t)?!0:this!==C?!1:t&&t._writableState instanceof Nr}});C.prototype.pipe=function(){Zt(this,new F_)};function iu(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"&&!In.isEncoding(r))throw new nu(r);typeof n!="function"&&(n=as)}if(e===null)throw new D_;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=In.from(e,r),r="buffer");else if(e instanceof In)r="buffer";else if(kr._isUint8Array(e))e=kr._uint8ArrayToBuffer(e),r="buffer";else throw new B_("chunk",["string","Buffer","Uint8Array"],e);let s;return i.ending?s=new U_:i.destroyed&&(s=new jr("write")),s?(xt.nextTick(n,s),Zt(t,s,!0),s):(i.pendingcb++,$_(t,i,e,r,n))}C.prototype.write=function(t,e,r){return iu(this,t,e,r)===!0};C.prototype.cork=function(){this._writableState.corked++};C.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||us(this,t))};C.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=v_(e)),!In.isEncoding(e))throw new nu(e);return this._writableState.defaultEncoding=e,this};function $_(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!==as&&(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 Jl(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new jr("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function Yl(t,e,r,n){--e.pendingcb,n(r),ls(e),Zt(t,r)}function q_(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Zt(t,new ru);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?xt.nextTick(Yl,t,r,e,i):Yl(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&us(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},xt.nextTick(W_,r.afterWriteTickInfo)):su(t,r,1,i))}function W_({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,su(t,e,r,n)}function su(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&&ls(e),fs(t,e)}function ls(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 jr("write"))}let r=t[Xt].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new jr("end"))}Tn(t)}function us(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?as:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:Zl(r,o);l.allBuffers=e.allBuffers,Jl(t,e,!0,e.length,l,"",a),Tn(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=i?1:a.length;Jl(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?Tn(e):o>256?(r.splice(0,o),e.bufferedIndex=0):e.bufferedIndex=o}e.bufferProcessing=!1}C.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new C_("_write()")};C.prototype._writev=null;C.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=iu(this,t,e);s instanceof A_&&(i=s)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,fs(this,n,!0),n.ended=!0):n.finished?i=new M_("end"):n.destroyed&&(i=new jr("end"))),typeof r=="function"&&(i||n.finished?xt.nextTick(r,i):n[Xt].push(r)),this};function An(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 z_(t,e){let r=!1;function n(i){if(r){Zt(t,i??ru());return}if(r=!0,e.pendingcb--,i){let s=e[Xt].splice(0);for(let o=0;o<s.length;o++)s[o](i);Zt(t,i,e.sync)}else An(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,xt.nextTick(os,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function G_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,z_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function fs(t,e,r){An(e)&&(G_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,xt.nextTick((n,i)=>{An(i)?os(n,i):i.pendingcb--},t,e)):An(e)&&(e.pendingcb++,os(t,e))))}function os(t,e){e.pendingcb--,e.finished=!0;let r=e[Xt].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()}}T_(C.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 H_=vn.destroy;C.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Xt].length)&&xt.nextTick(ls,r),H_.call(this,t,e),this};C.prototype._undestroy=vn.undestroy;C.prototype._destroy=function(t,e){e(t)};C.prototype[N_.captureRejectionSymbol]=function(t){this.destroy(t)};var ss;function ou(){return ss===void 0&&(ss={}),ss}C.fromWeb=function(t,e){return ou().newStreamWritableFromWritableStream(t,e)};C.toWeb=function(t){return ou().newWritableStreamFromStreamWritable(t)}});var Su=v((Gg,xu)=>{var cs=Qe(),V_=pe(),{isReadable:K_,isWritable:Q_,isIterable:lu,isNodeStream:J_,isReadableNodeStream:uu,isWritableNodeStream:fu,isDuplexNodeStream:Y_,isReadableStream:cu,isWritableStream:du}=ge(),hu=Be(),{AbortError:gu,codes:{ERR_INVALID_ARG_TYPE:Z_,ERR_INVALID_RETURN_VALUE:pu}}=Q(),{destroyer:tr}=mt(),X_=Se(),wu=vr(),ey=kn(),{createDeferredPromise:_u}=Y(),yu=Ji(),bu=globalThis.Blob||V_.Blob,ty=typeof bu<"u"?function(e){return e instanceof bu}:function(e){return!1},ry=globalThis.AbortController||Wt().AbortController,{FunctionPrototypeCall:mu}=B(),Ze=class extends X_{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)}};xu.exports=function t(e,r){if(Y_(e))return e;if(uu(e))return er({readable:e});if(fu(e))return er({writable:e});if(J_(e))return er({writable:!1,readable:!1});if(cu(e))return er({readable:wu.fromWeb(e)});if(du(e))return er({writable:ey.fromWeb(e)});if(typeof e=="function"){let{value:i,write:s,final:o,destroy:a}=ny(e);if(lu(i))return yu(Ze,i,{objectMode:!0,write:s,final:o,destroy:a});let l=i?.then;if(typeof l=="function"){let u,f=mu(l,i,c=>{if(c!=null)throw new pu("nully","body",c)},c=>{tr(u,c)});return u=new Ze({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,cs.nextTick(c,null)}catch(d){cs.nextTick(c,d)}})},destroy:a})}throw new pu("Iterable, AsyncIterable or AsyncFunction",r,i)}if(ty(e))return t(e.arrayBuffer());if(lu(e))return yu(Ze,e,{objectMode:!0,writable:!1});if(cu(e?.readable)&&du(e?.writable))return Ze.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?uu(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?fu(e?.writable)?e?.writable:t(e.writable):void 0;return er({readable:i,writable:s})}let n=e?.then;if(typeof n=="function"){let i;return mu(n,e,s=>{s!=null&&i.push(s),i.push(null)},s=>{tr(i,s)}),i=new Ze({objectMode:!0,writable:!1,read(){}})}throw new Z_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function ny(t){let{promise:e,resolve:r}=_u(),n=new ry,i=n.signal;return{value:t((async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(cs.nextTick(u),l)return;if(i.aborted)throw new gu(void 0,{cause:i.reason});({promise:e,resolve:r}=_u()),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 er(t){let e=t.readable&&typeof t.readable.read!="function"?wu.wrap(t.readable):t.readable,r=t.writable,n=!!K_(e),i=!!Q_(r),s,o,a,l,u;function f(c){let d=l;l=null,d?d(c):c&&u.destroy(c)}return u=new Ze({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(hu(r,c=>{i=!1,c&&tr(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&&(hu(e,c=>{n=!1,c&&tr(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 gu),a=null,s=null,o=null,l===null?d(c):(l=d,tr(r,c),tr(e,c))},u}});var Se=v((Hg,Iu)=>{"use strict";var{ObjectDefineProperties:iy,ObjectGetOwnPropertyDescriptor:Ce,ObjectKeys:sy,ObjectSetPrototypeOf:Eu}=B();Iu.exports=ue;var ps=vr(),se=kn();Eu(ue.prototype,ps.prototype);Eu(ue,ps);{let t=sy(se.prototype);for(let e=0;e<t.length;e++){let r=t[e];ue.prototype[r]||(ue.prototype[r]=se.prototype[r])}}function ue(t){if(!(this instanceof ue))return new ue(t);ps.call(this,t),se.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}iy(ue.prototype,{writable:{__proto__:null,...Ce(se.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Ce(se.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Ce(se.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Ce(se.prototype,"writableBuffer")},writableLength:{__proto__:null,...Ce(se.prototype,"writableLength")},writableFinished:{__proto__:null,...Ce(se.prototype,"writableFinished")},writableCorked:{__proto__:null,...Ce(se.prototype,"writableCorked")},writableEnded:{__proto__:null,...Ce(se.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Ce(se.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 ds;function Ru(){return ds===void 0&&(ds={}),ds}ue.fromWeb=function(t,e){return Ru().newStreamDuplexFromReadableWritablePair(t,e)};ue.toWeb=function(t){return Ru().newReadableWritablePairFromDuplex(t)};var hs;ue.from=function(t){return hs||(hs=Su()),hs(t,"body")}});var bs=v((Vg,Tu)=>{"use strict";var{ObjectSetPrototypeOf:Au,Symbol:oy}=B();Tu.exports=Fe;var{ERR_METHOD_NOT_IMPLEMENTED:ay}=Q().codes,ys=Se(),{getHighWaterMark:ly}=Ir();Au(Fe.prototype,ys.prototype);Au(Fe,ys);var Pr=oy("kCallback");function Fe(t){if(!(this instanceof Fe))return new Fe(t);let e=t?ly(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ys.call(this,t),this._readableState.sync=!1,this[Pr]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",uy)}function _s(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 uy(){this._final!==_s&&_s.call(this)}Fe.prototype._final=_s;Fe.prototype._transform=function(t,e,r){throw new ay("_transform()")};Fe.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[Pr]=r})};Fe.prototype._read=function(){if(this[Pr]){let t=this[Pr];this[Pr]=null,t()}}});var gs=v((Kg,ku)=>{"use strict";var{ObjectSetPrototypeOf:vu}=B();ku.exports=rr;var ms=bs();vu(rr.prototype,ms.prototype);vu(rr,ms);function rr(t){if(!(this instanceof rr))return new rr(t);ms.call(this,t)}rr.prototype._transform=function(t,e,r){r(null,t)}});var On=v((Qg,Lu)=>{var Or=Qe(),{ArrayIsArray:fy,Promise:cy,SymbolAsyncIterator:dy,SymbolDispose:hy}=B(),Pn=Be(),{once:py}=Y(),_y=mt(),ju=Se(),{aggregateTwoErrors:yy,codes:{ERR_INVALID_ARG_TYPE:vs,ERR_INVALID_RETURN_VALUE:ws,ERR_MISSING_ARGS:by,ERR_STREAM_DESTROYED:my,ERR_STREAM_PREMATURE_CLOSE:gy},AbortError:wy}=Q(),{validateFunction:xy,validateAbortSignal:Sy}=Ht(),{isIterable:St,isReadable:xs,isReadableNodeStream:Nn,isNodeStream:Nu,isTransformStream:nr,isWebStream:Ey,isReadableStream:Ss,isReadableFinished:Ry}=ge(),Iy=globalThis.AbortController||Wt().AbortController,Es,Rs,Is;function Pu(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=Pn(t,{readable:e,writable:r},s=>{n=!s});return{destroy:s=>{n||(n=!0,_y.destroyer(t,s||new my("pipe")))},cleanup:i}}function Ay(t){return xy(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function As(t){if(St(t))return t;if(Nn(t))return Ty(t);throw new vs("val",["Readable","Iterable","AsyncIterable"],t)}async function*Ty(t){Rs||(Rs=vr()),yield*Rs.prototype[dy].call(t)}async function jn(t,e,r,{end:n}){let i,s=null,o=u=>{if(u&&(i=u),s){let f=s;s=null,f()}},a=()=>new cy((u,f)=>{i?f(i):s=()=>{i?f(i):u()}});e.on("drain",o);let l=Pn(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?yy(i,u):u)}finally{l(),e.off("drain",o)}}async function Ts(t,e,r,{end:n}){nr(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 vy(...t){return Ou(t,py(Ay(t)))}function Ou(t,e,r){if(t.length===1&&fy(t[0])&&(t=t[0]),t.length<2)throw new by("streams");let n=new Iy,i=n.signal,s=r?.signal,o=[];Sy(s,"options.signal");function a(){y(new wy)}Is=Is||Y().addAbortListener;let l;s&&(l=Is(s,a));let u,f,c=[],d=0;function h(S){y(S,--d===0)}function y(S,w){var T;if(S&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=S),!(!u&&!w)){for(;c.length;)c.shift()(u);(T=l)===null||T===void 0||T[hy](),n.abort(),w&&(u||o.forEach(Ae=>Ae()),Or.nextTick(e,u,f))}}let _;for(let S=0;S<t.length;S++){let w=t[S],T=S<t.length-1,Ae=S>0,U=T||r?.end!==!1,At=S===t.length-1;if(Nu(w)){let Z=function(Te){Te&&Te.name!=="AbortError"&&Te.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(Te)};var g=Z;if(U){let{destroy:Te,cleanup:Wn}=Pu(w,T,Ae);c.push(Te),xs(w)&&At&&o.push(Wn)}w.on("error",Z),xs(w)&&At&&o.push(()=>{w.removeListener("error",Z)})}if(S===0)if(typeof w=="function"){if(_=w({signal:i}),!St(_))throw new ws("Iterable, AsyncIterable or Stream","source",_)}else St(w)||Nn(w)||nr(w)?_=w:_=ju.from(w);else if(typeof w=="function"){if(nr(_)){var x;_=As((x=_)===null||x===void 0?void 0:x.readable)}else _=As(_);if(_=w(_,{signal:i}),T){if(!St(_,!0))throw new ws("AsyncIterable",`transform[${S-1}]`,_)}else{var b;Es||(Es=gs());let Z=new Es({objectMode:!0}),Te=(b=_)===null||b===void 0?void 0:b.then;if(typeof Te=="function")d++,Te.call(_,Ue=>{f=Ue,Ue!=null&&Z.write(Ue),U&&Z.end(),Or.nextTick(h)},Ue=>{Z.destroy(Ue),Or.nextTick(h,Ue)});else if(St(_,!0))d++,jn(_,Z,h,{end:U});else if(Ss(_)||nr(_)){let Ue=_.readable||_;d++,jn(Ue,Z,h,{end:U})}else throw new ws("AsyncIterable or Promise","destination",_);_=Z;let{destroy:Wn,cleanup:xf}=Pu(_,!1,!0);c.push(Wn),At&&o.push(xf)}}else if(Nu(w)){if(Nn(_)){d+=2;let Z=ky(_,w,h,{end:U});xs(w)&&At&&o.push(Z)}else if(nr(_)||Ss(_)){let Z=_.readable||_;d++,jn(Z,w,h,{end:U})}else if(St(_))d++,jn(_,w,h,{end:U});else throw new vs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else if(Ey(w)){if(Nn(_))d++,Ts(As(_),w,h,{end:U});else if(Ss(_)||St(_))d++,Ts(_,w,h,{end:U});else if(nr(_))d++,Ts(_.readable,w,h,{end:U});else throw new vs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else _=ju.from(w)}return(i!=null&&i.aborted||s!=null&&s.aborted)&&Or.nextTick(a),_}function ky(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new gy)}),t.pipe(e,{end:!1}),n){let o=function(){i=!0,e.end()};var s=o;Ry(t)?Or.nextTick(o):t.once("end",o)}else r();return Pn(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)}),Pn(e,{readable:!1,writable:!0},r)}Lu.exports={pipelineImpl:Ou,pipeline:vy}});var js=v((Jg,Uu)=>{"use strict";var{pipeline:jy}=On(),Ln=Se(),{destroyer:Ny}=mt(),{isNodeStream:Bn,isReadable:Bu,isWritable:Cu,isWebStream:ks,isTransformStream:Et,isWritableStream:Fu,isReadableStream:Mu}=ge(),{AbortError:Py,codes:{ERR_INVALID_ARG_VALUE:Du,ERR_MISSING_ARGS:Oy}}=Q(),Ly=Be();Uu.exports=function(...e){if(e.length===0)throw new Oy("streams");if(e.length===1)return Ln.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Ln.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=Ln.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Bn(e[h])&&!ks(e[h]))){if(h<e.length-1&&!(Bu(e[h])||Mu(e[h])||Et(e[h])))throw new Du(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Cu(e[h])||Fu(e[h])||Et(e[h])))throw new Du(`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=jy(e,l),c=!!(Cu(u)||Fu(u)||Et(u)),d=!!(Bu(f)||Mu(f)||Et(f));if(a=new Ln({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(Bn(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(ks(u)){let _=(Et(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=Et(f)?f.readable:f;Ly(h,()=>{if(i){let y=i;i=null,y()}})}if(d){if(Bn(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(ks(f)){let y=(Et(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,Bn(f)&&Ny(f,h))},a}});var Ju=v((Yg,Os)=>{"use strict";var By=globalThis.AbortController||Wt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Cy,ERR_INVALID_ARG_TYPE:Lr,ERR_MISSING_ARGS:Fy,ERR_OUT_OF_RANGE:My},AbortError:Ee}=Q(),{validateAbortSignal:Rt,validateInteger:$u,validateObject:It}=Ht(),Dy=B().Symbol("kWeak"),Uy=B().Symbol("kResistStopPropagation"),{finished:$y}=Be(),qy=js(),{addAbortSignalNoValidate:Wy}=Rr(),{isWritable:zy,isNodeStream:Gy}=ge(),{deprecate:Hy}=Y(),{ArrayPrototypePush:Vy,Boolean:Ky,MathFloor:qu,Number:Qy,NumberIsNaN:Jy,Promise:Wu,PromiseReject:zu,PromiseResolve:Yy,PromisePrototypeThen:Gu,Symbol:Vu}=B(),Cn=Vu("kEmpty"),Hu=Vu("kEof");function Zy(t,e){if(e!=null&&It(e,"options"),e?.signal!=null&&Rt(e.signal,"options.signal"),Gy(t)&&!zy(t))throw new Cy("stream",t,"must be writable");let r=qy(this,t);return e!=null&&e.signal&&Wy(e.signal,r),r}function Fn(t,e){if(typeof t!="function")throw new Lr("fn",["Function","AsyncFunction"],t);e!=null&&It(e,"options"),e?.signal!=null&&Rt(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=qu(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=qu(e.highWaterMark)),$u(r,"options.concurrency",1),$u(n,"options.highWaterMark",0),n+=r,async function*(){let s=Y().AbortSignalAny([e?.signal].filter(Ky)),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===Cn)continue;b=Yy(b)}catch(g){b=zu(g)}d+=1,Gu(b,y,h),a.push(b),u&&(u(),u=null),!c&&(a.length>=n||d>=r)&&await new Wu(g=>{f=g})}a.push(Hu)}catch(b){let g=zu(b);Gu(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===Hu)return;if(s.aborted)throw new Ee;b!==Cn&&(yield b),a.shift(),_()}await new Wu(b=>{u=b})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function Xy(t=void 0){return t!=null&&It(t,"options"),t?.signal!=null&&Rt(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 Ku(t,e=void 0){for await(let r of Ps.call(this,t,e))return!0;return!1}async function eb(t,e=void 0){if(typeof t!="function")throw new Lr("fn",["Function","AsyncFunction"],t);return!await Ku.call(this,async(...r)=>!await t(...r),e)}async function tb(t,e){for await(let r of Ps.call(this,t,e))return r}async function rb(t,e){if(typeof t!="function")throw new Lr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),Cn}for await(let n of Fn.call(this,r,e));}function Ps(t,e){if(typeof t!="function")throw new Lr("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:Cn}return Fn.call(this,r,e)}var Ns=class extends Fy{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function nb(t,e,r){var n;if(typeof t!="function")throw new Lr("reducer",["Function","AsyncFunction"],t);r!=null&&It(r,"options"),r?.signal!=null&&Rt(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 $y(this.destroy(u)),u}let s=new By,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[Dy]:this,[Uy]:!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 Ns}finally{s.abort()}return e}async function ib(t){t!=null&&It(t,"options"),t?.signal!=null&&Rt(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});Vy(e,n)}return e}function sb(t,e){let r=Fn.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function Qu(t){if(t=Qy(t),Jy(t))return 0;if(t<0)throw new My("number",">= 0",t);return t}function ob(t,e=void 0){return e!=null&&It(e,"options"),e?.signal!=null&&Rt(e.signal,"options.signal"),t=Qu(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 ab(t,e=void 0){return e!=null&&It(e,"options"),e?.signal!=null&&Rt(e.signal,"options.signal"),t=Qu(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)}Os.exports.streamReturningOperators={asIndexedPairs:Hy(Xy,"readable.asIndexedPairs will be removed in a future version."),drop:ob,filter:Ps,flatMap:sb,map:Fn,take:ab,compose:Zy};Os.exports.promiseReturningOperators={every:eb,forEach:rb,reduce:nb,toArray:ib,some:Ku,find:tb}});var Ls=v((Zg,Yu)=>{"use strict";var{ArrayPrototypePop:lb,Promise:ub}=B(),{isIterable:fb,isNodeStream:cb,isWebStream:db}=ge(),{pipelineImpl:hb}=On(),{finished:pb}=Be();Bs();function _b(...t){return new ub((e,r)=>{let n,i,s=t[t.length-1];if(s&&typeof s=="object"&&!cb(s)&&!fb(s)&&!db(s)){let o=lb(t);n=o.signal,i=o.end}hb(t,(o,a)=>{o?r(o):e(a)},{signal:n,end:i})})}Yu.exports={finished:pb,pipeline:_b}});var Bs=v((Xg,af)=>{"use strict";var{Buffer:yb}=pe(),{ObjectDefineProperty:Me,ObjectKeys:ef,ReflectApply:tf}=B(),{promisify:{custom:rf}}=Y(),{streamReturningOperators:Zu,promiseReturningOperators:Xu}=Ju(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:nf}}=Q(),bb=js(),{setDefaultHighWaterMark:mb,getDefaultHighWaterMark:gb}=Ir(),{pipeline:sf}=On(),{destroyer:wb}=mt(),of=Be(),Cs=Ls(),Br=ge(),L=af.exports=yn().Stream;L.isDestroyed=Br.isDestroyed;L.isDisturbed=Br.isDisturbed;L.isErrored=Br.isErrored;L.isReadable=Br.isReadable;L.isWritable=Br.isWritable;L.Readable=vr();for(let t of ef(Zu)){let r=function(...n){if(new.target)throw nf();return L.Readable.from(tf(e,this,n))},e=Zu[t];Me(r,"name",{__proto__:null,value:e.name}),Me(r,"length",{__proto__:null,value:e.length}),Me(L.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of ef(Xu)){let r=function(...n){if(new.target)throw nf();return tf(e,this,n)},e=Xu[t];Me(r,"name",{__proto__:null,value:e.name}),Me(r,"length",{__proto__:null,value:e.length}),Me(L.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}L.Writable=kn();L.Duplex=Se();L.Transform=bs();L.PassThrough=gs();L.pipeline=sf;var{addAbortSignal:xb}=Rr();L.addAbortSignal=xb;L.finished=of;L.destroy=wb;L.compose=bb;L.setDefaultHighWaterMark=mb;L.getDefaultHighWaterMark=gb;Me(L,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Cs}});Me(sf,rf,{__proto__:null,enumerable:!0,get(){return Cs.pipeline}});Me(of,rf,{__proto__:null,enumerable:!0,get(){return Cs.finished}});L.Stream=L;L._isUint8Array=function(e){return e instanceof Uint8Array};L._uint8ArrayToBuffer=function(e){return yb.from(e.buffer,e.byteOffset,e.byteLength)}});var Mn=v((ew,M)=>{"use strict";var W=Bs(),Sb=Ls(),Eb=W.Readable.destroy;M.exports=W.Readable;M.exports._uint8ArrayToBuffer=W._uint8ArrayToBuffer;M.exports._isUint8Array=W._isUint8Array;M.exports.isDisturbed=W.isDisturbed;M.exports.isErrored=W.isErrored;M.exports.isReadable=W.isReadable;M.exports.Readable=W.Readable;M.exports.Writable=W.Writable;M.exports.Duplex=W.Duplex;M.exports.Transform=W.Transform;M.exports.PassThrough=W.PassThrough;M.exports.addAbortSignal=W.addAbortSignal;M.exports.finished=W.finished;M.exports.destroy=W.destroy;M.exports.destroy=Eb;M.exports.pipeline=W.pipeline;M.exports.compose=W.compose;Object.defineProperty(W,"promises",{configurable:!0,enumerable:!0,get(){return Sb}});M.exports.Stream=W.Stream;M.exports.default=M.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 or=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 kt={};Tt(kt,{Client:()=>oe,client:()=>re,deepClone:()=>$e,formdata:()=>Hs,metroError:()=>V,request:()=>rt,response:()=>vt,trace:()=>kf,url:()=>z});var tt="https://metro.muze.nl/details/";Symbol.metroProxy||(Symbol.metroProxy=Symbol("isProxy"));Symbol.metroSource||(Symbol.metroSource=Symbol("source"));var oe=class t{clientOptions={url:z(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=z(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=z(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(rt(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 V("metro.client: middlewares must be a function or an array of functions "+tt+"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=rt(e,r),!e.url)throw V("metro.client."+e.method.toLowerCase()+": Missing url parameter "+tt+"client/fetch-missing-url/",e);if(r||(r={}),typeof r!="object"||r instanceof String)throw V("metro.client.fetch: Invalid options parameter "+tt+"client/fetch-invalid-options/",r);let i=[async function(a){a[Symbol.metroProxy]&&(a=a[Symbol.metroSource]);let l=await fetch(a);return vt(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($e(this.clientOptions),...e)}get location(){return this.clientOptions.url}};function re(...t){return new oe(...$e(t))}function vf(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=z(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 rt(...t){let e={url:z(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=z(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,vf(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}),rt(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 zs(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 vt(...t){let e={};for(let i of t)typeof i=="string"?e.body=i:i instanceof Response?Object.assign(e,zs(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,zs(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 vt(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 Gs(t,e){typeof e=="function"?e(t.searchParams,t):(e=new URLSearchParams(e),e.forEach((r,n)=>{t.searchParams.append(n,r)}))}function z(...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)Gs(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":Gs(r,n.searchParams);break;default:if(!e.includes(i))throw V("metro.url: unknown url parameter "+tt+"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 V("metro.url: unsupported value for "+i+" "+tt+"url/unsupported-param-value/",t[i]);break}else throw V("metro.url: unsupported option value "+tt+"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 z(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 Hs(...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 V("metro.formdata: unknown option type "+tt+"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 Hs(r,...s)};break;default:r[n]instanceof Function?i=r[n].bind(r):i=r[n];break}return i}})}var ar={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 V(t,...e){return ar.error(t,...e),new Error(t,...e)}var kf={add(t,e){oe.tracers[t]=e},delete(t){delete oe.tracers[t]},clear(){oe.tracers={}},group(){let t=0;return{request:(e,r)=>{t++,ar.group(t),ar.info(e?.url,e,r)},response:(e,r)=>{ar.info(e?.body?e.body[Symbol.metroSource]:null,e,r),ar.groupEnd(t),t--}}}};function $e(t){if(Array.isArray(t))return t.slice().map($e);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]=$e(t[r])}),e}else return t;return t}var nt=class{#e;#t;constructor(e,r="/"){this.#e=re(e),this.#t=new R(r)}get name(){return"HttpAdapter"}get path(){return this.#t}supportsWrite(){return!0}supportsStreamingWrite(){return jf}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=z(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=z(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}},jf=(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 Nf={fs:or,adapters:{https:nt},path:R};globalThis.jsfs=Nf;function fe(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||Of(s))&&(r=r.with({headers:{"Content-Type":t.contentType}})),Vs(r.headers.get("Content-Type"))&&(r=r.with({body:JSON.stringify(r.data,t.replacer,t.space)}))}let i=await n(r);if(i&&Vs(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 Pf=/^application\/([a-zA-Z0-9\-_]+\+)?json\b/;function Vs(t){return Pf.exec(t)}function Of(t){return/^text\/plain\b/.exec(t)}function ce(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 jt(){return async function(e,r){let n=await r(e);return n.ok&&n.data?n.data:n}}var Gr=class extends oe{constructor(e,r,n=null){e instanceof oe?super(e.clientOptions,ce(),jt()):super(e,ce(),jt()),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]}},Gn=class extends Gr{constructor(e,r,n=null){e instanceof oe?super(e.with(fe()),r,n):super(re(e,fe()),r,n)}};function Ks(...t){return new Gr(...$e(t))}function Qs(...t){return new Gn(...$e(t))}var Js=Object.assign({},kt,{mw:{json:fe,thrower:ce,getdata:jt},api:Ks,jsonApi:Qs});globalThis.metro||(globalThis.metro=Js);var N=Js;var Hr={};Tt(Hr,{base64url_encode:()=>Jn,createState:()=>eo,default:()=>Pt,generateCodeChallenge:()=>Xs,generateCodeVerifier:()=>Zs,getExpires:()=>Kn,isAuthorized:()=>Ff,isExpired:()=>Qn,isRedirected:()=>Yn});globalThis.assertEnabled=!1;function Lf(){globalThis.assertEnabled=!0}function Bf(){globalThis.assertEnabled=!1}function D(t,e){if(globalThis.assertEnabled){let r=G(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 m(t){return function(r,n,i){if(typeof r<"u"&&r!=null&&typeof t<"u")return G(r,t,n,i)}}function k(t){return function(r,n,i){return r==null||typeof r>"u"?P("data is required",r,t||"any value",i):typeof t<"u"?G(r,t,n,i):!1}}function qe(t){return function(r,n,i){return r==null||typeof r>"u"?(Ys("data does not contain recommended value",r,t,i),!1):G(r,t,n,i)}}function $(...t){return function(r,n,i){for(let s of t)if(!G(r,s,n,i))return!1;return P("data does not match oneOf patterns",r,t,i)}}function ve(...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($(...t)(s))return P("data does not match anyOf patterns",s,t,i);return!1}}function Hn(...t){return function(r,n,i){let s=[];for(let o of t)s=s.concat(G(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 E(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 Vn(t,e,r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return P("data is not a valid email",t,"validEmail",r)}function it(t){return function(r,n,i){if(!(r instanceof t))return P("data is not an instanceof pattern",r,t,i)}}function Nt(t){return function(r,n,i){if(!G(r,t,n,i))return P("data matches pattern, when required not to",r,t,i)}}function G(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)=>G(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=G(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)=>G(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=G(t,e,r,n);s&&(i=i.concat(s))}else for(let[s,o]of Object.entries(e)){let a=G(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 Ys(t,e,r,n){console.warn("\u{1F170}\uFE0F Assert: "+n,t,r,e)}globalThis.assert={warn:Ys,error:P,assert:D,enable:Lf,disable:Bf,Required:k,Recommended:qe,Optional:m,oneOf:$,anyOf:ve,allOf:Hn,validURL:E,validEmail:Vn,instanceOf:it,not:Nt,fails:G};function lr(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 Pt(t){let e={client:re(),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:Zs(64)},authorize_callback:async f=>(window.location.href!=f.href&&window.location.replace(f.href),!1)};D(t,{});let r=Object.assign({},e.oauth2_configuration,t?.oauth2_configuration);t=Object.assign({},e,t),t.oauth2_configuration=r;let n=lr(t.site);t.tokens||(t.tokens=n.tokens),t.state||(t.state=n.state),D(t,{oauth2_configuration:{client_id:k(/.+/),grant_type:"authorization_code",authorization_endpoint:k(E),token_endpoint:k(E),redirect_uri:k(E)}});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=Qn(d);if(!d||y&&!h){try{if(!await o())return vt("false")}catch(_){throw _}return i(f,c)}else if(y&&h){try{if(!await a())return vt("false")}catch(_){throw _}return i(f,c)}else return f=rt(f,{headers:{Authorization:d.type+" "+d.value}}),c(f)}function s(){if(typeof window<"u"&&window?.location){let f=z(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 V("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 V("OAuth2mw: fetch access_token: "+c.status+": "+c.statusText+" ("+h+")",{cause:f})}let d=await c.json();if(t.tokens.set("access_token",{value:d.access_token,expires:Kn(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 V("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:Kn(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 V("oauth2mw: Missing options.oauth2_configuration.authorization_endpoint");let f=z(r.authorization_endpoint,{hash:""});D(r,{client_id:/.+/,redirect_uri:/.+/,scope:/.*/});let c={response_type:"code",client_id:r.client_id,redirect_uri:r.redirect_uri,state:r.state||eo(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 Xs(r.code_verifier),c.code_challenge_method="S256"),r.scope&&(c.scope=r.scope),r.prompt&&(c.prompt=r.prompt),z(f,{search:c})}function u(f=null){if(D(r,{client_id:/.+/,redirect_uri:/.+/}),!r.token_endpoint)throw V("oauth2mw: Missing options.endpoints.token url");let c=z(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":d.refresh_token=t.tokens.get("refresh_token");break;default:throw new Error("Unknown grant_type: ".oauth2.grant_type)}return rt(c,{method:"POST",body:new URLSearchParams(d)})}}function Qn(t){if(!t)return!0;let e=new Date(t.expires);return new Date().getTime()>e.getTime()}function Kn(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 Zs(t=64){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),Jn(e)}async function Xs(t){let r=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",r);return Jn(n)}function Jn(t){let e=Array.from(new Uint8Array(t),r=>String.fromCharCode(r)).join("");return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function eo(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",n=0;for(;n<t;)r+=e.charAt(Math.floor(Math.random()*e.length)),n++;return r}function Yn(){let t=new URL(document.location.href);if(!t.searchParams.has("code")){if(t.hash){let e=t.hash.substr(1);if(new URLSearchParams("?"+e).has("code"))return!0}return!1}return!0}function Ff(t){typeof t=="string"&&(t=lr(t).tokens);let e=t.get("access_token");return!!(e&&!Qn(e)||t.get("refresh_token"))}var Zn={};Tt(Zn,{default:()=>ro});var Vr={status:200,statusText:"OK",headers:{"Content-Type":"application/json"}},ur=t=>({status:400,statusText:"Bad Request",headers:{"Content-Type":"application/json"},body:JSON.stringify({error:"invalid_request",error_description:t})}),We,to={};function ro(t={}){return t=Object.assign({},{PKCE:!1,DPoP:!1},t),async(r,n)=>{let i=N.url(r.url);switch(i.pathname){case"/authorize/":if(We=G(i.searchParams,{response_type:"code",client_id:"mockClientId",state:m(/.*/)}))return N.response(ur(We));if(i.searchParams.has("code_challenge")){if(!i.searchParams.has("code_challenge_method"))return N.response(ur("missing code_challenge_method"));to.code_challenge=i.searchParams.get("code_challenge"),to.code_challenge_method=i.searchParams.get("code_challenge_method")}return N.response(Vr,{body:JSON.stringify({code:"mockAuthorizeToken",state:i.searchParams.get("state")})});case"/token/":if(r.data instanceof URLSearchParams){let l={};r.data.forEach((u,f)=>l[f]=u),r=r.with({body:l})}if(We=G(r,{method:"POST",data:{grant_type:$("refresh_token","authorization_code")}}))return N.response(ur(We));switch(r.data.grant_type){case"refresh_token":if(We=G(r.data,$({refresh_token:"mockRefreshToken",client_id:"mockClientId",client_secret:"mockClientSecret"},{refresh_token:"mockRefreshToken",client_id:"mockClientId",code_verifier:/.+/})))return N.response(ur(We));break;case"access_token":if(We=G(r.data,$({client_id:"mockClientId",client_secret:"mockClientSecret"},{client_id:"mockClientId",code_challenge:/.*/,code_challenge_method:"S256"})))return N.response(ur(We));break}return N.response(Vr,{body:JSON.stringify({access_token:"mockAccessToken",token_type:"mockExample",expires_in:3600,refresh_token:"mockRefreshToken",example_parameter:"mockExampleValue"})});case"/protected/":let s=r.headers.get("Authorization"),[o,a]=s?s.split(" "):[];return!a||a!=="mockAccessToken"?N.response({status:401,statusText:"Forbidden",body:"401 Forbidden"}):N.response(Vr,{body:JSON.stringify({result:"Success"})});case"/public/":return N.response(Vr,{body:JSON.stringify({result:"Success"})});default:return N.response({status:404,statusText:"not found",body:"404 Not Found "+i})}}}var Xn={};Tt(Xn,{default:()=>so});var no=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],io=["client_secret_post","client_secret_base","client_secret_jwt","private_key_jwt"],Mf={issuer:k(E),authorization_endpoint:k(E),token_endpoint:k(E),jwks_uri:m(E),registration_endpoint:m(E),scopes_supported:qe([]),response_types_supported:k(ve("code","token")),response_modes_supported:m([]),grant_types_supported:m([]),token_endpoint_auth_methods_supported:m([]),token_endpoint_auth_signing_alg_values_supported:m([]),service_documentation:m(E),ui_locales_supported:m([]),op_policy_uri:m(E),op_tos_uri:m(E),revocation_endpoint:m(E),revocation_endpoint_auth_methods_supported:m(io),revocation_endpoint_auth_signing_alg_values_supported:m(no),introspection_endpoint:m(E),introspection_endpoint_auth_methods_supported:m(io),introspection_endpoint_auth_signing_alg_values_supported:m(no),code_challendge_methods_supported:m([])};function so(t={}){let e={client:N.client()};t=Object.assign({},e,t),D(t,{issuer:k(E)});let r=Df(t.issuer);return t.client.with(t.issuer)}async function Df(t,e){let r=e.get(N.url(t,".wellknown/oauth_authorization_server"));if(r.ok){D(r.headers.get("Content-Type"),/application\/json.*/);let n=await r.json();return D(n,Mf),n}throw N.metroError("metro.oidcmw: Error while fetching "+t+".wellknown/oauth_authorization_server",r)}function oo(t=null){let e=!1;t=t||window.location.origin;let r=new URLSearchParams(window.location.search);if(!r.has("code")&&window.location.hash){let i=window.location.hash.substr(1);r=new URLSearchParams("?"+i)}let n=window.parent!==window?window.parent:window.opener;return n?r.has("code")?(n.postMessage({authorization_code:r.get("code")},t),e=!0):r.has("error")?n.postMessage({error:r.get("error")},t):n.postMessage({error:"Could not find an authorization_code"},t):console.error("No parent window found, cannot post authorization code (or error)"),e}function ao(t){return new Promise((e,r)=>{addEventListener("message",n=>{n.data.authorization_code?e(n.data.authorization_code):n.data.error?r(n.data.error):r("Unknown authorization error")},{once:!0}),window.open(t)})}function fr(){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 Uf=new TextEncoder,$f=new TextDecoder;function Kr(t){return typeof t=="string"?Uf.encode(t):$f.decode(t)}function lo(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new ti(`${t.name} modulusLength must be at least 2048 bits`)}function qf(t){switch(t.algorithm.name){case"ECDSA":return{name:t.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return lo(t.algorithm),{name:t.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return lo(t.algorithm),{name:t.algorithm.name};case"Ed25519":return{name:t.algorithm.name}}throw new ze}async function Wf(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=`${Qr(Kr(JSON.stringify(t)))}.${Qr(Kr(JSON.stringify(e)))}`,i=Qr(await crypto.subtle.sign(qf(r),r,Kr(n)));return`${n}.${i}`}var ei;Uint8Array.prototype.toBase64?ei=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):ei=e=>{e instanceof ArrayBuffer&&(e=new Uint8Array(e));let r=[];for(let n=0;n<e.byteLength;n+=32768)r.push(String.fromCharCode.apply(null,e.subarray(n,n+32768)));return btoa(r.join("")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")};function Qr(t){return ei(t)}var ze=class extends Error{constructor(e){var r;super(e??"operation not supported"),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}},ti=class extends Error{constructor(e){var r;super(e),this.name=this.constructor.name,(r=Error.captureStackTrace)===null||r===void 0||r.call(Error,this,this.constructor)}};function zf(t){switch(t.algorithm.hash.name){case"SHA-256":return"PS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Gf(t){switch(t.algorithm.hash.name){case"SHA-256":return"RS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Hf(t){switch(t.algorithm.namedCurve){case"P-256":return"ES256";default:throw new ze("unsupported EcKeyAlgorithm namedCurve")}}function Vf(t){switch(t.algorithm.name){case"RSA-PSS":return zf(t);case"RSASSA-PKCS1-v1_5":return Gf(t);case"ECDSA":return Hf(t);case"Ed25519":return"Ed25519";default:throw new ze("unsupported CryptoKey algorithm name")}}function uo(t){return t instanceof CryptoKey}function Kf(t){return uo(t)&&t.type==="private"}function Qf(t){return uo(t)&&t.type==="public"}function Jf(){return Math.floor(Date.now()/1e3)}async function ri(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(!Qf(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 Wf({alg:Vf(o),typ:"dpop+jwt",jwk:await Yf(a)},Object.assign(Object.assign({},s),{iat:Jf(),jti:crypto.randomUUID(),htm:r,nonce:n,htu:e,ath:i?Qr(await crypto.subtle.digest("SHA-256",Kr(i))):void 0}),o)}async function Yf(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 fo(t,e){var r;let n;if(typeof t!="string"||t.length===0)throw new TypeError('"alg" must be a non-empty string');switch(t){case"PS256":n={name:"RSA-PSS",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"RS256":n={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",modulusLength:2048,publicExponent:new Uint8Array([1,0,1])};break;case"ES256":n={name:"ECDSA",namedCurve:"P-256"};break;case"Ed25519":n={name:"Ed25519"};break;default:throw new ze}return crypto.subtle.generateKey(n,(r=e?.extractable)!==null&&r!==void 0?r:!1,["sign","verify"])}function cr(t){return D(t,{site:k(E),authorization_endpoint:k(E),token_endpoint:k(E),dpop_signing_alg_values_supported:m([])}),async(e,r)=>{let n=await fr(),i=await n.get(t.site);if(!i){let a=await fo("ES256");i={domain:t.site,keyPair:a},await n.set(i)}let s=N.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 ri(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 ri(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 Xf=Object.assign({},Hr,{oauth2mw:Pt,mockserver:Zn,discover:Xn,tokenstore:lr,dpopmw:cr,keysstore:fr,authorizePopup:ao,popupHandleRedirect:oo});globalThis.metro.oauth2||(globalThis.metro.oauth2=Xf);var dr=(...t)=>(e,r)=>t.filter(n=>r.hasOwnKey(n)).length>0?!1:P("root data must have all of",r,t),Ge=(...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 ae=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],Jr=["client_secret_post","client_secret_basic","client_secret_jwt","private_key_jwt"];async function hr(t={}){D(t,{client:m(it(N.client().constructor)),issuer:k(E)});let e={client:N.client().with(ce()).with(fe()),requireDynamicRegistration:!1};t=Object.assign({},e,t);let r=!1;function n(l){return r}let i={issuer:k(Hn(t.issuer,n)),authorization_endpoint:k(E),token_endpoint:k(E),userinfo_endpoint:qe(E),jwks_uri:k(E),registration_endpoint:t.requireDynamicRegistration?k(E):qe(E),scopes_supported:qe(Ge("openid")),response_types_supported:t.requireDynamicRegistration?k(Ge("code","id_token","id_token token")):k([]),response_modes_supported:m([]),grant_types_supported:t.requireDynamicRegistration?m(Ge("authorization_code")):m([]),acr_values_supported:m([]),subject_types_supported:k([]),id_token_signing_alg_values_supported:k(Ge("RS256")),id_token_encryption_alg_values_supported:m([]),id_token_encryption_enc_values_supported:m([]),userinfo_signing_alg_values_supported:m([]),userinfo_encryption_alg_values_supported:m([]),userinfo_encryption_enc_values_supported:m([]),request_object_signing_alg_values_supported:m(Ge("RS256")),request_object_encryption_alg_values_supported:m([]),request_object_encryption_enc_values_supported:m([]),token_endpoint_auth_methods_supported:m(ve(...Jr)),token_endpoint_auth_signing_alg_values_supported:m(Ge("RS256"),Nt(Ge("none"))),display_values_supported:m(ve("page","popup","touch","wap")),claim_types_supported:m(ve("normal","aggregated","distributed")),claims_supported:qe([]),service_documentation:m(E),claims_locales_supported:m([]),ui_locales_supported:m([]),claims_parameter_supported:m(Boolean),request_parameter_supported:m(Boolean),request_uri_parameter_supported:m(Boolean),op_policy_uri:m(E),op_tos_uri:m(E)},s=N.url(t.issuer,".well-known/openid-configuration"),a=(await t.client.get(s)).data;return D(a,i),D(a.issuer,t.issuer),a}async function pr(t){let e={redirect_uris:k([E]),response_types:m([]),grant_types:m(ve("authorization_code","refresh_token")),application_type:m($("native","web")),contacts:m([Vn]),client_name:m(String),logo_uri:m(E),client_uri:m(E),policy_uri:m(E),tos_uri:m(E),jwks_uri:m(E,Nt(dr("jwks"))),jwks:m(E,Nt(dr("jwks_uri"))),sector_identifier_uri:m(E),subject_type:m(String),id_token_signed_response_alg:m($(...ae)),id_token_encrypted_response_alg:m($(...ae)),id_token_encrypted_response_enc:m($(...ae),dr("id_token_encrypted_response_alg")),userinfo_signed_response_alg:m($(...ae)),userinfo_encrypted_response_alg:m($(...ae)),userinfo_encrypted_response_enc:m($(...ae),dr("userinfo_encrypted_response_alg")),request_object_signing_alg:m($(...ae)),request_object_encryption_alg:m($(...ae)),request_object_encryption_enc:m($(...ae)),token_endpoint_auth_method:m($(...Jr)),token_endpoint_auth_signing_alg:m($(...ae)),default_max_age:m(Number),require_auth_time:m(Boolean),default_acr_values:m([String]),initiate_login_uri:m([E]),request_uris:m([E])};D(t,{client:m(it(N.client().constructor)),registration_endpoint:E,client_info:e});let r={client:N.client().with(ce()).with(fe()),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 N.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 Yr(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 ni(t={}){let e={client:re(),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),D(t,{client:k(it(re().constructor)),client_info:k(),issuer:k(E),oauth2:m({}),openid_configuration:m()}),t.store||(t.store=Yr(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 hr({issuer:t.issuer}),t.store.set("openid_configuration",t.openid_configuration)),!t.client_info?.client_id){if(!t.openid_configuration.registration_endpoint)throw V("metro.oidcmw: Error: issuer "+t.issuer+" does not support dynamic client registration, but you haven't specified a client_id");t.client_info=await pr({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(cr(u)),o.client=l}return l=l.with(Pt(o)),i=await l.fetch(r),i}}function co(){return Yn()}function ho(t){if(!t.store){if(!t.issuer)throw V("Must supply options.issuer or options.store to get the id_token");t.store=Yr(t.issuer)}return t.store.get("id_token")}var po={oidcmw:ni,discover:hr,register:pr,isRedirected:co,idToken:ho};globalThis.metro.oidc||(globalThis.metro.oidc=po);var _o=po;function oi(t){return new ii(t)}var ai="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",ec={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#"};var ii=class{constructor(e){this.prefixes={...ec,...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 si(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}},si=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 Ot(r,this)),this.subjects[r]}addBlankNode(e){return this.#e[e]||(this.#e[e]=new st(this)),this.#e[e]}addCollection(e){return this.#e[e]||(this.#e[e]=new Lt(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}},st=class{constructor(e){Object.defineProperty(this,"graph",{value:e,writable:!1,enumerable:!1})}addPredicate(e,r){if(e.id&&(e=e.id),e==ai){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}},Ot=class extends st{constructor(e,r){super(r),Object.defineProperty(this,"id",{value:e,writable:!1,enumerable:!0})}},Lt=class extends Array{constructor(e,r){super(),Object.defineProperty(this,"graph",{value:r,writable:!1,enumerable:!1})}};var Us={};Tt(Us,{n3Parser:()=>Rb,n3Writer:()=>Ib});var Fo=zr(pe());var lt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",yr="http://www.w3.org/2001/XMLSchema#",tn="http://www.w3.org/2000/10/swap/",O={xsd:{decimal:`${yr}decimal`,boolean:`${yr}boolean`,double:`${yr}double`,integer:`${yr}integer`,string:`${yr}string`},rdf:{type:`${lt}type`,nil:`${lt}nil`,first:`${lt}first`,rest:`${lt}rest`,langString:`${lt}langString`,dirLangString:`${lt}dirLangString`,reifies:`${lt}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${tn}reify#forSome`,forAll:`${tn}reify#forAll`},log:{implies:`${tn}log#implies`,isImpliedBy:`${tn}log#isImpliedBy`}};var{xsd:rn}=O,Oc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Co={"\\":"\\","'":"'",'"':'"',n:`
|
|
3
|
+
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Lc=/[\x00-\x20<>\\"\{\}\|\^\`]/,Bc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_dircode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Cc=/$0^/,ut=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._dircode=/^--(ltr)|(rtl)/,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._atKeyword=/^@[a-z]+(?=[\s#<:])/i,this._keyword=/^(?:PREFIX|BASE|VERSION|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 Bc)&&this[r]instanceof RegExp&&(this[r]=Cc)}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||Lc.test(d))return o(this);c="IRI"}else n.length>2&&n[1]==="<"&&n[2]==="("?(c="<<(",_=3):!this._lineMode&&n.length>(r?1:2)&&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))&&y[1]!=="version"?(c="langcode",d=y[1]):(y=this._atKeyword.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"-":if(n[1]==="-"){this._previousMarker==="langcode"&&(y=this._dircode.exec(n))&&(c="dircode",_=2,d=y[1]||y[2],_=d.length+2);break}(y=this._number.exec(n)||r&&(y=this._number.exec(`${n} `)))&&(c="literal",d=y[0],h=typeof y[1]=="string"?rn.double:typeof y[2]=="string"?rn.decimal:rn.integer);break;case"B":case"b":case"p":case"P":case"G":case"g":case"V":case"v":(y=this._keyword.exec(n))?c=y[0].toUpperCase():x=!0;break;case"f":case"t":(y=this._boolean.exec(n))?(c="literal",d=y[0],h=rn.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")":if(!r&&(n.length===1||n.length===2&&n[1]===">"))break;if(n.length>2&&n[1]===">"&&n[2]===">"){c=")>>",_=3;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(Oc,(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 Co?Co[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=Fo.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:Mo,xsd:ft}=O,Ut,Fc=0;var mi={namedNode:Do,blankNode:Uo,variable:qo,literal:$o,defaultGraph:Mc,quad:gi,triple:gi,fromTerm:br,fromQuad:Wo},te=mi,ee=class t{constructor(e){this.id=e}get value(){return this.id}equals(e){return e instanceof t?this.id===e.id:!!e&&this.termType===e.termType&&this.value===e.value}hashCode(){return 0}toJSON(){return{termType:this.termType,value:this.value}}},Dt=class extends ee{get termType(){return"NamedNode"}},je=class t extends ee{get termType(){return"Literal"}get value(){return this.id.substring(1,this.id.lastIndexOf('"'))}get language(){let e=this.id,r=e.lastIndexOf('"')+1,n=e.lastIndexOf("--");return r<e.length&&e[r++]==="@"?(n>r?e.substr(0,n):e).substr(r).toLowerCase():""}get direction(){let e=this.id,r=e.lastIndexOf('"'),n=e.lastIndexOf("--");return n>r&&n+2<e.length?e.substr(n+2).toLowerCase():""}get datatype(){return new Dt(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!=="@"?ft.string:e.indexOf("--",r)>0?Mo.dirLangString:Mo.langString}equals(e){return e instanceof t?this.id===e.id:!!e&&!!e.datatype&&this.termType===e.termType&&this.value===e.value&&this.language===e.language&&(this.direction===e.direction||this.direction===""&&!e.direction)&&this.datatype.value===e.datatype.value}toJSON(){return{termType:this.termType,value:this.value,language:this.language,direction:this.direction,datatype:{termType:"NamedNode",value:this.datatypeString}}}},mr=class extends ee{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},gr=class extends ee{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},wr=class extends ee{constructor(){return super(""),Ut||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};Ut=new wr;function Ve(t,e,r){if(e=e||mi,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===mi)return new je(t);if(t[t.length-1]==='"')return e.literal(t.substr(1,t.length-2));let n=t.lastIndexOf('"',t.length-1),i;if(t[n+1]==="@"){i=t.substr(n+2);let s=i.lastIndexOf("--");s>0&&s<i.length&&(i={language:i.substr(0,s),direction:i.substr(s+2)})}else i=e.namedNode(t.substr(n+3));return e.literal(t.substr(1,n-1),i);case"[":t=JSON.parse(t);break;default:if(!r||!Array.isArray(t))return e.namedNode(t)}return e.quad(Ve(t[0],e,!0),Ve(t[1],e,!0),Ve(t[2],e,!0),t[3]&&Ve(t[3],e,!0))}function Ne(t,e){if(typeof t=="string")return t;if(t instanceof ee&&t.termType!=="Quad")return t.id;if(!t)return Ut.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.direction?`--${t.direction}`:""}`:t.datatype&&t.datatype.value!==ft.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 Ke=class extends ee{constructor(e,r,n,i){super(""),this._subject=e,this._predicate=r,this._object=n,this._graph=i||Ut}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 Do(t){return new Dt(t)}function Uo(t){return new mr(t||`n3-${Fc++}`)}function $o(t,e){if(typeof e=="string")return new je(`"${t}"@${e.toLowerCase()}`);if(e!==void 0&&!("termType"in e))return new je(`"${t}"@${e.language.toLowerCase()}${e.direction?`--${e.direction.toLowerCase()}`:""}`);let r=e?e.value:"";return r===""&&(typeof t=="boolean"?r=ft.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?ft.integer:ft.double:(r=ft.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===ft.string?new je(`"${t}"`):new je(`"${t}"^^${r}`)}function qo(t){return new gr(t)}function Mc(){return Ut}function gi(t,e,r,n){return new Ke(t,e,r,n)}function br(t){if(t instanceof ee)return t;switch(t.termType){case"NamedNode":return Do(t.value);case"BlankNode":return Uo(t.value);case"Variable":return qo(t.value);case"DefaultGraph":return Ut;case"Literal":return $o(t.value,t.language||t.datatype);case"Quad":return Wo(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Wo(t){if(t instanceof Ke)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return gi(br(t.subject),br(t.predicate),br(t.object),br(t.graph))}var zo=0,Pe=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Go(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,l&&(this._resolveRelativeIRI=u=>null),this._blankNodePrefix=typeof e.blankNodePrefix!="string"?"":e.blankNodePrefix.replace(/^(?!_:)/,"_:"),this._lexer=e.lexer||new ut({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){zo=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)}_readBeforeTopContext(e){return this._version&&!this._isValidVersion(this._version)?this._error(`Detected unsupported version as media type parameter: "${this._version}"`,e):this._readInTopContext(e)}_readInTopContext(e){switch(e.type){case"eof":return this._graph!==null?this._error("Unclosed graph",e):(delete this._prefixes._,this._callback(null,null,this._prefixes));case"PREFIX":this._sparqlStyle=!0;case"@prefix":return this._readPrefix;case"BASE":this._sparqlStyle=!0;case"@base":return this._readBaseIRI;case"VERSION":this._sparqlStyle=!0;case"@version":return this._readVersion;case"{":if(this._supportsNamedGraphs)return this._graph="",this._subject=null,this._readSubject;case"GRAPH":if(this._supportsNamedGraphs)return this._readNamedGraphLabel;default:return this._readSubject(e)}}_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"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(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._n3Mode?(this._saveContext("<<(",this._graph,null,null,null),this._graph=null,this._readSubject):this._error("Disallowed triple term as subject",e);case"<<":return this._saveContext("<<",this._graph,null,null,null),this._graph=null,this._readSubject;default:if((this._subject=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._readPredicateOrNamedGraph)}return this._readPredicateOrNamedGraph}_readPredicate(e){let r=e.type;switch(r){case"inverse":this._inversePredicate=!0;case"abbreviation":this._predicate=this.ABBREVIATIONS[e.value];break;case".":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._validAnnotation=!0,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"(":let r=this._contextStack;return(r.length&&r[r.length-1]).type==="<<"?this._error("Unexpected list in reified triple",e):(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._saveContext("<<(",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;case"<<":return this._saveContext("<<",this._graph,this._subject,this._predicate,null),this._graph=null,this._readSubject;default:if((this._object=this._readEntity(e))===void 0)return;if(this._n3Mode)return this._getPathReader(this._getContextEndReader())}return this._getContextEndReader()}_readPredicateOrNamedGraph(e){return e.type==="{"?this._readGraph(e):this._readPredicate(e)}_readGraph(e){return e.type!=="{"?this._error(`Expected graph but got ${e.type}`,e):(this._graph=this._subject,this._subject=null,this._readSubject)}_readBlankNodeHead(e){if(e.type==="]")return this._subject=null,this._readBlankNodeTail(e);{let r=this._contextStack;return(r.length>1&&r[r.length-2]).type==="<<"?this._error("Unexpected compound blank node expression in reified triple",e):(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);case"<<":this._saveContext("<<",this._graph,null,null,null),this._graph=null,i=this._readSubject;break;default:if((r=this._readEntity(e))===void 0)return}if(n===null&&(this._subject=n=this._factory.blankNode()),e.type==="<<"&&(o[o.length-1].subject=this._subject),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,r){let n=this._factory.literal(this._literalValue),i;switch(e.type){case"type":case"typeIRI":let s=this._readEntity(e);if(s===void 0)return;if(s.value===O.rdf.langString||s.value===O.rdf.dirLangString)return this._error("Detected illegal (directional) languaged-tagged string with explicit datatype",e);n=this._factory.literal(this._literalValue,s),e=null;break;case"langcode":if(e.value.split("-").some(o=>o.length>8))return this._error("Detected language tag with subtag longer than 8 characters",e);n=this._factory.literal(this._literalValue,e.value),this._literalLanguage=e.value,e=null,i=this._readDirCode.bind(this,r);break}return{token:e,literal:n,readCb:i}}_readDirCode(e,r,n){if(n.type==="dircode"){let i=this._factory.literal(this._literalValue,{language:this._literalLanguage,direction:n.value});e==="subject"?this._subject=i:this._object=i,this._literalLanguage=void 0,n=null}return e==="subject"?n===null?this._readPredicateOrNamedGraph:this._readPredicateOrNamedGraph(n):this._completeObjectLiteralPost(n,r)}_completeSubjectLiteral(e){let r=this._completeLiteral(e,"subject");return this._subject=r.literal,r.readCb?r.readCb.bind(this,!1):this._readPredicateOrNamedGraph}_completeObjectLiteral(e,r){let n=this._completeLiteral(e,"object");if(n)return this._object=n.literal,n.readCb?n.readCb.bind(this,r):this._completeObjectLiteralPost(n.token,r)}_completeObjectLiteralPost(e,r){return r&&this._emit(this._subject,this.RDF_FIRST,this._object,this._graph),e===null?this._getContextEndReader():(this._readCallback=this._getContextEndReader(),this._readCallback(e))}_readFormulaTail(e){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=!1,s=this._subject,o=this._inversePredicate;switch(e.type){case"}":if(this._graph===null)return this._error("Unexpected graph closing",e);if(this._n3Mode)return this._readFormulaTail(e);this._graph=null;case".":this._subject=null,this._tripleTerm=null,r=this._contextStack.length?this._readSubject:this._readInTopContext,o&&(this._inversePredicate=!1);break;case";":r=this._readPredicate;break;case",":r=this._readObject;break;case"~":r=this._readReifierInAnnotation,i=!0;break;case"{|":this._subject=this._readTripleTerm(),this._validAnnotation=!1,i=!0,r=this._readPredicate;break;case"|}":if(!this._annotation)return this._error("Unexpected annotation syntax closing",e);if(!this._validAnnotation)return this._error("Annotation block can not be empty",e);this._subject=null,this._annotation=!1,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(s!==null&&(!i||i&&!this._annotation)){let a=this._predicate,l=this._object;o?this._emit(l,a,s,n):this._emit(s,a,l,n)}return i&&(this._annotation=!0),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)}_isValidVersion(e){return this._parseUnsupportedVersions||t.SUPPORTED_VERSIONS.includes(e)}_readVersion(e){return e.type!=="literal"?this._error("Expected literal to follow version declaration",e):e.end-e.start!==e.value.length+2?this._error("Version declarations must use single quotes",e):(this._versionCallback(e.value),this._isValidVersion(e.value)?this._readDeclarationPunctuation:this._error(`Detected unsupported version: "${e.value}"`,e))}_readNamedGraphLabel(e){switch(e.type){case"IRI":case"blank":case"prefixed":return this._readSubject(e),this._readGraph;case"[":return this._readNamedGraphBlankLabel;default:return this._error("Invalid graph label",e)}}_readNamedGraphBlankLabel(e){return e.type!=="]"?this._error("Invalid graph label",e):(this._subject=this._factory.blankNode(),this._readGraph)}_readDeclarationPunctuation(e){return this._sparqlStyle?(this._sparqlStyle=!1,this._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}_readTripleTermTail(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())}_readReifiedTripleTailOrReifier(e){return e.type==="~"?this._readReifier:this._readReifiedTripleTail(e)}_readReifiedTripleTail(e){if(e.type!==">>")return this._error(`Expected >> but got ${e.type}`,e);this._tripleTerm=null;let r=this._readTripleTerm();this._restoreContext("<<",e);let n=this._contextStack,i=n.length&&n[n.length-1];return i&&i.type==="list"?(this._emit(this._subject,this.RDF_FIRST,r,this._graph),this._getContextEndReader()):this._subject===null?(this._subject=r,this._readPredicateOrReifierTripleEnd):(this._object=r,this._getContextEndReader())}_readPredicateOrReifierTripleEnd(e){return e.type==="."?(this._subject=null,this._readPunctuation(e)):this._readPredicate(e)}_readReifier(e){return this._reifier=this._readEntity(e),this._readReifiedTripleTail}_readReifierInAnnotation(e){return e.type==="IRI"||e.type==="typeIRI"||e.type==="type"||e.type==="prefixed"||e.type==="blank"||e.type==="var"?(this._reifier=this._readEntity(e),this._readPunctuation):(this._readTripleTerm(),this._subject=null,this._readPunctuation(e))}_readTripleTerm(){let e=this._contextStack,r=e.length&&e[e.length-1],n=r?r.graph:void 0,i=this._reifier||this._factory.blankNode();return this._reifier=null,this._tripleTerm=this._tripleTerm||this._factory.quad(this._subject,this._predicate,this._object),this._emit(i,this.RDF_REIFIES,this._tripleTerm,n||this.DEFAULTGRAPH),i}_getContextEndReader(){let e=this._contextStack;if(!e.length)return this._readPunctuation;switch(e[e.length-1].type){case"blank":return this._readBlankNodeTail;case"list":return this._readListItem;case"formula":return this._readFormulaTail;case"<<(":return this._readTripleTermTail;case"<<":return this._readReifiedTripleTailOrReifier}}_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=xr}_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,i){let s,o,a,l;if(r&&(r.onQuad||r.onPrefix||r.onComment||r.onVersion)?(s=r.onQuad,o=r.onPrefix,a=r.onComment,l=r.onVersion):(s=r,o=n,l=i),this._readCallback=this._readBeforeTopContext,this._sparqlStyle=!1,this._prefixes=Object.create(null),this._prefixes._=this._blankNodePrefix?this._blankNodePrefix.substr(2):`b${zo++}_`,this._prefixCallback=o||xr,this._versionCallback=l||xr,this._inversePredicate=!1,this._quantified=Object.create(null),!s){let f=[],c;if(this._callback=(d,h)=>{d?c=d:h&&f.push(h)},this._lexer.tokenize(e).every(d=>this._readCallback=this._readCallback(d)),c)throw c;return f}let u=(f,c)=>{f!==null?(this._callback(f),this._callback=xr):this._readCallback&&(this._readCallback=this._readCallback(c))};a&&(this._lexer.comments=!0,u=(f,c)=>{f!==null?(this._callback(f),this._callback=xr):this._readCallback&&(c.type==="comment"?a(c.value):this._readCallback=this._readCallback(c))}),this._callback=s,this._lexer.tokenize(e,u)}};function xr(){}function Go(t,e){t._factory=e,t.DEFAULTGRAPH=e.defaultGraph(),t.RDF_FIRST=e.namedNode(O.rdf.first),t.RDF_REST=e.namedNode(O.rdf.rest),t.RDF_NIL=e.namedNode(O.rdf.nil),t.RDF_REIFIES=e.namedNode(O.rdf.reifies),t.N3_FORALL=e.namedNode(O.r.forAll),t.N3_FORSOME=e.namedNode(O.r.forSome),t.ABBREVIATIONS={a:e.namedNode(O.rdf.type),"=":e.namedNode(O.owl.sameAs),">":e.namedNode(O.log.implies),"<":e.namedNode(O.log.isImpliedBy)},t.QUANTIFIERS_GRAPH=e.namedNode("urn:n3:quantifiers")}Pe.SUPPORTED_VERSIONS=["1.2","1.2-basic","1.1"];Go(Pe.prototype,te);var wi={};Tt(wi,{inDefaultGraph:()=>zc,isBlankNode:()=>Uc,isDefaultGraph:()=>ct,isLiteral:()=>$c,isNamedNode:()=>Dc,isQuad:()=>Wc,isVariable:()=>qc,prefix:()=>Gc,prefixes:()=>Ho});function Dc(t){return!!t&&t.termType==="NamedNode"}function Uc(t){return!!t&&t.termType==="BlankNode"}function $c(t){return!!t&&t.termType==="Literal"}function qc(t){return!!t&&t.termType==="Variable"}function Wc(t){return!!t&&t.termType==="Quad"}function ct(t){return!!t&&t.termType==="DefaultGraph"}function zc(t){return ct(t.graph)}function Gc(t,e){return Ho({"":t.value||t},e)("")}function Ho(t,e){let r=Object.create(null);for(let i in t)n(i,t[i]);e=e||te;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 $t(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var Hc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Vc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Vo="./",Kc="../",xi="?",Ko="#",dt=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Hc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",$t(e)],n=[],i=[],s=/[^/?#]*([/?#])/y,o,a=0,l=0,u=s.lastIndex=e.length;for(;!a&&!l&&(o=s.exec(this.base));)o[1]===Ko?l=s.lastIndex-1:(r.push($t(o[0]),"(?:"),n.push(")?"),o[1]!==xi?i.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Ko,a),this._pathReplacements[a]=xi));for(let f=0;f<i.length;f++)this._pathReplacements[i[f]]=Kc.repeat(i.length-f-1);return this._pathReplacements[i[i.length-1]]=Vo,this._baseLength=l>0?l:this.base.length,r.push($t(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!==xi&&!Vc.test(s)?e:i===Vo&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}};var Sr=te.defaultGraph(),{rdf:Qc,xsd:qt}=O,Qo=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Jo=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Jc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},ht=class extends ee{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=Sr,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new dt(r.baseIRI)))}get _inDefaultGraph(){return Sr.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
|
}
|
|
6
|
-
`)+(
|
|
6
|
+
`)+(Sr.equals(i)?"":`${this._encodeIriOrBlank(i)} {
|
|
7
7
|
`)),this._graph=i,this._subject=null),e.equals(this._subject)?r.equals(this._predicate)?this._write(`, ${this._encodeObject(n)}`,s):this._write(`;
|
|
8
8
|
${this._encodePredicate(this._predicate=r)} ${this._encodeObject(n)}`,s):this._write(`${(this._subject===null?"":`.
|
|
9
9
|
`)+this._encodeSubject(this._subject=e)} ${this._encodePredicate(this._predicate=r)} ${this._encodeObject(n)}`,s)}catch(o){s&&s(o)}}_writeQuadLine(e,r,n,i,s){delete this._prefixMatch,this._write(this.quadToString(e,r,n,i),s)}quadToString(e,r,n,i){return`${this._encodeSubject(e)} ${this._encodeIriOrBlank(r)} ${this._encodeObject(n)}${i&&i.value?` ${this._encodeIriOrBlank(i)} .
|
|
10
10
|
`:` .
|
|
11
|
-
`}`}quadsToString(e){let r="";for(let n of e)r+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return r}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),
|
|
11
|
+
`}`}quadsToString(e){let r="";for(let n of e)r+=this.quadToString(n.subject,n.predicate,n.object,n.graph);return r}_encodeSubject(e){return e.termType==="Quad"?this._encodeQuad(e):this._encodeIriOrBlank(e)}_encodeIriOrBlank(e){if(e.termType!=="NamedNode")return this._lists&&e.value in this._lists&&(e=this.list(this._lists[e.value])),"id"in e?e.id:`_:${e.value}`;let r=e.value;this._baseIri&&(r=this._baseIri.toRelative(r)),Qo.test(r)&&(r=r.replace(Jo,Yo));let n=this._prefixRegex.exec(r);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:r:`<${r}>`}_encodeLiteral(e){let r=e.value;Qo.test(r)&&(r=r.replace(Jo,Yo));let n=e.direction?`--${e.direction}`:"";if(e.language)return`"${r}"@${e.language}${n}`;if(this._lineMode){if(e.datatype.value===qt.string)return`"${r}"`}else switch(e.datatype.value){case qt.string:return`"${r}"`;case qt.boolean:if(r==="true"||r==="false")return r;break;case qt.integer:if(/^[+-]?\d+$/.test(r))return r;break;case qt.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case qt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===Qc.type?"a":this._encodeIriOrBlank(e)}_encodeObject(e){switch(e.termType){case"Quad":return this._encodeQuad(e);case"Literal":return this._encodeLiteral(e);default:return this._encodeIriOrBlank(e)}}_encodeQuad({subject:e,predicate:r,object:n,graph:i}){return`<<(${this._encodeSubject(e)} ${this._encodePredicate(r)} ${this._encodeObject(n)}${ct(i)?"":` ${this._encodeIriOrBlank(i)}`})>>`}_blockedWrite(){throw new Error("Cannot write because the writer has been closed.")}addQuad(e,r,n,i,s){n===void 0?this._writeQuad(e.subject,e.predicate,e.object,e.graph,r):typeof i=="function"?this._writeQuad(e,r,n,Sr,i):this._writeQuad(e,r,n,i||Sr,s)}addQuads(e){for(let r=0;r<e.length;r++)this.addQuad(e[r])}addPrefix(e,r,n){let i={};i[e]=r,this.addPrefixes(i,n)}addPrefixes(e,r){if(!this._prefixIRIs)return r&&r();let n=!1;for(let i in e){let s=e[i];typeof s!="string"&&(s=s.value),n=!0,this._subject!==null&&(this._write(this._inDefaultGraph?`.
|
|
12
12
|
`:`
|
|
13
13
|
}
|
|
14
14
|
`),this._subject=null,this._graph=""),this._prefixIRIs[s]=i+=":",this._write(`@prefix ${i} <${s}>.
|
|
15
|
-
`)}if(n){let i="",s="";for(let o in this._prefixIRIs)i+=i?`|${o}`:o,s+=(s?"|":"")+this._prefixIRIs[o];i
|
|
16
|
-
`:"",r)}blank(e,r){let n=e,i,s;switch(e===void 0?n=[]:e.termType?n=[{predicate:e,object:r}]:"length"in e||(n=[e]),s=n.length){case 0:return new
|
|
15
|
+
`)}if(n){let i="",s="";for(let o in this._prefixIRIs)i+=i?`|${o}`:o,s+=(s?"|":"")+this._prefixIRIs[o];i=$t(i,/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&"),this._prefixRegex=new RegExp(`^(?:${s})[^/]*$|^(${i})([_a-zA-Z0-9][\\-_a-zA-Z0-9]*)$`)}this._write(n?`
|
|
16
|
+
`:"",r)}blank(e,r){let n=e,i,s;switch(e===void 0?n=[]:e.termType?n=[{predicate:e,object:r}]:"length"in e||(n=[e]),s=n.length){case 0:return new ht("[]");case 1:if(i=n[0],!(i.object instanceof ht))return new ht(`[ ${this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)} ]`);default:let o="[";for(let a=0;a<s;a++)i=n[a],i.predicate.equals(e)?o+=`, ${this._encodeObject(i.object)}`:(o+=`${(a?`;
|
|
17
17
|
`:`
|
|
18
|
-
`)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new
|
|
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
|
|
18
|
+
`)+this._encodePredicate(i.predicate)} ${this._encodeObject(i.object)}`,e=i.predicate);return new ht(`${o}
|
|
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 ht(`(${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 Lo(t){let e=Oc[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 Ts=Cr(jn());var As=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 Gu(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:Gu(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 zu(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=zu(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 Pr=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 Ge(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&&(ut(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)}${ut(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 Pr({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 Ts.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,k.rdf.rest,k.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===k.rdf.first?b?u=i(h,"has multiple rdf:first arcs"):o.push(b=x):x.predicate.value===k.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===k.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=zu(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=Gu(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 Ts.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[As]&&(this[As]=this[Symbol.iterator]());let r=this[As];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 Vu(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 Or=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=Vu(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(vs(o.subject,a.subject)&&vs(o.predicate,a.predicate)&&vs(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(Hu(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=>Hu(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function Hu({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 vs(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var Qu=Cr(jn());var Lr=class extends Qu.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new Pe(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 Ku=Cr(jn());var Br=class extends Ku.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 Nn={Lexer:at,Parser:Pe,Writer:_e,Store:Ye,StoreFactory:kr,EntityIndex:Pr,StreamParser:Lr,StreamWriter:Br,Util:ui,Reasoner:Or,BaseIRI:ft,DataFactory:X,Term:Z,NamedNode:Ct,Literal:je,BlankNode:dr,Variable:hr,DefaultGraph:pr,Quad:ze,Triple:ze,termFromId:Ge,termToId:Ne};var ab=(t,e,r)=>{let n=new Nn.Parser({baseIRI:e,blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},lb=t=>new Promise((e,r)=>{let n=new Nn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=Nn.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(Jn),o(m)))},f=(b,g)=>{if(!g)return;let S=c(g);for(let m of S)if(!(m.predicate.id=="id"||m.predicate.id=="a")){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),M={predicate:o(Ae)};A instanceof kt?M.object=y(A):Array.isArray(A)?M.object=x(A):A instanceof Pt?M.object=o(A.id):A instanceof nt?M.object=_(A):h(A)?M.object=d(A):console.log("oldm-ns: encountered unknown object",A,m),g.push(M)}),g},d=b=>{let g=t.getType(b)||void 0;if(g)g==i+t.context.separator+"string"||g==i+t.context.separator+"number"?g=void 0: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 Pt?S.push(o(m.id)):m instanceof nt?S.push(_(m)):m instanceof kt&&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 Ju={context:Kn,...js};globalThis.oldm=Ju;var Pn=Ju;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function Ns(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"):{[r]:n(i,r,"select")}):Ie(n)?e.push(()=>r=="_"?n:{[r]:n}):e.push(i=>r=="_"?nr(i[r]).select(n):{[r]:nr(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 Ps(t){let e=[];if(Array.isArray(t))e.push(db(...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]=Ps(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 ub=Symbol("asc"),fb=Symbol("desc");function Yu(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===ub)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===fb)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=Yu(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 Zu(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]=nr(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 cb(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 Xu(t,e){let r=e.shift();if(typeof r=="string"&&(r=pb[r]),typeof r!="function")throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");let n=cb(t,r);if(e.length)for(let i in n)n[i]=Xu(n[i],e);return n}function db(...t){let e=t.map(r=>Ps(r));return r=>e.some(n=>n(r))}var hb={apply(t,e,r){let n=t.apply(e,r);return typeof n=="object"?new Proxy(n,Me):n}},Me={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=Ps(n);return new Proxy(t.filter(s=>i(s)),Me)};break;case"select":r=function(n){let i=Ns(n);return new Proxy(t.map(i),Me)};break;case"reduce":r=function(n,i=[]){let s=Zu(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,Me):Ie(o)?o:new Proxy(o,Fr)};break;case"orderBy":r=function(n){let i=Yu(n);return new Proxy(t.toSorted(i),Me)};break;case"groupBy":r=function(...n){let i=Xu(t,n);return new Proxy(i,Fr)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=Ns(n);return new Proxy(i(t),Me)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],hb)),r||(r=t[e]),r}},Fr={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=Ns(n),s={};for(let o in t)Array.isArray(t[o])?s[o]=new Proxy(t[o].map(i),Me):s[o]=new Proxy(t[o],Fr);return s};break;case"reduce":r=function(n,i=[]){let s=Zu(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,Me):Ie(l)?o[a]=l:o[a]=new Proxy(l,Fr)}else o[a]=new Proxy(t[a],Fr);return o};break;default:Array.isArray(t[e])?r=nr(t[e]):r=t[e];break}return r}},kn={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new rr,kn)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new rr,kn)};break;case"groupBy":r=function(){return new Proxy(new rr,kn)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},rr=class{toJSON(){return null}};function nr(t){return!t||typeof t!="object"?new Proxy(new rr,kn):new Proxy(t,Me)}function ks(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(ks(n));typeof e?.[i]<"u"?e=e[i]:e=null,i=n.shift()}return e}else return r&&r!=="_"?typeof e?.[r]<"u"?e[r]:null:e}}var ef=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(ks(n),ef(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),pb=new Proxy(ks(),ef());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}})),tf(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&tf(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 _b=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function tf(t){for(let e of _b)if(e.exec(t))return!0;return!1}globalThis.oldmmw=On;var rf=On;var Rt=class extends et{#e;#t;constructor(e,r="/",n={}){e=te(e).with(Ys.oidcmw(n)).with(rf(n)),r=R.collapse(r),super(e,r),this.#e=e,this.#t=r}get name(){return"SolidAdapter"}async read(e){let r=await this.#e.get(R.collapse(e,this.#t)),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 nr(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 yb(...t){return new jsfs.fs(new Rt(...t))}var Iw=Rt;globalThis.solidClient=yb;globalThis.SolidAdapter=Rt;})();
|
|
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 Yo(t){let e=Jc[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 Ms=zr(Mn());var Fs=Symbol("iter");function Cr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Cr(t[n]||Object.create(null),e[n],r-1);return t}function lf(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:lf(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 uf(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:Cr({},t[i],r-1);else if(r!==0){let s=uf(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 Fr=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||te}_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 Ve(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&&(ct(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)}${ct(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))}},et=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||te,this._entityIndex=r.entityIndex||new Fr({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 Ms.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 Xe(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,O.rdf.rest,O.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 w=0;w<_.length&&!u;w++)x=_[w],x.graph.equals(d)?f?u=i(h,"has non-list arcs out"):x.predicate.value===O.rdf.first?b?u=i(h,"has multiple rdf:first arcs"):o.push(b=x):x.predicate.value===O.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 w=0;w<y.length&&!u;++w)x=y[w],f?u=i(h,"can't have coreferences"):x.predicate.value===O.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 Xe&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Cr(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof Xe&&(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 Xe&&(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=uf(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 Xe&&(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 Xe&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Cr(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=lf(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=Cr(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 Xe=class t extends Ms.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 et({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[Fs]&&(this[Fs]=this[Symbol.iterator]());let r=this[Fs];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 Mr=class{dataset(e){return new et(e)}};function cf(t){let e=[];for(let{subject:r,object:n}of t.match(null,te.namedNode("http://www.w3.org/2000/10/swap/log#implies"),null,te.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 Dr=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=cf(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(Ds(o.subject,a.subject)&&Ds(o.predicate,a.predicate)&&Ds(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(ff(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=>ff(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function ff({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 Ds(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var df=zr(Mn());var Ur=class extends df.Transform{constructor(e){super({decodeStrings:!0}),this._readableState.objectMode=!0;let r=new Pe(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 hf=zr(Mn());var $r=class extends hf.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 Dn={Lexer:ut,Parser:Pe,Writer:_e,Store:et,StoreFactory:Mr,EntityIndex:Fr,StreamParser:Ur,StreamWriter:$r,Util:wi,Reasoner:Dr,BaseIRI:dt,DataFactory:te,Term:ee,NamedNode:Dt,Literal:je,BlankNode:mr,Variable:gr,DefaultGraph:wr,Quad:Ke,Triple:Ke,termFromId:Ve,termToId:Ne};var Rb=(t,e,r)=>{let n=new Dn.Parser({baseIRI:e,blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},Ib=t=>new Promise((e,r)=>{let n=new Dn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=Dn.DataFactory,u=(b,g)=>{let S=g.a;if(Array.isArray(S)||(S=[S]),S?.length)for(let w of S)w=t.fullURI(w),n.addQuad(s(o(b),o(ai),o(w)))},f=(b,g)=>{if(!g)return;let S=c(g);for(let w of S)if(!(w.predicate.id=="id"||w.predicate.id=="a")){Array.isArray(w.object)||(w.object=[w.object]);for(let T of w.object)n.addQuad(s(o(b),w.predicate,T))}},c=b=>{let g=[];return Object.entries(b).forEach(S=>{let w=S[0],T=S[1],Ae=t.fullURI(w),U={predicate:o(Ae)};T instanceof Lt?U.object=y(T):Array.isArray(T)?U.object=x(T):T instanceof Ot?U.object=o(T.id):T instanceof st?U.object=_(T):h(T)?U.object=d(T):console.log("oldm-ns: encountered unknown object",T,w),g.push(U)}),g},d=b=>{let g=t.getType(b)||void 0;if(g)g==i+t.context.separator+"string"||g==i+t.context.separator+"number"?g=void 0: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 w of g)h(w)?S.push(d(w)):w instanceof Ot?S.push(o(w.id)):w instanceof st?S.push(_(w)):w instanceof Lt&&S.push(y(w));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 pf={context:oi,...Us};globalThis.oldm=pf;var Un=pf;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function $s(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"):{[r]:n(i,r,"select")}):Ie(n)?e.push(()=>r=="_"?n:{[r]:n}):e.push(i=>r=="_"?sr(i[r]).select(n):{[r]:sr(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 qs(t){let e=[];if(Array.isArray(t))e.push(kb(...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]=qs(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 Ab=Symbol("asc"),Tb=Symbol("desc");function _f(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===Ab)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===Tb)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=_f(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 yf(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]=sr(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 vb(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 bf(t,e){let r=e.shift();if(typeof r=="string"&&(r=Nb[r]),typeof r!="function")throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");let n=vb(t,r);if(e.length)for(let i in n)n[i]=bf(n[i],e);return n}function kb(...t){let e=t.map(r=>qs(r));return r=>e.some(n=>n(r))}var jb={apply(t,e,r){let n=t.apply(e,r);return typeof n=="object"?new Proxy(n,De):n}},De={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=qs(n);return new Proxy(t.filter(s=>i(s)),De)};break;case"select":r=function(n){let i=$s(n);return new Proxy(t.map(i),De)};break;case"reduce":r=function(n,i=[]){let s=yf(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,De):Ie(o)?o:new Proxy(o,qr)};break;case"orderBy":r=function(n){let i=_f(n);return new Proxy(t.toSorted(i),De)};break;case"groupBy":r=function(...n){let i=bf(t,n);return new Proxy(i,qr)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=$s(n);return new Proxy(i(t),De)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],jb)),r||(r=t[e]),r}},qr={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=$s(n),s={};for(let o in t)Array.isArray(t[o])?s[o]=new Proxy(t[o].map(i),De):s[o]=new Proxy(t[o],qr);return s};break;case"reduce":r=function(n,i=[]){let s=yf(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,De):Ie(l)?o[a]=l:o[a]=new Proxy(l,qr)}else o[a]=new Proxy(t[a],qr);return o};break;default:Array.isArray(t[e])?r=sr(t[e]):r=t[e];break}return r}},$n={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new ir,$n)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new ir,$n)};break;case"groupBy":r=function(){return new Proxy(new ir,$n)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},ir=class{toJSON(){return null}};function sr(t){return!t||typeof t!="object"?new Proxy(new ir,$n):new Proxy(t,De)}function Ws(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(Ws(n));typeof e?.[i]<"u"?e=e[i]:e=null,i=n.shift()}return e}else return r&&r!=="_"?typeof e?.[r]<"u"?e[r]:null:e}}var mf=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(Ws(n),mf(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),Nb=new Proxy(Ws(),mf());function qn(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:Un.n3Parser,writer:Un.n3Writer},t),t.prefixes.ldp||(t.prefixes.ldp="http://www.w3.org/ns/ldp#");let e=Un.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}})),gf(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&gf(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 gf(t){for(let e of Pb)if(e.exec(t))return!0;return!1}globalThis.oldmmw=qn;var wf=qn;var Wr=class extends nt{#e;#t;constructor(e,r="/",n={}){e=re(e).with(_o.oidcmw(n)).with(wf(n)),r=R.collapse(r),super(e,r),this.#e=e,this.#t=r}get name(){return"SolidAdapter"}supportsDirectories(){return!0}async read(e){let r=await this.#e.get(R.collapse(e,this.#t)),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 sr(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})}async mkdir(e){this.#e.put(R.collapse(e,this.#t))}async rmdir(e){this.#e.delete(R.collapse(e,this.#t))}};async function Ob(t,e){let r={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#",schema:"https://schema.org/",solid:"http://www.w3.org/ns/solid/terms#",acl:"http://www.w3.org/ns/auth/acl#",space:"http://www.w3.org/ns/pim/space#",vcard:"http://www.w3.org/2006/vcard/ns#",foaf:"http://xmlns.com/foaf/0.1/"},parser:n3Parser,writer:n3Writer},n=Object.assign({},r,e);for(let o in r.prefixes)info.prefixes[o]||(info.prefixes[o]=r.prefixes[o]);let i=await metro.client().with(oldmmw(info),getdatamw()).get(t)?.primary;if(!i||!i.solid$oidcIssuer)throw new Error("solidClient: "+t+" did not return valid solid profile");info.issuer=i.solid$oidcIssuer;let s=oldm.many(i.space$storage).map(o=>new jsfs.fs(new Wr(o,"/",info)));return metro.api(metro.client(oidcmw(info),oldmmw(info)),{profile:i,issuer:i.solid$oidcIssuer,inbox:i.ldp$inbox,id:function(){return metro.oidc.idToken(this.issuer)},logout:async function(){throw new Error("not yet implemented")},...s})}})();
|
|
23
23
|
/*! Bundled license information:
|
|
24
24
|
|
|
25
25
|
ieee754/index.js:
|