!function(t){var e={};function r(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,r),s.l=!0,s.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},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 n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)r.d(n,s,function(e){return t[e]}.bind(null,s));return n},r.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){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=46)}([function(t,e){class r extends Error{constructor(t){super(t||"Coding Error"),this.name="CodingError"}}class n extends Error{constructor(t){super("To be implemented: "+t),this.name="ToBeImplementedError"}}class s extends Error{constructor(t,e={}){super(t||"Transport failure"),this.name="TransportError",Object.assign(this,e)}}class i extends Error{constructor(t){super(t||"Timed out"),this.name="TimeoutError"}}class o extends Error{constructor(t){super(t||"Intentionally Unimplemented Function"),this.name="IntentionallyUnimplementedError"}}e=t.exports={CodingError:r,ToBeImplementedError:n,TransportError:s,TimeoutError:i,IntentionallyUnimplementedError:o}},function(t,e,r){(function(n){function s(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,s=0;e[0].replace(/%[a-zA-Z%]/g,t=>{"%%"!==t&&(n++,"%c"===t&&(s=n))}),e.splice(s,0,r)}function o(...t){return"object"==typeof console&&console.log&&console.log(...t)}function a(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}}function u(){let t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&void 0!==n&&"env"in n&&(t=n.env.DEBUG),t}function c(){try{return localStorage}catch(t){}}e.log=o,e.formatArgs=i,e.save=a,e.load=u,e.useColors=s,e.storage=c(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.exports=r(52)(e);const{formatters:l}=t.exports;l.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this,r(4))},function(t,e,r){const n=r(3),{TransportError:s}=r(0),i=r(1)("dweb-transports"),o=r(14),a=r(67),u=r(91),c=r(97),l=r(100);class h{constructor(t){}static _connected(){return this._transports.filter(t=>!t.status)}static p_connectedNames(t){const e=this._connected().map(t=>t.name);if(!t)return new Promise((t,r)=>t(e));t(null,e)}static async p_connectedNamesParm(){return(await this.p_connectedNames()).map(t=>"transport="+t).join("&")}static statuses({connected:t}={}){const e=h._transports.map(t=>({name:t.name,status:t.status,info:t.info}));return t?e.filter(t=>!t.status):e}static p_statuses(t){const e=this.statuses({connected:!1});if(!t)return new Promise((t,r)=>t(e));t(null,e)}static validFor(t,e,r){return"string"==typeof t&&(t=[t]),t&&t[0]||["store","newlisturls","newdatabase","newtable","seed"].includes(e)?t&&t.length>0?[].concat(...t.map(t=>"string"==typeof t?n.parse(t):t).map(t=>this._transports.filter(n=>n.validFor(t,e,r)).map(e=>[t,e]))):this._transports.filter(t=>t.validFor(void 0,e,r)).map(t=>[void 0,t]):(console.error("Transports.validFor called with invalid arguments: urls=",t,"func=",e),[])}static urlsValidFor(t,e,r){return this.validFor(t,e,r).map(t=>t[0])}static http(){return h._connected().find(t=>"HTTP"===t.name)}static wolk(){return h._connected().find(t=>"WOLK"===t.name)}static ipfs(){return h._connected().find(t=>"IPFS"===t.name)}static webtorrent(){return h._connected().find(t=>"WEBTORRENT"===t.name)}static gun(){return h._connected().find(t=>"GUN"===t.name)}static fluence(){return h._connected().find(t=>"FLUENCE"===t.name)}static _resolvedUrlToGatewayUrl(t){const e=archiveOrgMirroredUrls.find(e=>t.startsWith(e));return e?this.mirror+t.slice(e.length):t}static togglePaused(t,e){const r=this._transports.find(e=>e.name===t);r?r.togglePaused(t=>e(null,t.status)):e(void 0)}static async _p_rawstore(t,e){let r=[],n=await Promise.all(t.map(async function(t){try{i("Storing %d bytes to %s",e.length,t.name);let n=await t.p_rawstore(e);return i("Storing %d bytes to %s succeeded: %s",e.length,t.name,n),n}catch(n){return i("Storing %d bytes to %s failed: %s",e.length,t.name,n.message),void r.push(n)}}));if(n=n.filter(t=>!!t),!n.length)throw i("Storing %d bytes failed on all transports",e.length),new s(r.map(t=>t.message).join(", "));return n}static async p_rawstore(t){let e=this.validFor(void 0,"store").map(([t,e])=>e);if(!e.length)throw i("Storing %d bytes failed: no transports available",t.length),new s("Transports.p_rawstore: Cant find transport for store");return this._p_rawstore(e,t)}static async p_rawfetch(t,e={}){if(!t.length)throw new s("Transports.p_rawfetch given an empty list of urls");let r=this.validFor(t,"fetch",{noCache:e.noCache});if(!r.length)throw new s("Transports.p_rawfetch cant find any transport for urls: "+t);let n=[],o=[];for(const[t,s]of r)try{i("Fetching %s via %s",t.href,s.name);let r=await s.p_rawfetch(t,Object.assign({},e,{silentFinalError:!0}));return i("Fetching %s via %s succeeded %d bytes",t.href,s.name,r.length),e.relay&&o.length&&(i("Fetching attempting relay of %d bytes from %s to %o",r.length,t.href,o.map(t=>t.name)),this._p_rawstore(o,r).then(t=>i("Fetching relayed %d bytes to %o",r.length,t))),r}catch(e){o.push(s),n.push(e),i("Fetching %s via %s failed: %s",t.href,s.name,e.message)}throw e.silentFinalError||i("Fetching %o failed on all transports",t),new s(n.map(t=>t.message).join(", "))}static fetch(t,e={},r){"function"==typeof e&&(r=e,e={});const n=this.p_rawfetch(t,e);if(!r)return n;n.then(t=>{try{r(null,t)}catch(t){i("Uncaught error in fetch %O",t)}}).catch(t=>r(t))}static seed({directoryPath:t,fileRelativePath:e,ipfsHash:r,urlToFile:n,torrentRelativePath:s},o){if(!o)return new Promise((t,e)=>{try{u.call(this,(r,n)=>{r?e(r):t(n)})}catch(t){e(t)}});try{u.call(this,o)}catch(t){o(t)}function u(o){let u=this.validFor(void 0,"seed").map(([t,e])=>e);if(u.length){const i={};a(u,(o,a)=>o.seed({directoryPath:t,torrentRelativePath:s,fileRelativePath:e,ipfsHash:r,urlToFile:n},(t,e)=>{i[o.name]=t?{err:t.message}:e,a(null)}),t=>o(null,i))}else i("Seeding: no transports available"),o(null,null)}}static async p_rawlist(t){let e=this.validFor(t,"list");if(!e.length)throw new s('Transports.p_rawlist: Cant find transport to "list" urls:'+t.join(","));let r=[],n=await Promise.all(e.map(async function([t,e]){try{i("Listing %s via %s",t,e.name);let n=await e.p_rawlist(t);return i("Listing %s via %s retrieved %d items",t,e.name,n.length),n}catch(n){return i("Listing %s via %s failed: %s",t,e.name,n.message),r.push(n),[]}}));if(r.length>=e.length)throw i("Listing %o failed on all transports",t),new s(r.map(t=>t.message).join(", "));let o={};return[].concat(...n).filter(t=>!o[t.signature]&&(o[t.signature]=!0))}static async p_rawadd(t,e){let r=this.validFor(t,"add");if(!r.length)throw i("Adding to %o failed: no transports available",t),new s("Transports.p_rawstore: Cant find transport for urls:"+t.join(","));let n=[];if(await Promise.all(r.map(async function([t,r]){try{return i("Adding to %s via %s",t,r.name),await r.p_rawadd(t,e),void i("Adding to %s via %s succeeded",t,r.name)}catch(e){return i("Adding to %s via %s failed: %s",t,r.name,e.message),void n.push(e)}})),n.length>=r.length)throw i("Adding to %o failed on all transports",t),new s(n.map(t=>t.message).join(", "))}static listmonitor(t,e,r={}){this.validFor(t,"listmonitor").map(([t,n])=>{n.listmonitor(t,e,r),i("Monitoring list %s via %s",t,n.name)})}static async p_newlisturls(t){let e=await Promise.all(this.validFor(void 0,"newlisturls").map(([e,r])=>r.p_newlisturls(t)));return[e.map(t=>t[0]),e.map(t=>t[1])]}static async p_f_createReadStream(t,{wanturl:e=!1,preferredTransports:r=[]}={}){let n=this.validFor(t,"createReadStream",{});if(!n.length)throw i("Opening stream from %o failed: no transports available",t),new s("Transports.p_f_createReadStream cant find any transport for urls: "+t);let o=[];n.sort((t,e)=>(r.indexOf(t[1].name)+1||999+Math.random())-(r.indexOf(e[1].name)+1||999+Math.random()));for(const[t,r]of n)try{i("Opening stream from %s via %s",t.href,r.name);let n=await r.p_f_createReadStream(t,{wanturl:e});return["IPFS","HTTP"].includes(r.name)||i("Opening stream from %s via %s succeeded",t.href,r.name),n}catch(e){o.push(e),i("Opening stream from %s via %s failed: %s",t.href,r.name,e.message)}throw i("Opening stream from %o failed on all transports",t),new s(o.map(t=>t.message).join(", "))}static createReadStream(t,e={},r){const n=this.validFor(t,"createReadStream",{});if(!n.length)throw i("Opening stream from %o failed: no transports available",t),new s("Transports.createReadStream cant find any transport for urls: "+t);const o=[];let a;n.sort((t,r)=>(e.preferredTransports.indexOf(t[1].name)+1||999+Math.random())-(e.preferredTransports.indexOf(r[1].name)+1||999+Math.random())),u(n,(t,r)=>{const n=t[0],s=t[1];i("Opening stream from %s via %s",n.href,s.name),s.createReadStream(n,e,(t,e)=>{t?(i("Opening stream from %s via %s failed: %s",n.href,s.name,t.message),o.push(t),r(null,!1)):(["IPFS","HTTP"].includes(s.name)||i("Opening stream from %s via %s succeeded",n.href,s.name),a=e,r(null,!0))})},(e,n)=>{n?r(null,a):(i("Opening stream from %o failed on all transports",t),r(new s(o.map(t=>t.message).join(", "))))})}static async p_get(t,e){let r=this.validFor(t,"get"),n=Array.isArray(e)?`${e.length} keys`:e;if(!r.length)throw i("Getting %s from %o failed: no transports available",n,t),new s("Transports.p_get cant find any transport to get keys from urls: "+t);let o=[];for(const[t,s]of r)try{i("Getting %s from %s via %s",n,t.href,s.name);let r=await s.p_get(t,e);return i("Getting %s from %s via %s succeeded length=%d",n,t.href,s.name,r.length),r}catch(e){o.push(e),i("Getting %s from %s via %s failed: %s",n,t.href,s.name,e.message)}throw i("Getting %s from %o failed on all transports",n,t),new s(o.map(t=>t.message).join(", "))}static async p_set(t,e,r){let n="object"==typeof e?`${e.length} keys`:e,o=this.validFor(t,"set");if(!o.length)throw i("Setting %s on %o failed: no transports available",n,t),new s("Transports.p_set cant find any transport for urls: "+t);let a=[],u=!1;if(await Promise.all(o.map(async function([t,s]){try{i("Setting %s on %s via %s",n,t.href,s.name),await s.p_set(t,e,r),i("Setting %s on %s via %s succeeded",n,t.href,s.name),u=!0}catch(e){i("Setting %s on %s via %s failed: %s",n,t.href,s.name,e.message),a.push(e)}})),!u)throw i("Setting %s on %o failed on all transports",n,t),new s(a.map(t=>t.message).join(", "))}static async p_delete(t,e){let r=Array.isArray(e)?`${e.length} keys`:e,n=this.validFor(t,"set");if(!n.length)throw i("Deleting %s on %o failed: no transports available",r,t),new s("Transports.p_set cant find any transport for urls: "+t);let o=[],a=!1;if(await Promise.all(n.map(async function([t,n]){try{i("Deleting %s on %s via %s",r,t.href,n.name),await n.p_delete(t,e),i("Deleting %s on %s via %s succeeded",r,t.href,n.name),a=!0}catch(e){i("Deleting %s on %s via %s failed: %s",r,t.href,n.name,e.message),o.push(e)}})),!a)throw i("Deleting %s on %o failed on all transports",r,t),new s(o.map(t=>t.message).join(", "))}static async p_keys(t){let e=this.validFor(t,"keys");if(!e.length)throw i("Getting all keys on %o failed: no transports available",t),new s("Transports.p_keys cant find any transport for urls: "+t);let r=[];for(const[t,n]of e)try{i("Getting all keys on %s via %s",t.href,n.name);let e=await n.p_keys(t);return i("Getting all keys on %s via %s succeeded with %d keys",t.href,n.name,e.length),e}catch(e){r.push(e),i("Getting all keys on %s via %s failed: %s",t.href,n.name,e.message)}throw i("Getting all keys on %o failed on all transports",t),new s(r.map(t=>t.message).join(", "))}static async p_getall(t){let e=this.validFor(t,"getall");if(!e.length)throw i("Getting all values on %o failed: no transports available",t),new s("Transports.p_getall cant find any transport for urls: "+t);let r=[];for(const[t,n]of e)try{i("Getting all values on %s via %s",t.href,n.name);let e=await n.p_getall(t);return i("Getting all values on %s via %s succeeded with %d values",t.href,n.name,e.length),e}catch(e){r.push(e),i("Getting all values on %s via %s failed: %s",t.href,n.name,e.message)}throw i("Getting all keys on %o failed on all transports",t),new s(r.map(t=>t.message).join(", "))}static async p_newdatabase(t){let e=await Promise.all(this.validFor(void 0,"newdatabase").map(([e,r])=>r.p_newdatabase(t)));return{privateurls:e.map(t=>t.privateurl),publicurls:e.map(t=>t.publicurl)}}static async p_newtable(t,e){let r=await Promise.all(this.validFor(void 0,"newtable").map(([r,n])=>n.p_newtable(t,e)));return{privateurls:r.map(t=>t.privateurl),publicurls:r.map(t=>t.publicurl)}}static async p_connection(t){await Promise.all(this.validFor(t,"connection").map(([t,e])=>e.p_connection(t)))}static monitor(t,e,{current:r=!1}={}){this.validFor(t,"monitor").map(([t,n])=>{i("Monitoring table %s via %s",t,n.name),n.monitor(t,e,{current:r})})}static addtransport(t){h._transports.push(t)}static setup0(t,e,r){return t.map(t=>{const r=this._transportclasses[t];return r?(i("Setting up connection to %s with options %o",t,e),r.setup0(e)):void i("Connection to %s unavailable",t)}).filter(t=>!!t)}static p_setup1(t){const e=Promise.all(this._transports.filter(t=>!this._optionspaused.includes(t.name)).map(t=>(i("Connection stage 1 to %s",t.name),t.p_setup1())));if(!t)return e;e.catch(e=>t(e)).then(e=>t(null,e))}static p_setup2(t){const e=Promise.all(this._transports.filter(t=>!this._optionspaused.includes(t.name)).map(t=>(i("Connection stage 2 to %s",t.name),t.p_setup2())));if(!t)return e;e.catch(e=>t(e)).then(e=>t(null,e))}static p_stop(t){if(!t)return new Promise((t,r)=>{try{e.call(this,(e,n)=>{e?r(e):t(n)})}catch(t){r(t)}});try{e.call(this,t)}catch(e){t(e)}function e(t){c(this._connected(),(t,e)=>{i("Stopping %s",t.name),t.stop(e)},t)}}static _tabbrevs(t){let e=t.transports;return e&&e.length||(e=t.defaulttransports||[]),e.length||(e=["HTTP","IPFS","WEBTORRENT","HASH"]),e=e.map(t=>t.toUpperCase()),e}static loadIntoHtmlPage(t){const e="https://cdn.jsdelivr.net/npm";this._tabbrevs(t).forEach(t=>{this._transportclasses[t].scripts.map(r=>{i("Loading %s %s",t,r),document.write('