@muze-nl/jsfs-solid 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +102 -28
- package/dist/browser.js.map +3 -3
- package/dist/browser.min.js +8 -8
- package/dist/browser.min.js.map +3 -3
- package/package.full.json +37 -0
- package/package.json +4 -10
- package/package.json~ +4 -10
package/dist/browser.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(()=>{var Ef=Object.create;var Gn=Object.defineProperty;var Rf=Object.getOwnPropertyDescriptor;var If=Object.getOwnPropertyNames;var Af=Object.getPrototypeOf,Tf=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),vt=(t,e)=>{for(var r in e)Gn(t,r,{get:e[r],enumerable:!0})},vf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of If(e))!Tf.call(t,i)&&i!==r&&Gn(t,i,{get:()=>e[i],enumerable:!(n=Rf(e,i))||n.enumerable});return t};var zr=(t,e,r)=>(r=t!=null?Ef(Af(t)):{},vf(e||!t||!t.__esModule?Gn(r,"default",{value:t,enumerable:!0}):r,t));var go=v(Zr=>{"use strict";Zr.byteLength=nc;Zr.toByteArray=sc;Zr.fromByteArray=lc;var de=[],ne=[],rc=typeof Uint8Array<"u"?Uint8Array:Array,ui="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(at=0,bo=ui.length;at<bo;++at)de[at]=ui[at],ne[ui.charCodeAt(at)]=at;var at,bo;ne[45]=62;ne[95]=63;function mo(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 nc(t){var e=mo(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ic(t,e,r){return(e+r)*3/4-r}function sc(t){var e,r=mo(t),n=r[0],i=r[1],s=new rc(ic(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 oc(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function ac(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(oc(n));return i.join("")}function lc(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(ac(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 wo=v(fi=>{fi.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)};fi.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(Dt=>{"use strict";var ci=go(),Ft=wo(),xo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Dt.Buffer=p;Dt.SlowBuffer=pc;Dt.INSPECT_MAX_BYTES=50;var Xr=2147483647;Dt.kMaxLength=Xr;p.TYPED_ARRAY_SUPPORT=uc();!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 uc(){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 _i(t)}return Io(t,e,r)}p.poolSize=8192;function Io(t,e,r){if(typeof t=="string")return cc(t,e);if(ArrayBuffer.isView(t))return dc(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 hi(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=hc(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 Io(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 fc(t,e,r){return Ao(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 fc(t,e,r)};function _i(t){return Ao(t),ke(t<0?0:yi(t)|0)}p.allocUnsafe=function(t){return _i(t)};p.allocUnsafeSlow=function(t){return _i(t)};function cc(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=To(t,e)|0,n=ke(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function di(t){let e=t.length<0?0:yi(t.length)|0,r=ke(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function dc(t){if(he(t,Uint8Array)){let e=new Uint8Array(t);return hi(e.buffer,e.byteOffset,e.byteLength)}return di(t)}function hi(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 hc(t){if(p.isBuffer(t)){let e=yi(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"||mi(t.length)?ke(0):di(t);if(t.type==="Buffer"&&Array.isArray(t.data))return di(t.data)}function yi(t){if(t>=Xr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xr.toString(16)+" bytes");return t|0}function pc(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 To(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 pi(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Co(t).length;default:if(i)return n?-1:pi(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=To;function _c(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 Ic(this,e,r);case"utf8":case"utf-8":return ko(this,e,r);case"ascii":return Ec(this,e,r);case"latin1":case"binary":return Rc(this,e,r);case"base64":return xc(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ac(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function lt(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)lt(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)lt(this,r,r+3),lt(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)lt(this,r,r+7),lt(this,r+1,r+6),lt(this,r+2,r+5),lt(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ko(this,0,e):_c.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=Dt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};xo&&(p.prototype[xo]=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 vo(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,mi(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:So(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):So(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function So(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 vo(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return vo(this,e,r,n,!1)};function yc(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(mi(a))return o;t[r+o]=a}return o}function bc(t,e,r,n){return en(pi(e,t.length-r),t,r,n)}function mc(t,e,r,n){return en(jc(e),t,r,n)}function gc(t,e,r,n){return en(Co(e),t,r,n)}function wc(t,e,r,n){return en(Nc(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 yc(this,e,r,n);case"utf8":case"utf-8":return bc(this,e,r,n);case"ascii":case"latin1":case"binary":return mc(this,e,r,n);case"base64":return gc(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wc(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 xc(t,e,r){return e===0&&r===t.length?ci.fromByteArray(t):ci.fromByteArray(t.slice(e,r))}function ko(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 Sc(n)}var Eo=4096;function Sc(t){let e=t.length;if(e<=Eo)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Eo));return r}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]&127);return n}function Rc(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 Ic(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 Ac(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,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(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,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(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,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(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,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(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),Ft.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||H(e,4,this.length),Ft.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ft.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ft.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 jo(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 No(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=He(function(e,r=0){return jo(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=He(function(e,r=0){return No(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 jo(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=He(function(e,r=0){return No(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 Oo(t,e,r,n,i){return e=+e,r=r>>>0,i||Po(t,e,r,4,34028234663852886e22,-34028234663852886e22),Ft.write(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return Oo(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return Oo(this,e,r,!1,n)};function Lo(t,e,r,n,i){return e=+e,r=r>>>0,i||Po(t,e,r,8,17976931348623157e292,-17976931348623157e292),Ft.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return Lo(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return Lo(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 Ct={};function bi(t,e,r){Ct[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}`}}}bi("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);bi("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);bi("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=Ro(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Ro(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ro(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 Tc(t,e,r){Mt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&yr(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 Ct.ERR_OUT_OF_RANGE("value",a,t)}Tc(n,i,s)}function Mt(t,e){if(typeof t!="number")throw new Ct.ERR_INVALID_ARG_TYPE(e,"number",t)}function yr(t,e,r){throw Math.floor(t)!==t?(Mt(t,r),new Ct.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ct.ERR_BUFFER_OUT_OF_BOUNDS:new Ct.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var vc=/[^+/0-9A-Za-z-_]/g;function kc(t){if(t=t.split("=")[0],t=t.trim().replace(vc,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function pi(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 jc(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Nc(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 Co(t){return ci.toByteArray(kc(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 mi(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 He(t){return typeof BigInt>"u"?Oc:t}function Oc(){throw new Error("BigInt not supported")}});var B=v((Ig,Xo)=>{"use strict";var Ei=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}};Xo.exports={AggregateError:Ei,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 Ri=v((Ag,ea)=>{"use strict";ea.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,na)=>{"use strict";var{format:Zc,inspect:nn}=Ri(),{AggregateError:Xc}=B(),ed=globalThis.AggregateError||Xc,td=Symbol("kIsNodeError"),rd=["string","function","number","object","Function","Object","boolean","bigint","symbol"],nd=/^([A-Z][a-z0-9]*)+$/,id="__node_internal_",sn={};function _t(t,e){if(!t)throw new sn.ERR_INTERNAL_ASSERTION(e)}function ta(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 sd(t,e,r){if(typeof e=="function")return _t(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 _t(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Zc(e,...r)}function K(t,e,r){r||(r=Error);class n extends r{constructor(...s){super(sd(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[td]=!0,sn[t]=n}function ra(t){let e=id+t.name;return Object.defineProperty(t,"name",{value:e}),t}function od(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new ed([e,t],e.message);return r.code=e.code,r}return t||e}var Ii=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)=>{_t(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)_t(typeof l=="string","All expected entries have to be of type string"),rd.includes(l)?i.push(l.toLowerCase()):nd.test(l)?s.push(l):(_t(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)=>{_t(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)=>{_t(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=ta(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=ta(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);na.exports={AbortError:Ii,aggregateTwoErrors:ra(od),hideStackFrames:ra,codes:sn}});var zt=v((vg,on)=>{"use strict";var{AbortController:ia,AbortSignal:ad}=typeof self<"u"?self:typeof window<"u"?window:void 0;on.exports=ia;on.exports.AbortSignal=ad;on.exports.default=ia});var Rr=v((kg,Ai)=>{"use strict";var Gt=typeof Reflect=="object"?Reflect:null,sa=Gt&&typeof Gt.apply=="function"?Gt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},an;Gt&&typeof Gt.ownKeys=="function"?an=Gt.ownKeys:Object.getOwnPropertySymbols?an=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:an=function(e){return Object.getOwnPropertyNames(e)};function ld(t){console&&console.warn&&console.warn(t)}var aa=Number.isNaN||function(e){return e!==e};function j(){j.init.call(this)}Ai.exports=j;Ai.exports.once=dd;j.EventEmitter=j;j.prototype._events=void 0;j.prototype._eventsCount=0;j.prototype._maxListeners=void 0;var oa=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 oa},set:function(t){if(typeof t!="number"||t<0||aa(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");oa=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||aa(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 la(t){return t._maxListeners===void 0?j.defaultMaxListeners:t._maxListeners}j.prototype.getMaxListeners=function(){return la(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")sa(l,this,r);else for(var u=l.length,f=ha(l,u),n=0;n<u;++n)sa(f[n],this,r);return!0};function ua(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=la(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,ld(a)}return t}j.prototype.addListener=function(e,r){return ua(this,e,r,!1)};j.prototype.on=j.prototype.addListener;j.prototype.prependListener=function(e,r){return ua(this,e,r,!0)};function ud(){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 fa(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=ud.bind(n);return i.listener=r,n.wrapFn=i,i}j.prototype.once=function(e,r){return ln(r),this.on(e,fa(this,e,r)),this};j.prototype.prependOnceListener=function(e,r){return ln(r),this.prependListener(e,fa(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():fd(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 ca(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?cd(i):ha(i,i.length)}j.prototype.listeners=function(e){return ca(this,e,!0)};j.prototype.rawListeners=function(e){return ca(this,e,!1)};j.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):da.call(t,e)};j.prototype.listenerCount=da;function da(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 ha(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function fd(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function cd(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function dd(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))}pa(t,e,s,{once:!0}),e!=="error"&&hd(t,i,{once:!0})})}function hd(t,e,r){typeof t.on=="function"&&pa(t,"error",e,r)}function pa(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,vi)=>{"use strict";var pd=pe(),{format:_d,inspect:yd}=Ri(),{codes:{ERR_INVALID_ARG_TYPE:Ti}}=Q(),{kResistStopPropagation:bd,AggregateError:md,SymbolDispose:gd}=B(),wd=globalThis.AbortSignal||zt().AbortSignal,xd=globalThis.AbortController||zt().AbortController,Sd=Object.getPrototypeOf(async function(){}).constructor,_a=globalThis.Blob||pd.Blob,Ed=typeof _a<"u"?function(e){return e instanceof _a}:function(e){return!1},ya=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Ti(e,"AbortSignal",t)},Rd=(t,e)=>{if(typeof t!="function")throw new Ti(e,"Function",t)};vi.exports={AggregateError:md,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:_d,inspect:yd,types:{isAsyncFunction(t){return t instanceof Sd},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Ed,deprecate(t,e){return t},addAbortListener:Rr().addAbortListener||function(e,r){if(e===void 0)throw new Ti("signal","AbortSignal",e);ya(e,"signal"),Rd(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[bd]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[gd](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:wd.any||function(e){if(e.length===1)return e[0];let r=new xd,n=()=>r.abort();return e.forEach(i=>{ya(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};vi.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Vt=v((Ng,Aa)=>{"use strict";var{ArrayIsArray:ji,ArrayPrototypeIncludes:wa,ArrayPrototypeJoin:xa,ArrayPrototypeMap:Id,NumberIsInteger:Ni,NumberIsNaN:Ad,NumberMAX_SAFE_INTEGER:Td,NumberMIN_SAFE_INTEGER:vd,NumberParseInt:kd,ObjectPrototypeHasOwnProperty:jd,RegExpPrototypeExec:Sa,String:Nd,StringPrototypeToUpperCase:Pd,StringPrototypeTrim:Od}=B(),{hideStackFrames:ie,codes:{ERR_SOCKET_BAD_PORT:Ld,ERR_INVALID_ARG_TYPE:J,ERR_INVALID_ARG_VALUE:Ht,ERR_OUT_OF_RANGE:yt,ERR_UNKNOWN_SIGNAL:ba}}=Q(),{normalizeEncoding:Bd}=Y(),{isAsyncFunction:Cd,isArrayBufferView:Fd}=Y().types,ma={};function Md(t){return t===(t|0)}function Dd(t){return t===t>>>0}var Ud=/^[0-7]+$/,$d="must be a 32-bit unsigned integer or an octal string";function qd(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Sa(Ud,t)===null)throw new Ht(e,t,$d);t=kd(t,8)}return Ea(t,e),t}var Wd=ie((t,e,r=vd,n=Td)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Ni(t))throw new yt(e,"an integer",t);if(t<r||t>n)throw new yt(e,`>= ${r} && <= ${n}`,t)}),zd=ie((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Ni(t))throw new yt(e,"an integer",t);if(t<r||t>n)throw new yt(e,`>= ${r} && <= ${n}`,t)}),Ea=ie((t,e,r=!1)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Ni(t))throw new yt(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new yt(e,`>= ${n} && <= ${i}`,t)});function Pi(t,e){if(typeof t!="string")throw new J(e,"string",t)}function Gd(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)&&Ad(t))throw new yt(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Hd=ie((t,e,r)=>{if(!wa(r,t)){let i="must be one of: "+xa(Id(r,s=>typeof s=="string"?`'${s}'`:Nd(s)),", ");throw new Ht(e,t,i)}});function Ra(t,e){if(typeof t!="boolean")throw new J(e,"boolean",t)}function ki(t,e,r){return t==null||!jd(t,e)?r:t[e]}var Vd=ie((t,e,r=null)=>{let n=ki(r,"allowArray",!1),i=ki(r,"allowFunction",!1);if(!ki(r,"nullable",!1)&&t===null||!n&&ji(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new J(e,"Object",t)}),Kd=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(!ji(t))throw new J(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Ht(e,t,n)}});function Qd(t,e){un(t,e);for(let r=0;r<t.length;r++)Pi(t[r],`${e}[${r}]`)}function Jd(t,e){un(t,e);for(let r=0;r<t.length;r++)Ra(t[r],`${e}[${r}]`)}function Yd(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);Ia(n,i)}}function Zd(t,e="signal"){if(Pi(t,e),ma[t]===void 0)throw ma[Pd(t)]!==void 0?new ba(t+" (signals must use all capital letters)"):new ba(t)}var Xd=ie((t,e="buffer")=>{if(!Fd(t))throw new J(e,["Buffer","TypedArray","DataView"],t)});function eh(t,e){let r=Bd(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Ht("encoding",e,`is invalid for data of length ${n}`)}function th(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Od(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Ld(e,t,r);return t|0}var Ia=ie((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new J(e,"AbortSignal",t)}),rh=ie((t,e)=>{if(typeof t!="function")throw new J(e,"Function",t)}),nh=ie((t,e)=>{if(typeof t!="function"||Cd(t))throw new J(e,"Function",t)}),ih=ie((t,e)=>{if(t!==void 0)throw new J(e,"undefined",t)});function sh(t,e,r){if(!wa(r,t))throw new J(e,`('${xa(r,"|")}')`,t)}var oh=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function ga(t,e){if(typeof t>"u"||!Sa(oh,t))throw new Ht(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ah(t){if(typeof t=="string")return ga(t,"hints"),t;if(ji(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];ga(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Ht("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Aa.exports={isInt32:Md,isUint32:Dd,parseFileMode:qd,validateArray:un,validateStringArray:Qd,validateBooleanArray:Jd,validateAbortSignalArray:Yd,validateBoolean:Ra,validateBuffer:Xd,validateDictionary:Kd,validateEncoding:eh,validateFunction:rh,validateInt32:zd,validateInteger:Wd,validateNumber:Gd,validateObject:Vd,validateOneOf:Hd,validatePlainFunction:nh,validatePort:th,validateSignalName:Zd,validateString:Pi,validateUint32:Ea,validateUndefined:ih,validateUnion:sh,validateAbortSignal:Ia,validateLinkHeaderValue:ah}});var Qe=v((Pg,ja)=>{var F=ja.exports={},ye,be;function Oi(){throw new Error("setTimeout has not been defined")}function Li(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ye=setTimeout:ye=Oi}catch{ye=Oi}try{typeof clearTimeout=="function"?be=clearTimeout:be=Li}catch{be=Li}})();function Ta(t){if(ye===setTimeout)return setTimeout(t,0);if((ye===Oi||!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 lh(t){if(be===clearTimeout)return clearTimeout(t);if((be===Li||!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=[],Kt=!1,bt,fn=-1;function uh(){!Kt||!bt||(Kt=!1,bt.length?Oe=bt.concat(Oe):fn=-1,Oe.length&&va())}function va(){if(!Kt){var t=Ta(uh);Kt=!0;for(var e=Oe.length;e;){for(bt=Oe,Oe=[];++fn<e;)bt&&bt[fn].run();fn=-1,e=Oe.length}bt=null,Kt=!1,lh(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 ka(t,e)),Oe.length===1&&!Kt&&Ta(va)};function ka(t,e){this.fun=t,this.array=e}ka.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,Ga)=>{"use strict";var{SymbolAsyncIterator:Na,SymbolIterator:Pa,SymbolFor:mt}=B(),Oa=mt("nodejs.stream.destroyed"),La=mt("nodejs.stream.errored"),Bi=mt("nodejs.stream.readable"),Ci=mt("nodejs.stream.writable"),Ba=mt("nodejs.stream.disturbed"),fh=mt("nodejs.webstream.isClosedPromise"),ch=mt("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 dh(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 Ca(t){return!!(t&&!me(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Fa(t){return!!(t&&!me(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Ma(t){return!!(t&&!me(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function hh(t){return Ca(t)||Fa(t)||Ma(t)}function ph(t,e){return t==null?!1:e===!0?typeof t[Na]=="function":e===!1?typeof t[Pa]=="function":typeof t[Na]=="function"||typeof t[Pa]=="function"}function hn(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Oa]||n!=null&&n.destroyed)}function Da(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 _h(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 yh(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 Ua(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 $a(t){return t&&t[Bi]!=null?t[Bi]:typeof t?.readable!="boolean"?null:hn(t)?!1:cn(t)&&t.readable&&!Ua(t)}function qa(t){return t&&t[Ci]!=null?t[Ci]:typeof t?.writable!="boolean"?null:hn(t)?!1:dn(t)&&t.writable&&!Da(t)}function bh(t,e){return me(t)?hn(t)?!0:!(e?.readable!==!1&&$a(t)||e?.writable!==!1&&qa(t)):null}function mh(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 gh(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 wh(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"&&Wa(t)?t._closed:null}function Wa(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function za(t){return typeof t._sent100=="boolean"&&Wa(t)}function xh(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 Sh(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&za(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Eh(t){var e;return!!(t&&((e=t[Ba])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Rh(t){var e,r,n,i,s,o,a,l,u,f;return!!(t&&((e=(r=(n=(i=(s=(o=t[La])!==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))}Ga.exports={isDestroyed:hn,kIsDestroyed:Oa,isDisturbed:Eh,kIsDisturbed:Ba,isErrored:Rh,kIsErrored:La,isReadable:$a,kIsReadable:Bi,kIsClosedPromise:fh,kControllerErrorFunction:ch,kIsWritable:Ci,isClosed:wh,isDuplexNodeStream:dh,isFinished:bh,isIterable:ph,isReadableNodeStream:cn,isReadableStream:Ca,isReadableEnded:yh,isReadableFinished:Ua,isReadableErrored:gh,isNodeStream:me,isWebStream:hh,isWritable:qa,isWritableNodeStream:dn,isWritableStream:Fa,isWritableEnded:Da,isWritableFinished:_h,isWritableErrored:mh,isServerRequest:xh,isServerResponse:za,willEmitClose:Sh,isTransformStream:Ma}});var Be=v((Lg,$i)=>{"use strict";var Je=Qe(),{AbortError:el,codes:Ih}=Q(),{ERR_INVALID_ARG_TYPE:Ah,ERR_STREAM_PREMATURE_CLOSE:Ha}=Ih,{kEmptyObject:Mi,once:Di}=Y(),{validateAbortSignal:Th,validateFunction:vh,validateObject:kh,validateBoolean:jh}=Vt(),{Promise:Nh,PromisePrototypeThen:Ph,SymbolDispose:tl}=B(),{isClosed:Oh,isReadable:Va,isReadableNodeStream:Fi,isReadableStream:Lh,isReadableFinished:Ka,isReadableErrored:Qa,isWritable:Ja,isWritableNodeStream:Ya,isWritableStream:Bh,isWritableFinished:Za,isWritableErrored:Xa,isNodeStream:Ch,willEmitClose:Fh,kIsClosedPromise:Mh}=ge(),Qt;function Dh(t){return t.setHeader&&typeof t.abort=="function"}var Ui=()=>{};function rl(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Mi):e==null?e=Mi:kh(e,"options"),vh(r,"callback"),Th(e.signal,"options.signal"),r=Di(r),Lh(t)||Bh(t))return Uh(t,e,r);if(!Ch(t))throw new Ah("stream",["ReadableStream","WritableStream","Stream"],t);let s=(n=e.readable)!==null&&n!==void 0?n:Fi(t),o=(i=e.writable)!==null&&i!==void 0?i:Ya(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=Fh(t)&&Fi(t)===s&&Ya(t)===o,c=Za(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=Ka(t,!1),y=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},_=T=>{r.call(t,T)},x=Oh(t),b=()=>{x=!0;let T=Xa(t)||Qa(t);if(T&&typeof T!="boolean")return r.call(t,T);if(s&&!h&&Fi(t,!0)&&!Ka(t,!1))return r.call(t,new Ha);if(o&&!c&&!Za(t,!1))return r.call(t,new Ha);r.call(t)},g=()=>{x=!0;let T=Xa(t)||Qa(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},S=()=>{t.req.on("finish",d)};Dh(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||Va(t))&&(c||Ja(t)===!1)||!o&&(!f||Ja(t))&&(h||Va(t)===!1)||l&&t.req&&t.aborted)&&Je.nextTick(g);let w=()=>{r=Ui,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 el(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Je.nextTick(T);else{Qt=Qt||Y().addAbortListener;let Ae=Qt(e.signal,T),U=r;r=Di((...Tt)=>{Ae[tl](),U.apply(t,Tt)})}}return w}function Uh(t,e,r){let n=!1,i=Ui;if(e.signal)if(i=()=>{n=!0,r.call(t,new el(void 0,{cause:e.signal.reason}))},e.signal.aborted)Je.nextTick(i);else{Qt=Qt||Y().addAbortListener;let o=Qt(e.signal,i),a=r;r=Di((...l)=>{o[tl](),a.apply(t,l)})}let s=(...o)=>{n||Je.nextTick(()=>r.apply(t,o))};return Ph(t[Mh].promise,s,s),Ui}function $h(t,e){var r;let n=!1;return e===null&&(e=Mi),(r=e)!==null&&r!==void 0&&r.cleanup&&(jh(e.cleanup,"cleanup"),n=e.cleanup),new Nh((i,s)=>{let o=rl(t,e,a=>{n&&o(),a?s(a):i()})})}$i.exports=rl;$i.exports.finished=$h});var gt=v((Bg,fl)=>{"use strict";var we=Qe(),{aggregateTwoErrors:qh,codes:{ERR_MULTIPLE_CALLBACK:Wh},AbortError:zh}=Q(),{Symbol:sl}=B(),{kIsDestroyed:Gh,isDestroyed:Hh,isFinished:Vh,isServerRequest:Kh}=ge(),ol=sl("kDestroy"),qi=sl("kConstruct");function al(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Qh(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):(al(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?nl(this,t,e):this.once(ol,function(s){nl(this,qh(s,t),e)}),this)}function nl(t,e,r){let n=!1;function i(s){if(n)return;n=!0;let o=t._readableState,a=t._writableState;al(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?we.nextTick(Jh,t,s):we.nextTick(ll,t)}try{t._destroy(e||null,i)}catch(s){i(s)}}function Jh(t,e){Wi(t,e),ll(t)}function ll(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 Wi(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 Yh(){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 zi(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(Wi,t,e):Wi(t,e))}function Zh(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(qi,e),!(t.listenerCount(qi)>1)&&we.nextTick(Xh,t)}function Xh(t){let e=!1;function r(n){if(e){zi(t,n??new Wh);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(ol,n):n?zi(t,n,!0):we.nextTick(ep,t)}try{t._construct(n=>{we.nextTick(r,n)})}catch(n){we.nextTick(r,n)}}function ep(t){t.emit(qi)}function il(t){return t?.setHeader&&typeof t.abort=="function"}function ul(t){t.emit("close")}function tp(t,e){t.emit("error",e),we.nextTick(ul,t)}function rp(t,e){!t||Hh(t)||(!e&&!Vh(t)&&(e=new zh),Kh(t)?(t.socket=null,t.destroy(e)):il(t)?t.abort():il(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?we.nextTick(tp,t,e):we.nextTick(ul,t),t.destroyed||(t[Gh]=!0))}fl.exports={construct:Zh,destroyer:rp,destroy:Qh,undestroy:Yh,errorOrDestroy:zi}});var yn=v((Cg,dl)=>{"use strict";var{ArrayIsArray:np,ObjectSetPrototypeOf:cl}=B(),{EventEmitter:pn}=Rr();function _n(t){pn.call(this,t)}cl(_n.prototype,pn.prototype);cl(_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)}Gi(r,"error",l),Gi(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 Gi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):np(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}dl.exports={Stream:_n,prependListener:Gi}});var Ir=v((Fg,bn)=>{"use strict";var{SymbolDispose:ip}=B(),{AbortError:hl,codes:sp}=Q(),{isNodeStream:pl,isWebStream:op,kControllerErrorFunction:ap}=ge(),lp=Be(),{ERR_INVALID_ARG_TYPE:_l}=sp,Hi,up=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new _l(e,"AbortSignal",t)};bn.exports.addAbortSignal=function(e,r){if(up(e,"signal"),!pl(r)&&!op(r))throw new _l("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=pl(e)?()=>{e.destroy(new hl(void 0,{cause:t.reason}))}:()=>{e[ap](new hl(void 0,{cause:t.reason}))};if(t.aborted)r();else{Hi=Hi||Y().addAbortListener;let n=Hi(t,r);lp(e,n[ip])}return e}});var ml=v((Dg,bl)=>{"use strict";var{StringPrototypeSlice:yl,SymbolIterator:fp,TypedArrayPrototypeSet:mn,Uint8Array:cp}=B(),{Buffer:Vi}=pe(),{inspect:dp}=Y();bl.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 Vi.alloc(0);let r=Vi.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}*[fp](){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+=yl(s,0,e),this.head=n,n.data=yl(s,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Vi.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 cp(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 dp(this,{...r,depth:0,customInspect:!1})}}});var Ar=v((Ug,Sl)=>{"use strict";var{MathFloor:hp,NumberIsInteger:pp}=B(),{validateInteger:_p}=Vt(),{ERR_INVALID_ARG_VALUE:yp}=Q().codes,gl=16*1024,wl=16;function bp(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function xl(t){return t?wl:gl}function mp(t,e){_p(e,"value",0),t?wl=e:gl=e}function gp(t,e,r,n){let i=bp(e,n,r);if(i!=null){if(!pp(i)||i<0){let s=n?`options.${r}`:"options.highWaterMark";throw new yp(s,i)}return hp(i)}return xl(t.objectMode)}Sl.exports={getHighWaterMark:gp,getDefaultHighWaterMark:xl,setDefaultHighWaterMark:mp}});var Il=v((Ki,Rl)=>{var gn=pe(),xe=gn.Buffer;function El(t,e){for(var r in t)e[r]=t[r]}xe.from&&xe.alloc&&xe.allocUnsafe&&xe.allocUnsafeSlow?Rl.exports=gn:(El(gn,Ki),Ki.Buffer=wt);function wt(t,e,r){return xe(t,e,r)}wt.prototype=Object.create(xe.prototype);El(xe,wt);wt.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xe(t,e,r)};wt.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};wt.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xe(t)};wt.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return gn.SlowBuffer(t)}});var vl=v(Tl=>{"use strict";var Ji=Il().Buffer,Al=Ji.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 wp(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 xp(t){var e=wp(t);if(typeof e!="string"&&(Ji.isEncoding===Al||!Al(t)))throw new Error("Unknown encoding: "+t);return e||t}Tl.StringDecoder=Tr;function Tr(t){this.encoding=xp(t);var e;switch(this.encoding){case"utf16le":this.text=Tp,this.end=vp,e=4;break;case"utf8":this.fillLast=Rp,e=4;break;case"base64":this.text=kp,this.end=jp,e=3;break;default:this.write=Np,this.end=Pp;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ji.allocUnsafe(e)}Tr.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||""};Tr.prototype.end=Ap;Tr.prototype.text=Ip;Tr.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 Qi(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Sp(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Qi(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Qi(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Qi(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Ep(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 Rp(t){var e=this.lastTotal-this.lastNeed,r=Ep(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 Ip(t,e){var r=Sp(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function Ap(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Tp(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 vp(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 kp(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 jp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Np(t){return t.toString(this.encoding)}function Pp(t){return t&&t.length?this.write(t):""}});var Yi=v((qg,Pl)=>{"use strict";var kl=Qe(),{PromisePrototypeThen:Op,SymbolAsyncIterator:jl,SymbolIterator:Nl}=B(),{Buffer:Lp}=pe(),{ERR_INVALID_ARG_TYPE:Bp,ERR_STREAM_NULL_VALUES:Cp}=Q().codes;function Fp(t,e,r){let n;if(typeof e=="string"||e instanceof Lp)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[jl])i=!0,n=e[jl]();else if(e&&e[Nl])i=!1,n=e[Nl]();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){Op(a(u),()=>kl.nextTick(f,u),c=>kl.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 Cp;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}Pl.exports=Fp});var kr=v((Wg,Jl)=>{"use strict";var le=Qe(),{ArrayPrototypeIndexOf:Mp,NumberIsInteger:Dp,NumberIsNaN:Up,NumberParseInt:$p,ObjectDefineProperties:ss,ObjectKeys:qp,ObjectSetPrototypeOf:Bl,Promise:Cl,SafeSet:Wp,SymbolAsyncDispose:zp,SymbolAsyncIterator:Gp,Symbol:Hp}=B();Jl.exports=I;I.ReadableState=En;var{EventEmitter:Vp}=Rr(),{Stream:Ye,prependListener:Kp}=yn(),{Buffer:Zi}=pe(),{addAbortSignal:Qp}=Ir(),Fl=Be(),A=Y().debuglog("stream",t=>{A=t}),Jp=ml(),Zt=gt(),{getHighWaterMark:Yp,getDefaultHighWaterMark:Zp}=Ar(),{aggregateTwoErrors:Ol,codes:{ERR_INVALID_ARG_TYPE:Xp,ERR_METHOD_NOT_IMPLEMENTED:e_,ERR_OUT_OF_RANGE:t_,ERR_STREAM_PUSH_AFTER_EOF:r_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:n_},AbortError:i_}=Q(),{validateObject:s_}=Vt(),xt=Hp("kPaused"),{StringDecoder:Ml}=vl(),o_=Yi();Bl(I.prototype,Ye.prototype);Bl(I,Ye);var Xi=()=>{},{errorOrDestroy:Jt}=Zt,Yt=1,a_=2,Dl=4,vr=8,Ul=16,wn=32,xn=64,$l=128,l_=256,u_=512,f_=1024,ns=2048,is=4096,c_=8192,d_=16384,h_=32768,ql=65536,p_=1<<17,__=1<<18;function q(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}ss(En.prototype,{objectMode:q(Yt),ended:q(a_),endEmitted:q(Dl),reading:q(vr),constructed:q(Ul),sync:q(wn),needReadable:q(xn),emittedReadable:q($l),readableListening:q(l_),resumeScheduled:q(u_),errorEmitted:q(f_),emitClose:q(ns),autoDestroy:q(is),destroyed:q(c_),closed:q(d_),closeEmitted:q(h_),multiAwaitDrain:q(ql),readingMore:q(p_),dataEmitted:q(__)});function En(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.state=ns|is|Ul|wn,t&&t.objectMode&&(this.state|=Yt),r&&t&&t.readableObjectMode&&(this.state|=Yt),this.highWaterMark=t?Yp(this,t,"readableHighWaterMark",r):Zp(!1),this.buffer=new Jp,this.length=0,this.pipes=[],this.flowing=null,this[xt]=null,t&&t.emitClose===!1&&(this.state&=~ns),t&&t.autoDestroy===!1&&(this.state&=~is),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Ml(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&&Qp(t.signal,this)),Ye.call(this,t),Zt.construct(this,()=>{this._readableState.needReadable&&Sn(this,this._readableState)})}I.prototype.destroy=Zt.destroy;I.prototype._undestroy=Zt.undestroy;I.prototype._destroy=function(t,e){e(t)};I.prototype[Vp.captureRejectionSymbol]=function(t){this.destroy(t)};I.prototype[zp]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new i_,this.destroy(t)),new Cl((e,r)=>Fl(this,n=>n&&n!==t?r(n):e(null)))};I.prototype.push=function(t,e){return Wl(this,t,e,!1)};I.prototype.unshift=function(t,e){return Wl(this,t,e,!0)};function Wl(t,e,r,n){A("readableAddChunk",e);let i=t._readableState,s;if((i.state&Yt)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Zi.from(e,r).toString(i.encoding):(e=Zi.from(e,r),r=""))):e instanceof Zi?r="":Ye._isUint8Array(e)?(e=Ye._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new Xp("chunk",["string","Buffer","Uint8Array"],e))),s)Jt(t,s);else if(e===null)i.state&=~vr,m_(t,i);else if((i.state&Yt)!==0||e&&e.length>0)if(n)if((i.state&Dl)!==0)Jt(t,new n_);else{if(i.destroyed||i.errored)return!1;es(t,i,e,!0)}else if(i.ended)Jt(t,new r_);else{if(i.destroyed||i.errored)return!1;i.state&=~vr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?es(t,i,e,!1):Sn(t,i)):es(t,i,e,!1)}else n||(i.state&=~vr,Sn(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function es(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&ql)!==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[xt]===!0||t.flowing===!1};I.prototype.setEncoding=function(t){let e=new Ml(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 y_=1073741824;function b_(t){if(t>y_)throw new t_("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Ll(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Yt)!==0?1:Up(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:Dp(t)||(t=$p(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=b_(t)),t!==0&&(e.state&=~$l),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?ts(this):Rn(this),null;if(t=Ll(t,e),t===0&&e.ended)return e.length===0&&ts(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|=vr|wn,e.length===0&&(e.state|=xn);try{this._read(e.highWaterMark)}catch(s){Jt(this,s)}e.state&=~wn,e.reading||(t=Ll(r,e))}let i;return t>0?i=Kl(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&&ts(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function m_(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,zl(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(zl,t))}function zl(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,Hl(t)}function Sn(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,le.nextTick(g_,t,e))}function g_(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 e_("_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 Wp(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=w_(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?Jt(t,b):t.emit("error",b)}}Kp(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 w_(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=Mp(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};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(x_,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(Gl,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(Gl,this),e};function Gl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[xt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function x_(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,S_(this,t)),t[xt]=!1,this};function S_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,le.nextTick(E_,t,e))}function E_(t,e){A("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Hl(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[xt]=!0,this};function Hl(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=>{Jt(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=qp(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[Gp]=function(){return Vl(this)};I.prototype.iterator=function(t){return t!==void 0&&s_(t,"options"),Vl(this,t)};function Vl(t,e){typeof t.read!="function"&&(t=I.wrap(t,{objectMode:!0}));let r=R_(t,e);return r.stream=t,r}async function*R_(t,e){let r=Xi;function n(o){this===t?(r(),r=Xi):r=o}t.on("readable",n);let i,s=Fl(t,{writable:!1},o=>{i=o?Ol(i,o):null,r(),r=Xi});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 Cl(n)}}}catch(o){throw i=Ol(i,o),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Zt.destroyer(t,null):(t.off("readable",n),s())}}ss(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}}});ss(En.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[xt]!==!1},set(t){this[xt]=!!t}}});I._fromList=Kl;function Kl(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 ts(t){let e=t._readableState;A("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,le.nextTick(I_,e,t))}function I_(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(A_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function A_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}I.from=function(t,e){return o_(I,t,e)};var rs;function Ql(){return rs===void 0&&(rs={}),rs}I.fromWeb=function(t,e){return Ql().newStreamReadableFromReadableStream(t,e)};I.toWeb=function(t,e){return Ql().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){Zt.destroyer(t,i),s(i)}}).wrap(t)}});var kn=v((zg,lu)=>{"use strict";var St=Qe(),{ArrayPrototypeSlice:Xl,Error:T_,FunctionPrototypeSymbolHasInstance:eu,ObjectDefineProperty:tu,ObjectDefineProperties:v_,ObjectSetPrototypeOf:ru,StringPrototypeToLowerCase:k_,Symbol:j_,SymbolHasInstance:N_}=B();lu.exports=C;C.WritableState=Pr;var{EventEmitter:P_}=Rr(),jr=yn().Stream,{Buffer:In}=pe(),vn=gt(),{addAbortSignal:O_}=Ir(),{getHighWaterMark:L_,getDefaultHighWaterMark:B_}=Ar(),{ERR_INVALID_ARG_TYPE:C_,ERR_METHOD_NOT_IMPLEMENTED:F_,ERR_MULTIPLE_CALLBACK:nu,ERR_STREAM_CANNOT_PIPE:M_,ERR_STREAM_DESTROYED:Nr,ERR_STREAM_ALREADY_FINISHED:D_,ERR_STREAM_NULL_VALUES:U_,ERR_STREAM_WRITE_AFTER_END:$_,ERR_UNKNOWN_ENCODING:iu}=Q().codes,{errorOrDestroy:Xt}=vn;ru(C.prototype,jr.prototype);ru(C,jr);function ls(){}var er=j_("kOnFinished");function Pr(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?L_(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=W_.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[er]=[]}function Tn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Pr.prototype.getBuffer=function(){return Xl(this.buffered,this.bufferedIndex)};tu(Pr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function C(t){let e=this instanceof Se();if(!e&&!eu(C,this))return new C(t);this._writableState=new Pr(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&&O_(t.signal,this)),jr.call(this,t),vn.construct(this,()=>{let r=this._writableState;r.writing||fs(this,r),cs(this,r)})}tu(C,N_,{__proto__:null,value:function(t){return eu(this,t)?!0:this!==C?!1:t&&t._writableState instanceof Pr}});C.prototype.pipe=function(){Xt(this,new M_)};function su(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 iu(r);typeof n!="function"&&(n=ls)}if(e===null)throw new U_;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(jr._isUint8Array(e))e=jr._uint8ArrayToBuffer(e),r="buffer";else throw new C_("chunk",["string","Buffer","Uint8Array"],e);let s;return i.ending?s=new $_:i.destroyed&&(s=new Nr("write")),s?(St.nextTick(n,s),Xt(t,s,!0),s):(i.pendingcb++,q_(t,i,e,r,n))}C.prototype.write=function(t,e,r){return su(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||fs(this,t))};C.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=k_(e)),!In.isEncoding(e))throw new iu(e);return this._writableState.defaultEncoding=e,this};function q_(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!==ls&&(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 Yl(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Nr("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function Zl(t,e,r,n){--e.pendingcb,n(r),us(e),Xt(t,r)}function W_(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Xt(t,new nu);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?St.nextTick(Zl,t,r,e,i):Zl(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&fs(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},St.nextTick(z_,r.afterWriteTickInfo)):ou(t,r,1,i))}function z_({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,ou(t,e,r,n)}function ou(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&&us(e),cs(t,e)}function us(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 Nr("write"))}let r=t[er].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Nr("end"))}Tn(t)}function fs(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?ls:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:Xl(r,o);l.allBuffers=e.allBuffers,Yl(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;Yl(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 F_("_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=su(this,t,e);s instanceof T_&&(i=s)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,cs(this,n,!0),n.ended=!0):n.finished?i=new D_("end"):n.destroyed&&(i=new Nr("end"))),typeof r=="function"&&(i||n.finished?St.nextTick(r,i):n[er].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 G_(t,e){let r=!1;function n(i){if(r){Xt(t,i??nu());return}if(r=!0,e.pendingcb--,i){let s=e[er].splice(0);for(let o=0;o<s.length;o++)s[o](i);Xt(t,i,e.sync)}else An(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,St.nextTick(as,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function H_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,G_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function cs(t,e,r){An(e)&&(H_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,St.nextTick((n,i)=>{An(i)?as(n,i):i.pendingcb--},t,e)):An(e)&&(e.pendingcb++,as(t,e))))}function as(t,e){e.pendingcb--,e.finished=!0;let r=e[er].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()}}v_(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 V_=vn.destroy;C.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[er].length)&&St.nextTick(us,r),V_.call(this,t,e),this};C.prototype._undestroy=vn.undestroy;C.prototype._destroy=function(t,e){e(t)};C.prototype[P_.captureRejectionSymbol]=function(t){this.destroy(t)};var os;function au(){return os===void 0&&(os={}),os}C.fromWeb=function(t,e){return au().newStreamWritableFromWritableStream(t,e)};C.toWeb=function(t){return au().newWritableStreamFromStreamWritable(t)}});var Eu=v((Gg,Su)=>{var ds=Qe(),K_=pe(),{isReadable:Q_,isWritable:J_,isIterable:uu,isNodeStream:Y_,isReadableNodeStream:fu,isWritableNodeStream:cu,isDuplexNodeStream:Z_,isReadableStream:du,isWritableStream:hu}=ge(),pu=Be(),{AbortError:wu,codes:{ERR_INVALID_ARG_TYPE:X_,ERR_INVALID_RETURN_VALUE:_u}}=Q(),{destroyer:rr}=gt(),ey=Se(),xu=kr(),ty=kn(),{createDeferredPromise:yu}=Y(),bu=Yi(),mu=globalThis.Blob||K_.Blob,ry=typeof mu<"u"?function(e){return e instanceof mu}:function(e){return!1},ny=globalThis.AbortController||zt().AbortController,{FunctionPrototypeCall:gu}=B(),Ze=class extends ey{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)}};Su.exports=function t(e,r){if(Z_(e))return e;if(fu(e))return tr({readable:e});if(cu(e))return tr({writable:e});if(Y_(e))return tr({writable:!1,readable:!1});if(du(e))return tr({readable:xu.fromWeb(e)});if(hu(e))return tr({writable:ty.fromWeb(e)});if(typeof e=="function"){let{value:i,write:s,final:o,destroy:a}=iy(e);if(uu(i))return bu(Ze,i,{objectMode:!0,write:s,final:o,destroy:a});let l=i?.then;if(typeof l=="function"){let u,f=gu(l,i,c=>{if(c!=null)throw new _u("nully","body",c)},c=>{rr(u,c)});return u=new Ze({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,ds.nextTick(c,null)}catch(d){ds.nextTick(c,d)}})},destroy:a})}throw new _u("Iterable, AsyncIterable or AsyncFunction",r,i)}if(ry(e))return t(e.arrayBuffer());if(uu(e))return bu(Ze,e,{objectMode:!0,writable:!1});if(du(e?.readable)&&hu(e?.writable))return Ze.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?fu(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?cu(e?.writable)?e?.writable:t(e.writable):void 0;return tr({readable:i,writable:s})}let n=e?.then;if(typeof n=="function"){let i;return gu(n,e,s=>{s!=null&&i.push(s),i.push(null)},s=>{rr(i,s)}),i=new Ze({objectMode:!0,writable:!1,read(){}})}throw new X_(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function iy(t){let{promise:e,resolve:r}=yu(),n=new ny,i=n.signal;return{value:t((async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(ds.nextTick(u),l)return;if(i.aborted)throw new wu(void 0,{cause:i.reason});({promise:e,resolve:r}=yu()),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 tr(t){let e=t.readable&&typeof t.readable.read!="function"?xu.wrap(t.readable):t.readable,r=t.writable,n=!!Q_(e),i=!!J_(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&&(pu(r,c=>{i=!1,c&&rr(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&&(pu(e,c=>{n=!1,c&&rr(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 wu),a=null,s=null,o=null,l===null?d(c):(l=d,rr(r,c),rr(e,c))},u}});var Se=v((Hg,Au)=>{"use strict";var{ObjectDefineProperties:sy,ObjectGetOwnPropertyDescriptor:Ce,ObjectKeys:oy,ObjectSetPrototypeOf:Ru}=B();Au.exports=ue;var _s=kr(),se=kn();Ru(ue.prototype,_s.prototype);Ru(ue,_s);{let t=oy(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);_s.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}sy(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 hs;function Iu(){return hs===void 0&&(hs={}),hs}ue.fromWeb=function(t,e){return Iu().newStreamDuplexFromReadableWritablePair(t,e)};ue.toWeb=function(t){return Iu().newReadableWritablePairFromDuplex(t)};var ps;ue.from=function(t){return ps||(ps=Eu()),ps(t,"body")}});var ms=v((Vg,vu)=>{"use strict";var{ObjectSetPrototypeOf:Tu,Symbol:ay}=B();vu.exports=Fe;var{ERR_METHOD_NOT_IMPLEMENTED:ly}=Q().codes,bs=Se(),{getHighWaterMark:uy}=Ar();Tu(Fe.prototype,bs.prototype);Tu(Fe,bs);var Or=ay("kCallback");function Fe(t){if(!(this instanceof Fe))return new Fe(t);let e=t?uy(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),bs.call(this,t),this._readableState.sync=!1,this[Or]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",fy)}function ys(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 fy(){this._final!==ys&&ys.call(this)}Fe.prototype._final=ys;Fe.prototype._transform=function(t,e,r){throw new ly("_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[Or]=r})};Fe.prototype._read=function(){if(this[Or]){let t=this[Or];this[Or]=null,t()}}});var ws=v((Kg,ju)=>{"use strict";var{ObjectSetPrototypeOf:ku}=B();ju.exports=nr;var gs=ms();ku(nr.prototype,gs.prototype);ku(nr,gs);function nr(t){if(!(this instanceof nr))return new nr(t);gs.call(this,t)}nr.prototype._transform=function(t,e,r){r(null,t)}});var On=v((Qg,Bu)=>{var Lr=Qe(),{ArrayIsArray:cy,Promise:dy,SymbolAsyncIterator:hy,SymbolDispose:py}=B(),Pn=Be(),{once:_y}=Y(),yy=gt(),Nu=Se(),{aggregateTwoErrors:by,codes:{ERR_INVALID_ARG_TYPE:ks,ERR_INVALID_RETURN_VALUE:xs,ERR_MISSING_ARGS:my,ERR_STREAM_DESTROYED:gy,ERR_STREAM_PREMATURE_CLOSE:wy},AbortError:xy}=Q(),{validateFunction:Sy,validateAbortSignal:Ey}=Vt(),{isIterable:Et,isReadable:Ss,isReadableNodeStream:Nn,isNodeStream:Pu,isTransformStream:ir,isWebStream:Ry,isReadableStream:Es,isReadableFinished:Iy}=ge(),Ay=globalThis.AbortController||zt().AbortController,Rs,Is,As;function Ou(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,yy.destroyer(t,s||new gy("pipe")))},cleanup:i}}function Ty(t){return Sy(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function Ts(t){if(Et(t))return t;if(Nn(t))return vy(t);throw new ks("val",["Readable","Iterable","AsyncIterable"],t)}async function*vy(t){Is||(Is=kr()),yield*Is.prototype[hy].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 dy((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?by(i,u):u)}finally{l(),e.off("drain",o)}}async function vs(t,e,r,{end:n}){ir(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 ky(...t){return Lu(t,_y(Ty(t)))}function Lu(t,e,r){if(t.length===1&&cy(t[0])&&(t=t[0]),t.length<2)throw new my("streams");let n=new Ay,i=n.signal,s=r?.signal,o=[];Ey(s,"options.signal");function a(){y(new xy)}As=As||Y().addAbortListener;let l;s&&(l=As(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[py](),n.abort(),w&&(u||o.forEach(Ae=>Ae()),Lr.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,Tt=S===t.length-1;if(Pu(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:zn}=Ou(w,T,Ae);c.push(Te),Ss(w)&&Tt&&o.push(zn)}w.on("error",Z),Ss(w)&&Tt&&o.push(()=>{w.removeListener("error",Z)})}if(S===0)if(typeof w=="function"){if(_=w({signal:i}),!Et(_))throw new xs("Iterable, AsyncIterable or Stream","source",_)}else Et(w)||Nn(w)||ir(w)?_=w:_=Nu.from(w);else if(typeof w=="function"){if(ir(_)){var x;_=Ts((x=_)===null||x===void 0?void 0:x.readable)}else _=Ts(_);if(_=w(_,{signal:i}),T){if(!Et(_,!0))throw new xs("AsyncIterable",`transform[${S-1}]`,_)}else{var b;Rs||(Rs=ws());let Z=new Rs({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(),Lr.nextTick(h)},Ue=>{Z.destroy(Ue),Lr.nextTick(h,Ue)});else if(Et(_,!0))d++,jn(_,Z,h,{end:U});else if(Es(_)||ir(_)){let Ue=_.readable||_;d++,jn(Ue,Z,h,{end:U})}else throw new xs("AsyncIterable or Promise","destination",_);_=Z;let{destroy:zn,cleanup:Sf}=Ou(_,!1,!0);c.push(zn),Tt&&o.push(Sf)}}else if(Pu(w)){if(Nn(_)){d+=2;let Z=jy(_,w,h,{end:U});Ss(w)&&Tt&&o.push(Z)}else if(ir(_)||Es(_)){let Z=_.readable||_;d++,jn(Z,w,h,{end:U})}else if(Et(_))d++,jn(_,w,h,{end:U});else throw new ks("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else if(Ry(w)){if(Nn(_))d++,vs(Ts(_),w,h,{end:U});else if(Es(_)||Et(_))d++,vs(_,w,h,{end:U});else if(ir(_))d++,vs(_.readable,w,h,{end:U});else throw new ks("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else _=Nu.from(w)}return(i!=null&&i.aborted||s!=null&&s.aborted)&&Lr.nextTick(a),_}function jy(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new wy)}),t.pipe(e,{end:!1}),n){let o=function(){i=!0,e.end()};var s=o;Iy(t)?Lr.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)}Bu.exports={pipelineImpl:Lu,pipeline:ky}});var Ns=v((Jg,$u)=>{"use strict";var{pipeline:Ny}=On(),Ln=Se(),{destroyer:Py}=gt(),{isNodeStream:Bn,isReadable:Cu,isWritable:Fu,isWebStream:js,isTransformStream:Rt,isWritableStream:Mu,isReadableStream:Du}=ge(),{AbortError:Oy,codes:{ERR_INVALID_ARG_VALUE:Uu,ERR_MISSING_ARGS:Ly}}=Q(),By=Be();$u.exports=function(...e){if(e.length===0)throw new Ly("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])&&!js(e[h]))){if(h<e.length-1&&!(Cu(e[h])||Du(e[h])||Rt(e[h])))throw new Uu(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Fu(e[h])||Mu(e[h])||Rt(e[h])))throw new Uu(`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=Ny(e,l),c=!!(Fu(u)||Mu(u)||Rt(u)),d=!!(Cu(f)||Du(f)||Rt(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(js(u)){let _=(Rt(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=Rt(f)?f.readable:f;By(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(js(f)){let y=(Rt(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 Oy),s=null,n=null,i=null,o===null?y(h):(o=y,Bn(f)&&Py(f,h))},a}});var Yu=v((Yg,Ls)=>{"use strict";var Cy=globalThis.AbortController||zt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Fy,ERR_INVALID_ARG_TYPE:Br,ERR_MISSING_ARGS:My,ERR_OUT_OF_RANGE:Dy},AbortError:Ee}=Q(),{validateAbortSignal:It,validateInteger:qu,validateObject:At}=Vt(),Uy=B().Symbol("kWeak"),$y=B().Symbol("kResistStopPropagation"),{finished:qy}=Be(),Wy=Ns(),{addAbortSignalNoValidate:zy}=Ir(),{isWritable:Gy,isNodeStream:Hy}=ge(),{deprecate:Vy}=Y(),{ArrayPrototypePush:Ky,Boolean:Qy,MathFloor:Wu,Number:Jy,NumberIsNaN:Yy,Promise:zu,PromiseReject:Gu,PromiseResolve:Zy,PromisePrototypeThen:Hu,Symbol:Ku}=B(),Cn=Ku("kEmpty"),Vu=Ku("kEof");function Xy(t,e){if(e!=null&&At(e,"options"),e?.signal!=null&&It(e.signal,"options.signal"),Hy(t)&&!Gy(t))throw new Fy("stream",t,"must be writable");let r=Wy(this,t);return e!=null&&e.signal&&zy(e.signal,r),r}function Fn(t,e){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);e!=null&&At(e,"options"),e?.signal!=null&&It(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Wu(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Wu(e.highWaterMark)),qu(r,"options.concurrency",1),qu(n,"options.highWaterMark",0),n+=r,async function*(){let s=Y().AbortSignalAny([e?.signal].filter(Qy)),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=Zy(b)}catch(g){b=Gu(g)}d+=1,Hu(b,y,h),a.push(b),u&&(u(),u=null),!c&&(a.length>=n||d>=r)&&await new zu(g=>{f=g})}a.push(Vu)}catch(b){let g=Gu(b);Hu(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===Vu)return;if(s.aborted)throw new Ee;b!==Cn&&(yield b),a.shift(),_()}await new zu(b=>{u=b})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function eb(t=void 0){return t!=null&&At(t,"options"),t?.signal!=null&&It(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 Qu(t,e=void 0){for await(let r of Os.call(this,t,e))return!0;return!1}async function tb(t,e=void 0){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);return!await Qu.call(this,async(...r)=>!await t(...r),e)}async function rb(t,e){for await(let r of Os.call(this,t,e))return r}async function nb(t,e){if(typeof t!="function")throw new Br("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 Os(t,e){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:Cn}return Fn.call(this,r,e)}var Ps=class extends My{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function ib(t,e,r){var n;if(typeof t!="function")throw new Br("reducer",["Function","AsyncFunction"],t);r!=null&&At(r,"options"),r?.signal!=null&&It(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 qy(this.destroy(u)),u}let s=new Cy,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[Uy]:this,[$y]:!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 Ps}finally{s.abort()}return e}async function sb(t){t!=null&&At(t,"options"),t?.signal!=null&&It(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});Ky(e,n)}return e}function ob(t,e){let r=Fn.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function Ju(t){if(t=Jy(t),Yy(t))return 0;if(t<0)throw new Dy("number",">= 0",t);return t}function ab(t,e=void 0){return e!=null&&At(e,"options"),e?.signal!=null&&It(e.signal,"options.signal"),t=Ju(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;t--<=0&&(yield s)}}.call(this)}function lb(t,e=void 0){return e!=null&&At(e,"options"),e?.signal!=null&&It(e.signal,"options.signal"),t=Ju(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ee;for await(let s of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new Ee;if(t-- >0&&(yield s),t<=0)return}}.call(this)}Ls.exports.streamReturningOperators={asIndexedPairs:Vy(eb,"readable.asIndexedPairs will be removed in a future version."),drop:ab,filter:Os,flatMap:ob,map:Fn,take:lb,compose:Xy};Ls.exports.promiseReturningOperators={every:tb,forEach:nb,reduce:ib,toArray:sb,some:Qu,find:rb}});var Bs=v((Zg,Zu)=>{"use strict";var{ArrayPrototypePop:ub,Promise:fb}=B(),{isIterable:cb,isNodeStream:db,isWebStream:hb}=ge(),{pipelineImpl:pb}=On(),{finished:_b}=Be();Cs();function yb(...t){return new fb((e,r)=>{let n,i,s=t[t.length-1];if(s&&typeof s=="object"&&!db(s)&&!cb(s)&&!hb(s)){let o=ub(t);n=o.signal,i=o.end}pb(t,(o,a)=>{o?r(o):e(a)},{signal:n,end:i})})}Zu.exports={finished:_b,pipeline:yb}});var Cs=v((Xg,lf)=>{"use strict";var{Buffer:bb}=pe(),{ObjectDefineProperty:Me,ObjectKeys:tf,ReflectApply:rf}=B(),{promisify:{custom:nf}}=Y(),{streamReturningOperators:Xu,promiseReturningOperators:ef}=Yu(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:sf}}=Q(),mb=Ns(),{setDefaultHighWaterMark:gb,getDefaultHighWaterMark:wb}=Ar(),{pipeline:of}=On(),{destroyer:xb}=gt(),af=Be(),Fs=Bs(),Cr=ge(),L=lf.exports=yn().Stream;L.isDestroyed=Cr.isDestroyed;L.isDisturbed=Cr.isDisturbed;L.isErrored=Cr.isErrored;L.isReadable=Cr.isReadable;L.isWritable=Cr.isWritable;L.Readable=kr();for(let t of tf(Xu)){let r=function(...n){if(new.target)throw sf();return L.Readable.from(rf(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})}for(let t of tf(ef)){let r=function(...n){if(new.target)throw sf();return rf(e,this,n)},e=ef[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=ms();L.PassThrough=ws();L.pipeline=of;var{addAbortSignal:Sb}=Ir();L.addAbortSignal=Sb;L.finished=af;L.destroy=xb;L.compose=mb;L.setDefaultHighWaterMark=gb;L.getDefaultHighWaterMark=wb;Me(L,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Fs}});Me(of,nf,{__proto__:null,enumerable:!0,get(){return Fs.pipeline}});Me(af,nf,{__proto__:null,enumerable:!0,get(){return Fs.finished}});L.Stream=L;L._isUint8Array=function(e){return e instanceof Uint8Array};L._uint8ArrayToBuffer=function(e){return bb.from(e.buffer,e.byteOffset,e.byteLength)}});var Mn=v((ew,M)=>{"use strict";var W=Cs(),Eb=Bs(),Rb=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=Rb;M.exports.pipeline=W.pipeline;M.exports.compose=W.compose;Object.defineProperty(W,"promises",{configurable:!0,enumerable:!0,get(){return Eb}});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 ar=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 jt={};vt(jt,{Client:()=>oe,client:()=>re,deepClone:()=>$e,formdata:()=>Vs,metroError:()=>V,request:()=>nt,response:()=>kt,trace:()=>jf,url:()=>z});var rt="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(nt(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 "+rt+"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=nt(e,r),!e.url)throw V("metro.client."+e.method.toLowerCase()+": Missing url parameter "+rt+"client/fetch-missing-url/",e);if(r||(r={}),typeof r!="object"||r instanceof String)throw V("metro.client.fetch: Invalid options parameter "+rt+"client/fetch-invalid-options/",r);let i=[async function(a){a[Symbol.metroProxy]&&(a=a[Symbol.metroSource]);let l=await fetch(a);return kt(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 kf(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 nt(...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,kf(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}),nt(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 Gs(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 kt(...t){let e={};for(let i of t)typeof i=="string"?e.body=i:i instanceof Response?Object.assign(e,Gs(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,Gs(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 kt(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 Hs(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)Hs(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":Hs(r,n.searchParams);break;default:if(!e.includes(i))throw V("metro.url: unknown url parameter "+rt+"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+" "+rt+"url/unsupported-param-value/",t[i]);break}else throw V("metro.url: unsupported option value "+rt+"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 Vs(...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 "+rt+"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 Vs(r,...s)};break;default:r[n]instanceof Function?i=r[n].bind(r):i=r[n];break}return i}})}var lr={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 lr.error(t,...e),new Error(t,...e)}var jf={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++,lr.group(t),lr.info(e?.url,e,r)},response:(e,r)=>{lr.info(e?.body?e.body[Symbol.metroSource]:null,e,r),lr.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 it=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 Nf}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}},Nf=(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:ar,adapters:{https:it},path:R};globalThis.jsfs=Pf;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||Lf(s))&&(r=r.with({headers:{"Content-Type":t.contentType}})),Ks(r.headers.get("Content-Type"))&&(r=r.with({body:JSON.stringify(r.data,t.replacer,t.space)}))}let i=await n(r);if(i&&Ks(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 Of=/^application\/([a-zA-Z0-9\-_]+\+)?json\b/;function Ks(t){return Of.exec(t)}function Lf(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 Nt(){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(),Nt()):super(e,ce(),Nt()),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]}},Hn=class extends Gr{constructor(e,r,n=null){e instanceof oe?super(e.with(fe()),r,n):super(re(e,fe()),r,n)}};function Qs(...t){return new Gr(...$e(t))}function Js(...t){return new Hn(...$e(t))}var Ys=Object.assign({},jt,{mw:{json:fe,thrower:ce,getdata:Nt},api:Qs,jsonApi:Js});globalThis.metro||(globalThis.metro=Ys);var N=Ys;var Hr={};vt(Hr,{base64url_encode:()=>Yn,createState:()=>to,default:()=>Ot,generateCodeChallenge:()=>eo,generateCodeVerifier:()=>Xs,getExpires:()=>Qn,isAuthorized:()=>Mf,isExpired:()=>Jn,isRedirected:()=>Zn});globalThis.assertEnabled=!1;function Bf(){globalThis.assertEnabled=!0}function Cf(){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"?(Zs("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 Vn(...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 Kn(t,e,r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return P("data is not a valid email",t,"validEmail",r)}function st(t){return function(r,n,i){if(!(r instanceof t))return P("data is not an instanceof pattern",r,t,i)}}function Pt(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 Zs(t,e,r,n){console.warn("\u{1F170}\uFE0F Assert: "+n,t,r,e)}globalThis.assert={warn:Zs,error:P,assert:D,enable:Bf,disable:Cf,Required:k,Recommended:qe,Optional:m,oneOf:$,anyOf:ve,allOf:Vn,validURL:E,validEmail:Kn,instanceOf:st,not:Pt,fails:G};function ur(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 Ot(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:Xs(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=ur(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=Jn(d);if(!d||y&&!h){try{if(!await o())return kt("false")}catch(_){throw _}return i(f,c)}else if(y&&h){try{if(!await a())return kt("false")}catch(_){throw _}return i(f,c)}else return f=nt(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:Qn(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:Qn(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||to(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 eo(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 nt(c,{method:"POST",body:new URLSearchParams(d)})}}function Jn(t){if(!t)return!0;let e=new Date(t.expires);return new Date().getTime()>e.getTime()}function Qn(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 Xs(t=64){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),Yn(e)}async function eo(t){let r=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",r);return Yn(n)}function Yn(t){let e=Array.from(new Uint8Array(t),r=>String.fromCharCode(r)).join("");return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function to(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",n=0;for(;n<t;)r+=e.charAt(Math.floor(Math.random()*e.length)),n++;return r}function Zn(){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 Mf(t){typeof t=="string"&&(t=ur(t).tokens);let e=t.get("access_token");return!!(e&&!Jn(e)||t.get("refresh_token"))}var Xn={};vt(Xn,{default:()=>no});var Vr={status:200,statusText:"OK",headers:{"Content-Type":"application/json"}},fr=t=>({status:400,statusText:"Bad Request",headers:{"Content-Type":"application/json"},body:JSON.stringify({error:"invalid_request",error_description:t})}),We,ro={};function no(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(fr(We));if(i.searchParams.has("code_challenge")){if(!i.searchParams.has("code_challenge_method"))return N.response(fr("missing code_challenge_method"));ro.code_challenge=i.searchParams.get("code_challenge"),ro.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(fr(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(fr(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(fr(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 ei={};vt(ei,{default:()=>oo});var io=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],so=["client_secret_post","client_secret_base","client_secret_jwt","private_key_jwt"],Df={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(so),revocation_endpoint_auth_signing_alg_values_supported:m(io),introspection_endpoint:m(E),introspection_endpoint_auth_methods_supported:m(so),introspection_endpoint_auth_signing_alg_values_supported:m(io),code_challendge_methods_supported:m([])};function oo(t={}){let e={client:N.client()};t=Object.assign({},e,t),D(t,{issuer:k(E)});let r=Uf(t.issuer);return t.client.with(t.issuer)}async function Uf(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,Df),n}throw N.metroError("metro.oidcmw: Error while fetching "+t+".wellknown/oauth_authorization_server",r)}function ao(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 lo(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 cr(){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 $f=new TextEncoder,qf=new TextDecoder;function Kr(t){return typeof t=="string"?$f.encode(t):qf.decode(t)}function uo(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new ri(`${t.name} modulusLength must be at least 2048 bits`)}function Wf(t){switch(t.algorithm.name){case"ECDSA":return{name:t.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return uo(t.algorithm),{name:t.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return uo(t.algorithm),{name:t.algorithm.name};case"Ed25519":return{name:t.algorithm.name}}throw new ze}async function zf(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(Wf(r),r,Kr(n)));return`${n}.${i}`}var ti;Uint8Array.prototype.toBase64?ti=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):ti=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 ti(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)}},ri=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 Gf(t){switch(t.algorithm.hash.name){case"SHA-256":return"PS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Hf(t){switch(t.algorithm.hash.name){case"SHA-256":return"RS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Vf(t){switch(t.algorithm.namedCurve){case"P-256":return"ES256";default:throw new ze("unsupported EcKeyAlgorithm namedCurve")}}function Kf(t){switch(t.algorithm.name){case"RSA-PSS":return Gf(t);case"RSASSA-PKCS1-v1_5":return Hf(t);case"ECDSA":return Vf(t);case"Ed25519":return"Ed25519";default:throw new ze("unsupported CryptoKey algorithm name")}}function fo(t){return t instanceof CryptoKey}function Qf(t){return fo(t)&&t.type==="private"}function Jf(t){return fo(t)&&t.type==="public"}function Yf(){return Math.floor(Date.now()/1e3)}async function ni(t,e,r,n,i,s){let o=t?.privateKey,a=t?.publicKey;if(!Qf(o))throw new TypeError('"keypair.privateKey" must be a private CryptoKey');if(!Jf(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 zf({alg:Kf(o),typ:"dpop+jwt",jwk:await Zf(a)},Object.assign(Object.assign({},s),{iat:Yf(),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 Zf(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 co(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 dr(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 cr(),i=await n.get(t.site);if(!i){let a=await co("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 ni(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 ni(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 ec=Object.assign({},Hr,{oauth2mw:Ot,mockserver:Xn,discover:ei,tokenstore:ur,dpopmw:dr,keysstore:cr,authorizePopup:lo,popupHandleRedirect:ao});globalThis.metro.oauth2||(globalThis.metro.oauth2=ec);var hr=(...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 pr(t={}){D(t,{client:m(st(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(Vn(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"),Pt(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 _r(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([Kn]),client_name:m(String),logo_uri:m(E),client_uri:m(E),policy_uri:m(E),tos_uri:m(E),jwks_uri:m(E,Pt(hr("jwks"))),jwks:m(E,Pt(hr("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),hr("id_token_encrypted_response_alg")),userinfo_signed_response_alg:m($(...ae)),userinfo_encrypted_response_alg:m($(...ae)),userinfo_encrypted_response_enc:m($(...ae),hr("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(st(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 ii(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(st(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 pr({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 _r({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(dr(u)),o.client=l}return l=l.with(Ot(o)),i=await l.fetch(r),i}}function ho(){return Zn()}function po(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 _o={oidcmw:ii,discover:pr,register:_r,isRedirected:ho,idToken:po};globalThis.metro.oidc||(globalThis.metro.oidc=_o);var yo=_o;function ai(t){return new si(t)}var li="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",tc={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 si=class{constructor(e){this.prefixes={...tc,...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 oi(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}},oi=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 Lt(r,this)),this.subjects[r]}addBlankNode(e){return this.#e[e]||(this.#e[e]=new ot(this)),this.#e[e]}addCollection(e){return this.#e[e]||(this.#e[e]=new Bt(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}},ot=class{constructor(e){Object.defineProperty(this,"graph",{value:e,writable:!1,enumerable:!1})}addPredicate(e,r){if(e.id&&(e=e.id),e==li){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}},Lt=class extends ot{constructor(e,r){super(r),Object.defineProperty(this,"id",{value:e,writable:!1,enumerable:!0})}},Bt=class extends Array{constructor(e,r){super(),Object.defineProperty(this,"graph",{value:r,writable:!1,enumerable:!1})}};var $s={};vt($s,{n3Parser:()=>Ib,n3Writer:()=>Ab});var Mo=zr(pe());var ut="http://www.w3.org/1999/02/22-rdf-syntax-ns#",br="http://www.w3.org/2001/XMLSchema#",tn="http://www.w3.org/2000/10/swap/",O={xsd:{decimal:`${br}decimal`,boolean:`${br}boolean`,double:`${br}double`,integer:`${br}integer`,string:`${br}string`},rdf:{type:`${ut}type`,nil:`${ut}nil`,first:`${ut}first`,rest:`${ut}rest`,langString:`${ut}langString`,dirLangString:`${ut}dirLangString`,reifies:`${ut}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,Lc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Fo={"\\":"\\","'":"'",'"':'"',n:`
|
|
3
|
-
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Bc=/[\x00-\x20<>\\"\{\}\|\^\`]/,Cc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_dircode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},Fc=/$0^/,ft=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 Cc)&&this[r]instanceof RegExp&&(this[r]=Fc)}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"?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(Lc,(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 Fo?Fo[a]:(r=!0,"")});return r?null:n}_parseLiteral(e){if(e.length>=3){let r=e.match(/^(?:"""|"|'''|'|)/)[0],n=r.length,i=Math.max(this._literalClosingPos,n);for(;(i=e.indexOf(r,i))>0;){let s=0;for(;e[i-s-1]==="\\";)s++;if(s%2===0){let o=e.substring(n,i),a=o.split(/\r\n|\r|\n/).length-1,l=i+n;if(n===1&&a!==0||n===3&&this._lineMode)break;return this._line+=a,{value:this._unescape(o),matchLength:l}}i++}this._literalClosingPos=e.length-n+1}return{value:"",matchLength:0}}_syntaxError(e){this._input=null;let r=new Error(`Unexpected "${e}" on line ${this._line}.`);return r.context={token:void 0,line:this._line,previousToken:this.previousToken},r}_readStartingBom(e){return e.startsWith("\uFEFF")?e.substr(1):e}tokenize(e,r){if(this._line=1,typeof e=="string")if(this._input=this._readStartingBom(e),typeof r=="function")queueMicrotask(()=>this._tokenizeToEnd(r,!0));else{let n=[],i;if(this._tokenizeToEnd((s,o)=>s?i=s:n.push(o),!0),i)throw i;return n}else this._pendingBuffer=null,typeof e.setEncoding=="function"&&e.setEncoding("utf8"),e.on("data",n=>{this._input!==null&&n.length!==0&&(this._pendingBuffer&&(n=Mo.Buffer.concat([this._pendingBuffer,n]),this._pendingBuffer=null),n[n.length-1]&128?this._pendingBuffer=n:(typeof this._input>"u"?this._input=this._readStartingBom(typeof n=="string"?n:n.toString()):this._input+=n,this._tokenizeToEnd(r,!1)))}),e.on("end",()=>{typeof this._input=="string"&&this._tokenizeToEnd(r,!0)}),e.on("error",r)}};var{rdf:Do,xsd:ct}=O,$t,Mc=0;var gi={namedNode:Uo,blankNode:$o,variable:Wo,literal:qo,defaultGraph:Dc,quad:wi,triple:wi,fromTerm:mr,fromQuad:zo},te=gi,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}}},Ut=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 Ut(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!=="@"?ct.string:e.indexOf("--",r)>0?Do.dirLangString:Do.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}}}},gr=class extends ee{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},wr=class extends ee{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},xr=class extends ee{constructor(){return super(""),$t||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};$t=new xr;function Ve(t,e,r){if(e=e||gi,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===gi)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 $t.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!==ct.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||$t}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 Uo(t){return new Ut(t)}function $o(t){return new gr(t||`n3-${Mc++}`)}function qo(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=ct.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?ct.integer:ct.double:(r=ct.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===ct.string?new je(`"${t}"`):new je(`"${t}"^^${r}`)}function Wo(t){return new wr(t)}function Dc(){return $t}function wi(t,e,r,n){return new Ke(t,e,r,n)}function mr(t){if(t instanceof ee)return t;switch(t.termType){case"NamedNode":return Uo(t.value);case"BlankNode":return $o(t.value);case"Variable":return Wo(t.value);case"DefaultGraph":return $t;case"Literal":return qo(t.value,t.language||t.datatype);case"Quad":return zo(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function zo(t){if(t instanceof Ke)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return wi(mr(t.subject),mr(t.predicate),mr(t.object),mr(t.graph))}var Go=0,Pe=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Ho(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 ft({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){Go=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=Sr}_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${Go++}_`,this._prefixCallback=o||Sr,this._versionCallback=l||Sr,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=Sr):this._readCallback&&(this._readCallback=this._readCallback(c))};a&&(this._lexer.comments=!0,u=(f,c)=>{f!==null?(this._callback(f),this._callback=Sr):this._readCallback&&(c.type==="comment"?a(c.value):this._readCallback=this._readCallback(c))}),this._callback=s,this._lexer.tokenize(e,u)}};function Sr(){}function Ho(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"];Ho(Pe.prototype,te);var xi={};vt(xi,{inDefaultGraph:()=>Gc,isBlankNode:()=>$c,isDefaultGraph:()=>dt,isLiteral:()=>qc,isNamedNode:()=>Uc,isQuad:()=>zc,isVariable:()=>Wc,prefix:()=>Hc,prefixes:()=>Vo});function Uc(t){return!!t&&t.termType==="NamedNode"}function $c(t){return!!t&&t.termType==="BlankNode"}function qc(t){return!!t&&t.termType==="Literal"}function Wc(t){return!!t&&t.termType==="Variable"}function zc(t){return!!t&&t.termType==="Quad"}function dt(t){return!!t&&t.termType==="DefaultGraph"}function Gc(t){return dt(t.graph)}function Hc(t,e){return Vo({"":t.value||t},e)("")}function Vo(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 qt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var Vc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Kc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Ko="./",Qc="../",Si="?",Qo="#",ht=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Vc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",qt(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]===Qo?l=s.lastIndex-1:(r.push(qt(o[0]),"(?:"),n.push(")?"),o[1]!==Si?i.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Qo,a),this._pathReplacements[a]=Si));for(let f=0;f<i.length;f++)this._pathReplacements[i[f]]=Qc.repeat(i.length-f-1);return this._pathReplacements[i[i.length-1]]=Ko,this._baseLength=l>0?l:this.base.length,r.push(qt(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!==Si&&!Kc.test(s)?e:i===Ko&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}};var Er=te.defaultGraph(),{rdf:Jc,xsd:Wt}=O,Jo=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Yo=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,Yc={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},pt=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=Er,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new ht(r.baseIRI)))}get _inDefaultGraph(){return Er.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 If=Object.create;var Qn=Object.defineProperty;var Af=Object.getOwnPropertyDescriptor;var Tf=Object.getOwnPropertyNames;var vf=Object.getPrototypeOf,kf=Object.prototype.hasOwnProperty;var v=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),nt=(t,e)=>{for(var r in e)Qn(t,r,{get:e[r],enumerable:!0})},jf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Tf(e))!kf.call(t,i)&&i!==r&&Qn(t,i,{get:()=>e[i],enumerable:!(n=Af(e,i))||n.enumerable});return t};var zr=(t,e,r)=>(r=t!=null?If(vf(t)):{},jf(e||!t||!t.__esModule?Qn(r,"default",{value:t,enumerable:!0}):r,t));var xo=v(rn=>{"use strict";rn.byteLength=ac;rn.toByteArray=uc;rn.fromByteArray=dc;var de=[],ne=[],oc=typeof Uint8Array<"u"?Uint8Array:Array,fi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ft=0,go=fi.length;ft<go;++ft)de[ft]=fi[ft],ne[fi.charCodeAt(ft)]=ft;var ft,go;ne[45]=62;ne[95]=63;function wo(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 ac(t){var e=wo(t),r=e[0],n=e[1];return(r+n)*3/4-n}function lc(t,e,r){return(e+r)*3/4-r}function uc(t){var e,r=wo(t),n=r[0],i=r[1],s=new oc(lc(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 fc(t){return de[t>>18&63]+de[t>>12&63]+de[t>>6&63]+de[t&63]}function cc(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(fc(n));return i.join("")}function dc(t){for(var e,r=t.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(cc(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 So=v(ci=>{ci.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)};ci.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(Dt=>{"use strict";var di=xo(),Ft=So(),Eo=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Dt.Buffer=p;Dt.SlowBuffer=mc;Dt.INSPECT_MAX_BYTES=50;var nn=2147483647;Dt.kMaxLength=nn;p.TYPED_ARRAY_SUPPORT=hc();!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 hc(){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>nn)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 yi(t)}return To(t,e,r)}p.poolSize=8192;function To(t,e,r){if(typeof t=="string")return _c(t,e);if(ArrayBuffer.isView(t))return yc(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 pi(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=bc(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 To(t,e,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function vo(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 pc(t,e,r){return vo(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 pc(t,e,r)};function yi(t){return vo(t),ke(t<0?0:bi(t)|0)}p.allocUnsafe=function(t){return yi(t)};p.allocUnsafeSlow=function(t){return yi(t)};function _c(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ko(t,e)|0,n=ke(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function hi(t){let e=t.length<0?0:bi(t.length)|0,r=ke(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function yc(t){if(he(t,Uint8Array)){let e=new Uint8Array(t);return pi(e.buffer,e.byteOffset,e.byteLength)}return hi(t)}function pi(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 bc(t){if(p.isBuffer(t)){let e=bi(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"||gi(t.length)?ke(0):hi(t);if(t.type==="Buffer"&&Array.isArray(t.data))return hi(t.data)}function bi(t){if(t>=nn)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+nn.toString(16)+" bytes");return t|0}function mc(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 ko(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 _i(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Mo(t).length;default:if(i)return n?-1:_i(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=ko;function gc(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 kc(this,e,r);case"utf8":case"utf-8":return No(this,e,r);case"ascii":return Tc(this,e,r);case"latin1":case"binary":return vc(this,e,r);case"base64":return Ic(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return jc(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function ct(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)ct(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)ct(this,r,r+3),ct(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)ct(this,r,r+7),ct(this,r+1,r+6),ct(this,r+2,r+5),ct(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?No(this,0,e):gc.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=Dt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Eo&&(p.prototype[Eo]=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 jo(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,gi(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),p.isBuffer(e))return e.length===0?-1:Ro(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ro(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Ro(t,e,r,n,i){let s=1,o=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,o/=2,a/=2,r/=2}function l(f,c){return s===1?f[c]:f.readUInt16BE(c*s)}let u;if(i){let f=-1;for(u=r;u<o;u++)if(l(t,u)===l(e,f===-1?0:u-f)){if(f===-1&&(f=u),u-f+1===a)return f*s}else f!==-1&&(u-=u-f),f=-1}else for(r+a>o&&(r=o-a),u=r;u>=0;u--){let f=!0;for(let c=0;c<a;c++)if(l(t,u+c)!==l(e,c)){f=!1;break}if(f)return u}return-1}p.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};p.prototype.indexOf=function(e,r,n){return jo(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return jo(this,e,r,n,!1)};function wc(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(gi(a))return o;t[r+o]=a}return o}function xc(t,e,r,n){return sn(_i(e,t.length-r),t,r,n)}function Sc(t,e,r,n){return sn(Lc(e),t,r,n)}function Ec(t,e,r,n){return sn(Mo(e),t,r,n)}function Rc(t,e,r,n){return sn(Bc(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 wc(this,e,r,n);case"utf8":case"utf-8":return xc(this,e,r,n);case"ascii":case"latin1":case"binary":return Sc(this,e,r,n);case"base64":return Ec(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 Ic(t,e,r){return e===0&&r===t.length?di.fromByteArray(t):di.fromByteArray(t.slice(e,r))}function No(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 Ac(n)}var Io=4096;function Ac(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 Tc(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 vc(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 kc(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+=Cc[t[s]];return i}function jc(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=Ve(function(e){e=e>>>0,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(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=Ve(function(e){e=e>>>0,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(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=Ve(function(e){e=e>>>0,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(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=Ve(function(e){e=e>>>0,Mt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&yr(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),Ft.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||H(e,4,this.length),Ft.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ft.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||H(e,8,this.length),Ft.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 Po(t,e,r,n,i){Fo(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 Oo(t,e,r,n,i){Fo(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=Ve(function(e,r=0){return Po(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=Ve(function(e,r=0){return Oo(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=Ve(function(e,r=0){return Po(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=Ve(function(e,r=0){return Oo(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Lo(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 Bo(t,e,r,n,i){return e=+e,r=r>>>0,i||Lo(t,e,r,4,34028234663852886e22,-34028234663852886e22),Ft.write(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return Bo(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return Bo(this,e,r,!1,n)};function Co(t,e,r,n,i){return e=+e,r=r>>>0,i||Lo(t,e,r,8,17976931348623157e292,-17976931348623157e292),Ft.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return Co(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return Co(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 Ct={};function mi(t,e,r){Ct[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}`}}}mi("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);mi("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);mi("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=Ao(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Ao(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ao(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 Nc(t,e,r){Mt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&yr(e,t.length-(r+1))}function Fo(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 Ct.ERR_OUT_OF_RANGE("value",a,t)}Nc(n,i,s)}function Mt(t,e){if(typeof t!="number")throw new Ct.ERR_INVALID_ARG_TYPE(e,"number",t)}function yr(t,e,r){throw Math.floor(t)!==t?(Mt(t,r),new Ct.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ct.ERR_BUFFER_OUT_OF_BOUNDS:new Ct.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Pc=/[^+/0-9A-Za-z-_]/g;function Oc(t){if(t=t.split("=")[0],t=t.trim().replace(Pc,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function _i(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 Lc(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Bc(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 Mo(t){return di.toByteArray(Oc(t))}function sn(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 gi(t){return t!==t}var Cc=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 Ve(t){return typeof BigInt>"u"?Fc:t}function Fc(){throw new Error("BigInt not supported")}});var B=v((vg,ta)=>{"use strict";var Ri=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}};ta.exports={AggregateError:Ri,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 Ii=v((kg,ra)=>{"use strict";ra.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((jg,sa)=>{"use strict";var{format:rd,inspect:ln}=Ii(),{AggregateError:nd}=B(),id=globalThis.AggregateError||nd,sd=Symbol("kIsNodeError"),od=["string","function","number","object","Function","Object","boolean","bigint","symbol"],ad=/^([A-Z][a-z0-9]*)+$/,ld="__node_internal_",un={};function mt(t,e){if(!t)throw new un.ERR_INTERNAL_ASSERTION(e)}function na(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 ud(t,e,r){if(typeof e=="function")return mt(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 mt(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:rd(e,...r)}function K(t,e,r){r||(r=Error);class n extends r{constructor(...s){super(ud(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[sd]=!0,un[t]=n}function ia(t){let e=ld+t.name;return Object.defineProperty(t,"name",{value:e}),t}function fd(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new id([e,t],e.message);return r.code=e.code,r}return t||e}var Ai=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new un.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)=>{mt(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)mt(typeof l=="string","All expected entries have to be of type string"),od.includes(l)?i.push(l.toLowerCase()):ad.test(l)?s.push(l):(mt(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=ln(r,{depth:-1});n+=`. Received ${l}`}}else{let l=ln(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=ln(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)=>{mt(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)=>{mt(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=na(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=na(n)),n+="n"}else n=ln(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);sa.exports={AbortError:Ai,aggregateTwoErrors:ia(fd),hideStackFrames:ia,codes:un}});var zt=v((Ng,fn)=>{"use strict";var{AbortController:oa,AbortSignal:cd}=typeof self<"u"?self:typeof window<"u"?window:void 0;fn.exports=oa;fn.exports.AbortSignal=cd;fn.exports.default=oa});var Rr=v((Pg,Ti)=>{"use strict";var Gt=typeof Reflect=="object"?Reflect:null,aa=Gt&&typeof Gt.apply=="function"?Gt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},cn;Gt&&typeof Gt.ownKeys=="function"?cn=Gt.ownKeys:Object.getOwnPropertySymbols?cn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:cn=function(e){return Object.getOwnPropertyNames(e)};function dd(t){console&&console.warn&&console.warn(t)}var ua=Number.isNaN||function(e){return e!==e};function j(){j.init.call(this)}Ti.exports=j;Ti.exports.once=yd;j.EventEmitter=j;j.prototype._events=void 0;j.prototype._eventsCount=0;j.prototype._maxListeners=void 0;var la=10;function dn(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 la},set:function(t){if(typeof t!="number"||t<0||ua(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");la=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||ua(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 fa(t){return t._maxListeners===void 0?j.defaultMaxListeners:t._maxListeners}j.prototype.getMaxListeners=function(){return fa(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")aa(l,this,r);else for(var u=l.length,f=_a(l,u),n=0;n<u;++n)aa(f[n],this,r);return!0};function ca(t,e,r,n){var i,s,o;if(dn(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=fa(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,dd(a)}return t}j.prototype.addListener=function(e,r){return ca(this,e,r,!1)};j.prototype.on=j.prototype.addListener;j.prototype.prependListener=function(e,r){return ca(this,e,r,!0)};function hd(){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 da(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=hd.bind(n);return i.listener=r,n.wrapFn=i,i}j.prototype.once=function(e,r){return dn(r),this.on(e,da(this,e,r)),this};j.prototype.prependOnceListener=function(e,r){return dn(r),this.prependListener(e,da(this,e,r)),this};j.prototype.removeListener=function(e,r){var n,i,s,o,a;if(dn(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():pd(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 ha(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?_d(i):_a(i,i.length)}j.prototype.listeners=function(e){return ha(this,e,!0)};j.prototype.rawListeners=function(e){return ha(this,e,!1)};j.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):pa.call(t,e)};j.prototype.listenerCount=pa;function pa(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?cn(this._events):[]};function _a(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function pd(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function _d(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function yd(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))}ya(t,e,s,{once:!0}),e!=="error"&&bd(t,i,{once:!0})})}function bd(t,e,r){typeof t.on=="function"&&ya(t,"error",e,r)}function ya(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((Og,ki)=>{"use strict";var md=pe(),{format:gd,inspect:wd}=Ii(),{codes:{ERR_INVALID_ARG_TYPE:vi}}=Q(),{kResistStopPropagation:xd,AggregateError:Sd,SymbolDispose:Ed}=B(),Rd=globalThis.AbortSignal||zt().AbortSignal,Id=globalThis.AbortController||zt().AbortController,Ad=Object.getPrototypeOf(async function(){}).constructor,ba=globalThis.Blob||md.Blob,Td=typeof ba<"u"?function(e){return e instanceof ba}:function(e){return!1},ma=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new vi(e,"AbortSignal",t)},vd=(t,e)=>{if(typeof t!="function")throw new vi(e,"Function",t)};ki.exports={AggregateError:Sd,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:gd,inspect:wd,types:{isAsyncFunction(t){return t instanceof Ad},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Td,deprecate(t,e){return t},addAbortListener:Rr().addAbortListener||function(e,r){if(e===void 0)throw new vi("signal","AbortSignal",e);ma(e,"signal"),vd(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[xd]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Ed](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:Rd.any||function(e){if(e.length===1)return e[0];let r=new Id,n=()=>r.abort();return e.forEach(i=>{ma(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};ki.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Vt=v((Lg,va)=>{"use strict";var{ArrayIsArray:Ni,ArrayPrototypeIncludes:Sa,ArrayPrototypeJoin:Ea,ArrayPrototypeMap:kd,NumberIsInteger:Pi,NumberIsNaN:jd,NumberMAX_SAFE_INTEGER:Nd,NumberMIN_SAFE_INTEGER:Pd,NumberParseInt:Od,ObjectPrototypeHasOwnProperty:Ld,RegExpPrototypeExec:Ra,String:Bd,StringPrototypeToUpperCase:Cd,StringPrototypeTrim:Fd}=B(),{hideStackFrames:ie,codes:{ERR_SOCKET_BAD_PORT:Md,ERR_INVALID_ARG_TYPE:J,ERR_INVALID_ARG_VALUE:Ht,ERR_OUT_OF_RANGE:gt,ERR_UNKNOWN_SIGNAL:ga}}=Q(),{normalizeEncoding:Dd}=Y(),{isAsyncFunction:Ud,isArrayBufferView:$d}=Y().types,wa={};function qd(t){return t===(t|0)}function Wd(t){return t===t>>>0}var zd=/^[0-7]+$/,Gd="must be a 32-bit unsigned integer or an octal string";function Hd(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Ra(zd,t)===null)throw new Ht(e,t,Gd);t=Od(t,8)}return Ia(t,e),t}var Vd=ie((t,e,r=Pd,n=Nd)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Pi(t))throw new gt(e,"an integer",t);if(t<r||t>n)throw new gt(e,`>= ${r} && <= ${n}`,t)}),Kd=ie((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Pi(t))throw new gt(e,"an integer",t);if(t<r||t>n)throw new gt(e,`>= ${r} && <= ${n}`,t)}),Ia=ie((t,e,r=!1)=>{if(typeof t!="number")throw new J(e,"number",t);if(!Pi(t))throw new gt(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new gt(e,`>= ${n} && <= ${i}`,t)});function Oi(t,e){if(typeof t!="string")throw new J(e,"string",t)}function Qd(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)&&jd(t))throw new gt(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Jd=ie((t,e,r)=>{if(!Sa(r,t)){let i="must be one of: "+Ea(kd(r,s=>typeof s=="string"?`'${s}'`:Bd(s)),", ");throw new Ht(e,t,i)}});function Aa(t,e){if(typeof t!="boolean")throw new J(e,"boolean",t)}function ji(t,e,r){return t==null||!Ld(t,e)?r:t[e]}var Yd=ie((t,e,r=null)=>{let n=ji(r,"allowArray",!1),i=ji(r,"allowFunction",!1);if(!ji(r,"nullable",!1)&&t===null||!n&&Ni(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new J(e,"Object",t)}),Zd=ie((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new J(e,"a dictionary",t)}),hn=ie((t,e,r=0)=>{if(!Ni(t))throw new J(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Ht(e,t,n)}});function Xd(t,e){hn(t,e);for(let r=0;r<t.length;r++)Oi(t[r],`${e}[${r}]`)}function eh(t,e){hn(t,e);for(let r=0;r<t.length;r++)Aa(t[r],`${e}[${r}]`)}function th(t,e){hn(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);Ta(n,i)}}function rh(t,e="signal"){if(Oi(t,e),wa[t]===void 0)throw wa[Cd(t)]!==void 0?new ga(t+" (signals must use all capital letters)"):new ga(t)}var nh=ie((t,e="buffer")=>{if(!$d(t))throw new J(e,["Buffer","TypedArray","DataView"],t)});function ih(t,e){let r=Dd(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Ht("encoding",e,`is invalid for data of length ${n}`)}function sh(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Fd(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new Md(e,t,r);return t|0}var Ta=ie((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new J(e,"AbortSignal",t)}),oh=ie((t,e)=>{if(typeof t!="function")throw new J(e,"Function",t)}),ah=ie((t,e)=>{if(typeof t!="function"||Ud(t))throw new J(e,"Function",t)}),lh=ie((t,e)=>{if(t!==void 0)throw new J(e,"undefined",t)});function uh(t,e,r){if(!Sa(r,t))throw new J(e,`('${Ea(r,"|")}')`,t)}var fh=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function xa(t,e){if(typeof t>"u"||!Ra(fh,t))throw new Ht(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ch(t){if(typeof t=="string")return xa(t,"hints"),t;if(Ni(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];xa(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Ht("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}va.exports={isInt32:qd,isUint32:Wd,parseFileMode:Hd,validateArray:hn,validateStringArray:Xd,validateBooleanArray:eh,validateAbortSignalArray:th,validateBoolean:Aa,validateBuffer:nh,validateDictionary:Zd,validateEncoding:ih,validateFunction:oh,validateInt32:Kd,validateInteger:Vd,validateNumber:Qd,validateObject:Yd,validateOneOf:Jd,validatePlainFunction:ah,validatePort:sh,validateSignalName:rh,validateString:Oi,validateUint32:Ia,validateUndefined:lh,validateUnion:uh,validateAbortSignal:Ta,validateLinkHeaderValue:ch}});var Je=v((Bg,Pa)=>{var F=Pa.exports={},ye,be;function Li(){throw new Error("setTimeout has not been defined")}function Bi(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?ye=setTimeout:ye=Li}catch{ye=Li}try{typeof clearTimeout=="function"?be=clearTimeout:be=Bi}catch{be=Bi}})();function ka(t){if(ye===setTimeout)return setTimeout(t,0);if((ye===Li||!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 dh(t){if(be===clearTimeout)return clearTimeout(t);if((be===Bi||!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=[],Kt=!1,wt,pn=-1;function hh(){!Kt||!wt||(Kt=!1,wt.length?Oe=wt.concat(Oe):pn=-1,Oe.length&&ja())}function ja(){if(!Kt){var t=ka(hh);Kt=!0;for(var e=Oe.length;e;){for(wt=Oe,Oe=[];++pn<e;)wt&&wt[pn].run();pn=-1,e=Oe.length}wt=null,Kt=!1,dh(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 Na(t,e)),Oe.length===1&&!Kt&&ka(ja)};function Na(t,e){this.fun=t,this.array=e}Na.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((Cg,Va)=>{"use strict";var{SymbolAsyncIterator:Oa,SymbolIterator:La,SymbolFor:xt}=B(),Ba=xt("nodejs.stream.destroyed"),Ca=xt("nodejs.stream.errored"),Ci=xt("nodejs.stream.readable"),Fi=xt("nodejs.stream.writable"),Fa=xt("nodejs.stream.disturbed"),ph=xt("nodejs.webstream.isClosedPromise"),_h=xt("nodejs.webstream.controllerErrorFunction");function _n(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 yn(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 yh(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 Ma(t){return!!(t&&!me(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Da(t){return!!(t&&!me(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Ua(t){return!!(t&&!me(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function bh(t){return Ma(t)||Da(t)||Ua(t)}function mh(t,e){return t==null?!1:e===!0?typeof t[Oa]=="function":e===!1?typeof t[La]=="function":typeof t[Oa]=="function"||typeof t[La]=="function"}function bn(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Ba]||n!=null&&n.destroyed)}function $a(t){if(!yn(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 gh(t,e){if(!yn(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 wh(t){if(!_n(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 qa(t,e){if(!_n(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 Wa(t){return t&&t[Ci]!=null?t[Ci]:typeof t?.readable!="boolean"?null:bn(t)?!1:_n(t)&&t.readable&&!qa(t)}function za(t){return t&&t[Fi]!=null?t[Fi]:typeof t?.writable!="boolean"?null:bn(t)?!1:yn(t)&&t.writable&&!$a(t)}function xh(t,e){return me(t)?bn(t)?!0:!(e?.readable!==!1&&Wa(t)||e?.writable!==!1&&za(t)):null}function Sh(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 Eh(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 Rh(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"&&Ga(t)?t._closed:null}function Ga(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Ha(t){return typeof t._sent100=="boolean"&&Ga(t)}function Ih(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 Ah(t){if(!me(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Ha(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Th(t){var e;return!!(t&&((e=t[Fa])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function vh(t){var e,r,n,i,s,o,a,l,u,f;return!!(t&&((e=(r=(n=(i=(s=(o=t[Ca])!==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))}Va.exports={isDestroyed:bn,kIsDestroyed:Ba,isDisturbed:Th,kIsDisturbed:Fa,isErrored:vh,kIsErrored:Ca,isReadable:Wa,kIsReadable:Ci,kIsClosedPromise:ph,kControllerErrorFunction:_h,kIsWritable:Fi,isClosed:Rh,isDuplexNodeStream:yh,isFinished:xh,isIterable:mh,isReadableNodeStream:_n,isReadableStream:Ma,isReadableEnded:wh,isReadableFinished:qa,isReadableErrored:Eh,isNodeStream:me,isWebStream:bh,isWritable:za,isWritableNodeStream:yn,isWritableStream:Da,isWritableEnded:$a,isWritableFinished:gh,isWritableErrored:Sh,isServerRequest:Ih,isServerResponse:Ha,willEmitClose:Ah,isTransformStream:Ua}});var Be=v((Fg,qi)=>{"use strict";var Ye=Je(),{AbortError:rl,codes:kh}=Q(),{ERR_INVALID_ARG_TYPE:jh,ERR_STREAM_PREMATURE_CLOSE:Ka}=kh,{kEmptyObject:Di,once:Ui}=Y(),{validateAbortSignal:Nh,validateFunction:Ph,validateObject:Oh,validateBoolean:Lh}=Vt(),{Promise:Bh,PromisePrototypeThen:Ch,SymbolDispose:nl}=B(),{isClosed:Fh,isReadable:Qa,isReadableNodeStream:Mi,isReadableStream:Mh,isReadableFinished:Ja,isReadableErrored:Ya,isWritable:Za,isWritableNodeStream:Xa,isWritableStream:Dh,isWritableFinished:el,isWritableErrored:tl,isNodeStream:Uh,willEmitClose:$h,kIsClosedPromise:qh}=ge(),Qt;function Wh(t){return t.setHeader&&typeof t.abort=="function"}var $i=()=>{};function il(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Di):e==null?e=Di:Oh(e,"options"),Ph(r,"callback"),Nh(e.signal,"options.signal"),r=Ui(r),Mh(t)||Dh(t))return zh(t,e,r);if(!Uh(t))throw new jh("stream",["ReadableStream","WritableStream","Stream"],t);let s=(n=e.readable)!==null&&n!==void 0?n:Mi(t),o=(i=e.writable)!==null&&i!==void 0?i:Xa(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||d()},f=$h(t)&&Mi(t)===s&&Xa(t)===o,c=el(t,!1),d=()=>{c=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||s))&&(!s||h)&&r.call(t)},h=Ja(t,!1),y=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||o))&&(!o||c)&&r.call(t)},_=T=>{r.call(t,T)},x=Fh(t),b=()=>{x=!0;let T=tl(t)||Ya(t);if(T&&typeof T!="boolean")return r.call(t,T);if(s&&!h&&Mi(t,!0)&&!Ja(t,!1))return r.call(t,new Ka);if(o&&!c&&!el(t,!1))return r.call(t,new Ka);r.call(t)},g=()=>{x=!0;let T=tl(t)||Ya(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},S=()=>{t.req.on("finish",d)};Wh(t)?(t.on("complete",d),f||t.on("abort",b),t.req?S():t.on("request",S)):o&&!a&&(t.on("end",u),t.on("close",u)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",y),t.on("finish",d),e.error!==!1&&t.on("error",_),t.on("close",b),x?Ye.nextTick(b):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?f||Ye.nextTick(g):(!s&&(!f||Qa(t))&&(c||Za(t)===!1)||!o&&(!f||Za(t))&&(h||Qa(t)===!1)||l&&t.req&&t.aborted)&&Ye.nextTick(g);let w=()=>{r=$i,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 rl(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Ye.nextTick(T);else{Qt=Qt||Y().addAbortListener;let Ae=Qt(e.signal,T),U=r;r=Ui((...jt)=>{Ae[nl](),U.apply(t,jt)})}}return w}function zh(t,e,r){let n=!1,i=$i;if(e.signal)if(i=()=>{n=!0,r.call(t,new rl(void 0,{cause:e.signal.reason}))},e.signal.aborted)Ye.nextTick(i);else{Qt=Qt||Y().addAbortListener;let o=Qt(e.signal,i),a=r;r=Ui((...l)=>{o[nl](),a.apply(t,l)})}let s=(...o)=>{n||Ye.nextTick(()=>r.apply(t,o))};return Ch(t[qh].promise,s,s),$i}function Gh(t,e){var r;let n=!1;return e===null&&(e=Di),(r=e)!==null&&r!==void 0&&r.cleanup&&(Lh(e.cleanup,"cleanup"),n=e.cleanup),new Bh((i,s)=>{let o=il(t,e,a=>{n&&o(),a?s(a):i()})})}qi.exports=il;qi.exports.finished=Gh});var St=v((Mg,dl)=>{"use strict";var we=Je(),{aggregateTwoErrors:Hh,codes:{ERR_MULTIPLE_CALLBACK:Vh},AbortError:Kh}=Q(),{Symbol:al}=B(),{kIsDestroyed:Qh,isDestroyed:Jh,isFinished:Yh,isServerRequest:Zh}=ge(),ll=al("kDestroy"),Wi=al("kConstruct");function ul(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Xh(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):(ul(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?sl(this,t,e):this.once(ll,function(s){sl(this,Hh(s,t),e)}),this)}function sl(t,e,r){let n=!1;function i(s){if(n)return;n=!0;let o=t._readableState,a=t._writableState;ul(s,a,o),a&&(a.closed=!0),o&&(o.closed=!0),typeof r=="function"&&r(s),s?we.nextTick(ep,t,s):we.nextTick(fl,t)}try{t._destroy(e||null,i)}catch(s){i(s)}}function ep(t,e){zi(t,e),fl(t)}function fl(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 zi(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 tp(){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 Gi(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(zi,t,e):zi(t,e))}function rp(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(Wi,e),!(t.listenerCount(Wi)>1)&&we.nextTick(np,t)}function np(t){let e=!1;function r(n){if(e){Gi(t,n??new Vh);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(ll,n):n?Gi(t,n,!0):we.nextTick(ip,t)}try{t._construct(n=>{we.nextTick(r,n)})}catch(n){we.nextTick(r,n)}}function ip(t){t.emit(Wi)}function ol(t){return t?.setHeader&&typeof t.abort=="function"}function cl(t){t.emit("close")}function sp(t,e){t.emit("error",e),we.nextTick(cl,t)}function op(t,e){!t||Jh(t)||(!e&&!Yh(t)&&(e=new Kh),Zh(t)?(t.socket=null,t.destroy(e)):ol(t)?t.abort():ol(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?we.nextTick(sp,t,e):we.nextTick(cl,t),t.destroyed||(t[Qh]=!0))}dl.exports={construct:rp,destroyer:op,destroy:Xh,undestroy:tp,errorOrDestroy:Gi}});var wn=v((Dg,pl)=>{"use strict";var{ArrayIsArray:ap,ObjectSetPrototypeOf:hl}=B(),{EventEmitter:mn}=Rr();function gn(t){mn.call(this,t)}hl(gn.prototype,mn.prototype);hl(gn,mn);gn.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(),mn.listenerCount(this,"error")===0&&this.emit("error",f)}Hi(r,"error",l),Hi(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 Hi(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):ap(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}pl.exports={Stream:gn,prependListener:Hi}});var Ir=v((Ug,xn)=>{"use strict";var{SymbolDispose:lp}=B(),{AbortError:_l,codes:up}=Q(),{isNodeStream:yl,isWebStream:fp,kControllerErrorFunction:cp}=ge(),dp=Be(),{ERR_INVALID_ARG_TYPE:bl}=up,Vi,hp=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new bl(e,"AbortSignal",t)};xn.exports.addAbortSignal=function(e,r){if(hp(e,"signal"),!yl(r)&&!fp(r))throw new bl("stream",["ReadableStream","WritableStream","Stream"],r);return xn.exports.addAbortSignalNoValidate(e,r)};xn.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=yl(e)?()=>{e.destroy(new _l(void 0,{cause:t.reason}))}:()=>{e[cp](new _l(void 0,{cause:t.reason}))};if(t.aborted)r();else{Vi=Vi||Y().addAbortListener;let n=Vi(t,r);dp(e,n[lp])}return e}});var wl=v((qg,gl)=>{"use strict";var{StringPrototypeSlice:ml,SymbolIterator:pp,TypedArrayPrototypeSet:Sn,Uint8Array:_p}=B(),{Buffer:Ki}=pe(),{inspect:yp}=Y();gl.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 Ki.alloc(0);let r=Ki.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)Sn(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}*[pp](){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+=ml(s,0,e),this.head=n,n.data=ml(s,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Ki.allocUnsafe(e),n=e,i=this.head,s=0;do{let o=i.data;if(e>o.length)Sn(r,o,n-e),e-=o.length;else{e===o.length?(Sn(r,o,n-e),++s,i.next?this.head=i.next:this.head=this.tail=null):(Sn(r,new _p(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 yp(this,{...r,depth:0,customInspect:!1})}}});var Ar=v((Wg,Rl)=>{"use strict";var{MathFloor:bp,NumberIsInteger:mp}=B(),{validateInteger:gp}=Vt(),{ERR_INVALID_ARG_VALUE:wp}=Q().codes,xl=16*1024,Sl=16;function xp(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function El(t){return t?Sl:xl}function Sp(t,e){gp(e,"value",0),t?Sl=e:xl=e}function Ep(t,e,r,n){let i=xp(e,n,r);if(i!=null){if(!mp(i)||i<0){let s=n?`options.${r}`:"options.highWaterMark";throw new wp(s,i)}return bp(i)}return El(t.objectMode)}Rl.exports={getHighWaterMark:Ep,getDefaultHighWaterMark:El,setDefaultHighWaterMark:Sp}});var Tl=v((Qi,Al)=>{var En=pe(),xe=En.Buffer;function Il(t,e){for(var r in t)e[r]=t[r]}xe.from&&xe.alloc&&xe.allocUnsafe&&xe.allocUnsafeSlow?Al.exports=En:(Il(En,Qi),Qi.Buffer=Et);function Et(t,e,r){return xe(t,e,r)}Et.prototype=Object.create(xe.prototype);Il(xe,Et);Et.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return xe(t,e,r)};Et.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};Et.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return xe(t)};Et.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return En.SlowBuffer(t)}});var jl=v(kl=>{"use strict";var Yi=Tl().Buffer,vl=Yi.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 Ip(t){var e=Rp(t);if(typeof e!="string"&&(Yi.isEncoding===vl||!vl(t)))throw new Error("Unknown encoding: "+t);return e||t}kl.StringDecoder=Tr;function Tr(t){this.encoding=Ip(t);var e;switch(this.encoding){case"utf16le":this.text=Np,this.end=Pp,e=4;break;case"utf8":this.fillLast=vp,e=4;break;case"base64":this.text=Op,this.end=Lp,e=3;break;default:this.write=Bp,this.end=Cp;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Yi.allocUnsafe(e)}Tr.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||""};Tr.prototype.end=jp;Tr.prototype.text=kp;Tr.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 Ji(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function Ap(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Ji(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Ji(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Ji(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function Tp(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 vp(t){var e=this.lastTotal-this.lastNeed,r=Tp(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 kp(t,e){var r=Ap(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 jp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function Np(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 Pp(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 Op(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 Lp(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function Bp(t){return t.toString(this.encoding)}function Cp(t){return t&&t.length?this.write(t):""}});var Zi=v((Gg,Ll)=>{"use strict";var Nl=Je(),{PromisePrototypeThen:Fp,SymbolAsyncIterator:Pl,SymbolIterator:Ol}=B(),{Buffer:Mp}=pe(),{ERR_INVALID_ARG_TYPE:Dp,ERR_STREAM_NULL_VALUES:Up}=Q().codes;function $p(t,e,r){let n;if(typeof e=="string"||e instanceof Mp)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[Pl])i=!0,n=e[Pl]();else if(e&&e[Ol])i=!1,n=e[Ol]();else throw new Dp("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){Fp(a(u),()=>Nl.nextTick(f,u),c=>Nl.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 Up;if(s.push(c))continue;o=!1}}catch(u){s.destroy(u)}break}}return s}Ll.exports=$p});var kr=v((Hg,Zl)=>{"use strict";var le=Je(),{ArrayPrototypeIndexOf:qp,NumberIsInteger:Wp,NumberIsNaN:zp,NumberParseInt:Gp,ObjectDefineProperties:os,ObjectKeys:Hp,ObjectSetPrototypeOf:Fl,Promise:Ml,SafeSet:Vp,SymbolAsyncDispose:Kp,SymbolAsyncIterator:Qp,Symbol:Jp}=B();Zl.exports=I;I.ReadableState=Tn;var{EventEmitter:Yp}=Rr(),{Stream:Ze,prependListener:Zp}=wn(),{Buffer:Xi}=pe(),{addAbortSignal:Xp}=Ir(),Dl=Be(),A=Y().debuglog("stream",t=>{A=t}),e_=wl(),Zt=St(),{getHighWaterMark:t_,getDefaultHighWaterMark:r_}=Ar(),{aggregateTwoErrors:Bl,codes:{ERR_INVALID_ARG_TYPE:n_,ERR_METHOD_NOT_IMPLEMENTED:i_,ERR_OUT_OF_RANGE:s_,ERR_STREAM_PUSH_AFTER_EOF:o_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:a_},AbortError:l_}=Q(),{validateObject:u_}=Vt(),Rt=Jp("kPaused"),{StringDecoder:Ul}=jl(),f_=Zi();Fl(I.prototype,Ze.prototype);Fl(I,Ze);var es=()=>{},{errorOrDestroy:Jt}=Zt,Yt=1,c_=2,$l=4,vr=8,ql=16,Rn=32,In=64,Wl=128,d_=256,h_=512,p_=1024,is=2048,ss=4096,__=8192,y_=16384,b_=32768,zl=65536,m_=1<<17,g_=1<<18;function q(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}os(Tn.prototype,{objectMode:q(Yt),ended:q(c_),endEmitted:q($l),reading:q(vr),constructed:q(ql),sync:q(Rn),needReadable:q(In),emittedReadable:q(Wl),readableListening:q(d_),resumeScheduled:q(h_),errorEmitted:q(p_),emitClose:q(is),autoDestroy:q(ss),destroyed:q(__),closed:q(y_),closeEmitted:q(b_),multiAwaitDrain:q(zl),readingMore:q(m_),dataEmitted:q(g_)});function Tn(t,e,r){typeof r!="boolean"&&(r=e instanceof Se()),this.state=is|ss|ql|Rn,t&&t.objectMode&&(this.state|=Yt),r&&t&&t.readableObjectMode&&(this.state|=Yt),this.highWaterMark=t?t_(this,t,"readableHighWaterMark",r):r_(!1),this.buffer=new e_,this.length=0,this.pipes=[],this.flowing=null,this[Rt]=null,t&&t.emitClose===!1&&(this.state&=~is),t&&t.autoDestroy===!1&&(this.state&=~ss),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Ul(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 Tn(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&&Xp(t.signal,this)),Ze.call(this,t),Zt.construct(this,()=>{this._readableState.needReadable&&An(this,this._readableState)})}I.prototype.destroy=Zt.destroy;I.prototype._undestroy=Zt.undestroy;I.prototype._destroy=function(t,e){e(t)};I.prototype[Yp.captureRejectionSymbol]=function(t){this.destroy(t)};I.prototype[Kp]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new l_,this.destroy(t)),new Ml((e,r)=>Dl(this,n=>n&&n!==t?r(n):e(null)))};I.prototype.push=function(t,e){return Gl(this,t,e,!1)};I.prototype.unshift=function(t,e){return Gl(this,t,e,!0)};function Gl(t,e,r,n){A("readableAddChunk",e);let i=t._readableState,s;if((i.state&Yt)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Xi.from(e,r).toString(i.encoding):(e=Xi.from(e,r),r=""))):e instanceof Xi?r="":Ze._isUint8Array(e)?(e=Ze._uint8ArrayToBuffer(e),r=""):e!=null&&(s=new n_("chunk",["string","Buffer","Uint8Array"],e))),s)Jt(t,s);else if(e===null)i.state&=~vr,S_(t,i);else if((i.state&Yt)!==0||e&&e.length>0)if(n)if((i.state&$l)!==0)Jt(t,new a_);else{if(i.destroyed||i.errored)return!1;ts(t,i,e,!0)}else if(i.ended)Jt(t,new o_);else{if(i.destroyed||i.errored)return!1;i.state&=~vr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?ts(t,i,e,!1):An(t,i)):ts(t,i,e,!1)}else n||(i.state&=~vr,An(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function ts(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&zl)!==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&In)!==0&&vn(t)),An(t,e)}I.prototype.isPaused=function(){let t=this._readableState;return t[Rt]===!0||t.flowing===!1};I.prototype.setEncoding=function(t){let e=new Ul(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 w_=1073741824;function x_(t){if(t>w_)throw new s_("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Cl(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Yt)!==0?1:zp(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:Wp(t)||(t=Gp(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=x_(t)),t!==0&&(e.state&=~Wl),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?rs(this):vn(this),null;if(t=Cl(t,e),t===0&&e.ended)return e.length===0&&rs(this),null;let n=(e.state&In)!==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|=vr|Rn,e.length===0&&(e.state|=In);try{this._read(e.highWaterMark)}catch(s){Jt(this,s)}e.state&=~Rn,e.reading||(t=Cl(r,e))}let i;return t>0?i=Jl(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&&rs(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function S_(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?vn(t):(e.needReadable=!1,e.emittedReadable=!0,Hl(t))}}function vn(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(Hl,t))}function Hl(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,Kl(t)}function An(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,le.nextTick(E_,t,e))}function E_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(A("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}I.prototype._read=function(t){throw new i_("_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 Vp(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=R_(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?Jt(t,b):t.emit("error",b)}}Zp(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 R_(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=qp(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=Ze.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?vn(this):n.reading||le.nextTick(I_,this)),r};I.prototype.addListener=I.prototype.on;I.prototype.removeListener=function(t,e){let r=Ze.prototype.removeListener.call(this,t,e);return t==="readable"&&le.nextTick(Vl,this),r};I.prototype.off=I.prototype.removeListener;I.prototype.removeAllListeners=function(t){let e=Ze.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&le.nextTick(Vl,this),e};function Vl(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Rt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function I_(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,A_(this,t)),t[Rt]=!1,this};function A_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,le.nextTick(T_,t,e))}function T_(t,e){A("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Kl(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[Rt]=!0,this};function Kl(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=>{Jt(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=Hp(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[Qp]=function(){return Ql(this)};I.prototype.iterator=function(t){return t!==void 0&&u_(t,"options"),Ql(this,t)};function Ql(t,e){typeof t.read!="function"&&(t=I.wrap(t,{objectMode:!0}));let r=v_(t,e);return r.stream=t,r}async function*v_(t,e){let r=es;function n(o){this===t?(r(),r=es):r=o}t.on("readable",n);let i,s=Dl(t,{writable:!1},o=>{i=o?Bl(i,o):null,r(),r=es});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 Ml(n)}}}catch(o){throw i=Bl(i,o),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Zt.destroyer(t,null):(t.off("readable",n),s())}}os(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}}});os(Tn.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Rt]!==!1},set(t){this[Rt]=!!t}}});I._fromList=Jl;function Jl(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 rs(t){let e=t._readableState;A("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,le.nextTick(k_,e,t))}function k_(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(j_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function j_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}I.from=function(t,e){return f_(I,t,e)};var ns;function Yl(){return ns===void 0&&(ns={}),ns}I.fromWeb=function(t,e){return Yl().newStreamReadableFromReadableStream(t,e)};I.toWeb=function(t,e){return Yl().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){Zt.destroyer(t,i),s(i)}}).wrap(t)}});var On=v((Vg,fu)=>{"use strict";var It=Je(),{ArrayPrototypeSlice:tu,Error:N_,FunctionPrototypeSymbolHasInstance:ru,ObjectDefineProperty:nu,ObjectDefineProperties:P_,ObjectSetPrototypeOf:iu,StringPrototypeToLowerCase:O_,Symbol:L_,SymbolHasInstance:B_}=B();fu.exports=C;C.WritableState=Pr;var{EventEmitter:C_}=Rr(),jr=wn().Stream,{Buffer:kn}=pe(),Pn=St(),{addAbortSignal:F_}=Ir(),{getHighWaterMark:M_,getDefaultHighWaterMark:D_}=Ar(),{ERR_INVALID_ARG_TYPE:U_,ERR_METHOD_NOT_IMPLEMENTED:$_,ERR_MULTIPLE_CALLBACK:su,ERR_STREAM_CANNOT_PIPE:q_,ERR_STREAM_DESTROYED:Nr,ERR_STREAM_ALREADY_FINISHED:W_,ERR_STREAM_NULL_VALUES:z_,ERR_STREAM_WRITE_AFTER_END:G_,ERR_UNKNOWN_ENCODING:ou}=Q().codes,{errorOrDestroy:Xt}=Pn;iu(C.prototype,jr.prototype);iu(C,jr);function us(){}var er=L_("kOnFinished");function Pr(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?M_(this,t,"writableHighWaterMark",r):D_(!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=V_.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Nn(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[er]=[]}function Nn(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Pr.prototype.getBuffer=function(){return tu(this.buffered,this.bufferedIndex)};nu(Pr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function C(t){let e=this instanceof Se();if(!e&&!ru(C,this))return new C(t);this._writableState=new Pr(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&&F_(t.signal,this)),jr.call(this,t),Pn.construct(this,()=>{let r=this._writableState;r.writing||cs(this,r),ds(this,r)})}nu(C,B_,{__proto__:null,value:function(t){return ru(this,t)?!0:this!==C?!1:t&&t._writableState instanceof Pr}});C.prototype.pipe=function(){Xt(this,new q_)};function au(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"&&!kn.isEncoding(r))throw new ou(r);typeof n!="function"&&(n=us)}if(e===null)throw new z_;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=kn.from(e,r),r="buffer");else if(e instanceof kn)r="buffer";else if(jr._isUint8Array(e))e=jr._uint8ArrayToBuffer(e),r="buffer";else throw new U_("chunk",["string","Buffer","Uint8Array"],e);let s;return i.ending?s=new G_:i.destroyed&&(s=new Nr("write")),s?(It.nextTick(n,s),Xt(t,s,!0),s):(i.pendingcb++,H_(t,i,e,r,n))}C.prototype.write=function(t,e,r){return au(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||cs(this,t))};C.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=O_(e)),!kn.isEncoding(e))throw new ou(e);return this._writableState.defaultEncoding=e,this};function H_(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!==us&&(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 Xl(t,e,r,n,i,s,o){e.writelen=n,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Nr("write")):r?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function eu(t,e,r,n){--e.pendingcb,n(r),fs(e),Xt(t,r)}function V_(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Xt(t,new su);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?It.nextTick(eu,t,r,e,i):eu(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&cs(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},It.nextTick(K_,r.afterWriteTickInfo)):lu(t,r,1,i))}function K_({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,lu(t,e,r,n)}function lu(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&&fs(e),ds(t,e)}function fs(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 Nr("write"))}let r=t[er].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Nr("end"))}Nn(t)}function cs(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?us:u=>{for(let f=o;f<r.length;++f)r[f].callback(u)},l=e.allNoop&&o===0?r:tu(r,o);l.allBuffers=e.allBuffers,Xl(t,e,!0,e.length,l,"",a),Nn(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[o];r[o++]=null;let f=i?1:a.length;Xl(t,e,!1,f,a,l,u)}while(o<r.length&&!e.writing);o===r.length?Nn(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 $_("_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=au(this,t,e);s instanceof N_&&(i=s)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,ds(this,n,!0),n.ended=!0):n.finished?i=new W_("end"):n.destroyed&&(i=new Nr("end"))),typeof r=="function"&&(i||n.finished?It.nextTick(r,i):n[er].push(r)),this};function jn(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 Q_(t,e){let r=!1;function n(i){if(r){Xt(t,i??su());return}if(r=!0,e.pendingcb--,i){let s=e[er].splice(0);for(let o=0;o<s.length;o++)s[o](i);Xt(t,i,e.sync)}else jn(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,It.nextTick(ls,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function J_(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Q_(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function ds(t,e,r){jn(e)&&(J_(t,e),e.pendingcb===0&&(r?(e.pendingcb++,It.nextTick((n,i)=>{jn(i)?ls(n,i):i.pendingcb--},t,e)):jn(e)&&(e.pendingcb++,ls(t,e))))}function ls(t,e){e.pendingcb--,e.finished=!0;let r=e[er].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()}}P_(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 Y_=Pn.destroy;C.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[er].length)&&It.nextTick(fs,r),Y_.call(this,t,e),this};C.prototype._undestroy=Pn.undestroy;C.prototype._destroy=function(t,e){e(t)};C.prototype[C_.captureRejectionSymbol]=function(t){this.destroy(t)};var as;function uu(){return as===void 0&&(as={}),as}C.fromWeb=function(t,e){return uu().newStreamWritableFromWritableStream(t,e)};C.toWeb=function(t){return uu().newWritableStreamFromStreamWritable(t)}});var Iu=v((Kg,Ru)=>{var hs=Je(),Z_=pe(),{isReadable:X_,isWritable:ey,isIterable:cu,isNodeStream:ty,isReadableNodeStream:du,isWritableNodeStream:hu,isDuplexNodeStream:ry,isReadableStream:pu,isWritableStream:_u}=ge(),yu=Be(),{AbortError:Su,codes:{ERR_INVALID_ARG_TYPE:ny,ERR_INVALID_RETURN_VALUE:bu}}=Q(),{destroyer:rr}=St(),iy=Se(),Eu=kr(),sy=On(),{createDeferredPromise:mu}=Y(),gu=Zi(),wu=globalThis.Blob||Z_.Blob,oy=typeof wu<"u"?function(e){return e instanceof wu}:function(e){return!1},ay=globalThis.AbortController||zt().AbortController,{FunctionPrototypeCall:xu}=B(),Xe=class extends iy{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};Ru.exports=function t(e,r){if(ry(e))return e;if(du(e))return tr({readable:e});if(hu(e))return tr({writable:e});if(ty(e))return tr({writable:!1,readable:!1});if(pu(e))return tr({readable:Eu.fromWeb(e)});if(_u(e))return tr({writable:sy.fromWeb(e)});if(typeof e=="function"){let{value:i,write:s,final:o,destroy:a}=ly(e);if(cu(i))return gu(Xe,i,{objectMode:!0,write:s,final:o,destroy:a});let l=i?.then;if(typeof l=="function"){let u,f=xu(l,i,c=>{if(c!=null)throw new bu("nully","body",c)},c=>{rr(u,c)});return u=new Xe({objectMode:!0,readable:!1,write:s,final(c){o(async()=>{try{await f,hs.nextTick(c,null)}catch(d){hs.nextTick(c,d)}})},destroy:a})}throw new bu("Iterable, AsyncIterable or AsyncFunction",r,i)}if(oy(e))return t(e.arrayBuffer());if(cu(e))return gu(Xe,e,{objectMode:!0,writable:!1});if(pu(e?.readable)&&_u(e?.writable))return Xe.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?du(e?.readable)?e?.readable:t(e.readable):void 0,s=e!=null&&e.writable?hu(e?.writable)?e?.writable:t(e.writable):void 0;return tr({readable:i,writable:s})}let n=e?.then;if(typeof n=="function"){let i;return xu(n,e,s=>{s!=null&&i.push(s),i.push(null)},s=>{rr(i,s)}),i=new Xe({objectMode:!0,writable:!1,read(){}})}throw new ny(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function ly(t){let{promise:e,resolve:r}=mu(),n=new ay,i=n.signal;return{value:t(async function*(){for(;;){let o=e;e=null;let{chunk:a,done:l,cb:u}=await o;if(hs.nextTick(u),l)return;if(i.aborted)throw new Su(void 0,{cause:i.reason});({promise:e,resolve:r}=mu()),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 tr(t){let e=t.readable&&typeof t.readable.read!="function"?Eu.wrap(t.readable):t.readable,r=t.writable,n=!!X_(e),i=!!ey(r),s,o,a,l,u;function f(c){let d=l;l=null,d?d(c):c&&u.destroy(c)}return u=new Xe({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(yu(r,c=>{i=!1,c&&rr(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&&(yu(e,c=>{n=!1,c&&rr(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 Su),a=null,s=null,o=null,l===null?d(c):(l=d,rr(r,c),rr(e,c))},u}});var Se=v((Qg,vu)=>{"use strict";var{ObjectDefineProperties:uy,ObjectGetOwnPropertyDescriptor:Ce,ObjectKeys:fy,ObjectSetPrototypeOf:Au}=B();vu.exports=ue;var ys=kr(),se=On();Au(ue.prototype,ys.prototype);Au(ue,ys);{let t=fy(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);ys.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}uy(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 ps;function Tu(){return ps===void 0&&(ps={}),ps}ue.fromWeb=function(t,e){return Tu().newStreamDuplexFromReadableWritablePair(t,e)};ue.toWeb=function(t){return Tu().newReadableWritablePairFromDuplex(t)};var _s;ue.from=function(t){return _s||(_s=Iu()),_s(t,"body")}});var gs=v((Jg,ju)=>{"use strict";var{ObjectSetPrototypeOf:ku,Symbol:cy}=B();ju.exports=Fe;var{ERR_METHOD_NOT_IMPLEMENTED:dy}=Q().codes,ms=Se(),{getHighWaterMark:hy}=Ar();ku(Fe.prototype,ms.prototype);ku(Fe,ms);var Or=cy("kCallback");function Fe(t){if(!(this instanceof Fe))return new Fe(t);let e=t?hy(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ms.call(this,t),this._readableState.sync=!1,this[Or]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",py)}function bs(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 py(){this._final!==bs&&bs.call(this)}Fe.prototype._final=bs;Fe.prototype._transform=function(t,e,r){throw new dy("_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[Or]=r})};Fe.prototype._read=function(){if(this[Or]){let t=this[Or];this[Or]=null,t()}}});var xs=v((Yg,Pu)=>{"use strict";var{ObjectSetPrototypeOf:Nu}=B();Pu.exports=nr;var ws=gs();Nu(nr.prototype,ws.prototype);Nu(nr,ws);function nr(t){if(!(this instanceof nr))return new nr(t);ws.call(this,t)}nr.prototype._transform=function(t,e,r){r(null,t)}});var Fn=v((Zg,Fu)=>{var Lr=Je(),{ArrayIsArray:_y,Promise:yy,SymbolAsyncIterator:by,SymbolDispose:my}=B(),Cn=Be(),{once:gy}=Y(),wy=St(),Ou=Se(),{aggregateTwoErrors:xy,codes:{ERR_INVALID_ARG_TYPE:js,ERR_INVALID_RETURN_VALUE:Ss,ERR_MISSING_ARGS:Sy,ERR_STREAM_DESTROYED:Ey,ERR_STREAM_PREMATURE_CLOSE:Ry},AbortError:Iy}=Q(),{validateFunction:Ay,validateAbortSignal:Ty}=Vt(),{isIterable:At,isReadable:Es,isReadableNodeStream:Bn,isNodeStream:Lu,isTransformStream:ir,isWebStream:vy,isReadableStream:Rs,isReadableFinished:ky}=ge(),jy=globalThis.AbortController||zt().AbortController,Is,As,Ts;function Bu(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=Cn(t,{readable:e,writable:r},s=>{n=!s});return{destroy:s=>{n||(n=!0,wy.destroyer(t,s||new Ey("pipe")))},cleanup:i}}function Ny(t){return Ay(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function vs(t){if(At(t))return t;if(Bn(t))return Py(t);throw new js("val",["Readable","Iterable","AsyncIterable"],t)}async function*Py(t){As||(As=kr()),yield*As.prototype[by].call(t)}async function Ln(t,e,r,{end:n}){let i,s=null,o=u=>{if(u&&(i=u),s){let f=s;s=null,f()}},a=()=>new yy((u,f)=>{i?f(i):s=()=>{i?f(i):u()}});e.on("drain",o);let l=Cn(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?xy(i,u):u)}finally{l(),e.off("drain",o)}}async function ks(t,e,r,{end:n}){ir(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 Oy(...t){return Cu(t,gy(Ny(t)))}function Cu(t,e,r){if(t.length===1&&_y(t[0])&&(t=t[0]),t.length<2)throw new Sy("streams");let n=new jy,i=n.signal,s=r?.signal,o=[];Ty(s,"options.signal");function a(){y(new Iy)}Ts=Ts||Y().addAbortListener;let l;s&&(l=Ts(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[my](),n.abort(),w&&(u||o.forEach(Ae=>Ae()),Lr.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,jt=S===t.length-1;if(Lu(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:Kn}=Bu(w,T,Ae);c.push(Te),Es(w)&&jt&&o.push(Kn)}w.on("error",Z),Es(w)&&jt&&o.push(()=>{w.removeListener("error",Z)})}if(S===0)if(typeof w=="function"){if(_=w({signal:i}),!At(_))throw new Ss("Iterable, AsyncIterable or Stream","source",_)}else At(w)||Bn(w)||ir(w)?_=w:_=Ou.from(w);else if(typeof w=="function"){if(ir(_)){var x;_=vs((x=_)===null||x===void 0?void 0:x.readable)}else _=vs(_);if(_=w(_,{signal:i}),T){if(!At(_,!0))throw new Ss("AsyncIterable",`transform[${S-1}]`,_)}else{var b;Is||(Is=xs());let Z=new Is({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(),Lr.nextTick(h)},Ue=>{Z.destroy(Ue),Lr.nextTick(h,Ue)});else if(At(_,!0))d++,Ln(_,Z,h,{end:U});else if(Rs(_)||ir(_)){let Ue=_.readable||_;d++,Ln(Ue,Z,h,{end:U})}else throw new Ss("AsyncIterable or Promise","destination",_);_=Z;let{destroy:Kn,cleanup:Rf}=Bu(_,!1,!0);c.push(Kn),jt&&o.push(Rf)}}else if(Lu(w)){if(Bn(_)){d+=2;let Z=Ly(_,w,h,{end:U});Es(w)&&jt&&o.push(Z)}else if(ir(_)||Rs(_)){let Z=_.readable||_;d++,Ln(Z,w,h,{end:U})}else if(At(_))d++,Ln(_,w,h,{end:U});else throw new js("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else if(vy(w)){if(Bn(_))d++,ks(vs(_),w,h,{end:U});else if(Rs(_)||At(_))d++,ks(_,w,h,{end:U});else if(ir(_))d++,ks(_.readable,w,h,{end:U});else throw new js("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],_);_=w}else _=Ou.from(w)}return(i!=null&&i.aborted||s!=null&&s.aborted)&&Lr.nextTick(a),_}function Ly(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;ky(t)?Lr.nextTick(o):t.once("end",o)}else r();return Cn(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)}),Cn(e,{readable:!1,writable:!0},r)}Fu.exports={pipelineImpl:Cu,pipeline:Oy}});var Ps=v((Xg,Wu)=>{"use strict";var{pipeline:By}=Fn(),Mn=Se(),{destroyer:Cy}=St(),{isNodeStream:Dn,isReadable:Mu,isWritable:Du,isWebStream:Ns,isTransformStream:Tt,isWritableStream:Uu,isReadableStream:$u}=ge(),{AbortError:Fy,codes:{ERR_INVALID_ARG_VALUE:qu,ERR_MISSING_ARGS:My}}=Q(),Dy=Be();Wu.exports=function(...e){if(e.length===0)throw new My("streams");if(e.length===1)return Mn.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Mn.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=Mn.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Dn(e[h])&&!Ns(e[h]))){if(h<e.length-1&&!(Mu(e[h])||$u(e[h])||Tt(e[h])))throw new qu(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Du(e[h])||Uu(e[h])||Tt(e[h])))throw new qu(`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=By(e,l),c=!!(Du(u)||Uu(u)||Tt(u)),d=!!(Mu(f)||$u(f)||Tt(f));if(a=new Mn({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:c,readable:d}),c){if(Dn(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(Ns(u)){let _=(Tt(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=Tt(f)?f.readable:f;Dy(h,()=>{if(i){let y=i;i=null,y()}})}if(d){if(Dn(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(Ns(f)){let y=(Tt(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 Fy),s=null,n=null,i=null,o===null?y(h):(o=y,Dn(f)&&Cy(f,h))},a}});var Xu=v((ew,Bs)=>{"use strict";var Uy=globalThis.AbortController||zt().AbortController,{codes:{ERR_INVALID_ARG_VALUE:$y,ERR_INVALID_ARG_TYPE:Br,ERR_MISSING_ARGS:qy,ERR_OUT_OF_RANGE:Wy},AbortError:Ee}=Q(),{validateAbortSignal:vt,validateInteger:zu,validateObject:kt}=Vt(),zy=B().Symbol("kWeak"),Gy=B().Symbol("kResistStopPropagation"),{finished:Hy}=Be(),Vy=Ps(),{addAbortSignalNoValidate:Ky}=Ir(),{isWritable:Qy,isNodeStream:Jy}=ge(),{deprecate:Yy}=Y(),{ArrayPrototypePush:Zy,Boolean:Xy,MathFloor:Gu,Number:eb,NumberIsNaN:tb,Promise:Hu,PromiseReject:Vu,PromiseResolve:rb,PromisePrototypeThen:Ku,Symbol:Ju}=B(),Un=Ju("kEmpty"),Qu=Ju("kEof");function nb(t,e){if(e!=null&&kt(e,"options"),e?.signal!=null&&vt(e.signal,"options.signal"),Jy(t)&&!Qy(t))throw new $y("stream",t,"must be writable");let r=Vy(this,t);return e!=null&&e.signal&&Ky(e.signal,r),r}function $n(t,e){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);e!=null&&kt(e,"options"),e?.signal!=null&&vt(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Gu(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Gu(e.highWaterMark)),zu(r,"options.concurrency",1),zu(n,"options.highWaterMark",0),n+=r,async function*(){let s=Y().AbortSignalAny([e?.signal].filter(Xy)),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===Un)continue;b=rb(b)}catch(g){b=Vu(g)}d+=1,Ku(b,y,h),a.push(b),u&&(u(),u=null),!c&&(a.length>=n||d>=r)&&await new Hu(g=>{f=g})}a.push(Qu)}catch(b){let g=Vu(b);Ku(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===Qu)return;if(s.aborted)throw new Ee;b!==Un&&(yield b),a.shift(),_()}await new Hu(b=>{u=b})}}finally{c=!0,f&&(f(),f=null)}}.call(this)}function ib(t=void 0){return t!=null&&kt(t,"options"),t?.signal!=null&&vt(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 Yu(t,e=void 0){for await(let r of Ls.call(this,t,e))return!0;return!1}async function sb(t,e=void 0){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);return!await Yu.call(this,async(...r)=>!await t(...r),e)}async function ob(t,e){for await(let r of Ls.call(this,t,e))return r}async function ab(t,e){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),Un}for await(let n of $n.call(this,r,e));}function Ls(t,e){if(typeof t!="function")throw new Br("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:Un}return $n.call(this,r,e)}var Os=class extends qy{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function lb(t,e,r){var n;if(typeof t!="function")throw new Br("reducer",["Function","AsyncFunction"],t);r!=null&&kt(r,"options"),r?.signal!=null&&vt(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 Hy(this.destroy(u)),u}let s=new Uy,o=s.signal;if(r!=null&&r.signal){let u={once:!0,[zy]:this,[Gy]:!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 Os}finally{s.abort()}return e}async function ub(t){t!=null&&kt(t,"options"),t?.signal!=null&&vt(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});Zy(e,n)}return e}function fb(t,e){let r=$n.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function Zu(t){if(t=eb(t),tb(t))return 0;if(t<0)throw new Wy("number",">= 0",t);return t}function cb(t,e=void 0){return e!=null&&kt(e,"options"),e?.signal!=null&&vt(e.signal,"options.signal"),t=Zu(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 db(t,e=void 0){return e!=null&&kt(e,"options"),e?.signal!=null&&vt(e.signal,"options.signal"),t=Zu(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)}Bs.exports.streamReturningOperators={asIndexedPairs:Yy(ib,"readable.asIndexedPairs will be removed in a future version."),drop:cb,filter:Ls,flatMap:fb,map:$n,take:db,compose:nb};Bs.exports.promiseReturningOperators={every:sb,forEach:ab,reduce:lb,toArray:ub,some:Yu,find:ob}});var Cs=v((tw,ef)=>{"use strict";var{ArrayPrototypePop:hb,Promise:pb}=B(),{isIterable:_b,isNodeStream:yb,isWebStream:bb}=ge(),{pipelineImpl:mb}=Fn(),{finished:gb}=Be();Fs();function wb(...t){return new pb((e,r)=>{let n,i,s=t[t.length-1];if(s&&typeof s=="object"&&!yb(s)&&!_b(s)&&!bb(s)){let o=hb(t);n=o.signal,i=o.end}mb(t,(o,a)=>{o?r(o):e(a)},{signal:n,end:i})})}ef.exports={finished:gb,pipeline:wb}});var Fs=v((rw,ff)=>{"use strict";var{Buffer:xb}=pe(),{ObjectDefineProperty:Me,ObjectKeys:nf,ReflectApply:sf}=B(),{promisify:{custom:of}}=Y(),{streamReturningOperators:tf,promiseReturningOperators:rf}=Xu(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:af}}=Q(),Sb=Ps(),{setDefaultHighWaterMark:Eb,getDefaultHighWaterMark:Rb}=Ar(),{pipeline:lf}=Fn(),{destroyer:Ib}=St(),uf=Be(),Ms=Cs(),Cr=ge(),L=ff.exports=wn().Stream;L.isDestroyed=Cr.isDestroyed;L.isDisturbed=Cr.isDisturbed;L.isErrored=Cr.isErrored;L.isReadable=Cr.isReadable;L.isWritable=Cr.isWritable;L.Readable=kr();for(let t of nf(tf)){let r=function(...n){if(new.target)throw af();return L.Readable.from(sf(e,this,n))},e=tf[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 nf(rf)){let r=function(...n){if(new.target)throw af();return sf(e,this,n)},e=rf[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=On();L.Duplex=Se();L.Transform=gs();L.PassThrough=xs();L.pipeline=lf;var{addAbortSignal:Ab}=Ir();L.addAbortSignal=Ab;L.finished=uf;L.destroy=Ib;L.compose=Sb;L.setDefaultHighWaterMark=Eb;L.getDefaultHighWaterMark=Rb;Me(L,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Ms}});Me(lf,of,{__proto__:null,enumerable:!0,get(){return Ms.pipeline}});Me(uf,of,{__proto__:null,enumerable:!0,get(){return Ms.finished}});L.Stream=L;L._isUint8Array=function(e){return e instanceof Uint8Array};L._uint8ArrayToBuffer=function(e){return xb.from(e.buffer,e.byteOffset,e.byteLength)}});var qn=v((nw,M)=>{"use strict";var W=Fs(),Tb=Cs(),vb=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=vb;M.exports.pipeline=W.pipeline;M.exports.compose=W.compose;Object.defineProperty(W,"promises",{configurable:!0,enumerable:!0,get(){return Tb}});M.exports.Stream=W.Stream;M.exports.default=M.exports});var E=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 ar=class t{#e;#t="/";constructor(e){this.#e=e,this.#t=this.#e.path}get path(){return this.#t}cd(e){return e instanceof E||(e=new E(E.collapse(e,this.#t))),new t(this.#e.cd(e))}async read(e,r=null){if(e instanceof E||(e=new E(E.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 E||(e=new E(E.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 remove(e){return e instanceof E||(e=new E(E.collapse(e,this.#t))),this.#e.remove(e)}async exists(e){return e instanceof E||(e=new E(E.collapse(e,this.#t))),this.#e.exists(e)}async list(e=""){return e instanceof E||(e=new E(E.collapse(e,this.#t))),this.#e.list(e)}async mkdir(e=""){if(!this.#e.supportsWrite())throw new Error("Adapter "+this.#e.name+" is read only.");if(!this.#e.supportsDirectories)throw new Error("Adapter "+this.#e.name+" does not support directories.");return e instanceof E||(e=new E(E.collapse(e,this.#t))),this.#e.mkdir(e)}async rmdir(e=""){if(!this.#e.supportsWrite())throw new Error("Adapter "+this.#e.name+" is read only.");if(!this.#e.supportsDirectories)throw new Error("Adapter "+this.#e.name+" does not support directories.");return e instanceof E||(e=new E(E.collapse(e,this.#t))),this.#e.rmdir(e)}};var Pt={};nt(Pt,{Client:()=>oe,client:()=>re,deepClone:()=>$e,formdata:()=>Ks,metroError:()=>V,request:()=>st,response:()=>Nt,trace:()=>Pf,url:()=>z});var it="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(st(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 "+it+"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=st(e,r),!e.url)throw V("metro.client."+e.method.toLowerCase()+": Missing url parameter "+it+"client/fetch-missing-url/",e);if(r||(r={}),typeof r!="object"||r instanceof String)throw V("metro.client.fetch: Invalid options parameter "+it+"client/fetch-invalid-options/",r);let i=[async function(a){a[Symbol.metroProxy]&&(a=a[Symbol.metroSource]);let l=await fetch(a);return Nt(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 Nf(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 st(...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,Nf(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}),st(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 Hs(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 Nt(...t){let e={};for(let i of t)typeof i=="string"?e.body=i:i instanceof Response?Object.assign(e,Hs(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,Hs(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 Nt(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 Vs(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)Vs(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":Vs(r,n.searchParams);break;default:if(!e.includes(i))throw V("metro.url: unknown url parameter "+it+"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+" "+it+"url/unsupported-param-value/",t[i]);break}else throw V("metro.url: unsupported option value "+it+"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 Ks(...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 "+it+"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 Ks(r,...s)};break;default:r[n]instanceof Function?i=r[n].bind(r):i=r[n];break}return i}})}var lr={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 lr.error(t,...e),new Error(t,...e)}var Pf={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++,lr.group(t),lr.info(e?.url,e,r)},response:(e,r)=>{lr.info(e?.body?e.body[Symbol.metroSource]:null,e,r),lr.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 ot=class{#e;#t;constructor(e,r="/"){this.#e=re(e),this.#t=new E(r)}get name(){return"HttpAdapter"}get path(){return this.#t}supportsWrite(){return!0}supportsStreamingWrite(){return Of}supportsStreamingRead(){return!0}supportsDirectories(){return!1}cd(e){if(!E.isPath(e))throw new TypeError(e+" is not a valid path");return E.isRelative(e)&&(e=E.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:E.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 remove(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:E.filename(u.pathname),path:u.pathname,name:u.innerText,href:u.href}}).filter(u=>{let f=new URL(u.href);return f.pathname=E.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=E.collapse(r+E.collapse(e)),new URL(e,this.#e.clientOptions.url)}getMimetype(e){return e.headers.has("Content-Type")?e.headers.get("Content-Type"):null}},Of=(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 Lf={fs:ar,adapters:{https:ot},path:E};globalThis.jsfs=Lf;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||Cf(s))&&(r=r.with({headers:{"Content-Type":t.contentType}})),Qs(r.headers.get("Content-Type"))&&(r=r.with({body:JSON.stringify(r.data,t.replacer,t.space)}))}let i=await n(r);if(i&&Qs(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 Bf=/^application\/([a-zA-Z0-9\-_]+\+)?json\b/;function Qs(t){return Bf.exec(t)}function Cf(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 Ot(){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(),Ot()):super(e,ce(),Ot()),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]}},Jn=class extends Gr{constructor(e,r,n=null){e instanceof oe?super(e.with(fe()),r,n):super(re(e,fe()),r,n)}};function Js(...t){return new Gr(...$e(t))}function Ys(...t){return new Jn(...$e(t))}var Zs=Object.assign({},Pt,{mw:{json:fe,thrower:ce,getdata:Ot},api:Js,jsonApi:Ys});globalThis.metro||(globalThis.metro=Zs);var N=Zs;var Hr={};nt(Hr,{base64url_encode:()=>ti,createState:()=>ro,default:()=>Bt,generateCodeChallenge:()=>to,generateCodeVerifier:()=>eo,getExpires:()=>Xn,isAuthorized:()=>Uf,isExpired:()=>ei,isRedirected:()=>ri});globalThis.assertEnabled=!1;function Ff(){globalThis.assertEnabled=!0}function Mf(){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"?(Xs("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 Yn(...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 R(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 Zn(t,e,r){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t))return P("data is not a valid email",t,"validEmail",r)}function at(t){return function(r,n,i){if(!(r instanceof t))return P("data is not an instanceof pattern",r,t,i)}}function Lt(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 Xs(t,e,r,n){console.warn("\u{1F170}\uFE0F Assert: "+n,t,r,e)}globalThis.assert={warn:Xs,error:P,assert:D,enable:Ff,disable:Mf,Required:k,Recommended:qe,Optional:m,oneOf:$,anyOf:ve,allOf:Yn,validURL:R,validEmail:Zn,instanceOf:at,not:Lt,fails:G};function ur(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 Bt(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:eo(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=ur(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(R),token_endpoint:k(R),redirect_uri:k(R)}});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=ei(d);if(!d||y&&!h){try{if(!await o())return Nt("false")}catch(_){throw _}return i(f,c)}else if(y&&h){try{if(!await a())return Nt("false")}catch(_){throw _}return i(f,c)}else return f=st(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:Xn(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:Xn(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||ro(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 to(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 st(c,{method:"POST",body:new URLSearchParams(d)})}}function ei(t){if(!t)return!0;let e=new Date(t.expires);return new Date().getTime()>e.getTime()}function Xn(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 eo(t=64){let e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),ti(e)}async function to(t){let r=new TextEncoder().encode(t),n=await globalThis.crypto.subtle.digest("SHA-256",r);return ti(n)}function ti(t){let e=Array.from(new Uint8Array(t),r=>String.fromCharCode(r)).join("");return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function ro(t){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r="",n=0;for(;n<t;)r+=e.charAt(Math.floor(Math.random()*e.length)),n++;return r}function ri(){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 Uf(t){typeof t=="string"&&(t=ur(t).tokens);let e=t.get("access_token");return!!(e&&!ei(e)||t.get("refresh_token"))}var ni={};nt(ni,{default:()=>io});var Vr={status:200,statusText:"OK",headers:{"Content-Type":"application/json"}},fr=t=>({status:400,statusText:"Bad Request",headers:{"Content-Type":"application/json"},body:JSON.stringify({error:"invalid_request",error_description:t})}),We,no={};function io(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(fr(We));if(i.searchParams.has("code_challenge")){if(!i.searchParams.has("code_challenge_method"))return N.response(fr("missing code_challenge_method"));no.code_challenge=i.searchParams.get("code_challenge"),no.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(fr(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(fr(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(fr(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 ii={};nt(ii,{default:()=>ao});var so=["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512"],oo=["client_secret_post","client_secret_base","client_secret_jwt","private_key_jwt"],$f={issuer:k(R),authorization_endpoint:k(R),token_endpoint:k(R),jwks_uri:m(R),registration_endpoint:m(R),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(R),ui_locales_supported:m([]),op_policy_uri:m(R),op_tos_uri:m(R),revocation_endpoint:m(R),revocation_endpoint_auth_methods_supported:m(oo),revocation_endpoint_auth_signing_alg_values_supported:m(so),introspection_endpoint:m(R),introspection_endpoint_auth_methods_supported:m(oo),introspection_endpoint_auth_signing_alg_values_supported:m(so),code_challendge_methods_supported:m([])};function ao(t={}){let e={client:N.client()};t=Object.assign({},e,t),D(t,{issuer:k(R)});let r=qf(t.issuer);return t.client.with(t.issuer)}async function qf(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,$f),n}throw N.metroError("metro.oidcmw: Error while fetching "+t+".wellknown/oauth_authorization_server",r)}function lo(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 uo(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 cr(){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 Wf=new TextEncoder,zf=new TextDecoder;function Kr(t){return typeof t=="string"?Wf.encode(t):zf.decode(t)}function fo(t){if(typeof t.modulusLength!="number"||t.modulusLength<2048)throw new oi(`${t.name} modulusLength must be at least 2048 bits`)}function Gf(t){switch(t.algorithm.name){case"ECDSA":return{name:t.algorithm.name,hash:"SHA-256"};case"RSA-PSS":return fo(t.algorithm),{name:t.algorithm.name,saltLength:32};case"RSASSA-PKCS1-v1_5":return fo(t.algorithm),{name:t.algorithm.name};case"Ed25519":return{name:t.algorithm.name}}throw new ze}async function Hf(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(Gf(r),r,Kr(n)));return`${n}.${i}`}var si;Uint8Array.prototype.toBase64?si=t=>(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t.toBase64({alphabet:"base64url",omitPadding:!0})):si=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 si(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)}},oi=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 ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Kf(t){switch(t.algorithm.hash.name){case"SHA-256":return"RS256";default:throw new ze("unsupported RsaHashedKeyAlgorithm hash name")}}function Qf(t){switch(t.algorithm.namedCurve){case"P-256":return"ES256";default:throw new ze("unsupported EcKeyAlgorithm namedCurve")}}function Jf(t){switch(t.algorithm.name){case"RSA-PSS":return Vf(t);case"RSASSA-PKCS1-v1_5":return Kf(t);case"ECDSA":return Qf(t);case"Ed25519":return"Ed25519";default:throw new ze("unsupported CryptoKey algorithm name")}}function co(t){return t instanceof CryptoKey}function Yf(t){return co(t)&&t.type==="private"}function Zf(t){return co(t)&&t.type==="public"}function Xf(){return Math.floor(Date.now()/1e3)}async function ai(t,e,r,n,i,s){let o=t?.privateKey,a=t?.publicKey;if(!Yf(o))throw new TypeError('"keypair.privateKey" must be a private CryptoKey');if(!Zf(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 Hf({alg:Jf(o),typ:"dpop+jwt",jwk:await ec(a)},Object.assign(Object.assign({},s),{iat:Xf(),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 ec(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 ho(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 dr(t){return D(t,{site:k(R),authorization_endpoint:k(R),token_endpoint:k(R),dpop_signing_alg_values_supported:m([])}),async(e,r)=>{let n=await cr(),i=await n.get(t.site);if(!i){let a=await ho("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 ai(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 ai(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 rc=Object.assign({},Hr,{oauth2mw:Bt,mockserver:ni,discover:ii,tokenstore:ur,dpopmw:dr,keysstore:cr,authorizePopup:uo,popupHandleRedirect:lo});globalThis.metro.oauth2||(globalThis.metro.oauth2=rc);var hr=(...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 pr(t={}){D(t,{client:m(at(N.client().constructor)),issuer:k(R)});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(Yn(t.issuer,n)),authorization_endpoint:k(R),token_endpoint:k(R),userinfo_endpoint:qe(R),jwks_uri:k(R),registration_endpoint:t.requireDynamicRegistration?k(R):qe(R),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"),Lt(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(R),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(R),op_tos_uri:m(R)},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 _r(t){let e={redirect_uris:k([R]),response_types:m([]),grant_types:m(ve("authorization_code","refresh_token")),application_type:m($("native","web")),contacts:m([Zn]),client_name:m(String),logo_uri:m(R),client_uri:m(R),policy_uri:m(R),tos_uri:m(R),jwks_uri:m(R,Lt(hr("jwks"))),jwks:m(R,Lt(hr("jwks_uri"))),sector_identifier_uri:m(R),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),hr("id_token_encrypted_response_alg")),userinfo_signed_response_alg:m($(...ae)),userinfo_encrypted_response_alg:m($(...ae)),userinfo_encrypted_response_enc:m($(...ae),hr("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([R]),request_uris:m([R])};D(t,{client:m(at(N.client().constructor)),registration_endpoint:R,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 li(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(at(re().constructor)),client_info:k(),issuer:k(R),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 pr({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 _r({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(dr(u)),o.client=l}return l=l.with(Bt(o)),i=await l.fetch(r),i}}function po(){return ri()}function _o(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 yo={oidcmw:li,discover:pr,register:_r,isRedirected:po,idToken:_o};globalThis.metro.oidc||(globalThis.metro.oidc=yo);var bo=yo;var ui={};nt(ui,{BlankNode:()=>He,Collection:()=>ut,Context:()=>Zr,Graph:()=>Xr,NamedNode:()=>lt,default:()=>en,first:()=>sc,many:()=>ic,one:()=>nc,prefixes:()=>mo,rdfType:()=>tn});function en(t){return new Zr(t)}var tn="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",mo={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#"};function nc(t,e="last"){let r=t;if(Array.isArray(t))if(e=="last")r=t[t.length-1];else if(e=="first")r=t[0];else if(typeof e=="function")r=e(t);else throw new Error("Unknown value for whichOne parameter");return r}function ic(t){return Array.isArray(t)?t:t==null?[]:[t]}function sc(...t){for(let e of t)if(e!=null)return e;return null}var Zr=class{constructor(e){this.prefixes={...mo,...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 Xr(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}},Xr=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 lt(r,this)),this.subjects[r]}addBlankNode(e){return this.#e[e]||(this.#e[e]=new He(this)),this.#e[e]}addCollection(e){return this.#e[e]||(this.#e[e]=new ut(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}},He=class{constructor(e){Object.defineProperty(this,"graph",{value:e,writable:!1,enumerable:!1})}addPredicate(e,r){if(e.id&&(e=e.id),e==tn){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}},lt=class extends He{constructor(e,r){super(r),Object.defineProperty(this,"id",{value:e,writable:!1,enumerable:!0})}},ut=class extends Array{constructor(e,r){super(),Object.defineProperty(this,"graph",{value:r,writable:!1,enumerable:!1})}};var qs={};nt(qs,{n3Parser:()=>kb,n3Writer:()=>jb});var Uo=zr(pe());var dt="http://www.w3.org/1999/02/22-rdf-syntax-ns#",br="http://www.w3.org/2001/XMLSchema#",on="http://www.w3.org/2000/10/swap/",O={xsd:{decimal:`${br}decimal`,boolean:`${br}boolean`,double:`${br}double`,integer:`${br}integer`,string:`${br}string`},rdf:{type:`${dt}type`,nil:`${dt}nil`,first:`${dt}first`,rest:`${dt}rest`,langString:`${dt}langString`,dirLangString:`${dt}dirLangString`,reifies:`${dt}reifies`},owl:{sameAs:"http://www.w3.org/2002/07/owl#sameAs"},r:{forSome:`${on}reify#forSome`,forAll:`${on}reify#forAll`},log:{implies:`${on}log#implies`,isImpliedBy:`${on}log#isImpliedBy`}};var{xsd:an}=O,Mc=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{8})|\\([^])/g,Do={"\\":"\\","'":"'",'"':'"',n:`
|
|
3
|
+
`,r:"\r",t:" ",f:"\f",b:"\b",_:"_","~":"~",".":".","-":"-","!":"!",$:"$","&":"&","(":"(",")":")","*":"*","+":"+",",":",",";":";","=":"=","/":"/","?":"?","#":"#","@":"@","%":"%"},Dc=/[\x00-\x20<>\\"\{\}\|\^\`]/,Uc={_iri:!0,_unescapedIri:!0,_simpleQuotedString:!0,_langcode:!0,_dircode:!0,_blank:!0,_newline:!0,_comment:!0,_whitespace:!0,_endOfFile:!0},$c=/$0^/,ht=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 Uc)&&this[r]instanceof RegExp&&(this[r]=$c)}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||Dc.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"?an.double:typeof y[2]=="string"?an.decimal:an.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=an.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(Mc,(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 Do?Do[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=Uo.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:$o,xsd:pt}=O,$t,qc=0;var wi={namedNode:qo,blankNode:Wo,variable:Go,literal:zo,defaultGraph:Wc,quad:xi,triple:xi,fromTerm:mr,fromQuad:Ho},te=wi,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}}},Ut=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 Ut(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!=="@"?pt.string:e.indexOf("--",r)>0?$o.dirLangString:$o.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}}}},gr=class extends ee{constructor(e){super(`_:${e}`)}get termType(){return"BlankNode"}get value(){return this.id.substr(2)}},wr=class extends ee{constructor(e){super(`?${e}`)}get termType(){return"Variable"}get value(){return this.id.substr(1)}},xr=class extends ee{constructor(){return super(""),$t||this}get termType(){return"DefaultGraph"}equals(e){return this===e||!!e&&this.termType===e.termType}};$t=new xr;function Ke(t,e,r){if(e=e||wi,!t)return e.defaultGraph();switch(t[0]){case"?":return e.variable(t.substr(1));case"_":return e.blankNode(t.substr(2));case'"':if(e===wi)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(Ke(t[0],e,!0),Ke(t[1],e,!0),Ke(t[2],e,!0),t[3]&&Ke(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 $t.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!==pt.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 Qe=class extends ee{constructor(e,r,n,i){super(""),this._subject=e,this._predicate=r,this._object=n,this._graph=i||$t}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 qo(t){return new Ut(t)}function Wo(t){return new gr(t||`n3-${qc++}`)}function zo(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=pt.boolean:typeof t=="number"&&(Number.isFinite(t)?r=Number.isInteger(t)?pt.integer:pt.double:(r=pt.double,Number.isNaN(t)||(t=t>0?"INF":"-INF")))),r===""||r===pt.string?new je(`"${t}"`):new je(`"${t}"^^${r}`)}function Go(t){return new wr(t)}function Wc(){return $t}function xi(t,e,r,n){return new Qe(t,e,r,n)}function mr(t){if(t instanceof ee)return t;switch(t.termType){case"NamedNode":return qo(t.value);case"BlankNode":return Wo(t.value);case"Variable":return Go(t.value);case"DefaultGraph":return $t;case"Literal":return zo(t.value,t.language||t.datatype);case"Quad":return Ho(t);default:throw new Error(`Unexpected termType: ${t.termType}`)}}function Ho(t){if(t instanceof Qe)return t;if(t.termType!=="Quad")throw new Error(`Unexpected termType: ${t.termType}`);return xi(mr(t.subject),mr(t.predicate),mr(t.object),mr(t.graph))}var Vo=0,Pe=class t{constructor(e){this._contextStack=[],this._graph=null,e=e||{},this._setBase(e.baseIRI),e.factory&&Ko(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 ht({lineMode:l,n3:a,isImpliedBy:this._isImpliedBy}),this._explicitQuantifiers=!!e.explicitQuantifiers,this._parseUnsupportedVersions=!!e.parseUnsupportedVersions,this._version=e.version}static _resetBlankNodePrefix(){Vo=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=Sr}_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${Vo++}_`,this._prefixCallback=o||Sr,this._versionCallback=l||Sr,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=Sr):this._readCallback&&(this._readCallback=this._readCallback(c))};a&&(this._lexer.comments=!0,u=(f,c)=>{f!==null?(this._callback(f),this._callback=Sr):this._readCallback&&(c.type==="comment"?a(c.value):this._readCallback=this._readCallback(c))}),this._callback=s,this._lexer.tokenize(e,u)}};function Sr(){}function Ko(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"];Ko(Pe.prototype,te);var Si={};nt(Si,{inDefaultGraph:()=>Qc,isBlankNode:()=>Gc,isDefaultGraph:()=>_t,isLiteral:()=>Hc,isNamedNode:()=>zc,isQuad:()=>Kc,isVariable:()=>Vc,prefix:()=>Jc,prefixes:()=>Qo});function zc(t){return!!t&&t.termType==="NamedNode"}function Gc(t){return!!t&&t.termType==="BlankNode"}function Hc(t){return!!t&&t.termType==="Literal"}function Vc(t){return!!t&&t.termType==="Variable"}function Kc(t){return!!t&&t.termType==="Quad"}function _t(t){return!!t&&t.termType==="DefaultGraph"}function Qc(t){return _t(t.graph)}function Jc(t,e){return Qo({"":t.value||t},e)("")}function Qo(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 qt(t){return t.replace(/[\]\/\(\)\*\+\?\.\\\$]/g,"\\$&")}var Yc=/^:?[^:?#]*(?:[?#]|$)|^file:|^[^:]*:\/*[^?#]+?\/(?:\.\.?(?:\/|$)|\/)/i,Zc=/^(?:(?:[^/?#]{3,}|\.?[^/?#.]\.?)(?:\/[^/?#]{3,}|\.?[^/?#.]\.?)*\/?)?(?:[?#]|$)/,Jo="./",Xc="../",Ei="?",Yo="#",yt=class t{constructor(e){this.base=e,this._baseLength=0,this._baseMatcher=null,this._pathReplacements=new Array(e.length+1)}static supports(e){return!Yc.test(e)}_getBaseMatcher(){if(this._baseMatcher)return this._baseMatcher;if(!t.supports(this.base))return this._baseMatcher=/.^/;let e=/^[^:]*:\/*/.exec(this.base)[0],r=["^",qt(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]===Yo?l=s.lastIndex-1:(r.push(qt(o[0]),"(?:"),n.push(")?"),o[1]!==Ei?i.push(u=s.lastIndex):(a=u=s.lastIndex,l=this.base.indexOf(Yo,a),this._pathReplacements[a]=Ei));for(let f=0;f<i.length;f++)this._pathReplacements[i[f]]=Xc.repeat(i.length-f-1);return this._pathReplacements[i[i.length-1]]=Jo,this._baseLength=l>0?l:this.base.length,r.push(qt(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!==Ei&&!Zc.test(s)?e:i===Jo&&/^[^?#]/.test(s)?s:i+s}return e.substring(n-1)}};var Er=te.defaultGraph(),{rdf:ed,xsd:Wt}=O,Zo=/["\\\t\n\r\b\f\u0000-\u0019\ud800-\udbff]/,Xo=/["\\\t\n\r\b\f\u0000-\u0019]|[\ud800-\udbff][\udc00-\udfff]/g,td={"\\":"\\\\",'"':'\\"'," ":"\\t","\n":"\\n","\r":"\\r","\b":"\\b","\f":"\\f"},bt=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=Er,this._prefixIRIs=Object.create(null),r.prefixes&&this.addPrefixes(r.prefixes),r.baseIRI&&(this._baseIri=new yt(r.baseIRI)))}get _inDefaultGraph(){return Er.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
|
`)+(Er.equals(i)?"":`${this._encodeIriOrBlank(i)} {
|
|
@@ -8,18 +8,18 @@
|
|
|
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)),Zo.test(r)&&(r=r.replace(Xo,ea));let n=this._prefixRegex.exec(r);return n?n[1]?this._prefixIRIs[n[1]]+n[2]:r:`<${r}>`}_encodeLiteral(e){let r=e.value;Zo.test(r)&&(r=r.replace(Xo,ea));let n=e.direction?`--${e.direction}`:"";if(e.language)return`"${r}"@${e.language}${n}`;if(this._lineMode){if(e.datatype.value===Wt.string)return`"${r}"`}else switch(e.datatype.value){case Wt.string:return`"${r}"`;case Wt.boolean:if(r==="true"||r==="false")return r;break;case Wt.integer:if(/^[+-]?\d+$/.test(r))return r;break;case Wt.decimal:if(/^[+-]?\d*\.\d+$/.test(r))return r;break;case Wt.double:if(/^[+-]?(?:\d+\.\d*|\.?\d+)[eE][+-]?\d+$/.test(r))return r;break}return`"${r}"^^${this._encodeIriOrBlank(e.datatype)}`}_encodePredicate(e){return e.value===ed.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)}${_t(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,Er,i):this._writeQuad(e,r,n,i||Er,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
15
|
`)}if(n){let i="",s="";for(let o in this._prefixIRIs)i+=i?`|${o}`:o,s+=(s?"|":"")+this._prefixIRIs[o];i=qt(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
|
|
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 bt("[]");case 1:if(i=n[0],!(i.object instanceof bt))return new bt(`[ ${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 bt(`${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 bt(`(${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 Zo(t){let e=Yc[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 Ds=zr(Mn());var Ms=Symbol("iter");function Fr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Fr(t[n]||Object.create(null),e[n],r-1);return t}function uf(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null: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}function ff(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:Fr({},t[i],r-1);else if(r!==0){let s=ff(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 Mr=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&&(dt(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)}${dt(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 Mr({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 Ds.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=Fr(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=ff(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=Fr(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=uf(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=Fr(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 Ds.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[Ms]&&(this[Ms]=this[Symbol.iterator]());let r=this[Ms];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 Dr=class{dataset(e){return new et(e)}};function df(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 Ur=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=df(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(Us(o.subject,a.subject)&&Us(o.predicate,a.predicate)&&Us(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(cf(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=>cf(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function cf({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 Us(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var hf=zr(Mn());var $r=class extends hf.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 pf=zr(Mn());var qr=class extends pf.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:ft,Parser:Pe,Writer:_e,Store:et,StoreFactory:Dr,EntityIndex:Mr,StreamParser:$r,StreamWriter:qr,Util:xi,Reasoner:Ur,BaseIRI:ht,DataFactory:te,Term:ee,NamedNode:Ut,Literal:je,BlankNode:gr,Variable:wr,DefaultGraph:xr,Quad:Ke,Triple:Ke,termFromId:Ve,termToId:Ne};var Ib=(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}},Ab=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(li),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 Bt?U.object=y(T):Array.isArray(T)?U.object=x(T):T instanceof Lt?U.object=o(T.id):T instanceof ot?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 Lt?S.push(o(w.id)):w instanceof ot?S.push(_(w)):w instanceof Bt&&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 _f={context:ai,...$s};globalThis.oldm=_f;var Un=_f;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function qs(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=="_"?or(i[r]).select(n):{[r]:or(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 Ws(t){let e=[];if(Array.isArray(t))e.push(jb(...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]=Ws(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 Tb=Symbol("asc"),vb=Symbol("desc");function yf(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===Tb)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===vb)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=yf(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 bf(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]=or(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 kb(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 mf(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=kb(t,r);if(e.length)for(let i in n)n[i]=mf(n[i],e);return n}function jb(...t){let e=t.map(r=>Ws(r));return r=>e.some(n=>n(r))}var Nb={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=Ws(n);return new Proxy(t.filter(s=>i(s)),De)};break;case"select":r=function(n){let i=qs(n);return new Proxy(t.map(i),De)};break;case"reduce":r=function(n,i=[]){let s=bf(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,De):Ie(o)?o:new Proxy(o,Wr)};break;case"orderBy":r=function(n){let i=yf(n);return new Proxy(t.toSorted(i),De)};break;case"groupBy":r=function(...n){let i=mf(t,n);return new Proxy(i,Wr)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=qs(n);return new Proxy(i(t),De)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],Nb)),r||(r=t[e]),r}},Wr={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=qs(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],Wr);return s};break;case"reduce":r=function(n,i=[]){let s=bf(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,Wr)}else o[a]=new Proxy(t[a],Wr);return o};break;default:Array.isArray(t[e])?r=or(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 sr,$n)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new sr,$n)};break;case"groupBy":r=function(){return new Proxy(new sr,$n)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},sr=class{toJSON(){return null}};function or(t){return!t||typeof t!="object"?new Proxy(new sr,$n):new Proxy(t,De)}function zs(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(zs(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 gf=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(zs(n),gf(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),Pb=new Proxy(zs(),gf());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}})),wf(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&wf(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 Ob=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function wf(t){for(let e of Ob)if(e.exec(t))return!0;return!1}globalThis.oldmmw=qn;var xf=qn;var tt=class extends it{#e;#t;constructor(e,r="/",n={}){e=re(e).with(yo.oidcmw(n)).with(xf(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 or(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 Wn(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:oldm.n3Parser,writer:oldm.n3Writer},n=Object.assign({},r,e);for(let o in r.prefixes)n.prefixes[o]||(n.prefixes[o]=r.prefixes[o]);let i=await metro.client().with(oldmmw(n),getdatamw()).get(t)?.primary;if(!i||!i.solid$oidcIssuer)throw new Error("solidClient: "+t+" did not return valid solid profile");n.issuer=i.solid$oidcIssuer;let s=oldm.many(i.space$storage).map(o=>new jsfs.fs(new tt(o,"/",n)));return metro.api(metro.client(oidcmw(n),oldmmw(n)),{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})}var u0={adapter:tt,client:Wn};globalThis.solidClient=Wn;globalThis.SolidAdapter=tt;})();
|
|
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 ea(t){let e=td[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 Us=zr(qn());var Ds=Symbol("iter");function Fr(t,e,r=4){if(r===0)return Object.assign(t,e);for(let n in e)t[n]=Fr(t[n]||Object.create(null),e[n],r-1);return t}function cf(t,e,r=4){let n=!1;for(let i in t)if(i in e){let s=r===0?null:cf(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 df(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:Fr({},t[i],r-1);else if(r!==0){let s=df(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 Mr=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 Ke(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&&(_t(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)}${_t(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))}},tt=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 Mr({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 Us.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 et(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 et&&(e=e.filtered),Array.isArray(e))this.addQuads(e);else if(e instanceof t&&e._entityIndex===this._entityIndex)e._size!==0&&(this._graphs=Fr(this._graphs,e._graphs),this._size=null);else for(let r of e)this.add(r);return this}contains(e){if(e instanceof et&&(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 et&&(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=df(this._graphs,e._graphs);return n&&(r._graphs=n,r._size=null),r}return this.filter(r=>!e.has(r))}equals(e){return e instanceof et&&(e=e.filtered),e===this||this.size===e.size&&this.contains(e)}filter(e){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 et&&(e=e.filtered),e===this){let r=new t({entityIndex:this._entityIndex});return r._graphs=Fr(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=cf(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=Fr(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 et=class t extends Us.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 tt({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[Ds]&&(this[Ds]=this[Symbol.iterator]());let r=this[Ds];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 Dr=class{dataset(e){return new tt(e)}};function pf(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 Ur=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=pf(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($s(o.subject,a.subject)&&$s(o.predicate,a.predicate)&&$s(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(hf(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=>hf(s,i))}let r=this._store._getGraphs();for(let n in r)this._reasonGraphNaive(e,r[n]);this._store._size=null}};function hf({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 $s(t,e){return t.value===null&&(t.value=e.value),t.value===e.value}var _f=zr(qn());var $r=class extends _f.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 yf=zr(qn());var qr=class extends yf.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 Wn={Lexer:ht,Parser:Pe,Writer:_e,Store:tt,StoreFactory:Dr,EntityIndex:Mr,StreamParser:$r,StreamWriter:qr,Util:Si,Reasoner:Ur,BaseIRI:yt,DataFactory:te,Term:ee,NamedNode:Ut,Literal:je,BlankNode:gr,Variable:wr,DefaultGraph:xr,Quad:Qe,Triple:Qe,termFromId:Ke,termToId:Ne};var kb=(t,e,r)=>{let n=new Wn.Parser({baseIRI:e,blankNodePrefix:"",format:r}),i=Object.create(null);return{quads:n.parse(t,null,(o,a)=>{i[o]=a.id}),prefixes:i}},jb=t=>new Promise((e,r)=>{let n=new Wn.Writer({format:t.type,prefixes:{...t.prefixes}}),i=t.prefixes.xsd,{quad:s,namedNode:o,literal:a,blankNode:l}=Wn.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(tn),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 ut?U.object=y(T):Array.isArray(T)?U.object=x(T):T instanceof lt?U.object=o(T.id):T instanceof He?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 lt?S.push(o(w.id)):w instanceof He?S.push(_(w)):w instanceof ut&&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 bf={context:en,...ui,...qs};globalThis.oldm=bf;var zn=bf;function Ie(t){return[String,Boolean,Number,BigInt].includes(t?.constructor)}function Ws(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=="_"?or(i[r]).select(n):{[r]:or(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 zs(t){let e=[];if(Array.isArray(t))e.push(Lb(...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]=zs(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 Nb=Symbol("asc"),Pb=Symbol("desc");function mf(t){let e=Object.entries(t),r=[];for(let[n,i]of e)if(i instanceof Function)r.push(i);else if(i===Nb)r.push((s,o)=>s[n]>o[n]?1:s[n]<o[n]?-1:0);else if(i===Pb)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=mf(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 gf(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]=or(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 Ob(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 wf(t,e){let r=e.shift();if(typeof r=="string"&&(r=Cb[r]),typeof r!="function")throw new Error("groupBy parameters must be either a property name or a pointer function (e.g.: _.name)");let n=Ob(t,r);if(e.length)for(let i in n)n[i]=wf(n[i],e);return n}function Lb(...t){let e=t.map(r=>zs(r));return r=>e.some(n=>n(r))}var Bb={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=zs(n);return new Proxy(t.filter(s=>i(s)),De)};break;case"select":r=function(n){let i=Ws(n);return new Proxy(t.map(i),De)};break;case"reduce":r=function(n,i=[]){let s=gf(n),o=t.reduce(s,i);return Array.isArray(o)?new Proxy(o,De):Ie(o)?o:new Proxy(o,Wr)};break;case"orderBy":r=function(n){let i=mf(n);return new Proxy(t.toSorted(i),De)};break;case"groupBy":r=function(...n){let i=wf(t,n);return new Proxy(i,Wr)};break}return!r&&t&&typeof t=="object"&&e==="select"&&(r=function(n){let i=Ws(n);return new Proxy(i(t),De)}),!r&&t&&typeof t[e]=="function"&&(r=new Proxy(t[e],Bb)),r||(r=t[e]),r}},Wr={get(t,e){let r=null;switch(e){case"select":r=function(n){let i=Ws(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],Wr);return s};break;case"reduce":r=function(n,i=[]){let s=gf(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,Wr)}else o[a]=new Proxy(t[a],Wr);return o};break;default:Array.isArray(t[e])?r=or(t[e]):r=t[e];break}return r}},Gn={get(t,e){let r=null;switch(e){case"where":r=function(){return new Proxy(new sr,Gn)};break;case"reduce":case"select":r=function(){return null};break;case"orderBy":r=function(){return new Proxy(new sr,Gn)};break;case"groupBy":r=function(){return new Proxy(new sr,Gn)};break}return!r&&typeof t?.[e]=="function"&&(r=t[e]),r}},sr=class{toJSON(){return null}};function or(t){return!t||typeof t!="object"?new Proxy(new sr,Gn):new Proxy(t,De)}function Gs(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(Gs(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 xf=t=>(t||(t=[]),{get(e,r){if(r=="constructor"||typeof r=="symbol")return e[r];let n=t.concat([r]);return new Proxy(Gs(n),xf(n))},apply(e,r,n){let i=e(...n);return Array.isArray(i)&&(i=i.flat(1/0)),i}}),Cb=new Proxy(Gs(),xf());function Hn(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:zn.n3Parser,writer:zn.n3Writer},t),t.prefixes.ldp||(t.prefixes.ldp="http://www.w3.org/ns/ldp#");let e=zn.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}})),Sf(n.headers.get("Content-Type"))&&(n=n.with({body:await e.writer(n.data)}))}let s=await i(n);if(s&&Sf(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 Fb=[/^text\/turtle\b/,/^application\/n-quads\b/,/^text\/x-nquads\b/,/^appliction\/n-triples\b/,/^application\/trig\b/];function Sf(t){for(let e of Fb)if(e.exec(t))return!0;return!1}globalThis.oldmmw=Hn;var Ef=Hn;var rt=class extends ot{#e;#t;constructor(e,r="/",n={}){e=re(e).with(bo.oidcmw(n)).with(Ef(n)),r=E.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(E.collapse(e,this.#t)),n={type:this.getMimetype(r),name:E.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 or(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(E.collapse(e,this.#t))}async rmdir(e){this.#e.delete(E.collapse(e,this.#t))}};async function Vn(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:oldm.n3Parser,writer:oldm.n3Writer},n=Object.assign({},r,e);for(let o in r.prefixes)n.prefixes[o]||(n.prefixes[o]=r.prefixes[o]);let i=await metro.client().with(oldmmw(n),getdatamw()).get(t)?.primary;if(!i||!i.solid$oidcIssuer)throw new Error("solidClient: "+t+" did not return valid solid profile");n.issuer=i.solid$oidcIssuer;let s=oldm.many(i.space$storage).map(o=>new jsfs.fs(new rt(o,"/",n)));return metro.api(metro.client(oidcmw(n),oldmmw(n)),{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})}var c0={adapter:rt,client:Vn};globalThis.solidClient=Vn;globalThis.SolidAdapter=rt;})();
|
|
23
23
|
/*! Bundled license information:
|
|
24
24
|
|
|
25
25
|
ieee754/index.js:
|