diff --git a/src/coll.js b/src/coll.js index 3d555bd..ef9728c 100644 --- a/src/coll.js +++ b/src/coll.js @@ -65,6 +65,8 @@ class Coll extends LitElement this.splitter = null; this.isVisible = true; + + this.favIconUrl = ""; } static get properties() { @@ -93,12 +95,13 @@ class Coll extends LitElement embed: { type: String }, editable: { type: Boolean }, - isVisible: { type: Boolean } + isVisible: { type: Boolean }, + + favIconUrl: {type: String } } } firstUpdated() { - //this.doUpdateInfo(); this.inited = true; window.addEventListener("hashchange", (event) => this.onHashChange(event)); @@ -127,6 +130,13 @@ class Coll extends LitElement if (changedProperties.has("sourceUrl")) { this.doUpdateInfo(); } + if (changedProperties.has("editable")) { + if (this.editable) { + this._pollColl = setInterval(() => this.doUpdateInfo(), 10000); + } else if (this._pollColl) { + clearInterval(this._pollColl); + } + } if (changedProperties.has("tabData")) { if (!this.collInfo || !this.collInfo.coll) { return; @@ -257,6 +267,14 @@ class Coll extends LitElement }})); } + onCollUpdate(event) { + if (!this.editable) { + return; + } + + this.collInfo = {...this.collInfo, ...event.detail}; + } + onHashChange(event) { const hash = window.location.hash; if (hash && hash !== this._locationHash) { @@ -418,6 +436,12 @@ class Coll extends LitElement border-radius: 4px; } + .favicon img { + width: 20px; + height: 20px; + filter: drop-shadow(1px 1px 2px grey); + } + #datetime { position: absolute; right: 1em; @@ -570,6 +594,7 @@ class Coll extends LitElement ts="${this.tabData.ts || ""}" @coll-tab-nav="${this.onCollTabNav}" id="replay" @replay-loading="${(e) => this.isLoading = e.detail.loading}" + @replay-favicons="${this.onFavIcons}" > ` : ``} @@ -640,6 +665,8 @@ class Coll extends LitElement const isReplay = !!this.tabData.url; + const showFavIcon = isReplay && this.favIconUrl; + return html` Skip replay navigation @@ -677,9 +704,13 @@ class Coll extends LitElement - + ${isReplay ? html`${dateStr}` : html``} + ${showFavIcon ? html` + + + ` : html``} @@ -803,6 +834,7 @@ class Coll extends LitElement .url="${this.tabData.url || ""}" .ts="${this.tabData.ts || ""}" @coll-tab-nav="${this.onCollTabNav}" id="pages" + @coll-update="${this.onCollUpdate}" class="${isPages ? '' : 'is-hidden'} ${isSidebar ? 'sidebar' : ''}" role="${isSidebar ? '' : 'main'}" > @@ -878,6 +910,16 @@ class Coll extends LitElement this.showSidebar = false; } + onFavIcons(event) { + this.favIconUrl = ""; + event.detail.icons.map(async (icon) => { + const res = await fetch(icon.href); + if (res.status === 200) { + this.favIconUrl = icon.href; + } + }); + } + onReAuthed(event) { this.reauthWait = (async () => { const headers = event.detail.headers; diff --git a/src/pageentry.js b/src/pageentry.js index ac9aa91..27a08bb 100644 --- a/src/pageentry.js +++ b/src/pageentry.js @@ -4,7 +4,7 @@ import { LitElement, html, css, unsafeCSS } from 'lit-element'; import "keyword-mark-element/lib/keyword-mark.js"; -import { getPageDateTS, getReplayLink } from './pageutils'; +import { getReplayLink } from './pageutils'; import { wrapCss } from './misc'; @@ -24,9 +24,6 @@ class PageEntry extends LitElement this.index = 0; this.isCurrent = false; this.isSidebar = false; - - this.timestamp = ""; - this.date = null; } static get properties() { @@ -42,8 +39,6 @@ class PageEntry extends LitElement index: { type: Number }, isCurrent: { type: Boolean }, isSidebar: { type: Boolean }, - timestamp: { type: String }, - date: { type: Object } } } @@ -170,16 +165,12 @@ class PageEntry extends LitElement this.iconValid = !!this.page.favIconUrl; //this.updateFavIcon(); this.deleting = false; - - const res = getPageDateTS(this.page); - this.timestamp = res.timestamp; - this.date = res.date; } } render() { const p = this.page; - const date = this.date; + const date = this.page.date; const hasSize = typeof(p.size) === "number"; @@ -204,14 +195,13 @@ class PageEntry extends LitElement ${this.iconValid ? html` - this.iconValid = false}" src="${this.replayPrefix}/${this.timestamp}id_/${p.favIconUrl}"/>` : html` + this.iconValid = false}" src="${this.replayPrefix}/${this.page.timestamp}id_/${p.favIconUrl}"/>` : html` `} - - ${this.isCurrent ? html`Current Page` : ``} + ${p.title || p.url} @@ -245,7 +235,7 @@ class PageEntry extends LitElement return; } - const resp = await fetch(`${this.replayPrefix}/${this.timestamp}id_/${this.page.favIconUrl}`); + const resp = await fetch(`${this.replayPrefix}/${this.page.timestamp}id_/${this.page.favIconUrl}`); if (resp.status != 200) { this.favIconData = null; @@ -313,7 +303,7 @@ class PageEntry extends LitElement const data = { url: this.page.url, - ts: this.timestamp, + ts: this.page.timestamp, }; this.sendChangeEvent(data); return false; diff --git a/src/pages.js b/src/pages.js index 85aefd2..8388cf8 100644 --- a/src/pages.js +++ b/src/pages.js @@ -11,6 +11,8 @@ import { getTS, getPageDateTS } from './pageutils'; import fasSearch from '@fortawesome/fontawesome-free/svgs/solid/search.svg'; import fasAngleDown from '@fortawesome/fontawesome-free/svgs/solid/angle-down.svg'; +import fasEdit from '@fortawesome/fontawesome-free/svgs/solid/edit.svg'; + // =========================================================================== class Pages extends LitElement @@ -41,6 +43,8 @@ class Pages extends LitElement this.isSidebar = false; this.url = ""; this.ts = ""; + + this.editing = false; } static get sortKeys() { @@ -85,7 +89,9 @@ class Pages extends LitElement isSidebar: { type: Boolean }, url: { type: String }, - ts: { type: String } + ts: { type: String }, + + editing: { type: Boolean } } } @@ -322,6 +328,7 @@ class Pages extends LitElement border-right: 3px solid rgb(237, 237, 237); background-color: whitesmoke; padding-right: 0px; + position: relative; } .index-bar-title { @@ -331,6 +338,17 @@ class Pages extends LitElement word-break: break-word; } + .index-bar-title:hover + .editIcon { + display: block; + } + + .editIcon { + display: none; + position: absolute; + right: 8px; + top: 8px; + } + .index-bar-status { display: flex; flex-direction: row; @@ -413,6 +431,11 @@ class Pages extends LitElement background-color: rgb(207, 243, 255); } + .is-disabled { + pointer-events: none; + opacity: .65; + } + .page-header { display: flex; flex-direction: row; @@ -509,7 +532,13 @@ class Pages extends LitElement - ${this.collInfo.title} + + ${this.editable && this.editing ? html` + + ` : html` + this.editing = true}">${this.collInfo.title}`} + + ${this.editable ? html`` : html``} ${this.formatResults()} @@ -556,17 +585,29 @@ class Pages extends LitElement - this.onDownload(e, "wacz", true)}" @keyup="${clickOnSpacebarPress}" class="dropdown-item"> + this.onDownload(e, "wacz", true)}" + @keyup="${clickOnSpacebarPress}" + class="dropdown-item ${this.selectedPages.size === 0 ? 'is-disabled' : ''}"> Download Selected as WACZ (Web Archive Collection) - this.onDownload(e, "warc", true)}" @keyup="${clickOnSpacebarPress}" class="dropdown-item"> + this.onDownload(e, "warc", true)}" + @keyup="${clickOnSpacebarPress}" + class="dropdown-item ${this.selectedPages.size === 0 ? 'is-disabled' : ''}"> Download Selected as WARC Only - this.onDownload(e, "wacz", false)}" @keyup="${clickOnSpacebarPress}" class="dropdown-item"> + this.onDownload(e, "wacz", false)}" + @keyup="${clickOnSpacebarPress}" + class="dropdown-item"> Download All as WACZ (Web Archive Collection) - this.onDownload(e, "warc", false)}" @keyup="${clickOnSpacebarPress}" class="dropdown-item"> + this.onDownload(e, "warc", false)}" + @keyup="${clickOnSpacebarPress}" + class="dropdown-item"> Download All as WARC Only @@ -576,7 +617,7 @@ class Pages extends LitElement renderPageHeader() { return html` - ${this.editable ? html` + ${this.editable && this.filteredPages.length ? html` @@ -656,6 +697,30 @@ class Pages extends LitElement `; } + onUpdateTitle(event) { + event.preventDefault(); + + this.editing = false; + + if (!this.editable) { + return; + } + const input = this.renderRoot.querySelector("#titleEdit"); + if (!input || !input.value.trim()) { + return; + } + + const title = input.value; + + const body = JSON.stringify({title}); + + fetch(`${this.collInfo.apiPrefix}/metadata`, {method: 'POST', body}).then((res) => { + if (res.status === 200) { + this.dispatchEvent(new CustomEvent("coll-update", {detail: {title}})); + } + }); + } + onMenu(event) { event.stopPropagation(); this.menuActive = !this.menuActive; diff --git a/sw.js b/sw.js index 9ad6667..937f033 100644 --- a/sw.js +++ b/sw.js @@ -1,12 +1,12 @@ /*! sw.js is part of ReplayWeb.page (https://replayweb.page) Copyright (C) 2020, Webrecorder Software. Licensed under the Affero General Public License v3. */ -!function(e,t){for(var n in t)e[n]=t[n]}(self,function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=224)}([function(e,t,n){"use strict";function r(e,t){for(const n of t)if(e.startsWith(n))return!0;return!1}function i(e,t){for(const n of t)if(e.indexOf(n)>=0)return!0;return!1}function s(e){return e.replace(/[-:T]/g,"").slice(0,14)}function o(e){return e.replace(/[-:.TZ]/g,"")}function a(e){if(!e)return new Date;e.length<17&&(e+="00000101000000000".substr(e.length));const t=e.substring(0,4)+"-"+e.substring(4,6)+"-"+e.substring(6,8)+"T"+e.substring(8,10)+":"+e.substring(10,12)+":"+e.substring(12,14)+"."+e.substring(14)+"Z";return new Date(t)}function u(e){if(!e)return"";try{return""+parseInt(e.getTime()/1e3)}catch(e){return""}}async function l(e,t){const n="string"==typeof e?(new TextEncoder).encode(e):e,r=await crypto.subtle.digest(t,n);return t+":"+new Uint8Array(r).map(e=>e.toString(16).padStart(2,"0")).join("")}function c(e){try{return new Headers(e)}catch(t){for(let t of Object.keys(e)){const n=e[t],r=n.replace(/[\r\n]+/g,", ");n!=r&&(e[t]=r)}return new Headers(e)}}n.d(t,"l",(function(){return r})),n.d(t,"c",(function(){return i})),n.d(t,"f",(function(){return s})),n.d(t,"g",(function(){return o})),n.d(t,"m",(function(){return a})),n.d(t,"e",(function(){return u})),n.d(t,"d",(function(){return l})),n.d(t,"i",(function(){return d})),n.d(t,"j",(function(){return c})),n.d(t,"k",(function(){return f})),n.d(t,"h",(function(){return p})),n.d(t,"a",(function(){return m})),n.d(t,"b",(function(){return w}));const h=[101,204,205,304];function d(e){return h.includes(e)}function p(e){return"XMLHttpRequest"===e.headers.get("X-Pywb-Requested-With")}function f(e,t){let n,r;return t||(t="Sorry, this url was not found in the archive."),"script"===e.destination||e.headers.get("x-pywb-requested-with")?(n=JSON.stringify(t),r="application/json"):(n=t,r="text/html"),new Response(n,{status:404,statusText:"Not Found",headers:{"Content-Type":r}})}class m extends class{constructor(e,t){this.url=e,this.status=t}}{}class w{}},function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return a})),n.d(t,"d",(function(){return y})),n.d(t,"f",(function(){return T})),n.d(t,"e",(function(){return b})),n.d(t,"c",(function(){return D}));var r=n(116);const i=new TextDecoder("utf-8");class s extends r.Inflate{constructor(e,t){super(e),this.reader=t}onEnd(e){this.err=e,this.err||(this.reader._rawOffset+=this.strm.total_in)}}class o{static concatChunks(e,t){if(1===e.length)return e[0];const n=new Uint8Array(t);let r=0;for(const t of e)n.set(t,r),r+=t.byteLength;return n}static splitChunk(e,t){return[e.slice(0,t),e.slice(t)]}static async readFully(e){const t=[];let n=0;for await(const r of e)t.push(r),n+=r.byteLength;return o.concatChunks(t,n)}getReadableStream(){const e=this[Symbol.asyncIterator]();return new ReadableStream({pull:t=>e.next().then(e=>{e.done||!e.value?t.close():t.enqueue(e.value)})})}readFully(){return o.readFully(this)}async readline(e=0){const t=await this.readlineRaw(e);return t?i.decode(t):""}async*iterLines(e=0){let t=null;for(;t=await this.readline(e);)yield t}}class a extends o{constructor(e,t="gzip",n=!1){if(super(),this.compressed=t,this.opts={raw:"deflateRaw"===t},this.inflator=t?new s(this.opts,this):null,"function"!=typeof e[Symbol.asyncIterator])if("function"==typeof e.getReader)e=a.fromReadable(e.getReader());else if("function"==typeof e.read)e=a.fromReadable(e);else{if("function"!=typeof e[Symbol.iterator])throw new TypeError("Invalid Stream Source");e=a.fromIter(e)}this._sourceIter=n?this.dechunk(e):e[Symbol.asyncIterator](),this.lastValue=null,this.errored=!1,this._savedChunk=null,this._rawOffset=0,this._readOffset=0,this.numChunks=0}async _loadNext(){const e=await this._sourceIter.next();return e.done?null:e.value}async*dechunk(e){const t=e instanceof a?e:new a(e,null);let n=-1,r=!0;for(;0!=n;){const e=await t.readlineRaw(64);let s=null;if(n=parseInt(i.decode(e),16),!n||n>2**32){if(Number.isNaN(n)||n>2**32){r||(this.errored=!0),yield e;break}}else if(s=await t.readSize(n),s.length!=n){r?yield e:this.errored=!0,yield s;break}const o=await t.readSize(2);if(13!=o[0]||10!=o[1]){r?yield e:this.errored=!0,yield s,yield o;break}if(r=!1,!s||0===n)return;yield s}yield*t}_unread(e){e.length&&(this._readOffset-=e.length,this._savedChunk&&console.log("Already have chunk!"),this._savedChunk=e)}async _next(){if(this._savedChunk){const e=this._savedChunk;return this._savedChunk=null,e}if(this.compressed){const e=this._getNextChunk();if(e)return e}let e=await this._loadNext();for(;this.compressed&&e;){this._push(e);const t=this._getNextChunk(e);if(t)return t;e=await this._loadNext()}return e}_push(e){this.lastValue=e,this.inflator.ended&&(this.inflator=new s(this.opts,this)),this.inflator.push(e),this.inflator.err&&this.inflator.ended&&"deflate"===this.compressed&&!1===this.opts.raw&&0===this.numChunks&&(this.opts.raw=!0,this.compressed="deflateRaw",this.inflator=new s(this.opts,this),this.inflator.push(e))}_getNextChunk(e){for(;;){if(this.inflator.chunks.length>0)return this.numChunks++,this.inflator.chunks.shift();if(this.inflator.ended){if(0!==this.inflator.err)return this.compressed=null,e;const t=this.inflator.strm.avail_in;if(t&&this.lastValue){this._push(this.lastValue.slice(-t));continue}}return null}}async*[Symbol.asyncIterator](){let e=null;for(;e=await this._next();)this._readOffset+=e.length,yield e}async readlineRaw(e){const t=[];let n,r=0,i=null;for await(const s of this){if(e&&r+s.byteLength>e){i=s,n=e-r-1;const t=s.slice(0,n+1).indexOf(10);t>=0&&(n=t);break}if(n=s.indexOf(10),n>=0){i=s;break}t.push(s),r+=s.byteLength}if(i){const[e,s]=a.splitChunk(i,n+1);t.push(e),r+=e.byteLength,this._unread(s)}else if(!t.length)return null;return a.concatChunks(t,r)}readFully(){return this.readSize()}async readSize(e=-1,t=!1){const n=[];let r=0;for await(const i of this){if(e>=0){if(i.length>e){const[s,o]=a.splitChunk(i,e);t||n.push(s),r+=s.byteLength,this._unread(o);break}if(i.length===e){t||n.push(i),r+=i.byteLength,e=0;break}e-=i.length}t||n.push(i),r+=i.byteLength}return t?r:a.concatChunks(n,r)}getReadOffset(){return this._readOffset}getRawOffset(){return this.compressed?this._rawOffset:this._readOffset}getRawLength(e){return this.compressed?this.inflator.strm.total_in:this._readOffset-e}static fromReadable(e){return{async*[Symbol.asyncIterator](){let t=null;for(;(t=await e.read())&&!t.done;)yield t.value}}}static fromIter(e){return{async*[Symbol.asyncIterator](){for(const t of e)yield t}}}}class u extends o{constructor(e,t,n=0){super(),this.sourceIter=e,this.length=t,this.limit=t,this.skip=n}setLimitSkip(e,t=0){this.limit=e,this.skip=t}async*[Symbol.asyncIterator](){if(!(this.limit<=0))for await(let e of this.sourceIter){if(this.skip>0){if(!(e.length>=this.skip)){this.skip-=e.length;continue}{const[t,n]=u.splitChunk(e,this.skip);e=n,this.skip=0}}if(e.length>this.limit){const[t,n]=u.splitChunk(e,this.limit);e=t,this.sourceIter._unread(n)}if(e.length&&(this.limit-=e.length,yield e),this.limit<=0)break}}async readlineRaw(e){if(this.limit<=0)return null;const t=await this.sourceIter.readlineRaw(e?Math.min(e,this.limit):this.limit);return this.limit-=t.length,t}async skipFully(){const e=this.limit;for(;this.limit>0;)this.limit-=await this.sourceIter.readSize(this.limit,!0);return e}}const l=new Uint8Array([13,10]),c=new Uint8Array([13,10,13,10]);class h{constructor({statusline:e,headers:t}){this.statusline=e,this.headers=t}toString(){const e=[this.statusline];for(const[t,n]of this.headers)e.push(`${t}: ${n}`);return e.join("\r\n")+"\r\n"}async*iterSerialize(e){yield e.encode(this.statusline),yield l;for(const[t,n]of this.headers)yield e.encode(`${t}: ${n}\r\n`)}_parseResponseStatusLine(){const e=p(this.statusline," ",2);this._protocol=e[0],this._statusCode=e.length>1?Number(e[1]):"",this._statusText=e.length>2?e[2]:""}get statusCode(){return void 0===this._statusCode&&this._parseResponseStatusLine(),this._statusCode}get protocol(){return void 0===this._protocol&&this._parseResponseStatusLine(),this._protocol}get statusText(){return void 0===this._statusText&&this._parseResponseStatusLine(),this._statusText}_parseRequestStatusLine(){const e=this.statusline.split(" ",2);this._method=e[0],this._requestPath=e.length>1?e[1]:""}get method(){return void 0===this._method&&this._parseRequestStatusLine(),this._method}get requestPath(){return void 0===this._requestPath&&this._parseRequestStatusLine(),this._requestPath}}class d{startsWithSpace(e){const t=e.charAt(0);return" "===t||"\t"===t}async parse(e,{headersClass:t=Map}={}){const n=await e.readline();if(!n)return null;let r=n.trimEnd();const i=new t;if(!r)return null;let s=(await e.readline()).trimEnd();for(;s;){let[t,n]=p(s,":",1);n&&(t=t.trimStart(),n=n.trim());let r=(await e.readline()).trimEnd();for(;this.startsWithSpace(r);)n&&(n+=r),r=(await e.readline()).trimEnd();if(n)try{i.set(t,n)}catch(e){}s=r}return new h({statusline:r,headers:i,totalRead:this.totalRead})}}function p(e,t,n){const r=e.split(t),i=r.slice(0,n);return r.slice(n).length>0&&i.push(r.slice(n).join(t)),i}var f=n(117),m=n.n(f);const w=new TextDecoder("utf-8"),g=new TextEncoder("utf-8"),_={warcinfo:"application/warc-fields",response:"application/http; msgtype=response",revisit:"application/http; msgtype=response",request:"application/http; msgtype=request",metadata:"application/warc-fields"};class b extends o{static create({url:e,date:t,type:n,warcHeaders:r={},filename:i="",httpHeaders:s={},statusline:o="HTTP/1.1 200 OK",warcVersion:a="WARC/1.0",keepHeadersCase:u=!0,refersToUrl:l,refersToDate:c}={},d){function p(e){return"WARC/1.0"===a&&"Z"!=(e=e.split(".")[0]).charAt(t.length-1)&&(e+="Z"),e}t||(t=(new Date).toISOString()),t=p(t),r={...r},"warcinfo"===n?i&&(r["WARC-Filename"]=i):r["WARC-Target-URI"]=e,r["WARC-Date"]=t,r["WARC-Type"]=n,"revisit"===n&&(r["WARC-Profile"]="WARC/1.1"===a?"http://netpreserve.org/warc/1.1/revisit/identical-payload-digest":"http://netpreserve.org/warc/1.0/revisit/identical-payload-digest",r["WARC-Refers-To-Target-URI"]=l,r["WARC-Refers-To-Date"]=p(c)),(r=new h({statusline:a,headers:u?new Map(Object.entries(r)):new Headers(r)})).headers.get("WARC-Record-ID")||r.headers.set("WARC-Record-ID",``),!r.headers.get("Content-Type")&&_[n]&&r.headers.set("Content-Type",_[n]);const f=new b({warcHeaders:r,reader:d});switch(n){case"response":case"request":case"revisit":f.httpHeaders=new h({statusline:o,headers:u?new Map(Object.entries(s)):new Headers(s)})}return f}static createWARCInfo(e={},t){return e.type="warcinfo",b.create(e,async function*(){for(const[e,n]of Object.entries(t))yield g.encode(`${e}: ${n}\r\n`)}())}constructor({warcHeaders:e,reader:t}){super(),this.warcHeaders=e,this._reader=t,this._contentReader=null,this.payload=null,this.httpHeaders=null,this.consumed=!1,this.fixUp()}getResponseInfo(){const e=this.httpHeaders;return e?{headers:e.headers,status:e.statusCode,statusText:e.statusText}:null}fixUp(){const e=this.warcHeaders.headers.get("WARC-Target-URI");e&&e.startsWith("<")&&e.endsWith(">")&&this.warcHeaders.headers.set("WARC-Target-URI",e.slice(1,-1))}async readFully(e=!1){if(this.httpHeaders){if(this._contentReader&&!e)throw new TypeError("WARC Record decoding already started, but requesting raw payload");if(e&&"raw"===this.consumed&&this.payload)return await this._createDecodingReader([this.payload]).readFully()}return this.payload||(e?(this.payload=await super.readFully(),this.consumed="content"):(this.payload=await b.readFully(this._reader),this.consumed="raw")),this.payload}get reader(){if(this._contentReader)throw new TypeError("WARC Record decoding already started, but requesting raw payload");return this._reader}get contentReader(){return this.httpHeaders?(this._contentReader||(this._contentReader=this._createDecodingReader(this._reader)),this._contentReader):this._reader}_createDecodingReader(e){let t=this.httpHeaders.headers.get("content-encoding"),n=this.httpHeaders.headers.get("transfer-encoding");const r="chunked"===n;return t||r||(t=n),new a(e,t,r)}async readlineRaw(e){if(this.consumed)throw new Error("Record already consumed.. Perhaps a promise was not awaited?");return this.contentReader.readlineRaw(e)}async contentText(){const e=await this.readFully(!0);return w.decode(e)}async*[Symbol.asyncIterator](){for await(const e of this.contentReader)if(yield e,this.consumed)throw new Error("Record already consumed.. Perhaps a promise was not awaited?");this.consumed="content"}async skipFully(){if(this.consumed)return;const e=await this._reader.skipFully();return this.consumed="skipped",e}warcHeader(e){return this.warcHeaders.headers.get(e)}get warcType(){return this.warcHeaders.headers.get("WARC-Type")}get warcTargetURI(){return this.warcHeaders.headers.get("WARC-Target-URI")}get warcDate(){return this.warcHeaders.headers.get("WARC-Date")}get warcRefersToTargetURI(){return this.warcHeaders.headers.get("WARC-Refers-To-Target-URI")}get warcRefersToDate(){return this.warcHeaders.headers.get("WARC-Refers-To-Date")}get warcPayloadDigest(){return this.warcHeaders.headers.get("WARC-Payload-Digest")}get warcBlockDigest(){return this.warcHeaders.headers.get("WARC-Block-Digest")}get warcContentType(){return this.warcHeaders.headers.get("Content-Type")}get warcContentLength(){return Number(this.warcHeaders.headers.get("Content-Length"))}}class y{static parse(e,t){return new y(e,t).parse()}static iterRecords(e,t){return new y(e,t)[Symbol.asyncIterator]()}constructor(e,{keepHeadersCase:t=!1,parseHttp:n=!0}={}){this._offset=0,this._warcHeadersLength=0,this._headersClass=t?Map:Headers,this._parseHttp=n,this._atRecordBoundary=!0,e instanceof a||(e=new a(e)),this._reader=e,this._record=null}async readToNextRecord(){!this._atRecordBoundary&&this._reader&&this._record&&(await this._record.skipFully(),await this._reader.readSize(4,!0),this._atRecordBoundary=!0)}_initRecordReader(e){return new u(this._reader,Number(e.headers.get("Content-Length")||0))}async parse(){await this.readToNextRecord(),this._offset=this._reader.getRawOffset();const e=new d,t=await e.parse(this._reader,{headersClass:this._headersClass});if(!t)return null;this._warcHeadersLength=this._reader.getReadOffset();const n=new b({warcHeaders:t,reader:this._initRecordReader(t)});if(this._atRecordBoundary=!1,this._record=n,this._parseHttp)switch(n.warcType){case"response":case"request":await this._addHttpHeaders(n,e,this._reader);break;case"revisit":n.warcContentLength>0&&await this._addHttpHeaders(n,e,this._reader)}return n}get offset(){return this._offset}get recordLength(){return this._reader.getRawLength(this._offset)}async*[Symbol.asyncIterator](){let e=null;for(;e=await this.parse(this._reader);)yield e;this._record=null}async _addHttpHeaders(e,t){const n=await t.parse(this._reader,{headersClass:this._headersClass});e.httpHeaders=n;const r=this._reader.getReadOffset()-this._warcHeadersLength;e.reader.setLimitSkip&&e.reader.setLimitSkip(e.warcContentLength-r)}}var v=n(118),E=n.n(v),A=n(119);const x=new TextEncoder;class T extends o{static async serialize(e,t){const n=new T(e,t);return await n.readFully()}static base16(e){return Array.from(new Uint8Array(e)).map(e=>e.toString(16).padStart(2,"0")).join("")}constructor(e,t={}){super(),this.record=e,this.gzip=t.gzip;const n=t&&t.digest||{};"revisit"===e.warcType||"warcinfo"===e.warcType||e.warcPayloadDigest&&e.warcBlockDigest?this.digestAlgo=null:(this.digestAlgo=n.algo||"sha-256",this.digestAlgoPrefix=n.prefix||"sha-256:",this.digestBase32=n.base32||!1)}async*[Symbol.asyncIterator](){if(!this.gzip)return void(yield*this.generateRecord());const e=new A.Deflate({gzip:!0});let t=null;for await(const n of this.generateRecord())for(t&&t.length>0&&e.push(t),t=n;e.chunks.length;)yield e.chunks.shift();e.push(t,!0),yield e.result}async digestMessage(e){const t=await crypto.subtle.digest(this.digestAlgo,e);return this.digestAlgoPrefix+(this.digestBase32?E.a.encode(t):T.base16(t))}async*generateRecord(){let e=0,t=null;this.record.httpHeaders&&(t=x.encode(this.record.httpHeaders.toString()+"\r\n"),e+=t.length);const n=await this.record.readFully();if(e+=n.length,this.digestAlgo){const r=await this.digestMessage(n),i=t?await this.digestMessage(T.concatChunks([t,n],e)):r;this.record.warcHeaders.headers.set("WARC-Payload-Digest",r),this.record.warcHeaders.headers.set("WARC-Block-Digest",i)}this.record.warcHeaders.headers.set("Content-Length",e);const r=x.encode(this.record.warcHeaders.toString());yield r,yield l,t&&(yield t),yield n,yield c}}const S="offset,warc-type,warc-target-uri".split(",");const C="urlkey,timestamp,url,mime,status,digest,length,offset,filename".split(","),k="urlkey,timestamp,url,mime,status,digest,redirect,meta,length,offset,filename".split(",");class D extends class extends class{constructor(e,t){this.opts=e,this.out=t}serialize(e){return JSON.stringify(e)+"\n"}write(e){this.out.write(this.serialize(e))}async run(e){for await(const t of this.iterIndex(e))this.write(t)}async*iterIndex(e){const t={strictHeaders:!0,parseHttp:this.parseHttp};for(const{filename:n,reader:r}of e){if(!n||!r)continue;const e=new y(r,t);for await(const t of e){await t.skipFully();const r=this.indexRecord(t,e,n);r&&(yield r)}}}indexRecord(e,t,n){if(this.filterRecord&&!this.filterRecord(e))return null;const r={},i={offset:t.offset,length:t.recordLength,filename:n};for(const t of this.fields)null!=i[t]?r[t]=i[t]:this.setField(t,e,r);return r}setField(e,t,n){const r=this.getField(e,t);null!=r&&(n[e]=r)}getField(e,t){return"http:status"===e?!t.httpHeaders||"response"!==t.warcType&&"revisit"!==t.warcType?null:t.httpHeaders.statusCode:e.startsWith("http:")?t.httpHeaders?t.httpHeaders.headers.get(e.slice(5)):null:t.warcHeaders.headers.get(e)}}{constructor(e={},t=null){if(super(e,t),e.fields){this.fields=e.fields.split(","),this.parseHttp=!1;for(const e of this.fields)if(e.startsWith("http:")){this.parseHttp=!0;break}}else this.fields=S,this.parseHttp=!1}}{constructor(e={},t=null){switch(super(e,t),this.includeAll=e.all,this.fields=C,this.parseHttp=!0,e.format){case"cdxj":this.serialize=this.serializeCDXJ;break;case"cdx":this.serialize=this.serializeCDX11}}filterRecord(e){if(this.includeAll)return!0;const t=e.warcType;return"request"!==t&&"warcinfo"!==t}serializeCDXJ(e){const{urlkey:t,timestamp:n}=e;return delete e.urlkey,delete e.timestamp,`${t} ${n} ${JSON.stringify(e)}\n`}serializeCDX11(e){const t=[];for(const n of k)t.push(null!=e[n]?e[n]:"-");return t.join(" ")+"\n"}getField(e,t){let n=null;switch(e){case"urlkey":return this.getSurt(t.warcTargetURI);case"timestamp":return n=t.warcDate,n.replace(/[-:T]/g,"").slice(0,14);case"url":return t.warcTargetURI;case"mime":switch(t.warcType){case"revisit":return"warc/revisit";case"response":case"request":e="http:content-type";break;default:e="content-type"}return n=super.getField(e,t),n?n.split(";",1)[0].trim():null;case"status":return super.getField("http:status",t);case"digest":return n=t.warcPayloadDigest,n?n.split(":",2)[1]:null}}getSurt(e){try{const t=new URL(e);let n=t.hostname.split(".").reverse().join(",");return t.port&&(n+=":"+t.port),n+=")",n+=t.pathname,n.toLowerCase()}catch(t){return e}}}},function(e,t,n){"use strict";var r=n(25),i=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],s=["scalar","sequence","mapping"];e.exports=function(e,t){var n,o;if(t=t||{},Object.keys(t).forEach((function(t){if(-1===i.indexOf(t))throw new r('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=(n=t.styleAliases||null,o={},null!==n&&Object.keys(n).forEach((function(e){n[e].forEach((function(t){o[String(t)]=e}))})),o),-1===s.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}},function(e,t,n){"use strict";(function(e){ +!function(t,e){for(var r in e)t[r]=e[r]}(self,function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=209)}([function(t,e,r){"use strict";function i(t,e){for(const r of e)if(t.startsWith(r))return!0;return!1}function n(t,e){for(const r of e)if(t.indexOf(r)>=0)return!0;return!1}function s(t){return t.replace(/[-:T]/g,"").slice(0,14)}function o(t){return t.replace(/[-:.TZ]/g,"")}function a(t){if(!t)return new Date;t.length<17&&(t+="00000101000000000".substr(t.length));const e=t.substring(0,4)+"-"+t.substring(4,6)+"-"+t.substring(6,8)+"T"+t.substring(8,10)+":"+t.substring(10,12)+":"+t.substring(12,14)+"."+t.substring(14)+"Z";return new Date(e)}function u(t){if(!t)return"";try{return""+parseInt(t.getTime()/1e3)}catch(t){return""}}async function h(t,e){const r="string"==typeof t?(new TextEncoder).encode(t):t,i=await crypto.subtle.digest(e,r);return e+":"+new Uint8Array(i).map(t=>t.toString(16).padStart(2,"0")).join("")}function c(t){try{return new Headers(t)}catch(e){for(let e of Object.keys(t)){const r=t[e],i=r.replace(/[\r\n]+/g,", ");r!=i&&(t[e]=i)}return new Headers(t)}}r.d(e,"l",(function(){return i})),r.d(e,"c",(function(){return n})),r.d(e,"f",(function(){return s})),r.d(e,"g",(function(){return o})),r.d(e,"m",(function(){return a})),r.d(e,"e",(function(){return u})),r.d(e,"d",(function(){return h})),r.d(e,"i",(function(){return d})),r.d(e,"j",(function(){return c})),r.d(e,"k",(function(){return p})),r.d(e,"h",(function(){return f})),r.d(e,"a",(function(){return m})),r.d(e,"b",(function(){return w}));const l=[101,204,205,304];function d(t){return l.includes(t)}function f(t){return"XMLHttpRequest"===t.headers.get("X-Pywb-Requested-With")}function p(t,e){let r,i;return e||(e="Sorry, this url was not found in the archive."),"script"===t.destination||t.headers.get("x-pywb-requested-with")?(r=JSON.stringify(e),i="application/json"):(r=e,i="text/html"),new Response(r,{status:404,statusText:"Not Found",headers:{"Content-Type":i}})}class m extends class{constructor(t,e){this.url=t,this.status=e}}{}class w{}},function(t,e,r){"use strict";r.d(e,"b",(function(){return o})),r.d(e,"a",(function(){return a})),r.d(e,"d",(function(){return b})),r.d(e,"f",(function(){return x})),r.d(e,"e",(function(){return _})),r.d(e,"c",(function(){return k}));var i=r(57);const n=new TextDecoder("utf-8");class s extends i.Inflate{constructor(t,e){super(t),this.reader=e}onEnd(t){this.err=t,this.err||(this.reader._rawOffset+=this.strm.total_in)}}class o{static concatChunks(t,e){if(1===t.length)return t[0];const r=new Uint8Array(e);let i=0;for(const e of t)r.set(e,i),i+=e.byteLength;return r}static splitChunk(t,e){return[t.slice(0,e),t.slice(e)]}static async readFully(t){const e=[];let r=0;for await(const i of t)e.push(i),r+=i.byteLength;return o.concatChunks(e,r)}getReadableStream(){const t=this[Symbol.asyncIterator]();return new ReadableStream({pull:e=>t.next().then(t=>{t.done||!t.value?e.close():e.enqueue(t.value)})})}readFully(){return o.readFully(this)}async readline(t=0){const e=await this.readlineRaw(t);return e?n.decode(e):""}async*iterLines(t=0){let e=null;for(;e=await this.readline(t);)yield e}}class a extends o{constructor(t,e="gzip",r=!1){if(super(),this.compressed=e,this.opts={raw:"deflateRaw"===e},this.inflator=e?new s(this.opts,this):null,"function"!=typeof t[Symbol.asyncIterator])if("function"==typeof t.getReader)t=a.fromReadable(t.getReader());else if("function"==typeof t.read)t=a.fromReadable(t);else{if("function"!=typeof t[Symbol.iterator])throw new TypeError("Invalid Stream Source");t=a.fromIter(t)}this._sourceIter=r?this.dechunk(t):t[Symbol.asyncIterator](),this.lastValue=null,this.errored=!1,this._savedChunk=null,this._rawOffset=0,this._readOffset=0,this.numChunks=0}async _loadNext(){const t=await this._sourceIter.next();return t.done?null:t.value}async*dechunk(t){const e=t instanceof a?t:new a(t,null);let r=-1,i=!0;for(;0!=r;){const t=await e.readlineRaw(64);let s=null;if(r=parseInt(n.decode(t),16),!r||r>2**32){if(Number.isNaN(r)||r>2**32){i||(this.errored=!0),yield t;break}}else if(s=await e.readSize(r),s.length!=r){i?yield t:this.errored=!0,yield s;break}const o=await e.readSize(2);if(13!=o[0]||10!=o[1]){i?yield t:this.errored=!0,yield s,yield o;break}if(i=!1,!s||0===r)return;yield s}yield*e}_unread(t){t.length&&(this._readOffset-=t.length,this._savedChunk&&console.log("Already have chunk!"),this._savedChunk=t)}async _next(){if(this._savedChunk){const t=this._savedChunk;return this._savedChunk=null,t}if(this.compressed){const t=this._getNextChunk();if(t)return t}let t=await this._loadNext();for(;this.compressed&&t;){this._push(t);const e=this._getNextChunk(t);if(e)return e;t=await this._loadNext()}return t}_push(t){this.lastValue=t,this.inflator.ended&&(this.inflator=new s(this.opts,this)),this.inflator.push(t),this.inflator.err&&this.inflator.ended&&"deflate"===this.compressed&&!1===this.opts.raw&&0===this.numChunks&&(this.opts.raw=!0,this.compressed="deflateRaw",this.inflator=new s(this.opts,this),this.inflator.push(t))}_getNextChunk(t){for(;;){if(this.inflator.chunks.length>0)return this.numChunks++,this.inflator.chunks.shift();if(this.inflator.ended){if(0!==this.inflator.err)return this.compressed=null,t;const e=this.inflator.strm.avail_in;if(e&&this.lastValue){this._push(this.lastValue.slice(-e));continue}}return null}}async*[Symbol.asyncIterator](){let t=null;for(;t=await this._next();)this._readOffset+=t.length,yield t}async readlineRaw(t){const e=[];let r,i=0,n=null;for await(const s of this){if(t&&i+s.byteLength>t){n=s,r=t-i-1;const e=s.slice(0,r+1).indexOf(10);e>=0&&(r=e);break}if(r=s.indexOf(10),r>=0){n=s;break}e.push(s),i+=s.byteLength}if(n){const[t,s]=a.splitChunk(n,r+1);e.push(t),i+=t.byteLength,this._unread(s)}else if(!e.length)return null;return a.concatChunks(e,i)}readFully(){return this.readSize()}async readSize(t=-1,e=!1){const r=[];let i=0;for await(const n of this){if(t>=0){if(n.length>t){const[s,o]=a.splitChunk(n,t);e||r.push(s),i+=s.byteLength,this._unread(o);break}if(n.length===t){e||r.push(n),i+=n.byteLength,t=0;break}t-=n.length}e||r.push(n),i+=n.byteLength}return e?i:a.concatChunks(r,i)}getReadOffset(){return this._readOffset}getRawOffset(){return this.compressed?this._rawOffset:this._readOffset}getRawLength(t){return this.compressed?this.inflator.strm.total_in:this._readOffset-t}static fromReadable(t){return{async*[Symbol.asyncIterator](){let e=null;for(;(e=await t.read())&&!e.done;)yield e.value}}}static fromIter(t){return{async*[Symbol.asyncIterator](){for(const e of t)yield e}}}}class u extends o{constructor(t,e,r=0){super(),this.sourceIter=t,this.length=e,this.limit=e,this.skip=r}setLimitSkip(t,e=0){this.limit=t,this.skip=e}async*[Symbol.asyncIterator](){if(!(this.limit<=0))for await(let t of this.sourceIter){if(this.skip>0){if(!(t.length>=this.skip)){this.skip-=t.length;continue}{const[e,r]=u.splitChunk(t,this.skip);t=r,this.skip=0}}if(t.length>this.limit){const[e,r]=u.splitChunk(t,this.limit);t=e,this.sourceIter._unread(r)}if(t.length&&(this.limit-=t.length,yield t),this.limit<=0)break}}async readlineRaw(t){if(this.limit<=0)return null;const e=await this.sourceIter.readlineRaw(t?Math.min(t,this.limit):this.limit);return this.limit-=e.length,e}async skipFully(){const t=this.limit;for(;this.limit>0;)this.limit-=await this.sourceIter.readSize(this.limit,!0);return t}}const h=new Uint8Array([13,10]),c=new Uint8Array([13,10,13,10]);class l{constructor({statusline:t,headers:e}){this.statusline=t,this.headers=e}toString(){const t=[this.statusline];for(const[e,r]of this.headers)t.push(`${e}: ${r}`);return t.join("\r\n")+"\r\n"}async*iterSerialize(t){yield t.encode(this.statusline),yield h;for(const[e,r]of this.headers)yield t.encode(`${e}: ${r}\r\n`)}_parseResponseStatusLine(){const t=f(this.statusline," ",2);this._protocol=t[0],this._statusCode=t.length>1?Number(t[1]):"",this._statusText=t.length>2?t[2]:""}get statusCode(){return void 0===this._statusCode&&this._parseResponseStatusLine(),this._statusCode}get protocol(){return void 0===this._protocol&&this._parseResponseStatusLine(),this._protocol}get statusText(){return void 0===this._statusText&&this._parseResponseStatusLine(),this._statusText}_parseRequestStatusLine(){const t=this.statusline.split(" ",2);this._method=t[0],this._requestPath=t.length>1?t[1]:""}get method(){return void 0===this._method&&this._parseRequestStatusLine(),this._method}get requestPath(){return void 0===this._requestPath&&this._parseRequestStatusLine(),this._requestPath}}class d{startsWithSpace(t){const e=t.charAt(0);return" "===e||"\t"===e}async parse(t,{headersClass:e=Map}={}){const r=await t.readline();if(!r)return null;let i=r.trimEnd();const n=new e;if(!i)return null;let s=(await t.readline()).trimEnd();for(;s;){let[e,r]=f(s,":",1);r&&(e=e.trimStart(),r=r.trim());let i=(await t.readline()).trimEnd();for(;this.startsWithSpace(i);)r&&(r+=i),i=(await t.readline()).trimEnd();if(r)try{n.set(e,r)}catch(t){}s=i}return new l({statusline:i,headers:n,totalRead:this.totalRead})}}function f(t,e,r){const i=t.split(e),n=i.slice(0,r);return i.slice(r).length>0&&n.push(i.slice(r).join(e)),n}var p=r(114),m=r.n(p);const w=new TextDecoder("utf-8"),g=new TextEncoder("utf-8"),y={warcinfo:"application/warc-fields",response:"application/http; msgtype=response",revisit:"application/http; msgtype=response",request:"application/http; msgtype=request",metadata:"application/warc-fields"};class _ extends o{static create({url:t,date:e,type:r,warcHeaders:i={},filename:n="",httpHeaders:s={},status:o="200",statusText:a="OK",httpVersion:u="HTTP/1.1",warcVersion:h="WARC/1.0",keepHeadersCase:c=!0,refersToUrl:d,refersToDate:f}={},p){function w(t){return"WARC/1.0"===h&&"Z"!=(t=t.split(".")[0]).charAt(e.length-1)&&(t+="Z"),t}e||(e=(new Date).toISOString()),e=w(e),i={...i},"warcinfo"===r?n&&(i["WARC-Filename"]=n):i["WARC-Target-URI"]=t,i["WARC-Date"]=e,i["WARC-Type"]=r,"revisit"===r&&(i["WARC-Profile"]="WARC/1.1"===h?"http://netpreserve.org/warc/1.1/revisit/identical-payload-digest":"http://netpreserve.org/warc/1.0/revisit/identical-payload-digest",i["WARC-Refers-To-Target-URI"]=d,i["WARC-Refers-To-Date"]=w(f)),(i=new l({statusline:h,headers:c?new Map(Object.entries(i)):new Headers(i)})).headers.get("WARC-Record-ID")||i.headers.set("WARC-Record-ID",``),!i.headers.get("Content-Type")&&y[r]&&i.headers.set("Content-Type",y[r]);const g=new _({warcHeaders:i,reader:p});switch(r){case"response":case"request":case"revisit":g.httpHeaders=new l({statusline:u+" "+o+" "+a,headers:c?new Map(Object.entries(s)):new Headers(s)})}return g}static createWARCInfo(t={},e){return t.type="warcinfo",_.create(t,async function*(){for(const[t,r]of Object.entries(e))yield g.encode(`${t}: ${r}\r\n`)}())}constructor({warcHeaders:t,reader:e}){super(),this.warcHeaders=t,this._reader=e,this._contentReader=null,this.payload=null,this.httpHeaders=null,this.consumed=!1,this.fixUp()}getResponseInfo(){const t=this.httpHeaders;return t?{headers:t.headers,status:t.statusCode,statusText:t.statusText}:null}fixUp(){const t=this.warcHeaders.headers.get("WARC-Target-URI");t&&t.startsWith("<")&&t.endsWith(">")&&this.warcHeaders.headers.set("WARC-Target-URI",t.slice(1,-1))}async readFully(t=!1){if(this.httpHeaders){if(this._contentReader&&!t)throw new TypeError("WARC Record decoding already started, but requesting raw payload");if(t&&"raw"===this.consumed&&this.payload)return await this._createDecodingReader([this.payload]).readFully()}return this.payload||(t?(this.payload=await super.readFully(),this.consumed="content"):(this.payload=await _.readFully(this._reader),this.consumed="raw")),this.payload}get reader(){if(this._contentReader)throw new TypeError("WARC Record decoding already started, but requesting raw payload");return this._reader}get contentReader(){return this.httpHeaders?(this._contentReader||(this._contentReader=this._createDecodingReader(this._reader)),this._contentReader):this._reader}_createDecodingReader(t){let e=this.httpHeaders.headers.get("content-encoding"),r=this.httpHeaders.headers.get("transfer-encoding");const i="chunked"===r;return e||i||(e=r),new a(t,e,i)}async readlineRaw(t){if(this.consumed)throw new Error("Record already consumed.. Perhaps a promise was not awaited?");return this.contentReader.readlineRaw(t)}async contentText(){const t=await this.readFully(!0);return w.decode(t)}async*[Symbol.asyncIterator](){for await(const t of this.contentReader)if(yield t,this.consumed)throw new Error("Record already consumed.. Perhaps a promise was not awaited?");this.consumed="content"}async skipFully(){if(this.consumed)return;const t=await this._reader.skipFully();return this.consumed="skipped",t}warcHeader(t){return this.warcHeaders.headers.get(t)}get warcType(){return this.warcHeaders.headers.get("WARC-Type")}get warcTargetURI(){return this.warcHeaders.headers.get("WARC-Target-URI")}get warcDate(){return this.warcHeaders.headers.get("WARC-Date")}get warcRefersToTargetURI(){return this.warcHeaders.headers.get("WARC-Refers-To-Target-URI")}get warcRefersToDate(){return this.warcHeaders.headers.get("WARC-Refers-To-Date")}get warcPayloadDigest(){return this.warcHeaders.headers.get("WARC-Payload-Digest")}get warcBlockDigest(){return this.warcHeaders.headers.get("WARC-Block-Digest")}get warcContentType(){return this.warcHeaders.headers.get("Content-Type")}get warcContentLength(){return Number(this.warcHeaders.headers.get("Content-Length"))}}class b{static parse(t,e){return new b(t,e).parse()}static iterRecords(t,e){return new b(t,e)[Symbol.asyncIterator]()}constructor(t,{keepHeadersCase:e=!1,parseHttp:r=!0}={}){this._offset=0,this._warcHeadersLength=0,this._headersClass=e?Map:Headers,this._parseHttp=r,this._atRecordBoundary=!0,t instanceof a||(t=new a(t)),this._reader=t,this._record=null}async readToNextRecord(){!this._atRecordBoundary&&this._reader&&this._record&&(await this._record.skipFully(),await this._reader.readSize(4,!0),this._atRecordBoundary=!0)}_initRecordReader(t){return new u(this._reader,Number(t.headers.get("Content-Length")||0))}async parse(){await this.readToNextRecord(),this._offset=this._reader.getRawOffset();const t=new d,e=await t.parse(this._reader,{headersClass:this._headersClass});if(!e)return null;this._warcHeadersLength=this._reader.getReadOffset();const r=new _({warcHeaders:e,reader:this._initRecordReader(e)});if(this._atRecordBoundary=!1,this._record=r,this._parseHttp)switch(r.warcType){case"response":case"request":await this._addHttpHeaders(r,t,this._reader);break;case"revisit":r.warcContentLength>0&&await this._addHttpHeaders(r,t,this._reader)}return r}get offset(){return this._offset}get recordLength(){return this._reader.getRawLength(this._offset)}async*[Symbol.asyncIterator](){let t=null;for(;t=await this.parse(this._reader);)yield t;this._record=null}async _addHttpHeaders(t,e){const r=await e.parse(this._reader,{headersClass:this._headersClass});t.httpHeaders=r;const i=this._reader.getReadOffset()-this._warcHeadersLength;t.reader.setLimitSkip&&t.reader.setLimitSkip(t.warcContentLength-i)}}var E=r(115),v=r.n(E),A=r(56);const T=new TextEncoder;class x extends o{static async serialize(t,e){const r=new x(t,e);return await r.readFully()}static base16(t){return Array.from(new Uint8Array(t)).map(t=>t.toString(16).padStart(2,"0")).join("")}constructor(t,e={}){super(),this.record=t,this.gzip=e.gzip;const r=e&&e.digest||{};"revisit"===t.warcType||"warcinfo"===t.warcType||t.warcPayloadDigest&&t.warcBlockDigest?this.digestAlgo=null:(this.digestAlgo=r.algo||"sha-256",this.digestAlgoPrefix=r.prefix||"sha-256:",this.digestBase32=r.base32||!1)}async*[Symbol.asyncIterator](){if(!this.gzip)return void(yield*this.generateRecord());const t=new A.Deflate({gzip:!0});let e=null;for await(const r of this.generateRecord())for(e&&e.length>0&&t.push(e),e=r;t.chunks.length;)yield t.chunks.shift();t.push(e,!0),yield t.result}async digestMessage(t){const e=await crypto.subtle.digest(this.digestAlgo,t);return this.digestAlgoPrefix+(this.digestBase32?v.a.encode(e):x.base16(e))}async*generateRecord(){let t=0,e=null;this.record.httpHeaders&&(e=T.encode(this.record.httpHeaders.toString()+"\r\n"),t+=e.length);const r=await this.record.readFully();if(t+=r.length,this.digestAlgo){const i=await this.digestMessage(r),n=e?await this.digestMessage(x.concatChunks([e,r],t)):i;this.record.warcHeaders.headers.set("WARC-Payload-Digest",i),this.record.warcHeaders.headers.set("WARC-Block-Digest",n)}this.record.warcHeaders.headers.set("Content-Length",t);const i=T.encode(this.record.warcHeaders.toString());yield i,yield h,e&&(yield e),yield r,yield c}}const S="offset,warc-type,warc-target-uri".split(",");const C="urlkey,timestamp,url,mime,status,digest,length,offset,filename".split(","),D="urlkey,timestamp,url,mime,status,digest,redirect,meta,length,offset,filename".split(",");class k extends class extends class{constructor(t,e){this.opts=t,this.out=e}serialize(t){return JSON.stringify(t)+"\n"}write(t){this.out.write(this.serialize(t))}async run(t){for await(const e of this.iterIndex(t))this.write(e)}async*iterIndex(t){const e={strictHeaders:!0,parseHttp:this.parseHttp};for(const{filename:r,reader:i}of t){if(!r||!i)continue;const t=new b(i,e);for await(const e of t){await e.skipFully();const i=this.indexRecord(e,t,r);i&&(yield i)}}}indexRecord(t,e,r){if(this.filterRecord&&!this.filterRecord(t))return null;const i={},n={offset:e.offset,length:e.recordLength,filename:r};for(const e of this.fields)null!=n[e]?i[e]=n[e]:this.setField(e,t,i);return i}setField(t,e,r){const i=this.getField(t,e);null!=i&&(r[t]=i)}getField(t,e){return"http:status"===t?!e.httpHeaders||"response"!==e.warcType&&"revisit"!==e.warcType?null:e.httpHeaders.statusCode:t.startsWith("http:")?e.httpHeaders?e.httpHeaders.headers.get(t.slice(5)):null:e.warcHeaders.headers.get(t)}}{constructor(t={},e=null){if(super(t,e),t.fields){this.fields=t.fields.split(","),this.parseHttp=!1;for(const t of this.fields)if(t.startsWith("http:")){this.parseHttp=!0;break}}else this.fields=S,this.parseHttp=!1}}{constructor(t={},e=null){switch(super(t,e),this.includeAll=t.all,this.fields=C,this.parseHttp=!0,t.format){case"cdxj":this.serialize=this.serializeCDXJ;break;case"cdx":this.serialize=this.serializeCDX11}}filterRecord(t){if(this.includeAll)return!0;const e=t.warcType;return"request"!==e&&"warcinfo"!==e}serializeCDXJ(t){const{urlkey:e,timestamp:r}=t;return delete t.urlkey,delete t.timestamp,`${e} ${r} ${JSON.stringify(t)}\n`}serializeCDX11(t){const e=[];for(const r of D)e.push(null!=t[r]?t[r]:"-");return e.join(" ")+"\n"}getField(t,e){let r=null;switch(t){case"urlkey":return this.getSurt(e.warcTargetURI);case"timestamp":return r=e.warcDate,r.replace(/[-:T]/g,"").slice(0,14);case"url":return e.warcTargetURI;case"mime":switch(e.warcType){case"revisit":return"warc/revisit";case"response":case"request":t="http:content-type";break;default:t="content-type"}return r=super.getField(t,e),r?r.split(";",1)[0].trim():null;case"status":return super.getField("http:status",e);case"digest":return r=e.warcPayloadDigest,r?r.split(":",2)[1]:null}}getSurt(t){try{const e=new URL(t);let r=e.hostname.split(".").reverse().join(",");return e.port&&(r+=":"+e.port),r+=")",r+=e.pathname,r.toLowerCase()}catch(e){return t}}}},function(t,e,r){"use strict";var i=r(24),n=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],s=["scalar","sequence","mapping"];t.exports=function(t,e){var r,o;if(e=e||{},Object.keys(e).forEach((function(e){if(-1===n.indexOf(e))throw new i('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')})),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(r=e.styleAliases||null,o={},null!==r&&Object.keys(r).forEach((function(t){r[t].forEach((function(e){o[String(e)]=t}))})),o),-1===s.indexOf(this.kind))throw new i('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},function(t,e,r){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ -var r=n(129),i=n(130),s=n(69);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function f(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return j(e).length;default:if(r)return W(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return D(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return C(this,t,n);case"latin1":case"binary":return k(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function w(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:_(e,t,n,r,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):_(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function _(e,t,n,r,i){var s,o=1,a=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(s=n;sa&&(n=a-u),s=n;s>=0;s--){for(var h=!0,d=0;di&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function S(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(s=e[i+1]))&&(u=(31&l)<<6|63&s)>127&&(c=u);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(u=(15&l)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},u.prototype.compare=function(e,t,n,r,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(r,i),c=e.slice(t,n),h=0;hi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return y(this,e,t,n);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return E(this,e,t,n);case"base64":return A(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",s=t;sn)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,n,r,i,s){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function F(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function P(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,s){return s||P(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function B(e,t,n,r,s){return s||P(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUInt8=function(e,t){return t||O(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||O(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||O(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||O(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=this[e],i=1,s=0;++s=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||O(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},u.prototype.readInt8=function(e,t){return t||O(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||O(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||O(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||O(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||O(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||I(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s=0&&(s*=256);)this[t+i]=e/s&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):F(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);I(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);I(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):F(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return B(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return B(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function j(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(6))},function(e,t,n){e.exports=i;var r=n(42).EventEmitter;function i(){r.call(this)}n(13)(i,r),i.Readable=n(43),i.Writable=n(138),i.Duplex=n(139),i.Transform=n(140),i.PassThrough=n(141),i.Stream=i,i.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function s(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",s),e._isStdio||t&&!1===t.end||(n.on("end",a),n.on("close",u));var o=!1;function a(){o||(o=!0,e.end())}function u(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",i),e.removeListener("drain",s),n.removeListener("end",a),n.removeListener("close",u),n.removeListener("error",l),e.removeListener("error",l),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",l),e.on("error",l),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(1),i=n(0);const s=new TextDecoder("utf-8");class o{static fromResponse({url:e,response:t,date:n,noRW:i,isLive:s}){const a=t.body?new r.a(t.body.getReader(),!1):null,u=Number(t.headers.get("x-redirect-status")||t.status),l=t.statusText;let c=t.headers;const h=c.get("x-proxy-set-cookie");if(h){const e=[];h.split(",").forEach(t=>{const n=t.split(";",1)[0].trim();n.indexOf("=")>0&&e.push(n)}),e.length&&(c=new Headers(c),c.set("x-wabac-preset-cookie",e.join(";")),console.log("cookies",e.join(";")))}return new o({payload:a,status:u,statusText:l,headers:c,url:e,date:n,noRW:i,isLive:s})}constructor({payload:e,status:t,statusText:n,headers:r,url:i,date:s,extraOpts:o=null,noRW:a=!1,isLive:u=!1}){this.reader=null,this.buffer=null,e&&e[Symbol.asyncIterator]?this.reader=e:this.buffer=e,this.status=t,this.statusText=n,this.headers=r,this.url=i,this.date=s,this.extraOpts=o,this.noRW=a,this.isLive=u}async getText(){const e=await this.getBuffer();return"string"==typeof e?e:s.decode(e)}async getBuffer(){return this.buffer||(this.buffer=await this.reader.readFully()),this.buffer}async setContent(e){e instanceof r.b?(this.reader=e,this.buffer=null):e.getReader?(this.reader=new r.a(e.getReader()),this.buffer=null):(this.reader=null,this.buffer=e)}async*[Symbol.asyncIterator](){this.buffer?yield this.buffer:this.reader&&(yield*this.reader)}setRange(e){const t=e.match(/^bytes\=(\d+)\-(\d+)?$/);let n=0;if(this.buffer)n=this.buffer.length;else if(this.reader&&(n=Number(this.headers.get("content-length")),!n))return;if(!t)return this.status=416,this.statusText="Range Not Satisfiable",this.headers.set("Content-Range","*/"+n),!1;const r=Number(t[1]),i=Number(t[2])||n-1;return this.buffer?this.buffer=this.buffer.slice(r,i+1):this.reader&&(0===r&&i===n-1||this.reader.setLimitSkip(i-r+1,r)),this.headers.set("Content-Range",`bytes ${r}-${i}/${n}`),this.headers.set("Content-Length",i-r+1),this.status=206,this.statusText="Partial Content",!0}makeResponse(){let e=null;Object(i.i)(this.status)||(e=this.buffer||!this.reader?this.buffer:this.reader.getReadableStream());const t=new Response(e,{status:this.status,statusText:this.statusText,headers:this.headers});return t.date=this.date,t}}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";const r=function(e,t){const n=t.exec(e);return!(null==n)};t.isExist=function(e){return void 0!==e},t.isEmptyObject=function(e){return 0===Object.keys(e).length},t.merge=function(e,t,n){if(t){const r=Object.keys(t),i=r.length;for(let s=0;s1)for(var n=1;ne.decode(t),t.utf8.checksUTF8=!0}else t.utf8=e=>e.toString("utf8"),t.utf8.checksUTF8=!1;t.parseCBORint=function(e,t){switch(e){case o.ONE:return t.readUInt8(0);case o.TWO:return t.readUInt16BE(0);case o.FOUR:return t.readUInt32BE(0);case o.EIGHT:const n=t.readUInt32BE(0),r=t.readUInt32BE(4);return n>2097151?new i(n).times(a).plus(r):n*a+r;default:throw new Error("Invalid additional info for int: "+e)}},t.writeHalf=function(t,n){const r=e.allocUnsafe(4);r.writeFloatBE(n,0);const i=r.readUInt32BE(0);if(0!=(8191&i))return!1;let s=i>>16&32768;const o=i>>23&255,a=8388607&i;if(o>=113&&o<=142)s+=(o-112<<10)+(a>>13);else{if(!(o>=103&&o<113))return!1;if(a&(1<<126-o)-1)return!1;s+=a+8388608>>126-o}return t.writeUInt16BE(s),!0},t.parseHalf=function(e){const t=128&e[0]?-1:1,n=(124&e[0])>>2,r=(3&e[0])<<8|e[1];return n?31===n?t*(r?NaN:Infinity):t*Math.pow(2,n-25)*(1024+r):5.960464477539063e-8*t*r},t.parseCBORfloat=function(e){switch(e.length){case 2:return t.parseHalf(e);case 4:return e.readFloatBE(0);case 8:return e.readDoubleBE(0);default:throw new Error("Invalid float size: "+e.length)}},t.hex=function(t){return e.from(t.replace(/^0x/,""),"hex")},t.bin=function(t){let n=0,r=(t=t.replace(/\s/g,"")).length%8||8;const i=[];for(;r<=t.length;)i.push(parseInt(t.slice(n,r),2)),n=r,r+=8;return e.from(i)},t.extend=function(e={},...t){const n=t.length;for(let r=0;re===t[n]))},t.bufferEqual=function(t,n){if(null==t&&null==n)return!0;if(null==t||null==n)return!1;if(!e.isBuffer(t)||!e.isBuffer(n)||t.length!==n.length)return!1;const r=t.length;let i,s,o=!0;for(i=s=0;s0||e===t?t:t-1}function m(e){for(var t,n,r=1,i=e.length,s=e[0]+"";rl^n?1:-1;for(a=(u=i.length)<(l=s.length)?u:l,o=0;os[o]^n?1:-1;return u==l?0:u>l^n?1:-1}function g(e,t,n,r){if(en||e!==u(e))throw Error(l+(r||"Argument")+("number"==typeof e?en?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function _(e){var t=e.c.length-1;return f(e.e/14)==t&&e.c[t]%2!=0}function b(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function y(e,t,n){var r,i;if(t<0){for(i=n+".";++t;i+=n);e=i+e}else if(++t>(r=e.length)){for(i=n,t-=r;--t;i+=n);e+=i}else tN?m.c=m.e=null:e.e=10;h/=10,l++);return void(l>N?m.c=m.e=null:(m.e=l,m.c=[e]))}f=String(e)}else{if(!o.test(f=String(e)))return i(m,f,d);m.s=45==f.charCodeAt(0)?(f=f.slice(1),-1):1}(l=f.indexOf("."))>-1&&(f=f.replace(".","")),(h=f.search(/e/i))>0?(l<0&&(l=h),l+=+f.slice(h+1),f=f.substring(0,h)):l<0&&(l=f.length)}else{if(g(t,2,U.length,"Base"),10==t)return H(m=new M(e),k+m.e+1,D);if(f=String(e),d="number"==typeof e){if(0*e!=0)return i(m,f,d,t);if(m.s=1/e<0?(f=f.slice(1),-1):1,M.DEBUG&&f.replace(/^0\.0*|\./,"").length>15)throw Error(c+e)}else m.s=45===f.charCodeAt(0)?(f=f.slice(1),-1):1;for(n=U.slice(0,t),l=h=0,p=f.length;hl){l=p;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,h=-1,l=0;continue}return i(m,String(e),d,t)}d=!1,(l=(f=r(f,t,10,m.s)).indexOf("."))>-1?f=f.replace(".",""):l=f.length}for(h=0;48===f.charCodeAt(h);h++);for(p=f.length;48===f.charCodeAt(--p););if(f=f.slice(h,++p)){if(p-=h,d&&M.DEBUG&&p>15&&(e>9007199254740991||e!==u(e)))throw Error(c+m.s*e);if((l=l-h-1)>N)m.c=m.e=null;else if(l=O)?b(u,o):y(u,o,"0");else if(s=(e=H(new M(e),t,n)).e,a=(u=m(e.c)).length,1==r||2==r&&(t<=s||s<=R)){for(;aa){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-a)>0)for(s+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function j(e,t){for(var n,r=1,i=new M(e[0]);r=10;i/=10,r++);return(n=r+14*n-1)>N?e.c=e.e=null:n=10;l/=10,i++);if((s=t-i)<0)s+=14,o=t,f=(c=m[p=0])/w[i-o-1]%10|0;else if((p=a((s+1)/14))>=m.length){if(!r)break e;for(;m.length<=p;m.push(0));c=f=0,i=1,o=(s%=14)-14+1}else{for(c=l=m[p],i=1;l>=10;l/=10,i++);f=(o=(s%=14)-14+i)<0?0:c/w[i-o-1]%10|0}if(r=r||t<0||null!=m[p+1]||(o<0?c:c%w[i-o-1]),r=n<4?(f||r)&&(0==n||n==(e.s<0?3:2)):f>5||5==f&&(4==n||r||6==n&&(s>0?o>0?c/w[i-o]:0:m[p-1])%10&1||n==(e.s<0?8:7)),t<1||!m[0])return m.length=0,r?(t-=e.e+1,m[0]=w[(14-t%14)%14],e.e=-t||0):m[0]=e.e=0,e;if(0==s?(m.length=p,l=1,p--):(m.length=p+1,l=w[14-s],m[p]=o>0?u(c/w[i-o]%w[o])*l:0),r)for(;;){if(0==p){for(s=1,o=m[0];o>=10;o/=10,s++);for(o=m[0]+=l,l=1;o>=10;o/=10,l++);s!=l&&(e.e++,m[0]==h&&(m[0]=1));break}if(m[p]+=l,m[p]!=h)break;m[p--]=0,l=1}for(s=m.length;0===m[--s];m.pop());}e.e>N?e.c=e.e=null:e.e=O?b(t,n):y(t,n,"0"),e.s<0?"-"+t:t)}return M.clone=e,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(l+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(g(n=e[t],0,p,t),k=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(g(n=e[t],0,8,t),D=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(g(n[0],-p,0,t),g(n[1],0,p,t),R=n[0],O=n[1]):(g(n,-p,p,t),R=-(O=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)g(n[0],-p,-1,t),g(n[1],1,p,t),I=n[0],N=n[1];else{if(g(n,-p,p,t),!n)throw Error(l+t+" cannot be zero: "+n);I=-(N=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(l+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!n,Error(l+"crypto unavailable");F=n}else F=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(g(n=e[t],0,9,t),P=n),e.hasOwnProperty(t="POW_PRECISION")&&(g(n=e[t],0,p,t),L=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(l+t+" not an object: "+n);B=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(l+t+" invalid: "+n);U=n}}return{DECIMAL_PLACES:k,ROUNDING_MODE:D,EXPONENTIAL_AT:[R,O],RANGE:[I,N],CRYPTO:F,MODULO_MODE:P,POW_PRECISION:L,FORMAT:B,ALPHABET:U}},M.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!M.DEBUG)return!0;var t,n,r=e.c,i=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===s||-1===s)&&i>=-p&&i<=p&&i===u(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%14)<1&&(t+=14),String(r[0]).length==t){for(t=0;t=h||n!==u(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(l+"Invalid BigNumber: "+e)},M.maximum=M.max=function(){return j(arguments,S.lt)},M.minimum=M.min=function(){return j(arguments,S.gt)},M.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,o,c=0,h=[],f=new M(C);if(null==e?e=k:g(e,0,p),i=a(e/14),F)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));c>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[c]=n[0],t[c+1]=n[1]):(h.push(o%1e14),c+=2);c=i/2}else{if(!crypto.randomBytes)throw F=!1,Error(l+"crypto unavailable");for(t=crypto.randomBytes(i*=7);c=9e15?crypto.randomBytes(7).copy(t,c):(h.push(o%1e14),c+=7);c=i/7}if(!F)for(;c=10;o/=10,c++);c<14&&(r-=14-c)}return f.e=r,f.c=h,f}),M.sum=function(){for(var e=1,t=arguments,n=new M(t[0]);en-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(t,r,i,s,o){var a,u,l,c,h,d,p,f,w=t.indexOf("."),g=k,_=D;for(w>=0&&(c=L,L=0,t=t.replace(".",""),d=(f=new M(r)).pow(t.length-w),L=c,f.c=e(y(m(d.c),d.e,"0"),10,i,"0123456789"),f.e=f.c.length),l=c=(p=e(t,r,i,o?(a=U,"0123456789"):(a="0123456789",U))).length;0==p[--c];p.pop());if(!p[0])return a.charAt(0);if(w<0?--l:(d.c=p,d.e=l,d.s=s,p=(d=n(d,f,g,_,i)).c,h=d.r,l=d.e),w=p[u=l+g+1],c=i/2,h=h||u<0||null!=p[u+1],h=_<4?(null!=w||h)&&(0==_||_==(d.s<0?3:2)):w>c||w==c&&(4==_||h||6==_&&1&p[u-1]||_==(d.s<0?8:7)),u<1||!p[0])t=h?y(a.charAt(1),-g,a.charAt(0)):a.charAt(0);else{if(p.length=u,h)for(--i;++p[--u]>i;)p[u]=0,u||(++l,p=[1].concat(p));for(c=p.length;!p[--c];);for(w=0,t="";w<=c;t+=a.charAt(p[w++]));t=y(t,l,a.charAt(0))}return t}}(),n=function(){function e(e,t,n){var r,i,s,o,a=0,u=e.length,l=t%1e7,c=t/1e7|0;for(e=e.slice();u--;)a=((i=l*(s=e[u]%1e7)+(r=c*s+(o=e[u]/1e7|0)*l)%1e7*1e7+a)/n|0)+(r/1e7|0)+c*o,e[u]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,s;if(n!=r)s=n>r?1:-1;else for(i=s=0;it[i]?1:-1;break}return s}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,s,o,a){var l,c,d,p,m,w,g,_,b,y,v,E,A,x,T,S,C,k=r.s==i.s?1:-1,D=r.c,R=i.c;if(!(D&&D[0]&&R&&R[0]))return new M(r.s&&i.s&&(D?!R||D[0]!=R[0]:R)?D&&0==D[0]||!R?0*k:k/0:NaN);for(b=(_=new M(k)).c=[],k=s+(c=r.e-i.e)+1,a||(a=h,c=f(r.e/14)-f(i.e/14),k=k/14|0),d=0;R[d]==(D[d]||0);d++);if(R[d]>(D[d]||0)&&c--,k<0)b.push(1),p=!0;else{for(x=D.length,S=R.length,d=0,k+=2,(m=u(a/(R[0]+1)))>1&&(R=e(R,m,a),D=e(D,m,a),S=R.length,x=D.length),A=S,v=(y=D.slice(0,S)).length;v=a/2&&T++;do{if(m=0,(l=t(R,y,S,v))<0){if(E=y[0],S!=v&&(E=E*a+(y[1]||0)),(m=u(E/T))>1)for(m>=a&&(m=a-1),g=(w=e(R,m,a)).length,v=y.length;1==t(w,y,g,v);)m--,n(w,S=10;k/=10,d++);H(_,s+(_.e=d+14*c-1)+1,o,p)}else _.e=c,_.r=+p;return _}}(),v=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,A=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,n,r){var i,s=n?t:t.replace(T,"");if(x.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!n&&(s=s.replace(v,(function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t})),r&&(i=r,s=s.replace(E,"$1").replace(A,"0.$1")),t!=s))return new M(s,i);if(M.DEBUG)throw Error(l+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},S.absoluteValue=S.abs=function(){var e=new M(this);return e.s<0&&(e.s=1),e},S.comparedTo=function(e,t){return w(this,new M(e,t))},S.decimalPlaces=S.dp=function(e,t){var n,r,i,s=this;if(null!=e)return g(e,0,p),null==t?t=D:g(t,0,8),H(new M(s),e+s.e+1,t);if(!(n=s.c))return null;if(r=14*((i=n.length-1)-f(this.e/14)),i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},S.dividedBy=S.div=function(e,t){return n(this,new M(e,t),k,D)},S.dividedToIntegerBy=S.idiv=function(e,t){return n(this,new M(e,t),0,1)},S.exponentiatedBy=S.pow=function(e,t){var n,r,i,s,o,c,h,d,p=this;if((e=new M(e)).c&&!e.isInteger())throw Error(l+"Exponent not an integer: "+G(e));if(null!=t&&(t=new M(t)),o=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new M(Math.pow(+G(p),o?2-_(e):+G(e))),t?d.mod(t):d;if(c=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new M(NaN);(r=!c&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||o&&p.c[1]>=24e7:p.c[0]<8e13||o&&p.c[0]<=9999975e7)))return s=p.s<0&&_(e)?-0:0,p.e>-1&&(s=1/s),new M(c?1/s:s);L&&(s=a(L/14+2))}for(o?(n=new M(.5),c&&(e.s=1),h=_(e)):h=(i=Math.abs(+G(e)))%2,d=new M(C);;){if(h){if(!(d=d.times(p)).c)break;s?d.c.length>s&&(d.c.length=s):r&&(d=d.mod(t))}if(i){if(0===(i=u(i/2)))break;h=i%2}else if(H(e=e.times(n),e.e+1,1),e.e>14)h=_(e);else{if(0===(i=+G(e)))break;h=i%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):r&&(p=p.mod(t))}return r?d:(c&&(d=C.div(d)),t?d.mod(t):s?H(d,L,D,void 0):d)},S.integerValue=function(e){var t=new M(this);return null==e?e=D:g(e,0,8),H(t,t.e+1,e)},S.isEqualTo=S.eq=function(e,t){return 0===w(this,new M(e,t))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(e,t){return w(this,new M(e,t))>0},S.isGreaterThanOrEqualTo=S.gte=function(e,t){return 1===(t=w(this,new M(e,t)))||0===t},S.isInteger=function(){return!!this.c&&f(this.e/14)>this.c.length-2},S.isLessThan=S.lt=function(e,t){return w(this,new M(e,t))<0},S.isLessThanOrEqualTo=S.lte=function(e,t){return-1===(t=w(this,new M(e,t)))||0===t},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(e,t){var n,r,i,s,o=this,a=o.s;if(t=(e=new M(e,t)).s,!a||!t)return new M(NaN);if(a!=t)return e.s=-t,o.plus(e);var u=o.e/14,l=e.e/14,c=o.c,d=e.c;if(!u||!l){if(!c||!d)return c?(e.s=-t,e):new M(d?o:NaN);if(!c[0]||!d[0])return d[0]?(e.s=-t,e):new M(c[0]?o:3==D?-0:0)}if(u=f(u),l=f(l),c=c.slice(),a=u-l){for((s=a<0)?(a=-a,i=c):(l=u,i=d),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(s=(a=c.length)<(t=d.length))?a:t,a=t=0;t0)for(;t--;c[n++]=0);for(t=h-1;r>a;){if(c[--r]=0;){for(n=0,p=y[i]%1e7,m=y[i]/1e7|0,s=i+(o=u);s>i;)n=((l=p*(l=b[--o]%1e7)+(a=m*l+(c=b[o]/1e7|0)*p)%1e7*1e7+w[s]+n)/g|0)+(a/1e7|0)+m*c,w[s--]=l%g;w[s]=n}return n?++r:w.splice(0,1),z(e,w,r)},S.negated=function(){var e=new M(this);return e.s=-e.s||null,e},S.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new M(e,t)).s,!i||!t)return new M(NaN);if(i!=t)return e.s=-t,r.minus(e);var s=r.e/14,o=e.e/14,a=r.c,u=e.c;if(!s||!o){if(!a||!u)return new M(i/0);if(!a[0]||!u[0])return u[0]?e:new M(a[0]?r:0*i)}if(s=f(s),o=f(o),a=a.slice(),i=s-o){for(i>0?(o=s,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(t=u.length)<0&&(n=u,u=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++o),z(e,a,o)},S.precision=S.sd=function(e,t){var n,r,i,s=this;if(null!=e&&e!==!!e)return g(e,1,p),null==t?t=D:g(t,0,8),H(new M(s),e,t);if(!(n=s.c))return null;if(r=14*(i=n.length-1)+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&s.e+1>r&&(r=s.e+1),r},S.shiftedBy=function(e){return g(e,-9007199254740991,9007199254740991),this.times("1e"+e)},S.squareRoot=S.sqrt=function(){var e,t,r,i,s,o=this,a=o.c,u=o.s,l=o.e,c=k+4,h=new M("0.5");if(1!==u||!a||!a[0])return new M(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(u=Math.sqrt(+G(o)))||u==1/0?(((t=m(a)).length+l)%2==0&&(t+="0"),u=Math.sqrt(+t),l=f((l+1)/2)-(l<0||l%2),r=new M(t=u==1/0?"1e"+l:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+l)):r=new M(u+""),r.c[0])for((u=(l=r.e)+c)<3&&(u=0);;)if(s=r,r=h.times(s.plus(n(o,s,c,1))),m(s.c).slice(0,u)===(t=m(r.c)).slice(0,u)){if(r.e0&&m>0){for(s=m%a||a,h=f.substr(0,s);s0&&(h+=c+f.slice(s)),p&&(h="-"+h)}r=d?h+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):h}return(n.prefix||"")+r+(n.suffix||"")},S.toFraction=function(e){var t,r,i,s,o,a,u,c,h,p,f,w,g=this,_=g.c;if(null!=e&&(!(u=new M(e)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(l+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+G(u));if(!_)return new M(g);for(t=new M(C),h=r=new M(C),i=c=new M(C),w=m(_),o=t.e=w.length-g.e-1,t.c[0]=d[(a=o%14)<0?14+a:a],e=!e||u.comparedTo(t)>0?o>0?t:h:u,a=N,N=1/0,u=new M(w),c.c[0]=0;p=n(u,t,0,1),1!=(s=r.plus(p.times(i))).comparedTo(e);)r=i,i=s,h=c.plus(p.times(s=h)),c=s,t=u.minus(p.times(s=t)),u=s;return s=n(e.minus(r),i,0,1),c=c.plus(s.times(h)),r=r.plus(s.times(i)),c.s=h.s=g.s,f=n(h,i,o*=2,D).minus(g).abs().comparedTo(n(c,r,o,D).minus(g).abs())<1?[h,i]:[c,r],N=a,f},S.toNumber=function(){return+G(this)},S.toPrecision=function(e,t){return null!=e&&g(e,1,p),W(this,e,t,2)},S.toString=function(e){var t,n=this,i=n.s,s=n.e;return null===s?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=s<=R||s>=O?b(m(n.c),s):y(m(n.c),s,"0"):10===e?t=y(m((n=H(new M(n),k+s+1,D)).c),n.e,"0"):(g(e,2,U.length,"Base"),t=r(y(m(n.c),s,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},S.valueOf=S.toJSON=function(){return G(this)},S._isBigNumber=!0,null!=t&&M.set(t),M}()).default=s.BigNumber=s,void 0===(r=function(){return s}.call(t,n,t,e))||(e.exports=r)}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));class r{constructor(){this.promises=[],this.batch=[],this.count=0}addPage(e){this.promises.push(this.db.addPage(e))}addResource(e){this.batch.length>=1e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=1e3} records`)),this.batch.push(e)}async finishIndexing(){this.batch.length>0&&this.promises.push(this.db.addResources(this.batch)),console.log(`Indexed ${this.count+=this.batch.length} records`),this._finishLoad();try{await Promise.all(this.promises)}catch(e){console.warn(e)}this.promises=[]}_finishLoad(){}}},,,function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(3).Buffer)},function(e,t,n){"use strict";const r=t.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};t.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},t.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const i=t.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};t.SPECIAL_ELEMENTS={[r.HTML]:{[i.ADDRESS]:!0,[i.APPLET]:!0,[i.AREA]:!0,[i.ARTICLE]:!0,[i.ASIDE]:!0,[i.BASE]:!0,[i.BASEFONT]:!0,[i.BGSOUND]:!0,[i.BLOCKQUOTE]:!0,[i.BODY]:!0,[i.BR]:!0,[i.BUTTON]:!0,[i.CAPTION]:!0,[i.CENTER]:!0,[i.COL]:!0,[i.COLGROUP]:!0,[i.DD]:!0,[i.DETAILS]:!0,[i.DIR]:!0,[i.DIV]:!0,[i.DL]:!0,[i.DT]:!0,[i.EMBED]:!0,[i.FIELDSET]:!0,[i.FIGCAPTION]:!0,[i.FIGURE]:!0,[i.FOOTER]:!0,[i.FORM]:!0,[i.FRAME]:!0,[i.FRAMESET]:!0,[i.H1]:!0,[i.H2]:!0,[i.H3]:!0,[i.H4]:!0,[i.H5]:!0,[i.H6]:!0,[i.HEAD]:!0,[i.HEADER]:!0,[i.HGROUP]:!0,[i.HR]:!0,[i.HTML]:!0,[i.IFRAME]:!0,[i.IMG]:!0,[i.INPUT]:!0,[i.LI]:!0,[i.LINK]:!0,[i.LISTING]:!0,[i.MAIN]:!0,[i.MARQUEE]:!0,[i.MENU]:!0,[i.META]:!0,[i.NAV]:!0,[i.NOEMBED]:!0,[i.NOFRAMES]:!0,[i.NOSCRIPT]:!0,[i.OBJECT]:!0,[i.OL]:!0,[i.P]:!0,[i.PARAM]:!0,[i.PLAINTEXT]:!0,[i.PRE]:!0,[i.SCRIPT]:!0,[i.SECTION]:!0,[i.SELECT]:!0,[i.SOURCE]:!0,[i.STYLE]:!0,[i.SUMMARY]:!0,[i.TABLE]:!0,[i.TBODY]:!0,[i.TD]:!0,[i.TEMPLATE]:!0,[i.TEXTAREA]:!0,[i.TFOOT]:!0,[i.TH]:!0,[i.THEAD]:!0,[i.TITLE]:!0,[i.TR]:!0,[i.TRACK]:!0,[i.UL]:!0,[i.WBR]:!0,[i.XMP]:!0},[r.MATHML]:{[i.MI]:!0,[i.MO]:!0,[i.MN]:!0,[i.MS]:!0,[i.MTEXT]:!0,[i.ANNOTATION_XML]:!0},[r.SVG]:{[i.TITLE]:!0,[i.FOREIGN_OBJECT]:!0,[i.DESC]:!0}}},function(e,t,n){"use strict";function r(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},e.exports=r},function(e,t,n){"use strict";var r=n(16);e.exports=new r({include:[n(90)],implicit:[n(193),n(194)],explicit:[n(195),n(196),n(197),n(198)]})},function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),f(n)?r.showHidden=n:n&&t._extend(r,n),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function l(e,t){return e}function c(e,n,r){if(e.customInspect&&n&&A(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return g(i)||(i=c(e,i,r)),i}var s=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(g(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(w(t))return e.stylize(""+t,"number");if(f(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,n);if(s)return s;var o=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(n)),E(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(n);if(0===o.length){if(A(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(b(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(v(n))return e.stylize(Date.prototype.toString.call(n),"date");if(E(n))return h(n)}var l,y="",x=!1,T=["{","}"];(p(n)&&(x=!0,T=["[","]"]),A(n))&&(y=" [Function"+(n.name?": "+n.name:"")+"]");return b(n)&&(y=" "+RegExp.prototype.toString.call(n)),v(n)&&(y=" "+Date.prototype.toUTCString.call(n)),E(n)&&(y=" "+h(n)),0!==o.length||x&&0!=n.length?r<0?b(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),l=x?function(e,t,n,r,i){for(var s=[],o=0,a=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,y,T)):T[0]+y+T[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),k(r,i)||(o="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=m(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),_(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function p(e){return Array.isArray(e)}function f(e){return"boolean"==typeof e}function m(e){return null===e}function w(e){return"number"==typeof e}function g(e){return"string"==typeof e}function _(e){return void 0===e}function b(e){return y(e)&&"[object RegExp]"===x(e)}function y(e){return"object"==typeof e&&null!==e}function v(e){return y(e)&&"[object Date]"===x(e)}function E(e){return y(e)&&("[object Error]"===x(e)||e instanceof Error)}function A(e){return"function"==typeof e}function x(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(_(s)&&(s=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!o[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var r=e.pid;o[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else o[n]=function(){};return o[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=f,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=w,t.isString=g,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=_,t.isRegExp=b,t.isObject=y,t.isDate=v,t.isError=E,t.isFunction=A,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(210);var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),S[e.getMonth()],t].join(" ")}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",C(),t.format.apply(t,arguments))},t.inherits=n(211),t._extend=function(e,t){if(!t||!y(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var D="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(D&&e[D]){var t;if("function"!=typeof(t=e[D]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,D,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],s=0;s255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}[r.inspect.custom](e,t){return"simple("+this.value+")"}inspect(e,t){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(e){return e instanceof u}static decode(e,t=!0,n=!1){switch(e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:a.NULL;case o.UNDEFINED:return t?void 0:a.UNDEFINED;case-1:if(!t||!n)throw new Error("Invalid BREAK");return a.BREAK;default:return new u(e)}}}e.exports=u},function(e,t,n){"use strict";(function(t){const r=n(4),i=n(27);class s extends r.Transform{constructor(e,n,r){let i,s;switch(null==r&&(r={}),typeof e){case"object":t.isBuffer(e)?(i=e,null!=n&&"object"==typeof n&&(r=n)):r=e;break;case"string":i=e,null!=n&&"object"==typeof n?r=n:s=n}null==r&&(r={}),null==i&&(i=r.input),null==s&&(s=r.inputEncoding),delete r.input,delete r.inputEncoding;const o=null==r.watchPipe||r.watchPipe;delete r.watchPipe;const a=!!r.readError;delete r.readError,super(r),this.readError=a,o&&this.on("pipe",e=>{const t=e._readableState.objectMode;if(this.length>0&&t!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");return this._readableState.objectMode=t,this._writableState.objectMode=t}),null!=i&&this.end(i,s)}static isNoFilter(e){return e instanceof this}static compare(e,t){if(!(e instanceof this))throw new TypeError("Arguments must be NoFilters");return e===t?0:e.compare(t)}static concat(e,n){if(!Array.isArray(e))throw new TypeError("list argument must be an Array of NoFilters");if(0===e.length||0===n)return t.alloc(0);null==n&&(n=e.reduce((e,t)=>{if(!(t instanceof s))throw new TypeError("list argument must be an Array of NoFilters");return e+t.length},0));let r=!0,i=!0;const o=e.map(e=>{if(!(e instanceof s))throw new TypeError("list argument must be an Array of NoFilters");const n=e.slice();return t.isBuffer(n)?i=!1:r=!1,n});if(r)return t.concat(o,n);if(i)return[].concat(...o).slice(0,n);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(e,n,r){this._readableState.objectMode||t.isBuffer(e)||(e=t.from(e,n)),this.push(e),r()}_bufArray(){let e=this._readableState.buffer;if(!Array.isArray(e)){let t=e.head;for(e=[];null!=t;)e.push(t.data),t=t.next}return e}read(e){const t=super.read(e);if(null!=t){if(this.emit("read",t),this.readError&&t.length{this.on("finish",()=>{const r=this.read();null==e||t||(t=!0,e(null,r)),n(r)}),this.on("error",n=>{null==e||t||(t=!0,e(n)),r(n)})})}compare(e){if(!(e instanceof s))throw new TypeError("Arguments must be NoFilters");if(this===e)return 0;{const n=this.slice(),r=e.slice();if(t.isBuffer(n)&&t.isBuffer(r))return n.compare(r);throw new Error("Cannot compare streams in object mode")}}equals(e){return 0===this.compare(e)}slice(e,n){if(this._readableState.objectMode)return this._bufArray().slice(e,n);const r=this._bufArray();switch(r.length){case 0:return t.alloc(0);case 1:return r[0].slice(e,n);default:return t.concat(r).slice(e,n)}}get(e){return this.slice()[e]}toJSON(){const e=this.slice();return t.isBuffer(e)?e.toJSON():e}toString(e,n,r){const s=this.slice(n,r);if(!t.isBuffer(s))return JSON.stringify(s);if((!e||"utf8"===e)&&i.TextDecoder){return new i.TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(s)}return s.toString(e,n,r)}inspect(e,t){return this[i.inspect.custom](e,t)}[i.inspect.custom](e,n){const r=this._bufArray().map(e=>t.isBuffer(e)?(null!=n?n.stylize:void 0)?n.stylize(e.toString("hex"),"string"):e.toString("hex"):i.inspect(e,n)).join(", ");return`${this.constructor.name} [${r}]`}get length(){return this._readableState.length}writeBigInt(e){let n=e.toString(16);if(e<0){const t=BigInt(Math.floor(n.length/2));n=(e=(BigInt(1)<=a.DIGIT_0&&e<=a.DIGIT_9}function p(e){return e>=a.LATIN_CAPITAL_A&&e<=a.LATIN_CAPITAL_Z}function f(e){return e>=a.LATIN_SMALL_A&&e<=a.LATIN_SMALL_Z}function m(e){return f(e)||p(e)}function w(e){return m(e)||d(e)}function g(e){return e>=a.LATIN_CAPITAL_A&&e<=a.LATIN_CAPITAL_F}function _(e){return e>=a.LATIN_SMALL_A&&e<=a.LATIN_SMALL_F}function b(e){return e+32}function y(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(e>>>10&1023|55296)+String.fromCharCode(56320|1023&e))}function v(e){return String.fromCharCode(b(e))}function E(e,t){const n=s[++e];let r=++e,i=r+n-1;for(;r<=i;){const e=r+i>>>1,o=s[e];if(ot))return s[e+n];i=e-1}}return-1}class A{constructor(){this.preprocessor=new r,this.tokenQueue=[],this.allowCDATA=!1,this.state=c,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(e){this._consume(),this._err(e),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this[this.state](e)}return this.tokenQueue.shift()}write(e,t){this.active=!0,this.preprocessor.write(e,t)}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:A.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(e){this.state=e,this._unconsume()}_consumeSequenceIfMatch(e,t,n){let r=0,i=!0;const s=e.length;let o=0,u=t,l=void 0;for(;o0&&(u=this._consume(),r++),u===a.EOF){i=!1;break}if(l=e[o],u!==l&&(n||u!==b(l))){i=!1;break}}if(!i)for(;r--;)this._unconsume();return i}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==u.SCRIPT_STRING.length)return!1;for(let e=0;e0&&this._err(o.endTagWithAttributes),e.selfClosing&&this._err(o.endTagWithTrailingSolidus)),this.tokenQueue.push(e)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(e,t){this.currentCharacterToken&&this.currentCharacterToken.type!==e&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=t:this._createCharacterToken(e,t)}_emitCodePoint(e){let t=A.CHARACTER_TOKEN;h(e)?t=A.WHITESPACE_CHARACTER_TOKEN:e===a.NULL&&(t=A.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(t,y(e))}_emitSeveralCodePoints(e){for(let t=0;t-1;){const e=s[r],i=e<7;i&&1&e&&(t=2&e?[s[++r],s[++r]]:[s[++r]],n=0);const o=this._consume();if(this.tempBuff.push(o),n++,o===a.EOF)break;r=i?4&e?E(r,o):-1:o===e?++r:-1}for(;n--;)this.tempBuff.pop(),this._unconsume();return t}_isCharacterReferenceInAttribute(){return"ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_UNQUOTED_STATE"===this.returnState}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){const e=this._consume();return this._unconsume(),e===a.EQUALS_SIGN||w(e)}return!1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let e=0;e")):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitChars(i.REPLACEMENT_CHARACTER)):e===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(e))}SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE(e){e===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE"):m(e)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE")):(this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE(e){m(e)?(this._createEndTagToken(),this._reconsumeInState("SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE")):(this._emitChars(""),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE(e){if(p(e))this.currentToken.tagName+=v(e),this.tempBuff.push(e);else if(f(e))this.currentToken.tagName+=y(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(h(e))return void(this.state="BEFORE_ATTRIBUTE_NAME_STATE");if(e===a.SOLIDUS)return void(this.state="SELF_CLOSING_START_TAG_STATE");if(e===a.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=c)}this._emitChars(""),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}}SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE(e){h(e)||e===a.SOLIDUS||e===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_DOUBLE_ESCAPED_STATE":"SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(e)):p(e)?(this.tempBuff.push(b(e)),this._emitCodePoint(e)):f(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPED_STATE(e){e===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",this._emitChars("-")):e===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):e===a.NULL?(this._err(o.unexpectedNullCharacter),this._emitChars(i.REPLACEMENT_CHARACTER)):e===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(e)}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE(e){e===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",this._emitChars("-")):e===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(i.REPLACEMENT_CHARACTER)):e===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(e))}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE(e){e===a.HYPHEN_MINUS?this._emitChars("-"):e===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):e===a.GREATER_THAN_SIGN?(this.state="SCRIPT_DATA_STATE",this._emitChars(">")):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(i.REPLACEMENT_CHARACTER)):e===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(e))}SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE(e){e===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",this._emitChars("/")):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE(e){h(e)||e===a.SOLIDUS||e===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_ESCAPED_STATE":"SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(e)):p(e)?(this.tempBuff.push(b(e)),this._emitCodePoint(e)):f(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}BEFORE_ATTRIBUTE_NAME_STATE(e){h(e)||(e===a.SOLIDUS||e===a.GREATER_THAN_SIGN||e===a.EOF?this._reconsumeInState("AFTER_ATTRIBUTE_NAME_STATE"):e===a.EQUALS_SIGN?(this._err(o.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state="ATTRIBUTE_NAME_STATE"):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}ATTRIBUTE_NAME_STATE(e){h(e)||e===a.SOLIDUS||e===a.GREATER_THAN_SIGN||e===a.EOF?(this._leaveAttrName("AFTER_ATTRIBUTE_NAME_STATE"),this._unconsume()):e===a.EQUALS_SIGN?this._leaveAttrName("BEFORE_ATTRIBUTE_VALUE_STATE"):p(e)?this.currentAttr.name+=v(e):e===a.QUOTATION_MARK||e===a.APOSTROPHE||e===a.LESS_THAN_SIGN?(this._err(o.unexpectedCharacterInAttributeName),this.currentAttr.name+=y(e)):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.name+=i.REPLACEMENT_CHARACTER):this.currentAttr.name+=y(e)}AFTER_ATTRIBUTE_NAME_STATE(e){h(e)||(e===a.SOLIDUS?this.state="SELF_CLOSING_START_TAG_STATE":e===a.EQUALS_SIGN?this.state="BEFORE_ATTRIBUTE_VALUE_STATE":e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}BEFORE_ATTRIBUTE_VALUE_STATE(e){h(e)||(e===a.QUOTATION_MARK?this.state="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE":e===a.APOSTROPHE?this.state="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE":e===a.GREATER_THAN_SIGN?(this._err(o.missingAttributeValue),this.state=c,this._emitCurrentToken()):this._reconsumeInState("ATTRIBUTE_VALUE_UNQUOTED_STATE"))}ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE(e){e===a.QUOTATION_MARK?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":e===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=i.REPLACEMENT_CHARACTER):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=y(e)}ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE(e){e===a.APOSTROPHE?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":e===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=i.REPLACEMENT_CHARACTER):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=y(e)}ATTRIBUTE_VALUE_UNQUOTED_STATE(e){h(e)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):e===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_UNQUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):e===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=i.REPLACEMENT_CHARACTER):e===a.QUOTATION_MARK||e===a.APOSTROPHE||e===a.LESS_THAN_SIGN||e===a.EQUALS_SIGN||e===a.GRAVE_ACCENT?(this._err(o.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=y(e)):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=y(e)}AFTER_ATTRIBUTE_VALUE_QUOTED_STATE(e){h(e)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):e===a.SOLIDUS?this._leaveAttrValue("SELF_CLOSING_START_TAG_STATE"):e===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.missingWhitespaceBetweenAttributes),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}SELF_CLOSING_START_TAG_STATE(e){e===a.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.unexpectedSolidusInTag),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}BOGUS_COMMENT_STATE(e){e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.EOF?(this._emitCurrentToken(),this._emitEOFToken()):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=i.REPLACEMENT_CHARACTER):this.currentToken.data+=y(e)}MARKUP_DECLARATION_OPEN_STATE(e){this._consumeSequenceIfMatch(u.DASH_DASH_STRING,e,!0)?(this._createCommentToken(),this.state="COMMENT_START_STATE"):this._consumeSequenceIfMatch(u.DOCTYPE_STRING,e,!1)?this.state="DOCTYPE_STATE":this._consumeSequenceIfMatch(u.CDATA_START_STRING,e,!0)?this.allowCDATA?this.state="CDATA_SECTION_STATE":(this._err(o.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state="BOGUS_COMMENT_STATE"):this._ensureHibernation()||(this._err(o.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState("BOGUS_COMMENT_STATE"))}COMMENT_START_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_START_DASH_STATE":e===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):this._reconsumeInState("COMMENT_STATE")}COMMENT_START_DASH_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":e===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_END_DASH_STATE":e===a.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state="COMMENT_LESS_THAN_SIGN_STATE"):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=i.REPLACEMENT_CHARACTER):e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=y(e)}COMMENT_LESS_THAN_SIGN_STATE(e){e===a.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state="COMMENT_LESS_THAN_SIGN_BANG_STATE"):e===a.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE":this._reconsumeInState("COMMENT_END_DASH_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE(e){e!==a.GREATER_THAN_SIGN&&e!==a.EOF&&this._err(o.nestedComment),this._reconsumeInState("COMMENT_END_STATE")}COMMENT_END_DASH_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_STATE(e){e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.EXCLAMATION_MARK?this.state="COMMENT_END_BANG_STATE":e===a.HYPHEN_MINUS?this.currentToken.data+="-":e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_BANG_STATE(e){e===a.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state="COMMENT_END_DASH_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.incorrectlyClosedComment),this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState("COMMENT_STATE"))}DOCTYPE_STATE(e){h(e)?this.state="BEFORE_DOCTYPE_NAME_STATE":e===a.GREATER_THAN_SIGN?this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"):e===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingWhitespaceBeforeDoctypeName),this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"))}BEFORE_DOCTYPE_NAME_STATE(e){h(e)||(p(e)?(this._createDoctypeToken(v(e)),this.state="DOCTYPE_NAME_STATE"):e===a.NULL?(this._err(o.unexpectedNullCharacter),this._createDoctypeToken(i.REPLACEMENT_CHARACTER),this.state="DOCTYPE_NAME_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(y(e)),this.state="DOCTYPE_NAME_STATE"))}DOCTYPE_NAME_STATE(e){h(e)?this.state="AFTER_DOCTYPE_NAME_STATE":e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):p(e)?this.currentToken.name+=v(e):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.name+=i.REPLACEMENT_CHARACTER):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=y(e)}AFTER_DOCTYPE_NAME_STATE(e){h(e)||(e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(u.PUBLIC_STRING,e,!1)?this.state="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE":this._consumeSequenceIfMatch(u.SYSTEM_STRING,e,!1)?this.state="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE":this._ensureHibernation()||(this._err(o.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE(e){h(e)?this.state="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE":e===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE(e){h(e)||(e===a.QUOTATION_MARK?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE(e){e===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=i.REPLACEMENT_CHARACTER):e===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=y(e)}DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE(e){e===a.APOSTROPHE?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=i.REPLACEMENT_CHARACTER):e===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=y(e)}AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE(e){h(e)?this.state="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE":e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.QUOTATION_MARK?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE(e){h(e)||(e===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):e===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE(e){h(e)?this.state="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE":e===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE(e){h(e)||(e===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE(e){e===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=i.REPLACEMENT_CHARACTER):e===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=y(e)}DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE(e){e===a.APOSTROPHE?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=i.REPLACEMENT_CHARACTER):e===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=y(e)}AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE(e){h(e)||(e===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}BOGUS_DOCTYPE_STATE(e){e===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):e===a.NULL?this._err(o.unexpectedNullCharacter):e===a.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}CDATA_SECTION_STATE(e){e===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_BRACKET_STATE":e===a.EOF?(this._err(o.eofInCdata),this._emitEOFToken()):this._emitCodePoint(e)}CDATA_SECTION_BRACKET_STATE(e){e===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_END_STATE":(this._emitChars("]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CDATA_SECTION_END_STATE(e){e===a.GREATER_THAN_SIGN?this.state=c:e===a.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CHARACTER_REFERENCE_STATE(e){this.tempBuff=[a.AMPERSAND],e===a.NUMBER_SIGN?(this.tempBuff.push(e),this.state="NUMERIC_CHARACTER_REFERENCE_STATE"):w(e)?this._reconsumeInState("NAMED_CHARACTER_REFERENCE_STATE"):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}NAMED_CHARACTER_REFERENCE_STATE(e){const t=this._matchNamedCharacterReference(e);if(this._ensureHibernation())this.tempBuff=[a.AMPERSAND];else if(t){const e=this.tempBuff[this.tempBuff.length-1]===a.SEMICOLON;this._isCharacterReferenceAttributeQuirk(e)||(e||this._errOnNextCodePoint(o.missingSemicolonAfterCharacterReference),this.tempBuff=t),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state="AMBIGUOS_AMPERSAND_STATE"}AMBIGUOS_AMPERSAND_STATE(e){w(e)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=y(e):this._emitCodePoint(e):(e===a.SEMICOLON&&this._err(o.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}NUMERIC_CHARACTER_REFERENCE_STATE(e){this.charRefCode=0,e===a.LATIN_SMALL_X||e===a.LATIN_CAPITAL_X?(this.tempBuff.push(e),this.state="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE"):this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_START_STATE")}HEXADEMICAL_CHARACTER_REFERENCE_START_STATE(e){!function(e){return d(e)||g(e)||_(e)}(e)?(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState("HEXADEMICAL_CHARACTER_REFERENCE_STATE")}DECIMAL_CHARACTER_REFERENCE_START_STATE(e){d(e)?this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_STATE"):(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}HEXADEMICAL_CHARACTER_REFERENCE_STATE(e){g(e)?this.charRefCode=16*this.charRefCode+e-55:_(e)?this.charRefCode=16*this.charRefCode+e-87:d(e)?this.charRefCode=16*this.charRefCode+e-48:e===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}DECIMAL_CHARACTER_REFERENCE_STATE(e){d(e)?this.charRefCode=10*this.charRefCode+e-48:e===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}NUMERIC_CHARACTER_REFERENCE_END_STATE(){if(this.charRefCode===a.NULL)this._err(o.nullCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(o.characterReferenceOutsideUnicodeRange),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(i.isSurrogate(this.charRefCode))this._err(o.surrogateCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(i.isUndefinedCodePoint(this.charRefCode))this._err(o.noncharacterCharacterReference);else if(i.isControlCodePoint(this.charRefCode)||this.charRefCode===a.CARRIAGE_RETURN){this._err(o.controlCharacterReference);const e=l[this.charRefCode];e&&(this.charRefCode=e)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}}A.CHARACTER_TOKEN="CHARACTER_TOKEN",A.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",A.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",A.START_TAG_TOKEN="START_TAG_TOKEN",A.END_TAG_TOKEN="END_TAG_TOKEN",A.COMMENT_TOKEN="COMMENT_TOKEN",A.DOCTYPE_TOKEN="DOCTYPE_TOKEN",A.EOF_TOKEN="EOF_TOKEN",A.HIBERNATION_TOKEN="HIBERNATION_TOKEN",A.MODE={DATA:c,RCDATA:"RCDATA_STATE",RAWTEXT:"RAWTEXT_STATE",SCRIPT_DATA:"SCRIPT_DATA_STATE",PLAINTEXT:"PLAINTEXT_STATE"},A.getTokenAttr=function(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null},e.exports=A},function(e,t,n){"use strict";const r=n(7),i=n(7).buildOptions,s=n(177),o=1,a=2,u=3,l=4;let c="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|(([\\w:\\-._]*:)?([\\w:\\-._]+))([^>]*)>|((\\/)(([\\w:\\-._]*:)?([\\w:\\-._]+))\\s*>))([^<]*)";!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const h={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",localeRange:"",tagValueProcessor:function(e,t){return e},attrValueProcessor:function(e,t){return e},stopNodes:[]};t.defaultOptions=h;const d=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","localeRange","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","stopNodes"];t.props=d;function p(e,t,n){const r=e[7]||n;let i=e[14];return i&&(t.trimValues&&(i=i.trim()),i=t.tagValueProcessor(i,r),i=w(i,t.parseNodeValue,t.parseTrueNumberOnly)),i}function f(e){return"]]>"===e[4]?l:"/"===e[10]?a:void 0!==e[8]&&"/"===e[8].substr(e[8].length-1)?u:o}function m(e,t){if(t.ignoreNameSpace){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}function w(e,t,n){if(t&&"string"==typeof e){let t;return""===e.trim()||isNaN(e)?t="true"===e||"false"!==e&&e:(-1!==e.indexOf("0x")?t=Number.parseInt(e,16):-1!==e.indexOf(".")?(t=Number.parseFloat(e),e=e.replace(/0+$/,"")):t=Number.parseInt(e,10),n&&(t=String(t)===e?t:e)),t}return r.isExist(e)?e:""}const g=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");function _(e,t){if(!t.ignoreAttributes&&"string"==typeof e){e=e.replace(/\r?\n/g," ");const n=r.getAllMatches(e,g),i=n.length,s={};for(let e=0;e/g,"");const n=new s("!xml");let o=n;c=c.replace(/\[\\w/g,"["+t.localeRange+"\\w");const m=new RegExp(c,"g");let w=m.exec(e),g=m.exec(e);for(;w;){const n=f(w);if(n===a)o.parent&&w[14]&&(o.parent.val=r.getValue(o.parent.val)+""+p(w,t,o.parent.tagname)),t.stopNodes.length&&t.stopNodes.includes(o.tagname)&&(o.child=[],null==o.attrsMap&&(o.attrsMap={}),o.val=e.substr(o.startIndex+1,w.index-o.startIndex-1)),o=o.parent;else if(n===l)if(t.cdataTagName){const e=new s(t.cdataTagName,o,w[3]);e.attrsMap=_(w[8],t),o.addChild(e),o.val=r.getValue(o.val)+t.cdataPositionChar,w[14]&&(o.val+=p(w,t))}else o.val=(o.val||"")+(w[3]||"")+p(w,t);else if(n===u){o&&w[14]&&(o.val=r.getValue(o.val)+""+p(w,t));const e=new s(t.ignoreNameSpace?w[7]:w[5],o,"");w[8]&&w[8].length>0&&(w[8]=w[8].substr(0,w[8].length-1)),e.attrsMap=_(w[8],t),o.addChild(e)}else{const e=new s(t.ignoreNameSpace?w[7]:w[5],o,p(w,t));t.stopNodes.length&&t.stopNodes.includes(e.tagname)&&(e.startIndex=w.index+w[1].length),e.attrsMap=_(w[8],t),o.addChild(e),o=e}w=g,g=m.exec(e)}return n}},function(e,t,n){"use strict";var r=n(16);e.exports=r.DEFAULT=new r({include:[n(26)],explicit:[n(199),n(200),n(201)]})},function(e,t,n){"use strict";(function(t){const r=n(212),i=n(54),s=n(28),o=n(17),a=n(18).BigNumber,u=n(29),l=n(12),c=l.MT,h=l.NUMBYTES,d=(l.SIMPLE,l.SYMS),p=new a(-1),f=p.minus(new a(Number.MAX_SAFE_INTEGER.toString(16),16)),m=Symbol("count"),w=(Symbol("pending_key"),Symbol("major type")),g=Symbol("error"),_=Symbol("not found");function b(e,t,n){const r=[];return r[m]=n,r[d.PARENT]=e,r[w]=t,r}function y(e,t){const n=new u;return n[m]=-1,n[d.PARENT]=e,n[w]=t,n}function v(e){return o.bufferToBigInt(e)}function E(e){return BigInt("-1")-o.bufferToBigInt(e)}class A extends r{constructor(e){const t=(e=e||{}).tags;delete e.tags;const n=null!=e.max_depth?e.max_depth:-1;delete e.max_depth;const r=!!o.hasBigInt&&!!e.bigint;delete e.bigint,super(e),this.running=!0,this.max_depth=n,this.tags=t,r&&(null==this.tags&&(this.tags={}),this.tags[2]=v,this.tags[3]=E)}static nullcheck(e){switch(e){case d.NULL:return null;case d.UNDEFINED:return;case _:throw new Error("Value not found");default:return e}}static decodeFirstSync(e,t){let n,r={};switch(typeof(t=t||{encoding:"hex"})){case"string":n=t;break;case"object":r=o.extend({},t),n=r.encoding,delete r.encoding}const i=new A(r),s=new u(e,null!=n?n:o.guessEncoding(e)),a=i._parse();let l=a.next();for(;!l.done;){const e=s.read(l.value);if(null==e||e.length!==l.value)throw new Error("Insufficient data");l=a.next(e)}return A.nullcheck(l.value)}static decodeAllSync(e,t){let n,r={};switch(typeof(t=t||{encoding:"hex"})){case"string":n=t;break;case"object":r=o.extend({},t),n=r.encoding,delete r.encoding}const i=new A(r),s=new u(e,null!=n?n:o.guessEncoding(e)),a=[];for(;s.length>0;){const e=i._parse();let t=e.next();for(;!t.done;){const n=s.read(t.value);if(null==n||n.length!==t.value)throw new Error("Insufficient data");t=e.next(n)}a.push(A.nullcheck(t.value))}return a}static decodeFirst(e,t,n){let r={},i=!1,s="hex";switch(typeof t){case"function":n=t,s=o.guessEncoding(e);break;case"string":s=t;break;case"object":r=o.extend({},t),s=null!=r.encoding?r.encoding:o.guessEncoding(e),delete r.encoding,i=null!=r.required&&r.required,delete r.required}const a=new A(r);let u,l=_;return a.on("data",e=>{l=A.nullcheck(e),a.close()}),"function"==typeof n?(a.once("error",e=>{const t=l;return l=g,a.close(),n(e,t)}),a.once("end",()=>{switch(l){case _:return i?n(new Error("No CBOR found")):n(null,l);case g:return;default:return n(null,l)}})):u=new Promise((e,t)=>(a.once("error",e=>(l=g,a.close(),t(e))),a.once("end",()=>{switch(l){case _:return i?t(new Error("No CBOR found")):e(l);case g:return;default:return e(l)}}))),a.end(e,s),u}static decodeAll(e,t,n){let r={},i="hex";switch(typeof t){case"function":n=t,i=o.guessEncoding(e);break;case"string":i=t;break;case"object":r=o.extend({},t),i=null!=r.encoding?r.encoding:o.guessEncoding(e),delete r.encoding}const s=new A(r);let a;const u=[];return s.on("data",e=>u.push(A.nullcheck(e))),"function"==typeof n?(s.on("error",n),s.on("end",()=>n(null,u))):a=new Promise((e,t)=>{s.on("error",t),s.on("end",()=>e(u))}),s.end(e,i),a}close(){this.running=!1,this.__fresh=!0}*_parse(){let e=null,n=0,r=null;for(;;){if(this.max_depth>=0&&n>this.max_depth)throw new Error("Maximum depth "+this.max_depth+" exceeded");const l=(yield 1)[0];if(!this.running)throw new Error("Unexpected data: 0x"+l.toString(16));const g=l>>5,_=31&l,v=null!=e?e[w]:void 0,E=null!=e?e.length:void 0;switch(_){case h.ONE:this.emit("more-bytes",g,1,v,E),r=(yield 1)[0];break;case h.TWO:case h.FOUR:case h.EIGHT:const e=1<<_-24;this.emit("more-bytes",g,e,v,E);const t=yield e;r=g===c.SIMPLE_FLOAT?t:o.parseCBORint(_,t);break;case 28:case 29:case 30:throw this.running=!1,new Error("Additional info not implemented: "+_);case h.INDEFINITE:switch(g){case c.POS_INT:case c.NEG_INT:case c.TAG:throw new Error("Invalid indefinite encoding for MT "+g)}r=-1;break;default:r=_}switch(g){case c.POS_INT:break;case c.NEG_INT:r=r===Number.MAX_SAFE_INTEGER?f:r instanceof a?p.minus(r):-1-r;break;case c.BYTE_STRING:case c.UTF8_STRING:switch(r){case 0:this.emit("start-string",g,r,v,E),r=g===c.BYTE_STRING?t.allocUnsafe(0):"";break;case-1:this.emit("start",g,d.STREAM,v,E),e=y(e,g),n++;continue;default:this.emit("start-string",g,r,v,E),r=yield r,g===c.UTF8_STRING&&(r=o.utf8(r))}break;case c.ARRAY:case c.MAP:switch(r){case 0:r=g===c.MAP?{}:[];break;case-1:this.emit("start",g,d.STREAM,v,E),e=b(e,g,-1),n++;continue;default:this.emit("start",g,r,v,E),e=b(e,g,r*(g-3)),n++;continue}break;case c.TAG:this.emit("start",g,r,v,E),e=b(e,g,1),e.push(r),n++;continue;case c.SIMPLE_FLOAT:if("number"==typeof r){if(_===h.ONE&&r<32)throw new Error("Invalid two-byte encoding of simple value "+r);const t=null!=e;r=s.decode(r,t,t&&e[m]<0)}else r=o.parseCBORfloat(r)}this.emit("value",r,v,E,_);let A=!1;for(;null!=e;){switch(!1){case r!==d.BREAK:e[m]=1;break;case!Array.isArray(e):e.push(r);break;case!(e instanceof u):const t=e[w];if(null!=t&&t!==g)throw this.running=!1,new Error("Invalid major type in indefinite encoding");e.write(r)}if(0!=--e[m]){A=!0;break}if(--n,delete e[m],this.emit("stop",e[w]),Array.isArray(e))switch(e[w]){case c.ARRAY:r=e;break;case c.MAP:let t=!0;if(e.length%2!=0)throw new Error("Invalid map length: "+e.length);for(let n=0,r=e.length;n=48&&e[s]<=57||e[s]>=65&&e[s]<=70||e[s]>=97&&e[s]<=102;)s++;if(0===s)return e;if(13!=e[s]||10!=e[s+1])return e;s+=2;var i=parseInt(r.decode(e.subarray(t,s)),16);if(0==i)break;e.set(e.subarray(s,s+i),n),s+=i,n+=i,13==e[s]&&10==e[s+1]&&(s+=2),t=s}return e.subarray(0,n)}(e))}catch(e){console.log("Chunk-Encoding Ignored: "+e)}try{if("br"===t)0===(e=i()(e)).length&&(e=r);else if("gzip"===t||"gzip"===n){const t=new s.Inflate;t.push(e,!0),t.result&&!t.err&&(e=t.result)}}catch(e){console.log("Content-Encoding Ignored: "+e)}return e}},function(e,t,n){"use strict";var r={};(0,n(9).assign)(r,n(159),n(162),n(85)),e.exports=r},function(e,t){var n={};n[t.ACCEPTED=202]="Accepted",n[t.BAD_GATEWAY=502]="Bad Gateway",n[t.BAD_REQUEST=400]="Bad Request",n[t.CONFLICT=409]="Conflict",n[t.CONTINUE=100]="Continue",n[t.CREATED=201]="Created",n[t.EXPECTATION_FAILED=417]="Expectation Failed",n[t.FAILED_DEPENDENCY=424]="Failed Dependency",n[t.FORBIDDEN=403]="Forbidden",n[t.GATEWAY_TIMEOUT=504]="Gateway Timeout",n[t.GONE=410]="Gone",n[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP Version Not Supported",n[t.IM_A_TEAPOT=418]="I'm a teapot",n[t.INSUFFICIENT_SPACE_ON_RESOURCE=419]="Insufficient Space on Resource",n[t.INSUFFICIENT_STORAGE=507]="Insufficient Storage",n[t.INTERNAL_SERVER_ERROR=500]="Server Error",n[t.LENGTH_REQUIRED=411]="Length Required",n[t.LOCKED=423]="Locked",n[t.METHOD_FAILURE=420]="Method Failure",n[t.METHOD_NOT_ALLOWED=405]="Method Not Allowed",n[t.MOVED_PERMANENTLY=301]="Moved Permanently",n[t.MOVED_TEMPORARILY=302]="Moved Temporarily",n[t.MULTI_STATUS=207]="Multi-Status",n[t.MULTIPLE_CHOICES=300]="Multiple Choices",n[t.NETWORK_AUTHENTICATION_REQUIRED=511]="Network Authentication Required",n[t.NO_CONTENT=204]="No Content",n[t.NON_AUTHORITATIVE_INFORMATION=203]="Non Authoritative Information",n[t.NOT_ACCEPTABLE=406]="Not Acceptable",n[t.NOT_FOUND=404]="Not Found",n[t.NOT_IMPLEMENTED=501]="Not Implemented",n[t.NOT_MODIFIED=304]="Not Modified",n[t.OK=200]="OK",n[t.PARTIAL_CONTENT=206]="Partial Content",n[t.PAYMENT_REQUIRED=402]="Payment Required",n[t.PERMANENT_REDIRECT=308]="Permanent Redirect",n[t.PRECONDITION_FAILED=412]="Precondition Failed",n[t.PRECONDITION_REQUIRED=428]="Precondition Required",n[t.PROCESSING=102]="Processing",n[t.PROXY_AUTHENTICATION_REQUIRED=407]="Proxy Authentication Required",n[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="Request Header Fields Too Large",n[t.REQUEST_TIMEOUT=408]="Request Timeout",n[t.REQUEST_TOO_LONG=413]="Request Entity Too Large",n[t.REQUEST_URI_TOO_LONG=414]="Request-URI Too Long",n[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="Requested Range Not Satisfiable",n[t.RESET_CONTENT=205]="Reset Content",n[t.SEE_OTHER=303]="See Other",n[t.SERVICE_UNAVAILABLE=503]="Service Unavailable",n[t.SWITCHING_PROTOCOLS=101]="Switching Protocols",n[t.TEMPORARY_REDIRECT=307]="Temporary Redirect",n[t.TOO_MANY_REQUESTS=429]="Too Many Requests",n[t.UNAUTHORIZED=401]="Unauthorized",n[t.UNPROCESSABLE_ENTITY=422]="Unprocessable Entity",n[t.UNSUPPORTED_MEDIA_TYPE=415]="Unsupported Media Type",n[t.USE_PROXY=305]="Use Proxy",t.getStatusText=function(e){if(n.hasOwnProperty(e))return n[e];throw new Error("Status code does not exist: "+e)},t.getStatusCode=function(e){for(key in n)if(n[key]===e)return parseInt(key,10);throw new Error("Reason phrase does not exist: "+e)}},function(e,t,n){"use strict";let{Json2Csv:r}=n(204),{Csv2Json:i}=n(207),s=n(53);function o(e,t,n,r){return s.convert({data:t,callback:n,options:r,converter:e})}function a(e,t,n){return new Promise((r,i)=>o(e,t,(e,t)=>e?i(e):r(t),n))}function u(e,t,n,r,i){return console.warn("WARNING: "+t+" is deprecated and will be removed soon. Please use "+n+" instead."),a(e,r,i)}e.exports={json2csv:(e,t,n)=>o(r,e,t,n),csv2json:(e,t,n)=>o(i,e,t,n),json2csvAsync:(e,t)=>a(r,e,t),csv2jsonAsync:(e,t)=>a(i,e,t),json2csvPromisified:(e,t)=>u(r,"json2csvPromisified()","json2csvAsync()",e,t),csv2jsonPromisified:(e,t)=>u(i,"csv2jsonPromisified()","csv2jsonAsync()",e,t)}},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function h(e,t,n,r){var i,s,o,a;if(l(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function d(){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 p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)s(u,this,t);else{var l=u.length,c=w(u,l);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){(t=e.exports=n(68)).Stream=t,t.Readable=t,t.Writable=n(45),t.Duplex=n(10),t.Transform=n(74),t.PassThrough=n(137)},function(e,t,n){var r=n(3),i=r.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),s(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(t,r,i){var s=n(33);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=_;var a,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:s.nextTick;_.WritableState=g;var l=Object.create(n(23));l.inherits=n(13);var c={deprecate:n(135)},h=n(70),d=n(44).Buffer,p=i.Uint8Array||function(){};var f,m=n(71);function w(){}function g(e,t){a=a||n(10),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(s.nextTick(i,r),s.nextTick(x,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),x(e,t))}(e,n,r,t,i);else{var o=E(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||v(e,n),r?u(y,e,n,o,i):y(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(e){if(a=a||n(10),!(f.call(_,this)||this instanceof a))return new _(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function b(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function y(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),x(e,t)}function v(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),s=t.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,b(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,h=n.callback;if(b(e,t,!1,t.objectMode?1:l.length,l,c,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),x(e,t)}))}function x(e,t){var n=E(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(A,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(_,h),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(e){return!!f.call(this,e)||this===_&&(e&&e._writableState instanceof g)}})):f=function(e){return e instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,a=!i.objectMode&&(r=e,d.isBuffer(r)||r instanceof p);return a&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=w),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),s.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),s.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,x(e,t),n&&(t.finished?s.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(14),n(72).setImmediate,n(6))},function(e,t,n){"use strict";const r=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];t.REPLACEMENT_CHARACTER="�",t.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},t.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},t.isSurrogate=function(e){return e>=55296&&e<=57343},t.isSurrogatePair=function(e){return e>=56320&&e<=57343},t.getSurrogatePairCodePoint=function(e,t){return 1024*(e-55296)+9216+t},t.isControlCodePoint=function(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159},t.isUndefinedCodePoint=function(e){return e>=64976&&e<=65007||r.indexOf(e)>-1}},function(e,t,n){"use strict";class r{constructor(e){const t={},n=this._getOverriddenMethods(this,t);for(const r of Object.keys(n))"function"==typeof n[r]&&(t[r]=e[r],e[r]=n[r])}_getOverriddenMethods(){throw new Error("Not implemented")}}r.install=function(e,t,n){e.__mixins||(e.__mixins=[]);for(let n=0;n=0?t:void 0),remainingKeyPath:e.slice(t+1)}}e.exports={evaluatePath:function e(t,n){if(!t)return null;let{indexOfDot:i,currentKey:s,remainingKeyPath:o}=r(n);if(i>=0&&!t[n])return Array.isArray(t[s])?t[s].map(t=>e(t,o)):e(t[s],o);if(Array.isArray(t))return t.map(t=>e(t,n));return t[n]},setPath:function e(t,n,i){if(!t)throw new Error("No document was provided.");let{indexOfDot:s,currentKey:o,remainingKeyPath:a}=r(n);if(s>=0){if(!t[o]&&Array.isArray(t))return t.forEach(t=>e(t,n,i));t[o]||(t[o]={}),e(t[o],a,i)}else{if(Array.isArray(t))return t.forEach(t=>e(t,a,i));t[n]=i}return t}}},function(e){e.exports=JSON.parse('{"errors":{"callbackRequired":"A callback is required!","optionsRequired":"Options were not passed and are required.","json2csv":{"cannotCallOn":"Cannot call json2csv on ","dataCheckFailure":"Data provided was not an array of documents.","notSameSchema":"Not all documents have the same schema."},"csv2json":{"cannotCallOn":"Cannot call csv2json on ","dataCheckFailure":"CSV is not a string."}},"defaultOptions":{"delimiter":{"field":",","wrap":"\\"","eol":"\\n"},"excelBOM":false,"prependHeader":true,"trimHeaderFields":false,"trimFieldValues":false,"sortHeader":false,"parseCsvNumbers":false,"keys":null,"checkSchemaDifferences":false,"expandArrayObjects":false,"unwindArrays":false,"useLocaleFormat":false},"values":{"excelBOM":"\ufeff"}}')},function(e,t,n){"use strict";let r=n(51),i=n(52);const s=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;function o(e){return JSON.parse(JSON.stringify(e))}function a(e){return c(e)||l(e)||""===e}function u(e){return"object"==typeof e}function l(e){return null===e}function c(e){return void 0===e}function h(e,t){return e.filter(e=>!t.includes(e))}e.exports={isStringRepresentation:function(e,t){const n=e[0],r=e.length-1,i=e[r];return n===t.delimiter.wrap&&i===t.delimiter.wrap},isDateRepresentation:function(e){return s.test(e)},computeSchemaDifferences:function(e,t){return h(e,t).concat(h(t,e))},deepCopy:o,convert:function(e){let{options:t,callback:n}=function(e,t){if(u(e)&&(n=e,"function"!=typeof n))return{options:e,callback:t};var n;return{options:t,callback:e}}(e.callback,e.options);r=t,(r={...i.defaultOptions,...r||{}}).delimiter={...i.defaultOptions.delimiter,...r.delimiter},t=r;var r;let s=new e.converter(t);(function(e){if(!e.callback)throw new Error(i.errors.callbackRequired);if(!e.data)return e.callback(new Error(e.errorMessages.cannotCallOn+e.data+".")),!1;if(!e.dataCheckFn(e.data))return e.callback(new Error(e.errorMessages.dataCheckFailure)),!1;return!0})({data:e.data,callback:n,errorMessages:s.validationMessages,dataCheckFn:s.validationFn})&&s.convert(e.data,n)},isEmptyField:a,removeEmptyFields:function(e){return e.filter(e=>!a(e))},getNCharacters:function(e,t,n){return e.substring(t,t+n)},unwind:function(e,t){const n=[];return e.forEach(e=>{!function(e,t,n){const i=r.evaluatePath(t,n);let s=o(t);Array.isArray(i)?i.forEach(i=>{s=o(t),e.push(r.setPath(s,n,i))}):e.push(s)}(n,e,t)}),n},isInvalid:function(e){return e===1/0||e===-1/0},isString:function(e){return"string"==typeof e},isNull:l,isError:function(e){return"[object Error]"===Object.prototype.toString.call(e)},isDate:function(e){return e instanceof Date},isUndefined:c,isObject:u,unique:function(e){return[...new Set(e)]},flatten:function(e){return[].concat(...e)}}},function(e,t,n){"use strict";const r=n(18).BigNumber,i=n(17),s=n(55),o=new r(-1),a=new r(10),u=new r(2);class l{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){let t=null!=e?e[this.tag]:void 0;if("function"!=typeof t&&(t=l["_tag_"+this.tag],"function"!=typeof t))return this;try{return t.call(l,this.value)}catch(e){return this.err=e,this}}static _tag_0(e){return new Date(e)}static _tag_1(e){return new Date(1e3*e)}static _tag_2(e){return i.bufferToBignumber(e)}static _tag_3(e){return o.minus(i.bufferToBignumber(e))}static _tag_4(e){return a.pow(e[0]).times(e[1])}static _tag_5(e){return u.pow(e[0]).times(e[1])}static _tag_32(e){return s.parse(e)}static _tag_35(e){return new RegExp(e)}}e.exports=l},function(e,t,n){"use strict";var r=n(213),i=n(215);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof s?e.format():s.prototype.format.call(e)},t.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(l),h=["%","/","?",";","#"].concat(c),d=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=n(216);function b(e,t,n){if(e&&i.isObject(e)&&e instanceof s)return e;var r=new s;return r.parse(e,t,n),r}s.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var s=e.indexOf("?"),a=-1!==s&&s127?N+="x":N+=I[F];if(!N.match(p)){var L=R.slice(0,C),B=R.slice(C+1),U=I.match(f);U&&(L.push(U[1]),B.unshift(U[2])),B.length&&(b="/"+B.join(".")+b),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=r.toASCII(this.hostname));var M=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+M,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[E])for(C=0,O=c.length;C0)&&n.host.split("@"))&&(n.auth=D.shift(),n.host=n.hostname=D.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!A.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var T=A.slice(-1)[0],S=(n.host||e.host||A.length>1)&&("."===T||".."===T)||""===T,C=0,k=A.length;k>=0;k--)"."===(T=A[k])?A.splice(k,1):".."===T?(A.splice(k,1),C++):C&&(A.splice(k,1),C--);if(!v&&!E)for(;C--;C)A.unshift("..");!v||""===A[0]||A[0]&&"/"===A[0].charAt(0)||A.unshift(""),S&&"/"!==A.join("/").substr(-1)&&A.push("");var D,R=""===A[0]||A[0]&&"/"===A[0].charAt(0);x&&(n.hostname=n.host=R?"":A.length?A.shift():"",(D=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=D.shift(),n.host=n.hostname=D.shift()));return(v=v||n.host&&A.length)&&!R&&A.unshift(""),A.length?n.pathname=A.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},s.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},,function(e,t,n){"use strict";const{Transform:r}=n(4),i=n(34),s=n(144),o=n(47),a=n(76),u=n(146),l=n(147),c={sourceCodeLocationInfo:!1};const h={[i.START_TAG_TOKEN]:{eventName:"startTag",reshapeToken:e=>({tagName:e.tagName,attrs:e.attrs,selfClosing:e.selfClosing,sourceCodeLocation:e.location})},[i.END_TAG_TOKEN]:{eventName:"endTag",reshapeToken:e=>({tagName:e.tagName,sourceCodeLocation:e.location})},[i.COMMENT_TOKEN]:{eventName:"comment",reshapeToken:e=>({text:e.data,sourceCodeLocation:e.location})},[i.DOCTYPE_TOKEN]:{eventName:"doctype",reshapeToken:e=>({name:e.name,publicId:e.publicId,systemId:e.systemId,sourceCodeLocation:e.location})},[i.CHARACTER_TOKEN]:{eventName:"text",reshapeToken:e=>({text:e.chars,sourceCodeLocation:e.location})}};e.exports=class extends r{constructor(e){super({encoding:"utf8",decodeStrings:!1}),this.options=a(c,e),this.tokenizer=new i(e),this.locInfoMixin=null,this.options.sourceCodeLocationInfo&&(this.locInfoMixin=o.install(this.tokenizer,s)),this.parserFeedbackSimulator=new l(this.tokenizer),this.pendingText=null,this.lastChunkWritten=!1,this.stopped=!1,this.pipe(new u)}_transform(e,t,n){if("string"!=typeof e)throw new TypeError("Parser can work only with string streams.");n(null,this._transformChunk(e))}_final(e){this.lastChunkWritten=!0,e(null,this._transformChunk(""))}stop(){this.stopped=!0}_transformChunk(e){return this.stopped||(this.tokenizer.write(e,this.lastChunkWritten),this._runParsingLoop()),e}_runParsingLoop(){let e=null;do{if(e=this.parserFeedbackSimulator.getNextToken(),e.type===i.HIBERNATION_TOKEN)break;if(e.type===i.CHARACTER_TOKEN||e.type===i.WHITESPACE_CHARACTER_TOKEN||e.type===i.NULL_CHARACTER_TOKEN){if(null===this.pendingText)e.type=i.CHARACTER_TOKEN,this.pendingText=e;else if(this.pendingText.chars+=e.chars,this.options.sourceCodeLocationInfo){const{endLine:t,endCol:n,endOffset:r}=e.location;Object.assign(this.pendingText.location,{endLine:t,endCol:n,endOffset:r})}}else this._emitPendingText(),this._handleToken(e)}while(!this.stopped&&e.type!==i.EOF_TOKEN)}_handleToken(e){if(e.type===i.EOF_TOKEN)return!0;const{eventName:t,reshapeToken:n}=h[e.type];return 0!==this.listenerCount(t)&&(this._emitToken(t,n(e)),!0)}_emitToken(e,t){this.emit(e,t)}_emitPendingText(){null!==this.pendingText&&(this._handleToken(this.pendingText),this.pendingText=null)}}},function(e,t,n){"use strict";n.r(t),n.d(t,"CollectionLoader",(function(){return ye})),n.d(t,"WorkerLoader",(function(){return ve}));const r=(e,t)=>t.some(t=>e instanceof t);let i,s;const o=new WeakMap,a=new WeakMap,u=new WeakMap,l=new WeakMap,c=new WeakMap;let h={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return a.get(e);if("objectStoreNames"===t)return e.objectStoreNames||u.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return m(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function d(e){h=e(h)}function p(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(w(this),t),m(o.get(this))}:function(...t){return m(e.apply(w(this),t))}:function(t,...n){const r=e.call(w(this),t,...n);return u.set(r,t.sort?t.sort():[t]),m(r)}}function f(e){return"function"==typeof e?p(e):(e instanceof IDBTransaction&&function(e){if(a.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});a.set(e,t)}(e),r(e,i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,h):e)}function m(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(m(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&o.set(t,e)}).catch(()=>{}),c.set(t,e),t}(e);if(l.has(e))return l.get(e);const t=f(e);return t!==e&&(l.set(e,t),c.set(t,e)),t}const w=e=>c.get(e);function g(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=m(o);return r&&o.addEventListener("upgradeneeded",e=>{r(m(o.result),e.oldVersion,e.newVersion,m(o.transaction))}),n&&o.addEventListener("blocked",()=>n()),s&&o.addEventListener("close",()=>s()),i&&a.then(e=>e.addEventListener("versionchange",i)).catch(()=>{}),a}function _(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),m(n).then(()=>{})}const b=["get","getKey","getAll","getAllKeys","count"],y=["put","add","delete","clear"],v=new Map;function E(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(v.get(t))return v.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=y.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!b.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,i?"readwrite":"readonly");let o=s.store;r&&(o=o.index(t.shift()));const a=o[n](...t);return i&&await s.done,a};return v.set(t,s),s}d(e=>({...e,get:(t,n,r)=>E(t,n)||e.get(t,n,r),has:(t,n)=>!!E(t,n)||e.has(t,n)}));const A=["continue","continuePrimaryKey","advance"],x={},T=new WeakMap,S=new WeakMap,C={get(e,t){if(!A.includes(t))return e[t];let n=x[t];return n||(n=x[t]=function(...e){T.set(this,S.get(this)[t](...e))}),n}};async function*k(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const n=new Proxy(t,C);for(S.set(n,t),c.set(n,w(t));t;)yield n,t=await(T.get(n)||t.continue()),T.delete(n)}function D(e,t){return t===Symbol.asyncIterator&&r(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&r(e,[IDBIndex,IDBObjectStore])}d(e=>({...e,get:(t,n,r)=>D(t,n)?k:e.get(t,n,r),has:(t,n)=>D(t,n)||e.has(t,n)}));var R=n(0),O=n(121),I=n.n(O);const N=[{match:/[?&](_|cb|_ga|\w*cache\w*)=[\d.-]+(?=$|&)/i,replace:""},{match:/([?&])utm_[^=]+=[^&]+(?=&|$)/g,replace:""},{match:/[?&](callback=jsonp)[^&]+(?=&|$)/i,replace:""},{match:/[?&]((?:\w+)=jquery)[\d]+_[\d]+/i,replace:""},{match:/\/\/.*(?:gcs-vimeo|vod|vod-progressive)\.akamaized\.net.*(\/[\d]+)\/[\d]+(.mp4)/,replace:"//video.vimeo.net$1$2",split:".net",last:!0},{match:/\/\/.*(player.vimeo.com\/video\/[\d]+)\?.*/i,replace:"$1"},{match:/www.\washingtonpost\.com\/wp-apps\/imrs.php/,args:[["src"]]},{match:/(\.(?:php|js|webm|mp4|gif|jpg|png|css|json|m3u8))\?.*/i,replace:"$1"},{match:/(\/\/.*www\.youtube\.com\/embed\/[^?]+)[?].*/i,replace:"$1"},{match:/(www\.)?youtube(-nocookie)?\.com\/get_video_info/i,args:[["video_id","html5"]]},{match:/\/\/.*(googlevideo.com\/videoplayback)/i,replace:"server.$1",args:[["id","itag"],["id"]]},{match:/facebook\.com\/ajax\/pagelet\/generic.php\/photoviewerinitpagelet/i,args:[[{arg:"data",keys:["query_type","fbid","v","cursor","data"]}]]},{match:/facebook\.com\/api\/graphql/i,args:[["variables","doc_id"]],fuzzyArgs:!0},{match:/facebook\.com\/api\/graphqlbatch/i,args:[["batch_name","queries"],["batch_name"]]},{match:/facebook\.com\/ajax\/navigation/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/route-definition/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/bulk-route-definitions/i,args:[["route_urls[0]","__user"],["route_urls[0]"]]},{match:/facebook\.com\/ajax\/relay-ef/i,args:[["queries[0]","__user"],["queries[0]"]]},{match:/facebook\.com\/videos\/vodcomments/i,args:[["eft_id"]]},{match:/facebook\.com\/ajax\.*/i,replaceQuery:/([?&][^_]\w+=[^&]+)/g},{match:/plus\.googleapis\.com\/u\/\/0\/_\/widget\/render\/comments/i,args:[["href","stream_id","substream_id"]]},{match:/(static.wixstatic.com\/.*\.[\w]+)\/v1\/fill\/w_.*/,replace:"$1"}];function F(e,t,n){if(!(n&&n.rule&&n.rule.replace&&n.rule.split))return function(e,t,n){try{e=new URL(e)}catch(e){return 0}const r=n&&n.args&&!n.fuzzyArgs?new Set(n.args[0]):null;let i=0,s=null;const o=new URLSearchParams(e.search);for(const e of t){if(204===e.mime)continue;let t="string"==typeof e?e:e.url;try{t=new URL(t)}catch(e){continue}const n=new URLSearchParams(t.search);let a=P(o,n,r);a+=P(n,o,r),a/=2,a>i&&(i=a,s=e)}return{score:i,result:s}}(e,t,n&&n.rule);const r=n.fuzzyUrl.endsWith("?")?n.fuzzyUrl.slice(0,-1):n.fuzzyUrl,i=n.rule.match,s=n.rule.replace;for(const e of t){if(r===("string"==typeof e?e:e.url).replace(i,s))return{score:1,result:e}}return{score:0,result:null}}function P(e,t,n){let r=1,i=1;for(const[s,o]of e){const e=t.get(s);if(n&&n.has(s)&&e!==o)return-1;let a;a="_"===s[0]?1:10;const u=Number(o),l=Number(e);if(i+=a,e===o)r+=a*o.length;else if(null===e)r-=1;else if(isNaN(u)||isNaN(l)){r+=a*(Math.min(e.length,o.length)-I()(e,o))}else r+=10-Math.log(Math.abs(u-l)+1)}return r/i}const L=new class{constructor(e){this.rules=e||N}*fuzzyUrls(e,t=!1){const n=e;function r(e,r){if(!t)return e;const i=r.split||"?",s=n.indexOf(i);return[e,{prefix:s>0?n.slice(0,s+i.length):n,rule:r,fuzzyUrl:e}]}-1===e.indexOf("?")&&(e+="?");for(const t of this.rules){if(e.match(t.match))if(void 0===t.args&&void 0!==t.replace){const n=e.replace(t.match,t.replace);if(n!=e&&(yield r(n,t),e=n),t.last)break}else{if(void 0!==t.args){void 0!==t.replace&&(e=e.replace(t.match,t.replace));for(let n of t.args){const i=this.getQueryUrl(e,n);e!=i&&(yield r(i,t))}break}if(t.replaceQuery){const n=e.match(t.replaceQuery),i=this.getQueryUrl(e,n?n.join(""):"");i!=e&&(yield r(i,t));break}}}}getQueryUrl(e,t){try{e=new URL(e)}catch(e){return null}if("string"==typeof t)return e.search=t,e.toString();const n=new URLSearchParams(e.search),r=new URLSearchParams;for(const e of t)if("string"==typeof e){const t=n.get(e);t&&r.set(e,t)}else"object"==typeof e&&this.setQueryJsonArg(n,r,e);return e.search="?"+r.toString(),e.toString()}setQueryJsonArg(e,t,n){let r;try{r=e.get(n.arg),r=JSON.parse(r)}catch(e){return void console.log("JSON parse error: "+r)}let i={};for(const e of n.keys){const t=r[e];null!=t&&(i[e]=t)}t.set(n.arg,JSON.stringify(i))}};var B=n(40),U=n(5);class M{constructor(e,t={}){this.name=e,this.db=null;const{minDedupSize:n}=t;this.minDedupSize=Number.isInteger(n)?n:1024,this.version=1,this.useRefCounts=!0,this.allowRepeats=!0,this.repeatTracker=this.allowRepeats?new W:null,this.fuzzyPrefixSearch=!0,this.initing=this.init()}async init(){this.db=await g(this.name,this.version,{upgrade:(e,t,n,r)=>this._initDB(e,t,n,r),blocking:e=>{e&&null!==e.newVersion||this.close()}})}_initDB(e,t,n,r){if(!t){const t=e.createObjectStore("pages",{keyPath:"id"});t.createIndex("url","url"),t.createIndex("ts","ts");e.createObjectStore("pageLists",{keyPath:"id",autoIncrement:!0});e.createObjectStore("curatedPages",{keyPath:"id",autoIncrement:!0}).createIndex("listPages",["list","pos"]);const n=e.createObjectStore("resources",{keyPath:["url","ts"]});n.createIndex("pageId","pageId"),n.createIndex("mimeStatusUrl",["mime","status","url"]);e.createObjectStore("payload",{keyPath:"digest",unique:!0}),e.createObjectStore("digestRef",{keyPath:"digest",unique:!0})}}async clearAll(){const e=["pages","resources","payload","digestRef"];for(const t of e)await this.db.clear(t)}close(){this.db&&(this.db.close(),this.db=null)}async delete(){this.close(),await _(this.name,{blocked(e){console.log("Unable to delete: "+e)}})}async addPage(e,t){const n=e.url,r=e.title||e.url,i=e.id||this.newPageId();let s=e.ts;s||!e.date&&!e.datetime||(s=new Date(e.date||e.datetime).getTime());const o={...e,url:n,ts:s,title:r,id:i};return t?(t.store.put(o),o.id):await this.db.put("pages",o)}async addPages(e){const t=this.db.transaction("pages","readwrite");for(const t of e)this.addPage(t);try{await t.done}catch(e){console.warn("addPages tx",e.toString())}}async addCPageList(e){const t={};return t.title=e.title,t.desc=e.desc,t.slug=e.slug,await this.db.put("pageLists",t)}async addCuratedPageLists(e,t="pages",n="public"){for(const r of e){if(n&&!r[n])continue;const e=await this.addCPageList(r),i=this.db.transaction("curatedPages","readwrite");let s=0;const o=r[t]||[];for(const t of o){const n={};n.pos=s++,n.list=e;const r=typeof t.page;n.page="string"===r?t.page:"object"===r?t.page.id:t.page_id||t.pageId,n.desc=t.desc,i.store.put(n)}try{await i.done}catch(e){console.warn("addCuratedPageLists tx",e.toString())}}}async getAllCuratedByList(){const e=await this.db.getAll("pageLists"),t=this.db.transaction("curatedPages","readonly");for await(const n of t.store.index("listPages").iterate()){const t=e[n.value.list-1];t&&(t.show=!0,t.pages||(t.pages=[]),t.pages.push(n.value))}return e}newPageId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async getAllPages(){return await this.db.getAll("pages")}async getPages(e){const t=[];e.sort();for await(const n of this.matchAny("pages",null,e))t.push(n);return t}async dedupResource(e,t,n){const r=n.objectStore("digestRef"),i=!!e&&await r.get(e);let s=!0;if(i)++i.count,r.put(i),s=!1;else try{n.objectStore("payload").add({digest:e,payload:t});const i=1,s=t.length;r.put({digest:e,count:i,size:s})}catch(e){console.log(e)}return s}async addResources(e){const t=[],n=[];let r=this.db.transaction(["digestRef","payload"],"readwrite");for(const i of e)"warc/revisit"===i.mime?t.push(i):n.push(i),this.useRefCounts&&i.digest&&i.payload&&(await this.dedupResource(i.digest,i.payload,r),delete i.payload);try{await r.done}catch(e){console.log("Payload Bulk Add Failed: "+e)}const i=this.db.transaction("resources","readwrite");for(const e of t)i.store.put(e);for(const e of n)i.store.put(e),this._addUrlFuzzy(e,i);await i.done}async _addUrlFuzzy(e,t){if(e.status>=200&&e.status<300&&204!=e.status)for await(const n of L.fuzzyUrls(e.url)){if(n===e.url)continue;const r={url:n,ts:e.ts,origURL:e.url,origTS:e.ts,pageId:e.pageId,digest:e.digest};t.store.put(r)}}async addResource(e){let t=!1;if(e.payload&&e.payload.length>this.minDedupSize){e.digest||(e.digest=await Object(R.d)(e.payload,"sha-256"));const n=this.db.transaction(["digestRef","payload"],"readwrite");t=await this.dedupResource(e.digest,e.payload,n);try{await n.done}catch(e){console.log("Payload Add Failed: "+e)}delete e.payload}if("warc/revisit"===e.mime){try{await this.db.add("resources",e)}catch(t){console.log("Skip Duplicate revisit for: "+e.url)}return t}const n=this.db.transaction("resources","readwrite");n.store.put(e),this._addUrlFuzzy(e,n);try{await n.done}catch(t){console.log("Fuzzy Add Error for "+e.url),console.log(t)}return t}async getResource(e,t,n){const r=Object(R.m)(e.timestamp).getTime();let i=e.url,s=null;const o={skip:this.repeatTracker?this.repeatTracker.getSkipCount(n,i,e.request.method):0};if(i.startsWith("//")){let t=!1;s=await this.lookupUrl("https:"+i,r,o),s||(s=await this.lookupUrl("http:"+i,r,o),(s||e.request.referrer.indexOf("/http://",2)>0)&&(t=!0)),i=(t?"http:":"https:")+i}else s=await this.lookupUrl(i,r,o);let a;if(!s)for await(const[e,t]of L.fuzzyUrls(i,!0)){if(s=await this.lookupUrl(e),s)break;a||(a=t)}if(!s&&a&&this.fuzzyPrefixSearch&&(s=await this.lookupQueryPrefix(i,a)),s&&s.origURL){const e=await this.lookupUrl(s.origURL,s.origTS||s.ts);e&&(i=e.url,s=e)}if(!s)return null;const u=s.status,l=s.statusText||Object(B.getStatusText)(u);let c=null;if(!Object(R.i)()&&(c=await this.loadPayload(s),!c))return null;const h=Object(R.j)(s.respHeaders),d=new Date(s.ts),p=s.extraOpts||null;return new U.a({url:i,payload:c,status:u,statusText:l,headers:h,date:d,extraOpts:p})}async loadPayload(e){if(e.digest&&!e.payload){const t=await this.db.get("payload",e.digest);if(!t)return null;const{payload:n}=t;return n}return e.payload}async lookupUrl(e,t,n={}){const r=this.db.transaction("resources","readonly");if(t){const n=await r.store.get([e,t]);if(n)return n}let i=null,s=n.skip||0;for await(const n of r.store.iterate(this.getLookupRange(e))){if(i&&n.value.ts>t){if(0==s){return n.value.ts-tt?++a:i?(yield o.value,o=await o.continue()):o=await o.continue(n[a])}}async resourcesByUrlAndMime(e,t,n=1e3,r=!0,i="",s=""){const o=t?null:n,a=await this.db.getAll("resources",this.getLookupRange(e,r?"prefix":"exact",i,s),o);t=t.split(",");const u=[];for(const e of a)for(const r of t)if(!r||e.mime&&e.mime.startsWith(r)){if(u.push(this.resJson(e)),u.length===n)return u;break}return u}async resourcesByMime(e,t=100,n="",r="",i=0){const s=[];(e=e.split(",")).sort();let o=[];n&&o.push([n,i,r]);for(const t of e)(!n||!t||t>n)&&o.push([t,0,""]);for await(const e of this.matchAny("resources","mimeStatusUrl",o,0))if(s.push(this.resJson(e)),s.length===t)break;return s}async deletePage(e){const t=this.db.transaction("pages","readwrite"),n=await t.store.get(e);await t.store.delete(e);const r=await this.deletePageResources(e);return{pageSize:n&&n.size||0,dedupSize:r}}async deletePageResources(e){const t={},n=this.db.transaction("resources","readwrite");let r=await n.store.index("pageId").openCursor(e),i=0;for(;r;){const e=r.value.digest;e?t[e]=(t[e]||0)+1:r.value.payload&&(i+=r.value.payload.length),n.store.delete(r.primaryKey),r=await r.continue()}await n.done;const s=this.db.transaction(["payload","digestRef"],"readwrite"),o=s.objectStore("digestRef");for(const e of Object.keys(t)){const n=await o.get(e);n&&(n.count-=t[e]),n&&n.count>=1?o.put(n):(i+=n?n.size:0,o.delete(e),s.objectStore("payload").delete(e))}return await s.done,i}getLookupRange(e,t,n,r){let i,s,o;switch(t){case"prefix":s=e.slice(0,-1)+String.fromCharCode(e.charCodeAt(e.length-1)+1),i=[e],s=[s];break;case"host":const t=new URL(e).origin;i=[t+"/"],s=[t+"0"];break;case"exact":default:i=[e],s=[e+"!"]}return n?(i=[n,r||""],o=!0):o=!1,IDBKeyRange.bound(i,s,o,!0)}}class W{constructor(){this.repeats={}}getSkipCount(e,t,n){if("POST"!==n)return 0;e.replacesClientId&&delete this.repeats[e.replacesClientId];const r=e.resultingClientId||e.clientId;return r?(void 0===this.repeats[r]&&(this.repeats[r]={}),void 0===this.repeats[r][t]?this.repeats[r][t]=0:this.repeats[r][t]++,this.repeats[r][t]):0}}var j=n(1),z=n(57),H=n.n(z),G=n(4),q=n(38);const V=["script","style","header","footer","banner-div","noscript"];var X=n(20);class K extends X.a{constructor(e,t=null,n=null){super(),this.reader=e,this.abort=t,this.loadId=n,this.anyPages=!1,this.detectPages=!1,this._lastRecord=null,this.metadata={},this.pageMap={},this.pages=[],this.lists=[]}parseWarcInfo(e){if(!e.payload)return;const t=new TextDecoder("utf-8").decode(e.payload);for(const e of t.split("\n"))if(e.startsWith("json-metadata:"))try{const t=JSON.parse(e.slice("json-metadata:".length));if("collection"===t.type&&(this.metadata.desc=t.desc,this.metadata.title=t.title),t.pages&&t.pages.length){this.pages=this.pages.concat(t.pages);for(const e of t.pages)e.ts=Object(R.m)(e.timestamp).getTime(),this.pageMap[e.ts+"/"+e.url]={page:e};this.anyPages=!0}t.lists&&t.lists.length&&(this.lists=this.lists.concat(t.lists))}catch(e){console.log("Page Add Error",e.toString())}}index(e){if("warcinfo"!==e.warcType){if(this._lastRecord)return this._lastRecord.warcTargetURI!=e.warcTargetURI?(this.indexReqResponse(this._lastRecord,null),void(this._lastRecord=e)):void("request"===e.warcType&&"response"===this._lastRecord.warcType?(this.indexReqResponse(this._lastRecord,e),this._lastRecord=null):"response"===e.warcType&&"request"===this._lastRecord.warcType?(this.indexReqResponse(e,this._lastRecord),this._lastRecord=null):(this.indexReqResponse(this._lastRecord,null),this._lastRecord=e));this._lastRecord=e}else this.parseWarcInfo(e)}indexDone(){this._lastRecord&&(this.indexReqResponse(this._lastRecord),this._lastRecord=null)}shouldIndexMetadataRecord(e){const t=e.warcTargetURI;return!(!t||!t.startsWith("metadata://"))}parseRevisitRecord(e){const t=e.warcTargetURI.split("#")[0],n=(e.warcDate,new Date(e.warcDate).getTime()),r=e.warcRefersToTargetURI,i=new Date(e.warcRefersToDate).getTime();return r===t&&i===n?null:{url:t,ts:n,origURL:r,origTS:i,digest:e.warcPayloadDigest,pageId:null}}indexReqResponse(e,t){const n=this.parseRecords(e,t);n&&this.addResource(n)}parseRecords(e,t){switch(e.warcType){case"revisit":return this.parseRevisitRecord(e);case"resource":t=null;break;case"response":break;case"metadata":if(!this.shouldIndexMetadataRecord(e))return null;break;default:return null}const n=e.warcTargetURI.split("#")[0],r=e.warcDate;let i,s=200,o="OK",a=0,u="";if(e.httpHeaders){if(s=Number(e.httpHeaders.statusCode)||200,t&&"OPTIONS"===t.httpHeaders.method)return null;if(o=e.httpHeaders.statusText,i=Object(R.j)(e.httpHeaders.headers),u=(i.get("content-type")||"").split(";")[0],a=parseInt(i.get("content-length")||0),206===s){const e=i.get("content-range"),t=`bytes 0-${a-1}/${a}`;if(e&&e!==t)return null}if(s>300&&s<400){const e=i.get("location");if(e&&new URL(e,n).href===n)return null}}else i=new Headers,i.set("content-type",e.warcContentType),i.set("content-length",e.warcContentLength),u=e.warcContentType,a=e.warcContentLength;let l=null;if(t&&t.httpHeaders.headers)try{const e=new Headers(t.httpHeaders.headers).get("cookie");e&&i.set("x-wabac-preset-cookie",e),l=t.httpHeaders.headers.get("Referer")}catch(e){console.warn(e)}if(void 0===this.detectPages&&(this.detectPages=!this.anyPages),this.detectPages&&function(e,t,n){if(200!=t)return!1;if(!e.startsWith("http:")&&!e.startsWith("https:")&&!e.startsWith("blob:"))return!1;if(e.endsWith("/robots.txt"))return!1;const r=e.split("?",2);if(2===r.length&&r[1].length>r[0].length)return!1;if(r[0].substring(r[0].lastIndexOf("/")+1).startsWith("."))return!1;if(n&&"text/html"!==n)return!1;return!0}(n,s,u)){const e=n;this.addPage({url:n,date:r,title:e})}const c=new Date(r).getTime(),h=Object.fromEntries(i.entries()),d=e.warcPayloadDigest,p=e.payload,f={url:n,ts:c,status:s,mime:u,respHeaders:h,digest:d,payload:p,reader:p?null:e.reader,referrer:l};this.pageMap[c+"/"+n]&&p&&u.startsWith("text/")&&(this.pageMap[c+"/"+n].textPromise=async function(e,t,n,r){const i=new H.a,s=[];let o=null;i.on("text",(e,t)=>{if(o)return;const n=e.text.trim();n&&s.push(n)}),i.on("startTag",e=>{!e.selfClosing&&V.includes(e.tagName)&&(o=e.tagName)}),i.on("endTag",e=>{e.tagName===o&&(o=null)});const a=new G.PassThrough({encoding:"utf8"});(n||r)&&(t=await Object(q.a)(t,n,r)),a.push(t),a.push(null),a.pipe(i);const u=new Promise(e=>{i.on("end",()=>{e(s.join(" "))})});return await u}(0,p,i.get("content-encoding"),i.get("transfer-encoding")));const m=e.warcHeader("WARC-JSON-Metadata");if(m)try{f.extraOpts=JSON.parse(m)}catch(e){}const w=e.warcHeader("WARC-Page-ID");return w&&(f.pageId=w),f}filterRecord(e){return null}async load(e,t,n){this.db=e;const r=new j.d(this.reader);let i=0,s=0;try{for await(const e of r){if(!e.warcType){console.log("skip empty record");continue}if(self.interruptLoads&&this.loadId&&self.interruptLoads[this.loadId])throw t(Math.round(r.offset/n*95),"Loading Canceled",r.offset,n),self.interruptLoads[this.loadId](),this.abort&&this.abort.abort(),new R.b;s=(new Date).getTime(),s-i>500&&(t(Math.round(r.offset/n*95),null,r.offset,n),i=s);const o=this.filterRecord(e);if("done"===o){this.abort&&this.abort.abort();break}if("skip"!==o){"skipContent"===o?await e.skipFully():await e.readFully(),this.index(e,r);try{await Promise.all(this.promises)}catch(e){console.warn(e.toString())}this.promises=[]}}}catch(e){if(e instanceof R.b)throw e;t(Math.round(r.offset/n*95),`Sorry there was an error downloading. Please try again (${e})`,r.offset,n),console.warn(e)}return this.indexDone(),t(95),await this.finishIndexing(),t(100),this.metadata}async _finishLoad(){if(this.pages.length){for(const{page:e,textPromise:t}of Object.values(this.pageMap))if(t)try{e.text=await t}catch(e){console.warn("Error adding text: "+e.toString())}this.promises.push(this.db.addPages(this.pages))}this.lists.length&&this.promises.push(this.db.addCuratedPageLists(this.lists,"bookmarks","public"))}}class Y extends K{constructor(e){super(e),this.detectPages=!1}addPage(){}async load(){const e=await new j.d(this.reader).parse();if(!e)return null;const t=this.parseRecords(e,null);return t&&"revisit"!==e.warcType||await e.readFully(),t}}class J extends K{filterRecord(e){if("warcinfo"!=e.warcType)return"done"}}const Z="https://helper-proxy.webrecorder.workers.dev";function Q(e,t,n,r,i){if(e.startsWith("blob:"))return new te(e,i,n);if(e.startsWith("http:")||e.startsWith("https:")||e.startsWith("file:"))return new $(e,t,n);if(e.startsWith("googledrive:"))return new ee(e,t,n,r);throw new Error("Invalid URL: "+e)}class ${constructor(e,t,n=null,r=!1){this.url=e,this.headers=t||{},this.length=n,this.canLoadOnDemand=r,this.isValid=!1}async doInitialFetch(e){const t=new Headers(this.headers);t.set("Range","bytes=0-"),this.isValid=!1;let n=null,r=null;if(e)try{r=await fetch(this.url,{headers:t,method:"HEAD"}),200!==r.status&&206!=r.status||(this.canLoadOnDemand=206===r.status||"bytes"===r.headers.get("Accept-Ranges"),this.isValid=!0)}catch(e){}if(!this.isValid){n=new AbortController;const e=n.signal;r=await fetch(this.url,{headers:t,signal:e}),this.canLoadOnDemand=206===r.status||"bytes"===r.headers.get("Accept-Ranges"),this.isValid=206===r.status||200===r.status}if(null===this.length&&(this.length=Number(r.headers.get("Content-Length")),!this.length&&206===r.status)){let e=r.headers.get("Content-Range");e&&(e=e.split("/"),2===e.length&&(this.length=e[1]))}if(null===this.length)try{const e=await fetch(`${Z}/c/${this.url}`),t=await e.json();t.size&&(this.length=t.size)}catch(e){console.log("Error fetching from helper: "+e.toString())}return this.length=Number(this.length||0),{response:r,abort:n}}async getLength(){if(null===this.length){const{response:e,abort:t}=await this.doInitialFetch(!0);t&&t.abort()}return this.length}async getRange(e,t,n=!1,r=null){const i=new Headers(this.headers);i.set("Range",`bytes=${e}-${e+t-1}`);const s={signal:r,headers:i};let o=null;try{o=await fetch(this.url,s)}catch(e){throw console.log(e),new RangeError(this.url)}if(206!=o.status)throw 401===o.status||403===o.status?new R.a(this.url,o.status):new RangeError(this.url,o.status);return n?o.body:new Uint8Array(await o.arrayBuffer())}}class ee{constructor(e,t,n,r){this.fileId=e.slice("googledrive://".length),this.apiUrl=`https://www.googleapis.com/drive/v3/files/${this.fileId}?alt=media`,this.canLoadOnDemand=!0,this.headers=t,r&&r.publicUrl?this.publicUrl=r.publicUrl:this.publicUrl=null,this.length=n,this.isValid=!1}async getLength(){return this.length}async doInitialFetch(e){let t=null,n=null;if(this.publicUrl){t=new $(this.publicUrl,null,this.length);try{n=await t.doInitialFetch(e)}catch(e){}if(!t.isValid&&(n&&n.abort&&n.abort.abort(),await this.refreshPublicUrl())){t=new $(this.publicUrl,null,this.length);try{n=await t.doInitialFetch(e)}catch(e){}!t.isValid&&n&&n.abort&&n.abort.abort()}}return t&&t.isValid||(this.publicUrl=null,t=new $(this.apiUrl,this.headers,this.length),n=await t.doInitialFetch(e)),this.isValid=t.isValid,this.length||(this.length=t.length),n}async getRange(e,t,n=!1,r){let i=null;if(this.publicUrl){i=new $(this.publicUrl,null,this.length);try{return await i.getRange(e,t,n,r)}catch(s){if(await this.refreshPublicUrl()){i=new $(this.publicUrl,null,this.length);try{return await i.getRange(e,t,n,r)}catch(e){}}}this.publicUrl=null}return i=new $(this.apiUrl,this.headers,this.length),await i.getRange(e,t,n,r)}async refreshPublicUrl(){try{const e=await fetch(`${Z}/g/${this.fileId}`),t=await e.json();if(t.url)return this.publicUrl=t.url,!0}catch(e){}return!1}}class te{constructor(e,t=null,n=null){this.url=e,this.blob=t,this.size=this.blob?this.blob.size:n,this.canLoadOnDemand=!1}get length(){return this.size}get isValid(){return!!this.blob}async doInitialFetch(e){if(!this.blob){const e=await fetch(this.url);this.blob=await e.blob()}let t=null;return e||(t=this.blob.stream?this.blob.stream():await this.getReadableStream(this.blob)),{response:new Response(t),stream:t}}async getLength(){if(!this.blob&&!this.blob.size){let e=await fetch(this.url);this.blob=await e.blob(),this.size=this.blob.size}return this.size}async getRange(e,t,n=!1,r){if(!this.blob){const r=new Headers;r.set("Range",`bytes=${e}-${e+t-1}`);const i=await fetch(this.url,{headers:r});if(i.headers.get("content-range"))return n?i.body:new Uint8Array(await i.arrayBuffer());this.blob=await i.blob()}const i=this.blob.slice(e,e+t,"application/octet-stream");if(n)return i.stream?i.stream():await this.getReadableStream(i);try{const e=i.arrayBuffer?await i.arrayBuffer():await this.getArrayBuffer(i);return new Uint8Array(e)}catch(e){return console.log("error reading blob",e),null}}getArrayBuffer(e){return new Promise(t=>{let n=new FileReader;n.onloadend=()=>{t(n.result)},n.readAsArrayBuffer(e)})}async getReadableStream(e){const t=await this.getArrayBuffer(e);return new ReadableStream({start(e){e.enqueue(new Uint8Array(t)),e.close()}})}}class ne extends M{constructor(e,t=!1){super(e),this.noCache=t,this.useRefCounts=!1}async loadRecordFromSource(e){const t=await this.loadSource(e.source),n=new Y(t);return await n.load()}async loadPayload(e,t=0){let n=await super.loadPayload(e);if(n&&e.respHeaders&&"warc/revisit"!==e.mime)return n;const r=await this.loadRecordFromSource(e);if(!r)return console.log("No WARC Record Loaded for: "+e.url),null;if(r.url!==e.url)return console.log(`Wrong url: expected ${e.url}, got ${r.url}`),null;if(r.ts!==e.ts){if(1e3*Math.floor(r.ts/1e3)!==e.ts)return console.log(`Wrong timestamp: expected ${e.ts}, got ${r.ts}`),null}if(r.digest!==e.digest&&console.log(`Wrong digest: expected ${e.digest}, got ${r.digest}`),r.origURL){const i=await this.lookupUrl(r.origURL,r.origTS,{noRevisits:!0});return i&&(n||(t<2?n=await this.loadPayload(i,t+1):console.warn("Avoiding revisit lookup loop for: "+JSON.stringify(r)),n))?(e.respHeaders=i.respHeaders,e.mime=i.mime,i.extraOpts&&(e.extraOpts=i.extraOpts),this.noCache||(delete e.payload,await this.db.put("resources",e)),n):null}const i=r.digest;if(!this.noCache&&r.reader&&i&&(r.reader=new se(this,r.reader,i,e.url)),n=r.payload,!n&&!r.reader)return null;try{n&&!this.noCache&&await this.commitPayload(n,i)}catch(t){console.warn("Payload Update Error: "+e.url),console.warn(t)}if(!(e.respHeaders&&e.digest||(e.respHeaders=r.respHeaders,e.digest=i,r.extraOpts&&(e.extraOpts=r.extraOpts),this.noCache)))try{await this.db.put("resources",e)}catch(t){console.warn("Resource Update Error: "+e.url),console.warn(t)}return n||r.reader}async commitPayload(e,t){if(!e||0===e.length)return;const n=this.db.transaction(["payload","digestRef"],"readwrite");try{if(n.objectStore("payload").put({payload:e,digest:t}),this.useRefCounts){const r=await n.objectStore("digestRef").get(t);r&&(r.size=e.length,n.objectStore("digestRef").put(r))}await n.done}catch(e){console.warn("Payload Commit Error: "+e)}}}class re extends ne{constructor(e,t,n=!1){super(e,n),this.loader=t}updateHeaders(e){this.loader.headers=e}async loadSource(e){const{start:t,length:n}=e;return await this.loader.getRange(t,n,!0)}}class ie extends ne{constructor(e,t,n,r=!1){super(e,r),this.remoteUrlPrefix=t,this.headers=n}updateHeaders(e){this.headers=e}async loadSource(e){const{start:t,length:n}=e,r=new Headers(this.headers),i=Q(new URL(e.path,this.remoteUrlPrefix).href,r);return await i.getRange(t,n,!0)}}class se extends j.b{constructor(e,t,n,r=""){super(),this.db=e,this.reader=t,this.digest=n,this.url=r,this.chunks=[],this.size=0,this.fullbuff=null,this.commit=!0,this.alreadyRead=!1}setLimitSkip(e=-1,t=0){(-1!=e||t>0)&&(this.commit=!1),this.reader.setLimitSkip(e,t)}async*[Symbol.asyncIterator](){if(!this.alreadyRead){for await(const e of this.reader)this.chunks.push(e),this.size+=e.byteLength,yield e;this.fullbuff=j.b.concatChunks(this.chunks,this.size),0!==this.reader.limit?console.warn(`Expected payload not consumed, ${this.reader.limit} bytes left`):this.commit&&await this.db.commitPayload(this.fullbuff,this.digest),this.chunks=[],this.alreadyRead=!0}}async readFully(){for await(const e of this);return this.fullbuff}}class oe extends K{constructor(e,t,n){super(e,t,n),this.cdxindexer=null}filterRecord(e){switch(e.warcType){case"warcinfo":case"revisit":return null;case"request":return"skipContent";case"metadata":return this.shouldIndexMetadataRecord(e)?null:"skipContent"}const t=e.warcTargetURI,n=new Date(e.warcDate).getTime();if(this.pageMap[n+"/"+t])return e._isPage=!0,null}index(e,t){if(e._isPage)return super.index(e,t);if("warcinfo"===e.warcType)return void this.parseWarcInfo(e);this.cdxindexer||(this.cdxindexer=new j.c({},null));const n=this.cdxindexer.indexRecord(e,t,"");n&&this.addCdx(n)}addCdx(e){const{url:t,mime:n}=e,r=Number(e.status)||200,i=Object(R.m)(e.timestamp).getTime(),s={path:e.filename,start:Number(e.offset),length:Number(e.length)};let{digest:o}=e;o&&-1===o.indexOf(":")&&(o="sha1:"+o);const a={url:t,ts:i,status:r,digest:o,mime:n,loaded:!1,source:s};this.batch.length>=3e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=3e3} records`)),this.batch.push(a)}}class ae extends oe{async load(e){this.db=e;let t=this.reader;t.iterLines||(t=new j.a(this.reader));for await(const e of t.iterLines()){let t,n,r,i=e.trimEnd();if(!i.startsWith("{")){const e=i.indexOf(" {");if(e<0)continue;[n,r]=i.split(" ",2),i=i.slice(e)}try{t=JSON.parse(i)}catch(e){console.log("JSON Parser error on: "+i);continue}t.timestamp=r,t.url||(t.url=n),this.addCdx(t)}this.indexDone(),await this.finishIndexing()}}const ue=/(?:([\d]+)[^\/]*\/)?(http.*)/;class le{constructor(e){this.sourceUrl=e.sourceUrl,this.type=e.extraConfig&&e.extraConfig.sourceType||"kiwix",this.notFoundPageUrl=e.extraConfig&&e.extraConfig.notFoundPageUrl}async getAllPages(){return[]}async getResource(e,t,n){const{url:r,headers:i}=de(e,t);let s=i;if("kiwix"===this.type){const t=await this.resolveHeaders(r);if(!t){if(this.notFoundPageUrl&&"navigate"===e.request.mode){const e=await fetch(this.notFoundPageUrl);if(200===e.status){const t={"Content-Type":"text/html"},n=await e.text();return new Response(n.replace("$URL",r),{status:404,headers:t})}}return null}let{headers:n,encodedUrl:i,date:o,status:a,statusText:u,hasPayload:l}=t;if(s.has("Range")){const e=s.get("Range");s={Range:e}}let c=null,h=null;l&&(h=await fetch(this.sourceUrl+"A/"+i,{headers:s}),h.body&&(c=new j.a(h.body.getReader(),!1))),c||(c=new Uint8Array([])),o||(o=new Date),n||(n=new Headers),206===h.status&&(a=206,u="Partial Content",n.set("Content-Length",h.headers.get("Content-Length")),n.set("Content-Range",h.headers.get("Content-Range")),n.set("Accept-Ranges","bytes"));const d=!1,p=!1;return new U.a({payload:c,status:a,statusText:u,headers:n,url:r,date:o,noRW:p,isLive:d})}}async resolveHeaders(e){const t=e.slice(e.indexOf("//")+2);let n=encodeURI(t);n=encodeURIComponent(t);let r=await fetch(this.sourceUrl+"H/"+n);if(200!==r.status)return null;let i=null,s=null,o=null,a=null,u=!1;try{const t=await j.d.parse(r.body);if("revisit"===t.warcType){const n=t.warcHeaders.headers.get("WARC-Refers-To-Target-URI");if(n&&n!==e)return await this.resolveHeaders(n)}s=new Date(t.warcDate),t.httpHeaders?(i=t.httpHeaders.headers,o=Number(t.httpHeaders.statusCode),a=t.httpHeaders.statusText,u="0"!==t.httpHeaders.headers.get("Content-Length")):"resource"===t.warcType&&(i=new Headers,i.set("Content-Type",t.warcContentType),i.set("Content-Length",t.warcContentLength),o=200,a="OK",u=t.warcContentLength>0),o||(o=200)}catch(t){console.warn(t),console.warn("Ignoring headers, error parsing headers response for: "+e)}return{encodedUrl:n,headers:i,date:s,status:o,statusText:a,hasPayload:u}}}class ce{constructor(e){this.replayPrefix=e.replayPrefix,this.idMod=void 0!==e.idMod?e.idMod:"id_",this.redirMod=void 0!==e.redirMod?e.redirMod:"mp_",this.redirectMode=this.idMod===this.redirMod?"follow":"manual"}async getAllPages(){return[]}getUrl(e,t){let n=this.replayPrefix;return(t||e.timestamp)&&(n+=e.timestamp+t+"/"),n+e.url}async getResource(e,t,n){let r=await fetch(this.getUrl(e,this.idMod),{credentials:"same-origin",redirect:this.redirectMode,mode:"cors"});if(r.status>=400&&!r.headers.get("memento-datetime"))return null;const i=await this.getRedirect(e,r,t);let s=null,o=!1;i?(r=Response.redirect(i.path,307),o=!0,s=i.timestamp):s=e.timestamp;const a=e.url,u=s?Object(R.m)(s):new Date;return U.a.fromResponse({url:a,response:r,date:u,noRW:o})}async getRedirect(e,t,n){if("opaqueredirect"===t.type)t=await fetch(this.getUrl(e,this.redirMod),{credentials:"same-origin",redirect:"follow",mode:"cors"});else if(!t.redirected)return null;const r=t.url.indexOf(this.replayPrefix)+this.replayPrefix.length,i=t.url.slice(r),s=i.match(ue);return s?{timestamp:s[1],path:n+s[1]+"mp_/"+s[2]}:{path:n+i}}}class he{constructor(e,t=!1,n=!0){this.prefix=e||"",this.proxyPathOnly=t,this.isLive=n}async getAllPages(){return[]}async getResource(e,t,n){const{headers:r,credentials:i,url:s}=de(e,t);let o;if(this.proxyPathOnly){const e=new URL(s);o=this.prefix+e.pathname+e.search}else o=this.prefix+s;const a=await fetch(o,{method:e.request.method,body:e.request.body,headers:r,credentials:i,mode:"cors",redirect:"follow"});return U.a.fromResponse({url:s,response:a,date:new Date,noRW:!1,isLive:this.isLive})}}function de(e,t,n=!0){let r,i,s;if(n){r=new Headers(e.request.headers),i=e.request.referrer;const n=i.indexOf("/http",t.length-1);n>0&&(i=i.slice(n+1),r.set("X-Proxy-Referer",i)),s=e.request.credentials}else r=new Headers,s="omit";let o=e.url;if(o.startsWith("//"))try{o=new URL(i).protocol+o}catch(e){o="https:"+o}return{referrer:i,headers:r,credentials:s,url:o}}var pe=n(32),fe=n.n(pe),me=n(41);class we extends re{constructor(e,t,n=null,r=!1,i){super(e,t,r),this.zipreader=new ge(t),this.externalSources=[],this.fuzzyUrlRules=[],this.useSurt=!0,this.fullConfig=i,this.textIndex=i&&i.metadata&&i.metadata.textIndex,t.canLoadOnDemand=!0,n&&this.initConfig(n)}_initDB(e,t,n,r){if(super._initDB(e,t,n,r),!t){e.createObjectStore("ziplines",{keyPath:"prefix"}),e.createObjectStore("zipEntries",{keyPath:"filename"})}}async init(){await super.init(),await this.loadZipEntries()}async close(){super.close(),caches.delete("cache:"+this.name.slice("db:".length))}async clearZipData(){const e=["zipEntries","ziplines"];for(const t of e)await this.db.clear(t)}async clearAll(){await super.clearAll(),await this.clearZipData()}updateHeaders(e){this.zipreader.loader.headers=e}async loadZipEntries(){const e=await this.db.getAll("zipEntries");if(!e.length)return;const t={};for(const n of e)t[n.filename]=n;this.zipreader.entries=t}async saveZipEntries(e){const t=this.db.transaction("zipEntries","readwrite");t.store.clear();for(const n of Object.values(e))t.store.put(n);await t.done,this.db.clear("ziplines")}async loadZiplinesIndex(e,t,n){let r=0,i=0,s=0,o=[],a="";for await(const u of e.iterLines()){if(r+=u.length,r===u.length&&u.startsWith("!meta")){const e=u.indexOf(" {");if(e<0){console.warn("Invalid Meta Line: "+u);continue}const t=JSON.parse(u.slice(e));t.filename&&(a=t.filename),"cdxj-gzip-1.0"!==t.format&&console.log(`Unknown CDXJ format "${t.format}", archive may not parse correctly`);continue}let e;if(u.indexOf("\t")>0){let[t,n,r,i]=u.split("\t");r=Number(r),i=Number(i),e={prefix:t,filename:n,offset:r,length:i,loaded:!1},this.useSurt=!0}else{const t=u.indexOf(" {");if(t<0){console.log("Invalid Index Line: "+u);continue}const n=u.slice(0,t);let{offset:r,length:i,filename:s}=JSON.parse(u.slice(t));s=s||a,e={prefix:n,filename:s,offset:r,length:i,loaded:!1}}s=(new Date).getTime(),s-i>500&&(t(Math.round(r/n*100),null,r,n),i=s),o.push(e)}const u=this.db.transaction("ziplines","readwrite");for(const e of o)u.store.put(e);try{await u.done}catch(e){console.log("Error loading ziplines index: ",e)}}async load(e,t,n){if(e!==this)return void console.error("wrong db");const r=await e.zipreader.load(!0);await e.saveZipEntries(r);const i=[];let s;r["webarchive.yaml"]&&(s=await this.loadMetadata(r,await e.zipreader.loadFile("webarchive.yaml")));for(const n of Object.keys(r))if(n.endsWith(".cdx")||n.endsWith(".cdxj")){console.log("Loading CDX "+n);const t=await e.zipreader.loadFile(n);i.push(new ae(t).load(e))}else if(n.endsWith(".idx")){if(this.loader.canLoadOnDemand){console.log("Loading IDX "+n);const r=e.zipreader.getCompressedSize(n);i.push(e.loadZiplinesIndex(await e.zipreader.loadFile(n),t,r))}}else if(n.endsWith(".warc.gz")||n.endsWith(".warc"))if(!s&&this.loader.canLoadOnDemand){const r=new AbortController,i=await e.zipreader.loadFile(n,{signal:r.signal,unzip:!0}),o=new J(i,r),a=e.zipreader.getCompressedSize(n);s=await o.load(e,t,a)}else if(!this.loader.canLoadOnDemand){const r=await e.zipreader.loadFile(n,{unzip:!0}),i=new K(r);i.detectPages=!1;const o=e.zipreader.getCompressedSize(n);s=await i.load(e,t,o)}return await Promise.all(i),s||{}}async loadPagesCSV(e){const t=(new TextDecoder).decode(await e.readFully()),n=await Object(me.csv2jsonAsync)(t);n&&n.length&&await this.addPages(n)}initConfig(e){if(void 0!==e.decodeResponses&&(this.fullConfig.decode=e.decodeResponses),void 0!==e.useSurt&&(this.useSurt=e.useSurt),e.es)for(const[t,n]of e.es){const e=new he(n,!0,!1);this.externalSources.push({prefix:t,external:e})}if(e.fuzzy)for(const[t,n]of e.fuzzy){const e=new RegExp(t);this.fuzzyUrlRules.push({match:e,replace:n})}e.textIndex&&(this.textIndex=e.textIndex)}async getTextIndex(){const e={"Content-Type":"application/ndjson"};if(!this.textIndex)return new Response("",{headers:e});const t=this.zipreader.getCompressedSize(this.textIndex);t>0&&(e["Content-Length"]=""+t);const n=await this.zipreader.loadFile(this.textIndex,{unzip:!0});return new Response(n.getReadableStream(),{headers:e})}async loadMetadata(e,t){const n=(new TextDecoder).decode(await t.readFully()),r=fe.a.safeLoad(n);void 0!==r.config&&this.initConfig(r.config);const i={desc:r.desc,title:r.title};r.textIndex&&(i.textIndex=r.textIndex);const s=r.pages||[];s&&s.length?await this.addPages(s):e["pages.csv"]&&await this.loadPagesCSV(await this.zipreader.loadFile("pages.csv"));const o=r.pageLists||[];return o&&o.length&&await this.addCuratedPageLists(o,"pages","show"),i}async loadRecordFromSource(e){let t,n=0,r=-1;const i=e.source;if("string"==typeof i)t=i;else{if("object"!=typeof i)return null;n=i.start,r=i.length,t=i.path}let s=null;const o=await this.zipreader.loadFileCheckDirs(t,n,r);return s=new Y(o),await s.load()}getSurt(e){try{e=e.replace(/www\d*\./,"");const t=new URL(e);let n=t.hostname.split(".").reverse().join(",");return t.port&&(n+=":"+t.port),n+=")",n+=t.pathname,t.search&&(t.searchParams.sort(),n+=t.search),n.toLowerCase()}catch(t){return e}}async loadFromZiplines(e,t){t&&Object(R.f)(new Date(t).toISOString());let n,r;const i=this.useSurt?this.getSurt(e):e;n=i+" 9",r=i;const s=this.db.transaction("ziplines","readonly"),o=[],a=IDBKeyRange.upperBound(n,!1);for await(const e of s.store.iterate(a,"prev"))if(o.unshift(e.value),!e.value.prefix.split(" ")[0].startsWith(r))break;await s.done;const u=[];for(const e of o){if(e.loaded)continue;const t="indexes/"+e.filename,n={offset:e.offset,length:e.length,unzip:!0},r=await this.zipreader.loadFile(t,n);u.push(new ae(r).load(this)),e.loaded=!0,await this.db.put("ziplines",e)}return await Promise.all(u),u.length>0}async getResource(e,t,n){if(this.externalSources.length)for(const{prefix:r,external:i}of this.externalSources)if(e.url.startsWith(r))try{return await i.getResource(e,t,n)}catch(e){console.warn("Upstream Error",e)}let r=await super.getResource(e,t,n);if(r)return r;if(this.fuzzyUrlRules.length)for(const{match:i,replace:s}of this.fuzzyUrlRules){const o=e.url.replace(i,s);if(o&&o!==e.url&&(e.url=o,r=await super.getResource(e,t,n),r))return r}return null}async lookupUrl(e,t,n={}){try{let r=await super.lookupUrl(e,t,n);return!r||n.noRevisits&&"warc/revisit"===r.mime?(await this.loadFromZiplines(e,t)&&(r=await super.lookupUrl(e,t,n)),r):r}catch(e){return console.warn(e),null}}async resourcesByUrlAndMime(e,...t){let n=await super.resourcesByUrlAndMime(e,...t);return n.length>0||await this.loadFromZiplines(e,"")&&(n=await super.resourcesByUrlAndMime(e,...t)),n}}class ge{constructor(e,t=null){this.loader=e,this.entries=t}async load(e=!1){if(!this.entries||e){const e=await this.loader.getLength(),t=Math.min(65558,e),n=e-t,r=await this.loader.getRange(n,t);this.entries=this._loadEntries(r,n)}return this.entries}_loadEntries(e,t){const n=e.byteLength,r=new DataView(e.buffer),i=new TextDecoder("utf8"),s=new TextDecoder("ascii"),o={};let a=0,u=0,l=n;for(let t=n-22,i=Math.max(0,t-65535);t>=i;--t)if(80===e[t]&&75===e[t+1]&&5===e[t+2]&&6===e[t+3]){l=t,u=r.getUint32(t+16,!0),a=r.getUint16(t+8,!0);break}if(4294967295===u||65535===a){if(117853008!==r.getUint32(l-20,!0))return void console.warn("invalid zip64 EOCD locator");const e=this.getUint64(r,l-12,!0)-t;if(101075792!==r.getUint32(e,!0))return void console.warn("invalid zip64 EOCD record");a=this.getUint64(r,e+32,!0),u=this.getUint64(r,e+48,!0)}if(t&&(u-=t),u>=n||u<=0)for(u=-1,a=65535;++u=0&&u=8&&(a=this.getUint64(r,e,!0),e+=8,i-=8),4294967295===n&&i>=8&&(n=this.getUint64(r,e,!0),e+=8,i-=8),4294967295===p&&i>=8&&(p=this.getUint64(r,e,!0),e+=8,i-=8)),e+=i}}f.endsWith("/")||(o[f]={filename:f,deflate:d,uncompressedSize:a,compressedSize:n,localEntryOffset:p}),u+=46+l+c+h}return o}async loadFileCheckDirs(e,t,n){if(null===this.entries&&await this.load(),this.entries["archive/"+e])e="archive/"+e;else if(this.entries["warcs/"+e])e="warcs/"+e;else for(const t of Object.keys(this.entries))if(t.endsWith("/"+e)){e=t;break}return await this.loadFile(e,{offset:t,length:n,unzip:!0})}getCompressedSize(e){if(null===this.entries)return-1;const t=this.entries[e];return t?t.compressedSize:-1}async loadFile(e,{offset:t=0,length:n=-1,signal:r=null,unzip:i=!1}={}){null===this.entries&&await this.load();const s=this.entries[e];if(!s)return null;if(void 0===s.offset){const e=await this.loader.getRange(s.localEntryOffset,30),t=new DataView(e.buffer),n=t.getUint16(26,!0),r=t.getUint16(28,!0);s.offset=30+n+r+s.localEntryOffset}n=n<0?s.compressedSize:Math.min(n,s.compressedSize-t),t+=s.offset;const o=await this.loader.getRange(t,n,!0,r);return i?s.deflate?new j.a(new j.a(o.getReader(),"deflate")):new j.a(o.getReader()):new j.a(o.getReader(),s.deflate?"deflate":null)}getUint64(e,t,n){const r=e.getUint32(t,n),i=e.getUint32(t+4,n),s=n?r+2**32*i:2**32*r+i;return Number.isSafeInteger(s)||console.warn(s,"exceeds MAX_SAFE_INTEGER. Precision may be lost"),s}}class _e extends X.a{constructor(e){super(),this.har=e,this.pageRefs={}}async load(e){return this.db=e,"string"==typeof this.har&&(this.har=JSON.parse(this.har)),this.parseEntries(this.har),this.parsePages(this.har),await this.finishIndexing(),{}}parsePages(e){for(const t of e.log.pages){if(!t.pageTimings||!t.pageTimings.onLoad)continue;let e;e=t.title&&(t.title.startsWith("http:")||t.title.startsWith("https:"))?t.title:this.pageRefs[t.id];const n=t.title||e,r=t.startedDateTime;this.addPage({url:e,date:r,title:n})}}parseEntries(e){for(const t of e.log.entries){if(!t.response.content||!t.response.content.text){console.log("Skipping: "+t.request.url);continue}let e=null;try{e=Uint8Array.from(atob(t.response.content.text),e=>e.charCodeAt(0))}catch(n){e=t.response.content.text}console.log("Added: "+t.request.url);const n=new Date(t.startedDateTime).getTime(),r={};for(const{name:e,value:n}of t.response.headers)r[e]=n;this.addResource({url:t.request.url,ts:n,status:t.response.status,respHeaders:r,payload:e}),t.pageref&&!this.pageRefs[t.pageref]&&(this.pageRefs[t.pageref]=t.request.url)}}}var be=n(122);self.interruptLoads={};class ye{constructor(){this.colldb=null,this.root=null,this._init_db=this._initDB()}async _initDB(){this.colldb=await g("collDB",1,{upgrade:(e,t,n,r)=>{e.createObjectStore("colls",{keyPath:"name"})}})}async loadAll(e){if(await this._init_db,e)for(const t of e.split(",")){const e=t.split(":");if(2===e.length){const t={dbname:e[1],sourceName:e[1],decode:!1},n={name:e[0],type:"archive",config:t};console.log("Adding Coll: "+JSON.stringify(n)),await this.colldb.put("colls",n)}}try{const e=(await this.listAll()).map(e=>this._initColl(e));await Promise.all(e)}catch(e){console.warn(e.toString())}return!0}async listAll(){return await this._init_db,await this.colldb.getAll("colls")}async loadColl(e){await this._init_db;const t=await this.colldb.get("colls",e);return t?await this._initColl(t):null}async deleteColl(e){await this._init_db;const t=await this.colldb.get("colls",e);if(!t)return!1;t.config.dbname&&await _(t.config.dbname,{blocked(e){console.log(`Unable to delete ${t.config.dbname}: ${e}`)}}),await this.colldb.delete("colls",e)}async updateAuth(e,t){await this._init_db;const n=await this.colldb.get("colls",e);return!!n&&(n.config.headers=t,await this.colldb.put("colls",n),!0)}async updateSize(e,t,n){await this._init_db;const r=await this.colldb.get("colls",e);if(!r)return!1;r.config.loadSize=(r.config.loadSize||0)+t,r.config.dedupSize=(r.config.dedupSize||0)+n,await this.colldb.put("colls",r)}async _initColl(e){let t=null,n=null;switch(e.type){case"archive":t=new M(e.config.dbname);break;case"remotesource":n=Q(e.config.loadUrl,e.config.headers,e.config.size,e.config.extra),t=new re(e.config.dbname,n,e.config.noCache);break;case"remoteprefix":t=new ie(e.config.dbname,e.config.remotePrefix,e.config.headers,e.config.noCache);break;case"remotezip":n=Q(e.config.loadUrl||e.config.sourceUrl,e.config.headers,e.config.extra),t=new we(e.config.dbname,n,e.config.extraConfig,e.config.noCache,e.config);break;case"remoteproxy":t=new ce(e.config);break;case"remotewarcproxy":t=new le(e.config);break;case"live":t=new he(e.config.prefix,e.config.proxyPathOnly,e.config.isLive)}if(!t)return console.log("no store found: "+e.type),null;t.initing&&await t.initing;const r=e.name,i=e.config;return e.config.root&&(this.root=r),this._createCollection({name:r,store:t,config:i})}_createCollection(e){return e}}class ve extends ye{constructor(e){super(),this.registerListener(e)}async hasCollection(e){return await this._init_db,null!=await this.colldb.getKey("colls",e)}registerListener(e){e.addEventListener("message",e=>this._handleMessage(e))}async _handleMessage(e){await this._init_db;const t=e.source||self;switch(e.data.msg_type){case"addColl":{const n=e.data.name,r=(e,r,i,s)=>{t.postMessage({msg_type:"collProgress",name:n,percent:e,error:r,currentSize:i,totalSize:s})};let i;try{if(await this.hasCollection(n)?e.data.skipExisting?i=!0:(await this.deleteCollection(n),i=await this.addCollection(e.data,r)):i=await this.addCollection(e.data,r),!i)return}catch(e){return console.warn(e),void r(0,"An unexpected error occured: "+e.toString())}t.postMessage({msg_type:"collAdded",name:n});break}case"cancelLoad":{const t=e.data.name,n=new Promise(e=>self.interruptLoads[t]=e);await n,await this.deleteCollection(t),delete self.interruptLoads[t];break}case"removeColl":{const n=e.data.name;await this.hasCollection(n)&&(await this.deleteCollection(n),this.doListAll(t));break}case"listAll":this.doListAll(t)}}async doListAll(e){const t=[],n=await this.listAll();for(const e of n)t.push({name:e.name,prefix:e.name,pageList:[],sourceName:e.config.sourceName});e.postMessage({msg_type:"listAll",colls:t})}async addCollection(e,t){const n=e.name;let r=null,i={root:e.root||!1},s=null;const o=e.file;if(!o||!o.sourceUrl)return t(0,"Invalid Load Request"),!1;if(o.sourceUrl.startsWith("proxy:"))i.sourceUrl=o.sourceUrl.slice("proxy:".length),i.extraConfig=e.extraConfig,i.topTemplateUrl=e.topTemplateUrl,r="remotewarcproxy";else{let a=null;r="archive",i.dbname="db:"+n;let u=o.loadUrl||o.sourceUrl;u.match(/[\w]+:\/\//)||(u=new URL(u,self.location.href).href),i.decode=!0,i.onDemand=!1,i.loadUrl=u,i.sourceUrl=o.sourceUrl,i.sourceName=o.name||o.sourceUrl;try{i.sourceName.match(/https?:\/\//)&&(i.sourceName=new URL(i.sourceName).pathname)}catch(e){}i.sourceName=i.sourceName.slice(i.sourceName.lastIndexOf("/")+1),i.headers=o.headers,i.size="number"==typeof o.size?o.size:null,i.extra=o.extra,i.extraConfig=e.extraConfig,i.noCache=u.startsWith("file:")||o.noCache;const l=Q(u,o.headers,o.size,i.extra,o.blob);let c=!1;(i.sourceName.endsWith(".wacz")||i.sourceName.endsWith(".zip"))&&(s=new we(i.dbname,l,i.extraConfig,i.noCache,i),r="remotezip",a=s,c=!0);let{abort:h,response:d,stream:p}=await l.doInitialFetch(c);if(p=p||d.body,!l.isValid){const e=l.length<=1e3?await d.text():"";return t(0,`Sorry, this URL could not be loaded.\nMake sure this is a valid URL and you have access to this file.\nStatus: ${d.status} ${d.statusText}\nError Details:\n${e}`),h&&h.abort(),!1}if(!l.length)return t(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."),h&&h.abort(),!1;const f=l.length;if(i.sourceName.endsWith(".warc")||i.sourceName.endsWith(".warc.gz")?f<25e6||!l.canLoadOnDemand?a=new K(p,h,n):(a=new oe(p,h,n),r="remotesource",s=new re(i.dbname,l,i.noCache)):i.sourceName.endsWith(".cdxj")||i.sourceName.endsWith(".cdx")?(i.remotePrefix=e.remotePrefix||u.slice(0,u.lastIndexOf("/")+1),a=new ae(p,h,n),r="remoteprefix",s=new ie(i.dbname,i.remotePrefix,i.headers,i.noCache)):i.sourceName.endsWith(".wbn")?(a=new be.a(await d.arrayBuffer()),i.decode=!1):i.sourceName.endsWith(".har")&&(a=new _e(await d.json()),i.decode=!1),!a)return t(0,`The ${i.sourceName} is not a known archive format that could be loaded.`),h&&h.abort(),!1;s||(s=new M(i.dbname)),await s.initing,i.onDemand=l.canLoadOnDemand;try{i.metadata=await a.load(s,t,f)}catch(e){return e instanceof R.b||t(0,"Unexpected Loading Error: "+e.toString()),!1}i.metadata.size||(i.metadata.size=f)}i.ctime=(new Date).getTime();const a={name:n,type:r,config:i};return await this.colldb.add("colls",a),!0}async deleteCollection(e){const t="db:"+e;try{await _(t,{blocked(e){console.log("Unable to delete: "+e)}})}catch(e){return console.warn(e),!1}return await this.colldb.delete("colls",e),!0}}},,,,,function(e,t,n){"use strict";const r=n(176),i=n(35),s=n(35),o=n(7).buildOptions,a=n(178);t.parse=function(e,t,n){if(n){!0===n&&(n={});const t=a.validate(e,n);if(!0!==t)throw Error(t.err.msg)}return t=o(t,s.defaultOptions,s.props),r.convertToJson(i.getTraversalObj(e,t),t)},t.convertTonimn=n(179).convert2nimn,t.getTraversalObj=i.getTraversalObj,t.convertToJson=r.convertToJson,t.convertToJsonString=n(180).convertToJsonString,t.validate=a.validate,t.j2xParser=n(181),t.parseToNimn=function(e,n,r){return t.convertTonimn(t.getTraversalObj(e,r),n,r)}},,,,,function(e,t,n){"use strict";(function(t,r){var i=n(33);e.exports=b;var s,o=n(69);b.ReadableState=_;n(42).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=n(70),l=n(44).Buffer,c=t.Uint8Array||function(){};var h=Object.create(n(23));h.inherits=n(13);var d=n(131),p=void 0;p=d&&d.debuglog?d.debuglog("stream"):function(){};var f,m=n(132),w=n(71);h.inherits(b,u);var g=["error","close","destroy","pause","resume"];function _(e,t){e=e||{};var r=t instanceof(s=s||n(10));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(f||(f=n(73).StringDecoder),this.decoder=new f(e.encoding),this.encoding=e.encoding)}function b(e){if(s=s||n(10),!(this instanceof b))return new b(e);this._readableState=new _(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function y(e,t,n,r,i){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,A(e)}(e,o)):(i||(s=function(e,t){var n;r=t,l.isBuffer(r)||r instanceof c||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):v(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?v(e,o,t,!1):T(e,o)):v(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(x,e):x(e))}function x(e){p("emit readable"),e.emit("readable"),D(e)}function T(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(S,e,t))}function S(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;es.length?s.length:e;if(o===s.length?i+=s:i+=s.slice(0,e),0===(e-=o)){o===s.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var s=r.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function O(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(I,t,e))}function I(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function N(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):A(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,t);var u=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?c:b;function l(t,r){p("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),e.removeListener("close",g),e.removeListener("finish",_),e.removeListener("drain",h),e.removeListener("error",w),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",b),n.removeListener("data",m),d=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function c(){p("onend"),e.end()}s.endEmitted?i.nextTick(u):n.once("end",u),e.on("unpipe",l);var h=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,D(e))}}(n);e.on("drain",h);var d=!1;var f=!1;function m(t){p("ondata"),f=!1,!1!==e.write(t)||f||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==N(s.pipes,e))&&!d&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,f=!0),n.pause())}function w(t){p("onerror",t),b(),e.removeListener("error",w),0===a(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",_),b()}function _(){p("onfinish"),e.removeListener("close",g),b()}function b(){p("unpipe"),n.unpipe(e)}return n.on("data",m),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",w),e.once("close",g),e.once("finish",_),e.emit("pipe",n),s.flowing||(p("pipe resume"),n.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(134),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(6))},function(e,t,n){"use strict";var r=n(136).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=h,t=3;break;default:return this.write=d,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=o;var r=n(10),i=Object.create(n(23));function s(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length(Object.keys(t).forEach(n=>{e[n]=t[n]}),e),Object.create(null))}},function(e,t,n){var r=n(78).BrotliInput,i=n(78).BrotliOutput,s=n(152),o=n(79),a=n(80).HuffmanCode,u=n(80).BrotliBuildHuffmanTable,l=n(156),c=n(157),h=n(158),d=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),p=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),f=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),m=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function w(e){var t;return 0===e.readBits(1)?16:(t=e.readBits(3))>0?17+t:(t=e.readBits(3))>0?8+t:17}function g(e){if(e.readBits(1)){var t=e.readBits(3);return 0===t?1:e.readBits(t)+(1<1&&0===s)throw new Error("Invalid size byte");i.meta_block_length|=s<<8*r}}else for(r=0;r4&&0===o)throw new Error("Invalid size nibble");i.meta_block_length|=o<<4*r}return++i.meta_block_length,i.input_end||i.is_metadata||(i.is_uncompressed=e.readBits(1)),i}function y(e,t,n){var r;return n.fillBitWindow(),(r=e[t+=n.val_>>>n.bit_pos_&255].bits-8)>0&&(n.bit_pos_+=8,t+=e[t].value,t+=n.val_>>>n.bit_pos_&(1<>=1,++c;for(f=0;f0;++f){var b,y=d[f],v=0;r.fillBitWindow(),v+=r.val_>>>r.bit_pos_&15,r.bit_pos_+=_[v].bits,b=_[v].value,m[y]=b,0!==b&&(w-=32>>b,++g)}if(1!==g&&0!==w)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function(e,t,n,r){for(var i=0,s=8,o=0,l=0,c=32768,h=[],d=0;d<32;d++)h.push(new a(0,0));for(u(h,0,5,e,18);i0;){var p,f=0;if(r.readMoreInput(),r.fillBitWindow(),f+=r.val_>>>r.bit_pos_&31,r.bit_pos_+=h[f].bits,(p=255&h[f].value)<16)o=0,n[i++]=p,0!==p&&(s=p,c-=32768>>p);else{var m,w,g=p-14,_=0;if(16===p&&(_=s),l!==_&&(o=0,l=_),m=o,o>0&&(o-=2,o<<=g),i+(w=(o+=r.readBits(g)+3)-m)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var b=0;b>>5]),this.htrees=new Uint32Array(t)}function S(e,t){var n,r,i={num_htrees:null,context_map:null},s=0;t.readMoreInput();var o=i.num_htrees=g(t)+1,u=i.context_map=new Uint8Array(e);if(o<=1)return i;for(t.readBits(1)&&(s=t.readBits(4)+1),n=[],r=0;r<1080;r++)n[r]=new a(0,0);for(v(o+s,n,0,t),r=0;r=e)throw new Error("[DecodeContextMap] i >= context_map_size");u[r]=0,++r}else u[r]=l-s,++r}return t.readBits(1)&&function(e,t){var n,r=new Uint8Array(256);for(n=0;n<256;++n)r[n]=n;for(n=0;n=e&&(a-=e),r[n]=a,i[u+(1&s[l])]=a,++s[l]}function k(e,t,n,r,i,o){var a,u=i+1,l=n&i,c=o.pos_&s.IBUF_MASK;if(t<8||o.bit_pos_+(t<<3)0;)o.readMoreInput(),r[l++]=o.readBits(8),l===u&&(e.write(r,u),l=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)r[l]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++l,--t;if(c+(a=o.bit_end_pos_-o.bit_pos_>>3)>s.IBUF_MASK){for(var h=s.IBUF_MASK+1-c,d=0;d=u){e.write(r,u),l-=u;for(d=0;d=u;){if(a=u-l,o.input_.read(r,l,a)t.buffer.length){var he=new Uint8Array(R+Z);he.set(t.buffer),t.buffer=he}if(O=ce.input_end,W=ce.is_uncompressed,ce.is_metadata)for(D(x);Z>0;--Z)x.readMoreInput(),x.readBits(8);else if(0!==Z)if(W)x.bit_pos_=x.bit_pos_+7&-8,k(t,Z,R,p,d,x),R+=Z;else{for(n=0;n<3;++n)ee[n]=g(x)+1,ee[n]>=2&&(v(ee[n]+2,m,1080*n,x),v(26,_,1080*n,x),Q[n]=E(_,1080*n,x),ne[n]=1);for(x.readMoreInput(),H=(1<<(j=x.readBits(2)))-1,G=(z=16+(x.readBits(4)<0;){var fe,me,we,ge,_e,be,ye,ve,Ee,Ae,xe,Te;for(x.readMoreInput(),0===Q[1]&&(C(ee[1],m,1,$,te,ne,x),Q[1]=E(_,1080,x),J=B[1].htrees[$[1]]),--Q[1],(me=(fe=y(B[1].codes,J,x))>>6)>=2?(me-=2,ye=-1):ye=0,we=c.kInsertRangeLut[me]+(fe>>3&7),ge=c.kCopyRangeLut[me]+(7&fe),_e=c.kInsertLengthPrefixCode[we].offset+x.readBits(c.kInsertLengthPrefixCode[we].nbits),be=c.kCopyLengthPrefixCode[ge].offset+x.readBits(c.kCopyLengthPrefixCode[ge].nbits),P=p[R-1&d],L=p[R-2&d],Ee=0;Ee<_e;++Ee)x.readMoreInput(),0===Q[0]&&(C(ee[0],m,0,$,te,ne,x),Q[0]=E(_,0,x),ie=$[0]<<6,Y=re[$[0]],ue=l.lookupOffsets[Y],le=l.lookupOffsets[Y+1]),se=q[ie+(l.lookup[ue+P]|l.lookup[le+L])],--Q[0],L=P,P=y(B[0].codes,B[0].htrees[se],x),p[R&d]=P,(R&d)===d&&t.write(p,u),++R;if((Z-=_e)<=0)break;if(ye<0)if(x.readMoreInput(),0===Q[2]&&(C(ee[2],m,2,$,te,ne,x),Q[2]=E(_,2160,x),oe=$[2]<<2),--Q[2],ae=X[oe+(255&(be>4?3:be-2))],(ye=y(B[2].codes,B[2].htrees[ae],x))>=z)Te=(ye-=z)&H,ye=z+((Se=(2+(1&(ye>>=j))<<(xe=1+(ye>>1)))-4)+x.readBits(xe)<(I=R=o.minDictionaryWordLength&&be<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+R+" distance: "+ve+" len: "+be+" bytes left: "+Z);var Se=o.offsetsByLength[be],Ce=ve-I-1,ke=o.sizeBitsByLength[be],De=Ce>>ke;if(Se+=(Ce&(1<=f){t.write(p,u);for(var Oe=0;Oe0&&(N[3&F]=ve,++F),be>Z)throw new Error("Invalid backward reference. pos: "+R+" distance: "+ve+" len: "+be+" bytes left: "+Z);for(Ee=0;Eethis.buffer.length&&(n=this.buffer.length-this.pos);for(var r=0;rthis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(e.subarray(0,t),this.pos),this.pos+=t,t},t.BrotliOutput=r},function(e,t,n){var r=n(153);t.init=function(){t.dictionary=r.init()},t.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),t.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),t.minDictionaryWordLength=4,t.maxDictionaryWordLength=24},function(e,t){function n(e,t){this.bits=e,this.value=t}t.HuffmanCode=n;function r(e,t){for(var n=1<>=1;return(e&n-1)+n}function i(e,t,r,i,s){do{e[t+(i-=r)]=new n(s.bits,s.value)}while(i>0)}function s(e,t,n){for(var r=1<0;--y[l])i(e,t+h,d,w,new n(255&l,65535&_[c++])),h=r(h,l);for(f=g-1,p=-1,l=o+1,d=2;l<=15;++l,d<<=1)for(;y[l]>0;--y[l])(h&f)!==p&&(t+=w,g+=w=1<<(m=s(y,l,o)),e[b+(p=h&f)]=new n(m+o&255,t-b-p&65535)),i(e,t+(h>>o),d,w,new n(l-o&255,65535&_[c++])),h=r(h,l);return g}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){for(var i=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{s=s+(i=i+t[r++]|0)|0}while(--o);i%=65521,s%=65521}return i|s<<16|0}},function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}},function(e,t,n){"use strict";var r=n(9),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.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 u(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return u(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n4)l[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&n1?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return u(l,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){for(var i=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{s=s+(i=i+t[r++]|0)|0}while(--o);i%=65521,s%=65521}return i|s<<16|0}},function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}},function(e,t,n){"use strict";var r=n(11),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.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 u(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return u(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n4)l[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&n1?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return u(l,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";var r=n(16);e.exports=new r({include:[n(91)]})},function(e,t,n){"use strict";var r=n(16);e.exports=new r({include:[n(50)],implicit:[n(189),n(190),n(191),n(192)]})},function(e,t,n){"use strict";t.Commented=n(209),t.Diagnose=n(219),t.Decoder=n(37),t.Encoder=n(93),t.Simple=n(28),t.Tagged=n(54),t.Map=n(220),t.comment=t.Commented.comment,t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.decodeAllSync=t.Decoder.decodeAllSync,t.decodeFirstSync=t.Decoder.decodeFirstSync,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.encodeCanonical=t.Encoder.encodeCanonical,t.encodeOne=t.Encoder.encodeOne,t.encodeAsync=t.Encoder.encodeAsync,t.decode=t.Decoder.decodeFirstSync,t.leveldb={decode:t.Decoder.decodeAllSync,encode:t.Encoder.encode,buffer:!0,name:"cbor"},t.hasBigInt=n(17).hasBigInt},function(e,t,n){"use strict";(function(t){const r=n(4),i=n(55),s=n(18).BigNumber,o=n(29),a=(n(54),n(28),n(17)),u=n(12),l=u.MT,c=u.NUMBYTES,h=u.SHIFT32,d=u.SYMS,p=u.TAG,f=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.TWO,m=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.FOUR,w=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.EIGHT,g=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.TRUE,_=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.FALSE,b=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.UNDEFINED,y=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.NULL,v=new s("0x20000000000000"),E=t.from("f97e00","hex"),A=t.from("f9fc00","hex"),x=t.from("f97c00","hex"),T=t.from("f98000","hex"),S=Symbol("CBOR_LOOP_DETECT");class C extends r.Transform{constructor(e){const n=Object.assign({},e,{readableObjectMode:!1,writableObjectMode:!0});super(n),this.canonical=n.canonical,this.encodeUndefined=n.encodeUndefined,this.disallowUndefinedKeys=!!n.disallowUndefinedKeys,this.dateType=null!=n.dateType?n.dateType.toLowerCase():"number","symbol"==typeof n.detectLoops?this.detectLoops=n.detectLoops:this.detectLoops=n.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes=[Array,this._pushArray,Date,this._pushDate,t,this._pushBuffer,Map,this._pushMap,o,this._pushNoFilter,RegExp,this._pushRegexp,Set,this._pushSet,s,this._pushBigNumber,ArrayBuffer,this._pushUint8Array,Uint8ClampedArray,this._pushUint8Array,Uint8Array,this._pushUint8Array,Uint16Array,this._pushArray,Uint32Array,this._pushArray,Int8Array,this._pushArray,Int16Array,this._pushArray,Int32Array,this._pushArray,Float32Array,this._pushFloat32Array,Float64Array,this._pushFloat64Array],i.Url&&this.semanticTypes.push(i.Url,this._pushUrl),i.URL&&this.semanticTypes.push(i.URL,this._pushURL);const r=n.genTypes||[];for(let e=0,t=r.length;e{r.pushAny(e);const n=i.read();r.pushAny(t);const s=i.read();return n.compare(s)});for(const[t,r]of n){if(e.disallowUndefinedKeys&&void 0===t)throw new Error("Invalid Map key: undefined");if(!e.pushAny(t)||!e.pushAny(r))return!1}}else for(const[n,r]of t){if(e.disallowUndefinedKeys&&void 0===n)throw new Error("Invalid Map key: undefined");if(!e.pushAny(n)||!e.pushAny(r))return!1}return!0}_pushUint8Array(e,n){return e._pushBuffer(e,t.from(n))}_pushFloat32Array(e,t){const n=t.length;if(!e._pushInt(n,l.ARRAY))return!1;for(let r=0;r{const n=r[e]||(r[e]=C.encode(e)),i=r[t]||(r[t]=C.encode(t));return n.compare(i)}),!this._pushInt(n.length,l.MAP))return!1;let i;for(let t=0,s=n.length;t{const s=[],o=new C(n);o.on("data",e=>s.push(e)),o.on("error",i),o.on("finish",()=>r(t.concat(s))),o.pushAny(e),o.end()})}}e.exports=C}).call(this,n(3).Buffer)},,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";const r=n(57),{escapeString:i}=n(149);e.exports=class extends r{constructor(){super({sourceCodeLocationInfo:!0}),this.posTracker=this.locInfoMixin.posTracker}_transformChunk(e){super._transformChunk(e)}_getRawHtml(e){const t=this.posTracker.droppedBufferSize,n=e.startOffset-t,r=e.endOffset-t;return this.tokenizer.preprocessor.html.slice(n,r)}_handleToken(e){super._handleToken(e)||this.emitRaw(this._getRawHtml(e.location)),this.parserFeedbackSimulator.skipNextNewLine=!1}_emitToken(e,t){this.emit(e,t,this._getRawHtml(t.sourceCodeLocation))}emitDoctype(e){let t="",this.push(t)}emitStartTag(e){let t="<"+e.tagName;const n=e.attrs;for(let e=0;e":">",this.push(t)}emitEndTag(e){this.push(`${e.tagName}>`)}emitText({text:e}){this.push(i(e,!1))}emitComment(e){this.push(`\x3c!--${e.text}--\x3e`)}emitRaw(e){this.push(e)}}},function(e,t,n){e.exports=n(77).BrotliDecompressBuffer},function(e,t,n){"use strict";var r=n(167),i=n(11),s=n(88),o=n(170),a=n(49),u=n(89),l=n(171),c=Object.prototype.toString;function h(e){if(!(this instanceof h))return new h(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);if(this.header=new l,r.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=s.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=r.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[n])}function d(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(e,t){var n,a,u,l,h,d=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=s.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new i.Buf8(p),d.next_out=0,d.avail_out=p),(n=r.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(n=r.inflateSetDictionary(this.strm,f)),n===o.Z_BUF_ERROR&&!0===m&&(n=o.Z_OK,m=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&n!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(d.output,d.next_out),l=d.next_out-u,h=s.buf2string(d.output,u),d.next_out=l,d.avail_out=p-l,l&&i.arraySet(d.output,d.output,u,l,0),this.onData(h)):this.onData(i.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),d.avail_out=0,!0)},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=h,t.inflate=d,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},t.ungzip=d},function(e,t,n){"use strict";!function(){var t,r,i,s=0,o=[];for(r=0;r<256;r++)o[r]=(r+256).toString(16).substr(1);function a(){var e,n=(e=16,(!t||s+e>u.BUFFER_SIZE)&&(s=0,t=u.randomBytes(u.BUFFER_SIZE)),t.slice(s,s+=e));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,n}function u(){var e=a();return o[e[0]]+o[e[1]]+o[e[2]]+o[e[3]]+"-"+o[e[4]]+o[e[5]]+"-"+o[e[6]]+o[e[7]]+"-"+o[e[8]]+o[e[9]]+"-"+o[e[10]]+o[e[11]]+o[e[12]]+o[e[13]]+o[e[14]]+o[e[15]]}u.BUFFER_SIZE=4096,u.bin=a,u.clearBuffer=function(){t=null,s=0},u.test=function(e){return"string"==typeof e&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(e)},"undefined"!=typeof crypto?i=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(i=window.msCrypto),i=i||n(172),e.exports=u,u.randomBytes=function(){if(i){if(i.randomBytes)return i.randomBytes;if(i.getRandomValues)return function(e){var t=new Uint8Array(e);return i.getRandomValues(t),t}}return function(e){var t,n=[];for(t=0;t=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(i)return W(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var 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 S(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function g(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),r=+r,isNaN(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=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,i,n){var s,o=1,a=t.length,u=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,u/=2,r/=2}function h(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var c=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var l=!0,d=0;dn&&(i=n):i=n;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function x(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+l<=r)switch(l){case 1:h<128&&(c=h);break;case 2:128==(192&(s=t[n+1]))&&(u=(31&h)<<6|63&s)>127&&(c=u);break;case 3:s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&(u=(15&h)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[n+1],o=t[n+2],a=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");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;for(var s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),a=Math.min(s,o),h=this.slice(i,n),c=t.slice(e,r),l=0;ln)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,i,n,s){if(!u.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 O(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function F(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function P(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 B(t,e,r,i,s){return s||P(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function L(t,e,r,i,s){return s||P(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=this[t],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+n]=t/s&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):F(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):F(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){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("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&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 j(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(6))},function(t,e,r){t.exports=n;var i=r(41).EventEmitter;function n(){i.call(this)}r(13)(n,i),n.Readable=r(42),n.Writable=r(133),n.Duplex=r(134),n.Transform=r(135),n.PassThrough=r(136),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(c(),0===i.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",n),t.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",h),t.removeListener("error",h),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",h),t.on("error",h),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var i=r(1),n=r(0);const s=new TextDecoder("utf-8");class o{static fromResponse({url:t,response:e,date:r,noRW:n,isLive:s}){const a=e.body?new i.a(e.body.getReader(),!1):null,u=Number(e.headers.get("x-redirect-status")||e.status),h=e.statusText;let c=e.headers;const l=c.get("x-proxy-set-cookie");if(l){const t=[];l.split(",").forEach(e=>{const r=e.split(";",1)[0].trim();r.indexOf("=")>0&&t.push(r)}),t.length&&(c=new Headers(c),c.set("x-wabac-preset-cookie",t.join(";")),console.log("cookies",t.join(";")))}return new o({payload:a,status:u,statusText:h,headers:c,url:t,date:r,noRW:n,isLive:s})}constructor({payload:t,status:e,statusText:r,headers:i,url:n,date:s,extraOpts:o=null,noRW:a=!1,isLive:u=!1}){this.reader=null,this.buffer=null,t&&t[Symbol.asyncIterator]?this.reader=t:this.buffer=t,this.status=e,this.statusText=r,this.headers=i,this.url=n,this.date=s,this.extraOpts=o,this.noRW=a,this.isLive=u}async getText(){const t=await this.getBuffer();return"string"==typeof t?t:s.decode(t)}async getBuffer(){return this.buffer||(this.buffer=await this.reader.readFully()),this.buffer}async setContent(t){t instanceof i.b?(this.reader=t,this.buffer=null):t.getReader?(this.reader=new i.a(t.getReader()),this.buffer=null):(this.reader=null,this.buffer=t)}async*[Symbol.asyncIterator](){this.buffer?yield this.buffer:this.reader&&(yield*this.reader)}setRange(t){const e=t.match(/^bytes\=(\d+)\-(\d+)?$/);let r=0;if(this.buffer)r=this.buffer.length;else if(this.reader&&(r=Number(this.headers.get("content-length")),!r))return;if(!e)return this.status=416,this.statusText="Range Not Satisfiable",this.headers.set("Content-Range","*/"+r),!1;const i=Number(e[1]),n=Number(e[2])||r-1;return this.buffer?this.buffer=this.buffer.slice(i,n+1):this.reader&&(0===i&&n===r-1||this.reader.setLimitSkip(n-i+1,i)),this.headers.set("Content-Range",`bytes ${i}-${n}/${r}`),this.headers.set("Content-Length",n-i+1),this.status=206,this.statusText="Partial Content",!0}makeResponse(){let t=null;Object(n.i)(this.status)||(t=this.buffer||!this.reader?this.buffer:this.reader.getReadableStream());const e=new Response(t,{status:this.status,statusText:this.statusText,headers:this.headers});return e.date=this.date,e}}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";const i=":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",n="["+i+"][: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]*",s=new RegExp("^"+n+"$");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;s0||t===e?e:e-1}function m(t){for(var e,r,i=1,n=t.length,s=t[0]+"";ih^r?1:-1;for(a=(u=n.length)<(h=s.length)?u:h,o=0;os[o]^r?1:-1;return u==h?0:u>h^r?1:-1}function g(t,e,r,i){if(tr||t!==u(t))throw Error(h+(i||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function y(t){var e=t.c.length-1;return p(t.e/14)==e&&t.c[e]%2!=0}function _(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function b(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else eO?m.c=m.e=null:t.e=10;l/=10,h++);return void(h>O?m.c=m.e=null:(m.e=h,m.c=[t]))}p=String(t)}else{if(!o.test(p=String(t)))return n(m,p,d);m.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(h=p.indexOf("."))>-1&&(p=p.replace(".","")),(l=p.search(/e/i))>0?(h<0&&(h=l),h+=+p.slice(l+1),p=p.substring(0,l)):h<0&&(h=p.length)}else{if(g(e,2,U.length,"Base"),10==e)return z(m=new M(t),D+m.e+1,k);if(p=String(t),d="number"==typeof t){if(0*t!=0)return n(m,p,d,e);if(m.s=1/t<0?(p=p.slice(1),-1):1,M.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(c+t)}else m.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=U.slice(0,e),h=l=0,f=p.length;lh){h=f;continue}}else if(!a&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){a=!0,l=-1,h=0;continue}return n(m,String(t),d,e)}d=!1,(h=(p=i(p,e,10,m.s)).indexOf("."))>-1?p=p.replace(".",""):h=p.length}for(l=0;48===p.charCodeAt(l);l++);for(f=p.length;48===p.charCodeAt(--f););if(p=p.slice(l,++f)){if(f-=l,d&&M.DEBUG&&f>15&&(t>9007199254740991||t!==u(t)))throw Error(c+m.s*t);if((h=h-l-1)>O)m.c=m.e=null;else if(h=I)?_(u,o):b(u,o,"0");else if(s=(t=z(new M(t),e,r)).e,a=(u=m(t.c)).length,1==i||2==i&&(e<=s||s<=R)){for(;aa){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=s-a)>0)for(s+1==a&&(u+=".");e--;u+="0");return t.s<0&&n?"-"+u:u}function j(t,e){for(var r,i=1,n=new M(t[0]);i=10;n/=10,i++);return(r=i+14*r-1)>O?t.c=t.e=null:r=10;h/=10,n++);if((s=e-n)<0)s+=14,o=e,p=(c=m[f=0])/w[n-o-1]%10|0;else if((f=a((s+1)/14))>=m.length){if(!i)break t;for(;m.length<=f;m.push(0));c=p=0,n=1,o=(s%=14)-14+1}else{for(c=h=m[f],n=1;h>=10;h/=10,n++);p=(o=(s%=14)-14+n)<0?0:c/w[n-o-1]%10|0}if(i=i||e<0||null!=m[f+1]||(o<0?c:c%w[n-o-1]),i=r<4?(p||i)&&(0==r||r==(t.s<0?3:2)):p>5||5==p&&(4==r||i||6==r&&(s>0?o>0?c/w[n-o]:0:m[f-1])%10&1||r==(t.s<0?8:7)),e<1||!m[0])return m.length=0,i?(e-=t.e+1,m[0]=w[(14-e%14)%14],t.e=-e||0):m[0]=t.e=0,t;if(0==s?(m.length=f,h=1,f--):(m.length=f+1,h=w[14-s],m[f]=o>0?u(c/w[n-o]%w[o])*h:0),i)for(;;){if(0==f){for(s=1,o=m[0];o>=10;o/=10,s++);for(o=m[0]+=h,h=1;o>=10;o/=10,h++);s!=h&&(t.e++,m[0]==l&&(m[0]=1));break}if(m[f]+=h,m[f]!=l)break;m[f--]=0,h=1}for(s=m.length;0===m[--s];m.pop());}t.e>O?t.c=t.e=null:t.e=I?_(e,r):b(e,r,"0"),t.s<0?"-"+e:e)}return M.clone=t,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(g(r=t[e],0,f,e),D=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(g(r=t[e],0,8,e),k=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(g(r[0],-f,0,e),g(r[1],0,f,e),R=r[0],I=r[1]):(g(r,-f,f,e),R=-(I=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)g(r[0],-f,-1,e),g(r[1],1,f,e),N=r[0],O=r[1];else{if(g(r,-f,f,e),!r)throw Error(h+e+" cannot be zero: "+r);N=-(O=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(h+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!r,Error(h+"crypto unavailable");F=r}else F=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(g(r=t[e],0,9,e),P=r),t.hasOwnProperty(e="POW_PRECISION")&&(g(r=t[e],0,f,e),B=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(h+e+" not an object: "+r);L=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(h+e+" invalid: "+r);U=r}}return{DECIMAL_PLACES:D,ROUNDING_MODE:k,EXPONENTIAL_AT:[R,I],RANGE:[N,O],CRYPTO:F,MODULO_MODE:P,POW_PRECISION:B,FORMAT:L,ALPHABET:U}},M.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!M.DEBUG)return!0;var e,r,i=t.c,n=t.e,s=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===s||-1===s)&&n>=-f&&n<=f&&n===u(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break t}if((e=(n+1)%14)<1&&(e+=14),String(i[0]).length==e){for(e=0;e=l||r!==u(r))break t;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(h+"Invalid BigNumber: "+t)},M.maximum=M.max=function(){return j(arguments,S.lt)},M.minimum=M.min=function(){return j(arguments,S.gt)},M.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,i,n,o,c=0,l=[],p=new M(C);if(null==t?t=D:g(t,0,f),n=a(t/14),F)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(n*=2));c>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(o%1e14),c+=2);c=n/2}else{if(!crypto.randomBytes)throw F=!1,Error(h+"crypto unavailable");for(e=crypto.randomBytes(n*=7);c=9e15?crypto.randomBytes(7).copy(e,c):(l.push(o%1e14),c+=7);c=n/7}if(!F)for(;c=10;o/=10,c++);c<14&&(i-=14-c)}return p.e=i,p.c=l,p}),M.sum=function(){for(var t=1,e=arguments,r=new M(e[0]);tr-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}return function(e,i,n,s,o){var a,u,h,c,l,d,f,p,w=e.indexOf("."),g=D,y=k;for(w>=0&&(c=B,B=0,e=e.replace(".",""),d=(p=new M(i)).pow(e.length-w),B=c,p.c=t(b(m(d.c),d.e,"0"),10,n,"0123456789"),p.e=p.c.length),h=c=(f=t(e,i,n,o?(a=U,"0123456789"):(a="0123456789",U))).length;0==f[--c];f.pop());if(!f[0])return a.charAt(0);if(w<0?--h:(d.c=f,d.e=h,d.s=s,f=(d=r(d,p,g,y,n)).c,l=d.r,h=d.e),w=f[u=h+g+1],c=n/2,l=l||u<0||null!=f[u+1],l=y<4?(null!=w||l)&&(0==y||y==(d.s<0?3:2)):w>c||w==c&&(4==y||l||6==y&&1&f[u-1]||y==(d.s<0?8:7)),u<1||!f[0])e=l?b(a.charAt(1),-g,a.charAt(0)):a.charAt(0);else{if(f.length=u,l)for(--n;++f[--u]>n;)f[u]=0,u||(++h,f=[1].concat(f));for(c=f.length;!f[--c];);for(w=0,e="";w<=c;e+=a.charAt(f[w++]));e=b(e,h,a.charAt(0))}return e}}(),r=function(){function t(t,e,r){var i,n,s,o,a=0,u=t.length,h=e%1e7,c=e/1e7|0;for(t=t.slice();u--;)a=((n=h*(s=t[u]%1e7)+(i=c*s+(o=t[u]/1e7|0)*h)%1e7*1e7+a)/r|0)+(i/1e7|0)+c*o,t[u]=n%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;ne[n]?1:-1;break}return s}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]1;t.splice(0,1));}return function(i,n,s,o,a){var h,c,d,f,m,w,g,y,_,b,E,v,A,T,x,S,C,D=i.s==n.s?1:-1,k=i.c,R=n.c;if(!(k&&k[0]&&R&&R[0]))return new M(i.s&&n.s&&(k?!R||k[0]!=R[0]:R)?k&&0==k[0]||!R?0*D:D/0:NaN);for(_=(y=new M(D)).c=[],D=s+(c=i.e-n.e)+1,a||(a=l,c=p(i.e/14)-p(n.e/14),D=D/14|0),d=0;R[d]==(k[d]||0);d++);if(R[d]>(k[d]||0)&&c--,D<0)_.push(1),f=!0;else{for(T=k.length,S=R.length,d=0,D+=2,(m=u(a/(R[0]+1)))>1&&(R=t(R,m,a),k=t(k,m,a),S=R.length,T=k.length),A=S,E=(b=k.slice(0,S)).length;E=a/2&&x++;do{if(m=0,(h=e(R,b,S,E))<0){if(v=b[0],S!=E&&(v=v*a+(b[1]||0)),(m=u(v/x))>1)for(m>=a&&(m=a-1),g=(w=t(R,m,a)).length,E=b.length;1==e(w,b,g,E);)m--,r(w,S=10;D/=10,d++);z(y,s+(y.e=d+14*c-1)+1,o,f)}else y.e=c,y.r=+f;return y}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,A=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(t,e,r,i){var n,s=r?e:e.replace(x,"");if(T.test(s))t.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(E,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,s=s.replace(v,"$1").replace(A,"0.$1")),e!=s))return new M(s,n);if(M.DEBUG)throw Error(h+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},S.absoluteValue=S.abs=function(){var t=new M(this);return t.s<0&&(t.s=1),t},S.comparedTo=function(t,e){return w(this,new M(t,e))},S.decimalPlaces=S.dp=function(t,e){var r,i,n,s=this;if(null!=t)return g(t,0,f),null==e?e=k:g(e,0,8),z(new M(s),t+s.e+1,e);if(!(r=s.c))return null;if(i=14*((n=r.length-1)-p(this.e/14)),n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},S.dividedBy=S.div=function(t,e){return r(this,new M(t,e),D,k)},S.dividedToIntegerBy=S.idiv=function(t,e){return r(this,new M(t,e),0,1)},S.exponentiatedBy=S.pow=function(t,e){var r,i,n,s,o,c,l,d,f=this;if((t=new M(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+G(t));if(null!=e&&(e=new M(e)),o=t.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!t.c||!t.c[0])return d=new M(Math.pow(+G(f),o?2-y(t):+G(t))),e?d.mod(e):d;if(c=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new M(NaN);(i=!c&&f.isInteger()&&e.isInteger())&&(f=f.mod(e))}else{if(t.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||o&&f.c[1]>=24e7:f.c[0]<8e13||o&&f.c[0]<=9999975e7)))return s=f.s<0&&y(t)?-0:0,f.e>-1&&(s=1/s),new M(c?1/s:s);B&&(s=a(B/14+2))}for(o?(r=new M(.5),c&&(t.s=1),l=y(t)):l=(n=Math.abs(+G(t)))%2,d=new M(C);;){if(l){if(!(d=d.times(f)).c)break;s?d.c.length>s&&(d.c.length=s):i&&(d=d.mod(e))}if(n){if(0===(n=u(n/2)))break;l=n%2}else if(z(t=t.times(r),t.e+1,1),t.e>14)l=y(t);else{if(0===(n=+G(t)))break;l=n%2}f=f.times(f),s?f.c&&f.c.length>s&&(f.c.length=s):i&&(f=f.mod(e))}return i?d:(c&&(d=C.div(d)),e?d.mod(e):s?z(d,B,k,void 0):d)},S.integerValue=function(t){var e=new M(this);return null==t?t=k:g(t,0,8),z(e,e.e+1,t)},S.isEqualTo=S.eq=function(t,e){return 0===w(this,new M(t,e))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(t,e){return w(this,new M(t,e))>0},S.isGreaterThanOrEqualTo=S.gte=function(t,e){return 1===(e=w(this,new M(t,e)))||0===e},S.isInteger=function(){return!!this.c&&p(this.e/14)>this.c.length-2},S.isLessThan=S.lt=function(t,e){return w(this,new M(t,e))<0},S.isLessThanOrEqualTo=S.lte=function(t,e){return-1===(e=w(this,new M(t,e)))||0===e},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(t,e){var r,i,n,s,o=this,a=o.s;if(e=(t=new M(t,e)).s,!a||!e)return new M(NaN);if(a!=e)return t.s=-e,o.plus(t);var u=o.e/14,h=t.e/14,c=o.c,d=t.c;if(!u||!h){if(!c||!d)return c?(t.s=-e,t):new M(d?o:NaN);if(!c[0]||!d[0])return d[0]?(t.s=-e,t):new M(c[0]?o:3==k?-0:0)}if(u=p(u),h=p(h),c=c.slice(),a=u-h){for((s=a<0)?(a=-a,n=c):(h=u,n=d),n.reverse(),e=a;e--;n.push(0));n.reverse()}else for(i=(s=(a=c.length)<(e=d.length))?a:e,a=e=0;e0)for(;e--;c[r++]=0);for(e=l-1;i>a;){if(c[--i]=0;){for(r=0,f=b[n]%1e7,m=b[n]/1e7|0,s=n+(o=u);s>n;)r=((h=f*(h=_[--o]%1e7)+(a=m*h+(c=_[o]/1e7|0)*f)%1e7*1e7+w[s]+r)/g|0)+(a/1e7|0)+m*c,w[s--]=h%g;w[s]=r}return r?++i:w.splice(0,1),H(t,w,i)},S.negated=function(){var t=new M(this);return t.s=-t.s||null,t},S.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new M(t,e)).s,!n||!e)return new M(NaN);if(n!=e)return t.s=-e,i.minus(t);var s=i.e/14,o=t.e/14,a=i.c,u=t.c;if(!s||!o){if(!a||!u)return new M(n/0);if(!a[0]||!u[0])return u[0]?t:new M(a[0]?i:0*n)}if(s=p(s),o=p(o),a=a.slice(),n=s-o){for(n>0?(o=s,r=u):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(e=u.length)<0&&(r=u,u=a,a=r,e=n),n=0;e;)n=(a[--e]=a[e]+u[e]+n)/l|0,a[e]=l===a[e]?0:a[e]%l;return n&&(a=[n].concat(a),++o),H(t,a,o)},S.precision=S.sd=function(t,e){var r,i,n,s=this;if(null!=t&&t!==!!t)return g(t,1,f),null==e?e=k:g(e,0,8),z(new M(s),t,e);if(!(r=s.c))return null;if(i=14*(n=r.length-1)+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&s.e+1>i&&(i=s.e+1),i},S.shiftedBy=function(t){return g(t,-9007199254740991,9007199254740991),this.times("1e"+t)},S.squareRoot=S.sqrt=function(){var t,e,i,n,s,o=this,a=o.c,u=o.s,h=o.e,c=D+4,l=new M("0.5");if(1!==u||!a||!a[0])return new M(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(u=Math.sqrt(+G(o)))||u==1/0?(((e=m(a)).length+h)%2==0&&(e+="0"),u=Math.sqrt(+e),h=p((h+1)/2)-(h<0||h%2),i=new M(e=u==1/0?"1e"+h:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+h)):i=new M(u+""),i.c[0])for((u=(h=i.e)+c)<3&&(u=0);;)if(s=i,i=l.times(s.plus(r(o,s,c,1))),m(s.c).slice(0,u)===(e=m(i.c)).slice(0,u)){if(i.e0&&m>0){for(s=m%a||a,l=p.substr(0,s);s0&&(l+=c+p.slice(s)),f&&(l="-"+l)}i=d?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):l}return(r.prefix||"")+i+(r.suffix||"")},S.toFraction=function(t){var e,i,n,s,o,a,u,c,l,f,p,w,g=this,y=g.c;if(null!=t&&(!(u=new M(t)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(h+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+G(u));if(!y)return new M(g);for(e=new M(C),l=i=new M(C),n=c=new M(C),w=m(y),o=e.e=w.length-g.e-1,e.c[0]=d[(a=o%14)<0?14+a:a],t=!t||u.comparedTo(e)>0?o>0?e:l:u,a=O,O=1/0,u=new M(w),c.c[0]=0;f=r(u,e,0,1),1!=(s=i.plus(f.times(n))).comparedTo(t);)i=n,n=s,l=c.plus(f.times(s=l)),c=s,e=u.minus(f.times(s=e)),u=s;return s=r(t.minus(i),n,0,1),c=c.plus(s.times(l)),i=i.plus(s.times(n)),c.s=l.s=g.s,p=r(l,n,o*=2,k).minus(g).abs().comparedTo(r(c,i,o,k).minus(g).abs())<1?[l,n]:[c,i],O=a,p},S.toNumber=function(){return+G(this)},S.toPrecision=function(t,e){return null!=t&&g(t,1,f),W(this,t,e,2)},S.toString=function(t){var e,r=this,n=r.s,s=r.e;return null===s?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==t?e=s<=R||s>=I?_(m(r.c),s):b(m(r.c),s,"0"):10===t?e=b(m((r=z(new M(r),D+s+1,k)).c),r.e,"0"):(g(t,2,U.length,"Base"),e=i(b(m(r.c),s,"0"),10,t,n,!0)),n<0&&r.c[0]&&(e="-"+e)),e},S.valueOf=S.toJSON=function(){return G(this)},S._isBigNumber=!0,null!=e&&M.set(e),M}()).default=s.BigNumber=s,void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()},function(t,e,r){"use strict";const i=r(11).BigNumber;e.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},e.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},e.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},e.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},e.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},e.SHIFT32=4294967296,e.BI={MINUS_ONE:-1,MAXINT32:4294967295,MAXINT64:"0xffffffffffffffff",SHIFT32:e.SHIFT32};const n=new i(-1);e.BN={MINUS_ONE:n,NEG_MAX:n.minus(new i(Number.MAX_SAFE_INTEGER.toString(16),16)),MAXINT:new i("0x20000000000000"),MAXINT32:new i(4294967295),MAXINT64:new i("0xffffffffffffffff"),SHIFT32:new i(e.SHIFT32)}},function(t,e){"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}}},function(t,e){var r,i,n=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(t){r=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var u,h=[],c=!1,l=-1;function d(){c&&u&&(c=!1,u.length?h=u.concat(h):l=-1,h.length&&f())}function f(){if(!c){var t=a(d);c=!0;for(var e=h.length;e;){for(u=h,h=[];++l1)for(var r=1;rt.decode(e),e.utf8.checksUTF8=!0}else e.utf8=t=>t.toString("utf8"),e.utf8.checksUTF8=!1;e.parseCBORint=function(t,e){switch(t){case o.ONE:return e.readUInt8(0);case o.TWO:return e.readUInt16BE(0);case o.FOUR:return e.readUInt32BE(0);case o.EIGHT:const r=e.readUInt32BE(0),i=e.readUInt32BE(4);return r>2097151?new n(r).times(a).plus(i):r*a+i;default:throw new Error("Invalid additional info for int: "+t)}},e.writeHalf=function(e,r){const i=t.allocUnsafe(4);i.writeFloatBE(r,0);const n=i.readUInt32BE(0);if(0!=(8191&n))return!1;let s=n>>16&32768;const o=n>>23&255,a=8388607&n;if(o>=113&&o<=142)s+=(o-112<<10)+(a>>13);else{if(!(o>=103&&o<113))return!1;if(a&(1<<126-o)-1)return!1;s+=a+8388608>>126-o}return e.writeUInt16BE(s),!0},e.parseHalf=function(t){const e=128&t[0]?-1:1,r=(124&t[0])>>2,i=(3&t[0])<<8|t[1];return r?31===r?e*(i?NaN:Infinity):e*Math.pow(2,r-25)*(1024+i):5.960464477539063e-8*e*i},e.parseCBORfloat=function(t){switch(t.length){case 2:return e.parseHalf(t);case 4:return t.readFloatBE(0);case 8:return t.readDoubleBE(0);default:throw new Error("Invalid float size: "+t.length)}},e.hex=function(e){return t.from(e.replace(/^0x/,""),"hex")},e.bin=function(e){let r=0,i=(e=e.replace(/\s/g,"")).length%8||8;const n=[];for(;i<=e.length;)n.push(parseInt(e.slice(r,i),2)),r=i,i+=8;return t.from(n)},e.extend=function(t={},...e){const r=e.length;for(let i=0;it===e[r]))},e.bufferEqual=function(e,r){if(null==e&&null==r)return!0;if(null==e||null==r)return!1;if(!t.isBuffer(e)||!t.isBuffer(r)||e.length!==r.length)return!1;const i=e.length;let n,s,o=!0;for(n=s=0;s=1e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=1e3} records`)),this.batch.push(t)}async finishIndexing(){this.batch.length>0&&this.promises.push(this.db.addResources(this.batch)),console.log(`Indexed ${this.count+=this.batch.length} records`),this._finishLoad();try{await Promise.all(this.promises)}catch(t){console.warn(t)}this.promises=[]}_finishLoad(){}}},,,function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(3).Buffer)},function(t,e,r){"use strict";const i=e.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};e.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},e.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const n=e.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};e.SPECIAL_ELEMENTS={[i.HTML]:{[n.ADDRESS]:!0,[n.APPLET]:!0,[n.AREA]:!0,[n.ARTICLE]:!0,[n.ASIDE]:!0,[n.BASE]:!0,[n.BASEFONT]:!0,[n.BGSOUND]:!0,[n.BLOCKQUOTE]:!0,[n.BODY]:!0,[n.BR]:!0,[n.BUTTON]:!0,[n.CAPTION]:!0,[n.CENTER]:!0,[n.COL]:!0,[n.COLGROUP]:!0,[n.DD]:!0,[n.DETAILS]:!0,[n.DIR]:!0,[n.DIV]:!0,[n.DL]:!0,[n.DT]:!0,[n.EMBED]:!0,[n.FIELDSET]:!0,[n.FIGCAPTION]:!0,[n.FIGURE]:!0,[n.FOOTER]:!0,[n.FORM]:!0,[n.FRAME]:!0,[n.FRAMESET]:!0,[n.H1]:!0,[n.H2]:!0,[n.H3]:!0,[n.H4]:!0,[n.H5]:!0,[n.H6]:!0,[n.HEAD]:!0,[n.HEADER]:!0,[n.HGROUP]:!0,[n.HR]:!0,[n.HTML]:!0,[n.IFRAME]:!0,[n.IMG]:!0,[n.INPUT]:!0,[n.LI]:!0,[n.LINK]:!0,[n.LISTING]:!0,[n.MAIN]:!0,[n.MARQUEE]:!0,[n.MENU]:!0,[n.META]:!0,[n.NAV]:!0,[n.NOEMBED]:!0,[n.NOFRAMES]:!0,[n.NOSCRIPT]:!0,[n.OBJECT]:!0,[n.OL]:!0,[n.P]:!0,[n.PARAM]:!0,[n.PLAINTEXT]:!0,[n.PRE]:!0,[n.SCRIPT]:!0,[n.SECTION]:!0,[n.SELECT]:!0,[n.SOURCE]:!0,[n.STYLE]:!0,[n.SUMMARY]:!0,[n.TABLE]:!0,[n.TBODY]:!0,[n.TD]:!0,[n.TEMPLATE]:!0,[n.TEXTAREA]:!0,[n.TFOOT]:!0,[n.TH]:!0,[n.THEAD]:!0,[n.TITLE]:!0,[n.TR]:!0,[n.TRACK]:!0,[n.UL]:!0,[n.WBR]:!0,[n.XMP]:!0},[i.MATHML]:{[n.MI]:!0,[n.MO]:!0,[n.MN]:!0,[n.MS]:!0,[n.MTEXT]:!0,[n.ANNOTATION_XML]:!0},[i.SVG]:{[n.TITLE]:!0,[n.FOREIGN_OBJECT]:!0,[n.DESC]:!0}}},function(t,e,r){"use strict";function i(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(t){var e=this.name+": ";return e+=this.reason||"(unknown reason)",!t&&this.mark&&(e+=" "+this.mark.toString()),e},t.exports=i},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(87)],implicit:[r(178),r(179)],explicit:[r(180),r(181),r(182),r(183)]})},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=s)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),c(i,t,i.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function h(t,e){return t}function c(t,r,i){if(t.customInspect&&r&&A(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return g(n)||(n=c(t,n,i)),n}var s=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(w(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(s)return s;var o=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(r)),v(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return l(r);if(0===o.length){if(A(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return t.stylize(Date.prototype.toString.call(r),"date");if(v(r))return l(r)}var h,b="",T=!1,x=["{","}"];(f(r)&&(T=!0,x=["[","]"]),A(r))&&(b=" [Function"+(r.name?": "+r.name:"")+"]");return _(r)&&(b=" "+RegExp.prototype.toString.call(r)),E(r)&&(b=" "+Date.prototype.toUTCString.call(r)),v(r)&&(b=" "+l(r)),0!==o.length||T&&0!=r.length?i<0?_(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=T?function(t,e,r,i,n){for(var s=[],o=0,a=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,b,x)):x[0]+b+x[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,i,n,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),D(i,n)||(o="["+n+"]"),a||(t.seen.indexOf(u.value)<0?(a=m(r)?c(t,u.value,null):c(t,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),y(o)){if(s&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function f(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function w(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function _(t){return b(t)&&"[object RegExp]"===T(t)}function b(t){return"object"==typeof t&&null!==t}function E(t){return b(t)&&"[object Date]"===T(t)}function v(t){return b(t)&&("[object Error]"===T(t)||t instanceof Error)}function A(t){return"function"==typeof t}function T(t){return Object.prototype.toString.call(t)}function x(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(y(s)&&(s=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var i=t.pid;o[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else o[r]=function(){};return o[r]},e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=f,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=w,e.isString=g,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=_,e.isObject=b,e.isDate=E,e.isError=v,e.isFunction=A,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(195);var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var t=new Date,e=[x(t.getHours()),x(t.getMinutes()),x(t.getSeconds())].join(":");return[t.getDate(),S[t.getMonth()],e].join(" ")}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",C(),e.format.apply(e,arguments))},e.inherits=r(196),e._extend=function(t,e){if(!e||!b(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var k="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(k&&t[k]){var e;if("function"!=typeof(e=t[k]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,k,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],s=0;s255||(0|t)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}toString(){return"simple("+this.value+")"}[i.inspect.custom](t,e){return"simple("+this.value+")"}inspect(t,e){return"simple("+this.value+")"}encodeCBOR(t){return t._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(t){return t instanceof u}static decode(t,e=!0,r=!1){switch(t){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return e?null:a.NULL;case o.UNDEFINED:return e?void 0:a.UNDEFINED;case-1:if(!e||!r)throw new Error("Invalid BREAK");return a.BREAK;default:return new u(t)}}}t.exports=u},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(26);class s extends i.Transform{constructor(t,r,i){let n,s;switch(null==i&&(i={}),typeof t){case"object":e.isBuffer(t)?(n=t,null!=r&&"object"==typeof r&&(i=r)):i=t;break;case"string":n=t,null!=r&&"object"==typeof r?i=r:s=r}null==i&&(i={}),null==n&&(n=i.input),null==s&&(s=i.inputEncoding),delete i.input,delete i.inputEncoding;const o=null==i.watchPipe||i.watchPipe;delete i.watchPipe;const a=!!i.readError;delete i.readError,super(i),this.readError=a,o&&this.on("pipe",t=>{const e=t._readableState.objectMode;if(this.length>0&&e!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");return this._readableState.objectMode=e,this._writableState.objectMode=e}),null!=n&&this.end(n,s)}static isNoFilter(t){return t instanceof this}static compare(t,e){if(!(t instanceof this))throw new TypeError("Arguments must be NoFilters");return t===e?0:t.compare(e)}static concat(t,r){if(!Array.isArray(t))throw new TypeError("list argument must be an Array of NoFilters");if(0===t.length||0===r)return e.alloc(0);null==r&&(r=t.reduce((t,e)=>{if(!(e instanceof s))throw new TypeError("list argument must be an Array of NoFilters");return t+e.length},0));let i=!0,n=!0;const o=t.map(t=>{if(!(t instanceof s))throw new TypeError("list argument must be an Array of NoFilters");const r=t.slice();return e.isBuffer(r)?n=!1:i=!1,r});if(i)return e.concat(o,r);if(n)return[].concat(...o).slice(0,r);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(t,r,i){this._readableState.objectMode||e.isBuffer(t)||(t=e.from(t,r)),this.push(t),i()}_bufArray(){let t=this._readableState.buffer;if(!Array.isArray(t)){let e=t.head;for(t=[];null!=e;)t.push(e.data),e=e.next}return t}read(t){const e=super.read(t);if(null!=e){if(this.emit("read",e),this.readError&&e.length{this.on("finish",()=>{const i=this.read();null==t||e||(e=!0,t(null,i)),r(i)}),this.on("error",r=>{null==t||e||(e=!0,t(r)),i(r)})})}compare(t){if(!(t instanceof s))throw new TypeError("Arguments must be NoFilters");if(this===t)return 0;{const r=this.slice(),i=t.slice();if(e.isBuffer(r)&&e.isBuffer(i))return r.compare(i);throw new Error("Cannot compare streams in object mode")}}equals(t){return 0===this.compare(t)}slice(t,r){if(this._readableState.objectMode)return this._bufArray().slice(t,r);const i=this._bufArray();switch(i.length){case 0:return e.alloc(0);case 1:return i[0].slice(t,r);default:return e.concat(i).slice(t,r)}}get(t){return this.slice()[t]}toJSON(){const t=this.slice();return e.isBuffer(t)?t.toJSON():t}toString(t,r,i){const s=this.slice(r,i);if(!e.isBuffer(s))return JSON.stringify(s);if((!t||"utf8"===t)&&n.TextDecoder){return new n.TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(s)}return s.toString(t,r,i)}inspect(t,e){return this[n.inspect.custom](t,e)}[n.inspect.custom](t,r){const i=this._bufArray().map(t=>e.isBuffer(t)?(null!=r?r.stylize:void 0)?r.stylize(t.toString("hex"),"string"):t.toString("hex"):n.inspect(t,r)).join(", ");return`${this.constructor.name} [${i}]`}get length(){return this._readableState.length}writeBigInt(t){let r=t.toString(16);if(t<0){const e=BigInt(Math.floor(r.length/2));r=(t=(BigInt(1)<=a.DIGIT_0&&t<=a.DIGIT_9}function f(t){return t>=a.LATIN_CAPITAL_A&&t<=a.LATIN_CAPITAL_Z}function p(t){return t>=a.LATIN_SMALL_A&&t<=a.LATIN_SMALL_Z}function m(t){return p(t)||f(t)}function w(t){return m(t)||d(t)}function g(t){return t>=a.LATIN_CAPITAL_A&&t<=a.LATIN_CAPITAL_F}function y(t){return t>=a.LATIN_SMALL_A&&t<=a.LATIN_SMALL_F}function _(t){return t+32}function b(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(t>>>10&1023|55296)+String.fromCharCode(56320|1023&t))}function E(t){return String.fromCharCode(_(t))}function v(t,e){const r=s[++t];let i=++t,n=i+r-1;for(;i<=n;){const t=i+n>>>1,o=s[t];if(oe))return s[t+r];n=t-1}}return-1}class A{constructor(){this.preprocessor=new i,this.tokenQueue=[],this.allowCDATA=!1,this.state=c,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(t){this._consume(),this._err(t),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this[this.state](t)}return this.tokenQueue.shift()}write(t,e){this.active=!0,this.preprocessor.write(t,e)}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:A.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(t){this.state=t,this._unconsume()}_consumeSequenceIfMatch(t,e,r){let i=0,n=!0;const s=t.length;let o=0,u=e,h=void 0;for(;o0&&(u=this._consume(),i++),u===a.EOF){n=!1;break}if(h=t[o],u!==h&&(r||u!==_(h))){n=!1;break}}if(!n)for(;i--;)this._unconsume();return n}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==u.SCRIPT_STRING.length)return!1;for(let t=0;t0&&this._err(o.endTagWithAttributes),t.selfClosing&&this._err(o.endTagWithTrailingSolidus)),this.tokenQueue.push(t)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(t,e){this.currentCharacterToken&&this.currentCharacterToken.type!==t&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=e:this._createCharacterToken(t,e)}_emitCodePoint(t){let e=A.CHARACTER_TOKEN;l(t)?e=A.WHITESPACE_CHARACTER_TOKEN:t===a.NULL&&(e=A.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(e,b(t))}_emitSeveralCodePoints(t){for(let e=0;e-1;){const t=s[i],n=t<7;n&&1&t&&(e=2&t?[s[++i],s[++i]]:[s[++i]],r=0);const o=this._consume();if(this.tempBuff.push(o),r++,o===a.EOF)break;i=n?4&t?v(i,o):-1:o===t?++i:-1}for(;r--;)this.tempBuff.pop(),this._unconsume();return e}_isCharacterReferenceInAttribute(){return"ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_UNQUOTED_STATE"===this.returnState}_isCharacterReferenceAttributeQuirk(t){if(!t&&this._isCharacterReferenceInAttribute()){const t=this._consume();return this._unconsume(),t===a.EQUALS_SIGN||w(t)}return!1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let t=0;t")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE(t){t===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE"):m(t)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE")):(this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE(t){m(t)?(this._createEndTagToken(),this._reconsumeInState("SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE")):(this._emitChars(""),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE(t){if(f(t))this.currentToken.tagName+=E(t),this.tempBuff.push(t);else if(p(t))this.currentToken.tagName+=b(t),this.tempBuff.push(t);else{if(this.lastStartTagName===this.currentToken.tagName){if(l(t))return void(this.state="BEFORE_ATTRIBUTE_NAME_STATE");if(t===a.SOLIDUS)return void(this.state="SELF_CLOSING_START_TAG_STATE");if(t===a.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=c)}this._emitChars(""),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}}SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_DOUBLE_ESCAPED_STATE":"SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(t)):f(t)?(this.tempBuff.push(_(t)),this._emitCodePoint(t)):p(t)?(this.tempBuff.push(t),this._emitCodePoint(t)):this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPED_STATE(t){t===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",this._emitChars("-")):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(t)}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE(t){t===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",this._emitChars("-")):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE(t){t===a.HYPHEN_MINUS?this._emitChars("-"):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.GREATER_THAN_SIGN?(this.state="SCRIPT_DATA_STATE",this._emitChars(">")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE(t){t===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",this._emitChars("/")):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_ESCAPED_STATE":"SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t)):f(t)?(this.tempBuff.push(_(t)),this._emitCodePoint(t)):p(t)?(this.tempBuff.push(t),this._emitCodePoint(t)):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}BEFORE_ATTRIBUTE_NAME_STATE(t){l(t)||(t===a.SOLIDUS||t===a.GREATER_THAN_SIGN||t===a.EOF?this._reconsumeInState("AFTER_ATTRIBUTE_NAME_STATE"):t===a.EQUALS_SIGN?(this._err(o.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state="ATTRIBUTE_NAME_STATE"):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}ATTRIBUTE_NAME_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN||t===a.EOF?(this._leaveAttrName("AFTER_ATTRIBUTE_NAME_STATE"),this._unconsume()):t===a.EQUALS_SIGN?this._leaveAttrName("BEFORE_ATTRIBUTE_VALUE_STATE"):f(t)?this.currentAttr.name+=E(t):t===a.QUOTATION_MARK||t===a.APOSTROPHE||t===a.LESS_THAN_SIGN?(this._err(o.unexpectedCharacterInAttributeName),this.currentAttr.name+=b(t)):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.name+=n.REPLACEMENT_CHARACTER):this.currentAttr.name+=b(t)}AFTER_ATTRIBUTE_NAME_STATE(t){l(t)||(t===a.SOLIDUS?this.state="SELF_CLOSING_START_TAG_STATE":t===a.EQUALS_SIGN?this.state="BEFORE_ATTRIBUTE_VALUE_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}BEFORE_ATTRIBUTE_VALUE_STATE(t){l(t)||(t===a.QUOTATION_MARK?this.state="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE":t===a.APOSTROPHE?this.state="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.missingAttributeValue),this.state=c,this._emitCurrentToken()):this._reconsumeInState("ATTRIBUTE_VALUE_UNQUOTED_STATE"))}ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}ATTRIBUTE_VALUE_UNQUOTED_STATE(t){l(t)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_UNQUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.QUOTATION_MARK||t===a.APOSTROPHE||t===a.LESS_THAN_SIGN||t===a.EQUALS_SIGN||t===a.GRAVE_ACCENT?(this._err(o.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=b(t)):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}AFTER_ATTRIBUTE_VALUE_QUOTED_STATE(t){l(t)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):t===a.SOLIDUS?this._leaveAttrValue("SELF_CLOSING_START_TAG_STATE"):t===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.missingWhitespaceBetweenAttributes),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}SELF_CLOSING_START_TAG_STATE(t){t===a.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.unexpectedSolidusInTag),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}BOGUS_COMMENT_STATE(t){t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._emitCurrentToken(),this._emitEOFToken()):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):this.currentToken.data+=b(t)}MARKUP_DECLARATION_OPEN_STATE(t){this._consumeSequenceIfMatch(u.DASH_DASH_STRING,t,!0)?(this._createCommentToken(),this.state="COMMENT_START_STATE"):this._consumeSequenceIfMatch(u.DOCTYPE_STRING,t,!1)?this.state="DOCTYPE_STATE":this._consumeSequenceIfMatch(u.CDATA_START_STRING,t,!0)?this.allowCDATA?this.state="CDATA_SECTION_STATE":(this._err(o.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state="BOGUS_COMMENT_STATE"):this._ensureHibernation()||(this._err(o.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState("BOGUS_COMMENT_STATE"))}COMMENT_START_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_START_DASH_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):this._reconsumeInState("COMMENT_STATE")}COMMENT_START_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_DASH_STATE":t===a.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state="COMMENT_LESS_THAN_SIGN_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=b(t)}COMMENT_LESS_THAN_SIGN_STATE(t){t===a.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state="COMMENT_LESS_THAN_SIGN_BANG_STATE"):t===a.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE":this._reconsumeInState("COMMENT_END_DASH_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE(t){t!==a.GREATER_THAN_SIGN&&t!==a.EOF&&this._err(o.nestedComment),this._reconsumeInState("COMMENT_END_STATE")}COMMENT_END_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_STATE(t){t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EXCLAMATION_MARK?this.state="COMMENT_END_BANG_STATE":t===a.HYPHEN_MINUS?this.currentToken.data+="-":t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_BANG_STATE(t){t===a.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state="COMMENT_END_DASH_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.incorrectlyClosedComment),this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState("COMMENT_STATE"))}DOCTYPE_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_NAME_STATE":t===a.GREATER_THAN_SIGN?this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingWhitespaceBeforeDoctypeName),this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"))}BEFORE_DOCTYPE_NAME_STATE(t){l(t)||(f(t)?(this._createDoctypeToken(E(t)),this.state="DOCTYPE_NAME_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this._createDoctypeToken(n.REPLACEMENT_CHARACTER),this.state="DOCTYPE_NAME_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(b(t)),this.state="DOCTYPE_NAME_STATE"))}DOCTYPE_NAME_STATE(t){l(t)?this.state="AFTER_DOCTYPE_NAME_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):f(t)?this.currentToken.name+=E(t):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.name+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=b(t)}AFTER_DOCTYPE_NAME_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(u.PUBLIC_STRING,t,!1)?this.state="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE":this._consumeSequenceIfMatch(u.SYSTEM_STRING,t,!1)?this.state="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE":this._ensureHibernation()||(this._err(o.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE(t){l(t)||(t===a.QUOTATION_MARK?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=b(t)}DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=b(t)}AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE(t){l(t)?this.state="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE(t){l(t)||(t===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=b(t)}DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=b(t)}AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}BOGUS_DOCTYPE_STATE(t){t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.NULL?this._err(o.unexpectedNullCharacter):t===a.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}CDATA_SECTION_STATE(t){t===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_BRACKET_STATE":t===a.EOF?(this._err(o.eofInCdata),this._emitEOFToken()):this._emitCodePoint(t)}CDATA_SECTION_BRACKET_STATE(t){t===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_END_STATE":(this._emitChars("]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CDATA_SECTION_END_STATE(t){t===a.GREATER_THAN_SIGN?this.state=c:t===a.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CHARACTER_REFERENCE_STATE(t){this.tempBuff=[a.AMPERSAND],t===a.NUMBER_SIGN?(this.tempBuff.push(t),this.state="NUMERIC_CHARACTER_REFERENCE_STATE"):w(t)?this._reconsumeInState("NAMED_CHARACTER_REFERENCE_STATE"):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}NAMED_CHARACTER_REFERENCE_STATE(t){const e=this._matchNamedCharacterReference(t);if(this._ensureHibernation())this.tempBuff=[a.AMPERSAND];else if(e){const t=this.tempBuff[this.tempBuff.length-1]===a.SEMICOLON;this._isCharacterReferenceAttributeQuirk(t)||(t||this._errOnNextCodePoint(o.missingSemicolonAfterCharacterReference),this.tempBuff=e),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state="AMBIGUOS_AMPERSAND_STATE"}AMBIGUOS_AMPERSAND_STATE(t){w(t)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=b(t):this._emitCodePoint(t):(t===a.SEMICOLON&&this._err(o.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}NUMERIC_CHARACTER_REFERENCE_STATE(t){this.charRefCode=0,t===a.LATIN_SMALL_X||t===a.LATIN_CAPITAL_X?(this.tempBuff.push(t),this.state="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE"):this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_START_STATE")}HEXADEMICAL_CHARACTER_REFERENCE_START_STATE(t){!function(t){return d(t)||g(t)||y(t)}(t)?(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState("HEXADEMICAL_CHARACTER_REFERENCE_STATE")}DECIMAL_CHARACTER_REFERENCE_START_STATE(t){d(t)?this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_STATE"):(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}HEXADEMICAL_CHARACTER_REFERENCE_STATE(t){g(t)?this.charRefCode=16*this.charRefCode+t-55:y(t)?this.charRefCode=16*this.charRefCode+t-87:d(t)?this.charRefCode=16*this.charRefCode+t-48:t===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}DECIMAL_CHARACTER_REFERENCE_STATE(t){d(t)?this.charRefCode=10*this.charRefCode+t-48:t===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}NUMERIC_CHARACTER_REFERENCE_END_STATE(){if(this.charRefCode===a.NULL)this._err(o.nullCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(o.characterReferenceOutsideUnicodeRange),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(n.isSurrogate(this.charRefCode))this._err(o.surrogateCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(n.isUndefinedCodePoint(this.charRefCode))this._err(o.noncharacterCharacterReference);else if(n.isControlCodePoint(this.charRefCode)||this.charRefCode===a.CARRIAGE_RETURN){this._err(o.controlCharacterReference);const t=h[this.charRefCode];t&&(this.charRefCode=t)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}}A.CHARACTER_TOKEN="CHARACTER_TOKEN",A.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",A.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",A.START_TAG_TOKEN="START_TAG_TOKEN",A.END_TAG_TOKEN="END_TAG_TOKEN",A.COMMENT_TOKEN="COMMENT_TOKEN",A.DOCTYPE_TOKEN="DOCTYPE_TOKEN",A.EOF_TOKEN="EOF_TOKEN",A.HIBERNATION_TOKEN="HIBERNATION_TOKEN",A.MODE={DATA:c,RCDATA:"RCDATA_STATE",RAWTEXT:"RAWTEXT_STATE",SCRIPT_DATA:"SCRIPT_DATA_STATE",PLAINTEXT:"PLAINTEXT_STATE"},A.getTokenAttr=function(t,e){for(let r=t.attrs.length-1;r>=0;r--)if(t.attrs[r].name===e)return t.attrs[r].value;return null},t.exports=A},function(t,e,r){"use strict";const i=r(7),n=r(7).buildOptions,s=r(162);"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,i.nameRegexp);!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const o={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",tagValueProcessor:function(t,e){return t},attrValueProcessor:function(t,e){return t},stopNodes:[]};e.defaultOptions=o;const a=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","stopNodes"];function u(t,e,r){return e&&(r.trimValues&&(e=e.trim()),e=c(e=r.tagValueProcessor(e,t),r.parseNodeValue,r.parseTrueNumberOnly)),e}function h(t,e){if(e.ignoreNameSpace){const e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}function c(t,e,r){if(e&&"string"==typeof t){let e;return""===t.trim()||isNaN(t)?e="true"===t||"false"!==t&&t:(-1!==t.indexOf("0x")?e=Number.parseInt(t,16):-1!==t.indexOf(".")?(e=Number.parseFloat(t),t=t.replace(/\.?0+$/,"")):e=Number.parseInt(t,10),r&&(e=String(e)===t?e:t)),e}return i.isExist(t)?t:""}e.props=a;const l=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");function d(t,e){if(!e.ignoreAttributes&&"string"==typeof t){t=t.replace(/\r?\n/g," ");const r=i.getAllMatches(t,l),n=r.length,s={};for(let t=0;t"===e)return{data:i,index:n};"\t"===e&&(e=" ")}i+=e}}function p(t,e,r,i){const n=t.indexOf(e,r);if(-1===n)throw new Error(i);return n+e.length-1}e.getTraversalObj=function(t,e){t=t.replace(/(\r\n)|\n/," "),e=n(e,o,a);const r=new s("!xml");let h=r,c="";for(let r=0;r",r,"Closing Tag is not closed.");let s=t.substring(r+2,n).trim();if(e.ignoreNameSpace){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}h&&(h.val?h.val=i.getValue(h.val)+""+u(s,c,e):h.val=u(s,c,e)),e.stopNodes.length&&e.stopNodes.includes(h.tagname)&&(h.child=[],null==h.attrsMap&&(h.attrsMap={}),h.val=t.substr(h.startIndex+1,r-h.startIndex-1)),h=h.parent,c="",r=n}else if("?"===t[r+1])r=p(t,"?>",r,"Pi Tag is not closed.");else if("!--"===t.substr(r+1,3))r=p(t,"--\x3e",r,"Comment is not closed.");else if("!D"===t.substr(r+1,2)){const e=p(t,">",r,"DOCTYPE is not closed.");r=t.substring(r,e).indexOf("[")>=0?t.indexOf("]>",r)+1:e}else if("!["===t.substr(r+1,2)){const n=p(t,"]]>",r,"CDATA is not closed.")-2,o=t.substring(r+9,n);if(c&&(h.val=i.getValue(h.val)+""+u(h.tagname,c,e),c=""),e.cdataTagName){const t=new s(e.cdataTagName,h,o);h.addChild(t),h.val=i.getValue(h.val)+e.cdataPositionChar,o&&(t.val=o)}else h.val=(h.val||"")+(o||"");r=n+2}else{const n=f(t,r+1);let o=n.data;const a=n.index,l=o.indexOf(" ");let p=o;if(-1!==l&&(p=o.substr(0,l).trimRight(),o=o.substr(l+1)),e.ignoreNameSpace){const t=p.indexOf(":");-1!==t&&(p=p.substr(t+1))}if(h&&c&&"!xml"!==h.tagname&&(h.val=i.getValue(h.val)+""+u(h.tagname,c,e)),o.length>0&&o.lastIndexOf("/")===o.length-1){"/"===p[p.length-1]?(p=p.substr(0,p.length-1),o=p):o=o.substr(0,o.length-1);const t=new s(p,h,"");p!==o&&(t.attrsMap=d(o,e)),h.addChild(t)}else{const t=new s(p,h);e.stopNodes.length&&e.stopNodes.includes(t.tagname)&&(t.startIndex=a),p!==o&&(t.attrsMap=d(o,e)),h.addChild(t),h=t}c="",r=a}else c+=t[r]}return r}},function(t,e,r){"use strict";var i=r(16);t.exports=i.DEFAULT=new i({include:[r(25)],explicit:[r(184),r(185),r(186)]})},function(t,e,r){"use strict";(function(e){const i=r(197),n=r(52),s=r(27),o=r(17),a=r(11).BigNumber,u=r(28),h=r(12),c=h.MT,l=h.NUMBYTES,d=(h.SIMPLE,h.SYMS),f=o.bigIntize(h.BI),p=h.BN,m=Symbol("count"),w=(Symbol("pending_key"),Symbol("major type")),g=Symbol("error"),y=Symbol("not found");function _(t,e,r){const i=[];return i[m]=r,i[d.PARENT]=t,i[w]=e,i}function b(t,e){const r=new u;return r[m]=-1,r[d.PARENT]=t,r[w]=e,r}function E(t){return o.bufferToBigInt(t)}function v(t){return f.MINUS_ONE-o.bufferToBigInt(t)}class A extends i{constructor(t){const e=(t=t||{}).tags;delete t.tags;const r=null!=t.max_depth?t.max_depth:-1;delete t.max_depth;const i=!!o.hasBigInt&&!!t.bigint;delete t.bigint,super(t),this.running=!0,this.max_depth=r,this.tags=e,i&&(null==this.tags&&(this.tags={}),null==this.tags[2]&&(this.tags[2]=E),null==this.tags[3]&&(this.tags[3]=v))}static nullcheck(t){switch(t){case d.NULL:return null;case d.UNDEFINED:return;case y:throw new Error("Value not found");default:return t}}static decodeFirstSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":i=o.extend({},e),r=i.encoding,delete i.encoding}const n=new A(i),s=new u(t,null!=r?r:o.guessEncoding(t)),a=n._parse();let h=a.next();for(;!h.done;){const t=s.read(h.value);if(null==t||t.length!==h.value)throw new Error("Insufficient data");h=a.next(t)}return A.nullcheck(h.value)}static decodeAllSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":i=o.extend({},e),r=i.encoding,delete i.encoding}const n=new A(i),s=new u(t,null!=r?r:o.guessEncoding(t)),a=[];for(;s.length>0;){const t=n._parse();let e=t.next();for(;!e.done;){const r=s.read(e.value);if(null==r||r.length!==e.value)throw new Error("Insufficient data");e=t.next(r)}a.push(A.nullcheck(e.value))}return a}static decodeFirst(t,e,r){let i={},n=!1,s="hex";switch(typeof e){case"function":r=e,s=o.guessEncoding(t);break;case"string":s=e;break;case"object":i=o.extend({},e),s=null!=i.encoding?i.encoding:o.guessEncoding(t),delete i.encoding,n=null!=i.required&&i.required,delete i.required}const a=new A(i);let u,h=y;return a.on("data",t=>{h=A.nullcheck(t),a.close()}),"function"==typeof r?(a.once("error",t=>{const e=h;return h=g,a.close(),r(t,e)}),a.once("end",()=>{switch(h){case y:return n?r(new Error("No CBOR found")):r(null,h);case g:return;default:return r(null,h)}})):u=new Promise((t,e)=>(a.once("error",t=>(h=g,a.close(),e(t))),a.once("end",()=>{switch(h){case y:return n?e(new Error("No CBOR found")):t(h);case g:return;default:return t(h)}}))),a.end(t,s),u}static decodeAll(t,e,r){let i={},n="hex";switch(typeof e){case"function":r=e,n=o.guessEncoding(t);break;case"string":n=e;break;case"object":i=o.extend({},e),n=null!=i.encoding?i.encoding:o.guessEncoding(t),delete i.encoding}const s=new A(i);let a;const u=[];return s.on("data",t=>u.push(A.nullcheck(t))),"function"==typeof r?(s.on("error",r),s.on("end",()=>r(null,u))):a=new Promise((t,e)=>{s.on("error",e),s.on("end",()=>t(u))}),s.end(t,n),a}close(){this.running=!1,this.__fresh=!0}*_parse(){let t=null,r=0,i=null;for(;;){if(this.max_depth>=0&&r>this.max_depth)throw new Error("Maximum depth "+this.max_depth+" exceeded");const h=(yield 1)[0];if(!this.running)throw new Error("Unexpected data: 0x"+h.toString(16));const f=h>>5,g=31&h,y=null!=t?t[w]:void 0,E=null!=t?t.length:void 0;switch(g){case l.ONE:this.emit("more-bytes",f,1,y,E),i=(yield 1)[0];break;case l.TWO:case l.FOUR:case l.EIGHT:const t=1<=48&&t[s]<=57||t[s]>=65&&t[s]<=70||t[s]>=97&&t[s]<=102;)s++;if(0===s)return t;if(13!=t[s]||10!=t[s+1])return t;s+=2;var n=parseInt(i.decode(t.subarray(e,s)),16);if(0==n)break;t.set(t.subarray(s,s+n),r),s+=n,r+=n,13==t[s]&&10==t[s+1]&&(s+=2),e=s}return t.subarray(0,r)}(t))}catch(t){console.log("Chunk-Encoding Ignored: "+t)}try{if("br"===e)0===(t=n()(t)).length&&(t=i);else if("gzip"===e||"gzip"===r){const e=new s.Inflate;e.push(t,!0),e.result&&!e.err&&(t=e.result)}}catch(t){console.log("Content-Encoding Ignored: "+t)}return t}},function(t,e,r){"use strict";var i={};(0,r(9).assign)(i,r(56),r(57),r(86)),t.exports=i},function(t,e){var r={};r[e.ACCEPTED=202]="Accepted",r[e.BAD_GATEWAY=502]="Bad Gateway",r[e.BAD_REQUEST=400]="Bad Request",r[e.CONFLICT=409]="Conflict",r[e.CONTINUE=100]="Continue",r[e.CREATED=201]="Created",r[e.EXPECTATION_FAILED=417]="Expectation Failed",r[e.FAILED_DEPENDENCY=424]="Failed Dependency",r[e.FORBIDDEN=403]="Forbidden",r[e.GATEWAY_TIMEOUT=504]="Gateway Timeout",r[e.GONE=410]="Gone",r[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP Version Not Supported",r[e.IM_A_TEAPOT=418]="I'm a teapot",r[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="Insufficient Space on Resource",r[e.INSUFFICIENT_STORAGE=507]="Insufficient Storage",r[e.INTERNAL_SERVER_ERROR=500]="Server Error",r[e.LENGTH_REQUIRED=411]="Length Required",r[e.LOCKED=423]="Locked",r[e.METHOD_FAILURE=420]="Method Failure",r[e.METHOD_NOT_ALLOWED=405]="Method Not Allowed",r[e.MOVED_PERMANENTLY=301]="Moved Permanently",r[e.MOVED_TEMPORARILY=302]="Moved Temporarily",r[e.MULTI_STATUS=207]="Multi-Status",r[e.MULTIPLE_CHOICES=300]="Multiple Choices",r[e.NETWORK_AUTHENTICATION_REQUIRED=511]="Network Authentication Required",r[e.NO_CONTENT=204]="No Content",r[e.NON_AUTHORITATIVE_INFORMATION=203]="Non Authoritative Information",r[e.NOT_ACCEPTABLE=406]="Not Acceptable",r[e.NOT_FOUND=404]="Not Found",r[e.NOT_IMPLEMENTED=501]="Not Implemented",r[e.NOT_MODIFIED=304]="Not Modified",r[e.OK=200]="OK",r[e.PARTIAL_CONTENT=206]="Partial Content",r[e.PAYMENT_REQUIRED=402]="Payment Required",r[e.PERMANENT_REDIRECT=308]="Permanent Redirect",r[e.PRECONDITION_FAILED=412]="Precondition Failed",r[e.PRECONDITION_REQUIRED=428]="Precondition Required",r[e.PROCESSING=102]="Processing",r[e.PROXY_AUTHENTICATION_REQUIRED=407]="Proxy Authentication Required",r[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="Request Header Fields Too Large",r[e.REQUEST_TIMEOUT=408]="Request Timeout",r[e.REQUEST_TOO_LONG=413]="Request Entity Too Large",r[e.REQUEST_URI_TOO_LONG=414]="Request-URI Too Long",r[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="Requested Range Not Satisfiable",r[e.RESET_CONTENT=205]="Reset Content",r[e.SEE_OTHER=303]="See Other",r[e.SERVICE_UNAVAILABLE=503]="Service Unavailable",r[e.SWITCHING_PROTOCOLS=101]="Switching Protocols",r[e.TEMPORARY_REDIRECT=307]="Temporary Redirect",r[e.TOO_MANY_REQUESTS=429]="Too Many Requests",r[e.UNAUTHORIZED=401]="Unauthorized",r[e.UNPROCESSABLE_ENTITY=422]="Unprocessable Entity",r[e.UNSUPPORTED_MEDIA_TYPE=415]="Unsupported Media Type",r[e.USE_PROXY=305]="Use Proxy",e.getStatusText=function(t){if(r.hasOwnProperty(t))return r[t];throw new Error("Status code does not exist: "+t)},e.getStatusCode=function(t){for(key in r)if(r[key]===t)return parseInt(key,10);throw new Error("Reason phrase does not exist: "+t)}},function(t,e,r){"use strict";let{Json2Csv:i}=r(189),{Csv2Json:n}=r(192),s=r(51);function o(t,e,r,i){return s.convert({data:e,callback:r,options:i,converter:t})}function a(t,e,r){return new Promise((i,n)=>o(t,e,(t,e)=>t?n(t):i(e),r))}function u(t,e,r,i,n){return console.warn("WARNING: "+e+" is deprecated and will be removed soon. Please use "+r+" instead."),a(t,i,n)}t.exports={json2csv:(t,e,r)=>o(i,t,e,r),csv2json:(t,e,r)=>o(n,t,e,r),json2csvAsync:(t,e)=>a(i,t,e),csv2jsonAsync:(t,e)=>a(n,t,e),json2csvPromisified:(t,e)=>u(i,"json2csvPromisified()","json2csvAsync()",t,e),csv2jsonPromisified:(t,e)=>u(n,"csv2jsonPromisified()","csv2jsonAsync()",t,e)}},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function h(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?a.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var n,s,o,a;if(h(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 u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return t}function d(){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 f(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=d.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 u=n[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,c=w(u,h);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},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){(e=t.exports=r(68)).Stream=e,e.Readable=e,e.Writable=r(44),e.Duplex=r(10),e.Transform=r(75),e.PassThrough=r(132)},function(t,e,r){var i=r(3),n=i.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,e),e.Buffer=o),s(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,i,n){var s=r(32);function o(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?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=y;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:s.nextTick;y.WritableState=g;var h=Object.create(r(22));h.inherits=r(13);var c={deprecate:r(130)},l=r(70),d=r(43).Buffer,f=n.Uint8Array||function(){};var p,m=r(72);function w(){}function g(t,e){a=a||r(10),t=t||{};var i=e instanceof a;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,h=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(h||0===h)?h:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,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,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(s.nextTick(n,i),s.nextTick(T,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),T(t,e))}(t,r,i,e,n);else{var o=v(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||E(t,r),i?u(b,t,r,o,n):b(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function y(t){if(a=a||r(10),!(p.call(y,this)||this instanceof a))return new y(t);this._writableState=new g(t,this),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)),l.call(this)}function _(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function b(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),T(t,e)}function E(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)n[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;n.allBuffers=u,_(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,c=r.encoding,l=r.callback;if(_(t,e,!1,e.objectMode?1:h.length,h,c,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function v(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function A(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),T(t,e)}))}function T(t,e){var r=v(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(A,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(y,l),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.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]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):p=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,a=!n.objectMode&&(i=t,d.isBuffer(i)||i instanceof f);return a&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=w),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.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=d.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 u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var i=this._writableState;"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||i.finished||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(14),r(73).setImmediate,r(6))},function(t,e,r){"use strict";const i=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];e.REPLACEMENT_CHARACTER="�",e.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},e.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},e.isSurrogate=function(t){return t>=55296&&t<=57343},e.isSurrogatePair=function(t){return t>=56320&&t<=57343},e.getSurrogatePairCodePoint=function(t,e){return 1024*(t-55296)+9216+e},e.isControlCodePoint=function(t){return 32!==t&&10!==t&&13!==t&&9!==t&&12!==t&&t>=1&&t<=31||t>=127&&t<=159},e.isUndefinedCodePoint=function(t){return t>=64976&&t<=65007||i.indexOf(t)>-1}},function(t,e,r){"use strict";class i{constructor(t){const e={},r=this._getOverriddenMethods(this,e);for(const i of Object.keys(r))"function"==typeof r[i]&&(e[i]=t[i],t[i]=r[i])}_getOverriddenMethods(){throw new Error("Not implemented")}}i.install=function(t,e,r){t.__mixins||(t.__mixins=[]);for(let r=0;r=0?e:void 0),remainingKeyPath:t.slice(e+1)}}t.exports={evaluatePath:function t(e,r){if(!e)return null;let{indexOfDot:n,currentKey:s,remainingKeyPath:o}=i(r);if(n>=0&&!e[r])return Array.isArray(e[s])?e[s].map(e=>t(e,o)):t(e[s],o);if(Array.isArray(e))return e.map(e=>t(e,r));return e[r]},setPath:function t(e,r,n){if(!e)throw new Error("No document was provided.");let{indexOfDot:s,currentKey:o,remainingKeyPath:a}=i(r);if(s>=0){if(!e[o]&&Array.isArray(e))return e.forEach(e=>t(e,r,n));e[o]||(e[o]={}),t(e[o],a,n)}else{if(Array.isArray(e))return e.forEach(e=>t(e,a,n));e[r]=n}return e}}},function(t){t.exports=JSON.parse('{"errors":{"callbackRequired":"A callback is required!","optionsRequired":"Options were not passed and are required.","json2csv":{"cannotCallOn":"Cannot call json2csv on ","dataCheckFailure":"Data provided was not an array of documents.","notSameSchema":"Not all documents have the same schema."},"csv2json":{"cannotCallOn":"Cannot call csv2json on ","dataCheckFailure":"CSV is not a string."}},"defaultOptions":{"delimiter":{"field":",","wrap":"\\"","eol":"\\n"},"excelBOM":false,"prependHeader":true,"trimHeaderFields":false,"trimFieldValues":false,"sortHeader":false,"parseCsvNumbers":false,"keys":null,"checkSchemaDifferences":false,"expandArrayObjects":false,"unwindArrays":false,"useLocaleFormat":false},"values":{"excelBOM":"\ufeff"}}')},function(t,e,r){"use strict";let i=r(49),n=r(50);const s=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;function o(t){return JSON.parse(JSON.stringify(t))}function a(t){return c(t)||h(t)||""===t}function u(t){return"object"==typeof t}function h(t){return null===t}function c(t){return void 0===t}function l(t,e){return t.filter(t=>!e.includes(t))}t.exports={isStringRepresentation:function(t,e){const r=t[0],i=t.length-1,n=t[i];return r===e.delimiter.wrap&&n===e.delimiter.wrap},isDateRepresentation:function(t){return s.test(t)},computeSchemaDifferences:function(t,e){return l(t,e).concat(l(e,t))},deepCopy:o,convert:function(t){let{options:e,callback:r}=function(t,e){if(u(t)&&(r=t,"function"!=typeof r))return{options:t,callback:e};var r;return{options:e,callback:t}}(t.callback,t.options);i=e,(i={...n.defaultOptions,...i||{}}).delimiter={...n.defaultOptions.delimiter,...i.delimiter},e=i;var i;let s=new t.converter(e);(function(t){if(!t.callback)throw new Error(n.errors.callbackRequired);if(!t.data)return t.callback(new Error(t.errorMessages.cannotCallOn+t.data+".")),!1;if(!t.dataCheckFn(t.data))return t.callback(new Error(t.errorMessages.dataCheckFailure)),!1;return!0})({data:t.data,callback:r,errorMessages:s.validationMessages,dataCheckFn:s.validationFn})&&s.convert(t.data,r)},isEmptyField:a,removeEmptyFields:function(t){return t.filter(t=>!a(t))},getNCharacters:function(t,e,r){return t.substring(e,e+r)},unwind:function(t,e){const r=[];return t.forEach(t=>{!function(t,e,r){const n=i.evaluatePath(e,r);let s=o(e);Array.isArray(n)?n.forEach(n=>{s=o(e),t.push(i.setPath(s,r,n))}):t.push(s)}(r,t,e)}),r},isInvalid:function(t){return t===1/0||t===-1/0},isString:function(t){return"string"==typeof t},isNull:h,isError:function(t){return"[object Error]"===Object.prototype.toString.call(t)},isDate:function(t){return t instanceof Date},isUndefined:c,isObject:u,unique:function(t){return[...new Set(t)]},flatten:function(t){return[].concat(...t)}}},function(t,e,r){"use strict";const i=r(11).BigNumber,n=r(17),s=r(53),o=new i(-1),a=new i(10),u=new i(2);class h{constructor(t,e,r){if(this.tag=t,this.value=e,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(t){return t._pushTag(this.tag),t.pushAny(this.value)}convert(t){let e=null!=t?t[this.tag]:void 0;if("function"!=typeof e&&(e=h["_tag_"+this.tag],"function"!=typeof e))return this;try{return e.call(h,this.value)}catch(t){return this.err=t,this}}static _tag_0(t){return new Date(t)}static _tag_1(t){return new Date(1e3*t)}static _tag_2(t){return n.bufferToBignumber(t)}static _tag_3(t){return o.minus(n.bufferToBignumber(t))}static _tag_4(t){return a.pow(t[0]).times(t[1])}static _tag_5(t){return u.pow(t[0]).times(t[1])}static _tag_32(t){return s.parse(t)}static _tag_35(t){return new RegExp(t)}}t.exports=h},function(t,e,r){"use strict";var i=r(198),n=r(200);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=_,e.resolve=function(t,e){return _(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?_(t,!1,!0).resolveObject(e):e},e.format=function(t){n.isString(t)&&(t=_(t));return t instanceof s?t.format():s.prototype.format.call(t)},e.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(h),l=["%","/","?",";","#"].concat(c),d=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(201);function _(t,e,r){if(t&&n.isObject(t)&&t instanceof s)return t;var i=new s;return i.parse(t,e,r),i}s.prototype.parse=function(t,e,r){if(!n.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),a=-1!==s&&s127?O+="x":O+=N[F];if(!O.match(f)){var B=R.slice(0,C),L=R.slice(C+1),U=N.match(p);U&&(B.push(U[1]),L.unshift(U[2])),L.length&&(_="/"+L.join(".")+_),this.hostname=B.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),k||(this.hostname=i.toASCII(this.hostname));var M=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+M,this.href+=this.host,k&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!m[v])for(C=0,I=c.length;C0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift());return r.search=t.search,r.query=t.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!A.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var x=A.slice(-1)[0],S=(r.host||t.host||A.length>1)&&("."===x||".."===x)||""===x,C=0,D=A.length;D>=0;D--)"."===(x=A[D])?A.splice(D,1):".."===x?(A.splice(D,1),C++):C&&(A.splice(D,1),C--);if(!E&&!v)for(;C--;C)A.unshift("..");!E||""===A[0]||A[0]&&"/"===A[0].charAt(0)||A.unshift(""),S&&"/"!==A.join("/").substr(-1)&&A.push("");var k,R=""===A[0]||A[0]&&"/"===A[0].charAt(0);T&&(r.hostname=r.host=R?"":A.length?A.shift():"",(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift()));return(E=E||r.host&&A.length)&&!R&&A.unshift(""),A.length?r.pathname=A.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},,function(t,e,r){"use strict";const{Transform:i}=r(4),n=r(33),s=r(139),o=r(46),a=r(77),u=r(141),h=r(142),c={sourceCodeLocationInfo:!1};const l={[n.START_TAG_TOKEN]:{eventName:"startTag",reshapeToken:t=>({tagName:t.tagName,attrs:t.attrs,selfClosing:t.selfClosing,sourceCodeLocation:t.location})},[n.END_TAG_TOKEN]:{eventName:"endTag",reshapeToken:t=>({tagName:t.tagName,sourceCodeLocation:t.location})},[n.COMMENT_TOKEN]:{eventName:"comment",reshapeToken:t=>({text:t.data,sourceCodeLocation:t.location})},[n.DOCTYPE_TOKEN]:{eventName:"doctype",reshapeToken:t=>({name:t.name,publicId:t.publicId,systemId:t.systemId,sourceCodeLocation:t.location})},[n.CHARACTER_TOKEN]:{eventName:"text",reshapeToken:t=>({text:t.chars,sourceCodeLocation:t.location})}};t.exports=class extends i{constructor(t){super({encoding:"utf8",decodeStrings:!1}),this.options=a(c,t),this.tokenizer=new n(t),this.locInfoMixin=null,this.options.sourceCodeLocationInfo&&(this.locInfoMixin=o.install(this.tokenizer,s)),this.parserFeedbackSimulator=new h(this.tokenizer),this.pendingText=null,this.lastChunkWritten=!1,this.stopped=!1,this.pipe(new u)}_transform(t,e,r){if("string"!=typeof t)throw new TypeError("Parser can work only with string streams.");r(null,this._transformChunk(t))}_final(t){this.lastChunkWritten=!0,t(null,this._transformChunk(""))}stop(){this.stopped=!0}_transformChunk(t){return this.stopped||(this.tokenizer.write(t,this.lastChunkWritten),this._runParsingLoop()),t}_runParsingLoop(){let t=null;do{if(t=this.parserFeedbackSimulator.getNextToken(),t.type===n.HIBERNATION_TOKEN)break;if(t.type===n.CHARACTER_TOKEN||t.type===n.WHITESPACE_CHARACTER_TOKEN||t.type===n.NULL_CHARACTER_TOKEN){if(null===this.pendingText)t.type=n.CHARACTER_TOKEN,this.pendingText=t;else if(this.pendingText.chars+=t.chars,this.options.sourceCodeLocationInfo){const{endLine:e,endCol:r,endOffset:i}=t.location;Object.assign(this.pendingText.location,{endLine:e,endCol:r,endOffset:i})}}else this._emitPendingText(),this._handleToken(t)}while(!this.stopped&&t.type!==n.EOF_TOKEN)}_handleToken(t){if(t.type===n.EOF_TOKEN)return!0;const{eventName:e,reshapeToken:r}=l[t.type];return 0!==this.listenerCount(e)&&(this._emitToken(e,r(t)),!0)}_emitToken(t,e){this.emit(t,e)}_emitPendingText(){null!==this.pendingText&&(this._handleToken(this.pendingText),this.pendingText=null)}}},function(t,e,r){"use strict";var i=r(153),n=r(9),s=r(84),o=r(47),a=r(85),u=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(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 c;if(c="string"==typeof e.dictionary?s.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(r=i.deflateSetDictionary(this.strm,c)))throw new Error(o[r]);this._dict_set=!0}}function c(t,e){var r=new h(e);if(r.push(t,!0),r.err)throw r.msg||o[r.err];return r.result}h.prototype.push=function(t,e){var r,o,a=this.strm,h=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]"===u.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(h),a.next_out=0,a.avail_out=h),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)},h.prototype.onData=function(t){this.chunks.push(t)},h.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=h,e.deflate=c,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,c(t,e)}},function(t,e,r){"use strict";var i=r(155),n=r(9),s=r(84),o=r(86),a=r(47),u=r(85),h=r(158),c=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(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 u,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 h,i.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=s.string2buf(e.dictionary):"[object ArrayBuffer]"===c.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 d(t,e){var r=new l(e);if(r.push(t,!0),r.err)throw r.msg||a[r.err];return r.result}l.prototype.push=function(t,e){var r,a,u,h,l,d=this.strm,f=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof t?d.input=s.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(f),d.next_out=0,d.avail_out=f),(r=i.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&p&&(r=i.inflateSetDictionary(this.strm,p)),r===o.Z_BUF_ERROR&&!0===m&&(r=o.Z_OK,m=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&r!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(d.output,d.next_out),h=d.next_out-u,l=s.buf2string(d.output,u),d.next_out=h,d.avail_out=f-h,h&&n.arraySet(d.output,d.output,u,h,0),this.onData(l)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.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),d.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.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=l,e.inflate=d,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,d(t,e)},e.ungzip=d},function(t,e,r){"use strict";r.r(e),r.d(e,"CollectionLoader",(function(){return _t})),r.d(e,"WorkerLoader",(function(){return bt}));const i=(t,e)=>e.some(e=>t instanceof e);let n,s;const o=new WeakMap,a=new WeakMap,u=new WeakMap,h=new WeakMap,c=new WeakMap;let l={get(t,e,r){if(t instanceof IDBTransaction){if("done"===e)return a.get(t);if("objectStoreNames"===e)return t.objectStoreNames||u.get(t);if("store"===e)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return m(t[e])},set:(t,e,r)=>(t[e]=r,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function d(t){l=t(l)}function f(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(w(this),e),m(o.get(this))}:function(...e){return m(t.apply(w(this),e))}:function(e,...r){const i=t.call(w(this),e,...r);return u.set(i,e.sort?e.sort():[e]),m(i)}}function p(t){return"function"==typeof t?f(t):(t instanceof IDBTransaction&&function(t){if(a.has(t))return;const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("complete",n),t.removeEventListener("error",s),t.removeEventListener("abort",s)},n=()=>{e(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",n),t.addEventListener("error",s),t.addEventListener("abort",s)});a.set(t,e)}(t),i(t,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,l):t)}function m(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("success",n),t.removeEventListener("error",s)},n=()=>{e(m(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",n),t.addEventListener("error",s)});return e.then(e=>{e instanceof IDBCursor&&o.set(e,t)}).catch(()=>{}),c.set(e,t),e}(t);if(h.has(t))return h.get(t);const e=p(t);return e!==t&&(h.set(t,e),c.set(e,t)),e}const w=t=>c.get(t);function g(t,e,{blocked:r,upgrade:i,blocking:n,terminated:s}={}){const o=indexedDB.open(t,e),a=m(o);return i&&o.addEventListener("upgradeneeded",t=>{i(m(o.result),t.oldVersion,t.newVersion,m(o.transaction))}),r&&o.addEventListener("blocked",()=>r()),a.then(t=>{s&&t.addEventListener("close",()=>s()),n&&t.addEventListener("versionchange",()=>n())}).catch(()=>{}),a}function y(t,{blocked:e}={}){const r=indexedDB.deleteDatabase(t);return e&&r.addEventListener("blocked",()=>e()),m(r).then(()=>{})}const _=["get","getKey","getAll","getAllKeys","count"],b=["put","add","delete","clear"],E=new Map;function v(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(E.get(e))return E.get(e);const r=e.replace(/FromIndex$/,""),i=e!==r,n=b.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!n&&!_.includes(r))return;const s=async function(t,...e){const s=this.transaction(t,n?"readwrite":"readonly");let o=s.store;i&&(o=o.index(e.shift()));const a=await o[r](...e);return n&&await s.done,a};return E.set(e,s),s}d(t=>({...t,get:(e,r,i)=>v(e,r)||t.get(e,r,i),has:(e,r)=>!!v(e,r)||t.has(e,r)}));const A=["continue","continuePrimaryKey","advance"],T={},x=new WeakMap,S=new WeakMap,C={get(t,e){if(!A.includes(e))return t[e];let r=T[e];return r||(r=T[e]=function(...t){x.set(this,S.get(this)[e](...t))}),r}};async function*D(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,C);for(S.set(r,e),c.set(r,w(e));e;)yield r,e=await(x.get(r)||e.continue()),x.delete(r)}function k(t,e){return e===Symbol.asyncIterator&&i(t,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===e&&i(t,[IDBIndex,IDBObjectStore])}d(t=>({...t,get:(e,r,i)=>k(e,r)?D:t.get(e,r,i),has:(e,r)=>k(e,r)||t.has(e,r)}));var R=r(0),I=r(117),N=r.n(I);const O=[{match:/\/\/.*gcs-vimeo|vod|vod-progressive\.akamaized\.net.*\/([\d]+)\/[\d]+(.mp4)/,fuzzyCanonReplace:"//vimeo-cdn.fuzzy.replayweb.page/$1$2",split:".net"},{match:/\/\/.*player.vimeo.com\/(video\/[\d]+)\?.*/i,fuzzyCanonReplace:"//vimeo.fuzzy.replayweb.page/$1"},{match:/www.\washingtonpost\.com\/wp-apps\/imrs.php/,args:[["src"]]},{match:/(static.wixstatic.com\/.*\.[\w]+\/v1\/fill\/)(w_.*)/,replace:"$1?_args=$2",split:"/v1/fill"},{match:/(youtube\.com\/embed\/[^?]+)[?].*/i,replace:"$1"},{match:/(www\.)?youtube(-nocookie)?\.com\/get_video_info/i,args:[["video_id","html5"]]},{match:/\/\/.*googlevideo.com\/(videoplayback)/i,fuzzyCanonReplace:"//youtube.fuzzy.replayweb.page/$1",args:[["id","itag"],["id"]],fuzzyArgs:!0},{match:/facebook\.com\/ajax\/pagelet\/generic.php\/photoviewerinitpagelet/i,args:[[{arg:"data",keys:["query_type","fbid","v","cursor","data"]}]]},{match:/facebook\.com\/api\/graphql/i,args:[["variables","doc_id"]],fuzzyArgs:!0},{match:/facebook\.com\/api\/graphqlbatch/i,args:[["batch_name","queries"],["batch_name"]]},{match:/facebook\.com\/ajax\/navigation/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/route-definition/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/bulk-route-definitions/i,args:[["route_urls[0]","__user"],["route_urls[0]"]]},{match:/facebook\.com\/ajax\/relay-ef/i,args:[["queries[0]","__user"],["queries[0]"]]},{match:/facebook\.com\/videos\/vodcomments/i,args:[["eft_id"]]},{match:/facebook\.com\/ajax\.*/i,replaceQuery:/([?&][^_]\w+=[^&]+)/g},{match:/plus\.googleapis\.com\/u\/\/0\/_\/widget\/render\/comments/i,args:[["href","stream_id","substream_id"]]},{match:(F=["(callback=jsonp)[^&]+(?=&|$)","((?:\\w+)=jquery)[\\d]+_[\\d]+","utm_[^=]+=[^&]+(?=&|$)","(_|cb|_ga|\\w*cache\\w*)=[\\d.-]+(?=$|&)"],new RegExp("[?&]"+F.map(t=>"("+t+")").join("|"),"gi")),replace:""},{match:/(\.(?:php|js|webm|mp4|gif|jpg|png|css|json|m3u8))\?.*/i,replace:"$1"}];var F;const P=new class{constructor(t){this.rules=t||O}getRuleFor(t){let e;const r=-1===t.indexOf("?")?t+"?":t;for(const t of this.rules)if(r.match(t.match)){e=t;break}let i=t;e&&e.fuzzyCanonReplace&&(i=t.replace(e.match,e.fuzzyCanonReplace));const n=e&&e.split||"?",s=t.indexOf(n);return{prefix:s>0?t.slice(0,s+n.length):t,rule:e,fuzzyCanonUrl:i}}fuzzyCompareUrls(t,e,r){if(!e||!e.length)return null;if(r&&void 0!==r.replace&&void 0!==r.match){const i=r.match,n=r.replace,s=t.replace(i,n),o=[];for(const t of e){const e=("string"==typeof t?t:t.url).replace(i,n);if(s===e)return t;t.fuzzyMatchUrl=e,o.push(t)}e=o,t=s}return this.fuzzyBestMatchQuery(t,e,r)}fuzzyBestMatchQuery(t,e,r){try{t=new URL(t)}catch(t){return 0}const i=r&&r.args&&!r.fuzzyArgs?new Set(r.args[0]):null;let n=0,s=null;const o=new URLSearchParams(t.search);for(const t of e){if(204===t.mime)continue;let e="string"==typeof t?t:t.fuzzyMatchUrl||t.url;try{e=new URL(e)}catch(t){continue}const r=new URLSearchParams(e.search);let a=this.getMatch(o,r,i);a+=this.getMatch(r,o,i),a/=2,a>n&&(n=a,s=t)}return s}getMatch(t,e,r){let i=1,n=1;for(const[s,o]of t){const t=e.get(s);if(r&&r.has(s)&&t!==o)return-1;let a;a="_"===s[0]?1:10,null!==t&&(i+=.5*a);const u=Number(o),h=Number(t);if(n+=a,t===o)i+=a*o.length;else if(null===t)i+=0;else if(isNaN(u)||isNaN(h)){const e=Math.min(t.length,o.length),r=N()(t,o);rthis._initDB(t,e,r,i),blocking:t=>{t&&null!==t.newVersion||this.close()}})}_initDB(t,e,r,i){if(!e){const e=t.createObjectStore("pages",{keyPath:"id"});e.createIndex("url","url"),e.createIndex("ts","ts");t.createObjectStore("pageLists",{keyPath:"id",autoIncrement:!0});t.createObjectStore("curatedPages",{keyPath:"id",autoIncrement:!0}).createIndex("listPages",["list","pos"]);const r=t.createObjectStore("resources",{keyPath:["url","ts"]});r.createIndex("pageId","pageId"),r.createIndex("mimeStatusUrl",["mime","status","url"]);t.createObjectStore("payload",{keyPath:"digest",unique:!0}),t.createObjectStore("digestRef",{keyPath:"digest",unique:!0})}}async clearAll(){const t=["pages","resources","payload","digestRef"];for(const e of t)await this.db.clear(e)}close(){this.db&&(this.db.close(),this.db=null)}async delete(){this.close(),await y(this.name,{blocked(t){console.log("Unable to delete: "+t)}})}async addPage(t,e){const r=t.url,i=t.title||t.url,n=t.id||this.newPageId();let s=t.ts;s||!t.date&&!t.datetime||(s=new Date(t.date||t.datetime).getTime());const o={...t,url:r,ts:s,title:i,id:n};return e?(e.store.put(o),o.id):await this.db.put("pages",o)}async addPages(t){const e=this.db.transaction("pages","readwrite");for(const e of t)this.addPage(e);try{await e.done}catch(t){console.warn("addPages tx",t.toString())}}async addCPageList(t){const e={};return e.title=t.title,e.desc=t.desc,e.slug=t.slug,await this.db.put("pageLists",e)}async addCuratedPageLists(t,e="pages",r="public"){for(const i of t){if(r&&!i[r])continue;const t=await this.addCPageList(i),n=this.db.transaction("curatedPages","readwrite");let s=0;const o=i[e]||[];for(const e of o){const r={};r.pos=s++,r.list=t;const i=typeof e.page;r.page="string"===i?e.page:"object"===i?e.page.id:e.page_id||e.pageId,r.desc=e.desc,n.store.put(r)}try{await n.done}catch(t){console.warn("addCuratedPageLists tx",t.toString())}}}async getAllCuratedByList(){const t=await this.db.getAll("pageLists"),e=this.db.transaction("curatedPages","readonly");for await(const r of e.store.index("listPages").iterate()){const e=t[r.value.list-1];e&&(e.show=!0,e.pages||(e.pages=[]),e.pages.push(r.value))}return t}newPageId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async getAllPages(){return await this.db.getAll("pages")}async getPages(t){const e=[];t.sort();for await(const r of this.matchAny("pages",null,t))e.push(r);return e}async dedupResource(t,e,r,i=1){const n=r.objectStore("digestRef"),s=await n.get(t);if(s)return++s.count,s;try{return r.objectStore("payload").add({digest:t,payload:e}),{digest:t,count:i,size:e.length}}catch(t){console.log(t)}return null}async addResources(t){const e=[],r=[],i={},n=this.db.transaction(["digestRef","payload"],"readwrite");for(const s of t){let t=1;if("warc/revisit"===s.mime)e.push(s);else{r.push(s);const e=this.getFuzzyUrl(s);e&&(r.push(e),t=2)}this.useRefCounts&&s.digest&&s.payload&&(i[s.digest]=await this.dedupResource(s.digest,s.payload,n,t),delete s.payload)}try{await n.done}catch(t){console.log("Payload Bulk Add Failed: "+t)}const s=this.db.transaction(["digestRef","resources"],"readwrite"),o=s.objectStore("resources");let a={};for(const t of e){if(this.useRefCounts){let e=i[t.digest];e||(e=await s.objectStore("digestRef").get(t.digest)),e&&(e.count++,a[t.digest]=e)}o.put(t)}for(const t of r)o.put(t);if(this.useRefCounts){const t=s.objectStore("digestRef");for(const e of Object.values(a))t.put(e)}await s.done}getFuzzyUrl(t){if(t.status>=200&&t.status<400&&304!==t.status&&204!==t.status){const{fuzzyCanonUrl:e}=P.getRuleFor(t.url);return e&&e!==t.url?{url:e,ts:t.ts,origURL:t.url,origTS:t.ts,pageId:t.pageId,digest:t.digest}:null}return null}async addResource(t){t.payload&&t.payload.length>this.minDedupSize&&(t.digest||(t.digest=await Object(R.d)(t.payload,"sha-256")));let e=null,r=!1;const i=this.db.transaction(["resources","digestRef","payload"],"readwrite");if(t.payload&&t.payload.length>this.minDedupSize?(e=await this.dedupResource(t.digest,t.payload,i),r=e&&1===e.count,delete t.payload):t.payload&&(r=!0),"warc/revisit"!==t.mime){i.objectStore("resources").put(t);const r=this.getFuzzyUrl(t);r&&(i.objectStore("resources").put(r),e&&e.count++)}else i.objectStore("resources").add(t);e&&i.objectStore("digestRef").put(e);try{await i.done}catch(e){"warc/revisit"===t.mime?console.log("Skip Duplicate revisit for: "+t.url):console.log("Add Error for "+t.url),console.log(e)}return r}async getResource(t,e,r){const i=Object(R.m)(t.timestamp).getTime();let n=t.url,s=null;const o={skip:this.repeatTracker?this.repeatTracker.getSkipCount(r,n,t.request.method):0};if(n.startsWith("//")){let e=!1;s=await this.lookupUrl("https:"+n,i,o),s||(s=await this.lookupUrl("http:"+n,i,o),(s||t.request.referrer.indexOf("/http://",2)>0)&&(e=!0)),n=(e?"http:":"https:")+n}else if(s=await this.lookupUrl(n,i,o),!s&&n.startsWith("http://")){const t=n.replace("http://","https://");s=await this.lookupUrl(t,i,o),s&&(n=t)}if(!s&&this.fuzzyPrefixSearch&&(s=await this.lookupQueryPrefix(n)),s&&s.origURL){const t=await this.lookupUrl(s.origURL,s.origTS||s.ts);t&&(n=t.url,s=t)}if(!s)return null;const a=s.status,u=s.statusText||Object(B.getStatusText)(a);let h=null;if(!Object(R.i)()&&(h=await this.loadPayload(s),!h))return null;const c=Object(R.j)(s.respHeaders),l=new Date(s.ts),d=s.extraOpts||null;return new L.a({url:n,payload:h,status:a,statusText:u,headers:c,date:l,extraOpts:d})}async loadPayload(t){if(t.digest&&!t.payload){const e=await this.db.get("payload",t.digest);if(!e)return null;const{payload:r}=e;return r}return t.payload}async lookupUrl(t,e,r={}){const i=this.db.transaction("resources","readonly");if(e){const r=await i.store.get([t,e]);if(r)return r}let n=null,s=r.skip||0;for await(const r of i.store.iterate(this.getLookupRange(t))){if(n&&r.value.ts>e){if(0==s){return r.value.ts-ee?++a:n?(yield o.value,o=await o.continue()):o=await o.continue(r[a])}}async resourcesByUrlAndMime(t,e,r=1e3,i=!0,n="",s=""){const o=e?null:r,a=await this.db.getAll("resources",this.getLookupRange(t,i?"prefix":"exact",n,s),o);e=e.split(",");const u=[];for(const t of a)for(const i of e)if(!i||t.mime&&t.mime.startsWith(i)){if(u.push(this.resJson(t)),u.length===r)return u;break}return u}async resourcesByMime(t,e=100,r="",i="",n=0){const s=[];(t=t.split(",")).sort();let o=[];r&&o.push([r,n,i]);for(const e of t)(!r||!e||e>r)&&o.push([e,0,""]);for await(const t of this.matchAny("resources","mimeStatusUrl",o,0))if(s.push(this.resJson(t)),s.length===e)break;return s}async deletePage(t){const e=this.db.transaction("pages","readwrite"),r=await e.store.get(t);await e.store.delete(t);const i=await this.deletePageResources(t);return{pageSize:r&&r.size||0,dedupSize:i}}async deletePageResources(t){const e={},r=this.db.transaction("resources","readwrite");let i=await r.store.index("pageId").openCursor(t),n=0;for(;i;){const t=i.value.digest;t?e[t]=(e[t]||0)+1:i.value.payload&&(n+=i.value.payload.length),r.store.delete(i.primaryKey),i=await i.continue()}await r.done;const s=this.db.transaction(["payload","digestRef"],"readwrite"),o=s.objectStore("digestRef");for(const t of Object.keys(e)){const r=await o.get(t);r&&(r.count-=e[t]),r&&r.count>=1?o.put(r):(n+=r?r.size:0,o.delete(t),s.objectStore("payload").delete(t))}return await s.done,n}getLookupRange(t,e,r,i){let n,s,o;switch(e){case"prefix":s=t.slice(0,-1)+String.fromCharCode(t.charCodeAt(t.length-1)+1),n=[t],s=[s];break;case"host":const e=new URL(t).origin;n=[e+"/"],s=[e+"0"];break;case"exact":default:n=[t],s=[t+"!"]}return r?(n=[r,i||""],o=!0):o=!1,IDBKeyRange.bound(n,s,o,!0)}}class M{constructor(){this.repeats={}}getSkipCount(t,e,r){if("POST"!==r&&!e.endsWith(".m3u8"))return 0;t.replacesClientId&&delete this.repeats[t.replacesClientId];const i=t.resultingClientId||t.clientId;return i?(void 0===this.repeats[i]&&(this.repeats[i]={}),void 0===this.repeats[i][e]?this.repeats[i][e]=0:this.repeats[i][e]++,this.repeats[i][e]):0}}var W=r(1),j=r(55),H=r.n(j),z=r(4),G=r(37);const q=["script","style","header","footer","banner-div","noscript"];var X=r(19);class Y extends X.a{constructor(t,e=null,r=null){super(),this.reader=t,this.abort=e,this.loadId=r,this.anyPages=!1,this.detectPages=!1,this._lastRecord=null,this.metadata={},this.pageMap={},this.pages=[],this.lists=[]}parseWarcInfo(t){if(!t.payload)return;const e=new TextDecoder("utf-8").decode(t.payload);for(const t of e.split("\n"))if(t.startsWith("json-metadata:"))try{const e=JSON.parse(t.slice("json-metadata:".length));if("collection"===e.type&&(this.metadata.desc=e.desc,this.metadata.title=e.title),e.pages&&e.pages.length){this.pages=this.pages.concat(e.pages);for(const t of e.pages)t.ts=Object(R.m)(t.timestamp).getTime(),this.pageMap[t.ts+"/"+t.url]={page:t};this.anyPages=!0}e.lists&&e.lists.length&&(this.lists=this.lists.concat(e.lists))}catch(t){console.log("Page Add Error",t.toString())}}index(t){if("warcinfo"!==t.warcType){if(this._lastRecord)return this._lastRecord.warcTargetURI!=t.warcTargetURI?(this.indexReqResponse(this._lastRecord,null),void(this._lastRecord=t)):void("request"===t.warcType&&"response"===this._lastRecord.warcType?(this.indexReqResponse(this._lastRecord,t),this._lastRecord=null):"response"===t.warcType&&"request"===this._lastRecord.warcType?(this.indexReqResponse(t,this._lastRecord),this._lastRecord=null):(this.indexReqResponse(this._lastRecord,null),this._lastRecord=t));this._lastRecord=t}else this.parseWarcInfo(t)}indexDone(){this._lastRecord&&(this.indexReqResponse(this._lastRecord),this._lastRecord=null)}shouldIndexMetadataRecord(t){const e=t.warcTargetURI;return!(!e||!e.startsWith("metadata://"))}parseRevisitRecord(t){const e=t.warcTargetURI.split("#")[0],r=(t.warcDate,new Date(t.warcDate).getTime()),i=t.warcRefersToTargetURI,n=new Date(t.warcRefersToDate).getTime();return i===e&&n===r?null:{url:e,ts:r,origURL:i,origTS:n,digest:t.warcPayloadDigest,pageId:null}}indexReqResponse(t,e){const r=this.parseRecords(t,e);r&&this.addResource(r)}parseRecords(t,e){switch(t.warcType){case"revisit":return this.parseRevisitRecord(t);case"resource":e=null;break;case"response":break;case"metadata":if(!this.shouldIndexMetadataRecord(t))return null;break;default:return null}const r=t.warcTargetURI.split("#")[0],i=t.warcDate;let n,s=200,o="OK",a=0,u="";if(t.httpHeaders){if(s=Number(t.httpHeaders.statusCode)||200,e&&"OPTIONS"===e.httpHeaders.method)return null;if(o=t.httpHeaders.statusText,n=Object(R.j)(t.httpHeaders.headers),u=(n.get("content-type")||"").split(";")[0],a=parseInt(n.get("content-length")||0),206===s){const t=n.get("content-range"),e=`bytes 0-${a-1}/${a}`;if(t&&t!==e)return null}if(s>300&&s<400){const t=n.get("location");if(t&&new URL(t,r).href===r)return null}}else n=new Headers,n.set("content-type",t.warcContentType),n.set("content-length",t.warcContentLength),u=t.warcContentType,a=t.warcContentLength;let h=null;if(e&&e.httpHeaders.headers)try{const t=new Headers(e.httpHeaders.headers).get("cookie");t&&n.set("x-wabac-preset-cookie",t),h=e.httpHeaders.headers.get("Referer")}catch(t){console.warn(t)}if(void 0===this.detectPages&&(this.detectPages=!this.anyPages),this.detectPages&&function(t,e,r){if(200!=e)return!1;if(!t.startsWith("http:")&&!t.startsWith("https:")&&!t.startsWith("blob:"))return!1;if(t.endsWith("/robots.txt"))return!1;const i=t.split("?",2);if(2===i.length&&i[1].length>i[0].length)return!1;if(i[0].substring(i[0].lastIndexOf("/")+1).startsWith("."))return!1;if(r&&"text/html"!==r)return!1;return!0}(r,s,u)){const t=r;this.addPage({url:r,date:i,title:t})}const c=new Date(i).getTime(),l=Object.fromEntries(n.entries()),d=t.warcPayloadDigest,f=t.payload,p={url:r,ts:c,status:s,mime:u,respHeaders:l,digest:d,payload:f,reader:f?null:t.reader,referrer:h};this.pageMap[c+"/"+r]&&f&&u.startsWith("text/")&&(this.pageMap[c+"/"+r].textPromise=async function(t,e,r,i){const n=new H.a,s=[];let o=null;n.on("text",(t,e)=>{if(o)return;const r=t.text.trim();r&&s.push(r)}),n.on("startTag",t=>{!t.selfClosing&&q.includes(t.tagName)&&(o=t.tagName)}),n.on("endTag",t=>{t.tagName===o&&(o=null)});const a=new z.PassThrough({encoding:"utf8"});(r||i)&&(e=await Object(G.a)(e,r,i)),a.push(e),a.push(null),a.pipe(n);const u=new Promise(t=>{n.on("end",()=>{t(s.join(" "))})});return await u}(0,f,n.get("content-encoding"),n.get("transfer-encoding")));const m=t.warcHeader("WARC-JSON-Metadata");if(m)try{p.extraOpts=JSON.parse(m)}catch(t){}const w=t.warcHeader("WARC-Page-ID");return w&&(p.pageId=w),p}filterRecord(t){return null}async load(t,e,r){this.db=t;const i=new W.d(this.reader);let n=0,s=0;try{for await(const t of i){if(!t.warcType){console.log("skip empty record");continue}if(self.interruptLoads&&this.loadId&&self.interruptLoads[this.loadId])throw e(Math.round(i.offset/r*95),"Loading Canceled",i.offset,r),self.interruptLoads[this.loadId](),this.abort&&this.abort.abort(),new R.b;s=(new Date).getTime(),s-n>500&&(e(Math.round(i.offset/r*95),null,i.offset,r),n=s);const o=this.filterRecord(t);if("done"===o){this.abort&&this.abort.abort();break}if("skip"!==o){"skipContent"===o?await t.skipFully():await t.readFully(),this.index(t,i);try{await Promise.all(this.promises)}catch(t){console.warn(t.toString())}this.promises=[]}}}catch(t){if(t instanceof R.b)throw t;e(Math.round(i.offset/r*95),`Sorry there was an error downloading. Please try again (${t})`,i.offset,r),console.warn(t)}return this.indexDone(),e(95),await this.finishIndexing(),e(100),this.metadata}async _finishLoad(){if(this.pages.length){for(const{page:t,textPromise:e}of Object.values(this.pageMap))if(e)try{t.text=await e}catch(t){console.warn("Error adding text: "+t.toString())}this.promises.push(this.db.addPages(this.pages))}this.lists.length&&this.promises.push(this.db.addCuratedPageLists(this.lists,"bookmarks","public"))}}class V extends Y{constructor(t){super(t),this.detectPages=!1}addPage(){}async load(){const t=await new W.d(this.reader).parse();if(!t)return null;const e=this.parseRecords(t,null);return e&&"revisit"!==t.warcType||await t.readFully(),e}}class K extends Y{filterRecord(t){if("warcinfo"!=t.warcType)return"done"}}const J="https://helper-proxy.webrecorder.workers.dev";function Z(t,e,r,i,n){if(t.startsWith("blob:"))return new tt(t,n,r);if(t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:"))return new Q(t,e,r);if(t.startsWith("googledrive:"))return new $(t,e,r,i);throw new Error("Invalid URL: "+t)}class Q{constructor(t,e,r=null,i=!1){this.url=t,this.headers=e||{},this.length=r,this.canLoadOnDemand=i,this.isValid=!1}async doInitialFetch(t){const e=new Headers(this.headers);e.set("Range","bytes=0-"),this.isValid=!1;let r=null,i=null;if(t)try{i=await fetch(this.url,{headers:e,method:"HEAD"}),200!==i.status&&206!=i.status||(this.canLoadOnDemand=206===i.status||"bytes"===i.headers.get("Accept-Ranges"),this.isValid=!0)}catch(t){}if(!this.isValid){r=new AbortController;const t=r.signal;i=await fetch(this.url,{headers:e,signal:t}),this.canLoadOnDemand=206===i.status||"bytes"===i.headers.get("Accept-Ranges"),this.isValid=206===i.status||200===i.status}if(null===this.length&&(this.length=Number(i.headers.get("Content-Length")),!this.length&&206===i.status)){let t=i.headers.get("Content-Range");t&&(t=t.split("/"),2===t.length&&(this.length=t[1]))}if(null===this.length)try{const t=await fetch(`${J}/c/${this.url}`),e=await t.json();e.size&&(this.length=e.size)}catch(t){console.log("Error fetching from helper: "+t.toString())}return this.length=Number(this.length||0),{response:i,abort:r}}async getLength(){if(null===this.length){const{response:t,abort:e}=await this.doInitialFetch(!0);e&&e.abort()}return this.length}async getRange(t,e,r=!1,i=null){const n=new Headers(this.headers);n.set("Range",`bytes=${t}-${t+e-1}`);const s={signal:i,headers:n};let o=null;try{o=await fetch(this.url,s)}catch(t){throw console.log(t),new RangeError(this.url)}if(206!=o.status)throw 401===o.status||403===o.status?new R.a(this.url,o.status):new RangeError(this.url,o.status);return r?o.body:new Uint8Array(await o.arrayBuffer())}}class ${constructor(t,e,r,i){this.fileId=t.slice("googledrive://".length),this.apiUrl=`https://www.googleapis.com/drive/v3/files/${this.fileId}?alt=media`,this.canLoadOnDemand=!0,this.headers=e,i&&i.publicUrl?this.publicUrl=i.publicUrl:this.publicUrl=null,this.length=r,this.isValid=!1}async getLength(){return this.length}async doInitialFetch(t){let e=null,r=null;if(this.publicUrl){e=new Q(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}if(!e.isValid&&(r&&r.abort&&r.abort.abort(),await this.refreshPublicUrl())){e=new Q(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}!e.isValid&&r&&r.abort&&r.abort.abort()}}return e&&e.isValid||(this.publicUrl=null,e=new Q(this.apiUrl,this.headers,this.length),r=await e.doInitialFetch(t)),this.isValid=e.isValid,this.length||(this.length=e.length),r}async getRange(t,e,r=!1,i){let n=null;if(this.publicUrl){n=new Q(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(s){if(await this.refreshPublicUrl()){n=new Q(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(t){}}}this.publicUrl=null}return n=new Q(this.apiUrl,this.headers,this.length),await n.getRange(t,e,r,i)}async refreshPublicUrl(){try{const t=await fetch(`${J}/g/${this.fileId}`),e=await t.json();if(e.url)return this.publicUrl=e.url,!0}catch(t){}return!1}}class tt{constructor(t,e=null,r=null){this.url=t,this.blob=e,this.size=this.blob?this.blob.size:r,this.canLoadOnDemand=!1}get length(){return this.size}get isValid(){return!!this.blob}async doInitialFetch(t){if(!this.blob){const t=await fetch(this.url);this.blob=await t.blob()}let e=null;return t||(e=this.blob.stream?this.blob.stream():await this.getReadableStream(this.blob)),{response:new Response(e),stream:e}}async getLength(){if(!this.blob&&!this.blob.size){let t=await fetch(this.url);this.blob=await t.blob(),this.size=this.blob.size}return this.size}async getRange(t,e,r=!1,i){if(!this.blob){const i=new Headers;i.set("Range",`bytes=${t}-${t+e-1}`);const n=await fetch(this.url,{headers:i});if(n.headers.get("content-range"))return r?n.body:new Uint8Array(await n.arrayBuffer());this.blob=await n.blob()}const n=this.blob.slice(t,t+e,"application/octet-stream");if(r)return n.stream?n.stream():await this.getReadableStream(n);try{const t=n.arrayBuffer?await n.arrayBuffer():await this.getArrayBuffer(n);return new Uint8Array(t)}catch(t){return console.log("error reading blob",t),null}}getArrayBuffer(t){return new Promise(e=>{let r=new FileReader;r.onloadend=()=>{e(r.result)},r.readAsArrayBuffer(t)})}async getReadableStream(t){const e=await this.getArrayBuffer(t);return new ReadableStream({start(t){t.enqueue(new Uint8Array(e)),t.close()}})}}class et extends U{constructor(t,e=!1){super(t),this.noCache=e,this.useRefCounts=!1}async loadRecordFromSource(t){const e=await this.loadSource(t.source),r=new V(e);return await r.load()}async loadPayload(t,e=0){let r=await super.loadPayload(t);if(r&&t.respHeaders&&"warc/revisit"!==t.mime)return r;const i=await this.loadRecordFromSource(t);if(!i)return console.log("No WARC Record Loaded for: "+t.url),null;if(i.url!==t.url)return console.log(`Wrong url: expected ${t.url}, got ${i.url}`),null;if(i.ts!==t.ts){if(1e3*Math.floor(i.ts/1e3)!==t.ts)return console.log(`Wrong timestamp: expected ${t.ts}, got ${i.ts}`),null}if(i.digest!==t.digest&&console.log(`Wrong digest: expected ${t.digest}, got ${i.digest}`),i.origURL){const n=await this.lookupUrl(i.origURL,i.origTS,{noRevisits:!0});return n&&(r||(e<2?r=await this.loadPayload(n,e+1):console.warn("Avoiding revisit lookup loop for: "+JSON.stringify(i)),r))?(t.respHeaders=n.respHeaders,t.mime=n.mime,n.extraOpts&&(t.extraOpts=n.extraOpts),this.noCache||(delete t.payload,await this.db.put("resources",t)),r):null}const n=i.digest;if(!this.noCache&&i.reader&&n&&(i.reader=new nt(this,i.reader,n,t.url)),r=i.payload,!r&&!i.reader)return null;try{r&&!this.noCache&&await this.commitPayload(r,n)}catch(e){console.warn("Payload Update Error: "+t.url),console.warn(e)}if(!(t.respHeaders&&t.digest||(t.respHeaders=i.respHeaders,t.digest=n,i.extraOpts&&(t.extraOpts=i.extraOpts),this.noCache)))try{await this.db.put("resources",t)}catch(e){console.warn("Resource Update Error: "+t.url),console.warn(e)}return r||i.reader}async commitPayload(t,e){if(!t||0===t.length)return;const r=this.db.transaction(["payload","digestRef"],"readwrite");try{if(r.objectStore("payload").put({payload:t,digest:e}),this.useRefCounts){const i=await r.objectStore("digestRef").get(e);i&&(i.size=t.length,r.objectStore("digestRef").put(i))}await r.done}catch(t){console.warn("Payload Commit Error: "+t)}}}class rt extends et{constructor(t,e,r=!1){super(t,r),this.loader=e}updateHeaders(t){this.loader.headers=t}async loadSource(t){const{start:e,length:r}=t;return await this.loader.getRange(e,r,!0)}}class it extends et{constructor(t,e,r,i=!1){super(t,i),this.remoteUrlPrefix=e,this.headers=r}updateHeaders(t){this.headers=t}async loadSource(t){const{start:e,length:r}=t,i=new Headers(this.headers),n=Z(new URL(t.path,this.remoteUrlPrefix).href,i);return await n.getRange(e,r,!0)}}class nt extends W.b{constructor(t,e,r,i=""){super(),this.db=t,this.reader=e,this.digest=r,this.url=i,this.chunks=[],this.size=0,this.fullbuff=null,this.commit=!0,this.alreadyRead=!1}setLimitSkip(t=-1,e=0){(-1!=t||e>0)&&(this.commit=!1),this.reader.setLimitSkip(t,e)}async*[Symbol.asyncIterator](){if(!this.alreadyRead){for await(const t of this.reader)this.chunks.push(t),this.size+=t.byteLength,yield t;this.fullbuff=W.b.concatChunks(this.chunks,this.size),0!==this.reader.limit?console.warn(`Expected payload not consumed, ${this.reader.limit} bytes left`):this.commit&&await this.db.commitPayload(this.fullbuff,this.digest),this.chunks=[],this.alreadyRead=!0}}async readFully(){for await(const t of this);return this.fullbuff}}class st extends Y{constructor(t,e,r){super(t,e,r),this.cdxindexer=null}filterRecord(t){switch(t.warcType){case"warcinfo":case"revisit":return null;case"request":return"skipContent";case"metadata":return this.shouldIndexMetadataRecord(t)?null:"skipContent"}const e=t.warcTargetURI,r=new Date(t.warcDate).getTime();if(this.pageMap[r+"/"+e])return t._isPage=!0,null}index(t,e){if(t._isPage)return super.index(t,e);if("warcinfo"===t.warcType)return void this.parseWarcInfo(t);this.cdxindexer||(this.cdxindexer=new W.c({},null));const r=this.cdxindexer.indexRecord(t,e,"");r&&this.addCdx(r)}addCdx(t){const{url:e,mime:r}=t,i=Number(t.status)||200,n=Object(R.m)(t.timestamp).getTime(),s={path:t.filename,start:Number(t.offset),length:Number(t.length)};let{digest:o}=t;o&&-1===o.indexOf(":")&&(o="sha1:"+o);const a={url:e,ts:n,status:i,digest:o,mime:r,loaded:!1,source:s};this.batch.length>=3e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=3e3} records`)),this.batch.push(a)}}class ot extends st{async load(t){this.db=t;let e=this.reader;e.iterLines||(e=new W.a(this.reader));for await(const t of e.iterLines()){let e,r,i,n=t.trimEnd();if(!n.startsWith("{")){const t=n.indexOf(" {");if(t<0)continue;[r,i]=n.split(" ",2),n=n.slice(t)}try{e=JSON.parse(n)}catch(t){console.log("JSON Parser error on: "+n);continue}e.timestamp=i,e.url||(e.url=r),this.addCdx(e)}this.indexDone(),await this.finishIndexing()}}const at=/(?:([\d]+)[^\/]*\/)?(http.*)/;class ut{constructor(t){this.sourceUrl=t.sourceUrl,this.type=t.extraConfig&&t.extraConfig.sourceType||"kiwix",this.notFoundPageUrl=t.extraConfig&&t.extraConfig.notFoundPageUrl}async getAllPages(){return[]}async getResource(t,e,r){const{url:i,headers:n}=lt(t,e);let s=n;if("kiwix"===this.type){const e=await this.resolveHeaders(i);if(!e){if(this.notFoundPageUrl&&"navigate"===t.request.mode){const t=await fetch(this.notFoundPageUrl);if(200===t.status){const e={"Content-Type":"text/html"},r=await t.text();return new Response(r.replace("$URL",i),{status:404,headers:e})}}return null}let{headers:r,encodedUrl:n,date:o,status:a,statusText:u,hasPayload:h}=e;if(s.has("Range")){const t=s.get("Range");s={Range:t}}let c=null,l=null;h&&(l=await fetch(this.sourceUrl+"A/"+n,{headers:s}),l.body&&(c=new W.a(l.body.getReader(),!1)),206===l.status&&(a=206,u="Partial Content",r.set("Content-Length",l.headers.get("Content-Length")),r.set("Content-Range",l.headers.get("Content-Range")),r.set("Accept-Ranges","bytes"))),c||(c=new Uint8Array([])),o||(o=new Date),r||(r=new Headers);const d=!1,f=!1;return new L.a({payload:c,status:a,statusText:u,headers:r,url:i,date:o,noRW:f,isLive:d})}}async resolveHeaders(t){const e=t.slice(t.indexOf("//")+2);let r=encodeURI(e);r=encodeURIComponent(e);let i=await fetch(this.sourceUrl+"H/"+r);if(200!==i.status)return null;let n=null,s=null,o=null,a=null,u=!1;try{const e=await W.d.parse(i.body);if("revisit"===e.warcType){const r=e.warcHeaders.headers.get("WARC-Refers-To-Target-URI");if(r&&r!==t)return await this.resolveHeaders(r)}s=new Date(e.warcDate),e.httpHeaders?(n=e.httpHeaders.headers,o=Number(e.httpHeaders.statusCode),a=e.httpHeaders.statusText,u="0"!==e.httpHeaders.headers.get("Content-Length")):"resource"===e.warcType&&(n=new Headers,n.set("Content-Type",e.warcContentType),n.set("Content-Length",e.warcContentLength),o=200,a="OK",u=e.warcContentLength>0),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:u}}}class ht{constructor(t){this.replayPrefix=t.replayPrefix,this.idMod=void 0!==t.idMod?t.idMod:"id_",this.redirMod=void 0!==t.redirMod?t.redirMod:"mp_",this.redirectMode=this.idMod===this.redirMod?"follow":"manual"}async getAllPages(){return[]}getUrl(t,e){let r=this.replayPrefix;return(e||t.timestamp)&&(r+=t.timestamp+e+"/"),r+t.url}async getResource(t,e,r){let i=await fetch(this.getUrl(t,this.idMod),{credentials:"same-origin",redirect:this.redirectMode,mode:"cors"});if(i.status>=400&&!i.headers.get("memento-datetime"))return null;const n=await this.getRedirect(t,i,e);let s=null,o=!1;n?(i=Response.redirect(n.path,307),o=!0,s=n.timestamp):s=t.timestamp;const a=t.url,u=s?Object(R.m)(s):new Date;return L.a.fromResponse({url:a,response:i,date:u,noRW:o})}async getRedirect(t,e,r){if("opaqueredirect"===e.type)e=await fetch(this.getUrl(t,this.redirMod),{credentials:"same-origin",redirect:"follow",mode:"cors"});else if(!e.redirected)return null;const i=e.url.indexOf(this.replayPrefix)+this.replayPrefix.length,n=e.url.slice(i),s=n.match(at);return s?{timestamp:s[1],path:r+s[1]+"mp_/"+s[2]}:{path:r+n}}}class ct{constructor(t,e=!1,r=!0){this.prefix=t||"",this.proxyPathOnly=e,this.isLive=r}async getAllPages(){return[]}async getResource(t,e,r){const{headers:i,credentials:n,url:s}=lt(t,e);let o;if(this.proxyPathOnly){const t=new URL(s);o=this.prefix+t.pathname+t.search}else o=this.prefix+s;const a=await fetch(o,{method:t.request.method,body:t.request.body,headers:i,credentials:n,mode:"cors",redirect:"follow"});return L.a.fromResponse({url:s,response:a,date:new Date,noRW:!1,isLive:this.isLive})}}function lt(t,e,r=!0){let i,n,s;if(r){i=new Headers(t.request.headers),n=t.request.referrer;const r=n.indexOf("/http",e.length-1);r>0&&(n=n.slice(r+1),i.set("X-Proxy-Referer",n)),s=t.request.credentials}else i=new Headers,s="omit";let o=t.url;if(o.startsWith("//"))try{o=new URL(n).protocol+o}catch(t){o="https:"+o}return{referrer:n,headers:i,credentials:s,url:o}}var dt=r(31),ft=r.n(dt),pt=r(40);class mt extends rt{constructor(t,e,r=null,i=!1,n){super(t,e,i),this.zipreader=new wt(e),this.externalSources=[],this.fuzzyUrlRules=[],this.useSurt=!0,this.fullConfig=n,this.textIndex=n&&n.metadata&&n.metadata.textIndex,e.canLoadOnDemand=!0,r&&this.initConfig(r)}_initDB(t,e,r,i){if(super._initDB(t,e,r,i),!e){t.createObjectStore("ziplines",{keyPath:"prefix"}),t.createObjectStore("zipEntries",{keyPath:"filename"})}}async init(){await super.init(),await this.loadZipEntries()}async close(){super.close(),caches.delete("cache:"+this.name.slice("db:".length))}async clearZipData(){const t=["zipEntries","ziplines"];for(const e of t)await this.db.clear(e)}async clearAll(){await super.clearAll(),await this.clearZipData()}updateHeaders(t){this.zipreader.loader.headers=t}async loadZipEntries(){const t=await this.db.getAll("zipEntries");if(!t.length)return;const e={};for(const r of t)e[r.filename]=r;this.zipreader.entries=e}async saveZipEntries(t){const e=this.db.transaction("zipEntries","readwrite");e.store.clear();for(const r of Object.values(t))e.store.put(r);await e.done,this.db.clear("ziplines")}async loadZiplinesIndex(t,e,r){let i=0,n=0,s=0,o=[],a="";for await(const u of t.iterLines()){if(i+=u.length,i===u.length&&u.startsWith("!meta")){const t=u.indexOf(" {");if(t<0){console.warn("Invalid Meta Line: "+u);continue}const e=JSON.parse(u.slice(t));e.filename&&(a=e.filename),"cdxj-gzip-1.0"!==e.format&&console.log(`Unknown CDXJ format "${e.format}", archive may not parse correctly`);continue}let t;if(u.indexOf("\t")>0){let[e,r,i,n]=u.split("\t");i=Number(i),n=Number(n),t={prefix:e,filename:r,offset:i,length:n,loaded:!1},this.useSurt=!0}else{const e=u.indexOf(" {");if(e<0){console.log("Invalid Index Line: "+u);continue}const r=u.slice(0,e);let{offset:i,length:n,filename:s}=JSON.parse(u.slice(e));s=s||a,t={prefix:r,filename:s,offset:i,length:n,loaded:!1}}s=(new Date).getTime(),s-n>500&&(e(Math.round(i/r*100),null,i,r),n=s),o.push(t)}const u=this.db.transaction("ziplines","readwrite");for(const t of o)u.store.put(t);try{await u.done}catch(t){console.log("Error loading ziplines index: ",t)}}async load(t,e,r){if(t!==this)return void console.error("wrong db");const i=await t.zipreader.load(!0);await t.saveZipEntries(i);const n=[];let s;i["webarchive.yaml"]&&(s=await this.loadMetadata(i,await t.zipreader.loadFile("webarchive.yaml")));for(const r of Object.keys(i))if(r.endsWith(".cdx")||r.endsWith(".cdxj")){console.log("Loading CDX "+r);const e=await t.zipreader.loadFile(r);n.push(new ot(e).load(t))}else if(r.endsWith(".idx")){if(this.loader.canLoadOnDemand){console.log("Loading IDX "+r);const i=t.zipreader.getCompressedSize(r);n.push(t.loadZiplinesIndex(await t.zipreader.loadFile(r),e,i))}}else if(r.endsWith(".warc.gz")||r.endsWith(".warc"))if(!s&&this.loader.canLoadOnDemand){const i=new AbortController,n=await t.zipreader.loadFile(r,{signal:i.signal,unzip:!0}),o=new K(n,i),a=t.zipreader.getCompressedSize(r);s=await o.load(t,e,a)}else if(!this.loader.canLoadOnDemand){const i=await t.zipreader.loadFile(r,{unzip:!0}),n=new Y(i);n.detectPages=!1;const o=t.zipreader.getCompressedSize(r);s=await n.load(t,e,o)}return await Promise.all(n),s||{}}async loadPagesCSV(t){const e=(new TextDecoder).decode(await t.readFully()),r=await Object(pt.csv2jsonAsync)(e);r&&r.length&&await this.addPages(r)}initConfig(t){if(void 0!==t.decodeResponses&&(this.fullConfig.decode=t.decodeResponses),void 0!==t.useSurt&&(this.useSurt=t.useSurt),t.es)for(const[e,r]of t.es){const t=new ct(r,!0,!1);this.externalSources.push({prefix:e,external:t})}if(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)}async getTextIndex(){const t={"Content-Type":"application/ndjson"};if(!this.textIndex)return new Response("",{headers:t});const e=this.zipreader.getCompressedSize(this.textIndex);e>0&&(t["Content-Length"]=""+e);const r=await this.zipreader.loadFile(this.textIndex,{unzip:!0});return new Response(r.getReadableStream(),{headers:t})}async loadMetadata(t,e){const r=(new TextDecoder).decode(await e.readFully()),i=ft.a.safeLoad(r);void 0!==i.config&&this.initConfig(i.config);const n={desc:i.desc,title:i.title};i.textIndex&&(n.textIndex=i.textIndex);const s=i.pages||[];s&&s.length?await this.addPages(s):t["pages.csv"]&&await this.loadPagesCSV(await this.zipreader.loadFile("pages.csv"));const o=i.pageLists||[];return o&&o.length&&await this.addCuratedPageLists(o,"pages","show"),n}async loadRecordFromSource(t){let e,r=0,i=-1;const n=t.source;if("string"==typeof n)e=n;else{if("object"!=typeof n)return null;r=n.start,i=n.length,e=n.path}let s=null;const o=await this.zipreader.loadFileCheckDirs(e,r,i);return s=new V(o),await s.load()}getSurt(t){try{t=t.replace(/www\d*\./,"");const e=new URL(t);let r=e.hostname.split(".").reverse().join(",");return e.port&&(r+=":"+e.port),r+=")",r+=e.pathname,e.search&&(e.searchParams.sort(),r+=e.search),r.toLowerCase()}catch(e){return t}}async loadFromZiplines(t,e){e&&Object(R.f)(new Date(e).toISOString());let r,i;const n=this.useSurt?this.getSurt(t):t;r=n+" 9",i=n;const s=this.db.transaction("ziplines","readonly"),o=[],a=IDBKeyRange.upperBound(r,!1);for await(const t of s.store.iterate(a,"prev"))if(o.unshift(t.value),!t.value.prefix.split(" ")[0].startsWith(i))break;await s.done;const u=[];for(const t of o){if(t.loaded)continue;const e="indexes/"+t.filename,r={offset:t.offset,length:t.length,unzip:!0},i=await this.zipreader.loadFile(e,r);u.push(new ot(i).load(this)),t.loaded=!0,await this.db.put("ziplines",t)}return await Promise.all(u),u.length>0}async getResource(t,e,r){if(this.externalSources.length)for(const{prefix:i,external:n}of this.externalSources)if(t.url.startsWith(i))try{return await n.getResource(t,e,r)}catch(t){console.warn("Upstream Error",t)}let i=await super.getResource(t,e,r);if(i)return i;if(this.fuzzyUrlRules.length)for(const{match:n,replace:s}of this.fuzzyUrlRules){const o=t.url.replace(n,s);if(o&&o!==t.url&&(t.url=o,i=await super.getResource(t,e,r),i))return i}return null}async lookupUrl(t,e,r={}){try{let i=await super.lookupUrl(t,e,r);return!i||r.noRevisits&&"warc/revisit"===i.mime?(await this.loadFromZiplines(t,e)&&(i=await super.lookupUrl(t,e,r)),i):i}catch(t){return console.warn(t),null}}async resourcesByUrlAndMime(t,...e){let r=await super.resourcesByUrlAndMime(t,...e);return r.length>0||await this.loadFromZiplines(t,"")&&(r=await super.resourcesByUrlAndMime(t,...e)),r}}class wt{constructor(t,e=null){this.loader=t,this.entries=e}async load(t=!1){if(!this.entries||t){const t=await this.loader.getLength(),e=Math.min(65558,t),r=t-e,i=await this.loader.getRange(r,e);this.entries=this._loadEntries(i,r)}return this.entries}_loadEntries(t,e){const r=t.byteLength,i=new DataView(t.buffer),n=new TextDecoder("utf8"),s=new TextDecoder("ascii"),o={};let a=0,u=0,h=r;for(let e=r-22,n=Math.max(0,e-65535);e>=n;--e)if(80===t[e]&&75===t[e+1]&&5===t[e+2]&&6===t[e+3]){h=e,u=i.getUint32(e+16,!0),a=i.getUint16(e+8,!0);break}if(4294967295===u||65535===a){if(117853008!==i.getUint32(h-20,!0))return void console.warn("invalid zip64 EOCD locator");const t=this.getUint64(i,h-12,!0)-e;if(101075792!==i.getUint32(t,!0))return void console.warn("invalid zip64 EOCD record");a=this.getUint64(i,t+32,!0),u=this.getUint64(i,t+48,!0)}if(e&&(u-=e),u>=r||u<=0)for(u=-1,a=65535;++u=0&&u=8&&(a=this.getUint64(i,t,!0),t+=8,n-=8),4294967295===r&&n>=8&&(r=this.getUint64(i,t,!0),t+=8,n-=8),4294967295===f&&n>=8&&(f=this.getUint64(i,t,!0),t+=8,n-=8)),t+=n}}p.endsWith("/")||(o[p]={filename:p,deflate:d,uncompressedSize:a,compressedSize:r,localEntryOffset:f}),u+=46+h+c+l}return o}async loadFileCheckDirs(t,e,r){if(null===this.entries&&await this.load(),this.entries["archive/"+t])t="archive/"+t;else if(this.entries["warcs/"+t])t="warcs/"+t;else for(const e of Object.keys(this.entries))if(e.endsWith("/"+t)){t=e;break}return await this.loadFile(t,{offset:e,length:r,unzip:!0})}getCompressedSize(t){if(null===this.entries)return-1;const e=this.entries[t];return e?e.compressedSize:-1}async loadFile(t,{offset:e=0,length:r=-1,signal:i=null,unzip:n=!1}={}){null===this.entries&&await this.load();const s=this.entries[t];if(!s)return null;if(void 0===s.offset){const t=await this.loader.getRange(s.localEntryOffset,30),e=new DataView(t.buffer),r=e.getUint16(26,!0),i=e.getUint16(28,!0);s.offset=30+r+i+s.localEntryOffset}r=r<0?s.compressedSize:Math.min(r,s.compressedSize-e),e+=s.offset;const o=await this.loader.getRange(e,r,!0,i);return n?s.deflate?new W.a(new W.a(o.getReader(),"deflate")):new W.a(o.getReader()):new W.a(o.getReader(),s.deflate?"deflate":null)}getUint64(t,e,r){const i=t.getUint32(e,r),n=t.getUint32(e+4,r),s=r?i+2**32*n:2**32*i+n;return Number.isSafeInteger(s)||console.warn(s,"exceeds MAX_SAFE_INTEGER. Precision may be lost"),s}}class gt extends X.a{constructor(t){super(),this.har=t,this.pageRefs={}}async load(t){return this.db=t,"string"==typeof this.har&&(this.har=JSON.parse(this.har)),this.parseEntries(this.har),this.parsePages(this.har),await this.finishIndexing(),{}}parsePages(t){for(const e of t.log.pages){if(!e.pageTimings||!e.pageTimings.onLoad)continue;let t;t=e.title&&(e.title.startsWith("http:")||e.title.startsWith("https:"))?e.title:this.pageRefs[e.id];const r=e.title||t,i=e.startedDateTime;this.addPage({url:t,date:i,title:r})}}parseEntries(t){for(const e of t.log.entries){if(!e.response.content||!e.response.content.text){console.log("Skipping: "+e.request.url);continue}let t=null;try{t=Uint8Array.from(atob(e.response.content.text),t=>t.charCodeAt(0))}catch(r){t=e.response.content.text}console.log("Added: "+e.request.url);const r=new Date(e.startedDateTime).getTime(),i={};for(const{name:t,value:r}of e.response.headers)i[t]=r;this.addResource({url:e.request.url,ts:r,status:e.response.status,respHeaders:i,payload:t}),e.pageref&&!this.pageRefs[e.pageref]&&(this.pageRefs[e.pageref]=e.request.url)}}}var yt=r(118);self.interruptLoads={};class _t{constructor(){this.colldb=null,this.root=null,this._init_db=this._initDB()}async _initDB(){this.colldb=await g("collDB",1,{upgrade:(t,e,r,i)=>{t.createObjectStore("colls",{keyPath:"name"})}})}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 deleteColl(t){await this._init_db;const e=await this.colldb.get("colls",t);if(!e)return!1;e.config.dbname&&await y(e.config.dbname,{blocked(t){console.log(`Unable to delete ${e.config.dbname}: ${t}`)}}),await this.colldb.delete("colls",t)}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);if(!r)return!1;const i=r.config.metadata||{};return Object.assign(i,e),await this.colldb.put("colls",r),i}async updateSize(t,e,r){await this._init_db;const i=await this.colldb.get("colls",t);if(!i)return!1;i.config.loadSize=(i.config.loadSize||0)+e,i.config.dedupSize=(i.config.dedupSize||0)+r,await this.colldb.put("colls",i)}async _initColl(t){let e=null,r=null;switch(t.type){case"archive":e=new U(t.config.dbname);break;case"remotesource":r=Z(t.config.loadUrl,t.config.headers,t.config.size,t.config.extra),e=new rt(t.config.dbname,r,t.config.noCache);break;case"remoteprefix":e=new it(t.config.dbname,t.config.remotePrefix,t.config.headers,t.config.noCache);break;case"remotezip":r=Z(t.config.loadUrl||t.config.sourceUrl,t.config.headers,t.config.extra),e=new mt(t.config.dbname,r,t.config.extraConfig,t.config.noCache,t.config);break;case"remoteproxy":e=new ht(t.config);break;case"remotewarcproxy":e=new ut(t.config);break;case"live":e=new ct(t.config.prefix,t.config.proxyPathOnly,t.config.isLive)}if(!e)return console.log("no store found: "+t.type),null;e.initing&&await e.initing;const i=t.name,n=t.config;return t.config.root&&(this.root=i),this._createCollection({name:i,store:e,config:n})}_createCollection(t){return t}}class bt extends _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=>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)=>{e.postMessage({msg_type:"collProgress",name:r,percent:t,error:i,currentSize:n,totalSize:s})};let n;try{if(await this.hasCollection(r)?t.data.skipExisting?n=!0:(await this.deleteCollection(r),n=await this.addCollection(t.data,i)):n=await this.addCollection(t.data,i),!n)return}catch(t){return console.warn(t),void i(0,"An unexpected error occured: "+t.toString())}e.postMessage({msg_type:"collAdded",name:r});break}case"cancelLoad":{const e=t.data.name,r=new Promise(t=>self.interruptLoads[e]=t);await r,await this.deleteCollection(e),delete self.interruptLoads[e];break}case"removeColl":{const r=t.data.name;await this.hasCollection(r)&&(await this.deleteCollection(r),this.doListAll(e));break}case"listAll":this.doListAll(e)}}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){const r=t.name;let i=null,n={root:t.root||!1},s=null;const o=t.file;if(!o||!o.sourceUrl)return e(0,"Invalid Load Request"),!1;if(o.sourceUrl.startsWith("proxy:"))n.sourceUrl=o.sourceUrl.slice("proxy:".length),n.extraConfig=t.extraConfig,n.topTemplateUrl=t.topTemplateUrl,i="remotewarcproxy";else{let a=null;i="archive",n.dbname="db:"+r;let u=o.loadUrl||o.sourceUrl;u.match(/[\w]+:\/\//)||(u=new URL(u,self.location.href).href),n.decode=!0,n.onDemand=!1,n.loadUrl=u,n.sourceUrl=o.sourceUrl,n.sourceName=o.name||o.sourceUrl;try{n.sourceName.match(/https?:\/\//)&&(n.sourceName=new URL(n.sourceName).pathname)}catch(t){}n.sourceName=n.sourceName.slice(n.sourceName.lastIndexOf("/")+1),n.headers=o.headers,n.size="number"==typeof o.size?o.size:null,n.extra=o.extra,n.extraConfig=t.extraConfig,n.noCache=u.startsWith("file:")||o.noCache;const h=Z(u,o.headers,o.size,n.extra,o.blob);let c=!1;(n.sourceName.endsWith(".wacz")||n.sourceName.endsWith(".zip"))&&(s=new mt(n.dbname,h,n.extraConfig,n.noCache,n),i="remotezip",a=s,c=!0);let{abort:l,response:d,stream:f}=await h.doInitialFetch(c);if(f=f||d.body,!h.isValid){const t=h.length<=1e3?await d.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: ${d.status} ${d.statusText}\nError Details:\n${t}`),l&&l.abort(),!1}if(!h.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."),l&&l.abort(),!1;const p=h.length;if(n.sourceName.endsWith(".warc")||n.sourceName.endsWith(".warc.gz")?p<25e6||!h.canLoadOnDemand?a=new Y(f,l,r):(a=new st(f,l,r),i="remotesource",s=new rt(n.dbname,h,n.noCache)):n.sourceName.endsWith(".cdxj")||n.sourceName.endsWith(".cdx")?(n.remotePrefix=t.remotePrefix||u.slice(0,u.lastIndexOf("/")+1),a=new ot(f,l,r),i="remoteprefix",s=new it(n.dbname,n.remotePrefix,n.headers,n.noCache)):n.sourceName.endsWith(".wbn")?(a=new yt.a(await d.arrayBuffer()),n.decode=!1):n.sourceName.endsWith(".har")&&(a=new gt(await d.json()),n.decode=!1),!a)return e(0,`The ${n.sourceName} is not a known archive format that could be loaded.`),l&&l.abort(),!1;s||(s=new U(n.dbname)),await s.initing,n.onDemand=h.canLoadOnDemand;try{n.metadata=await a.load(s,e,p)}catch(t){return t instanceof R.b||e(0,"Unexpected Loading Error: "+t.toString()),!1}n.metadata.size||(n.metadata.size=p)}n.ctime=(new Date).getTime();const a={name:r,type:i,config:n};return await this.colldb.add("colls",a),!0}async deleteCollection(t){const e="db:"+t;try{await y(e,{blocked(t){console.log("Unable to delete: "+t)}})}catch(t){return console.warn(t),!1}return await this.colldb.delete("colls",t),!0}}},,,,,function(t,e,r){"use strict";const i=r(161),n=r(34),s=r(34),o=r(7).buildOptions,a=r(163);e.parse=function(t,e,r){if(r){!0===r&&(r={});const e=a.validate(t,r);if(!0!==e)throw Error(e.err.msg)}e=o(e,s.defaultOptions,s.props);const u=n.getTraversalObj(t,e);return i.convertToJson(u,e)},e.convertTonimn=r(164).convert2nimn,e.getTraversalObj=n.getTraversalObj,e.convertToJson=i.convertToJson,e.convertToJsonString=r(165).convertToJsonString,e.validate=a.validate,e.j2xParser=r(166),e.parseToNimn=function(t,r,i){return e.convertTonimn(e.getTraversalObj(t,i),r,i)}},,,,,function(t,e,r){"use strict";(function(e,i){var n=r(32);t.exports=_;var s,o=r(69);_.ReadableState=y;r(41).EventEmitter;var a=function(t,e){return t.listeners(e).length},u=r(70),h=r(43).Buffer,c=e.Uint8Array||function(){};var l=Object.create(r(22));l.inherits=r(13);var d=r(126),f=void 0;f=d&&d.debuglog?d.debuglog("stream"):function(){};var p,m=r(127),w=r(72);l.inherits(_,u);var g=["error","close","destroy","pause","resume"];function y(t,e){t=t||{};var i=e instanceof(s=s||r(10));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,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.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(74).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function _(t){if(s=s||r(10),!(this instanceof _))return new _(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function b(t,e,r,i,n){var s,o=t._readableState;null===e?(o.reading=!1,function(t,e){if(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,A(t)}(t,o)):(n||(s=function(t,e){var r;i=e,h.isBuffer(i)||i instanceof c||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(o,e)),s?t.emit("error",s):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):E(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?E(t,o,e,!1):x(t,o)):E(t,o,e,!1))):i||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(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 A(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(T,t):T(t))}function T(t){f("emit readable"),t.emit("readable"),k(t)}function x(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(S,t,e))}function S(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;ts.length?s.length:t;if(o===s.length?n+=s:n+=s.slice(0,t),0===(t-=o)){o===s.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=h.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var s=i.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(o));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(N,e,t))}function N(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function O(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):A(this),null;if(0===(t=v(t,e))&&e.ended)return 0===e.length&&I(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?R(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&I(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(t,e){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,f("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?c:_;function h(e,i){f("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",w),t.removeListener("unpipe",h),r.removeListener("end",c),r.removeListener("end",_),r.removeListener("data",m),d=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function c(){f("onend"),t.end()}s.endEmitted?n.nextTick(u):r.once("end",u),t.on("unpipe",h);var l=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,k(t))}}(r);t.on("drain",l);var d=!1;var p=!1;function m(e){f("ondata"),p=!1,!1!==t.write(e)||p||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==O(s.pipes,t))&&!d&&(f("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function w(e){f("onerror",e),_(),t.removeListener("error",w),0===a(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",y),_()}function y(){f("onfinish"),t.removeListener("close",g),_()}function _(){f("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",w),t.once("close",g),t.once("finish",y),t.emit("pipe",r),s.flowing||(f("pipe resume"),r.resume()),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?o-4:o;for(r=0;r>16&255,u[c++]=e>>8&255,u[c++]=255&e;2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[c++]=255&e);1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,s=[],o=0,a=r-n;oa?a:o+16383));1===n?(e=t[r-1],s.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],s.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var n,s,o=[],a=e;a>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e,r){"use strict";var i=r(32);function n(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||i.nextTick(n,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(i.nextTick(n,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),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.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,r){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function s(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new s(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new s(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(129),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(6))},function(t,e,r){"use strict";var i=r(131).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=h,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=l,e=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";t.exports=o;var i=r(10),n=Object.create(r(22));function s(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length(Object.keys(e).forEach(r=>{t[r]=e[r]}),t),Object.create(null))}},function(t,e,r){var i=r(79).BrotliInput,n=r(79).BrotliOutput,s=r(147),o=r(80),a=r(81).HuffmanCode,u=r(81).BrotliBuildHuffmanTable,h=r(150),c=r(151),l=r(152),d=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),f=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),p=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),m=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function w(t){var e;return 0===t.readBits(1)?16:(e=t.readBits(3))>0?17+e:(e=t.readBits(3))>0?8+e:17}function g(t){if(t.readBits(1)){var e=t.readBits(3);return 0===e?1:t.readBits(e)+(1<1&&0===s)throw new Error("Invalid size byte");n.meta_block_length|=s<<8*i}}else for(i=0;i4&&0===o)throw new Error("Invalid size nibble");n.meta_block_length|=o<<4*i}return++n.meta_block_length,n.input_end||n.is_metadata||(n.is_uncompressed=t.readBits(1)),n}function b(t,e,r){var i;return r.fillBitWindow(),(i=t[e+=r.val_>>>r.bit_pos_&255].bits-8)>0&&(r.bit_pos_+=8,e+=t[e].value,e+=r.val_>>>r.bit_pos_&(1<>=1,++c;for(p=0;p0;++p){var _,b=d[p],E=0;i.fillBitWindow(),E+=i.val_>>>i.bit_pos_&15,i.bit_pos_+=y[E].bits,_=y[E].value,m[b]=_,0!==_&&(w-=32>>_,++g)}if(1!==g&&0!==w)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function(t,e,r,i){for(var n=0,s=8,o=0,h=0,c=32768,l=[],d=0;d<32;d++)l.push(new a(0,0));for(u(l,0,5,t,18);n0;){var f,p=0;if(i.readMoreInput(),i.fillBitWindow(),p+=i.val_>>>i.bit_pos_&31,i.bit_pos_+=l[p].bits,(f=255&l[p].value)<16)o=0,r[n++]=f,0!==f&&(s=f,c-=32768>>f);else{var m,w,g=f-14,y=0;if(16===f&&(y=s),h!==y&&(o=0,h=y),m=o,o>0&&(o-=2,o<<=g),n+(w=(o+=i.readBits(g)+3)-m)>e)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var _=0;_>>5]),this.htrees=new Uint32Array(e)}function S(t,e){var r,i,n={num_htrees:null,context_map:null},s=0;e.readMoreInput();var o=n.num_htrees=g(e)+1,u=n.context_map=new Uint8Array(t);if(o<=1)return n;for(e.readBits(1)&&(s=e.readBits(4)+1),r=[],i=0;i<1080;i++)r[i]=new a(0,0);for(E(o+s,r,0,e),i=0;i=t)throw new Error("[DecodeContextMap] i >= context_map_size");u[i]=0,++i}else u[i]=h-s,++i}return e.readBits(1)&&function(t,e){var r,i=new Uint8Array(256);for(r=0;r<256;++r)i[r]=r;for(r=0;r=t&&(a-=t),i[r]=a,n[u+(1&s[h])]=a,++s[h]}function D(t,e,r,i,n,o){var a,u=n+1,h=r&n,c=o.pos_&s.IBUF_MASK;if(e<8||o.bit_pos_+(e<<3)0;)o.readMoreInput(),i[h++]=o.readBits(8),h===u&&(t.write(i,u),h=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)i[h]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++h,--e;if(c+(a=o.bit_end_pos_-o.bit_pos_>>3)>s.IBUF_MASK){for(var l=s.IBUF_MASK+1-c,d=0;d=u){t.write(i,u),h-=u;for(d=0;d=u;){if(a=u-h,o.input_.read(i,h,a)e.buffer.length){var lt=new Uint8Array(R+Z);lt.set(e.buffer),e.buffer=lt}if(I=ct.input_end,W=ct.is_uncompressed,ct.is_metadata)for(k(T);Z>0;--Z)T.readMoreInput(),T.readBits(8);else if(0!==Z)if(W)T.bit_pos_=T.bit_pos_+7&-8,D(e,Z,R,f,d,T),R+=Z;else{for(r=0;r<3;++r)tt[r]=g(T)+1,tt[r]>=2&&(E(tt[r]+2,m,1080*r,T),E(26,y,1080*r,T),Q[r]=v(y,1080*r,T),rt[r]=1);for(T.readMoreInput(),z=(1<<(j=T.readBits(2)))-1,G=(H=16+(T.readBits(4)<0;){var pt,mt,wt,gt,yt,_t,bt,Et,vt,At,Tt,xt;for(T.readMoreInput(),0===Q[1]&&(C(tt[1],m,1,$,et,rt,T),Q[1]=v(y,1080,T),J=L[1].htrees[$[1]]),--Q[1],(mt=(pt=b(L[1].codes,J,T))>>6)>=2?(mt-=2,bt=-1):bt=0,wt=c.kInsertRangeLut[mt]+(pt>>3&7),gt=c.kCopyRangeLut[mt]+(7&pt),yt=c.kInsertLengthPrefixCode[wt].offset+T.readBits(c.kInsertLengthPrefixCode[wt].nbits),_t=c.kCopyLengthPrefixCode[gt].offset+T.readBits(c.kCopyLengthPrefixCode[gt].nbits),P=f[R-1&d],B=f[R-2&d],vt=0;vt4?3:_t-2))],(bt=b(L[2].codes,L[2].htrees[at],T))>=H)xt=(bt-=H)&z,bt=H+((St=(2+(1&(bt>>=j))<<(Tt=1+(bt>>1)))-4)+T.readBits(Tt)<(N=R=o.minDictionaryWordLength&&_t<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+R+" distance: "+Et+" len: "+_t+" bytes left: "+Z);var St=o.offsetsByLength[_t],Ct=Et-N-1,Dt=o.sizeBitsByLength[_t],kt=Ct>>Dt;if(St+=(Ct&(1<=p){e.write(f,u);for(var It=0;It0&&(O[3&F]=Et,++F),_t>Z)throw new Error("Invalid backward reference. pos: "+R+" distance: "+Et+" len: "+_t+" bytes left: "+Z);for(vt=0;vt<_t;++vt)f[R&d]=f[R-Et&d],(R&d)===d&&e.write(f,u),++R,--Z}P=f[R-1&d],B=f[R-2&d]}R&=1073741823}}e.write(f,R&d)}x.prototype.decode=function(t){var e,r=0;for(e=0;ethis.buffer.length&&(r=this.buffer.length-this.pos);for(var i=0;ithis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(t.subarray(0,e),this.pos),this.pos+=e,e},e.BrotliOutput=i},function(t,e,r){var i=r(148);e.init=function(){e.dictionary=i.init()},e.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),e.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),e.minDictionaryWordLength=4,e.maxDictionaryWordLength=24},function(t,e){function r(t,e){this.bits=t,this.value=e}e.HuffmanCode=r;function i(t,e){for(var r=1<>=1;return(t&r-1)+r}function n(t,e,i,n,s){do{t[e+(n-=i)]=new r(s.bits,s.value)}while(n>0)}function s(t,e,r){for(var i=1<0;--b[h])n(t,e+l,d,w,new r(255&h,65535&y[c++])),l=i(l,h);for(p=g-1,f=-1,h=o+1,d=2;h<=15;++h,d<<=1)for(;b[h]>0;--b[h])(l&p)!==f&&(e+=w,g+=w=1<<(m=s(b,h,o)),t[_+(f=l&p)]=new r(m+o&255,e-_-f&65535)),n(t,e+(l>>o),d,w,new r(h-o&255,65535&y[c++])),l=i(l,h);return g}},function(t,e,r){"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}},function(t,e,r){"use strict";var i=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,e,r,n){var s=i,o=n+r;t^=-1;for(var a=n;a>>8^s[255&(t^e[a])];return-1^t}},function(t,e,r){"use strict";var i=r(9),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 u(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 u(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)h[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return u(h,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}},function(t,e,r){"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}},function(t,e,r){"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}},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(88)]})},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(48)],implicit:[r(174),r(175),r(176),r(177)]})},function(t,e,r){"use strict";e.Commented=r(194),e.Diagnose=r(204),e.Decoder=r(36),e.Encoder=r(90),e.Simple=r(27),e.Tagged=r(52),e.Map=r(205),e.comment=e.Commented.comment,e.decodeAll=e.Decoder.decodeAll,e.decodeFirst=e.Decoder.decodeFirst,e.decodeAllSync=e.Decoder.decodeAllSync,e.decodeFirstSync=e.Decoder.decodeFirstSync,e.diagnose=e.Diagnose.diagnose,e.encode=e.Encoder.encode,e.encodeCanonical=e.Encoder.encodeCanonical,e.encodeOne=e.Encoder.encodeOne,e.encodeAsync=e.Encoder.encodeAsync,e.decode=e.Decoder.decodeFirstSync,e.leveldb={decode:e.Decoder.decodeAllSync,encode:e.Encoder.encode,buffer:!0,name:"cbor"},e.hasBigInt=r(17).hasBigInt},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(53),s=r(11).BigNumber,o=r(28),a=(r(52),r(27),r(17)),u=r(12),h=u.MT,c=u.NUMBYTES,l=u.SHIFT32,d=u.SYMS,f=u.TAG,p=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.TWO,m=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.FOUR,w=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.EIGHT,g=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.TRUE,y=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.FALSE,_=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.UNDEFINED,b=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.NULL,E=a.bigIntize(u.BI),v=u.BN,A=e.from("f97e00","hex"),T=e.from("f9fc00","hex"),x=e.from("f97c00","hex"),S=e.from("f98000","hex"),C=Symbol("CBOR_LOOP_DETECT");class D extends i.Transform{constructor(t){const r=Object.assign({},t,{readableObjectMode:!1,writableObjectMode:!0});super(r),this.canonical=r.canonical,this.encodeUndefined=r.encodeUndefined,this.disallowUndefinedKeys=!!r.disallowUndefinedKeys,this.dateType=null!=r.dateType?r.dateType.toLowerCase():"number",this.collapseBigIntegers=!!r.collapseBigIntegers,"symbol"==typeof r.detectLoops?this.detectLoops=r.detectLoops:this.detectLoops=r.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes=[Array,this._pushArray,Date,this._pushDate,e,this._pushBuffer,Map,this._pushMap,o,this._pushNoFilter,RegExp,this._pushRegexp,Set,this._pushSet,s,this._pushBigNumber,ArrayBuffer,this._pushUint8Array,Uint8ClampedArray,this._pushUint8Array,Uint8Array,this._pushUint8Array,Uint16Array,this._pushArray,Uint32Array,this._pushArray,Int8Array,this._pushArray,Int16Array,this._pushArray,Int32Array,this._pushArray,Float32Array,this._pushFloat32Array,Float64Array,this._pushFloat64Array],n.Url&&this.semanticTypes.push(n.Url,this._pushUrl),n.URL&&this.semanticTypes.push(n.URL,this._pushURL);const i=r.genTypes||[];for(let t=0,e=i.length;t{i.pushAny(t);const r=n.read();i.pushAny(e);const s=n.read();return r.compare(s)});for(const[e,i]of r){if(t.disallowUndefinedKeys&&void 0===e)throw new Error("Invalid Map key: undefined");if(!t.pushAny(e)||!t.pushAny(i))return!1}}else for(const[r,i]of e){if(t.disallowUndefinedKeys&&void 0===r)throw new Error("Invalid Map key: undefined");if(!t.pushAny(r)||!t.pushAny(i))return!1}return!0}_pushUint8Array(t,r){return t._pushBuffer(t,e.from(r))}_pushFloat32Array(t,e){const r=e.length;if(!t._pushInt(r,h.ARRAY))return!1;for(let i=0;i{const r=i[t]||(i[t]=D.encode(t)),n=i[e]||(i[e]=D.encode(e));return r.compare(n)}),!this._pushInt(r.length,h.MAP))return!1;let n;for(let e=0,s=r.length;e{const s=[],o=new D(r);o.on("data",t=>s.push(t)),o.on("error",n),o.on("finish",()=>i(e.concat(s))),o.pushAny(t),o.end()})}}t.exports=D}).call(this,r(3).Buffer)},,,,,,,,,,,,,,,,,,,,,,function(t,e,r){"use strict";const i=r(55),{escapeString:n}=r(144);t.exports=class extends i{constructor(){super({sourceCodeLocationInfo:!0}),this.posTracker=this.locInfoMixin.posTracker}_transformChunk(t){super._transformChunk(t)}_getRawHtml(t){const e=this.posTracker.droppedBufferSize,r=t.startOffset-e,i=t.endOffset-e;return this.tokenizer.preprocessor.html.slice(r,i)}_handleToken(t){super._handleToken(t)||this.emitRaw(this._getRawHtml(t.location)),this.parserFeedbackSimulator.skipNextNewLine=!1}_emitToken(t,e){this.emit(t,e,this._getRawHtml(e.sourceCodeLocation))}emitDoctype(t){let e="",this.push(e)}emitStartTag(t){let e="<"+t.tagName;const r=t.attrs;for(let t=0;t":">",this.push(e)}emitEndTag(t){this.push(`${t.tagName}>`)}emitText({text:t}){this.push(n(t,!1))}emitComment(t){this.push(`\x3c!--${t.text}--\x3e`)}emitRaw(t){this.push(t)}}},function(t,e,r){t.exports=r(78).BrotliDecompressBuffer},function(t,e,r){"use strict";!function(){var e,i,n,s=0,o=[];for(i=0;i<256;i++)o[i]=(i+256).toString(16).substr(1);function a(){var t,r=(t=16,(!e||s+t>u.BUFFER_SIZE)&&(s=0,e=u.randomBytes(u.BUFFER_SIZE)),e.slice(s,s+=t));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,r}function u(){var t=a();return o[t[0]]+o[t[1]]+o[t[2]]+o[t[3]]+"-"+o[t[4]]+o[t[5]]+"-"+o[t[6]]+o[t[7]]+"-"+o[t[8]]+o[t[9]]+"-"+o[t[10]]+o[t[11]]+o[t[12]]+o[t[13]]+o[t[14]]+o[t[15]]}u.BUFFER_SIZE=4096,u.bin=a,u.clearBuffer=function(){e=null,s=0},u.test=function(t){return"string"==typeof t&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)},"undefined"!=typeof crypto?n=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(n=window.msCrypto),n=n||r(159),t.exports=u,u.randomBytes=function(){if(n){if(n.randomBytes)return n.randomBytes;if(n.getRandomValues)return function(t){var e=new Uint8Array(t);return n.getRandomValues(e),e}}return function(t){var e,r=[];for(e=0;e10&&(t="..."+t.substr(-10));var n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},d=function(e){if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,n,r,i,s,o,a,u,c=[],h=0,d=(e=e.replace(/=/g,"")).length,p=0,f=d>>3<<3;p>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1),c[h++]=255&(s<<7|o<<2|a>>>3),c[h++]=255&(a<<5|u);var m=d-f;return 2===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2)):4===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4)):5===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],s=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1)):7===m&&(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],s=l[e.charAt(p++)],o=l[e.charAt(p++)],a=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1),c[h++]=255&(s<<7|o<<2|a>>>3)),c},p=function(e,t){if(!t)return function(e){for(var t,n,r="",i=e.length,s=0,o=0;s191&&t<=223?(n=31&t,o=1):t<=239?(n=15&t,o=2):t<=247?(n=7&t,o=3):h(s,r);for(var a=0;a191)&&h(s,r),n<<=6,n+=63&t;n>=55296&&n<=57343&&h(s,r),n>1114111&&h(s,r),n<=65535?r+=String.fromCharCode(n):(n-=65536,r+=String.fromCharCode(55296+(n>>10)),r+=String.fromCharCode(56320+(1023&n)))}return r}(d(e));if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,i,s,o,a,u,c,p="",f=e.indexOf("=");-1===f&&(f=e.length);for(var m=0,w=f>>3<<3;m>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|u>>>3))+String.fromCharCode(255&(u<<5|c));var g=f-w;return 2===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))):4===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))):5===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],o=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))):7===g&&(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],o=l[e.charAt(m++)],a=l[e.charAt(m++)],u=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|u>>>3))),p},f={encode:function(e,t){var n="string"!=typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?function(e){for(var t,n,r,i,s,o="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s];var h=a-c;return 1===h?(t=e[l],o+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e[l++],n=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e[l++],n=e[l++],r=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e[l++],n=e[l++],r=e[l++],i=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),o}(e):t?function(e){for(var t,n,r,i,s,o="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s];var h=a-c;return 1===h?(t=e.charCodeAt(l),o+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l++),i=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),o}(e):function(e){var t,n,r,i,s,o,a,l=!1,h="",d=0,p=0,f=e.length;do{for(c[0]=c[5],c[1]=c[6],c[2]=c[7],a=p;d>6,c[a++]=128|63&o):o<55296||o>=57344?(c[a++]=224|o>>12,c[a++]=128|o>>6&63,c[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++d)),c[a++]=240|o>>18,c[a++]=128|o>>12&63,c[a++]=128|o>>6&63,c[a++]=128|63&o);a-p,p=a-5,d===f&&++d,d>f&&a<6&&(l=!0),t=c[0],a>4?(n=c[1],r=c[2],i=c[3],s=c[4],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s]):1===a?h+=u[t>>>3]+u[t<<2&31]+"======":2===a?(n=c[1],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===a?(n=c[1],r=c[2],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):(n=c[1],r=c[2],i=c[3],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"=")}while(!l);return h}(e)},decode:p};p.asBytes=d,o?e.exports=f:(s.base32=f,a&&(void 0===(i=function(){return f}.call(f,n,f,e))||(e.exports=i)))}()}).call(this,n(14),n(6))},function(e,t,n){"use strict";var r=n(174),i=n(11),s=n(88),o=n(49),a=n(89),u=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(o[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=r.deflateSetDictionary(this.strm,c)))throw new Error(o[n]);this._dict_set=!0}}function c(e,t){var n=new l(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}l.prototype.push=function(e,t){var n,o,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===u.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(l),a.next_out=0,a.avail_out=l),1!==(n=r.deflate(a,o))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==n);return 4===o?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==o||(this.onEnd(0),a.avail_out=0,!0)},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=l,t.deflate=c,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n(182);var r=/\\(u\{([0-9A-Fa-f]+)\}|u([0-9A-Fa-f]{4})|x([0-9A-Fa-f]{2})|([1-7][0-7]{0,2}|[0-7]{2,3})|(['"tbrnfv0\\]))|\\U([0-9A-Fa-f]{8})/g,i={0:"\0",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v","'":"'",'"':'"',"\\":"\\"},s=function(e){return String.fromCodePoint(parseInt(e,16))};t.default=function(e){return e.replace(r,(function(e,t,n,r,o,a,u,l){return void 0!==n?s(n):void 0!==r?s(r):void 0!==o?s(o):void 0!==a?(c=a,String.fromCodePoint(parseInt(c,8))):void 0!==l?s(l):i[u];var c}))},e.exports=t.default},function(e,t,n){"use strict";e.exports=function(){function e(e,t,n,r,i){return e
${dateStr}
${this.iconValid ? html` - this.iconValid = false}" src="${this.replayPrefix}/${this.timestamp}id_/${p.favIconUrl}"/>` : html` + this.iconValid = false}" src="${this.replayPrefix}/${this.page.timestamp}id_/${p.favIconUrl}"/>` : html` `}
Current Page
${p.title || p.url}
l){l=p;continue}}else if(!a&&(f==f.toUpperCase()&&(f=f.toLowerCase())||f==f.toLowerCase()&&(f=f.toUpperCase()))){a=!0,h=-1,l=0;continue}return i(m,String(e),d,t)}d=!1,(l=(f=r(f,t,10,m.s)).indexOf("."))>-1?f=f.replace(".",""):l=f.length}for(h=0;48===f.charCodeAt(h);h++);for(p=f.length;48===f.charCodeAt(--p););if(f=f.slice(h,++p)){if(p-=h,d&&M.DEBUG&&p>15&&(e>9007199254740991||e!==u(e)))throw Error(c+m.s*e);if((l=l-h-1)>N)m.c=m.e=null;else if(l=O)?b(u,o):y(u,o,"0");else if(s=(e=H(new M(e),t,n)).e,a=(u=m(e.c)).length,1==r||2==r&&(t<=s||s<=R)){for(;aa){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-a)>0)for(s+1==a&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function j(e,t){for(var n,r=1,i=new M(e[0]);r=10;i/=10,r++);return(n=r+14*n-1)>N?e.c=e.e=null:n=10;l/=10,i++);if((s=t-i)<0)s+=14,o=t,f=(c=m[p=0])/w[i-o-1]%10|0;else if((p=a((s+1)/14))>=m.length){if(!r)break e;for(;m.length<=p;m.push(0));c=f=0,i=1,o=(s%=14)-14+1}else{for(c=l=m[p],i=1;l>=10;l/=10,i++);f=(o=(s%=14)-14+i)<0?0:c/w[i-o-1]%10|0}if(r=r||t<0||null!=m[p+1]||(o<0?c:c%w[i-o-1]),r=n<4?(f||r)&&(0==n||n==(e.s<0?3:2)):f>5||5==f&&(4==n||r||6==n&&(s>0?o>0?c/w[i-o]:0:m[p-1])%10&1||n==(e.s<0?8:7)),t<1||!m[0])return m.length=0,r?(t-=e.e+1,m[0]=w[(14-t%14)%14],e.e=-t||0):m[0]=e.e=0,e;if(0==s?(m.length=p,l=1,p--):(m.length=p+1,l=w[14-s],m[p]=o>0?u(c/w[i-o]%w[o])*l:0),r)for(;;){if(0==p){for(s=1,o=m[0];o>=10;o/=10,s++);for(o=m[0]+=l,l=1;o>=10;o/=10,l++);s!=l&&(e.e++,m[0]==h&&(m[0]=1));break}if(m[p]+=l,m[p]!=h)break;m[p--]=0,l=1}for(s=m.length;0===m[--s];m.pop());}e.e>N?e.c=e.e=null:e.e=O?b(t,n):y(t,n,"0"),e.s<0?"-"+t:t)}return M.clone=e,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.set=function(e){var t,n;if(null!=e){if("object"!=typeof e)throw Error(l+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(g(n=e[t],0,p,t),k=n),e.hasOwnProperty(t="ROUNDING_MODE")&&(g(n=e[t],0,8,t),D=n),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((n=e[t])&&n.pop?(g(n[0],-p,0,t),g(n[1],0,p,t),R=n[0],O=n[1]):(g(n,-p,p,t),R=-(O=n<0?-n:n))),e.hasOwnProperty(t="RANGE"))if((n=e[t])&&n.pop)g(n[0],-p,-1,t),g(n[1],1,p,t),I=n[0],N=n[1];else{if(g(n,-p,p,t),!n)throw Error(l+t+" cannot be zero: "+n);I=-(N=n<0?-n:n)}if(e.hasOwnProperty(t="CRYPTO")){if((n=e[t])!==!!n)throw Error(l+t+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!n,Error(l+"crypto unavailable");F=n}else F=n}if(e.hasOwnProperty(t="MODULO_MODE")&&(g(n=e[t],0,9,t),P=n),e.hasOwnProperty(t="POW_PRECISION")&&(g(n=e[t],0,p,t),L=n),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(n=e[t]))throw Error(l+t+" not an object: "+n);B=n}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(n=e[t])||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(l+t+" invalid: "+n);U=n}}return{DECIMAL_PLACES:k,ROUNDING_MODE:D,EXPONENTIAL_AT:[R,O],RANGE:[I,N],CRYPTO:F,MODULO_MODE:P,POW_PRECISION:L,FORMAT:B,ALPHABET:U}},M.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!M.DEBUG)return!0;var t,n,r=e.c,i=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(r)){if((1===s||-1===s)&&i>=-p&&i<=p&&i===u(i)){if(0===r[0]){if(0===i&&1===r.length)return!0;break e}if((t=(i+1)%14)<1&&(t+=14),String(r[0]).length==t){for(t=0;t=h||n!==u(n))break e;if(0!==n)return!0}}}else if(null===r&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(l+"Invalid BigNumber: "+e)},M.maximum=M.max=function(){return j(arguments,S.lt)},M.minimum=M.min=function(){return j(arguments,S.gt)},M.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,n,r,i,o,c=0,h=[],f=new M(C);if(null==e?e=k:g(e,0,p),i=a(e/14),F)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));c>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),t[c]=n[0],t[c+1]=n[1]):(h.push(o%1e14),c+=2);c=i/2}else{if(!crypto.randomBytes)throw F=!1,Error(l+"crypto unavailable");for(t=crypto.randomBytes(i*=7);c=9e15?crypto.randomBytes(7).copy(t,c):(h.push(o%1e14),c+=7);c=i/7}if(!F)for(;c=10;o/=10,c++);c<14&&(r-=14-c)}return f.e=r,f.c=h,f}),M.sum=function(){for(var e=1,t=arguments,n=new M(t[0]);en-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/n|0,o[i]%=n)}return o.reverse()}return function(t,r,i,s,o){var a,u,l,c,h,d,p,f,w=t.indexOf("."),g=k,_=D;for(w>=0&&(c=L,L=0,t=t.replace(".",""),d=(f=new M(r)).pow(t.length-w),L=c,f.c=e(y(m(d.c),d.e,"0"),10,i,"0123456789"),f.e=f.c.length),l=c=(p=e(t,r,i,o?(a=U,"0123456789"):(a="0123456789",U))).length;0==p[--c];p.pop());if(!p[0])return a.charAt(0);if(w<0?--l:(d.c=p,d.e=l,d.s=s,p=(d=n(d,f,g,_,i)).c,h=d.r,l=d.e),w=p[u=l+g+1],c=i/2,h=h||u<0||null!=p[u+1],h=_<4?(null!=w||h)&&(0==_||_==(d.s<0?3:2)):w>c||w==c&&(4==_||h||6==_&&1&p[u-1]||_==(d.s<0?8:7)),u<1||!p[0])t=h?y(a.charAt(1),-g,a.charAt(0)):a.charAt(0);else{if(p.length=u,h)for(--i;++p[--u]>i;)p[u]=0,u||(++l,p=[1].concat(p));for(c=p.length;!p[--c];);for(w=0,t="";w<=c;t+=a.charAt(p[w++]));t=y(t,l,a.charAt(0))}return t}}(),n=function(){function e(e,t,n){var r,i,s,o,a=0,u=e.length,l=t%1e7,c=t/1e7|0;for(e=e.slice();u--;)a=((i=l*(s=e[u]%1e7)+(r=c*s+(o=e[u]/1e7|0)*l)%1e7*1e7+a)/n|0)+(r/1e7|0)+c*o,e[u]=i%n;return a&&(e=[a].concat(e)),e}function t(e,t,n,r){var i,s;if(n!=r)s=n>r?1:-1;else for(i=s=0;it[i]?1:-1;break}return s}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]1;e.splice(0,1));}return function(r,i,s,o,a){var l,c,d,p,m,w,g,_,b,y,v,E,A,x,T,S,C,k=r.s==i.s?1:-1,D=r.c,R=i.c;if(!(D&&D[0]&&R&&R[0]))return new M(r.s&&i.s&&(D?!R||D[0]!=R[0]:R)?D&&0==D[0]||!R?0*k:k/0:NaN);for(b=(_=new M(k)).c=[],k=s+(c=r.e-i.e)+1,a||(a=h,c=f(r.e/14)-f(i.e/14),k=k/14|0),d=0;R[d]==(D[d]||0);d++);if(R[d]>(D[d]||0)&&c--,k<0)b.push(1),p=!0;else{for(x=D.length,S=R.length,d=0,k+=2,(m=u(a/(R[0]+1)))>1&&(R=e(R,m,a),D=e(D,m,a),S=R.length,x=D.length),A=S,v=(y=D.slice(0,S)).length;v=a/2&&T++;do{if(m=0,(l=t(R,y,S,v))<0){if(E=y[0],S!=v&&(E=E*a+(y[1]||0)),(m=u(E/T))>1)for(m>=a&&(m=a-1),g=(w=e(R,m,a)).length,v=y.length;1==t(w,y,g,v);)m--,n(w,S=10;k/=10,d++);H(_,s+(_.e=d+14*c-1)+1,o,p)}else _.e=c,_.r=+p;return _}}(),v=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,A=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(e,t,n,r){var i,s=n?t:t.replace(T,"");if(x.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!n&&(s=s.replace(v,(function(e,t,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?e:t})),r&&(i=r,s=s.replace(E,"$1").replace(A,"0.$1")),t!=s))return new M(s,i);if(M.DEBUG)throw Error(l+"Not a"+(r?" base "+r:"")+" number: "+t);e.s=null}e.c=e.e=null},S.absoluteValue=S.abs=function(){var e=new M(this);return e.s<0&&(e.s=1),e},S.comparedTo=function(e,t){return w(this,new M(e,t))},S.decimalPlaces=S.dp=function(e,t){var n,r,i,s=this;if(null!=e)return g(e,0,p),null==t?t=D:g(t,0,8),H(new M(s),e+s.e+1,t);if(!(n=s.c))return null;if(r=14*((i=n.length-1)-f(this.e/14)),i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},S.dividedBy=S.div=function(e,t){return n(this,new M(e,t),k,D)},S.dividedToIntegerBy=S.idiv=function(e,t){return n(this,new M(e,t),0,1)},S.exponentiatedBy=S.pow=function(e,t){var n,r,i,s,o,c,h,d,p=this;if((e=new M(e)).c&&!e.isInteger())throw Error(l+"Exponent not an integer: "+G(e));if(null!=t&&(t=new M(t)),o=e.e>14,!p.c||!p.c[0]||1==p.c[0]&&!p.e&&1==p.c.length||!e.c||!e.c[0])return d=new M(Math.pow(+G(p),o?2-_(e):+G(e))),t?d.mod(t):d;if(c=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new M(NaN);(r=!c&&p.isInteger()&&t.isInteger())&&(p=p.mod(t))}else{if(e.e>9&&(p.e>0||p.e<-1||(0==p.e?p.c[0]>1||o&&p.c[1]>=24e7:p.c[0]<8e13||o&&p.c[0]<=9999975e7)))return s=p.s<0&&_(e)?-0:0,p.e>-1&&(s=1/s),new M(c?1/s:s);L&&(s=a(L/14+2))}for(o?(n=new M(.5),c&&(e.s=1),h=_(e)):h=(i=Math.abs(+G(e)))%2,d=new M(C);;){if(h){if(!(d=d.times(p)).c)break;s?d.c.length>s&&(d.c.length=s):r&&(d=d.mod(t))}if(i){if(0===(i=u(i/2)))break;h=i%2}else if(H(e=e.times(n),e.e+1,1),e.e>14)h=_(e);else{if(0===(i=+G(e)))break;h=i%2}p=p.times(p),s?p.c&&p.c.length>s&&(p.c.length=s):r&&(p=p.mod(t))}return r?d:(c&&(d=C.div(d)),t?d.mod(t):s?H(d,L,D,void 0):d)},S.integerValue=function(e){var t=new M(this);return null==e?e=D:g(e,0,8),H(t,t.e+1,e)},S.isEqualTo=S.eq=function(e,t){return 0===w(this,new M(e,t))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(e,t){return w(this,new M(e,t))>0},S.isGreaterThanOrEqualTo=S.gte=function(e,t){return 1===(t=w(this,new M(e,t)))||0===t},S.isInteger=function(){return!!this.c&&f(this.e/14)>this.c.length-2},S.isLessThan=S.lt=function(e,t){return w(this,new M(e,t))<0},S.isLessThanOrEqualTo=S.lte=function(e,t){return-1===(t=w(this,new M(e,t)))||0===t},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(e,t){var n,r,i,s,o=this,a=o.s;if(t=(e=new M(e,t)).s,!a||!t)return new M(NaN);if(a!=t)return e.s=-t,o.plus(e);var u=o.e/14,l=e.e/14,c=o.c,d=e.c;if(!u||!l){if(!c||!d)return c?(e.s=-t,e):new M(d?o:NaN);if(!c[0]||!d[0])return d[0]?(e.s=-t,e):new M(c[0]?o:3==D?-0:0)}if(u=f(u),l=f(l),c=c.slice(),a=u-l){for((s=a<0)?(a=-a,i=c):(l=u,i=d),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(r=(s=(a=c.length)<(t=d.length))?a:t,a=t=0;t0)for(;t--;c[n++]=0);for(t=h-1;r>a;){if(c[--r]=0;){for(n=0,p=y[i]%1e7,m=y[i]/1e7|0,s=i+(o=u);s>i;)n=((l=p*(l=b[--o]%1e7)+(a=m*l+(c=b[o]/1e7|0)*p)%1e7*1e7+w[s]+n)/g|0)+(a/1e7|0)+m*c,w[s--]=l%g;w[s]=n}return n?++r:w.splice(0,1),z(e,w,r)},S.negated=function(){var e=new M(this);return e.s=-e.s||null,e},S.plus=function(e,t){var n,r=this,i=r.s;if(t=(e=new M(e,t)).s,!i||!t)return new M(NaN);if(i!=t)return e.s=-t,r.minus(e);var s=r.e/14,o=e.e/14,a=r.c,u=e.c;if(!s||!o){if(!a||!u)return new M(i/0);if(!a[0]||!u[0])return u[0]?e:new M(a[0]?r:0*i)}if(s=f(s),o=f(o),a=a.slice(),i=s-o){for(i>0?(o=s,n=u):(i=-i,n=a),n.reverse();i--;n.push(0));n.reverse()}for((i=a.length)-(t=u.length)<0&&(n=u,u=a,a=n,t=i),i=0;t;)i=(a[--t]=a[t]+u[t]+i)/h|0,a[t]=h===a[t]?0:a[t]%h;return i&&(a=[i].concat(a),++o),z(e,a,o)},S.precision=S.sd=function(e,t){var n,r,i,s=this;if(null!=e&&e!==!!e)return g(e,1,p),null==t?t=D:g(t,0,8),H(new M(s),e,t);if(!(n=s.c))return null;if(r=14*(i=n.length-1)+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&s.e+1>r&&(r=s.e+1),r},S.shiftedBy=function(e){return g(e,-9007199254740991,9007199254740991),this.times("1e"+e)},S.squareRoot=S.sqrt=function(){var e,t,r,i,s,o=this,a=o.c,u=o.s,l=o.e,c=k+4,h=new M("0.5");if(1!==u||!a||!a[0])return new M(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(u=Math.sqrt(+G(o)))||u==1/0?(((t=m(a)).length+l)%2==0&&(t+="0"),u=Math.sqrt(+t),l=f((l+1)/2)-(l<0||l%2),r=new M(t=u==1/0?"1e"+l:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+l)):r=new M(u+""),r.c[0])for((u=(l=r.e)+c)<3&&(u=0);;)if(s=r,r=h.times(s.plus(n(o,s,c,1))),m(s.c).slice(0,u)===(t=m(r.c)).slice(0,u)){if(r.e0&&m>0){for(s=m%a||a,h=f.substr(0,s);s0&&(h+=c+f.slice(s)),p&&(h="-"+h)}r=d?h+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):d):h}return(n.prefix||"")+r+(n.suffix||"")},S.toFraction=function(e){var t,r,i,s,o,a,u,c,h,p,f,w,g=this,_=g.c;if(null!=e&&(!(u=new M(e)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(l+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+G(u));if(!_)return new M(g);for(t=new M(C),h=r=new M(C),i=c=new M(C),w=m(_),o=t.e=w.length-g.e-1,t.c[0]=d[(a=o%14)<0?14+a:a],e=!e||u.comparedTo(t)>0?o>0?t:h:u,a=N,N=1/0,u=new M(w),c.c[0]=0;p=n(u,t,0,1),1!=(s=r.plus(p.times(i))).comparedTo(e);)r=i,i=s,h=c.plus(p.times(s=h)),c=s,t=u.minus(p.times(s=t)),u=s;return s=n(e.minus(r),i,0,1),c=c.plus(s.times(h)),r=r.plus(s.times(i)),c.s=h.s=g.s,f=n(h,i,o*=2,D).minus(g).abs().comparedTo(n(c,r,o,D).minus(g).abs())<1?[h,i]:[c,r],N=a,f},S.toNumber=function(){return+G(this)},S.toPrecision=function(e,t){return null!=e&&g(e,1,p),W(this,e,t,2)},S.toString=function(e){var t,n=this,i=n.s,s=n.e;return null===s?i?(t="Infinity",i<0&&(t="-"+t)):t="NaN":(null==e?t=s<=R||s>=O?b(m(n.c),s):y(m(n.c),s,"0"):10===e?t=y(m((n=H(new M(n),k+s+1,D)).c),n.e,"0"):(g(e,2,U.length,"Base"),t=r(y(m(n.c),s,"0"),10,e,i,!0)),i<0&&n.c[0]&&(t="-"+t)),t},S.valueOf=S.toJSON=function(){return G(this)},S._isBigNumber=!0,null!=t&&M.set(t),M}()).default=s.BigNumber=s,void 0===(r=function(){return s}.call(t,n,t,e))||(e.exports=r)}()},,function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));class r{constructor(){this.promises=[],this.batch=[],this.count=0}addPage(e){this.promises.push(this.db.addPage(e))}addResource(e){this.batch.length>=1e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=1e3} records`)),this.batch.push(e)}async finishIndexing(){this.batch.length>0&&this.promises.push(this.db.addResources(this.batch)),console.log(`Indexed ${this.count+=this.batch.length} records`),this._finishLoad();try{await Promise.all(this.promises)}catch(e){console.warn(e)}this.promises=[]}_finishLoad(){}}},,,function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===n(e)},t.isBoolean=function(e){return"boolean"==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return"number"==typeof e},t.isString=function(e){return"string"==typeof e},t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return"[object RegExp]"===n(e)},t.isObject=function(e){return"object"==typeof e&&null!==e},t.isDate=function(e){return"[object Date]"===n(e)},t.isError=function(e){return"[object Error]"===n(e)||e instanceof Error},t.isFunction=function(e){return"function"==typeof e},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=e.isBuffer}).call(this,n(3).Buffer)},function(e,t,n){"use strict";const r=t.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};t.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},t.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const i=t.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};t.SPECIAL_ELEMENTS={[r.HTML]:{[i.ADDRESS]:!0,[i.APPLET]:!0,[i.AREA]:!0,[i.ARTICLE]:!0,[i.ASIDE]:!0,[i.BASE]:!0,[i.BASEFONT]:!0,[i.BGSOUND]:!0,[i.BLOCKQUOTE]:!0,[i.BODY]:!0,[i.BR]:!0,[i.BUTTON]:!0,[i.CAPTION]:!0,[i.CENTER]:!0,[i.COL]:!0,[i.COLGROUP]:!0,[i.DD]:!0,[i.DETAILS]:!0,[i.DIR]:!0,[i.DIV]:!0,[i.DL]:!0,[i.DT]:!0,[i.EMBED]:!0,[i.FIELDSET]:!0,[i.FIGCAPTION]:!0,[i.FIGURE]:!0,[i.FOOTER]:!0,[i.FORM]:!0,[i.FRAME]:!0,[i.FRAMESET]:!0,[i.H1]:!0,[i.H2]:!0,[i.H3]:!0,[i.H4]:!0,[i.H5]:!0,[i.H6]:!0,[i.HEAD]:!0,[i.HEADER]:!0,[i.HGROUP]:!0,[i.HR]:!0,[i.HTML]:!0,[i.IFRAME]:!0,[i.IMG]:!0,[i.INPUT]:!0,[i.LI]:!0,[i.LINK]:!0,[i.LISTING]:!0,[i.MAIN]:!0,[i.MARQUEE]:!0,[i.MENU]:!0,[i.META]:!0,[i.NAV]:!0,[i.NOEMBED]:!0,[i.NOFRAMES]:!0,[i.NOSCRIPT]:!0,[i.OBJECT]:!0,[i.OL]:!0,[i.P]:!0,[i.PARAM]:!0,[i.PLAINTEXT]:!0,[i.PRE]:!0,[i.SCRIPT]:!0,[i.SECTION]:!0,[i.SELECT]:!0,[i.SOURCE]:!0,[i.STYLE]:!0,[i.SUMMARY]:!0,[i.TABLE]:!0,[i.TBODY]:!0,[i.TD]:!0,[i.TEMPLATE]:!0,[i.TEXTAREA]:!0,[i.TFOOT]:!0,[i.TH]:!0,[i.THEAD]:!0,[i.TITLE]:!0,[i.TR]:!0,[i.TRACK]:!0,[i.UL]:!0,[i.WBR]:!0,[i.XMP]:!0},[r.MATHML]:{[i.MI]:!0,[i.MO]:!0,[i.MN]:!0,[i.MS]:!0,[i.MTEXT]:!0,[i.ANNOTATION_XML]:!0},[r.SVG]:{[i.TITLE]:!0,[i.FOREIGN_OBJECT]:!0,[i.DESC]:!0}}},function(e,t,n){"use strict";function r(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},e.exports=r},function(e,t,n){"use strict";var r=n(16);e.exports=new r({include:[n(90)],implicit:[n(193),n(194)],explicit:[n(195),n(196),n(197),n(198)]})},function(e,t,n){(function(e){var r=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r=s)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(e){return"[Circular]"}default:return e}})),u=r[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),f(n)?r.showHidden=n:n&&t._extend(r,n),_(r.showHidden)&&(r.showHidden=!1),_(r.depth)&&(r.depth=2),_(r.colors)&&(r.colors=!1),_(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),c(r,e,r.depth)}function u(e,t){var n=a.styles[t];return n?"["+a.colors[n][0]+"m"+e+"["+a.colors[n][1]+"m":e}function l(e,t){return e}function c(e,n,r){if(e.customInspect&&n&&A(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return g(i)||(i=c(e,i,r)),i}var s=function(e,t){if(_(t))return e.stylize("undefined","undefined");if(g(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(w(t))return e.stylize(""+t,"number");if(f(t))return e.stylize(""+t,"boolean");if(m(t))return e.stylize("null","null")}(e,n);if(s)return s;var o=Object.keys(n),a=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(n)),E(n)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(n);if(0===o.length){if(A(n)){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(b(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(v(n))return e.stylize(Date.prototype.toString.call(n),"date");if(E(n))return h(n)}var l,y="",x=!1,T=["{","}"];(p(n)&&(x=!0,T=["[","]"]),A(n))&&(y=" [Function"+(n.name?": "+n.name:"")+"]");return b(n)&&(y=" "+RegExp.prototype.toString.call(n)),v(n)&&(y=" "+Date.prototype.toUTCString.call(n)),E(n)&&(y=" "+h(n)),0!==o.length||x&&0!=n.length?r<0?b(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),l=x?function(e,t,n,r,i){for(var s=[],o=0,a=t.length;o=0&&0,e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(l,y,T)):T[0]+y+T[1]}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function d(e,t,n,r,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?a=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(a=e.stylize("[Setter]","special")),k(r,i)||(o="["+i+"]"),a||(e.seen.indexOf(u.value)<0?(a=m(n)?c(e,u.value,null):c(e,u.value,n-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+a.split("\n").map((function(e){return" "+e})).join("\n")):a=e.stylize("[Circular]","special")),_(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function p(e){return Array.isArray(e)}function f(e){return"boolean"==typeof e}function m(e){return null===e}function w(e){return"number"==typeof e}function g(e){return"string"==typeof e}function _(e){return void 0===e}function b(e){return y(e)&&"[object RegExp]"===x(e)}function y(e){return"object"==typeof e&&null!==e}function v(e){return y(e)&&"[object Date]"===x(e)}function E(e){return y(e)&&("[object Error]"===x(e)||e instanceof Error)}function A(e){return"function"==typeof e}function x(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(n){if(_(s)&&(s=e.env.NODE_DEBUG||""),n=n.toUpperCase(),!o[n])if(new RegExp("\\b"+n+"\\b","i").test(s)){var r=e.pid;o[n]=function(){var e=t.format.apply(t,arguments);console.error("%s %d: %s",n,r,e)}}else o[n]=function(){};return o[n]},t.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=p,t.isBoolean=f,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=w,t.isString=g,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=_,t.isRegExp=b,t.isObject=y,t.isDate=v,t.isError=E,t.isFunction=A,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=n(210);var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),S[e.getMonth()],t].join(" ")}function k(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",C(),t.format.apply(t,arguments))},t.inherits=n(211),t._extend=function(e,t){if(!t||!y(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e};var D="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(e,t){if(!e){var n=new Error("Promise was rejected with a falsy value");n.reason=e,e=n}return t(e)}t.promisify=function(e){if("function"!=typeof e)throw new TypeError('The "original" argument must be of type Function');if(D&&e[D]){var t;if("function"!=typeof(t=e[D]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,D,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var t,n,r=new Promise((function(e,r){t=e,n=r})),i=[],s=0;s255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}[r.inspect.custom](e,t){return"simple("+this.value+")"}inspect(e,t){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(e){return e instanceof u}static decode(e,t=!0,n=!1){switch(e){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return t?null:a.NULL;case o.UNDEFINED:return t?void 0:a.UNDEFINED;case-1:if(!t||!n)throw new Error("Invalid BREAK");return a.BREAK;default:return new u(e)}}}e.exports=u},function(e,t,n){"use strict";(function(t){const r=n(4),i=n(27);class s extends r.Transform{constructor(e,n,r){let i,s;switch(null==r&&(r={}),typeof e){case"object":t.isBuffer(e)?(i=e,null!=n&&"object"==typeof n&&(r=n)):r=e;break;case"string":i=e,null!=n&&"object"==typeof n?r=n:s=n}null==r&&(r={}),null==i&&(i=r.input),null==s&&(s=r.inputEncoding),delete r.input,delete r.inputEncoding;const o=null==r.watchPipe||r.watchPipe;delete r.watchPipe;const a=!!r.readError;delete r.readError,super(r),this.readError=a,o&&this.on("pipe",e=>{const t=e._readableState.objectMode;if(this.length>0&&t!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");return this._readableState.objectMode=t,this._writableState.objectMode=t}),null!=i&&this.end(i,s)}static isNoFilter(e){return e instanceof this}static compare(e,t){if(!(e instanceof this))throw new TypeError("Arguments must be NoFilters");return e===t?0:e.compare(t)}static concat(e,n){if(!Array.isArray(e))throw new TypeError("list argument must be an Array of NoFilters");if(0===e.length||0===n)return t.alloc(0);null==n&&(n=e.reduce((e,t)=>{if(!(t instanceof s))throw new TypeError("list argument must be an Array of NoFilters");return e+t.length},0));let r=!0,i=!0;const o=e.map(e=>{if(!(e instanceof s))throw new TypeError("list argument must be an Array of NoFilters");const n=e.slice();return t.isBuffer(n)?i=!1:r=!1,n});if(r)return t.concat(o,n);if(i)return[].concat(...o).slice(0,n);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(e,n,r){this._readableState.objectMode||t.isBuffer(e)||(e=t.from(e,n)),this.push(e),r()}_bufArray(){let e=this._readableState.buffer;if(!Array.isArray(e)){let t=e.head;for(e=[];null!=t;)e.push(t.data),t=t.next}return e}read(e){const t=super.read(e);if(null!=t){if(this.emit("read",t),this.readError&&t.length{this.on("finish",()=>{const r=this.read();null==e||t||(t=!0,e(null,r)),n(r)}),this.on("error",n=>{null==e||t||(t=!0,e(n)),r(n)})})}compare(e){if(!(e instanceof s))throw new TypeError("Arguments must be NoFilters");if(this===e)return 0;{const n=this.slice(),r=e.slice();if(t.isBuffer(n)&&t.isBuffer(r))return n.compare(r);throw new Error("Cannot compare streams in object mode")}}equals(e){return 0===this.compare(e)}slice(e,n){if(this._readableState.objectMode)return this._bufArray().slice(e,n);const r=this._bufArray();switch(r.length){case 0:return t.alloc(0);case 1:return r[0].slice(e,n);default:return t.concat(r).slice(e,n)}}get(e){return this.slice()[e]}toJSON(){const e=this.slice();return t.isBuffer(e)?e.toJSON():e}toString(e,n,r){const s=this.slice(n,r);if(!t.isBuffer(s))return JSON.stringify(s);if((!e||"utf8"===e)&&i.TextDecoder){return new i.TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(s)}return s.toString(e,n,r)}inspect(e,t){return this[i.inspect.custom](e,t)}[i.inspect.custom](e,n){const r=this._bufArray().map(e=>t.isBuffer(e)?(null!=n?n.stylize:void 0)?n.stylize(e.toString("hex"),"string"):e.toString("hex"):i.inspect(e,n)).join(", ");return`${this.constructor.name} [${r}]`}get length(){return this._readableState.length}writeBigInt(e){let n=e.toString(16);if(e<0){const t=BigInt(Math.floor(n.length/2));n=(e=(BigInt(1)<=a.DIGIT_0&&e<=a.DIGIT_9}function p(e){return e>=a.LATIN_CAPITAL_A&&e<=a.LATIN_CAPITAL_Z}function f(e){return e>=a.LATIN_SMALL_A&&e<=a.LATIN_SMALL_Z}function m(e){return f(e)||p(e)}function w(e){return m(e)||d(e)}function g(e){return e>=a.LATIN_CAPITAL_A&&e<=a.LATIN_CAPITAL_F}function _(e){return e>=a.LATIN_SMALL_A&&e<=a.LATIN_SMALL_F}function b(e){return e+32}function y(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(e>>>10&1023|55296)+String.fromCharCode(56320|1023&e))}function v(e){return String.fromCharCode(b(e))}function E(e,t){const n=s[++e];let r=++e,i=r+n-1;for(;r<=i;){const e=r+i>>>1,o=s[e];if(ot))return s[e+n];i=e-1}}return-1}class A{constructor(){this.preprocessor=new r,this.tokenQueue=[],this.allowCDATA=!1,this.state=c,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(e){this._consume(),this._err(e),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this[this.state](e)}return this.tokenQueue.shift()}write(e,t){this.active=!0,this.preprocessor.write(e,t)}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:A.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(e){this.state=e,this._unconsume()}_consumeSequenceIfMatch(e,t,n){let r=0,i=!0;const s=e.length;let o=0,u=t,l=void 0;for(;o0&&(u=this._consume(),r++),u===a.EOF){i=!1;break}if(l=e[o],u!==l&&(n||u!==b(l))){i=!1;break}}if(!i)for(;r--;)this._unconsume();return i}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==u.SCRIPT_STRING.length)return!1;for(let e=0;e0&&this._err(o.endTagWithAttributes),e.selfClosing&&this._err(o.endTagWithTrailingSolidus)),this.tokenQueue.push(e)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(e,t){this.currentCharacterToken&&this.currentCharacterToken.type!==e&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=t:this._createCharacterToken(e,t)}_emitCodePoint(e){let t=A.CHARACTER_TOKEN;h(e)?t=A.WHITESPACE_CHARACTER_TOKEN:e===a.NULL&&(t=A.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(t,y(e))}_emitSeveralCodePoints(e){for(let t=0;t-1;){const e=s[r],i=e<7;i&&1&e&&(t=2&e?[s[++r],s[++r]]:[s[++r]],n=0);const o=this._consume();if(this.tempBuff.push(o),n++,o===a.EOF)break;r=i?4&e?E(r,o):-1:o===e?++r:-1}for(;n--;)this.tempBuff.pop(),this._unconsume();return t}_isCharacterReferenceInAttribute(){return"ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_UNQUOTED_STATE"===this.returnState}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){const e=this._consume();return this._unconsume(),e===a.EQUALS_SIGN||w(e)}return!1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let e=0;e")):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitChars(i.REPLACEMENT_CHARACTER)):e===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(e))}SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE(e){e===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE"):m(e)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE")):(this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE(e){m(e)?(this._createEndTagToken(),this._reconsumeInState("SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE")):(this._emitChars(""),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE(e){if(p(e))this.currentToken.tagName+=v(e),this.tempBuff.push(e);else if(f(e))this.currentToken.tagName+=y(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(h(e))return void(this.state="BEFORE_ATTRIBUTE_NAME_STATE");if(e===a.SOLIDUS)return void(this.state="SELF_CLOSING_START_TAG_STATE");if(e===a.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=c)}this._emitChars(""),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}}SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE(e){h(e)||e===a.SOLIDUS||e===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_DOUBLE_ESCAPED_STATE":"SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(e)):p(e)?(this.tempBuff.push(b(e)),this._emitCodePoint(e)):f(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPED_STATE(e){e===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",this._emitChars("-")):e===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):e===a.NULL?(this._err(o.unexpectedNullCharacter),this._emitChars(i.REPLACEMENT_CHARACTER)):e===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(e)}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE(e){e===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",this._emitChars("-")):e===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(i.REPLACEMENT_CHARACTER)):e===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(e))}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE(e){e===a.HYPHEN_MINUS?this._emitChars("-"):e===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):e===a.GREATER_THAN_SIGN?(this.state="SCRIPT_DATA_STATE",this._emitChars(">")):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(i.REPLACEMENT_CHARACTER)):e===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(e))}SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE(e){e===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",this._emitChars("/")):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE(e){h(e)||e===a.SOLIDUS||e===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_ESCAPED_STATE":"SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(e)):p(e)?(this.tempBuff.push(b(e)),this._emitCodePoint(e)):f(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}BEFORE_ATTRIBUTE_NAME_STATE(e){h(e)||(e===a.SOLIDUS||e===a.GREATER_THAN_SIGN||e===a.EOF?this._reconsumeInState("AFTER_ATTRIBUTE_NAME_STATE"):e===a.EQUALS_SIGN?(this._err(o.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state="ATTRIBUTE_NAME_STATE"):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}ATTRIBUTE_NAME_STATE(e){h(e)||e===a.SOLIDUS||e===a.GREATER_THAN_SIGN||e===a.EOF?(this._leaveAttrName("AFTER_ATTRIBUTE_NAME_STATE"),this._unconsume()):e===a.EQUALS_SIGN?this._leaveAttrName("BEFORE_ATTRIBUTE_VALUE_STATE"):p(e)?this.currentAttr.name+=v(e):e===a.QUOTATION_MARK||e===a.APOSTROPHE||e===a.LESS_THAN_SIGN?(this._err(o.unexpectedCharacterInAttributeName),this.currentAttr.name+=y(e)):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.name+=i.REPLACEMENT_CHARACTER):this.currentAttr.name+=y(e)}AFTER_ATTRIBUTE_NAME_STATE(e){h(e)||(e===a.SOLIDUS?this.state="SELF_CLOSING_START_TAG_STATE":e===a.EQUALS_SIGN?this.state="BEFORE_ATTRIBUTE_VALUE_STATE":e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}BEFORE_ATTRIBUTE_VALUE_STATE(e){h(e)||(e===a.QUOTATION_MARK?this.state="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE":e===a.APOSTROPHE?this.state="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE":e===a.GREATER_THAN_SIGN?(this._err(o.missingAttributeValue),this.state=c,this._emitCurrentToken()):this._reconsumeInState("ATTRIBUTE_VALUE_UNQUOTED_STATE"))}ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE(e){e===a.QUOTATION_MARK?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":e===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=i.REPLACEMENT_CHARACTER):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=y(e)}ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE(e){e===a.APOSTROPHE?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":e===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=i.REPLACEMENT_CHARACTER):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=y(e)}ATTRIBUTE_VALUE_UNQUOTED_STATE(e){h(e)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):e===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_UNQUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):e===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=i.REPLACEMENT_CHARACTER):e===a.QUOTATION_MARK||e===a.APOSTROPHE||e===a.LESS_THAN_SIGN||e===a.EQUALS_SIGN||e===a.GRAVE_ACCENT?(this._err(o.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=y(e)):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=y(e)}AFTER_ATTRIBUTE_VALUE_QUOTED_STATE(e){h(e)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):e===a.SOLIDUS?this._leaveAttrValue("SELF_CLOSING_START_TAG_STATE"):e===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.missingWhitespaceBetweenAttributes),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}SELF_CLOSING_START_TAG_STATE(e){e===a.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.unexpectedSolidusInTag),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}BOGUS_COMMENT_STATE(e){e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.EOF?(this._emitCurrentToken(),this._emitEOFToken()):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=i.REPLACEMENT_CHARACTER):this.currentToken.data+=y(e)}MARKUP_DECLARATION_OPEN_STATE(e){this._consumeSequenceIfMatch(u.DASH_DASH_STRING,e,!0)?(this._createCommentToken(),this.state="COMMENT_START_STATE"):this._consumeSequenceIfMatch(u.DOCTYPE_STRING,e,!1)?this.state="DOCTYPE_STATE":this._consumeSequenceIfMatch(u.CDATA_START_STRING,e,!0)?this.allowCDATA?this.state="CDATA_SECTION_STATE":(this._err(o.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state="BOGUS_COMMENT_STATE"):this._ensureHibernation()||(this._err(o.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState("BOGUS_COMMENT_STATE"))}COMMENT_START_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_START_DASH_STATE":e===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):this._reconsumeInState("COMMENT_STATE")}COMMENT_START_DASH_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":e===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_END_DASH_STATE":e===a.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state="COMMENT_LESS_THAN_SIGN_STATE"):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=i.REPLACEMENT_CHARACTER):e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=y(e)}COMMENT_LESS_THAN_SIGN_STATE(e){e===a.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state="COMMENT_LESS_THAN_SIGN_BANG_STATE"):e===a.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE":this._reconsumeInState("COMMENT_END_DASH_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE(e){e!==a.GREATER_THAN_SIGN&&e!==a.EOF&&this._err(o.nestedComment),this._reconsumeInState("COMMENT_END_STATE")}COMMENT_END_DASH_STATE(e){e===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_STATE(e){e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.EXCLAMATION_MARK?this.state="COMMENT_END_BANG_STATE":e===a.HYPHEN_MINUS?this.currentToken.data+="-":e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_BANG_STATE(e){e===a.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state="COMMENT_END_DASH_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.incorrectlyClosedComment),this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState("COMMENT_STATE"))}DOCTYPE_STATE(e){h(e)?this.state="BEFORE_DOCTYPE_NAME_STATE":e===a.GREATER_THAN_SIGN?this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"):e===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingWhitespaceBeforeDoctypeName),this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"))}BEFORE_DOCTYPE_NAME_STATE(e){h(e)||(p(e)?(this._createDoctypeToken(v(e)),this.state="DOCTYPE_NAME_STATE"):e===a.NULL?(this._err(o.unexpectedNullCharacter),this._createDoctypeToken(i.REPLACEMENT_CHARACTER),this.state="DOCTYPE_NAME_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(y(e)),this.state="DOCTYPE_NAME_STATE"))}DOCTYPE_NAME_STATE(e){h(e)?this.state="AFTER_DOCTYPE_NAME_STATE":e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):p(e)?this.currentToken.name+=v(e):e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.name+=i.REPLACEMENT_CHARACTER):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=y(e)}AFTER_DOCTYPE_NAME_STATE(e){h(e)||(e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(u.PUBLIC_STRING,e,!1)?this.state="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE":this._consumeSequenceIfMatch(u.SYSTEM_STRING,e,!1)?this.state="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE":this._ensureHibernation()||(this._err(o.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE(e){h(e)?this.state="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE":e===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE(e){h(e)||(e===a.QUOTATION_MARK?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE(e){e===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=i.REPLACEMENT_CHARACTER):e===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=y(e)}DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE(e){e===a.APOSTROPHE?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=i.REPLACEMENT_CHARACTER):e===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=y(e)}AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE(e){h(e)?this.state="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE":e===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):e===a.QUOTATION_MARK?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE(e){h(e)||(e===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):e===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE(e){h(e)?this.state="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE":e===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE(e){h(e)||(e===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):e===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):e===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE(e){e===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=i.REPLACEMENT_CHARACTER):e===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=y(e)}DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE(e){e===a.APOSTROPHE?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":e===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=i.REPLACEMENT_CHARACTER):e===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=y(e)}AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE(e){h(e)||(e===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):e===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}BOGUS_DOCTYPE_STATE(e){e===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):e===a.NULL?this._err(o.unexpectedNullCharacter):e===a.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}CDATA_SECTION_STATE(e){e===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_BRACKET_STATE":e===a.EOF?(this._err(o.eofInCdata),this._emitEOFToken()):this._emitCodePoint(e)}CDATA_SECTION_BRACKET_STATE(e){e===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_END_STATE":(this._emitChars("]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CDATA_SECTION_END_STATE(e){e===a.GREATER_THAN_SIGN?this.state=c:e===a.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CHARACTER_REFERENCE_STATE(e){this.tempBuff=[a.AMPERSAND],e===a.NUMBER_SIGN?(this.tempBuff.push(e),this.state="NUMERIC_CHARACTER_REFERENCE_STATE"):w(e)?this._reconsumeInState("NAMED_CHARACTER_REFERENCE_STATE"):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}NAMED_CHARACTER_REFERENCE_STATE(e){const t=this._matchNamedCharacterReference(e);if(this._ensureHibernation())this.tempBuff=[a.AMPERSAND];else if(t){const e=this.tempBuff[this.tempBuff.length-1]===a.SEMICOLON;this._isCharacterReferenceAttributeQuirk(e)||(e||this._errOnNextCodePoint(o.missingSemicolonAfterCharacterReference),this.tempBuff=t),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state="AMBIGUOS_AMPERSAND_STATE"}AMBIGUOS_AMPERSAND_STATE(e){w(e)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=y(e):this._emitCodePoint(e):(e===a.SEMICOLON&&this._err(o.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}NUMERIC_CHARACTER_REFERENCE_STATE(e){this.charRefCode=0,e===a.LATIN_SMALL_X||e===a.LATIN_CAPITAL_X?(this.tempBuff.push(e),this.state="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE"):this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_START_STATE")}HEXADEMICAL_CHARACTER_REFERENCE_START_STATE(e){!function(e){return d(e)||g(e)||_(e)}(e)?(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState("HEXADEMICAL_CHARACTER_REFERENCE_STATE")}DECIMAL_CHARACTER_REFERENCE_START_STATE(e){d(e)?this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_STATE"):(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}HEXADEMICAL_CHARACTER_REFERENCE_STATE(e){g(e)?this.charRefCode=16*this.charRefCode+e-55:_(e)?this.charRefCode=16*this.charRefCode+e-87:d(e)?this.charRefCode=16*this.charRefCode+e-48:e===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}DECIMAL_CHARACTER_REFERENCE_STATE(e){d(e)?this.charRefCode=10*this.charRefCode+e-48:e===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}NUMERIC_CHARACTER_REFERENCE_END_STATE(){if(this.charRefCode===a.NULL)this._err(o.nullCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(o.characterReferenceOutsideUnicodeRange),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(i.isSurrogate(this.charRefCode))this._err(o.surrogateCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(i.isUndefinedCodePoint(this.charRefCode))this._err(o.noncharacterCharacterReference);else if(i.isControlCodePoint(this.charRefCode)||this.charRefCode===a.CARRIAGE_RETURN){this._err(o.controlCharacterReference);const e=l[this.charRefCode];e&&(this.charRefCode=e)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}}A.CHARACTER_TOKEN="CHARACTER_TOKEN",A.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",A.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",A.START_TAG_TOKEN="START_TAG_TOKEN",A.END_TAG_TOKEN="END_TAG_TOKEN",A.COMMENT_TOKEN="COMMENT_TOKEN",A.DOCTYPE_TOKEN="DOCTYPE_TOKEN",A.EOF_TOKEN="EOF_TOKEN",A.HIBERNATION_TOKEN="HIBERNATION_TOKEN",A.MODE={DATA:c,RCDATA:"RCDATA_STATE",RAWTEXT:"RAWTEXT_STATE",SCRIPT_DATA:"SCRIPT_DATA_STATE",PLAINTEXT:"PLAINTEXT_STATE"},A.getTokenAttr=function(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null},e.exports=A},function(e,t,n){"use strict";const r=n(7),i=n(7).buildOptions,s=n(177),o=1,a=2,u=3,l=4;let c="<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|(([\\w:\\-._]*:)?([\\w:\\-._]+))([^>]*)>|((\\/)(([\\w:\\-._]*:)?([\\w:\\-._]+))\\s*>))([^<]*)";!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const h={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",localeRange:"",tagValueProcessor:function(e,t){return e},attrValueProcessor:function(e,t){return e},stopNodes:[]};t.defaultOptions=h;const d=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","localeRange","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","stopNodes"];t.props=d;function p(e,t,n){const r=e[7]||n;let i=e[14];return i&&(t.trimValues&&(i=i.trim()),i=t.tagValueProcessor(i,r),i=w(i,t.parseNodeValue,t.parseTrueNumberOnly)),i}function f(e){return"]]>"===e[4]?l:"/"===e[10]?a:void 0!==e[8]&&"/"===e[8].substr(e[8].length-1)?u:o}function m(e,t){if(t.ignoreNameSpace){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}function w(e,t,n){if(t&&"string"==typeof e){let t;return""===e.trim()||isNaN(e)?t="true"===e||"false"!==e&&e:(-1!==e.indexOf("0x")?t=Number.parseInt(e,16):-1!==e.indexOf(".")?(t=Number.parseFloat(e),e=e.replace(/0+$/,"")):t=Number.parseInt(e,10),n&&(t=String(t)===e?t:e)),t}return r.isExist(e)?e:""}const g=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");function _(e,t){if(!t.ignoreAttributes&&"string"==typeof e){e=e.replace(/\r?\n/g," ");const n=r.getAllMatches(e,g),i=n.length,s={};for(let e=0;e/g,"");const n=new s("!xml");let o=n;c=c.replace(/\[\\w/g,"["+t.localeRange+"\\w");const m=new RegExp(c,"g");let w=m.exec(e),g=m.exec(e);for(;w;){const n=f(w);if(n===a)o.parent&&w[14]&&(o.parent.val=r.getValue(o.parent.val)+""+p(w,t,o.parent.tagname)),t.stopNodes.length&&t.stopNodes.includes(o.tagname)&&(o.child=[],null==o.attrsMap&&(o.attrsMap={}),o.val=e.substr(o.startIndex+1,w.index-o.startIndex-1)),o=o.parent;else if(n===l)if(t.cdataTagName){const e=new s(t.cdataTagName,o,w[3]);e.attrsMap=_(w[8],t),o.addChild(e),o.val=r.getValue(o.val)+t.cdataPositionChar,w[14]&&(o.val+=p(w,t))}else o.val=(o.val||"")+(w[3]||"")+p(w,t);else if(n===u){o&&w[14]&&(o.val=r.getValue(o.val)+""+p(w,t));const e=new s(t.ignoreNameSpace?w[7]:w[5],o,"");w[8]&&w[8].length>0&&(w[8]=w[8].substr(0,w[8].length-1)),e.attrsMap=_(w[8],t),o.addChild(e)}else{const e=new s(t.ignoreNameSpace?w[7]:w[5],o,p(w,t));t.stopNodes.length&&t.stopNodes.includes(e.tagname)&&(e.startIndex=w.index+w[1].length),e.attrsMap=_(w[8],t),o.addChild(e),o=e}w=g,g=m.exec(e)}return n}},function(e,t,n){"use strict";var r=n(16);e.exports=r.DEFAULT=new r({include:[n(26)],explicit:[n(199),n(200),n(201)]})},function(e,t,n){"use strict";(function(t){const r=n(212),i=n(54),s=n(28),o=n(17),a=n(18).BigNumber,u=n(29),l=n(12),c=l.MT,h=l.NUMBYTES,d=(l.SIMPLE,l.SYMS),p=new a(-1),f=p.minus(new a(Number.MAX_SAFE_INTEGER.toString(16),16)),m=Symbol("count"),w=(Symbol("pending_key"),Symbol("major type")),g=Symbol("error"),_=Symbol("not found");function b(e,t,n){const r=[];return r[m]=n,r[d.PARENT]=e,r[w]=t,r}function y(e,t){const n=new u;return n[m]=-1,n[d.PARENT]=e,n[w]=t,n}function v(e){return o.bufferToBigInt(e)}function E(e){return BigInt("-1")-o.bufferToBigInt(e)}class A extends r{constructor(e){const t=(e=e||{}).tags;delete e.tags;const n=null!=e.max_depth?e.max_depth:-1;delete e.max_depth;const r=!!o.hasBigInt&&!!e.bigint;delete e.bigint,super(e),this.running=!0,this.max_depth=n,this.tags=t,r&&(null==this.tags&&(this.tags={}),this.tags[2]=v,this.tags[3]=E)}static nullcheck(e){switch(e){case d.NULL:return null;case d.UNDEFINED:return;case _:throw new Error("Value not found");default:return e}}static decodeFirstSync(e,t){let n,r={};switch(typeof(t=t||{encoding:"hex"})){case"string":n=t;break;case"object":r=o.extend({},t),n=r.encoding,delete r.encoding}const i=new A(r),s=new u(e,null!=n?n:o.guessEncoding(e)),a=i._parse();let l=a.next();for(;!l.done;){const e=s.read(l.value);if(null==e||e.length!==l.value)throw new Error("Insufficient data");l=a.next(e)}return A.nullcheck(l.value)}static decodeAllSync(e,t){let n,r={};switch(typeof(t=t||{encoding:"hex"})){case"string":n=t;break;case"object":r=o.extend({},t),n=r.encoding,delete r.encoding}const i=new A(r),s=new u(e,null!=n?n:o.guessEncoding(e)),a=[];for(;s.length>0;){const e=i._parse();let t=e.next();for(;!t.done;){const n=s.read(t.value);if(null==n||n.length!==t.value)throw new Error("Insufficient data");t=e.next(n)}a.push(A.nullcheck(t.value))}return a}static decodeFirst(e,t,n){let r={},i=!1,s="hex";switch(typeof t){case"function":n=t,s=o.guessEncoding(e);break;case"string":s=t;break;case"object":r=o.extend({},t),s=null!=r.encoding?r.encoding:o.guessEncoding(e),delete r.encoding,i=null!=r.required&&r.required,delete r.required}const a=new A(r);let u,l=_;return a.on("data",e=>{l=A.nullcheck(e),a.close()}),"function"==typeof n?(a.once("error",e=>{const t=l;return l=g,a.close(),n(e,t)}),a.once("end",()=>{switch(l){case _:return i?n(new Error("No CBOR found")):n(null,l);case g:return;default:return n(null,l)}})):u=new Promise((e,t)=>(a.once("error",e=>(l=g,a.close(),t(e))),a.once("end",()=>{switch(l){case _:return i?t(new Error("No CBOR found")):e(l);case g:return;default:return e(l)}}))),a.end(e,s),u}static decodeAll(e,t,n){let r={},i="hex";switch(typeof t){case"function":n=t,i=o.guessEncoding(e);break;case"string":i=t;break;case"object":r=o.extend({},t),i=null!=r.encoding?r.encoding:o.guessEncoding(e),delete r.encoding}const s=new A(r);let a;const u=[];return s.on("data",e=>u.push(A.nullcheck(e))),"function"==typeof n?(s.on("error",n),s.on("end",()=>n(null,u))):a=new Promise((e,t)=>{s.on("error",t),s.on("end",()=>e(u))}),s.end(e,i),a}close(){this.running=!1,this.__fresh=!0}*_parse(){let e=null,n=0,r=null;for(;;){if(this.max_depth>=0&&n>this.max_depth)throw new Error("Maximum depth "+this.max_depth+" exceeded");const l=(yield 1)[0];if(!this.running)throw new Error("Unexpected data: 0x"+l.toString(16));const g=l>>5,_=31&l,v=null!=e?e[w]:void 0,E=null!=e?e.length:void 0;switch(_){case h.ONE:this.emit("more-bytes",g,1,v,E),r=(yield 1)[0];break;case h.TWO:case h.FOUR:case h.EIGHT:const e=1<<_-24;this.emit("more-bytes",g,e,v,E);const t=yield e;r=g===c.SIMPLE_FLOAT?t:o.parseCBORint(_,t);break;case 28:case 29:case 30:throw this.running=!1,new Error("Additional info not implemented: "+_);case h.INDEFINITE:switch(g){case c.POS_INT:case c.NEG_INT:case c.TAG:throw new Error("Invalid indefinite encoding for MT "+g)}r=-1;break;default:r=_}switch(g){case c.POS_INT:break;case c.NEG_INT:r=r===Number.MAX_SAFE_INTEGER?f:r instanceof a?p.minus(r):-1-r;break;case c.BYTE_STRING:case c.UTF8_STRING:switch(r){case 0:this.emit("start-string",g,r,v,E),r=g===c.BYTE_STRING?t.allocUnsafe(0):"";break;case-1:this.emit("start",g,d.STREAM,v,E),e=y(e,g),n++;continue;default:this.emit("start-string",g,r,v,E),r=yield r,g===c.UTF8_STRING&&(r=o.utf8(r))}break;case c.ARRAY:case c.MAP:switch(r){case 0:r=g===c.MAP?{}:[];break;case-1:this.emit("start",g,d.STREAM,v,E),e=b(e,g,-1),n++;continue;default:this.emit("start",g,r,v,E),e=b(e,g,r*(g-3)),n++;continue}break;case c.TAG:this.emit("start",g,r,v,E),e=b(e,g,1),e.push(r),n++;continue;case c.SIMPLE_FLOAT:if("number"==typeof r){if(_===h.ONE&&r<32)throw new Error("Invalid two-byte encoding of simple value "+r);const t=null!=e;r=s.decode(r,t,t&&e[m]<0)}else r=o.parseCBORfloat(r)}this.emit("value",r,v,E,_);let A=!1;for(;null!=e;){switch(!1){case r!==d.BREAK:e[m]=1;break;case!Array.isArray(e):e.push(r);break;case!(e instanceof u):const t=e[w];if(null!=t&&t!==g)throw this.running=!1,new Error("Invalid major type in indefinite encoding");e.write(r)}if(0!=--e[m]){A=!0;break}if(--n,delete e[m],this.emit("stop",e[w]),Array.isArray(e))switch(e[w]){case c.ARRAY:r=e;break;case c.MAP:let t=!0;if(e.length%2!=0)throw new Error("Invalid map length: "+e.length);for(let n=0,r=e.length;n=48&&e[s]<=57||e[s]>=65&&e[s]<=70||e[s]>=97&&e[s]<=102;)s++;if(0===s)return e;if(13!=e[s]||10!=e[s+1])return e;s+=2;var i=parseInt(r.decode(e.subarray(t,s)),16);if(0==i)break;e.set(e.subarray(s,s+i),n),s+=i,n+=i,13==e[s]&&10==e[s+1]&&(s+=2),t=s}return e.subarray(0,n)}(e))}catch(e){console.log("Chunk-Encoding Ignored: "+e)}try{if("br"===t)0===(e=i()(e)).length&&(e=r);else if("gzip"===t||"gzip"===n){const t=new s.Inflate;t.push(e,!0),t.result&&!t.err&&(e=t.result)}}catch(e){console.log("Content-Encoding Ignored: "+e)}return e}},function(e,t,n){"use strict";var r={};(0,n(9).assign)(r,n(159),n(162),n(85)),e.exports=r},function(e,t){var n={};n[t.ACCEPTED=202]="Accepted",n[t.BAD_GATEWAY=502]="Bad Gateway",n[t.BAD_REQUEST=400]="Bad Request",n[t.CONFLICT=409]="Conflict",n[t.CONTINUE=100]="Continue",n[t.CREATED=201]="Created",n[t.EXPECTATION_FAILED=417]="Expectation Failed",n[t.FAILED_DEPENDENCY=424]="Failed Dependency",n[t.FORBIDDEN=403]="Forbidden",n[t.GATEWAY_TIMEOUT=504]="Gateway Timeout",n[t.GONE=410]="Gone",n[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP Version Not Supported",n[t.IM_A_TEAPOT=418]="I'm a teapot",n[t.INSUFFICIENT_SPACE_ON_RESOURCE=419]="Insufficient Space on Resource",n[t.INSUFFICIENT_STORAGE=507]="Insufficient Storage",n[t.INTERNAL_SERVER_ERROR=500]="Server Error",n[t.LENGTH_REQUIRED=411]="Length Required",n[t.LOCKED=423]="Locked",n[t.METHOD_FAILURE=420]="Method Failure",n[t.METHOD_NOT_ALLOWED=405]="Method Not Allowed",n[t.MOVED_PERMANENTLY=301]="Moved Permanently",n[t.MOVED_TEMPORARILY=302]="Moved Temporarily",n[t.MULTI_STATUS=207]="Multi-Status",n[t.MULTIPLE_CHOICES=300]="Multiple Choices",n[t.NETWORK_AUTHENTICATION_REQUIRED=511]="Network Authentication Required",n[t.NO_CONTENT=204]="No Content",n[t.NON_AUTHORITATIVE_INFORMATION=203]="Non Authoritative Information",n[t.NOT_ACCEPTABLE=406]="Not Acceptable",n[t.NOT_FOUND=404]="Not Found",n[t.NOT_IMPLEMENTED=501]="Not Implemented",n[t.NOT_MODIFIED=304]="Not Modified",n[t.OK=200]="OK",n[t.PARTIAL_CONTENT=206]="Partial Content",n[t.PAYMENT_REQUIRED=402]="Payment Required",n[t.PERMANENT_REDIRECT=308]="Permanent Redirect",n[t.PRECONDITION_FAILED=412]="Precondition Failed",n[t.PRECONDITION_REQUIRED=428]="Precondition Required",n[t.PROCESSING=102]="Processing",n[t.PROXY_AUTHENTICATION_REQUIRED=407]="Proxy Authentication Required",n[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="Request Header Fields Too Large",n[t.REQUEST_TIMEOUT=408]="Request Timeout",n[t.REQUEST_TOO_LONG=413]="Request Entity Too Large",n[t.REQUEST_URI_TOO_LONG=414]="Request-URI Too Long",n[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="Requested Range Not Satisfiable",n[t.RESET_CONTENT=205]="Reset Content",n[t.SEE_OTHER=303]="See Other",n[t.SERVICE_UNAVAILABLE=503]="Service Unavailable",n[t.SWITCHING_PROTOCOLS=101]="Switching Protocols",n[t.TEMPORARY_REDIRECT=307]="Temporary Redirect",n[t.TOO_MANY_REQUESTS=429]="Too Many Requests",n[t.UNAUTHORIZED=401]="Unauthorized",n[t.UNPROCESSABLE_ENTITY=422]="Unprocessable Entity",n[t.UNSUPPORTED_MEDIA_TYPE=415]="Unsupported Media Type",n[t.USE_PROXY=305]="Use Proxy",t.getStatusText=function(e){if(n.hasOwnProperty(e))return n[e];throw new Error("Status code does not exist: "+e)},t.getStatusCode=function(e){for(key in n)if(n[key]===e)return parseInt(key,10);throw new Error("Reason phrase does not exist: "+e)}},function(e,t,n){"use strict";let{Json2Csv:r}=n(204),{Csv2Json:i}=n(207),s=n(53);function o(e,t,n,r){return s.convert({data:t,callback:n,options:r,converter:e})}function a(e,t,n){return new Promise((r,i)=>o(e,t,(e,t)=>e?i(e):r(t),n))}function u(e,t,n,r,i){return console.warn("WARNING: "+t+" is deprecated and will be removed soon. Please use "+n+" instead."),a(e,r,i)}e.exports={json2csv:(e,t,n)=>o(r,e,t,n),csv2json:(e,t,n)=>o(i,e,t,n),json2csvAsync:(e,t)=>a(r,e,t),csv2jsonAsync:(e,t)=>a(i,e,t),json2csvPromisified:(e,t)=>u(r,"json2csvPromisified()","json2csvAsync()",e,t),csv2jsonPromisified:(e,t)=>u(i,"csv2jsonPromisified()","csv2jsonAsync()",e,t)}},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function h(e,t,n,r){var i,s,o,a;if(l(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=c(e))>0&&o.length>i&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function d(){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 p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)s(u,this,t);else{var l=u.length,c=w(u,l);for(n=0;n=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){(t=e.exports=n(68)).Stream=t,t.Readable=t,t.Writable=n(45),t.Duplex=n(10),t.Transform=n(74),t.PassThrough=n(137)},function(e,t,n){var r=n(3),i=r.Buffer;function s(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(s(r,t),t.Buffer=o),s(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(t,r,i){var s=n(33);function o(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=_;var a,u=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:s.nextTick;_.WritableState=g;var l=Object.create(n(23));l.inherits=n(13);var c={deprecate:n(135)},h=n(70),d=n(44).Buffer,p=i.Uint8Array||function(){};var f,m=n(71);function w(){}function g(e,t){a=a||n(10),e=e||{};var r=t instanceof a;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var i=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var h=!1===e.decodeStrings;this.decodeStrings=!h,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(s.nextTick(i,r),s.nextTick(x,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(i(r),e._writableState.errorEmitted=!0,e.emit("error",r),x(e,t))}(e,n,r,t,i);else{var o=E(n);o||n.corked||n.bufferProcessing||!n.bufferedRequest||v(e,n),r?u(y,e,n,o,i):y(e,n,o,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function _(e){if(a=a||n(10),!(f.call(_,this)||this instanceof a))return new _(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),h.call(this)}function b(e,t,n,r,i,s,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,n?e._writev(i,t.onwrite):e._write(i,s,t.onwrite),t.sync=!1}function y(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),x(e,t)}function v(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,i=new Array(r),s=t.corkedRequestsFree;s.entry=n;for(var a=0,u=!0;n;)i[a]=n,n.isBuf||(u=!1),n=n.next,a+=1;i.allBuffers=u,b(e,t,!0,t.length,i,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new o(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,h=n.callback;if(b(e,t,!1,t.objectMode?1:l.length,l,c,h),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function A(e,t){e._final((function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),x(e,t)}))}function x(e,t){var n=E(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,s.nextTick(A,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(_,h),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(f=Function.prototype[Symbol.hasInstance],Object.defineProperty(_,Symbol.hasInstance,{value:function(e){return!!f.call(this,e)||this===_&&(e&&e._writableState instanceof g)}})):f=function(e){return e instanceof this},_.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},_.prototype.write=function(e,t,n){var r,i=this._writableState,o=!1,a=!i.objectMode&&(r=e,d.isBuffer(r)||r instanceof p);return a&&!d.isBuffer(e)&&(e=function(e){return d.from(e)}(e)),"function"==typeof t&&(n=t,t=null),a?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=w),i.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),s.nextTick(t,n)}(this,n):(a||function(e,t,n,r){var i=!0,o=!1;return null===n?o=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(e.emit("error",o),s.nextTick(r,o),i=!1),i}(this,i,e,n))&&(i.pendingcb++,o=function(e,t,n,r,i,s){if(!n){var o=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=d.from(t,n));return t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=t.objectMode?1:r.length;t.length+=a;var u=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(_.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),_.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},_.prototype._writev=null,_.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,x(e,t),n&&(t.finished?s.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),_.prototype.destroy=m.destroy,_.prototype._undestroy=m.undestroy,_.prototype._destroy=function(e,t){this.end(),t(e)}}).call(this,n(14),n(72).setImmediate,n(6))},function(e,t,n){"use strict";const r=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];t.REPLACEMENT_CHARACTER="�",t.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},t.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},t.isSurrogate=function(e){return e>=55296&&e<=57343},t.isSurrogatePair=function(e){return e>=56320&&e<=57343},t.getSurrogatePairCodePoint=function(e,t){return 1024*(e-55296)+9216+t},t.isControlCodePoint=function(e){return 32!==e&&10!==e&&13!==e&&9!==e&&12!==e&&e>=1&&e<=31||e>=127&&e<=159},t.isUndefinedCodePoint=function(e){return e>=64976&&e<=65007||r.indexOf(e)>-1}},function(e,t,n){"use strict";class r{constructor(e){const t={},n=this._getOverriddenMethods(this,t);for(const r of Object.keys(n))"function"==typeof n[r]&&(t[r]=e[r],e[r]=n[r])}_getOverriddenMethods(){throw new Error("Not implemented")}}r.install=function(e,t,n){e.__mixins||(e.__mixins=[]);for(let n=0;n=0?t:void 0),remainingKeyPath:e.slice(t+1)}}e.exports={evaluatePath:function e(t,n){if(!t)return null;let{indexOfDot:i,currentKey:s,remainingKeyPath:o}=r(n);if(i>=0&&!t[n])return Array.isArray(t[s])?t[s].map(t=>e(t,o)):e(t[s],o);if(Array.isArray(t))return t.map(t=>e(t,n));return t[n]},setPath:function e(t,n,i){if(!t)throw new Error("No document was provided.");let{indexOfDot:s,currentKey:o,remainingKeyPath:a}=r(n);if(s>=0){if(!t[o]&&Array.isArray(t))return t.forEach(t=>e(t,n,i));t[o]||(t[o]={}),e(t[o],a,i)}else{if(Array.isArray(t))return t.forEach(t=>e(t,a,i));t[n]=i}return t}}},function(e){e.exports=JSON.parse('{"errors":{"callbackRequired":"A callback is required!","optionsRequired":"Options were not passed and are required.","json2csv":{"cannotCallOn":"Cannot call json2csv on ","dataCheckFailure":"Data provided was not an array of documents.","notSameSchema":"Not all documents have the same schema."},"csv2json":{"cannotCallOn":"Cannot call csv2json on ","dataCheckFailure":"CSV is not a string."}},"defaultOptions":{"delimiter":{"field":",","wrap":"\\"","eol":"\\n"},"excelBOM":false,"prependHeader":true,"trimHeaderFields":false,"trimFieldValues":false,"sortHeader":false,"parseCsvNumbers":false,"keys":null,"checkSchemaDifferences":false,"expandArrayObjects":false,"unwindArrays":false,"useLocaleFormat":false},"values":{"excelBOM":"\ufeff"}}')},function(e,t,n){"use strict";let r=n(51),i=n(52);const s=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;function o(e){return JSON.parse(JSON.stringify(e))}function a(e){return c(e)||l(e)||""===e}function u(e){return"object"==typeof e}function l(e){return null===e}function c(e){return void 0===e}function h(e,t){return e.filter(e=>!t.includes(e))}e.exports={isStringRepresentation:function(e,t){const n=e[0],r=e.length-1,i=e[r];return n===t.delimiter.wrap&&i===t.delimiter.wrap},isDateRepresentation:function(e){return s.test(e)},computeSchemaDifferences:function(e,t){return h(e,t).concat(h(t,e))},deepCopy:o,convert:function(e){let{options:t,callback:n}=function(e,t){if(u(e)&&(n=e,"function"!=typeof n))return{options:e,callback:t};var n;return{options:t,callback:e}}(e.callback,e.options);r=t,(r={...i.defaultOptions,...r||{}}).delimiter={...i.defaultOptions.delimiter,...r.delimiter},t=r;var r;let s=new e.converter(t);(function(e){if(!e.callback)throw new Error(i.errors.callbackRequired);if(!e.data)return e.callback(new Error(e.errorMessages.cannotCallOn+e.data+".")),!1;if(!e.dataCheckFn(e.data))return e.callback(new Error(e.errorMessages.dataCheckFailure)),!1;return!0})({data:e.data,callback:n,errorMessages:s.validationMessages,dataCheckFn:s.validationFn})&&s.convert(e.data,n)},isEmptyField:a,removeEmptyFields:function(e){return e.filter(e=>!a(e))},getNCharacters:function(e,t,n){return e.substring(t,t+n)},unwind:function(e,t){const n=[];return e.forEach(e=>{!function(e,t,n){const i=r.evaluatePath(t,n);let s=o(t);Array.isArray(i)?i.forEach(i=>{s=o(t),e.push(r.setPath(s,n,i))}):e.push(s)}(n,e,t)}),n},isInvalid:function(e){return e===1/0||e===-1/0},isString:function(e){return"string"==typeof e},isNull:l,isError:function(e){return"[object Error]"===Object.prototype.toString.call(e)},isDate:function(e){return e instanceof Date},isUndefined:c,isObject:u,unique:function(e){return[...new Set(e)]},flatten:function(e){return[].concat(...e)}}},function(e,t,n){"use strict";const r=n(18).BigNumber,i=n(17),s=n(55),o=new r(-1),a=new r(10),u=new r(2);class l{constructor(e,t,n){if(this.tag=e,this.value=t,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){let t=null!=e?e[this.tag]:void 0;if("function"!=typeof t&&(t=l["_tag_"+this.tag],"function"!=typeof t))return this;try{return t.call(l,this.value)}catch(e){return this.err=e,this}}static _tag_0(e){return new Date(e)}static _tag_1(e){return new Date(1e3*e)}static _tag_2(e){return i.bufferToBignumber(e)}static _tag_3(e){return o.minus(i.bufferToBignumber(e))}static _tag_4(e){return a.pow(e[0]).times(e[1])}static _tag_5(e){return u.pow(e[0]).times(e[1])}static _tag_32(e){return s.parse(e)}static _tag_35(e){return new RegExp(e)}}e.exports=l},function(e,t,n){"use strict";var r=n(213),i=n(215);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=b,t.resolve=function(e,t){return b(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?b(e,!1,!0).resolveObject(t):t},t.format=function(e){i.isString(e)&&(e=b(e));return e instanceof s?e.format():s.prototype.format.call(e)},t.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,l=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(l),h=["%","/","?",";","#"].concat(c),d=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=n(216);function b(e,t,n){if(e&&i.isObject(e)&&e instanceof s)return e;var r=new s;return r.parse(e,t,n),r}s.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var s=e.indexOf("?"),a=-1!==s&&s127?N+="x":N+=I[F];if(!N.match(p)){var L=R.slice(0,C),B=R.slice(C+1),U=I.match(f);U&&(L.push(U[1]),B.unshift(U[2])),B.length&&(b="/"+B.join(".")+b),this.hostname=L.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=r.toASCII(this.hostname));var M=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+M,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[E])for(C=0,O=c.length;C0)&&n.host.split("@"))&&(n.auth=D.shift(),n.host=n.hostname=D.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!A.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var T=A.slice(-1)[0],S=(n.host||e.host||A.length>1)&&("."===T||".."===T)||""===T,C=0,k=A.length;k>=0;k--)"."===(T=A[k])?A.splice(k,1):".."===T?(A.splice(k,1),C++):C&&(A.splice(k,1),C--);if(!v&&!E)for(;C--;C)A.unshift("..");!v||""===A[0]||A[0]&&"/"===A[0].charAt(0)||A.unshift(""),S&&"/"!==A.join("/").substr(-1)&&A.push("");var D,R=""===A[0]||A[0]&&"/"===A[0].charAt(0);x&&(n.hostname=n.host=R?"":A.length?A.shift():"",(D=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=D.shift(),n.host=n.hostname=D.shift()));return(v=v||n.host&&A.length)&&!R&&A.unshift(""),A.length?n.pathname=A.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},s.prototype.parseHost=function(){var e=this.host,t=a.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},,function(e,t,n){"use strict";const{Transform:r}=n(4),i=n(34),s=n(144),o=n(47),a=n(76),u=n(146),l=n(147),c={sourceCodeLocationInfo:!1};const h={[i.START_TAG_TOKEN]:{eventName:"startTag",reshapeToken:e=>({tagName:e.tagName,attrs:e.attrs,selfClosing:e.selfClosing,sourceCodeLocation:e.location})},[i.END_TAG_TOKEN]:{eventName:"endTag",reshapeToken:e=>({tagName:e.tagName,sourceCodeLocation:e.location})},[i.COMMENT_TOKEN]:{eventName:"comment",reshapeToken:e=>({text:e.data,sourceCodeLocation:e.location})},[i.DOCTYPE_TOKEN]:{eventName:"doctype",reshapeToken:e=>({name:e.name,publicId:e.publicId,systemId:e.systemId,sourceCodeLocation:e.location})},[i.CHARACTER_TOKEN]:{eventName:"text",reshapeToken:e=>({text:e.chars,sourceCodeLocation:e.location})}};e.exports=class extends r{constructor(e){super({encoding:"utf8",decodeStrings:!1}),this.options=a(c,e),this.tokenizer=new i(e),this.locInfoMixin=null,this.options.sourceCodeLocationInfo&&(this.locInfoMixin=o.install(this.tokenizer,s)),this.parserFeedbackSimulator=new l(this.tokenizer),this.pendingText=null,this.lastChunkWritten=!1,this.stopped=!1,this.pipe(new u)}_transform(e,t,n){if("string"!=typeof e)throw new TypeError("Parser can work only with string streams.");n(null,this._transformChunk(e))}_final(e){this.lastChunkWritten=!0,e(null,this._transformChunk(""))}stop(){this.stopped=!0}_transformChunk(e){return this.stopped||(this.tokenizer.write(e,this.lastChunkWritten),this._runParsingLoop()),e}_runParsingLoop(){let e=null;do{if(e=this.parserFeedbackSimulator.getNextToken(),e.type===i.HIBERNATION_TOKEN)break;if(e.type===i.CHARACTER_TOKEN||e.type===i.WHITESPACE_CHARACTER_TOKEN||e.type===i.NULL_CHARACTER_TOKEN){if(null===this.pendingText)e.type=i.CHARACTER_TOKEN,this.pendingText=e;else if(this.pendingText.chars+=e.chars,this.options.sourceCodeLocationInfo){const{endLine:t,endCol:n,endOffset:r}=e.location;Object.assign(this.pendingText.location,{endLine:t,endCol:n,endOffset:r})}}else this._emitPendingText(),this._handleToken(e)}while(!this.stopped&&e.type!==i.EOF_TOKEN)}_handleToken(e){if(e.type===i.EOF_TOKEN)return!0;const{eventName:t,reshapeToken:n}=h[e.type];return 0!==this.listenerCount(t)&&(this._emitToken(t,n(e)),!0)}_emitToken(e,t){this.emit(e,t)}_emitPendingText(){null!==this.pendingText&&(this._handleToken(this.pendingText),this.pendingText=null)}}},function(e,t,n){"use strict";n.r(t),n.d(t,"CollectionLoader",(function(){return ye})),n.d(t,"WorkerLoader",(function(){return ve}));const r=(e,t)=>t.some(t=>e instanceof t);let i,s;const o=new WeakMap,a=new WeakMap,u=new WeakMap,l=new WeakMap,c=new WeakMap;let h={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return a.get(e);if("objectStoreNames"===t)return e.objectStoreNames||u.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return m(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function d(e){h=e(h)}function p(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(w(this),t),m(o.get(this))}:function(...t){return m(e.apply(w(this),t))}:function(t,...n){const r=e.call(w(this),t,...n);return u.set(r,t.sort?t.sort():[t]),m(r)}}function f(e){return"function"==typeof e?p(e):(e instanceof IDBTransaction&&function(e){if(a.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});a.set(e,t)}(e),r(e,i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,h):e)}function m(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(m(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&o.set(t,e)}).catch(()=>{}),c.set(t,e),t}(e);if(l.has(e))return l.get(e);const t=f(e);return t!==e&&(l.set(e,t),c.set(t,e)),t}const w=e=>c.get(e);function g(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=m(o);return r&&o.addEventListener("upgradeneeded",e=>{r(m(o.result),e.oldVersion,e.newVersion,m(o.transaction))}),n&&o.addEventListener("blocked",()=>n()),s&&o.addEventListener("close",()=>s()),i&&a.then(e=>e.addEventListener("versionchange",i)).catch(()=>{}),a}function _(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),m(n).then(()=>{})}const b=["get","getKey","getAll","getAllKeys","count"],y=["put","add","delete","clear"],v=new Map;function E(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(v.get(t))return v.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=y.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!b.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,i?"readwrite":"readonly");let o=s.store;r&&(o=o.index(t.shift()));const a=o[n](...t);return i&&await s.done,a};return v.set(t,s),s}d(e=>({...e,get:(t,n,r)=>E(t,n)||e.get(t,n,r),has:(t,n)=>!!E(t,n)||e.has(t,n)}));const A=["continue","continuePrimaryKey","advance"],x={},T=new WeakMap,S=new WeakMap,C={get(e,t){if(!A.includes(t))return e[t];let n=x[t];return n||(n=x[t]=function(...e){T.set(this,S.get(this)[t](...e))}),n}};async function*k(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const n=new Proxy(t,C);for(S.set(n,t),c.set(n,w(t));t;)yield n,t=await(T.get(n)||t.continue()),T.delete(n)}function D(e,t){return t===Symbol.asyncIterator&&r(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&r(e,[IDBIndex,IDBObjectStore])}d(e=>({...e,get:(t,n,r)=>D(t,n)?k:e.get(t,n,r),has:(t,n)=>D(t,n)||e.has(t,n)}));var R=n(0),O=n(121),I=n.n(O);const N=[{match:/[?&](_|cb|_ga|\w*cache\w*)=[\d.-]+(?=$|&)/i,replace:""},{match:/([?&])utm_[^=]+=[^&]+(?=&|$)/g,replace:""},{match:/[?&](callback=jsonp)[^&]+(?=&|$)/i,replace:""},{match:/[?&]((?:\w+)=jquery)[\d]+_[\d]+/i,replace:""},{match:/\/\/.*(?:gcs-vimeo|vod|vod-progressive)\.akamaized\.net.*(\/[\d]+)\/[\d]+(.mp4)/,replace:"//video.vimeo.net$1$2",split:".net",last:!0},{match:/\/\/.*(player.vimeo.com\/video\/[\d]+)\?.*/i,replace:"$1"},{match:/www.\washingtonpost\.com\/wp-apps\/imrs.php/,args:[["src"]]},{match:/(\.(?:php|js|webm|mp4|gif|jpg|png|css|json|m3u8))\?.*/i,replace:"$1"},{match:/(\/\/.*www\.youtube\.com\/embed\/[^?]+)[?].*/i,replace:"$1"},{match:/(www\.)?youtube(-nocookie)?\.com\/get_video_info/i,args:[["video_id","html5"]]},{match:/\/\/.*(googlevideo.com\/videoplayback)/i,replace:"server.$1",args:[["id","itag"],["id"]]},{match:/facebook\.com\/ajax\/pagelet\/generic.php\/photoviewerinitpagelet/i,args:[[{arg:"data",keys:["query_type","fbid","v","cursor","data"]}]]},{match:/facebook\.com\/api\/graphql/i,args:[["variables","doc_id"]],fuzzyArgs:!0},{match:/facebook\.com\/api\/graphqlbatch/i,args:[["batch_name","queries"],["batch_name"]]},{match:/facebook\.com\/ajax\/navigation/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/route-definition/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/bulk-route-definitions/i,args:[["route_urls[0]","__user"],["route_urls[0]"]]},{match:/facebook\.com\/ajax\/relay-ef/i,args:[["queries[0]","__user"],["queries[0]"]]},{match:/facebook\.com\/videos\/vodcomments/i,args:[["eft_id"]]},{match:/facebook\.com\/ajax\.*/i,replaceQuery:/([?&][^_]\w+=[^&]+)/g},{match:/plus\.googleapis\.com\/u\/\/0\/_\/widget\/render\/comments/i,args:[["href","stream_id","substream_id"]]},{match:/(static.wixstatic.com\/.*\.[\w]+)\/v1\/fill\/w_.*/,replace:"$1"}];function F(e,t,n){if(!(n&&n.rule&&n.rule.replace&&n.rule.split))return function(e,t,n){try{e=new URL(e)}catch(e){return 0}const r=n&&n.args&&!n.fuzzyArgs?new Set(n.args[0]):null;let i=0,s=null;const o=new URLSearchParams(e.search);for(const e of t){if(204===e.mime)continue;let t="string"==typeof e?e:e.url;try{t=new URL(t)}catch(e){continue}const n=new URLSearchParams(t.search);let a=P(o,n,r);a+=P(n,o,r),a/=2,a>i&&(i=a,s=e)}return{score:i,result:s}}(e,t,n&&n.rule);const r=n.fuzzyUrl.endsWith("?")?n.fuzzyUrl.slice(0,-1):n.fuzzyUrl,i=n.rule.match,s=n.rule.replace;for(const e of t){if(r===("string"==typeof e?e:e.url).replace(i,s))return{score:1,result:e}}return{score:0,result:null}}function P(e,t,n){let r=1,i=1;for(const[s,o]of e){const e=t.get(s);if(n&&n.has(s)&&e!==o)return-1;let a;a="_"===s[0]?1:10;const u=Number(o),l=Number(e);if(i+=a,e===o)r+=a*o.length;else if(null===e)r-=1;else if(isNaN(u)||isNaN(l)){r+=a*(Math.min(e.length,o.length)-I()(e,o))}else r+=10-Math.log(Math.abs(u-l)+1)}return r/i}const L=new class{constructor(e){this.rules=e||N}*fuzzyUrls(e,t=!1){const n=e;function r(e,r){if(!t)return e;const i=r.split||"?",s=n.indexOf(i);return[e,{prefix:s>0?n.slice(0,s+i.length):n,rule:r,fuzzyUrl:e}]}-1===e.indexOf("?")&&(e+="?");for(const t of this.rules){if(e.match(t.match))if(void 0===t.args&&void 0!==t.replace){const n=e.replace(t.match,t.replace);if(n!=e&&(yield r(n,t),e=n),t.last)break}else{if(void 0!==t.args){void 0!==t.replace&&(e=e.replace(t.match,t.replace));for(let n of t.args){const i=this.getQueryUrl(e,n);e!=i&&(yield r(i,t))}break}if(t.replaceQuery){const n=e.match(t.replaceQuery),i=this.getQueryUrl(e,n?n.join(""):"");i!=e&&(yield r(i,t));break}}}}getQueryUrl(e,t){try{e=new URL(e)}catch(e){return null}if("string"==typeof t)return e.search=t,e.toString();const n=new URLSearchParams(e.search),r=new URLSearchParams;for(const e of t)if("string"==typeof e){const t=n.get(e);t&&r.set(e,t)}else"object"==typeof e&&this.setQueryJsonArg(n,r,e);return e.search="?"+r.toString(),e.toString()}setQueryJsonArg(e,t,n){let r;try{r=e.get(n.arg),r=JSON.parse(r)}catch(e){return void console.log("JSON parse error: "+r)}let i={};for(const e of n.keys){const t=r[e];null!=t&&(i[e]=t)}t.set(n.arg,JSON.stringify(i))}};var B=n(40),U=n(5);class M{constructor(e,t={}){this.name=e,this.db=null;const{minDedupSize:n}=t;this.minDedupSize=Number.isInteger(n)?n:1024,this.version=1,this.useRefCounts=!0,this.allowRepeats=!0,this.repeatTracker=this.allowRepeats?new W:null,this.fuzzyPrefixSearch=!0,this.initing=this.init()}async init(){this.db=await g(this.name,this.version,{upgrade:(e,t,n,r)=>this._initDB(e,t,n,r),blocking:e=>{e&&null!==e.newVersion||this.close()}})}_initDB(e,t,n,r){if(!t){const t=e.createObjectStore("pages",{keyPath:"id"});t.createIndex("url","url"),t.createIndex("ts","ts");e.createObjectStore("pageLists",{keyPath:"id",autoIncrement:!0});e.createObjectStore("curatedPages",{keyPath:"id",autoIncrement:!0}).createIndex("listPages",["list","pos"]);const n=e.createObjectStore("resources",{keyPath:["url","ts"]});n.createIndex("pageId","pageId"),n.createIndex("mimeStatusUrl",["mime","status","url"]);e.createObjectStore("payload",{keyPath:"digest",unique:!0}),e.createObjectStore("digestRef",{keyPath:"digest",unique:!0})}}async clearAll(){const e=["pages","resources","payload","digestRef"];for(const t of e)await this.db.clear(t)}close(){this.db&&(this.db.close(),this.db=null)}async delete(){this.close(),await _(this.name,{blocked(e){console.log("Unable to delete: "+e)}})}async addPage(e,t){const n=e.url,r=e.title||e.url,i=e.id||this.newPageId();let s=e.ts;s||!e.date&&!e.datetime||(s=new Date(e.date||e.datetime).getTime());const o={...e,url:n,ts:s,title:r,id:i};return t?(t.store.put(o),o.id):await this.db.put("pages",o)}async addPages(e){const t=this.db.transaction("pages","readwrite");for(const t of e)this.addPage(t);try{await t.done}catch(e){console.warn("addPages tx",e.toString())}}async addCPageList(e){const t={};return t.title=e.title,t.desc=e.desc,t.slug=e.slug,await this.db.put("pageLists",t)}async addCuratedPageLists(e,t="pages",n="public"){for(const r of e){if(n&&!r[n])continue;const e=await this.addCPageList(r),i=this.db.transaction("curatedPages","readwrite");let s=0;const o=r[t]||[];for(const t of o){const n={};n.pos=s++,n.list=e;const r=typeof t.page;n.page="string"===r?t.page:"object"===r?t.page.id:t.page_id||t.pageId,n.desc=t.desc,i.store.put(n)}try{await i.done}catch(e){console.warn("addCuratedPageLists tx",e.toString())}}}async getAllCuratedByList(){const e=await this.db.getAll("pageLists"),t=this.db.transaction("curatedPages","readonly");for await(const n of t.store.index("listPages").iterate()){const t=e[n.value.list-1];t&&(t.show=!0,t.pages||(t.pages=[]),t.pages.push(n.value))}return e}newPageId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async getAllPages(){return await this.db.getAll("pages")}async getPages(e){const t=[];e.sort();for await(const n of this.matchAny("pages",null,e))t.push(n);return t}async dedupResource(e,t,n){const r=n.objectStore("digestRef"),i=!!e&&await r.get(e);let s=!0;if(i)++i.count,r.put(i),s=!1;else try{n.objectStore("payload").add({digest:e,payload:t});const i=1,s=t.length;r.put({digest:e,count:i,size:s})}catch(e){console.log(e)}return s}async addResources(e){const t=[],n=[];let r=this.db.transaction(["digestRef","payload"],"readwrite");for(const i of e)"warc/revisit"===i.mime?t.push(i):n.push(i),this.useRefCounts&&i.digest&&i.payload&&(await this.dedupResource(i.digest,i.payload,r),delete i.payload);try{await r.done}catch(e){console.log("Payload Bulk Add Failed: "+e)}const i=this.db.transaction("resources","readwrite");for(const e of t)i.store.put(e);for(const e of n)i.store.put(e),this._addUrlFuzzy(e,i);await i.done}async _addUrlFuzzy(e,t){if(e.status>=200&&e.status<300&&204!=e.status)for await(const n of L.fuzzyUrls(e.url)){if(n===e.url)continue;const r={url:n,ts:e.ts,origURL:e.url,origTS:e.ts,pageId:e.pageId,digest:e.digest};t.store.put(r)}}async addResource(e){let t=!1;if(e.payload&&e.payload.length>this.minDedupSize){e.digest||(e.digest=await Object(R.d)(e.payload,"sha-256"));const n=this.db.transaction(["digestRef","payload"],"readwrite");t=await this.dedupResource(e.digest,e.payload,n);try{await n.done}catch(e){console.log("Payload Add Failed: "+e)}delete e.payload}if("warc/revisit"===e.mime){try{await this.db.add("resources",e)}catch(t){console.log("Skip Duplicate revisit for: "+e.url)}return t}const n=this.db.transaction("resources","readwrite");n.store.put(e),this._addUrlFuzzy(e,n);try{await n.done}catch(t){console.log("Fuzzy Add Error for "+e.url),console.log(t)}return t}async getResource(e,t,n){const r=Object(R.m)(e.timestamp).getTime();let i=e.url,s=null;const o={skip:this.repeatTracker?this.repeatTracker.getSkipCount(n,i,e.request.method):0};if(i.startsWith("//")){let t=!1;s=await this.lookupUrl("https:"+i,r,o),s||(s=await this.lookupUrl("http:"+i,r,o),(s||e.request.referrer.indexOf("/http://",2)>0)&&(t=!0)),i=(t?"http:":"https:")+i}else s=await this.lookupUrl(i,r,o);let a;if(!s)for await(const[e,t]of L.fuzzyUrls(i,!0)){if(s=await this.lookupUrl(e),s)break;a||(a=t)}if(!s&&a&&this.fuzzyPrefixSearch&&(s=await this.lookupQueryPrefix(i,a)),s&&s.origURL){const e=await this.lookupUrl(s.origURL,s.origTS||s.ts);e&&(i=e.url,s=e)}if(!s)return null;const u=s.status,l=s.statusText||Object(B.getStatusText)(u);let c=null;if(!Object(R.i)()&&(c=await this.loadPayload(s),!c))return null;const h=Object(R.j)(s.respHeaders),d=new Date(s.ts),p=s.extraOpts||null;return new U.a({url:i,payload:c,status:u,statusText:l,headers:h,date:d,extraOpts:p})}async loadPayload(e){if(e.digest&&!e.payload){const t=await this.db.get("payload",e.digest);if(!t)return null;const{payload:n}=t;return n}return e.payload}async lookupUrl(e,t,n={}){const r=this.db.transaction("resources","readonly");if(t){const n=await r.store.get([e,t]);if(n)return n}let i=null,s=n.skip||0;for await(const n of r.store.iterate(this.getLookupRange(e))){if(i&&n.value.ts>t){if(0==s){return n.value.ts-tt?++a:i?(yield o.value,o=await o.continue()):o=await o.continue(n[a])}}async resourcesByUrlAndMime(e,t,n=1e3,r=!0,i="",s=""){const o=t?null:n,a=await this.db.getAll("resources",this.getLookupRange(e,r?"prefix":"exact",i,s),o);t=t.split(",");const u=[];for(const e of a)for(const r of t)if(!r||e.mime&&e.mime.startsWith(r)){if(u.push(this.resJson(e)),u.length===n)return u;break}return u}async resourcesByMime(e,t=100,n="",r="",i=0){const s=[];(e=e.split(",")).sort();let o=[];n&&o.push([n,i,r]);for(const t of e)(!n||!t||t>n)&&o.push([t,0,""]);for await(const e of this.matchAny("resources","mimeStatusUrl",o,0))if(s.push(this.resJson(e)),s.length===t)break;return s}async deletePage(e){const t=this.db.transaction("pages","readwrite"),n=await t.store.get(e);await t.store.delete(e);const r=await this.deletePageResources(e);return{pageSize:n&&n.size||0,dedupSize:r}}async deletePageResources(e){const t={},n=this.db.transaction("resources","readwrite");let r=await n.store.index("pageId").openCursor(e),i=0;for(;r;){const e=r.value.digest;e?t[e]=(t[e]||0)+1:r.value.payload&&(i+=r.value.payload.length),n.store.delete(r.primaryKey),r=await r.continue()}await n.done;const s=this.db.transaction(["payload","digestRef"],"readwrite"),o=s.objectStore("digestRef");for(const e of Object.keys(t)){const n=await o.get(e);n&&(n.count-=t[e]),n&&n.count>=1?o.put(n):(i+=n?n.size:0,o.delete(e),s.objectStore("payload").delete(e))}return await s.done,i}getLookupRange(e,t,n,r){let i,s,o;switch(t){case"prefix":s=e.slice(0,-1)+String.fromCharCode(e.charCodeAt(e.length-1)+1),i=[e],s=[s];break;case"host":const t=new URL(e).origin;i=[t+"/"],s=[t+"0"];break;case"exact":default:i=[e],s=[e+"!"]}return n?(i=[n,r||""],o=!0):o=!1,IDBKeyRange.bound(i,s,o,!0)}}class W{constructor(){this.repeats={}}getSkipCount(e,t,n){if("POST"!==n)return 0;e.replacesClientId&&delete this.repeats[e.replacesClientId];const r=e.resultingClientId||e.clientId;return r?(void 0===this.repeats[r]&&(this.repeats[r]={}),void 0===this.repeats[r][t]?this.repeats[r][t]=0:this.repeats[r][t]++,this.repeats[r][t]):0}}var j=n(1),z=n(57),H=n.n(z),G=n(4),q=n(38);const V=["script","style","header","footer","banner-div","noscript"];var X=n(20);class K extends X.a{constructor(e,t=null,n=null){super(),this.reader=e,this.abort=t,this.loadId=n,this.anyPages=!1,this.detectPages=!1,this._lastRecord=null,this.metadata={},this.pageMap={},this.pages=[],this.lists=[]}parseWarcInfo(e){if(!e.payload)return;const t=new TextDecoder("utf-8").decode(e.payload);for(const e of t.split("\n"))if(e.startsWith("json-metadata:"))try{const t=JSON.parse(e.slice("json-metadata:".length));if("collection"===t.type&&(this.metadata.desc=t.desc,this.metadata.title=t.title),t.pages&&t.pages.length){this.pages=this.pages.concat(t.pages);for(const e of t.pages)e.ts=Object(R.m)(e.timestamp).getTime(),this.pageMap[e.ts+"/"+e.url]={page:e};this.anyPages=!0}t.lists&&t.lists.length&&(this.lists=this.lists.concat(t.lists))}catch(e){console.log("Page Add Error",e.toString())}}index(e){if("warcinfo"!==e.warcType){if(this._lastRecord)return this._lastRecord.warcTargetURI!=e.warcTargetURI?(this.indexReqResponse(this._lastRecord,null),void(this._lastRecord=e)):void("request"===e.warcType&&"response"===this._lastRecord.warcType?(this.indexReqResponse(this._lastRecord,e),this._lastRecord=null):"response"===e.warcType&&"request"===this._lastRecord.warcType?(this.indexReqResponse(e,this._lastRecord),this._lastRecord=null):(this.indexReqResponse(this._lastRecord,null),this._lastRecord=e));this._lastRecord=e}else this.parseWarcInfo(e)}indexDone(){this._lastRecord&&(this.indexReqResponse(this._lastRecord),this._lastRecord=null)}shouldIndexMetadataRecord(e){const t=e.warcTargetURI;return!(!t||!t.startsWith("metadata://"))}parseRevisitRecord(e){const t=e.warcTargetURI.split("#")[0],n=(e.warcDate,new Date(e.warcDate).getTime()),r=e.warcRefersToTargetURI,i=new Date(e.warcRefersToDate).getTime();return r===t&&i===n?null:{url:t,ts:n,origURL:r,origTS:i,digest:e.warcPayloadDigest,pageId:null}}indexReqResponse(e,t){const n=this.parseRecords(e,t);n&&this.addResource(n)}parseRecords(e,t){switch(e.warcType){case"revisit":return this.parseRevisitRecord(e);case"resource":t=null;break;case"response":break;case"metadata":if(!this.shouldIndexMetadataRecord(e))return null;break;default:return null}const n=e.warcTargetURI.split("#")[0],r=e.warcDate;let i,s=200,o="OK",a=0,u="";if(e.httpHeaders){if(s=Number(e.httpHeaders.statusCode)||200,t&&"OPTIONS"===t.httpHeaders.method)return null;if(o=e.httpHeaders.statusText,i=Object(R.j)(e.httpHeaders.headers),u=(i.get("content-type")||"").split(";")[0],a=parseInt(i.get("content-length")||0),206===s){const e=i.get("content-range"),t=`bytes 0-${a-1}/${a}`;if(e&&e!==t)return null}if(s>300&&s<400){const e=i.get("location");if(e&&new URL(e,n).href===n)return null}}else i=new Headers,i.set("content-type",e.warcContentType),i.set("content-length",e.warcContentLength),u=e.warcContentType,a=e.warcContentLength;let l=null;if(t&&t.httpHeaders.headers)try{const e=new Headers(t.httpHeaders.headers).get("cookie");e&&i.set("x-wabac-preset-cookie",e),l=t.httpHeaders.headers.get("Referer")}catch(e){console.warn(e)}if(void 0===this.detectPages&&(this.detectPages=!this.anyPages),this.detectPages&&function(e,t,n){if(200!=t)return!1;if(!e.startsWith("http:")&&!e.startsWith("https:")&&!e.startsWith("blob:"))return!1;if(e.endsWith("/robots.txt"))return!1;const r=e.split("?",2);if(2===r.length&&r[1].length>r[0].length)return!1;if(r[0].substring(r[0].lastIndexOf("/")+1).startsWith("."))return!1;if(n&&"text/html"!==n)return!1;return!0}(n,s,u)){const e=n;this.addPage({url:n,date:r,title:e})}const c=new Date(r).getTime(),h=Object.fromEntries(i.entries()),d=e.warcPayloadDigest,p=e.payload,f={url:n,ts:c,status:s,mime:u,respHeaders:h,digest:d,payload:p,reader:p?null:e.reader,referrer:l};this.pageMap[c+"/"+n]&&p&&u.startsWith("text/")&&(this.pageMap[c+"/"+n].textPromise=async function(e,t,n,r){const i=new H.a,s=[];let o=null;i.on("text",(e,t)=>{if(o)return;const n=e.text.trim();n&&s.push(n)}),i.on("startTag",e=>{!e.selfClosing&&V.includes(e.tagName)&&(o=e.tagName)}),i.on("endTag",e=>{e.tagName===o&&(o=null)});const a=new G.PassThrough({encoding:"utf8"});(n||r)&&(t=await Object(q.a)(t,n,r)),a.push(t),a.push(null),a.pipe(i);const u=new Promise(e=>{i.on("end",()=>{e(s.join(" "))})});return await u}(0,p,i.get("content-encoding"),i.get("transfer-encoding")));const m=e.warcHeader("WARC-JSON-Metadata");if(m)try{f.extraOpts=JSON.parse(m)}catch(e){}const w=e.warcHeader("WARC-Page-ID");return w&&(f.pageId=w),f}filterRecord(e){return null}async load(e,t,n){this.db=e;const r=new j.d(this.reader);let i=0,s=0;try{for await(const e of r){if(!e.warcType){console.log("skip empty record");continue}if(self.interruptLoads&&this.loadId&&self.interruptLoads[this.loadId])throw t(Math.round(r.offset/n*95),"Loading Canceled",r.offset,n),self.interruptLoads[this.loadId](),this.abort&&this.abort.abort(),new R.b;s=(new Date).getTime(),s-i>500&&(t(Math.round(r.offset/n*95),null,r.offset,n),i=s);const o=this.filterRecord(e);if("done"===o){this.abort&&this.abort.abort();break}if("skip"!==o){"skipContent"===o?await e.skipFully():await e.readFully(),this.index(e,r);try{await Promise.all(this.promises)}catch(e){console.warn(e.toString())}this.promises=[]}}}catch(e){if(e instanceof R.b)throw e;t(Math.round(r.offset/n*95),`Sorry there was an error downloading. Please try again (${e})`,r.offset,n),console.warn(e)}return this.indexDone(),t(95),await this.finishIndexing(),t(100),this.metadata}async _finishLoad(){if(this.pages.length){for(const{page:e,textPromise:t}of Object.values(this.pageMap))if(t)try{e.text=await t}catch(e){console.warn("Error adding text: "+e.toString())}this.promises.push(this.db.addPages(this.pages))}this.lists.length&&this.promises.push(this.db.addCuratedPageLists(this.lists,"bookmarks","public"))}}class Y extends K{constructor(e){super(e),this.detectPages=!1}addPage(){}async load(){const e=await new j.d(this.reader).parse();if(!e)return null;const t=this.parseRecords(e,null);return t&&"revisit"!==e.warcType||await e.readFully(),t}}class J extends K{filterRecord(e){if("warcinfo"!=e.warcType)return"done"}}const Z="https://helper-proxy.webrecorder.workers.dev";function Q(e,t,n,r,i){if(e.startsWith("blob:"))return new te(e,i,n);if(e.startsWith("http:")||e.startsWith("https:")||e.startsWith("file:"))return new $(e,t,n);if(e.startsWith("googledrive:"))return new ee(e,t,n,r);throw new Error("Invalid URL: "+e)}class ${constructor(e,t,n=null,r=!1){this.url=e,this.headers=t||{},this.length=n,this.canLoadOnDemand=r,this.isValid=!1}async doInitialFetch(e){const t=new Headers(this.headers);t.set("Range","bytes=0-"),this.isValid=!1;let n=null,r=null;if(e)try{r=await fetch(this.url,{headers:t,method:"HEAD"}),200!==r.status&&206!=r.status||(this.canLoadOnDemand=206===r.status||"bytes"===r.headers.get("Accept-Ranges"),this.isValid=!0)}catch(e){}if(!this.isValid){n=new AbortController;const e=n.signal;r=await fetch(this.url,{headers:t,signal:e}),this.canLoadOnDemand=206===r.status||"bytes"===r.headers.get("Accept-Ranges"),this.isValid=206===r.status||200===r.status}if(null===this.length&&(this.length=Number(r.headers.get("Content-Length")),!this.length&&206===r.status)){let e=r.headers.get("Content-Range");e&&(e=e.split("/"),2===e.length&&(this.length=e[1]))}if(null===this.length)try{const e=await fetch(`${Z}/c/${this.url}`),t=await e.json();t.size&&(this.length=t.size)}catch(e){console.log("Error fetching from helper: "+e.toString())}return this.length=Number(this.length||0),{response:r,abort:n}}async getLength(){if(null===this.length){const{response:e,abort:t}=await this.doInitialFetch(!0);t&&t.abort()}return this.length}async getRange(e,t,n=!1,r=null){const i=new Headers(this.headers);i.set("Range",`bytes=${e}-${e+t-1}`);const s={signal:r,headers:i};let o=null;try{o=await fetch(this.url,s)}catch(e){throw console.log(e),new RangeError(this.url)}if(206!=o.status)throw 401===o.status||403===o.status?new R.a(this.url,o.status):new RangeError(this.url,o.status);return n?o.body:new Uint8Array(await o.arrayBuffer())}}class ee{constructor(e,t,n,r){this.fileId=e.slice("googledrive://".length),this.apiUrl=`https://www.googleapis.com/drive/v3/files/${this.fileId}?alt=media`,this.canLoadOnDemand=!0,this.headers=t,r&&r.publicUrl?this.publicUrl=r.publicUrl:this.publicUrl=null,this.length=n,this.isValid=!1}async getLength(){return this.length}async doInitialFetch(e){let t=null,n=null;if(this.publicUrl){t=new $(this.publicUrl,null,this.length);try{n=await t.doInitialFetch(e)}catch(e){}if(!t.isValid&&(n&&n.abort&&n.abort.abort(),await this.refreshPublicUrl())){t=new $(this.publicUrl,null,this.length);try{n=await t.doInitialFetch(e)}catch(e){}!t.isValid&&n&&n.abort&&n.abort.abort()}}return t&&t.isValid||(this.publicUrl=null,t=new $(this.apiUrl,this.headers,this.length),n=await t.doInitialFetch(e)),this.isValid=t.isValid,this.length||(this.length=t.length),n}async getRange(e,t,n=!1,r){let i=null;if(this.publicUrl){i=new $(this.publicUrl,null,this.length);try{return await i.getRange(e,t,n,r)}catch(s){if(await this.refreshPublicUrl()){i=new $(this.publicUrl,null,this.length);try{return await i.getRange(e,t,n,r)}catch(e){}}}this.publicUrl=null}return i=new $(this.apiUrl,this.headers,this.length),await i.getRange(e,t,n,r)}async refreshPublicUrl(){try{const e=await fetch(`${Z}/g/${this.fileId}`),t=await e.json();if(t.url)return this.publicUrl=t.url,!0}catch(e){}return!1}}class te{constructor(e,t=null,n=null){this.url=e,this.blob=t,this.size=this.blob?this.blob.size:n,this.canLoadOnDemand=!1}get length(){return this.size}get isValid(){return!!this.blob}async doInitialFetch(e){if(!this.blob){const e=await fetch(this.url);this.blob=await e.blob()}let t=null;return e||(t=this.blob.stream?this.blob.stream():await this.getReadableStream(this.blob)),{response:new Response(t),stream:t}}async getLength(){if(!this.blob&&!this.blob.size){let e=await fetch(this.url);this.blob=await e.blob(),this.size=this.blob.size}return this.size}async getRange(e,t,n=!1,r){if(!this.blob){const r=new Headers;r.set("Range",`bytes=${e}-${e+t-1}`);const i=await fetch(this.url,{headers:r});if(i.headers.get("content-range"))return n?i.body:new Uint8Array(await i.arrayBuffer());this.blob=await i.blob()}const i=this.blob.slice(e,e+t,"application/octet-stream");if(n)return i.stream?i.stream():await this.getReadableStream(i);try{const e=i.arrayBuffer?await i.arrayBuffer():await this.getArrayBuffer(i);return new Uint8Array(e)}catch(e){return console.log("error reading blob",e),null}}getArrayBuffer(e){return new Promise(t=>{let n=new FileReader;n.onloadend=()=>{t(n.result)},n.readAsArrayBuffer(e)})}async getReadableStream(e){const t=await this.getArrayBuffer(e);return new ReadableStream({start(e){e.enqueue(new Uint8Array(t)),e.close()}})}}class ne extends M{constructor(e,t=!1){super(e),this.noCache=t,this.useRefCounts=!1}async loadRecordFromSource(e){const t=await this.loadSource(e.source),n=new Y(t);return await n.load()}async loadPayload(e,t=0){let n=await super.loadPayload(e);if(n&&e.respHeaders&&"warc/revisit"!==e.mime)return n;const r=await this.loadRecordFromSource(e);if(!r)return console.log("No WARC Record Loaded for: "+e.url),null;if(r.url!==e.url)return console.log(`Wrong url: expected ${e.url}, got ${r.url}`),null;if(r.ts!==e.ts){if(1e3*Math.floor(r.ts/1e3)!==e.ts)return console.log(`Wrong timestamp: expected ${e.ts}, got ${r.ts}`),null}if(r.digest!==e.digest&&console.log(`Wrong digest: expected ${e.digest}, got ${r.digest}`),r.origURL){const i=await this.lookupUrl(r.origURL,r.origTS,{noRevisits:!0});return i&&(n||(t<2?n=await this.loadPayload(i,t+1):console.warn("Avoiding revisit lookup loop for: "+JSON.stringify(r)),n))?(e.respHeaders=i.respHeaders,e.mime=i.mime,i.extraOpts&&(e.extraOpts=i.extraOpts),this.noCache||(delete e.payload,await this.db.put("resources",e)),n):null}const i=r.digest;if(!this.noCache&&r.reader&&i&&(r.reader=new se(this,r.reader,i,e.url)),n=r.payload,!n&&!r.reader)return null;try{n&&!this.noCache&&await this.commitPayload(n,i)}catch(t){console.warn("Payload Update Error: "+e.url),console.warn(t)}if(!(e.respHeaders&&e.digest||(e.respHeaders=r.respHeaders,e.digest=i,r.extraOpts&&(e.extraOpts=r.extraOpts),this.noCache)))try{await this.db.put("resources",e)}catch(t){console.warn("Resource Update Error: "+e.url),console.warn(t)}return n||r.reader}async commitPayload(e,t){if(!e||0===e.length)return;const n=this.db.transaction(["payload","digestRef"],"readwrite");try{if(n.objectStore("payload").put({payload:e,digest:t}),this.useRefCounts){const r=await n.objectStore("digestRef").get(t);r&&(r.size=e.length,n.objectStore("digestRef").put(r))}await n.done}catch(e){console.warn("Payload Commit Error: "+e)}}}class re extends ne{constructor(e,t,n=!1){super(e,n),this.loader=t}updateHeaders(e){this.loader.headers=e}async loadSource(e){const{start:t,length:n}=e;return await this.loader.getRange(t,n,!0)}}class ie extends ne{constructor(e,t,n,r=!1){super(e,r),this.remoteUrlPrefix=t,this.headers=n}updateHeaders(e){this.headers=e}async loadSource(e){const{start:t,length:n}=e,r=new Headers(this.headers),i=Q(new URL(e.path,this.remoteUrlPrefix).href,r);return await i.getRange(t,n,!0)}}class se extends j.b{constructor(e,t,n,r=""){super(),this.db=e,this.reader=t,this.digest=n,this.url=r,this.chunks=[],this.size=0,this.fullbuff=null,this.commit=!0,this.alreadyRead=!1}setLimitSkip(e=-1,t=0){(-1!=e||t>0)&&(this.commit=!1),this.reader.setLimitSkip(e,t)}async*[Symbol.asyncIterator](){if(!this.alreadyRead){for await(const e of this.reader)this.chunks.push(e),this.size+=e.byteLength,yield e;this.fullbuff=j.b.concatChunks(this.chunks,this.size),0!==this.reader.limit?console.warn(`Expected payload not consumed, ${this.reader.limit} bytes left`):this.commit&&await this.db.commitPayload(this.fullbuff,this.digest),this.chunks=[],this.alreadyRead=!0}}async readFully(){for await(const e of this);return this.fullbuff}}class oe extends K{constructor(e,t,n){super(e,t,n),this.cdxindexer=null}filterRecord(e){switch(e.warcType){case"warcinfo":case"revisit":return null;case"request":return"skipContent";case"metadata":return this.shouldIndexMetadataRecord(e)?null:"skipContent"}const t=e.warcTargetURI,n=new Date(e.warcDate).getTime();if(this.pageMap[n+"/"+t])return e._isPage=!0,null}index(e,t){if(e._isPage)return super.index(e,t);if("warcinfo"===e.warcType)return void this.parseWarcInfo(e);this.cdxindexer||(this.cdxindexer=new j.c({},null));const n=this.cdxindexer.indexRecord(e,t,"");n&&this.addCdx(n)}addCdx(e){const{url:t,mime:n}=e,r=Number(e.status)||200,i=Object(R.m)(e.timestamp).getTime(),s={path:e.filename,start:Number(e.offset),length:Number(e.length)};let{digest:o}=e;o&&-1===o.indexOf(":")&&(o="sha1:"+o);const a={url:t,ts:i,status:r,digest:o,mime:n,loaded:!1,source:s};this.batch.length>=3e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=3e3} records`)),this.batch.push(a)}}class ae extends oe{async load(e){this.db=e;let t=this.reader;t.iterLines||(t=new j.a(this.reader));for await(const e of t.iterLines()){let t,n,r,i=e.trimEnd();if(!i.startsWith("{")){const e=i.indexOf(" {");if(e<0)continue;[n,r]=i.split(" ",2),i=i.slice(e)}try{t=JSON.parse(i)}catch(e){console.log("JSON Parser error on: "+i);continue}t.timestamp=r,t.url||(t.url=n),this.addCdx(t)}this.indexDone(),await this.finishIndexing()}}const ue=/(?:([\d]+)[^\/]*\/)?(http.*)/;class le{constructor(e){this.sourceUrl=e.sourceUrl,this.type=e.extraConfig&&e.extraConfig.sourceType||"kiwix",this.notFoundPageUrl=e.extraConfig&&e.extraConfig.notFoundPageUrl}async getAllPages(){return[]}async getResource(e,t,n){const{url:r,headers:i}=de(e,t);let s=i;if("kiwix"===this.type){const t=await this.resolveHeaders(r);if(!t){if(this.notFoundPageUrl&&"navigate"===e.request.mode){const e=await fetch(this.notFoundPageUrl);if(200===e.status){const t={"Content-Type":"text/html"},n=await e.text();return new Response(n.replace("$URL",r),{status:404,headers:t})}}return null}let{headers:n,encodedUrl:i,date:o,status:a,statusText:u,hasPayload:l}=t;if(s.has("Range")){const e=s.get("Range");s={Range:e}}let c=null,h=null;l&&(h=await fetch(this.sourceUrl+"A/"+i,{headers:s}),h.body&&(c=new j.a(h.body.getReader(),!1))),c||(c=new Uint8Array([])),o||(o=new Date),n||(n=new Headers),206===h.status&&(a=206,u="Partial Content",n.set("Content-Length",h.headers.get("Content-Length")),n.set("Content-Range",h.headers.get("Content-Range")),n.set("Accept-Ranges","bytes"));const d=!1,p=!1;return new U.a({payload:c,status:a,statusText:u,headers:n,url:r,date:o,noRW:p,isLive:d})}}async resolveHeaders(e){const t=e.slice(e.indexOf("//")+2);let n=encodeURI(t);n=encodeURIComponent(t);let r=await fetch(this.sourceUrl+"H/"+n);if(200!==r.status)return null;let i=null,s=null,o=null,a=null,u=!1;try{const t=await j.d.parse(r.body);if("revisit"===t.warcType){const n=t.warcHeaders.headers.get("WARC-Refers-To-Target-URI");if(n&&n!==e)return await this.resolveHeaders(n)}s=new Date(t.warcDate),t.httpHeaders?(i=t.httpHeaders.headers,o=Number(t.httpHeaders.statusCode),a=t.httpHeaders.statusText,u="0"!==t.httpHeaders.headers.get("Content-Length")):"resource"===t.warcType&&(i=new Headers,i.set("Content-Type",t.warcContentType),i.set("Content-Length",t.warcContentLength),o=200,a="OK",u=t.warcContentLength>0),o||(o=200)}catch(t){console.warn(t),console.warn("Ignoring headers, error parsing headers response for: "+e)}return{encodedUrl:n,headers:i,date:s,status:o,statusText:a,hasPayload:u}}}class ce{constructor(e){this.replayPrefix=e.replayPrefix,this.idMod=void 0!==e.idMod?e.idMod:"id_",this.redirMod=void 0!==e.redirMod?e.redirMod:"mp_",this.redirectMode=this.idMod===this.redirMod?"follow":"manual"}async getAllPages(){return[]}getUrl(e,t){let n=this.replayPrefix;return(t||e.timestamp)&&(n+=e.timestamp+t+"/"),n+e.url}async getResource(e,t,n){let r=await fetch(this.getUrl(e,this.idMod),{credentials:"same-origin",redirect:this.redirectMode,mode:"cors"});if(r.status>=400&&!r.headers.get("memento-datetime"))return null;const i=await this.getRedirect(e,r,t);let s=null,o=!1;i?(r=Response.redirect(i.path,307),o=!0,s=i.timestamp):s=e.timestamp;const a=e.url,u=s?Object(R.m)(s):new Date;return U.a.fromResponse({url:a,response:r,date:u,noRW:o})}async getRedirect(e,t,n){if("opaqueredirect"===t.type)t=await fetch(this.getUrl(e,this.redirMod),{credentials:"same-origin",redirect:"follow",mode:"cors"});else if(!t.redirected)return null;const r=t.url.indexOf(this.replayPrefix)+this.replayPrefix.length,i=t.url.slice(r),s=i.match(ue);return s?{timestamp:s[1],path:n+s[1]+"mp_/"+s[2]}:{path:n+i}}}class he{constructor(e,t=!1,n=!0){this.prefix=e||"",this.proxyPathOnly=t,this.isLive=n}async getAllPages(){return[]}async getResource(e,t,n){const{headers:r,credentials:i,url:s}=de(e,t);let o;if(this.proxyPathOnly){const e=new URL(s);o=this.prefix+e.pathname+e.search}else o=this.prefix+s;const a=await fetch(o,{method:e.request.method,body:e.request.body,headers:r,credentials:i,mode:"cors",redirect:"follow"});return U.a.fromResponse({url:s,response:a,date:new Date,noRW:!1,isLive:this.isLive})}}function de(e,t,n=!0){let r,i,s;if(n){r=new Headers(e.request.headers),i=e.request.referrer;const n=i.indexOf("/http",t.length-1);n>0&&(i=i.slice(n+1),r.set("X-Proxy-Referer",i)),s=e.request.credentials}else r=new Headers,s="omit";let o=e.url;if(o.startsWith("//"))try{o=new URL(i).protocol+o}catch(e){o="https:"+o}return{referrer:i,headers:r,credentials:s,url:o}}var pe=n(32),fe=n.n(pe),me=n(41);class we extends re{constructor(e,t,n=null,r=!1,i){super(e,t,r),this.zipreader=new ge(t),this.externalSources=[],this.fuzzyUrlRules=[],this.useSurt=!0,this.fullConfig=i,this.textIndex=i&&i.metadata&&i.metadata.textIndex,t.canLoadOnDemand=!0,n&&this.initConfig(n)}_initDB(e,t,n,r){if(super._initDB(e,t,n,r),!t){e.createObjectStore("ziplines",{keyPath:"prefix"}),e.createObjectStore("zipEntries",{keyPath:"filename"})}}async init(){await super.init(),await this.loadZipEntries()}async close(){super.close(),caches.delete("cache:"+this.name.slice("db:".length))}async clearZipData(){const e=["zipEntries","ziplines"];for(const t of e)await this.db.clear(t)}async clearAll(){await super.clearAll(),await this.clearZipData()}updateHeaders(e){this.zipreader.loader.headers=e}async loadZipEntries(){const e=await this.db.getAll("zipEntries");if(!e.length)return;const t={};for(const n of e)t[n.filename]=n;this.zipreader.entries=t}async saveZipEntries(e){const t=this.db.transaction("zipEntries","readwrite");t.store.clear();for(const n of Object.values(e))t.store.put(n);await t.done,this.db.clear("ziplines")}async loadZiplinesIndex(e,t,n){let r=0,i=0,s=0,o=[],a="";for await(const u of e.iterLines()){if(r+=u.length,r===u.length&&u.startsWith("!meta")){const e=u.indexOf(" {");if(e<0){console.warn("Invalid Meta Line: "+u);continue}const t=JSON.parse(u.slice(e));t.filename&&(a=t.filename),"cdxj-gzip-1.0"!==t.format&&console.log(`Unknown CDXJ format "${t.format}", archive may not parse correctly`);continue}let e;if(u.indexOf("\t")>0){let[t,n,r,i]=u.split("\t");r=Number(r),i=Number(i),e={prefix:t,filename:n,offset:r,length:i,loaded:!1},this.useSurt=!0}else{const t=u.indexOf(" {");if(t<0){console.log("Invalid Index Line: "+u);continue}const n=u.slice(0,t);let{offset:r,length:i,filename:s}=JSON.parse(u.slice(t));s=s||a,e={prefix:n,filename:s,offset:r,length:i,loaded:!1}}s=(new Date).getTime(),s-i>500&&(t(Math.round(r/n*100),null,r,n),i=s),o.push(e)}const u=this.db.transaction("ziplines","readwrite");for(const e of o)u.store.put(e);try{await u.done}catch(e){console.log("Error loading ziplines index: ",e)}}async load(e,t,n){if(e!==this)return void console.error("wrong db");const r=await e.zipreader.load(!0);await e.saveZipEntries(r);const i=[];let s;r["webarchive.yaml"]&&(s=await this.loadMetadata(r,await e.zipreader.loadFile("webarchive.yaml")));for(const n of Object.keys(r))if(n.endsWith(".cdx")||n.endsWith(".cdxj")){console.log("Loading CDX "+n);const t=await e.zipreader.loadFile(n);i.push(new ae(t).load(e))}else if(n.endsWith(".idx")){if(this.loader.canLoadOnDemand){console.log("Loading IDX "+n);const r=e.zipreader.getCompressedSize(n);i.push(e.loadZiplinesIndex(await e.zipreader.loadFile(n),t,r))}}else if(n.endsWith(".warc.gz")||n.endsWith(".warc"))if(!s&&this.loader.canLoadOnDemand){const r=new AbortController,i=await e.zipreader.loadFile(n,{signal:r.signal,unzip:!0}),o=new J(i,r),a=e.zipreader.getCompressedSize(n);s=await o.load(e,t,a)}else if(!this.loader.canLoadOnDemand){const r=await e.zipreader.loadFile(n,{unzip:!0}),i=new K(r);i.detectPages=!1;const o=e.zipreader.getCompressedSize(n);s=await i.load(e,t,o)}return await Promise.all(i),s||{}}async loadPagesCSV(e){const t=(new TextDecoder).decode(await e.readFully()),n=await Object(me.csv2jsonAsync)(t);n&&n.length&&await this.addPages(n)}initConfig(e){if(void 0!==e.decodeResponses&&(this.fullConfig.decode=e.decodeResponses),void 0!==e.useSurt&&(this.useSurt=e.useSurt),e.es)for(const[t,n]of e.es){const e=new he(n,!0,!1);this.externalSources.push({prefix:t,external:e})}if(e.fuzzy)for(const[t,n]of e.fuzzy){const e=new RegExp(t);this.fuzzyUrlRules.push({match:e,replace:n})}e.textIndex&&(this.textIndex=e.textIndex)}async getTextIndex(){const e={"Content-Type":"application/ndjson"};if(!this.textIndex)return new Response("",{headers:e});const t=this.zipreader.getCompressedSize(this.textIndex);t>0&&(e["Content-Length"]=""+t);const n=await this.zipreader.loadFile(this.textIndex,{unzip:!0});return new Response(n.getReadableStream(),{headers:e})}async loadMetadata(e,t){const n=(new TextDecoder).decode(await t.readFully()),r=fe.a.safeLoad(n);void 0!==r.config&&this.initConfig(r.config);const i={desc:r.desc,title:r.title};r.textIndex&&(i.textIndex=r.textIndex);const s=r.pages||[];s&&s.length?await this.addPages(s):e["pages.csv"]&&await this.loadPagesCSV(await this.zipreader.loadFile("pages.csv"));const o=r.pageLists||[];return o&&o.length&&await this.addCuratedPageLists(o,"pages","show"),i}async loadRecordFromSource(e){let t,n=0,r=-1;const i=e.source;if("string"==typeof i)t=i;else{if("object"!=typeof i)return null;n=i.start,r=i.length,t=i.path}let s=null;const o=await this.zipreader.loadFileCheckDirs(t,n,r);return s=new Y(o),await s.load()}getSurt(e){try{e=e.replace(/www\d*\./,"");const t=new URL(e);let n=t.hostname.split(".").reverse().join(",");return t.port&&(n+=":"+t.port),n+=")",n+=t.pathname,t.search&&(t.searchParams.sort(),n+=t.search),n.toLowerCase()}catch(t){return e}}async loadFromZiplines(e,t){t&&Object(R.f)(new Date(t).toISOString());let n,r;const i=this.useSurt?this.getSurt(e):e;n=i+" 9",r=i;const s=this.db.transaction("ziplines","readonly"),o=[],a=IDBKeyRange.upperBound(n,!1);for await(const e of s.store.iterate(a,"prev"))if(o.unshift(e.value),!e.value.prefix.split(" ")[0].startsWith(r))break;await s.done;const u=[];for(const e of o){if(e.loaded)continue;const t="indexes/"+e.filename,n={offset:e.offset,length:e.length,unzip:!0},r=await this.zipreader.loadFile(t,n);u.push(new ae(r).load(this)),e.loaded=!0,await this.db.put("ziplines",e)}return await Promise.all(u),u.length>0}async getResource(e,t,n){if(this.externalSources.length)for(const{prefix:r,external:i}of this.externalSources)if(e.url.startsWith(r))try{return await i.getResource(e,t,n)}catch(e){console.warn("Upstream Error",e)}let r=await super.getResource(e,t,n);if(r)return r;if(this.fuzzyUrlRules.length)for(const{match:i,replace:s}of this.fuzzyUrlRules){const o=e.url.replace(i,s);if(o&&o!==e.url&&(e.url=o,r=await super.getResource(e,t,n),r))return r}return null}async lookupUrl(e,t,n={}){try{let r=await super.lookupUrl(e,t,n);return!r||n.noRevisits&&"warc/revisit"===r.mime?(await this.loadFromZiplines(e,t)&&(r=await super.lookupUrl(e,t,n)),r):r}catch(e){return console.warn(e),null}}async resourcesByUrlAndMime(e,...t){let n=await super.resourcesByUrlAndMime(e,...t);return n.length>0||await this.loadFromZiplines(e,"")&&(n=await super.resourcesByUrlAndMime(e,...t)),n}}class ge{constructor(e,t=null){this.loader=e,this.entries=t}async load(e=!1){if(!this.entries||e){const e=await this.loader.getLength(),t=Math.min(65558,e),n=e-t,r=await this.loader.getRange(n,t);this.entries=this._loadEntries(r,n)}return this.entries}_loadEntries(e,t){const n=e.byteLength,r=new DataView(e.buffer),i=new TextDecoder("utf8"),s=new TextDecoder("ascii"),o={};let a=0,u=0,l=n;for(let t=n-22,i=Math.max(0,t-65535);t>=i;--t)if(80===e[t]&&75===e[t+1]&&5===e[t+2]&&6===e[t+3]){l=t,u=r.getUint32(t+16,!0),a=r.getUint16(t+8,!0);break}if(4294967295===u||65535===a){if(117853008!==r.getUint32(l-20,!0))return void console.warn("invalid zip64 EOCD locator");const e=this.getUint64(r,l-12,!0)-t;if(101075792!==r.getUint32(e,!0))return void console.warn("invalid zip64 EOCD record");a=this.getUint64(r,e+32,!0),u=this.getUint64(r,e+48,!0)}if(t&&(u-=t),u>=n||u<=0)for(u=-1,a=65535;++u=0&&u=8&&(a=this.getUint64(r,e,!0),e+=8,i-=8),4294967295===n&&i>=8&&(n=this.getUint64(r,e,!0),e+=8,i-=8),4294967295===p&&i>=8&&(p=this.getUint64(r,e,!0),e+=8,i-=8)),e+=i}}f.endsWith("/")||(o[f]={filename:f,deflate:d,uncompressedSize:a,compressedSize:n,localEntryOffset:p}),u+=46+l+c+h}return o}async loadFileCheckDirs(e,t,n){if(null===this.entries&&await this.load(),this.entries["archive/"+e])e="archive/"+e;else if(this.entries["warcs/"+e])e="warcs/"+e;else for(const t of Object.keys(this.entries))if(t.endsWith("/"+e)){e=t;break}return await this.loadFile(e,{offset:t,length:n,unzip:!0})}getCompressedSize(e){if(null===this.entries)return-1;const t=this.entries[e];return t?t.compressedSize:-1}async loadFile(e,{offset:t=0,length:n=-1,signal:r=null,unzip:i=!1}={}){null===this.entries&&await this.load();const s=this.entries[e];if(!s)return null;if(void 0===s.offset){const e=await this.loader.getRange(s.localEntryOffset,30),t=new DataView(e.buffer),n=t.getUint16(26,!0),r=t.getUint16(28,!0);s.offset=30+n+r+s.localEntryOffset}n=n<0?s.compressedSize:Math.min(n,s.compressedSize-t),t+=s.offset;const o=await this.loader.getRange(t,n,!0,r);return i?s.deflate?new j.a(new j.a(o.getReader(),"deflate")):new j.a(o.getReader()):new j.a(o.getReader(),s.deflate?"deflate":null)}getUint64(e,t,n){const r=e.getUint32(t,n),i=e.getUint32(t+4,n),s=n?r+2**32*i:2**32*r+i;return Number.isSafeInteger(s)||console.warn(s,"exceeds MAX_SAFE_INTEGER. Precision may be lost"),s}}class _e extends X.a{constructor(e){super(),this.har=e,this.pageRefs={}}async load(e){return this.db=e,"string"==typeof this.har&&(this.har=JSON.parse(this.har)),this.parseEntries(this.har),this.parsePages(this.har),await this.finishIndexing(),{}}parsePages(e){for(const t of e.log.pages){if(!t.pageTimings||!t.pageTimings.onLoad)continue;let e;e=t.title&&(t.title.startsWith("http:")||t.title.startsWith("https:"))?t.title:this.pageRefs[t.id];const n=t.title||e,r=t.startedDateTime;this.addPage({url:e,date:r,title:n})}}parseEntries(e){for(const t of e.log.entries){if(!t.response.content||!t.response.content.text){console.log("Skipping: "+t.request.url);continue}let e=null;try{e=Uint8Array.from(atob(t.response.content.text),e=>e.charCodeAt(0))}catch(n){e=t.response.content.text}console.log("Added: "+t.request.url);const n=new Date(t.startedDateTime).getTime(),r={};for(const{name:e,value:n}of t.response.headers)r[e]=n;this.addResource({url:t.request.url,ts:n,status:t.response.status,respHeaders:r,payload:e}),t.pageref&&!this.pageRefs[t.pageref]&&(this.pageRefs[t.pageref]=t.request.url)}}}var be=n(122);self.interruptLoads={};class ye{constructor(){this.colldb=null,this.root=null,this._init_db=this._initDB()}async _initDB(){this.colldb=await g("collDB",1,{upgrade:(e,t,n,r)=>{e.createObjectStore("colls",{keyPath:"name"})}})}async loadAll(e){if(await this._init_db,e)for(const t of e.split(",")){const e=t.split(":");if(2===e.length){const t={dbname:e[1],sourceName:e[1],decode:!1},n={name:e[0],type:"archive",config:t};console.log("Adding Coll: "+JSON.stringify(n)),await this.colldb.put("colls",n)}}try{const e=(await this.listAll()).map(e=>this._initColl(e));await Promise.all(e)}catch(e){console.warn(e.toString())}return!0}async listAll(){return await this._init_db,await this.colldb.getAll("colls")}async loadColl(e){await this._init_db;const t=await this.colldb.get("colls",e);return t?await this._initColl(t):null}async deleteColl(e){await this._init_db;const t=await this.colldb.get("colls",e);if(!t)return!1;t.config.dbname&&await _(t.config.dbname,{blocked(e){console.log(`Unable to delete ${t.config.dbname}: ${e}`)}}),await this.colldb.delete("colls",e)}async updateAuth(e,t){await this._init_db;const n=await this.colldb.get("colls",e);return!!n&&(n.config.headers=t,await this.colldb.put("colls",n),!0)}async updateSize(e,t,n){await this._init_db;const r=await this.colldb.get("colls",e);if(!r)return!1;r.config.loadSize=(r.config.loadSize||0)+t,r.config.dedupSize=(r.config.dedupSize||0)+n,await this.colldb.put("colls",r)}async _initColl(e){let t=null,n=null;switch(e.type){case"archive":t=new M(e.config.dbname);break;case"remotesource":n=Q(e.config.loadUrl,e.config.headers,e.config.size,e.config.extra),t=new re(e.config.dbname,n,e.config.noCache);break;case"remoteprefix":t=new ie(e.config.dbname,e.config.remotePrefix,e.config.headers,e.config.noCache);break;case"remotezip":n=Q(e.config.loadUrl||e.config.sourceUrl,e.config.headers,e.config.extra),t=new we(e.config.dbname,n,e.config.extraConfig,e.config.noCache,e.config);break;case"remoteproxy":t=new ce(e.config);break;case"remotewarcproxy":t=new le(e.config);break;case"live":t=new he(e.config.prefix,e.config.proxyPathOnly,e.config.isLive)}if(!t)return console.log("no store found: "+e.type),null;t.initing&&await t.initing;const r=e.name,i=e.config;return e.config.root&&(this.root=r),this._createCollection({name:r,store:t,config:i})}_createCollection(e){return e}}class ve extends ye{constructor(e){super(),this.registerListener(e)}async hasCollection(e){return await this._init_db,null!=await this.colldb.getKey("colls",e)}registerListener(e){e.addEventListener("message",e=>this._handleMessage(e))}async _handleMessage(e){await this._init_db;const t=e.source||self;switch(e.data.msg_type){case"addColl":{const n=e.data.name,r=(e,r,i,s)=>{t.postMessage({msg_type:"collProgress",name:n,percent:e,error:r,currentSize:i,totalSize:s})};let i;try{if(await this.hasCollection(n)?e.data.skipExisting?i=!0:(await this.deleteCollection(n),i=await this.addCollection(e.data,r)):i=await this.addCollection(e.data,r),!i)return}catch(e){return console.warn(e),void r(0,"An unexpected error occured: "+e.toString())}t.postMessage({msg_type:"collAdded",name:n});break}case"cancelLoad":{const t=e.data.name,n=new Promise(e=>self.interruptLoads[t]=e);await n,await this.deleteCollection(t),delete self.interruptLoads[t];break}case"removeColl":{const n=e.data.name;await this.hasCollection(n)&&(await this.deleteCollection(n),this.doListAll(t));break}case"listAll":this.doListAll(t)}}async doListAll(e){const t=[],n=await this.listAll();for(const e of n)t.push({name:e.name,prefix:e.name,pageList:[],sourceName:e.config.sourceName});e.postMessage({msg_type:"listAll",colls:t})}async addCollection(e,t){const n=e.name;let r=null,i={root:e.root||!1},s=null;const o=e.file;if(!o||!o.sourceUrl)return t(0,"Invalid Load Request"),!1;if(o.sourceUrl.startsWith("proxy:"))i.sourceUrl=o.sourceUrl.slice("proxy:".length),i.extraConfig=e.extraConfig,i.topTemplateUrl=e.topTemplateUrl,r="remotewarcproxy";else{let a=null;r="archive",i.dbname="db:"+n;let u=o.loadUrl||o.sourceUrl;u.match(/[\w]+:\/\//)||(u=new URL(u,self.location.href).href),i.decode=!0,i.onDemand=!1,i.loadUrl=u,i.sourceUrl=o.sourceUrl,i.sourceName=o.name||o.sourceUrl;try{i.sourceName.match(/https?:\/\//)&&(i.sourceName=new URL(i.sourceName).pathname)}catch(e){}i.sourceName=i.sourceName.slice(i.sourceName.lastIndexOf("/")+1),i.headers=o.headers,i.size="number"==typeof o.size?o.size:null,i.extra=o.extra,i.extraConfig=e.extraConfig,i.noCache=u.startsWith("file:")||o.noCache;const l=Q(u,o.headers,o.size,i.extra,o.blob);let c=!1;(i.sourceName.endsWith(".wacz")||i.sourceName.endsWith(".zip"))&&(s=new we(i.dbname,l,i.extraConfig,i.noCache,i),r="remotezip",a=s,c=!0);let{abort:h,response:d,stream:p}=await l.doInitialFetch(c);if(p=p||d.body,!l.isValid){const e=l.length<=1e3?await d.text():"";return t(0,`Sorry, this URL could not be loaded.\nMake sure this is a valid URL and you have access to this file.\nStatus: ${d.status} ${d.statusText}\nError Details:\n${e}`),h&&h.abort(),!1}if(!l.length)return t(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."),h&&h.abort(),!1;const f=l.length;if(i.sourceName.endsWith(".warc")||i.sourceName.endsWith(".warc.gz")?f<25e6||!l.canLoadOnDemand?a=new K(p,h,n):(a=new oe(p,h,n),r="remotesource",s=new re(i.dbname,l,i.noCache)):i.sourceName.endsWith(".cdxj")||i.sourceName.endsWith(".cdx")?(i.remotePrefix=e.remotePrefix||u.slice(0,u.lastIndexOf("/")+1),a=new ae(p,h,n),r="remoteprefix",s=new ie(i.dbname,i.remotePrefix,i.headers,i.noCache)):i.sourceName.endsWith(".wbn")?(a=new be.a(await d.arrayBuffer()),i.decode=!1):i.sourceName.endsWith(".har")&&(a=new _e(await d.json()),i.decode=!1),!a)return t(0,`The ${i.sourceName} is not a known archive format that could be loaded.`),h&&h.abort(),!1;s||(s=new M(i.dbname)),await s.initing,i.onDemand=l.canLoadOnDemand;try{i.metadata=await a.load(s,t,f)}catch(e){return e instanceof R.b||t(0,"Unexpected Loading Error: "+e.toString()),!1}i.metadata.size||(i.metadata.size=f)}i.ctime=(new Date).getTime();const a={name:n,type:r,config:i};return await this.colldb.add("colls",a),!0}async deleteCollection(e){const t="db:"+e;try{await _(t,{blocked(e){console.log("Unable to delete: "+e)}})}catch(e){return console.warn(e),!1}return await this.colldb.delete("colls",e),!0}}},,,,,function(e,t,n){"use strict";const r=n(176),i=n(35),s=n(35),o=n(7).buildOptions,a=n(178);t.parse=function(e,t,n){if(n){!0===n&&(n={});const t=a.validate(e,n);if(!0!==t)throw Error(t.err.msg)}return t=o(t,s.defaultOptions,s.props),r.convertToJson(i.getTraversalObj(e,t),t)},t.convertTonimn=n(179).convert2nimn,t.getTraversalObj=i.getTraversalObj,t.convertToJson=r.convertToJson,t.convertToJsonString=n(180).convertToJsonString,t.validate=a.validate,t.j2xParser=n(181),t.parseToNimn=function(e,n,r){return t.convertTonimn(t.getTraversalObj(e,r),n,r)}},,,,,function(e,t,n){"use strict";(function(t,r){var i=n(33);e.exports=b;var s,o=n(69);b.ReadableState=_;n(42).EventEmitter;var a=function(e,t){return e.listeners(t).length},u=n(70),l=n(44).Buffer,c=t.Uint8Array||function(){};var h=Object.create(n(23));h.inherits=n(13);var d=n(131),p=void 0;p=d&&d.debuglog?d.debuglog("stream"):function(){};var f,m=n(132),w=n(71);h.inherits(b,u);var g=["error","close","destroy","pause","resume"];function _(e,t){e=e||{};var r=t instanceof(s=s||n(10));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var i=e.highWaterMark,o=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=i||0===i?i:r&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(f||(f=n(73).StringDecoder),this.decoder=new f(e.encoding),this.encoding=e.encoding)}function b(e){if(s=s||n(10),!(this instanceof b))return new b(e);this._readableState=new _(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),u.call(this)}function y(e,t,n,r,i){var s,o=e._readableState;null===t?(o.reading=!1,function(e,t){if(t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,A(e)}(e,o)):(i||(s=function(e,t){var n;r=t,l.isBuffer(r)||r instanceof c||"string"==typeof t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk"));var r;return n}(o,t)),s?e.emit("error",s):o.objectMode||t&&t.length>0?("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?o.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):v(e,o,t,!0):o.ended?e.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!n?(t=o.decoder.write(t),o.objectMode||0!==t.length?v(e,o,t,!1):T(e,o)):v(e,o,t,!1))):r||(o.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=8388608?e=8388608:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function A(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(p("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?i.nextTick(x,e):x(e))}function x(e){p("emit readable"),e.emit("readable"),D(e)}function T(e,t){t.readingMore||(t.readingMore=!0,i.nextTick(S,e,t))}function S(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;es.length?s.length:e;if(o===s.length?i+=s:i+=s.slice(0,e),0===(e-=o)){o===s.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++r}return t.length-=r,i}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,i=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var s=r.data,o=e>s.length?s.length:e;if(s.copy(n,n.length-e,0,o),0===(e-=o)){o===s.length?(++i,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(o));break}++i}return t.length-=i,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function O(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,i.nextTick(I,t,e))}function I(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function N(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return p("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?O(this):A(this),null;if(0===(e=E(e,t))&&t.ended)return 0===t.length&&O(this),null;var r,i=t.needReadable;return p("need readable",i),(0===t.length||t.length-e0?R(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&O(this)),null!==r&&this.emit("data",r),r},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,p("pipe count=%d opts=%j",s.pipesCount,t);var u=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?c:b;function l(t,r){p("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,p("cleanup"),e.removeListener("close",g),e.removeListener("finish",_),e.removeListener("drain",h),e.removeListener("error",w),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",b),n.removeListener("data",m),d=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||h())}function c(){p("onend"),e.end()}s.endEmitted?i.nextTick(u):n.once("end",u),e.on("unpipe",l);var h=function(e){return function(){var t=e._readableState;p("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,D(e))}}(n);e.on("drain",h);var d=!1;var f=!1;function m(t){p("ondata"),f=!1,!1!==e.write(t)||f||((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==N(s.pipes,e))&&!d&&(p("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,f=!0),n.pause())}function w(t){p("onerror",t),b(),e.removeListener("error",w),0===a(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",_),b()}function _(){p("onfinish"),e.removeListener("close",g),b()}function b(){p("unpipe"),n.unpipe(e)}return n.on("data",m),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?o(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",w),e.once("close",g),e.once("finish",_),e.emit("pipe",n),s.flowing||(p("pipe resume"),n.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(134),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(6))},function(e,t,n){"use strict";var r=n(136).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=h,t=3;break;default:return this.write=d,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function h(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function p(e){return e&&e.length?this.write(e):""}t.StringDecoder=s,s.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return i>0&&(e.lastNeed=i-1),i;if(--r=0)return i>0&&(e.lastNeed=i-2),i;if(--r=0)return i>0&&(2===i?i=0:e.lastNeed=i-3),i;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},s.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=o;var r=n(10),i=Object.create(n(23));function s(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length(Object.keys(t).forEach(n=>{e[n]=t[n]}),e),Object.create(null))}},function(e,t,n){var r=n(78).BrotliInput,i=n(78).BrotliOutput,s=n(152),o=n(79),a=n(80).HuffmanCode,u=n(80).BrotliBuildHuffmanTable,l=n(156),c=n(157),h=n(158),d=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),p=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),f=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),m=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function w(e){var t;return 0===e.readBits(1)?16:(t=e.readBits(3))>0?17+t:(t=e.readBits(3))>0?8+t:17}function g(e){if(e.readBits(1)){var t=e.readBits(3);return 0===t?1:e.readBits(t)+(1<1&&0===s)throw new Error("Invalid size byte");i.meta_block_length|=s<<8*r}}else for(r=0;r4&&0===o)throw new Error("Invalid size nibble");i.meta_block_length|=o<<4*r}return++i.meta_block_length,i.input_end||i.is_metadata||(i.is_uncompressed=e.readBits(1)),i}function y(e,t,n){var r;return n.fillBitWindow(),(r=e[t+=n.val_>>>n.bit_pos_&255].bits-8)>0&&(n.bit_pos_+=8,t+=e[t].value,t+=n.val_>>>n.bit_pos_&(1<>=1,++c;for(f=0;f0;++f){var b,y=d[f],v=0;r.fillBitWindow(),v+=r.val_>>>r.bit_pos_&15,r.bit_pos_+=_[v].bits,b=_[v].value,m[y]=b,0!==b&&(w-=32>>b,++g)}if(1!==g&&0!==w)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function(e,t,n,r){for(var i=0,s=8,o=0,l=0,c=32768,h=[],d=0;d<32;d++)h.push(new a(0,0));for(u(h,0,5,e,18);i0;){var p,f=0;if(r.readMoreInput(),r.fillBitWindow(),f+=r.val_>>>r.bit_pos_&31,r.bit_pos_+=h[f].bits,(p=255&h[f].value)<16)o=0,n[i++]=p,0!==p&&(s=p,c-=32768>>p);else{var m,w,g=p-14,_=0;if(16===p&&(_=s),l!==_&&(o=0,l=_),m=o,o>0&&(o-=2,o<<=g),i+(w=(o+=r.readBits(g)+3)-m)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var b=0;b>>5]),this.htrees=new Uint32Array(t)}function S(e,t){var n,r,i={num_htrees:null,context_map:null},s=0;t.readMoreInput();var o=i.num_htrees=g(t)+1,u=i.context_map=new Uint8Array(e);if(o<=1)return i;for(t.readBits(1)&&(s=t.readBits(4)+1),n=[],r=0;r<1080;r++)n[r]=new a(0,0);for(v(o+s,n,0,t),r=0;r=e)throw new Error("[DecodeContextMap] i >= context_map_size");u[r]=0,++r}else u[r]=l-s,++r}return t.readBits(1)&&function(e,t){var n,r=new Uint8Array(256);for(n=0;n<256;++n)r[n]=n;for(n=0;n=e&&(a-=e),r[n]=a,i[u+(1&s[l])]=a,++s[l]}function k(e,t,n,r,i,o){var a,u=i+1,l=n&i,c=o.pos_&s.IBUF_MASK;if(t<8||o.bit_pos_+(t<<3)0;)o.readMoreInput(),r[l++]=o.readBits(8),l===u&&(e.write(r,u),l=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)r[l]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++l,--t;if(c+(a=o.bit_end_pos_-o.bit_pos_>>3)>s.IBUF_MASK){for(var h=s.IBUF_MASK+1-c,d=0;d=u){e.write(r,u),l-=u;for(d=0;d=u;){if(a=u-l,o.input_.read(r,l,a)t.buffer.length){var he=new Uint8Array(R+Z);he.set(t.buffer),t.buffer=he}if(O=ce.input_end,W=ce.is_uncompressed,ce.is_metadata)for(D(x);Z>0;--Z)x.readMoreInput(),x.readBits(8);else if(0!==Z)if(W)x.bit_pos_=x.bit_pos_+7&-8,k(t,Z,R,p,d,x),R+=Z;else{for(n=0;n<3;++n)ee[n]=g(x)+1,ee[n]>=2&&(v(ee[n]+2,m,1080*n,x),v(26,_,1080*n,x),Q[n]=E(_,1080*n,x),ne[n]=1);for(x.readMoreInput(),H=(1<<(j=x.readBits(2)))-1,G=(z=16+(x.readBits(4)<0;){var fe,me,we,ge,_e,be,ye,ve,Ee,Ae,xe,Te;for(x.readMoreInput(),0===Q[1]&&(C(ee[1],m,1,$,te,ne,x),Q[1]=E(_,1080,x),J=B[1].htrees[$[1]]),--Q[1],(me=(fe=y(B[1].codes,J,x))>>6)>=2?(me-=2,ye=-1):ye=0,we=c.kInsertRangeLut[me]+(fe>>3&7),ge=c.kCopyRangeLut[me]+(7&fe),_e=c.kInsertLengthPrefixCode[we].offset+x.readBits(c.kInsertLengthPrefixCode[we].nbits),be=c.kCopyLengthPrefixCode[ge].offset+x.readBits(c.kCopyLengthPrefixCode[ge].nbits),P=p[R-1&d],L=p[R-2&d],Ee=0;Ee<_e;++Ee)x.readMoreInput(),0===Q[0]&&(C(ee[0],m,0,$,te,ne,x),Q[0]=E(_,0,x),ie=$[0]<<6,Y=re[$[0]],ue=l.lookupOffsets[Y],le=l.lookupOffsets[Y+1]),se=q[ie+(l.lookup[ue+P]|l.lookup[le+L])],--Q[0],L=P,P=y(B[0].codes,B[0].htrees[se],x),p[R&d]=P,(R&d)===d&&t.write(p,u),++R;if((Z-=_e)<=0)break;if(ye<0)if(x.readMoreInput(),0===Q[2]&&(C(ee[2],m,2,$,te,ne,x),Q[2]=E(_,2160,x),oe=$[2]<<2),--Q[2],ae=X[oe+(255&(be>4?3:be-2))],(ye=y(B[2].codes,B[2].htrees[ae],x))>=z)Te=(ye-=z)&H,ye=z+((Se=(2+(1&(ye>>=j))<<(xe=1+(ye>>1)))-4)+x.readBits(xe)<(I=R=o.minDictionaryWordLength&&be<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+R+" distance: "+ve+" len: "+be+" bytes left: "+Z);var Se=o.offsetsByLength[be],Ce=ve-I-1,ke=o.sizeBitsByLength[be],De=Ce>>ke;if(Se+=(Ce&(1<=f){t.write(p,u);for(var Oe=0;Oe0&&(N[3&F]=ve,++F),be>Z)throw new Error("Invalid backward reference. pos: "+R+" distance: "+ve+" len: "+be+" bytes left: "+Z);for(Ee=0;Eethis.buffer.length&&(n=this.buffer.length-this.pos);for(var r=0;rthis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(e.subarray(0,t),this.pos),this.pos+=t,t},t.BrotliOutput=r},function(e,t,n){var r=n(153);t.init=function(){t.dictionary=r.init()},t.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),t.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),t.minDictionaryWordLength=4,t.maxDictionaryWordLength=24},function(e,t){function n(e,t){this.bits=e,this.value=t}t.HuffmanCode=n;function r(e,t){for(var n=1<>=1;return(e&n-1)+n}function i(e,t,r,i,s){do{e[t+(i-=r)]=new n(s.bits,s.value)}while(i>0)}function s(e,t,n){for(var r=1<0;--y[l])i(e,t+h,d,w,new n(255&l,65535&_[c++])),h=r(h,l);for(f=g-1,p=-1,l=o+1,d=2;l<=15;++l,d<<=1)for(;y[l]>0;--y[l])(h&f)!==p&&(t+=w,g+=w=1<<(m=s(y,l,o)),e[b+(p=h&f)]=new n(m+o&255,t-b-p&65535)),i(e,t+(h>>o),d,w,new n(l-o&255,65535&_[c++])),h=r(h,l);return g}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){for(var i=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{s=s+(i=i+t[r++]|0)|0}while(--o);i%=65521,s%=65521}return i|s<<16|0}},function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}},function(e,t,n){"use strict";var r=n(9),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.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 u(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return u(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n4)l[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&n1?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return u(l,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){for(var i=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{s=s+(i=i+t[r++]|0)|0}while(--o);i%=65521,s%=65521}return i|s<<16|0}},function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}},function(e,t,n){"use strict";var r=n(11),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.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 u(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return u(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n4)l[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&n1?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return u(l,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";var r=n(16);e.exports=new r({include:[n(91)]})},function(e,t,n){"use strict";var r=n(16);e.exports=new r({include:[n(50)],implicit:[n(189),n(190),n(191),n(192)]})},function(e,t,n){"use strict";t.Commented=n(209),t.Diagnose=n(219),t.Decoder=n(37),t.Encoder=n(93),t.Simple=n(28),t.Tagged=n(54),t.Map=n(220),t.comment=t.Commented.comment,t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.decodeAllSync=t.Decoder.decodeAllSync,t.decodeFirstSync=t.Decoder.decodeFirstSync,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.encodeCanonical=t.Encoder.encodeCanonical,t.encodeOne=t.Encoder.encodeOne,t.encodeAsync=t.Encoder.encodeAsync,t.decode=t.Decoder.decodeFirstSync,t.leveldb={decode:t.Decoder.decodeAllSync,encode:t.Encoder.encode,buffer:!0,name:"cbor"},t.hasBigInt=n(17).hasBigInt},function(e,t,n){"use strict";(function(t){const r=n(4),i=n(55),s=n(18).BigNumber,o=n(29),a=(n(54),n(28),n(17)),u=n(12),l=u.MT,c=u.NUMBYTES,h=u.SHIFT32,d=u.SYMS,p=u.TAG,f=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.TWO,m=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.FOUR,w=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.EIGHT,g=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.TRUE,_=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.FALSE,b=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.UNDEFINED,y=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.NULL,v=new s("0x20000000000000"),E=t.from("f97e00","hex"),A=t.from("f9fc00","hex"),x=t.from("f97c00","hex"),T=t.from("f98000","hex"),S=Symbol("CBOR_LOOP_DETECT");class C extends r.Transform{constructor(e){const n=Object.assign({},e,{readableObjectMode:!1,writableObjectMode:!0});super(n),this.canonical=n.canonical,this.encodeUndefined=n.encodeUndefined,this.disallowUndefinedKeys=!!n.disallowUndefinedKeys,this.dateType=null!=n.dateType?n.dateType.toLowerCase():"number","symbol"==typeof n.detectLoops?this.detectLoops=n.detectLoops:this.detectLoops=n.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes=[Array,this._pushArray,Date,this._pushDate,t,this._pushBuffer,Map,this._pushMap,o,this._pushNoFilter,RegExp,this._pushRegexp,Set,this._pushSet,s,this._pushBigNumber,ArrayBuffer,this._pushUint8Array,Uint8ClampedArray,this._pushUint8Array,Uint8Array,this._pushUint8Array,Uint16Array,this._pushArray,Uint32Array,this._pushArray,Int8Array,this._pushArray,Int16Array,this._pushArray,Int32Array,this._pushArray,Float32Array,this._pushFloat32Array,Float64Array,this._pushFloat64Array],i.Url&&this.semanticTypes.push(i.Url,this._pushUrl),i.URL&&this.semanticTypes.push(i.URL,this._pushURL);const r=n.genTypes||[];for(let e=0,t=r.length;e{r.pushAny(e);const n=i.read();r.pushAny(t);const s=i.read();return n.compare(s)});for(const[t,r]of n){if(e.disallowUndefinedKeys&&void 0===t)throw new Error("Invalid Map key: undefined");if(!e.pushAny(t)||!e.pushAny(r))return!1}}else for(const[n,r]of t){if(e.disallowUndefinedKeys&&void 0===n)throw new Error("Invalid Map key: undefined");if(!e.pushAny(n)||!e.pushAny(r))return!1}return!0}_pushUint8Array(e,n){return e._pushBuffer(e,t.from(n))}_pushFloat32Array(e,t){const n=t.length;if(!e._pushInt(n,l.ARRAY))return!1;for(let r=0;r{const n=r[e]||(r[e]=C.encode(e)),i=r[t]||(r[t]=C.encode(t));return n.compare(i)}),!this._pushInt(n.length,l.MAP))return!1;let i;for(let t=0,s=n.length;t{const s=[],o=new C(n);o.on("data",e=>s.push(e)),o.on("error",i),o.on("finish",()=>r(t.concat(s))),o.pushAny(e),o.end()})}}e.exports=C}).call(this,n(3).Buffer)},,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";const r=n(57),{escapeString:i}=n(149);e.exports=class extends r{constructor(){super({sourceCodeLocationInfo:!0}),this.posTracker=this.locInfoMixin.posTracker}_transformChunk(e){super._transformChunk(e)}_getRawHtml(e){const t=this.posTracker.droppedBufferSize,n=e.startOffset-t,r=e.endOffset-t;return this.tokenizer.preprocessor.html.slice(n,r)}_handleToken(e){super._handleToken(e)||this.emitRaw(this._getRawHtml(e.location)),this.parserFeedbackSimulator.skipNextNewLine=!1}_emitToken(e,t){this.emit(e,t,this._getRawHtml(t.sourceCodeLocation))}emitDoctype(e){let t="",this.push(t)}emitStartTag(e){let t="<"+e.tagName;const n=e.attrs;for(let e=0;e":">",this.push(t)}emitEndTag(e){this.push(`${e.tagName}>`)}emitText({text:e}){this.push(i(e,!1))}emitComment(e){this.push(`\x3c!--${e.text}--\x3e`)}emitRaw(e){this.push(e)}}},function(e,t,n){e.exports=n(77).BrotliDecompressBuffer},function(e,t,n){"use strict";var r=n(167),i=n(11),s=n(88),o=n(170),a=n(49),u=n(89),l=n(171),c=Object.prototype.toString;function h(e){if(!(this instanceof h))return new h(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);if(this.header=new l,r.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=s.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=r.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[n])}function d(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(e,t){var n,a,u,l,h,d=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=s.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new i.Buf8(p),d.next_out=0,d.avail_out=p),(n=r.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(n=r.inflateSetDictionary(this.strm,f)),n===o.Z_BUF_ERROR&&!0===m&&(n=o.Z_OK,m=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&n!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(d.output,d.next_out),l=d.next_out-u,h=s.buf2string(d.output,u),d.next_out=l,d.avail_out=p-l,l&&i.arraySet(d.output,d.output,u,l,0),this.onData(h)):this.onData(i.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),d.avail_out=0,!0)},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=h,t.inflate=d,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},t.ungzip=d},function(e,t,n){"use strict";!function(){var t,r,i,s=0,o=[];for(r=0;r<256;r++)o[r]=(r+256).toString(16).substr(1);function a(){var e,n=(e=16,(!t||s+e>u.BUFFER_SIZE)&&(s=0,t=u.randomBytes(u.BUFFER_SIZE)),t.slice(s,s+=e));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,n}function u(){var e=a();return o[e[0]]+o[e[1]]+o[e[2]]+o[e[3]]+"-"+o[e[4]]+o[e[5]]+"-"+o[e[6]]+o[e[7]]+"-"+o[e[8]]+o[e[9]]+"-"+o[e[10]]+o[e[11]]+o[e[12]]+o[e[13]]+o[e[14]]+o[e[15]]}u.BUFFER_SIZE=4096,u.bin=a,u.clearBuffer=function(){t=null,s=0},u.test=function(e){return"string"==typeof e&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(e)},"undefined"!=typeof crypto?i=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(i=window.msCrypto),i=i||n(172),e.exports=u,u.randomBytes=function(){if(i){if(i.randomBytes)return i.randomBytes;if(i.getRandomValues)return function(e){var t=new Uint8Array(e);return i.getRandomValues(t),t}}return function(e){var t,n=[];for(t=0;t=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(i)return W(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var 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 S(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function g(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),r=+r,isNaN(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=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,i,n){var s,o=1,a=t.length,u=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,u/=2,r/=2}function h(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var c=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var l=!0,d=0;dn&&(i=n):i=n;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function x(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+l<=r)switch(l){case 1:h<128&&(c=h);break;case 2:128==(192&(s=t[n+1]))&&(u=(31&h)<<6|63&s)>127&&(c=u);break;case 3:s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&(u=(15&h)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[n+1],o=t[n+2],a=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");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;for(var s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),a=Math.min(s,o),h=this.slice(i,n),c=t.slice(e,r),l=0;ln)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,i,n,s){if(!u.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 O(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function F(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function P(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 B(t,e,r,i,s){return s||P(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function L(t,e,r,i,s){return s||P(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=this[t],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+n]=t/s&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):F(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):F(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){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("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&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 j(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(6))},function(t,e,r){t.exports=n;var i=r(41).EventEmitter;function n(){i.call(this)}r(13)(n,i),n.Readable=r(42),n.Writable=r(133),n.Duplex=r(134),n.Transform=r(135),n.PassThrough=r(136),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(c(),0===i.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",n),t.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",h),t.removeListener("error",h),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",h),t.on("error",h),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var i=r(1),n=r(0);const s=new TextDecoder("utf-8");class o{static fromResponse({url:t,response:e,date:r,noRW:n,isLive:s}){const a=e.body?new i.a(e.body.getReader(),!1):null,u=Number(e.headers.get("x-redirect-status")||e.status),h=e.statusText;let c=e.headers;const l=c.get("x-proxy-set-cookie");if(l){const t=[];l.split(",").forEach(e=>{const r=e.split(";",1)[0].trim();r.indexOf("=")>0&&t.push(r)}),t.length&&(c=new Headers(c),c.set("x-wabac-preset-cookie",t.join(";")),console.log("cookies",t.join(";")))}return new o({payload:a,status:u,statusText:h,headers:c,url:t,date:r,noRW:n,isLive:s})}constructor({payload:t,status:e,statusText:r,headers:i,url:n,date:s,extraOpts:o=null,noRW:a=!1,isLive:u=!1}){this.reader=null,this.buffer=null,t&&t[Symbol.asyncIterator]?this.reader=t:this.buffer=t,this.status=e,this.statusText=r,this.headers=i,this.url=n,this.date=s,this.extraOpts=o,this.noRW=a,this.isLive=u}async getText(){const t=await this.getBuffer();return"string"==typeof t?t:s.decode(t)}async getBuffer(){return this.buffer||(this.buffer=await this.reader.readFully()),this.buffer}async setContent(t){t instanceof i.b?(this.reader=t,this.buffer=null):t.getReader?(this.reader=new i.a(t.getReader()),this.buffer=null):(this.reader=null,this.buffer=t)}async*[Symbol.asyncIterator](){this.buffer?yield this.buffer:this.reader&&(yield*this.reader)}setRange(t){const e=t.match(/^bytes\=(\d+)\-(\d+)?$/);let r=0;if(this.buffer)r=this.buffer.length;else if(this.reader&&(r=Number(this.headers.get("content-length")),!r))return;if(!e)return this.status=416,this.statusText="Range Not Satisfiable",this.headers.set("Content-Range","*/"+r),!1;const i=Number(e[1]),n=Number(e[2])||r-1;return this.buffer?this.buffer=this.buffer.slice(i,n+1):this.reader&&(0===i&&n===r-1||this.reader.setLimitSkip(n-i+1,i)),this.headers.set("Content-Range",`bytes ${i}-${n}/${r}`),this.headers.set("Content-Length",n-i+1),this.status=206,this.statusText="Partial Content",!0}makeResponse(){let t=null;Object(n.i)(this.status)||(t=this.buffer||!this.reader?this.buffer:this.reader.getReadableStream());const e=new Response(t,{status:this.status,statusText:this.statusText,headers:this.headers});return e.date=this.date,e}}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";const i=":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",n="["+i+"][: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]*",s=new RegExp("^"+n+"$");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;s0||t===e?e:e-1}function m(t){for(var e,r,i=1,n=t.length,s=t[0]+"";ih^r?1:-1;for(a=(u=n.length)<(h=s.length)?u:h,o=0;os[o]^r?1:-1;return u==h?0:u>h^r?1:-1}function g(t,e,r,i){if(tr||t!==u(t))throw Error(h+(i||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function y(t){var e=t.c.length-1;return p(t.e/14)==e&&t.c[e]%2!=0}function _(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function b(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else eO?m.c=m.e=null:t.e=10;l/=10,h++);return void(h>O?m.c=m.e=null:(m.e=h,m.c=[t]))}p=String(t)}else{if(!o.test(p=String(t)))return n(m,p,d);m.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(h=p.indexOf("."))>-1&&(p=p.replace(".","")),(l=p.search(/e/i))>0?(h<0&&(h=l),h+=+p.slice(l+1),p=p.substring(0,l)):h<0&&(h=p.length)}else{if(g(e,2,U.length,"Base"),10==e)return z(m=new M(t),D+m.e+1,k);if(p=String(t),d="number"==typeof t){if(0*t!=0)return n(m,p,d,e);if(m.s=1/t<0?(p=p.slice(1),-1):1,M.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(c+t)}else m.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=U.slice(0,e),h=l=0,f=p.length;lh){h=f;continue}}else if(!a&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){a=!0,l=-1,h=0;continue}return n(m,String(t),d,e)}d=!1,(h=(p=i(p,e,10,m.s)).indexOf("."))>-1?p=p.replace(".",""):h=p.length}for(l=0;48===p.charCodeAt(l);l++);for(f=p.length;48===p.charCodeAt(--f););if(p=p.slice(l,++f)){if(f-=l,d&&M.DEBUG&&f>15&&(t>9007199254740991||t!==u(t)))throw Error(c+m.s*t);if((h=h-l-1)>O)m.c=m.e=null;else if(h=I)?_(u,o):b(u,o,"0");else if(s=(t=z(new M(t),e,r)).e,a=(u=m(t.c)).length,1==i||2==i&&(e<=s||s<=R)){for(;aa){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=s-a)>0)for(s+1==a&&(u+=".");e--;u+="0");return t.s<0&&n?"-"+u:u}function j(t,e){for(var r,i=1,n=new M(t[0]);i=10;n/=10,i++);return(r=i+14*r-1)>O?t.c=t.e=null:r=10;h/=10,n++);if((s=e-n)<0)s+=14,o=e,p=(c=m[f=0])/w[n-o-1]%10|0;else if((f=a((s+1)/14))>=m.length){if(!i)break t;for(;m.length<=f;m.push(0));c=p=0,n=1,o=(s%=14)-14+1}else{for(c=h=m[f],n=1;h>=10;h/=10,n++);p=(o=(s%=14)-14+n)<0?0:c/w[n-o-1]%10|0}if(i=i||e<0||null!=m[f+1]||(o<0?c:c%w[n-o-1]),i=r<4?(p||i)&&(0==r||r==(t.s<0?3:2)):p>5||5==p&&(4==r||i||6==r&&(s>0?o>0?c/w[n-o]:0:m[f-1])%10&1||r==(t.s<0?8:7)),e<1||!m[0])return m.length=0,i?(e-=t.e+1,m[0]=w[(14-e%14)%14],t.e=-e||0):m[0]=t.e=0,t;if(0==s?(m.length=f,h=1,f--):(m.length=f+1,h=w[14-s],m[f]=o>0?u(c/w[n-o]%w[o])*h:0),i)for(;;){if(0==f){for(s=1,o=m[0];o>=10;o/=10,s++);for(o=m[0]+=h,h=1;o>=10;o/=10,h++);s!=h&&(t.e++,m[0]==l&&(m[0]=1));break}if(m[f]+=h,m[f]!=l)break;m[f--]=0,h=1}for(s=m.length;0===m[--s];m.pop());}t.e>O?t.c=t.e=null:t.e=I?_(e,r):b(e,r,"0"),t.s<0?"-"+e:e)}return M.clone=t,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(g(r=t[e],0,f,e),D=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(g(r=t[e],0,8,e),k=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(g(r[0],-f,0,e),g(r[1],0,f,e),R=r[0],I=r[1]):(g(r,-f,f,e),R=-(I=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)g(r[0],-f,-1,e),g(r[1],1,f,e),N=r[0],O=r[1];else{if(g(r,-f,f,e),!r)throw Error(h+e+" cannot be zero: "+r);N=-(O=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(h+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!r,Error(h+"crypto unavailable");F=r}else F=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(g(r=t[e],0,9,e),P=r),t.hasOwnProperty(e="POW_PRECISION")&&(g(r=t[e],0,f,e),B=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(h+e+" not an object: "+r);L=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(h+e+" invalid: "+r);U=r}}return{DECIMAL_PLACES:D,ROUNDING_MODE:k,EXPONENTIAL_AT:[R,I],RANGE:[N,O],CRYPTO:F,MODULO_MODE:P,POW_PRECISION:B,FORMAT:L,ALPHABET:U}},M.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!M.DEBUG)return!0;var e,r,i=t.c,n=t.e,s=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===s||-1===s)&&n>=-f&&n<=f&&n===u(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break t}if((e=(n+1)%14)<1&&(e+=14),String(i[0]).length==e){for(e=0;e=l||r!==u(r))break t;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(h+"Invalid BigNumber: "+t)},M.maximum=M.max=function(){return j(arguments,S.lt)},M.minimum=M.min=function(){return j(arguments,S.gt)},M.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,i,n,o,c=0,l=[],p=new M(C);if(null==t?t=D:g(t,0,f),n=a(t/14),F)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(n*=2));c>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(o%1e14),c+=2);c=n/2}else{if(!crypto.randomBytes)throw F=!1,Error(h+"crypto unavailable");for(e=crypto.randomBytes(n*=7);c=9e15?crypto.randomBytes(7).copy(e,c):(l.push(o%1e14),c+=7);c=n/7}if(!F)for(;c=10;o/=10,c++);c<14&&(i-=14-c)}return p.e=i,p.c=l,p}),M.sum=function(){for(var t=1,e=arguments,r=new M(e[0]);tr-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}return function(e,i,n,s,o){var a,u,h,c,l,d,f,p,w=e.indexOf("."),g=D,y=k;for(w>=0&&(c=B,B=0,e=e.replace(".",""),d=(p=new M(i)).pow(e.length-w),B=c,p.c=t(b(m(d.c),d.e,"0"),10,n,"0123456789"),p.e=p.c.length),h=c=(f=t(e,i,n,o?(a=U,"0123456789"):(a="0123456789",U))).length;0==f[--c];f.pop());if(!f[0])return a.charAt(0);if(w<0?--h:(d.c=f,d.e=h,d.s=s,f=(d=r(d,p,g,y,n)).c,l=d.r,h=d.e),w=f[u=h+g+1],c=n/2,l=l||u<0||null!=f[u+1],l=y<4?(null!=w||l)&&(0==y||y==(d.s<0?3:2)):w>c||w==c&&(4==y||l||6==y&&1&f[u-1]||y==(d.s<0?8:7)),u<1||!f[0])e=l?b(a.charAt(1),-g,a.charAt(0)):a.charAt(0);else{if(f.length=u,l)for(--n;++f[--u]>n;)f[u]=0,u||(++h,f=[1].concat(f));for(c=f.length;!f[--c];);for(w=0,e="";w<=c;e+=a.charAt(f[w++]));e=b(e,h,a.charAt(0))}return e}}(),r=function(){function t(t,e,r){var i,n,s,o,a=0,u=t.length,h=e%1e7,c=e/1e7|0;for(t=t.slice();u--;)a=((n=h*(s=t[u]%1e7)+(i=c*s+(o=t[u]/1e7|0)*h)%1e7*1e7+a)/r|0)+(i/1e7|0)+c*o,t[u]=n%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;ne[n]?1:-1;break}return s}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]1;t.splice(0,1));}return function(i,n,s,o,a){var h,c,d,f,m,w,g,y,_,b,E,v,A,T,x,S,C,D=i.s==n.s?1:-1,k=i.c,R=n.c;if(!(k&&k[0]&&R&&R[0]))return new M(i.s&&n.s&&(k?!R||k[0]!=R[0]:R)?k&&0==k[0]||!R?0*D:D/0:NaN);for(_=(y=new M(D)).c=[],D=s+(c=i.e-n.e)+1,a||(a=l,c=p(i.e/14)-p(n.e/14),D=D/14|0),d=0;R[d]==(k[d]||0);d++);if(R[d]>(k[d]||0)&&c--,D<0)_.push(1),f=!0;else{for(T=k.length,S=R.length,d=0,D+=2,(m=u(a/(R[0]+1)))>1&&(R=t(R,m,a),k=t(k,m,a),S=R.length,T=k.length),A=S,E=(b=k.slice(0,S)).length;E=a/2&&x++;do{if(m=0,(h=e(R,b,S,E))<0){if(v=b[0],S!=E&&(v=v*a+(b[1]||0)),(m=u(v/x))>1)for(m>=a&&(m=a-1),g=(w=t(R,m,a)).length,E=b.length;1==e(w,b,g,E);)m--,r(w,S=10;D/=10,d++);z(y,s+(y.e=d+14*c-1)+1,o,f)}else y.e=c,y.r=+f;return y}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,A=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(t,e,r,i){var n,s=r?e:e.replace(x,"");if(T.test(s))t.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(E,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,s=s.replace(v,"$1").replace(A,"0.$1")),e!=s))return new M(s,n);if(M.DEBUG)throw Error(h+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},S.absoluteValue=S.abs=function(){var t=new M(this);return t.s<0&&(t.s=1),t},S.comparedTo=function(t,e){return w(this,new M(t,e))},S.decimalPlaces=S.dp=function(t,e){var r,i,n,s=this;if(null!=t)return g(t,0,f),null==e?e=k:g(e,0,8),z(new M(s),t+s.e+1,e);if(!(r=s.c))return null;if(i=14*((n=r.length-1)-p(this.e/14)),n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},S.dividedBy=S.div=function(t,e){return r(this,new M(t,e),D,k)},S.dividedToIntegerBy=S.idiv=function(t,e){return r(this,new M(t,e),0,1)},S.exponentiatedBy=S.pow=function(t,e){var r,i,n,s,o,c,l,d,f=this;if((t=new M(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+G(t));if(null!=e&&(e=new M(e)),o=t.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!t.c||!t.c[0])return d=new M(Math.pow(+G(f),o?2-y(t):+G(t))),e?d.mod(e):d;if(c=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new M(NaN);(i=!c&&f.isInteger()&&e.isInteger())&&(f=f.mod(e))}else{if(t.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||o&&f.c[1]>=24e7:f.c[0]<8e13||o&&f.c[0]<=9999975e7)))return s=f.s<0&&y(t)?-0:0,f.e>-1&&(s=1/s),new M(c?1/s:s);B&&(s=a(B/14+2))}for(o?(r=new M(.5),c&&(t.s=1),l=y(t)):l=(n=Math.abs(+G(t)))%2,d=new M(C);;){if(l){if(!(d=d.times(f)).c)break;s?d.c.length>s&&(d.c.length=s):i&&(d=d.mod(e))}if(n){if(0===(n=u(n/2)))break;l=n%2}else if(z(t=t.times(r),t.e+1,1),t.e>14)l=y(t);else{if(0===(n=+G(t)))break;l=n%2}f=f.times(f),s?f.c&&f.c.length>s&&(f.c.length=s):i&&(f=f.mod(e))}return i?d:(c&&(d=C.div(d)),e?d.mod(e):s?z(d,B,k,void 0):d)},S.integerValue=function(t){var e=new M(this);return null==t?t=k:g(t,0,8),z(e,e.e+1,t)},S.isEqualTo=S.eq=function(t,e){return 0===w(this,new M(t,e))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(t,e){return w(this,new M(t,e))>0},S.isGreaterThanOrEqualTo=S.gte=function(t,e){return 1===(e=w(this,new M(t,e)))||0===e},S.isInteger=function(){return!!this.c&&p(this.e/14)>this.c.length-2},S.isLessThan=S.lt=function(t,e){return w(this,new M(t,e))<0},S.isLessThanOrEqualTo=S.lte=function(t,e){return-1===(e=w(this,new M(t,e)))||0===e},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(t,e){var r,i,n,s,o=this,a=o.s;if(e=(t=new M(t,e)).s,!a||!e)return new M(NaN);if(a!=e)return t.s=-e,o.plus(t);var u=o.e/14,h=t.e/14,c=o.c,d=t.c;if(!u||!h){if(!c||!d)return c?(t.s=-e,t):new M(d?o:NaN);if(!c[0]||!d[0])return d[0]?(t.s=-e,t):new M(c[0]?o:3==k?-0:0)}if(u=p(u),h=p(h),c=c.slice(),a=u-h){for((s=a<0)?(a=-a,n=c):(h=u,n=d),n.reverse(),e=a;e--;n.push(0));n.reverse()}else for(i=(s=(a=c.length)<(e=d.length))?a:e,a=e=0;e0)for(;e--;c[r++]=0);for(e=l-1;i>a;){if(c[--i]=0;){for(r=0,f=b[n]%1e7,m=b[n]/1e7|0,s=n+(o=u);s>n;)r=((h=f*(h=_[--o]%1e7)+(a=m*h+(c=_[o]/1e7|0)*f)%1e7*1e7+w[s]+r)/g|0)+(a/1e7|0)+m*c,w[s--]=h%g;w[s]=r}return r?++i:w.splice(0,1),H(t,w,i)},S.negated=function(){var t=new M(this);return t.s=-t.s||null,t},S.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new M(t,e)).s,!n||!e)return new M(NaN);if(n!=e)return t.s=-e,i.minus(t);var s=i.e/14,o=t.e/14,a=i.c,u=t.c;if(!s||!o){if(!a||!u)return new M(n/0);if(!a[0]||!u[0])return u[0]?t:new M(a[0]?i:0*n)}if(s=p(s),o=p(o),a=a.slice(),n=s-o){for(n>0?(o=s,r=u):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(e=u.length)<0&&(r=u,u=a,a=r,e=n),n=0;e;)n=(a[--e]=a[e]+u[e]+n)/l|0,a[e]=l===a[e]?0:a[e]%l;return n&&(a=[n].concat(a),++o),H(t,a,o)},S.precision=S.sd=function(t,e){var r,i,n,s=this;if(null!=t&&t!==!!t)return g(t,1,f),null==e?e=k:g(e,0,8),z(new M(s),t,e);if(!(r=s.c))return null;if(i=14*(n=r.length-1)+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&s.e+1>i&&(i=s.e+1),i},S.shiftedBy=function(t){return g(t,-9007199254740991,9007199254740991),this.times("1e"+t)},S.squareRoot=S.sqrt=function(){var t,e,i,n,s,o=this,a=o.c,u=o.s,h=o.e,c=D+4,l=new M("0.5");if(1!==u||!a||!a[0])return new M(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(u=Math.sqrt(+G(o)))||u==1/0?(((e=m(a)).length+h)%2==0&&(e+="0"),u=Math.sqrt(+e),h=p((h+1)/2)-(h<0||h%2),i=new M(e=u==1/0?"1e"+h:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+h)):i=new M(u+""),i.c[0])for((u=(h=i.e)+c)<3&&(u=0);;)if(s=i,i=l.times(s.plus(r(o,s,c,1))),m(s.c).slice(0,u)===(e=m(i.c)).slice(0,u)){if(i.e0&&m>0){for(s=m%a||a,l=p.substr(0,s);s0&&(l+=c+p.slice(s)),f&&(l="-"+l)}i=d?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):l}return(r.prefix||"")+i+(r.suffix||"")},S.toFraction=function(t){var e,i,n,s,o,a,u,c,l,f,p,w,g=this,y=g.c;if(null!=t&&(!(u=new M(t)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(h+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+G(u));if(!y)return new M(g);for(e=new M(C),l=i=new M(C),n=c=new M(C),w=m(y),o=e.e=w.length-g.e-1,e.c[0]=d[(a=o%14)<0?14+a:a],t=!t||u.comparedTo(e)>0?o>0?e:l:u,a=O,O=1/0,u=new M(w),c.c[0]=0;f=r(u,e,0,1),1!=(s=i.plus(f.times(n))).comparedTo(t);)i=n,n=s,l=c.plus(f.times(s=l)),c=s,e=u.minus(f.times(s=e)),u=s;return s=r(t.minus(i),n,0,1),c=c.plus(s.times(l)),i=i.plus(s.times(n)),c.s=l.s=g.s,p=r(l,n,o*=2,k).minus(g).abs().comparedTo(r(c,i,o,k).minus(g).abs())<1?[l,n]:[c,i],O=a,p},S.toNumber=function(){return+G(this)},S.toPrecision=function(t,e){return null!=t&&g(t,1,f),W(this,t,e,2)},S.toString=function(t){var e,r=this,n=r.s,s=r.e;return null===s?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==t?e=s<=R||s>=I?_(m(r.c),s):b(m(r.c),s,"0"):10===t?e=b(m((r=z(new M(r),D+s+1,k)).c),r.e,"0"):(g(t,2,U.length,"Base"),e=i(b(m(r.c),s,"0"),10,t,n,!0)),n<0&&r.c[0]&&(e="-"+e)),e},S.valueOf=S.toJSON=function(){return G(this)},S._isBigNumber=!0,null!=e&&M.set(e),M}()).default=s.BigNumber=s,void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()},function(t,e,r){"use strict";const i=r(11).BigNumber;e.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},e.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},e.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},e.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},e.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},e.SHIFT32=4294967296,e.BI={MINUS_ONE:-1,MAXINT32:4294967295,MAXINT64:"0xffffffffffffffff",SHIFT32:e.SHIFT32};const n=new i(-1);e.BN={MINUS_ONE:n,NEG_MAX:n.minus(new i(Number.MAX_SAFE_INTEGER.toString(16),16)),MAXINT:new i("0x20000000000000"),MAXINT32:new i(4294967295),MAXINT64:new i("0xffffffffffffffff"),SHIFT32:new i(e.SHIFT32)}},function(t,e){"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}}},function(t,e){var r,i,n=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(t){r=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var u,h=[],c=!1,l=-1;function d(){c&&u&&(c=!1,u.length?h=u.concat(h):l=-1,h.length&&f())}function f(){if(!c){var t=a(d);c=!0;for(var e=h.length;e;){for(u=h,h=[];++l1)for(var r=1;rt.decode(e),e.utf8.checksUTF8=!0}else e.utf8=t=>t.toString("utf8"),e.utf8.checksUTF8=!1;e.parseCBORint=function(t,e){switch(t){case o.ONE:return e.readUInt8(0);case o.TWO:return e.readUInt16BE(0);case o.FOUR:return e.readUInt32BE(0);case o.EIGHT:const r=e.readUInt32BE(0),i=e.readUInt32BE(4);return r>2097151?new n(r).times(a).plus(i):r*a+i;default:throw new Error("Invalid additional info for int: "+t)}},e.writeHalf=function(e,r){const i=t.allocUnsafe(4);i.writeFloatBE(r,0);const n=i.readUInt32BE(0);if(0!=(8191&n))return!1;let s=n>>16&32768;const o=n>>23&255,a=8388607&n;if(o>=113&&o<=142)s+=(o-112<<10)+(a>>13);else{if(!(o>=103&&o<113))return!1;if(a&(1<<126-o)-1)return!1;s+=a+8388608>>126-o}return e.writeUInt16BE(s),!0},e.parseHalf=function(t){const e=128&t[0]?-1:1,r=(124&t[0])>>2,i=(3&t[0])<<8|t[1];return r?31===r?e*(i?NaN:Infinity):e*Math.pow(2,r-25)*(1024+i):5.960464477539063e-8*e*i},e.parseCBORfloat=function(t){switch(t.length){case 2:return e.parseHalf(t);case 4:return t.readFloatBE(0);case 8:return t.readDoubleBE(0);default:throw new Error("Invalid float size: "+t.length)}},e.hex=function(e){return t.from(e.replace(/^0x/,""),"hex")},e.bin=function(e){let r=0,i=(e=e.replace(/\s/g,"")).length%8||8;const n=[];for(;i<=e.length;)n.push(parseInt(e.slice(r,i),2)),r=i,i+=8;return t.from(n)},e.extend=function(t={},...e){const r=e.length;for(let i=0;it===e[r]))},e.bufferEqual=function(e,r){if(null==e&&null==r)return!0;if(null==e||null==r)return!1;if(!t.isBuffer(e)||!t.isBuffer(r)||e.length!==r.length)return!1;const i=e.length;let n,s,o=!0;for(n=s=0;s=1e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=1e3} records`)),this.batch.push(t)}async finishIndexing(){this.batch.length>0&&this.promises.push(this.db.addResources(this.batch)),console.log(`Indexed ${this.count+=this.batch.length} records`),this._finishLoad();try{await Promise.all(this.promises)}catch(t){console.warn(t)}this.promises=[]}_finishLoad(){}}},,,function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(3).Buffer)},function(t,e,r){"use strict";const i=e.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};e.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},e.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const n=e.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};e.SPECIAL_ELEMENTS={[i.HTML]:{[n.ADDRESS]:!0,[n.APPLET]:!0,[n.AREA]:!0,[n.ARTICLE]:!0,[n.ASIDE]:!0,[n.BASE]:!0,[n.BASEFONT]:!0,[n.BGSOUND]:!0,[n.BLOCKQUOTE]:!0,[n.BODY]:!0,[n.BR]:!0,[n.BUTTON]:!0,[n.CAPTION]:!0,[n.CENTER]:!0,[n.COL]:!0,[n.COLGROUP]:!0,[n.DD]:!0,[n.DETAILS]:!0,[n.DIR]:!0,[n.DIV]:!0,[n.DL]:!0,[n.DT]:!0,[n.EMBED]:!0,[n.FIELDSET]:!0,[n.FIGCAPTION]:!0,[n.FIGURE]:!0,[n.FOOTER]:!0,[n.FORM]:!0,[n.FRAME]:!0,[n.FRAMESET]:!0,[n.H1]:!0,[n.H2]:!0,[n.H3]:!0,[n.H4]:!0,[n.H5]:!0,[n.H6]:!0,[n.HEAD]:!0,[n.HEADER]:!0,[n.HGROUP]:!0,[n.HR]:!0,[n.HTML]:!0,[n.IFRAME]:!0,[n.IMG]:!0,[n.INPUT]:!0,[n.LI]:!0,[n.LINK]:!0,[n.LISTING]:!0,[n.MAIN]:!0,[n.MARQUEE]:!0,[n.MENU]:!0,[n.META]:!0,[n.NAV]:!0,[n.NOEMBED]:!0,[n.NOFRAMES]:!0,[n.NOSCRIPT]:!0,[n.OBJECT]:!0,[n.OL]:!0,[n.P]:!0,[n.PARAM]:!0,[n.PLAINTEXT]:!0,[n.PRE]:!0,[n.SCRIPT]:!0,[n.SECTION]:!0,[n.SELECT]:!0,[n.SOURCE]:!0,[n.STYLE]:!0,[n.SUMMARY]:!0,[n.TABLE]:!0,[n.TBODY]:!0,[n.TD]:!0,[n.TEMPLATE]:!0,[n.TEXTAREA]:!0,[n.TFOOT]:!0,[n.TH]:!0,[n.THEAD]:!0,[n.TITLE]:!0,[n.TR]:!0,[n.TRACK]:!0,[n.UL]:!0,[n.WBR]:!0,[n.XMP]:!0},[i.MATHML]:{[n.MI]:!0,[n.MO]:!0,[n.MN]:!0,[n.MS]:!0,[n.MTEXT]:!0,[n.ANNOTATION_XML]:!0},[i.SVG]:{[n.TITLE]:!0,[n.FOREIGN_OBJECT]:!0,[n.DESC]:!0}}},function(t,e,r){"use strict";function i(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(t){var e=this.name+": ";return e+=this.reason||"(unknown reason)",!t&&this.mark&&(e+=" "+this.mark.toString()),e},t.exports=i},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(87)],implicit:[r(178),r(179)],explicit:[r(180),r(181),r(182),r(183)]})},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=s)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),c(i,t,i.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function h(t,e){return t}function c(t,r,i){if(t.customInspect&&r&&A(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return g(n)||(n=c(t,n,i)),n}var s=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(w(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(s)return s;var o=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(r)),v(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return l(r);if(0===o.length){if(A(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return t.stylize(Date.prototype.toString.call(r),"date");if(v(r))return l(r)}var h,b="",T=!1,x=["{","}"];(f(r)&&(T=!0,x=["[","]"]),A(r))&&(b=" [Function"+(r.name?": "+r.name:"")+"]");return _(r)&&(b=" "+RegExp.prototype.toString.call(r)),E(r)&&(b=" "+Date.prototype.toUTCString.call(r)),v(r)&&(b=" "+l(r)),0!==o.length||T&&0!=r.length?i<0?_(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=T?function(t,e,r,i,n){for(var s=[],o=0,a=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,b,x)):x[0]+b+x[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,i,n,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),D(i,n)||(o="["+n+"]"),a||(t.seen.indexOf(u.value)<0?(a=m(r)?c(t,u.value,null):c(t,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),y(o)){if(s&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function f(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function w(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function _(t){return b(t)&&"[object RegExp]"===T(t)}function b(t){return"object"==typeof t&&null!==t}function E(t){return b(t)&&"[object Date]"===T(t)}function v(t){return b(t)&&("[object Error]"===T(t)||t instanceof Error)}function A(t){return"function"==typeof t}function T(t){return Object.prototype.toString.call(t)}function x(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(y(s)&&(s=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var i=t.pid;o[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else o[r]=function(){};return o[r]},e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=f,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=w,e.isString=g,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=_,e.isObject=b,e.isDate=E,e.isError=v,e.isFunction=A,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(195);var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var t=new Date,e=[x(t.getHours()),x(t.getMinutes()),x(t.getSeconds())].join(":");return[t.getDate(),S[t.getMonth()],e].join(" ")}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",C(),e.format.apply(e,arguments))},e.inherits=r(196),e._extend=function(t,e){if(!e||!b(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var k="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(k&&t[k]){var e;if("function"!=typeof(e=t[k]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,k,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],s=0;s255||(0|t)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}toString(){return"simple("+this.value+")"}[i.inspect.custom](t,e){return"simple("+this.value+")"}inspect(t,e){return"simple("+this.value+")"}encodeCBOR(t){return t._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(t){return t instanceof u}static decode(t,e=!0,r=!1){switch(t){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return e?null:a.NULL;case o.UNDEFINED:return e?void 0:a.UNDEFINED;case-1:if(!e||!r)throw new Error("Invalid BREAK");return a.BREAK;default:return new u(t)}}}t.exports=u},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(26);class s extends i.Transform{constructor(t,r,i){let n,s;switch(null==i&&(i={}),typeof t){case"object":e.isBuffer(t)?(n=t,null!=r&&"object"==typeof r&&(i=r)):i=t;break;case"string":n=t,null!=r&&"object"==typeof r?i=r:s=r}null==i&&(i={}),null==n&&(n=i.input),null==s&&(s=i.inputEncoding),delete i.input,delete i.inputEncoding;const o=null==i.watchPipe||i.watchPipe;delete i.watchPipe;const a=!!i.readError;delete i.readError,super(i),this.readError=a,o&&this.on("pipe",t=>{const e=t._readableState.objectMode;if(this.length>0&&e!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");return this._readableState.objectMode=e,this._writableState.objectMode=e}),null!=n&&this.end(n,s)}static isNoFilter(t){return t instanceof this}static compare(t,e){if(!(t instanceof this))throw new TypeError("Arguments must be NoFilters");return t===e?0:t.compare(e)}static concat(t,r){if(!Array.isArray(t))throw new TypeError("list argument must be an Array of NoFilters");if(0===t.length||0===r)return e.alloc(0);null==r&&(r=t.reduce((t,e)=>{if(!(e instanceof s))throw new TypeError("list argument must be an Array of NoFilters");return t+e.length},0));let i=!0,n=!0;const o=t.map(t=>{if(!(t instanceof s))throw new TypeError("list argument must be an Array of NoFilters");const r=t.slice();return e.isBuffer(r)?n=!1:i=!1,r});if(i)return e.concat(o,r);if(n)return[].concat(...o).slice(0,r);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(t,r,i){this._readableState.objectMode||e.isBuffer(t)||(t=e.from(t,r)),this.push(t),i()}_bufArray(){let t=this._readableState.buffer;if(!Array.isArray(t)){let e=t.head;for(t=[];null!=e;)t.push(e.data),e=e.next}return t}read(t){const e=super.read(t);if(null!=e){if(this.emit("read",e),this.readError&&e.length{this.on("finish",()=>{const i=this.read();null==t||e||(e=!0,t(null,i)),r(i)}),this.on("error",r=>{null==t||e||(e=!0,t(r)),i(r)})})}compare(t){if(!(t instanceof s))throw new TypeError("Arguments must be NoFilters");if(this===t)return 0;{const r=this.slice(),i=t.slice();if(e.isBuffer(r)&&e.isBuffer(i))return r.compare(i);throw new Error("Cannot compare streams in object mode")}}equals(t){return 0===this.compare(t)}slice(t,r){if(this._readableState.objectMode)return this._bufArray().slice(t,r);const i=this._bufArray();switch(i.length){case 0:return e.alloc(0);case 1:return i[0].slice(t,r);default:return e.concat(i).slice(t,r)}}get(t){return this.slice()[t]}toJSON(){const t=this.slice();return e.isBuffer(t)?t.toJSON():t}toString(t,r,i){const s=this.slice(r,i);if(!e.isBuffer(s))return JSON.stringify(s);if((!t||"utf8"===t)&&n.TextDecoder){return new n.TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(s)}return s.toString(t,r,i)}inspect(t,e){return this[n.inspect.custom](t,e)}[n.inspect.custom](t,r){const i=this._bufArray().map(t=>e.isBuffer(t)?(null!=r?r.stylize:void 0)?r.stylize(t.toString("hex"),"string"):t.toString("hex"):n.inspect(t,r)).join(", ");return`${this.constructor.name} [${i}]`}get length(){return this._readableState.length}writeBigInt(t){let r=t.toString(16);if(t<0){const e=BigInt(Math.floor(r.length/2));r=(t=(BigInt(1)<=a.DIGIT_0&&t<=a.DIGIT_9}function f(t){return t>=a.LATIN_CAPITAL_A&&t<=a.LATIN_CAPITAL_Z}function p(t){return t>=a.LATIN_SMALL_A&&t<=a.LATIN_SMALL_Z}function m(t){return p(t)||f(t)}function w(t){return m(t)||d(t)}function g(t){return t>=a.LATIN_CAPITAL_A&&t<=a.LATIN_CAPITAL_F}function y(t){return t>=a.LATIN_SMALL_A&&t<=a.LATIN_SMALL_F}function _(t){return t+32}function b(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(t>>>10&1023|55296)+String.fromCharCode(56320|1023&t))}function E(t){return String.fromCharCode(_(t))}function v(t,e){const r=s[++t];let i=++t,n=i+r-1;for(;i<=n;){const t=i+n>>>1,o=s[t];if(oe))return s[t+r];n=t-1}}return-1}class A{constructor(){this.preprocessor=new i,this.tokenQueue=[],this.allowCDATA=!1,this.state=c,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(t){this._consume(),this._err(t),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this[this.state](t)}return this.tokenQueue.shift()}write(t,e){this.active=!0,this.preprocessor.write(t,e)}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:A.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(t){this.state=t,this._unconsume()}_consumeSequenceIfMatch(t,e,r){let i=0,n=!0;const s=t.length;let o=0,u=e,h=void 0;for(;o0&&(u=this._consume(),i++),u===a.EOF){n=!1;break}if(h=t[o],u!==h&&(r||u!==_(h))){n=!1;break}}if(!n)for(;i--;)this._unconsume();return n}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==u.SCRIPT_STRING.length)return!1;for(let t=0;t0&&this._err(o.endTagWithAttributes),t.selfClosing&&this._err(o.endTagWithTrailingSolidus)),this.tokenQueue.push(t)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(t,e){this.currentCharacterToken&&this.currentCharacterToken.type!==t&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=e:this._createCharacterToken(t,e)}_emitCodePoint(t){let e=A.CHARACTER_TOKEN;l(t)?e=A.WHITESPACE_CHARACTER_TOKEN:t===a.NULL&&(e=A.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(e,b(t))}_emitSeveralCodePoints(t){for(let e=0;e-1;){const t=s[i],n=t<7;n&&1&t&&(e=2&t?[s[++i],s[++i]]:[s[++i]],r=0);const o=this._consume();if(this.tempBuff.push(o),r++,o===a.EOF)break;i=n?4&t?v(i,o):-1:o===t?++i:-1}for(;r--;)this.tempBuff.pop(),this._unconsume();return e}_isCharacterReferenceInAttribute(){return"ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_UNQUOTED_STATE"===this.returnState}_isCharacterReferenceAttributeQuirk(t){if(!t&&this._isCharacterReferenceInAttribute()){const t=this._consume();return this._unconsume(),t===a.EQUALS_SIGN||w(t)}return!1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let t=0;t")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE(t){t===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE"):m(t)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE")):(this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE(t){m(t)?(this._createEndTagToken(),this._reconsumeInState("SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE")):(this._emitChars(""),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE(t){if(f(t))this.currentToken.tagName+=E(t),this.tempBuff.push(t);else if(p(t))this.currentToken.tagName+=b(t),this.tempBuff.push(t);else{if(this.lastStartTagName===this.currentToken.tagName){if(l(t))return void(this.state="BEFORE_ATTRIBUTE_NAME_STATE");if(t===a.SOLIDUS)return void(this.state="SELF_CLOSING_START_TAG_STATE");if(t===a.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=c)}this._emitChars(""),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}}SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_DOUBLE_ESCAPED_STATE":"SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(t)):f(t)?(this.tempBuff.push(_(t)),this._emitCodePoint(t)):p(t)?(this.tempBuff.push(t),this._emitCodePoint(t)):this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPED_STATE(t){t===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",this._emitChars("-")):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(t)}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE(t){t===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",this._emitChars("-")):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE(t){t===a.HYPHEN_MINUS?this._emitChars("-"):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.GREATER_THAN_SIGN?(this.state="SCRIPT_DATA_STATE",this._emitChars(">")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE(t){t===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",this._emitChars("/")):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_ESCAPED_STATE":"SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t)):f(t)?(this.tempBuff.push(_(t)),this._emitCodePoint(t)):p(t)?(this.tempBuff.push(t),this._emitCodePoint(t)):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}BEFORE_ATTRIBUTE_NAME_STATE(t){l(t)||(t===a.SOLIDUS||t===a.GREATER_THAN_SIGN||t===a.EOF?this._reconsumeInState("AFTER_ATTRIBUTE_NAME_STATE"):t===a.EQUALS_SIGN?(this._err(o.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state="ATTRIBUTE_NAME_STATE"):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}ATTRIBUTE_NAME_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN||t===a.EOF?(this._leaveAttrName("AFTER_ATTRIBUTE_NAME_STATE"),this._unconsume()):t===a.EQUALS_SIGN?this._leaveAttrName("BEFORE_ATTRIBUTE_VALUE_STATE"):f(t)?this.currentAttr.name+=E(t):t===a.QUOTATION_MARK||t===a.APOSTROPHE||t===a.LESS_THAN_SIGN?(this._err(o.unexpectedCharacterInAttributeName),this.currentAttr.name+=b(t)):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.name+=n.REPLACEMENT_CHARACTER):this.currentAttr.name+=b(t)}AFTER_ATTRIBUTE_NAME_STATE(t){l(t)||(t===a.SOLIDUS?this.state="SELF_CLOSING_START_TAG_STATE":t===a.EQUALS_SIGN?this.state="BEFORE_ATTRIBUTE_VALUE_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}BEFORE_ATTRIBUTE_VALUE_STATE(t){l(t)||(t===a.QUOTATION_MARK?this.state="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE":t===a.APOSTROPHE?this.state="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.missingAttributeValue),this.state=c,this._emitCurrentToken()):this._reconsumeInState("ATTRIBUTE_VALUE_UNQUOTED_STATE"))}ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}ATTRIBUTE_VALUE_UNQUOTED_STATE(t){l(t)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_UNQUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.QUOTATION_MARK||t===a.APOSTROPHE||t===a.LESS_THAN_SIGN||t===a.EQUALS_SIGN||t===a.GRAVE_ACCENT?(this._err(o.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=b(t)):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}AFTER_ATTRIBUTE_VALUE_QUOTED_STATE(t){l(t)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):t===a.SOLIDUS?this._leaveAttrValue("SELF_CLOSING_START_TAG_STATE"):t===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.missingWhitespaceBetweenAttributes),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}SELF_CLOSING_START_TAG_STATE(t){t===a.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.unexpectedSolidusInTag),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}BOGUS_COMMENT_STATE(t){t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._emitCurrentToken(),this._emitEOFToken()):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):this.currentToken.data+=b(t)}MARKUP_DECLARATION_OPEN_STATE(t){this._consumeSequenceIfMatch(u.DASH_DASH_STRING,t,!0)?(this._createCommentToken(),this.state="COMMENT_START_STATE"):this._consumeSequenceIfMatch(u.DOCTYPE_STRING,t,!1)?this.state="DOCTYPE_STATE":this._consumeSequenceIfMatch(u.CDATA_START_STRING,t,!0)?this.allowCDATA?this.state="CDATA_SECTION_STATE":(this._err(o.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state="BOGUS_COMMENT_STATE"):this._ensureHibernation()||(this._err(o.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState("BOGUS_COMMENT_STATE"))}COMMENT_START_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_START_DASH_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):this._reconsumeInState("COMMENT_STATE")}COMMENT_START_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_DASH_STATE":t===a.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state="COMMENT_LESS_THAN_SIGN_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=b(t)}COMMENT_LESS_THAN_SIGN_STATE(t){t===a.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state="COMMENT_LESS_THAN_SIGN_BANG_STATE"):t===a.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE":this._reconsumeInState("COMMENT_END_DASH_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE(t){t!==a.GREATER_THAN_SIGN&&t!==a.EOF&&this._err(o.nestedComment),this._reconsumeInState("COMMENT_END_STATE")}COMMENT_END_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_STATE(t){t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EXCLAMATION_MARK?this.state="COMMENT_END_BANG_STATE":t===a.HYPHEN_MINUS?this.currentToken.data+="-":t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_BANG_STATE(t){t===a.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state="COMMENT_END_DASH_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.incorrectlyClosedComment),this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState("COMMENT_STATE"))}DOCTYPE_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_NAME_STATE":t===a.GREATER_THAN_SIGN?this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingWhitespaceBeforeDoctypeName),this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"))}BEFORE_DOCTYPE_NAME_STATE(t){l(t)||(f(t)?(this._createDoctypeToken(E(t)),this.state="DOCTYPE_NAME_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this._createDoctypeToken(n.REPLACEMENT_CHARACTER),this.state="DOCTYPE_NAME_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(b(t)),this.state="DOCTYPE_NAME_STATE"))}DOCTYPE_NAME_STATE(t){l(t)?this.state="AFTER_DOCTYPE_NAME_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):f(t)?this.currentToken.name+=E(t):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.name+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=b(t)}AFTER_DOCTYPE_NAME_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(u.PUBLIC_STRING,t,!1)?this.state="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE":this._consumeSequenceIfMatch(u.SYSTEM_STRING,t,!1)?this.state="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE":this._ensureHibernation()||(this._err(o.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE(t){l(t)||(t===a.QUOTATION_MARK?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=b(t)}DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=b(t)}AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE(t){l(t)?this.state="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE(t){l(t)||(t===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=b(t)}DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=b(t)}AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}BOGUS_DOCTYPE_STATE(t){t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.NULL?this._err(o.unexpectedNullCharacter):t===a.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}CDATA_SECTION_STATE(t){t===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_BRACKET_STATE":t===a.EOF?(this._err(o.eofInCdata),this._emitEOFToken()):this._emitCodePoint(t)}CDATA_SECTION_BRACKET_STATE(t){t===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_END_STATE":(this._emitChars("]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CDATA_SECTION_END_STATE(t){t===a.GREATER_THAN_SIGN?this.state=c:t===a.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CHARACTER_REFERENCE_STATE(t){this.tempBuff=[a.AMPERSAND],t===a.NUMBER_SIGN?(this.tempBuff.push(t),this.state="NUMERIC_CHARACTER_REFERENCE_STATE"):w(t)?this._reconsumeInState("NAMED_CHARACTER_REFERENCE_STATE"):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}NAMED_CHARACTER_REFERENCE_STATE(t){const e=this._matchNamedCharacterReference(t);if(this._ensureHibernation())this.tempBuff=[a.AMPERSAND];else if(e){const t=this.tempBuff[this.tempBuff.length-1]===a.SEMICOLON;this._isCharacterReferenceAttributeQuirk(t)||(t||this._errOnNextCodePoint(o.missingSemicolonAfterCharacterReference),this.tempBuff=e),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state="AMBIGUOS_AMPERSAND_STATE"}AMBIGUOS_AMPERSAND_STATE(t){w(t)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=b(t):this._emitCodePoint(t):(t===a.SEMICOLON&&this._err(o.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}NUMERIC_CHARACTER_REFERENCE_STATE(t){this.charRefCode=0,t===a.LATIN_SMALL_X||t===a.LATIN_CAPITAL_X?(this.tempBuff.push(t),this.state="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE"):this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_START_STATE")}HEXADEMICAL_CHARACTER_REFERENCE_START_STATE(t){!function(t){return d(t)||g(t)||y(t)}(t)?(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState("HEXADEMICAL_CHARACTER_REFERENCE_STATE")}DECIMAL_CHARACTER_REFERENCE_START_STATE(t){d(t)?this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_STATE"):(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}HEXADEMICAL_CHARACTER_REFERENCE_STATE(t){g(t)?this.charRefCode=16*this.charRefCode+t-55:y(t)?this.charRefCode=16*this.charRefCode+t-87:d(t)?this.charRefCode=16*this.charRefCode+t-48:t===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}DECIMAL_CHARACTER_REFERENCE_STATE(t){d(t)?this.charRefCode=10*this.charRefCode+t-48:t===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}NUMERIC_CHARACTER_REFERENCE_END_STATE(){if(this.charRefCode===a.NULL)this._err(o.nullCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(o.characterReferenceOutsideUnicodeRange),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(n.isSurrogate(this.charRefCode))this._err(o.surrogateCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(n.isUndefinedCodePoint(this.charRefCode))this._err(o.noncharacterCharacterReference);else if(n.isControlCodePoint(this.charRefCode)||this.charRefCode===a.CARRIAGE_RETURN){this._err(o.controlCharacterReference);const t=h[this.charRefCode];t&&(this.charRefCode=t)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}}A.CHARACTER_TOKEN="CHARACTER_TOKEN",A.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",A.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",A.START_TAG_TOKEN="START_TAG_TOKEN",A.END_TAG_TOKEN="END_TAG_TOKEN",A.COMMENT_TOKEN="COMMENT_TOKEN",A.DOCTYPE_TOKEN="DOCTYPE_TOKEN",A.EOF_TOKEN="EOF_TOKEN",A.HIBERNATION_TOKEN="HIBERNATION_TOKEN",A.MODE={DATA:c,RCDATA:"RCDATA_STATE",RAWTEXT:"RAWTEXT_STATE",SCRIPT_DATA:"SCRIPT_DATA_STATE",PLAINTEXT:"PLAINTEXT_STATE"},A.getTokenAttr=function(t,e){for(let r=t.attrs.length-1;r>=0;r--)if(t.attrs[r].name===e)return t.attrs[r].value;return null},t.exports=A},function(t,e,r){"use strict";const i=r(7),n=r(7).buildOptions,s=r(162);"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,i.nameRegexp);!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const o={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",tagValueProcessor:function(t,e){return t},attrValueProcessor:function(t,e){return t},stopNodes:[]};e.defaultOptions=o;const a=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","stopNodes"];function u(t,e,r){return e&&(r.trimValues&&(e=e.trim()),e=c(e=r.tagValueProcessor(e,t),r.parseNodeValue,r.parseTrueNumberOnly)),e}function h(t,e){if(e.ignoreNameSpace){const e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}function c(t,e,r){if(e&&"string"==typeof t){let e;return""===t.trim()||isNaN(t)?e="true"===t||"false"!==t&&t:(-1!==t.indexOf("0x")?e=Number.parseInt(t,16):-1!==t.indexOf(".")?(e=Number.parseFloat(t),t=t.replace(/\.?0+$/,"")):e=Number.parseInt(t,10),r&&(e=String(e)===t?e:t)),e}return i.isExist(t)?t:""}e.props=a;const l=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");function d(t,e){if(!e.ignoreAttributes&&"string"==typeof t){t=t.replace(/\r?\n/g," ");const r=i.getAllMatches(t,l),n=r.length,s={};for(let t=0;t"===e)return{data:i,index:n};"\t"===e&&(e=" ")}i+=e}}function p(t,e,r,i){const n=t.indexOf(e,r);if(-1===n)throw new Error(i);return n+e.length-1}e.getTraversalObj=function(t,e){t=t.replace(/(\r\n)|\n/," "),e=n(e,o,a);const r=new s("!xml");let h=r,c="";for(let r=0;r",r,"Closing Tag is not closed.");let s=t.substring(r+2,n).trim();if(e.ignoreNameSpace){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}h&&(h.val?h.val=i.getValue(h.val)+""+u(s,c,e):h.val=u(s,c,e)),e.stopNodes.length&&e.stopNodes.includes(h.tagname)&&(h.child=[],null==h.attrsMap&&(h.attrsMap={}),h.val=t.substr(h.startIndex+1,r-h.startIndex-1)),h=h.parent,c="",r=n}else if("?"===t[r+1])r=p(t,"?>",r,"Pi Tag is not closed.");else if("!--"===t.substr(r+1,3))r=p(t,"--\x3e",r,"Comment is not closed.");else if("!D"===t.substr(r+1,2)){const e=p(t,">",r,"DOCTYPE is not closed.");r=t.substring(r,e).indexOf("[")>=0?t.indexOf("]>",r)+1:e}else if("!["===t.substr(r+1,2)){const n=p(t,"]]>",r,"CDATA is not closed.")-2,o=t.substring(r+9,n);if(c&&(h.val=i.getValue(h.val)+""+u(h.tagname,c,e),c=""),e.cdataTagName){const t=new s(e.cdataTagName,h,o);h.addChild(t),h.val=i.getValue(h.val)+e.cdataPositionChar,o&&(t.val=o)}else h.val=(h.val||"")+(o||"");r=n+2}else{const n=f(t,r+1);let o=n.data;const a=n.index,l=o.indexOf(" ");let p=o;if(-1!==l&&(p=o.substr(0,l).trimRight(),o=o.substr(l+1)),e.ignoreNameSpace){const t=p.indexOf(":");-1!==t&&(p=p.substr(t+1))}if(h&&c&&"!xml"!==h.tagname&&(h.val=i.getValue(h.val)+""+u(h.tagname,c,e)),o.length>0&&o.lastIndexOf("/")===o.length-1){"/"===p[p.length-1]?(p=p.substr(0,p.length-1),o=p):o=o.substr(0,o.length-1);const t=new s(p,h,"");p!==o&&(t.attrsMap=d(o,e)),h.addChild(t)}else{const t=new s(p,h);e.stopNodes.length&&e.stopNodes.includes(t.tagname)&&(t.startIndex=a),p!==o&&(t.attrsMap=d(o,e)),h.addChild(t),h=t}c="",r=a}else c+=t[r]}return r}},function(t,e,r){"use strict";var i=r(16);t.exports=i.DEFAULT=new i({include:[r(25)],explicit:[r(184),r(185),r(186)]})},function(t,e,r){"use strict";(function(e){const i=r(197),n=r(52),s=r(27),o=r(17),a=r(11).BigNumber,u=r(28),h=r(12),c=h.MT,l=h.NUMBYTES,d=(h.SIMPLE,h.SYMS),f=o.bigIntize(h.BI),p=h.BN,m=Symbol("count"),w=(Symbol("pending_key"),Symbol("major type")),g=Symbol("error"),y=Symbol("not found");function _(t,e,r){const i=[];return i[m]=r,i[d.PARENT]=t,i[w]=e,i}function b(t,e){const r=new u;return r[m]=-1,r[d.PARENT]=t,r[w]=e,r}function E(t){return o.bufferToBigInt(t)}function v(t){return f.MINUS_ONE-o.bufferToBigInt(t)}class A extends i{constructor(t){const e=(t=t||{}).tags;delete t.tags;const r=null!=t.max_depth?t.max_depth:-1;delete t.max_depth;const i=!!o.hasBigInt&&!!t.bigint;delete t.bigint,super(t),this.running=!0,this.max_depth=r,this.tags=e,i&&(null==this.tags&&(this.tags={}),null==this.tags[2]&&(this.tags[2]=E),null==this.tags[3]&&(this.tags[3]=v))}static nullcheck(t){switch(t){case d.NULL:return null;case d.UNDEFINED:return;case y:throw new Error("Value not found");default:return t}}static decodeFirstSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":i=o.extend({},e),r=i.encoding,delete i.encoding}const n=new A(i),s=new u(t,null!=r?r:o.guessEncoding(t)),a=n._parse();let h=a.next();for(;!h.done;){const t=s.read(h.value);if(null==t||t.length!==h.value)throw new Error("Insufficient data");h=a.next(t)}return A.nullcheck(h.value)}static decodeAllSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":i=o.extend({},e),r=i.encoding,delete i.encoding}const n=new A(i),s=new u(t,null!=r?r:o.guessEncoding(t)),a=[];for(;s.length>0;){const t=n._parse();let e=t.next();for(;!e.done;){const r=s.read(e.value);if(null==r||r.length!==e.value)throw new Error("Insufficient data");e=t.next(r)}a.push(A.nullcheck(e.value))}return a}static decodeFirst(t,e,r){let i={},n=!1,s="hex";switch(typeof e){case"function":r=e,s=o.guessEncoding(t);break;case"string":s=e;break;case"object":i=o.extend({},e),s=null!=i.encoding?i.encoding:o.guessEncoding(t),delete i.encoding,n=null!=i.required&&i.required,delete i.required}const a=new A(i);let u,h=y;return a.on("data",t=>{h=A.nullcheck(t),a.close()}),"function"==typeof r?(a.once("error",t=>{const e=h;return h=g,a.close(),r(t,e)}),a.once("end",()=>{switch(h){case y:return n?r(new Error("No CBOR found")):r(null,h);case g:return;default:return r(null,h)}})):u=new Promise((t,e)=>(a.once("error",t=>(h=g,a.close(),e(t))),a.once("end",()=>{switch(h){case y:return n?e(new Error("No CBOR found")):t(h);case g:return;default:return t(h)}}))),a.end(t,s),u}static decodeAll(t,e,r){let i={},n="hex";switch(typeof e){case"function":r=e,n=o.guessEncoding(t);break;case"string":n=e;break;case"object":i=o.extend({},e),n=null!=i.encoding?i.encoding:o.guessEncoding(t),delete i.encoding}const s=new A(i);let a;const u=[];return s.on("data",t=>u.push(A.nullcheck(t))),"function"==typeof r?(s.on("error",r),s.on("end",()=>r(null,u))):a=new Promise((t,e)=>{s.on("error",e),s.on("end",()=>t(u))}),s.end(t,n),a}close(){this.running=!1,this.__fresh=!0}*_parse(){let t=null,r=0,i=null;for(;;){if(this.max_depth>=0&&r>this.max_depth)throw new Error("Maximum depth "+this.max_depth+" exceeded");const h=(yield 1)[0];if(!this.running)throw new Error("Unexpected data: 0x"+h.toString(16));const f=h>>5,g=31&h,y=null!=t?t[w]:void 0,E=null!=t?t.length:void 0;switch(g){case l.ONE:this.emit("more-bytes",f,1,y,E),i=(yield 1)[0];break;case l.TWO:case l.FOUR:case l.EIGHT:const t=1<=48&&t[s]<=57||t[s]>=65&&t[s]<=70||t[s]>=97&&t[s]<=102;)s++;if(0===s)return t;if(13!=t[s]||10!=t[s+1])return t;s+=2;var n=parseInt(i.decode(t.subarray(e,s)),16);if(0==n)break;t.set(t.subarray(s,s+n),r),s+=n,r+=n,13==t[s]&&10==t[s+1]&&(s+=2),e=s}return t.subarray(0,r)}(t))}catch(t){console.log("Chunk-Encoding Ignored: "+t)}try{if("br"===e)0===(t=n()(t)).length&&(t=i);else if("gzip"===e||"gzip"===r){const e=new s.Inflate;e.push(t,!0),e.result&&!e.err&&(t=e.result)}}catch(t){console.log("Content-Encoding Ignored: "+t)}return t}},function(t,e,r){"use strict";var i={};(0,r(9).assign)(i,r(56),r(57),r(86)),t.exports=i},function(t,e){var r={};r[e.ACCEPTED=202]="Accepted",r[e.BAD_GATEWAY=502]="Bad Gateway",r[e.BAD_REQUEST=400]="Bad Request",r[e.CONFLICT=409]="Conflict",r[e.CONTINUE=100]="Continue",r[e.CREATED=201]="Created",r[e.EXPECTATION_FAILED=417]="Expectation Failed",r[e.FAILED_DEPENDENCY=424]="Failed Dependency",r[e.FORBIDDEN=403]="Forbidden",r[e.GATEWAY_TIMEOUT=504]="Gateway Timeout",r[e.GONE=410]="Gone",r[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP Version Not Supported",r[e.IM_A_TEAPOT=418]="I'm a teapot",r[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="Insufficient Space on Resource",r[e.INSUFFICIENT_STORAGE=507]="Insufficient Storage",r[e.INTERNAL_SERVER_ERROR=500]="Server Error",r[e.LENGTH_REQUIRED=411]="Length Required",r[e.LOCKED=423]="Locked",r[e.METHOD_FAILURE=420]="Method Failure",r[e.METHOD_NOT_ALLOWED=405]="Method Not Allowed",r[e.MOVED_PERMANENTLY=301]="Moved Permanently",r[e.MOVED_TEMPORARILY=302]="Moved Temporarily",r[e.MULTI_STATUS=207]="Multi-Status",r[e.MULTIPLE_CHOICES=300]="Multiple Choices",r[e.NETWORK_AUTHENTICATION_REQUIRED=511]="Network Authentication Required",r[e.NO_CONTENT=204]="No Content",r[e.NON_AUTHORITATIVE_INFORMATION=203]="Non Authoritative Information",r[e.NOT_ACCEPTABLE=406]="Not Acceptable",r[e.NOT_FOUND=404]="Not Found",r[e.NOT_IMPLEMENTED=501]="Not Implemented",r[e.NOT_MODIFIED=304]="Not Modified",r[e.OK=200]="OK",r[e.PARTIAL_CONTENT=206]="Partial Content",r[e.PAYMENT_REQUIRED=402]="Payment Required",r[e.PERMANENT_REDIRECT=308]="Permanent Redirect",r[e.PRECONDITION_FAILED=412]="Precondition Failed",r[e.PRECONDITION_REQUIRED=428]="Precondition Required",r[e.PROCESSING=102]="Processing",r[e.PROXY_AUTHENTICATION_REQUIRED=407]="Proxy Authentication Required",r[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="Request Header Fields Too Large",r[e.REQUEST_TIMEOUT=408]="Request Timeout",r[e.REQUEST_TOO_LONG=413]="Request Entity Too Large",r[e.REQUEST_URI_TOO_LONG=414]="Request-URI Too Long",r[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="Requested Range Not Satisfiable",r[e.RESET_CONTENT=205]="Reset Content",r[e.SEE_OTHER=303]="See Other",r[e.SERVICE_UNAVAILABLE=503]="Service Unavailable",r[e.SWITCHING_PROTOCOLS=101]="Switching Protocols",r[e.TEMPORARY_REDIRECT=307]="Temporary Redirect",r[e.TOO_MANY_REQUESTS=429]="Too Many Requests",r[e.UNAUTHORIZED=401]="Unauthorized",r[e.UNPROCESSABLE_ENTITY=422]="Unprocessable Entity",r[e.UNSUPPORTED_MEDIA_TYPE=415]="Unsupported Media Type",r[e.USE_PROXY=305]="Use Proxy",e.getStatusText=function(t){if(r.hasOwnProperty(t))return r[t];throw new Error("Status code does not exist: "+t)},e.getStatusCode=function(t){for(key in r)if(r[key]===t)return parseInt(key,10);throw new Error("Reason phrase does not exist: "+t)}},function(t,e,r){"use strict";let{Json2Csv:i}=r(189),{Csv2Json:n}=r(192),s=r(51);function o(t,e,r,i){return s.convert({data:e,callback:r,options:i,converter:t})}function a(t,e,r){return new Promise((i,n)=>o(t,e,(t,e)=>t?n(t):i(e),r))}function u(t,e,r,i,n){return console.warn("WARNING: "+e+" is deprecated and will be removed soon. Please use "+r+" instead."),a(t,i,n)}t.exports={json2csv:(t,e,r)=>o(i,t,e,r),csv2json:(t,e,r)=>o(n,t,e,r),json2csvAsync:(t,e)=>a(i,t,e),csv2jsonAsync:(t,e)=>a(n,t,e),json2csvPromisified:(t,e)=>u(i,"json2csvPromisified()","json2csvAsync()",t,e),csv2jsonPromisified:(t,e)=>u(n,"csv2jsonPromisified()","csv2jsonAsync()",t,e)}},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function h(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?a.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var n,s,o,a;if(h(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 u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return t}function d(){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 f(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=d.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 u=n[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,c=w(u,h);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},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){(e=t.exports=r(68)).Stream=e,e.Readable=e,e.Writable=r(44),e.Duplex=r(10),e.Transform=r(75),e.PassThrough=r(132)},function(t,e,r){var i=r(3),n=i.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,e),e.Buffer=o),s(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,i,n){var s=r(32);function o(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?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=y;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:s.nextTick;y.WritableState=g;var h=Object.create(r(22));h.inherits=r(13);var c={deprecate:r(130)},l=r(70),d=r(43).Buffer,f=n.Uint8Array||function(){};var p,m=r(72);function w(){}function g(t,e){a=a||r(10),t=t||{};var i=e instanceof a;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,h=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(h||0===h)?h:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,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,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(s.nextTick(n,i),s.nextTick(T,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),T(t,e))}(t,r,i,e,n);else{var o=v(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||E(t,r),i?u(b,t,r,o,n):b(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function y(t){if(a=a||r(10),!(p.call(y,this)||this instanceof a))return new y(t);this._writableState=new g(t,this),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)),l.call(this)}function _(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function b(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),T(t,e)}function E(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)n[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;n.allBuffers=u,_(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,c=r.encoding,l=r.callback;if(_(t,e,!1,e.objectMode?1:h.length,h,c,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function v(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function A(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),T(t,e)}))}function T(t,e){var r=v(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(A,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(y,l),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.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]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):p=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,a=!n.objectMode&&(i=t,d.isBuffer(i)||i instanceof f);return a&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=w),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.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=d.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 u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var i=this._writableState;"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||i.finished||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(14),r(73).setImmediate,r(6))},function(t,e,r){"use strict";const i=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];e.REPLACEMENT_CHARACTER="�",e.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},e.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},e.isSurrogate=function(t){return t>=55296&&t<=57343},e.isSurrogatePair=function(t){return t>=56320&&t<=57343},e.getSurrogatePairCodePoint=function(t,e){return 1024*(t-55296)+9216+e},e.isControlCodePoint=function(t){return 32!==t&&10!==t&&13!==t&&9!==t&&12!==t&&t>=1&&t<=31||t>=127&&t<=159},e.isUndefinedCodePoint=function(t){return t>=64976&&t<=65007||i.indexOf(t)>-1}},function(t,e,r){"use strict";class i{constructor(t){const e={},r=this._getOverriddenMethods(this,e);for(const i of Object.keys(r))"function"==typeof r[i]&&(e[i]=t[i],t[i]=r[i])}_getOverriddenMethods(){throw new Error("Not implemented")}}i.install=function(t,e,r){t.__mixins||(t.__mixins=[]);for(let r=0;r=0?e:void 0),remainingKeyPath:t.slice(e+1)}}t.exports={evaluatePath:function t(e,r){if(!e)return null;let{indexOfDot:n,currentKey:s,remainingKeyPath:o}=i(r);if(n>=0&&!e[r])return Array.isArray(e[s])?e[s].map(e=>t(e,o)):t(e[s],o);if(Array.isArray(e))return e.map(e=>t(e,r));return e[r]},setPath:function t(e,r,n){if(!e)throw new Error("No document was provided.");let{indexOfDot:s,currentKey:o,remainingKeyPath:a}=i(r);if(s>=0){if(!e[o]&&Array.isArray(e))return e.forEach(e=>t(e,r,n));e[o]||(e[o]={}),t(e[o],a,n)}else{if(Array.isArray(e))return e.forEach(e=>t(e,a,n));e[r]=n}return e}}},function(t){t.exports=JSON.parse('{"errors":{"callbackRequired":"A callback is required!","optionsRequired":"Options were not passed and are required.","json2csv":{"cannotCallOn":"Cannot call json2csv on ","dataCheckFailure":"Data provided was not an array of documents.","notSameSchema":"Not all documents have the same schema."},"csv2json":{"cannotCallOn":"Cannot call csv2json on ","dataCheckFailure":"CSV is not a string."}},"defaultOptions":{"delimiter":{"field":",","wrap":"\\"","eol":"\\n"},"excelBOM":false,"prependHeader":true,"trimHeaderFields":false,"trimFieldValues":false,"sortHeader":false,"parseCsvNumbers":false,"keys":null,"checkSchemaDifferences":false,"expandArrayObjects":false,"unwindArrays":false,"useLocaleFormat":false},"values":{"excelBOM":"\ufeff"}}')},function(t,e,r){"use strict";let i=r(49),n=r(50);const s=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;function o(t){return JSON.parse(JSON.stringify(t))}function a(t){return c(t)||h(t)||""===t}function u(t){return"object"==typeof t}function h(t){return null===t}function c(t){return void 0===t}function l(t,e){return t.filter(t=>!e.includes(t))}t.exports={isStringRepresentation:function(t,e){const r=t[0],i=t.length-1,n=t[i];return r===e.delimiter.wrap&&n===e.delimiter.wrap},isDateRepresentation:function(t){return s.test(t)},computeSchemaDifferences:function(t,e){return l(t,e).concat(l(e,t))},deepCopy:o,convert:function(t){let{options:e,callback:r}=function(t,e){if(u(t)&&(r=t,"function"!=typeof r))return{options:t,callback:e};var r;return{options:e,callback:t}}(t.callback,t.options);i=e,(i={...n.defaultOptions,...i||{}}).delimiter={...n.defaultOptions.delimiter,...i.delimiter},e=i;var i;let s=new t.converter(e);(function(t){if(!t.callback)throw new Error(n.errors.callbackRequired);if(!t.data)return t.callback(new Error(t.errorMessages.cannotCallOn+t.data+".")),!1;if(!t.dataCheckFn(t.data))return t.callback(new Error(t.errorMessages.dataCheckFailure)),!1;return!0})({data:t.data,callback:r,errorMessages:s.validationMessages,dataCheckFn:s.validationFn})&&s.convert(t.data,r)},isEmptyField:a,removeEmptyFields:function(t){return t.filter(t=>!a(t))},getNCharacters:function(t,e,r){return t.substring(e,e+r)},unwind:function(t,e){const r=[];return t.forEach(t=>{!function(t,e,r){const n=i.evaluatePath(e,r);let s=o(e);Array.isArray(n)?n.forEach(n=>{s=o(e),t.push(i.setPath(s,r,n))}):t.push(s)}(r,t,e)}),r},isInvalid:function(t){return t===1/0||t===-1/0},isString:function(t){return"string"==typeof t},isNull:h,isError:function(t){return"[object Error]"===Object.prototype.toString.call(t)},isDate:function(t){return t instanceof Date},isUndefined:c,isObject:u,unique:function(t){return[...new Set(t)]},flatten:function(t){return[].concat(...t)}}},function(t,e,r){"use strict";const i=r(11).BigNumber,n=r(17),s=r(53),o=new i(-1),a=new i(10),u=new i(2);class h{constructor(t,e,r){if(this.tag=t,this.value=e,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(t){return t._pushTag(this.tag),t.pushAny(this.value)}convert(t){let e=null!=t?t[this.tag]:void 0;if("function"!=typeof e&&(e=h["_tag_"+this.tag],"function"!=typeof e))return this;try{return e.call(h,this.value)}catch(t){return this.err=t,this}}static _tag_0(t){return new Date(t)}static _tag_1(t){return new Date(1e3*t)}static _tag_2(t){return n.bufferToBignumber(t)}static _tag_3(t){return o.minus(n.bufferToBignumber(t))}static _tag_4(t){return a.pow(t[0]).times(t[1])}static _tag_5(t){return u.pow(t[0]).times(t[1])}static _tag_32(t){return s.parse(t)}static _tag_35(t){return new RegExp(t)}}t.exports=h},function(t,e,r){"use strict";var i=r(198),n=r(200);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=_,e.resolve=function(t,e){return _(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?_(t,!1,!0).resolveObject(e):e},e.format=function(t){n.isString(t)&&(t=_(t));return t instanceof s?t.format():s.prototype.format.call(t)},e.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(h),l=["%","/","?",";","#"].concat(c),d=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(201);function _(t,e,r){if(t&&n.isObject(t)&&t instanceof s)return t;var i=new s;return i.parse(t,e,r),i}s.prototype.parse=function(t,e,r){if(!n.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),a=-1!==s&&s127?O+="x":O+=N[F];if(!O.match(f)){var B=R.slice(0,C),L=R.slice(C+1),U=N.match(p);U&&(B.push(U[1]),L.unshift(U[2])),L.length&&(_="/"+L.join(".")+_),this.hostname=B.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),k||(this.hostname=i.toASCII(this.hostname));var M=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+M,this.href+=this.host,k&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!m[v])for(C=0,I=c.length;C0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift());return r.search=t.search,r.query=t.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!A.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var x=A.slice(-1)[0],S=(r.host||t.host||A.length>1)&&("."===x||".."===x)||""===x,C=0,D=A.length;D>=0;D--)"."===(x=A[D])?A.splice(D,1):".."===x?(A.splice(D,1),C++):C&&(A.splice(D,1),C--);if(!E&&!v)for(;C--;C)A.unshift("..");!E||""===A[0]||A[0]&&"/"===A[0].charAt(0)||A.unshift(""),S&&"/"!==A.join("/").substr(-1)&&A.push("");var k,R=""===A[0]||A[0]&&"/"===A[0].charAt(0);T&&(r.hostname=r.host=R?"":A.length?A.shift():"",(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift()));return(E=E||r.host&&A.length)&&!R&&A.unshift(""),A.length?r.pathname=A.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},,function(t,e,r){"use strict";const{Transform:i}=r(4),n=r(33),s=r(139),o=r(46),a=r(77),u=r(141),h=r(142),c={sourceCodeLocationInfo:!1};const l={[n.START_TAG_TOKEN]:{eventName:"startTag",reshapeToken:t=>({tagName:t.tagName,attrs:t.attrs,selfClosing:t.selfClosing,sourceCodeLocation:t.location})},[n.END_TAG_TOKEN]:{eventName:"endTag",reshapeToken:t=>({tagName:t.tagName,sourceCodeLocation:t.location})},[n.COMMENT_TOKEN]:{eventName:"comment",reshapeToken:t=>({text:t.data,sourceCodeLocation:t.location})},[n.DOCTYPE_TOKEN]:{eventName:"doctype",reshapeToken:t=>({name:t.name,publicId:t.publicId,systemId:t.systemId,sourceCodeLocation:t.location})},[n.CHARACTER_TOKEN]:{eventName:"text",reshapeToken:t=>({text:t.chars,sourceCodeLocation:t.location})}};t.exports=class extends i{constructor(t){super({encoding:"utf8",decodeStrings:!1}),this.options=a(c,t),this.tokenizer=new n(t),this.locInfoMixin=null,this.options.sourceCodeLocationInfo&&(this.locInfoMixin=o.install(this.tokenizer,s)),this.parserFeedbackSimulator=new h(this.tokenizer),this.pendingText=null,this.lastChunkWritten=!1,this.stopped=!1,this.pipe(new u)}_transform(t,e,r){if("string"!=typeof t)throw new TypeError("Parser can work only with string streams.");r(null,this._transformChunk(t))}_final(t){this.lastChunkWritten=!0,t(null,this._transformChunk(""))}stop(){this.stopped=!0}_transformChunk(t){return this.stopped||(this.tokenizer.write(t,this.lastChunkWritten),this._runParsingLoop()),t}_runParsingLoop(){let t=null;do{if(t=this.parserFeedbackSimulator.getNextToken(),t.type===n.HIBERNATION_TOKEN)break;if(t.type===n.CHARACTER_TOKEN||t.type===n.WHITESPACE_CHARACTER_TOKEN||t.type===n.NULL_CHARACTER_TOKEN){if(null===this.pendingText)t.type=n.CHARACTER_TOKEN,this.pendingText=t;else if(this.pendingText.chars+=t.chars,this.options.sourceCodeLocationInfo){const{endLine:e,endCol:r,endOffset:i}=t.location;Object.assign(this.pendingText.location,{endLine:e,endCol:r,endOffset:i})}}else this._emitPendingText(),this._handleToken(t)}while(!this.stopped&&t.type!==n.EOF_TOKEN)}_handleToken(t){if(t.type===n.EOF_TOKEN)return!0;const{eventName:e,reshapeToken:r}=l[t.type];return 0!==this.listenerCount(e)&&(this._emitToken(e,r(t)),!0)}_emitToken(t,e){this.emit(t,e)}_emitPendingText(){null!==this.pendingText&&(this._handleToken(this.pendingText),this.pendingText=null)}}},function(t,e,r){"use strict";var i=r(153),n=r(9),s=r(84),o=r(47),a=r(85),u=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(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 c;if(c="string"==typeof e.dictionary?s.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(r=i.deflateSetDictionary(this.strm,c)))throw new Error(o[r]);this._dict_set=!0}}function c(t,e){var r=new h(e);if(r.push(t,!0),r.err)throw r.msg||o[r.err];return r.result}h.prototype.push=function(t,e){var r,o,a=this.strm,h=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]"===u.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(h),a.next_out=0,a.avail_out=h),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)},h.prototype.onData=function(t){this.chunks.push(t)},h.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=h,e.deflate=c,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,c(t,e)}},function(t,e,r){"use strict";var i=r(155),n=r(9),s=r(84),o=r(86),a=r(47),u=r(85),h=r(158),c=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(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 u,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 h,i.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=s.string2buf(e.dictionary):"[object ArrayBuffer]"===c.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 d(t,e){var r=new l(e);if(r.push(t,!0),r.err)throw r.msg||a[r.err];return r.result}l.prototype.push=function(t,e){var r,a,u,h,l,d=this.strm,f=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof t?d.input=s.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(f),d.next_out=0,d.avail_out=f),(r=i.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&p&&(r=i.inflateSetDictionary(this.strm,p)),r===o.Z_BUF_ERROR&&!0===m&&(r=o.Z_OK,m=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&r!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(d.output,d.next_out),h=d.next_out-u,l=s.buf2string(d.output,u),d.next_out=h,d.avail_out=f-h,h&&n.arraySet(d.output,d.output,u,h,0),this.onData(l)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.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),d.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.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=l,e.inflate=d,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,d(t,e)},e.ungzip=d},function(t,e,r){"use strict";r.r(e),r.d(e,"CollectionLoader",(function(){return _t})),r.d(e,"WorkerLoader",(function(){return bt}));const i=(t,e)=>e.some(e=>t instanceof e);let n,s;const o=new WeakMap,a=new WeakMap,u=new WeakMap,h=new WeakMap,c=new WeakMap;let l={get(t,e,r){if(t instanceof IDBTransaction){if("done"===e)return a.get(t);if("objectStoreNames"===e)return t.objectStoreNames||u.get(t);if("store"===e)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return m(t[e])},set:(t,e,r)=>(t[e]=r,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function d(t){l=t(l)}function f(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(w(this),e),m(o.get(this))}:function(...e){return m(t.apply(w(this),e))}:function(e,...r){const i=t.call(w(this),e,...r);return u.set(i,e.sort?e.sort():[e]),m(i)}}function p(t){return"function"==typeof t?f(t):(t instanceof IDBTransaction&&function(t){if(a.has(t))return;const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("complete",n),t.removeEventListener("error",s),t.removeEventListener("abort",s)},n=()=>{e(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",n),t.addEventListener("error",s),t.addEventListener("abort",s)});a.set(t,e)}(t),i(t,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,l):t)}function m(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("success",n),t.removeEventListener("error",s)},n=()=>{e(m(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",n),t.addEventListener("error",s)});return e.then(e=>{e instanceof IDBCursor&&o.set(e,t)}).catch(()=>{}),c.set(e,t),e}(t);if(h.has(t))return h.get(t);const e=p(t);return e!==t&&(h.set(t,e),c.set(e,t)),e}const w=t=>c.get(t);function g(t,e,{blocked:r,upgrade:i,blocking:n,terminated:s}={}){const o=indexedDB.open(t,e),a=m(o);return i&&o.addEventListener("upgradeneeded",t=>{i(m(o.result),t.oldVersion,t.newVersion,m(o.transaction))}),r&&o.addEventListener("blocked",()=>r()),a.then(t=>{s&&t.addEventListener("close",()=>s()),n&&t.addEventListener("versionchange",()=>n())}).catch(()=>{}),a}function y(t,{blocked:e}={}){const r=indexedDB.deleteDatabase(t);return e&&r.addEventListener("blocked",()=>e()),m(r).then(()=>{})}const _=["get","getKey","getAll","getAllKeys","count"],b=["put","add","delete","clear"],E=new Map;function v(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(E.get(e))return E.get(e);const r=e.replace(/FromIndex$/,""),i=e!==r,n=b.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!n&&!_.includes(r))return;const s=async function(t,...e){const s=this.transaction(t,n?"readwrite":"readonly");let o=s.store;i&&(o=o.index(e.shift()));const a=await o[r](...e);return n&&await s.done,a};return E.set(e,s),s}d(t=>({...t,get:(e,r,i)=>v(e,r)||t.get(e,r,i),has:(e,r)=>!!v(e,r)||t.has(e,r)}));const A=["continue","continuePrimaryKey","advance"],T={},x=new WeakMap,S=new WeakMap,C={get(t,e){if(!A.includes(e))return t[e];let r=T[e];return r||(r=T[e]=function(...t){x.set(this,S.get(this)[e](...t))}),r}};async function*D(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,C);for(S.set(r,e),c.set(r,w(e));e;)yield r,e=await(x.get(r)||e.continue()),x.delete(r)}function k(t,e){return e===Symbol.asyncIterator&&i(t,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===e&&i(t,[IDBIndex,IDBObjectStore])}d(t=>({...t,get:(e,r,i)=>k(e,r)?D:t.get(e,r,i),has:(e,r)=>k(e,r)||t.has(e,r)}));var R=r(0),I=r(117),N=r.n(I);const O=[{match:/\/\/.*gcs-vimeo|vod|vod-progressive\.akamaized\.net.*\/([\d]+)\/[\d]+(.mp4)/,fuzzyCanonReplace:"//vimeo-cdn.fuzzy.replayweb.page/$1$2",split:".net"},{match:/\/\/.*player.vimeo.com\/(video\/[\d]+)\?.*/i,fuzzyCanonReplace:"//vimeo.fuzzy.replayweb.page/$1"},{match:/www.\washingtonpost\.com\/wp-apps\/imrs.php/,args:[["src"]]},{match:/(static.wixstatic.com\/.*\.[\w]+\/v1\/fill\/)(w_.*)/,replace:"$1?_args=$2",split:"/v1/fill"},{match:/(youtube\.com\/embed\/[^?]+)[?].*/i,replace:"$1"},{match:/(www\.)?youtube(-nocookie)?\.com\/get_video_info/i,args:[["video_id","html5"]]},{match:/\/\/.*googlevideo.com\/(videoplayback)/i,fuzzyCanonReplace:"//youtube.fuzzy.replayweb.page/$1",args:[["id","itag"],["id"]],fuzzyArgs:!0},{match:/facebook\.com\/ajax\/pagelet\/generic.php\/photoviewerinitpagelet/i,args:[[{arg:"data",keys:["query_type","fbid","v","cursor","data"]}]]},{match:/facebook\.com\/api\/graphql/i,args:[["variables","doc_id"]],fuzzyArgs:!0},{match:/facebook\.com\/api\/graphqlbatch/i,args:[["batch_name","queries"],["batch_name"]]},{match:/facebook\.com\/ajax\/navigation/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/route-definition/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/bulk-route-definitions/i,args:[["route_urls[0]","__user"],["route_urls[0]"]]},{match:/facebook\.com\/ajax\/relay-ef/i,args:[["queries[0]","__user"],["queries[0]"]]},{match:/facebook\.com\/videos\/vodcomments/i,args:[["eft_id"]]},{match:/facebook\.com\/ajax\.*/i,replaceQuery:/([?&][^_]\w+=[^&]+)/g},{match:/plus\.googleapis\.com\/u\/\/0\/_\/widget\/render\/comments/i,args:[["href","stream_id","substream_id"]]},{match:(F=["(callback=jsonp)[^&]+(?=&|$)","((?:\\w+)=jquery)[\\d]+_[\\d]+","utm_[^=]+=[^&]+(?=&|$)","(_|cb|_ga|\\w*cache\\w*)=[\\d.-]+(?=$|&)"],new RegExp("[?&]"+F.map(t=>"("+t+")").join("|"),"gi")),replace:""},{match:/(\.(?:php|js|webm|mp4|gif|jpg|png|css|json|m3u8))\?.*/i,replace:"$1"}];var F;const P=new class{constructor(t){this.rules=t||O}getRuleFor(t){let e;const r=-1===t.indexOf("?")?t+"?":t;for(const t of this.rules)if(r.match(t.match)){e=t;break}let i=t;e&&e.fuzzyCanonReplace&&(i=t.replace(e.match,e.fuzzyCanonReplace));const n=e&&e.split||"?",s=t.indexOf(n);return{prefix:s>0?t.slice(0,s+n.length):t,rule:e,fuzzyCanonUrl:i}}fuzzyCompareUrls(t,e,r){if(!e||!e.length)return null;if(r&&void 0!==r.replace&&void 0!==r.match){const i=r.match,n=r.replace,s=t.replace(i,n),o=[];for(const t of e){const e=("string"==typeof t?t:t.url).replace(i,n);if(s===e)return t;t.fuzzyMatchUrl=e,o.push(t)}e=o,t=s}return this.fuzzyBestMatchQuery(t,e,r)}fuzzyBestMatchQuery(t,e,r){try{t=new URL(t)}catch(t){return 0}const i=r&&r.args&&!r.fuzzyArgs?new Set(r.args[0]):null;let n=0,s=null;const o=new URLSearchParams(t.search);for(const t of e){if(204===t.mime)continue;let e="string"==typeof t?t:t.fuzzyMatchUrl||t.url;try{e=new URL(e)}catch(t){continue}const r=new URLSearchParams(e.search);let a=this.getMatch(o,r,i);a+=this.getMatch(r,o,i),a/=2,a>n&&(n=a,s=t)}return s}getMatch(t,e,r){let i=1,n=1;for(const[s,o]of t){const t=e.get(s);if(r&&r.has(s)&&t!==o)return-1;let a;a="_"===s[0]?1:10,null!==t&&(i+=.5*a);const u=Number(o),h=Number(t);if(n+=a,t===o)i+=a*o.length;else if(null===t)i+=0;else if(isNaN(u)||isNaN(h)){const e=Math.min(t.length,o.length),r=N()(t,o);rthis._initDB(t,e,r,i),blocking:t=>{t&&null!==t.newVersion||this.close()}})}_initDB(t,e,r,i){if(!e){const e=t.createObjectStore("pages",{keyPath:"id"});e.createIndex("url","url"),e.createIndex("ts","ts");t.createObjectStore("pageLists",{keyPath:"id",autoIncrement:!0});t.createObjectStore("curatedPages",{keyPath:"id",autoIncrement:!0}).createIndex("listPages",["list","pos"]);const r=t.createObjectStore("resources",{keyPath:["url","ts"]});r.createIndex("pageId","pageId"),r.createIndex("mimeStatusUrl",["mime","status","url"]);t.createObjectStore("payload",{keyPath:"digest",unique:!0}),t.createObjectStore("digestRef",{keyPath:"digest",unique:!0})}}async clearAll(){const t=["pages","resources","payload","digestRef"];for(const e of t)await this.db.clear(e)}close(){this.db&&(this.db.close(),this.db=null)}async delete(){this.close(),await y(this.name,{blocked(t){console.log("Unable to delete: "+t)}})}async addPage(t,e){const r=t.url,i=t.title||t.url,n=t.id||this.newPageId();let s=t.ts;s||!t.date&&!t.datetime||(s=new Date(t.date||t.datetime).getTime());const o={...t,url:r,ts:s,title:i,id:n};return e?(e.store.put(o),o.id):await this.db.put("pages",o)}async addPages(t){const e=this.db.transaction("pages","readwrite");for(const e of t)this.addPage(e);try{await e.done}catch(t){console.warn("addPages tx",t.toString())}}async addCPageList(t){const e={};return e.title=t.title,e.desc=t.desc,e.slug=t.slug,await this.db.put("pageLists",e)}async addCuratedPageLists(t,e="pages",r="public"){for(const i of t){if(r&&!i[r])continue;const t=await this.addCPageList(i),n=this.db.transaction("curatedPages","readwrite");let s=0;const o=i[e]||[];for(const e of o){const r={};r.pos=s++,r.list=t;const i=typeof e.page;r.page="string"===i?e.page:"object"===i?e.page.id:e.page_id||e.pageId,r.desc=e.desc,n.store.put(r)}try{await n.done}catch(t){console.warn("addCuratedPageLists tx",t.toString())}}}async getAllCuratedByList(){const t=await this.db.getAll("pageLists"),e=this.db.transaction("curatedPages","readonly");for await(const r of e.store.index("listPages").iterate()){const e=t[r.value.list-1];e&&(e.show=!0,e.pages||(e.pages=[]),e.pages.push(r.value))}return t}newPageId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async getAllPages(){return await this.db.getAll("pages")}async getPages(t){const e=[];t.sort();for await(const r of this.matchAny("pages",null,t))e.push(r);return e}async dedupResource(t,e,r,i=1){const n=r.objectStore("digestRef"),s=await n.get(t);if(s)return++s.count,s;try{return r.objectStore("payload").add({digest:t,payload:e}),{digest:t,count:i,size:e.length}}catch(t){console.log(t)}return null}async addResources(t){const e=[],r=[],i={},n=this.db.transaction(["digestRef","payload"],"readwrite");for(const s of t){let t=1;if("warc/revisit"===s.mime)e.push(s);else{r.push(s);const e=this.getFuzzyUrl(s);e&&(r.push(e),t=2)}this.useRefCounts&&s.digest&&s.payload&&(i[s.digest]=await this.dedupResource(s.digest,s.payload,n,t),delete s.payload)}try{await n.done}catch(t){console.log("Payload Bulk Add Failed: "+t)}const s=this.db.transaction(["digestRef","resources"],"readwrite"),o=s.objectStore("resources");let a={};for(const t of e){if(this.useRefCounts){let e=i[t.digest];e||(e=await s.objectStore("digestRef").get(t.digest)),e&&(e.count++,a[t.digest]=e)}o.put(t)}for(const t of r)o.put(t);if(this.useRefCounts){const t=s.objectStore("digestRef");for(const e of Object.values(a))t.put(e)}await s.done}getFuzzyUrl(t){if(t.status>=200&&t.status<400&&304!==t.status&&204!==t.status){const{fuzzyCanonUrl:e}=P.getRuleFor(t.url);return e&&e!==t.url?{url:e,ts:t.ts,origURL:t.url,origTS:t.ts,pageId:t.pageId,digest:t.digest}:null}return null}async addResource(t){t.payload&&t.payload.length>this.minDedupSize&&(t.digest||(t.digest=await Object(R.d)(t.payload,"sha-256")));let e=null,r=!1;const i=this.db.transaction(["resources","digestRef","payload"],"readwrite");if(t.payload&&t.payload.length>this.minDedupSize?(e=await this.dedupResource(t.digest,t.payload,i),r=e&&1===e.count,delete t.payload):t.payload&&(r=!0),"warc/revisit"!==t.mime){i.objectStore("resources").put(t);const r=this.getFuzzyUrl(t);r&&(i.objectStore("resources").put(r),e&&e.count++)}else i.objectStore("resources").add(t);e&&i.objectStore("digestRef").put(e);try{await i.done}catch(e){"warc/revisit"===t.mime?console.log("Skip Duplicate revisit for: "+t.url):console.log("Add Error for "+t.url),console.log(e)}return r}async getResource(t,e,r){const i=Object(R.m)(t.timestamp).getTime();let n=t.url,s=null;const o={skip:this.repeatTracker?this.repeatTracker.getSkipCount(r,n,t.request.method):0};if(n.startsWith("//")){let e=!1;s=await this.lookupUrl("https:"+n,i,o),s||(s=await this.lookupUrl("http:"+n,i,o),(s||t.request.referrer.indexOf("/http://",2)>0)&&(e=!0)),n=(e?"http:":"https:")+n}else if(s=await this.lookupUrl(n,i,o),!s&&n.startsWith("http://")){const t=n.replace("http://","https://");s=await this.lookupUrl(t,i,o),s&&(n=t)}if(!s&&this.fuzzyPrefixSearch&&(s=await this.lookupQueryPrefix(n)),s&&s.origURL){const t=await this.lookupUrl(s.origURL,s.origTS||s.ts);t&&(n=t.url,s=t)}if(!s)return null;const a=s.status,u=s.statusText||Object(B.getStatusText)(a);let h=null;if(!Object(R.i)()&&(h=await this.loadPayload(s),!h))return null;const c=Object(R.j)(s.respHeaders),l=new Date(s.ts),d=s.extraOpts||null;return new L.a({url:n,payload:h,status:a,statusText:u,headers:c,date:l,extraOpts:d})}async loadPayload(t){if(t.digest&&!t.payload){const e=await this.db.get("payload",t.digest);if(!e)return null;const{payload:r}=e;return r}return t.payload}async lookupUrl(t,e,r={}){const i=this.db.transaction("resources","readonly");if(e){const r=await i.store.get([t,e]);if(r)return r}let n=null,s=r.skip||0;for await(const r of i.store.iterate(this.getLookupRange(t))){if(n&&r.value.ts>e){if(0==s){return r.value.ts-ee?++a:n?(yield o.value,o=await o.continue()):o=await o.continue(r[a])}}async resourcesByUrlAndMime(t,e,r=1e3,i=!0,n="",s=""){const o=e?null:r,a=await this.db.getAll("resources",this.getLookupRange(t,i?"prefix":"exact",n,s),o);e=e.split(",");const u=[];for(const t of a)for(const i of e)if(!i||t.mime&&t.mime.startsWith(i)){if(u.push(this.resJson(t)),u.length===r)return u;break}return u}async resourcesByMime(t,e=100,r="",i="",n=0){const s=[];(t=t.split(",")).sort();let o=[];r&&o.push([r,n,i]);for(const e of t)(!r||!e||e>r)&&o.push([e,0,""]);for await(const t of this.matchAny("resources","mimeStatusUrl",o,0))if(s.push(this.resJson(t)),s.length===e)break;return s}async deletePage(t){const e=this.db.transaction("pages","readwrite"),r=await e.store.get(t);await e.store.delete(t);const i=await this.deletePageResources(t);return{pageSize:r&&r.size||0,dedupSize:i}}async deletePageResources(t){const e={},r=this.db.transaction("resources","readwrite");let i=await r.store.index("pageId").openCursor(t),n=0;for(;i;){const t=i.value.digest;t?e[t]=(e[t]||0)+1:i.value.payload&&(n+=i.value.payload.length),r.store.delete(i.primaryKey),i=await i.continue()}await r.done;const s=this.db.transaction(["payload","digestRef"],"readwrite"),o=s.objectStore("digestRef");for(const t of Object.keys(e)){const r=await o.get(t);r&&(r.count-=e[t]),r&&r.count>=1?o.put(r):(n+=r?r.size:0,o.delete(t),s.objectStore("payload").delete(t))}return await s.done,n}getLookupRange(t,e,r,i){let n,s,o;switch(e){case"prefix":s=t.slice(0,-1)+String.fromCharCode(t.charCodeAt(t.length-1)+1),n=[t],s=[s];break;case"host":const e=new URL(t).origin;n=[e+"/"],s=[e+"0"];break;case"exact":default:n=[t],s=[t+"!"]}return r?(n=[r,i||""],o=!0):o=!1,IDBKeyRange.bound(n,s,o,!0)}}class M{constructor(){this.repeats={}}getSkipCount(t,e,r){if("POST"!==r&&!e.endsWith(".m3u8"))return 0;t.replacesClientId&&delete this.repeats[t.replacesClientId];const i=t.resultingClientId||t.clientId;return i?(void 0===this.repeats[i]&&(this.repeats[i]={}),void 0===this.repeats[i][e]?this.repeats[i][e]=0:this.repeats[i][e]++,this.repeats[i][e]):0}}var W=r(1),j=r(55),H=r.n(j),z=r(4),G=r(37);const q=["script","style","header","footer","banner-div","noscript"];var X=r(19);class Y extends X.a{constructor(t,e=null,r=null){super(),this.reader=t,this.abort=e,this.loadId=r,this.anyPages=!1,this.detectPages=!1,this._lastRecord=null,this.metadata={},this.pageMap={},this.pages=[],this.lists=[]}parseWarcInfo(t){if(!t.payload)return;const e=new TextDecoder("utf-8").decode(t.payload);for(const t of e.split("\n"))if(t.startsWith("json-metadata:"))try{const e=JSON.parse(t.slice("json-metadata:".length));if("collection"===e.type&&(this.metadata.desc=e.desc,this.metadata.title=e.title),e.pages&&e.pages.length){this.pages=this.pages.concat(e.pages);for(const t of e.pages)t.ts=Object(R.m)(t.timestamp).getTime(),this.pageMap[t.ts+"/"+t.url]={page:t};this.anyPages=!0}e.lists&&e.lists.length&&(this.lists=this.lists.concat(e.lists))}catch(t){console.log("Page Add Error",t.toString())}}index(t){if("warcinfo"!==t.warcType){if(this._lastRecord)return this._lastRecord.warcTargetURI!=t.warcTargetURI?(this.indexReqResponse(this._lastRecord,null),void(this._lastRecord=t)):void("request"===t.warcType&&"response"===this._lastRecord.warcType?(this.indexReqResponse(this._lastRecord,t),this._lastRecord=null):"response"===t.warcType&&"request"===this._lastRecord.warcType?(this.indexReqResponse(t,this._lastRecord),this._lastRecord=null):(this.indexReqResponse(this._lastRecord,null),this._lastRecord=t));this._lastRecord=t}else this.parseWarcInfo(t)}indexDone(){this._lastRecord&&(this.indexReqResponse(this._lastRecord),this._lastRecord=null)}shouldIndexMetadataRecord(t){const e=t.warcTargetURI;return!(!e||!e.startsWith("metadata://"))}parseRevisitRecord(t){const e=t.warcTargetURI.split("#")[0],r=(t.warcDate,new Date(t.warcDate).getTime()),i=t.warcRefersToTargetURI,n=new Date(t.warcRefersToDate).getTime();return i===e&&n===r?null:{url:e,ts:r,origURL:i,origTS:n,digest:t.warcPayloadDigest,pageId:null}}indexReqResponse(t,e){const r=this.parseRecords(t,e);r&&this.addResource(r)}parseRecords(t,e){switch(t.warcType){case"revisit":return this.parseRevisitRecord(t);case"resource":e=null;break;case"response":break;case"metadata":if(!this.shouldIndexMetadataRecord(t))return null;break;default:return null}const r=t.warcTargetURI.split("#")[0],i=t.warcDate;let n,s=200,o="OK",a=0,u="";if(t.httpHeaders){if(s=Number(t.httpHeaders.statusCode)||200,e&&"OPTIONS"===e.httpHeaders.method)return null;if(o=t.httpHeaders.statusText,n=Object(R.j)(t.httpHeaders.headers),u=(n.get("content-type")||"").split(";")[0],a=parseInt(n.get("content-length")||0),206===s){const t=n.get("content-range"),e=`bytes 0-${a-1}/${a}`;if(t&&t!==e)return null}if(s>300&&s<400){const t=n.get("location");if(t&&new URL(t,r).href===r)return null}}else n=new Headers,n.set("content-type",t.warcContentType),n.set("content-length",t.warcContentLength),u=t.warcContentType,a=t.warcContentLength;let h=null;if(e&&e.httpHeaders.headers)try{const t=new Headers(e.httpHeaders.headers).get("cookie");t&&n.set("x-wabac-preset-cookie",t),h=e.httpHeaders.headers.get("Referer")}catch(t){console.warn(t)}if(void 0===this.detectPages&&(this.detectPages=!this.anyPages),this.detectPages&&function(t,e,r){if(200!=e)return!1;if(!t.startsWith("http:")&&!t.startsWith("https:")&&!t.startsWith("blob:"))return!1;if(t.endsWith("/robots.txt"))return!1;const i=t.split("?",2);if(2===i.length&&i[1].length>i[0].length)return!1;if(i[0].substring(i[0].lastIndexOf("/")+1).startsWith("."))return!1;if(r&&"text/html"!==r)return!1;return!0}(r,s,u)){const t=r;this.addPage({url:r,date:i,title:t})}const c=new Date(i).getTime(),l=Object.fromEntries(n.entries()),d=t.warcPayloadDigest,f=t.payload,p={url:r,ts:c,status:s,mime:u,respHeaders:l,digest:d,payload:f,reader:f?null:t.reader,referrer:h};this.pageMap[c+"/"+r]&&f&&u.startsWith("text/")&&(this.pageMap[c+"/"+r].textPromise=async function(t,e,r,i){const n=new H.a,s=[];let o=null;n.on("text",(t,e)=>{if(o)return;const r=t.text.trim();r&&s.push(r)}),n.on("startTag",t=>{!t.selfClosing&&q.includes(t.tagName)&&(o=t.tagName)}),n.on("endTag",t=>{t.tagName===o&&(o=null)});const a=new z.PassThrough({encoding:"utf8"});(r||i)&&(e=await Object(G.a)(e,r,i)),a.push(e),a.push(null),a.pipe(n);const u=new Promise(t=>{n.on("end",()=>{t(s.join(" "))})});return await u}(0,f,n.get("content-encoding"),n.get("transfer-encoding")));const m=t.warcHeader("WARC-JSON-Metadata");if(m)try{p.extraOpts=JSON.parse(m)}catch(t){}const w=t.warcHeader("WARC-Page-ID");return w&&(p.pageId=w),p}filterRecord(t){return null}async load(t,e,r){this.db=t;const i=new W.d(this.reader);let n=0,s=0;try{for await(const t of i){if(!t.warcType){console.log("skip empty record");continue}if(self.interruptLoads&&this.loadId&&self.interruptLoads[this.loadId])throw e(Math.round(i.offset/r*95),"Loading Canceled",i.offset,r),self.interruptLoads[this.loadId](),this.abort&&this.abort.abort(),new R.b;s=(new Date).getTime(),s-n>500&&(e(Math.round(i.offset/r*95),null,i.offset,r),n=s);const o=this.filterRecord(t);if("done"===o){this.abort&&this.abort.abort();break}if("skip"!==o){"skipContent"===o?await t.skipFully():await t.readFully(),this.index(t,i);try{await Promise.all(this.promises)}catch(t){console.warn(t.toString())}this.promises=[]}}}catch(t){if(t instanceof R.b)throw t;e(Math.round(i.offset/r*95),`Sorry there was an error downloading. Please try again (${t})`,i.offset,r),console.warn(t)}return this.indexDone(),e(95),await this.finishIndexing(),e(100),this.metadata}async _finishLoad(){if(this.pages.length){for(const{page:t,textPromise:e}of Object.values(this.pageMap))if(e)try{t.text=await e}catch(t){console.warn("Error adding text: "+t.toString())}this.promises.push(this.db.addPages(this.pages))}this.lists.length&&this.promises.push(this.db.addCuratedPageLists(this.lists,"bookmarks","public"))}}class V extends Y{constructor(t){super(t),this.detectPages=!1}addPage(){}async load(){const t=await new W.d(this.reader).parse();if(!t)return null;const e=this.parseRecords(t,null);return e&&"revisit"!==t.warcType||await t.readFully(),e}}class K extends Y{filterRecord(t){if("warcinfo"!=t.warcType)return"done"}}const J="https://helper-proxy.webrecorder.workers.dev";function Z(t,e,r,i,n){if(t.startsWith("blob:"))return new tt(t,n,r);if(t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:"))return new Q(t,e,r);if(t.startsWith("googledrive:"))return new $(t,e,r,i);throw new Error("Invalid URL: "+t)}class Q{constructor(t,e,r=null,i=!1){this.url=t,this.headers=e||{},this.length=r,this.canLoadOnDemand=i,this.isValid=!1}async doInitialFetch(t){const e=new Headers(this.headers);e.set("Range","bytes=0-"),this.isValid=!1;let r=null,i=null;if(t)try{i=await fetch(this.url,{headers:e,method:"HEAD"}),200!==i.status&&206!=i.status||(this.canLoadOnDemand=206===i.status||"bytes"===i.headers.get("Accept-Ranges"),this.isValid=!0)}catch(t){}if(!this.isValid){r=new AbortController;const t=r.signal;i=await fetch(this.url,{headers:e,signal:t}),this.canLoadOnDemand=206===i.status||"bytes"===i.headers.get("Accept-Ranges"),this.isValid=206===i.status||200===i.status}if(null===this.length&&(this.length=Number(i.headers.get("Content-Length")),!this.length&&206===i.status)){let t=i.headers.get("Content-Range");t&&(t=t.split("/"),2===t.length&&(this.length=t[1]))}if(null===this.length)try{const t=await fetch(`${J}/c/${this.url}`),e=await t.json();e.size&&(this.length=e.size)}catch(t){console.log("Error fetching from helper: "+t.toString())}return this.length=Number(this.length||0),{response:i,abort:r}}async getLength(){if(null===this.length){const{response:t,abort:e}=await this.doInitialFetch(!0);e&&e.abort()}return this.length}async getRange(t,e,r=!1,i=null){const n=new Headers(this.headers);n.set("Range",`bytes=${t}-${t+e-1}`);const s={signal:i,headers:n};let o=null;try{o=await fetch(this.url,s)}catch(t){throw console.log(t),new RangeError(this.url)}if(206!=o.status)throw 401===o.status||403===o.status?new R.a(this.url,o.status):new RangeError(this.url,o.status);return r?o.body:new Uint8Array(await o.arrayBuffer())}}class ${constructor(t,e,r,i){this.fileId=t.slice("googledrive://".length),this.apiUrl=`https://www.googleapis.com/drive/v3/files/${this.fileId}?alt=media`,this.canLoadOnDemand=!0,this.headers=e,i&&i.publicUrl?this.publicUrl=i.publicUrl:this.publicUrl=null,this.length=r,this.isValid=!1}async getLength(){return this.length}async doInitialFetch(t){let e=null,r=null;if(this.publicUrl){e=new Q(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}if(!e.isValid&&(r&&r.abort&&r.abort.abort(),await this.refreshPublicUrl())){e=new Q(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}!e.isValid&&r&&r.abort&&r.abort.abort()}}return e&&e.isValid||(this.publicUrl=null,e=new Q(this.apiUrl,this.headers,this.length),r=await e.doInitialFetch(t)),this.isValid=e.isValid,this.length||(this.length=e.length),r}async getRange(t,e,r=!1,i){let n=null;if(this.publicUrl){n=new Q(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(s){if(await this.refreshPublicUrl()){n=new Q(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(t){}}}this.publicUrl=null}return n=new Q(this.apiUrl,this.headers,this.length),await n.getRange(t,e,r,i)}async refreshPublicUrl(){try{const t=await fetch(`${J}/g/${this.fileId}`),e=await t.json();if(e.url)return this.publicUrl=e.url,!0}catch(t){}return!1}}class tt{constructor(t,e=null,r=null){this.url=t,this.blob=e,this.size=this.blob?this.blob.size:r,this.canLoadOnDemand=!1}get length(){return this.size}get isValid(){return!!this.blob}async doInitialFetch(t){if(!this.blob){const t=await fetch(this.url);this.blob=await t.blob()}let e=null;return t||(e=this.blob.stream?this.blob.stream():await this.getReadableStream(this.blob)),{response:new Response(e),stream:e}}async getLength(){if(!this.blob&&!this.blob.size){let t=await fetch(this.url);this.blob=await t.blob(),this.size=this.blob.size}return this.size}async getRange(t,e,r=!1,i){if(!this.blob){const i=new Headers;i.set("Range",`bytes=${t}-${t+e-1}`);const n=await fetch(this.url,{headers:i});if(n.headers.get("content-range"))return r?n.body:new Uint8Array(await n.arrayBuffer());this.blob=await n.blob()}const n=this.blob.slice(t,t+e,"application/octet-stream");if(r)return n.stream?n.stream():await this.getReadableStream(n);try{const t=n.arrayBuffer?await n.arrayBuffer():await this.getArrayBuffer(n);return new Uint8Array(t)}catch(t){return console.log("error reading blob",t),null}}getArrayBuffer(t){return new Promise(e=>{let r=new FileReader;r.onloadend=()=>{e(r.result)},r.readAsArrayBuffer(t)})}async getReadableStream(t){const e=await this.getArrayBuffer(t);return new ReadableStream({start(t){t.enqueue(new Uint8Array(e)),t.close()}})}}class et extends U{constructor(t,e=!1){super(t),this.noCache=e,this.useRefCounts=!1}async loadRecordFromSource(t){const e=await this.loadSource(t.source),r=new V(e);return await r.load()}async loadPayload(t,e=0){let r=await super.loadPayload(t);if(r&&t.respHeaders&&"warc/revisit"!==t.mime)return r;const i=await this.loadRecordFromSource(t);if(!i)return console.log("No WARC Record Loaded for: "+t.url),null;if(i.url!==t.url)return console.log(`Wrong url: expected ${t.url}, got ${i.url}`),null;if(i.ts!==t.ts){if(1e3*Math.floor(i.ts/1e3)!==t.ts)return console.log(`Wrong timestamp: expected ${t.ts}, got ${i.ts}`),null}if(i.digest!==t.digest&&console.log(`Wrong digest: expected ${t.digest}, got ${i.digest}`),i.origURL){const n=await this.lookupUrl(i.origURL,i.origTS,{noRevisits:!0});return n&&(r||(e<2?r=await this.loadPayload(n,e+1):console.warn("Avoiding revisit lookup loop for: "+JSON.stringify(i)),r))?(t.respHeaders=n.respHeaders,t.mime=n.mime,n.extraOpts&&(t.extraOpts=n.extraOpts),this.noCache||(delete t.payload,await this.db.put("resources",t)),r):null}const n=i.digest;if(!this.noCache&&i.reader&&n&&(i.reader=new nt(this,i.reader,n,t.url)),r=i.payload,!r&&!i.reader)return null;try{r&&!this.noCache&&await this.commitPayload(r,n)}catch(e){console.warn("Payload Update Error: "+t.url),console.warn(e)}if(!(t.respHeaders&&t.digest||(t.respHeaders=i.respHeaders,t.digest=n,i.extraOpts&&(t.extraOpts=i.extraOpts),this.noCache)))try{await this.db.put("resources",t)}catch(e){console.warn("Resource Update Error: "+t.url),console.warn(e)}return r||i.reader}async commitPayload(t,e){if(!t||0===t.length)return;const r=this.db.transaction(["payload","digestRef"],"readwrite");try{if(r.objectStore("payload").put({payload:t,digest:e}),this.useRefCounts){const i=await r.objectStore("digestRef").get(e);i&&(i.size=t.length,r.objectStore("digestRef").put(i))}await r.done}catch(t){console.warn("Payload Commit Error: "+t)}}}class rt extends et{constructor(t,e,r=!1){super(t,r),this.loader=e}updateHeaders(t){this.loader.headers=t}async loadSource(t){const{start:e,length:r}=t;return await this.loader.getRange(e,r,!0)}}class it extends et{constructor(t,e,r,i=!1){super(t,i),this.remoteUrlPrefix=e,this.headers=r}updateHeaders(t){this.headers=t}async loadSource(t){const{start:e,length:r}=t,i=new Headers(this.headers),n=Z(new URL(t.path,this.remoteUrlPrefix).href,i);return await n.getRange(e,r,!0)}}class nt extends W.b{constructor(t,e,r,i=""){super(),this.db=t,this.reader=e,this.digest=r,this.url=i,this.chunks=[],this.size=0,this.fullbuff=null,this.commit=!0,this.alreadyRead=!1}setLimitSkip(t=-1,e=0){(-1!=t||e>0)&&(this.commit=!1),this.reader.setLimitSkip(t,e)}async*[Symbol.asyncIterator](){if(!this.alreadyRead){for await(const t of this.reader)this.chunks.push(t),this.size+=t.byteLength,yield t;this.fullbuff=W.b.concatChunks(this.chunks,this.size),0!==this.reader.limit?console.warn(`Expected payload not consumed, ${this.reader.limit} bytes left`):this.commit&&await this.db.commitPayload(this.fullbuff,this.digest),this.chunks=[],this.alreadyRead=!0}}async readFully(){for await(const t of this);return this.fullbuff}}class st extends Y{constructor(t,e,r){super(t,e,r),this.cdxindexer=null}filterRecord(t){switch(t.warcType){case"warcinfo":case"revisit":return null;case"request":return"skipContent";case"metadata":return this.shouldIndexMetadataRecord(t)?null:"skipContent"}const e=t.warcTargetURI,r=new Date(t.warcDate).getTime();if(this.pageMap[r+"/"+e])return t._isPage=!0,null}index(t,e){if(t._isPage)return super.index(t,e);if("warcinfo"===t.warcType)return void this.parseWarcInfo(t);this.cdxindexer||(this.cdxindexer=new W.c({},null));const r=this.cdxindexer.indexRecord(t,e,"");r&&this.addCdx(r)}addCdx(t){const{url:e,mime:r}=t,i=Number(t.status)||200,n=Object(R.m)(t.timestamp).getTime(),s={path:t.filename,start:Number(t.offset),length:Number(t.length)};let{digest:o}=t;o&&-1===o.indexOf(":")&&(o="sha1:"+o);const a={url:e,ts:n,status:i,digest:o,mime:r,loaded:!1,source:s};this.batch.length>=3e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=3e3} records`)),this.batch.push(a)}}class ot extends st{async load(t){this.db=t;let e=this.reader;e.iterLines||(e=new W.a(this.reader));for await(const t of e.iterLines()){let e,r,i,n=t.trimEnd();if(!n.startsWith("{")){const t=n.indexOf(" {");if(t<0)continue;[r,i]=n.split(" ",2),n=n.slice(t)}try{e=JSON.parse(n)}catch(t){console.log("JSON Parser error on: "+n);continue}e.timestamp=i,e.url||(e.url=r),this.addCdx(e)}this.indexDone(),await this.finishIndexing()}}const at=/(?:([\d]+)[^\/]*\/)?(http.*)/;class ut{constructor(t){this.sourceUrl=t.sourceUrl,this.type=t.extraConfig&&t.extraConfig.sourceType||"kiwix",this.notFoundPageUrl=t.extraConfig&&t.extraConfig.notFoundPageUrl}async getAllPages(){return[]}async getResource(t,e,r){const{url:i,headers:n}=lt(t,e);let s=n;if("kiwix"===this.type){const e=await this.resolveHeaders(i);if(!e){if(this.notFoundPageUrl&&"navigate"===t.request.mode){const t=await fetch(this.notFoundPageUrl);if(200===t.status){const e={"Content-Type":"text/html"},r=await t.text();return new Response(r.replace("$URL",i),{status:404,headers:e})}}return null}let{headers:r,encodedUrl:n,date:o,status:a,statusText:u,hasPayload:h}=e;if(s.has("Range")){const t=s.get("Range");s={Range:t}}let c=null,l=null;h&&(l=await fetch(this.sourceUrl+"A/"+n,{headers:s}),l.body&&(c=new W.a(l.body.getReader(),!1)),206===l.status&&(a=206,u="Partial Content",r.set("Content-Length",l.headers.get("Content-Length")),r.set("Content-Range",l.headers.get("Content-Range")),r.set("Accept-Ranges","bytes"))),c||(c=new Uint8Array([])),o||(o=new Date),r||(r=new Headers);const d=!1,f=!1;return new L.a({payload:c,status:a,statusText:u,headers:r,url:i,date:o,noRW:f,isLive:d})}}async resolveHeaders(t){const e=t.slice(t.indexOf("//")+2);let r=encodeURI(e);r=encodeURIComponent(e);let i=await fetch(this.sourceUrl+"H/"+r);if(200!==i.status)return null;let n=null,s=null,o=null,a=null,u=!1;try{const e=await W.d.parse(i.body);if("revisit"===e.warcType){const r=e.warcHeaders.headers.get("WARC-Refers-To-Target-URI");if(r&&r!==t)return await this.resolveHeaders(r)}s=new Date(e.warcDate),e.httpHeaders?(n=e.httpHeaders.headers,o=Number(e.httpHeaders.statusCode),a=e.httpHeaders.statusText,u="0"!==e.httpHeaders.headers.get("Content-Length")):"resource"===e.warcType&&(n=new Headers,n.set("Content-Type",e.warcContentType),n.set("Content-Length",e.warcContentLength),o=200,a="OK",u=e.warcContentLength>0),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:u}}}class ht{constructor(t){this.replayPrefix=t.replayPrefix,this.idMod=void 0!==t.idMod?t.idMod:"id_",this.redirMod=void 0!==t.redirMod?t.redirMod:"mp_",this.redirectMode=this.idMod===this.redirMod?"follow":"manual"}async getAllPages(){return[]}getUrl(t,e){let r=this.replayPrefix;return(e||t.timestamp)&&(r+=t.timestamp+e+"/"),r+t.url}async getResource(t,e,r){let i=await fetch(this.getUrl(t,this.idMod),{credentials:"same-origin",redirect:this.redirectMode,mode:"cors"});if(i.status>=400&&!i.headers.get("memento-datetime"))return null;const n=await this.getRedirect(t,i,e);let s=null,o=!1;n?(i=Response.redirect(n.path,307),o=!0,s=n.timestamp):s=t.timestamp;const a=t.url,u=s?Object(R.m)(s):new Date;return L.a.fromResponse({url:a,response:i,date:u,noRW:o})}async getRedirect(t,e,r){if("opaqueredirect"===e.type)e=await fetch(this.getUrl(t,this.redirMod),{credentials:"same-origin",redirect:"follow",mode:"cors"});else if(!e.redirected)return null;const i=e.url.indexOf(this.replayPrefix)+this.replayPrefix.length,n=e.url.slice(i),s=n.match(at);return s?{timestamp:s[1],path:r+s[1]+"mp_/"+s[2]}:{path:r+n}}}class ct{constructor(t,e=!1,r=!0){this.prefix=t||"",this.proxyPathOnly=e,this.isLive=r}async getAllPages(){return[]}async getResource(t,e,r){const{headers:i,credentials:n,url:s}=lt(t,e);let o;if(this.proxyPathOnly){const t=new URL(s);o=this.prefix+t.pathname+t.search}else o=this.prefix+s;const a=await fetch(o,{method:t.request.method,body:t.request.body,headers:i,credentials:n,mode:"cors",redirect:"follow"});return L.a.fromResponse({url:s,response:a,date:new Date,noRW:!1,isLive:this.isLive})}}function lt(t,e,r=!0){let i,n,s;if(r){i=new Headers(t.request.headers),n=t.request.referrer;const r=n.indexOf("/http",e.length-1);r>0&&(n=n.slice(r+1),i.set("X-Proxy-Referer",n)),s=t.request.credentials}else i=new Headers,s="omit";let o=t.url;if(o.startsWith("//"))try{o=new URL(n).protocol+o}catch(t){o="https:"+o}return{referrer:n,headers:i,credentials:s,url:o}}var dt=r(31),ft=r.n(dt),pt=r(40);class mt extends rt{constructor(t,e,r=null,i=!1,n){super(t,e,i),this.zipreader=new wt(e),this.externalSources=[],this.fuzzyUrlRules=[],this.useSurt=!0,this.fullConfig=n,this.textIndex=n&&n.metadata&&n.metadata.textIndex,e.canLoadOnDemand=!0,r&&this.initConfig(r)}_initDB(t,e,r,i){if(super._initDB(t,e,r,i),!e){t.createObjectStore("ziplines",{keyPath:"prefix"}),t.createObjectStore("zipEntries",{keyPath:"filename"})}}async init(){await super.init(),await this.loadZipEntries()}async close(){super.close(),caches.delete("cache:"+this.name.slice("db:".length))}async clearZipData(){const t=["zipEntries","ziplines"];for(const e of t)await this.db.clear(e)}async clearAll(){await super.clearAll(),await this.clearZipData()}updateHeaders(t){this.zipreader.loader.headers=t}async loadZipEntries(){const t=await this.db.getAll("zipEntries");if(!t.length)return;const e={};for(const r of t)e[r.filename]=r;this.zipreader.entries=e}async saveZipEntries(t){const e=this.db.transaction("zipEntries","readwrite");e.store.clear();for(const r of Object.values(t))e.store.put(r);await e.done,this.db.clear("ziplines")}async loadZiplinesIndex(t,e,r){let i=0,n=0,s=0,o=[],a="";for await(const u of t.iterLines()){if(i+=u.length,i===u.length&&u.startsWith("!meta")){const t=u.indexOf(" {");if(t<0){console.warn("Invalid Meta Line: "+u);continue}const e=JSON.parse(u.slice(t));e.filename&&(a=e.filename),"cdxj-gzip-1.0"!==e.format&&console.log(`Unknown CDXJ format "${e.format}", archive may not parse correctly`);continue}let t;if(u.indexOf("\t")>0){let[e,r,i,n]=u.split("\t");i=Number(i),n=Number(n),t={prefix:e,filename:r,offset:i,length:n,loaded:!1},this.useSurt=!0}else{const e=u.indexOf(" {");if(e<0){console.log("Invalid Index Line: "+u);continue}const r=u.slice(0,e);let{offset:i,length:n,filename:s}=JSON.parse(u.slice(e));s=s||a,t={prefix:r,filename:s,offset:i,length:n,loaded:!1}}s=(new Date).getTime(),s-n>500&&(e(Math.round(i/r*100),null,i,r),n=s),o.push(t)}const u=this.db.transaction("ziplines","readwrite");for(const t of o)u.store.put(t);try{await u.done}catch(t){console.log("Error loading ziplines index: ",t)}}async load(t,e,r){if(t!==this)return void console.error("wrong db");const i=await t.zipreader.load(!0);await t.saveZipEntries(i);const n=[];let s;i["webarchive.yaml"]&&(s=await this.loadMetadata(i,await t.zipreader.loadFile("webarchive.yaml")));for(const r of Object.keys(i))if(r.endsWith(".cdx")||r.endsWith(".cdxj")){console.log("Loading CDX "+r);const e=await t.zipreader.loadFile(r);n.push(new ot(e).load(t))}else if(r.endsWith(".idx")){if(this.loader.canLoadOnDemand){console.log("Loading IDX "+r);const i=t.zipreader.getCompressedSize(r);n.push(t.loadZiplinesIndex(await t.zipreader.loadFile(r),e,i))}}else if(r.endsWith(".warc.gz")||r.endsWith(".warc"))if(!s&&this.loader.canLoadOnDemand){const i=new AbortController,n=await t.zipreader.loadFile(r,{signal:i.signal,unzip:!0}),o=new K(n,i),a=t.zipreader.getCompressedSize(r);s=await o.load(t,e,a)}else if(!this.loader.canLoadOnDemand){const i=await t.zipreader.loadFile(r,{unzip:!0}),n=new Y(i);n.detectPages=!1;const o=t.zipreader.getCompressedSize(r);s=await n.load(t,e,o)}return await Promise.all(n),s||{}}async loadPagesCSV(t){const e=(new TextDecoder).decode(await t.readFully()),r=await Object(pt.csv2jsonAsync)(e);r&&r.length&&await this.addPages(r)}initConfig(t){if(void 0!==t.decodeResponses&&(this.fullConfig.decode=t.decodeResponses),void 0!==t.useSurt&&(this.useSurt=t.useSurt),t.es)for(const[e,r]of t.es){const t=new ct(r,!0,!1);this.externalSources.push({prefix:e,external:t})}if(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)}async getTextIndex(){const t={"Content-Type":"application/ndjson"};if(!this.textIndex)return new Response("",{headers:t});const e=this.zipreader.getCompressedSize(this.textIndex);e>0&&(t["Content-Length"]=""+e);const r=await this.zipreader.loadFile(this.textIndex,{unzip:!0});return new Response(r.getReadableStream(),{headers:t})}async loadMetadata(t,e){const r=(new TextDecoder).decode(await e.readFully()),i=ft.a.safeLoad(r);void 0!==i.config&&this.initConfig(i.config);const n={desc:i.desc,title:i.title};i.textIndex&&(n.textIndex=i.textIndex);const s=i.pages||[];s&&s.length?await this.addPages(s):t["pages.csv"]&&await this.loadPagesCSV(await this.zipreader.loadFile("pages.csv"));const o=i.pageLists||[];return o&&o.length&&await this.addCuratedPageLists(o,"pages","show"),n}async loadRecordFromSource(t){let e,r=0,i=-1;const n=t.source;if("string"==typeof n)e=n;else{if("object"!=typeof n)return null;r=n.start,i=n.length,e=n.path}let s=null;const o=await this.zipreader.loadFileCheckDirs(e,r,i);return s=new V(o),await s.load()}getSurt(t){try{t=t.replace(/www\d*\./,"");const e=new URL(t);let r=e.hostname.split(".").reverse().join(",");return e.port&&(r+=":"+e.port),r+=")",r+=e.pathname,e.search&&(e.searchParams.sort(),r+=e.search),r.toLowerCase()}catch(e){return t}}async loadFromZiplines(t,e){e&&Object(R.f)(new Date(e).toISOString());let r,i;const n=this.useSurt?this.getSurt(t):t;r=n+" 9",i=n;const s=this.db.transaction("ziplines","readonly"),o=[],a=IDBKeyRange.upperBound(r,!1);for await(const t of s.store.iterate(a,"prev"))if(o.unshift(t.value),!t.value.prefix.split(" ")[0].startsWith(i))break;await s.done;const u=[];for(const t of o){if(t.loaded)continue;const e="indexes/"+t.filename,r={offset:t.offset,length:t.length,unzip:!0},i=await this.zipreader.loadFile(e,r);u.push(new ot(i).load(this)),t.loaded=!0,await this.db.put("ziplines",t)}return await Promise.all(u),u.length>0}async getResource(t,e,r){if(this.externalSources.length)for(const{prefix:i,external:n}of this.externalSources)if(t.url.startsWith(i))try{return await n.getResource(t,e,r)}catch(t){console.warn("Upstream Error",t)}let i=await super.getResource(t,e,r);if(i)return i;if(this.fuzzyUrlRules.length)for(const{match:n,replace:s}of this.fuzzyUrlRules){const o=t.url.replace(n,s);if(o&&o!==t.url&&(t.url=o,i=await super.getResource(t,e,r),i))return i}return null}async lookupUrl(t,e,r={}){try{let i=await super.lookupUrl(t,e,r);return!i||r.noRevisits&&"warc/revisit"===i.mime?(await this.loadFromZiplines(t,e)&&(i=await super.lookupUrl(t,e,r)),i):i}catch(t){return console.warn(t),null}}async resourcesByUrlAndMime(t,...e){let r=await super.resourcesByUrlAndMime(t,...e);return r.length>0||await this.loadFromZiplines(t,"")&&(r=await super.resourcesByUrlAndMime(t,...e)),r}}class wt{constructor(t,e=null){this.loader=t,this.entries=e}async load(t=!1){if(!this.entries||t){const t=await this.loader.getLength(),e=Math.min(65558,t),r=t-e,i=await this.loader.getRange(r,e);this.entries=this._loadEntries(i,r)}return this.entries}_loadEntries(t,e){const r=t.byteLength,i=new DataView(t.buffer),n=new TextDecoder("utf8"),s=new TextDecoder("ascii"),o={};let a=0,u=0,h=r;for(let e=r-22,n=Math.max(0,e-65535);e>=n;--e)if(80===t[e]&&75===t[e+1]&&5===t[e+2]&&6===t[e+3]){h=e,u=i.getUint32(e+16,!0),a=i.getUint16(e+8,!0);break}if(4294967295===u||65535===a){if(117853008!==i.getUint32(h-20,!0))return void console.warn("invalid zip64 EOCD locator");const t=this.getUint64(i,h-12,!0)-e;if(101075792!==i.getUint32(t,!0))return void console.warn("invalid zip64 EOCD record");a=this.getUint64(i,t+32,!0),u=this.getUint64(i,t+48,!0)}if(e&&(u-=e),u>=r||u<=0)for(u=-1,a=65535;++u=0&&u=8&&(a=this.getUint64(i,t,!0),t+=8,n-=8),4294967295===r&&n>=8&&(r=this.getUint64(i,t,!0),t+=8,n-=8),4294967295===f&&n>=8&&(f=this.getUint64(i,t,!0),t+=8,n-=8)),t+=n}}p.endsWith("/")||(o[p]={filename:p,deflate:d,uncompressedSize:a,compressedSize:r,localEntryOffset:f}),u+=46+h+c+l}return o}async loadFileCheckDirs(t,e,r){if(null===this.entries&&await this.load(),this.entries["archive/"+t])t="archive/"+t;else if(this.entries["warcs/"+t])t="warcs/"+t;else for(const e of Object.keys(this.entries))if(e.endsWith("/"+t)){t=e;break}return await this.loadFile(t,{offset:e,length:r,unzip:!0})}getCompressedSize(t){if(null===this.entries)return-1;const e=this.entries[t];return e?e.compressedSize:-1}async loadFile(t,{offset:e=0,length:r=-1,signal:i=null,unzip:n=!1}={}){null===this.entries&&await this.load();const s=this.entries[t];if(!s)return null;if(void 0===s.offset){const t=await this.loader.getRange(s.localEntryOffset,30),e=new DataView(t.buffer),r=e.getUint16(26,!0),i=e.getUint16(28,!0);s.offset=30+r+i+s.localEntryOffset}r=r<0?s.compressedSize:Math.min(r,s.compressedSize-e),e+=s.offset;const o=await this.loader.getRange(e,r,!0,i);return n?s.deflate?new W.a(new W.a(o.getReader(),"deflate")):new W.a(o.getReader()):new W.a(o.getReader(),s.deflate?"deflate":null)}getUint64(t,e,r){const i=t.getUint32(e,r),n=t.getUint32(e+4,r),s=r?i+2**32*n:2**32*i+n;return Number.isSafeInteger(s)||console.warn(s,"exceeds MAX_SAFE_INTEGER. Precision may be lost"),s}}class gt extends X.a{constructor(t){super(),this.har=t,this.pageRefs={}}async load(t){return this.db=t,"string"==typeof this.har&&(this.har=JSON.parse(this.har)),this.parseEntries(this.har),this.parsePages(this.har),await this.finishIndexing(),{}}parsePages(t){for(const e of t.log.pages){if(!e.pageTimings||!e.pageTimings.onLoad)continue;let t;t=e.title&&(e.title.startsWith("http:")||e.title.startsWith("https:"))?e.title:this.pageRefs[e.id];const r=e.title||t,i=e.startedDateTime;this.addPage({url:t,date:i,title:r})}}parseEntries(t){for(const e of t.log.entries){if(!e.response.content||!e.response.content.text){console.log("Skipping: "+e.request.url);continue}let t=null;try{t=Uint8Array.from(atob(e.response.content.text),t=>t.charCodeAt(0))}catch(r){t=e.response.content.text}console.log("Added: "+e.request.url);const r=new Date(e.startedDateTime).getTime(),i={};for(const{name:t,value:r}of e.response.headers)i[t]=r;this.addResource({url:e.request.url,ts:r,status:e.response.status,respHeaders:i,payload:t}),e.pageref&&!this.pageRefs[e.pageref]&&(this.pageRefs[e.pageref]=e.request.url)}}}var yt=r(118);self.interruptLoads={};class _t{constructor(){this.colldb=null,this.root=null,this._init_db=this._initDB()}async _initDB(){this.colldb=await g("collDB",1,{upgrade:(t,e,r,i)=>{t.createObjectStore("colls",{keyPath:"name"})}})}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 deleteColl(t){await this._init_db;const e=await this.colldb.get("colls",t);if(!e)return!1;e.config.dbname&&await y(e.config.dbname,{blocked(t){console.log(`Unable to delete ${e.config.dbname}: ${t}`)}}),await this.colldb.delete("colls",t)}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);if(!r)return!1;const i=r.config.metadata||{};return Object.assign(i,e),await this.colldb.put("colls",r),i}async updateSize(t,e,r){await this._init_db;const i=await this.colldb.get("colls",t);if(!i)return!1;i.config.loadSize=(i.config.loadSize||0)+e,i.config.dedupSize=(i.config.dedupSize||0)+r,await this.colldb.put("colls",i)}async _initColl(t){let e=null,r=null;switch(t.type){case"archive":e=new U(t.config.dbname);break;case"remotesource":r=Z(t.config.loadUrl,t.config.headers,t.config.size,t.config.extra),e=new rt(t.config.dbname,r,t.config.noCache);break;case"remoteprefix":e=new it(t.config.dbname,t.config.remotePrefix,t.config.headers,t.config.noCache);break;case"remotezip":r=Z(t.config.loadUrl||t.config.sourceUrl,t.config.headers,t.config.extra),e=new mt(t.config.dbname,r,t.config.extraConfig,t.config.noCache,t.config);break;case"remoteproxy":e=new ht(t.config);break;case"remotewarcproxy":e=new ut(t.config);break;case"live":e=new ct(t.config.prefix,t.config.proxyPathOnly,t.config.isLive)}if(!e)return console.log("no store found: "+t.type),null;e.initing&&await e.initing;const i=t.name,n=t.config;return t.config.root&&(this.root=i),this._createCollection({name:i,store:e,config:n})}_createCollection(t){return t}}class bt extends _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=>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)=>{e.postMessage({msg_type:"collProgress",name:r,percent:t,error:i,currentSize:n,totalSize:s})};let n;try{if(await this.hasCollection(r)?t.data.skipExisting?n=!0:(await this.deleteCollection(r),n=await this.addCollection(t.data,i)):n=await this.addCollection(t.data,i),!n)return}catch(t){return console.warn(t),void i(0,"An unexpected error occured: "+t.toString())}e.postMessage({msg_type:"collAdded",name:r});break}case"cancelLoad":{const e=t.data.name,r=new Promise(t=>self.interruptLoads[e]=t);await r,await this.deleteCollection(e),delete self.interruptLoads[e];break}case"removeColl":{const r=t.data.name;await this.hasCollection(r)&&(await this.deleteCollection(r),this.doListAll(e));break}case"listAll":this.doListAll(e)}}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){const r=t.name;let i=null,n={root:t.root||!1},s=null;const o=t.file;if(!o||!o.sourceUrl)return e(0,"Invalid Load Request"),!1;if(o.sourceUrl.startsWith("proxy:"))n.sourceUrl=o.sourceUrl.slice("proxy:".length),n.extraConfig=t.extraConfig,n.topTemplateUrl=t.topTemplateUrl,i="remotewarcproxy";else{let a=null;i="archive",n.dbname="db:"+r;let u=o.loadUrl||o.sourceUrl;u.match(/[\w]+:\/\//)||(u=new URL(u,self.location.href).href),n.decode=!0,n.onDemand=!1,n.loadUrl=u,n.sourceUrl=o.sourceUrl,n.sourceName=o.name||o.sourceUrl;try{n.sourceName.match(/https?:\/\//)&&(n.sourceName=new URL(n.sourceName).pathname)}catch(t){}n.sourceName=n.sourceName.slice(n.sourceName.lastIndexOf("/")+1),n.headers=o.headers,n.size="number"==typeof o.size?o.size:null,n.extra=o.extra,n.extraConfig=t.extraConfig,n.noCache=u.startsWith("file:")||o.noCache;const h=Z(u,o.headers,o.size,n.extra,o.blob);let c=!1;(n.sourceName.endsWith(".wacz")||n.sourceName.endsWith(".zip"))&&(s=new mt(n.dbname,h,n.extraConfig,n.noCache,n),i="remotezip",a=s,c=!0);let{abort:l,response:d,stream:f}=await h.doInitialFetch(c);if(f=f||d.body,!h.isValid){const t=h.length<=1e3?await d.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: ${d.status} ${d.statusText}\nError Details:\n${t}`),l&&l.abort(),!1}if(!h.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."),l&&l.abort(),!1;const p=h.length;if(n.sourceName.endsWith(".warc")||n.sourceName.endsWith(".warc.gz")?p<25e6||!h.canLoadOnDemand?a=new Y(f,l,r):(a=new st(f,l,r),i="remotesource",s=new rt(n.dbname,h,n.noCache)):n.sourceName.endsWith(".cdxj")||n.sourceName.endsWith(".cdx")?(n.remotePrefix=t.remotePrefix||u.slice(0,u.lastIndexOf("/")+1),a=new ot(f,l,r),i="remoteprefix",s=new it(n.dbname,n.remotePrefix,n.headers,n.noCache)):n.sourceName.endsWith(".wbn")?(a=new yt.a(await d.arrayBuffer()),n.decode=!1):n.sourceName.endsWith(".har")&&(a=new gt(await d.json()),n.decode=!1),!a)return e(0,`The ${n.sourceName} is not a known archive format that could be loaded.`),l&&l.abort(),!1;s||(s=new U(n.dbname)),await s.initing,n.onDemand=h.canLoadOnDemand;try{n.metadata=await a.load(s,e,p)}catch(t){return t instanceof R.b||e(0,"Unexpected Loading Error: "+t.toString()),!1}n.metadata.size||(n.metadata.size=p)}n.ctime=(new Date).getTime();const a={name:r,type:i,config:n};return await this.colldb.add("colls",a),!0}async deleteCollection(t){const e="db:"+t;try{await y(e,{blocked(t){console.log("Unable to delete: "+t)}})}catch(t){return console.warn(t),!1}return await this.colldb.delete("colls",t),!0}}},,,,,function(t,e,r){"use strict";const i=r(161),n=r(34),s=r(34),o=r(7).buildOptions,a=r(163);e.parse=function(t,e,r){if(r){!0===r&&(r={});const e=a.validate(t,r);if(!0!==e)throw Error(e.err.msg)}e=o(e,s.defaultOptions,s.props);const u=n.getTraversalObj(t,e);return i.convertToJson(u,e)},e.convertTonimn=r(164).convert2nimn,e.getTraversalObj=n.getTraversalObj,e.convertToJson=i.convertToJson,e.convertToJsonString=r(165).convertToJsonString,e.validate=a.validate,e.j2xParser=r(166),e.parseToNimn=function(t,r,i){return e.convertTonimn(e.getTraversalObj(t,i),r,i)}},,,,,function(t,e,r){"use strict";(function(e,i){var n=r(32);t.exports=_;var s,o=r(69);_.ReadableState=y;r(41).EventEmitter;var a=function(t,e){return t.listeners(e).length},u=r(70),h=r(43).Buffer,c=e.Uint8Array||function(){};var l=Object.create(r(22));l.inherits=r(13);var d=r(126),f=void 0;f=d&&d.debuglog?d.debuglog("stream"):function(){};var p,m=r(127),w=r(72);l.inherits(_,u);var g=["error","close","destroy","pause","resume"];function y(t,e){t=t||{};var i=e instanceof(s=s||r(10));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,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.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(74).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function _(t){if(s=s||r(10),!(this instanceof _))return new _(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function b(t,e,r,i,n){var s,o=t._readableState;null===e?(o.reading=!1,function(t,e){if(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,A(t)}(t,o)):(n||(s=function(t,e){var r;i=e,h.isBuffer(i)||i instanceof c||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(o,e)),s?t.emit("error",s):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):E(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?E(t,o,e,!1):x(t,o)):E(t,o,e,!1))):i||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(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 A(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(T,t):T(t))}function T(t){f("emit readable"),t.emit("readable"),k(t)}function x(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(S,t,e))}function S(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;ts.length?s.length:t;if(o===s.length?n+=s:n+=s.slice(0,t),0===(t-=o)){o===s.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=h.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var s=i.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(o));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(N,e,t))}function N(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function O(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):A(this),null;if(0===(t=v(t,e))&&e.ended)return 0===e.length&&I(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?R(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&I(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(t,e){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,f("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?c:_;function h(e,i){f("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",w),t.removeListener("unpipe",h),r.removeListener("end",c),r.removeListener("end",_),r.removeListener("data",m),d=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function c(){f("onend"),t.end()}s.endEmitted?n.nextTick(u):r.once("end",u),t.on("unpipe",h);var l=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,k(t))}}(r);t.on("drain",l);var d=!1;var p=!1;function m(e){f("ondata"),p=!1,!1!==t.write(e)||p||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==O(s.pipes,t))&&!d&&(f("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function w(e){f("onerror",e),_(),t.removeListener("error",w),0===a(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",y),_()}function y(){f("onfinish"),t.removeListener("close",g),_()}function _(){f("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",w),t.once("close",g),t.once("finish",y),t.emit("pipe",r),s.flowing||(f("pipe resume"),r.resume()),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?o-4:o;for(r=0;r>16&255,u[c++]=e>>8&255,u[c++]=255&e;2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[c++]=255&e);1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,s=[],o=0,a=r-n;oa?a:o+16383));1===n?(e=t[r-1],s.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],s.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var n,s,o=[],a=e;a>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e,r){"use strict";var i=r(32);function n(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||i.nextTick(n,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(i.nextTick(n,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),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.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,r){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function s(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new s(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new s(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(129),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(6))},function(t,e,r){"use strict";var i=r(131).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=h,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=l,e=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";t.exports=o;var i=r(10),n=Object.create(r(22));function s(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length(Object.keys(e).forEach(r=>{t[r]=e[r]}),t),Object.create(null))}},function(t,e,r){var i=r(79).BrotliInput,n=r(79).BrotliOutput,s=r(147),o=r(80),a=r(81).HuffmanCode,u=r(81).BrotliBuildHuffmanTable,h=r(150),c=r(151),l=r(152),d=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),f=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),p=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),m=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function w(t){var e;return 0===t.readBits(1)?16:(e=t.readBits(3))>0?17+e:(e=t.readBits(3))>0?8+e:17}function g(t){if(t.readBits(1)){var e=t.readBits(3);return 0===e?1:t.readBits(e)+(1<1&&0===s)throw new Error("Invalid size byte");n.meta_block_length|=s<<8*i}}else for(i=0;i4&&0===o)throw new Error("Invalid size nibble");n.meta_block_length|=o<<4*i}return++n.meta_block_length,n.input_end||n.is_metadata||(n.is_uncompressed=t.readBits(1)),n}function b(t,e,r){var i;return r.fillBitWindow(),(i=t[e+=r.val_>>>r.bit_pos_&255].bits-8)>0&&(r.bit_pos_+=8,e+=t[e].value,e+=r.val_>>>r.bit_pos_&(1<>=1,++c;for(p=0;p0;++p){var _,b=d[p],E=0;i.fillBitWindow(),E+=i.val_>>>i.bit_pos_&15,i.bit_pos_+=y[E].bits,_=y[E].value,m[b]=_,0!==_&&(w-=32>>_,++g)}if(1!==g&&0!==w)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function(t,e,r,i){for(var n=0,s=8,o=0,h=0,c=32768,l=[],d=0;d<32;d++)l.push(new a(0,0));for(u(l,0,5,t,18);n0;){var f,p=0;if(i.readMoreInput(),i.fillBitWindow(),p+=i.val_>>>i.bit_pos_&31,i.bit_pos_+=l[p].bits,(f=255&l[p].value)<16)o=0,r[n++]=f,0!==f&&(s=f,c-=32768>>f);else{var m,w,g=f-14,y=0;if(16===f&&(y=s),h!==y&&(o=0,h=y),m=o,o>0&&(o-=2,o<<=g),n+(w=(o+=i.readBits(g)+3)-m)>e)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var _=0;_>>5]),this.htrees=new Uint32Array(e)}function S(t,e){var r,i,n={num_htrees:null,context_map:null},s=0;e.readMoreInput();var o=n.num_htrees=g(e)+1,u=n.context_map=new Uint8Array(t);if(o<=1)return n;for(e.readBits(1)&&(s=e.readBits(4)+1),r=[],i=0;i<1080;i++)r[i]=new a(0,0);for(E(o+s,r,0,e),i=0;i=t)throw new Error("[DecodeContextMap] i >= context_map_size");u[i]=0,++i}else u[i]=h-s,++i}return e.readBits(1)&&function(t,e){var r,i=new Uint8Array(256);for(r=0;r<256;++r)i[r]=r;for(r=0;r=t&&(a-=t),i[r]=a,n[u+(1&s[h])]=a,++s[h]}function D(t,e,r,i,n,o){var a,u=n+1,h=r&n,c=o.pos_&s.IBUF_MASK;if(e<8||o.bit_pos_+(e<<3)0;)o.readMoreInput(),i[h++]=o.readBits(8),h===u&&(t.write(i,u),h=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)i[h]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++h,--e;if(c+(a=o.bit_end_pos_-o.bit_pos_>>3)>s.IBUF_MASK){for(var l=s.IBUF_MASK+1-c,d=0;d=u){t.write(i,u),h-=u;for(d=0;d=u;){if(a=u-h,o.input_.read(i,h,a)e.buffer.length){var lt=new Uint8Array(R+Z);lt.set(e.buffer),e.buffer=lt}if(I=ct.input_end,W=ct.is_uncompressed,ct.is_metadata)for(k(T);Z>0;--Z)T.readMoreInput(),T.readBits(8);else if(0!==Z)if(W)T.bit_pos_=T.bit_pos_+7&-8,D(e,Z,R,f,d,T),R+=Z;else{for(r=0;r<3;++r)tt[r]=g(T)+1,tt[r]>=2&&(E(tt[r]+2,m,1080*r,T),E(26,y,1080*r,T),Q[r]=v(y,1080*r,T),rt[r]=1);for(T.readMoreInput(),z=(1<<(j=T.readBits(2)))-1,G=(H=16+(T.readBits(4)<0;){var pt,mt,wt,gt,yt,_t,bt,Et,vt,At,Tt,xt;for(T.readMoreInput(),0===Q[1]&&(C(tt[1],m,1,$,et,rt,T),Q[1]=v(y,1080,T),J=L[1].htrees[$[1]]),--Q[1],(mt=(pt=b(L[1].codes,J,T))>>6)>=2?(mt-=2,bt=-1):bt=0,wt=c.kInsertRangeLut[mt]+(pt>>3&7),gt=c.kCopyRangeLut[mt]+(7&pt),yt=c.kInsertLengthPrefixCode[wt].offset+T.readBits(c.kInsertLengthPrefixCode[wt].nbits),_t=c.kCopyLengthPrefixCode[gt].offset+T.readBits(c.kCopyLengthPrefixCode[gt].nbits),P=f[R-1&d],B=f[R-2&d],vt=0;vt4?3:_t-2))],(bt=b(L[2].codes,L[2].htrees[at],T))>=H)xt=(bt-=H)&z,bt=H+((St=(2+(1&(bt>>=j))<<(Tt=1+(bt>>1)))-4)+T.readBits(Tt)<(N=R=o.minDictionaryWordLength&&_t<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+R+" distance: "+Et+" len: "+_t+" bytes left: "+Z);var St=o.offsetsByLength[_t],Ct=Et-N-1,Dt=o.sizeBitsByLength[_t],kt=Ct>>Dt;if(St+=(Ct&(1<=p){e.write(f,u);for(var It=0;It0&&(O[3&F]=Et,++F),_t>Z)throw new Error("Invalid backward reference. pos: "+R+" distance: "+Et+" len: "+_t+" bytes left: "+Z);for(vt=0;vt<_t;++vt)f[R&d]=f[R-Et&d],(R&d)===d&&e.write(f,u),++R,--Z}P=f[R-1&d],B=f[R-2&d]}R&=1073741823}}e.write(f,R&d)}x.prototype.decode=function(t){var e,r=0;for(e=0;ethis.buffer.length&&(r=this.buffer.length-this.pos);for(var i=0;ithis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(t.subarray(0,e),this.pos),this.pos+=e,e},e.BrotliOutput=i},function(t,e,r){var i=r(148);e.init=function(){e.dictionary=i.init()},e.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),e.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),e.minDictionaryWordLength=4,e.maxDictionaryWordLength=24},function(t,e){function r(t,e){this.bits=t,this.value=e}e.HuffmanCode=r;function i(t,e){for(var r=1<>=1;return(t&r-1)+r}function n(t,e,i,n,s){do{t[e+(n-=i)]=new r(s.bits,s.value)}while(n>0)}function s(t,e,r){for(var i=1<0;--b[h])n(t,e+l,d,w,new r(255&h,65535&y[c++])),l=i(l,h);for(p=g-1,f=-1,h=o+1,d=2;h<=15;++h,d<<=1)for(;b[h]>0;--b[h])(l&p)!==f&&(e+=w,g+=w=1<<(m=s(b,h,o)),t[_+(f=l&p)]=new r(m+o&255,e-_-f&65535)),n(t,e+(l>>o),d,w,new r(h-o&255,65535&y[c++])),l=i(l,h);return g}},function(t,e,r){"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}},function(t,e,r){"use strict";var i=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,e,r,n){var s=i,o=n+r;t^=-1;for(var a=n;a>>8^s[255&(t^e[a])];return-1^t}},function(t,e,r){"use strict";var i=r(9),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 u(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 u(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)h[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return u(h,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}},function(t,e,r){"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}},function(t,e,r){"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}},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(88)]})},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(48)],implicit:[r(174),r(175),r(176),r(177)]})},function(t,e,r){"use strict";e.Commented=r(194),e.Diagnose=r(204),e.Decoder=r(36),e.Encoder=r(90),e.Simple=r(27),e.Tagged=r(52),e.Map=r(205),e.comment=e.Commented.comment,e.decodeAll=e.Decoder.decodeAll,e.decodeFirst=e.Decoder.decodeFirst,e.decodeAllSync=e.Decoder.decodeAllSync,e.decodeFirstSync=e.Decoder.decodeFirstSync,e.diagnose=e.Diagnose.diagnose,e.encode=e.Encoder.encode,e.encodeCanonical=e.Encoder.encodeCanonical,e.encodeOne=e.Encoder.encodeOne,e.encodeAsync=e.Encoder.encodeAsync,e.decode=e.Decoder.decodeFirstSync,e.leveldb={decode:e.Decoder.decodeAllSync,encode:e.Encoder.encode,buffer:!0,name:"cbor"},e.hasBigInt=r(17).hasBigInt},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(53),s=r(11).BigNumber,o=r(28),a=(r(52),r(27),r(17)),u=r(12),h=u.MT,c=u.NUMBYTES,l=u.SHIFT32,d=u.SYMS,f=u.TAG,p=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.TWO,m=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.FOUR,w=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.EIGHT,g=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.TRUE,y=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.FALSE,_=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.UNDEFINED,b=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.NULL,E=a.bigIntize(u.BI),v=u.BN,A=e.from("f97e00","hex"),T=e.from("f9fc00","hex"),x=e.from("f97c00","hex"),S=e.from("f98000","hex"),C=Symbol("CBOR_LOOP_DETECT");class D extends i.Transform{constructor(t){const r=Object.assign({},t,{readableObjectMode:!1,writableObjectMode:!0});super(r),this.canonical=r.canonical,this.encodeUndefined=r.encodeUndefined,this.disallowUndefinedKeys=!!r.disallowUndefinedKeys,this.dateType=null!=r.dateType?r.dateType.toLowerCase():"number",this.collapseBigIntegers=!!r.collapseBigIntegers,"symbol"==typeof r.detectLoops?this.detectLoops=r.detectLoops:this.detectLoops=r.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes=[Array,this._pushArray,Date,this._pushDate,e,this._pushBuffer,Map,this._pushMap,o,this._pushNoFilter,RegExp,this._pushRegexp,Set,this._pushSet,s,this._pushBigNumber,ArrayBuffer,this._pushUint8Array,Uint8ClampedArray,this._pushUint8Array,Uint8Array,this._pushUint8Array,Uint16Array,this._pushArray,Uint32Array,this._pushArray,Int8Array,this._pushArray,Int16Array,this._pushArray,Int32Array,this._pushArray,Float32Array,this._pushFloat32Array,Float64Array,this._pushFloat64Array],n.Url&&this.semanticTypes.push(n.Url,this._pushUrl),n.URL&&this.semanticTypes.push(n.URL,this._pushURL);const i=r.genTypes||[];for(let t=0,e=i.length;t{i.pushAny(t);const r=n.read();i.pushAny(e);const s=n.read();return r.compare(s)});for(const[e,i]of r){if(t.disallowUndefinedKeys&&void 0===e)throw new Error("Invalid Map key: undefined");if(!t.pushAny(e)||!t.pushAny(i))return!1}}else for(const[r,i]of e){if(t.disallowUndefinedKeys&&void 0===r)throw new Error("Invalid Map key: undefined");if(!t.pushAny(r)||!t.pushAny(i))return!1}return!0}_pushUint8Array(t,r){return t._pushBuffer(t,e.from(r))}_pushFloat32Array(t,e){const r=e.length;if(!t._pushInt(r,h.ARRAY))return!1;for(let i=0;i{const r=i[t]||(i[t]=D.encode(t)),n=i[e]||(i[e]=D.encode(e));return r.compare(n)}),!this._pushInt(r.length,h.MAP))return!1;let n;for(let e=0,s=r.length;e{const s=[],o=new D(r);o.on("data",t=>s.push(t)),o.on("error",n),o.on("finish",()=>i(e.concat(s))),o.pushAny(t),o.end()})}}t.exports=D}).call(this,r(3).Buffer)},,,,,,,,,,,,,,,,,,,,,,function(t,e,r){"use strict";const i=r(55),{escapeString:n}=r(144);t.exports=class extends i{constructor(){super({sourceCodeLocationInfo:!0}),this.posTracker=this.locInfoMixin.posTracker}_transformChunk(t){super._transformChunk(t)}_getRawHtml(t){const e=this.posTracker.droppedBufferSize,r=t.startOffset-e,i=t.endOffset-e;return this.tokenizer.preprocessor.html.slice(r,i)}_handleToken(t){super._handleToken(t)||this.emitRaw(this._getRawHtml(t.location)),this.parserFeedbackSimulator.skipNextNewLine=!1}_emitToken(t,e){this.emit(t,e,this._getRawHtml(e.sourceCodeLocation))}emitDoctype(t){let e="",this.push(e)}emitStartTag(t){let e="<"+t.tagName;const r=t.attrs;for(let t=0;t":">",this.push(e)}emitEndTag(t){this.push(`${t.tagName}>`)}emitText({text:t}){this.push(n(t,!1))}emitComment(t){this.push(`\x3c!--${t.text}--\x3e`)}emitRaw(t){this.push(t)}}},function(t,e,r){t.exports=r(78).BrotliDecompressBuffer},function(t,e,r){"use strict";!function(){var e,i,n,s=0,o=[];for(i=0;i<256;i++)o[i]=(i+256).toString(16).substr(1);function a(){var t,r=(t=16,(!e||s+t>u.BUFFER_SIZE)&&(s=0,e=u.randomBytes(u.BUFFER_SIZE)),e.slice(s,s+=t));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,r}function u(){var t=a();return o[t[0]]+o[t[1]]+o[t[2]]+o[t[3]]+"-"+o[t[4]]+o[t[5]]+"-"+o[t[6]]+o[t[7]]+"-"+o[t[8]]+o[t[9]]+"-"+o[t[10]]+o[t[11]]+o[t[12]]+o[t[13]]+o[t[14]]+o[t[15]]}u.BUFFER_SIZE=4096,u.bin=a,u.clearBuffer=function(){e=null,s=0},u.test=function(t){return"string"==typeof t&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)},"undefined"!=typeof crypto?n=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(n=window.msCrypto),n=n||r(159),t.exports=u,u.randomBytes=function(){if(n){if(n.randomBytes)return n.randomBytes;if(n.getRandomValues)return function(t){var e=new Uint8Array(t);return n.getRandomValues(e),e}}return function(t){var e,r=[];for(e=0;e10&&(t="..."+t.substr(-10));var n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},d=function(e){if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,n,r,i,s,o,a,u,c=[],h=0,d=(e=e.replace(/=/g,"")).length,p=0,f=d>>3<<3;p>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1),c[h++]=255&(s<<7|o<<2|a>>>3),c[h++]=255&(a<<5|u);var m=d-f;return 2===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2)):4===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4)):5===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],s=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1)):7===m&&(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],s=l[e.charAt(p++)],o=l[e.charAt(p++)],a=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1),c[h++]=255&(s<<7|o<<2|a>>>3)),c},p=function(e,t){if(!t)return function(e){for(var t,n,r="",i=e.length,s=0,o=0;s191&&t<=223?(n=31&t,o=1):t<=239?(n=15&t,o=2):t<=247?(n=7&t,o=3):h(s,r);for(var a=0;a191)&&h(s,r),n<<=6,n+=63&t;n>=55296&&n<=57343&&h(s,r),n>1114111&&h(s,r),n<=65535?r+=String.fromCharCode(n):(n-=65536,r+=String.fromCharCode(55296+(n>>10)),r+=String.fromCharCode(56320+(1023&n)))}return r}(d(e));if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,i,s,o,a,u,c,p="",f=e.indexOf("=");-1===f&&(f=e.length);for(var m=0,w=f>>3<<3;m>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|u>>>3))+String.fromCharCode(255&(u<<5|c));var g=f-w;return 2===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))):4===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))):5===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],o=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))):7===g&&(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],o=l[e.charAt(m++)],a=l[e.charAt(m++)],u=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|u>>>3))),p},f={encode:function(e,t){var n="string"!=typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?function(e){for(var t,n,r,i,s,o="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s];var h=a-c;return 1===h?(t=e[l],o+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e[l++],n=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e[l++],n=e[l++],r=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e[l++],n=e[l++],r=e[l++],i=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),o}(e):t?function(e){for(var t,n,r,i,s,o="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s];var h=a-c;return 1===h?(t=e.charCodeAt(l),o+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l++),i=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),o}(e):function(e){var t,n,r,i,s,o,a,l=!1,h="",d=0,p=0,f=e.length;do{for(c[0]=c[5],c[1]=c[6],c[2]=c[7],a=p;d>6,c[a++]=128|63&o):o<55296||o>=57344?(c[a++]=224|o>>12,c[a++]=128|o>>6&63,c[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++d)),c[a++]=240|o>>18,c[a++]=128|o>>12&63,c[a++]=128|o>>6&63,c[a++]=128|63&o);a-p,p=a-5,d===f&&++d,d>f&&a<6&&(l=!0),t=c[0],a>4?(n=c[1],r=c[2],i=c[3],s=c[4],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s]):1===a?h+=u[t>>>3]+u[t<<2&31]+"======":2===a?(n=c[1],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===a?(n=c[1],r=c[2],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):(n=c[1],r=c[2],i=c[3],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"=")}while(!l);return h}(e)},decode:p};p.asBytes=d,o?e.exports=f:(s.base32=f,a&&(void 0===(i=function(){return f}.call(f,n,f,e))||(e.exports=i)))}()}).call(this,n(14),n(6))},function(e,t,n){"use strict";var r=n(174),i=n(11),s=n(88),o=n(49),a=n(89),u=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(o[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=r.deflateSetDictionary(this.strm,c)))throw new Error(o[n]);this._dict_set=!0}}function c(e,t){var n=new l(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}l.prototype.push=function(e,t){var n,o,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===u.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(l),a.next_out=0,a.avail_out=l),1!==(n=r.deflate(a,o))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==n);return 4===o?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==o||(this.onEnd(0),a.avail_out=0,!0)},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=l,t.deflate=c,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n(182);var r=/\\(u\{([0-9A-Fa-f]+)\}|u([0-9A-Fa-f]{4})|x([0-9A-Fa-f]{2})|([1-7][0-7]{0,2}|[0-7]{2,3})|(['"tbrnfv0\\]))|\\U([0-9A-Fa-f]{8})/g,i={0:"\0",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v","'":"'",'"':'"',"\\":"\\"},s=function(e){return String.fromCodePoint(parseInt(e,16))};t.default=function(e){return e.replace(r,(function(e,t,n,r,o,a,u,l){return void 0!==n?s(n):void 0!==r?s(r):void 0!==o?s(o):void 0!==a?(c=a,String.fromCodePoint(parseInt(c,8))):void 0!==l?s(l):i[u];var c}))},e.exports=t.default},function(e,t,n){"use strict";e.exports=function(){function e(e,t,n,r,i){return e
0;++f){var b,y=d[f],v=0;r.fillBitWindow(),v+=r.val_>>>r.bit_pos_&15,r.bit_pos_+=_[v].bits,b=_[v].value,m[y]=b,0!==b&&(w-=32>>b,++g)}if(1!==g&&0!==w)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function(e,t,n,r){for(var i=0,s=8,o=0,l=0,c=32768,h=[],d=0;d<32;d++)h.push(new a(0,0));for(u(h,0,5,e,18);i0;){var p,f=0;if(r.readMoreInput(),r.fillBitWindow(),f+=r.val_>>>r.bit_pos_&31,r.bit_pos_+=h[f].bits,(p=255&h[f].value)<16)o=0,n[i++]=p,0!==p&&(s=p,c-=32768>>p);else{var m,w,g=p-14,_=0;if(16===p&&(_=s),l!==_&&(o=0,l=_),m=o,o>0&&(o-=2,o<<=g),i+(w=(o+=r.readBits(g)+3)-m)>t)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var b=0;b>>5]),this.htrees=new Uint32Array(t)}function S(e,t){var n,r,i={num_htrees:null,context_map:null},s=0;t.readMoreInput();var o=i.num_htrees=g(t)+1,u=i.context_map=new Uint8Array(e);if(o<=1)return i;for(t.readBits(1)&&(s=t.readBits(4)+1),n=[],r=0;r<1080;r++)n[r]=new a(0,0);for(v(o+s,n,0,t),r=0;r=e)throw new Error("[DecodeContextMap] i >= context_map_size");u[r]=0,++r}else u[r]=l-s,++r}return t.readBits(1)&&function(e,t){var n,r=new Uint8Array(256);for(n=0;n<256;++n)r[n]=n;for(n=0;n=e&&(a-=e),r[n]=a,i[u+(1&s[l])]=a,++s[l]}function k(e,t,n,r,i,o){var a,u=i+1,l=n&i,c=o.pos_&s.IBUF_MASK;if(t<8||o.bit_pos_+(t<<3)0;)o.readMoreInput(),r[l++]=o.readBits(8),l===u&&(e.write(r,u),l=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)r[l]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++l,--t;if(c+(a=o.bit_end_pos_-o.bit_pos_>>3)>s.IBUF_MASK){for(var h=s.IBUF_MASK+1-c,d=0;d=u){e.write(r,u),l-=u;for(d=0;d=u;){if(a=u-l,o.input_.read(r,l,a)t.buffer.length){var he=new Uint8Array(R+Z);he.set(t.buffer),t.buffer=he}if(O=ce.input_end,W=ce.is_uncompressed,ce.is_metadata)for(D(x);Z>0;--Z)x.readMoreInput(),x.readBits(8);else if(0!==Z)if(W)x.bit_pos_=x.bit_pos_+7&-8,k(t,Z,R,p,d,x),R+=Z;else{for(n=0;n<3;++n)ee[n]=g(x)+1,ee[n]>=2&&(v(ee[n]+2,m,1080*n,x),v(26,_,1080*n,x),Q[n]=E(_,1080*n,x),ne[n]=1);for(x.readMoreInput(),H=(1<<(j=x.readBits(2)))-1,G=(z=16+(x.readBits(4)<0;){var fe,me,we,ge,_e,be,ye,ve,Ee,Ae,xe,Te;for(x.readMoreInput(),0===Q[1]&&(C(ee[1],m,1,$,te,ne,x),Q[1]=E(_,1080,x),J=B[1].htrees[$[1]]),--Q[1],(me=(fe=y(B[1].codes,J,x))>>6)>=2?(me-=2,ye=-1):ye=0,we=c.kInsertRangeLut[me]+(fe>>3&7),ge=c.kCopyRangeLut[me]+(7&fe),_e=c.kInsertLengthPrefixCode[we].offset+x.readBits(c.kInsertLengthPrefixCode[we].nbits),be=c.kCopyLengthPrefixCode[ge].offset+x.readBits(c.kCopyLengthPrefixCode[ge].nbits),P=p[R-1&d],L=p[R-2&d],Ee=0;Ee<_e;++Ee)x.readMoreInput(),0===Q[0]&&(C(ee[0],m,0,$,te,ne,x),Q[0]=E(_,0,x),ie=$[0]<<6,Y=re[$[0]],ue=l.lookupOffsets[Y],le=l.lookupOffsets[Y+1]),se=q[ie+(l.lookup[ue+P]|l.lookup[le+L])],--Q[0],L=P,P=y(B[0].codes,B[0].htrees[se],x),p[R&d]=P,(R&d)===d&&t.write(p,u),++R;if((Z-=_e)<=0)break;if(ye<0)if(x.readMoreInput(),0===Q[2]&&(C(ee[2],m,2,$,te,ne,x),Q[2]=E(_,2160,x),oe=$[2]<<2),--Q[2],ae=X[oe+(255&(be>4?3:be-2))],(ye=y(B[2].codes,B[2].htrees[ae],x))>=z)Te=(ye-=z)&H,ye=z+((Se=(2+(1&(ye>>=j))<<(xe=1+(ye>>1)))-4)+x.readBits(xe)<(I=R=o.minDictionaryWordLength&&be<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+R+" distance: "+ve+" len: "+be+" bytes left: "+Z);var Se=o.offsetsByLength[be],Ce=ve-I-1,ke=o.sizeBitsByLength[be],De=Ce>>ke;if(Se+=(Ce&(1<=f){t.write(p,u);for(var Oe=0;Oe0&&(N[3&F]=ve,++F),be>Z)throw new Error("Invalid backward reference. pos: "+R+" distance: "+ve+" len: "+be+" bytes left: "+Z);for(Ee=0;Eethis.buffer.length&&(n=this.buffer.length-this.pos);for(var r=0;rthis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(e.subarray(0,t),this.pos),this.pos+=t,t},t.BrotliOutput=r},function(e,t,n){var r=n(153);t.init=function(){t.dictionary=r.init()},t.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),t.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),t.minDictionaryWordLength=4,t.maxDictionaryWordLength=24},function(e,t){function n(e,t){this.bits=e,this.value=t}t.HuffmanCode=n;function r(e,t){for(var n=1<>=1;return(e&n-1)+n}function i(e,t,r,i,s){do{e[t+(i-=r)]=new n(s.bits,s.value)}while(i>0)}function s(e,t,n){for(var r=1<0;--y[l])i(e,t+h,d,w,new n(255&l,65535&_[c++])),h=r(h,l);for(f=g-1,p=-1,l=o+1,d=2;l<=15;++l,d<<=1)for(;y[l]>0;--y[l])(h&f)!==p&&(t+=w,g+=w=1<<(m=s(y,l,o)),e[b+(p=h&f)]=new n(m+o&255,t-b-p&65535)),i(e,t+(h>>o),d,w,new n(l-o&255,65535&_[c++])),h=r(h,l);return g}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){for(var i=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{s=s+(i=i+t[r++]|0)|0}while(--o);i%=65521,s%=65521}return i|s<<16|0}},function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}},function(e,t,n){"use strict";var r=n(9),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.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 u(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return u(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n4)l[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&n1?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return u(l,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";e.exports=function(e,t,n,r){for(var i=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){n-=o=n>2e3?2e3:n;do{s=s+(i=i+t[r++]|0)|0}while(--o);i%=65521,s%=65521}return i|s<<16|0}},function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();e.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}},function(e,t,n){"use strict";var r=n(11),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.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 u(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o>>6,t[o++]=128|63&n):n<65536?(t[o++]=224|n>>>12,t[o++]=128|n>>>6&63,t[o++]=128|63&n):(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63,t[o++]=128|n>>>6&63,t[o++]=128|63&n);return t},t.buf2binstring=function(e){return u(e,e.length)},t.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n4)l[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;s>1&&n1?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return u(l,r)},t.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},function(e,t,n){"use strict";e.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}},function(e,t,n){"use strict";var r=n(16);e.exports=new r({include:[n(91)]})},function(e,t,n){"use strict";var r=n(16);e.exports=new r({include:[n(50)],implicit:[n(189),n(190),n(191),n(192)]})},function(e,t,n){"use strict";t.Commented=n(209),t.Diagnose=n(219),t.Decoder=n(37),t.Encoder=n(93),t.Simple=n(28),t.Tagged=n(54),t.Map=n(220),t.comment=t.Commented.comment,t.decodeAll=t.Decoder.decodeAll,t.decodeFirst=t.Decoder.decodeFirst,t.decodeAllSync=t.Decoder.decodeAllSync,t.decodeFirstSync=t.Decoder.decodeFirstSync,t.diagnose=t.Diagnose.diagnose,t.encode=t.Encoder.encode,t.encodeCanonical=t.Encoder.encodeCanonical,t.encodeOne=t.Encoder.encodeOne,t.encodeAsync=t.Encoder.encodeAsync,t.decode=t.Decoder.decodeFirstSync,t.leveldb={decode:t.Decoder.decodeAllSync,encode:t.Encoder.encode,buffer:!0,name:"cbor"},t.hasBigInt=n(17).hasBigInt},function(e,t,n){"use strict";(function(t){const r=n(4),i=n(55),s=n(18).BigNumber,o=n(29),a=(n(54),n(28),n(17)),u=n(12),l=u.MT,c=u.NUMBYTES,h=u.SHIFT32,d=u.SYMS,p=u.TAG,f=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.TWO,m=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.FOUR,w=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.EIGHT,g=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.TRUE,_=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.FALSE,b=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.UNDEFINED,y=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.NULL,v=new s("0x20000000000000"),E=t.from("f97e00","hex"),A=t.from("f9fc00","hex"),x=t.from("f97c00","hex"),T=t.from("f98000","hex"),S=Symbol("CBOR_LOOP_DETECT");class C extends r.Transform{constructor(e){const n=Object.assign({},e,{readableObjectMode:!1,writableObjectMode:!0});super(n),this.canonical=n.canonical,this.encodeUndefined=n.encodeUndefined,this.disallowUndefinedKeys=!!n.disallowUndefinedKeys,this.dateType=null!=n.dateType?n.dateType.toLowerCase():"number","symbol"==typeof n.detectLoops?this.detectLoops=n.detectLoops:this.detectLoops=n.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes=[Array,this._pushArray,Date,this._pushDate,t,this._pushBuffer,Map,this._pushMap,o,this._pushNoFilter,RegExp,this._pushRegexp,Set,this._pushSet,s,this._pushBigNumber,ArrayBuffer,this._pushUint8Array,Uint8ClampedArray,this._pushUint8Array,Uint8Array,this._pushUint8Array,Uint16Array,this._pushArray,Uint32Array,this._pushArray,Int8Array,this._pushArray,Int16Array,this._pushArray,Int32Array,this._pushArray,Float32Array,this._pushFloat32Array,Float64Array,this._pushFloat64Array],i.Url&&this.semanticTypes.push(i.Url,this._pushUrl),i.URL&&this.semanticTypes.push(i.URL,this._pushURL);const r=n.genTypes||[];for(let e=0,t=r.length;e{r.pushAny(e);const n=i.read();r.pushAny(t);const s=i.read();return n.compare(s)});for(const[t,r]of n){if(e.disallowUndefinedKeys&&void 0===t)throw new Error("Invalid Map key: undefined");if(!e.pushAny(t)||!e.pushAny(r))return!1}}else for(const[n,r]of t){if(e.disallowUndefinedKeys&&void 0===n)throw new Error("Invalid Map key: undefined");if(!e.pushAny(n)||!e.pushAny(r))return!1}return!0}_pushUint8Array(e,n){return e._pushBuffer(e,t.from(n))}_pushFloat32Array(e,t){const n=t.length;if(!e._pushInt(n,l.ARRAY))return!1;for(let r=0;r{const n=r[e]||(r[e]=C.encode(e)),i=r[t]||(r[t]=C.encode(t));return n.compare(i)}),!this._pushInt(n.length,l.MAP))return!1;let i;for(let t=0,s=n.length;t{const s=[],o=new C(n);o.on("data",e=>s.push(e)),o.on("error",i),o.on("finish",()=>r(t.concat(s))),o.pushAny(e),o.end()})}}e.exports=C}).call(this,n(3).Buffer)},,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";const r=n(57),{escapeString:i}=n(149);e.exports=class extends r{constructor(){super({sourceCodeLocationInfo:!0}),this.posTracker=this.locInfoMixin.posTracker}_transformChunk(e){super._transformChunk(e)}_getRawHtml(e){const t=this.posTracker.droppedBufferSize,n=e.startOffset-t,r=e.endOffset-t;return this.tokenizer.preprocessor.html.slice(n,r)}_handleToken(e){super._handleToken(e)||this.emitRaw(this._getRawHtml(e.location)),this.parserFeedbackSimulator.skipNextNewLine=!1}_emitToken(e,t){this.emit(e,t,this._getRawHtml(t.sourceCodeLocation))}emitDoctype(e){let t="",this.push(t)}emitStartTag(e){let t="<"+e.tagName;const n=e.attrs;for(let e=0;e":">",this.push(t)}emitEndTag(e){this.push(`${e.tagName}>`)}emitText({text:e}){this.push(i(e,!1))}emitComment(e){this.push(`\x3c!--${e.text}--\x3e`)}emitRaw(e){this.push(e)}}},function(e,t,n){e.exports=n(77).BrotliDecompressBuffer},function(e,t,n){"use strict";var r=n(167),i=n(11),s=n(88),o=n(170),a=n(49),u=n(89),l=n(171),c=Object.prototype.toString;function h(e){if(!(this instanceof h))return new h(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);if(this.header=new l,r.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=s.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=r.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[n])}function d(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(e,t){var n,a,u,l,h,d=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=s.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new i.Buf8(p),d.next_out=0,d.avail_out=p),(n=r.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(n=r.inflateSetDictionary(this.strm,f)),n===o.Z_BUF_ERROR&&!0===m&&(n=o.Z_OK,m=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&n!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(d.output,d.next_out),l=d.next_out-u,h=s.buf2string(d.output,u),d.next_out=l,d.avail_out=p-l,l&&i.arraySet(d.output,d.output,u,l,0),this.onData(h)):this.onData(i.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),d.avail_out=0,!0)},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=h,t.inflate=d,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},t.ungzip=d},function(e,t,n){"use strict";!function(){var t,r,i,s=0,o=[];for(r=0;r<256;r++)o[r]=(r+256).toString(16).substr(1);function a(){var e,n=(e=16,(!t||s+e>u.BUFFER_SIZE)&&(s=0,t=u.randomBytes(u.BUFFER_SIZE)),t.slice(s,s+=e));return n[6]=15&n[6]|64,n[8]=63&n[8]|128,n}function u(){var e=a();return o[e[0]]+o[e[1]]+o[e[2]]+o[e[3]]+"-"+o[e[4]]+o[e[5]]+"-"+o[e[6]]+o[e[7]]+"-"+o[e[8]]+o[e[9]]+"-"+o[e[10]]+o[e[11]]+o[e[12]]+o[e[13]]+o[e[14]]+o[e[15]]}u.BUFFER_SIZE=4096,u.bin=a,u.clearBuffer=function(){t=null,s=0},u.test=function(e){return"string"==typeof e&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(e)},"undefined"!=typeof crypto?i=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(i=window.msCrypto),i=i||n(172),e.exports=u,u.randomBytes=function(){if(i){if(i.randomBytes)return i.randomBytes;if(i.getRandomValues)return function(e){var t=new Uint8Array(e);return i.getRandomValues(t),t}}return function(e){var t,n=[];for(t=0;t=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return j(t).length;default:if(i)return W(t).length;e=(""+e).toLowerCase(),i=!0}}function m(t,e,r){var 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 S(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function w(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}function g(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),r=+r,isNaN(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=u.from(e,i)),u.isBuffer(e))return 0===e.length?-1:y(t,e,r,i,n);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,i,n){var s,o=1,a=t.length,u=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,u/=2,r/=2}function h(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(n){var c=-1;for(s=r;sa&&(r=a-u),s=r;s>=0;s--){for(var l=!0,d=0;dn&&(i=n):i=n;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");i>s/2&&(i=s/2);for(var o=0;o>8,n=r%256,s.push(n),s.push(i);return s}(e,t.length-r),t,r,i)}function x(t,e,r){return 0===e&&r===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,r))}function S(t,e,r){r=Math.min(t.length,r);for(var i=[],n=e;n239?4:h>223?3:h>191?2:1;if(n+l<=r)switch(l){case 1:h<128&&(c=h);break;case 2:128==(192&(s=t[n+1]))&&(u=(31&h)<<6|63&s)>127&&(c=u);break;case 3:s=t[n+1],o=t[n+2],128==(192&s)&&128==(192&o)&&(u=(15&h)<<12|(63&s)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[n+1],o=t[n+2],a=t[n+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(u=(15&h)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,i.push(c>>>10&1023|55296),c=56320|1023&c),i.push(c),n+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",i=0;for(;i0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},u.prototype.compare=function(t,e,r,i,n){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");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;for(var s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(e>>>=0),a=Math.min(s,o),h=this.slice(i,n),c=t.slice(e,r),l=0;ln)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return E(this,t,e,r);case"latin1":case"binary":return v(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(t,e,r){var i="";r=Math.min(t.length,r);for(var n=e;ni)&&(r=i);for(var n="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,i,n,s){if(!u.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 O(t,e,r,i){e<0&&(e=65535+e+1);for(var n=0,s=Math.min(t.length-r,2);n>>8*(i?n:1-n)}function F(t,e,r,i){e<0&&(e=4294967295+e+1);for(var n=0,s=Math.min(t.length-r,4);n>>8*(i?n:3-n)&255}function P(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 B(t,e,r,i,s){return s||P(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function L(t,e,r,i,s){return s||P(t,0,r,8),n.write(t,e,r,i,52,8),r+8}u.prototype.slice=function(t,e){var r,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(n*=256);)i+=this[t+--e]*n;return i},u.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=this[t],n=1,s=0;++s=(n*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||I(t,e,this.length);for(var i=e,n=1,s=this[t+--i];i>0&&(n*=256);)s+=this[t+--i]*n;return s>=(n*=128)&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),n.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),n.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,i){(t=+t,e|=0,r|=0,i)||N(this,t,e,r,Math.pow(2,8*r)-1,0);var n=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+n]=t/s&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):F(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=0,o=1,a=0;for(this[e]=255&t;++s>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,i){if(t=+t,e|=0,!i){var n=Math.pow(2,8*r-1);N(this,t,e,r,n-1,-n)}var s=r-1,o=1,a=0;for(this[e+s]=255&t;--s>=0&&(o*=256);)t<0&&0===a&&0!==this[e+s+1]&&(a=1),this[e+s]=(t/o>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):O(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):O(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):F(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,i){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("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--n)t[n+e]=this[n+r];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(n=0;n>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&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 j(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(U,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function H(t,e,r,i){for(var n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}}).call(this,r(6))},function(t,e,r){t.exports=n;var i=r(41).EventEmitter;function n(){i.call(this)}r(13)(n,i),n.Readable=r(42),n.Writable=r(133),n.Duplex=r(134),n.Transform=r(135),n.PassThrough=r(136),n.Stream=n,n.prototype.pipe=function(t,e){var r=this;function n(e){t.writable&&!1===t.write(e)&&r.pause&&r.pause()}function s(){r.readable&&r.resume&&r.resume()}r.on("data",n),t.on("drain",s),t._isStdio||e&&!1===e.end||(r.on("end",a),r.on("close",u));var o=!1;function a(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function h(t){if(c(),0===i.listenerCount(this,"error"))throw t}function c(){r.removeListener("data",n),t.removeListener("drain",s),r.removeListener("end",a),r.removeListener("close",u),r.removeListener("error",h),t.removeListener("error",h),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("error",h),t.on("error",h),r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t}},function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var i=r(1),n=r(0);const s=new TextDecoder("utf-8");class o{static fromResponse({url:t,response:e,date:r,noRW:n,isLive:s}){const a=e.body?new i.a(e.body.getReader(),!1):null,u=Number(e.headers.get("x-redirect-status")||e.status),h=e.statusText;let c=e.headers;const l=c.get("x-proxy-set-cookie");if(l){const t=[];l.split(",").forEach(e=>{const r=e.split(";",1)[0].trim();r.indexOf("=")>0&&t.push(r)}),t.length&&(c=new Headers(c),c.set("x-wabac-preset-cookie",t.join(";")),console.log("cookies",t.join(";")))}return new o({payload:a,status:u,statusText:h,headers:c,url:t,date:r,noRW:n,isLive:s})}constructor({payload:t,status:e,statusText:r,headers:i,url:n,date:s,extraOpts:o=null,noRW:a=!1,isLive:u=!1}){this.reader=null,this.buffer=null,t&&t[Symbol.asyncIterator]?this.reader=t:this.buffer=t,this.status=e,this.statusText=r,this.headers=i,this.url=n,this.date=s,this.extraOpts=o,this.noRW=a,this.isLive=u}async getText(){const t=await this.getBuffer();return"string"==typeof t?t:s.decode(t)}async getBuffer(){return this.buffer||(this.buffer=await this.reader.readFully()),this.buffer}async setContent(t){t instanceof i.b?(this.reader=t,this.buffer=null):t.getReader?(this.reader=new i.a(t.getReader()),this.buffer=null):(this.reader=null,this.buffer=t)}async*[Symbol.asyncIterator](){this.buffer?yield this.buffer:this.reader&&(yield*this.reader)}setRange(t){const e=t.match(/^bytes\=(\d+)\-(\d+)?$/);let r=0;if(this.buffer)r=this.buffer.length;else if(this.reader&&(r=Number(this.headers.get("content-length")),!r))return;if(!e)return this.status=416,this.statusText="Range Not Satisfiable",this.headers.set("Content-Range","*/"+r),!1;const i=Number(e[1]),n=Number(e[2])||r-1;return this.buffer?this.buffer=this.buffer.slice(i,n+1):this.reader&&(0===i&&n===r-1||this.reader.setLimitSkip(n-i+1,i)),this.headers.set("Content-Range",`bytes ${i}-${n}/${r}`),this.headers.set("Content-Length",n-i+1),this.status=206,this.statusText="Partial Content",!0}makeResponse(){let t=null;Object(n.i)(this.status)||(t=this.buffer||!this.reader?this.buffer:this.reader.getReadableStream());const e=new Response(t,{status:this.status,statusText:this.statusText,headers:this.headers});return e.date=this.date,e}}},function(t,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(t){"object"==typeof window&&(r=window)}t.exports=r},function(t,e,r){"use strict";const i=":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",n="["+i+"][: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]*",s=new RegExp("^"+n+"$");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;s0||t===e?e:e-1}function m(t){for(var e,r,i=1,n=t.length,s=t[0]+"";ih^r?1:-1;for(a=(u=n.length)<(h=s.length)?u:h,o=0;os[o]^r?1:-1;return u==h?0:u>h^r?1:-1}function g(t,e,r,i){if(tr||t!==u(t))throw Error(h+(i||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function y(t){var e=t.c.length-1;return p(t.e/14)==e&&t.c[e]%2!=0}function _(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function b(t,e,r){var i,n;if(e<0){for(n=r+".";++e;n+=r);t=n+t}else if(++e>(i=t.length)){for(n=r,e-=i;--e;n+=r);t+=n}else eO?m.c=m.e=null:t.e=10;l/=10,h++);return void(h>O?m.c=m.e=null:(m.e=h,m.c=[t]))}p=String(t)}else{if(!o.test(p=String(t)))return n(m,p,d);m.s=45==p.charCodeAt(0)?(p=p.slice(1),-1):1}(h=p.indexOf("."))>-1&&(p=p.replace(".","")),(l=p.search(/e/i))>0?(h<0&&(h=l),h+=+p.slice(l+1),p=p.substring(0,l)):h<0&&(h=p.length)}else{if(g(e,2,U.length,"Base"),10==e)return z(m=new M(t),D+m.e+1,k);if(p=String(t),d="number"==typeof t){if(0*t!=0)return n(m,p,d,e);if(m.s=1/t<0?(p=p.slice(1),-1):1,M.DEBUG&&p.replace(/^0\.0*|\./,"").length>15)throw Error(c+t)}else m.s=45===p.charCodeAt(0)?(p=p.slice(1),-1):1;for(r=U.slice(0,e),h=l=0,f=p.length;lh){h=f;continue}}else if(!a&&(p==p.toUpperCase()&&(p=p.toLowerCase())||p==p.toLowerCase()&&(p=p.toUpperCase()))){a=!0,l=-1,h=0;continue}return n(m,String(t),d,e)}d=!1,(h=(p=i(p,e,10,m.s)).indexOf("."))>-1?p=p.replace(".",""):h=p.length}for(l=0;48===p.charCodeAt(l);l++);for(f=p.length;48===p.charCodeAt(--f););if(p=p.slice(l,++f)){if(f-=l,d&&M.DEBUG&&f>15&&(t>9007199254740991||t!==u(t)))throw Error(c+m.s*t);if((h=h-l-1)>O)m.c=m.e=null;else if(h=I)?_(u,o):b(u,o,"0");else if(s=(t=z(new M(t),e,r)).e,a=(u=m(t.c)).length,1==i||2==i&&(e<=s||s<=R)){for(;aa){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=s-a)>0)for(s+1==a&&(u+=".");e--;u+="0");return t.s<0&&n?"-"+u:u}function j(t,e){for(var r,i=1,n=new M(t[0]);i=10;n/=10,i++);return(r=i+14*r-1)>O?t.c=t.e=null:r=10;h/=10,n++);if((s=e-n)<0)s+=14,o=e,p=(c=m[f=0])/w[n-o-1]%10|0;else if((f=a((s+1)/14))>=m.length){if(!i)break t;for(;m.length<=f;m.push(0));c=p=0,n=1,o=(s%=14)-14+1}else{for(c=h=m[f],n=1;h>=10;h/=10,n++);p=(o=(s%=14)-14+n)<0?0:c/w[n-o-1]%10|0}if(i=i||e<0||null!=m[f+1]||(o<0?c:c%w[n-o-1]),i=r<4?(p||i)&&(0==r||r==(t.s<0?3:2)):p>5||5==p&&(4==r||i||6==r&&(s>0?o>0?c/w[n-o]:0:m[f-1])%10&1||r==(t.s<0?8:7)),e<1||!m[0])return m.length=0,i?(e-=t.e+1,m[0]=w[(14-e%14)%14],t.e=-e||0):m[0]=t.e=0,t;if(0==s?(m.length=f,h=1,f--):(m.length=f+1,h=w[14-s],m[f]=o>0?u(c/w[n-o]%w[o])*h:0),i)for(;;){if(0==f){for(s=1,o=m[0];o>=10;o/=10,s++);for(o=m[0]+=h,h=1;o>=10;o/=10,h++);s!=h&&(t.e++,m[0]==l&&(m[0]=1));break}if(m[f]+=h,m[f]!=l)break;m[f--]=0,h=1}for(s=m.length;0===m[--s];m.pop());}t.e>O?t.c=t.e=null:t.e=I?_(e,r):b(e,r,"0"),t.s<0?"-"+e:e)}return M.clone=t,M.ROUND_UP=0,M.ROUND_DOWN=1,M.ROUND_CEIL=2,M.ROUND_FLOOR=3,M.ROUND_HALF_UP=4,M.ROUND_HALF_DOWN=5,M.ROUND_HALF_EVEN=6,M.ROUND_HALF_CEIL=7,M.ROUND_HALF_FLOOR=8,M.EUCLID=9,M.config=M.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(g(r=t[e],0,f,e),D=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(g(r=t[e],0,8,e),k=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(g(r[0],-f,0,e),g(r[1],0,f,e),R=r[0],I=r[1]):(g(r,-f,f,e),R=-(I=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)g(r[0],-f,-1,e),g(r[1],1,f,e),N=r[0],O=r[1];else{if(g(r,-f,f,e),!r)throw Error(h+e+" cannot be zero: "+r);N=-(O=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(h+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw F=!r,Error(h+"crypto unavailable");F=r}else F=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(g(r=t[e],0,9,e),P=r),t.hasOwnProperty(e="POW_PRECISION")&&(g(r=t[e],0,f,e),B=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(h+e+" not an object: "+r);L=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.$|[+-.\s]|(.).*\1/.test(r))throw Error(h+e+" invalid: "+r);U=r}}return{DECIMAL_PLACES:D,ROUNDING_MODE:k,EXPONENTIAL_AT:[R,I],RANGE:[N,O],CRYPTO:F,MODULO_MODE:P,POW_PRECISION:B,FORMAT:L,ALPHABET:U}},M.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!M.DEBUG)return!0;var e,r,i=t.c,n=t.e,s=t.s;t:if("[object Array]"=={}.toString.call(i)){if((1===s||-1===s)&&n>=-f&&n<=f&&n===u(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break t}if((e=(n+1)%14)<1&&(e+=14),String(i[0]).length==e){for(e=0;e=l||r!==u(r))break t;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(h+"Invalid BigNumber: "+t)},M.maximum=M.max=function(){return j(arguments,S.lt)},M.minimum=M.min=function(){return j(arguments,S.gt)},M.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,i,n,o,c=0,l=[],p=new M(C);if(null==t?t=D:g(t,0,f),n=a(t/14),F)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(n*=2));c>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[c]=r[0],e[c+1]=r[1]):(l.push(o%1e14),c+=2);c=n/2}else{if(!crypto.randomBytes)throw F=!1,Error(h+"crypto unavailable");for(e=crypto.randomBytes(n*=7);c=9e15?crypto.randomBytes(7).copy(e,c):(l.push(o%1e14),c+=7);c=n/7}if(!F)for(;c=10;o/=10,c++);c<14&&(i-=14-c)}return p.e=i,p.c=l,p}),M.sum=function(){for(var t=1,e=arguments,r=new M(e[0]);tr-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}return function(e,i,n,s,o){var a,u,h,c,l,d,f,p,w=e.indexOf("."),g=D,y=k;for(w>=0&&(c=B,B=0,e=e.replace(".",""),d=(p=new M(i)).pow(e.length-w),B=c,p.c=t(b(m(d.c),d.e,"0"),10,n,"0123456789"),p.e=p.c.length),h=c=(f=t(e,i,n,o?(a=U,"0123456789"):(a="0123456789",U))).length;0==f[--c];f.pop());if(!f[0])return a.charAt(0);if(w<0?--h:(d.c=f,d.e=h,d.s=s,f=(d=r(d,p,g,y,n)).c,l=d.r,h=d.e),w=f[u=h+g+1],c=n/2,l=l||u<0||null!=f[u+1],l=y<4?(null!=w||l)&&(0==y||y==(d.s<0?3:2)):w>c||w==c&&(4==y||l||6==y&&1&f[u-1]||y==(d.s<0?8:7)),u<1||!f[0])e=l?b(a.charAt(1),-g,a.charAt(0)):a.charAt(0);else{if(f.length=u,l)for(--n;++f[--u]>n;)f[u]=0,u||(++h,f=[1].concat(f));for(c=f.length;!f[--c];);for(w=0,e="";w<=c;e+=a.charAt(f[w++]));e=b(e,h,a.charAt(0))}return e}}(),r=function(){function t(t,e,r){var i,n,s,o,a=0,u=t.length,h=e%1e7,c=e/1e7|0;for(t=t.slice();u--;)a=((n=h*(s=t[u]%1e7)+(i=c*s+(o=t[u]/1e7|0)*h)%1e7*1e7+a)/r|0)+(i/1e7|0)+c*o,t[u]=n%r;return a&&(t=[a].concat(t)),t}function e(t,e,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;ne[n]?1:-1;break}return s}function r(t,e,r,i){for(var n=0;r--;)t[r]-=n,n=t[r]1;t.splice(0,1));}return function(i,n,s,o,a){var h,c,d,f,m,w,g,y,_,b,E,v,A,T,x,S,C,D=i.s==n.s?1:-1,k=i.c,R=n.c;if(!(k&&k[0]&&R&&R[0]))return new M(i.s&&n.s&&(k?!R||k[0]!=R[0]:R)?k&&0==k[0]||!R?0*D:D/0:NaN);for(_=(y=new M(D)).c=[],D=s+(c=i.e-n.e)+1,a||(a=l,c=p(i.e/14)-p(n.e/14),D=D/14|0),d=0;R[d]==(k[d]||0);d++);if(R[d]>(k[d]||0)&&c--,D<0)_.push(1),f=!0;else{for(T=k.length,S=R.length,d=0,D+=2,(m=u(a/(R[0]+1)))>1&&(R=t(R,m,a),k=t(k,m,a),S=R.length,T=k.length),A=S,E=(b=k.slice(0,S)).length;E=a/2&&x++;do{if(m=0,(h=e(R,b,S,E))<0){if(v=b[0],S!=E&&(v=v*a+(b[1]||0)),(m=u(v/x))>1)for(m>=a&&(m=a-1),g=(w=t(R,m,a)).length,E=b.length;1==e(w,b,g,E);)m--,r(w,S=10;D/=10,d++);z(y,s+(y.e=d+14*c-1)+1,o,f)}else y.e=c,y.r=+f;return y}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,A=/^\.([^.]+)$/,T=/^-?(Infinity|NaN)$/,x=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(t,e,r,i){var n,s=r?e:e.replace(x,"");if(T.test(s))t.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(E,(function(t,e,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?t:e})),i&&(n=i,s=s.replace(v,"$1").replace(A,"0.$1")),e!=s))return new M(s,n);if(M.DEBUG)throw Error(h+"Not a"+(i?" base "+i:"")+" number: "+e);t.s=null}t.c=t.e=null},S.absoluteValue=S.abs=function(){var t=new M(this);return t.s<0&&(t.s=1),t},S.comparedTo=function(t,e){return w(this,new M(t,e))},S.decimalPlaces=S.dp=function(t,e){var r,i,n,s=this;if(null!=t)return g(t,0,f),null==e?e=k:g(e,0,8),z(new M(s),t+s.e+1,e);if(!(r=s.c))return null;if(i=14*((n=r.length-1)-p(this.e/14)),n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},S.dividedBy=S.div=function(t,e){return r(this,new M(t,e),D,k)},S.dividedToIntegerBy=S.idiv=function(t,e){return r(this,new M(t,e),0,1)},S.exponentiatedBy=S.pow=function(t,e){var r,i,n,s,o,c,l,d,f=this;if((t=new M(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+G(t));if(null!=e&&(e=new M(e)),o=t.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!t.c||!t.c[0])return d=new M(Math.pow(+G(f),o?2-y(t):+G(t))),e?d.mod(e):d;if(c=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new M(NaN);(i=!c&&f.isInteger()&&e.isInteger())&&(f=f.mod(e))}else{if(t.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||o&&f.c[1]>=24e7:f.c[0]<8e13||o&&f.c[0]<=9999975e7)))return s=f.s<0&&y(t)?-0:0,f.e>-1&&(s=1/s),new M(c?1/s:s);B&&(s=a(B/14+2))}for(o?(r=new M(.5),c&&(t.s=1),l=y(t)):l=(n=Math.abs(+G(t)))%2,d=new M(C);;){if(l){if(!(d=d.times(f)).c)break;s?d.c.length>s&&(d.c.length=s):i&&(d=d.mod(e))}if(n){if(0===(n=u(n/2)))break;l=n%2}else if(z(t=t.times(r),t.e+1,1),t.e>14)l=y(t);else{if(0===(n=+G(t)))break;l=n%2}f=f.times(f),s?f.c&&f.c.length>s&&(f.c.length=s):i&&(f=f.mod(e))}return i?d:(c&&(d=C.div(d)),e?d.mod(e):s?z(d,B,k,void 0):d)},S.integerValue=function(t){var e=new M(this);return null==t?t=k:g(t,0,8),z(e,e.e+1,t)},S.isEqualTo=S.eq=function(t,e){return 0===w(this,new M(t,e))},S.isFinite=function(){return!!this.c},S.isGreaterThan=S.gt=function(t,e){return w(this,new M(t,e))>0},S.isGreaterThanOrEqualTo=S.gte=function(t,e){return 1===(e=w(this,new M(t,e)))||0===e},S.isInteger=function(){return!!this.c&&p(this.e/14)>this.c.length-2},S.isLessThan=S.lt=function(t,e){return w(this,new M(t,e))<0},S.isLessThanOrEqualTo=S.lte=function(t,e){return-1===(e=w(this,new M(t,e)))||0===e},S.isNaN=function(){return!this.s},S.isNegative=function(){return this.s<0},S.isPositive=function(){return this.s>0},S.isZero=function(){return!!this.c&&0==this.c[0]},S.minus=function(t,e){var r,i,n,s,o=this,a=o.s;if(e=(t=new M(t,e)).s,!a||!e)return new M(NaN);if(a!=e)return t.s=-e,o.plus(t);var u=o.e/14,h=t.e/14,c=o.c,d=t.c;if(!u||!h){if(!c||!d)return c?(t.s=-e,t):new M(d?o:NaN);if(!c[0]||!d[0])return d[0]?(t.s=-e,t):new M(c[0]?o:3==k?-0:0)}if(u=p(u),h=p(h),c=c.slice(),a=u-h){for((s=a<0)?(a=-a,n=c):(h=u,n=d),n.reverse(),e=a;e--;n.push(0));n.reverse()}else for(i=(s=(a=c.length)<(e=d.length))?a:e,a=e=0;e0)for(;e--;c[r++]=0);for(e=l-1;i>a;){if(c[--i]=0;){for(r=0,f=b[n]%1e7,m=b[n]/1e7|0,s=n+(o=u);s>n;)r=((h=f*(h=_[--o]%1e7)+(a=m*h+(c=_[o]/1e7|0)*f)%1e7*1e7+w[s]+r)/g|0)+(a/1e7|0)+m*c,w[s--]=h%g;w[s]=r}return r?++i:w.splice(0,1),H(t,w,i)},S.negated=function(){var t=new M(this);return t.s=-t.s||null,t},S.plus=function(t,e){var r,i=this,n=i.s;if(e=(t=new M(t,e)).s,!n||!e)return new M(NaN);if(n!=e)return t.s=-e,i.minus(t);var s=i.e/14,o=t.e/14,a=i.c,u=t.c;if(!s||!o){if(!a||!u)return new M(n/0);if(!a[0]||!u[0])return u[0]?t:new M(a[0]?i:0*n)}if(s=p(s),o=p(o),a=a.slice(),n=s-o){for(n>0?(o=s,r=u):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(e=u.length)<0&&(r=u,u=a,a=r,e=n),n=0;e;)n=(a[--e]=a[e]+u[e]+n)/l|0,a[e]=l===a[e]?0:a[e]%l;return n&&(a=[n].concat(a),++o),H(t,a,o)},S.precision=S.sd=function(t,e){var r,i,n,s=this;if(null!=t&&t!==!!t)return g(t,1,f),null==e?e=k:g(e,0,8),z(new M(s),t,e);if(!(r=s.c))return null;if(i=14*(n=r.length-1)+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return t&&s.e+1>i&&(i=s.e+1),i},S.shiftedBy=function(t){return g(t,-9007199254740991,9007199254740991),this.times("1e"+t)},S.squareRoot=S.sqrt=function(){var t,e,i,n,s,o=this,a=o.c,u=o.s,h=o.e,c=D+4,l=new M("0.5");if(1!==u||!a||!a[0])return new M(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(u=Math.sqrt(+G(o)))||u==1/0?(((e=m(a)).length+h)%2==0&&(e+="0"),u=Math.sqrt(+e),h=p((h+1)/2)-(h<0||h%2),i=new M(e=u==1/0?"1e"+h:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+h)):i=new M(u+""),i.c[0])for((u=(h=i.e)+c)<3&&(u=0);;)if(s=i,i=l.times(s.plus(r(o,s,c,1))),m(s.c).slice(0,u)===(e=m(i.c)).slice(0,u)){if(i.e0&&m>0){for(s=m%a||a,l=p.substr(0,s);s0&&(l+=c+p.slice(s)),f&&(l="-"+l)}i=d?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?d.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):d):l}return(r.prefix||"")+i+(r.suffix||"")},S.toFraction=function(t){var e,i,n,s,o,a,u,c,l,f,p,w,g=this,y=g.c;if(null!=t&&(!(u=new M(t)).isInteger()&&(u.c||1!==u.s)||u.lt(C)))throw Error(h+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+G(u));if(!y)return new M(g);for(e=new M(C),l=i=new M(C),n=c=new M(C),w=m(y),o=e.e=w.length-g.e-1,e.c[0]=d[(a=o%14)<0?14+a:a],t=!t||u.comparedTo(e)>0?o>0?e:l:u,a=O,O=1/0,u=new M(w),c.c[0]=0;f=r(u,e,0,1),1!=(s=i.plus(f.times(n))).comparedTo(t);)i=n,n=s,l=c.plus(f.times(s=l)),c=s,e=u.minus(f.times(s=e)),u=s;return s=r(t.minus(i),n,0,1),c=c.plus(s.times(l)),i=i.plus(s.times(n)),c.s=l.s=g.s,p=r(l,n,o*=2,k).minus(g).abs().comparedTo(r(c,i,o,k).minus(g).abs())<1?[l,n]:[c,i],O=a,p},S.toNumber=function(){return+G(this)},S.toPrecision=function(t,e){return null!=t&&g(t,1,f),W(this,t,e,2)},S.toString=function(t){var e,r=this,n=r.s,s=r.e;return null===s?n?(e="Infinity",n<0&&(e="-"+e)):e="NaN":(null==t?e=s<=R||s>=I?_(m(r.c),s):b(m(r.c),s,"0"):10===t?e=b(m((r=z(new M(r),D+s+1,k)).c),r.e,"0"):(g(t,2,U.length,"Base"),e=i(b(m(r.c),s,"0"),10,t,n,!0)),n<0&&r.c[0]&&(e="-"+e)),e},S.valueOf=S.toJSON=function(){return G(this)},S._isBigNumber=!0,null!=e&&M.set(e),M}()).default=s.BigNumber=s,void 0===(i=function(){return s}.call(e,r,e,t))||(t.exports=i)}()},function(t,e,r){"use strict";const i=r(11).BigNumber;e.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},e.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},e.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},e.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},e.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},e.SHIFT32=4294967296,e.BI={MINUS_ONE:-1,MAXINT32:4294967295,MAXINT64:"0xffffffffffffffff",SHIFT32:e.SHIFT32};const n=new i(-1);e.BN={MINUS_ONE:n,NEG_MAX:n.minus(new i(Number.MAX_SAFE_INTEGER.toString(16),16)),MAXINT:new i("0x20000000000000"),MAXINT32:new i(4294967295),MAXINT64:new i("0xffffffffffffffff"),SHIFT32:new i(e.SHIFT32)}},function(t,e){"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}}},function(t,e){var r,i,n=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(r===setTimeout)return setTimeout(t,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(t){r=s}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();var u,h=[],c=!1,l=-1;function d(){c&&u&&(c=!1,u.length?h=u.concat(h):l=-1,h.length&&f())}function f(){if(!c){var t=a(d);c=!0;for(var e=h.length;e;){for(u=h,h=[];++l1)for(var r=1;rt.decode(e),e.utf8.checksUTF8=!0}else e.utf8=t=>t.toString("utf8"),e.utf8.checksUTF8=!1;e.parseCBORint=function(t,e){switch(t){case o.ONE:return e.readUInt8(0);case o.TWO:return e.readUInt16BE(0);case o.FOUR:return e.readUInt32BE(0);case o.EIGHT:const r=e.readUInt32BE(0),i=e.readUInt32BE(4);return r>2097151?new n(r).times(a).plus(i):r*a+i;default:throw new Error("Invalid additional info for int: "+t)}},e.writeHalf=function(e,r){const i=t.allocUnsafe(4);i.writeFloatBE(r,0);const n=i.readUInt32BE(0);if(0!=(8191&n))return!1;let s=n>>16&32768;const o=n>>23&255,a=8388607&n;if(o>=113&&o<=142)s+=(o-112<<10)+(a>>13);else{if(!(o>=103&&o<113))return!1;if(a&(1<<126-o)-1)return!1;s+=a+8388608>>126-o}return e.writeUInt16BE(s),!0},e.parseHalf=function(t){const e=128&t[0]?-1:1,r=(124&t[0])>>2,i=(3&t[0])<<8|t[1];return r?31===r?e*(i?NaN:Infinity):e*Math.pow(2,r-25)*(1024+i):5.960464477539063e-8*e*i},e.parseCBORfloat=function(t){switch(t.length){case 2:return e.parseHalf(t);case 4:return t.readFloatBE(0);case 8:return t.readDoubleBE(0);default:throw new Error("Invalid float size: "+t.length)}},e.hex=function(e){return t.from(e.replace(/^0x/,""),"hex")},e.bin=function(e){let r=0,i=(e=e.replace(/\s/g,"")).length%8||8;const n=[];for(;i<=e.length;)n.push(parseInt(e.slice(r,i),2)),r=i,i+=8;return t.from(n)},e.extend=function(t={},...e){const r=e.length;for(let i=0;it===e[r]))},e.bufferEqual=function(e,r){if(null==e&&null==r)return!0;if(null==e||null==r)return!1;if(!t.isBuffer(e)||!t.isBuffer(r)||e.length!==r.length)return!1;const i=e.length;let n,s,o=!0;for(n=s=0;s=1e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=1e3} records`)),this.batch.push(t)}async finishIndexing(){this.batch.length>0&&this.promises.push(this.db.addResources(this.batch)),console.log(`Indexed ${this.count+=this.batch.length} records`),this._finishLoad();try{await Promise.all(this.promises)}catch(t){console.warn(t)}this.promises=[]}_finishLoad(){}}},,,function(t,e,r){(function(t){function r(t){return Object.prototype.toString.call(t)}e.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===r(t)},e.isBoolean=function(t){return"boolean"==typeof t},e.isNull=function(t){return null===t},e.isNullOrUndefined=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isString=function(t){return"string"==typeof t},e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=function(t){return void 0===t},e.isRegExp=function(t){return"[object RegExp]"===r(t)},e.isObject=function(t){return"object"==typeof t&&null!==t},e.isDate=function(t){return"[object Date]"===r(t)},e.isError=function(t){return"[object Error]"===r(t)||t instanceof Error},e.isFunction=function(t){return"function"==typeof t},e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=t.isBuffer}).call(this,r(3).Buffer)},function(t,e,r){"use strict";const i=e.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};e.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"},e.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};const n=e.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};e.SPECIAL_ELEMENTS={[i.HTML]:{[n.ADDRESS]:!0,[n.APPLET]:!0,[n.AREA]:!0,[n.ARTICLE]:!0,[n.ASIDE]:!0,[n.BASE]:!0,[n.BASEFONT]:!0,[n.BGSOUND]:!0,[n.BLOCKQUOTE]:!0,[n.BODY]:!0,[n.BR]:!0,[n.BUTTON]:!0,[n.CAPTION]:!0,[n.CENTER]:!0,[n.COL]:!0,[n.COLGROUP]:!0,[n.DD]:!0,[n.DETAILS]:!0,[n.DIR]:!0,[n.DIV]:!0,[n.DL]:!0,[n.DT]:!0,[n.EMBED]:!0,[n.FIELDSET]:!0,[n.FIGCAPTION]:!0,[n.FIGURE]:!0,[n.FOOTER]:!0,[n.FORM]:!0,[n.FRAME]:!0,[n.FRAMESET]:!0,[n.H1]:!0,[n.H2]:!0,[n.H3]:!0,[n.H4]:!0,[n.H5]:!0,[n.H6]:!0,[n.HEAD]:!0,[n.HEADER]:!0,[n.HGROUP]:!0,[n.HR]:!0,[n.HTML]:!0,[n.IFRAME]:!0,[n.IMG]:!0,[n.INPUT]:!0,[n.LI]:!0,[n.LINK]:!0,[n.LISTING]:!0,[n.MAIN]:!0,[n.MARQUEE]:!0,[n.MENU]:!0,[n.META]:!0,[n.NAV]:!0,[n.NOEMBED]:!0,[n.NOFRAMES]:!0,[n.NOSCRIPT]:!0,[n.OBJECT]:!0,[n.OL]:!0,[n.P]:!0,[n.PARAM]:!0,[n.PLAINTEXT]:!0,[n.PRE]:!0,[n.SCRIPT]:!0,[n.SECTION]:!0,[n.SELECT]:!0,[n.SOURCE]:!0,[n.STYLE]:!0,[n.SUMMARY]:!0,[n.TABLE]:!0,[n.TBODY]:!0,[n.TD]:!0,[n.TEMPLATE]:!0,[n.TEXTAREA]:!0,[n.TFOOT]:!0,[n.TH]:!0,[n.THEAD]:!0,[n.TITLE]:!0,[n.TR]:!0,[n.TRACK]:!0,[n.UL]:!0,[n.WBR]:!0,[n.XMP]:!0},[i.MATHML]:{[n.MI]:!0,[n.MO]:!0,[n.MN]:!0,[n.MS]:!0,[n.MTEXT]:!0,[n.ANNOTATION_XML]:!0},[i.SVG]:{[n.TITLE]:!0,[n.FOREIGN_OBJECT]:!0,[n.DESC]:!0}}},function(t,e,r){"use strict";function i(t,e){Error.call(this),this.name="YAMLException",this.reason=t,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i.prototype.toString=function(t){var e=this.name+": ";return e+=this.reason||"(unknown reason)",!t&&this.mark&&(e+=" "+this.mark.toString()),e},t.exports=i},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(87)],implicit:[r(178),r(179)],explicit:[r(180),r(181),r(182),r(183)]})},function(t,e,r){(function(t){var i=Object.getOwnPropertyDescriptors||function(t){for(var e=Object.keys(t),r={},i=0;i=s)return t;switch(t){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(t){return"[Circular]"}default:return t}})),u=i[r];r=3&&(i.depth=arguments[2]),arguments.length>=4&&(i.colors=arguments[3]),p(r)?i.showHidden=r:r&&e._extend(i,r),y(i.showHidden)&&(i.showHidden=!1),y(i.depth)&&(i.depth=2),y(i.colors)&&(i.colors=!1),y(i.customInspect)&&(i.customInspect=!0),i.colors&&(i.stylize=u),c(i,t,i.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function h(t,e){return t}function c(t,r,i){if(t.customInspect&&r&&A(r.inspect)&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var n=r.inspect(i,t);return g(n)||(n=c(t,n,i)),n}var s=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(w(e))return t.stylize(""+e,"number");if(p(e))return t.stylize(""+e,"boolean");if(m(e))return t.stylize("null","null")}(t,r);if(s)return s;var o=Object.keys(r),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(r)),v(r)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return l(r);if(0===o.length){if(A(r)){var u=r.name?": "+r.name:"";return t.stylize("[Function"+u+"]","special")}if(_(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(E(r))return t.stylize(Date.prototype.toString.call(r),"date");if(v(r))return l(r)}var h,b="",T=!1,x=["{","}"];(f(r)&&(T=!0,x=["[","]"]),A(r))&&(b=" [Function"+(r.name?": "+r.name:"")+"]");return _(r)&&(b=" "+RegExp.prototype.toString.call(r)),E(r)&&(b=" "+Date.prototype.toUTCString.call(r)),v(r)&&(b=" "+l(r)),0!==o.length||T&&0!=r.length?i<0?_(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special"):(t.seen.push(r),h=T?function(t,e,r,i,n){for(var s=[],o=0,a=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(h,b,x)):x[0]+b+x[1]}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function d(t,e,r,i,n,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(e,n)||{value:e[n]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),D(i,n)||(o="["+n+"]"),a||(t.seen.indexOf(u.value)<0?(a=m(r)?c(t,u.value,null):c(t,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),y(o)){if(s&&n.match(/^\d+$/))return a;(o=JSON.stringify(""+n)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function f(t){return Array.isArray(t)}function p(t){return"boolean"==typeof t}function m(t){return null===t}function w(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function _(t){return b(t)&&"[object RegExp]"===T(t)}function b(t){return"object"==typeof t&&null!==t}function E(t){return b(t)&&"[object Date]"===T(t)}function v(t){return b(t)&&("[object Error]"===T(t)||t instanceof Error)}function A(t){return"function"==typeof t}function T(t){return Object.prototype.toString.call(t)}function x(t){return t<10?"0"+t.toString(10):t.toString(10)}e.debuglog=function(r){if(y(s)&&(s=t.env.NODE_DEBUG||""),r=r.toUpperCase(),!o[r])if(new RegExp("\\b"+r+"\\b","i").test(s)){var i=t.pid;o[r]=function(){var t=e.format.apply(e,arguments);console.error("%s %d: %s",r,i,t)}}else o[r]=function(){};return o[r]},e.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},e.isArray=f,e.isBoolean=p,e.isNull=m,e.isNullOrUndefined=function(t){return null==t},e.isNumber=w,e.isString=g,e.isSymbol=function(t){return"symbol"==typeof t},e.isUndefined=y,e.isRegExp=_,e.isObject=b,e.isDate=E,e.isError=v,e.isFunction=A,e.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},e.isBuffer=r(195);var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function C(){var t=new Date,e=[x(t.getHours()),x(t.getMinutes()),x(t.getSeconds())].join(":");return[t.getDate(),S[t.getMonth()],e].join(" ")}function D(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.log=function(){console.log("%s - %s",C(),e.format.apply(e,arguments))},e.inherits=r(196),e._extend=function(t,e){if(!e||!b(e))return t;for(var r=Object.keys(e),i=r.length;i--;)t[r[i]]=e[r[i]];return t};var k="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function R(t,e){if(!t){var r=new Error("Promise was rejected with a falsy value");r.reason=t,t=r}return e(t)}e.promisify=function(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(k&&t[k]){var e;if("function"!=typeof(e=t[k]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,k,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,r,i=new Promise((function(t,i){e=t,r=i})),n=[],s=0;s255||(0|t)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}toString(){return"simple("+this.value+")"}[i.inspect.custom](t,e){return"simple("+this.value+")"}inspect(t,e){return"simple("+this.value+")"}encodeCBOR(t){return t._pushInt(this.value,s.SIMPLE_FLOAT)}static isSimple(t){return t instanceof u}static decode(t,e=!0,r=!1){switch(t){case o.FALSE:return!1;case o.TRUE:return!0;case o.NULL:return e?null:a.NULL;case o.UNDEFINED:return e?void 0:a.UNDEFINED;case-1:if(!e||!r)throw new Error("Invalid BREAK");return a.BREAK;default:return new u(t)}}}t.exports=u},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(26);class s extends i.Transform{constructor(t,r,i){let n,s;switch(null==i&&(i={}),typeof t){case"object":e.isBuffer(t)?(n=t,null!=r&&"object"==typeof r&&(i=r)):i=t;break;case"string":n=t,null!=r&&"object"==typeof r?i=r:s=r}null==i&&(i={}),null==n&&(n=i.input),null==s&&(s=i.inputEncoding),delete i.input,delete i.inputEncoding;const o=null==i.watchPipe||i.watchPipe;delete i.watchPipe;const a=!!i.readError;delete i.readError,super(i),this.readError=a,o&&this.on("pipe",t=>{const e=t._readableState.objectMode;if(this.length>0&&e!==this._readableState.objectMode)throw new Error("Do not switch objectMode in the middle of the stream");return this._readableState.objectMode=e,this._writableState.objectMode=e}),null!=n&&this.end(n,s)}static isNoFilter(t){return t instanceof this}static compare(t,e){if(!(t instanceof this))throw new TypeError("Arguments must be NoFilters");return t===e?0:t.compare(e)}static concat(t,r){if(!Array.isArray(t))throw new TypeError("list argument must be an Array of NoFilters");if(0===t.length||0===r)return e.alloc(0);null==r&&(r=t.reduce((t,e)=>{if(!(e instanceof s))throw new TypeError("list argument must be an Array of NoFilters");return t+e.length},0));let i=!0,n=!0;const o=t.map(t=>{if(!(t instanceof s))throw new TypeError("list argument must be an Array of NoFilters");const r=t.slice();return e.isBuffer(r)?n=!1:i=!1,r});if(i)return e.concat(o,r);if(n)return[].concat(...o).slice(0,r);throw new Error("Concatenating mixed object and byte streams not supported")}_transform(t,r,i){this._readableState.objectMode||e.isBuffer(t)||(t=e.from(t,r)),this.push(t),i()}_bufArray(){let t=this._readableState.buffer;if(!Array.isArray(t)){let e=t.head;for(t=[];null!=e;)t.push(e.data),e=e.next}return t}read(t){const e=super.read(t);if(null!=e){if(this.emit("read",e),this.readError&&e.length{this.on("finish",()=>{const i=this.read();null==t||e||(e=!0,t(null,i)),r(i)}),this.on("error",r=>{null==t||e||(e=!0,t(r)),i(r)})})}compare(t){if(!(t instanceof s))throw new TypeError("Arguments must be NoFilters");if(this===t)return 0;{const r=this.slice(),i=t.slice();if(e.isBuffer(r)&&e.isBuffer(i))return r.compare(i);throw new Error("Cannot compare streams in object mode")}}equals(t){return 0===this.compare(t)}slice(t,r){if(this._readableState.objectMode)return this._bufArray().slice(t,r);const i=this._bufArray();switch(i.length){case 0:return e.alloc(0);case 1:return i[0].slice(t,r);default:return e.concat(i).slice(t,r)}}get(t){return this.slice()[t]}toJSON(){const t=this.slice();return e.isBuffer(t)?t.toJSON():t}toString(t,r,i){const s=this.slice(r,i);if(!e.isBuffer(s))return JSON.stringify(s);if((!t||"utf8"===t)&&n.TextDecoder){return new n.TextDecoder("utf8",{fatal:!0,ignoreBOM:!0}).decode(s)}return s.toString(t,r,i)}inspect(t,e){return this[n.inspect.custom](t,e)}[n.inspect.custom](t,r){const i=this._bufArray().map(t=>e.isBuffer(t)?(null!=r?r.stylize:void 0)?r.stylize(t.toString("hex"),"string"):t.toString("hex"):n.inspect(t,r)).join(", ");return`${this.constructor.name} [${i}]`}get length(){return this._readableState.length}writeBigInt(t){let r=t.toString(16);if(t<0){const e=BigInt(Math.floor(r.length/2));r=(t=(BigInt(1)<=a.DIGIT_0&&t<=a.DIGIT_9}function f(t){return t>=a.LATIN_CAPITAL_A&&t<=a.LATIN_CAPITAL_Z}function p(t){return t>=a.LATIN_SMALL_A&&t<=a.LATIN_SMALL_Z}function m(t){return p(t)||f(t)}function w(t){return m(t)||d(t)}function g(t){return t>=a.LATIN_CAPITAL_A&&t<=a.LATIN_CAPITAL_F}function y(t){return t>=a.LATIN_SMALL_A&&t<=a.LATIN_SMALL_F}function _(t){return t+32}function b(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(t>>>10&1023|55296)+String.fromCharCode(56320|1023&t))}function E(t){return String.fromCharCode(_(t))}function v(t,e){const r=s[++t];let i=++t,n=i+r-1;for(;i<=n;){const t=i+n>>>1,o=s[t];if(oe))return s[t+r];n=t-1}}return-1}class A{constructor(){this.preprocessor=new i,this.tokenQueue=[],this.allowCDATA=!1,this.state=c,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(t){this._consume(),this._err(t),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this[this.state](t)}return this.tokenQueue.shift()}write(t,e){this.active=!0,this.preprocessor.write(t,e)}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:A.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(t){this.state=t,this._unconsume()}_consumeSequenceIfMatch(t,e,r){let i=0,n=!0;const s=t.length;let o=0,u=e,h=void 0;for(;o0&&(u=this._consume(),i++),u===a.EOF){n=!1;break}if(h=t[o],u!==h&&(r||u!==_(h))){n=!1;break}}if(!n)for(;i--;)this._unconsume();return n}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==u.SCRIPT_STRING.length)return!1;for(let t=0;t0&&this._err(o.endTagWithAttributes),t.selfClosing&&this._err(o.endTagWithTrailingSolidus)),this.tokenQueue.push(t)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(t,e){this.currentCharacterToken&&this.currentCharacterToken.type!==t&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=e:this._createCharacterToken(t,e)}_emitCodePoint(t){let e=A.CHARACTER_TOKEN;l(t)?e=A.WHITESPACE_CHARACTER_TOKEN:t===a.NULL&&(e=A.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(e,b(t))}_emitSeveralCodePoints(t){for(let e=0;e-1;){const t=s[i],n=t<7;n&&1&t&&(e=2&t?[s[++i],s[++i]]:[s[++i]],r=0);const o=this._consume();if(this.tempBuff.push(o),r++,o===a.EOF)break;i=n?4&t?v(i,o):-1:o===t?++i:-1}for(;r--;)this.tempBuff.pop(),this._unconsume();return e}_isCharacterReferenceInAttribute(){return"ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE"===this.returnState||"ATTRIBUTE_VALUE_UNQUOTED_STATE"===this.returnState}_isCharacterReferenceAttributeQuirk(t){if(!t&&this._isCharacterReferenceInAttribute()){const t=this._consume();return this._unconsume(),t===a.EQUALS_SIGN||w(t)}return!1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let t=0;t")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE(t){t===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE"):m(t)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE")):(this._emitChars("<"),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE(t){m(t)?(this._createEndTagToken(),this._reconsumeInState("SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE")):(this._emitChars(""),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE"))}SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE(t){if(f(t))this.currentToken.tagName+=E(t),this.tempBuff.push(t);else if(p(t))this.currentToken.tagName+=b(t),this.tempBuff.push(t);else{if(this.lastStartTagName===this.currentToken.tagName){if(l(t))return void(this.state="BEFORE_ATTRIBUTE_NAME_STATE");if(t===a.SOLIDUS)return void(this.state="SELF_CLOSING_START_TAG_STATE");if(t===a.GREATER_THAN_SIGN)return this._emitCurrentToken(),void(this.state=c)}this._emitChars(""),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}}SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_DOUBLE_ESCAPED_STATE":"SCRIPT_DATA_ESCAPED_STATE",this._emitCodePoint(t)):f(t)?(this.tempBuff.push(_(t)),this._emitCodePoint(t)):p(t)?(this.tempBuff.push(t),this._emitCodePoint(t)):this._reconsumeInState("SCRIPT_DATA_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPED_STATE(t){t===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",this._emitChars("-")):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(t)}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE(t){t===a.HYPHEN_MINUS?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",this._emitChars("-")):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE(t){t===a.HYPHEN_MINUS?this._emitChars("-"):t===a.LESS_THAN_SIGN?(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",this._emitChars("<")):t===a.GREATER_THAN_SIGN?(this.state="SCRIPT_DATA_STATE",this._emitChars(">")):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitChars(n.REPLACEMENT_CHARACTER)):t===a.EOF?(this._err(o.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t))}SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE(t){t===a.SOLIDUS?(this.tempBuff=[],this.state="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",this._emitChars("/")):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?"SCRIPT_DATA_ESCAPED_STATE":"SCRIPT_DATA_DOUBLE_ESCAPED_STATE",this._emitCodePoint(t)):f(t)?(this.tempBuff.push(_(t)),this._emitCodePoint(t)):p(t)?(this.tempBuff.push(t),this._emitCodePoint(t)):this._reconsumeInState("SCRIPT_DATA_DOUBLE_ESCAPED_STATE")}BEFORE_ATTRIBUTE_NAME_STATE(t){l(t)||(t===a.SOLIDUS||t===a.GREATER_THAN_SIGN||t===a.EOF?this._reconsumeInState("AFTER_ATTRIBUTE_NAME_STATE"):t===a.EQUALS_SIGN?(this._err(o.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state="ATTRIBUTE_NAME_STATE"):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}ATTRIBUTE_NAME_STATE(t){l(t)||t===a.SOLIDUS||t===a.GREATER_THAN_SIGN||t===a.EOF?(this._leaveAttrName("AFTER_ATTRIBUTE_NAME_STATE"),this._unconsume()):t===a.EQUALS_SIGN?this._leaveAttrName("BEFORE_ATTRIBUTE_VALUE_STATE"):f(t)?this.currentAttr.name+=E(t):t===a.QUOTATION_MARK||t===a.APOSTROPHE||t===a.LESS_THAN_SIGN?(this._err(o.unexpectedCharacterInAttributeName),this.currentAttr.name+=b(t)):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.name+=n.REPLACEMENT_CHARACTER):this.currentAttr.name+=b(t)}AFTER_ATTRIBUTE_NAME_STATE(t){l(t)||(t===a.SOLIDUS?this.state="SELF_CLOSING_START_TAG_STATE":t===a.EQUALS_SIGN?this.state="BEFORE_ATTRIBUTE_VALUE_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState("ATTRIBUTE_NAME_STATE")))}BEFORE_ATTRIBUTE_VALUE_STATE(t){l(t)||(t===a.QUOTATION_MARK?this.state="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE":t===a.APOSTROPHE?this.state="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.missingAttributeValue),this.state=c,this._emitCurrentToken()):this._reconsumeInState("ATTRIBUTE_VALUE_UNQUOTED_STATE"))}ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE":t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}ATTRIBUTE_VALUE_UNQUOTED_STATE(t){l(t)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):t===a.AMPERSAND?(this.returnState="ATTRIBUTE_VALUE_UNQUOTED_STATE",this.state="CHARACTER_REFERENCE_STATE"):t===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentAttr.value+=n.REPLACEMENT_CHARACTER):t===a.QUOTATION_MARK||t===a.APOSTROPHE||t===a.LESS_THAN_SIGN||t===a.EQUALS_SIGN||t===a.GRAVE_ACCENT?(this._err(o.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=b(t)):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):this.currentAttr.value+=b(t)}AFTER_ATTRIBUTE_VALUE_QUOTED_STATE(t){l(t)?this._leaveAttrValue("BEFORE_ATTRIBUTE_NAME_STATE"):t===a.SOLIDUS?this._leaveAttrValue("SELF_CLOSING_START_TAG_STATE"):t===a.GREATER_THAN_SIGN?(this._leaveAttrValue(c),this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.missingWhitespaceBetweenAttributes),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}SELF_CLOSING_START_TAG_STATE(t){t===a.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInTag),this._emitEOFToken()):(this._err(o.unexpectedSolidusInTag),this._reconsumeInState("BEFORE_ATTRIBUTE_NAME_STATE"))}BOGUS_COMMENT_STATE(t){t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._emitCurrentToken(),this._emitEOFToken()):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):this.currentToken.data+=b(t)}MARKUP_DECLARATION_OPEN_STATE(t){this._consumeSequenceIfMatch(u.DASH_DASH_STRING,t,!0)?(this._createCommentToken(),this.state="COMMENT_START_STATE"):this._consumeSequenceIfMatch(u.DOCTYPE_STRING,t,!1)?this.state="DOCTYPE_STATE":this._consumeSequenceIfMatch(u.CDATA_START_STRING,t,!0)?this.allowCDATA?this.state="CDATA_SECTION_STATE":(this._err(o.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state="BOGUS_COMMENT_STATE"):this._ensureHibernation()||(this._err(o.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState("BOGUS_COMMENT_STATE"))}COMMENT_START_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_START_DASH_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):this._reconsumeInState("COMMENT_STATE")}COMMENT_START_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":t===a.GREATER_THAN_SIGN?(this._err(o.abruptClosingOfEmptyComment),this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_DASH_STATE":t===a.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state="COMMENT_LESS_THAN_SIGN_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.data+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=b(t)}COMMENT_LESS_THAN_SIGN_STATE(t){t===a.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state="COMMENT_LESS_THAN_SIGN_BANG_STATE"):t===a.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE":this._reconsumeInState("COMMENT_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE":this._reconsumeInState("COMMENT_END_DASH_STATE")}COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE(t){t!==a.GREATER_THAN_SIGN&&t!==a.EOF&&this._err(o.nestedComment),this._reconsumeInState("COMMENT_END_STATE")}COMMENT_END_DASH_STATE(t){t===a.HYPHEN_MINUS?this.state="COMMENT_END_STATE":t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_STATE(t){t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EXCLAMATION_MARK?this.state="COMMENT_END_BANG_STATE":t===a.HYPHEN_MINUS?this.currentToken.data+="-":t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState("COMMENT_STATE"))}COMMENT_END_BANG_STATE(t){t===a.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state="COMMENT_END_DASH_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.incorrectlyClosedComment),this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState("COMMENT_STATE"))}DOCTYPE_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_NAME_STATE":t===a.GREATER_THAN_SIGN?this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingWhitespaceBeforeDoctypeName),this._reconsumeInState("BEFORE_DOCTYPE_NAME_STATE"))}BEFORE_DOCTYPE_NAME_STATE(t){l(t)||(f(t)?(this._createDoctypeToken(E(t)),this.state="DOCTYPE_NAME_STATE"):t===a.NULL?(this._err(o.unexpectedNullCharacter),this._createDoctypeToken(n.REPLACEMENT_CHARACTER),this.state="DOCTYPE_NAME_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(b(t)),this.state="DOCTYPE_NAME_STATE"))}DOCTYPE_NAME_STATE(t){l(t)?this.state="AFTER_DOCTYPE_NAME_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):f(t)?this.currentToken.name+=E(t):t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.name+=n.REPLACEMENT_CHARACTER):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=b(t)}AFTER_DOCTYPE_NAME_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(u.PUBLIC_STRING,t,!1)?this.state="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE":this._consumeSequenceIfMatch(u.SYSTEM_STRING,t,!1)?this.state="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE":this._ensureHibernation()||(this._err(o.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE(t){l(t)||(t===a.QUOTATION_MARK?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.publicId="",this.state="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=b(t)}DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.publicId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=b(t)}AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE(t){l(t)?this.state="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE":t===a.GREATER_THAN_SIGN?(this.state=c,this._emitCurrentToken()):t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE(t){l(t)?this.state="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.QUOTATION_MARK?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this._err(o.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE"))}BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE(t){l(t)||(t===a.QUOTATION_MARK?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE"):t===a.APOSTROPHE?(this.currentToken.systemId="",this.state="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE"):t===a.GREATER_THAN_SIGN?(this._err(o.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=c,this._emitCurrentToken()):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE(t){t===a.QUOTATION_MARK?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=b(t)}DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE(t){t===a.APOSTROPHE?this.state="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE":t===a.NULL?(this._err(o.unexpectedNullCharacter),this.currentToken.systemId+=n.REPLACEMENT_CHARACTER):t===a.GREATER_THAN_SIGN?(this._err(o.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=b(t)}AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE(t){l(t)||(t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.EOF?(this._err(o.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(o.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState("BOGUS_DOCTYPE_STATE")))}BOGUS_DOCTYPE_STATE(t){t===a.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=c):t===a.NULL?this._err(o.unexpectedNullCharacter):t===a.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}CDATA_SECTION_STATE(t){t===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_BRACKET_STATE":t===a.EOF?(this._err(o.eofInCdata),this._emitEOFToken()):this._emitCodePoint(t)}CDATA_SECTION_BRACKET_STATE(t){t===a.RIGHT_SQUARE_BRACKET?this.state="CDATA_SECTION_END_STATE":(this._emitChars("]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CDATA_SECTION_END_STATE(t){t===a.GREATER_THAN_SIGN?this.state=c:t===a.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState("CDATA_SECTION_STATE"))}CHARACTER_REFERENCE_STATE(t){this.tempBuff=[a.AMPERSAND],t===a.NUMBER_SIGN?(this.tempBuff.push(t),this.state="NUMERIC_CHARACTER_REFERENCE_STATE"):w(t)?this._reconsumeInState("NAMED_CHARACTER_REFERENCE_STATE"):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}NAMED_CHARACTER_REFERENCE_STATE(t){const e=this._matchNamedCharacterReference(t);if(this._ensureHibernation())this.tempBuff=[a.AMPERSAND];else if(e){const t=this.tempBuff[this.tempBuff.length-1]===a.SEMICOLON;this._isCharacterReferenceAttributeQuirk(t)||(t||this._errOnNextCodePoint(o.missingSemicolonAfterCharacterReference),this.tempBuff=e),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state="AMBIGUOS_AMPERSAND_STATE"}AMBIGUOS_AMPERSAND_STATE(t){w(t)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=b(t):this._emitCodePoint(t):(t===a.SEMICOLON&&this._err(o.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}NUMERIC_CHARACTER_REFERENCE_STATE(t){this.charRefCode=0,t===a.LATIN_SMALL_X||t===a.LATIN_CAPITAL_X?(this.tempBuff.push(t),this.state="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE"):this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_START_STATE")}HEXADEMICAL_CHARACTER_REFERENCE_START_STATE(t){!function(t){return d(t)||g(t)||y(t)}(t)?(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)):this._reconsumeInState("HEXADEMICAL_CHARACTER_REFERENCE_STATE")}DECIMAL_CHARACTER_REFERENCE_START_STATE(t){d(t)?this._reconsumeInState("DECIMAL_CHARACTER_REFERENCE_STATE"):(this._err(o.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}HEXADEMICAL_CHARACTER_REFERENCE_STATE(t){g(t)?this.charRefCode=16*this.charRefCode+t-55:y(t)?this.charRefCode=16*this.charRefCode+t-87:d(t)?this.charRefCode=16*this.charRefCode+t-48:t===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}DECIMAL_CHARACTER_REFERENCE_STATE(t){d(t)?this.charRefCode=10*this.charRefCode+t-48:t===a.SEMICOLON?this.state="NUMERIC_CHARACTER_REFERENCE_END_STATE":(this._err(o.missingSemicolonAfterCharacterReference),this._reconsumeInState("NUMERIC_CHARACTER_REFERENCE_END_STATE"))}NUMERIC_CHARACTER_REFERENCE_END_STATE(){if(this.charRefCode===a.NULL)this._err(o.nullCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(o.characterReferenceOutsideUnicodeRange),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(n.isSurrogate(this.charRefCode))this._err(o.surrogateCharacterReference),this.charRefCode=a.REPLACEMENT_CHARACTER;else if(n.isUndefinedCodePoint(this.charRefCode))this._err(o.noncharacterCharacterReference);else if(n.isControlCodePoint(this.charRefCode)||this.charRefCode===a.CARRIAGE_RETURN){this._err(o.controlCharacterReference);const t=h[this.charRefCode];t&&(this.charRefCode=t)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}}A.CHARACTER_TOKEN="CHARACTER_TOKEN",A.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN",A.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN",A.START_TAG_TOKEN="START_TAG_TOKEN",A.END_TAG_TOKEN="END_TAG_TOKEN",A.COMMENT_TOKEN="COMMENT_TOKEN",A.DOCTYPE_TOKEN="DOCTYPE_TOKEN",A.EOF_TOKEN="EOF_TOKEN",A.HIBERNATION_TOKEN="HIBERNATION_TOKEN",A.MODE={DATA:c,RCDATA:"RCDATA_STATE",RAWTEXT:"RAWTEXT_STATE",SCRIPT_DATA:"SCRIPT_DATA_STATE",PLAINTEXT:"PLAINTEXT_STATE"},A.getTokenAttr=function(t,e){for(let r=t.attrs.length-1;r>=0;r--)if(t.attrs[r].name===e)return t.attrs[r].value;return null},t.exports=A},function(t,e,r){"use strict";const i=r(7),n=r(7).buildOptions,s=r(162);"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,i.nameRegexp);!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const o={attributeNamePrefix:"@_",attrNodeName:!1,textNodeName:"#text",ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:"\\c",tagValueProcessor:function(t,e){return t},attrValueProcessor:function(t,e){return t},stopNodes:[]};e.defaultOptions=o;const a=["attributeNamePrefix","attrNodeName","textNodeName","ignoreAttributes","ignoreNameSpace","allowBooleanAttributes","parseNodeValue","parseAttributeValue","arrayMode","trimValues","cdataTagName","cdataPositionChar","tagValueProcessor","attrValueProcessor","parseTrueNumberOnly","stopNodes"];function u(t,e,r){return e&&(r.trimValues&&(e=e.trim()),e=c(e=r.tagValueProcessor(e,t),r.parseNodeValue,r.parseTrueNumberOnly)),e}function h(t,e){if(e.ignoreNameSpace){const e=t.split(":"),r="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=r+e[1])}return t}function c(t,e,r){if(e&&"string"==typeof t){let e;return""===t.trim()||isNaN(t)?e="true"===t||"false"!==t&&t:(-1!==t.indexOf("0x")?e=Number.parseInt(t,16):-1!==t.indexOf(".")?(e=Number.parseFloat(t),t=t.replace(/\.?0+$/,"")):e=Number.parseInt(t,10),r&&(e=String(e)===t?e:t)),e}return i.isExist(t)?t:""}e.props=a;const l=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])(.*?)\\3)?","g");function d(t,e){if(!e.ignoreAttributes&&"string"==typeof t){t=t.replace(/\r?\n/g," ");const r=i.getAllMatches(t,l),n=r.length,s={};for(let t=0;t"===e)return{data:i,index:n};"\t"===e&&(e=" ")}i+=e}}function p(t,e,r,i){const n=t.indexOf(e,r);if(-1===n)throw new Error(i);return n+e.length-1}e.getTraversalObj=function(t,e){t=t.replace(/(\r\n)|\n/," "),e=n(e,o,a);const r=new s("!xml");let h=r,c="";for(let r=0;r",r,"Closing Tag is not closed.");let s=t.substring(r+2,n).trim();if(e.ignoreNameSpace){const t=s.indexOf(":");-1!==t&&(s=s.substr(t+1))}h&&(h.val?h.val=i.getValue(h.val)+""+u(s,c,e):h.val=u(s,c,e)),e.stopNodes.length&&e.stopNodes.includes(h.tagname)&&(h.child=[],null==h.attrsMap&&(h.attrsMap={}),h.val=t.substr(h.startIndex+1,r-h.startIndex-1)),h=h.parent,c="",r=n}else if("?"===t[r+1])r=p(t,"?>",r,"Pi Tag is not closed.");else if("!--"===t.substr(r+1,3))r=p(t,"--\x3e",r,"Comment is not closed.");else if("!D"===t.substr(r+1,2)){const e=p(t,">",r,"DOCTYPE is not closed.");r=t.substring(r,e).indexOf("[")>=0?t.indexOf("]>",r)+1:e}else if("!["===t.substr(r+1,2)){const n=p(t,"]]>",r,"CDATA is not closed.")-2,o=t.substring(r+9,n);if(c&&(h.val=i.getValue(h.val)+""+u(h.tagname,c,e),c=""),e.cdataTagName){const t=new s(e.cdataTagName,h,o);h.addChild(t),h.val=i.getValue(h.val)+e.cdataPositionChar,o&&(t.val=o)}else h.val=(h.val||"")+(o||"");r=n+2}else{const n=f(t,r+1);let o=n.data;const a=n.index,l=o.indexOf(" ");let p=o;if(-1!==l&&(p=o.substr(0,l).trimRight(),o=o.substr(l+1)),e.ignoreNameSpace){const t=p.indexOf(":");-1!==t&&(p=p.substr(t+1))}if(h&&c&&"!xml"!==h.tagname&&(h.val=i.getValue(h.val)+""+u(h.tagname,c,e)),o.length>0&&o.lastIndexOf("/")===o.length-1){"/"===p[p.length-1]?(p=p.substr(0,p.length-1),o=p):o=o.substr(0,o.length-1);const t=new s(p,h,"");p!==o&&(t.attrsMap=d(o,e)),h.addChild(t)}else{const t=new s(p,h);e.stopNodes.length&&e.stopNodes.includes(t.tagname)&&(t.startIndex=a),p!==o&&(t.attrsMap=d(o,e)),h.addChild(t),h=t}c="",r=a}else c+=t[r]}return r}},function(t,e,r){"use strict";var i=r(16);t.exports=i.DEFAULT=new i({include:[r(25)],explicit:[r(184),r(185),r(186)]})},function(t,e,r){"use strict";(function(e){const i=r(197),n=r(52),s=r(27),o=r(17),a=r(11).BigNumber,u=r(28),h=r(12),c=h.MT,l=h.NUMBYTES,d=(h.SIMPLE,h.SYMS),f=o.bigIntize(h.BI),p=h.BN,m=Symbol("count"),w=(Symbol("pending_key"),Symbol("major type")),g=Symbol("error"),y=Symbol("not found");function _(t,e,r){const i=[];return i[m]=r,i[d.PARENT]=t,i[w]=e,i}function b(t,e){const r=new u;return r[m]=-1,r[d.PARENT]=t,r[w]=e,r}function E(t){return o.bufferToBigInt(t)}function v(t){return f.MINUS_ONE-o.bufferToBigInt(t)}class A extends i{constructor(t){const e=(t=t||{}).tags;delete t.tags;const r=null!=t.max_depth?t.max_depth:-1;delete t.max_depth;const i=!!o.hasBigInt&&!!t.bigint;delete t.bigint,super(t),this.running=!0,this.max_depth=r,this.tags=e,i&&(null==this.tags&&(this.tags={}),null==this.tags[2]&&(this.tags[2]=E),null==this.tags[3]&&(this.tags[3]=v))}static nullcheck(t){switch(t){case d.NULL:return null;case d.UNDEFINED:return;case y:throw new Error("Value not found");default:return t}}static decodeFirstSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":i=o.extend({},e),r=i.encoding,delete i.encoding}const n=new A(i),s=new u(t,null!=r?r:o.guessEncoding(t)),a=n._parse();let h=a.next();for(;!h.done;){const t=s.read(h.value);if(null==t||t.length!==h.value)throw new Error("Insufficient data");h=a.next(t)}return A.nullcheck(h.value)}static decodeAllSync(t,e){let r,i={};switch(typeof(e=e||{encoding:"hex"})){case"string":r=e;break;case"object":i=o.extend({},e),r=i.encoding,delete i.encoding}const n=new A(i),s=new u(t,null!=r?r:o.guessEncoding(t)),a=[];for(;s.length>0;){const t=n._parse();let e=t.next();for(;!e.done;){const r=s.read(e.value);if(null==r||r.length!==e.value)throw new Error("Insufficient data");e=t.next(r)}a.push(A.nullcheck(e.value))}return a}static decodeFirst(t,e,r){let i={},n=!1,s="hex";switch(typeof e){case"function":r=e,s=o.guessEncoding(t);break;case"string":s=e;break;case"object":i=o.extend({},e),s=null!=i.encoding?i.encoding:o.guessEncoding(t),delete i.encoding,n=null!=i.required&&i.required,delete i.required}const a=new A(i);let u,h=y;return a.on("data",t=>{h=A.nullcheck(t),a.close()}),"function"==typeof r?(a.once("error",t=>{const e=h;return h=g,a.close(),r(t,e)}),a.once("end",()=>{switch(h){case y:return n?r(new Error("No CBOR found")):r(null,h);case g:return;default:return r(null,h)}})):u=new Promise((t,e)=>(a.once("error",t=>(h=g,a.close(),e(t))),a.once("end",()=>{switch(h){case y:return n?e(new Error("No CBOR found")):t(h);case g:return;default:return t(h)}}))),a.end(t,s),u}static decodeAll(t,e,r){let i={},n="hex";switch(typeof e){case"function":r=e,n=o.guessEncoding(t);break;case"string":n=e;break;case"object":i=o.extend({},e),n=null!=i.encoding?i.encoding:o.guessEncoding(t),delete i.encoding}const s=new A(i);let a;const u=[];return s.on("data",t=>u.push(A.nullcheck(t))),"function"==typeof r?(s.on("error",r),s.on("end",()=>r(null,u))):a=new Promise((t,e)=>{s.on("error",e),s.on("end",()=>t(u))}),s.end(t,n),a}close(){this.running=!1,this.__fresh=!0}*_parse(){let t=null,r=0,i=null;for(;;){if(this.max_depth>=0&&r>this.max_depth)throw new Error("Maximum depth "+this.max_depth+" exceeded");const h=(yield 1)[0];if(!this.running)throw new Error("Unexpected data: 0x"+h.toString(16));const f=h>>5,g=31&h,y=null!=t?t[w]:void 0,E=null!=t?t.length:void 0;switch(g){case l.ONE:this.emit("more-bytes",f,1,y,E),i=(yield 1)[0];break;case l.TWO:case l.FOUR:case l.EIGHT:const t=1<=48&&t[s]<=57||t[s]>=65&&t[s]<=70||t[s]>=97&&t[s]<=102;)s++;if(0===s)return t;if(13!=t[s]||10!=t[s+1])return t;s+=2;var n=parseInt(i.decode(t.subarray(e,s)),16);if(0==n)break;t.set(t.subarray(s,s+n),r),s+=n,r+=n,13==t[s]&&10==t[s+1]&&(s+=2),e=s}return t.subarray(0,r)}(t))}catch(t){console.log("Chunk-Encoding Ignored: "+t)}try{if("br"===e)0===(t=n()(t)).length&&(t=i);else if("gzip"===e||"gzip"===r){const e=new s.Inflate;e.push(t,!0),e.result&&!e.err&&(t=e.result)}}catch(t){console.log("Content-Encoding Ignored: "+t)}return t}},function(t,e,r){"use strict";var i={};(0,r(9).assign)(i,r(56),r(57),r(86)),t.exports=i},function(t,e){var r={};r[e.ACCEPTED=202]="Accepted",r[e.BAD_GATEWAY=502]="Bad Gateway",r[e.BAD_REQUEST=400]="Bad Request",r[e.CONFLICT=409]="Conflict",r[e.CONTINUE=100]="Continue",r[e.CREATED=201]="Created",r[e.EXPECTATION_FAILED=417]="Expectation Failed",r[e.FAILED_DEPENDENCY=424]="Failed Dependency",r[e.FORBIDDEN=403]="Forbidden",r[e.GATEWAY_TIMEOUT=504]="Gateway Timeout",r[e.GONE=410]="Gone",r[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP Version Not Supported",r[e.IM_A_TEAPOT=418]="I'm a teapot",r[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="Insufficient Space on Resource",r[e.INSUFFICIENT_STORAGE=507]="Insufficient Storage",r[e.INTERNAL_SERVER_ERROR=500]="Server Error",r[e.LENGTH_REQUIRED=411]="Length Required",r[e.LOCKED=423]="Locked",r[e.METHOD_FAILURE=420]="Method Failure",r[e.METHOD_NOT_ALLOWED=405]="Method Not Allowed",r[e.MOVED_PERMANENTLY=301]="Moved Permanently",r[e.MOVED_TEMPORARILY=302]="Moved Temporarily",r[e.MULTI_STATUS=207]="Multi-Status",r[e.MULTIPLE_CHOICES=300]="Multiple Choices",r[e.NETWORK_AUTHENTICATION_REQUIRED=511]="Network Authentication Required",r[e.NO_CONTENT=204]="No Content",r[e.NON_AUTHORITATIVE_INFORMATION=203]="Non Authoritative Information",r[e.NOT_ACCEPTABLE=406]="Not Acceptable",r[e.NOT_FOUND=404]="Not Found",r[e.NOT_IMPLEMENTED=501]="Not Implemented",r[e.NOT_MODIFIED=304]="Not Modified",r[e.OK=200]="OK",r[e.PARTIAL_CONTENT=206]="Partial Content",r[e.PAYMENT_REQUIRED=402]="Payment Required",r[e.PERMANENT_REDIRECT=308]="Permanent Redirect",r[e.PRECONDITION_FAILED=412]="Precondition Failed",r[e.PRECONDITION_REQUIRED=428]="Precondition Required",r[e.PROCESSING=102]="Processing",r[e.PROXY_AUTHENTICATION_REQUIRED=407]="Proxy Authentication Required",r[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="Request Header Fields Too Large",r[e.REQUEST_TIMEOUT=408]="Request Timeout",r[e.REQUEST_TOO_LONG=413]="Request Entity Too Large",r[e.REQUEST_URI_TOO_LONG=414]="Request-URI Too Long",r[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="Requested Range Not Satisfiable",r[e.RESET_CONTENT=205]="Reset Content",r[e.SEE_OTHER=303]="See Other",r[e.SERVICE_UNAVAILABLE=503]="Service Unavailable",r[e.SWITCHING_PROTOCOLS=101]="Switching Protocols",r[e.TEMPORARY_REDIRECT=307]="Temporary Redirect",r[e.TOO_MANY_REQUESTS=429]="Too Many Requests",r[e.UNAUTHORIZED=401]="Unauthorized",r[e.UNPROCESSABLE_ENTITY=422]="Unprocessable Entity",r[e.UNSUPPORTED_MEDIA_TYPE=415]="Unsupported Media Type",r[e.USE_PROXY=305]="Use Proxy",e.getStatusText=function(t){if(r.hasOwnProperty(t))return r[t];throw new Error("Status code does not exist: "+t)},e.getStatusCode=function(t){for(key in r)if(r[key]===t)return parseInt(key,10);throw new Error("Reason phrase does not exist: "+t)}},function(t,e,r){"use strict";let{Json2Csv:i}=r(189),{Csv2Json:n}=r(192),s=r(51);function o(t,e,r,i){return s.convert({data:e,callback:r,options:i,converter:t})}function a(t,e,r){return new Promise((i,n)=>o(t,e,(t,e)=>t?n(t):i(e),r))}function u(t,e,r,i,n){return console.warn("WARNING: "+e+" is deprecated and will be removed soon. Please use "+r+" instead."),a(t,i,n)}t.exports={json2csv:(t,e,r)=>o(i,t,e,r),csv2json:(t,e,r)=>o(n,t,e,r),json2csvAsync:(t,e)=>a(i,t,e),csv2jsonAsync:(t,e)=>a(n,t,e),json2csvPromisified:(t,e)=>u(i,"json2csvPromisified()","json2csvAsync()",t,e),csv2jsonPromisified:(t,e)=>u(n,"csv2jsonPromisified()","csv2jsonAsync()",t,e)}},function(t,e,r){"use strict";var i,n="object"==typeof Reflect?Reflect:null,s=n&&"function"==typeof n.apply?n.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var u=10;function h(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?a.defaultMaxListeners:t._maxListeners}function l(t,e,r,i){var n,s,o,a;if(h(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 u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return t}function d(){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 f(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},n=d.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 u=n[t];if(void 0===u)return!1;if("function"==typeof u)s(u,this,e);else{var h=u.length,c=w(u,h);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},a.prototype.listeners=function(t){return p(this,t,!0)},a.prototype.rawListeners=function(t){return p(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):m.call(t,e)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,r){(e=t.exports=r(68)).Stream=e,e.Readable=e,e.Writable=r(44),e.Duplex=r(10),e.Transform=r(75),e.PassThrough=r(132)},function(t,e,r){var i=r(3),n=i.Buffer;function s(t,e){for(var r in t)e[r]=t[r]}function o(t,e,r){return n(t,e,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=i:(s(i,e),e.Buffer=o),s(n,o),o.from=function(t,e,r){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,r)},o.alloc=function(t,e,r){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=n(t);return void 0!==e?"string"==typeof r?i.fill(e,r):i.fill(e):i.fill(0),i},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,r){"use strict";(function(e,i,n){var s=r(32);function o(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?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=y;var a,u=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:s.nextTick;y.WritableState=g;var h=Object.create(r(22));h.inherits=r(13);var c={deprecate:r(130)},l=r(70),d=r(43).Buffer,f=n.Uint8Array||function(){};var p,m=r(72);function w(){}function g(t,e){a=a||r(10),t=t||{};var i=e instanceof a;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,h=t.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(h||0===h)?h:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var l=!1===t.decodeStrings;this.decodeStrings=!l,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,n=r.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(r),e)!function(t,e,r,i,n){--e.pendingcb,r?(s.nextTick(n,i),s.nextTick(T,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(n(i),t._writableState.errorEmitted=!0,t.emit("error",i),T(t,e))}(t,r,i,e,n);else{var o=v(r);o||r.corked||r.bufferProcessing||!r.bufferedRequest||E(t,r),i?u(b,t,r,o,n):b(t,r,o,n)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function y(t){if(a=a||r(10),!(p.call(y,this)||this instanceof a))return new y(t);this._writableState=new g(t,this),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)),l.call(this)}function _(t,e,r,i,n,s,o){e.writelen=i,e.writecb=o,e.writing=!0,e.sync=!0,r?t._writev(n,e.onwrite):t._write(n,s,e.onwrite),e.sync=!1}function b(t,e,r,i){r||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),T(t,e)}function E(t,e){e.bufferProcessing=!0;var r=e.bufferedRequest;if(t._writev&&r&&r.next){var i=e.bufferedRequestCount,n=new Array(i),s=e.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)n[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;n.allBuffers=u,_(t,e,!0,e.length,n,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;r;){var h=r.chunk,c=r.encoding,l=r.callback;if(_(t,e,!1,e.objectMode?1:h.length,h,c,l),r=r.next,e.bufferedRequestCount--,e.writing)break}null===r&&(e.lastBufferedRequest=null)}e.bufferedRequest=r,e.bufferProcessing=!1}function v(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function A(t,e){t._final((function(r){e.pendingcb--,r&&t.emit("error",r),e.prefinished=!0,t.emit("prefinish"),T(t,e)}))}function T(t,e){var r=v(e);return r&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,s.nextTick(A,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),r}h.inherits(y,l),g.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.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]?(p=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(t){return!!p.call(this,t)||this===y&&(t&&t._writableState instanceof g)}})):p=function(t){return t instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(t,e,r){var i,n=this._writableState,o=!1,a=!n.objectMode&&(i=t,d.isBuffer(i)||i instanceof f);return a&&!d.isBuffer(t)&&(t=function(t){return d.from(t)}(t)),"function"==typeof e&&(r=e,e=null),a?e="buffer":e||(e=n.defaultEncoding),"function"!=typeof r&&(r=w),n.ended?function(t,e){var r=new Error("write after end");t.emit("error",r),s.nextTick(e,r)}(this,r):(a||function(t,e,r,i){var n=!0,o=!1;return null===r?o=new TypeError("May not write null values to stream"):"string"==typeof r||void 0===r||e.objectMode||(o=new TypeError("Invalid non-string/buffer chunk")),o&&(t.emit("error",o),s.nextTick(i,o),n=!1),n}(this,n,t,r))&&(n.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=d.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 u=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(t,e,r){r(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(t,e,r){var i=this._writableState;"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||i.finished||function(t,e,r){e.ending=!0,T(t,e),r&&(e.finished?s.nextTick(r):t.once("finish",r));e.ended=!0,t.writable=!1}(this,i,r)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),y.prototype.destroy=m.destroy,y.prototype._undestroy=m.undestroy,y.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,r(14),r(73).setImmediate,r(6))},function(t,e,r){"use strict";const i=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];e.REPLACEMENT_CHARACTER="�",e.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533},e.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]},e.isSurrogate=function(t){return t>=55296&&t<=57343},e.isSurrogatePair=function(t){return t>=56320&&t<=57343},e.getSurrogatePairCodePoint=function(t,e){return 1024*(t-55296)+9216+e},e.isControlCodePoint=function(t){return 32!==t&&10!==t&&13!==t&&9!==t&&12!==t&&t>=1&&t<=31||t>=127&&t<=159},e.isUndefinedCodePoint=function(t){return t>=64976&&t<=65007||i.indexOf(t)>-1}},function(t,e,r){"use strict";class i{constructor(t){const e={},r=this._getOverriddenMethods(this,e);for(const i of Object.keys(r))"function"==typeof r[i]&&(e[i]=t[i],t[i]=r[i])}_getOverriddenMethods(){throw new Error("Not implemented")}}i.install=function(t,e,r){t.__mixins||(t.__mixins=[]);for(let r=0;r=0?e:void 0),remainingKeyPath:t.slice(e+1)}}t.exports={evaluatePath:function t(e,r){if(!e)return null;let{indexOfDot:n,currentKey:s,remainingKeyPath:o}=i(r);if(n>=0&&!e[r])return Array.isArray(e[s])?e[s].map(e=>t(e,o)):t(e[s],o);if(Array.isArray(e))return e.map(e=>t(e,r));return e[r]},setPath:function t(e,r,n){if(!e)throw new Error("No document was provided.");let{indexOfDot:s,currentKey:o,remainingKeyPath:a}=i(r);if(s>=0){if(!e[o]&&Array.isArray(e))return e.forEach(e=>t(e,r,n));e[o]||(e[o]={}),t(e[o],a,n)}else{if(Array.isArray(e))return e.forEach(e=>t(e,a,n));e[r]=n}return e}}},function(t){t.exports=JSON.parse('{"errors":{"callbackRequired":"A callback is required!","optionsRequired":"Options were not passed and are required.","json2csv":{"cannotCallOn":"Cannot call json2csv on ","dataCheckFailure":"Data provided was not an array of documents.","notSameSchema":"Not all documents have the same schema."},"csv2json":{"cannotCallOn":"Cannot call csv2json on ","dataCheckFailure":"CSV is not a string."}},"defaultOptions":{"delimiter":{"field":",","wrap":"\\"","eol":"\\n"},"excelBOM":false,"prependHeader":true,"trimHeaderFields":false,"trimFieldValues":false,"sortHeader":false,"parseCsvNumbers":false,"keys":null,"checkSchemaDifferences":false,"expandArrayObjects":false,"unwindArrays":false,"useLocaleFormat":false},"values":{"excelBOM":"\ufeff"}}')},function(t,e,r){"use strict";let i=r(49),n=r(50);const s=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/;function o(t){return JSON.parse(JSON.stringify(t))}function a(t){return c(t)||h(t)||""===t}function u(t){return"object"==typeof t}function h(t){return null===t}function c(t){return void 0===t}function l(t,e){return t.filter(t=>!e.includes(t))}t.exports={isStringRepresentation:function(t,e){const r=t[0],i=t.length-1,n=t[i];return r===e.delimiter.wrap&&n===e.delimiter.wrap},isDateRepresentation:function(t){return s.test(t)},computeSchemaDifferences:function(t,e){return l(t,e).concat(l(e,t))},deepCopy:o,convert:function(t){let{options:e,callback:r}=function(t,e){if(u(t)&&(r=t,"function"!=typeof r))return{options:t,callback:e};var r;return{options:e,callback:t}}(t.callback,t.options);i=e,(i={...n.defaultOptions,...i||{}}).delimiter={...n.defaultOptions.delimiter,...i.delimiter},e=i;var i;let s=new t.converter(e);(function(t){if(!t.callback)throw new Error(n.errors.callbackRequired);if(!t.data)return t.callback(new Error(t.errorMessages.cannotCallOn+t.data+".")),!1;if(!t.dataCheckFn(t.data))return t.callback(new Error(t.errorMessages.dataCheckFailure)),!1;return!0})({data:t.data,callback:r,errorMessages:s.validationMessages,dataCheckFn:s.validationFn})&&s.convert(t.data,r)},isEmptyField:a,removeEmptyFields:function(t){return t.filter(t=>!a(t))},getNCharacters:function(t,e,r){return t.substring(e,e+r)},unwind:function(t,e){const r=[];return t.forEach(t=>{!function(t,e,r){const n=i.evaluatePath(e,r);let s=o(e);Array.isArray(n)?n.forEach(n=>{s=o(e),t.push(i.setPath(s,r,n))}):t.push(s)}(r,t,e)}),r},isInvalid:function(t){return t===1/0||t===-1/0},isString:function(t){return"string"==typeof t},isNull:h,isError:function(t){return"[object Error]"===Object.prototype.toString.call(t)},isDate:function(t){return t instanceof Date},isUndefined:c,isObject:u,unique:function(t){return[...new Set(t)]},flatten:function(t){return[].concat(...t)}}},function(t,e,r){"use strict";const i=r(11).BigNumber,n=r(17),s=r(53),o=new i(-1),a=new i(10),u=new i(2);class h{constructor(t,e,r){if(this.tag=t,this.value=e,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(t){return t._pushTag(this.tag),t.pushAny(this.value)}convert(t){let e=null!=t?t[this.tag]:void 0;if("function"!=typeof e&&(e=h["_tag_"+this.tag],"function"!=typeof e))return this;try{return e.call(h,this.value)}catch(t){return this.err=t,this}}static _tag_0(t){return new Date(t)}static _tag_1(t){return new Date(1e3*t)}static _tag_2(t){return n.bufferToBignumber(t)}static _tag_3(t){return o.minus(n.bufferToBignumber(t))}static _tag_4(t){return a.pow(t[0]).times(t[1])}static _tag_5(t){return u.pow(t[0]).times(t[1])}static _tag_32(t){return s.parse(t)}static _tag_35(t){return new RegExp(t)}}t.exports=h},function(t,e,r){"use strict";var i=r(198),n=r(200);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=_,e.resolve=function(t,e){return _(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?_(t,!1,!0).resolveObject(e):e},e.format=function(t){n.isString(t)&&(t=_(t));return t instanceof s?t.format():s.prototype.format.call(t)},e.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,h=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),c=["'"].concat(h),l=["%","/","?",";","#"].concat(c),d=["/","?","#"],f=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=r(201);function _(t,e,r){if(t&&n.isObject(t)&&t instanceof s)return t;var i=new s;return i.parse(t,e,r),i}s.prototype.parse=function(t,e,r){if(!n.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),a=-1!==s&&s127?O+="x":O+=N[F];if(!O.match(f)){var B=R.slice(0,C),L=R.slice(C+1),U=N.match(p);U&&(B.push(U[1]),L.unshift(U[2])),L.length&&(_="/"+L.join(".")+_),this.hostname=B.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),k||(this.hostname=i.toASCII(this.hostname));var M=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+M,this.href+=this.host,k&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==_[0]&&(_="/"+_))}if(!m[v])for(C=0,I=c.length;C0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift());return r.search=t.search,r.query=t.query,n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!A.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var x=A.slice(-1)[0],S=(r.host||t.host||A.length>1)&&("."===x||".."===x)||""===x,C=0,D=A.length;D>=0;D--)"."===(x=A[D])?A.splice(D,1):".."===x?(A.splice(D,1),C++):C&&(A.splice(D,1),C--);if(!E&&!v)for(;C--;C)A.unshift("..");!E||""===A[0]||A[0]&&"/"===A[0].charAt(0)||A.unshift(""),S&&"/"!==A.join("/").substr(-1)&&A.push("");var k,R=""===A[0]||A[0]&&"/"===A[0].charAt(0);T&&(r.hostname=r.host=R?"":A.length?A.shift():"",(k=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=k.shift(),r.host=r.hostname=k.shift()));return(E=E||r.host&&A.length)&&!R&&A.unshift(""),A.length?r.pathname=A.join("/"):(r.pathname=null,r.path=null),n.isNull(r.pathname)&&n.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},s.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},,function(t,e,r){"use strict";const{Transform:i}=r(4),n=r(33),s=r(139),o=r(46),a=r(77),u=r(141),h=r(142),c={sourceCodeLocationInfo:!1};const l={[n.START_TAG_TOKEN]:{eventName:"startTag",reshapeToken:t=>({tagName:t.tagName,attrs:t.attrs,selfClosing:t.selfClosing,sourceCodeLocation:t.location})},[n.END_TAG_TOKEN]:{eventName:"endTag",reshapeToken:t=>({tagName:t.tagName,sourceCodeLocation:t.location})},[n.COMMENT_TOKEN]:{eventName:"comment",reshapeToken:t=>({text:t.data,sourceCodeLocation:t.location})},[n.DOCTYPE_TOKEN]:{eventName:"doctype",reshapeToken:t=>({name:t.name,publicId:t.publicId,systemId:t.systemId,sourceCodeLocation:t.location})},[n.CHARACTER_TOKEN]:{eventName:"text",reshapeToken:t=>({text:t.chars,sourceCodeLocation:t.location})}};t.exports=class extends i{constructor(t){super({encoding:"utf8",decodeStrings:!1}),this.options=a(c,t),this.tokenizer=new n(t),this.locInfoMixin=null,this.options.sourceCodeLocationInfo&&(this.locInfoMixin=o.install(this.tokenizer,s)),this.parserFeedbackSimulator=new h(this.tokenizer),this.pendingText=null,this.lastChunkWritten=!1,this.stopped=!1,this.pipe(new u)}_transform(t,e,r){if("string"!=typeof t)throw new TypeError("Parser can work only with string streams.");r(null,this._transformChunk(t))}_final(t){this.lastChunkWritten=!0,t(null,this._transformChunk(""))}stop(){this.stopped=!0}_transformChunk(t){return this.stopped||(this.tokenizer.write(t,this.lastChunkWritten),this._runParsingLoop()),t}_runParsingLoop(){let t=null;do{if(t=this.parserFeedbackSimulator.getNextToken(),t.type===n.HIBERNATION_TOKEN)break;if(t.type===n.CHARACTER_TOKEN||t.type===n.WHITESPACE_CHARACTER_TOKEN||t.type===n.NULL_CHARACTER_TOKEN){if(null===this.pendingText)t.type=n.CHARACTER_TOKEN,this.pendingText=t;else if(this.pendingText.chars+=t.chars,this.options.sourceCodeLocationInfo){const{endLine:e,endCol:r,endOffset:i}=t.location;Object.assign(this.pendingText.location,{endLine:e,endCol:r,endOffset:i})}}else this._emitPendingText(),this._handleToken(t)}while(!this.stopped&&t.type!==n.EOF_TOKEN)}_handleToken(t){if(t.type===n.EOF_TOKEN)return!0;const{eventName:e,reshapeToken:r}=l[t.type];return 0!==this.listenerCount(e)&&(this._emitToken(e,r(t)),!0)}_emitToken(t,e){this.emit(t,e)}_emitPendingText(){null!==this.pendingText&&(this._handleToken(this.pendingText),this.pendingText=null)}}},function(t,e,r){"use strict";var i=r(153),n=r(9),s=r(84),o=r(47),a=r(85),u=Object.prototype.toString;function h(t){if(!(this instanceof h))return new h(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 c;if(c="string"==typeof e.dictionary?s.string2buf(e.dictionary):"[object ArrayBuffer]"===u.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,0!==(r=i.deflateSetDictionary(this.strm,c)))throw new Error(o[r]);this._dict_set=!0}}function c(t,e){var r=new h(e);if(r.push(t,!0),r.err)throw r.msg||o[r.err];return r.result}h.prototype.push=function(t,e){var r,o,a=this.strm,h=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]"===u.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(h),a.next_out=0,a.avail_out=h),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)},h.prototype.onData=function(t){this.chunks.push(t)},h.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=h,e.deflate=c,e.deflateRaw=function(t,e){return(e=e||{}).raw=!0,c(t,e)},e.gzip=function(t,e){return(e=e||{}).gzip=!0,c(t,e)}},function(t,e,r){"use strict";var i=r(155),n=r(9),s=r(84),o=r(86),a=r(47),u=r(85),h=r(158),c=Object.prototype.toString;function l(t){if(!(this instanceof l))return new l(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 u,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 h,i.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=s.string2buf(e.dictionary):"[object ArrayBuffer]"===c.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 d(t,e){var r=new l(e);if(r.push(t,!0),r.err)throw r.msg||a[r.err];return r.result}l.prototype.push=function(t,e){var r,a,u,h,l,d=this.strm,f=this.options.chunkSize,p=this.options.dictionary,m=!1;if(this.ended)return!1;a=e===~~e?e:!0===e?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof t?d.input=s.binstring2buf(t):"[object ArrayBuffer]"===c.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(f),d.next_out=0,d.avail_out=f),(r=i.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&p&&(r=i.inflateSetDictionary(this.strm,p)),r===o.Z_BUF_ERROR&&!0===m&&(r=o.Z_OK,m=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&r!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(u=s.utf8border(d.output,d.next_out),h=d.next_out-u,l=s.buf2string(d.output,u),d.next_out=h,d.avail_out=f-h,h&&n.arraySet(d.output,d.output,u,h,0),this.onData(l)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((d.avail_in>0||0===d.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),d.avail_out=0,!0)},l.prototype.onData=function(t){this.chunks.push(t)},l.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=l,e.inflate=d,e.inflateRaw=function(t,e){return(e=e||{}).raw=!0,d(t,e)},e.ungzip=d},function(t,e,r){"use strict";r.r(e),r.d(e,"CollectionLoader",(function(){return _t})),r.d(e,"WorkerLoader",(function(){return bt}));const i=(t,e)=>e.some(e=>t instanceof e);let n,s;const o=new WeakMap,a=new WeakMap,u=new WeakMap,h=new WeakMap,c=new WeakMap;let l={get(t,e,r){if(t instanceof IDBTransaction){if("done"===e)return a.get(t);if("objectStoreNames"===e)return t.objectStoreNames||u.get(t);if("store"===e)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return m(t[e])},set:(t,e,r)=>(t[e]=r,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function d(t){l=t(l)}function f(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(s||(s=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(w(this),e),m(o.get(this))}:function(...e){return m(t.apply(w(this),e))}:function(e,...r){const i=t.call(w(this),e,...r);return u.set(i,e.sort?e.sort():[e]),m(i)}}function p(t){return"function"==typeof t?f(t):(t instanceof IDBTransaction&&function(t){if(a.has(t))return;const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("complete",n),t.removeEventListener("error",s),t.removeEventListener("abort",s)},n=()=>{e(),i()},s=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",n),t.addEventListener("error",s),t.addEventListener("abort",s)});a.set(t,e)}(t),i(t,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,l):t)}function m(t){if(t instanceof IDBRequest)return function(t){const e=new Promise((e,r)=>{const i=()=>{t.removeEventListener("success",n),t.removeEventListener("error",s)},n=()=>{e(m(t.result)),i()},s=()=>{r(t.error),i()};t.addEventListener("success",n),t.addEventListener("error",s)});return e.then(e=>{e instanceof IDBCursor&&o.set(e,t)}).catch(()=>{}),c.set(e,t),e}(t);if(h.has(t))return h.get(t);const e=p(t);return e!==t&&(h.set(t,e),c.set(e,t)),e}const w=t=>c.get(t);function g(t,e,{blocked:r,upgrade:i,blocking:n,terminated:s}={}){const o=indexedDB.open(t,e),a=m(o);return i&&o.addEventListener("upgradeneeded",t=>{i(m(o.result),t.oldVersion,t.newVersion,m(o.transaction))}),r&&o.addEventListener("blocked",()=>r()),a.then(t=>{s&&t.addEventListener("close",()=>s()),n&&t.addEventListener("versionchange",()=>n())}).catch(()=>{}),a}function y(t,{blocked:e}={}){const r=indexedDB.deleteDatabase(t);return e&&r.addEventListener("blocked",()=>e()),m(r).then(()=>{})}const _=["get","getKey","getAll","getAllKeys","count"],b=["put","add","delete","clear"],E=new Map;function v(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(E.get(e))return E.get(e);const r=e.replace(/FromIndex$/,""),i=e!==r,n=b.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!n&&!_.includes(r))return;const s=async function(t,...e){const s=this.transaction(t,n?"readwrite":"readonly");let o=s.store;i&&(o=o.index(e.shift()));const a=await o[r](...e);return n&&await s.done,a};return E.set(e,s),s}d(t=>({...t,get:(e,r,i)=>v(e,r)||t.get(e,r,i),has:(e,r)=>!!v(e,r)||t.has(e,r)}));const A=["continue","continuePrimaryKey","advance"],T={},x=new WeakMap,S=new WeakMap,C={get(t,e){if(!A.includes(e))return t[e];let r=T[e];return r||(r=T[e]=function(...t){x.set(this,S.get(this)[e](...t))}),r}};async function*D(...t){let e=this;if(e instanceof IDBCursor||(e=await e.openCursor(...t)),!e)return;e=e;const r=new Proxy(e,C);for(S.set(r,e),c.set(r,w(e));e;)yield r,e=await(x.get(r)||e.continue()),x.delete(r)}function k(t,e){return e===Symbol.asyncIterator&&i(t,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===e&&i(t,[IDBIndex,IDBObjectStore])}d(t=>({...t,get:(e,r,i)=>k(e,r)?D:t.get(e,r,i),has:(e,r)=>k(e,r)||t.has(e,r)}));var R=r(0),I=r(117),N=r.n(I);const O=[{match:/\/\/.*gcs-vimeo|vod|vod-progressive\.akamaized\.net.*\/([\d]+)\/[\d]+(.mp4)/,fuzzyCanonReplace:"//vimeo-cdn.fuzzy.replayweb.page/$1$2",split:".net"},{match:/\/\/.*player.vimeo.com\/(video\/[\d]+)\?.*/i,fuzzyCanonReplace:"//vimeo.fuzzy.replayweb.page/$1"},{match:/www.\washingtonpost\.com\/wp-apps\/imrs.php/,args:[["src"]]},{match:/(static.wixstatic.com\/.*\.[\w]+\/v1\/fill\/)(w_.*)/,replace:"$1?_args=$2",split:"/v1/fill"},{match:/(youtube\.com\/embed\/[^?]+)[?].*/i,replace:"$1"},{match:/(www\.)?youtube(-nocookie)?\.com\/get_video_info/i,args:[["video_id","html5"]]},{match:/\/\/.*googlevideo.com\/(videoplayback)/i,fuzzyCanonReplace:"//youtube.fuzzy.replayweb.page/$1",args:[["id","itag"],["id"]],fuzzyArgs:!0},{match:/facebook\.com\/ajax\/pagelet\/generic.php\/photoviewerinitpagelet/i,args:[[{arg:"data",keys:["query_type","fbid","v","cursor","data"]}]]},{match:/facebook\.com\/api\/graphql/i,args:[["variables","doc_id"]],fuzzyArgs:!0},{match:/facebook\.com\/api\/graphqlbatch/i,args:[["batch_name","queries"],["batch_name"]]},{match:/facebook\.com\/ajax\/navigation/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/route-definition/i,args:[["route_url","__user"],["route_url"]]},{match:/facebook\.com\/ajax\/bulk-route-definitions/i,args:[["route_urls[0]","__user"],["route_urls[0]"]]},{match:/facebook\.com\/ajax\/relay-ef/i,args:[["queries[0]","__user"],["queries[0]"]]},{match:/facebook\.com\/videos\/vodcomments/i,args:[["eft_id"]]},{match:/facebook\.com\/ajax\.*/i,replaceQuery:/([?&][^_]\w+=[^&]+)/g},{match:/plus\.googleapis\.com\/u\/\/0\/_\/widget\/render\/comments/i,args:[["href","stream_id","substream_id"]]},{match:(F=["(callback=jsonp)[^&]+(?=&|$)","((?:\\w+)=jquery)[\\d]+_[\\d]+","utm_[^=]+=[^&]+(?=&|$)","(_|cb|_ga|\\w*cache\\w*)=[\\d.-]+(?=$|&)"],new RegExp("[?&]"+F.map(t=>"("+t+")").join("|"),"gi")),replace:""},{match:/(\.(?:php|js|webm|mp4|gif|jpg|png|css|json|m3u8))\?.*/i,replace:"$1"}];var F;const P=new class{constructor(t){this.rules=t||O}getRuleFor(t){let e;const r=-1===t.indexOf("?")?t+"?":t;for(const t of this.rules)if(r.match(t.match)){e=t;break}let i=t;e&&e.fuzzyCanonReplace&&(i=t.replace(e.match,e.fuzzyCanonReplace));const n=e&&e.split||"?",s=t.indexOf(n);return{prefix:s>0?t.slice(0,s+n.length):t,rule:e,fuzzyCanonUrl:i}}fuzzyCompareUrls(t,e,r){if(!e||!e.length)return null;if(r&&void 0!==r.replace&&void 0!==r.match){const i=r.match,n=r.replace,s=t.replace(i,n),o=[];for(const t of e){const e=("string"==typeof t?t:t.url).replace(i,n);if(s===e)return t;t.fuzzyMatchUrl=e,o.push(t)}e=o,t=s}return this.fuzzyBestMatchQuery(t,e,r)}fuzzyBestMatchQuery(t,e,r){try{t=new URL(t)}catch(t){return 0}const i=r&&r.args&&!r.fuzzyArgs?new Set(r.args[0]):null;let n=0,s=null;const o=new URLSearchParams(t.search);for(const t of e){if(204===t.mime)continue;let e="string"==typeof t?t:t.fuzzyMatchUrl||t.url;try{e=new URL(e)}catch(t){continue}const r=new URLSearchParams(e.search);let a=this.getMatch(o,r,i);a+=this.getMatch(r,o,i),a/=2,a>n&&(n=a,s=t)}return s}getMatch(t,e,r){let i=1,n=1;for(const[s,o]of t){const t=e.get(s);if(r&&r.has(s)&&t!==o)return-1;let a;a="_"===s[0]?1:10,null!==t&&(i+=.5*a);const u=Number(o),h=Number(t);if(n+=a,t===o)i+=a*o.length;else if(null===t)i+=0;else if(isNaN(u)||isNaN(h)){const e=Math.min(t.length,o.length),r=N()(t,o);rthis._initDB(t,e,r,i),blocking:t=>{t&&null!==t.newVersion||this.close()}})}_initDB(t,e,r,i){if(!e){const e=t.createObjectStore("pages",{keyPath:"id"});e.createIndex("url","url"),e.createIndex("ts","ts");t.createObjectStore("pageLists",{keyPath:"id",autoIncrement:!0});t.createObjectStore("curatedPages",{keyPath:"id",autoIncrement:!0}).createIndex("listPages",["list","pos"]);const r=t.createObjectStore("resources",{keyPath:["url","ts"]});r.createIndex("pageId","pageId"),r.createIndex("mimeStatusUrl",["mime","status","url"]);t.createObjectStore("payload",{keyPath:"digest",unique:!0}),t.createObjectStore("digestRef",{keyPath:"digest",unique:!0})}}async clearAll(){const t=["pages","resources","payload","digestRef"];for(const e of t)await this.db.clear(e)}close(){this.db&&(this.db.close(),this.db=null)}async delete(){this.close(),await y(this.name,{blocked(t){console.log("Unable to delete: "+t)}})}async addPage(t,e){const r=t.url,i=t.title||t.url,n=t.id||this.newPageId();let s=t.ts;s||!t.date&&!t.datetime||(s=new Date(t.date||t.datetime).getTime());const o={...t,url:r,ts:s,title:i,id:n};return e?(e.store.put(o),o.id):await this.db.put("pages",o)}async addPages(t){const e=this.db.transaction("pages","readwrite");for(const e of t)this.addPage(e);try{await e.done}catch(t){console.warn("addPages tx",t.toString())}}async addCPageList(t){const e={};return e.title=t.title,e.desc=t.desc,e.slug=t.slug,await this.db.put("pageLists",e)}async addCuratedPageLists(t,e="pages",r="public"){for(const i of t){if(r&&!i[r])continue;const t=await this.addCPageList(i),n=this.db.transaction("curatedPages","readwrite");let s=0;const o=i[e]||[];for(const e of o){const r={};r.pos=s++,r.list=t;const i=typeof e.page;r.page="string"===i?e.page:"object"===i?e.page.id:e.page_id||e.pageId,r.desc=e.desc,n.store.put(r)}try{await n.done}catch(t){console.warn("addCuratedPageLists tx",t.toString())}}}async getAllCuratedByList(){const t=await this.db.getAll("pageLists"),e=this.db.transaction("curatedPages","readonly");for await(const r of e.store.index("listPages").iterate()){const e=t[r.value.list-1];e&&(e.show=!0,e.pages||(e.pages=[]),e.pages.push(r.value))}return t}newPageId(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}async getAllPages(){return await this.db.getAll("pages")}async getPages(t){const e=[];t.sort();for await(const r of this.matchAny("pages",null,t))e.push(r);return e}async dedupResource(t,e,r,i=1){const n=r.objectStore("digestRef"),s=await n.get(t);if(s)return++s.count,s;try{return r.objectStore("payload").add({digest:t,payload:e}),{digest:t,count:i,size:e.length}}catch(t){console.log(t)}return null}async addResources(t){const e=[],r=[],i={},n=this.db.transaction(["digestRef","payload"],"readwrite");for(const s of t){let t=1;if("warc/revisit"===s.mime)e.push(s);else{r.push(s);const e=this.getFuzzyUrl(s);e&&(r.push(e),t=2)}this.useRefCounts&&s.digest&&s.payload&&(i[s.digest]=await this.dedupResource(s.digest,s.payload,n,t),delete s.payload)}try{await n.done}catch(t){console.log("Payload Bulk Add Failed: "+t)}const s=this.db.transaction(["digestRef","resources"],"readwrite"),o=s.objectStore("resources");let a={};for(const t of e){if(this.useRefCounts){let e=i[t.digest];e||(e=await s.objectStore("digestRef").get(t.digest)),e&&(e.count++,a[t.digest]=e)}o.put(t)}for(const t of r)o.put(t);if(this.useRefCounts){const t=s.objectStore("digestRef");for(const e of Object.values(a))t.put(e)}await s.done}getFuzzyUrl(t){if(t.status>=200&&t.status<400&&304!==t.status&&204!==t.status){const{fuzzyCanonUrl:e}=P.getRuleFor(t.url);return e&&e!==t.url?{url:e,ts:t.ts,origURL:t.url,origTS:t.ts,pageId:t.pageId,digest:t.digest}:null}return null}async addResource(t){t.payload&&t.payload.length>this.minDedupSize&&(t.digest||(t.digest=await Object(R.d)(t.payload,"sha-256")));let e=null,r=!1;const i=this.db.transaction(["resources","digestRef","payload"],"readwrite");if(t.payload&&t.payload.length>this.minDedupSize?(e=await this.dedupResource(t.digest,t.payload,i),r=e&&1===e.count,delete t.payload):t.payload&&(r=!0),"warc/revisit"!==t.mime){i.objectStore("resources").put(t);const r=this.getFuzzyUrl(t);r&&(i.objectStore("resources").put(r),e&&e.count++)}else i.objectStore("resources").add(t);e&&i.objectStore("digestRef").put(e);try{await i.done}catch(e){"warc/revisit"===t.mime?console.log("Skip Duplicate revisit for: "+t.url):console.log("Add Error for "+t.url),console.log(e)}return r}async getResource(t,e,r){const i=Object(R.m)(t.timestamp).getTime();let n=t.url,s=null;const o={skip:this.repeatTracker?this.repeatTracker.getSkipCount(r,n,t.request.method):0};if(n.startsWith("//")){let e=!1;s=await this.lookupUrl("https:"+n,i,o),s||(s=await this.lookupUrl("http:"+n,i,o),(s||t.request.referrer.indexOf("/http://",2)>0)&&(e=!0)),n=(e?"http:":"https:")+n}else if(s=await this.lookupUrl(n,i,o),!s&&n.startsWith("http://")){const t=n.replace("http://","https://");s=await this.lookupUrl(t,i,o),s&&(n=t)}if(!s&&this.fuzzyPrefixSearch&&(s=await this.lookupQueryPrefix(n)),s&&s.origURL){const t=await this.lookupUrl(s.origURL,s.origTS||s.ts);t&&(n=t.url,s=t)}if(!s)return null;const a=s.status,u=s.statusText||Object(B.getStatusText)(a);let h=null;if(!Object(R.i)()&&(h=await this.loadPayload(s),!h))return null;const c=Object(R.j)(s.respHeaders),l=new Date(s.ts),d=s.extraOpts||null;return new L.a({url:n,payload:h,status:a,statusText:u,headers:c,date:l,extraOpts:d})}async loadPayload(t){if(t.digest&&!t.payload){const e=await this.db.get("payload",t.digest);if(!e)return null;const{payload:r}=e;return r}return t.payload}async lookupUrl(t,e,r={}){const i=this.db.transaction("resources","readonly");if(e){const r=await i.store.get([t,e]);if(r)return r}let n=null,s=r.skip||0;for await(const r of i.store.iterate(this.getLookupRange(t))){if(n&&r.value.ts>e){if(0==s){return r.value.ts-ee?++a:n?(yield o.value,o=await o.continue()):o=await o.continue(r[a])}}async resourcesByUrlAndMime(t,e,r=1e3,i=!0,n="",s=""){const o=e?null:r,a=await this.db.getAll("resources",this.getLookupRange(t,i?"prefix":"exact",n,s),o);e=e.split(",");const u=[];for(const t of a)for(const i of e)if(!i||t.mime&&t.mime.startsWith(i)){if(u.push(this.resJson(t)),u.length===r)return u;break}return u}async resourcesByMime(t,e=100,r="",i="",n=0){const s=[];(t=t.split(",")).sort();let o=[];r&&o.push([r,n,i]);for(const e of t)(!r||!e||e>r)&&o.push([e,0,""]);for await(const t of this.matchAny("resources","mimeStatusUrl",o,0))if(s.push(this.resJson(t)),s.length===e)break;return s}async deletePage(t){const e=this.db.transaction("pages","readwrite"),r=await e.store.get(t);await e.store.delete(t);const i=await this.deletePageResources(t);return{pageSize:r&&r.size||0,dedupSize:i}}async deletePageResources(t){const e={},r=this.db.transaction("resources","readwrite");let i=await r.store.index("pageId").openCursor(t),n=0;for(;i;){const t=i.value.digest;t?e[t]=(e[t]||0)+1:i.value.payload&&(n+=i.value.payload.length),r.store.delete(i.primaryKey),i=await i.continue()}await r.done;const s=this.db.transaction(["payload","digestRef"],"readwrite"),o=s.objectStore("digestRef");for(const t of Object.keys(e)){const r=await o.get(t);r&&(r.count-=e[t]),r&&r.count>=1?o.put(r):(n+=r?r.size:0,o.delete(t),s.objectStore("payload").delete(t))}return await s.done,n}getLookupRange(t,e,r,i){let n,s,o;switch(e){case"prefix":s=t.slice(0,-1)+String.fromCharCode(t.charCodeAt(t.length-1)+1),n=[t],s=[s];break;case"host":const e=new URL(t).origin;n=[e+"/"],s=[e+"0"];break;case"exact":default:n=[t],s=[t+"!"]}return r?(n=[r,i||""],o=!0):o=!1,IDBKeyRange.bound(n,s,o,!0)}}class M{constructor(){this.repeats={}}getSkipCount(t,e,r){if("POST"!==r&&!e.endsWith(".m3u8"))return 0;t.replacesClientId&&delete this.repeats[t.replacesClientId];const i=t.resultingClientId||t.clientId;return i?(void 0===this.repeats[i]&&(this.repeats[i]={}),void 0===this.repeats[i][e]?this.repeats[i][e]=0:this.repeats[i][e]++,this.repeats[i][e]):0}}var W=r(1),j=r(55),H=r.n(j),z=r(4),G=r(37);const q=["script","style","header","footer","banner-div","noscript"];var X=r(19);class Y extends X.a{constructor(t,e=null,r=null){super(),this.reader=t,this.abort=e,this.loadId=r,this.anyPages=!1,this.detectPages=!1,this._lastRecord=null,this.metadata={},this.pageMap={},this.pages=[],this.lists=[]}parseWarcInfo(t){if(!t.payload)return;const e=new TextDecoder("utf-8").decode(t.payload);for(const t of e.split("\n"))if(t.startsWith("json-metadata:"))try{const e=JSON.parse(t.slice("json-metadata:".length));if("collection"===e.type&&(this.metadata.desc=e.desc,this.metadata.title=e.title),e.pages&&e.pages.length){this.pages=this.pages.concat(e.pages);for(const t of e.pages)t.ts=Object(R.m)(t.timestamp).getTime(),this.pageMap[t.ts+"/"+t.url]={page:t};this.anyPages=!0}e.lists&&e.lists.length&&(this.lists=this.lists.concat(e.lists))}catch(t){console.log("Page Add Error",t.toString())}}index(t){if("warcinfo"!==t.warcType){if(this._lastRecord)return this._lastRecord.warcTargetURI!=t.warcTargetURI?(this.indexReqResponse(this._lastRecord,null),void(this._lastRecord=t)):void("request"===t.warcType&&"response"===this._lastRecord.warcType?(this.indexReqResponse(this._lastRecord,t),this._lastRecord=null):"response"===t.warcType&&"request"===this._lastRecord.warcType?(this.indexReqResponse(t,this._lastRecord),this._lastRecord=null):(this.indexReqResponse(this._lastRecord,null),this._lastRecord=t));this._lastRecord=t}else this.parseWarcInfo(t)}indexDone(){this._lastRecord&&(this.indexReqResponse(this._lastRecord),this._lastRecord=null)}shouldIndexMetadataRecord(t){const e=t.warcTargetURI;return!(!e||!e.startsWith("metadata://"))}parseRevisitRecord(t){const e=t.warcTargetURI.split("#")[0],r=(t.warcDate,new Date(t.warcDate).getTime()),i=t.warcRefersToTargetURI,n=new Date(t.warcRefersToDate).getTime();return i===e&&n===r?null:{url:e,ts:r,origURL:i,origTS:n,digest:t.warcPayloadDigest,pageId:null}}indexReqResponse(t,e){const r=this.parseRecords(t,e);r&&this.addResource(r)}parseRecords(t,e){switch(t.warcType){case"revisit":return this.parseRevisitRecord(t);case"resource":e=null;break;case"response":break;case"metadata":if(!this.shouldIndexMetadataRecord(t))return null;break;default:return null}const r=t.warcTargetURI.split("#")[0],i=t.warcDate;let n,s=200,o="OK",a=0,u="";if(t.httpHeaders){if(s=Number(t.httpHeaders.statusCode)||200,e&&"OPTIONS"===e.httpHeaders.method)return null;if(o=t.httpHeaders.statusText,n=Object(R.j)(t.httpHeaders.headers),u=(n.get("content-type")||"").split(";")[0],a=parseInt(n.get("content-length")||0),206===s){const t=n.get("content-range"),e=`bytes 0-${a-1}/${a}`;if(t&&t!==e)return null}if(s>300&&s<400){const t=n.get("location");if(t&&new URL(t,r).href===r)return null}}else n=new Headers,n.set("content-type",t.warcContentType),n.set("content-length",t.warcContentLength),u=t.warcContentType,a=t.warcContentLength;let h=null;if(e&&e.httpHeaders.headers)try{const t=new Headers(e.httpHeaders.headers).get("cookie");t&&n.set("x-wabac-preset-cookie",t),h=e.httpHeaders.headers.get("Referer")}catch(t){console.warn(t)}if(void 0===this.detectPages&&(this.detectPages=!this.anyPages),this.detectPages&&function(t,e,r){if(200!=e)return!1;if(!t.startsWith("http:")&&!t.startsWith("https:")&&!t.startsWith("blob:"))return!1;if(t.endsWith("/robots.txt"))return!1;const i=t.split("?",2);if(2===i.length&&i[1].length>i[0].length)return!1;if(i[0].substring(i[0].lastIndexOf("/")+1).startsWith("."))return!1;if(r&&"text/html"!==r)return!1;return!0}(r,s,u)){const t=r;this.addPage({url:r,date:i,title:t})}const c=new Date(i).getTime(),l=Object.fromEntries(n.entries()),d=t.warcPayloadDigest,f=t.payload,p={url:r,ts:c,status:s,mime:u,respHeaders:l,digest:d,payload:f,reader:f?null:t.reader,referrer:h};this.pageMap[c+"/"+r]&&f&&u.startsWith("text/")&&(this.pageMap[c+"/"+r].textPromise=async function(t,e,r,i){const n=new H.a,s=[];let o=null;n.on("text",(t,e)=>{if(o)return;const r=t.text.trim();r&&s.push(r)}),n.on("startTag",t=>{!t.selfClosing&&q.includes(t.tagName)&&(o=t.tagName)}),n.on("endTag",t=>{t.tagName===o&&(o=null)});const a=new z.PassThrough({encoding:"utf8"});(r||i)&&(e=await Object(G.a)(e,r,i)),a.push(e),a.push(null),a.pipe(n);const u=new Promise(t=>{n.on("end",()=>{t(s.join(" "))})});return await u}(0,f,n.get("content-encoding"),n.get("transfer-encoding")));const m=t.warcHeader("WARC-JSON-Metadata");if(m)try{p.extraOpts=JSON.parse(m)}catch(t){}const w=t.warcHeader("WARC-Page-ID");return w&&(p.pageId=w),p}filterRecord(t){return null}async load(t,e,r){this.db=t;const i=new W.d(this.reader);let n=0,s=0;try{for await(const t of i){if(!t.warcType){console.log("skip empty record");continue}if(self.interruptLoads&&this.loadId&&self.interruptLoads[this.loadId])throw e(Math.round(i.offset/r*95),"Loading Canceled",i.offset,r),self.interruptLoads[this.loadId](),this.abort&&this.abort.abort(),new R.b;s=(new Date).getTime(),s-n>500&&(e(Math.round(i.offset/r*95),null,i.offset,r),n=s);const o=this.filterRecord(t);if("done"===o){this.abort&&this.abort.abort();break}if("skip"!==o){"skipContent"===o?await t.skipFully():await t.readFully(),this.index(t,i);try{await Promise.all(this.promises)}catch(t){console.warn(t.toString())}this.promises=[]}}}catch(t){if(t instanceof R.b)throw t;e(Math.round(i.offset/r*95),`Sorry there was an error downloading. Please try again (${t})`,i.offset,r),console.warn(t)}return this.indexDone(),e(95),await this.finishIndexing(),e(100),this.metadata}async _finishLoad(){if(this.pages.length){for(const{page:t,textPromise:e}of Object.values(this.pageMap))if(e)try{t.text=await e}catch(t){console.warn("Error adding text: "+t.toString())}this.promises.push(this.db.addPages(this.pages))}this.lists.length&&this.promises.push(this.db.addCuratedPageLists(this.lists,"bookmarks","public"))}}class V extends Y{constructor(t){super(t),this.detectPages=!1}addPage(){}async load(){const t=await new W.d(this.reader).parse();if(!t)return null;const e=this.parseRecords(t,null);return e&&"revisit"!==t.warcType||await t.readFully(),e}}class K extends Y{filterRecord(t){if("warcinfo"!=t.warcType)return"done"}}const J="https://helper-proxy.webrecorder.workers.dev";function Z(t,e,r,i,n){if(t.startsWith("blob:"))return new tt(t,n,r);if(t.startsWith("http:")||t.startsWith("https:")||t.startsWith("file:"))return new Q(t,e,r);if(t.startsWith("googledrive:"))return new $(t,e,r,i);throw new Error("Invalid URL: "+t)}class Q{constructor(t,e,r=null,i=!1){this.url=t,this.headers=e||{},this.length=r,this.canLoadOnDemand=i,this.isValid=!1}async doInitialFetch(t){const e=new Headers(this.headers);e.set("Range","bytes=0-"),this.isValid=!1;let r=null,i=null;if(t)try{i=await fetch(this.url,{headers:e,method:"HEAD"}),200!==i.status&&206!=i.status||(this.canLoadOnDemand=206===i.status||"bytes"===i.headers.get("Accept-Ranges"),this.isValid=!0)}catch(t){}if(!this.isValid){r=new AbortController;const t=r.signal;i=await fetch(this.url,{headers:e,signal:t}),this.canLoadOnDemand=206===i.status||"bytes"===i.headers.get("Accept-Ranges"),this.isValid=206===i.status||200===i.status}if(null===this.length&&(this.length=Number(i.headers.get("Content-Length")),!this.length&&206===i.status)){let t=i.headers.get("Content-Range");t&&(t=t.split("/"),2===t.length&&(this.length=t[1]))}if(null===this.length)try{const t=await fetch(`${J}/c/${this.url}`),e=await t.json();e.size&&(this.length=e.size)}catch(t){console.log("Error fetching from helper: "+t.toString())}return this.length=Number(this.length||0),{response:i,abort:r}}async getLength(){if(null===this.length){const{response:t,abort:e}=await this.doInitialFetch(!0);e&&e.abort()}return this.length}async getRange(t,e,r=!1,i=null){const n=new Headers(this.headers);n.set("Range",`bytes=${t}-${t+e-1}`);const s={signal:i,headers:n};let o=null;try{o=await fetch(this.url,s)}catch(t){throw console.log(t),new RangeError(this.url)}if(206!=o.status)throw 401===o.status||403===o.status?new R.a(this.url,o.status):new RangeError(this.url,o.status);return r?o.body:new Uint8Array(await o.arrayBuffer())}}class ${constructor(t,e,r,i){this.fileId=t.slice("googledrive://".length),this.apiUrl=`https://www.googleapis.com/drive/v3/files/${this.fileId}?alt=media`,this.canLoadOnDemand=!0,this.headers=e,i&&i.publicUrl?this.publicUrl=i.publicUrl:this.publicUrl=null,this.length=r,this.isValid=!1}async getLength(){return this.length}async doInitialFetch(t){let e=null,r=null;if(this.publicUrl){e=new Q(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}if(!e.isValid&&(r&&r.abort&&r.abort.abort(),await this.refreshPublicUrl())){e=new Q(this.publicUrl,null,this.length);try{r=await e.doInitialFetch(t)}catch(t){}!e.isValid&&r&&r.abort&&r.abort.abort()}}return e&&e.isValid||(this.publicUrl=null,e=new Q(this.apiUrl,this.headers,this.length),r=await e.doInitialFetch(t)),this.isValid=e.isValid,this.length||(this.length=e.length),r}async getRange(t,e,r=!1,i){let n=null;if(this.publicUrl){n=new Q(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(s){if(await this.refreshPublicUrl()){n=new Q(this.publicUrl,null,this.length);try{return await n.getRange(t,e,r,i)}catch(t){}}}this.publicUrl=null}return n=new Q(this.apiUrl,this.headers,this.length),await n.getRange(t,e,r,i)}async refreshPublicUrl(){try{const t=await fetch(`${J}/g/${this.fileId}`),e=await t.json();if(e.url)return this.publicUrl=e.url,!0}catch(t){}return!1}}class tt{constructor(t,e=null,r=null){this.url=t,this.blob=e,this.size=this.blob?this.blob.size:r,this.canLoadOnDemand=!1}get length(){return this.size}get isValid(){return!!this.blob}async doInitialFetch(t){if(!this.blob){const t=await fetch(this.url);this.blob=await t.blob()}let e=null;return t||(e=this.blob.stream?this.blob.stream():await this.getReadableStream(this.blob)),{response:new Response(e),stream:e}}async getLength(){if(!this.blob&&!this.blob.size){let t=await fetch(this.url);this.blob=await t.blob(),this.size=this.blob.size}return this.size}async getRange(t,e,r=!1,i){if(!this.blob){const i=new Headers;i.set("Range",`bytes=${t}-${t+e-1}`);const n=await fetch(this.url,{headers:i});if(n.headers.get("content-range"))return r?n.body:new Uint8Array(await n.arrayBuffer());this.blob=await n.blob()}const n=this.blob.slice(t,t+e,"application/octet-stream");if(r)return n.stream?n.stream():await this.getReadableStream(n);try{const t=n.arrayBuffer?await n.arrayBuffer():await this.getArrayBuffer(n);return new Uint8Array(t)}catch(t){return console.log("error reading blob",t),null}}getArrayBuffer(t){return new Promise(e=>{let r=new FileReader;r.onloadend=()=>{e(r.result)},r.readAsArrayBuffer(t)})}async getReadableStream(t){const e=await this.getArrayBuffer(t);return new ReadableStream({start(t){t.enqueue(new Uint8Array(e)),t.close()}})}}class et extends U{constructor(t,e=!1){super(t),this.noCache=e,this.useRefCounts=!1}async loadRecordFromSource(t){const e=await this.loadSource(t.source),r=new V(e);return await r.load()}async loadPayload(t,e=0){let r=await super.loadPayload(t);if(r&&t.respHeaders&&"warc/revisit"!==t.mime)return r;const i=await this.loadRecordFromSource(t);if(!i)return console.log("No WARC Record Loaded for: "+t.url),null;if(i.url!==t.url)return console.log(`Wrong url: expected ${t.url}, got ${i.url}`),null;if(i.ts!==t.ts){if(1e3*Math.floor(i.ts/1e3)!==t.ts)return console.log(`Wrong timestamp: expected ${t.ts}, got ${i.ts}`),null}if(i.digest!==t.digest&&console.log(`Wrong digest: expected ${t.digest}, got ${i.digest}`),i.origURL){const n=await this.lookupUrl(i.origURL,i.origTS,{noRevisits:!0});return n&&(r||(e<2?r=await this.loadPayload(n,e+1):console.warn("Avoiding revisit lookup loop for: "+JSON.stringify(i)),r))?(t.respHeaders=n.respHeaders,t.mime=n.mime,n.extraOpts&&(t.extraOpts=n.extraOpts),this.noCache||(delete t.payload,await this.db.put("resources",t)),r):null}const n=i.digest;if(!this.noCache&&i.reader&&n&&(i.reader=new nt(this,i.reader,n,t.url)),r=i.payload,!r&&!i.reader)return null;try{r&&!this.noCache&&await this.commitPayload(r,n)}catch(e){console.warn("Payload Update Error: "+t.url),console.warn(e)}if(!(t.respHeaders&&t.digest||(t.respHeaders=i.respHeaders,t.digest=n,i.extraOpts&&(t.extraOpts=i.extraOpts),this.noCache)))try{await this.db.put("resources",t)}catch(e){console.warn("Resource Update Error: "+t.url),console.warn(e)}return r||i.reader}async commitPayload(t,e){if(!t||0===t.length)return;const r=this.db.transaction(["payload","digestRef"],"readwrite");try{if(r.objectStore("payload").put({payload:t,digest:e}),this.useRefCounts){const i=await r.objectStore("digestRef").get(e);i&&(i.size=t.length,r.objectStore("digestRef").put(i))}await r.done}catch(t){console.warn("Payload Commit Error: "+t)}}}class rt extends et{constructor(t,e,r=!1){super(t,r),this.loader=e}updateHeaders(t){this.loader.headers=t}async loadSource(t){const{start:e,length:r}=t;return await this.loader.getRange(e,r,!0)}}class it extends et{constructor(t,e,r,i=!1){super(t,i),this.remoteUrlPrefix=e,this.headers=r}updateHeaders(t){this.headers=t}async loadSource(t){const{start:e,length:r}=t,i=new Headers(this.headers),n=Z(new URL(t.path,this.remoteUrlPrefix).href,i);return await n.getRange(e,r,!0)}}class nt extends W.b{constructor(t,e,r,i=""){super(),this.db=t,this.reader=e,this.digest=r,this.url=i,this.chunks=[],this.size=0,this.fullbuff=null,this.commit=!0,this.alreadyRead=!1}setLimitSkip(t=-1,e=0){(-1!=t||e>0)&&(this.commit=!1),this.reader.setLimitSkip(t,e)}async*[Symbol.asyncIterator](){if(!this.alreadyRead){for await(const t of this.reader)this.chunks.push(t),this.size+=t.byteLength,yield t;this.fullbuff=W.b.concatChunks(this.chunks,this.size),0!==this.reader.limit?console.warn(`Expected payload not consumed, ${this.reader.limit} bytes left`):this.commit&&await this.db.commitPayload(this.fullbuff,this.digest),this.chunks=[],this.alreadyRead=!0}}async readFully(){for await(const t of this);return this.fullbuff}}class st extends Y{constructor(t,e,r){super(t,e,r),this.cdxindexer=null}filterRecord(t){switch(t.warcType){case"warcinfo":case"revisit":return null;case"request":return"skipContent";case"metadata":return this.shouldIndexMetadataRecord(t)?null:"skipContent"}const e=t.warcTargetURI,r=new Date(t.warcDate).getTime();if(this.pageMap[r+"/"+e])return t._isPage=!0,null}index(t,e){if(t._isPage)return super.index(t,e);if("warcinfo"===t.warcType)return void this.parseWarcInfo(t);this.cdxindexer||(this.cdxindexer=new W.c({},null));const r=this.cdxindexer.indexRecord(t,e,"");r&&this.addCdx(r)}addCdx(t){const{url:e,mime:r}=t,i=Number(t.status)||200,n=Object(R.m)(t.timestamp).getTime(),s={path:t.filename,start:Number(t.offset),length:Number(t.length)};let{digest:o}=t;o&&-1===o.indexOf(":")&&(o="sha1:"+o);const a={url:e,ts:n,status:i,digest:o,mime:r,loaded:!1,source:s};this.batch.length>=3e3&&(this.promises.push(this.db.addResources(this.batch)),this.batch=[],console.log(`Read ${this.count+=3e3} records`)),this.batch.push(a)}}class ot extends st{async load(t){this.db=t;let e=this.reader;e.iterLines||(e=new W.a(this.reader));for await(const t of e.iterLines()){let e,r,i,n=t.trimEnd();if(!n.startsWith("{")){const t=n.indexOf(" {");if(t<0)continue;[r,i]=n.split(" ",2),n=n.slice(t)}try{e=JSON.parse(n)}catch(t){console.log("JSON Parser error on: "+n);continue}e.timestamp=i,e.url||(e.url=r),this.addCdx(e)}this.indexDone(),await this.finishIndexing()}}const at=/(?:([\d]+)[^\/]*\/)?(http.*)/;class ut{constructor(t){this.sourceUrl=t.sourceUrl,this.type=t.extraConfig&&t.extraConfig.sourceType||"kiwix",this.notFoundPageUrl=t.extraConfig&&t.extraConfig.notFoundPageUrl}async getAllPages(){return[]}async getResource(t,e,r){const{url:i,headers:n}=lt(t,e);let s=n;if("kiwix"===this.type){const e=await this.resolveHeaders(i);if(!e){if(this.notFoundPageUrl&&"navigate"===t.request.mode){const t=await fetch(this.notFoundPageUrl);if(200===t.status){const e={"Content-Type":"text/html"},r=await t.text();return new Response(r.replace("$URL",i),{status:404,headers:e})}}return null}let{headers:r,encodedUrl:n,date:o,status:a,statusText:u,hasPayload:h}=e;if(s.has("Range")){const t=s.get("Range");s={Range:t}}let c=null,l=null;h&&(l=await fetch(this.sourceUrl+"A/"+n,{headers:s}),l.body&&(c=new W.a(l.body.getReader(),!1)),206===l.status&&(a=206,u="Partial Content",r.set("Content-Length",l.headers.get("Content-Length")),r.set("Content-Range",l.headers.get("Content-Range")),r.set("Accept-Ranges","bytes"))),c||(c=new Uint8Array([])),o||(o=new Date),r||(r=new Headers);const d=!1,f=!1;return new L.a({payload:c,status:a,statusText:u,headers:r,url:i,date:o,noRW:f,isLive:d})}}async resolveHeaders(t){const e=t.slice(t.indexOf("//")+2);let r=encodeURI(e);r=encodeURIComponent(e);let i=await fetch(this.sourceUrl+"H/"+r);if(200!==i.status)return null;let n=null,s=null,o=null,a=null,u=!1;try{const e=await W.d.parse(i.body);if("revisit"===e.warcType){const r=e.warcHeaders.headers.get("WARC-Refers-To-Target-URI");if(r&&r!==t)return await this.resolveHeaders(r)}s=new Date(e.warcDate),e.httpHeaders?(n=e.httpHeaders.headers,o=Number(e.httpHeaders.statusCode),a=e.httpHeaders.statusText,u="0"!==e.httpHeaders.headers.get("Content-Length")):"resource"===e.warcType&&(n=new Headers,n.set("Content-Type",e.warcContentType),n.set("Content-Length",e.warcContentLength),o=200,a="OK",u=e.warcContentLength>0),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:u}}}class ht{constructor(t){this.replayPrefix=t.replayPrefix,this.idMod=void 0!==t.idMod?t.idMod:"id_",this.redirMod=void 0!==t.redirMod?t.redirMod:"mp_",this.redirectMode=this.idMod===this.redirMod?"follow":"manual"}async getAllPages(){return[]}getUrl(t,e){let r=this.replayPrefix;return(e||t.timestamp)&&(r+=t.timestamp+e+"/"),r+t.url}async getResource(t,e,r){let i=await fetch(this.getUrl(t,this.idMod),{credentials:"same-origin",redirect:this.redirectMode,mode:"cors"});if(i.status>=400&&!i.headers.get("memento-datetime"))return null;const n=await this.getRedirect(t,i,e);let s=null,o=!1;n?(i=Response.redirect(n.path,307),o=!0,s=n.timestamp):s=t.timestamp;const a=t.url,u=s?Object(R.m)(s):new Date;return L.a.fromResponse({url:a,response:i,date:u,noRW:o})}async getRedirect(t,e,r){if("opaqueredirect"===e.type)e=await fetch(this.getUrl(t,this.redirMod),{credentials:"same-origin",redirect:"follow",mode:"cors"});else if(!e.redirected)return null;const i=e.url.indexOf(this.replayPrefix)+this.replayPrefix.length,n=e.url.slice(i),s=n.match(at);return s?{timestamp:s[1],path:r+s[1]+"mp_/"+s[2]}:{path:r+n}}}class ct{constructor(t,e=!1,r=!0){this.prefix=t||"",this.proxyPathOnly=e,this.isLive=r}async getAllPages(){return[]}async getResource(t,e,r){const{headers:i,credentials:n,url:s}=lt(t,e);let o;if(this.proxyPathOnly){const t=new URL(s);o=this.prefix+t.pathname+t.search}else o=this.prefix+s;const a=await fetch(o,{method:t.request.method,body:t.request.body,headers:i,credentials:n,mode:"cors",redirect:"follow"});return L.a.fromResponse({url:s,response:a,date:new Date,noRW:!1,isLive:this.isLive})}}function lt(t,e,r=!0){let i,n,s;if(r){i=new Headers(t.request.headers),n=t.request.referrer;const r=n.indexOf("/http",e.length-1);r>0&&(n=n.slice(r+1),i.set("X-Proxy-Referer",n)),s=t.request.credentials}else i=new Headers,s="omit";let o=t.url;if(o.startsWith("//"))try{o=new URL(n).protocol+o}catch(t){o="https:"+o}return{referrer:n,headers:i,credentials:s,url:o}}var dt=r(31),ft=r.n(dt),pt=r(40);class mt extends rt{constructor(t,e,r=null,i=!1,n){super(t,e,i),this.zipreader=new wt(e),this.externalSources=[],this.fuzzyUrlRules=[],this.useSurt=!0,this.fullConfig=n,this.textIndex=n&&n.metadata&&n.metadata.textIndex,e.canLoadOnDemand=!0,r&&this.initConfig(r)}_initDB(t,e,r,i){if(super._initDB(t,e,r,i),!e){t.createObjectStore("ziplines",{keyPath:"prefix"}),t.createObjectStore("zipEntries",{keyPath:"filename"})}}async init(){await super.init(),await this.loadZipEntries()}async close(){super.close(),caches.delete("cache:"+this.name.slice("db:".length))}async clearZipData(){const t=["zipEntries","ziplines"];for(const e of t)await this.db.clear(e)}async clearAll(){await super.clearAll(),await this.clearZipData()}updateHeaders(t){this.zipreader.loader.headers=t}async loadZipEntries(){const t=await this.db.getAll("zipEntries");if(!t.length)return;const e={};for(const r of t)e[r.filename]=r;this.zipreader.entries=e}async saveZipEntries(t){const e=this.db.transaction("zipEntries","readwrite");e.store.clear();for(const r of Object.values(t))e.store.put(r);await e.done,this.db.clear("ziplines")}async loadZiplinesIndex(t,e,r){let i=0,n=0,s=0,o=[],a="";for await(const u of t.iterLines()){if(i+=u.length,i===u.length&&u.startsWith("!meta")){const t=u.indexOf(" {");if(t<0){console.warn("Invalid Meta Line: "+u);continue}const e=JSON.parse(u.slice(t));e.filename&&(a=e.filename),"cdxj-gzip-1.0"!==e.format&&console.log(`Unknown CDXJ format "${e.format}", archive may not parse correctly`);continue}let t;if(u.indexOf("\t")>0){let[e,r,i,n]=u.split("\t");i=Number(i),n=Number(n),t={prefix:e,filename:r,offset:i,length:n,loaded:!1},this.useSurt=!0}else{const e=u.indexOf(" {");if(e<0){console.log("Invalid Index Line: "+u);continue}const r=u.slice(0,e);let{offset:i,length:n,filename:s}=JSON.parse(u.slice(e));s=s||a,t={prefix:r,filename:s,offset:i,length:n,loaded:!1}}s=(new Date).getTime(),s-n>500&&(e(Math.round(i/r*100),null,i,r),n=s),o.push(t)}const u=this.db.transaction("ziplines","readwrite");for(const t of o)u.store.put(t);try{await u.done}catch(t){console.log("Error loading ziplines index: ",t)}}async load(t,e,r){if(t!==this)return void console.error("wrong db");const i=await t.zipreader.load(!0);await t.saveZipEntries(i);const n=[];let s;i["webarchive.yaml"]&&(s=await this.loadMetadata(i,await t.zipreader.loadFile("webarchive.yaml")));for(const r of Object.keys(i))if(r.endsWith(".cdx")||r.endsWith(".cdxj")){console.log("Loading CDX "+r);const e=await t.zipreader.loadFile(r);n.push(new ot(e).load(t))}else if(r.endsWith(".idx")){if(this.loader.canLoadOnDemand){console.log("Loading IDX "+r);const i=t.zipreader.getCompressedSize(r);n.push(t.loadZiplinesIndex(await t.zipreader.loadFile(r),e,i))}}else if(r.endsWith(".warc.gz")||r.endsWith(".warc"))if(!s&&this.loader.canLoadOnDemand){const i=new AbortController,n=await t.zipreader.loadFile(r,{signal:i.signal,unzip:!0}),o=new K(n,i),a=t.zipreader.getCompressedSize(r);s=await o.load(t,e,a)}else if(!this.loader.canLoadOnDemand){const i=await t.zipreader.loadFile(r,{unzip:!0}),n=new Y(i);n.detectPages=!1;const o=t.zipreader.getCompressedSize(r);s=await n.load(t,e,o)}return await Promise.all(n),s||{}}async loadPagesCSV(t){const e=(new TextDecoder).decode(await t.readFully()),r=await Object(pt.csv2jsonAsync)(e);r&&r.length&&await this.addPages(r)}initConfig(t){if(void 0!==t.decodeResponses&&(this.fullConfig.decode=t.decodeResponses),void 0!==t.useSurt&&(this.useSurt=t.useSurt),t.es)for(const[e,r]of t.es){const t=new ct(r,!0,!1);this.externalSources.push({prefix:e,external:t})}if(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)}async getTextIndex(){const t={"Content-Type":"application/ndjson"};if(!this.textIndex)return new Response("",{headers:t});const e=this.zipreader.getCompressedSize(this.textIndex);e>0&&(t["Content-Length"]=""+e);const r=await this.zipreader.loadFile(this.textIndex,{unzip:!0});return new Response(r.getReadableStream(),{headers:t})}async loadMetadata(t,e){const r=(new TextDecoder).decode(await e.readFully()),i=ft.a.safeLoad(r);void 0!==i.config&&this.initConfig(i.config);const n={desc:i.desc,title:i.title};i.textIndex&&(n.textIndex=i.textIndex);const s=i.pages||[];s&&s.length?await this.addPages(s):t["pages.csv"]&&await this.loadPagesCSV(await this.zipreader.loadFile("pages.csv"));const o=i.pageLists||[];return o&&o.length&&await this.addCuratedPageLists(o,"pages","show"),n}async loadRecordFromSource(t){let e,r=0,i=-1;const n=t.source;if("string"==typeof n)e=n;else{if("object"!=typeof n)return null;r=n.start,i=n.length,e=n.path}let s=null;const o=await this.zipreader.loadFileCheckDirs(e,r,i);return s=new V(o),await s.load()}getSurt(t){try{t=t.replace(/www\d*\./,"");const e=new URL(t);let r=e.hostname.split(".").reverse().join(",");return e.port&&(r+=":"+e.port),r+=")",r+=e.pathname,e.search&&(e.searchParams.sort(),r+=e.search),r.toLowerCase()}catch(e){return t}}async loadFromZiplines(t,e){e&&Object(R.f)(new Date(e).toISOString());let r,i;const n=this.useSurt?this.getSurt(t):t;r=n+" 9",i=n;const s=this.db.transaction("ziplines","readonly"),o=[],a=IDBKeyRange.upperBound(r,!1);for await(const t of s.store.iterate(a,"prev"))if(o.unshift(t.value),!t.value.prefix.split(" ")[0].startsWith(i))break;await s.done;const u=[];for(const t of o){if(t.loaded)continue;const e="indexes/"+t.filename,r={offset:t.offset,length:t.length,unzip:!0},i=await this.zipreader.loadFile(e,r);u.push(new ot(i).load(this)),t.loaded=!0,await this.db.put("ziplines",t)}return await Promise.all(u),u.length>0}async getResource(t,e,r){if(this.externalSources.length)for(const{prefix:i,external:n}of this.externalSources)if(t.url.startsWith(i))try{return await n.getResource(t,e,r)}catch(t){console.warn("Upstream Error",t)}let i=await super.getResource(t,e,r);if(i)return i;if(this.fuzzyUrlRules.length)for(const{match:n,replace:s}of this.fuzzyUrlRules){const o=t.url.replace(n,s);if(o&&o!==t.url&&(t.url=o,i=await super.getResource(t,e,r),i))return i}return null}async lookupUrl(t,e,r={}){try{let i=await super.lookupUrl(t,e,r);return!i||r.noRevisits&&"warc/revisit"===i.mime?(await this.loadFromZiplines(t,e)&&(i=await super.lookupUrl(t,e,r)),i):i}catch(t){return console.warn(t),null}}async resourcesByUrlAndMime(t,...e){let r=await super.resourcesByUrlAndMime(t,...e);return r.length>0||await this.loadFromZiplines(t,"")&&(r=await super.resourcesByUrlAndMime(t,...e)),r}}class wt{constructor(t,e=null){this.loader=t,this.entries=e}async load(t=!1){if(!this.entries||t){const t=await this.loader.getLength(),e=Math.min(65558,t),r=t-e,i=await this.loader.getRange(r,e);this.entries=this._loadEntries(i,r)}return this.entries}_loadEntries(t,e){const r=t.byteLength,i=new DataView(t.buffer),n=new TextDecoder("utf8"),s=new TextDecoder("ascii"),o={};let a=0,u=0,h=r;for(let e=r-22,n=Math.max(0,e-65535);e>=n;--e)if(80===t[e]&&75===t[e+1]&&5===t[e+2]&&6===t[e+3]){h=e,u=i.getUint32(e+16,!0),a=i.getUint16(e+8,!0);break}if(4294967295===u||65535===a){if(117853008!==i.getUint32(h-20,!0))return void console.warn("invalid zip64 EOCD locator");const t=this.getUint64(i,h-12,!0)-e;if(101075792!==i.getUint32(t,!0))return void console.warn("invalid zip64 EOCD record");a=this.getUint64(i,t+32,!0),u=this.getUint64(i,t+48,!0)}if(e&&(u-=e),u>=r||u<=0)for(u=-1,a=65535;++u=0&&u=8&&(a=this.getUint64(i,t,!0),t+=8,n-=8),4294967295===r&&n>=8&&(r=this.getUint64(i,t,!0),t+=8,n-=8),4294967295===f&&n>=8&&(f=this.getUint64(i,t,!0),t+=8,n-=8)),t+=n}}p.endsWith("/")||(o[p]={filename:p,deflate:d,uncompressedSize:a,compressedSize:r,localEntryOffset:f}),u+=46+h+c+l}return o}async loadFileCheckDirs(t,e,r){if(null===this.entries&&await this.load(),this.entries["archive/"+t])t="archive/"+t;else if(this.entries["warcs/"+t])t="warcs/"+t;else for(const e of Object.keys(this.entries))if(e.endsWith("/"+t)){t=e;break}return await this.loadFile(t,{offset:e,length:r,unzip:!0})}getCompressedSize(t){if(null===this.entries)return-1;const e=this.entries[t];return e?e.compressedSize:-1}async loadFile(t,{offset:e=0,length:r=-1,signal:i=null,unzip:n=!1}={}){null===this.entries&&await this.load();const s=this.entries[t];if(!s)return null;if(void 0===s.offset){const t=await this.loader.getRange(s.localEntryOffset,30),e=new DataView(t.buffer),r=e.getUint16(26,!0),i=e.getUint16(28,!0);s.offset=30+r+i+s.localEntryOffset}r=r<0?s.compressedSize:Math.min(r,s.compressedSize-e),e+=s.offset;const o=await this.loader.getRange(e,r,!0,i);return n?s.deflate?new W.a(new W.a(o.getReader(),"deflate")):new W.a(o.getReader()):new W.a(o.getReader(),s.deflate?"deflate":null)}getUint64(t,e,r){const i=t.getUint32(e,r),n=t.getUint32(e+4,r),s=r?i+2**32*n:2**32*i+n;return Number.isSafeInteger(s)||console.warn(s,"exceeds MAX_SAFE_INTEGER. Precision may be lost"),s}}class gt extends X.a{constructor(t){super(),this.har=t,this.pageRefs={}}async load(t){return this.db=t,"string"==typeof this.har&&(this.har=JSON.parse(this.har)),this.parseEntries(this.har),this.parsePages(this.har),await this.finishIndexing(),{}}parsePages(t){for(const e of t.log.pages){if(!e.pageTimings||!e.pageTimings.onLoad)continue;let t;t=e.title&&(e.title.startsWith("http:")||e.title.startsWith("https:"))?e.title:this.pageRefs[e.id];const r=e.title||t,i=e.startedDateTime;this.addPage({url:t,date:i,title:r})}}parseEntries(t){for(const e of t.log.entries){if(!e.response.content||!e.response.content.text){console.log("Skipping: "+e.request.url);continue}let t=null;try{t=Uint8Array.from(atob(e.response.content.text),t=>t.charCodeAt(0))}catch(r){t=e.response.content.text}console.log("Added: "+e.request.url);const r=new Date(e.startedDateTime).getTime(),i={};for(const{name:t,value:r}of e.response.headers)i[t]=r;this.addResource({url:e.request.url,ts:r,status:e.response.status,respHeaders:i,payload:t}),e.pageref&&!this.pageRefs[e.pageref]&&(this.pageRefs[e.pageref]=e.request.url)}}}var yt=r(118);self.interruptLoads={};class _t{constructor(){this.colldb=null,this.root=null,this._init_db=this._initDB()}async _initDB(){this.colldb=await g("collDB",1,{upgrade:(t,e,r,i)=>{t.createObjectStore("colls",{keyPath:"name"})}})}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 deleteColl(t){await this._init_db;const e=await this.colldb.get("colls",t);if(!e)return!1;e.config.dbname&&await y(e.config.dbname,{blocked(t){console.log(`Unable to delete ${e.config.dbname}: ${t}`)}}),await this.colldb.delete("colls",t)}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);if(!r)return!1;const i=r.config.metadata||{};return Object.assign(i,e),await this.colldb.put("colls",r),i}async updateSize(t,e,r){await this._init_db;const i=await this.colldb.get("colls",t);if(!i)return!1;i.config.loadSize=(i.config.loadSize||0)+e,i.config.dedupSize=(i.config.dedupSize||0)+r,await this.colldb.put("colls",i)}async _initColl(t){let e=null,r=null;switch(t.type){case"archive":e=new U(t.config.dbname);break;case"remotesource":r=Z(t.config.loadUrl,t.config.headers,t.config.size,t.config.extra),e=new rt(t.config.dbname,r,t.config.noCache);break;case"remoteprefix":e=new it(t.config.dbname,t.config.remotePrefix,t.config.headers,t.config.noCache);break;case"remotezip":r=Z(t.config.loadUrl||t.config.sourceUrl,t.config.headers,t.config.extra),e=new mt(t.config.dbname,r,t.config.extraConfig,t.config.noCache,t.config);break;case"remoteproxy":e=new ht(t.config);break;case"remotewarcproxy":e=new ut(t.config);break;case"live":e=new ct(t.config.prefix,t.config.proxyPathOnly,t.config.isLive)}if(!e)return console.log("no store found: "+t.type),null;e.initing&&await e.initing;const i=t.name,n=t.config;return t.config.root&&(this.root=i),this._createCollection({name:i,store:e,config:n})}_createCollection(t){return t}}class bt extends _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=>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)=>{e.postMessage({msg_type:"collProgress",name:r,percent:t,error:i,currentSize:n,totalSize:s})};let n;try{if(await this.hasCollection(r)?t.data.skipExisting?n=!0:(await this.deleteCollection(r),n=await this.addCollection(t.data,i)):n=await this.addCollection(t.data,i),!n)return}catch(t){return console.warn(t),void i(0,"An unexpected error occured: "+t.toString())}e.postMessage({msg_type:"collAdded",name:r});break}case"cancelLoad":{const e=t.data.name,r=new Promise(t=>self.interruptLoads[e]=t);await r,await this.deleteCollection(e),delete self.interruptLoads[e];break}case"removeColl":{const r=t.data.name;await this.hasCollection(r)&&(await this.deleteCollection(r),this.doListAll(e));break}case"listAll":this.doListAll(e)}}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){const r=t.name;let i=null,n={root:t.root||!1},s=null;const o=t.file;if(!o||!o.sourceUrl)return e(0,"Invalid Load Request"),!1;if(o.sourceUrl.startsWith("proxy:"))n.sourceUrl=o.sourceUrl.slice("proxy:".length),n.extraConfig=t.extraConfig,n.topTemplateUrl=t.topTemplateUrl,i="remotewarcproxy";else{let a=null;i="archive",n.dbname="db:"+r;let u=o.loadUrl||o.sourceUrl;u.match(/[\w]+:\/\//)||(u=new URL(u,self.location.href).href),n.decode=!0,n.onDemand=!1,n.loadUrl=u,n.sourceUrl=o.sourceUrl,n.sourceName=o.name||o.sourceUrl;try{n.sourceName.match(/https?:\/\//)&&(n.sourceName=new URL(n.sourceName).pathname)}catch(t){}n.sourceName=n.sourceName.slice(n.sourceName.lastIndexOf("/")+1),n.headers=o.headers,n.size="number"==typeof o.size?o.size:null,n.extra=o.extra,n.extraConfig=t.extraConfig,n.noCache=u.startsWith("file:")||o.noCache;const h=Z(u,o.headers,o.size,n.extra,o.blob);let c=!1;(n.sourceName.endsWith(".wacz")||n.sourceName.endsWith(".zip"))&&(s=new mt(n.dbname,h,n.extraConfig,n.noCache,n),i="remotezip",a=s,c=!0);let{abort:l,response:d,stream:f}=await h.doInitialFetch(c);if(f=f||d.body,!h.isValid){const t=h.length<=1e3?await d.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: ${d.status} ${d.statusText}\nError Details:\n${t}`),l&&l.abort(),!1}if(!h.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."),l&&l.abort(),!1;const p=h.length;if(n.sourceName.endsWith(".warc")||n.sourceName.endsWith(".warc.gz")?p<25e6||!h.canLoadOnDemand?a=new Y(f,l,r):(a=new st(f,l,r),i="remotesource",s=new rt(n.dbname,h,n.noCache)):n.sourceName.endsWith(".cdxj")||n.sourceName.endsWith(".cdx")?(n.remotePrefix=t.remotePrefix||u.slice(0,u.lastIndexOf("/")+1),a=new ot(f,l,r),i="remoteprefix",s=new it(n.dbname,n.remotePrefix,n.headers,n.noCache)):n.sourceName.endsWith(".wbn")?(a=new yt.a(await d.arrayBuffer()),n.decode=!1):n.sourceName.endsWith(".har")&&(a=new gt(await d.json()),n.decode=!1),!a)return e(0,`The ${n.sourceName} is not a known archive format that could be loaded.`),l&&l.abort(),!1;s||(s=new U(n.dbname)),await s.initing,n.onDemand=h.canLoadOnDemand;try{n.metadata=await a.load(s,e,p)}catch(t){return t instanceof R.b||e(0,"Unexpected Loading Error: "+t.toString()),!1}n.metadata.size||(n.metadata.size=p)}n.ctime=(new Date).getTime();const a={name:r,type:i,config:n};return await this.colldb.add("colls",a),!0}async deleteCollection(t){const e="db:"+t;try{await y(e,{blocked(t){console.log("Unable to delete: "+t)}})}catch(t){return console.warn(t),!1}return await this.colldb.delete("colls",t),!0}}},,,,,function(t,e,r){"use strict";const i=r(161),n=r(34),s=r(34),o=r(7).buildOptions,a=r(163);e.parse=function(t,e,r){if(r){!0===r&&(r={});const e=a.validate(t,r);if(!0!==e)throw Error(e.err.msg)}e=o(e,s.defaultOptions,s.props);const u=n.getTraversalObj(t,e);return i.convertToJson(u,e)},e.convertTonimn=r(164).convert2nimn,e.getTraversalObj=n.getTraversalObj,e.convertToJson=i.convertToJson,e.convertToJsonString=r(165).convertToJsonString,e.validate=a.validate,e.j2xParser=r(166),e.parseToNimn=function(t,r,i){return e.convertTonimn(e.getTraversalObj(t,i),r,i)}},,,,,function(t,e,r){"use strict";(function(e,i){var n=r(32);t.exports=_;var s,o=r(69);_.ReadableState=y;r(41).EventEmitter;var a=function(t,e){return t.listeners(e).length},u=r(70),h=r(43).Buffer,c=e.Uint8Array||function(){};var l=Object.create(r(22));l.inherits=r(13);var d=r(126),f=void 0;f=d&&d.debuglog?d.debuglog("stream"):function(){};var p,m=r(127),w=r(72);l.inherits(_,u);var g=["error","close","destroy","pause","resume"];function y(t,e){t=t||{};var i=e instanceof(s=s||r(10));this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,o=t.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i&&(o||0===o)?o:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new m,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.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(p||(p=r(74).StringDecoder),this.decoder=new p(t.encoding),this.encoding=t.encoding)}function _(t){if(s=s||r(10),!(this instanceof _))return new _(t);this._readableState=new y(t,this),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),u.call(this)}function b(t,e,r,i,n){var s,o=t._readableState;null===e?(o.reading=!1,function(t,e){if(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,A(t)}(t,o)):(n||(s=function(t,e){var r;i=e,h.isBuffer(i)||i instanceof c||"string"==typeof e||void 0===e||t.objectMode||(r=new TypeError("Invalid non-string/buffer chunk"));var i;return r}(o,e)),s?t.emit("error",s):o.objectMode||e&&e.length>0?("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===h.prototype||(e=function(t){return h.from(t)}(e)),i?o.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):E(t,o,e,!0):o.ended?t.emit("error",new Error("stream.push() after EOF")):(o.reading=!1,o.decoder&&!r?(e=o.decoder.write(e),o.objectMode||0!==e.length?E(t,o,e,!1):x(t,o)):E(t,o,e,!1))):i||(o.reading=!1));return function(t){return!t.ended&&(t.needReadable||t.lengthe.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(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 A(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(f("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?n.nextTick(T,t):T(t))}function T(t){f("emit readable"),t.emit("readable"),k(t)}function x(t,e){e.readingMore||(e.readingMore=!0,n.nextTick(S,t,e))}function S(t,e){for(var r=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length=e.length?(r=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):r=function(t,e,r){var i;ts.length?s.length:t;if(o===s.length?n+=s:n+=s.slice(0,t),0===(t-=o)){o===s.length?(++i,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=s.slice(o));break}++i}return e.length-=i,n}(t,e):function(t,e){var r=h.allocUnsafe(t),i=e.head,n=1;i.data.copy(r),t-=i.data.length;for(;i=i.next;){var s=i.data,o=t>s.length?s.length:t;if(s.copy(r,r.length-t,0,o),0===(t-=o)){o===s.length?(++n,i.next?e.head=i.next:e.head=e.tail=null):(e.head=i,i.data=s.slice(o));break}++n}return e.length-=n,r}(t,e);return i}(t,e.buffer,e.decoder),r);var r}function I(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,n.nextTick(N,e,t))}function N(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function O(t,e){for(var r=0,i=t.length;r=e.highWaterMark||e.ended))return f("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?I(this):A(this),null;if(0===(t=v(t,e))&&e.ended)return 0===e.length&&I(this),null;var i,n=e.needReadable;return f("need readable",n),(0===e.length||e.length-t0?R(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&I(this)),null!==i&&this.emit("data",i),i},_.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(t,e){var r=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=t;break;case 1:s.pipes=[s.pipes,t];break;default:s.pipes.push(t)}s.pipesCount+=1,f("pipe count=%d opts=%j",s.pipesCount,e);var u=(!e||!1!==e.end)&&t!==i.stdout&&t!==i.stderr?c:_;function h(e,i){f("onunpipe"),e===r&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,f("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),t.removeListener("drain",l),t.removeListener("error",w),t.removeListener("unpipe",h),r.removeListener("end",c),r.removeListener("end",_),r.removeListener("data",m),d=!0,!s.awaitDrain||t._writableState&&!t._writableState.needDrain||l())}function c(){f("onend"),t.end()}s.endEmitted?n.nextTick(u):r.once("end",u),t.on("unpipe",h);var l=function(t){return function(){var e=t._readableState;f("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&a(t,"data")&&(e.flowing=!0,k(t))}}(r);t.on("drain",l);var d=!1;var p=!1;function m(e){f("ondata"),p=!1,!1!==t.write(e)||p||((1===s.pipesCount&&s.pipes===t||s.pipesCount>1&&-1!==O(s.pipes,t))&&!d&&(f("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function w(e){f("onerror",e),_(),t.removeListener("error",w),0===a(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",y),_()}function y(){f("onfinish"),t.removeListener("close",g),_()}function _(){f("unpipe"),r.unpipe(t)}return r.on("data",m),function(t,e,r){if("function"==typeof t.prependListener)return t.prependListener(e,r);t._events&&t._events[e]?o(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]:t.on(e,r)}(t,"error",w),t.once("close",g),t.once("finish",y),t.emit("pipe",r),s.flowing||(f("pipe resume"),r.resume()),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?o-4:o;for(r=0;r>16&255,u[c++]=e>>8&255,u[c++]=255&e;2===a&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,u[c++]=255&e);1===a&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,u[c++]=e>>8&255,u[c++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,n=r%3,s=[],o=0,a=r-n;oa?a:o+16383));1===n?(e=t[r-1],s.push(i[e>>2]+i[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],s.push(i[e>>10]+i[e>>4&63]+i[e<<2&63]+"="));return s.join("")};for(var i=[],n=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function c(t,e,r){for(var n,s,o=[],a=e;a>18&63]+i[s>>12&63]+i[s>>6&63]+i[63&s]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},function(t,e,r){"use strict";var i=r(32);function n(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var r=this,s=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return s||o?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||i.nextTick(n,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(i.nextTick(n,r,t),r._writableState&&(r._writableState.errorEmitted=!0)):e&&e(t)})),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.finished=!1,this._writableState.errorEmitted=!1)}}},function(t,e,r){(function(t){var i=void 0!==t&&t||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function s(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new s(n.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new s(n.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r(129),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,r(6))},function(t,e,r){"use strict";var i=r(131).Buffer,n=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===n||!n(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=h,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=c,this.end=l,e=3;break;default:return this.write=d,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,r=function(t,e,r){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==r?r:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var r=t.toString("utf16le",e);if(r){var i=r.charCodeAt(r.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function h(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function c(t,e){var r=(t.length-e)%3;return 0===r?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function l(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,r;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r=0)return n>0&&(t.lastNeed=n-1),n;if(--i=0)return n>0&&(t.lastNeed=n-2),n;if(--i=0)return n>0&&(2===n?n=0:t.lastNeed=n-3),n;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var i=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,r){"use strict";t.exports=o;var i=r(10),n=Object.create(r(22));function s(t,e){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(!i)return this.emit("error",new Error("write callback called multiple times"));r.writechunk=null,r.writecb=null,null!=e&&this.push(e),i(t);var n=this._readableState;n.reading=!1,(n.needReadable||n.length(Object.keys(e).forEach(r=>{t[r]=e[r]}),t),Object.create(null))}},function(t,e,r){var i=r(79).BrotliInput,n=r(79).BrotliOutput,s=r(147),o=r(80),a=r(81).HuffmanCode,u=r(81).BrotliBuildHuffmanTable,h=r(150),c=r(151),l=r(152),d=new Uint8Array([1,2,3,4,0,5,17,6,16,7,8,9,10,11,12,13,14,15]),f=new Uint8Array([3,2,1,0,3,3,3,3,3,3,2,2,2,2,2,2]),p=new Int8Array([0,0,0,0,-1,1,-2,2,-3,3,-1,1,-2,2,-3,3]),m=new Uint16Array([256,402,436,468,500,534,566,598,630,662,694,726,758,790,822,854,886,920,952,984,1016,1048,1080]);function w(t){var e;return 0===t.readBits(1)?16:(e=t.readBits(3))>0?17+e:(e=t.readBits(3))>0?8+e:17}function g(t){if(t.readBits(1)){var e=t.readBits(3);return 0===e?1:t.readBits(e)+(1<1&&0===s)throw new Error("Invalid size byte");n.meta_block_length|=s<<8*i}}else for(i=0;i4&&0===o)throw new Error("Invalid size nibble");n.meta_block_length|=o<<4*i}return++n.meta_block_length,n.input_end||n.is_metadata||(n.is_uncompressed=t.readBits(1)),n}function b(t,e,r){var i;return r.fillBitWindow(),(i=t[e+=r.val_>>>r.bit_pos_&255].bits-8)>0&&(r.bit_pos_+=8,e+=t[e].value,e+=r.val_>>>r.bit_pos_&(1<>=1,++c;for(p=0;p0;++p){var _,b=d[p],E=0;i.fillBitWindow(),E+=i.val_>>>i.bit_pos_&15,i.bit_pos_+=y[E].bits,_=y[E].value,m[b]=_,0!==_&&(w-=32>>_,++g)}if(1!==g&&0!==w)throw new Error("[ReadHuffmanCode] invalid num_codes or space");!function(t,e,r,i){for(var n=0,s=8,o=0,h=0,c=32768,l=[],d=0;d<32;d++)l.push(new a(0,0));for(u(l,0,5,t,18);n0;){var f,p=0;if(i.readMoreInput(),i.fillBitWindow(),p+=i.val_>>>i.bit_pos_&31,i.bit_pos_+=l[p].bits,(f=255&l[p].value)<16)o=0,r[n++]=f,0!==f&&(s=f,c-=32768>>f);else{var m,w,g=f-14,y=0;if(16===f&&(y=s),h!==y&&(o=0,h=y),m=o,o>0&&(o-=2,o<<=g),n+(w=(o+=i.readBits(g)+3)-m)>e)throw new Error("[ReadHuffmanCodeLengths] symbol + repeat_delta > num_symbols");for(var _=0;_>>5]),this.htrees=new Uint32Array(e)}function S(t,e){var r,i,n={num_htrees:null,context_map:null},s=0;e.readMoreInput();var o=n.num_htrees=g(e)+1,u=n.context_map=new Uint8Array(t);if(o<=1)return n;for(e.readBits(1)&&(s=e.readBits(4)+1),r=[],i=0;i<1080;i++)r[i]=new a(0,0);for(E(o+s,r,0,e),i=0;i=t)throw new Error("[DecodeContextMap] i >= context_map_size");u[i]=0,++i}else u[i]=h-s,++i}return e.readBits(1)&&function(t,e){var r,i=new Uint8Array(256);for(r=0;r<256;++r)i[r]=r;for(r=0;r=t&&(a-=t),i[r]=a,n[u+(1&s[h])]=a,++s[h]}function D(t,e,r,i,n,o){var a,u=n+1,h=r&n,c=o.pos_&s.IBUF_MASK;if(e<8||o.bit_pos_+(e<<3)0;)o.readMoreInput(),i[h++]=o.readBits(8),h===u&&(t.write(i,u),h=0);else{if(o.bit_end_pos_<32)throw new Error("[CopyUncompressedBlockToOutput] br.bit_end_pos_ < 32");for(;o.bit_pos_<32;)i[h]=o.val_>>>o.bit_pos_,o.bit_pos_+=8,++h,--e;if(c+(a=o.bit_end_pos_-o.bit_pos_>>3)>s.IBUF_MASK){for(var l=s.IBUF_MASK+1-c,d=0;d=u){t.write(i,u),h-=u;for(d=0;d=u;){if(a=u-h,o.input_.read(i,h,a)e.buffer.length){var lt=new Uint8Array(R+Z);lt.set(e.buffer),e.buffer=lt}if(I=ct.input_end,W=ct.is_uncompressed,ct.is_metadata)for(k(T);Z>0;--Z)T.readMoreInput(),T.readBits(8);else if(0!==Z)if(W)T.bit_pos_=T.bit_pos_+7&-8,D(e,Z,R,f,d,T),R+=Z;else{for(r=0;r<3;++r)tt[r]=g(T)+1,tt[r]>=2&&(E(tt[r]+2,m,1080*r,T),E(26,y,1080*r,T),Q[r]=v(y,1080*r,T),rt[r]=1);for(T.readMoreInput(),z=(1<<(j=T.readBits(2)))-1,G=(H=16+(T.readBits(4)<0;){var pt,mt,wt,gt,yt,_t,bt,Et,vt,At,Tt,xt;for(T.readMoreInput(),0===Q[1]&&(C(tt[1],m,1,$,et,rt,T),Q[1]=v(y,1080,T),J=L[1].htrees[$[1]]),--Q[1],(mt=(pt=b(L[1].codes,J,T))>>6)>=2?(mt-=2,bt=-1):bt=0,wt=c.kInsertRangeLut[mt]+(pt>>3&7),gt=c.kCopyRangeLut[mt]+(7&pt),yt=c.kInsertLengthPrefixCode[wt].offset+T.readBits(c.kInsertLengthPrefixCode[wt].nbits),_t=c.kCopyLengthPrefixCode[gt].offset+T.readBits(c.kCopyLengthPrefixCode[gt].nbits),P=f[R-1&d],B=f[R-2&d],vt=0;vt4?3:_t-2))],(bt=b(L[2].codes,L[2].htrees[at],T))>=H)xt=(bt-=H)&z,bt=H+((St=(2+(1&(bt>>=j))<<(Tt=1+(bt>>1)))-4)+T.readBits(Tt)<(N=R=o.minDictionaryWordLength&&_t<=o.maxDictionaryWordLength))throw new Error("Invalid backward reference. pos: "+R+" distance: "+Et+" len: "+_t+" bytes left: "+Z);var St=o.offsetsByLength[_t],Ct=Et-N-1,Dt=o.sizeBitsByLength[_t],kt=Ct>>Dt;if(St+=(Ct&(1<=p){e.write(f,u);for(var It=0;It0&&(O[3&F]=Et,++F),_t>Z)throw new Error("Invalid backward reference. pos: "+R+" distance: "+Et+" len: "+_t+" bytes left: "+Z);for(vt=0;vt<_t;++vt)f[R&d]=f[R-Et&d],(R&d)===d&&e.write(f,u),++R,--Z}P=f[R-1&d],B=f[R-2&d]}R&=1073741823}}e.write(f,R&d)}x.prototype.decode=function(t){var e,r=0;for(e=0;ethis.buffer.length&&(r=this.buffer.length-this.pos);for(var i=0;ithis.buffer.length)throw new Error("Output buffer is not large enough");return this.buffer.set(t.subarray(0,e),this.pos),this.pos+=e,e},e.BrotliOutput=i},function(t,e,r){var i=r(148);e.init=function(){e.dictionary=i.init()},e.offsetsByLength=new Uint32Array([0,0,0,0,0,4096,9216,21504,35840,44032,53248,63488,74752,87040,93696,100864,104704,106752,108928,113536,115968,118528,119872,121280,122016]),e.sizeBitsByLength=new Uint8Array([0,0,0,0,10,10,11,11,10,10,10,10,10,9,9,8,7,7,8,7,7,6,6,5,5]),e.minDictionaryWordLength=4,e.maxDictionaryWordLength=24},function(t,e){function r(t,e){this.bits=t,this.value=e}e.HuffmanCode=r;function i(t,e){for(var r=1<>=1;return(t&r-1)+r}function n(t,e,i,n,s){do{t[e+(n-=i)]=new r(s.bits,s.value)}while(n>0)}function s(t,e,r){for(var i=1<0;--b[h])n(t,e+l,d,w,new r(255&h,65535&y[c++])),l=i(l,h);for(p=g-1,f=-1,h=o+1,d=2;h<=15;++h,d<<=1)for(;b[h]>0;--b[h])(l&p)!==f&&(e+=w,g+=w=1<<(m=s(b,h,o)),t[_+(f=l&p)]=new r(m+o&255,e-_-f&65535)),n(t,e+(l>>o),d,w,new r(h-o&255,65535&y[c++])),l=i(l,h);return g}},function(t,e,r){"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}},function(t,e,r){"use strict";var i=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,e,r,n){var s=i,o=n+r;t^=-1;for(var a=n;a>>8^s[255&(t^e[a])];return-1^t}},function(t,e,r){"use strict";var i=r(9),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 u(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 u(t,t.length)},e.binstring2buf=function(t){for(var e=new i.Buf8(t.length),r=0,n=e.length;r4)h[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;s>1&&r1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return u(h,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}},function(t,e,r){"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}},function(t,e,r){"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}},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(88)]})},function(t,e,r){"use strict";var i=r(16);t.exports=new i({include:[r(48)],implicit:[r(174),r(175),r(176),r(177)]})},function(t,e,r){"use strict";e.Commented=r(194),e.Diagnose=r(204),e.Decoder=r(36),e.Encoder=r(90),e.Simple=r(27),e.Tagged=r(52),e.Map=r(205),e.comment=e.Commented.comment,e.decodeAll=e.Decoder.decodeAll,e.decodeFirst=e.Decoder.decodeFirst,e.decodeAllSync=e.Decoder.decodeAllSync,e.decodeFirstSync=e.Decoder.decodeFirstSync,e.diagnose=e.Diagnose.diagnose,e.encode=e.Encoder.encode,e.encodeCanonical=e.Encoder.encodeCanonical,e.encodeOne=e.Encoder.encodeOne,e.encodeAsync=e.Encoder.encodeAsync,e.decode=e.Decoder.decodeFirstSync,e.leveldb={decode:e.Decoder.decodeAllSync,encode:e.Encoder.encode,buffer:!0,name:"cbor"},e.hasBigInt=r(17).hasBigInt},function(t,e,r){"use strict";(function(e){const i=r(4),n=r(53),s=r(11).BigNumber,o=r(28),a=(r(52),r(27),r(17)),u=r(12),h=u.MT,c=u.NUMBYTES,l=u.SHIFT32,d=u.SYMS,f=u.TAG,p=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.TWO,m=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.FOUR,w=u.MT.SIMPLE_FLOAT<<5|u.NUMBYTES.EIGHT,g=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.TRUE,y=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.FALSE,_=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.UNDEFINED,b=u.MT.SIMPLE_FLOAT<<5|u.SIMPLE.NULL,E=a.bigIntize(u.BI),v=u.BN,A=e.from("f97e00","hex"),T=e.from("f9fc00","hex"),x=e.from("f97c00","hex"),S=e.from("f98000","hex"),C=Symbol("CBOR_LOOP_DETECT");class D extends i.Transform{constructor(t){const r=Object.assign({},t,{readableObjectMode:!1,writableObjectMode:!0});super(r),this.canonical=r.canonical,this.encodeUndefined=r.encodeUndefined,this.disallowUndefinedKeys=!!r.disallowUndefinedKeys,this.dateType=null!=r.dateType?r.dateType.toLowerCase():"number",this.collapseBigIntegers=!!r.collapseBigIntegers,"symbol"==typeof r.detectLoops?this.detectLoops=r.detectLoops:this.detectLoops=r.detectLoops?Symbol("CBOR_DETECT"):null,this.semanticTypes=[Array,this._pushArray,Date,this._pushDate,e,this._pushBuffer,Map,this._pushMap,o,this._pushNoFilter,RegExp,this._pushRegexp,Set,this._pushSet,s,this._pushBigNumber,ArrayBuffer,this._pushUint8Array,Uint8ClampedArray,this._pushUint8Array,Uint8Array,this._pushUint8Array,Uint16Array,this._pushArray,Uint32Array,this._pushArray,Int8Array,this._pushArray,Int16Array,this._pushArray,Int32Array,this._pushArray,Float32Array,this._pushFloat32Array,Float64Array,this._pushFloat64Array],n.Url&&this.semanticTypes.push(n.Url,this._pushUrl),n.URL&&this.semanticTypes.push(n.URL,this._pushURL);const i=r.genTypes||[];for(let t=0,e=i.length;t{i.pushAny(t);const r=n.read();i.pushAny(e);const s=n.read();return r.compare(s)});for(const[e,i]of r){if(t.disallowUndefinedKeys&&void 0===e)throw new Error("Invalid Map key: undefined");if(!t.pushAny(e)||!t.pushAny(i))return!1}}else for(const[r,i]of e){if(t.disallowUndefinedKeys&&void 0===r)throw new Error("Invalid Map key: undefined");if(!t.pushAny(r)||!t.pushAny(i))return!1}return!0}_pushUint8Array(t,r){return t._pushBuffer(t,e.from(r))}_pushFloat32Array(t,e){const r=e.length;if(!t._pushInt(r,h.ARRAY))return!1;for(let i=0;i{const r=i[t]||(i[t]=D.encode(t)),n=i[e]||(i[e]=D.encode(e));return r.compare(n)}),!this._pushInt(r.length,h.MAP))return!1;let n;for(let e=0,s=r.length;e{const s=[],o=new D(r);o.on("data",t=>s.push(t)),o.on("error",n),o.on("finish",()=>i(e.concat(s))),o.pushAny(t),o.end()})}}t.exports=D}).call(this,r(3).Buffer)},,,,,,,,,,,,,,,,,,,,,,function(t,e,r){"use strict";const i=r(55),{escapeString:n}=r(144);t.exports=class extends i{constructor(){super({sourceCodeLocationInfo:!0}),this.posTracker=this.locInfoMixin.posTracker}_transformChunk(t){super._transformChunk(t)}_getRawHtml(t){const e=this.posTracker.droppedBufferSize,r=t.startOffset-e,i=t.endOffset-e;return this.tokenizer.preprocessor.html.slice(r,i)}_handleToken(t){super._handleToken(t)||this.emitRaw(this._getRawHtml(t.location)),this.parserFeedbackSimulator.skipNextNewLine=!1}_emitToken(t,e){this.emit(t,e,this._getRawHtml(e.sourceCodeLocation))}emitDoctype(t){let e="",this.push(e)}emitStartTag(t){let e="<"+t.tagName;const r=t.attrs;for(let t=0;t":">",this.push(e)}emitEndTag(t){this.push(`${t.tagName}>`)}emitText({text:t}){this.push(n(t,!1))}emitComment(t){this.push(`\x3c!--${t.text}--\x3e`)}emitRaw(t){this.push(t)}}},function(t,e,r){t.exports=r(78).BrotliDecompressBuffer},function(t,e,r){"use strict";!function(){var e,i,n,s=0,o=[];for(i=0;i<256;i++)o[i]=(i+256).toString(16).substr(1);function a(){var t,r=(t=16,(!e||s+t>u.BUFFER_SIZE)&&(s=0,e=u.randomBytes(u.BUFFER_SIZE)),e.slice(s,s+=t));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,r}function u(){var t=a();return o[t[0]]+o[t[1]]+o[t[2]]+o[t[3]]+"-"+o[t[4]]+o[t[5]]+"-"+o[t[6]]+o[t[7]]+"-"+o[t[8]]+o[t[9]]+"-"+o[t[10]]+o[t[11]]+o[t[12]]+o[t[13]]+o[t[14]]+o[t[15]]}u.BUFFER_SIZE=4096,u.bin=a,u.clearBuffer=function(){e=null,s=0},u.test=function(t){return"string"==typeof t&&/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(t)},"undefined"!=typeof crypto?n=crypto:"undefined"!=typeof window&&void 0!==window.msCrypto&&(n=window.msCrypto),n=n||r(159),t.exports=u,u.randomBytes=function(){if(n){if(n.randomBytes)return n.randomBytes;if(n.getRandomValues)return function(t){var e=new Uint8Array(t);return n.getRandomValues(e),e}}return function(t){var e,r=[];for(e=0;e10&&(t="..."+t.substr(-10));var n=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+e+" bytes: "+t+" <-");throw n.position=e,n},d=function(e){if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");for(var t,n,r,i,s,o,a,u,c=[],h=0,d=(e=e.replace(/=/g,"")).length,p=0,f=d>>3<<3;p>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1),c[h++]=255&(s<<7|o<<2|a>>>3),c[h++]=255&(a<<5|u);var m=d-f;return 2===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2)):4===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4)):5===m?(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],s=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1)):7===m&&(t=l[e.charAt(p++)],n=l[e.charAt(p++)],r=l[e.charAt(p++)],i=l[e.charAt(p++)],s=l[e.charAt(p++)],o=l[e.charAt(p++)],a=l[e.charAt(p++)],c[h++]=255&(t<<3|n>>>2),c[h++]=255&(n<<6|r<<1|i>>>4),c[h++]=255&(i<<4|s>>>1),c[h++]=255&(s<<7|o<<2|a>>>3)),c},p=function(e,t){if(!t)return function(e){for(var t,n,r="",i=e.length,s=0,o=0;s191&&t<=223?(n=31&t,o=1):t<=239?(n=15&t,o=2):t<=247?(n=7&t,o=3):h(s,r);for(var a=0;a191)&&h(s,r),n<<=6,n+=63&t;n>=55296&&n<=57343&&h(s,r),n>1114111&&h(s,r),n<=65535?r+=String.fromCharCode(n):(n-=65536,r+=String.fromCharCode(55296+(n>>10)),r+=String.fromCharCode(56320+(1023&n)))}return r}(d(e));if(!/^[A-Z2-7=]+$/.test(e))throw new Error("Invalid base32 characters");var n,r,i,s,o,a,u,c,p="",f=e.indexOf("=");-1===f&&(f=e.length);for(var m=0,w=f>>3<<3;m>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|u>>>3))+String.fromCharCode(255&(u<<5|c));var g=f-w;return 2===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))):4===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))):5===g?(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],o=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))):7===g&&(n=l[e.charAt(m++)],r=l[e.charAt(m++)],i=l[e.charAt(m++)],s=l[e.charAt(m++)],o=l[e.charAt(m++)],a=l[e.charAt(m++)],u=l[e.charAt(m++)],p+=String.fromCharCode(255&(n<<3|r>>>2))+String.fromCharCode(255&(r<<6|i<<1|s>>>4))+String.fromCharCode(255&(s<<4|o>>>1))+String.fromCharCode(255&(o<<7|a<<2|u>>>3))),p},f={encode:function(e,t){var n="string"!=typeof e;return n&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),n?function(e){for(var t,n,r,i,s,o="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s];var h=a-c;return 1===h?(t=e[l],o+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e[l++],n=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e[l++],n=e[l++],r=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e[l++],n=e[l++],r=e[l++],i=e[l],o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),o}(e):t?function(e){for(var t,n,r,i,s,o="",a=e.length,l=0,c=5*parseInt(a/5);l>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s];var h=a-c;return 1===h?(t=e.charCodeAt(l),o+=u[t>>>3]+u[t<<2&31]+"======"):2===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===h?(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):4===h&&(t=e.charCodeAt(l++),n=e.charCodeAt(l++),r=e.charCodeAt(l++),i=e.charCodeAt(l),o+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"="),o}(e):function(e){var t,n,r,i,s,o,a,l=!1,h="",d=0,p=0,f=e.length;do{for(c[0]=c[5],c[1]=c[6],c[2]=c[7],a=p;d>6,c[a++]=128|63&o):o<55296||o>=57344?(c[a++]=224|o>>12,c[a++]=128|o>>6&63,c[a++]=128|63&o):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++d)),c[a++]=240|o>>18,c[a++]=128|o>>12&63,c[a++]=128|o>>6&63,c[a++]=128|63&o);a-p,p=a-5,d===f&&++d,d>f&&a<6&&(l=!0),t=c[0],a>4?(n=c[1],r=c[2],i=c[3],s=c[4],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[31&(i<<3|s>>>5)]+u[31&s]):1===a?h+=u[t>>>3]+u[t<<2&31]+"======":2===a?(n=c[1],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[n<<4&31]+"===="):3===a?(n=c[1],r=c[2],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[r<<1&31]+"==="):(n=c[1],r=c[2],i=c[3],h+=u[t>>>3]+u[31&(t<<2|n>>>6)]+u[n>>>1&31]+u[31&(n<<4|r>>>4)]+u[31&(r<<1|i>>>7)]+u[i>>>2&31]+u[i<<3&31]+"=")}while(!l);return h}(e)},decode:p};p.asBytes=d,o?e.exports=f:(s.base32=f,a&&(void 0===(i=function(){return f}.call(f,n,f,e))||(e.exports=i)))}()}).call(this,n(14),n(6))},function(e,t,n){"use strict";var r=n(174),i=n(11),s=n(88),o=n(49),a=n(89),u=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=i.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==n)throw new Error(o[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var c;if(c="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(n=r.deflateSetDictionary(this.strm,c)))throw new Error(o[n]);this._dict_set=!0}}function c(e,t){var n=new l(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}l.prototype.push=function(e,t){var n,o,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===u.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(l),a.next_out=0,a.avail_out=l),1!==(n=r.deflate(a,o))&&0!==n)return this.onEnd(n),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==n);return 4===o?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,0===n):2!==o||(this.onEnd(0),a.avail_out=0,!0)},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=l,t.deflate=c,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,c(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,c(e,t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,n(182);var r=/\\(u\{([0-9A-Fa-f]+)\}|u([0-9A-Fa-f]{4})|x([0-9A-Fa-f]{2})|([1-7][0-7]{0,2}|[0-7]{2,3})|(['"tbrnfv0\\]))|\\U([0-9A-Fa-f]{8})/g,i={0:"\0",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v","'":"'",'"':'"',"\\":"\\"},s=function(e){return String.fromCodePoint(parseInt(e,16))};t.default=function(e){return e.replace(r,(function(e,t,n,r,o,a,u,l){return void 0!==n?s(n):void 0!==r?s(r):void 0!==o?s(o):void 0!==a?(c=a,String.fromCodePoint(parseInt(c,8))):void 0!==l?s(l):i[u];var c}))},e.exports=t.default},function(e,t,n){"use strict";e.exports=function(){function e(e,t,n,r,i){return e