diff --git a/dist/sw.js b/dist/sw.js index fbae7648..74cbdee0 100644 --- a/dist/sw.js +++ b/dist/sw.js @@ -4,7 +4,7 @@ * * @author Feross Aboukhadijeh * @license MIT - */const i=r(9742),n=r(645),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50;const o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return l(t,e,r)}function l(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let i=a(r);const n=i.write(t,e);n!==r&&(i=i.slice(0,n));return i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return c.from(i,e,r);const n=function(t){if(c.isBuffer(t)){const e=0|f(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||J(t.length)?a(0):p(t);if("Buffer"===t.type&&Array.isArray(t.data))return p(t.data)}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.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)}function h(t){if("number"!=typeof t)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 u(t){return h(t),a(t<0?0:0|f(t))}function p(t){const e=t.length<0?0:0|f(t.length),r=a(e);for(let i=0;i=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function g(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(t).length;default:if(n)return i?-1:z(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=c.from(e,i)),c.isBuffer(e))return 0===e.length?-1:b(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,i,n){let s,o=1,a=t.length,c=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){let i=-1;for(s=r;sa&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let i=0;in&&(i=n):i=n;const s=e.length;let o;for(i>s/2&&(i=s/2),o=0;o>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function T(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);const i=[];let n=e;for(;n239?4:e>223?3:e>191?2:1;if(n+o<=r){let r,i,a,c;switch(o){case 1:e<128&&(s=e);break;case 2:r=t[n+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(s=c));break;case 3:r=t[n+1],i=t[n+2],128==(192&r)&&128==(192&i)&&(c=(15&e)<<12|(63&r)<<6|63&i,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:r=t[n+1],i=t[n+2],a=t[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(c=(15&e)<<18|(63&r)<<12|(63&i)<<6|63&a,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}return function(t){const e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);let r="",i=0;for(;ii.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(i,n)):Uint8Array.prototype.set.call(i,e,n);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,n)}n+=e.length}return i},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(t,e,r,i,n){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;let s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0);const a=Math.min(s,o),l=this.slice(i,n),h=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":case"latin1":case"binary":return _(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function I(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;ni)&&(r=i);let n="";for(let i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,i,n,s){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function P(t,e,r,i,n){j(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,r}function L(t,e,r,i,n){j(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o>>=8,t[r+2]=o,o>>=8,t[r+1]=o,o>>=8,t[r]=o,r+8}function D(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(t,e,r,i,s){return e=+e,r>>>=0,s||D(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function M(t,e,r,i,s){return e=+e,r>>>=0,s||D(t,0,r,8),n.write(t,e,r,i,52,8),r+8}c.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||O(t,e,this.length);let i=this[t],n=1,s=0;for(;++s>>=0,e>>>=0,r||O(t,e,this.length);let i=this[t+--e],n=1;for(;e>0&&(n*=256);)i+=this[t+--e]*n;return i},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=Z((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(i)+(BigInt(n)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(i)<>>=0,e>>>=0,r||O(t,e,this.length);let i=this[t],n=1,s=0;for(;++s=n&&(i-=Math.pow(2,8*e)),i},c.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let i=e,n=1,s=this[t+--i];for(;i>0&&(n*=256);)s+=this[t+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*e)),s},c.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=Z((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(i)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<>>=0,e||O(t,4,this.length),n.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e>>>=0,r>>>=0,!i){B(this,t,e,r,Math.pow(2,8*r)-1,0)}let n=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!i){B(this,t,e,r,Math.pow(2,8*r)-1,0)}let n=r-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=Z((function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Z((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}let n=0,s=1,o=0;for(this[e]=255&t;++n>0)-o&255;return e+r},c.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[e+n]=255&t;--n>=0&&(s*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/s>>0)-o&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=Z((function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Z((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,i){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=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),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function j(t,e,r,i,n,s){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${e}${i} and <= ${r}${i}`,new F.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||G(e,t.length-(r+1))}(i,n,s)}function V(t,e){if("number"!=typeof t)throw new F.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,r){if(Math.floor(t)!==t)throw V(t,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}H("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),H("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),H("ERR_OUT_OF_RANGE",(function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=W(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=W(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function z(t,e){let r;e=e||1/0;const i=t.length;let n=null;const s=[];for(let o=0;o55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function Q(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function Z(t){return"undefined"==typeof BigInt?$:t}function $(){throw new Error("BigInt not supported")}},7187:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var n=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(r,i){function n(r){t.removeListener(e,s),i(r)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",n),r([].slice.call(arguments))}g(t,e,s,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&g(t,"error",e,r)}(t,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var n,s,o,l;if(a(r),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),void 0===o)o=s[e]=r,++t._eventsCount;else if("function"==typeof o?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=c(t))>0&&o.length>n&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=o.length,l=h,console&&console.warn&&console.warn(l)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=h.bind(i);return n.listener=r,i.wrapFn=n,n}function p(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[t];if(void 0===c)return!1;if("function"==typeof c)i(c,this,e);else{var l=c.length,h=f(c,l);for(r=0;r=0;s--)if(r[s]===e||r[s].listener===e){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},s.prototype.listenerCount=d,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},6932:(t,e,r)=>{"use strict";const i=r(8501),n=r(8844),s=r(1192);t.exports={XMLParser:n,XMLValidator:i,XMLBuilder:s}},7849:(t,e)=>{"use strict";const r=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i="["+r+"][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",n=new RegExp("^"+i+"$");e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,r){if(e){const i=Object.keys(e),n=i.length;for(let s=0;s{"use strict";const i=r(7849),n={allowBooleanAttributes:!1,unpairedTags:[]};function s(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function o(t,e){const r=e;for(;e5&&"xml"===i)return p("InvalidXml","XML declaration allowed only at the start of the document.",f(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function a(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let r=1;for(e+=8;e"===t[e]&&(r--,0===r))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e"===t[e+2]){e+=2;break}return e}e.validate=function(t,e){e=Object.assign({},n,e);const r=[];let l=!1,d=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let n=0;n"!==t[n]&&" "!==t[n]&&"\t"!==t[n]&&"\n"!==t[n]&&"\r"!==t[n];n++)y+=t[n];if(y=y.trim(),"/"===y[y.length-1]&&(y=y.substring(0,y.length-1),n--),g=y,!i.isName(g)){let e;return e=0===y.trim().length?"Invalid space after '<'.":"Tag '"+y+"' is an invalid name.",p("InvalidTag",e,f(t,n))}const b=c(t,n);if(!1===b)return p("InvalidAttr","Attributes for '"+y+"' have open quote.",f(t,n));let A=b.value;if(n=b.index,"/"===A[A.length-1]){const r=n-A.length;A=A.substring(0,A.length-1);const i=h(A,e);if(!0!==i)return p(i.err.code,i.err.msg,f(t,r+i.err.line));l=!0}else if(w){if(!b.tagClosed)return p("InvalidTag","Closing tag '"+y+"' doesn't have proper closing.",f(t,n));if(A.trim().length>0)return p("InvalidTag","Closing tag '"+y+"' can't have attributes or invalid starting.",f(t,m));if(0===r.length)return p("InvalidTag","Closing tag '"+y+"' has not been opened.",f(t,m));{const e=r.pop();if(y!==e.tagName){let r=f(t,e.tagStartPos);return p("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+r.line+", col "+r.col+") instead of closing tag '"+y+"'.",f(t,m))}0==r.length&&(d=!0)}}else{const i=h(A,e);if(!0!==i)return p(i.err.code,i.err.msg,f(t,n-A.length+i.err.line));if(!0===d)return p("InvalidXml","Multiple possible root nodes found.",f(t,n));-1!==e.unpairedTags.indexOf(y)||r.push({tagName:y,tagStartPos:m}),l=!0}for(n++;n0)||p("InvalidXml","Invalid '"+JSON.stringify(r.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):p("InvalidXml","Start tag expected.",1)};function c(t,e){let r="",i="",n=!1;for(;e"===t[e]&&""===i){n=!0;break}r+=t[e]}return""===i&&{value:r,index:e,tagClosed:n}}const l=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function h(t,e){const r=i.getAllMatches(t,l),n={};for(let t=0;t{"use strict";const i=r(2592),n={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function s(t){this.options=Object.assign({},n,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=c),this.processTextOrObjNode=o,this.options.format?(this.indentate=a,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function o(t,e,r){const i=this.j2x(t,r+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,r):this.buildObjectNode(i.val,e,i.attrStr,r)}function a(t){return this.options.indentBy.repeat(t)}function c(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}s.prototype.build=function(t){return this.options.preserveOrder?i(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},s.prototype.j2x=function(t,e){let r="",i="";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n))if(void 0===t[n])this.isAttribute(n)&&(i+="");else if(null===t[n])this.isAttribute(n)?i+="":"?"===n[0]?i+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+n+"/"+this.tagEndChar;else if(t[n]instanceof Date)i+=this.buildTextValNode(t[n],n,"",e);else if("object"!=typeof t[n]){const s=this.isAttribute(n);if(s)r+=this.buildAttrPairStr(s,""+t[n]);else if(n===this.options.textNodeName){let e=this.options.tagValueProcessor(n,""+t[n]);i+=this.replaceEntitiesValue(e)}else i+=this.buildTextValNode(t[n],n,"",e)}else if(Array.isArray(t[n])){const r=t[n].length;let s="";for(let o=0;o"+t+n}},s.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(i)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),""===n?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+n+"0&&this.options.processEntities)for(let e=0;e{function e(t,o,a,c){let l="",h=!1;for(let u=0;u`,h=!1;continue}if(d===o.commentPropName){l+=c+`\x3c!--${p[d][0][o.textNodeName]}--\x3e`,h=!0;continue}if("?"===d[0]){const t=i(p[":@"],o),e="?xml"===d?"":c;let r=p[d][0][o.textNodeName];r=0!==r.length?" "+r:"",l+=e+`<${d}${r}${t}?>`,h=!0;continue}let g=c;""!==g&&(g+=o.indentBy);const m=c+`<${d}${i(p[":@"],o)}`,w=e(p[d],o,f,g);-1!==o.unpairedTags.indexOf(d)?o.suppressUnpairedNode?l+=m+">":l+=m+"/>":w&&0!==w.length||!o.suppressEmptyNode?w&&w.endsWith(">")?l+=m+`>${w}${c}`:(l+=m+">",w&&""!==c&&(w.includes("/>")||w.includes("`):l+=m+"/>",h=!0}return l}function r(t){const e=Object.keys(t);for(let r=0;r0&&e.processEntities)for(let r=0;r0&&(i="\n"),e(t,r,"",i)}},4780:(t,e,r)=>{const i=r(7849);function n(t,e){let r="";for(;e"===t[e]){if(p?"-"===t[e-1]&&"-"===t[e-2]&&(p=!1,i--):i--,0===i)break}else"["===t[e]?u=!0:d+=t[e];else{if(u&&o(t,e))e+=7,[entityName,val,e]=n(t,e+1),-1===val.indexOf("&")&&(r[h(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(u&&a(t,e))e+=8;else if(u&&c(t,e))e+=8;else if(u&&l(t,e))e+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}i++,d=""}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:r,i:e}}},6745:(t,e)=>{const r={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}};e.buildOptions=function(t){return Object.assign({},r,t)},e.defaultOptions=r},1078:(t,e,r)=>{"use strict";const i=r(7849),n=r(6311),s=r(4780),o=r(4153);function a(t){const e=Object.keys(t);for(let r=0;r0)){o||(t=this.replaceEntitiesValue(t));const i=this.options.tagValueProcessor(e,t,r,n,s);if(null==i)return t;if(typeof i!=typeof t||i!==t)return i;if(this.options.trimValues)return A(t,this.options.parseTagValue,this.options.numberParseOptions);return t.trim()===t?A(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function l(t){if(this.options.removeNSPrefix){const e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}const h=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function u(t,e,r){if(!this.options.ignoreAttributes&&"string"==typeof t){const r=i.getAllMatches(t,h),n=r.length,s={};for(let t=0;t",a,"Closing Tag is not closed.");let n=t.substring(a+2,e).trim();if(this.options.removeNSPrefix){const t=n.indexOf(":");-1!==t&&(n=n.substr(t+1))}this.options.transformTagName&&(n=this.options.transformTagName(n)),r&&(i=this.saveTextToParentTag(i,r,o));const s=o.substring(o.lastIndexOf(".")+1);if(n&&-1!==this.options.unpairedTags.indexOf(n))throw new Error(`Unpaired tag can not be used as closing tag: `);let c=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),r=this.tagsNodeStack.pop(),i="",a=e}else if("?"===t[a+1]){let e=y(t,a,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,r,o),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new n(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,o,e.tagName)),this.addChild(r,t,o)}a=e.closeIndex+1}else if("!--"===t.substr(a+1,3)){const e=w(t,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){const n=t.substring(a+4,e-2);i=this.saveTextToParentTag(i,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:n}])}a=e}else if("!D"===t.substr(a+1,2)){const e=s(t,a);this.docTypeEntities=e.entities,a=e.i}else if("!["===t.substr(a+1,2)){const e=w(t,"]]>",a,"CDATA is not closed.")-2,n=t.substring(a+9,e);i=this.saveTextToParentTag(i,r,o);let s=this.parseTextData(n,r.tagname,o,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:n}]):r.add(this.options.textNodeName,s),a=e+2}else{let s=y(t,a,this.options.removeNSPrefix),c=s.tagName;const l=s.rawTagName;let h=s.tagExp,u=s.attrExpPresent,p=s.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&i&&"!xml"!==r.tagname&&(i=this.saveTextToParentTag(i,r,o,!1));const d=r;if(d&&-1!==this.options.unpairedTags.indexOf(d.tagname)&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),c!==e.tagname&&(o+=o?"."+c:c),this.isItStopNode(this.options.stopNodes,o,c)){let e="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),h=c):h=h.substr(0,h.length-1),a=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))a=s.closeIndex;else{const r=this.readStopNodeData(t,l,p+1);if(!r)throw new Error(`Unexpected end of ${l}`);a=r.i,e=r.tagContent}const i=new n(c);c!==h&&u&&(i[":@"]=this.buildAttributesMap(h,o,c)),e&&(e=this.parseTextData(e,c,o,!0,u,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),i.add(this.options.textNodeName,e),this.addChild(r,i,o)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),h=c):h=h.substr(0,h.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const t=new n(c);c!==h&&u&&(t[":@"]=this.buildAttributesMap(h,o,c)),this.addChild(r,t,o),o=o.substr(0,o.lastIndexOf("."))}else{const t=new n(c);this.tagsNodeStack.push(r),c!==h&&u&&(t[":@"]=this.buildAttributesMap(h,o,c)),this.addChild(r,t,o),r=t}i="",a=p}}else i+=t[a]}return e.child};function d(t,e,r){const i=this.options.updateTag(e.tagname,r,e[":@"]);!1===i||("string"==typeof i?(e.tagname=i,t.addChild(e)):t.addChild(e))}const f=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){const r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function g(t,e,r,i){return t&&(void 0===i&&(i=0===Object.keys(e.child).length),void 0!==(t=this.parseTextData(t,e.tagname,r,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,i))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function m(t,e,r){const i="*."+r;for(const r in t){const n=t[r];if(i===n||e===n)return!0}return!1}function w(t,e,r,i){const n=t.indexOf(e,r);if(-1===n)throw new Error(i);return n+e.length-1}function y(t,e,r,i=">"){const n=function(t,e,r=">"){let i,n="";for(let s=e;s",r,`${e} is not closed`);if(t.substring(r+2,s).trim()===e&&(n--,0===n))return{tagContent:t.substring(i,r),i:s};r=s}else if("?"===t[r+1]){r=w(t,"?>",r+1,"StopNode is not closed.")}else if("!--"===t.substr(r+1,3)){r=w(t,"--\x3e",r+3,"StopNode is not closed.")}else if("!["===t.substr(r+1,2)){r=w(t,"]]>",r,"StopNode is not closed.")-2}else{const i=y(t,r,">");if(i){(i&&i.tagName)===e&&"/"!==i.tagExp[i.tagExp.length-1]&&n++,r=i.closeIndex}}}function A(t,e,r){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&o(t,r)}return i.isExist(t)?t:""}t.exports=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,16))}},this.addExternalEntities=a,this.parseXml=p,this.parseTextData=c,this.resolveNameSpace=l,this.buildAttributesMap=u,this.isItStopNode=m,this.replaceEntitiesValue=f,this.readStopNodeData=b,this.saveTextToParentTag=g,this.addChild=d}}},8844:(t,e,r)=>{const{buildOptions:i}=r(6745),n=r(1078),{prettify:s}=r(6997),o=r(8501);t.exports=class{constructor(t){this.externalEntities={},this.options=i(t)}parse(t,e){if("string"==typeof t);else{if(!t.toString)throw new Error("XML data is accepted in String or Bytes[] form.");t=t.toString()}if(e){!0===e&&(e={});const r=o.validate(t,e);if(!0!==r)throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`)}const r=new n(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(t);return this.options.preserveOrder||void 0===i?i:s(i,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}}},6997:(t,e)=>{"use strict";function r(t,e,o){let a;const c={};for(let l=0;l0&&(c[e.textNodeName]=a):void 0!==a&&(c[e.textNodeName]=a),c}function i(t){const e=Object.keys(t);for(let t=0;t{"use strict";t.exports=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}},2475:t=>{"use strict";var e=/^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i,r=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,i=/\s|\uFEFF|\xA0/,n=/\r?\n[\x20\x09]+/g,s=/[;,"]/,o=/[;,"]|\s/,a=/^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/,c=1,l=2,h=4;function u(t){return t.replace(r,"")}function p(t){return i.test(t)}function d(t,e){for(;p(t[e]);)e++;return e}function f(t){return o.test(t)||!a.test(t)}class g{constructor(t){this.refs=[],t&&this.parse(t)}rel(t){for(var e=[],r=t.toLowerCase(),i=0;i{return r=e,i=t,Object.keys(r).length===Object.keys(i).length&&Object.keys(r).every((t=>t in i&&r[t]===i[t]));var r,i}))||this.refs.push(t),this}has(t,e){t=t.toLowerCase(),e=e.toLowerCase();for(var r=0;r",e)))throw new Error("Expected end of URI delimiter at offset "+e);o={uri:t.slice(e+1,m)},e=m,r=l,e++}else if(r===l){if(p(t[e])){e++;continue}if(";"===t[e])r=h,e++;else{if(","!==t[e])throw new Error('Unexpected character "'+t[e]+'" at offset '+e);r=c,e++}}else{if(r!==h)throw new Error('Unknown parser state "'+r+'"');if(";"===t[e]||p(t[e])){e++;continue}-1===(m=t.indexOf("=",e))&&(m=t.indexOf(";",e)),-1===m&&(m=t.length);var a=u(t.slice(e,m)).toLowerCase(),f="";if('"'===t[e=d(t,e=m+1)])for(e++;e"),t.push(e);return t.join(", ")}}g.isCompatibleEncoding=function(t){return e.test(t)},g.parse=function(t,e){return(new g).parse(t,e)},g.isSingleOccurenceAttr=function(t){return"rel"===t||"type"===t||"media"===t||"title"===t||"title*"===t},g.isTokenAttr=function(t){return"rel"===t||"type"===t||"anchor"===t},g.escapeQuotes=function(t){return t.replace(/"/g,'\\"')},g.expandRelations=function(t){return t.rel.split(" ").map((function(e){var r=Object.assign({},t);return r.rel=e,r}))},g.parseExtendedValue=function(t){var e=/([^']+)?(?:'([^']*)')?(.+)/.exec(t);return{language:e[2].toLowerCase(),encoding:g.isCompatibleEncoding(e[1])?null:e[1].toLowerCase(),value:g.isCompatibleEncoding(e[1])?decodeURIComponent(e[3]):e[3]}},g.formatExtendedAttribute=function(t,e){var r=(e.encoding||"utf-8").toUpperCase();return t+"="+r+"'"+(e.language||"en")+"'"+(Buffer.isBuffer(e.value)&&g.isCompatibleEncoding(r)?e.value.toString(r):Buffer.isBuffer(e.value)?e.value.toString("hex").replace(/[0-9a-f]{2}/gi,"%$1"):encodeURIComponent(e.value))},g.formatAttribute=function(t,e){return Array.isArray(e)?e.map((e=>g.formatAttribute(t,e))).join("; "):"*"===t[t.length-1]||"string"!=typeof e?g.formatExtendedAttribute(t,e):(g.isTokenAttr(t)?e=f(e)?'"'+g.escapeQuotes(e)+'"':g.escapeQuotes(e):f(e)&&(e='"'+(e=(e=encodeURIComponent(e)).replace(/%20/g," ").replace(/%2C/g,",").replace(/%3B/g,";"))+'"'),t+"="+e)},t.exports=g},645:(t,e)=>{ + */const i=r(9742),n=r(645),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50;const o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return l(t,e,r)}function l(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let i=a(r);const n=i.write(t,e);n!==r&&(i=i.slice(0,n));return i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return d(e.buffer,e.byteOffset,e.byteLength)}return p(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return d(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return d(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return c.from(i,e,r);const n=function(t){if(c.isBuffer(t)){const e=0|f(t.length),r=a(e);return 0===r.length||t.copy(r,0,0,e),r}if(void 0!==t.length)return"number"!=typeof t.length||J(t.length)?a(0):p(t);if("Buffer"===t.type&&Array.isArray(t.data))return p(t.data)}(t);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.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)}function h(t){if("number"!=typeof t)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 u(t){return h(t),a(t<0?0:0|f(t))}function p(t){const e=t.length<0?0:0|f(t.length),r=a(e);for(let i=0;i=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function g(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Q(t).length;default:if(n)return i?-1:z(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,r){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,e,r);case"utf8":case"utf-8":return x(this,e,r);case"ascii":return I(this,e,r);case"latin1":case"binary":return R(this,e,r);case"base64":return T(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){const i=t[e];t[e]=t[r],t[r]=i}function y(t,e,r,i,n){if(0===t.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof e&&(e=c.from(e,i)),c.isBuffer(e))return 0===e.length?-1:b(t,e,r,i,n);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,i,n){let s,o=1,a=t.length,c=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,r/=2}function l(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){let i=-1;for(s=r;sa&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let i=0;in&&(i=n):i=n;const s=e.length;let o;for(i>s/2&&(i=s/2),o=0;o>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function T(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function x(t,e,r){r=Math.min(t.length,r);const i=[];let n=e;for(;n239?4:e>223?3:e>191?2:1;if(n+o<=r){let r,i,a,c;switch(o){case 1:e<128&&(s=e);break;case 2:r=t[n+1],128==(192&r)&&(c=(31&e)<<6|63&r,c>127&&(s=c));break;case 3:r=t[n+1],i=t[n+2],128==(192&r)&&128==(192&i)&&(c=(15&e)<<12|(63&r)<<6|63&i,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:r=t[n+1],i=t[n+2],a=t[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(c=(15&e)<<18|(63&r)<<12|(63&i)<<6|63&a,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}return function(t){const e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);let r="",i=0;for(;ii.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(i,n)):Uint8Array.prototype.set.call(i,e,n);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,n)}n+=e.length}return i},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;er&&(t+=" ... "),""},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(t,e,r,i,n){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),e<0||r>t.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&e>=r)return 0;if(i>=n)return-1;if(e>=r)return 1;if(this===t)return 0;let s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0);const a=Math.min(s,o),l=this.slice(i,n),h=t.slice(e,r);for(let t=0;t>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return A(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":case"latin1":case"binary":return _(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const C=4096;function I(t,e,r){let i="";r=Math.min(t.length,r);for(let n=e;ni)&&(r=i);let n="";for(let i=e;ir)throw new RangeError("Trying to access beyond buffer length")}function B(t,e,r,i,n,s){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}function P(t,e,r,i,n){j(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,o>>=8,t[r++]=o,r}function L(t,e,r,i,n){j(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=o,o>>=8,t[r+2]=o,o>>=8,t[r+1]=o,o>>=8,t[r]=o,r+8}function D(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function U(t,e,r,i,s){return e=+e,r>>>=0,s||D(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function M(t,e,r,i,s){return e=+e,r>>>=0,s||D(t,0,r,8),n.write(t,e,r,i,52,8),r+8}c.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||O(t,e,this.length);let i=this[t],n=1,s=0;for(;++s>>=0,e>>>=0,r||O(t,e,this.length);let i=this[t+--e],n=1;for(;e>0&&(n*=256);)i+=this[t+--e]*n;return i},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=Z((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,n=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(i)+(BigInt(n)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],n=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(i)<>>=0,e>>>=0,r||O(t,e,this.length);let i=this[t],n=1,s=0;for(;++s=n&&(i-=Math.pow(2,8*e)),i},c.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);let i=e,n=1,s=this[t+--i];for(;i>0&&(n*=256);)s+=this[t+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*e)),s},c.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=Z((function(t){V(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(i)<>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||G(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<>>=0,e||O(t,4,this.length),n.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,r,i){if(t=+t,e>>>=0,r>>>=0,!i){B(this,t,e,r,Math.pow(2,8*r)-1,0)}let n=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,!i){B(this,t,e,r,Math.pow(2,8*r)-1,0)}let n=r-1,s=1;for(this[e+n]=255&t;--n>=0&&(s*=256);)this[e+n]=t/s&255;return e+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=Z((function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=Z((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}let n=0,s=1,o=0;for(this[e]=255&t;++n>0)-o&255;return e+r},c.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*r-1);B(this,t,e,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[e+n]=255&t;--n>=0&&(s*=256);)t<0&&0===o&&0!==this[e+n+1]&&(o=1),this[e+n]=(t/s>>0)-o&255;return e+r},c.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||B(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=Z((function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=Z((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,r){return U(this,t,e,!0,r)},c.prototype.writeFloatBE=function(t,e,r){return U(this,t,e,!1,r)},c.prototype.writeDoubleLE=function(t,e,r){return M(this,t,e,!0,r)},c.prototype.writeDoubleBE=function(t,e,r){return M(this,t,e,!1,r)},c.prototype.copy=function(t,e,r,i){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=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),t.length-e>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(n=e;n=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function j(t,e,r,i,n,s){if(t>r||t3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${e}${i} and <= ${r}${i}`,new F.ERR_OUT_OF_RANGE("value",n,t)}!function(t,e,r){V(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||G(e,t.length-(r+1))}(i,n,s)}function V(t,e){if("number"!=typeof t)throw new F.ERR_INVALID_ARG_TYPE(e,"number",t)}function G(t,e,r){if(Math.floor(t)!==t)throw V(t,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}H("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),H("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),H("ERR_OUT_OF_RANGE",(function(t,e,r){let i=`The value of "${t}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=W(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=W(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i}),RangeError);const q=/[^+/0-9A-Za-z-_]/g;function z(t,e){let r;e=e||1/0;const i=t.length;let n=null;const s=[];for(let o=0;o55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function Q(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e}();function Z(t){return"undefined"==typeof BigInt?$:t}function $(){throw new Error("BigInt not supported")}},7187:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var n=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(r,i){function n(r){t.removeListener(e,s),i(r)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",n),r([].slice.call(arguments))}g(t,e,s,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&g(t,"error",e,r)}(t,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var n,s,o,l;if(a(r),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),s=t._events),o=s[e]),void 0===o)o=s[e]=r,++t._eventsCount;else if("function"==typeof o?o=s[e]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=c(t))>0&&o.length>n&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=t,h.type=e,h.count=o.length,l=h,console&&console.warn&&console.warn(l)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=h.bind(i);return n.listener=r,i.wrapFn=n,n}function p(t,e,r){var i=t._events;if(void 0===i)return[];var n=i[e];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(t){for(var e=new Array(t.length),r=0;r0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[t];if(void 0===c)return!1;if("function"==typeof c)i(c,this,e);else{var l=c.length,h=f(c,l);for(r=0;r=0;s--)if(r[s]===e||r[s].listener===e){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return p(this,t,!0)},s.prototype.rawListeners=function(t){return p(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):d.call(t,e)},s.prototype.listenerCount=d,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},6932:(t,e,r)=>{"use strict";const i=r(8501),n=r(8844),s=r(1192);t.exports={XMLParser:n,XMLValidator:i,XMLBuilder:s}},7849:(t,e)=>{"use strict";const r=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",i="["+r+"][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*",n=new RegExp("^"+i+"$");e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,r){if(e){const i=Object.keys(e),n=i.length;for(let s=0;s{"use strict";const i=r(7849),n={allowBooleanAttributes:!1,unpairedTags:[]};function s(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function o(t,e){const r=e;for(;e5&&"xml"===i)return p("InvalidXml","XML declaration allowed only at the start of the document.",f(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function a(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let r=1;for(e+=8;e"===t[e]&&(r--,0===r))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e"===t[e+2]){e+=2;break}return e}e.validate=function(t,e){e=Object.assign({},n,e);const r=[];let l=!1,d=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let n=0;n"!==t[n]&&" "!==t[n]&&"\t"!==t[n]&&"\n"!==t[n]&&"\r"!==t[n];n++)y+=t[n];if(y=y.trim(),"/"===y[y.length-1]&&(y=y.substring(0,y.length-1),n--),g=y,!i.isName(g)){let e;return e=0===y.trim().length?"Invalid space after '<'.":"Tag '"+y+"' is an invalid name.",p("InvalidTag",e,f(t,n))}const b=c(t,n);if(!1===b)return p("InvalidAttr","Attributes for '"+y+"' have open quote.",f(t,n));let A=b.value;if(n=b.index,"/"===A[A.length-1]){const r=n-A.length;A=A.substring(0,A.length-1);const i=h(A,e);if(!0!==i)return p(i.err.code,i.err.msg,f(t,r+i.err.line));l=!0}else if(w){if(!b.tagClosed)return p("InvalidTag","Closing tag '"+y+"' doesn't have proper closing.",f(t,n));if(A.trim().length>0)return p("InvalidTag","Closing tag '"+y+"' can't have attributes or invalid starting.",f(t,m));if(0===r.length)return p("InvalidTag","Closing tag '"+y+"' has not been opened.",f(t,m));{const e=r.pop();if(y!==e.tagName){let r=f(t,e.tagStartPos);return p("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+r.line+", col "+r.col+") instead of closing tag '"+y+"'.",f(t,m))}0==r.length&&(d=!0)}}else{const i=h(A,e);if(!0!==i)return p(i.err.code,i.err.msg,f(t,n-A.length+i.err.line));if(!0===d)return p("InvalidXml","Multiple possible root nodes found.",f(t,n));-1!==e.unpairedTags.indexOf(y)||r.push({tagName:y,tagStartPos:m}),l=!0}for(n++;n0)||p("InvalidXml","Invalid '"+JSON.stringify(r.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):p("InvalidXml","Start tag expected.",1)};function c(t,e){let r="",i="",n=!1;for(;e"===t[e]&&""===i){n=!0;break}r+=t[e]}return""===i&&{value:r,index:e,tagClosed:n}}const l=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function h(t,e){const r=i.getAllMatches(t,l),n={};for(let t=0;t{"use strict";const i=r(2592),n={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function s(t){this.options=Object.assign({},n,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=c),this.processTextOrObjNode=o,this.options.format?(this.indentate=a,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function o(t,e,r){const i=this.j2x(t,r+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,i.attrStr,r):this.buildObjectNode(i.val,e,i.attrStr,r)}function a(t){return this.options.indentBy.repeat(t)}function c(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}s.prototype.build=function(t){return this.options.preserveOrder?i(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},s.prototype.j2x=function(t,e){let r="",i="";for(let n in t)if(Object.prototype.hasOwnProperty.call(t,n))if(void 0===t[n])this.isAttribute(n)&&(i+="");else if(null===t[n])this.isAttribute(n)?i+="":"?"===n[0]?i+=this.indentate(e)+"<"+n+"?"+this.tagEndChar:i+=this.indentate(e)+"<"+n+"/"+this.tagEndChar;else if(t[n]instanceof Date)i+=this.buildTextValNode(t[n],n,"",e);else if("object"!=typeof t[n]){const s=this.isAttribute(n);if(s)r+=this.buildAttrPairStr(s,""+t[n]);else if(n===this.options.textNodeName){let e=this.options.tagValueProcessor(n,""+t[n]);i+=this.replaceEntitiesValue(e)}else i+=this.buildTextValNode(t[n],n,"",e)}else if(Array.isArray(t[n])){const r=t[n].length;let s="",o="";for(let a=0;a"+t+n}},s.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(i)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(i)+"<"+e+r+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(e,t);return n=this.replaceEntitiesValue(n),""===n?this.indentate(i)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(i)+"<"+e+r+">"+n+"0&&this.options.processEntities)for(let e=0;e{function e(t,o,a,c){let l="",h=!1;for(let u=0;u`,h=!1;continue}if(d===o.commentPropName){l+=c+`\x3c!--${p[d][0][o.textNodeName]}--\x3e`,h=!0;continue}if("?"===d[0]){const t=i(p[":@"],o),e="?xml"===d?"":c;let r=p[d][0][o.textNodeName];r=0!==r.length?" "+r:"",l+=e+`<${d}${r}${t}?>`,h=!0;continue}let g=c;""!==g&&(g+=o.indentBy);const m=c+`<${d}${i(p[":@"],o)}`,w=e(p[d],o,f,g);-1!==o.unpairedTags.indexOf(d)?o.suppressUnpairedNode?l+=m+">":l+=m+"/>":w&&0!==w.length||!o.suppressEmptyNode?w&&w.endsWith(">")?l+=m+`>${w}${c}`:(l+=m+">",w&&""!==c&&(w.includes("/>")||w.includes("`):l+=m+"/>",h=!0}return l}function r(t){const e=Object.keys(t);for(let r=0;r0&&e.processEntities)for(let r=0;r0&&(i="\n"),e(t,r,"",i)}},4780:(t,e,r)=>{const i=r(7849);function n(t,e){let r="";for(;e"===t[e]){if(p?"-"===t[e-1]&&"-"===t[e-2]&&(p=!1,i--):i--,0===i)break}else"["===t[e]?u=!0:d+=t[e];else{if(u&&o(t,e))e+=7,[entityName,val,e]=n(t,e+1),-1===val.indexOf("&")&&(r[h(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(u&&a(t,e))e+=8;else if(u&&c(t,e))e+=8;else if(u&&l(t,e))e+=9;else{if(!s)throw new Error("Invalid DOCTYPE");p=!0}i++,d=""}if(0!==i)throw new Error("Unclosed DOCTYPE")}return{entities:r,i:e}}},6745:(t,e)=>{const r={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}};e.buildOptions=function(t){return Object.assign({},r,t)},e.defaultOptions=r},1078:(t,e,r)=>{"use strict";const i=r(7849),n=r(6311),s=r(4780),o=r(4153);function a(t){const e=Object.keys(t);for(let r=0;r0)){o||(t=this.replaceEntitiesValue(t));const i=this.options.tagValueProcessor(e,t,r,n,s);if(null==i)return t;if(typeof i!=typeof t||i!==t)return i;if(this.options.trimValues)return A(t,this.options.parseTagValue,this.options.numberParseOptions);return t.trim()===t?A(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function l(t){if(this.options.removeNSPrefix){const e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}const h=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function u(t,e,r){if(!this.options.ignoreAttributes&&"string"==typeof t){const r=i.getAllMatches(t,h),n=r.length,s={};for(let t=0;t",a,"Closing Tag is not closed.");let n=t.substring(a+2,e).trim();if(this.options.removeNSPrefix){const t=n.indexOf(":");-1!==t&&(n=n.substr(t+1))}this.options.transformTagName&&(n=this.options.transformTagName(n)),r&&(i=this.saveTextToParentTag(i,r,o));const s=o.substring(o.lastIndexOf(".")+1);if(n&&-1!==this.options.unpairedTags.indexOf(n))throw new Error(`Unpaired tag can not be used as closing tag: `);let c=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),r=this.tagsNodeStack.pop(),i="",a=e}else if("?"===t[a+1]){let e=y(t,a,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(i=this.saveTextToParentTag(i,r,o),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new n(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,o,e.tagName)),this.addChild(r,t,o)}a=e.closeIndex+1}else if("!--"===t.substr(a+1,3)){const e=w(t,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){const n=t.substring(a+4,e-2);i=this.saveTextToParentTag(i,r,o),r.add(this.options.commentPropName,[{[this.options.textNodeName]:n}])}a=e}else if("!D"===t.substr(a+1,2)){const e=s(t,a);this.docTypeEntities=e.entities,a=e.i}else if("!["===t.substr(a+1,2)){const e=w(t,"]]>",a,"CDATA is not closed.")-2,n=t.substring(a+9,e);i=this.saveTextToParentTag(i,r,o);let s=this.parseTextData(n,r.tagname,o,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:n}]):r.add(this.options.textNodeName,s),a=e+2}else{let s=y(t,a,this.options.removeNSPrefix),c=s.tagName;const l=s.rawTagName;let h=s.tagExp,u=s.attrExpPresent,p=s.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),r&&i&&"!xml"!==r.tagname&&(i=this.saveTextToParentTag(i,r,o,!1));const d=r;if(d&&-1!==this.options.unpairedTags.indexOf(d.tagname)&&(r=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),c!==e.tagname&&(o+=o?"."+c:c),this.isItStopNode(this.options.stopNodes,o,c)){let e="";if(h.length>0&&h.lastIndexOf("/")===h.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),h=c):h=h.substr(0,h.length-1),a=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))a=s.closeIndex;else{const r=this.readStopNodeData(t,l,p+1);if(!r)throw new Error(`Unexpected end of ${l}`);a=r.i,e=r.tagContent}const i=new n(c);c!==h&&u&&(i[":@"]=this.buildAttributesMap(h,o,c)),e&&(e=this.parseTextData(e,c,o,!0,u,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),i.add(this.options.textNodeName,e),this.addChild(r,i,o)}else{if(h.length>0&&h.lastIndexOf("/")===h.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),h=c):h=h.substr(0,h.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const t=new n(c);c!==h&&u&&(t[":@"]=this.buildAttributesMap(h,o,c)),this.addChild(r,t,o),o=o.substr(0,o.lastIndexOf("."))}else{const t=new n(c);this.tagsNodeStack.push(r),c!==h&&u&&(t[":@"]=this.buildAttributesMap(h,o,c)),this.addChild(r,t,o),r=t}i="",a=p}}else i+=t[a]}return e.child};function d(t,e,r){const i=this.options.updateTag(e.tagname,r,e[":@"]);!1===i||("string"==typeof i?(e.tagname=i,t.addChild(e)):t.addChild(e))}const f=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){const r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function g(t,e,r,i){return t&&(void 0===i&&(i=0===Object.keys(e.child).length),void 0!==(t=this.parseTextData(t,e.tagname,r,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,i))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function m(t,e,r){const i="*."+r;for(const r in t){const n=t[r];if(i===n||e===n)return!0}return!1}function w(t,e,r,i){const n=t.indexOf(e,r);if(-1===n)throw new Error(i);return n+e.length-1}function y(t,e,r,i=">"){const n=function(t,e,r=">"){let i,n="";for(let s=e;s",r,`${e} is not closed`);if(t.substring(r+2,s).trim()===e&&(n--,0===n))return{tagContent:t.substring(i,r),i:s};r=s}else if("?"===t[r+1]){r=w(t,"?>",r+1,"StopNode is not closed.")}else if("!--"===t.substr(r+1,3)){r=w(t,"--\x3e",r+3,"StopNode is not closed.")}else if("!["===t.substr(r+1,2)){r=w(t,"]]>",r,"StopNode is not closed.")-2}else{const i=y(t,r,">");if(i){(i&&i.tagName)===e&&"/"!==i.tagExp[i.tagExp.length-1]&&n++,r=i.closeIndex}}}function A(t,e,r){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&o(t,r)}return i.isExist(t)?t:""}t.exports=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,16))}},this.addExternalEntities=a,this.parseXml=p,this.parseTextData=c,this.resolveNameSpace=l,this.buildAttributesMap=u,this.isItStopNode=m,this.replaceEntitiesValue=f,this.readStopNodeData=b,this.saveTextToParentTag=g,this.addChild=d}}},8844:(t,e,r)=>{const{buildOptions:i}=r(6745),n=r(1078),{prettify:s}=r(6997),o=r(8501);t.exports=class{constructor(t){this.externalEntities={},this.options=i(t)}parse(t,e){if("string"==typeof t);else{if(!t.toString)throw new Error("XML data is accepted in String or Bytes[] form.");t=t.toString()}if(e){!0===e&&(e={});const r=o.validate(t,e);if(!0!==r)throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`)}const r=new n(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(t);return this.options.preserveOrder||void 0===i?i:s(i,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}}},6997:(t,e)=>{"use strict";function r(t,e,o){let a;const c={};for(let l=0;l0&&(c[e.textNodeName]=a):void 0!==a&&(c[e.textNodeName]=a),c}function i(t){const e=Object.keys(t);for(let t=0;t{"use strict";t.exports=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}},2475:t=>{"use strict";var e=/^utf-?8|ascii|utf-?16-?le|ucs-?2|base-?64|latin-?1$/i,r=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,i=/\s|\uFEFF|\xA0/,n=/\r?\n[\x20\x09]+/g,s=/[;,"]/,o=/[;,"]|\s/,a=/^[!#$%&'*+\-\.^_`|~\da-zA-Z]+$/,c=1,l=2,h=4;function u(t){return t.replace(r,"")}function p(t){return i.test(t)}function d(t,e){for(;p(t[e]);)e++;return e}function f(t){return o.test(t)||!a.test(t)}class g{constructor(t){this.refs=[],t&&this.parse(t)}rel(t){for(var e=[],r=t.toLowerCase(),i=0;i{return r=e,i=t,Object.keys(r).length===Object.keys(i).length&&Object.keys(r).every((t=>t in i&&r[t]===i[t]));var r,i}))||this.refs.push(t),this}has(t,e){t=t.toLowerCase(),e=e.toLowerCase();for(var r=0;r",e)))throw new Error("Expected end of URI delimiter at offset "+e);o={uri:t.slice(e+1,m)},e=m,r=l,e++}else if(r===l){if(p(t[e])){e++;continue}if(";"===t[e])r=h,e++;else{if(","!==t[e])throw new Error('Unexpected character "'+t[e]+'" at offset '+e);r=c,e++}}else{if(r!==h)throw new Error('Unknown parser state "'+r+'"');if(";"===t[e]||p(t[e])){e++;continue}-1===(m=t.indexOf("=",e))&&(m=t.indexOf(";",e)),-1===m&&(m=t.length);var a=u(t.slice(e,m)).toLowerCase(),f="";if('"'===t[e=d(t,e=m+1)])for(e++;e"),t.push(e);return t.join(", ")}}g.isCompatibleEncoding=function(t){return e.test(t)},g.parse=function(t,e){return(new g).parse(t,e)},g.isSingleOccurenceAttr=function(t){return"rel"===t||"type"===t||"media"===t||"title"===t||"title*"===t},g.isTokenAttr=function(t){return"rel"===t||"type"===t||"anchor"===t},g.escapeQuotes=function(t){return t.replace(/"/g,'\\"')},g.expandRelations=function(t){return t.rel.split(" ").map((function(e){var r=Object.assign({},t);return r.rel=e,r}))},g.parseExtendedValue=function(t){var e=/([^']+)?(?:'([^']*)')?(.+)/.exec(t);return{language:e[2].toLowerCase(),encoding:g.isCompatibleEncoding(e[1])?null:e[1].toLowerCase(),value:g.isCompatibleEncoding(e[1])?decodeURIComponent(e[3]):e[3]}},g.formatExtendedAttribute=function(t,e){var r=(e.encoding||"utf-8").toUpperCase();return t+"="+r+"'"+(e.language||"en")+"'"+(Buffer.isBuffer(e.value)&&g.isCompatibleEncoding(r)?e.value.toString(r):Buffer.isBuffer(e.value)?e.value.toString("hex").replace(/[0-9a-f]{2}/gi,"%$1"):encodeURIComponent(e.value))},g.formatAttribute=function(t,e){return Array.isArray(e)?e.map((e=>g.formatAttribute(t,e))).join("; "):"*"===t[t.length-1]||"string"!=typeof e?g.formatExtendedAttribute(t,e):(g.isTokenAttr(t)?e=f(e)?'"'+g.escapeQuotes(e)+'"':g.escapeQuotes(e):f(e)&&(e='"'+(e=(e=encodeURIComponent(e)).replace(/%20/g," ").replace(/%2C/g,",").replace(/%3B/g,";"))+'"'),t+"="+e)},t.exports=g},645:(t,e)=>{ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ e.read=function(t,e,r,i,n){var s,o,a=8*n-i-1,c=(1<>1,h=-7,u=r?n-1:0,p=r?-1:1,d=t[e+u];for(u+=p,s=d&(1<<-h)-1,d>>=-h,h+=a;h>0;s=256*s+t[e+u],u+=p,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+t[e+u],u+=p,h-=8);if(0===s)s=1-l;else{if(s===c)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,i),s-=l}return(d?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,e,r,i,n,s){var o,a,c,l=8*s-n-1,h=(1<>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=i?0:s-1,f=i?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),(e+=o+u>=1?p/c:p*Math.pow(2,1-u))*c>=2&&(o++,c/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(e*c-1)*Math.pow(2,n),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,n),o=0));n>=8;t[r+d]=255&a,d+=f,a/=256,n-=8);for(o=o<0;t[r+d]=255&o,d+=f,o/=256,l-=8);t[r+d-f]|=128*g}},5717:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}}},6512:function(t){!function(e){"use strict";const r="(0?\\d+|0x[a-f0-9]+)",i={fourOctet:new RegExp(`^${r}\\.${r}\\.${r}\\.${r}$`,"i"),threeOctet:new RegExp(`^${r}\\.${r}\\.${r}$`,"i"),twoOctet:new RegExp(`^${r}\\.${r}$`,"i"),longValue:new RegExp(`^${r}$`,"i")},n=new RegExp("^0[0-7]+$","i"),s=new RegExp("^0x[a-f0-9]+$","i"),o="%[0-9a-z]{1,}",a="(?:[0-9a-f]+::?)+",c={zoneIndex:new RegExp(o,"i"),native:new RegExp(`^(::)?(${a})?([0-9a-f]+)?(::)?(${o})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${r}\\.${r}\\.${r}\\.${r}(${o})?)$`,"i"),transitional:new RegExp(`^((?:${a})|(?:::)(?:${a})?)${r}\\.${r}\\.${r}\\.${r}(${o})?$`,"i")};function l(t,e){if(t.indexOf("::")!==t.lastIndexOf("::"))return null;let r,i,n=0,s=-1,o=(t.match(c.zoneIndex)||[])[0];for(o&&(o=o.substring(1),t=t.replace(/%.+$/,""));(s=t.indexOf(":",s+1))>=0;)n++;if("::"===t.substr(0,2)&&n--,"::"===t.substr(-2,2)&&n--,n>e)return null;for(i=e-n,r=":";i--;)r+="0:";return":"===(t=t.replace("::",r))[0]&&(t=t.slice(1)),":"===t[t.length-1]&&(t=t.slice(0,-1)),{parts:e=function(){const e=t.split(":"),r=[];for(let t=0;t0;){if(n=r-i,n<0&&(n=0),t[s]>>n!=e[s]>>n)return!1;i-=r,s+=1}return!0}function u(t){if(s.test(t))return parseInt(t,16);if("0"===t[0]&&!isNaN(parseInt(t[1],10))){if(n.test(t))return parseInt(t,8);throw new Error(`ipaddr: cannot parse ${t} as octal`)}return parseInt(t,10)}function p(t,e){for(;t.length=0;i-=1){if(n=this.octets[i],!(n in r))return null;if(s=r[n],e&&0!==s)return null;8!==s&&(e=!0),t+=s}return 32-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){return this.octets.slice(0)},t.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},t.prototype.toNormalizedString=function(){return this.toString()},t.prototype.toString=function(){return this.octets.join(".")},t}(),d.IPv4.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[];let s=0;for(;s<4;)n.push(parseInt(r[s],10)|255^parseInt(i[s],10)),s++;return new this(n)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(t){return null!==this.parser(t)},d.IPv4.isValid=function(t){try{return new this(this.parser(t)),!0}catch(t){return!1}},d.IPv4.isValidFourPartDecimal=function(t){return!(!d.IPv4.isValid(t)||!t.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(t){let e,r,i,n,s;try{for(e=this.parseCIDR(t),i=e[0].toByteArray(),s=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[],r=0;r<4;)n.push(parseInt(i[r],10)&parseInt(s[r],10)),r++;return new this(n)}catch(t){throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(t){const e=this.parser(t);if(null===e)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(e)},d.IPv4.parseCIDR=function(t){let e;if(e=t.match(/^(.+)\/(\d+)$/)){const t=parseInt(e[2]);if(t>=0&&t<=32){const r=[this.parse(e[1]),t];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(t){let e,r,n;if(e=t.match(i.fourOctet))return function(){const t=e.slice(1,6),i=[];for(let e=0;e4294967295||n<0)throw new Error("ipaddr: address outside defined range");return function(){const t=[];let e;for(e=0;e<=24;e+=8)t.push(n>>e&255);return t}().reverse()}return(e=t.match(i.twoOctet))?function(){const t=e.slice(1,4),r=[];if(n=u(t[1]),n>16777215||n<0)throw new Error("ipaddr: address outside defined range");return r.push(u(t[0])),r.push(n>>16&255),r.push(n>>8&255),r.push(255&n),r}():(e=t.match(i.threeOctet))?function(){const t=e.slice(1,5),r=[];if(n=u(t[2]),n>65535||n<0)throw new Error("ipaddr: address outside defined range");return r.push(u(t[0])),r.push(u(t[1])),r.push(n>>8&255),r.push(255&n),r}():null},d.IPv4.subnetMaskFromPrefixLength=function(t){if((t=parseInt(t))<0||t>32)throw new Error("ipaddr: invalid IPv4 prefix length");const e=[0,0,0,0];let r=0;const i=Math.floor(t/8);for(;r=0;s-=1){if(i=this.parts[s],!(i in r))return null;if(n=r[i],e&&0!==n)return null;16!==n&&(e=!0),t+=n}return 128-t},t.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},t.prototype.toByteArray=function(){let t;const e=[],r=this.parts;for(let i=0;i>8),e.push(255&t);return e},t.prototype.toFixedLengthString=function(){const t=function(){const t=[];for(let e=0;e>8,255&e,r>>8,255&r])},t.prototype.toNormalizedString=function(){const t=function(){const t=[];for(let e=0;en&&(i=r.index,n=r[0].length);return n<0?e:`${e.substring(0,i)}::${e.substring(i+n)}`},t.prototype.toString=function(){return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/,"::")},t}(),d.IPv6.broadcastAddressFromCIDR=function(t){try{const e=this.parseCIDR(t),r=e[0].toByteArray(),i=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[];let s=0;for(;s<16;)n.push(parseInt(r[s],10)|255^parseInt(i[s],10)),s++;return new this(n)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.isIPv6=function(t){return null!==this.parser(t)},d.IPv6.isValid=function(t){if("string"==typeof t&&-1===t.indexOf(":"))return!1;try{const e=this.parser(t);return new this(e.parts,e.zoneId),!0}catch(t){return!1}},d.IPv6.networkAddressFromCIDR=function(t){let e,r,i,n,s;try{for(e=this.parseCIDR(t),i=e[0].toByteArray(),s=this.subnetMaskFromPrefixLength(e[1]).toByteArray(),n=[],r=0;r<16;)n.push(parseInt(i[r],10)&parseInt(s[r],10)),r++;return new this(n)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.parse=function(t){const e=this.parser(t);if(null===e.parts)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(e.parts,e.zoneId)},d.IPv6.parseCIDR=function(t){let e,r,i;if((r=t.match(/^(.+)\/(\d+)$/))&&(e=parseInt(r[2]),e>=0&&e<=128))return i=[this.parse(r[1]),e],Object.defineProperty(i,"toString",{value:function(){return this.join("/")}}),i;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(t){let e,r,i,n,s,o;if(i=t.match(c.deprecatedTransitional))return this.parser(`::ffff:${i[1]}`);if(c.native.test(t))return l(t,8);if((i=t.match(c.transitional))&&(o=i[6]||"",e=l(i[1].slice(0,-1)+o,6),e.parts)){for(s=[parseInt(i[2]),parseInt(i[3]),parseInt(i[4]),parseInt(i[5])],r=0;r128)throw new Error("ipaddr: invalid IPv6 prefix length");const e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let r=0;const i=Math.floor(t/8);for(;r{"use strict";t.exports=function(){function t(t,e,r,i,n){return tr?r+1:t+1:i===n?e:e+1}return function(e,r){if(e===r)return 0;if(e.length>r.length){var i=e;e=r,r=i}for(var n=e.length,s=r.length;n>0&&e.charCodeAt(n-1)===r.charCodeAt(s-1);)n--,s--;for(var o=0;o{"use strict";var i={};(0,r(4236).assign)(i,r(4555),r(8843),r(1619)),t.exports=i},4555:(t,e,r)=>{"use strict";var i=r(405),n=r(4236),s=r(9373),o=r(8898),a=r(2292),c=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(t);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(0!==r)throw new Error(o[r]);if(e.header&&i.deflateSetHeader(this.strm,e.header),e.dictionary){var h;if(h="string"==typeof e.dictionary?s.string2buf(e.dictionary):"[object ArrayBuffer]"===c.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(r=i.deflateSetDictionary(this.strm,h)))throw new Error(o[r]);this._dict_set=!0}}function h(t,e){var r=new l(e);if(r.push(t,!0),r.err)throw r.msg||o[r.err];return r.result}l.prototype.push=function(t,e){var r,o,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=e===~~e?e:!0===e?4:0,"string"==typeof t?a.input=s.string2buf(t):"[object ArrayBuffer]"===c.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(l),a.next_out=0,a.avail_out=l),1!==(r=i.deflate(a,o))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==r);return 4===o?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==o||(this.onEnd(0),a.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.prototype.onEnd=function(t){0===t&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=l,e.deflate=h,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,h(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,h(t,e)}},8843:(t,e,r)=>{"use strict";var i=r(7948),n=r(4236),s=r(9373),o=r(1619),a=r(8898),c=r(2292),l=r(2401),h=Object.prototype.toString;function u(t){if(!(this instanceof u))return new u(t);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,e.windowBits);if(r!==o.Z_OK)throw new Error(a[r]);if(this.header=new l,i.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=s.string2buf(e.dictionary):"[object ArrayBuffer]"===h.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=i.inflateSetDictionary(this.strm,e.dictionary))!==o.Z_OK))throw new Error(a[r])}function p(t,e){var r=new u(e);if(r.push(t,!0),r.err)throw r.msg||a[r.err];return r.result}u.prototype.push=function(t,e){var r,a,c,l,u,p=this.strm,d=this.options.chunkSize,f=this.options.dictionary,g=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof t?p.input=s.binstring2buf(t):"[object ArrayBuffer]"===h.call(t)?p.input=new Uint8Array(t):p.input=t,p.next_in=0,p.avail_in=p.input.length;do{if(0===p.avail_out&&(p.output=new n.Buf8(d),p.next_out=0,p.avail_out=d),(r=i.inflate(p,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(r=i.inflateSetDictionary(this.strm,f)),r===o.Z_BUF_ERROR&&!0===g&&(r=o.Z_OK,g=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),this.ended=!0,!1;p.next_out&&(0!==p.avail_out&&r!==o.Z_STREAM_END&&(0!==p.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=s.utf8border(p.output,p.next_out),l=p.next_out-c,u=s.buf2string(p.output,c),p.next_out=l,p.avail_out=d-l,l&&n.arraySet(p.output,p.output,c,l,0),this.onData(u)):this.onData(n.shrinkBuf(p.output,p.next_out)))),0===p.avail_in&&0===p.avail_out&&(g=!0)}while((p.avail_in>0||0===p.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),p.avail_out=0,!0)},u.prototype.onData=function(t){this.chunks.push(t)},u.prototype.onEnd=function(t){t===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=u,e.inflate=p,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,p(t,e)},e.ungzip=p},4236:(t,e)=>{"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function i(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)i(r,n)&&(t[n]=r[n])}}return t},e.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var n={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray)t.set(e.subarray(r,r+i),n);else for(var s=0;s{"use strict";var i=r(4236),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(t){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){s=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function c(t,e){if(e<65534&&(t.subarray&&s||!t.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(t,e));for(var r="",o=0;o>>6,e[o++]=128|63&r):r<65536?(e[o++]=224|r>>>12,e[o++]=128|r>>>6&63,e[o++]=128|63&r):(e[o++]=240|r>>>18,e[o++]=128|r>>>12&63,e[o++]=128|r>>>6&63,e[o++]=128|63&r);return e},e.buf2binstring=function(t){return c(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)l[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r1?l[i++]=65533:n<65536?l[i++]=n:(n-=65536,l[i++]=55296|n>>10&1023,l[i++]=56320|1023&n)}return c(l,i)},e.utf8border=function(t,e){var r;for((e=e||t.length)>t.length&&(e=t.length),r=e-1;r>=0&&128==(192&t[r]);)r--;return r<0||0===r?e:r+o[t[r]]>e?r:e}},6069:t=>{"use strict";t.exports=function(t,e,r,i){for(var n=65535&t|0,s=t>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{s=s+(n=n+e[i++]|0)|0}while(--o);n%=65521,s%=65521}return n|s<<16|0}},1619:t=>{"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},2869:t=>{"use strict";var e=function(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[r]=t}return e}();t.exports=function(t,r,i,n){var s=e,o=n+i;t^=-1;for(var a=n;a>>8^s[255&(t^r[a])];return-1^t}},405:(t,e,r)=>{"use strict";var i,n=r(4236),s=r(342),o=r(6069),a=r(2869),c=r(8898),l=-2,h=258,u=262,p=103,d=113,f=666;function g(t,e){return t.msg=c[e],e}function m(t){return(t<<1)-(t>4?9:0)}function w(t){for(var e=t.length;--e>=0;)t[e]=0}function y(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),0!==r&&(n.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,0===e.pending&&(e.pending_out=0))}function b(t,e){s._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,y(t.strm)}function A(t,e){t.pending_buf[t.pending++]=e}function v(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function _(t,e){var r,i,n=t.max_chain_length,s=t.strstart,o=t.prev_length,a=t.nice_match,c=t.strstart>t.w_size-u?t.strstart-(t.w_size-u):0,l=t.window,p=t.w_mask,d=t.prev,f=t.strstart+h,g=l[s+o-1],m=l[s+o];t.prev_length>=t.good_match&&(n>>=2),a>t.lookahead&&(a=t.lookahead);do{if(l[(r=e)+o]===m&&l[r+o-1]===g&&l[r]===l[s]&&l[++r]===l[s+1]){s+=2,r++;do{}while(l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&l[++s]===l[++r]&&so){if(t.match_start=e,o=i,i>=a)break;g=l[s+o-1],m=l[s+o]}}}while((e=d[e&p])>c&&0!=--n);return o<=t.lookahead?o:t.lookahead}function E(t){var e,r,i,s,c,l,h,p,d,f,g=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=g+(g-u)){n.arraySet(t.window,t.window,g,g,0),t.match_start-=g,t.strstart-=g,t.block_start-=g,e=r=t.hash_size;do{i=t.head[--e],t.head[e]=i>=g?i-g:0}while(--r);e=r=g;do{i=t.prev[--e],t.prev[e]=i>=g?i-g:0}while(--r);s+=g}if(0===t.strm.avail_in)break;if(l=t.strm,h=t.window,p=t.strstart+t.lookahead,d=s,f=void 0,(f=l.avail_in)>d&&(f=d),r=0===f?0:(l.avail_in-=f,n.arraySet(h,l.input,l.next_in,f,p),1===l.state.wrap?l.adler=o(l.adler,h,f,p):2===l.state.wrap&&(l.adler=a(l.adler,h,f,p)),l.next_in+=f,l.total_in+=f,f),t.lookahead+=r,t.lookahead+t.insert>=3)for(c=t.strstart-t.insert,t.ins_h=t.window[c],t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3)if(i=s._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=s._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=(t.ins_h<15&&(a=2,i-=16),s<1||s>9||8!==r||i<8||i>15||e<0||e>9||o<0||o>4)return g(t,l);8===i&&(i=9);var c=new C;return t.state=c,c.strm=t,c.wrap=a,c.gzhead=null,c.w_bits=i,c.w_size=1<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(E(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,b(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-u&&(b(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(b(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(b(t,!1),t.strm.avail_out),1)})),new x(4,4,8,4,S),new x(4,5,16,8,S),new x(4,6,32,32,S),new x(4,4,16,16,T),new x(8,16,32,32,T),new x(8,16,128,128,T),new x(8,32,128,256,T),new x(32,128,258,1024,T),new x(32,258,258,4096,T)],e.deflateInit=function(t,e){return k(t,e,8,15,8,0)},e.deflateInit2=k,e.deflateReset=R,e.deflateResetKeep=I,e.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?l:(t.state.gzhead=e,0):l},e.deflate=function(t,e){var r,n,o,c;if(!t||!t.state||e>5||e<0)return t?g(t,l):l;if(n=t.state,!t.output||!t.input&&0!==t.avail_in||n.status===f&&4!==e)return g(t,0===t.avail_out?-5:l);if(n.strm=t,r=n.last_flush,n.last_flush=e,42===n.status)if(2===n.wrap)t.adler=0,A(n,31),A(n,139),A(n,8),n.gzhead?(A(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),A(n,255&n.gzhead.time),A(n,n.gzhead.time>>8&255),A(n,n.gzhead.time>>16&255),A(n,n.gzhead.time>>24&255),A(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),A(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(A(n,255&n.gzhead.extra.length),A(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(t.adler=a(t.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(A(n,0),A(n,0),A(n,0),A(n,0),A(n,0),A(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),A(n,3),n.status=d);else{var u=8+(n.w_bits-8<<4)<<8;u|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(u|=32),u+=31-u%31,n.status=d,v(n,u),0!==n.strstart&&(v(n,t.adler>>>16),v(n,65535&t.adler)),t.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),y(t),o=n.pending,n.pending!==n.pending_buf_size));)A(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),y(t),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindexo&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),y(t),o=n.pending,n.pending===n.pending_buf_size)){c=1;break}c=n.gzindexo&&(t.adler=a(t.adler,n.pending_buf,n.pending-o,o)),0===c&&(n.status=p)}else n.status=p;if(n.status===p&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&y(t),n.pending+2<=n.pending_buf_size&&(A(n,255&t.adler),A(n,t.adler>>8&255),t.adler=0,n.status=d)):n.status=d),0!==n.pending){if(y(t),0===t.avail_out)return n.last_flush=-1,0}else if(0===t.avail_in&&m(e)<=m(r)&&4!==e)return g(t,-5);if(n.status===f&&0!==t.avail_in)return g(t,-5);if(0!==t.avail_in||0!==n.lookahead||0!==e&&n.status!==f){var _=2===n.strategy?function(t,e){for(var r;;){if(0===t.lookahead&&(E(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,r=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(b(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(b(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(b(t,!1),0===t.strm.avail_out)?1:2}(n,e):3===n.strategy?function(t,e){for(var r,i,n,o,a=t.window;;){if(t.lookahead<=h){if(E(t),t.lookahead<=h&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(i=a[n=t.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=t.strstart+h;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(r=s._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=s._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(b(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(b(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(b(t,!1),0===t.strm.avail_out)?1:2}(n,e):i[n.level].func(n,e);if(3!==_&&4!==_||(n.status=f),1===_||3===_)return 0===t.avail_out&&(n.last_flush=-1),0;if(2===_&&(1===e?s._tr_align(n):5!==e&&(s._tr_stored_block(n,0,0,!1),3===e&&(w(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),y(t),0===t.avail_out))return n.last_flush=-1,0}return 4!==e?0:n.wrap<=0?1:(2===n.wrap?(A(n,255&t.adler),A(n,t.adler>>8&255),A(n,t.adler>>16&255),A(n,t.adler>>24&255),A(n,255&t.total_in),A(n,t.total_in>>8&255),A(n,t.total_in>>16&255),A(n,t.total_in>>24&255)):(v(n,t.adler>>>16),v(n,65535&t.adler)),y(t),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},e.deflateEnd=function(t){var e;return t&&t.state?42!==(e=t.state.status)&&69!==e&&73!==e&&91!==e&&e!==p&&e!==d&&e!==f?g(t,l):(t.state=null,e===d?g(t,-3):0):l},e.deflateSetDictionary=function(t,e){var r,i,s,a,c,h,u,p,d=e.length;if(!t||!t.state)return l;if(2===(a=(r=t.state).wrap)||1===a&&42!==r.status||r.lookahead)return l;for(1===a&&(t.adler=o(t.adler,e,d,0)),r.wrap=0,d>=r.w_size&&(0===a&&(w(r.head),r.strstart=0,r.block_start=0,r.insert=0),p=new n.Buf8(r.w_size),n.arraySet(p,e,d-r.w_size,r.w_size,0),e=p,d=r.w_size),c=t.avail_in,h=t.next_in,u=t.input,t.avail_in=d,t.next_in=0,t.input=e,E(r);r.lookahead>=3;){i=r.strstart,s=r.lookahead-2;do{r.ins_h=(r.ins_h<{"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},4264:t=>{"use strict";t.exports=function(t,e){var r,i,n,s,o,a,c,l,h,u,p,d,f,g,m,w,y,b,A,v,_,E,S,T,x;r=t.state,i=t.next_in,T=t.input,n=i+(t.avail_in-5),s=t.next_out,x=t.output,o=s-(e-t.avail_out),a=s+(t.avail_out-257),c=r.dmax,l=r.wsize,h=r.whave,u=r.wnext,p=r.window,d=r.hold,f=r.bits,g=r.lencode,m=r.distcode,w=(1<>>=A=b>>>24,f-=A,0===(A=b>>>16&255))x[s++]=65535&b;else{if(!(16&A)){if(0==(64&A)){b=g[(65535&b)+(d&(1<>>=A,f-=A),f<15&&(d+=T[i++]<>>=A=b>>>24,f-=A,!(16&(A=b>>>16&255))){if(0==(64&A)){b=m[(65535&b)+(d&(1<c){t.msg="invalid distance too far back",r.mode=30;break t}if(d>>>=A,f-=A,_>(A=s-o)){if((A=_-A)>h&&r.sane){t.msg="invalid distance too far back",r.mode=30;break t}if(E=0,S=p,0===u){if(E+=l-A,A2;)x[s++]=S[E++],x[s++]=S[E++],x[s++]=S[E++],v-=3;v&&(x[s++]=S[E++],v>1&&(x[s++]=S[E++]))}else{E=s-_;do{x[s++]=x[E++],x[s++]=x[E++],x[s++]=x[E++],v-=3}while(v>2);v&&(x[s++]=x[E++],v>1&&(x[s++]=x[E++]))}break}}break}}while(i>3,d&=(1<<(f-=v<<3))-1,t.next_in=i,t.next_out=s,t.avail_in=i{"use strict";var i=r(4236),n=r(6069),s=r(2869),o=r(4264),a=r(9241),c=-2,l=12,h=30;function u(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function p(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function d(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new i.Buf32(852),e.distcode=e.distdyn=new i.Buf32(592),e.sane=1,e.back=-1,0):c}function f(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,d(t)):c}function g(t,e){var r,i;return t&&t.state?(i=t.state,e<0?(r=0,e=-e):(r=1+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?c:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,f(t))):c}function m(t,e){var r,i;return t?(i=new p,t.state=i,i.window=null,0!==(r=g(t,e))&&(t.state=null),r):c}var w,y,b=!0;function A(t){if(b){var e;for(w=new i.Buf32(512),y=new i.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(a(1,t.lens,0,288,w,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;a(2,t.lens,0,32,y,0,t.work,{bits:5}),b=!1}t.lencode=w,t.lenbits=9,t.distcode=y,t.distbits=5}function v(t,e,r,n){var s,o=t.state;return null===o.window&&(o.wsize=1<=o.wsize?(i.arraySet(o.window,e,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((s=o.wsize-o.wnext)>n&&(s=n),i.arraySet(o.window,e,r-n,s,o.wnext),(n-=s)?(i.arraySet(o.window,e,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,r.check=s(r.check,M,2,0),y=0,b=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&y)<<8)+(y>>8))%31){t.msg="incorrect header check",r.mode=h;break}if(8!=(15&y)){t.msg="unknown compression method",r.mode=h;break}if(b-=4,B=8+(15&(y>>>=4)),0===r.wbits)r.wbits=B;else if(B>r.wbits){t.msg="invalid window size",r.mode=h;break}r.dmax=1<>8&1),512&r.flags&&(M[0]=255&y,M[1]=y>>>8&255,r.check=s(r.check,M,2,0)),y=0,b=0,r.mode=3;case 3:for(;b<32;){if(0===m)break t;m--,y+=p[f++]<>>8&255,M[2]=y>>>16&255,M[3]=y>>>24&255,r.check=s(r.check,M,4,0)),y=0,b=0,r.mode=4;case 4:for(;b<16;){if(0===m)break t;m--,y+=p[f++]<>8),512&r.flags&&(M[0]=255&y,M[1]=y>>>8&255,r.check=s(r.check,M,2,0)),y=0,b=0,r.mode=5;case 5:if(1024&r.flags){for(;b<16;){if(0===m)break t;m--,y+=p[f++]<>>8&255,r.check=s(r.check,M,2,0)),y=0,b=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((S=r.length)>m&&(S=m),S&&(r.head&&(B=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,p,f,S,B)),512&r.flags&&(r.check=s(r.check,p,S,f)),m-=S,f+=S,r.length-=S),r.length))break t;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===m)break t;S=0;do{B=p[f+S++],r.head&&B&&r.length<65536&&(r.head.name+=String.fromCharCode(B))}while(B&&S>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=l;break;case 10:for(;b<32;){if(0===m)break t;m--,y+=p[f++]<>>=7&b,b-=7&b,r.mode=27;break}for(;b<3;){if(0===m)break t;m--,y+=p[f++]<>>=1)){case 0:r.mode=14;break;case 1:if(A(r),r.mode=20,6===e){y>>>=2,b-=2;break t}break;case 2:r.mode=17;break;case 3:t.msg="invalid block type",r.mode=h}y>>>=2,b-=2;break;case 14:for(y>>>=7&b,b-=7&b;b<32;){if(0===m)break t;m--,y+=p[f++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=h;break}if(r.length=65535&y,y=0,b=0,r.mode=15,6===e)break t;case 15:r.mode=16;case 16:if(S=r.length){if(S>m&&(S=m),S>w&&(S=w),0===S)break t;i.arraySet(d,p,f,S,g),m-=S,f+=S,w-=S,g+=S,r.length-=S;break}r.mode=l;break;case 17:for(;b<14;){if(0===m)break t;m--,y+=p[f++]<>>=5,b-=5,r.ndist=1+(31&y),y>>>=5,b-=5,r.ncode=4+(15&y),y>>>=4,b-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=h;break}r.have=0,r.mode=18;case 18:for(;r.have>>=3,b-=3}for(;r.have<19;)r.lens[F[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,L={bits:r.lenbits},P=a(0,r.lens,0,19,r.lencode,0,r.work,L),r.lenbits=L.bits,P){t.msg="invalid code lengths set",r.mode=h;break}r.have=0,r.mode=19;case 19:for(;r.have>>16&255,R=65535&U,!((C=U>>>24)<=b);){if(0===m)break t;m--,y+=p[f++]<>>=C,b-=C,r.lens[r.have++]=R;else{if(16===R){for(D=C+2;b>>=C,b-=C,0===r.have){t.msg="invalid bit length repeat",r.mode=h;break}B=r.lens[r.have-1],S=3+(3&y),y>>>=2,b-=2}else if(17===R){for(D=C+3;b>>=C)),y>>>=3,b-=3}else{for(D=C+7;b>>=C)),y>>>=7,b-=7}if(r.have+S>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=h;break}for(;S--;)r.lens[r.have++]=B}}if(r.mode===h)break;if(0===r.lens[256]){t.msg="invalid code -- missing end-of-block",r.mode=h;break}if(r.lenbits=9,L={bits:r.lenbits},P=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,L),r.lenbits=L.bits,P){t.msg="invalid literal/lengths set",r.mode=h;break}if(r.distbits=6,r.distcode=r.distdyn,L={bits:r.distbits},P=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,L),r.distbits=L.bits,P){t.msg="invalid distances set",r.mode=h;break}if(r.mode=20,6===e)break t;case 20:r.mode=21;case 21:if(m>=6&&w>=258){t.next_out=g,t.avail_out=w,t.next_in=f,t.avail_in=m,r.hold=y,r.bits=b,o(t,E),g=t.next_out,d=t.output,w=t.avail_out,f=t.next_in,p=t.input,m=t.avail_in,y=r.hold,b=r.bits,r.mode===l&&(r.back=-1);break}for(r.back=0;I=(U=r.lencode[y&(1<>>16&255,R=65535&U,!((C=U>>>24)<=b);){if(0===m)break t;m--,y+=p[f++]<>k)])>>>16&255,R=65535&U,!(k+(C=U>>>24)<=b);){if(0===m)break t;m--,y+=p[f++]<>>=k,b-=k,r.back+=k}if(y>>>=C,b-=C,r.back+=C,r.length=R,0===I){r.mode=26;break}if(32&I){r.back=-1,r.mode=l;break}if(64&I){t.msg="invalid literal/length code",r.mode=h;break}r.extra=15&I,r.mode=22;case 22:if(r.extra){for(D=r.extra;b>>=r.extra,b-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;I=(U=r.distcode[y&(1<>>16&255,R=65535&U,!((C=U>>>24)<=b);){if(0===m)break t;m--,y+=p[f++]<>k)])>>>16&255,R=65535&U,!(k+(C=U>>>24)<=b);){if(0===m)break t;m--,y+=p[f++]<>>=k,b-=k,r.back+=k}if(y>>>=C,b-=C,r.back+=C,64&I){t.msg="invalid distance code",r.mode=h;break}r.offset=R,r.extra=15&I,r.mode=24;case 24:if(r.extra){for(D=r.extra;b>>=r.extra,b-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=h;break}r.mode=25;case 25:if(0===w)break t;if(S=E-w,r.offset>S){if((S=r.offset-S)>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=h;break}S>r.wnext?(S-=r.wnext,T=r.wsize-S):T=r.wnext-S,S>r.length&&(S=r.length),x=r.window}else x=d,T=g-r.offset,S=r.length;S>w&&(S=w),w-=S,r.length-=S;do{d[g++]=x[T++]}while(--S);0===r.length&&(r.mode=21);break;case 26:if(0===w)break t;d[g++]=r.length,w--,r.mode=21;break;case 27:if(r.wrap){for(;b<32;){if(0===m)break t;m--,y|=p[f++]<{"use strict";var i=r(4236),n=15,s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],o=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],a=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],c=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(t,e,r,l,h,u,p,d){var f,g,m,w,y,b,A,v,_,E=d.bits,S=0,T=0,x=0,C=0,I=0,R=0,k=0,N=0,O=0,B=0,P=null,L=0,D=new i.Buf16(16),U=new i.Buf16(16),M=null,F=0;for(S=0;S<=n;S++)D[S]=0;for(T=0;T=1&&0===D[C];C--);if(I>C&&(I=C),0===C)return h[u++]=20971520,h[u++]=20971520,d.bits=1,0;for(x=1;x0&&(0===t||1!==C))return-1;for(U[1]=0,S=1;S852||2===t&&O>592)return 1;for(;;){A=S-k,p[T]b?(v=M[F+p[T]],_=P[L+p[T]]):(v=96,_=0),f=1<>k)+(g-=f)]=A<<24|v<<16|_|0}while(0!==g);for(f=1<>=1;if(0!==f?(B&=f-1,B+=f):B=0,T++,0==--D[S]){if(S===C)break;S=e[r+p[T]]}if(S>I&&(B&w)!==m){for(0===k&&(k=I),y+=x,N=1<<(R=S-k);R+k852||2===t&&O>592)return 1;h[m=B&w]=I<<24|R<<16|y-u|0}}return 0!==B&&(h[y+B]=S-k<<24|64<<16|0),d.bits=I,0}},8898:t=>{"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},342:(t,e,r)=>{"use strict";var i=r(4236);function n(t){for(var e=t.length;--e>=0;)t[e]=0}var s=256,o=286,a=30,c=15,l=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],h=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],p=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],d=new Array(576);n(d);var f=new Array(60);n(f);var g=new Array(512);n(g);var m=new Array(256);n(m);var w=new Array(29);n(w);var y,b,A,v=new Array(a);function _(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}function E(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function S(t){return t<256?g[t]:g[256+(t>>>7)]}function T(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function x(t,e,r){t.bi_valid>16-r?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=r-16):(t.bi_buf|=e<>>=1,r<<=1}while(--e>0);return r>>>1}function R(t,e,r){var i,n,s=new Array(16),o=0;for(i=1;i<=c;i++)s[i]=o=o+r[i-1]<<1;for(n=0;n<=e;n++){var a=t[2*n+1];0!==a&&(t[2*n]=I(s[a]++,a))}}function k(t){var e;for(e=0;e8?T(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function O(t,e,r,i){var n=2*e,s=2*r;return t[n]>1;r>=1;r--)B(t,s,r);n=l;do{r=t.heap[1],t.heap[1]=t.heap[t.heap_len--],B(t,s,1),i=t.heap[1],t.heap[--t.heap_max]=r,t.heap[--t.heap_max]=i,s[2*n]=s[2*r]+s[2*i],t.depth[n]=(t.depth[r]>=t.depth[i]?t.depth[r]:t.depth[i])+1,s[2*r+1]=s[2*i+1]=n,t.heap[1]=n++,B(t,s,1)}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var r,i,n,s,o,a,l=e.dyn_tree,h=e.max_code,u=e.stat_desc.static_tree,p=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,g=e.stat_desc.max_length,m=0;for(s=0;s<=c;s++)t.bl_count[s]=0;for(l[2*t.heap[t.heap_max]+1]=0,r=t.heap_max+1;r<573;r++)(s=l[2*l[2*(i=t.heap[r])+1]+1]+1)>g&&(s=g,m++),l[2*i+1]=s,i>h||(t.bl_count[s]++,o=0,i>=f&&(o=d[i-f]),a=l[2*i],t.opt_len+=a*(s+o),p&&(t.static_len+=a*(u[2*i+1]+o)));if(0!==m){do{for(s=g-1;0===t.bl_count[s];)s--;t.bl_count[s]--,t.bl_count[s+1]+=2,t.bl_count[g]--,m-=2}while(m>0);for(s=g;0!==s;s--)for(i=t.bl_count[s];0!==i;)(n=t.heap[--r])>h||(l[2*n+1]!==s&&(t.opt_len+=(s-l[2*n+1])*l[2*n],l[2*n+1]=s),i--)}}(t,e),R(s,h,t.bl_count)}function D(t,e,r){var i,n,s=-1,o=e[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),e[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=e[2*(i+1)+1],++a>=7;i0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,r=4093624447;for(e=0;e<=31;e++,r>>>=1)if(1&r&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e=3&&0===t.bl_tree[2*p[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}(t),n=t.opt_len+3+7>>>3,(o=t.static_len+3+7>>>3)<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==e?F(t,e,r,i):4===t.strategy||o===n?(x(t,2+(i?1:0),3),P(t,d,f)):(x(t,4+(i?1:0),3),function(t,e,r,i){var n;for(x(t,e-257,5),x(t,r-1,5),x(t,i-4,4),n=0;n>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&r,t.last_lit++,0===e?t.dyn_ltree[2*r]++:(t.matches++,e--,t.dyn_ltree[2*(m[r]+s+1)]++,t.dyn_dtree[2*S(e)]++),t.last_lit===t.lit_bufsize-1},e._tr_align=function(t){x(t,2,3),C(t,256,d),function(t){16===t.bi_valid?(T(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(t)}},2292:t=>{"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},4155:t=>{var e,r,i=t.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===n||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:n}catch(t){e=n}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var a,c=[],l=!1,h=-1;function u(){l&&a&&(l=!1,a.length?c=a.concat(c):h=-1,c.length&&p())}function p(){if(!l){var t=o(u);l=!0;for(var e=c.length;e;){for(a=c,c=[];++h1)for(var r=1;r{"use strict";class r{static isArrayBuffer(t){return"[object ArrayBuffer]"===Object.prototype.toString.call(t)}static toArrayBuffer(t){return this.isArrayBuffer(t)?t:t.byteLength===t.buffer.byteLength?t.buffer:this.toUint8Array(t).slice().buffer}static toUint8Array(t){return this.toView(t,Uint8Array)}static toView(t,e){if(t.constructor===e)return t;if(this.isArrayBuffer(t))return new e(t);if(this.isArrayBufferView(t))return new e(t.buffer,t.byteOffset,t.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(t){return this.isArrayBufferView(t)||this.isArrayBuffer(t)}static isArrayBufferView(t){return ArrayBuffer.isView(t)||t&&this.isArrayBuffer(t.buffer)}static isEqual(t,e){const i=r.toUint8Array(t),n=r.toUint8Array(e);if(i.length!==n.byteLength)return!1;for(let t=0;tt.byteLength)).reduce(((t,e)=>t+e)),r=new Uint8Array(e);let i=0;return t.map((t=>new Uint8Array(t))).forEach((t=>{for(const e of t)r[i++]=e})),r.buffer},e.Xy=function(t,e){if(!t||!e)return!1;if(t.byteLength!==e.byteLength)return!1;const r=new Uint8Array(t),i=new Uint8Array(e);for(let e=0;e{"use strict";r.d(e,{Z:()=>i});const i="/**\n * Mini wombat for performing URL rewriting within the\n * Web/Shared/Service Worker context\n * @param {Object} info\n * @return {WBWombat}\n */\nfunction WBWombat(info) {\n if (!(this instanceof WBWombat)) return new WBWombat(info);\n /** @type {Object} */\n this.info = info;\n this.initImportScriptsRewrite();\n this.initHTTPOverrides();\n this.initClientApisOverride();\n this.initCacheApisOverride();\n}\n\n/**\n * Returns T/F indicating if the supplied URL is not to be rewritten\n * @param {string} url\n * @return {boolean}\n */\nWBWombat.prototype.noRewrite = function(url) {\n return (\n !url ||\n url.indexOf('blob:') === 0 ||\n url.indexOf('javascript:') === 0 ||\n url.indexOf('data:') === 0 ||\n url.indexOf(this.info.prefix) === 0\n );\n};\n\n/**\n * Returns T/F indicating if the supplied URL is an relative URL\n * @param {string} url\n * @return {boolean}\n */\nWBWombat.prototype.isRelURL = function(url) {\n return url.indexOf('/') === 0 || url.indexOf('http:') !== 0;\n};\n\n/**\n * Attempts to resolve the supplied relative URL against\n * the origin this worker was created on\n * @param {string} maybeRelURL\n * @param {string} against\n * @return {string}\n */\nWBWombat.prototype.maybeResolveURL = function(maybeRelURL, against) {\n if (!against) return maybeRelURL;\n try {\n var resolved = new URL(maybeRelURL, against);\n return resolved.href;\n } catch (e) {}\n return maybeRelURL;\n};\n\n/**\n * Returns null to indicate that the supplied URL is not to be rewritten.\n * Otherwise returns a URL that can be rewritten\n * @param {*} url\n * @param {string} resolveAgainst\n * @return {?string}\n */\nWBWombat.prototype.ensureURL = function(url, resolveAgainst) {\n if (!url) return url;\n var newURL;\n switch (typeof url) {\n case 'string':\n newURL = url;\n break;\n case 'object':\n newURL = url.toString();\n break;\n default:\n return null;\n }\n if (this.noRewrite(newURL)) return null;\n if (this.isRelURL(newURL)) {\n return this.maybeResolveURL(newURL, resolveAgainst);\n }\n\n // if url starts with current origin, but not properly rewritten, rewrite against current baseUr\n if (newURL.indexOf(self.location.origin) === 0) {\n return this.maybeResolveURL(newURL.slice(self.location.origin.length), resolveAgainst);\n }\n return newURL;\n};\n\n/**\n * Rewrites the supplied URL\n * @param {string} url\n * @return {string}\n */\nWBWombat.prototype.rewriteURL = function(url) {\n var rwURL = this.ensureURL(url, this.info.originalURL);\n if (!rwURL) return url;\n if (this.info.prefixMod) {\n return this.info.prefixMod + rwURL;\n }\n return rwURL;\n};\n\n/**\n * Rewrites the supplied URL of an controlled page using the mp\\_ modifier\n * @param {string} url\n * @param {WindowClient} [client]\n * @return {string}\n */\nWBWombat.prototype.rewriteClientWindowURL = function(url, client) {\n var rwURL = this.ensureURL(url, client ? client.url : this.info.originalURL);\n if (!rwURL) return url;\n if (this.info.prefix) {\n return this.info.prefix + 'mp_/' + rwURL;\n }\n return rwURL;\n};\n\n/**\n * Mini url rewriter specifically for rewriting web sockets\n * @param {?string} originalURL\n * @return {string}\n */\nWBWombat.prototype.rewriteWSURL = function(originalURL) {\n // If undefined, just return it\n if (!originalURL) return originalURL;\n\n var urltype_ = typeof originalURL;\n var url = originalURL;\n\n // If object, use toString\n if (urltype_ === 'object') {\n url = originalURL.toString();\n } else if (urltype_ !== 'string') {\n return originalURL;\n }\n\n // empty string check\n if (!url) return url;\n\n var wsScheme = 'ws://';\n var wssScheme = 'wss://';\n var https = 'https://';\n\n var wbSecure = this.info.prefix.indexOf(https) === 0;\n var wbPrefix =\n this.info.prefix.replace(\n wbSecure ? https : 'http://',\n wbSecure ? wssScheme : wsScheme\n ) + 'ws_/';\n return wbPrefix + url;\n};\n\n/**\n * Rewrites all URLs in the supplied arguments object\n * @param {Object} argsObj\n * @return {Array}\n */\nWBWombat.prototype.rewriteArgs = function(argsObj) {\n // recreate the original arguments object just with URLs rewritten\n var newArgObj = new Array(argsObj.length);\n for (var i = 0; i < newArgObj.length; i++) {\n newArgObj[i] = this.rewriteURL(argsObj[i]);\n }\n return newArgObj;\n};\n\n/**\n * Rewrites the input to one of the Fetch APIs\n * @param {*|string|Request} input\n * @return {*|string|Request}\n */\nWBWombat.prototype.rewriteFetchApi = function(input) {\n var rwInput = input;\n switch (typeof input) {\n case 'string':\n rwInput = this.rewriteURL(input);\n break;\n case 'object':\n if (input.url) {\n var new_url = this.rewriteURL(input.url);\n if (new_url !== input.url) {\n // not much we can do here Request.url is read only\n // https://developer.mozilla.org/en-US/docs/Web/API/Request/url\n rwInput = new Request(new_url, input);\n }\n } else if (input.href) {\n // it is likely that input is either self.location or self.URL\n // we cant do anything here so just let it go\n rwInput = input.href;\n }\n break;\n }\n return rwInput;\n};\n\n/**\n * Rewrites the input to one of the Cache APIs\n * @param {*|string|Request} request\n * @return {*|string|Request}\n */\nWBWombat.prototype.rewriteCacheApi = function(request) {\n var rwRequest = request;\n if (typeof request === 'string') {\n rwRequest = this.rewriteURL(request);\n }\n return rwRequest;\n};\n\n/**\n * Applies an override to the importScripts function\n * @see https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts\n */\nWBWombat.prototype.initImportScriptsRewrite = function() {\n if (!self.importScripts) return;\n var wombat = this;\n var origImportScripts = self.importScripts;\n self.importScripts = function importScripts() {\n // rewrite the arguments object and call original function via fn.apply\n var rwArgs = wombat.rewriteArgs(arguments);\n return origImportScripts.apply(this, rwArgs);\n };\n};\n\n/**\n * Applies overrides to the XMLHttpRequest.open and XMLHttpRequest.responseURL\n * in order to ensure URLs are rewritten.\n *\n * Applies an override to window.fetch in order to rewrite URLs and URLs of\n * the supplied Request objects used as arguments to fetch.\n *\n * Applies overrides to window.Request, window.Response, window.EventSource,\n * and window.WebSocket in order to ensure URLs they operate on are rewritten.\n *\n * @see https://xhr.spec.whatwg.org/\n * @see https://fetch.spec.whatwg.org/\n * @see https://html.spec.whatwg.org/multipage/web-sockets.html#websocket\n * @see https://html.spec.whatwg.org/multipage/server-sent-events.html#the-eventsource-interface\n */\nWBWombat.prototype.initHTTPOverrides = function() {\n var wombat = this;\n if (\n self.XMLHttpRequest &&\n self.XMLHttpRequest.prototype &&\n self.XMLHttpRequest.prototype.open\n ) {\n var oXHROpen = self.XMLHttpRequest.prototype.open;\n self.XMLHttpRequest.prototype.open = function open(\n method,\n url,\n async,\n user,\n password\n ) {\n var rwURL = wombat.rewriteURL(url);\n var openAsync = true;\n if (async != null && !async) openAsync = false;\n oXHROpen.call(this, method, rwURL, openAsync, user, password);\n if (rwURL.indexOf('data:') === -1) {\n this.setRequestHeader('X-Pywb-Requested-With', 'XMLHttpRequest');\n }\n };\n }\n\n if (self.fetch != null) {\n // this fetch is Worker.fetch\n var orig_fetch = self.fetch;\n self.fetch = function fetch(input, init_opts) {\n var rwInput = wombat.rewriteFetchApi(input);\n var newInitOpts = init_opts || {};\n newInitOpts['credentials'] = 'include';\n return orig_fetch.call(this, rwInput, newInitOpts);\n };\n }\n\n if (self.Request && self.Request.prototype) {\n var orig_request = self.Request;\n self.Request = (function(Request_) {\n return function Request(input, init_opts) {\n var newInitOpts = init_opts || {};\n var newInput = wombat.rewriteFetchApi(input);\n newInitOpts['credentials'] = 'include';\n return new Request_(newInput, newInitOpts);\n };\n })(self.Request);\n self.Request.prototype = orig_request.prototype;\n }\n\n if (self.Response && self.Response.prototype) {\n var originalRedirect = self.Response.prototype.redirect;\n self.Response.prototype.redirect = function redirect(url, status) {\n var rwURL = wombat.rewriteUrl(url);\n return originalRedirect.call(this, rwURL, status);\n };\n }\n\n if (self.EventSource && self.EventSource.prototype) {\n var origEventSource = self.EventSource;\n self.EventSource = (function(EventSource_) {\n return function EventSource(url, configuration) {\n var rwURL = url;\n if (url != null) {\n rwURL = wombat.rewriteUrl(url);\n }\n return new EventSource_(rwURL, configuration);\n };\n })(self.EventSource);\n self.EventSource.prototype = origEventSource.prototype;\n Object.defineProperty(self.EventSource.prototype, 'constructor', {\n value: self.EventSource\n });\n }\n\n if (self.WebSocket && self.WebSocket.prototype) {\n var origWebSocket = self.WebSocket;\n self.WebSocket = (function(WebSocket_) {\n return function WebSocket(url, configuration) {\n var rwURL = url;\n if (url != null) {\n rwURL = wombat.rewriteWSURL(url);\n }\n return new WebSocket_(rwURL, configuration);\n };\n })(self.WebSocket);\n self.WebSocket.prototype = origWebSocket.prototype;\n Object.defineProperty(self.WebSocket.prototype, 'constructor', {\n value: self.WebSocket\n });\n }\n};\n\n/**\n * Applies an override to Clients.openWindow and WindowClient.navigate that rewrites\n * the supplied URL that represents a controlled window\n * @see https://w3c.github.io/ServiceWorker/#window-client-interface\n * @see https://w3c.github.io/ServiceWorker/#clients-interface\n */\nWBWombat.prototype.initClientApisOverride = function() {\n var wombat = this;\n if (\n self.Clients &&\n self.Clients.prototype &&\n self.Clients.prototype.openWindow\n ) {\n var oClientsOpenWindow = self.Clients.prototype.openWindow;\n self.Clients.prototype.openWindow = function openWindow(url) {\n var rwURL = wombat.rewriteClientWindowURL(url);\n return oClientsOpenWindow.call(this, rwURL);\n };\n }\n\n if (\n self.WindowClient &&\n self.WindowClient.prototype &&\n self.WindowClient.prototype.navigate\n ) {\n var oWinClientNavigate = self.WindowClient.prototype.navigate;\n self.WindowClient.prototype.navigate = function navigate(url) {\n var rwURL = wombat.rewriteClientWindowURL(url, this);\n return oWinClientNavigate.call(this, rwURL);\n };\n }\n};\n\n/**\n * Applies overrides to the CacheStorage and Cache interfaces in order\n * to rewrite the URLs they operate on\n * @see https://w3c.github.io/ServiceWorker/#cachestorage\n * @see https://w3c.github.io/ServiceWorker/#cache-interface\n */\nWBWombat.prototype.initCacheApisOverride = function() {\n var wombat = this;\n if (\n self.CacheStorage &&\n self.CacheStorage.prototype &&\n self.CacheStorage.prototype.match\n ) {\n var oCacheStorageMatch = self.CacheStorage.prototype.match;\n self.CacheStorage.prototype.match = function match(request, options) {\n var rwRequest = wombat.rewriteCacheApi(request);\n return oCacheStorageMatch.call(this, rwRequest, options);\n };\n }\n\n if (self.Cache && self.Cache.prototype) {\n if (self.Cache.prototype.match) {\n var oCacheMatch = self.Cache.prototype.match;\n self.Cache.prototype.match = function match(request, options) {\n var rwRequest = wombat.rewriteCacheApi(request);\n return oCacheMatch.call(this, rwRequest, options);\n };\n }\n\n if (self.Cache.prototype.matchAll) {\n var oCacheMatchAll = self.Cache.prototype.matchAll;\n self.Cache.prototype.matchAll = function matchAll(request, options) {\n var rwRequest = wombat.rewriteCacheApi(request);\n return oCacheMatchAll.call(this, rwRequest, options);\n };\n }\n\n if (self.Cache.prototype.add) {\n var oCacheAdd = self.Cache.prototype.add;\n self.Cache.prototype.add = function add(request, options) {\n var rwRequest = wombat.rewriteCacheApi(request);\n return oCacheAdd.call(this, rwRequest, options);\n };\n }\n\n if (self.Cache.prototype.addAll) {\n var oCacheAddAll = self.Cache.prototype.addAll;\n self.Cache.prototype.addAll = function addAll(requests) {\n var rwRequests = requests;\n if (Array.isArray(requests)) {\n rwRequests = new Array(requests.length);\n for (var i = 0; i < requests.length; i++) {\n rwRequests[i] = wombat.rewriteCacheApi(requests[i]);\n }\n }\n return oCacheAddAll.call(this, rwRequests);\n };\n }\n\n if (self.Cache.prototype.put) {\n var oCachePut = self.Cache.prototype.put;\n self.Cache.prototype.put = function put(request, response) {\n var rwRequest = wombat.rewriteCacheApi(request);\n return oCachePut.call(this, rwRequest, response);\n };\n }\n\n if (self.Cache.prototype.delete) {\n var oCacheDelete = self.Cache.prototype.delete;\n self.Cache.prototype.delete = function newCacheDelete(request, options) {\n var rwRequest = wombat.rewriteCacheApi(request);\n return oCacheDelete.call(this, rwRequest, options);\n };\n }\n\n if (self.Cache.prototype.keys) {\n var oCacheKeys = self.Cache.prototype.keys;\n self.Cache.prototype.keys = function keys(request, options) {\n var rwRequest = wombat.rewriteCacheApi(request);\n return oCacheKeys.call(this, rwRequest, options);\n };\n }\n }\n};\n\nself.WBWombat = WBWombat;\n"},4281:t=>{"use strict";var e={};function r(t,r,i){i||(i=Error);var n=function(t){var e,i;function n(e,i,n){return t.call(this,function(t,e,i){return"string"==typeof r?r:r(t,e,i)}(e,i,n))||this}return i=t,(e=n).prototype=Object.create(i.prototype),e.prototype.constructor=e,e.__proto__=i,n}(i);n.prototype.name=i.name,n.prototype.code=t,e[t]=n}function i(t,e){if(Array.isArray(t)){var r=t.length;return t=t.map((function(t){return String(t)})),r>2?"one of ".concat(e," ").concat(t.slice(0,r-1).join(", "),", or ")+t[r-1]:2===r?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,r){var n,s,o,a;if("string"==typeof e&&(s="not ",e.substr(!o||o<0?0:+o,s.length)===s)?(n="must not be",e=e.replace(/^not /,"")):n="must be",function(t,e,r){return(void 0===r||r>t.length)&&(r=t.length),t.substring(r-e.length,r)===e}(t," argument"))a="The ".concat(t," ").concat(n," ").concat(i(e,"type"));else{var c=function(t,e,r){return"number"!=typeof r&&(r=0),!(r+e.length>t.length)&&-1!==t.indexOf(e,r)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(c," ").concat(n," ").concat(i(e,"type"))}return a+=". Received type ".concat(typeof r)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.q=e},6753:(t,e,r)=>{"use strict";var i=r(4155),n=Object.keys||function(t){var e=[];for(var r in t)e.push(r);return e};t.exports=h;var s=r(9481),o=r(4229);r(5717)(h,s);for(var a=n(o.prototype),c=0;c{"use strict";t.exports=n;var i=r(4605);function n(t){if(!(this instanceof n))return new n(t);i.call(this,t)}r(5717)(n,i),n.prototype._transform=function(t,e,r){r(null,t)}},9481:(t,e,r)=>{"use strict";var i,n=r(4155);t.exports=T,T.ReadableState=S;r(7187).EventEmitter;var s=function(t,e){return t.listeners(e).length},o=r(2503),a=r(8764).Buffer,c=r.g.Uint8Array||function(){};var l,h=r(4616);l=h&&h.debuglog?h.debuglog("stream"):function(){};var u,p,d,f=r(7327),g=r(1195),m=r(2457).getHighWaterMark,w=r(4281).q,y=w.ERR_INVALID_ARG_TYPE,b=w.ERR_STREAM_PUSH_AFTER_EOF,A=w.ERR_METHOD_NOT_IMPLEMENTED,v=w.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;r(5717)(T,o);var _=g.errorOrDestroy,E=["error","close","destroy","pause","resume"];function S(t,e,n){i=i||r(6753),t=t||{},"boolean"!=typeof n&&(n=e instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",n),this.buffer=new f,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(u||(u=r(2553).s),this.decoder=new u(t.encoding),this.encoding=t.encoding)}function T(t){if(i=i||r(6753),!(this instanceof T))return new T(t);var e=this instanceof i;this._readableState=new S(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function x(t,e,r,i,n){l("readableAddChunk",e);var s,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(l("onEofChunk"),e.ended)return;if(e.decoder){var r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?k(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,N(t)))}(t,o);else if(n||(s=function(t,e){var r;i=e,a.isBuffer(i)||i instanceof c||"string"==typeof e||void 0===e||t.objectMode||(r=new y("chunk",["string","Buffer","Uint8Array"],e));var i;return r}(o,e)),s)_(t,s);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===a.prototype||(e=function(t){return a.from(t)}(e)),i)o.endEmitted?_(t,new v):C(t,o,e,!0);else if(o.ended)_(t,new b);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?C(t,o,e,!1):O(t,o)):C(t,o,e,!1)}else i||(o.reading=!1,O(t,o));return!o.ended&&(o.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=I?t=I:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function k(t){var e=t._readableState;l("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,n.nextTick(N,t))}function N(t){var e=t._readableState;l("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,U(t)}function O(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(B,t,e))}function B(t,e){for(;!e.reading&&!e.ended&&(e.length0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function L(t){l("readable nexttick read 0"),t.read(0)}function D(t,e){l("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),U(t),e.flowing&&!e.reading&&t.read(0)}function U(t){var e=t._readableState;for(l("flow",e.flowing);e.flowing&&null!==t.read(););}function M(t,e){return 0===e.length?null:(e.objectMode?r=e.buffer.shift():!t||t>=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r);var r}function F(t){var e=t._readableState;l("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,n.nextTick(H,e,t))}function H(t,e){if(l("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var r=e._writableState;(!r||r.autoDestroy&&r.finished)&&e.destroy()}}function W(t,e){for(var r=0,i=t.length;r=e.highWaterMark:e.length>0)||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?F(this):k(this),null;if(0===(t=R(t,e))&&e.ended)return 0===e.length&&F(this),null;var i,n=e.needReadable;return l("need readable",n),(0===e.length||e.length-t0?M(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&F(this)),null!==i&&this.emit("data",i),i},T.prototype._read=function(t){_(this,new A("_read()"))},T.prototype.pipe=function(t,e){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=t;break;case 1:i.pipes=[i.pipes,t];break;default:i.pipes.push(t)}i.pipesCount+=1,l("pipe count=%d opts=%j",i.pipesCount,e);var o=(!e||!1!==e.end)&&t!==n.stdout&&t!==n.stderr?c:m;function a(e,n){l("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,l("cleanup"),t.removeListener("close",f),t.removeListener("finish",g),t.removeListener("drain",h),t.removeListener("error",d),t.removeListener("unpipe",a),r.removeListener("end",c),r.removeListener("end",m),r.removeListener("data",p),u=!0,!i.awaitDrain||t._writableState&&!t._writableState.needDrain||h())}function c(){l("onend"),t.end()}i.endEmitted?n.nextTick(o):r.once("end",o),t.on("unpipe",a);var h=function(t){return function(){var e=t._readableState;l("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&s(t,"data")&&(e.flowing=!0,U(t))}}(r);t.on("drain",h);var u=!1;function p(e){l("ondata");var n=t.write(e);l("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===t||i.pipesCount>1&&-1!==W(i.pipes,t))&&!u&&(l("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function d(e){l("onerror",e),m(),t.removeListener("error",d),0===s(t,"error")&&_(t,e)}function f(){t.removeListener("finish",g),m()}function g(){l("onfinish"),t.removeListener("close",f),m()}function m(){l("unpipe"),r.unpipe(t)}return r.on("data",p),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",d),t.once("close",f),t.once("finish",g),t.emit("pipe",r),i.flowing||(l("pipe resume"),r.resume()),t},T.prototype.unpipe=function(t){var e=this._readableState,r={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,r)),this;if(!t){var i=e.pipes,n=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,l("on readable",i.length,i.reading),i.length?k(this):i.reading||n.nextTick(L,this))),r},T.prototype.addListener=T.prototype.on,T.prototype.removeListener=function(t,e){var r=o.prototype.removeListener.call(this,t,e);return"readable"===t&&n.nextTick(P,this),r},T.prototype.removeAllListeners=function(t){var e=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||n.nextTick(P,this),e},T.prototype.resume=function(){var t=this._readableState;return t.flowing||(l("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,n.nextTick(D,t,e))}(this,t)),t.paused=!1,this},T.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},T.prototype.wrap=function(t){var e=this,r=this._readableState,i=!1;for(var n in t.on("end",(function(){if(l("wrapped end"),r.decoder&&!r.ended){var t=r.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(n){(l("wrapped data"),r.decoder&&(n=r.decoder.write(n)),r.objectMode&&null==n)||(r.objectMode||n&&n.length)&&(e.push(n)||(i=!0,t.pause()))})),t)void 0===this[n]&&"function"==typeof t[n]&&(this[n]=function(e){return function(){return t[e].apply(t,arguments)}}(n));for(var s=0;s{"use strict";t.exports=h;var i=r(4281).q,n=i.ERR_METHOD_NOT_IMPLEMENTED,s=i.ERR_MULTIPLE_CALLBACK,o=i.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=i.ERR_TRANSFORM_WITH_LENGTH_0,c=r(6753);function l(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new s);r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length{"use strict";var i,n=r(4155);function s(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,r){var i=t.entry;t.entry=null;for(;i;){var n=i.callback;e.pendingcb--,n(r),i=i.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=T,T.WritableState=S;var o={deprecate:r(4927)},a=r(2503),c=r(8764).Buffer,l=r.g.Uint8Array||function(){};var h,u=r(1195),p=r(2457).getHighWaterMark,d=r(4281).q,f=d.ERR_INVALID_ARG_TYPE,g=d.ERR_METHOD_NOT_IMPLEMENTED,m=d.ERR_MULTIPLE_CALLBACK,w=d.ERR_STREAM_CANNOT_PIPE,y=d.ERR_STREAM_DESTROYED,b=d.ERR_STREAM_NULL_VALUES,A=d.ERR_STREAM_WRITE_AFTER_END,v=d.ERR_UNKNOWN_ENCODING,_=u.errorOrDestroy;function E(){}function S(t,e,o){i=i||r(6753),t=t||{},"boolean"!=typeof o&&(o=e instanceof i),this.objectMode=!!t.objectMode,o&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=p(this,t,"writableHighWaterMark",o),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var r=t._writableState,i=r.sync,s=r.writecb;if("function"!=typeof s)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,s){--e.pendingcb,r?(n.nextTick(s,i),n.nextTick(N,t,e),t._writableState.errorEmitted=!0,_(t,i)):(s(i),t._writableState.errorEmitted=!0,_(t,i),N(t,e))}(t,r,i,e,s);else{var o=R(r)||t.destroyed;o||r.corked||r.bufferProcessing||!r.bufferedRequest||I(t,r),i?n.nextTick(C,t,r,o,s):C(t,r,o,s)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function T(t){var e=this instanceof(i=i||r(6753));if(!e&&!h.call(T,this))return new T(t);this._writableState=new S(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function x(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new y("write")):r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function C(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),N(t,e)}function I(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),o=e.corkedRequestsFree;o.entry=r;for(var a=0,c=!0;r;)n[a]=r,r.isBuf||(c=!1),r=r.next,a+=1;n.allBuffers=c,x(t,e,!0,e.length,n,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new s(e),e.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,h=r.encoding,u=r.callback;if(x(t,e,!1,e.objectMode?1:l.length,l,h,u),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function R(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function k(t,e){t._final((function(r){e.pendingcb--,r&&_(t,r),e.prefinished=!0,t.emit("prefinish"),N(t,e)}))}function N(t,e){var r=R(e);if(r&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,n.nextTick(k,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var i=t._readableState;(!i||i.autoDestroy&&i.endEmitted)&&t.destroy()}return r}r(5717)(T,a),S.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(S.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(T,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===T&&(t&&t._writableState instanceof S)}})):h=function(t){return t instanceof this},T.prototype.pipe=function(){_(this,new w)},T.prototype.write=function(t,e,r){var i,s=this._writableState,o=!1,a=!s.objectMode&&(i=t,c.isBuffer(i)||i instanceof l);return a&&!c.isBuffer(t)&&(t=function(t){return c.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=s.defaultEncoding),"function"!=typeof r&&(r=E),s.ending?function(t,e){var r=new A;_(t,r),n.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var s;return null===r?s=new b:"string"==typeof r||e.objectMode||(s=new f("chunk",["string","Buffer"],r)),!s||(_(t,s),n.nextTick(i,s),!1)}(this,s,t,r))&&(s.pendingcb++,o=function(t,e,r,i,n,s){if(!r){var o=function(t,e,r){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=c.from(e,r));return e}(e,i,n);i!==o&&(r=!0,n="buffer",i=o)}var a=e.objectMode?1:i.length;e.length+=a;var l=e.length-1))throw new v(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(T.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(T.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),T.prototype._write=function(t,e,r){r(new g("_write()"))},T.prototype._writev=null,T.prototype.end=function(t,e,r){var i=this._writableState;return"function"==typeof t?(r=t,t=null,e=null):"function"==typeof e&&(r=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||function(t,e,r){e.ending=!0,N(t,e),r&&(e.finished?n.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r),this},Object.defineProperty(T.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(T.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),T.prototype.destroy=u.destroy,T.prototype._undestroy=u.undestroy,T.prototype._destroy=function(t,e){e(t)}},5850:(t,e,r)=>{"use strict";var i,n=r(4155);function s(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var o=r(8610),a=Symbol("lastResolve"),c=Symbol("lastReject"),l=Symbol("error"),h=Symbol("ended"),u=Symbol("lastPromise"),p=Symbol("handlePromise"),d=Symbol("stream");function f(t,e){return{value:t,done:e}}function g(t){var e=t[a];if(null!==e){var r=t[d].read();null!==r&&(t[u]=null,t[a]=null,t[c]=null,e(f(r,!1)))}}function m(t){n.nextTick(g,t)}var w=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((s(i={get stream(){return this[d]},next:function(){var t=this,e=this[l];if(null!==e)return Promise.reject(e);if(this[h])return Promise.resolve(f(void 0,!0));if(this[d].destroyed)return new Promise((function(e,r){n.nextTick((function(){t[l]?r(t[l]):e(f(void 0,!0))}))}));var r,i=this[u];if(i)r=new Promise(function(t,e){return function(r,i){t.then((function(){e[h]?r(f(void 0,!0)):e[p](r,i)}),i)}}(i,this));else{var s=this[d].read();if(null!==s)return Promise.resolve(f(s,!1));r=new Promise(this[p])}return this[u]=r,r}},Symbol.asyncIterator,(function(){return this})),s(i,"return",(function(){var t=this;return new Promise((function(e,r){t[d].destroy(null,(function(t){t?r(t):e(f(void 0,!0))}))}))})),i),w);t.exports=function(t){var e,r=Object.create(y,(s(e={},d,{value:t,writable:!0}),s(e,a,{value:null,writable:!0}),s(e,c,{value:null,writable:!0}),s(e,l,{value:null,writable:!0}),s(e,h,{value:t._readableState.endEmitted,writable:!0}),s(e,p,{value:function(t,e){var i=r[d].read();i?(r[u]=null,r[a]=null,r[c]=null,t(f(i,!1))):(r[a]=t,r[c]=e)},writable:!0}),e));return r[u]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=r[c];return null!==e&&(r[u]=null,r[a]=null,r[c]=null,e(t)),void(r[l]=t)}var i=r[a];null!==i&&(r[u]=null,r[a]=null,r[c]=null,i(f(void 0,!0))),r[h]=!0})),t.on("readable",m.bind(null,r)),r}},7327:(t,e,r)=>{"use strict";function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,i)}return r}function n(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function s(t,e){for(var r=0;r0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,r=""+e.data;e=e.next;)r+=t+e.data;return r}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,r,i,n=o.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,r=n,i=a,o.prototype.copy.call(e,r,i),a+=s.data.length,s=s.next;return n}},{key:"consume",value:function(t,e){var r;return tn.length?n.length:t;if(s===n.length?i+=n:i+=n.slice(0,t),0==(t-=s)){s===n.length?(++r,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=n.slice(s));break}++r}return this.length-=r,i}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),r=this.head,i=1;for(r.data.copy(e),t-=r.data.length;r=r.next;){var n=r.data,s=t>n.length?n.length:t;if(n.copy(e,e.length-t,0,s),0==(t-=s)){s===n.length?(++i,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=n.slice(s));break}++i}return this.length-=i,e}},{key:c,value:function(t,e){return a(this,function(t){for(var e=1;e{"use strict";var i=r(4155);function n(t,e){o(t,e),s(t)}function s(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function o(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,i.nextTick(o,this,t)):i.nextTick(o,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?r._writableState?r._writableState.errorEmitted?i.nextTick(s,r):(r._writableState.errorEmitted=!0,i.nextTick(n,r,t)):i.nextTick(n,r,t):e?(i.nextTick(s,r),e(t)):i.nextTick(s,r)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(t,e){var r=t._readableState,i=t._writableState;r&&r.autoDestroy||i&&i.autoDestroy?t.destroy(e):t.emit("error",e)}}},8610:(t,e,r)=>{"use strict";var i=r(4281).q.ERR_STREAM_PREMATURE_CLOSE;function n(){}t.exports=function t(e,r,s){if("function"==typeof r)return t(e,null,r);r||(r={}),s=function(t){var e=!1;return function(){if(!e){e=!0;for(var r=arguments.length,i=new Array(r),n=0;n{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},9946:(t,e,r)=>{"use strict";var i;var n=r(4281).q,s=n.ERR_MISSING_ARGS,o=n.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function c(t,e,n,s){s=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(s);var a=!1;t.on("close",(function(){a=!0})),void 0===i&&(i=r(8610)),i(t,{readable:e,writable:n},(function(t){if(t)return s(t);a=!0,s()}));var c=!1;return function(e){if(!a&&!c)return c=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void s(e||new o("pipe"))}}function l(t){t()}function h(t,e){return t.pipe(e)}function u(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}t.exports=function(){for(var t=arguments.length,e=new Array(t),r=0;r0,(function(t){i||(i=t),t&&o.forEach(l),s||(o.forEach(l),n(i))}))}));return e.reduce(h)}},2457:(t,e,r)=>{"use strict";var i=r(4281).q.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,r,n){var s=function(t,e,r){return null!=t.highWaterMark?t.highWaterMark:e?t[r]:null}(e,n,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new i(n?r:"highWaterMark",s);return Math.floor(s)}return t.objectMode?16:16384}}},2503:(t,e,r)=>{t.exports=r(7187).EventEmitter},8660:(t,e,r)=>{var i,n=r(4155); /*! ***************************************************************************** @@ -118,4 +118,4 @@ var rm=function(t,e){return rm=Object.setPrototypeOf||{__proto__:[]}instanceof A * SOFTWARE. * */ -const Rw="crypto.algorithm";const kw="crypto.algorithmProvider";var Nw;Tm.registerSingleton(kw,class{getAlgorithms(){return Tm.resolveAll(Rw)}toAsnAlgorithm(t){for(const e of this.getAlgorithms()){const r=e.toAsnAlgorithm(t);if(r)return r}if(/[0-9.]+/.test(t.name)){const e=new bd({algorithm:t.name});if("parameters"in t){const r=t;e.parameters=r.parameters}return e}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(t){for(const e of this.getAlgorithms()){const r=e.toWebAlgorithm(t);if(r)return r}return{name:t.algorithm,parameters:t.parameters}}});const Ow="1.3.36.3.3.2.8.1.1",Bw=`${Ow}.1`,Pw=`${Ow}.2`,Lw=`${Ow}.3`,Dw=`${Ow}.4`,Uw=`${Ow}.5`,Mw=`${Ow}.6`,Fw=`${Ow}.7`,Hw=`${Ow}.8`,Ww=`${Ow}.9`,jw=`${Ow}.10`,Vw=`${Ow}.11`,Gw=`${Ow}.12`,qw=`${Ow}.13`,zw=`${Ow}.14`,Qw="brainpoolP160r1",Kw="brainpoolP160t1",Yw="brainpoolP192r1",Jw="brainpoolP192t1",Xw="brainpoolP224r1",Zw="brainpoolP224t1",$w="brainpoolP256r1",ty="brainpoolP256t1",ey="brainpoolP320r1",ry="brainpoolP320t1",iy="brainpoolP384r1",ny="brainpoolP384t1",sy="brainpoolP512r1",oy="brainpoolP512t1",ay="ECDSA";let cy=Nw=class{toAsnAlgorithm(t){if(t.name.toLowerCase()===ay.toLowerCase())if("hash"in t){switch(("string"==typeof t.hash?t.hash:t.hash.name).toLowerCase()){case"sha-1":return fg;case"sha-256":return gg;case"sha-384":return mg;case"sha-512":return wg}}else if("namedCurve"in t){let e="";switch(t.namedCurve){case"P-256":e=hg;break;case"K-256":e=Nw.SECP256K1;break;case"P-384":e=ug;break;case"P-521":e=pg;break;case Qw:e=Bw;break;case Kw:e=Pw;break;case Yw:e=Lw;break;case Jw:e=Dw;break;case Xw:e=Uw;break;case Zw:e=Mw;break;case $w:e=Fw;break;case ty:e=Hw;break;case ey:e=Ww;break;case ry:e=jw;break;case iy:e=Vw;break;case ny:e=Gw;break;case sy:e=qw;break;case oy:e=zw}if(e)return new bd({algorithm:ng,parameters:Du.serialize(new yg({namedCurve:e}))})}return null}toWebAlgorithm(t){switch(t.algorithm){case sg:return{name:ay,hash:{name:"SHA-1"}};case ag:return{name:ay,hash:{name:"SHA-256"}};case cg:return{name:ay,hash:{name:"SHA-384"}};case lg:return{name:ay,hash:{name:"SHA-512"}};case ng:if(!t.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(Du.parse(t.parameters,yg).namedCurve){case hg:return{name:ay,namedCurve:"P-256"};case Nw.SECP256K1:return{name:ay,namedCurve:"K-256"};case ug:return{name:ay,namedCurve:"P-384"};case pg:return{name:ay,namedCurve:"P-521"};case Bw:return{name:ay,namedCurve:Qw};case Pw:return{name:ay,namedCurve:Kw};case Lw:return{name:ay,namedCurve:Yw};case Dw:return{name:ay,namedCurve:Jw};case Uw:return{name:ay,namedCurve:Xw};case Mw:return{name:ay,namedCurve:Zw};case Fw:return{name:ay,namedCurve:$w};case Hw:return{name:ay,namedCurve:ty};case Ww:return{name:ay,namedCurve:ey};case jw:return{name:ay,namedCurve:ry};case Vw:return{name:ay,namedCurve:iy};case Gw:return{name:ay,namedCurve:ny};case qw:return{name:ay,namedCurve:sy};case zw:return{name:ay,namedCurve:oy}}}return null}};cy.SECP256K1="1.3.132.0.10",cy=Nw=$g([Cm()],cy),Tm.registerSingleton(Rw,cy);const ly=Symbol("name"),hy=Symbol("value");class uy{constructor(t,e={},r=""){this[ly]=t,this[hy]=r;for(const t in e)this[t]=e[t]}}uy.NAME=ly,uy.VALUE=hy;class py{static toString(t){const e=this.items[t];return e||t}}py.items={[Lg]:"sha1",[Dg]:"sha224",[Ug]:"sha256",[Mg]:"sha384",[Fg]:"sha512",[_g]:"rsaEncryption",[Ig]:"sha1WithRSAEncryption",[Rg]:"sha224WithRSAEncryption",[kg]:"sha256WithRSAEncryption",[Ng]:"sha384WithRSAEncryption",[Og]:"sha512WithRSAEncryption",[ng]:"ecPublicKey",[sg]:"ecdsaWithSHA1",[og]:"ecdsaWithSHA224",[ag]:"ecdsaWithSHA256",[cg]:"ecdsaWithSHA384",[lg]:"ecdsaWithSHA512",[Mp]:"TLS WWW server authentication",[Fp]:"TLS WWW client authentication",[Hp]:"Code Signing",[Wp]:"E-mail Protection",[jp]:"Time Stamping",[Vp]:"OCSP Signing","1.2.840.113549.1.7.2":"Signed Data"};class dy{static serialize(t){return this.serializeObj(t).join("\n")}static pad(t=0){return"".padStart(2*t," ")}static serializeObj(t,e=0){const r=[];let i=this.pad(e++),n="";const s=t[uy.VALUE];s&&(n=` ${s}`),r.push(`${i}${t[uy.NAME]}:${n}`),i=this.pad(e);for(const n in t){if("symbol"==typeof n)continue;const s=t[n],o=n?`${n}: `:"";if("string"==typeof s||"number"==typeof s||"boolean"==typeof s)r.push(`${i}${o}${s}`);else if(s instanceof Date)r.push(`${i}${o}${s.toUTCString()}`);else if(Array.isArray(s))for(const t of s)t[uy.NAME]=n,r.push(...this.serializeObj(t,e));else if(s instanceof uy)s[uy.NAME]=n,r.push(...this.serializeObj(s,e));else if(Dc.vJ.isBufferSource(s))n?(r.push(`${i}${o}`),r.push(...this.serializeBufferSource(s,e+1))):r.push(...this.serializeBufferSource(s,e));else{if(!("toTextObject"in s))throw new TypeError("Cannot serialize data in text format. Unsupported type.");{const t=s.toTextObject();t[uy.NAME]=n,r.push(...this.serializeObj(t,e))}}}return r}static serializeBufferSource(t,e=0){const r=this.pad(e),i=Dc.vJ.toUint8Array(t),n=[];for(let t=0;t255)return!1}return!0}getField(t){const e=this.extraNames.findId(t)||vy.findId(t),r=[];for(const t of this.asn)for(const i of t)i.type===e&&r.push(i.value.toString());return r}getName(t){return this.extraNames.get(t)||vy.get(t)}toString(){return this.asn.map((t=>t.map((t=>{const e=this.getName(t.type)||t.type,r=t.value.anyValue?`#${Dc.ep.ToHex(t.value.anyValue)}`:function(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,_y)}(t.value.toString());return`${e}=${r}`})).join("+"))).join(", ")}toJSON(){var t;const e=[];for(const r of this.asn){const i={};for(const e of r){const r=this.getName(e.type)||e.type;null!==(t=i[r])&&void 0!==t||(i[r]=[]),i[r].push(e.value.anyValue?`#${Dc.ep.ToHex(e.value.anyValue)}`:e.value.toString())}e.push(i)}return e}fromString(t){const e=new Ku,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,n=",";for(;i=r.exec(`${t},`);){let[,t,r]=i;const s=r[r.length-1];","!==s&&"+"!==s||(r=r.slice(0,r.length-1),i[3]=s);const o=i[3];if(/[\d.]+/.test(t)||(t=this.getName(t)||""),!t)throw new Error(`Cannot get OID for name type '${t}'`);const a=new qu({type:t});if("#"===r.charAt(0))a.value.anyValue=Dc.ep.FromHex(r.slice(1));else{const e=/"(.*?[^\\])?"/.exec(r);e&&(r=e[1]),r=r.replace(/\\0a/gi,"\n").replace(/\\0d/gi,"\r").replace(/\\0g/gi,"\t").replace(/\\(.)/g,"$1"),t===this.getName("E")||t===this.getName("DC")?a.value.ia5String=r:Ey.isASCII(r)?a.value.printableString=r:a.value.utf8String=r}"+"===n?e[e.length-1].push(a):e.push(new zu([a])),n=o}return e}fromJSON(t){const e=new Ku;for(const r of t){const t=new zu;for(const e in r){let i=e;if(/[\d.]+/.test(e)||(i=this.getName(e)||""),!i)throw new Error(`Cannot get OID for name type '${e}'`);const n=r[e];for(const e of n){const r=new qu({type:i});if("object"==typeof e)for(const t in e)switch(t){case"ia5String":r.value.ia5String=e[t];break;case"utf8String":r.value.utf8String=e[t];break;case"universalString":r.value.universalString=e[t];break;case"bmpString":r.value.bmpString=e[t];break;case"printableString":r.value.printableString=e[t]}else"#"===e[0]?r.value.anyValue=Dc.ep.FromHex(e.slice(1)):i===this.getName("E")||i===this.getName("DC")?r.value.ia5String=e:r.value.printableString=e;t.push(r)}}e.push(t)}return e}toArrayBuffer(){return Du.serialize(this.asn)}async getThumbprint(...t){var e;let r,i="SHA-1";return t.length>=1&&!(null===(e=t[0])||void 0===e?void 0:e.subtle)?(i=t[0]||i,r=t[1]||yy.get()):r=t[0]||yy.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const Sy="Cannot initialize GeneralName from ASN.1 data.",Ty=`${Sy} Unsupported string format in use.`,xy=`${Sy} Value doesn't match to GUID regular expression.`,Cy=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,Iy="1.3.6.1.4.1.311.25.1",Ry="1.3.6.1.4.1.311.20.2.3",ky="dns",Ny="dn",Oy="email",By="ip",Py="url",Ly="guid",Dy="upn",Uy="id";class My extends fy{constructor(...t){let e;if(2===t.length)switch(t[0]){case Ny:{const r=new Ey(t[1]).toArrayBuffer(),i=Du.parse(r,Ku);e=new Zu({directoryName:i});break}case ky:e=new Zu({dNSName:t[1]});break;case Oy:e=new Zu({rfc822Name:t[1]});break;case Ly:{const r=new RegExp(Cy,"i").exec(t[1]);if(!r)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=r.slice(1).map(((t,e)=>e<3?Dc.ep.ToHex(new Uint8Array(Dc.ep.FromHex(t)).reverse()):t)).join("");e=new Zu({otherName:new Ju({typeId:Iy,value:Du.serialize(new $h(Dc.ep.FromHex(i)))})});break}case By:e=new Zu({iPAddress:t[1]});break;case Uy:e=new Zu({registeredID:t[1]});break;case Dy:e=new Zu({otherName:new Ju({typeId:Ry,value:Du.serialize(hu.toASN(t[1]))})});break;case Py:e=new Zu({uniformResourceIdentifier:t[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else e=Dc.vJ.isBufferSource(t[0])?Du.parse(t[0],Zu):t[0];super(e)}onInit(t){if(null!=t.dNSName)this.type=ky,this.value=t.dNSName;else if(null!=t.rfc822Name)this.type=Oy,this.value=t.rfc822Name;else if(null!=t.iPAddress)this.type=By,this.value=t.iPAddress;else if(null!=t.uniformResourceIdentifier)this.type=Py,this.value=t.uniformResourceIdentifier;else if(null!=t.registeredID)this.type=Uy,this.value=t.registeredID;else if(null!=t.directoryName)this.type=Ny,this.value=new Ey(t.directoryName).toString();else{if(null==t.otherName)throw new Error(Ty);if(t.otherName.typeId===Iy){this.type=Ly;const e=Du.parse(t.otherName.value,$h),r=new RegExp(Cy,"i").exec(Dc.ep.ToHex(e));if(!r)throw new Error(xy);this.value=r.slice(1).map(((t,e)=>e<3?Dc.ep.ToHex(new Uint8Array(Dc.ep.FromHex(t)).reverse()):t)).join("-")}else{if(t.otherName.typeId!==Ry)throw new Error(Ty);this.type=Dy,this.value=Du.parse(t.otherName.value,Vu).toString()}}}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let t;switch(this.type){case Ny:case ky:case Ly:case By:case Uy:case Dy:case Py:t=this.type.toUpperCase();break;case Oy:t="Email";break;default:throw new Error("Unsupported GeneralName type")}let e=this.value;return this.type===Uy&&(e=py.toString(e)),new uy(t,void 0,e)}}class Fy extends fy{constructor(t){let e;if(t instanceof hp)e=t;else if(Array.isArray(t)){const r=[];for(const e of t)if(e instanceof Zu)r.push(e);else{const t=Du.parse(new My(e.type,e.value).rawData,Zu);r.push(t)}e=new hp(r)}else{if(!Dc.vJ.isBufferSource(t))throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");e=Du.parse(t,hp)}super(e)}onInit(t){const e=[];for(const r of t){let t=null;try{t=new My(r)}catch{continue}e.push(t)}this.items=e}toJSON(){return this.items.map((t=>t.toJSON()))}toTextObject(){const t=super.toTextObjectEmpty();for(const e of this.items){const r=e.toTextObject();let i=t[r[uy.NAME]];Array.isArray(i)||(i=[],t[r[uy.NAME]]=i),i.push(r)}return t}}Fy.NAME="GeneralNames";const Hy="\\n",Wy="-{5}BEGIN ([^\\n]+(?=-{5}))-{5}\\n(?:((?:[^:\\n]+: (?:[^\\n]+\\n(?: +[^\\n]+\\n)*))+))?\\n?((?:[a-zA-Z0-9=+/]+\\n)+)-{5}END \\1-{5}";class jy{static isPem(t){return"string"==typeof t&&new RegExp(Wy,"g").test(t)}static decodeWithHeaders(t){t=t.replace(/\r/g,"");const e=new RegExp(Wy,"g"),r=[];let i=null;for(;i=e.exec(t);){const t=i[3].replace(new RegExp("[\\n]+","g"),""),e={type:i[1],headers:[],rawData:Dc.ep.FromBase64(t)},n=i[2];if(n){const t=n.split(new RegExp(Hy,"g"));let r=null;for(const i of t){const[t,n]=i.split(/:(.*)/);if(void 0===n){if(!r)throw new Error("Cannot parse PEM string. Incorrect header value");r.value+=t.trim()}else r&&e.headers.push(r),r={key:t,value:n.trim()}}r&&e.headers.push(r)}r.push(e)}return r}static decode(t){return this.decodeWithHeaders(t).map((t=>t.rawData))}static decodeFirst(t){const e=this.decode(t);if(!e.length)throw new RangeError("PEM string doesn't contain any objects");return e[0]}static encode(t,e){if(Array.isArray(t)){const r=new Array;return e?t.forEach((t=>{if(!Dc.vJ.isBufferSource(t))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");r.push(this.encodeStruct({type:e,rawData:Dc.vJ.toArrayBuffer(t)}))})):t.forEach((t=>{if(!("type"in t))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");r.push(this.encodeStruct(t))})),r.join("\n")}if(!e)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:e,rawData:Dc.vJ.toArrayBuffer(t)})}static encodeStruct(t){var e;const r=t.type.toLocaleUpperCase(),i=[];if(i.push(`-----BEGIN ${r}-----`),null===(e=t.headers)||void 0===e?void 0:e.length){for(const e of t.headers)i.push(`${e.key}: ${e.value}`);i.push("")}const n=Dc.ep.ToBase64(t.rawData);let s,o=0;const a=Array();for(;o1?(i=t[0]||i,r=t[1]||r,e=t[2]||yy.get()):e=t[0]||yy.get(),e.subtle.importKey("spki",this.rawData,i,!0,r)}onInit(t){const e=Tm.resolve(kw),r=this.algorithm=e.toWebAlgorithm(t.algorithm);switch(t.algorithm.algorithm){case _g:{const e=Du.parse(t.subjectPublicKey,Zg),i=Dc.vJ.toUint8Array(e.modulus);r.publicExponent=Dc.vJ.toUint8Array(e.publicExponent),r.modulusLength=(i[0]?i:i.slice(1)).byteLength<<3;break}}}async getThumbprint(...t){var e;let r,i="SHA-1";return t.length>=1&&!(null===(e=t[0])||void 0===e?void 0:e.subtle)?(i=t[0]||i,r=t[1]||yy.get()):r=t[0]||yy.get(),await r.subtle.digest(i,this.rawData)}async getKeyIdentifier(t){t||(t=yy.get());const e=Du.parse(this.rawData,Ad);return await t.subtle.digest("SHA-1",e.subjectPublicKey)}toTextObject(){const t=this.toTextObjectEmpty(),e=Du.parse(this.rawData,Ad);if(t.Algorithm=dy.serializeAlgorithm(e.algorithm),e.algorithm.algorithm===ng)t["EC Point"]=e.subjectPublicKey;else t["Raw Data"]=e.subjectPublicKey;return t}}class qy{static register(t,e){this.items.set(t,e)}static create(t){const e=new gy(t),r=this.items.get(e.type);return r?new r(t):e}}qy.items=new Map;const zy="crypto.signatureFormatter";class Qy extends Vy{constructor(t){Vy.isAsnEncoded(t)?super(t,Rd):super(t),this.tag=jy.CertificateTag}onInit(t){const e=t.tbsCertificate;this.tbs=Du.serialize(e),this.serialNumber=Dc.ep.ToHex(e.serialNumber),this.subjectName=new Ey(e.subject),this.subject=new Ey(e.subject).toString(),this.issuerName=new Ey(e.issuer),this.issuer=this.issuerName.toString();const r=Tm.resolve(kw);this.signatureAlgorithm=r.toWebAlgorithm(t.signatureAlgorithm),this.signature=t.signatureValue;const i=e.validity.notBefore.utcTime||e.validity.notBefore.generalTime;if(!i)throw new Error("Cannot get 'notBefore' value");this.notBefore=i;const n=e.validity.notAfter.utcTime||e.validity.notAfter.generalTime;if(!n)throw new Error("Cannot get 'notAfter' value");this.notAfter=n,this.extensions=[],e.extensions&&(this.extensions=e.extensions.map((t=>qy.create(Du.serialize(t))))),this.publicKey=new Gy(e.subjectPublicKeyInfo)}getExtension(t){for(const e of this.extensions)if("string"==typeof t){if(e.type===t)return e}else if(e instanceof t)return e;return null}getExtensions(t){return this.extensions.filter((e=>"string"==typeof t?e.type===t:e instanceof t))}async verify(t={},e=yy.get()){let r,i;const n=t.publicKey;try{if(n)if("publicKey"in n)r={...n.publicKey.algorithm,...this.signatureAlgorithm},i=await n.publicKey.export(r,["verify"]);else if(n instanceof Gy)r={...n.algorithm,...this.signatureAlgorithm},i=await n.export(r,["verify"]);else if(Dc.vJ.isBufferSource(n)){const t=new Gy(n);r={...t.algorithm,...this.signatureAlgorithm},i=await t.export(r,["verify"])}else r={...n.algorithm,...this.signatureAlgorithm},i=n;else r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],e)}catch(t){return!1}const s=Tm.resolveAll(zy).reverse();let o=null;for(const t of s)if(o=t.toWebSignature(r,this.signature),o)break;if(!o)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const a=await e.subtle.verify(this.signatureAlgorithm,i,o,this.tbs);if(t.signatureOnly)return a;{const e=(t.date||new Date).getTime();return a&&this.notBefore.getTime()t))}else{const e=new Up(t[0]);super(Dp,t[1],Du.serialize(e)),this.usages=t[0]}}toTextObject(){const t=this.toTextObjectWithoutValue();return t[""]=this.usages.map((t=>py.toString(t))).join(", "),t}}Zy.NAME="Extended Key Usages",function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"}(Xy||(Xy={}));class $y extends gy{constructor(...t){if(Dc.vJ.isBufferSource(t[0])){super(t[0]);const e=Du.parse(this.value,Xp);this.usages=e.toNumber()}else{const e=new Xp(t[0]);super(Kp,t[1],Du.serialize(e)),this.usages=t[0]}}toTextObject(){const t=this.toTextObjectWithoutValue(),e=Du.parse(this.value,Xp);return t[""]=e.toJSON().join(", "),t}}$y.NAME="Key Usages";class tb extends gy{constructor(...t){if(Dc.vJ.isBufferSource(t[0])){super(t[0]);const e=Du.parse(this.value,pd);this.keyId=Dc.ep.ToHex(e)}else{const e="string"==typeof t[0]?Dc.ep.FromHex(t[0]):t[0],r=new pd(e);super(ud,t[1],Du.serialize(r)),this.keyId=Dc.ep.ToHex(e)}}static async create(t,e=!1,r=yy.get()){let i;i=t instanceof Gy?t.rawData:"publicKey"in t?t.publicKey.rawData:Dc.vJ.isBufferSource(t)?t:await r.subtle.exportKey("spki",t);const n=new Gy(i),s=await n.getKeyIdentifier(r);return new tb(Dc.ep.ToHex(s),e)}toTextObject(){const t=this.toTextObjectWithoutValue(),e=Du.parse(this.value,pd);return t[""]=e,t}}tb.NAME="Subject Key Identifier";class eb extends gy{constructor(...t){Dc.vJ.isBufferSource(t[0])?super(t[0]):super(od,t[1],new Fy(t[0]||[]).rawData)}onInit(t){super.onInit(t);const e=Du.parse(t.extnValue,ad);this.names=new Fy(e)}toTextObject(){const t=this.toTextObjectWithoutValue(),e=this.names.toTextObject();for(const r in e)t[r]=e[r];return t}}eb.NAME="Subject Alternative Name";class rb extends gy{constructor(...t){var e;if(Dc.vJ.isBufferSource(t[0])){super(t[0]);const e=Du.parse(this.value,vp);this.policies=e.map((t=>t.policyIdentifier))}else{const r=t[0],i=null!==(e=t[1])&&void 0!==e&&e,n=new vp(r.map((t=>new Ap({policyIdentifier:t}))));super(fp,i,Du.serialize(n)),this.policies=r}}toTextObject(){const t=this.toTextObjectWithoutValue();return t.Policy=this.policies.map((t=>new uy("",{},py.toString(t)))),t}}rb.NAME="Certificate Policies",qy.register(fp,rb);class ib extends fy{constructor(...t){let e;if(Dc.vJ.isBufferSource(t[0]))e=Dc.vJ.toArrayBuffer(t[0]);else{const r=t[0],i=Array.isArray(t[1])?t[1].map((t=>Dc.vJ.toArrayBuffer(t))):[];e=Du.serialize(new cd({type:r,values:i}))}super(e,cd)}onInit(t){this.type=t.type,this.values=t.values}toTextObject(){const t=this.toTextObjectWithoutValue();return t.Value=this.values.map((t=>new uy("",{"":t}))),t}toTextObjectWithoutValue(){const t=this.toTextObjectEmpty();return t[uy.NAME]===ib.NAME&&(t[uy.NAME]=py.toString(this.type)),t}}ib.NAME="Attribute";class nb extends ib{constructor(...t){var e;if(Dc.vJ.isBufferSource(t[0]))super(t[0]);else{const e=new bw({printableString:t[0]});super(tw,[Du.serialize(e)])}null!==(e=this.password)&&void 0!==e||(this.password="")}onInit(t){if(super.onInit(t),this.values[0]){const t=Du.parse(this.values[0],bw);this.password=t.toString()}}toTextObject(){const t=this.toTextObjectWithoutValue();return t[uy.VALUE]=this.password,t}}nb.NAME="Challenge Password";class sb extends ib{constructor(...t){var e;if(Dc.vJ.isBufferSource(t[0]))super(t[0]);else{const e=t[0],r=new Td;for(const t of e)r.push(Du.parse(t.rawData,Sd));super(ew,[Du.serialize(r)])}null!==(e=this.items)&&void 0!==e||(this.items=[])}onInit(t){if(super.onInit(t),this.values[0]){const t=Du.parse(this.values[0],Td);this.items=t.map((t=>qy.create(Du.serialize(t))))}}toTextObject(){const t=this.toTextObjectWithoutValue(),e=this.items.map((t=>t.toTextObject()));for(const r of e)t[r[uy.NAME]]=r;return t}}sb.NAME="Extensions";class ob{static register(t,e){this.items.set(t,e)}static create(t){const e=new ib(t),r=this.items.get(e.type);return r?new r(t):e}}ob.items=new Map;let ab=class{toAsnAlgorithm(t){if("rsassa-pkcs1-v1_5"===t.name.toLowerCase()){if(!t.hash)return new bd({algorithm:_g,parameters:null});switch(t.hash.name.toLowerCase()){case"sha-1":return new bd({algorithm:Ig,parameters:null});case"sha-256":return new bd({algorithm:kg,parameters:null});case"sha-384":return new bd({algorithm:Ng,parameters:null});case"sha-512":return new bd({algorithm:Og,parameters:null})}}return null}toWebAlgorithm(t){switch(t.algorithm){case _g:return{name:"RSASSA-PKCS1-v1_5"};case Ig:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case kg:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Ng:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Og:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}}}return null}};ab=$g([Cm()],ab),Tm.registerSingleton(Rw,ab);class cb{addPadding(t,e){const r=Dc.vJ.toUint8Array(e),i=new Uint8Array(t);return i.set(r,t-r.length),i}removePadding(t,e=!1){let r=Dc.vJ.toUint8Array(t);for(let t=0;t127){const t=new Uint8Array(r.length+1);return t.set(r,1),t.buffer}return r.buffer}toAsnSignature(t,e){if("ECDSA"===t.name){const r=t.namedCurve,i=cb.namedCurveSize.get(r)||cb.defaultNamedCurveSize,n=new Ag,s=Dc.vJ.toUint8Array(e);return n.r=this.removePadding(s.slice(0,i),!0),n.s=this.removePadding(s.slice(i,i+i),!0),Du.serialize(n)}return null}toWebSignature(t,e){if("ECDSA"===t.name){const r=Du.parse(e,Ag),i=t.namedCurve,n=cb.namedCurveSize.get(i)||cb.defaultNamedCurveSize,s=this.addPadding(n,this.removePadding(r.r)),o=this.addPadding(n,this.removePadding(r.s));return(0,Dc.$e)(s,o)}return null}}cb.namedCurveSize=new Map,cb.defaultNamedCurveSize=32;const lb="1.3.101.110",hb="1.3.101.111",ub="1.3.101.112",pb="1.3.101.113";let db=class{toAsnAlgorithm(t){let e=null;switch(t.name.toLowerCase()){case"eddsa":switch(t.namedCurve.toLowerCase()){case"ed25519":e=ub;break;case"ed448":e=pb}break;case"ecdh-es":switch(t.namedCurve.toLowerCase()){case"x25519":e=lb;break;case"x448":e=hb}}return e?new bd({algorithm:e}):null}toWebAlgorithm(t){switch(t.algorithm){case ub:return{name:"EdDSA",namedCurve:"Ed25519"};case pb:return{name:"EdDSA",namedCurve:"Ed448"};case lb:return{name:"ECDH-ES",namedCurve:"X25519"};case hb:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};db=$g([Cm()],db),Tm.registerSingleton(Rw,db);class fb extends Vy{constructor(t){Vy.isAsnEncoded(t)?super(t,Iw):super(t),this.tag=jy.CertificateRequestTag}onInit(t){this.tbs=Du.serialize(t.certificationRequestInfo),this.publicKey=new Gy(t.certificationRequestInfo.subjectPKInfo);const e=Tm.resolve(kw);this.signatureAlgorithm=e.toWebAlgorithm(t.signatureAlgorithm),this.signature=t.signature,this.attributes=t.certificationRequestInfo.attributes.map((t=>ob.create(Du.serialize(t))));const r=this.getAttribute(ew);this.extensions=[],r instanceof sb&&(this.extensions=r.items),this.subjectName=new Ey(t.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(t){for(const e of this.attributes)if(e.type===t)return e;return null}getAttributes(t){return this.attributes.filter((e=>e.type===t))}getExtension(t){for(const e of this.extensions)if(e.type===t)return e;return null}getExtensions(t){return this.extensions.filter((e=>e.type===t))}async verify(t=yy.get()){const e={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(e,["verify"],t),i=Tm.resolveAll(zy).reverse();let n=null;for(const t of i)if(n=t.toWebSignature(e,this.signature),n)break;if(!n)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await t.subtle.verify(this.signatureAlgorithm,r,n,this.tbs)}toTextObject(){const t=this.toTextObjectEmpty(),e=Du.parse(this.rawData,Iw),r=e.certificationRequestInfo,i=new uy("",{Version:`${xd[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const t=new uy("");for(const e of this.attributes){const r=e.toTextObject();t[r[uy.NAME]]=r}i.Attributes=t}return t.Data=i,t.Signature=new uy("",{Algorithm:dy.serializeAlgorithm(e.signatureAlgorithm),"":e.signature}),t}}fb.NAME="PKCS#10 Certificate Request";var gb;!function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"}(gb||(gb={}));qy.register(ap,Yy),qy.register(Dp,Zy),qy.register(Kp,$y),qy.register(ud,tb),qy.register(np,Ky),qy.register(od,eb),ob.register(tw,nb),ob.register(ew,sb),Tm.registerSingleton(zy,class{toAsnSignature(t,e){return Dc.vJ.toArrayBuffer(e)}toWebSignature(t,e){return Dc.vJ.toArrayBuffer(e)}}),Tm.registerSingleton(zy,cb),cb.namedCurveSize.set("P-256",32),cb.namedCurveSize.set("K-256",32),cb.namedCurveSize.set("P-384",48),cb.namedCurveSize.set("P-521",66);const mb=/-{5}(BEGIN|END) .*-{5}/gm;async function wb({hash:t,signature:e,publicKey:r,domain:i,domainCert:n,created:s,software:o}={}){let a;const c=[];if(e=(0,Lc.toByteArray)(e),n&&i&&!r){const t=n.split("\n\n"),i=(0,Lc.toByteArray)(t[0].replace(mb,"").replace(/\s/gm,"")),s=p(await crypto.subtle.digest("SHA-256",i));c.push({id:"certFingerprint",expected:s,matched:null});const o=new Qy(i);r=await o.publicKey.export();const l=(0,Lc.fromByteArray)(new Uint8Array(o.publicKey.rawData));c.push({id:"publicKey",expected:l,matched:null}),o.subject&&o.subject.startsWith("CN=")&&(a=o.subject.split(3)),e=function(t){try{const e=Bu.parse(t,Ag),r=0===e.r[0]?e.r.slice(1):e.r,i=0===e.s[0]?e.s.slice(1):e.s;t=lt([r,i],r.length+i.length)}catch(t){console.log(t)}return t}(e)}else{const t={name:"ECDSA",namedCurve:"P-384"};c.push({id:"publicKey",expected:r,matched:null}),r=await crypto.subtle.importKey("spki",(0,Lc.toByteArray)(r),t,!0,["verify"])}const l=new TextEncoder,h=await crypto.subtle.verify({name:"ECDSA",hash:"SHA-256"},r,e,l.encode(t));return c.push({id:"signature",expected:!0,matched:h}),s&&c.push({id:"created",expected:s,matched:null}),o&&c.push({id:"software",expected:o,matched:null}),i&&c.push({id:"domain",expected:i,matched:a}),c}const yb="pages/pages.jsonl",bb="pages/extraPages.jsonl",Ab="datapackage.json",vb="datapackage-digest.json",_b="webarchive.yaml";class Eb{constructor(t,e,r=!0){this.file=e,this.waczname=e.waczname,this.store=t,this.isRoot=r}async loadFileFromWACZ(t,e){return this.store.loadFileFromWACZ?await this.store.loadFileFromWACZ(this.file,t,e):await this.file.loadFile(t,e)}async load(){let t,e=null;return this.file.containsFile(vb)&&(e=await this.loadDigestData(vb)),this.file.containsFile(Ab)?t=await this.loadPackage(Ab,e):this.file.containsFile(_b)&&(t=await this.loadOldPackageYAML(_b)),t||{}}async loadTextFileFromWACZ(t,e=!1){const{reader:r,hasher:i}=await this.loadFileFromWACZ(t,{computeHash:!!e}),n=(new TextDecoder).decode(await r.readFully());return e&&i&&await this.store.addVerifyData(this.waczname,t,e,i.getHash()),n}async loadDigestData(t){try{const e=JSON.parse(await this.loadTextFileFromWACZ(t));let r;e.path===Ab&&e.hash&&(r=e.hash);const i=this.store,n=this.isRoot?"":this.waczname+":";if(!e.signedData||e.signedData.hash!==r)return void await i.addVerifyData(n,"signature");await i.addVerifyData(n,"datapackageHash",r);const s=await wb(e.signedData);return await i.addVerifyDataList(n,s),r}catch(t){console.warn(t)}}async loadPackage(t,e){const r=await this.loadTextFileFromWACZ(t,e),i=JSON.parse(r);switch(this.isRoot&&void 0!==i.config&&this.store.initConfig(i.config),i.profile){case"data-package":case"wacz-package":case void 0:case null:return await this.loadLeafWACZPackage(i);case"multi-wacz-package":return await this.loadMultiWACZPackage(i);default:throw new Error(`Unknown package profile: ${i.profile}`)}}async loadMultiWACZPackage(t){return this.file.markAsMultiWACZ(),await this.store.loadWACZFiles(t,this.file),t}async loadLeafWACZPackage(t){const e=t.metadata||{};let r=null;for(const e of t.resources)e.path===yb?(r=e.hash,await this.store.addVerifyData(this.waczname,e.path,e.hash)):(e.path.endsWith(".idx")||e.path.endsWith(".cdx"))&&await this.store.addVerifyData(this.waczname,e.path,e.hash);if(this.file.containsFile(yb)){(await this.loadPages(yb,r)).hasText&&(this.store.textIndex=e.textIndex=yb)}return this.file.containsFile(bb)&&(this.store.textIndex=e.textIndex=bb),e}async loadOldPackageYAML(t){const e=await this.loadTextFileFromWACZ(t),r=Pc.load(e),i={desc:r.desc,title:r.title};r.textIndex&&(i.textIndex=r.textIndex,r.config||(r.config={}),r.config.textIndex=r.textIndex),this.isRoot&&void 0!==r.config&&this.store.initConfig(r.config),i.title||(i.title=this.store.config.sourceName);const n=r.pages||[];n&&n.length&&await this.store.addPages(n);const s=r.pageLists||[];return s&&s.length&&await this.store.addCuratedPageLists(s,"pages","show"),i}async loadPages(t=yb,e=null){const{reader:r,hasher:i}=await this.loadFileFromWACZ(t,{unzip:!0,computeHash:!0});let n=null,s=[];for await(const t of r.iterLines()){const e=JSON.parse(t);this.waczname&&(e.wacz=this.waczname),n?(s.push(e),500===s.length&&(await this.store.addPages(s),s=[])):n=e}return s.length&&await this.store.addPages(s),i&&e&&await this.store.addVerifyData(this.waczname,t,e,i.getHash()),n}}class Sb{constructor(t,e,r=null){this.loader=t,this.loadId=r,this.loadUrl=e.loadUrl}async load(t){t.fullConfig&&this.loader.arrayBuffer&&this.loader.arrayBuffer.byteLength<=s&&(t.fullConfig.extra||(t.fullConfig.extra={}),t.fullConfig.extra.arrayBuffer=this.loader.arrayBuffer);const e=this.loadUrl,r=this.loader;return await t.addNewWACZ({name:"default",path:e,loader:r})}}class Tb{constructor(t,e,r=null){this.config=e,this.loadId=r,this.loader=t}async load(t,e=null,r=0){const i=new Do({loader:this.loader});await i.init();const n=i.zipreader,s=new Eb(t,i),o=await s.load();let a=0;const c=(t,i,n)=>{n+=a,e&&r&&e(Math.round(100*n/r),null,n,r)};for(const e of i.iterContainedFiles()){const r=n.getCompressedSize(e);(e.endsWith(".warc.gz")||e.endsWith(".warc"))&&await this.loadWARC(t,n,e,c,r),a+=r}return o||{}}async loadWARC(t,e,r,i,n){const{reader:s}=await e.loadFile(r,{unzip:!0}),o=new vs(s,null,r);return o.detectPages=!1,await o.load(t,i,n)}}class xb{constructor(t){this.response=t}async load(t){return await t.loadFromJSON(this.response)}}class Cb{constructor(t,{cloneResponse:e=!1,allowBody:r=!1,hostProxyOnly:i=!1}={}){if(t=t||{},this.prefix=t.prefix||"",this.proxyPathOnly=t.proxyPathOnly||!1,this.isLive=void 0===t.isLive||t.isLive,this.archivePrefix=t.archivePrefix||"",this.cloneResponse=e,this.allowBody=r||this.isLive,this.hostProxy=t.hostProxy,this.hostProxy instanceof Array){const t={};for(const e of this.hostProxy)t[e.host]=e;this.hostProxy=t}this.hostProxyOnly=i}async getAllPages(){return[]}getFetchUrl(t,e,r){let i;if(this.hostProxy){i=new URL(t);const e=this.hostProxy[i.host];if(e)return r.set("X-Proxy-Host",i.host),e.prefix+(e.pathOnly?i.pathname+i.search:t)}return this.hostProxyOnly?null:this.proxyPathOnly?(i||(i=new URL(t)),this.prefix+i.pathname+i.search):this.isLive||!e.timestamp?this.prefix+t:this.prefix+this.archivePrefix+e.timestamp+"id_/"+t}async getResource(t,e){const{headers:r,credentials:i,url:n}=t.prepareProxyRequest(e,!0),s=this.getFetchUrl(n,t,r);if(!s)return null;let o=null;!this.allowBody||"POST"!==t.method&&"PUT"!==t.method||(o=await t.getBody());const a=await fetch(s,{method:t.method,body:o,headers:r,credentials:i,mode:"cors",redirect:"follow"});let c=null;this.cloneResponse&&(c=a.clone());const l=vn.fromResponse({url:n,response:a,date:new Date,noRW:!1,isLive:this.isLive,archivePrefix:this.archivePrefix});return c&&(l.clonedResponse=c),l}}const Ib=/^([\w-]+,)*[\w-]+(:\d+)?,?\)\//;class Rb extends bo{constructor(t,e,r="wacz"){super(t.dbname,t.noCache),this.config=t,this.waczfiles={},this.waczNameForHash={},this.ziploadercache={},this.updating=null,this.rootSourceType=r,this.sourceLoader=e,this.externalSource=null,this.fuzzyUrlRules=[],this.textIndex=t&&t.metadata&&t.metadata.textIndex||bb,t.extraConfig&&this.initConfig(t.extraConfig)}initConfig(t){if(void 0!==t.decodeResponses&&(this.config.decode=t.decodeResponses),t.hostProxy&&(this.externalSource=new Cb(t,{hostProxyOnly:!0})),t.fuzzy)for(const[e,r]of t.fuzzy){const t=new RegExp(e);this.fuzzyUrlRules.push({match:t,replace:r})}t.textIndex&&(this.textIndex=t.textIndex)}updateHeaders(t){this.sourceLoader&&(this.sourceLoader.headers=t)}_initDB(t,e,r,i){super._initDB(t,e,r,i),e||(t.createObjectStore("ziplines",{keyPath:["waczname","prefix"]}),t.createObjectStore("waczfiles",{keyPath:"waczname"}),t.createObjectStore("verification",{keyPath:"id"})),2===e&&this.convertV2WACZDB(t,i),3===e&&t.createObjectStore("verification",{keyPath:"id"})}async convertV2WACZDB(t,e){try{const r=await e.objectStore("ziplines").getAll(),i=await e.objectStore("zipEntries").getAll();t.deleteObjectStore("ziplines"),t.deleteObjectStore("zipEntries"),t.createObjectStore("ziplines",{keyPath:["waczname","prefix"]}),t.createObjectStore("waczfiles",{keyPath:"waczname"}),t.createObjectStore("verification",{keyPath:"id"});const n=this.config.loadUrl;for(const t of r)t.waczname=n,e.objectStore("ziplines").put(t);const s=r.length>0?2:1,o=await this.computeHash(n),a=new Do({waczname:n,hash:o,url:n,entries:i,indexType:s});e.objectStore("waczfiles").put(a.serialize()),await e.done}catch(t){console.warn(t)}}addWACZFile(t){return this.waczfiles[t.waczname]=new Do(t),this.waczNameForHash[t.hash]=t.waczname,this.waczfiles[t.waczname]}async init(){await super.init();const t=await this.db.getAll("waczfiles")||[];for(const e of t)this.addWACZFile({...e,parent:this});for(const[t,e]of Object.entries(this.waczfiles)){e.path=e.path||t;const r=e.path.lastIndexOf("#!/");if(r>0){const t=e.path.slice(0,r),i=this.waczfiles[t];e.parent=i}else"json"!==this.rootSourceType&&(e.loader=this.sourceLoader)}await this.checkUpdates()}async close(){super.close(),caches.delete("cache:"+this.name.slice("db:".length))}async clearZipData(){const t=["waczfiles","ziplines"];for(const e of t)await this.db.clear(e)}async addVerifyData(t="",e,r,i,n=!1){let s=null;t&&(e=t+e),i&&(s=r===i,n&&console.log(`verify ${e}: ${s}`)),await this.db.put("verification",{id:e,expected:r,matched:s})}async addVerifyDataList(t,e){const r=this.db.transaction("verification","readwrite");for(const i of e)t&&(i.id=t+i.id),r.store.put(i);try{await r.done}catch(t){console.warn(t)}}async getVerifyInfo(){const t=await this.db.getAll("verification");let e=0,r=0,i={};const n=["domain","created","certFingerprint","software","datapackageHash","publicKey"];for(const s of t)n.includes(s.id)?i[s.id]=s.expected:"signature"===s.id||!0===s.matched?e++:!1===s.matched&&r++;return i.numInvalid=r,i.numValid=e,i}async getVerifyExpected(t){const e=await this.db.get("verification",t);return e&&e.expected}async clearAll(){await super.clearAll(),await this.clearZipData()}async loadRecordFromSource(t){const{start:e,length:r,path:i,wacz:n}=t.source,s={offset:e,length:r,unzip:!0,computeHash:!0},o=n,{reader:a,hasher:c}=await this.loadFileFromNamedWACZ(o,"archive/"+i,s),l=new _s(a,c);await this.waczfiles[o].save(this.db);const h=await l.load();return t[xo]&&(h.respHeaders["x-wabac-preset-cookie"]=t[xo]),{remote:h,hasher:c}}async loadIndex(t){if(!this.waczfiles[t])throw new Error("unknown waczfile: "+t);if(this.waczfiles[t].indexType)return{indexType:this.waczfiles[t].indexType,isNew:!1};let e=0;for(const r of this.waczfiles[t].iterContainedFiles())r.endsWith(".cdx")||r.endsWith(".cdxj")?(console.log(`Loading CDX for ${t}`),await this.loadCDX(r,t),e=1):r.endsWith(".idx")&&(console.log(`Loading IDX for ${t}`),await this.loadIDX(r,t),e=2);return this.waczfiles[t].indexType=e,await this.waczfiles[t].save(this.db,!0),{indexType:e,isNew:!0}}async loadCDX(t,e,r,i){const{reader:n,hasher:s}=await this.loadFileFromNamedWACZ(e,t,{computeHash:!0}),o=new Io(n,null,e,{wacz:e}),a=await o.load(this,r,i);if(s){const r=await this.getVerifyExpected(t);r&&this.addVerifyData(e,t,r,s.getHash())}return a}async loadIDX(t,e,r,i){const{reader:n,hasher:s}=await this.loadFileFromNamedWACZ(e,t,{computeHash:!0});let o=[],a="",c=!0,l=0;for await(const t of n.iterLines()){if(l+=t.length,l===t.length&&t.startsWith("!meta")){const e=t.indexOf(" {");if(e<0){console.warn("Invalid Meta Line: "+t);continue}const r=JSON.parse(t.slice(e));r.filename&&(a=r.filename),"cdxj-gzip-1.0"!==r.format&&console.log(`Unknown CDXJ format "${r.format}", archive may not parse correctly`);continue}let n;if(t.indexOf("\t")>0){let[r,i,s,o]=t.split("\t");s=Number(s),o=Number(o),n={waczname:e,prefix:r,filename:i,offset:s,length:o,loaded:!1},c=!1}else{const r=t.indexOf(" {");if(r<0){console.log("Invalid Index Line: "+t);continue}const i=t.slice(0,r);let{offset:s,length:o,filename:l,digest:h}=JSON.parse(t.slice(r));c=c&&!Ib.test(i),l=l||a,n={waczname:e,prefix:i,filename:l,offset:s,length:o,digest:h,loaded:!1}}r&&r(l/i,l,i),o.push(n)}if(s){const r=await this.getVerifyExpected(t);r&&this.addVerifyData(e,t,r,s.getHash())}const h=this.db.transaction("ziplines","readwrite");for(const t of o)h.store.put(t);try{await h.done}catch(t){console.log("Error loading ziplines index: ",t)}c&&c!==this.waczfiles[e].nonSurt&&(this.waczfiles[e].nonSurt=c,await this.waczfiles[e].save(this.db,!0))}async loadCDXFromIDX(t,e,r=0,i=!1){const n=this.waczfiles[t].nonSurt?e:nt(e),s=i?this.prefixUpperBound(n):n+" 9999",o=IDBKeyRange.upperBound([t,s],!0),a=this.db.transaction("ziplines","readonly"),c=[];for await(const e of a.store.iterate(o,"prev")){if(e.value.waczname!==t)break;if(c.unshift(e.value),!e.value.prefix.split(" ")[0].startsWith(n))break}await a.done;const l=[];c.length>3&&r&&c.sort(((t,e)=>{const i=t.prefix.split(" ")[1],n=e.prefix.split(" ")[1];if(!i||!n)return 0;const s=Math.abs(u(i).getTime()-r),o=Math.abs(u(n).getTime()-r);return s===o?0:s3)break}return l.length&&await Promise.allSettled(l),await this.waczfiles[t].save(this.db),l.length>0}async doCDXLoad(t,e,r){try{const i="indexes/"+e.filename,n={offset:e.offset,length:e.length,unzip:!0,computeHash:!!e.digest},{reader:s,hasher:o}=await this.loadFileFromNamedWACZ(r,i,n),a=new Io(s,null,null,{wacz:r});if(await a.load(this),o){const t=o.getHash(),n=`${i}:${e.offset}-${e.length}`;await this.addVerifyData(r,n,e.digest,t)}e.loaded=!0,await this.db.put("ziplines",e)}catch(t){await _(t,this.config)||console.warn(t)}finally{delete this.ziploadercache[t]}}async findPageAtUrl(t,e){const r=await this.db.getAllFromIndex("pages","url",t);let i=null,n=Number.MAX_SAFE_INTEGER;for(const t of r){const r=Math.abs(t.ts-e);if(r<1e3)return t;r0)return r;for(const i of Object.keys(this.waczfiles))if(i&&"local"!==i){const{indexType:n,isNew:s}=await this.loadIndex(i);switch(n){case 2:if(!await this.loadCDXFromIDX(i,t,0,!0))continue;break;case 1:if(!s)continue;break;default:continue}const o=await super.resourcesByUrlAndMime(t,...e);o&&o.length&&(r=r.concat(o))}return r}async loadFileFromWACZ(t,e,r){try{return await t.loadFile(e,r)}catch(i){if(await this.retryLoad(i))return await t.loadFile(e,r);throw i}}async loadFileFromNamedWACZ(t,e,r){const i=this.waczfiles[t];if(!i)throw new Error("No WACZ Found for: "+t);return await this.loadFileFromWACZ(i,e,r)}async addNewWACZ({name:t,hash:e,path:r,parent:i=null,loader:n=null}={}){const s=t||r;e?e.indexOf(":")>0&&(e=e.split(":")[1]):e=await d(s,"sha-256","");const o=this.addWACZFile({waczname:s,hash:e,path:r,parent:i,loader:n},!0);await o.init(),await o.save(this.db,!0);const a=new Eb(this,o,!i);return await a.load()}async loadWACZFiles(t,e=this){const r=[],i=async(t,e)=>{await this.waczfiles[t].init(e),await this.waczfiles[t].save(this.db,!0)},n=t.resources.map((t=>{const r=e.getLoadPath(t.path);return{name:e.getName(t.name),hash:t.hash,path:r}}));for(const{name:t,hash:s,path:o}of n)this.waczfiles[t]?this.waczfiles[t].path!==o&&r.push(i(t,o)):r.push(this.addNewWACZ({name:t,hash:s,path:o,parent:e}));r.length&&await Promise.allSettled(r)}async getTextIndex(){const t={"Content-Type":"application/ndjson"},e=Object.keys(this.waczfiles);if(!this.textIndex||!e.length)return new Response("",{headers:t});if(1===e.length){const r=e[0];let i;try{i=await this.loadFileFromNamedWACZ(r,this.textIndex,{unzip:!0})}catch(e){return new Response("",{headers:t})}const{reader:n}=i;if(!n)return new Response("",{headers:t});const s=this.waczfiles[r].getSizeOf(this.textIndex);return s>0&&(t["Content-Length"]=""+s),new Response(n.getReadableStream(),{headers:t})}{const r=[];for(const t of e)try{const{reader:e}=await this.loadFileFromNamedWACZ(t,this.textIndex,{unzip:!0});e&&r.push(e)}catch(t){continue}const i=new ReadableStream({async pull(t){for(const e of r)for await(const r of e)t.enqueue(r);t.close()}});return new Response(i,{headers:t})}}async getResource(t,e,r,{pageId:i}={}){if(await this.initing,this.externalSource){const i=await this.externalSource.getResource(t,e,r);if(i)return i}let n=i,s=null,o=null;if(n){if(s=this.waczNameForHash[n],!s)return null;if(o=await super.getResource(t,e,r,{waczname:s}),o)return o}let a=new Map;for(const[i,s]of Object.entries(this.waczfiles))s.fileType===Lo&&s.hash!==n&&(o=await super.getResource(t,e,r,{waczname:i,noFuzzyCheck:!0,loadFirst:!0}),o&&a.set(o.date,{name:i,hash:s.hash}));if(a.size>0){const r=u(t.timestamp);let i,n,o=-1;for(const t of a.keys()){const e=Math.abs(t.getTime()-r);if(o<0||e0),o||(o=200)}catch(e){console.warn(e),console.warn("Ignoring headers, error parsing headers response for: "+t)}return{encodedUrl:r,headers:n,date:s,status:o,statusText:a,hasPayload:c}}}const Nb=Pb([80,75,3,4]),Ob=Pb([31,139,8]),Bb=Pb([87,65,82,67]);function Pb(t){return e=>{for(const[r,i]of t.entries())if(i!==e[r])return!1;return!0}}async function Lb(t){const e=t.body.getReader();let r="";const{value:i,done:n}=await e.read();var s;return!n&&i.length>=4&&(s=i.slice(0,4),r=Nb(s)?".wacz":Bb(s)?".warc":Ob(s)?".warc.gz":void 0,r||(r=function(t){try{const e=(new TextDecoder).decode(t).split("\n");if(e>1&&e.indexOf(" {"))return".cdxj"}catch(t){return""}}(i))),n||e.cancel(),r}globalThis.self||(globalThis.self=globalThis),self.interruptLoads={};class Db extends class{constructor(){this.colldb=null,this.root=null,this.checkIpfs=!0,this._init_db=this._initDB()}async _initDB(){this.colldb=await Jn("collDB",1,{upgrade:t=>{t.createObjectStore("colls",{keyPath:"name"}).createIndex("type","type")}})}async loadAll(t){if(await this._init_db,t)for(const e of t.split(",")){const t=e.split(":");if(2===t.length){const e={dbname:t[1],sourceName:t[1],decode:!1},r={name:t[0],type:"archive",config:e};console.log("Adding Coll: "+JSON.stringify(r)),await this.colldb.put("colls",r)}}try{const t=(await this.listAll()).map((t=>this._initColl(t)));await Promise.all(t)}catch(t){console.warn(t.toString())}return!0}async listAll(){return await this._init_db,await this.colldb.getAll("colls")}async loadColl(t){await this._init_db;const e=await this.colldb.get("colls",t);return e?await this._initColl(e):null}async reload(t){return this.loadColl(t)}async deleteColl(t){await this._init_db;const e=await this.colldb.get("colls",t);if(!e)return!1;if(e.config.dbname)try{await Xn(e.config.dbname,{blocked(t,r){console.log(`Unable to delete ${e.config.dbname}, blocked: ${r}`)}})}catch(t){return console.warn(t),!1}return await this.colldb.delete("colls",t),!0}async updateAuth(t,e){await this._init_db;const r=await this.colldb.get("colls",t);return!!r&&(r.config.headers=e,await this.colldb.put("colls",r),!0)}async updateMetadata(t,e){await this._init_db;const r=await this.colldb.get("colls",t);return!!r&&(r.config.metadata={...r.config.metadata,...e},await this.colldb.put("colls",r),r.config.metadata)}async updateSize(t,e,r,i){await this._init_db;const n=await this.colldb.get("colls",t);if(!n)return!1;const s=n.config.metadata;return s.fullSize=(s.fullSize||0)+e,s.size=(s.size||0)+r,s.mtime=(new Date).getTime(),void 0!==i&&(n.config.decode=i),await this.colldb.put("colls",n),s}async initNewColl(t,e={},r="archive"){await this._init_db;const i=m(),n="local://"+i,s={name:i,type:r,config:{dbname:"db:"+i,ctime:(new Date).getTime(),decode:!1,metadata:t,sourceUrl:n,extraConfig:e}},o=await this._initColl(s);return await this.colldb.put("colls",s),o}async _initColl(t){const e=await this._initStore(t.type,t.config),r=t.name,i=t.config;return t.config.root&&!this.root&&(this.root=r),this._createCollection({name:r,store:e,config:i})}async _initStore(t,e){let r=null,i=null;switch(t){case"archive":i=new ws(e.dbname);break;case"remotesource":r=await lo({url:e.loadUrl,headers:e.headers,size:e.size,extra:e.extra}),i=new Ao(e.dbname,r,e.noCache);break;case"remoteprefix":i=new vo(e.dbname,e.remotePrefix,e.headers,e.noCache);break;case"wacz":case"remotezip":case"multiwacz":r=await lo({url:e.loadUrl||e.sourceUrl,headers:e.headers,extra:e.extra}),i=new Rb(e,r,"multiwacz"===t?"json":"wacz");break;case"remotewarcproxy":i=new kb(e);break;case"live":i=new Cb(e.extraConfig)}return i?(i.initing&&await i.initing,i):(console.log("no store found: "+t),null)}_createCollection(t){return t}}{constructor(t){super(),this.registerListener(t)}async hasCollection(t){return await this._init_db,null!=await this.colldb.getKey("colls",t)}registerListener(t){t.addEventListener("message",(t=>{t.waitUntil?t.waitUntil(this._handleMessage(t)):this._handleMessage(t)}))}async _handleMessage(t){await this._init_db;const e=t.source||self;switch(t.data.msg_type){case"addColl":{const r=t.data.name,i=(t,i,n,s,o=null,a=null)=>{e.postMessage({msg_type:"collProgress",name:r,percent:t,error:i,currentSize:n,totalSize:s,fileHandle:o,extraMsg:a})};let n;try{if(n=await this.colldb.get("colls",r),n?t.data.skipExisting||(await this.deleteColl(r),n=await this.addCollection(t.data,i)):n=await this.addCollection(t.data,i),!n){if(t.data.name)try{await Xn("db:"+t.data.name,{blocked(e,r){console.log(`Load failed and unable to delete ${t.data.name}: ${r}`)}})}catch(t){console.warn(t)}return}}catch(t){if(t instanceof x)return console.warn(t),void i(0,"permission_needed",null,null,t.info&&t.info.fileHandle);if("ConstraintError"!==t.name)return console.warn(t),void i(0,"An unexpected error occured: "+t.toString());console.log("already being added, just continue..."),n=await this.colldb.get("colls",r)}e.postMessage({msg_type:"collAdded",name:r,sourceUrl:n.config.sourceUrl});break}case"cancelLoad":{const e=t.data.name,r=new Promise((t=>self.interruptLoads[e]=t));await r,await this.deleteColl(e),delete self.interruptLoads[e];break}case"removeColl":{const r=t.data.name;await this.hasCollection(r)&&(await this.deleteColl(r),this.doListAll(e));break}case"listAll":this.doListAll(e);break;case"reload":this.reload(t.data.name)}}async doListAll(t){const e=[],r=await this.listAll();for(const t of r)e.push({name:t.name,prefix:t.name,pageList:[],sourceName:t.config.sourceName});t.postMessage({msg_type:"listAll",colls:e})}async addCollection(t,e){let r=t.name,i=null,n={root:t.root||!1},o=null,a=null;const c=t.file;if(!c||!c.sourceUrl)return e(0,"Invalid Load Request"),!1;if(n.dbname="db:"+r,c.sourceUrl.startsWith("proxy:"))n.sourceUrl=c.sourceUrl.slice("proxy:".length),n.extraConfig=t.extraConfig,n.extraConfig.prefix||(n.extraConfig.prefix=n.sourceUrl),n.topTemplateUrl=t.topTemplateUrl,n.metadata={},i=t.type||n.extraConfig.type||"remotewarcproxy",o=await this._initStore(i,n);else{let l=null;if(c.newFullImport&&(r=m(),c.loadUrl=c.loadUrl||c.sourceUrl,c.name=c.name||c.sourceUrl,c.sourceUrl="local://"+r),i="archive",c.newFullImport&&c.importCollId){const t=await this.colldb.get("colls",c.importCollId);if(!t||"archive"!==t.type)return void e(0,"Invalid Existing Collection: "+c.importCollId);n.dbname=t.config.dbname,a=t.config,a.decode=!0}let h=c.loadUrl||c.sourceUrl;h.match(/[\w]+:\/\//)||(h=new URL(h,self.location.href).href),n.decode=!0,n.onDemand=!1,n.loadUrl=h,n.sourceUrl=c.sourceUrl,n.sourceName=c.name||c.sourceUrl;try{if(n.sourceName.match(/https?:\/\//)){const t=new URL(n.sourceName);n.sourceName=t.pathname+t.hash}}catch(t){}if(n.sourceName=n.sourceName.slice(n.sourceName.lastIndexOf("/")+1),n.size="number"==typeof c.size?c.size:null,n.extra=c.extra,n.loadUrl.startsWith("file://")&&!c.blob&&!n.extra){if(!this._fileHandles||!this._fileHandles[n.sourceUrl])return void e(0,"missing_local_file");n.extra={fileHandle:this._fileHandles[n.sourceUrl]}}n.extraConfig=t.extraConfig,n.headers=c.headers||n.extraConfig&&n.extraConfig.headers,n.noCache=c.noCache;let u=await lo({url:h,headers:n.headers,size:c.size,extra:n.extra,blob:c.blob});if(c.loadEager){const{response:t}=await u.doInitialFetch(!1,!0),e={arrayBuffer:new Uint8Array(await t.arrayBuffer())};c.newFullImport=!0,u=await lo({url:h,headers:n.headers,size:c.size,extra:e})}let p=function(t){const e=[".warc",".warc.gz",".cdx",".cdxj",".har",".json",".wacz",".zip"];for(const r of e)if(t.endsWith(r))return r;return""}(n.sourceName),{abort:d,response:f}=await u.doInitialFetch(".wacz"===p);p||(p=await Lb(await f.clone()));const g=f.body;if(n.onDemand=u.canLoadOnDemand&&!c.newFullImport,!u.isValid){const t=u.length<=1e3?await f.text():"";return e(0,`Sorry, this URL could not be loaded.\nMake sure this is a valid URL and you have access to this file.\nStatus: ${f.status} ${f.statusText}\nError Details:\n${t}`),d&&d.abort(),!1}if(!u.length)return e(0,"Sorry, this URL could not be loaded because the size of the file is not accessible.\nMake sure this is a valid URL and you have access to this file."),d&&d.abort(),!1;const w=u.length;if(".wacz"===p)if(n.onDemand)l=new Sb(u,n,r),o=new Rb(n,u,"wacz"),i="wacz";else{if(!u.canLoadOnDemand||!c.newFullImport)return e(0,"Sorry, can't load this WACZ file due to lack of range request support on the server"),d&&d.abort(),!1;l=new Tb(u,n,r),o=null,delete n.extra}else".warc"===p||".warc.gz"===p?n.noCache||!(w300&&e<400)return;let s=null;void 0===this.timeRanges[n]?(s={count:0,children:[]},this.timeRanges[n]=s,r.referrer.indexOf("mp_/")>0&&self.clients.matchAll({type:"window"}).then((t=>this.updateStatsParent(n,r.referrer,t)))):s=this.timeRanges[n];const o=t.getTime();(!s.min||os.max)&&(s.max=o),s.count++}updateStatsParent(t,e,r){for(let i of r)if(i.url===e){this.timeRanges[i.id]?this.timeRanges[i.id].children[t]=1:this.timeRanges[i.id]={count:0,children:{id:1}};break}}async getStats(t){const e=new URL(t.request.url);let r=0;const i=new URLSearchParams(e.search).get("url"),n=await self.clients.matchAll({type:"window"}),s={};for(let t of n)t.url===i&&(r=t.id),s[t.id]=1;const o=this.timeRanges[r]||{},a={count:o.count||0,min:o.min,max:o.max},c=this.timeRanges[r]&&Object.keys(this.timeRanges[r].children)||[];for(let t of c){const e=this.timeRanges[t];e&&((!a.min||e.mina.max)&&(a.max=e.max),a.count+=e.count)}for(let t of Object.keys(this.timeRanges))s[t]||delete this.timeRanges[t];return new Response(JSON.stringify(a),{headers:{"Content-Type":"application/json"}})}}var Mb=function(){return Mb=Object.assign||function(t){for(var e,r=1,i=arguments.length;r$)/g,""):"[a-zA-Z0-9-_.~%':|=+\\*@$]+")+")"},Zb=[{name:"url-parameter",pattern:/^:([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})(<(.+?)>)?/,regex:function(t){return new RegExp(Xb(t[2]))}},{name:"url-parameter-splat",pattern:/^\*([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})/,regex:/([^?]*)/},{name:"url-parameter-matrix",pattern:/^;([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})(<(.+?)>)?/,regex:function(t){return new RegExp(";"+t[1]+"="+Xb(t[2]))}},{name:"query-parameter",pattern:/^(?:\?|&)(?::)?([a-zA-Z0-9-_]*[a-zA-Z0-9]{1})/},{name:"delimiter",pattern:/^(\/|\?)/,regex:function(t){return new RegExp("\\"+t[0])}},{name:"sub-delimiter",pattern:/^(!|&|-|_|\.|;)/,regex:function(t){return new RegExp(t[0])}},{name:"fragment",pattern:/^([0-9a-zA-Z]+)/,regex:function(t){return new RegExp(t[0])}}],$b=function t(e,r){if(void 0===r&&(r=[]),!Zb.some((function(i){var n=e.match(i.pattern);return!!n&&(r.push({type:i.name,match:n[0],val:n.slice(1,2),otherVal:n.slice(2),regex:i.regex instanceof Function?i.regex(n):i.regex}),n[0].length0,this.hasSpatParam=this.tokens.filter((function(t){return/splat$/.test(t.type)})).length>0,this.hasMatrixParams=this.tokens.filter((function(t){return/matrix$/.test(t.type)})).length>0,this.hasQueryParams=this.tokens.filter((function(t){return/^query-parameter/.test(t.type)})).length>0,this.spatParams=this.getParams("url-parameter-splat"),this.urlParams=this.getParams(/^url-parameter/),this.queryParams=this.getParams("query-parameter"),this.params=this.urlParams.concat(this.queryParams),this.source=this.tokens.filter((function(t){return void 0!==t.regex})).map((function(t){return t.regex.source})).join("")}return t.createPath=function(e,r){return new t(e,r)},t.prototype.isQueryParam=function(t){return-1!==this.queryParams.indexOf(t)},t.prototype.isSpatParam=function(t){return-1!==this.spatParams.indexOf(t)},t.prototype.test=function(t,e){var r=this,i=Mb(Mb({caseSensitive:!1,strictTrailingSlash:!1},this.options),e),n=function(t,e){return e||"\\/"===t?t:t.replace(/\\\/$/,"")+"(?:\\/)?"}(this.source,i.strictTrailingSlash),s=this.urlTest(t,n+(this.hasQueryParams?"(\\?.*$|$)":"$"),i.caseSensitive,i.urlParamsEncoding);if(!s||!this.hasQueryParams)return s;var o=qb(t,i.queryParams);return 0===Object.keys(o).filter((function(t){return!r.isQueryParam(t)})).length?(Object.keys(o).forEach((function(t){return s[t]=o[t]})),s):null},t.prototype.partialTest=function(t,e){var r=this,i=Mb(Mb({caseSensitive:!1,delimited:!0},this.options),e),n=function(t,e){return e?/(\/)$/.test(t)?t:t+"(\\/|\\?|\\.|;|$)":t}(this.source,i.delimited),s=this.urlTest(t,n,i.caseSensitive,i.urlParamsEncoding);if(!s)return s;if(!this.hasQueryParams)return s;var o=qb(t,i.queryParams);return Object.keys(o).filter((function(t){return r.isQueryParam(t)})).forEach((function(t){return function(t,e,r){void 0===r&&(r="");var i=t[e];return t[e]=void 0===i?r:Array.isArray(i)?i.concat(r):[i,r],t}(s,t,o[t])})),s},t.prototype.build=function(t,e){var r=this;void 0===t&&(t={});var i=Mb(Mb({ignoreConstraints:!1,ignoreSearch:!1,queryParams:{}},this.options),e),n=Object.keys(t).filter((function(t){return!r.isQueryParam(t)})).reduce((function(e,n){if(!tA(t[n]))return e;var s=t[n],o=r.isSpatParam(n);return"boolean"==typeof s?e[n]=s:Array.isArray(s)?e[n]=s.map((function(t){return Jb(t,i.urlParamsEncoding,o)})):e[n]=Jb(s,i.urlParamsEncoding,o),e}),{});if(this.urlParams.some((function(e){return!tA(t[e])}))){var s=this.urlParams.filter((function(e){return!tA(t[e])}));throw new Error("Cannot build path: '"+this.path+"' requires missing parameters { "+s.join(", ")+" }")}if(!i.ignoreConstraints&&!this.tokens.filter((function(t){return/^url-parameter/.test(t.type)&&!/-splat$/.test(t.type)})).every((function(t){return new RegExp("^"+Xb(t.otherVal[0])+"$").test(n[t.val])})))throw new Error("Some parameters of '"+this.path+"' are of invalid format");var o=this.tokens.filter((function(t){return!1===/^query-parameter/.test(t.type)})).map((function(t){return"url-parameter-matrix"===t.type?";"+t.val+"="+n[t.val[0]]:/^url-parameter/.test(t.type)?n[t.val[0]]:t.match})).join("");if(i.ignoreSearch)return o;var a=function(t,e){var r=Fb(e);return Object.keys(t).filter((function(e){return function(t){return void 0!==t}(t[e])})).map((function(e){return jb(e,t[e],r)})).filter(Boolean).join("&")}(this.queryParams.filter((function(e){return-1!==Object.keys(t).indexOf(e)})).reduce((function(e,r){return e[r]=t[r],e}),{}),i.queryParams);return a?o+"?"+a:o},t.prototype.getParams=function(t){var e=t instanceof RegExp?function(e){return t.test(e.type)}:function(e){return e.type===t};return this.tokens.filter(e).map((function(t){return t.val[0]}))},t.prototype.urlTest=function(t,e,r,i){var n=this,s=new RegExp("^"+e,r?"":"i"),o=t.match(s);return o?this.urlParams.length?o.slice(1,this.urlParams.length+1).reduce((function(t,e,r){return t[n.urlParams[r]]=(Yb[i]||decodeURIComponent)(e),t}),{}):{}:null},t}();class iA{constructor(t){this.routes={};for(const[e,r]of Object.entries(t)){let t,i;r instanceof Array?(t=r[0],i=r[1]||"GET"):(t=r,i="GET"),this.routes[i]=this.routes[i]||{},this.routes[i][e]=new rA(t)}}match(t,e="GET"){for(const[r,i]of Object.entries(this.routes[e]||[])){const e=t.split("?",2),n=e[0],s=i.test(n);if(s)return s._route=r,s._query=new URLSearchParams(2===e.length?e[1]:""),s}return{_route:null}}}class nA{constructor(t){this.router=new iA(this.routes),this.collections=t}get routes(){return{index:"coll-index",coll:"c/:coll",urls:"c/:coll/urls",urlsTs:"c/:coll/ts/",createColl:["c/create","POST"],deleteColl:["c/:coll","DELETE"],updateAuth:["c/:coll/updateAuth","POST"],updateMetadata:["c/:coll/metadata","POST"],curated:"c/:coll/curated/:list",pages:"c/:coll/pages",textIndex:"c/:coll/textIndex",deletePage:["c/:coll/page/:page","DELETE"]}}async apiResponse(t,e,r){const i=this.router.match(t,e.method),n=await this.handleApi(e,i,r);if(n instanceof Response)return n;const s=n.error?404:200;return this.makeResponse(n,s)}async handleApi(t,e){switch(e._route){case"index":return await this.listAll(e._query.get("filter"));case"createColl":{const e=await t.json();return S(await this.collections.initNewColl(e.metadata||{},e.extraConfig||{}))}case"coll":{const t=await this.collections.getColl(e.coll);if(!t)return{error:"collection_not_found"};const r=S(t);return"1"===e._query.get("all")?(t.store.db?(r.pages=await t.store.getAllPages(),r.lists=await t.store.db.getAll("pageLists"),r.curatedPages=await t.store.db.getAll("curatedPages")):(r.pages=[],r.lists=[],r.curatedPages=[]),r.verify=await t.store.getVerifyInfo()):(r.numLists=await t.store.db.count("pageLists"),r.numPages=await t.store.db.count("pages")),t.config.metadata.ipfsPins&&(r.ipfsPins=t.config.metadata.ipfsPins),r}case"deleteColl":{const t="1"===e._query.get("reload");return await this.collections.deleteColl(e.coll,t)?await this.listAll():{error:"collection_not_found"}}case"updateAuth":{const r=await t.json();return{success:await this.collections.updateAuth(e.coll,r.headers)}}case"updateMetadata":{const r=await t.json();return{metadata:await this.collections.updateMetadata(e.coll,r)}}case"urls":{const t=await this.collections.getColl(e.coll);if(!t)return{error:"collection_not_found"};const r=e._query.get("url"),i=Number(e._query.get("count")||100),n=e._query.get("mime"),s="1"===e._query.get("prefix"),o=e._query.get("fromUrl"),a=e._query.get("fromTs"),c=e._query.get("fromMime"),l=Number(e._query.get("fromStatus")||0);if(!t.store.resourcesByMime)return{urls:[]};let h;return h=r?await t.store.resourcesByUrlAndMime(r,n,i,s,o,a):await t.store.resourcesByMime(n,i,c,o,l),h=h||[],{urls:h}}case"urlsTs":{const t=await this.collections.getColl(e.coll);if(!t)return{error:"collection_not_found"};const r=e._query.get("url");return{timestamps:await t.store.getTimestampsByURL(r)}}case"pages":{const t=await this.collections.getColl(e.coll);if(!t)return{error:"collection_not_found"};return{pages:await t.store.getAllPages()}}case"textIndex":{const t=await this.collections.getColl(e.coll);return t?t.store.getTextIndex?await t.store.getTextIndex():{}:{error:"collection_not_found"}}case"curated":{const t=await this.collections.getColl(e.coll);if(!t)return{error:"collection_not_found"};const r=Number(e.list);return{curated:await t.store.db.getAllFromIndex("curatedPages","listPages",IDBKeyRange.bound([r],[r+1]))}}case"deletePage":{const t=await this.collections.getColl(e.coll);if(!t)return{error:"collection_not_found"};const{pageSize:r,deleteSize:i}=t.store.deletePage(e.page);return this.collections.updateSize(e.coll,r,i),{pageSize:r,deleteSize:i}}default:return{error:"not_found"}}}async listAll(t){const e=await this.collections.listAll(),r=[];return e.forEach((e=>{"live"!==e.type&&"remoteproxy"!==e.type&&(t&&0!==e.type.indexOf(t)||r.push(S(e)))})),{colls:r}}makeResponse(t,e=200){return new Response(JSON.stringify(t),{status:e,headers:{"Content-Type":"application/json"}})}}var sA=r(24);const oA=/^(?::([\w-]+)\/)?(\d*)([a-z]+_|[$][a-z0-9:.-]+)?(?:\/|\||%7C|%7c)(.+)/;class aA{constructor(t,e,{isRoot:r=!1,mod:i="",ts:n="",proxyOrigin:s=null,localOrigin:o=null}={}){const a=oA.exec(t);if(this.url="",this.timestamp=n,this.mod=i,this.pageId="",this.hash="",!a&&(t.startsWith("https:")||t.startsWith("http:")||t.startsWith("blob:")))this.url=t;else if(!a&&r)this.url="https://"+t;else{if(!a)return void(this.url=null);this.pageId=a[1]||"",this.timestamp=a[2],this.mod=a[3],this.url=a[4]}if(s&&o){const t=new URL(this.url);t.origin===o&&(this.url=s+t.pathname+(t.search?t.search:""))}const c=this.url.indexOf("#");c>0&&(this.hash=this.url.slice(c),this.url=this.url.substring(0,c)),this.request=e,this.method=e.method,this.mode=e.mode,this._postToGetConverted=!1}get headers(){return this.request.headers}get destination(){return this.request.destination}get referrer(){return this.request.referrer}async convertPostToGet(){if(this._postToGetConverted)return this.url;const t=this.request;if("POST"!==t.method&&"PUT"!==t.method)return this.url;const e={method:t.method,postData:await t.text(),headers:t.headers,url:this.url};return st(e)&&(this.url=e.url,this.method="GET",this.mode="navigate"===this.request.mode?"same-origin":this.request.mode,this._postToGetConverted=!0),this.url}prepareProxyRequest(t,e=!0){let r,i,n;if(e){r=new Headers(this.request.headers),i=this.request.referrer;const e=i.indexOf("/http",t.length-1);e>0&&(i=i.slice(e+1),r.set("X-Proxy-Referer",i)),n=this.request.credentials,this.cookie&&r.set("X-Proxy-Cookie",this.cookie)}else r=new Headers,n="omit";let s=this.url;if(s.startsWith("//"))try{s=new URL(i).protocol+s}catch(t){s="https:"+s}return{referrer:i,headers:r,credentials:n,url:s}}async getBody(){const t=this.request.clone();return new Uint8Array(await t.arrayBuffer())}}const cA="x-wabac-is-ajax-req";class lA extends Db{constructor(t,e=null,r={}){super(self),this.prefixes=t,this.colls={},this.inited=null,this.root=e,this.defaultConfig=r,this._fileHandles={}}_createCollection(t){return new Ln(t,this.prefixes,this.defaultConfig)}loadAll(t){return this.colls={},this.inited=super.loadAll(t),this.inited}async getColl(t){return this.colls[t]||(this.colls[t]=await this.loadColl(t)),this.colls[t]}async reload(t){delete this.colls[t],await this.getColl(t)}async addCollection(t,e){const r=await super.addCollection(t,e);return r&&r.name&&(this.colls[r.name]=this._createCollection(r)),r}async deleteColl(t,e=!1){return this.colls[t]&&(this.colls[t].store&&this.colls[t].store.delete&&await this.colls[t].store.delete(),e&&this.colls[t].config&&this.colls[t].config.extra&&this.colls[t].config.extra.fileHandle&&(this._fileHandles[this.colls[t].config.sourceUrl]=this.colls[t].config.extra.fileHandle)),!!await super.deleteColl(t)&&(delete this.colls[t],!0)}async initNewColl(t,e={},r="archive"){const i=await super.initNewColl(t,e,r);return i&&(this.colls[i.name]=i),i}async updateAuth(t,e){this.colls[t]&&this.colls[t].store.updateHeaders&&this.colls[t].store.updateHeaders(e),await super.updateAuth(t,e)}async updateMetadata(t,e){const r=await super.updateMetadata(t,e);return this.colls[t]&&r&&(this.colls[t].config.metadata=r,this.colls[t].metadata=r),r}async updateSize(t,e,r,i){const n=await super.updateSize(t,e,r,i);return this.colls[t]&&n&&(this.colls[t].config.metadata=n,this.colls[t].metadata=n),void 0!==i&&this.colls[t]&&(this.colls[t].config.decode=i),n}}class hA{constructor({staticData:t=null,ApiClass:e=nA,defaultConfig:r={},CollectionsClass:i=lA}={}){this.prefix=self.registration?self.registration.scope:"",this.replayPrefix=this.prefix;const n=new URLSearchParams(self.location.search);let s="w";n.has("replayPrefix")&&(s=n.get("replayPrefix")),s&&(this.replayPrefix+=s+"/"),this.staticPrefix=this.prefix+"static/",this.distPrefix=this.prefix+"dist/";const o={static:this.staticPrefix,root:this.prefix,main:this.replayPrefix};if(this.staticData=t||new Map,this.staticData.set(this.staticPrefix+"wombat.js",{type:"application/javascript",content:'/*! wombat.js (wabac.js 2.19.5) is part of Webrecorder project. Copyright (C) 2020-2024, Webrecorder Software. Licensed under the Affero General Public License v3. */(()=>{"use strict";function t(){this._map=[]}function e(t,e){void 0!==self.Symbol&&void 0!==self.Symbol.toStringTag&&Object.defineProperty(t.prototype,self.Symbol.toStringTag,{value:e,enumerable:!1})}function r(t){for(var e,r,i=t.__proto__||t.constructor.prototype||t.prototype,o=Object.getOwnPropertyNames(i),n=o.length,s=0;s=0?this._map.splice(e,1)[0][1]:null},t.prototype.map=function(t){for(var e=0;et+=String.fromCharCode(e)),""):t?t.toString():"";try{return"__wb_post_data="+btoa(e)}catch{return"__wb_post_data="}}function _(t){let{method:e,headers:r,postData:i}=t;if("GET"===e)return!1;function o(t){return t instanceof Uint8Array&&(t=(new TextDecoder).decode(t)),t}let n="";switch((r.get("content-type")||"").split(";")[0]){case"application/x-www-form-urlencoded":n=o(i);break;case"application/json":n=d(o(i));break;case"text/plain":try{n=d(o(i),!1)}catch{n=l(i)}break;case"multipart/form-data":{let t=r.get("content-type");if(!t)throw new Error("utils cannot call postToGetURL when missing content-type header");n=function(t,e){return function(t,e){let r=new URLSearchParams;t instanceof Uint8Array&&(t=(new TextDecoder).decode(t));try{let i=e.split("boundary=")[1],o=t.split(new RegExp("-*"+i+"-*","mi"));for(let t of o){let e=t.trim().match(/name="([^"]+)"\\r\\n\\r\\n(.*)/im);e&&r.set(e[1],e[2])}}catch{}return r}(t,e).toString()}(o(i),t);break}default:n=l(i)}return null!==n&&(t.url=function(t,e,r){if(!r)return t;let i=t.indexOf("?")>0?"&":"?";return`${t}${i}__wb_method=${r}&${e}`}(t.url,n,t.method),t.method="GET",t.requestBody=n,!0)}function u(t,e=!0){if("string"==typeof t)try{t=JSON.parse(t)}catch{t={}}let r=new URLSearchParams,i={};try{JSON.stringify(t,((t,e)=>(["object","function"].includes(typeof e)||r.set((t=>r.has(t)?(t in i||(i[t]=1),t+"."+ ++i[t]+"_"):t)(t),e),e)))}catch(t){if(!e)throw t}return r}function d(t,e=!0){return u(t,e).toString()}function f(e,i){if(!(this instanceof f))return new f(e,i);this.debug_rw=!1,this.$wbwindow=e,this.WBWindow=Window,this.URL=URL,this.origHost=e.location.host,this.origHostname=e.location.hostname,this.origProtocol=e.location.protocol,this.HTTP_PREFIX="http://",this.HTTPS_PREFIX="https://",this.REL_PREFIX="//",this.VALID_PREFIXES=[this.HTTP_PREFIX,this.HTTPS_PREFIX,this.REL_PREFIX],this.IGNORE_PREFIXES=["#","about:","data:","blob:","mailto:","javascript:","{","*"],"ignore_prefixes"in i&&(this.IGNORE_PREFIXES=this.IGNORE_PREFIXES.concat(i.ignore_prefixes)),this.WB_CHECK_THIS_FUNC="_____WB$wombat$check$this$function_____",this.WB_ASSIGN_FUNC="_____WB$wombat$assign$function_____",this.SKIP_OWN_FUNC_PROPS=["name","length","__WB_is_native_func__","arguments","caller","callee","prototype"],this.wb_setAttribute=e.Element.prototype.setAttribute,this.wb_getAttribute=e.Element.prototype.getAttribute,this.wb_funToString=Function.prototype.toString,this.WBAutoFetchWorker=null,this.wbUseAFWorker=i.enable_auto_fetch&&null!=e.Worker&&i.is_live,this.wb_rel_prefix="",this.wb_wombat_updating=!1,this.message_listeners=new t,this.storage_listeners=new t,this.linkAsTypes={script:"js_",worker:"js_",style:"cs_",image:"im_",document:"if_",fetch:"mp_",font:"oe_",audio:"oe_",video:"oe_",embed:"oe_",object:"oe_",track:"oe_","":"mp_",null:"mp_",undefined:"mp_"},this.linkTagMods={linkRelToAs:{import:this.linkAsTypes,preload:this.linkAsTypes},stylesheet:"cs_",null:"mp_",undefined:"mp_","":"mp_"},this.tagToMod={A:{href:"mp_"},AREA:{href:"mp_"},AUDIO:{src:"oe_",poster:"im_"},BASE:{href:"mp_"},EMBED:{src:"oe_"},FORM:{action:"mp_"},FRAME:{src:"fr_"},IFRAME:{src:"if_"},IMAGE:{href:"im_","xlink:href":"im_"},IMG:{src:"im_",srcset:"im_"},INPUT:{src:"oe_"},INS:{cite:"mp_"},META:{content:"mp_"},OBJECT:{data:"oe_",codebase:"oe_"},Q:{cite:"mp_"},SCRIPT:{src:"js_","xlink:href":"js_"},SOURCE:{src:"oe_",srcset:"oe_"},TRACK:{src:"oe_"},VIDEO:{src:"oe_",poster:"im_"},image:{href:"im_","xlink:href":"im_"}},this.URL_PROPS=["href","hash","pathname","host","hostname","protocol","origin","search","port"],this.wb_info=i,this.wb_opts=i.wombat_opts,this.wb_replay_prefix=i.prefix,this.wb_is_proxy=this.wb_info.proxy_magic||!this.wb_replay_prefix,this.wb_info.top_host=this.wb_info.top_host||"*",this.wb_curr_host=e.location.protocol+"//"+e.location.host,this.wb_info.wombat_opts=this.wb_info.wombat_opts||{},this.wb_orig_scheme=this.wb_info.wombat_scheme+"://",this.wb_orig_origin=this.wb_orig_scheme+this.wb_info.wombat_host,this.wb_abs_prefix=this.wb_replay_prefix,this.wb_capture_date_part="",!this.wb_info.is_live&&this.wb_info.wombat_ts&&(this.wb_capture_date_part="/"+this.wb_info.wombat_ts+"/"),this.BAD_PREFIXES=["http:"+this.wb_replay_prefix,"https:"+this.wb_replay_prefix,"http:/"+this.wb_replay_prefix,"https:/"+this.wb_replay_prefix],this.hostnamePortRe=/^[\\w-]+(\\.[\\w-_]+)+(:\\d+)(\\/|$)/,this.ipPortRe=/^\\d+\\.\\d+\\.\\d+\\.\\d+(:\\d+)?(\\/|$)/,this.workerBlobRe=/__WB_pmw\\(.*?\\)\\.(?=postMessage\\()/g,this.rmCheckThisInjectRe=/_____WB\\$wombat\\$check\\$this\\$function_____\\(.*?\\)/g,this.STYLE_REGEX=/(url\\s*\\(\\s*[\\\\"\']*)([^)\'"]+)([\\\\"\']*\\s*\\))/gi,this.IMPORT_REGEX=/(@import\\s*[\\\\"\']*)([^)\'";]+)([\\\\"\']*\\s*;?)/gi,this.IMPORT_JS_REGEX=/^(import\\s*\\([\'"]+)([^\'"]+)(["\'])/i,this.no_wombatRe=/WB_wombat_/g,this.srcsetRe=/\\s*(\\S*\\s+[\\d.]+[wx]),|(?:\\s*,(?:\\s+|(?=https?:)))/,this.cookie_path_regex=/\\bPath=\'?"?([^;\'"\\s]+)/i,this.cookie_domain_regex=/\\bDomain=([^;\'"\\s]+)/i,this.cookie_expires_regex=/\\bExpires=([^;\'"]+)/gi,this.SetCookieRe=/,(?![|])/,this.IP_RX=/^(\\d)+\\.(\\d)+\\.(\\d)+\\.(\\d)+$/,this.FullHTMLRegex=/^\\s*<(?:html|head|body|!doctype html)/i,this.IsTagRegex=/^\\s*0&&e.preserveMedia(r)}))},h.prototype.terminate=function(){this.worker.terminate()},h.prototype.justFetch=function(t){this.worker.postMessage({type:"fetch-all",values:t})},h.prototype.fetchAsPage=function(t,e,r){if(t){var i={"X-Wombat-History-Page":e};if(r){var o=encodeURIComponent(r.trim());r&&(i["X-Wombat-History-Title"]=o)}var n={url:t,options:{headers:i,cache:"no-store"}};this.justFetch([n])}},h.prototype.postMessage=function(t,e){if(e){var r=this;Promise.resolve().then((function(){r.worker.postMessage(t)}))}else this.worker.postMessage(t)},h.prototype.preserveSrcset=function(t,e){this.postMessage({type:"values",srcset:{value:t,mod:e,presplit:!0}},!0)},h.prototype.preserveDataSrcset=function(t){this.postMessage({type:"values",srcset:{value:t.dataset.srcset,mod:this.rwMod(t),presplit:!1}},!0)},h.prototype.preserveMedia=function(t){this.postMessage({type:"values",media:t},!0)},h.prototype.getSrcset=function(t){return this.wombat.wb_getAttribute?this.wombat.wb_getAttribute.call(t,"srcset"):t.getAttribute("srcset")},h.prototype.rwMod=function(t){switch(t.tagName){case"SOURCE":return t.parentElement&&"PICTURE"===t.parentElement.tagName?"im_":"oe_";case"IMG":return"im_"}return"oe_"},h.prototype.extractFromLocalDoc=function(){var t=this;Promise.resolve().then((function(){for(var e={type:"values",context:{docBaseURI:document.baseURI}},r=[],i=0,o=document.styleSheets;i=0||t.indexOf("ecmascript")>=0)&&(t.indexOf("json")>=0||t.indexOf("text/")>=0))},f.prototype.skipWrapScriptTextBasedOnText=function(t){if(!t||t.indexOf(this.WB_ASSIGN_FUNC)>=0||0===t.indexOf("<"))return!0;for(var e=["window","self","document","location","top","parent","frames","opener"],r=0;r=0)return!1;return!0},f.prototype.nodeHasChildren=function(t){if(!t)return!1;if("function"==typeof t.hasChildNodes)return t.hasChildNodes();var e=t.children||t.childNodes;return!!e&&e.length>0},f.prototype.rwModForElement=function(t,e){if(t){var r="mp_";if("LINK"===t.tagName&&"href"===e){if(t.rel){var i=t.rel.trim().toLowerCase(),o=this.wb_getAttribute.call(t,"as");if(o&&null!=this.linkTagMods.linkRelToAs[i])r=this.linkTagMods.linkRelToAs[i][o.toLowerCase()];else null!=this.linkTagMods[i]&&(r=this.linkTagMods[i])}}else{if("SCRIPT"===t.tagName)return"module"===t.type?"esm_":"js_";var n=this.tagToMod[t.tagName];null!=n&&(r=n[e])}return r}},f.prototype.removeWBOSRC=function(t){"SCRIPT"!==t.tagName||t.__$removedWBOSRC$__||(t.hasAttribute("__wb_orig_src")&&t.removeAttribute("__wb_orig_src"),t.__$removedWBOSRC$__=!0)},f.prototype.retrieveWBOSRC=function(t){var e;if("SCRIPT"===t.tagName&&!t.__$removedWBOSRC$__)return null==(e=this.wb_getAttribute?this.wb_getAttribute.call(t,"__wb_orig_src"):t.getAttribute("__wb_orig_src"))&&(t.__$removedWBOSRC$__=!0),e},f.prototype.wrapScriptTextJsProxy=function(t){return\'var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };\\nif (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }\\n{\\nlet window = _____WB$wombat$assign$function_____("window");\\nlet globalThis = _____WB$wombat$assign$function_____("globalThis");\\nlet self = _____WB$wombat$assign$function_____("self");\\nlet document = _____WB$wombat$assign$function_____("document");\\nlet location = _____WB$wombat$assign$function_____("location");\\nlet top = _____WB$wombat$assign$function_____("top");\\nlet parent = _____WB$wombat$assign$function_____("parent");\\nlet frames = _____WB$wombat$assign$function_____("frames");\\nlet opener = _____WB$wombat$assign$function_____("opener");\\n{\\n\'+t.replace(this.DotPostMessageRe,".__WB_pmw(self.window)$1")+"\\n\\n}}"},f.prototype.watchElem=function(t,e){if(!this.$wbwindow.MutationObserver)return!1;new this.$wbwindow.MutationObserver((function(t,r){for(var i=0;i"},f.prototype.getFinalUrl=function(t,e,r){var i=t?this.wb_rel_prefix:this.wb_abs_prefix;return null==e&&(e=this.wb_info.mod),this.wb_info.is_live||(i+=this.wb_info.wombat_ts),"/"!==(i+=e)[i.length-1]&&(i+="/"),i+r},f.prototype.resolveRelUrl=function(t,e){var r=this;function i(t){return!(!t||!t.baseURI)&&(t.baseURI.startsWith(r.HTTPS_PREFIX)||t.baseURI.startsWith(r.HTTP_PREFIX))}var o=null;return o=i(e)?e.baseURI:i(this.$wbwindow.document)?this.$wbwindow.document.baseURI:this.$wbwindow.__WB_replay_top.document.baseURI,new this.URL(t,o).href},f.prototype.extractOriginalURL=function(t){if(!t)return"";if(this.wb_is_proxy)return t;var e,r=t.toString(),i=r;if(this.startsWithOneOf(i,this.IGNORE_PREFIXES))return i;if(i.startsWith(this.wb_info.static_prefix))return i;e=this.startsWith(i,this.wb_abs_prefix)?this.wb_abs_prefix.length:this.wb_rel_prefix&&this.startsWith(i,this.wb_rel_prefix)?this.wb_rel_prefix.length:this.wb_rel_prefix?1:0;var o=i.indexOf("/http",e);return o<0&&(o=i.indexOf("///",e)),o<0&&(o=i.indexOf("/blob:",e)),o<0&&(o=i.indexOf("/about:blank",e)),o>=0?i=i.substr(o+1):((o=i.indexOf(this.wb_replay_prefix))>=0&&(i=i.substr(o+this.wb_replay_prefix.length)),i.length>4&&"_"===i.charAt(2)&&"/"===i.charAt(3)&&(i=i.substr(4)),i===r||this.startsWithOneOf(i,this.VALID_PREFIXES)||this.startsWith(i,"blob:")||(i=this.wb_orig_scheme+i)),"/"===r.charAt(0)&&"/"!==r.charAt(1)&&this.startsWith(i,this.wb_orig_origin)&&(i=i.substr(this.wb_orig_origin.length)),this.startsWith(i,this.REL_PREFIX)?this.wb_info.wombat_scheme+":"+i:i},f.prototype.makeParser=function(t,e){var r=this.extractOriginalURL(t),i=e;return e||(i="about:blank"===this.$wbwindow.location.href&&this.$wbwindow.opener?this.$wbwindow.opener.document:this.$wbwindow.document),this._makeURLParser(r,i)},f.prototype._makeURLParser=function(t,e){try{return new this.URL(t,e.baseURI)}catch(t){}var r=e.createElement("a");return r._no_rewrite=!0,r.href=t,r},f.prototype.defProp=function(t,e,r,i,o){var n=Object.getOwnPropertyDescriptor(t,e);if(n&&!n.configurable)return!1;if(!i)return!1;var s={configurable:!0,enumerable:o||!1,get:i};r&&(s.set=r);try{return Object.defineProperty(t,e,s),!0}catch(t){return console.warn("Failed to redefine property %s",e,t.message),!1}},f.prototype.defGetterProp=function(t,e,r,i){var o=Object.getOwnPropertyDescriptor(t,e);if(o&&!o.configurable)return!1;if(!r)return!1;try{return Object.defineProperty(t,e,{configurable:!0,enumerable:i||!1,get:r}),!0}catch(t){return console.warn("Failed to redefine property %s",e,t.message),!1}},f.prototype.getOrigGetter=function(t,e){var r;if(t.__lookupGetter__&&(r=t.__lookupGetter__(e)),!r&&Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);i&&(r=i.get)}return r},f.prototype.getOrigSetter=function(t,e){var r;if(t.__lookupSetter__&&(r=t.__lookupSetter__(e)),!r&&Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(t,e);i&&(r=i.set)}return r},f.prototype.getAllOwnProps=function(t){for(var e=[],r=Object.getOwnPropertyNames(t),i=0;i "+n),r.href=n}}},f.prototype.checkLocationChange=function(t,e){var r=typeof t,i=e?this.$wbwindow.__WB_replay_top.location:this.$wbwindow.location;"string"===r?this.updateLocation(t,i.href,i):"object"===r&&this.updateLocation(t.href,t._orig_href,i)},f.prototype.checkAllLocations=function(){if(this.wb_wombat_updating)return!1;this.wb_wombat_updating=!0,this.checkLocationChange(this.$wbwindow.WB_wombat_location,!1),this.$wbwindow.WB_wombat_location!=this.$wbwindow.__WB_replay_top.WB_wombat_location&&this.checkLocationChange(this.$wbwindow.__WB_replay_top.WB_wombat_location,!0),this.wb_wombat_updating=!1},f.prototype.proxyToObj=function(t){if(t)try{var e=t.__WBProxyRealObj__;if(e)return e}catch(t){}return t},f.prototype.objToProxy=function(t){if(t)try{var e=t._WB_wombat_obj_proxy;if(e)return e}catch(t){}return t},f.prototype.defaultProxyGet=function(t,e,r,i){switch(e){case"__WBProxyRealObj__":return t;case"location":case"WB_wombat_location":return t.WB_wombat_location;case"_WB_wombat_obj_proxy":return t._WB_wombat_obj_proxy;case"__WB_pmw":case this.WB_ASSIGN_FUNC:case this.WB_CHECK_THIS_FUNC:return t[e];case"origin":return t.WB_wombat_location.origin;case"constructor":return t.constructor}var o=Reflect.get(t,e),n=typeof o;if("string"===n&&o){var s=parseInt(e);if(o&&!isNaN(s))try{return this.initNewWindowWombat(o),o._WB_wombat_obj_proxy}catch(t){}}else{if("function"===n&&-1!==r.indexOf(e)){switch(e){case"requestAnimationFrame":case"cancelAnimationFrame":if(!this.isNativeFunction(o))return o;break;case"eval":if(this.isNativeFunction(o))return this.wrappedEval(o)}var a=i[e];if(!a||a.original!==o){const r=o.bind(t);for(const t of Object.getOwnPropertyNames(o))if(!this.SKIP_OWN_FUNC_PROPS.includes(t))try{r[t]=o[t]}catch(t){}return i[e]={original:o,boundFn:r},r}return a.boundFn}if("object"===n&&o&&o._WB_wombat_obj_proxy)return o instanceof this.WBWindow&&this.initNewWindowWombat(o),o._WB_wombat_obj_proxy}return o},f.prototype.setLoc=function(t,e){var r=this.makeParser(e,t.ownerDocument);t._orig_href=e,t._parser=r;var i=r.href;t._hash=r.hash,t._href=i,t._host=r.host,t._hostname=r.hostname,r.origin?t._origin=r.host?r.origin:"null":t._origin=r.protocol+"//"+r.hostname+(r.port?":"+r.port:""),t._pathname=r.pathname,t._port=r.port,t._protocol=r.protocol,t._search=r.search,Object.defineProperty||(t.href=i,t.hash=r.hash,t.host=t._host,t.hostname=t._hostname,t.origin=t._origin,t.pathname=t._pathname,t.port=t._port,t.protocol=t._protocol,t.search=t._search)},f.prototype.makeGetLocProp=function(t,e){var r=this;return function(){if(this._no_rewrite)return e.call(this,t);var i=e.call(this,"href");return"href"===t?r.extractOriginalURL(i):"ancestorOrigins"===t?[]:(this._orig_href!==i&&r.setLoc(this,i),this["_"+t])}},f.prototype.makeSetLocProp=function(t,e,r){var i=this;return function(o){if(this._no_rewrite)return e.call(this,t,o);if(this["_"+t]!==o){this["_"+t]=o;var n=r.call(this),s=i.makeParser(n,this.ownerDocument),a=!1;if("href"===t&&"string"==typeof o)if(o&&s instanceof i.URL)try{o=new i.URL(o,s).href}catch(t){console.warn("Error resolving URL",t)}else o&&("."===o[0]||"#"===o[0]?o=i.resolveRelUrl(o,this.ownerDocument):"/"===o[0]&&(o.length>1&&"/"===o[1]?o=s.protocol+o:(a=!0,o=WB_wombat_location.origin+o)));try{s[t]=o}catch(e){console.log("Error setting "+t+" = "+o)}"hash"===t?(o=s[t],e.call(this,"hash",o)):(a=a||o===s.pathname,o=i.rewriteUrl(s.href,a),e.call(this,"href",o))}}},f.prototype.styleReplacer=function(t,e,r,i,o,n){return e+this.rewriteUrl(r)+i},f.prototype.domConstructorErrorChecker=function(t,e,r,i){var o,n="number"==typeof i?i:1;if(t instanceof this.WBWindow?o="Failed to construct \'"+e+"\': Please use the \'new\' operator, this DOM object constructor cannot be called as a function.":r&&r.length=0)return o;if(0===o.indexOf(this.wb_rel_prefix)&&o.indexOf("http")>1){var a=o.indexOf(":/");return a>0&&"/"!==o[a+2]?o.substring(0,a+2)+"/"+o.substring(a+2):o}return this.getFinalUrl(!0,r,this.wb_orig_origin+o)}"."===o.charAt(0)&&(o=this.resolveRelUrl(o,i));var w=this.startsWithOneOf(o.toLowerCase(),this.VALID_PREFIXES);if(w){var h=this.replayTopHost,p=this.replayTopProtocol,c=w+h+"/";if(this.startsWith(o,c)){if(this.startsWith(o,this.wb_replay_prefix))return o;var l=p+"//",_=o.substring(c.length),u=!1;return _.indexOf(this.wb_rel_prefix)<0&&o.indexOf("/static/")<0&&(_=this.getFinalUrl(!0,r,WB_wombat_location.origin+"/"+_),u=!0),w!==l&&w!==this.REL_PREFIX&&(u=!0),u&&(o=e?"":l+h,_&&"/"!==_[0]&&(o+="/"),o+=_),o}return this.getFinalUrl(e,r,o)}return(w=this.startsWithOneOf(o,this.BAD_PREFIXES))?this.getFinalUrl(e,r,this.extractOriginalURL(o)):o},f.prototype.rewriteUrl=function(t,e,r,i){var o;return o=this.wb_info.rewrite_function?this.wb_info.rewrite_function(t,e,r,i):this.rewriteUrl_(t,e,r,i),this.debug_rw&&(t!==o?console.log("REWRITE: "+t+" -> "+o):console.log("NOT REWRITTEN "+t)),o},f.prototype.performAttributeRewrite=function(t,e,r,i){switch(e){case"innerHTML":case"outerHTML":return this.rewriteHtml(r);case"filter":return this.rewriteInlineStyle(r);case"style":return this.rewriteStyle(r);case"srcset":return this.rewriteSrcset(r,t)}if(i&&!this.startsWithOneOf(r,this.VALID_PREFIXES))return r;var o=this.rwModForElement(t,e);this.wbUseAFWorker&&this.WBAutoFetchWorker&&this.isSavedDataSrcSrcset(t)&&this.WBAutoFetchWorker.preserveDataSrcset(t);var n=this.rewriteUrl(r,!1,o,t.ownerDocument);return"esm_"===o&&n&&n.indexOf("esm_/")<0&&(n=n.replace(/(\\/[\\d]*)([\\w]+_)(?=\\/)/,"$1esm_")),n},f.prototype.rewriteAttr=function(t,e,r){var i=!1;if(!t||!t.getAttribute||t._no_rewrite||t["_"+e]||t.tagName&&t.tagName.indexOf("-")>0)return i;var o=this.wb_getAttribute.call(this.proxyToObj(t),e);if(!o||this.startsWith(o,"javascript:"))return i;var n=this.performAttributeRewrite(t,e,o,r);return n!==o&&(this.removeWBOSRC(t),this.wb_setAttribute.call(t,e,n),i=!0),i},f.prototype.noExceptRewriteStyle=function(t){try{return this.rewriteStyle(t)}catch(e){return t}},f.prototype.rewriteStyle=function(t){if(!t)return t;var e=t;return"object"==typeof t&&(e=t.toString()),"string"==typeof e?e.replace(this.STYLE_REGEX,this.styleReplacer).replace(this.IMPORT_REGEX,this.styleReplacer).replace(this.no_wombatRe,""):e},f.prototype.rewriteSrcset=function(t,e){if(!t)return"";for(var r=t.split(this.srcsetRe),i=[],o=this.rwModForElement(e,"srcset"),n=0;n=0){var o="javascript:";r=o+"window.parent._wb_wombat.initNewWindowWombat(window);"+i.substr(o.length)}return r||(r=this.rewriteUrl(i,!1,this.rwModForElement(t,e))),r!==i&&(this.wb_setAttribute.call(t,e,r),!0)},f.prototype.rewriteScript=function(t){if(t.hasAttribute("src")||!t.textContent||!this.$wbwindow.Proxy)return this.rewriteAttr(t,"src");if(this.skipWrapScriptBasedOnType(t.type))return!1;var e=t.textContent.trim();return!this.skipWrapScriptTextBasedOnText(e)&&(t.textContent=this.wrapScriptTextJsProxy(e),this.wb_info.injectDocClose&&t.textContent.trim().length&&(t.textContent+=";document.close();"),!0)},f.prototype.rewriteSVGElem=function(t){var e=this.rewriteAttr(t,"filter");return e=this.rewriteAttr(t,"style")||e,e=this.rewriteAttr(t,"xlink:href")||e,e=this.rewriteAttr(t,"href")||e,e=this.rewriteAttr(t,"src")||e},f.prototype.rewriteElem=function(t){var e=!1;if(!t)return e;if(t instanceof SVGElement)e=this.rewriteSVGElem(t);else switch(t.tagName){case"META":var r=this.wb_getAttribute.call(t,"http-equiv");r&&"content-security-policy"===r.toLowerCase()&&(this.wb_setAttribute.call(t,"http-equiv","_"+r),e=!0);break;case"STYLE":var i=this.rewriteStyle(t.textContent);t.textContent!==i&&(t.textContent=i,e=!0,this.wbUseAFWorker&&this.WBAutoFetchWorker&&null!=t.sheet&&this.WBAutoFetchWorker.deferredSheetExtraction(t.sheet));break;case"LINK":e=this.rewriteAttr(t,"href"),this.wbUseAFWorker&&"stylesheet"===t.rel&&this._addEventListener(t,"load",this.utilFns.wbSheetMediaQChecker);break;case"IMG":e=this.rewriteAttr(t,"src"),e=this.rewriteAttr(t,"srcset")||e,e=this.rewriteAttr(t,"style")||e,this.wbUseAFWorker&&this.WBAutoFetchWorker&&t.dataset.srcset&&this.WBAutoFetchWorker.preserveDataSrcset(t);break;case"OBJECT":if(this.wb_info.isSW&&t.parentElement){var o;"application/pdf"===t.getAttribute("type")?o="IFRAME":"image/svg+xml"===t.getAttribute("type")&&(o="IMG");for(var n=this.$wbwindow.document.createElement(o),s=0;s0;)for(var i=r.shift(),o=0;o=0&&(r=r.replace(/((id|class)=".*)WB_wombat_([^"]+)/,"$1$3")),!this.$wbwindow.HTMLTemplateElement||this.FullHTMLRegex.test(r))return this.rewriteHtmlFull(r,e);var i=(new DOMParser).parseFromString("","text/html");if(!i||!this.nodeHasChildren(i.head)||!i.head.children[0].content)return r;var o=i.head.children[0];if(o._no_rewrite=!0,this.recurseRewriteElem(o.content)){var n=o.innerHTML;if(e){var s=o.content.children&&o.content.children[0];if(s){var a="";if(this.endsWith(n,a)&&!this.endsWith(r.toLowerCase(),a))n=n.substring(0,n.length-a.length);else if(n.trimEnd().endsWith(a)&&!r.trimEnd().endsWith(a)){var w=r.lastIndexOf(a);w>0&&(n+=r.slice(w+a.length))}}else if("<"!==r[0]||">"!==r[r.length-1])return void(this.write_buff+=r)}return n}return r},f.prototype.rewriteHtmlFull=function(t,e){var r=(new DOMParser).parseFromString(t,"text/html");if(!r)return t;for(var i=!1,o=0;o=0)r.documentElement._no_rewrite=!0,n=this.reconstructDocType(r.doctype)+r.documentElement.outerHTML;else{r.head._no_rewrite=!0,r.body._no_rewrite=!0;var s=this.nodeHasChildren(r.head),a=this.nodeHasChildren(r.body);if(n=(s?r.head.outerHTML:"")+(a?r.body.outerHTML:""),e)if(r.all.length>3){var w="";this.endsWith(n,w)&&!this.endsWith(t.toLowerCase(),w)&&(n=n.substring(0,n.length-w.length))}else if("<"!==t[0]||">"!==t[t.length-1])return void(this.write_buff+=t);n=this.reconstructDocType(r.doctype)+n}return n}return t},f.prototype.rewriteInlineStyle=function(t){var e;try{e=decodeURIComponent(t)}catch(r){e=t}if(e!==t){var r=this.rewriteStyle(e).split(",",2);return r[0]+","+encodeURIComponent(r[1])}return this.rewriteStyle(t)},f.prototype.rewriteCookie=function(t){var e=this,r=t.replace(this.wb_abs_prefix,"").replace(this.wb_rel_prefix,"");return r=r.replace(this.cookie_domain_regex,(function(t,i){var o={domain:i,cookie:r,wb_type:"cookie"};return e.sendTopMessage(o,!0),e.$wbwindow.location.hostname.indexOf(".")>=0&&!e.IP_RX.test(e.$wbwindow.location.hostname)?"Domain=."+e.$wbwindow.location.hostname:""})).replace(this.cookie_path_regex,(function(t,r){var i=e.rewriteUrl(r);return 0===i.indexOf(e.wb_curr_host)&&(i=i.substring(e.wb_curr_host.length)),"Path="+i})),"https:"!==e.$wbwindow.location.protocol&&(r=r.replace("secure","")),r.replace(",|",",")},f.prototype.rewriteWorker=function(t){if(!t)return t;var e=0===(t=t.toString()).indexOf("blob:"),r=0===t.indexOf("javascript:");if(!e&&!r){if(!this.startsWithOneOf(t,this.VALID_PREFIXES)&&!this.startsWith(t,"/")&&!this.startsWithOneOf(t,this.BAD_PREFIXES)){var i=this.resolveRelUrl(t,this.$wbwindow.document);return this.rewriteUrl(i,!1,"wkr_",this.$wbwindow.document)}return this.rewriteUrl(t,!1,"wkr_",this.$wbwindow.document)}var o=r?t.replace("javascript:",""):null;if(e){var n=new XMLHttpRequest;this.utilFns.XHRopen.call(n,"GET",t,!1),this.utilFns.XHRsend.call(n),o=n.responseText.replace(this.workerBlobRe,"").replace(this.rmCheckThisInjectRe,"this")}if(this.wb_info.static_prefix||this.wb_info.ww_rw_script){var s=this.$wbwindow.document.baseURI;o="(function() { self.importScripts(\'"+(this.wb_info.ww_rw_script||this.wb_info.static_prefix+"wombatWorkers.js")+"\'); new WBWombat({\'prefix\': \'"+this.wb_abs_prefix+"\', \'prefixMod\': \'"+this.wb_abs_prefix+"wkrf_/\', \'originalURL\': "+JSON.stringify(s)+"}); })();"+o}var a=new Blob([o],{type:"application/javascript"});return this.URL.createObjectURL(a)},f.prototype.rewriteTextNodeFn=function(t,e,r){var i,o=this.proxyToObj(t);if(r.length>0&&o.parentElement&&"STYLE"===o.parentElement.tagName){i=new Array(r.length);var n=r.length-1;2===n?(i[0]=r[0],i[1]=r[1]):1===n&&(i[0]=r[0]),i[n]=this.rewriteStyle(r[n])}else i=r;return e.__WB_orig_apply?e.__WB_orig_apply(o,i):e.apply(o,i)},f.prototype.rewriteChildNodeFn=function(t,e,r){var i=this.proxyToObj(t);if(0===r.length)return e.call(i);var o=this.rewriteElementsInArguments(r);return e.__WB_orig_apply?e.__WB_orig_apply(i,o):e.apply(i,o)},f.prototype.rewriteInsertAdjHTMLOrElemArgs=function(t,e,r,i,o){var n=this.proxyToObj(t);return n._no_rewrite?e.call(n,r,i):o?e.call(n,r,this.rewriteHtml(i)):(this.rewriteElemComplete(i),e.call(n,r,i))},f.prototype.rewriteSetTimeoutInterval=function(t,e,r){var i=this.isString(r[0]),o=i?new Array(r.length):r;if(i){this.$wbwindow.Proxy?o[0]=this.wrapScriptTextJsProxy(r[0]):o[0]=r[0].replace(/\\blocation\\b/g,"WB_wombat_$&");for(var n=1;n(t.includes(r)&&(i=o.rewriteStyle(i)),e[r]=i,!0),get(t,i,n){var s=t[i];return"function"!=typeof s||"setProperty"!==i&&!o.isNativeFunction(s)?s:(r[i]||(r[i]=s.bind(e)),r[i])}})}))},f.prototype.overrideIframeContentAccess=function(t){if(this.$wbwindow.HTMLIFrameElement&&this.$wbwindow.HTMLIFrameElement.prototype){var e=this.$wbwindow.HTMLIFrameElement.prototype,r=this.getOrigGetter(e,t);if(r){var i=this.getOrigSetter(e,t),o=this;this.defProp(e,t,i,(function(){return o.initIframeWombat(this),o.objToProxy(r.call(this))})),e["_get_"+t]=r}}},f.prototype.overrideSWAccess=function(t){if(t.navigator.serviceWorker&&t.navigator.serviceWorker.controller){t._WB_wombat_sw=t.navigator.serviceWorker;var e={controller:null,ready:Promise.resolve({unregister:function(){}}),register:function(){return Promise.reject()},addEventListener:function(){},removeEventListener:function(){},onmessage:null,oncontrollerchange:null,getRegistrations:function(){return Promise.resolve([])},getRegistration:function(){return Promise.resolve(void 0)},startMessages:function(){}};this.defGetterProp(t.navigator,"serviceWorker",(function(){return e}))}},f.prototype.overrideFuncThisProxyToObj=function(t,e,r){if(t){var i=r;if(!r&&t.prototype&&t.prototype[e]?i=t.prototype:!r&&t[e]&&(i=t),i){var o=this,n=i[e];i[e]=function(){return n.apply(o.proxyToObj(this),arguments)}}}},f.prototype.overrideFuncArgProxyToObj=function(t,e,r){if(t&&t.prototype){var i=r||0,o=t.prototype[e];if(o){var n=this;t.prototype[e]=function(){for(var t=new Array(arguments.length),e=0;e0&&i(this.$wbwindow.CSSStyleValue,"parse"),this.$wbwindow.CSSStyleValue.parseAll&&this.$wbwindow.CSSStyleValue.parseAll.toString().indexOf("[native code]")>0&&i(this.$wbwindow.CSSStyleValue,"parseAll")}if(this.$wbwindow.CSSKeywordValue&&this.$wbwindow.CSSKeywordValue.prototype){var o=this.$wbwindow.CSSKeywordValue;this.$wbwindow.CSSKeywordValue=(t=this.$wbwindow.CSSKeywordValue,function(e){return r.domConstructorErrorChecker(this,"CSSKeywordValue",arguments),new t(r.rewriteStyle(e))}),this.$wbwindow.CSSKeywordValue.prototype=o.prototype,Object.defineProperty(this.$wbwindow.CSSKeywordValue.prototype,"constructor",{value:this.$wbwindow.CSSKeywordValue}),e(this.$wbwindow.CSSKeywordValue,"CSSKeywordValue")}if(this.$wbwindow.StylePropertyMap&&this.$wbwindow.StylePropertyMap.prototype){var n=this.$wbwindow.StylePropertyMap.prototype.set;this.$wbwindow.StylePropertyMap.prototype.set=function(){if(arguments.length<=1)return n.__WB_orig_apply?n.__WB_orig_apply(this,arguments):n.apply(this,arguments);var t=new Array(arguments.length);t[0]=arguments[0];for(var e=1;e")&&(e[0]=r.rewriteHtml(e[0]),i.type="text/html"),new t(e,i)}),this.$wbwindow.Blob.prototype=e.prototype}},f.prototype.initIntersectionObsOverride=function(){var t,e=this.$wbwindow.IntersectionObserver,r=this;this.$wbwindow.IntersectionObserver=(t=this.$wbwindow.IntersectionObserver,function(e,i){return i&&i.root&&(i.root=r.proxyToObj(i.root)),new t(e,i)}),this.$wbwindow.IntersectionObserver.prototype=e.prototype,Object.defineProperty(this.$wbwindow.IntersectionObserver.prototype,"constructor",{value:this.$wbwindow.IntersectionObserver})},f.prototype.initWSOverride=function(){this.$wbwindow.WebSocket&&this.$wbwindow.WebSocket.prototype&&(this.$wbwindow.WebSocket=function(t){function e(t,r){this.openCallbacks=[],this.addEventListener=function(t,r){"open"===t&&e.openCallbacks.push(r)},this.removeEventListener=function(){},this.close=function(){},this.send=function(t){console.log("ws send",t)},this.protocol=r&&r.length?r[0]:"",this.url=t,this.readyState=1;var i=this;setTimeout((function(){var t=new CustomEvent("open");i.onopen&&i.onopen(t),i.openCallbacks.forEach((e=>e(t)))}),500)}return e.CONNECTING=0,e.OPEN=1,e.CLOSING=2,e.CLOSED=3,e}(this.$wbwindow.WebSocket),Object.defineProperty(this.$wbwindow.WebSocket.prototype,"constructor",{value:this.$wbwindow.WebSocket}),e(this.$wbwindow.WebSocket,"WebSocket"))},f.prototype.initDocTitleOverride=function(){var t=this.getOrigGetter(this.$wbwindow.document,"title"),e=this.getOrigSetter(this.$wbwindow.document,"title"),r=this;this.defProp(this.$wbwindow.document,"title",(function(t){var i=e.call(this,t),o={wb_type:"title",title:t};return r.sendTopMessage(o),i}),t)},f.prototype.initFontFaceOverride=function(){if(this.$wbwindow.FontFace){var t,r=this,i=this.$wbwindow.FontFace;this.$wbwindow.FontFace=(t=this.$wbwindow.FontFace,function(e,i,o){r.domConstructorErrorChecker(this,"FontFace",arguments,2);var n=i;return null!=i&&(n="string"!=typeof i?r.rewriteInlineStyle(i.toString()):r.rewriteInlineStyle(i)),new t(e,n,o)}),this.$wbwindow.FontFace.prototype=i.prototype,Object.defineProperty(this.$wbwindow.FontFace.prototype,"constructor",{value:this.$wbwindow.FontFace}),e(this.$wbwindow.FontFace,"FontFace")}},f.prototype.initFixedRatio=function(t){try{this.$wbwindow.devicePixelRatio=t}catch(t){}if(Object.defineProperty)try{Object.defineProperty(this.$wbwindow,"devicePixelRatio",{value:t,writable:!1})}catch(t){}},f.prototype.initPaths=function(t){t.wombat_opts=t.wombat_opts||{},Object.assign(this.wb_info,t),this.wb_opts=t.wombat_opts,this.wb_replay_prefix=t.prefix,this.wb_is_proxy=t.proxy_magic||!this.wb_replay_prefix,this.wb_info.top_host=this.wb_info.top_host||"*",this.wb_curr_host=this.$wbwindow.location.protocol+"//"+this.$wbwindow.location.host,this.wb_info.wombat_opts=this.wb_info.wombat_opts||{},this.wb_orig_scheme=t.wombat_scheme+"://",this.wb_orig_origin=this.wb_orig_scheme+t.wombat_host,this.wb_abs_prefix=this.wb_replay_prefix,!t.is_live&&t.wombat_ts?this.wb_capture_date_part="/"+t.wombat_ts+"/":this.wb_capture_date_part="",this.initBadPrefixes(this.wb_replay_prefix),this.initCookiePreset()},f.prototype.initSeededRandom=function(t){this.$wbwindow.Math.seed=parseInt(t);var e=this;this.$wbwindow.Math.random=function(){return e.$wbwindow.Math.seed=(9301*e.$wbwindow.Math.seed+49297)%233280,e.$wbwindow.Math.seed/233280}},f.prototype.initHistoryOverrides=function(){this.overrideHistoryFunc("pushState"),this.overrideHistoryFunc("replaceState");var t=this;this.$wbwindow.addEventListener("popstate",(function(e){t.sendHistoryUpdate(t.$wbwindow.WB_wombat_location.href,t.$wbwindow.document.title)}))},f.prototype.initCookiePreset=function(){if(this.wb_info.presetCookie)for(var t=this.wb_info.presetCookie.split(";"),e=0;e2&&!this.__WB_xhr_open_arguments[2]&&-1===navigator.userAgent.indexOf("Firefox")&&(this.__WB_xhr_open_arguments[2]=!0,console.warn("wombat.js: Sync XHR not supported in SW-based replay in this browser, converted to async")),this._no_rewrite||(this.__WB_xhr_open_arguments[1]=i.rewriteUrl(this.__WB_xhr_open_arguments[1])),o.apply(this,this.__WB_xhr_open_arguments),!i.startsWith(this.__WB_xhr_open_arguments[1],"data:")){for(const[t,e]of this.__WB_xhr_headers.entries())n.call(this,t,e);n.call(this,"X-Pywb-Requested-With","XMLHttpRequest")}return s.call(this,t)}}else if(this.$wbwindow.XMLHttpRequest.prototype.open){var w=this.$wbwindow.XMLHttpRequest.prototype.open;this.utilFns.XHRopen=w,this.utilFns.XHRsend=this.$wbwindow.XMLHttpRequest.prototype.send,this.$wbwindow.XMLHttpRequest.prototype.open=function(t,e,r,o,n){var s=this._no_rewrite?e:i.rewriteUrl(e),a=!0;null==r||r||(a=!1),w.call(this,t,s,a,o,n),i.startsWith(s,"data:")||this.setRequestHeader("X-Pywb-Requested-With","XMLHttpRequest")}}if(this.$wbwindow.fetch){var h=this.$wbwindow.fetch;this.$wbwindow.fetch=function(t,e){var r;if(t instanceof Request){var o=i.rewriteUrl(t.url);t.__WB_no_unrewrite=!0,r=o===t.url?t:new Request(o,t),delete t.__WB_no_unrewrite}else t=i.rewriteUrl(t.toString()),r=new Request(t,e);return h.call(i.proxyToObj(this),r)}}if(this.$wbwindow.Request&&this.$wbwindow.Request.prototype){var p=this.$wbwindow.Request;this.$wbwindow.Request=(t=this.$wbwindow.Request,function e(r,o){i.domConstructorErrorChecker(this,"Request",arguments);var n=o||{},s=r,a=typeof r;switch(a){case"string":s=i.rewriteUrl(r);break;case"object":if(s=r,r.url){var w=i.rewriteUrl(r.url);w!==r.url&&(s=new t(w,r))}else r.href&&(s=i.rewriteUrl(r.toString(),!0))}let h=!1;if(n&&n.referrer){var p=i.rewriteUrl(n.referrer);p!==n.referrer&&(n instanceof e?(n.__WB_no_unrewrite=!0,h=!0):n.referrer=p)}var c=new t(s,n);return h&&delete n.__WB_no_unrewrite,c}),this.$wbwindow.Request.prototype=p.prototype,Object.defineProperty(this.$wbwindow.Request.prototype,"constructor",{value:this.$wbwindow.Request}),this.overridePropExtract(this.$wbwindow.Request.prototype,"url"),this.overridePropExtract(this.$wbwindow.Request.prototype,"referrer")}if(this.$wbwindow.Response&&this.$wbwindow.Response.prototype){var c=this.$wbwindow.Response.prototype.redirect;this.$wbwindow.Response.prototype.redirect=function(t,e){var r=i.rewriteUrl(t,!0,null,i.$wbwindow.document);return c.call(this,r,e)},this.overridePropExtract(this.$wbwindow.Response.prototype,"url")}if(this.$wbwindow.EventSource&&this.$wbwindow.EventSource.prototype){var l=this.$wbwindow.EventSource;this.$wbwindow.EventSource=(r=this.$wbwindow.EventSource,function(t,e){i.domConstructorErrorChecker(this,"EventSource",arguments);var o=t;return null!=t&&(o=i.rewriteUrl(t)),new r(o,e)}),this.$wbwindow.EventSource.prototype=l.prototype,Object.defineProperty(this.$wbwindow.EventSource.prototype,"constructor",{value:this.$wbwindow.EventSource}),e(this.$wbwindow.EventSource,"EventSource")}},f.prototype.initElementGetSetAttributeOverride=function(){if(!this.wb_opts.skip_setAttribute&&this.$wbwindow.Element&&this.$wbwindow.Element.prototype){var t=this,e=this.$wbwindow.Element.prototype;if(e.setAttribute){var r=e.setAttribute;e._orig_setAttribute=r,e.setAttribute=function(e,i){var o=i;if(e&&"string"==typeof o){var n=e.toLowerCase();if("LINK"===this.tagName&&"href"===n&&0===o.indexOf("data:text/css"))o=t.rewriteInlineStyle(i);else if("style"===n)o=t.rewriteStyle(i);else if("srcset"===n||"imagesrcset"===n&&"LINK"===this.tagName)o=t.rewriteSrcset(i,this);else{t.shouldRewriteAttr(this.tagName,n)&&(t.removeWBOSRC(this),this._no_rewrite||(o=t.rewriteUrl(i,!1,t.rwModForElement(this,n))))}}return r.call(this,e,o)}}if(e.getAttribute){var i=e.getAttribute;this.wb_getAttribute=i,e.getAttribute=function(e){var r=i.call(this,e);if(null===r)return r;var o=e;if(e&&(o=e.toLowerCase()),t.shouldRewriteAttr(this.tagName,o)){var n=t.retrieveWBOSRC(this);return n||t.extractOriginalURL(r)}return t.startsWith(o,"data-")&&t.startsWithOneOf(r,t.wb_prefixes)?t.extractOriginalURL(r):r}}}},f.prototype.initSvgImageOverrides=function(){if(this.$wbwindow.SVGImageElement){var t=this.$wbwindow.SVGImageElement.prototype,e=t.getAttribute,r=t.getAttributeNS,i=t.setAttribute,o=t.setAttributeNS,n=this;t.getAttribute=function(t){var r=e.call(this,t);return t.indexOf("xlink:href")>=0||"href"===t?n.extractOriginalURL(r):r},t.getAttributeNS=function(t,e){var i=r.call(this,t,e);return e.indexOf("xlink:href")>=0||"href"===e?n.extractOriginalURL(i):i},t.setAttribute=function(t,e){var r=e;return(t.indexOf("xlink:href")>=0||"href"===t)&&(r=n.rewriteUrl(e)),i.call(this,t,r)},t.setAttributeNS=function(t,e,r){var i=r;return(e.indexOf("xlink:href")>=0||"href"===e)&&(i=n.rewriteUrl(r)),o.call(this,t,e,i)}}},f.prototype.initCreateElementNSFix=function(){if(this.$wbwindow.document.createElementNS&&this.$wbwindow.Document.prototype.createElementNS){var t=this.$wbwindow.document.createElementNS,e=this,r=function(r,i){return t.call(e.proxyToObj(this),e.extractOriginalURL(r),i)};this.$wbwindow.Document.prototype.createElementNS=r,this.$wbwindow.document.createElementNS=r}},f.prototype.initQuerySelectorOverride=function(){if(this.$wbwindow.document.querySelector&&this.$wbwindow.Document.prototype.querySelector){var t=this,e=this.$wbwindow.document.querySelector,r=function(r){return e.call(t.proxyToObj(this),n(r))},i=this.$wbwindow.document.querySelectorAll,o=function(e){return i.call(t.proxyToObj(this),n(e))};this.$wbwindow.Document.prototype.querySelector=r,this.$wbwindow.document.querySelector=r,this.$wbwindow.Document.prototype.querySelectorAll=o,this.$wbwindow.document.querySelectorAll=o}function n(t){if("string"==typeof t)try{t=t.replace(/((?:^|\\s)\\b\\w+\\[(?:src|href|data-href))[\\^]?(=[\'"]?(?:https?[:])?\\/\\/)/,"$1*$2")}catch(t){}return t}},f.prototype.initInsertAdjacentElementHTMLOverrides=function(){var t=this.$wbwindow.Element;if(t&&t.prototype){var e=t.prototype,r=this.rewriteInsertAdjHTMLOrElemArgs;if(e.insertAdjacentHTML){var i=e.insertAdjacentHTML;e.insertAdjacentHTML=function(t,e){return r(this,i,t,e,!0)}}if(e.insertAdjacentElement){var o=e.insertAdjacentElement;e.insertAdjacentElement=function(t,e){return r(this,o,t,e,!1)}}}},f.prototype.initDomOverride=function(){var t=this.$wbwindow.Node;if(t&&t.prototype){var e=this.rewriteNodeFuncArgs;if(t.prototype.appendChild){var r=t.prototype.appendChild;t.prototype.appendChild=function(t,i){return e(this,r,t,i)}}if(t.prototype.insertBefore){var i=t.prototype.insertBefore;t.prototype.insertBefore=function(t,r){return e(this,i,t,r)}}if(t.prototype.replaceChild){var o=t.prototype.replaceChild;t.prototype.replaceChild=function(t,r){return e(this,o,t,r)}}this.overridePropToProxy(t.prototype,"ownerDocument"),this.overridePropToProxy(this.$wbwindow.HTMLHtmlElement.prototype,"parentNode"),this.overridePropToProxy(this.$wbwindow.Event.prototype,"target")}this.$wbwindow.Element&&this.$wbwindow.Element.prototype&&(this.overrideParentNodeAppendPrepend(this.$wbwindow.Element),this.overrideChildNodeInterface(this.$wbwindow.Element,!1)),this.$wbwindow.DocumentFragment&&this.$wbwindow.DocumentFragment.prototype&&this.overrideParentNodeAppendPrepend(this.$wbwindow.DocumentFragment)},f.prototype.initDocOverrides=function(t){if(Object.defineProperty){this.overrideReferrer(t),this.defGetterProp(t,"origin",(function(){return this.WB_wombat_location.origin})),this.defGetterProp(this.$wbwindow,"origin",(function(){return this.WB_wombat_location.origin}));var e=this;this.defProp(t,"domain",(function(t){var r=this.WB_wombat_location;r&&e.endsWith(r.hostname,t)&&(this.__wb_domain=t)}),(function(){return this.__wb_domain||this.WB_wombat_location.hostname}))}},f.prototype.initDocWriteOpenCloseOverride=function(){if(this.$wbwindow.DOMParser){var t=this.$wbwindow.Document.prototype,e=this.$wbwindow.document;this._writeBuff="";var r=this,i=e.write,o=function(){return d(this,i,u(arguments))};e.write=o,t.write=o;var n=e.writeln,s=function(){return d(this,n,u(arguments))};e.writeln=s,t.writeln=s;var a=e.open,w=function(){var t,e=r.proxyToObj(this);if(3===arguments.length){var i=r.rewriteUrl(arguments[0],!1,"mp_");t=a.call(e,i,arguments[1],arguments[2]),r.initNewWindowWombat(t,arguments[0])}else t=a.call(e),_()?r._writeBuff="":r.initNewWindowWombat(e.defaultView);return t};e.open=w,t.open=w;var h=e.close,p=function(){if(!r._writeBuff){var t=r.proxyToObj(this);return r.initNewWindowWombat(t.defaultView),h.__WB_orig_apply?h.__WB_orig_apply(t,arguments):h.apply(t,arguments)}if("loading"===this.readyState&&i.call(e,r.rewriteHtml(r._writeBuff,!0)),_()){r.blobUrlForIframe(r.$wbwindow.frameElement,r._writeBuff);const t=this;try{if(t.documentElement){new r.$wbwindow.MutationObserver(((e,i)=>{r.blobUrlForIframe(r.$wbwindow.frameElement,t.documentElement.outerHTML)})).observe(t.documentElement,{childList:!0,subtree:!0})}}catch(t){}}r._writeBuff=""};e.close=p,t.close=p;var c=this.getOrigGetter(t,"body"),l=this.getOrigSetter(t,"body");c&&l&&this.defProp(t,"body",(function(t){return t&&(t instanceof HTMLBodyElement||t instanceof HTMLFrameSetElement)&&r.rewriteElemComplete(t),l.call(r.proxyToObj(this),t)}),c)}function _(){return r.wb_info.isSW&&r.$wbwindow.frameElement}function u(t){return 0===t.length?"":1===t.length?t[0]:Array.prototype.join.call(t,"")}function d(t,e,i){r.$wbwindow;if(!(_()||"loading"===t.readyState&&r.wb_info.injectDocClose)){i=r.rewriteHtml(i,!0);var o=r.proxyToObj(t),n=e.call(o,i);return r.initNewWindowWombat(o.defaultView),n}r._writeBuff+=i}},f.prototype.initIframeWombat=function(t){var e;e=t._get_contentWindow?t._get_contentWindow.call(t):t.contentWindow;try{if(!e||e===this.$wbwindow||e._skip_wombat||e._wb_wombat)return}catch(t){return}var r=t.src;this.initNewWindowWombat(e,r)},f.prototype.initNewWindowWombat=function(t,e){var r=!1;if(t&&!t._wb_wombat){if(e&&""!==e&&!this.startsWithOneOf(e,["about:blank","javascript:"])||(r=!0),!r&&this.wb_info.isSW){var i=this.extractOriginalURL(e);("about:blank"===i||i.startsWith("srcdoc:")||i.startsWith("blob:"))&&(r=!0)}if(r){var o={};Object.assign(o,this.wb_info);var n=new f(t,o);t._wb_wombat=n.wombatInit()}else this.initProtoPmOrigin(t),this.initPostMessageOverride(t),this.initMessageEventOverride(t),this.initCheckThisFunc(t),this.initImportWrapperFunc(t)}},f.prototype.initTimeoutIntervalOverrides=function(){var t=this.rewriteSetTimeoutInterval;if(this.$wbwindow.setTimeout&&!this.$wbwindow.setTimeout.__$wbpatched$__){var e=this.$wbwindow.setTimeout;this.$wbwindow.setTimeout=function(){return t(this,e,arguments)},this.$wbwindow.setTimeout.__$wbpatched$__=!0}if(this.$wbwindow.setInterval&&!this.$wbwindow.setInterval.__$wbpatched$__){var r=this.$wbwindow.setInterval;this.$wbwindow.setInterval=function(){return t(this,r,arguments)},this.$wbwindow.setInterval.__$wbpatched$__=!0}},f.prototype.initWorkerOverrides=function(){var t,e,r=this;if(this.$wbwindow.Worker&&!this.$wbwindow.Worker._wb_worker_overridden){var i=this.$wbwindow.Worker;this.$wbwindow.Worker=(t=i,function(e,i){return r.domConstructorErrorChecker(this,"Worker",arguments),new t(r.rewriteWorker(e),i)}),this.$wbwindow.Worker.prototype=i.prototype,Object.defineProperty(this.$wbwindow.Worker.prototype,"constructor",{value:this.$wbwindow.Worker}),this.$wbwindow.Worker._wb_worker_overridden=!0}if(this.$wbwindow.SharedWorker&&!this.$wbwindow.SharedWorker.__wb_sharedWorker_overridden){var o=this.$wbwindow.SharedWorker;this.$wbwindow.SharedWorker=(e=o,function(t,i){return r.domConstructorErrorChecker(this,"SharedWorker",arguments),new e(r.rewriteWorker(t),i)}),this.$wbwindow.SharedWorker.prototype=o.prototype,Object.defineProperty(this.$wbwindow.SharedWorker.prototype,"constructor",{value:this.$wbwindow.SharedWorker}),this.$wbwindow.SharedWorker.__wb_sharedWorker_overridden=!0}if(this.$wbwindow.ServiceWorkerContainer&&this.$wbwindow.ServiceWorkerContainer.prototype&&this.$wbwindow.ServiceWorkerContainer.prototype.register){var n=this.$wbwindow.ServiceWorkerContainer.prototype.register;this.$wbwindow.ServiceWorkerContainer.prototype.register=function(t,e){var i=new r.URL(t,r.$wbwindow.document.baseURI).href,o=r.getPageUnderModifier();return e&&e.scope?e.scope=r.rewriteUrl(e.scope,!1,o):e={scope:r.rewriteUrl("/",!1,o)},n.call(this,r.rewriteUrl(i,!1,"sw_"),e)}}if(this.$wbwindow.Worklet&&this.$wbwindow.Worklet.prototype&&this.$wbwindow.Worklet.prototype.addModule&&!this.$wbwindow.Worklet.__wb_workerlet_overridden){var s=this.$wbwindow.Worklet.prototype.addModule;this.$wbwindow.Worklet.prototype.addModule=function(t,e){var i=r.rewriteUrl(t,!1,"js_");return s.call(this,i,e)},this.$wbwindow.Worklet.__wb_workerlet_overridden=!0}},f.prototype.initLocOverride=function(t,e,r){if(Object.defineProperty)for(var i=0;i=0&&i.splice(n,1)}return i}})}catch(t){console.log(t)}},f.prototype.initHashChange=function(){if(this.$wbwindow.__WB_top_frame){var t=this;this.$wbwindow.addEventListener("message",(function(e){if(e.data&&e.data.from_top){var r=e.data.message;r.wb_type&&"outer_hashchange"===r.wb_type&&t.$wbwindow.location.hash!=r.hash&&(t.$wbwindow.location.hash=r.hash)}})),this.$wbwindow.addEventListener("hashchange",(function(){var e={wb_type:"hashchange",hash:t.$wbwindow.location.hash};t.sendTopMessage(e)}))}},f.prototype.initPostMessageOverride=function(t){if(t.postMessage&&!t.__orig_postMessage){var e=t.postMessage,r=this;t.__orig_postMessage=e;var i=function(i,o,n,s){var a,w,h,p=r.proxyToObj(this);if(p||((p=t).__WB_source=t),p.__WB_source&&p.__WB_source.WB_wombat_location){var c=p.__WB_source;if(a=c.WB_wombat_location.origin,p.__WB_win_id||(p.__WB_win_id={},p.__WB_counter=0),!c.__WB_id){var l=p.__WB_counter;c.__WB_id=l+c.WB_wombat_location.href,p.__WB_counter+=1}p.__WB_win_id[c.__WB_id]=c,w=c.__WB_id,p.__WB_source=void 0}else a=window.WB_wombat_location.origin;"object"==typeof o?(h=o.targetOrigin,n=o.transfer):h=o;var _=h;_===p.location.origin&&(_=a);var u={from:a,to_origin:_,src_id:w,message:i,from_top:s};if("*"!==h){if("null"===p.location.origin||""===p.location.origin)return;h=p.location.origin}return e.call(p,u,h,n)};t.postMessage=i,t.Window.prototype.postMessage=i;var o=null,n=(o=t.EventTarget&&t.EventTarget.prototype?t.EventTarget.prototype:t).addEventListener;o.addEventListener=function(t,e,i){var o,s=r.proxyToObj(this);if("message"===t?o=r.message_listeners.add_or_get(e,(function(){return c(e,s,r)})):"storage"===t?r.storage_listeners.add_or_get(e,(function(){return p(e,s)})):o=e,o)return n.call(s,t,o,i)};var s=o.removeEventListener;o.removeEventListener=function(t,e,i){var o,n=r.proxyToObj(this);if("message"===t?o=r.message_listeners.remove(e):"storage"===t?r.storage_listeners.remove(e):o=e,o)return s.call(n,t,o,i)};var a=function(e,i){var o=r.getOrigSetter(t,e);r.defProp(t,e,(function(t){this["__orig_"+e]=t;var n=r.proxyToObj(this),s=t?i(t,n,r):t;return o.call(n,s)}),(function(){return this["__orig_"+e]}))};a("onmessage",c),a("onstorage",p)}},f.prototype.initMessageEventOverride=function(t){t.MessageEvent&&!t.MessageEvent.prototype.__extended&&(this.addEventOverride("target"),this.addEventOverride("srcElement"),this.addEventOverride("currentTarget"),this.addEventOverride("eventPhase"),this.addEventOverride("path"),this.overridePropToProxy(t.MessageEvent.prototype,"source"),t.MessageEvent.prototype.__extended=!0)},f.prototype.initUIEventsOverrides=function(){this.overrideAnUIEvent("UIEvent"),this.overrideAnUIEvent("MouseEvent"),this.overrideAnUIEvent("TouchEvent"),this.overrideAnUIEvent("FocusEvent"),this.overrideAnUIEvent("KeyboardEvent"),this.overrideAnUIEvent("WheelEvent"),this.overrideAnUIEvent("InputEvent"),this.overrideAnUIEvent("CompositionEvent")},f.prototype.initOpenOverride=function(){var t=this.$wbwindow.open;this.$wbwindow.Window.prototype.open&&(t=this.$wbwindow.Window.prototype.open);var e=this,r=function(r,i,o){i&&(i=e.rewriteAttrTarget(i));var n=e.rewriteUrl(r,!1),s=t.call(e.proxyToObj(this),n,i,o);return e.initNewWindowWombat(s,r),s};this.$wbwindow.open=r,this.$wbwindow.Window.prototype.open&&(this.$wbwindow.Window.prototype.open=r);for(var i=0;ithis.staticPrefix+"proxy/"+t))),n.has("adblockUrl")&&(r.adblockUrl=n.get("adblockUrl")),this.collections=new i(o,n.get("root"),r),this.collections.loadAll(n.get("dbColl")),this.proxyOriginMode=!!n.get("proxyOriginMode"),this.api=new e(this.collections),this.apiPrefix=this.replayPrefix+"api/",this.allowRewrittenCache=!!n.get("allowCache"),this.stats=n.get("stats")?new Ub:null,self.addEventListener("install",(()=>{self.skipWaiting()})),self.addEventListener("activate",(t=>{t.waitUntil(self.clients.claim()),console.log("Activate!")})),self.addEventListener("fetch",(t=>{t.respondWith(this.handleFetch(t))})),self.addEventListener("message",(t=>{"reload_all"===t.data.msg_type&&t.waitUntil(this.collections.loadAll())}))}getIndexHtml(t){const e=t.get("indexScript")||"./ui.js",r=t.get("indexAppTag")||"replay-app-main";return`\n \n \n