@junobuild/core 0.0.37 → 0.0.38-next-2023-12-08

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,25 +1,25 @@
1
- import{a as kn,b as go,c as ar,d as jn,e as ye,f as _o,g as bo,h as ot,i as ie,j as Kn,k as Ce,l as vo,m as Mn,n as Gt,o as Vn,p as oe,q as Yn,r as sr,s as Fe,t as qn}from"./chunk-N3SFIG7N.js";var In=ar(ur=>{"use strict";ur.byteLength=To;ur.toByteArray=Oo;ur.fromByteArray=Po;var Yt=[],Ft=[],Ao=typeof Uint8Array<"u"?Uint8Array:Array,$r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ae=0,Zn=$r.length;ae<Zn;++ae)Yt[ae]=$r[ae],Ft[$r.charCodeAt(ae)]=ae;var ae,Zn;Ft["-".charCodeAt(0)]=62;Ft["_".charCodeAt(0)]=63;function Qn(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function To(t){var e=Qn(t),r=e[0],i=e[1];return(r+i)*3/4-i}function So(t,e,r){return(e+r)*3/4-r}function Oo(t){var e,r=Qn(t),i=r[0],a=r[1],l=new Ao(So(t,i,a)),d=0,m=a>0?i-4:i,w;for(w=0;w<m;w+=4)e=Ft[t.charCodeAt(w)]<<18|Ft[t.charCodeAt(w+1)]<<12|Ft[t.charCodeAt(w+2)]<<6|Ft[t.charCodeAt(w+3)],l[d++]=e>>16&255,l[d++]=e>>8&255,l[d++]=e&255;return a===2&&(e=Ft[t.charCodeAt(w)]<<2|Ft[t.charCodeAt(w+1)]>>4,l[d++]=e&255),a===1&&(e=Ft[t.charCodeAt(w)]<<10|Ft[t.charCodeAt(w+1)]<<4|Ft[t.charCodeAt(w+2)]>>2,l[d++]=e>>8&255,l[d++]=e&255),l}function Uo(t){return Yt[t>>18&63]+Yt[t>>12&63]+Yt[t>>6&63]+Yt[t&63]}function Ro(t,e,r){for(var i,a=[],l=e;l<r;l+=3)i=(t[l]<<16&16711680)+(t[l+1]<<8&65280)+(t[l+2]&255),a.push(Uo(i));return a.join("")}function Po(t){for(var e,r=t.length,i=r%3,a=[],l=16383,d=0,m=r-i;d<m;d+=l)a.push(Ro(t,d,d+l>m?m:d+l));return i===1?(e=t[r-1],a.push(Yt[e>>2]+Yt[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],a.push(Yt[e>>10]+Yt[e>>4&63]+Yt[e<<2&63]+"=")),a.join("")}});var li=ar(ge=>{"use strict";var Wr=In(),we=bo(),Dn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ge.Buffer=g;ge.SlowBuffer=jo;ge.INSPECT_MAX_BYTES=50;var dr=2147483647;ge.kMaxLength=dr;g.TYPED_ARRAY_SUPPORT=No();!g.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function No(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}});Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function Xt(t){if(t>dr)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,g.prototype),e}function g(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Xr(t)}return ei(t,e,r)}g.poolSize=8192;function ei(t,e,r){if(typeof t=="string")return Co(t,e);if(ArrayBuffer.isView(t))return Fo(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(qt(t,ArrayBuffer)||t&&qt(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(qt(t,SharedArrayBuffer)||t&&qt(t.buffer,SharedArrayBuffer)))return Gr(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return g.from(i,e,r);var a=ko(t);if(a)return a;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return g.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}g.from=function(t,e,r){return ei(t,e,r)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function ri(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Bo(t,e,r){return ri(t),t<=0?Xt(t):e!==void 0?typeof r=="string"?Xt(t).fill(e,r):Xt(t).fill(e):Xt(t)}g.alloc=function(t,e,r){return Bo(t,e,r)};function Xr(t){return ri(t),Xt(t<0?0:Zr(t)|0)}g.allocUnsafe=function(t){return Xr(t)};g.allocUnsafeSlow=function(t){return Xr(t)};function Co(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!g.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=ni(t,e)|0,i=Xt(r),a=i.write(t,e);return a!==r&&(i=i.slice(0,a)),i}function zr(t){for(var e=t.length<0?0:Zr(t.length)|0,r=Xt(e),i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Fo(t){if(qt(t,Uint8Array)){var e=new Uint8Array(t);return Gr(e.buffer,e.byteOffset,e.byteLength)}return zr(t)}function Gr(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,g.prototype),i}function ko(t){if(g.isBuffer(t)){var e=Zr(t.length)|0,r=Xt(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Qr(t.length)?Xt(0):zr(t);if(t.type==="Buffer"&&Array.isArray(t.data))return zr(t.data)}function Zr(t){if(t>=dr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+dr.toString(16)+" bytes");return t|0}function jo(t){return+t!=t&&(t=0),g.alloc(+t)}g.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==g.prototype};g.compare=function(e,r){if(qt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),qt(r,Uint8Array)&&(r=g.from(r,r.offset,r.byteLength)),!g.isBuffer(e)||!g.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var i=e.length,a=r.length,l=0,d=Math.min(i,a);l<d;++l)if(e[l]!==r[l]){i=e[l],a=r[l];break}return i<a?-1:a<i?1:0};g.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};g.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return g.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var a=g.allocUnsafe(r),l=0;for(i=0;i<e.length;++i){var d=e[i];if(qt(d,Uint8Array))l+d.length>a.length?g.from(d).copy(a,l):Uint8Array.prototype.set.call(a,d,l);else if(g.isBuffer(d))d.copy(a,l);else throw new TypeError('"list" argument must be an Array of Buffers');l+=d.length}return a};function ni(t,e){if(g.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||qt(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var a=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Jr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ci(t).length;default:if(a)return i?-1:Jr(t).length;e=(""+e).toLowerCase(),a=!0}}g.byteLength=ni;function Ko(t,e,r){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Jo(this,e,r);case"utf8":case"utf-8":return oi(this,e,r);case"ascii":return zo(this,e,r);case"latin1":case"binary":return Go(this,e,r);case"base64":return $o(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xo(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}g.prototype._isBuffer=!0;function se(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}g.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)se(this,r,r+1);return this};g.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)se(this,r,r+3),se(this,r+1,r+2);return this};g.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)se(this,r,r+7),se(this,r+1,r+6),se(this,r+2,r+5),se(this,r+3,r+4);return this};g.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?oi(this,0,e):Ko.apply(this,arguments)};g.prototype.toLocaleString=g.prototype.toString;g.prototype.equals=function(e){if(!g.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:g.compare(this,e)===0};g.prototype.inspect=function(){var e="",r=ge.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Dn&&(g.prototype[Dn]=g.prototype.inspect);g.prototype.compare=function(e,r,i,a,l){if(qt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),!g.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),a===void 0&&(a=0),l===void 0&&(l=this.length),r<0||i>e.length||a<0||l>this.length)throw new RangeError("out of range index");if(a>=l&&r>=i)return 0;if(a>=l)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,a>>>=0,l>>>=0,this===e)return 0;for(var d=l-a,m=i-r,w=Math.min(d,m),A=this.slice(a,l),N=e.slice(r,i),O=0;O<w;++O)if(A[O]!==N[O]){d=A[O],m=N[O];break}return d<m?-1:m<d?1:0};function ii(t,e,r,i,a){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Qr(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0)if(a)r=0;else return-1;if(typeof e=="string"&&(e=g.from(e,i)),g.isBuffer(e))return e.length===0?-1:Ln(t,e,r,i,a);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Ln(t,[e],r,i,a);throw new TypeError("val must be string, number or Buffer")}function Ln(t,e,r,i,a){var l=1,d=t.length,m=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;l=2,d/=2,m/=2,r/=2}function w(D,st){return l===1?D[st]:D.readUInt16BE(st*l)}var A;if(a){var N=-1;for(A=r;A<d;A++)if(w(t,A)===w(e,N===-1?0:A-N)){if(N===-1&&(N=A),A-N+1===m)return N*l}else N!==-1&&(A-=A-N),N=-1}else for(r+m>d&&(r=d-m),A=r;A>=0;A--){for(var O=!0,Z=0;Z<m;Z++)if(w(t,A+Z)!==w(e,Z)){O=!1;break}if(O)return A}return-1}g.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};g.prototype.indexOf=function(e,r,i){return ii(this,e,r,i,!0)};g.prototype.lastIndexOf=function(e,r,i){return ii(this,e,r,i,!1)};function Mo(t,e,r,i){r=Number(r)||0;var a=t.length-r;i?(i=Number(i),i>a&&(i=a)):i=a;var l=e.length;i>l/2&&(i=l/2);for(var d=0;d<i;++d){var m=parseInt(e.substr(d*2,2),16);if(Qr(m))return d;t[r+d]=m}return d}function Vo(t,e,r,i){return pr(Jr(e,t.length-r),t,r,i)}function Yo(t,e,r,i){return pr(Io(e),t,r,i)}function qo(t,e,r,i){return pr(ci(e),t,r,i)}function Ho(t,e,r,i){return pr(Do(e,t.length-r),t,r,i)}g.prototype.write=function(e,r,i,a){if(r===void 0)a="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")a=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,a===void 0&&(a="utf8")):(a=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-r;if((i===void 0||i>l)&&(i=l),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var d=!1;;)switch(a){case"hex":return Mo(this,e,r,i);case"utf8":case"utf-8":return Vo(this,e,r,i);case"ascii":case"latin1":case"binary":return Yo(this,e,r,i);case"base64":return qo(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ho(this,e,r,i);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),d=!0}};g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $o(t,e,r){return e===0&&r===t.length?Wr.fromByteArray(t):Wr.fromByteArray(t.slice(e,r))}function oi(t,e,r){r=Math.min(t.length,r);for(var i=[],a=e;a<r;){var l=t[a],d=null,m=l>239?4:l>223?3:l>191?2:1;if(a+m<=r){var w,A,N,O;switch(m){case 1:l<128&&(d=l);break;case 2:w=t[a+1],(w&192)===128&&(O=(l&31)<<6|w&63,O>127&&(d=O));break;case 3:w=t[a+1],A=t[a+2],(w&192)===128&&(A&192)===128&&(O=(l&15)<<12|(w&63)<<6|A&63,O>2047&&(O<55296||O>57343)&&(d=O));break;case 4:w=t[a+1],A=t[a+2],N=t[a+3],(w&192)===128&&(A&192)===128&&(N&192)===128&&(O=(l&15)<<18|(w&63)<<12|(A&63)<<6|N&63,O>65535&&O<1114112&&(d=O))}}d===null?(d=65533,m=1):d>65535&&(d-=65536,i.push(d>>>10&1023|55296),d=56320|d&1023),i.push(d),a+=m}return Wo(i)}var ti=4096;function Wo(t){var e=t.length;if(e<=ti)return String.fromCharCode.apply(String,t);for(var r="",i=0;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=ti));return r}function zo(t,e,r){var i="";r=Math.min(t.length,r);for(var a=e;a<r;++a)i+=String.fromCharCode(t[a]&127);return i}function Go(t,e,r){var i="";r=Math.min(t.length,r);for(var a=e;a<r;++a)i+=String.fromCharCode(t[a]);return i}function Jo(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var a="",l=e;l<r;++l)a+=Lo[t[l]];return a}function Xo(t,e,r){for(var i=t.slice(e,r),a="",l=0;l<i.length-1;l+=2)a+=String.fromCharCode(i[l]+i[l+1]*256);return a}g.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var a=this.subarray(e,r);return Object.setPrototypeOf(a,g.prototype),a};function xt(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUintLE=g.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||xt(e,r,this.length);for(var a=this[e],l=1,d=0;++d<r&&(l*=256);)a+=this[e+d]*l;return a};g.prototype.readUintBE=g.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||xt(e,r,this.length);for(var a=this[e+--r],l=1;r>0&&(l*=256);)a+=this[e+--r]*l;return a};g.prototype.readUint8=g.prototype.readUInt8=function(e,r){return e=e>>>0,r||xt(e,1,this.length),this[e]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||xt(e,2,this.length),this[e]|this[e+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||xt(e,2,this.length),this[e]<<8|this[e+1]};g.prototype.readUint32LE=g.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};g.prototype.readUint32BE=g.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};g.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||xt(e,r,this.length);for(var a=this[e],l=1,d=0;++d<r&&(l*=256);)a+=this[e+d]*l;return l*=128,a>=l&&(a-=Math.pow(2,8*r)),a};g.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||xt(e,r,this.length);for(var a=r,l=1,d=this[e+--a];a>0&&(l*=256);)d+=this[e+--a]*l;return l*=128,d>=l&&(d-=Math.pow(2,8*r)),d};g.prototype.readInt8=function(e,r){return e=e>>>0,r||xt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};g.prototype.readInt16LE=function(e,r){e=e>>>0,r||xt(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};g.prototype.readInt16BE=function(e,r){e=e>>>0,r||xt(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};g.prototype.readInt32LE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};g.prototype.readInt32BE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};g.prototype.readFloatLE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),we.read(this,e,!0,23,4)};g.prototype.readFloatBE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),we.read(this,e,!1,23,4)};g.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||xt(e,8,this.length),we.read(this,e,!0,52,8)};g.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||xt(e,8,this.length),we.read(this,e,!1,52,8)};function Tt(t,e,r,i,a,l){if(!g.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<l)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(e,r,i,a){if(e=+e,r=r>>>0,i=i>>>0,!a){var l=Math.pow(2,8*i)-1;Tt(this,e,r,i,l,0)}var d=1,m=0;for(this[r]=e&255;++m<i&&(d*=256);)this[r+m]=e/d&255;return r+i};g.prototype.writeUintBE=g.prototype.writeUIntBE=function(e,r,i,a){if(e=+e,r=r>>>0,i=i>>>0,!a){var l=Math.pow(2,8*i)-1;Tt(this,e,r,i,l,0)}var d=i-1,m=1;for(this[r+d]=e&255;--d>=0&&(m*=256);)this[r+d]=e/m&255;return r+i};g.prototype.writeUint8=g.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,1,255,0),this[r]=e&255,r+1};g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};g.prototype.writeIntLE=function(e,r,i,a){if(e=+e,r=r>>>0,!a){var l=Math.pow(2,8*i-1);Tt(this,e,r,i,l-1,-l)}var d=0,m=1,w=0;for(this[r]=e&255;++d<i&&(m*=256);)e<0&&w===0&&this[r+d-1]!==0&&(w=1),this[r+d]=(e/m>>0)-w&255;return r+i};g.prototype.writeIntBE=function(e,r,i,a){if(e=+e,r=r>>>0,!a){var l=Math.pow(2,8*i-1);Tt(this,e,r,i,l-1,-l)}var d=i-1,m=1,w=0;for(this[r+d]=e&255;--d>=0&&(m*=256);)e<0&&w===0&&this[r+d+1]!==0&&(w=1),this[r+d]=(e/m>>0)-w&255;return r+i};g.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};g.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};g.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};g.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};g.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Tt(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function ai(t,e,r,i,a,l){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function si(t,e,r,i,a){return e=+e,r=r>>>0,a||ai(t,e,r,4,34028234663852886e22,-34028234663852886e22),we.write(t,e,r,i,23,4),r+4}g.prototype.writeFloatLE=function(e,r,i){return si(this,e,r,!0,i)};g.prototype.writeFloatBE=function(e,r,i){return si(this,e,r,!1,i)};function fi(t,e,r,i,a){return e=+e,r=r>>>0,a||ai(t,e,r,8,17976931348623157e292,-17976931348623157e292),we.write(t,e,r,i,52,8),r+8}g.prototype.writeDoubleLE=function(e,r,i){return fi(this,e,r,!0,i)};g.prototype.writeDoubleBE=function(e,r,i){return fi(this,e,r,!1,i)};g.prototype.copy=function(e,r,i,a){if(!g.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!a&&a!==0&&(a=this.length),r>=e.length&&(r=e.length),r||(r=0),a>0&&a<i&&(a=i),a===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-r<a-i&&(a=e.length-r+i);var l=a-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,a):Uint8Array.prototype.set.call(e,this.subarray(i,a),r),l};g.prototype.fill=function(e,r,i,a){if(typeof e=="string"){if(typeof r=="string"?(a=r,r=0,i=this.length):typeof i=="string"&&(a=i,i=this.length),a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!g.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(e.length===1){var l=e.charCodeAt(0);(a==="utf8"&&l<128||a==="latin1")&&(e=l)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var d;if(typeof e=="number")for(d=r;d<i;++d)this[d]=e;else{var m=g.isBuffer(e)?e:g.from(e,a),w=m.length;if(w===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(d=0;d<i-r;++d)this[d+r]=m[d%w]}return this};var Zo=/[^+/0-9A-Za-z-_]/g;function Qo(t){if(t=t.split("=")[0],t=t.trim().replace(Zo,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Jr(t,e){e=e||1/0;for(var r,i=t.length,a=null,l=[],d=0;d<i;++d){if(r=t.charCodeAt(d),r>55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&l.push(239,191,189);continue}else if(d+1===i){(e-=3)>-1&&l.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&l.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(e-=3)>-1&&l.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;l.push(r)}else if(r<2048){if((e-=2)<0)break;l.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;l.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;l.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return l}function Io(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Do(t,e){for(var r,i,a,l=[],d=0;d<t.length&&!((e-=2)<0);++d)r=t.charCodeAt(d),i=r>>8,a=r%256,l.push(a),l.push(i);return l}function ci(t){return Wr.toByteArray(Qo(t))}function pr(t,e,r,i){for(var a=0;a<i&&!(a+r>=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function qt(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Qr(t){return t!==t}var Lo=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var i=r*16,a=0;a<16;++a)e[i+a]=t[r]+t[a];return e}()});var Ai={};jn(Ai,{default:()=>ga});var ga,Ti=go(()=>{ga={}});var Si=ar((Sf,vr)=>{var le=(Ti(),_o(Ai));if(le&&le.default){vr.exports=le.default;for(let t in le)vr.exports[t]=le[t]}else le&&(vr.exports=le)});var nn=ar((Of,Er)=>{(function(t){"use strict";var e=function(o){var f,s=new Float64Array(16);if(o)for(f=0;f<o.length;f++)s[f]=o[f];return s},r=function(){throw new Error("no PRNG")},i=new Uint8Array(16),a=new Uint8Array(32);a[0]=9;var l=e(),d=e([1]),m=e([56129,1]),w=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),A=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),N=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),O=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Z=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function D(o,f,s,n){o[f]=s>>24&255,o[f+1]=s>>16&255,o[f+2]=s>>8&255,o[f+3]=s&255,o[f+4]=n>>24&255,o[f+5]=n>>16&255,o[f+6]=n>>8&255,o[f+7]=n&255}function st(o,f,s,n,c){var p,h=0;for(p=0;p<c;p++)h|=o[f+p]^s[n+p];return(1&h-1>>>8)-1}function ft(o,f,s,n){return st(o,f,s,n,16)}function bt(o,f,s,n){return st(o,f,s,n,32)}function pt(o,f,s,n){for(var c=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,h=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,b=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,S=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,j=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,R=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,rt=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,B=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,V=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,Y=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,z=s[16]&255|(s[17]&255)<<8|(s[18]&255)<<16|(s[19]&255)<<24,W=s[20]&255|(s[21]&255)<<8|(s[22]&255)<<16|(s[23]&255)<<24,q=s[24]&255|(s[25]&255)<<8|(s[26]&255)<<16|(s[27]&255)<<24,$=s[28]&255|(s[29]&255)<<8|(s[30]&255)<<16|(s[31]&255)<<24,H=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,C=c,K=p,P=h,F=b,k=S,U=j,x=R,y=rt,E=B,_=V,v=Y,T=z,M=W,G=q,X=$,J=H,u,I=0;I<20;I+=2)u=C+M|0,k^=u<<7|u>>>32-7,u=k+C|0,E^=u<<9|u>>>32-9,u=E+k|0,M^=u<<13|u>>>32-13,u=M+E|0,C^=u<<18|u>>>32-18,u=U+K|0,_^=u<<7|u>>>32-7,u=_+U|0,G^=u<<9|u>>>32-9,u=G+_|0,K^=u<<13|u>>>32-13,u=K+G|0,U^=u<<18|u>>>32-18,u=v+x|0,X^=u<<7|u>>>32-7,u=X+v|0,P^=u<<9|u>>>32-9,u=P+X|0,x^=u<<13|u>>>32-13,u=x+P|0,v^=u<<18|u>>>32-18,u=J+T|0,F^=u<<7|u>>>32-7,u=F+J|0,y^=u<<9|u>>>32-9,u=y+F|0,T^=u<<13|u>>>32-13,u=T+y|0,J^=u<<18|u>>>32-18,u=C+F|0,K^=u<<7|u>>>32-7,u=K+C|0,P^=u<<9|u>>>32-9,u=P+K|0,F^=u<<13|u>>>32-13,u=F+P|0,C^=u<<18|u>>>32-18,u=U+k|0,x^=u<<7|u>>>32-7,u=x+U|0,y^=u<<9|u>>>32-9,u=y+x|0,k^=u<<13|u>>>32-13,u=k+y|0,U^=u<<18|u>>>32-18,u=v+_|0,T^=u<<7|u>>>32-7,u=T+v|0,E^=u<<9|u>>>32-9,u=E+T|0,_^=u<<13|u>>>32-13,u=_+E|0,v^=u<<18|u>>>32-18,u=J+X|0,M^=u<<7|u>>>32-7,u=M+J|0,G^=u<<9|u>>>32-9,u=G+M|0,X^=u<<13|u>>>32-13,u=X+G|0,J^=u<<18|u>>>32-18;C=C+c|0,K=K+p|0,P=P+h|0,F=F+b|0,k=k+S|0,U=U+j|0,x=x+R|0,y=y+rt|0,E=E+B|0,_=_+V|0,v=v+Y|0,T=T+z|0,M=M+W|0,G=G+q|0,X=X+$|0,J=J+H|0,o[0]=C>>>0&255,o[1]=C>>>8&255,o[2]=C>>>16&255,o[3]=C>>>24&255,o[4]=K>>>0&255,o[5]=K>>>8&255,o[6]=K>>>16&255,o[7]=K>>>24&255,o[8]=P>>>0&255,o[9]=P>>>8&255,o[10]=P>>>16&255,o[11]=P>>>24&255,o[12]=F>>>0&255,o[13]=F>>>8&255,o[14]=F>>>16&255,o[15]=F>>>24&255,o[16]=k>>>0&255,o[17]=k>>>8&255,o[18]=k>>>16&255,o[19]=k>>>24&255,o[20]=U>>>0&255,o[21]=U>>>8&255,o[22]=U>>>16&255,o[23]=U>>>24&255,o[24]=x>>>0&255,o[25]=x>>>8&255,o[26]=x>>>16&255,o[27]=x>>>24&255,o[28]=y>>>0&255,o[29]=y>>>8&255,o[30]=y>>>16&255,o[31]=y>>>24&255,o[32]=E>>>0&255,o[33]=E>>>8&255,o[34]=E>>>16&255,o[35]=E>>>24&255,o[36]=_>>>0&255,o[37]=_>>>8&255,o[38]=_>>>16&255,o[39]=_>>>24&255,o[40]=v>>>0&255,o[41]=v>>>8&255,o[42]=v>>>16&255,o[43]=v>>>24&255,o[44]=T>>>0&255,o[45]=T>>>8&255,o[46]=T>>>16&255,o[47]=T>>>24&255,o[48]=M>>>0&255,o[49]=M>>>8&255,o[50]=M>>>16&255,o[51]=M>>>24&255,o[52]=G>>>0&255,o[53]=G>>>8&255,o[54]=G>>>16&255,o[55]=G>>>24&255,o[56]=X>>>0&255,o[57]=X>>>8&255,o[58]=X>>>16&255,o[59]=X>>>24&255,o[60]=J>>>0&255,o[61]=J>>>8&255,o[62]=J>>>16&255,o[63]=J>>>24&255}function vt(o,f,s,n){for(var c=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,h=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,b=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,S=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,j=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,R=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,rt=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,B=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,V=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,Y=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,z=s[16]&255|(s[17]&255)<<8|(s[18]&255)<<16|(s[19]&255)<<24,W=s[20]&255|(s[21]&255)<<8|(s[22]&255)<<16|(s[23]&255)<<24,q=s[24]&255|(s[25]&255)<<8|(s[26]&255)<<16|(s[27]&255)<<24,$=s[28]&255|(s[29]&255)<<8|(s[30]&255)<<16|(s[31]&255)<<24,H=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,C=c,K=p,P=h,F=b,k=S,U=j,x=R,y=rt,E=B,_=V,v=Y,T=z,M=W,G=q,X=$,J=H,u,I=0;I<20;I+=2)u=C+M|0,k^=u<<7|u>>>32-7,u=k+C|0,E^=u<<9|u>>>32-9,u=E+k|0,M^=u<<13|u>>>32-13,u=M+E|0,C^=u<<18|u>>>32-18,u=U+K|0,_^=u<<7|u>>>32-7,u=_+U|0,G^=u<<9|u>>>32-9,u=G+_|0,K^=u<<13|u>>>32-13,u=K+G|0,U^=u<<18|u>>>32-18,u=v+x|0,X^=u<<7|u>>>32-7,u=X+v|0,P^=u<<9|u>>>32-9,u=P+X|0,x^=u<<13|u>>>32-13,u=x+P|0,v^=u<<18|u>>>32-18,u=J+T|0,F^=u<<7|u>>>32-7,u=F+J|0,y^=u<<9|u>>>32-9,u=y+F|0,T^=u<<13|u>>>32-13,u=T+y|0,J^=u<<18|u>>>32-18,u=C+F|0,K^=u<<7|u>>>32-7,u=K+C|0,P^=u<<9|u>>>32-9,u=P+K|0,F^=u<<13|u>>>32-13,u=F+P|0,C^=u<<18|u>>>32-18,u=U+k|0,x^=u<<7|u>>>32-7,u=x+U|0,y^=u<<9|u>>>32-9,u=y+x|0,k^=u<<13|u>>>32-13,u=k+y|0,U^=u<<18|u>>>32-18,u=v+_|0,T^=u<<7|u>>>32-7,u=T+v|0,E^=u<<9|u>>>32-9,u=E+T|0,_^=u<<13|u>>>32-13,u=_+E|0,v^=u<<18|u>>>32-18,u=J+X|0,M^=u<<7|u>>>32-7,u=M+J|0,G^=u<<9|u>>>32-9,u=G+M|0,X^=u<<13|u>>>32-13,u=X+G|0,J^=u<<18|u>>>32-18;o[0]=C>>>0&255,o[1]=C>>>8&255,o[2]=C>>>16&255,o[3]=C>>>24&255,o[4]=U>>>0&255,o[5]=U>>>8&255,o[6]=U>>>16&255,o[7]=U>>>24&255,o[8]=v>>>0&255,o[9]=v>>>8&255,o[10]=v>>>16&255,o[11]=v>>>24&255,o[12]=J>>>0&255,o[13]=J>>>8&255,o[14]=J>>>16&255,o[15]=J>>>24&255,o[16]=x>>>0&255,o[17]=x>>>8&255,o[18]=x>>>16&255,o[19]=x>>>24&255,o[20]=y>>>0&255,o[21]=y>>>8&255,o[22]=y>>>16&255,o[23]=y>>>24&255,o[24]=E>>>0&255,o[25]=E>>>8&255,o[26]=E>>>16&255,o[27]=E>>>24&255,o[28]=_>>>0&255,o[29]=_>>>8&255,o[30]=_>>>16&255,o[31]=_>>>24&255}function Vt(o,f,s,n){pt(o,f,s,n)}function Nt(o,f,s,n){vt(o,f,s,n)}var Bt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Je(o,f,s,n,c,p,h){var b=new Uint8Array(16),S=new Uint8Array(64),j,R;for(R=0;R<16;R++)b[R]=0;for(R=0;R<8;R++)b[R]=p[R];for(;c>=64;){for(Vt(S,b,h,Bt),R=0;R<64;R++)o[f+R]=s[n+R]^S[R];for(j=1,R=8;R<16;R++)j=j+(b[R]&255)|0,b[R]=j&255,j>>>=8;c-=64,f+=64,n+=64}if(c>0)for(Vt(S,b,h,Bt),R=0;R<c;R++)o[f+R]=s[n+R]^S[R];return 0}function Xe(o,f,s,n,c){var p=new Uint8Array(16),h=new Uint8Array(64),b,S;for(S=0;S<16;S++)p[S]=0;for(S=0;S<8;S++)p[S]=n[S];for(;s>=64;){for(Vt(h,p,c,Bt),S=0;S<64;S++)o[f+S]=h[S];for(b=1,S=8;S<16;S++)b=b+(p[S]&255)|0,p[S]=b&255,b>>>=8;s-=64,f+=64}if(s>0)for(Vt(h,p,c,Bt),S=0;S<s;S++)o[f+S]=h[S];return 0}function Ze(o,f,s,n,c){var p=new Uint8Array(32);Nt(p,n,c,Bt);for(var h=new Uint8Array(8),b=0;b<8;b++)h[b]=n[b+16];return Xe(o,f,s,h,p)}function de(o,f,s,n,c,p,h){var b=new Uint8Array(32);Nt(b,p,h,Bt);for(var S=new Uint8Array(8),j=0;j<8;j++)S[j]=p[j+16];return Je(o,f,s,n,c,S,b)}var pe=function(o){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var f,s,n,c,p,h,b,S;f=o[0]&255|(o[1]&255)<<8,this.r[0]=f&8191,s=o[2]&255|(o[3]&255)<<8,this.r[1]=(f>>>13|s<<3)&8191,n=o[4]&255|(o[5]&255)<<8,this.r[2]=(s>>>10|n<<6)&7939,c=o[6]&255|(o[7]&255)<<8,this.r[3]=(n>>>7|c<<9)&8191,p=o[8]&255|(o[9]&255)<<8,this.r[4]=(c>>>4|p<<12)&255,this.r[5]=p>>>1&8190,h=o[10]&255|(o[11]&255)<<8,this.r[6]=(p>>>14|h<<2)&8191,b=o[12]&255|(o[13]&255)<<8,this.r[7]=(h>>>11|b<<5)&8065,S=o[14]&255|(o[15]&255)<<8,this.r[8]=(b>>>8|S<<8)&8191,this.r[9]=S>>>5&127,this.pad[0]=o[16]&255|(o[17]&255)<<8,this.pad[1]=o[18]&255|(o[19]&255)<<8,this.pad[2]=o[20]&255|(o[21]&255)<<8,this.pad[3]=o[22]&255|(o[23]&255)<<8,this.pad[4]=o[24]&255|(o[25]&255)<<8,this.pad[5]=o[26]&255|(o[27]&255)<<8,this.pad[6]=o[28]&255|(o[29]&255)<<8,this.pad[7]=o[30]&255|(o[31]&255)<<8};pe.prototype.blocks=function(o,f,s){for(var n=this.fin?0:2048,c,p,h,b,S,j,R,rt,B,V,Y,z,W,q,$,H,C,K,P,F=this.h[0],k=this.h[1],U=this.h[2],x=this.h[3],y=this.h[4],E=this.h[5],_=this.h[6],v=this.h[7],T=this.h[8],M=this.h[9],G=this.r[0],X=this.r[1],J=this.r[2],u=this.r[3],I=this.r[4],nt=this.r[5],it=this.r[6],Q=this.r[7],tt=this.r[8],et=this.r[9];s>=16;)c=o[f+0]&255|(o[f+1]&255)<<8,F+=c&8191,p=o[f+2]&255|(o[f+3]&255)<<8,k+=(c>>>13|p<<3)&8191,h=o[f+4]&255|(o[f+5]&255)<<8,U+=(p>>>10|h<<6)&8191,b=o[f+6]&255|(o[f+7]&255)<<8,x+=(h>>>7|b<<9)&8191,S=o[f+8]&255|(o[f+9]&255)<<8,y+=(b>>>4|S<<12)&8191,E+=S>>>1&8191,j=o[f+10]&255|(o[f+11]&255)<<8,_+=(S>>>14|j<<2)&8191,R=o[f+12]&255|(o[f+13]&255)<<8,v+=(j>>>11|R<<5)&8191,rt=o[f+14]&255|(o[f+15]&255)<<8,T+=(R>>>8|rt<<8)&8191,M+=rt>>>5|n,B=0,V=B,V+=F*G,V+=k*(5*et),V+=U*(5*tt),V+=x*(5*Q),V+=y*(5*it),B=V>>>13,V&=8191,V+=E*(5*nt),V+=_*(5*I),V+=v*(5*u),V+=T*(5*J),V+=M*(5*X),B+=V>>>13,V&=8191,Y=B,Y+=F*X,Y+=k*G,Y+=U*(5*et),Y+=x*(5*tt),Y+=y*(5*Q),B=Y>>>13,Y&=8191,Y+=E*(5*it),Y+=_*(5*nt),Y+=v*(5*I),Y+=T*(5*u),Y+=M*(5*J),B+=Y>>>13,Y&=8191,z=B,z+=F*J,z+=k*X,z+=U*G,z+=x*(5*et),z+=y*(5*tt),B=z>>>13,z&=8191,z+=E*(5*Q),z+=_*(5*it),z+=v*(5*nt),z+=T*(5*I),z+=M*(5*u),B+=z>>>13,z&=8191,W=B,W+=F*u,W+=k*J,W+=U*X,W+=x*G,W+=y*(5*et),B=W>>>13,W&=8191,W+=E*(5*tt),W+=_*(5*Q),W+=v*(5*it),W+=T*(5*nt),W+=M*(5*I),B+=W>>>13,W&=8191,q=B,q+=F*I,q+=k*u,q+=U*J,q+=x*X,q+=y*G,B=q>>>13,q&=8191,q+=E*(5*et),q+=_*(5*tt),q+=v*(5*Q),q+=T*(5*it),q+=M*(5*nt),B+=q>>>13,q&=8191,$=B,$+=F*nt,$+=k*I,$+=U*u,$+=x*J,$+=y*X,B=$>>>13,$&=8191,$+=E*G,$+=_*(5*et),$+=v*(5*tt),$+=T*(5*Q),$+=M*(5*it),B+=$>>>13,$&=8191,H=B,H+=F*it,H+=k*nt,H+=U*I,H+=x*u,H+=y*J,B=H>>>13,H&=8191,H+=E*X,H+=_*G,H+=v*(5*et),H+=T*(5*tt),H+=M*(5*Q),B+=H>>>13,H&=8191,C=B,C+=F*Q,C+=k*it,C+=U*nt,C+=x*I,C+=y*u,B=C>>>13,C&=8191,C+=E*J,C+=_*X,C+=v*G,C+=T*(5*et),C+=M*(5*tt),B+=C>>>13,C&=8191,K=B,K+=F*tt,K+=k*Q,K+=U*it,K+=x*nt,K+=y*I,B=K>>>13,K&=8191,K+=E*u,K+=_*J,K+=v*X,K+=T*G,K+=M*(5*et),B+=K>>>13,K&=8191,P=B,P+=F*et,P+=k*tt,P+=U*Q,P+=x*it,P+=y*nt,B=P>>>13,P&=8191,P+=E*I,P+=_*u,P+=v*J,P+=T*X,P+=M*G,B+=P>>>13,P&=8191,B=(B<<2)+B|0,B=B+V|0,V=B&8191,B=B>>>13,Y+=B,F=V,k=Y,U=z,x=W,y=q,E=$,_=H,v=C,T=K,M=P,f+=16,s-=16;this.h[0]=F,this.h[1]=k,this.h[2]=U,this.h[3]=x,this.h[4]=y,this.h[5]=E,this.h[6]=_,this.h[7]=v,this.h[8]=T,this.h[9]=M},pe.prototype.finish=function(o,f){var s=new Uint16Array(10),n,c,p,h;if(this.leftover){for(h=this.leftover,this.buffer[h++]=1;h<16;h++)this.buffer[h]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,h=2;h<10;h++)this.h[h]+=n,n=this.h[h]>>>13,this.h[h]&=8191;for(this.h[0]+=n*5,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,s[0]=this.h[0]+5,n=s[0]>>>13,s[0]&=8191,h=1;h<10;h++)s[h]=this.h[h]+n,n=s[h]>>>13,s[h]&=8191;for(s[9]-=8192,c=(n^1)-1,h=0;h<10;h++)s[h]&=c;for(c=~c,h=0;h<10;h++)this.h[h]=this.h[h]&c|s[h];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,p=this.h[0]+this.pad[0],this.h[0]=p&65535,h=1;h<8;h++)p=(this.h[h]+this.pad[h]|0)+(p>>>16)|0,this.h[h]=p&65535;o[f+0]=this.h[0]>>>0&255,o[f+1]=this.h[0]>>>8&255,o[f+2]=this.h[1]>>>0&255,o[f+3]=this.h[1]>>>8&255,o[f+4]=this.h[2]>>>0&255,o[f+5]=this.h[2]>>>8&255,o[f+6]=this.h[3]>>>0&255,o[f+7]=this.h[3]>>>8&255,o[f+8]=this.h[4]>>>0&255,o[f+9]=this.h[4]>>>8&255,o[f+10]=this.h[5]>>>0&255,o[f+11]=this.h[5]>>>8&255,o[f+12]=this.h[6]>>>0&255,o[f+13]=this.h[6]>>>8&255,o[f+14]=this.h[7]>>>0&255,o[f+15]=this.h[7]>>>8&255},pe.prototype.update=function(o,f,s){var n,c;if(this.leftover){for(c=16-this.leftover,c>s&&(c=s),n=0;n<c;n++)this.buffer[this.leftover+n]=o[f+n];if(s-=c,f+=c,this.leftover+=c,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(s>=16&&(c=s-s%16,this.blocks(o,f,c),f+=c,s-=c),s){for(n=0;n<s;n++)this.buffer[this.leftover+n]=o[f+n];this.leftover+=s}};function Ae(o,f,s,n,c,p){var h=new pe(p);return h.update(s,n,c),h.finish(o,f),0}function Qe(o,f,s,n,c,p){var h=new Uint8Array(16);return Ae(h,0,s,n,c,p),ft(o,f,h,0)}function Te(o,f,s,n,c){var p;if(s<32)return-1;for(de(o,0,f,0,s,n,c),Ae(o,16,o,32,s-32,o),p=0;p<16;p++)o[p]=0;return 0}function Se(o,f,s,n,c){var p,h=new Uint8Array(32);if(s<32||(Ze(h,0,32,n,c),Qe(f,16,f,32,s-32,h)!==0))return-1;for(de(o,0,f,0,s,n,c),p=0;p<32;p++)o[p]=0;return 0}function jt(o,f){var s;for(s=0;s<16;s++)o[s]=f[s]|0}function Dt(o){var f,s,n=1;for(f=0;f<16;f++)s=o[f]+n+65535,n=Math.floor(s/65536),o[f]=s-n*65536;o[0]+=n-1+37*(n-1)}function Lt(o,f,s){for(var n,c=~(s-1),p=0;p<16;p++)n=c&(o[p]^f[p]),o[p]^=n,f[p]^=n}function te(o,f){var s,n,c,p=e(),h=e();for(s=0;s<16;s++)h[s]=f[s];for(Dt(h),Dt(h),Dt(h),n=0;n<2;n++){for(p[0]=h[0]-65517,s=1;s<15;s++)p[s]=h[s]-65535-(p[s-1]>>16&1),p[s-1]&=65535;p[15]=h[15]-32767-(p[14]>>16&1),c=p[15]>>16&1,p[14]&=65535,Lt(h,p,1-c)}for(s=0;s<16;s++)o[2*s]=h[s]&255,o[2*s+1]=h[s]>>8}function Ie(o,f){var s=new Uint8Array(32),n=new Uint8Array(32);return te(s,o),te(n,f),bt(s,0,n,0)}function Oe(o){var f=new Uint8Array(32);return te(f,o),f[0]&1}function Ue(o,f){var s;for(s=0;s<16;s++)o[s]=f[2*s]+(f[2*s+1]<<8);o[15]&=32767}function Ut(o,f,s){for(var n=0;n<16;n++)o[n]=f[n]+s[n]}function Rt(o,f,s){for(var n=0;n<16;n++)o[n]=f[n]-s[n]}function L(o,f,s){var n,c,p=0,h=0,b=0,S=0,j=0,R=0,rt=0,B=0,V=0,Y=0,z=0,W=0,q=0,$=0,H=0,C=0,K=0,P=0,F=0,k=0,U=0,x=0,y=0,E=0,_=0,v=0,T=0,M=0,G=0,X=0,J=0,u=s[0],I=s[1],nt=s[2],it=s[3],Q=s[4],tt=s[5],et=s[6],dt=s[7],at=s[8],ct=s[9],lt=s[10],ut=s[11],ht=s[12],wt=s[13],gt=s[14],_t=s[15];n=f[0],p+=n*u,h+=n*I,b+=n*nt,S+=n*it,j+=n*Q,R+=n*tt,rt+=n*et,B+=n*dt,V+=n*at,Y+=n*ct,z+=n*lt,W+=n*ut,q+=n*ht,$+=n*wt,H+=n*gt,C+=n*_t,n=f[1],h+=n*u,b+=n*I,S+=n*nt,j+=n*it,R+=n*Q,rt+=n*tt,B+=n*et,V+=n*dt,Y+=n*at,z+=n*ct,W+=n*lt,q+=n*ut,$+=n*ht,H+=n*wt,C+=n*gt,K+=n*_t,n=f[2],b+=n*u,S+=n*I,j+=n*nt,R+=n*it,rt+=n*Q,B+=n*tt,V+=n*et,Y+=n*dt,z+=n*at,W+=n*ct,q+=n*lt,$+=n*ut,H+=n*ht,C+=n*wt,K+=n*gt,P+=n*_t,n=f[3],S+=n*u,j+=n*I,R+=n*nt,rt+=n*it,B+=n*Q,V+=n*tt,Y+=n*et,z+=n*dt,W+=n*at,q+=n*ct,$+=n*lt,H+=n*ut,C+=n*ht,K+=n*wt,P+=n*gt,F+=n*_t,n=f[4],j+=n*u,R+=n*I,rt+=n*nt,B+=n*it,V+=n*Q,Y+=n*tt,z+=n*et,W+=n*dt,q+=n*at,$+=n*ct,H+=n*lt,C+=n*ut,K+=n*ht,P+=n*wt,F+=n*gt,k+=n*_t,n=f[5],R+=n*u,rt+=n*I,B+=n*nt,V+=n*it,Y+=n*Q,z+=n*tt,W+=n*et,q+=n*dt,$+=n*at,H+=n*ct,C+=n*lt,K+=n*ut,P+=n*ht,F+=n*wt,k+=n*gt,U+=n*_t,n=f[6],rt+=n*u,B+=n*I,V+=n*nt,Y+=n*it,z+=n*Q,W+=n*tt,q+=n*et,$+=n*dt,H+=n*at,C+=n*ct,K+=n*lt,P+=n*ut,F+=n*ht,k+=n*wt,U+=n*gt,x+=n*_t,n=f[7],B+=n*u,V+=n*I,Y+=n*nt,z+=n*it,W+=n*Q,q+=n*tt,$+=n*et,H+=n*dt,C+=n*at,K+=n*ct,P+=n*lt,F+=n*ut,k+=n*ht,U+=n*wt,x+=n*gt,y+=n*_t,n=f[8],V+=n*u,Y+=n*I,z+=n*nt,W+=n*it,q+=n*Q,$+=n*tt,H+=n*et,C+=n*dt,K+=n*at,P+=n*ct,F+=n*lt,k+=n*ut,U+=n*ht,x+=n*wt,y+=n*gt,E+=n*_t,n=f[9],Y+=n*u,z+=n*I,W+=n*nt,q+=n*it,$+=n*Q,H+=n*tt,C+=n*et,K+=n*dt,P+=n*at,F+=n*ct,k+=n*lt,U+=n*ut,x+=n*ht,y+=n*wt,E+=n*gt,_+=n*_t,n=f[10],z+=n*u,W+=n*I,q+=n*nt,$+=n*it,H+=n*Q,C+=n*tt,K+=n*et,P+=n*dt,F+=n*at,k+=n*ct,U+=n*lt,x+=n*ut,y+=n*ht,E+=n*wt,_+=n*gt,v+=n*_t,n=f[11],W+=n*u,q+=n*I,$+=n*nt,H+=n*it,C+=n*Q,K+=n*tt,P+=n*et,F+=n*dt,k+=n*at,U+=n*ct,x+=n*lt,y+=n*ut,E+=n*ht,_+=n*wt,v+=n*gt,T+=n*_t,n=f[12],q+=n*u,$+=n*I,H+=n*nt,C+=n*it,K+=n*Q,P+=n*tt,F+=n*et,k+=n*dt,U+=n*at,x+=n*ct,y+=n*lt,E+=n*ut,_+=n*ht,v+=n*wt,T+=n*gt,M+=n*_t,n=f[13],$+=n*u,H+=n*I,C+=n*nt,K+=n*it,P+=n*Q,F+=n*tt,k+=n*et,U+=n*dt,x+=n*at,y+=n*ct,E+=n*lt,_+=n*ut,v+=n*ht,T+=n*wt,M+=n*gt,G+=n*_t,n=f[14],H+=n*u,C+=n*I,K+=n*nt,P+=n*it,F+=n*Q,k+=n*tt,U+=n*et,x+=n*dt,y+=n*at,E+=n*ct,_+=n*lt,v+=n*ut,T+=n*ht,M+=n*wt,G+=n*gt,X+=n*_t,n=f[15],C+=n*u,K+=n*I,P+=n*nt,F+=n*it,k+=n*Q,U+=n*tt,x+=n*et,y+=n*dt,E+=n*at,_+=n*ct,v+=n*lt,T+=n*ut,M+=n*ht,G+=n*wt,X+=n*gt,J+=n*_t,p+=38*K,h+=38*P,b+=38*F,S+=38*k,j+=38*U,R+=38*x,rt+=38*y,B+=38*E,V+=38*_,Y+=38*v,z+=38*T,W+=38*M,q+=38*G,$+=38*X,H+=38*J,c=1,n=p+c+65535,c=Math.floor(n/65536),p=n-c*65536,n=h+c+65535,c=Math.floor(n/65536),h=n-c*65536,n=b+c+65535,c=Math.floor(n/65536),b=n-c*65536,n=S+c+65535,c=Math.floor(n/65536),S=n-c*65536,n=j+c+65535,c=Math.floor(n/65536),j=n-c*65536,n=R+c+65535,c=Math.floor(n/65536),R=n-c*65536,n=rt+c+65535,c=Math.floor(n/65536),rt=n-c*65536,n=B+c+65535,c=Math.floor(n/65536),B=n-c*65536,n=V+c+65535,c=Math.floor(n/65536),V=n-c*65536,n=Y+c+65535,c=Math.floor(n/65536),Y=n-c*65536,n=z+c+65535,c=Math.floor(n/65536),z=n-c*65536,n=W+c+65535,c=Math.floor(n/65536),W=n-c*65536,n=q+c+65535,c=Math.floor(n/65536),q=n-c*65536,n=$+c+65535,c=Math.floor(n/65536),$=n-c*65536,n=H+c+65535,c=Math.floor(n/65536),H=n-c*65536,n=C+c+65535,c=Math.floor(n/65536),C=n-c*65536,p+=c-1+37*(c-1),c=1,n=p+c+65535,c=Math.floor(n/65536),p=n-c*65536,n=h+c+65535,c=Math.floor(n/65536),h=n-c*65536,n=b+c+65535,c=Math.floor(n/65536),b=n-c*65536,n=S+c+65535,c=Math.floor(n/65536),S=n-c*65536,n=j+c+65535,c=Math.floor(n/65536),j=n-c*65536,n=R+c+65535,c=Math.floor(n/65536),R=n-c*65536,n=rt+c+65535,c=Math.floor(n/65536),rt=n-c*65536,n=B+c+65535,c=Math.floor(n/65536),B=n-c*65536,n=V+c+65535,c=Math.floor(n/65536),V=n-c*65536,n=Y+c+65535,c=Math.floor(n/65536),Y=n-c*65536,n=z+c+65535,c=Math.floor(n/65536),z=n-c*65536,n=W+c+65535,c=Math.floor(n/65536),W=n-c*65536,n=q+c+65535,c=Math.floor(n/65536),q=n-c*65536,n=$+c+65535,c=Math.floor(n/65536),$=n-c*65536,n=H+c+65535,c=Math.floor(n/65536),H=n-c*65536,n=C+c+65535,c=Math.floor(n/65536),C=n-c*65536,p+=c-1+37*(c-1),o[0]=p,o[1]=h,o[2]=b,o[3]=S,o[4]=j,o[5]=R,o[6]=rt,o[7]=B,o[8]=V,o[9]=Y,o[10]=z,o[11]=W,o[12]=q,o[13]=$,o[14]=H,o[15]=C}function Ct(o,f){L(o,f,f)}function An(o,f){var s=e(),n;for(n=0;n<16;n++)s[n]=f[n];for(n=253;n>=0;n--)Ct(s,s),n!==2&&n!==4&&L(s,s,f);for(n=0;n<16;n++)o[n]=s[n]}function Tn(o,f){var s=e(),n;for(n=0;n<16;n++)s[n]=f[n];for(n=250;n>=0;n--)Ct(s,s),n!==1&&L(s,s,f);for(n=0;n<16;n++)o[n]=s[n]}function De(o,f,s){var n=new Uint8Array(32),c=new Float64Array(80),p,h,b=e(),S=e(),j=e(),R=e(),rt=e(),B=e();for(h=0;h<31;h++)n[h]=f[h];for(n[31]=f[31]&127|64,n[0]&=248,Ue(c,s),h=0;h<16;h++)S[h]=c[h],R[h]=b[h]=j[h]=0;for(b[0]=R[0]=1,h=254;h>=0;--h)p=n[h>>>3]>>>(h&7)&1,Lt(b,S,p),Lt(j,R,p),Ut(rt,b,j),Rt(b,b,j),Ut(j,S,R),Rt(S,S,R),Ct(R,rt),Ct(B,b),L(b,j,b),L(j,S,rt),Ut(rt,b,j),Rt(b,b,j),Ct(S,b),Rt(j,R,B),L(b,j,m),Ut(b,b,R),L(j,j,b),L(b,R,B),L(R,S,c),Ct(S,rt),Lt(b,S,p),Lt(j,R,p);for(h=0;h<16;h++)c[h+16]=b[h],c[h+32]=j[h],c[h+48]=S[h],c[h+64]=R[h];var V=c.subarray(32),Y=c.subarray(16);return An(V,V),L(Y,Y,V),te(o,Y),0}function Le(o,f){return De(o,f,a)}function Sn(o,f){return r(f,32),Le(o,f)}function tr(o,f,s){var n=new Uint8Array(32);return De(n,s,f),Nt(o,i,n,Bt)}var On=Te,uo=Se;function po(o,f,s,n,c,p){var h=new Uint8Array(32);return tr(h,c,p),On(o,f,s,n,h)}function ho(o,f,s,n,c,p){var h=new Uint8Array(32);return tr(h,c,p),uo(o,f,s,n,h)}var Un=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Rn(o,f,s,n){for(var c=new Int32Array(16),p=new Int32Array(16),h,b,S,j,R,rt,B,V,Y,z,W,q,$,H,C,K,P,F,k,U,x,y,E,_,v,T,M=o[0],G=o[1],X=o[2],J=o[3],u=o[4],I=o[5],nt=o[6],it=o[7],Q=f[0],tt=f[1],et=f[2],dt=f[3],at=f[4],ct=f[5],lt=f[6],ut=f[7],ht=0;n>=128;){for(k=0;k<16;k++)U=8*k+ht,c[k]=s[U+0]<<24|s[U+1]<<16|s[U+2]<<8|s[U+3],p[k]=s[U+4]<<24|s[U+5]<<16|s[U+6]<<8|s[U+7];for(k=0;k<80;k++)if(h=M,b=G,S=X,j=J,R=u,rt=I,B=nt,V=it,Y=Q,z=tt,W=et,q=dt,$=at,H=ct,C=lt,K=ut,x=it,y=ut,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=(u>>>14|at<<32-14)^(u>>>18|at<<32-18)^(at>>>41-32|u<<32-(41-32)),y=(at>>>14|u<<32-14)^(at>>>18|u<<32-18)^(u>>>41-32|at<<32-(41-32)),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=u&I^~u&nt,y=at&ct^~at&lt,E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=Un[k*2],y=Un[k*2+1],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=c[k%16],y=p[k%16],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,P=v&65535|T<<16,F=E&65535|_<<16,x=P,y=F,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=(M>>>28|Q<<32-28)^(Q>>>34-32|M<<32-(34-32))^(Q>>>39-32|M<<32-(39-32)),y=(Q>>>28|M<<32-28)^(M>>>34-32|Q<<32-(34-32))^(M>>>39-32|Q<<32-(39-32)),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=M&G^M&X^G&X,y=Q&tt^Q&et^tt&et,E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,V=v&65535|T<<16,K=E&65535|_<<16,x=j,y=q,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=P,y=F,E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,j=v&65535|T<<16,q=E&65535|_<<16,G=h,X=b,J=S,u=j,I=R,nt=rt,it=B,M=V,tt=Y,et=z,dt=W,at=q,ct=$,lt=H,ut=C,Q=K,k%16===15)for(U=0;U<16;U++)x=c[U],y=p[U],E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=c[(U+9)%16],y=p[(U+9)%16],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,P=c[(U+1)%16],F=p[(U+1)%16],x=(P>>>1|F<<32-1)^(P>>>8|F<<32-8)^P>>>7,y=(F>>>1|P<<32-1)^(F>>>8|P<<32-8)^(F>>>7|P<<32-7),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,P=c[(U+14)%16],F=p[(U+14)%16],x=(P>>>19|F<<32-19)^(F>>>61-32|P<<32-(61-32))^P>>>6,y=(F>>>19|P<<32-19)^(P>>>61-32|F<<32-(61-32))^(F>>>6|P<<32-6),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,c[U]=v&65535|T<<16,p[U]=E&65535|_<<16;x=M,y=Q,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[0],y=f[0],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,o[0]=M=v&65535|T<<16,f[0]=Q=E&65535|_<<16,x=G,y=tt,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[1],y=f[1],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,o[1]=G=v&65535|T<<16,f[1]=tt=E&65535|_<<16,x=X,y=et,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[2],y=f[2],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,o[2]=X=v&65535|T<<16,f[2]=et=E&65535|_<<16,x=J,y=dt,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[3],y=f[3],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,o[3]=J=v&65535|T<<16,f[3]=dt=E&65535|_<<16,x=u,y=at,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[4],y=f[4],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,o[4]=u=v&65535|T<<16,f[4]=at=E&65535|_<<16,x=I,y=ct,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[5],y=f[5],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,o[5]=I=v&65535|T<<16,f[5]=ct=E&65535|_<<16,x=nt,y=lt,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[6],y=f[6],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,o[6]=nt=v&65535|T<<16,f[6]=lt=E&65535|_<<16,x=it,y=ut,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[7],y=f[7],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,o[7]=it=v&65535|T<<16,f[7]=ut=E&65535|_<<16,ht+=128,n-=128}return n}function re(o,f,s){var n=new Int32Array(8),c=new Int32Array(8),p=new Uint8Array(256),h,b=s;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,c[0]=4089235720,c[1]=2227873595,c[2]=4271175723,c[3]=1595750129,c[4]=2917565137,c[5]=725511199,c[6]=4215389547,c[7]=327033209,Rn(n,c,f,s),s%=128,h=0;h<s;h++)p[h]=f[b-s+h];for(p[s]=128,s=256-128*(s<112?1:0),p[s-9]=0,D(p,s-8,b/536870912|0,b<<3),Rn(n,c,p,s),h=0;h<8;h++)D(o,8*h,n[h],c[h]);return 0}function er(o,f){var s=e(),n=e(),c=e(),p=e(),h=e(),b=e(),S=e(),j=e(),R=e();Rt(s,o[1],o[0]),Rt(R,f[1],f[0]),L(s,s,R),Ut(n,o[0],o[1]),Ut(R,f[0],f[1]),L(n,n,R),L(c,o[3],f[3]),L(c,c,A),L(p,o[2],f[2]),Ut(p,p,p),Rt(h,n,s),Rt(b,p,c),Ut(S,p,c),Ut(j,n,s),L(o[0],h,b),L(o[1],j,S),L(o[2],S,b),L(o[3],h,j)}function Pn(o,f,s){var n;for(n=0;n<4;n++)Lt(o[n],f[n],s)}function Br(o,f){var s=e(),n=e(),c=e();An(c,f[2]),L(s,f[0],c),L(n,f[1],c),te(o,n),o[31]^=Oe(s)<<7}function Cr(o,f,s){var n,c;for(jt(o[0],l),jt(o[1],d),jt(o[2],d),jt(o[3],l),c=255;c>=0;--c)n=s[c/8|0]>>(c&7)&1,Pn(o,f,n),er(f,o),er(o,o),Pn(o,f,n)}function rr(o,f){var s=[e(),e(),e(),e()];jt(s[0],N),jt(s[1],O),jt(s[2],d),L(s[3],N,O),Cr(o,s,f)}function Fr(o,f,s){var n=new Uint8Array(64),c=[e(),e(),e(),e()],p;for(s||r(f,32),re(n,f,32),n[0]&=248,n[31]&=127,n[31]|=64,rr(c,n),Br(o,c),p=0;p<32;p++)f[p+32]=o[p];return 0}var nr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function kr(o,f){var s,n,c,p;for(n=63;n>=32;--n){for(s=0,c=n-32,p=n-12;c<p;++c)f[c]+=s-16*f[n]*nr[c-(n-32)],s=Math.floor((f[c]+128)/256),f[c]-=s*256;f[c]+=s,f[n]=0}for(s=0,c=0;c<32;c++)f[c]+=s-(f[31]>>4)*nr[c],s=f[c]>>8,f[c]&=255;for(c=0;c<32;c++)f[c]-=s*nr[c];for(n=0;n<32;n++)f[n+1]+=f[n]>>8,o[n]=f[n]&255}function jr(o){var f=new Float64Array(64),s;for(s=0;s<64;s++)f[s]=o[s];for(s=0;s<64;s++)o[s]=0;kr(o,f)}function Nn(o,f,s,n){var c=new Uint8Array(64),p=new Uint8Array(64),h=new Uint8Array(64),b,S,j=new Float64Array(64),R=[e(),e(),e(),e()];re(c,n,32),c[0]&=248,c[31]&=127,c[31]|=64;var rt=s+64;for(b=0;b<s;b++)o[64+b]=f[b];for(b=0;b<32;b++)o[32+b]=c[32+b];for(re(h,o.subarray(32),s+32),jr(h),rr(R,h),Br(o,R),b=32;b<64;b++)o[b]=n[b];for(re(p,o,s+64),jr(p),b=0;b<64;b++)j[b]=0;for(b=0;b<32;b++)j[b]=h[b];for(b=0;b<32;b++)for(S=0;S<32;S++)j[b+S]+=p[b]*c[S];return kr(o.subarray(32),j),rt}function xo(o,f){var s=e(),n=e(),c=e(),p=e(),h=e(),b=e(),S=e();return jt(o[2],d),Ue(o[1],f),Ct(c,o[1]),L(p,c,w),Rt(c,c,o[2]),Ut(p,o[2],p),Ct(h,p),Ct(b,h),L(S,b,h),L(s,S,c),L(s,s,p),Tn(s,s),L(s,s,c),L(s,s,p),L(s,s,p),L(o[0],s,p),Ct(n,o[0]),L(n,n,p),Ie(n,c)&&L(o[0],o[0],Z),Ct(n,o[0]),L(n,n,p),Ie(n,c)?-1:(Oe(o[0])===f[31]>>7&&Rt(o[0],l,o[0]),L(o[3],o[0],o[1]),0)}function Kr(o,f,s,n){var c,p=new Uint8Array(32),h=new Uint8Array(64),b=[e(),e(),e(),e()],S=[e(),e(),e(),e()];if(s<64||xo(S,n))return-1;for(c=0;c<s;c++)o[c]=f[c];for(c=0;c<32;c++)o[c+32]=n[c];if(re(h,o,s),jr(h),Cr(b,S,h),rr(S,f.subarray(32)),er(b,S),Br(p,b),s-=64,bt(f,0,p,0)){for(c=0;c<s;c++)o[c]=0;return-1}for(c=0;c<s;c++)o[c]=f[c+64];return s}var Mr=32,ir=24,Re=32,he=16,Pe=32,or=32,Ne=32,Be=32,Vr=32,Bn=ir,yo=Re,mo=he,zt=64,ne=32,xe=64,Yr=32,qr=64;t.lowlevel={crypto_core_hsalsa20:Nt,crypto_stream_xor:de,crypto_stream:Ze,crypto_stream_salsa20_xor:Je,crypto_stream_salsa20:Xe,crypto_onetimeauth:Ae,crypto_onetimeauth_verify:Qe,crypto_verify_16:ft,crypto_verify_32:bt,crypto_secretbox:Te,crypto_secretbox_open:Se,crypto_scalarmult:De,crypto_scalarmult_base:Le,crypto_box_beforenm:tr,crypto_box_afternm:On,crypto_box:po,crypto_box_open:ho,crypto_box_keypair:Sn,crypto_hash:re,crypto_sign:Nn,crypto_sign_keypair:Fr,crypto_sign_open:Kr,crypto_secretbox_KEYBYTES:Mr,crypto_secretbox_NONCEBYTES:ir,crypto_secretbox_ZEROBYTES:Re,crypto_secretbox_BOXZEROBYTES:he,crypto_scalarmult_BYTES:Pe,crypto_scalarmult_SCALARBYTES:or,crypto_box_PUBLICKEYBYTES:Ne,crypto_box_SECRETKEYBYTES:Be,crypto_box_BEFORENMBYTES:Vr,crypto_box_NONCEBYTES:Bn,crypto_box_ZEROBYTES:yo,crypto_box_BOXZEROBYTES:mo,crypto_sign_BYTES:zt,crypto_sign_PUBLICKEYBYTES:ne,crypto_sign_SECRETKEYBYTES:xe,crypto_sign_SEEDBYTES:Yr,crypto_hash_BYTES:qr,gf:e,D:w,L:nr,pack25519:te,unpack25519:Ue,M:L,A:Ut,S:Ct,Z:Rt,pow2523:Tn,add:er,set25519:jt,modL:kr,scalarmult:Cr,scalarbase:rr};function Cn(o,f){if(o.length!==Mr)throw new Error("bad key size");if(f.length!==ir)throw new Error("bad nonce size")}function wo(o,f){if(o.length!==Ne)throw new Error("bad public key size");if(f.length!==Be)throw new Error("bad secret key size")}function Pt(){for(var o=0;o<arguments.length;o++)if(!(arguments[o]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Fn(o){for(var f=0;f<o.length;f++)o[f]=0}t.randomBytes=function(o){var f=new Uint8Array(o);return r(f,o),f},t.secretbox=function(o,f,s){Pt(o,f,s),Cn(s,f);for(var n=new Uint8Array(Re+o.length),c=new Uint8Array(n.length),p=0;p<o.length;p++)n[p+Re]=o[p];return Te(c,n,n.length,f,s),c.subarray(he)},t.secretbox.open=function(o,f,s){Pt(o,f,s),Cn(s,f);for(var n=new Uint8Array(he+o.length),c=new Uint8Array(n.length),p=0;p<o.length;p++)n[p+he]=o[p];return n.length<32||Se(c,n,n.length,f,s)!==0?null:c.subarray(Re)},t.secretbox.keyLength=Mr,t.secretbox.nonceLength=ir,t.secretbox.overheadLength=he,t.scalarMult=function(o,f){if(Pt(o,f),o.length!==or)throw new Error("bad n size");if(f.length!==Pe)throw new Error("bad p size");var s=new Uint8Array(Pe);return De(s,o,f),s},t.scalarMult.base=function(o){if(Pt(o),o.length!==or)throw new Error("bad n size");var f=new Uint8Array(Pe);return Le(f,o),f},t.scalarMult.scalarLength=or,t.scalarMult.groupElementLength=Pe,t.box=function(o,f,s,n){var c=t.box.before(s,n);return t.secretbox(o,f,c)},t.box.before=function(o,f){Pt(o,f),wo(o,f);var s=new Uint8Array(Vr);return tr(s,o,f),s},t.box.after=t.secretbox,t.box.open=function(o,f,s,n){var c=t.box.before(s,n);return t.secretbox.open(o,f,c)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var o=new Uint8Array(Ne),f=new Uint8Array(Be);return Sn(o,f),{publicKey:o,secretKey:f}},t.box.keyPair.fromSecretKey=function(o){if(Pt(o),o.length!==Be)throw new Error("bad secret key size");var f=new Uint8Array(Ne);return Le(f,o),{publicKey:f,secretKey:new Uint8Array(o)}},t.box.publicKeyLength=Ne,t.box.secretKeyLength=Be,t.box.sharedKeyLength=Vr,t.box.nonceLength=Bn,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(o,f){if(Pt(o,f),f.length!==xe)throw new Error("bad secret key size");var s=new Uint8Array(zt+o.length);return Nn(s,o,o.length,f),s},t.sign.open=function(o,f){if(Pt(o,f),f.length!==ne)throw new Error("bad public key size");var s=new Uint8Array(o.length),n=Kr(s,o,o.length,f);if(n<0)return null;for(var c=new Uint8Array(n),p=0;p<c.length;p++)c[p]=s[p];return c},t.sign.detached=function(o,f){for(var s=t.sign(o,f),n=new Uint8Array(zt),c=0;c<n.length;c++)n[c]=s[c];return n},t.sign.detached.verify=function(o,f,s){if(Pt(o,f,s),f.length!==zt)throw new Error("bad signature size");if(s.length!==ne)throw new Error("bad public key size");var n=new Uint8Array(zt+o.length),c=new Uint8Array(zt+o.length),p;for(p=0;p<zt;p++)n[p]=f[p];for(p=0;p<o.length;p++)n[p+zt]=o[p];return Kr(c,n,n.length,s)>=0},t.sign.keyPair=function(){var o=new Uint8Array(ne),f=new Uint8Array(xe);return Fr(o,f),{publicKey:o,secretKey:f}},t.sign.keyPair.fromSecretKey=function(o){if(Pt(o),o.length!==xe)throw new Error("bad secret key size");for(var f=new Uint8Array(ne),s=0;s<f.length;s++)f[s]=o[32+s];return{publicKey:f,secretKey:new Uint8Array(o)}},t.sign.keyPair.fromSeed=function(o){if(Pt(o),o.length!==Yr)throw new Error("bad seed size");for(var f=new Uint8Array(ne),s=new Uint8Array(xe),n=0;n<32;n++)s[n]=o[n];return Fr(f,s,!0),{publicKey:f,secretKey:s}},t.sign.publicKeyLength=ne,t.sign.secretKeyLength=xe,t.sign.seedLength=Yr,t.sign.signatureLength=zt,t.hash=function(o){Pt(o);var f=new Uint8Array(qr);return re(f,o,o.length),f},t.hash.hashLength=qr,t.verify=function(o,f){return Pt(o,f),o.length===0||f.length===0||o.length!==f.length?!1:st(o,0,f,0,o.length)===0},t.setPRNG=function(o){r=o},function(){var o=typeof self<"u"?self.crypto||self.msCrypto:null;if(o&&o.getRandomValues){var f=65536;t.setPRNG(function(s,n){var c,p=new Uint8Array(n);for(c=0;c<n;c+=f)o.getRandomValues(p.subarray(c,c+Math.min(n-c,f)));for(c=0;c<n;c++)s[c]=p[c];Fn(p)})}else typeof kn<"u"&&(o=Si(),o&&o.randomBytes&&t.setPRNG(function(s,n){var c,p=o.randomBytes(n);for(c=0;c<n;c++)s[c]=p[c];Fn(p)}))}()})(typeof Er<"u"&&Er.exports?Er.exports:self.nacl=self.nacl||{})});var yt=t=>t==null,Eo=t=>!yt(t);var mt=t=>Eo(t)?[t]:[],Et=t=>t?.[0],Hn=async t=>{let e=new Blob([JSON.stringify(t)],{type:"application/json; charset=utf-8"});return new Uint8Array(await e.arrayBuffer())},fr=async t=>{let e=new Blob([t instanceof Uint8Array?t:new Uint8Array(t)],{type:"application/json; charset=utf-8"});return JSON.parse(await e.text())},cr=()=>typeof window<"u";var me=class{callbacks=[];populate(e){this.callbacks.forEach(({callback:r})=>r(e))}subscribe(e){let r=Symbol();return this.callbacks.push({id:r,callback:e}),()=>this.callbacks=this.callbacks.filter(({id:i})=>i!==r)}};var Jt=class t extends me{static instance;authUser=null;constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}set(e){this.authUser=e,this.populate(e)}get(){return this.authUser}subscribe(e){let r=super.subscribe(e);return e(this.authUser),r}reset(){this.authUser=null,this.populate(this.authUser)}};var $n=({message:t,detail:e})=>{let r=new CustomEvent(t,{detail:e,bubbles:!0});document.dispatchEvent(r)};var Wn=BigInt(144e11),zn={width:576,height:576},Gn={width:505,height:705},Jn="internetcomputer.org";var At=class t extends me{static instance;env;constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}set(e){this.env=e,this.populate(e)}get(){return this.env}localIdentity(){return this.get()?.localIdentityCanisterId!==void 0}subscribe(e){let r=super.subscribe(e);return e(this.env),r}};var Hr=({width:t,height:e})=>{if(!cr()||yt(window)||yt(window.top))return;let{top:{innerWidth:r,innerHeight:i}}=window,a=i/2+screenY-e/2,l=r/2+screenX-t/2;return`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=${t}, height=${e}, top=${a}, left=${l}`};var lr=class{#t;constructor({domain:e}){this.#t=e}get id(){return"internet_identity"}signInOptions({windowed:e}){let r=At.getInstance().localIdentity()?`http://${At.getInstance().get()?.localIdentityCanisterId}.localhost:8000`:`https://identity.${this.#t??Jn}`;return{...e!==!1&&{windowOpenerFeatures:Hr(zn)},identityProvider:r}}},Xn=class{#t;#e;constructor({appName:e,logoUrl:r}){this.#t=e,this.#e=r}get id(){return"nfid"}signInOptions({windowed:e}){return{...e!==!1&&{windowOpenerFeatures:Hr(Gn)},identityProvider:`https://nfid.one/authenticate/?applicationName=${encodeURI(this.#t)}&applicationLogo=${encodeURI(this.#e)}`}}};var vi=ye(li());var hr;(function(t){t[t.SysFatal=1]="SysFatal",t[t.SysTransient=2]="SysTransient",t[t.DestinationInvalid=3]="DestinationInvalid",t[t.CanisterReject=4]="CanisterReject",t[t.CanisterError=5]="CanisterError"})(hr||(hr={}));var ta=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(r[i[a]]=t[i[a]]);return r},ea=new TextEncoder().encode(`
2
- ic-request`),Zt=class{getPrincipal(){return this._principal||(this._principal=ot.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()))),this._principal}async transformRequest(e){let{body:r}=e,i=ta(e,["body"]),a=await oe(r);return Object.assign(Object.assign({},i),{body:{content:r,sender_pubkey:this.getPublicKey().toDer(),sender_sig:await this.sign(Mn(ea,a))}})}},Qt=class{getPrincipal(){return ot.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var ui=ye(Yn());var ke=()=>{if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){let t=new Uint32Array(1);return window.crypto.getRandomValues(t),t[0]}if(typeof crypto<"u"&&crypto.getRandomValues){let t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}return typeof crypto<"u"&&crypto.randomInt?crypto.randomInt(0,4294967295):Math.floor(Math.random()*4294967295)};var xr;(function(t){t.Call="call"})(xr||(xr={}));function je(){let t=new ArrayBuffer(16),e=new DataView(t),r=ke(),i=ke(),a=ke(),l=ke();return e.setUint32(0,r),e.setUint32(4,i),e.setUint32(8,a),e.setUint32(12,l),t}var ra=BigInt(1e6),na=BigInt(60*1e3),fe=class{constructor(e){this._value=(BigInt(Date.now())+BigInt(e)-na)*ra}toCBOR(){return ui.value.u64(this._value.toString(16),16)}toHash(){return Kn(this._value)}};function di(t=je){return async e=>{let r=t(),i=e.request.headers;e.request.headers=i,e.endpoint==="call"&&(e.body.nonce=t())}}function yr(t){let e=[];return t.forEach((r,i)=>{e.push([i,r])}),e}var mr=class extends Error{constructor(e,r){super(e),this.response=r,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}};var Ht;(function(t){t.Received="received",t.Processing="processing",t.Replied="replied",t.Rejected="rejected",t.Unknown="unknown",t.Done="done"})(Ht||(Ht={}));var wr=5*60*1e3,oa="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",aa="ic0.app",sa=".ic0.app",fa="icp0.io",ca=".icp0.io",la="icp-api.io",ua=".icp-api.io",Ke=class extends ie{constructor(e){super(e),this.message=e}},_e=class extends ie{constructor(e){super(e),this.message=e}};function da(){let t;if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new Ke("Fetch implementation was not available. You appear to be in a browser context, but window.fetch was not present.");else if(typeof globalThis<"u")if(globalThis.fetch)t=globalThis.fetch.bind(globalThis);else throw new Ke("Fetch implementation was not available. You appear to be in a Node.js context, but global.fetch was not available.");else typeof self<"u"&&self.fetch&&(t=self.fetch.bind(self));if(t)return t;throw new Ke("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}var Me=class t{constructor(e={}){if(this.rootKey=Vn(oa),this._pipeline=[],this._timeDiffMsecs=0,this._rootKeyFetched=!1,this._isAgent=!0,e.source){if(!(e.source instanceof t))throw new Error("An Agent's source can only be another HttpAgent");this._pipeline=[...e.source._pipeline],this._identity=e.source._identity,this._fetch=e.source._fetch,this._host=e.source._host,this._credentials=e.source._credentials}else this._fetch=e.fetch||da()||fetch.bind(globalThis),this._fetchOptions=e.fetchOptions,this._callOptions=e.callOptions;if(e.host!==void 0)!e.host.match(/^[a-z]+:/)&&typeof window<"u"?this._host=new URL(window.location.protocol+"//"+e.host):this._host=new URL(e.host);else if(e.source!==void 0)this._host=e.source._host;else{let r=typeof window<"u"?window.location:void 0;r||(this._host=new URL("https://icp-api.io"),console.warn("Could not infer host from window.location, defaulting to mainnet gateway of https://icp-api.io. Please provide a host to the HttpAgent constructor to avoid this warning."));let i=["ic0.app","icp0.io","localhost","127.0.0.1"],a=r?.hostname,l;a&&typeof a=="string"&&(l=i.find(d=>a.endsWith(d))),r&&l?this._host=new URL(`${r.protocol}//${l}${r.port?":"+r.port:""}`):(this._host=new URL("https://icp-api.io"),console.warn("Could not infer host from window.location, defaulting to mainnet gateway of https://icp-api.io. Please provide a host to the HttpAgent constructor to avoid this warning."))}if(this._retryTimes=e.retryTimes!==void 0&&e.retryTimes>=0?e.retryTimes:3,this._host.hostname.endsWith(sa)?this._host.hostname=aa:this._host.hostname.endsWith(ca)?this._host.hostname=fa:this._host.hostname.endsWith(ua)&&(this._host.hostname=la),e.credentials){let{name:r,password:i}=e.credentials;this._credentials=`${r}${i?":"+i:""}`}this._identity=Promise.resolve(e.identity||new Qt),e.disableNonce||this.addTransform(di(je))}isLocal(){let e=this._host.hostname;return e==="127.0.0.1"||e.endsWith("localhost")}addTransform(e,r=e.priority||0){let i=this._pipeline.findIndex(a=>(a.priority||0)<r);this._pipeline.splice(i>=0?i:this._pipeline.length,0,Object.assign(e,{priority:r}))}async getPrincipal(){if(!this._identity)throw new _e("This identity has expired due this application's security policy. Please refresh your authentication.");return(await this._identity).getPrincipal()}async call(e,r,i){let a=await(i!==void 0?await i:await this._identity);if(!a)throw new _e("This identity has expired due this application's security policy. Please refresh your authentication.");let l=ot.from(e),d=r.effectiveCanisterId?ot.from(r.effectiveCanisterId):l,m=a.getPrincipal()||ot.anonymous(),w=new fe(wr);Math.abs(this._timeDiffMsecs)>1e3*30&&(w=new fe(wr+this._timeDiffMsecs));let A={request_type:xr.Call,canister_id:l,method_name:r.methodName,arg:r.arg,sender:m,ingress_expiry:w},N=await this._transform({request:{body:null,method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{})},endpoint:"call",body:A});N=await a.transformRequest(N);let O=sr(N.body),Z=this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${d.toText()}/call`,this._host),Object.assign(Object.assign(Object.assign({},this._callOptions),N.request),{body:O}))),[D,st]=await Promise.all([Z,oe(A)]),ft=await D.arrayBuffer(),bt=D.status===200&&ft.byteLength>0?Fe(ft):null;return{requestId:st,response:{ok:D.ok,status:D.status,statusText:D.statusText,body:bt,headers:yr(D.headers)}}}async _requestAndRetry(e,r=0){let i=await e();if(i.ok)return i;let a=await i.clone().text(),l=`Server returned an error:
1
+ import{a as Vn,b as Eo,c as fr,d as Yn,e as me,f as To,g as ot,h as So,i as oe,j as qn,k as Fe,l as Oo,m as Hn,n as Gt,o as $n,p as ae,q as Wn,r as cr,s as ke,t as zn}from"./chunk-TDCTL77T.js";var ti=fr(pr=>{"use strict";pr.byteLength=No;pr.toByteArray=Co;pr.fromByteArray=jo;var Yt=[],Ft=[],Po=typeof Uint8Array<"u"?Uint8Array:Array,Zr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(se=0,Dn=Zr.length;se<Dn;++se)Yt[se]=Zr[se],Ft[Zr.charCodeAt(se)]=se;var se,Dn;Ft["-".charCodeAt(0)]=62;Ft["_".charCodeAt(0)]=63;function Ln(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function No(t){var e=Ln(t),r=e[0],i=e[1];return(r+i)*3/4-i}function Bo(t,e,r){return(e+r)*3/4-r}function Co(t){var e,r=Ln(t),i=r[0],a=r[1],l=new Po(Bo(t,i,a)),d=0,m=a>0?i-4:i,w;for(w=0;w<m;w+=4)e=Ft[t.charCodeAt(w)]<<18|Ft[t.charCodeAt(w+1)]<<12|Ft[t.charCodeAt(w+2)]<<6|Ft[t.charCodeAt(w+3)],l[d++]=e>>16&255,l[d++]=e>>8&255,l[d++]=e&255;return a===2&&(e=Ft[t.charCodeAt(w)]<<2|Ft[t.charCodeAt(w+1)]>>4,l[d++]=e&255),a===1&&(e=Ft[t.charCodeAt(w)]<<10|Ft[t.charCodeAt(w+1)]<<4|Ft[t.charCodeAt(w+2)]>>2,l[d++]=e>>8&255,l[d++]=e&255),l}function Fo(t){return Yt[t>>18&63]+Yt[t>>12&63]+Yt[t>>6&63]+Yt[t&63]}function ko(t,e,r){for(var i,a=[],l=e;l<r;l+=3)i=(t[l]<<16&16711680)+(t[l+1]<<8&65280)+(t[l+2]&255),a.push(Fo(i));return a.join("")}function jo(t){for(var e,r=t.length,i=r%3,a=[],l=16383,d=0,m=r-i;d<m;d+=l)a.push(ko(t,d,d+l>m?m:d+l));return i===1?(e=t[r-1],a.push(Yt[e>>2]+Yt[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],a.push(Yt[e>>10]+Yt[e>>4&63]+Yt[e<<2&63]+"=")),a.join("")}});var pi=fr(_e=>{"use strict";var Qr=ti(),ge=So(),ei=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;_e.Buffer=g;_e.SlowBuffer=Ho;_e.INSPECT_MAX_BYTES=50;var hr=2147483647;_e.kMaxLength=hr;g.TYPED_ARRAY_SUPPORT=Ko();!g.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function Ko(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}});Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function Xt(t){if(t>hr)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,g.prototype),e}function g(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return tn(t)}return ii(t,e,r)}g.poolSize=8192;function ii(t,e,r){if(typeof t=="string")return Vo(t,e);if(ArrayBuffer.isView(t))return Yo(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(qt(t,ArrayBuffer)||t&&qt(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(qt(t,SharedArrayBuffer)||t&&qt(t.buffer,SharedArrayBuffer)))return Dr(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return g.from(i,e,r);var a=qo(t);if(a)return a;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return g.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}g.from=function(t,e,r){return ii(t,e,r)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function oi(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Mo(t,e,r){return oi(t),t<=0?Xt(t):e!==void 0?typeof r=="string"?Xt(t).fill(e,r):Xt(t).fill(e):Xt(t)}g.alloc=function(t,e,r){return Mo(t,e,r)};function tn(t){return oi(t),Xt(t<0?0:en(t)|0)}g.allocUnsafe=function(t){return tn(t)};g.allocUnsafeSlow=function(t){return tn(t)};function Vo(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!g.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=ai(t,e)|0,i=Xt(r),a=i.write(t,e);return a!==r&&(i=i.slice(0,a)),i}function Ir(t){for(var e=t.length<0?0:en(t.length)|0,r=Xt(e),i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Yo(t){if(qt(t,Uint8Array)){var e=new Uint8Array(t);return Dr(e.buffer,e.byteOffset,e.byteLength)}return Ir(t)}function Dr(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return e===void 0&&r===void 0?i=new Uint8Array(t):r===void 0?i=new Uint8Array(t,e):i=new Uint8Array(t,e,r),Object.setPrototypeOf(i,g.prototype),i}function qo(t){if(g.isBuffer(t)){var e=en(t.length)|0,r=Xt(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||rn(t.length)?Xt(0):Ir(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ir(t.data)}function en(t){if(t>=hr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hr.toString(16)+" bytes");return t|0}function Ho(t){return+t!=t&&(t=0),g.alloc(+t)}g.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==g.prototype};g.compare=function(e,r){if(qt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),qt(r,Uint8Array)&&(r=g.from(r,r.offset,r.byteLength)),!g.isBuffer(e)||!g.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var i=e.length,a=r.length,l=0,d=Math.min(i,a);l<d;++l)if(e[l]!==r[l]){i=e[l],a=r[l];break}return i<a?-1:a<i?1:0};g.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};g.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return g.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var a=g.allocUnsafe(r),l=0;for(i=0;i<e.length;++i){var d=e[i];if(qt(d,Uint8Array))l+d.length>a.length?g.from(d).copy(a,l):Uint8Array.prototype.set.call(a,d,l);else if(g.isBuffer(d))d.copy(a,l);else throw new TypeError('"list" argument must be an Array of Buffers');l+=d.length}return a};function ai(t,e){if(g.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||qt(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var a=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Lr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return di(t).length;default:if(a)return i?-1:Lr(t).length;e=(""+e).toLowerCase(),a=!0}}g.byteLength=ai;function $o(t,e,r){var i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Lo(this,e,r);case"utf8":case"utf-8":return fi(this,e,r);case"ascii":return Io(this,e,r);case"latin1":case"binary":return Do(this,e,r);case"base64":return Zo(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ta(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}g.prototype._isBuffer=!0;function fe(t,e,r){var i=t[e];t[e]=t[r],t[r]=i}g.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)fe(this,r,r+1);return this};g.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)fe(this,r,r+3),fe(this,r+1,r+2);return this};g.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)fe(this,r,r+7),fe(this,r+1,r+6),fe(this,r+2,r+5),fe(this,r+3,r+4);return this};g.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?fi(this,0,e):$o.apply(this,arguments)};g.prototype.toLocaleString=g.prototype.toString;g.prototype.equals=function(e){if(!g.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:g.compare(this,e)===0};g.prototype.inspect=function(){var e="",r=_e.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};ei&&(g.prototype[ei]=g.prototype.inspect);g.prototype.compare=function(e,r,i,a,l){if(qt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),!g.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),a===void 0&&(a=0),l===void 0&&(l=this.length),r<0||i>e.length||a<0||l>this.length)throw new RangeError("out of range index");if(a>=l&&r>=i)return 0;if(a>=l)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,a>>>=0,l>>>=0,this===e)return 0;for(var d=l-a,m=i-r,w=Math.min(d,m),E=this.slice(a,l),N=e.slice(r,i),O=0;O<w;++O)if(E[O]!==N[O]){d=E[O],m=N[O];break}return d<m?-1:m<d?1:0};function si(t,e,r,i,a){if(t.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,rn(r)&&(r=a?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(a)return-1;r=t.length-1}else if(r<0)if(a)r=0;else return-1;if(typeof e=="string"&&(e=g.from(e,i)),g.isBuffer(e))return e.length===0?-1:ri(t,e,r,i,a);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ri(t,[e],r,i,a);throw new TypeError("val must be string, number or Buffer")}function ri(t,e,r,i,a){var l=1,d=t.length,m=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;l=2,d/=2,m/=2,r/=2}function w(D,st){return l===1?D[st]:D.readUInt16BE(st*l)}var E;if(a){var N=-1;for(E=r;E<d;E++)if(w(t,E)===w(e,N===-1?0:E-N)){if(N===-1&&(N=E),E-N+1===m)return N*l}else N!==-1&&(E-=E-N),N=-1}else for(r+m>d&&(r=d-m),E=r;E>=0;E--){for(var O=!0,X=0;X<m;X++)if(w(t,E+X)!==w(e,X)){O=!1;break}if(O)return E}return-1}g.prototype.includes=function(e,r,i){return this.indexOf(e,r,i)!==-1};g.prototype.indexOf=function(e,r,i){return si(this,e,r,i,!0)};g.prototype.lastIndexOf=function(e,r,i){return si(this,e,r,i,!1)};function Wo(t,e,r,i){r=Number(r)||0;var a=t.length-r;i?(i=Number(i),i>a&&(i=a)):i=a;var l=e.length;i>l/2&&(i=l/2);for(var d=0;d<i;++d){var m=parseInt(e.substr(d*2,2),16);if(rn(m))return d;t[r+d]=m}return d}function zo(t,e,r,i){return xr(Lr(e,t.length-r),t,r,i)}function Go(t,e,r,i){return xr(na(e),t,r,i)}function Jo(t,e,r,i){return xr(di(e),t,r,i)}function Xo(t,e,r,i){return xr(ia(e,t.length-r),t,r,i)}g.prototype.write=function(e,r,i,a){if(r===void 0)a="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")a=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,a===void 0&&(a="utf8")):(a=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var l=this.length-r;if((i===void 0||i>l)&&(i=l),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var d=!1;;)switch(a){case"hex":return Wo(this,e,r,i);case"utf8":case"utf-8":return zo(this,e,r,i);case"ascii":case"latin1":case"binary":return Go(this,e,r,i);case"base64":return Jo(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xo(this,e,r,i);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),d=!0}};g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Zo(t,e,r){return e===0&&r===t.length?Qr.fromByteArray(t):Qr.fromByteArray(t.slice(e,r))}function fi(t,e,r){r=Math.min(t.length,r);for(var i=[],a=e;a<r;){var l=t[a],d=null,m=l>239?4:l>223?3:l>191?2:1;if(a+m<=r){var w,E,N,O;switch(m){case 1:l<128&&(d=l);break;case 2:w=t[a+1],(w&192)===128&&(O=(l&31)<<6|w&63,O>127&&(d=O));break;case 3:w=t[a+1],E=t[a+2],(w&192)===128&&(E&192)===128&&(O=(l&15)<<12|(w&63)<<6|E&63,O>2047&&(O<55296||O>57343)&&(d=O));break;case 4:w=t[a+1],E=t[a+2],N=t[a+3],(w&192)===128&&(E&192)===128&&(N&192)===128&&(O=(l&15)<<18|(w&63)<<12|(E&63)<<6|N&63,O>65535&&O<1114112&&(d=O))}}d===null?(d=65533,m=1):d>65535&&(d-=65536,i.push(d>>>10&1023|55296),d=56320|d&1023),i.push(d),a+=m}return Qo(i)}var ni=4096;function Qo(t){var e=t.length;if(e<=ni)return String.fromCharCode.apply(String,t);for(var r="",i=0;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=ni));return r}function Io(t,e,r){var i="";r=Math.min(t.length,r);for(var a=e;a<r;++a)i+=String.fromCharCode(t[a]&127);return i}function Do(t,e,r){var i="";r=Math.min(t.length,r);for(var a=e;a<r;++a)i+=String.fromCharCode(t[a]);return i}function Lo(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var a="",l=e;l<r;++l)a+=oa[t[l]];return a}function ta(t,e,r){for(var i=t.slice(e,r),a="",l=0;l<i.length-1;l+=2)a+=String.fromCharCode(i[l]+i[l+1]*256);return a}g.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var a=this.subarray(e,r);return Object.setPrototypeOf(a,g.prototype),a};function xt(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUintLE=g.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||xt(e,r,this.length);for(var a=this[e],l=1,d=0;++d<r&&(l*=256);)a+=this[e+d]*l;return a};g.prototype.readUintBE=g.prototype.readUIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||xt(e,r,this.length);for(var a=this[e+--r],l=1;r>0&&(l*=256);)a+=this[e+--r]*l;return a};g.prototype.readUint8=g.prototype.readUInt8=function(e,r){return e=e>>>0,r||xt(e,1,this.length),this[e]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||xt(e,2,this.length),this[e]|this[e+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||xt(e,2,this.length),this[e]<<8|this[e+1]};g.prototype.readUint32LE=g.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};g.prototype.readUint32BE=g.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};g.prototype.readIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||xt(e,r,this.length);for(var a=this[e],l=1,d=0;++d<r&&(l*=256);)a+=this[e+d]*l;return l*=128,a>=l&&(a-=Math.pow(2,8*r)),a};g.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||xt(e,r,this.length);for(var a=r,l=1,d=this[e+--a];a>0&&(l*=256);)d+=this[e+--a]*l;return l*=128,d>=l&&(d-=Math.pow(2,8*r)),d};g.prototype.readInt8=function(e,r){return e=e>>>0,r||xt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};g.prototype.readInt16LE=function(e,r){e=e>>>0,r||xt(e,2,this.length);var i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};g.prototype.readInt16BE=function(e,r){e=e>>>0,r||xt(e,2,this.length);var i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};g.prototype.readInt32LE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};g.prototype.readInt32BE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};g.prototype.readFloatLE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),ge.read(this,e,!0,23,4)};g.prototype.readFloatBE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),ge.read(this,e,!1,23,4)};g.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||xt(e,8,this.length),ge.read(this,e,!0,52,8)};g.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||xt(e,8,this.length),ge.read(this,e,!1,52,8)};function Ot(t,e,r,i,a,l){if(!g.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<l)throw new RangeError('"value" argument is out of bounds');if(r+i>t.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(e,r,i,a){if(e=+e,r=r>>>0,i=i>>>0,!a){var l=Math.pow(2,8*i)-1;Ot(this,e,r,i,l,0)}var d=1,m=0;for(this[r]=e&255;++m<i&&(d*=256);)this[r+m]=e/d&255;return r+i};g.prototype.writeUintBE=g.prototype.writeUIntBE=function(e,r,i,a){if(e=+e,r=r>>>0,i=i>>>0,!a){var l=Math.pow(2,8*i)-1;Ot(this,e,r,i,l,0)}var d=i-1,m=1;for(this[r+d]=e&255;--d>=0&&(m*=256);)this[r+d]=e/m&255;return r+i};g.prototype.writeUint8=g.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,1,255,0),this[r]=e&255,r+1};g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};g.prototype.writeIntLE=function(e,r,i,a){if(e=+e,r=r>>>0,!a){var l=Math.pow(2,8*i-1);Ot(this,e,r,i,l-1,-l)}var d=0,m=1,w=0;for(this[r]=e&255;++d<i&&(m*=256);)e<0&&w===0&&this[r+d-1]!==0&&(w=1),this[r+d]=(e/m>>0)-w&255;return r+i};g.prototype.writeIntBE=function(e,r,i,a){if(e=+e,r=r>>>0,!a){var l=Math.pow(2,8*i-1);Ot(this,e,r,i,l-1,-l)}var d=i-1,m=1,w=0;for(this[r+d]=e&255;--d>=0&&(m*=256);)e<0&&w===0&&this[r+d+1]!==0&&(w=1),this[r+d]=(e/m>>0)-w&255;return r+i};g.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};g.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};g.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};g.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};g.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Ot(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function ci(t,e,r,i,a,l){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function li(t,e,r,i,a){return e=+e,r=r>>>0,a||ci(t,e,r,4,34028234663852886e22,-34028234663852886e22),ge.write(t,e,r,i,23,4),r+4}g.prototype.writeFloatLE=function(e,r,i){return li(this,e,r,!0,i)};g.prototype.writeFloatBE=function(e,r,i){return li(this,e,r,!1,i)};function ui(t,e,r,i,a){return e=+e,r=r>>>0,a||ci(t,e,r,8,17976931348623157e292,-17976931348623157e292),ge.write(t,e,r,i,52,8),r+8}g.prototype.writeDoubleLE=function(e,r,i){return ui(this,e,r,!0,i)};g.prototype.writeDoubleBE=function(e,r,i){return ui(this,e,r,!1,i)};g.prototype.copy=function(e,r,i,a){if(!g.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!a&&a!==0&&(a=this.length),r>=e.length&&(r=e.length),r||(r=0),a>0&&a<i&&(a=i),a===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-r<a-i&&(a=e.length-r+i);var l=a-i;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,a):Uint8Array.prototype.set.call(e,this.subarray(i,a),r),l};g.prototype.fill=function(e,r,i,a){if(typeof e=="string"){if(typeof r=="string"?(a=r,r=0,i=this.length):typeof i=="string"&&(a=i,i=this.length),a!==void 0&&typeof a!="string")throw new TypeError("encoding must be a string");if(typeof a=="string"&&!g.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(e.length===1){var l=e.charCodeAt(0);(a==="utf8"&&l<128||a==="latin1")&&(e=l)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var d;if(typeof e=="number")for(d=r;d<i;++d)this[d]=e;else{var m=g.isBuffer(e)?e:g.from(e,a),w=m.length;if(w===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(d=0;d<i-r;++d)this[d+r]=m[d%w]}return this};var ea=/[^+/0-9A-Za-z-_]/g;function ra(t){if(t=t.split("=")[0],t=t.trim().replace(ea,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Lr(t,e){e=e||1/0;for(var r,i=t.length,a=null,l=[],d=0;d<i;++d){if(r=t.charCodeAt(d),r>55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&l.push(239,191,189);continue}else if(d+1===i){(e-=3)>-1&&l.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&l.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(e-=3)>-1&&l.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;l.push(r)}else if(r<2048){if((e-=2)<0)break;l.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;l.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;l.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return l}function na(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function ia(t,e){for(var r,i,a,l=[],d=0;d<t.length&&!((e-=2)<0);++d)r=t.charCodeAt(d),i=r>>8,a=r%256,l.push(a),l.push(i);return l}function di(t){return Qr.toByteArray(ra(t))}function xr(t,e,r,i){for(var a=0;a<i&&!(a+r>=e.length||a>=t.length);++a)e[a+r]=t[a];return a}function qt(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function rn(t){return t!==t}var oa=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var i=r*16,a=0;a<16;++a)e[i+a]=t[r]+t[a];return e}()});var Oi={};Yn(Oi,{default:()=>Ta});var Ta,Ri=Eo(()=>{Ta={}});var Ui=fr((Cf,Er)=>{var ue=(Ri(),To(Oi));if(ue&&ue.default){Er.exports=ue.default;for(let t in ue)Er.exports[t]=ue[t]}else ue&&(Er.exports=ue)});var ln=fr((Ff,Tr)=>{(function(t){"use strict";var e=function(o){var f,s=new Float64Array(16);if(o)for(f=0;f<o.length;f++)s[f]=o[f];return s},r=function(){throw new Error("no PRNG")},i=new Uint8Array(16),a=new Uint8Array(32);a[0]=9;var l=e(),d=e([1]),m=e([56129,1]),w=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),N=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),O=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),X=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function D(o,f,s,n){o[f]=s>>24&255,o[f+1]=s>>16&255,o[f+2]=s>>8&255,o[f+3]=s&255,o[f+4]=n>>24&255,o[f+5]=n>>16&255,o[f+6]=n>>8&255,o[f+7]=n&255}function st(o,f,s,n,c){var p,h=0;for(p=0;p<c;p++)h|=o[f+p]^s[n+p];return(1&h-1>>>8)-1}function ft(o,f,s,n){return st(o,f,s,n,16)}function At(o,f,s,n){return st(o,f,s,n,32)}function pt(o,f,s,n){for(var c=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,h=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,b=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,S=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,j=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,U=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,rt=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,B=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,V=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,Y=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,z=s[16]&255|(s[17]&255)<<8|(s[18]&255)<<16|(s[19]&255)<<24,W=s[20]&255|(s[21]&255)<<8|(s[22]&255)<<16|(s[23]&255)<<24,q=s[24]&255|(s[25]&255)<<8|(s[26]&255)<<16|(s[27]&255)<<24,$=s[28]&255|(s[29]&255)<<8|(s[30]&255)<<16|(s[31]&255)<<24,H=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,C=c,K=p,P=h,F=b,k=S,R=j,x=U,y=rt,A=B,_=V,v=Y,T=z,M=W,G=q,Z=$,J=H,u,I=0;I<20;I+=2)u=C+M|0,k^=u<<7|u>>>32-7,u=k+C|0,A^=u<<9|u>>>32-9,u=A+k|0,M^=u<<13|u>>>32-13,u=M+A|0,C^=u<<18|u>>>32-18,u=R+K|0,_^=u<<7|u>>>32-7,u=_+R|0,G^=u<<9|u>>>32-9,u=G+_|0,K^=u<<13|u>>>32-13,u=K+G|0,R^=u<<18|u>>>32-18,u=v+x|0,Z^=u<<7|u>>>32-7,u=Z+v|0,P^=u<<9|u>>>32-9,u=P+Z|0,x^=u<<13|u>>>32-13,u=x+P|0,v^=u<<18|u>>>32-18,u=J+T|0,F^=u<<7|u>>>32-7,u=F+J|0,y^=u<<9|u>>>32-9,u=y+F|0,T^=u<<13|u>>>32-13,u=T+y|0,J^=u<<18|u>>>32-18,u=C+F|0,K^=u<<7|u>>>32-7,u=K+C|0,P^=u<<9|u>>>32-9,u=P+K|0,F^=u<<13|u>>>32-13,u=F+P|0,C^=u<<18|u>>>32-18,u=R+k|0,x^=u<<7|u>>>32-7,u=x+R|0,y^=u<<9|u>>>32-9,u=y+x|0,k^=u<<13|u>>>32-13,u=k+y|0,R^=u<<18|u>>>32-18,u=v+_|0,T^=u<<7|u>>>32-7,u=T+v|0,A^=u<<9|u>>>32-9,u=A+T|0,_^=u<<13|u>>>32-13,u=_+A|0,v^=u<<18|u>>>32-18,u=J+Z|0,M^=u<<7|u>>>32-7,u=M+J|0,G^=u<<9|u>>>32-9,u=G+M|0,Z^=u<<13|u>>>32-13,u=Z+G|0,J^=u<<18|u>>>32-18;C=C+c|0,K=K+p|0,P=P+h|0,F=F+b|0,k=k+S|0,R=R+j|0,x=x+U|0,y=y+rt|0,A=A+B|0,_=_+V|0,v=v+Y|0,T=T+z|0,M=M+W|0,G=G+q|0,Z=Z+$|0,J=J+H|0,o[0]=C>>>0&255,o[1]=C>>>8&255,o[2]=C>>>16&255,o[3]=C>>>24&255,o[4]=K>>>0&255,o[5]=K>>>8&255,o[6]=K>>>16&255,o[7]=K>>>24&255,o[8]=P>>>0&255,o[9]=P>>>8&255,o[10]=P>>>16&255,o[11]=P>>>24&255,o[12]=F>>>0&255,o[13]=F>>>8&255,o[14]=F>>>16&255,o[15]=F>>>24&255,o[16]=k>>>0&255,o[17]=k>>>8&255,o[18]=k>>>16&255,o[19]=k>>>24&255,o[20]=R>>>0&255,o[21]=R>>>8&255,o[22]=R>>>16&255,o[23]=R>>>24&255,o[24]=x>>>0&255,o[25]=x>>>8&255,o[26]=x>>>16&255,o[27]=x>>>24&255,o[28]=y>>>0&255,o[29]=y>>>8&255,o[30]=y>>>16&255,o[31]=y>>>24&255,o[32]=A>>>0&255,o[33]=A>>>8&255,o[34]=A>>>16&255,o[35]=A>>>24&255,o[36]=_>>>0&255,o[37]=_>>>8&255,o[38]=_>>>16&255,o[39]=_>>>24&255,o[40]=v>>>0&255,o[41]=v>>>8&255,o[42]=v>>>16&255,o[43]=v>>>24&255,o[44]=T>>>0&255,o[45]=T>>>8&255,o[46]=T>>>16&255,o[47]=T>>>24&255,o[48]=M>>>0&255,o[49]=M>>>8&255,o[50]=M>>>16&255,o[51]=M>>>24&255,o[52]=G>>>0&255,o[53]=G>>>8&255,o[54]=G>>>16&255,o[55]=G>>>24&255,o[56]=Z>>>0&255,o[57]=Z>>>8&255,o[58]=Z>>>16&255,o[59]=Z>>>24&255,o[60]=J>>>0&255,o[61]=J>>>8&255,o[62]=J>>>16&255,o[63]=J>>>24&255}function Et(o,f,s,n){for(var c=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,p=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,h=s[4]&255|(s[5]&255)<<8|(s[6]&255)<<16|(s[7]&255)<<24,b=s[8]&255|(s[9]&255)<<8|(s[10]&255)<<16|(s[11]&255)<<24,S=s[12]&255|(s[13]&255)<<8|(s[14]&255)<<16|(s[15]&255)<<24,j=n[4]&255|(n[5]&255)<<8|(n[6]&255)<<16|(n[7]&255)<<24,U=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,rt=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,B=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,V=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,Y=n[8]&255|(n[9]&255)<<8|(n[10]&255)<<16|(n[11]&255)<<24,z=s[16]&255|(s[17]&255)<<8|(s[18]&255)<<16|(s[19]&255)<<24,W=s[20]&255|(s[21]&255)<<8|(s[22]&255)<<16|(s[23]&255)<<24,q=s[24]&255|(s[25]&255)<<8|(s[26]&255)<<16|(s[27]&255)<<24,$=s[28]&255|(s[29]&255)<<8|(s[30]&255)<<16|(s[31]&255)<<24,H=n[12]&255|(n[13]&255)<<8|(n[14]&255)<<16|(n[15]&255)<<24,C=c,K=p,P=h,F=b,k=S,R=j,x=U,y=rt,A=B,_=V,v=Y,T=z,M=W,G=q,Z=$,J=H,u,I=0;I<20;I+=2)u=C+M|0,k^=u<<7|u>>>32-7,u=k+C|0,A^=u<<9|u>>>32-9,u=A+k|0,M^=u<<13|u>>>32-13,u=M+A|0,C^=u<<18|u>>>32-18,u=R+K|0,_^=u<<7|u>>>32-7,u=_+R|0,G^=u<<9|u>>>32-9,u=G+_|0,K^=u<<13|u>>>32-13,u=K+G|0,R^=u<<18|u>>>32-18,u=v+x|0,Z^=u<<7|u>>>32-7,u=Z+v|0,P^=u<<9|u>>>32-9,u=P+Z|0,x^=u<<13|u>>>32-13,u=x+P|0,v^=u<<18|u>>>32-18,u=J+T|0,F^=u<<7|u>>>32-7,u=F+J|0,y^=u<<9|u>>>32-9,u=y+F|0,T^=u<<13|u>>>32-13,u=T+y|0,J^=u<<18|u>>>32-18,u=C+F|0,K^=u<<7|u>>>32-7,u=K+C|0,P^=u<<9|u>>>32-9,u=P+K|0,F^=u<<13|u>>>32-13,u=F+P|0,C^=u<<18|u>>>32-18,u=R+k|0,x^=u<<7|u>>>32-7,u=x+R|0,y^=u<<9|u>>>32-9,u=y+x|0,k^=u<<13|u>>>32-13,u=k+y|0,R^=u<<18|u>>>32-18,u=v+_|0,T^=u<<7|u>>>32-7,u=T+v|0,A^=u<<9|u>>>32-9,u=A+T|0,_^=u<<13|u>>>32-13,u=_+A|0,v^=u<<18|u>>>32-18,u=J+Z|0,M^=u<<7|u>>>32-7,u=M+J|0,G^=u<<9|u>>>32-9,u=G+M|0,Z^=u<<13|u>>>32-13,u=Z+G|0,J^=u<<18|u>>>32-18;o[0]=C>>>0&255,o[1]=C>>>8&255,o[2]=C>>>16&255,o[3]=C>>>24&255,o[4]=R>>>0&255,o[5]=R>>>8&255,o[6]=R>>>16&255,o[7]=R>>>24&255,o[8]=v>>>0&255,o[9]=v>>>8&255,o[10]=v>>>16&255,o[11]=v>>>24&255,o[12]=J>>>0&255,o[13]=J>>>8&255,o[14]=J>>>16&255,o[15]=J>>>24&255,o[16]=x>>>0&255,o[17]=x>>>8&255,o[18]=x>>>16&255,o[19]=x>>>24&255,o[20]=y>>>0&255,o[21]=y>>>8&255,o[22]=y>>>16&255,o[23]=y>>>24&255,o[24]=A>>>0&255,o[25]=A>>>8&255,o[26]=A>>>16&255,o[27]=A>>>24&255,o[28]=_>>>0&255,o[29]=_>>>8&255,o[30]=_>>>16&255,o[31]=_>>>24&255}function Vt(o,f,s,n){pt(o,f,s,n)}function Nt(o,f,s,n){Et(o,f,s,n)}var Bt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Ze(o,f,s,n,c,p,h){var b=new Uint8Array(16),S=new Uint8Array(64),j,U;for(U=0;U<16;U++)b[U]=0;for(U=0;U<8;U++)b[U]=p[U];for(;c>=64;){for(Vt(S,b,h,Bt),U=0;U<64;U++)o[f+U]=s[n+U]^S[U];for(j=1,U=8;U<16;U++)j=j+(b[U]&255)|0,b[U]=j&255,j>>>=8;c-=64,f+=64,n+=64}if(c>0)for(Vt(S,b,h,Bt),U=0;U<c;U++)o[f+U]=s[n+U]^S[U];return 0}function Qe(o,f,s,n,c){var p=new Uint8Array(16),h=new Uint8Array(64),b,S;for(S=0;S<16;S++)p[S]=0;for(S=0;S<8;S++)p[S]=n[S];for(;s>=64;){for(Vt(h,p,c,Bt),S=0;S<64;S++)o[f+S]=h[S];for(b=1,S=8;S<16;S++)b=b+(p[S]&255)|0,p[S]=b&255,b>>>=8;s-=64,f+=64}if(s>0)for(Vt(h,p,c,Bt),S=0;S<s;S++)o[f+S]=h[S];return 0}function Ie(o,f,s,n,c){var p=new Uint8Array(32);Nt(p,n,c,Bt);for(var h=new Uint8Array(8),b=0;b<8;b++)h[b]=n[b+16];return Qe(o,f,s,h,p)}function pe(o,f,s,n,c,p,h){var b=new Uint8Array(32);Nt(b,p,h,Bt);for(var S=new Uint8Array(8),j=0;j<8;j++)S[j]=p[j+16];return Ze(o,f,s,n,c,S,b)}var he=function(o){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var f,s,n,c,p,h,b,S;f=o[0]&255|(o[1]&255)<<8,this.r[0]=f&8191,s=o[2]&255|(o[3]&255)<<8,this.r[1]=(f>>>13|s<<3)&8191,n=o[4]&255|(o[5]&255)<<8,this.r[2]=(s>>>10|n<<6)&7939,c=o[6]&255|(o[7]&255)<<8,this.r[3]=(n>>>7|c<<9)&8191,p=o[8]&255|(o[9]&255)<<8,this.r[4]=(c>>>4|p<<12)&255,this.r[5]=p>>>1&8190,h=o[10]&255|(o[11]&255)<<8,this.r[6]=(p>>>14|h<<2)&8191,b=o[12]&255|(o[13]&255)<<8,this.r[7]=(h>>>11|b<<5)&8065,S=o[14]&255|(o[15]&255)<<8,this.r[8]=(b>>>8|S<<8)&8191,this.r[9]=S>>>5&127,this.pad[0]=o[16]&255|(o[17]&255)<<8,this.pad[1]=o[18]&255|(o[19]&255)<<8,this.pad[2]=o[20]&255|(o[21]&255)<<8,this.pad[3]=o[22]&255|(o[23]&255)<<8,this.pad[4]=o[24]&255|(o[25]&255)<<8,this.pad[5]=o[26]&255|(o[27]&255)<<8,this.pad[6]=o[28]&255|(o[29]&255)<<8,this.pad[7]=o[30]&255|(o[31]&255)<<8};he.prototype.blocks=function(o,f,s){for(var n=this.fin?0:2048,c,p,h,b,S,j,U,rt,B,V,Y,z,W,q,$,H,C,K,P,F=this.h[0],k=this.h[1],R=this.h[2],x=this.h[3],y=this.h[4],A=this.h[5],_=this.h[6],v=this.h[7],T=this.h[8],M=this.h[9],G=this.r[0],Z=this.r[1],J=this.r[2],u=this.r[3],I=this.r[4],nt=this.r[5],it=this.r[6],Q=this.r[7],tt=this.r[8],et=this.r[9];s>=16;)c=o[f+0]&255|(o[f+1]&255)<<8,F+=c&8191,p=o[f+2]&255|(o[f+3]&255)<<8,k+=(c>>>13|p<<3)&8191,h=o[f+4]&255|(o[f+5]&255)<<8,R+=(p>>>10|h<<6)&8191,b=o[f+6]&255|(o[f+7]&255)<<8,x+=(h>>>7|b<<9)&8191,S=o[f+8]&255|(o[f+9]&255)<<8,y+=(b>>>4|S<<12)&8191,A+=S>>>1&8191,j=o[f+10]&255|(o[f+11]&255)<<8,_+=(S>>>14|j<<2)&8191,U=o[f+12]&255|(o[f+13]&255)<<8,v+=(j>>>11|U<<5)&8191,rt=o[f+14]&255|(o[f+15]&255)<<8,T+=(U>>>8|rt<<8)&8191,M+=rt>>>5|n,B=0,V=B,V+=F*G,V+=k*(5*et),V+=R*(5*tt),V+=x*(5*Q),V+=y*(5*it),B=V>>>13,V&=8191,V+=A*(5*nt),V+=_*(5*I),V+=v*(5*u),V+=T*(5*J),V+=M*(5*Z),B+=V>>>13,V&=8191,Y=B,Y+=F*Z,Y+=k*G,Y+=R*(5*et),Y+=x*(5*tt),Y+=y*(5*Q),B=Y>>>13,Y&=8191,Y+=A*(5*it),Y+=_*(5*nt),Y+=v*(5*I),Y+=T*(5*u),Y+=M*(5*J),B+=Y>>>13,Y&=8191,z=B,z+=F*J,z+=k*Z,z+=R*G,z+=x*(5*et),z+=y*(5*tt),B=z>>>13,z&=8191,z+=A*(5*Q),z+=_*(5*it),z+=v*(5*nt),z+=T*(5*I),z+=M*(5*u),B+=z>>>13,z&=8191,W=B,W+=F*u,W+=k*J,W+=R*Z,W+=x*G,W+=y*(5*et),B=W>>>13,W&=8191,W+=A*(5*tt),W+=_*(5*Q),W+=v*(5*it),W+=T*(5*nt),W+=M*(5*I),B+=W>>>13,W&=8191,q=B,q+=F*I,q+=k*u,q+=R*J,q+=x*Z,q+=y*G,B=q>>>13,q&=8191,q+=A*(5*et),q+=_*(5*tt),q+=v*(5*Q),q+=T*(5*it),q+=M*(5*nt),B+=q>>>13,q&=8191,$=B,$+=F*nt,$+=k*I,$+=R*u,$+=x*J,$+=y*Z,B=$>>>13,$&=8191,$+=A*G,$+=_*(5*et),$+=v*(5*tt),$+=T*(5*Q),$+=M*(5*it),B+=$>>>13,$&=8191,H=B,H+=F*it,H+=k*nt,H+=R*I,H+=x*u,H+=y*J,B=H>>>13,H&=8191,H+=A*Z,H+=_*G,H+=v*(5*et),H+=T*(5*tt),H+=M*(5*Q),B+=H>>>13,H&=8191,C=B,C+=F*Q,C+=k*it,C+=R*nt,C+=x*I,C+=y*u,B=C>>>13,C&=8191,C+=A*J,C+=_*Z,C+=v*G,C+=T*(5*et),C+=M*(5*tt),B+=C>>>13,C&=8191,K=B,K+=F*tt,K+=k*Q,K+=R*it,K+=x*nt,K+=y*I,B=K>>>13,K&=8191,K+=A*u,K+=_*J,K+=v*Z,K+=T*G,K+=M*(5*et),B+=K>>>13,K&=8191,P=B,P+=F*et,P+=k*tt,P+=R*Q,P+=x*it,P+=y*nt,B=P>>>13,P&=8191,P+=A*I,P+=_*u,P+=v*J,P+=T*Z,P+=M*G,B+=P>>>13,P&=8191,B=(B<<2)+B|0,B=B+V|0,V=B&8191,B=B>>>13,Y+=B,F=V,k=Y,R=z,x=W,y=q,A=$,_=H,v=C,T=K,M=P,f+=16,s-=16;this.h[0]=F,this.h[1]=k,this.h[2]=R,this.h[3]=x,this.h[4]=y,this.h[5]=A,this.h[6]=_,this.h[7]=v,this.h[8]=T,this.h[9]=M},he.prototype.finish=function(o,f){var s=new Uint16Array(10),n,c,p,h;if(this.leftover){for(h=this.leftover,this.buffer[h++]=1;h<16;h++)this.buffer[h]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,h=2;h<10;h++)this.h[h]+=n,n=this.h[h]>>>13,this.h[h]&=8191;for(this.h[0]+=n*5,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,s[0]=this.h[0]+5,n=s[0]>>>13,s[0]&=8191,h=1;h<10;h++)s[h]=this.h[h]+n,n=s[h]>>>13,s[h]&=8191;for(s[9]-=8192,c=(n^1)-1,h=0;h<10;h++)s[h]&=c;for(c=~c,h=0;h<10;h++)this.h[h]=this.h[h]&c|s[h];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,p=this.h[0]+this.pad[0],this.h[0]=p&65535,h=1;h<8;h++)p=(this.h[h]+this.pad[h]|0)+(p>>>16)|0,this.h[h]=p&65535;o[f+0]=this.h[0]>>>0&255,o[f+1]=this.h[0]>>>8&255,o[f+2]=this.h[1]>>>0&255,o[f+3]=this.h[1]>>>8&255,o[f+4]=this.h[2]>>>0&255,o[f+5]=this.h[2]>>>8&255,o[f+6]=this.h[3]>>>0&255,o[f+7]=this.h[3]>>>8&255,o[f+8]=this.h[4]>>>0&255,o[f+9]=this.h[4]>>>8&255,o[f+10]=this.h[5]>>>0&255,o[f+11]=this.h[5]>>>8&255,o[f+12]=this.h[6]>>>0&255,o[f+13]=this.h[6]>>>8&255,o[f+14]=this.h[7]>>>0&255,o[f+15]=this.h[7]>>>8&255},he.prototype.update=function(o,f,s){var n,c;if(this.leftover){for(c=16-this.leftover,c>s&&(c=s),n=0;n<c;n++)this.buffer[this.leftover+n]=o[f+n];if(s-=c,f+=c,this.leftover+=c,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(s>=16&&(c=s-s%16,this.blocks(o,f,c),f+=c,s-=c),s){for(n=0;n<s;n++)this.buffer[this.leftover+n]=o[f+n];this.leftover+=s}};function Te(o,f,s,n,c,p){var h=new he(p);return h.update(s,n,c),h.finish(o,f),0}function De(o,f,s,n,c,p){var h=new Uint8Array(16);return Te(h,0,s,n,c,p),ft(o,f,h,0)}function Se(o,f,s,n,c){var p;if(s<32)return-1;for(pe(o,0,f,0,s,n,c),Te(o,16,o,32,s-32,o),p=0;p<16;p++)o[p]=0;return 0}function Oe(o,f,s,n,c){var p,h=new Uint8Array(32);if(s<32||(Ie(h,0,32,n,c),De(f,16,f,32,s-32,h)!==0))return-1;for(pe(o,0,f,0,s,n,c),p=0;p<32;p++)o[p]=0;return 0}function jt(o,f){var s;for(s=0;s<16;s++)o[s]=f[s]|0}function Dt(o){var f,s,n=1;for(f=0;f<16;f++)s=o[f]+n+65535,n=Math.floor(s/65536),o[f]=s-n*65536;o[0]+=n-1+37*(n-1)}function Lt(o,f,s){for(var n,c=~(s-1),p=0;p<16;p++)n=c&(o[p]^f[p]),o[p]^=n,f[p]^=n}function te(o,f){var s,n,c,p=e(),h=e();for(s=0;s<16;s++)h[s]=f[s];for(Dt(h),Dt(h),Dt(h),n=0;n<2;n++){for(p[0]=h[0]-65517,s=1;s<15;s++)p[s]=h[s]-65535-(p[s-1]>>16&1),p[s-1]&=65535;p[15]=h[15]-32767-(p[14]>>16&1),c=p[15]>>16&1,p[14]&=65535,Lt(h,p,1-c)}for(s=0;s<16;s++)o[2*s]=h[s]&255,o[2*s+1]=h[s]>>8}function Le(o,f){var s=new Uint8Array(32),n=new Uint8Array(32);return te(s,o),te(n,f),At(s,0,n,0)}function Re(o){var f=new Uint8Array(32);return te(f,o),f[0]&1}function Ue(o,f){var s;for(s=0;s<16;s++)o[s]=f[2*s]+(f[2*s+1]<<8);o[15]&=32767}function Rt(o,f,s){for(var n=0;n<16;n++)o[n]=f[n]+s[n]}function Ut(o,f,s){for(var n=0;n<16;n++)o[n]=f[n]-s[n]}function L(o,f,s){var n,c,p=0,h=0,b=0,S=0,j=0,U=0,rt=0,B=0,V=0,Y=0,z=0,W=0,q=0,$=0,H=0,C=0,K=0,P=0,F=0,k=0,R=0,x=0,y=0,A=0,_=0,v=0,T=0,M=0,G=0,Z=0,J=0,u=s[0],I=s[1],nt=s[2],it=s[3],Q=s[4],tt=s[5],et=s[6],dt=s[7],at=s[8],ct=s[9],lt=s[10],ut=s[11],ht=s[12],wt=s[13],gt=s[14],_t=s[15];n=f[0],p+=n*u,h+=n*I,b+=n*nt,S+=n*it,j+=n*Q,U+=n*tt,rt+=n*et,B+=n*dt,V+=n*at,Y+=n*ct,z+=n*lt,W+=n*ut,q+=n*ht,$+=n*wt,H+=n*gt,C+=n*_t,n=f[1],h+=n*u,b+=n*I,S+=n*nt,j+=n*it,U+=n*Q,rt+=n*tt,B+=n*et,V+=n*dt,Y+=n*at,z+=n*ct,W+=n*lt,q+=n*ut,$+=n*ht,H+=n*wt,C+=n*gt,K+=n*_t,n=f[2],b+=n*u,S+=n*I,j+=n*nt,U+=n*it,rt+=n*Q,B+=n*tt,V+=n*et,Y+=n*dt,z+=n*at,W+=n*ct,q+=n*lt,$+=n*ut,H+=n*ht,C+=n*wt,K+=n*gt,P+=n*_t,n=f[3],S+=n*u,j+=n*I,U+=n*nt,rt+=n*it,B+=n*Q,V+=n*tt,Y+=n*et,z+=n*dt,W+=n*at,q+=n*ct,$+=n*lt,H+=n*ut,C+=n*ht,K+=n*wt,P+=n*gt,F+=n*_t,n=f[4],j+=n*u,U+=n*I,rt+=n*nt,B+=n*it,V+=n*Q,Y+=n*tt,z+=n*et,W+=n*dt,q+=n*at,$+=n*ct,H+=n*lt,C+=n*ut,K+=n*ht,P+=n*wt,F+=n*gt,k+=n*_t,n=f[5],U+=n*u,rt+=n*I,B+=n*nt,V+=n*it,Y+=n*Q,z+=n*tt,W+=n*et,q+=n*dt,$+=n*at,H+=n*ct,C+=n*lt,K+=n*ut,P+=n*ht,F+=n*wt,k+=n*gt,R+=n*_t,n=f[6],rt+=n*u,B+=n*I,V+=n*nt,Y+=n*it,z+=n*Q,W+=n*tt,q+=n*et,$+=n*dt,H+=n*at,C+=n*ct,K+=n*lt,P+=n*ut,F+=n*ht,k+=n*wt,R+=n*gt,x+=n*_t,n=f[7],B+=n*u,V+=n*I,Y+=n*nt,z+=n*it,W+=n*Q,q+=n*tt,$+=n*et,H+=n*dt,C+=n*at,K+=n*ct,P+=n*lt,F+=n*ut,k+=n*ht,R+=n*wt,x+=n*gt,y+=n*_t,n=f[8],V+=n*u,Y+=n*I,z+=n*nt,W+=n*it,q+=n*Q,$+=n*tt,H+=n*et,C+=n*dt,K+=n*at,P+=n*ct,F+=n*lt,k+=n*ut,R+=n*ht,x+=n*wt,y+=n*gt,A+=n*_t,n=f[9],Y+=n*u,z+=n*I,W+=n*nt,q+=n*it,$+=n*Q,H+=n*tt,C+=n*et,K+=n*dt,P+=n*at,F+=n*ct,k+=n*lt,R+=n*ut,x+=n*ht,y+=n*wt,A+=n*gt,_+=n*_t,n=f[10],z+=n*u,W+=n*I,q+=n*nt,$+=n*it,H+=n*Q,C+=n*tt,K+=n*et,P+=n*dt,F+=n*at,k+=n*ct,R+=n*lt,x+=n*ut,y+=n*ht,A+=n*wt,_+=n*gt,v+=n*_t,n=f[11],W+=n*u,q+=n*I,$+=n*nt,H+=n*it,C+=n*Q,K+=n*tt,P+=n*et,F+=n*dt,k+=n*at,R+=n*ct,x+=n*lt,y+=n*ut,A+=n*ht,_+=n*wt,v+=n*gt,T+=n*_t,n=f[12],q+=n*u,$+=n*I,H+=n*nt,C+=n*it,K+=n*Q,P+=n*tt,F+=n*et,k+=n*dt,R+=n*at,x+=n*ct,y+=n*lt,A+=n*ut,_+=n*ht,v+=n*wt,T+=n*gt,M+=n*_t,n=f[13],$+=n*u,H+=n*I,C+=n*nt,K+=n*it,P+=n*Q,F+=n*tt,k+=n*et,R+=n*dt,x+=n*at,y+=n*ct,A+=n*lt,_+=n*ut,v+=n*ht,T+=n*wt,M+=n*gt,G+=n*_t,n=f[14],H+=n*u,C+=n*I,K+=n*nt,P+=n*it,F+=n*Q,k+=n*tt,R+=n*et,x+=n*dt,y+=n*at,A+=n*ct,_+=n*lt,v+=n*ut,T+=n*ht,M+=n*wt,G+=n*gt,Z+=n*_t,n=f[15],C+=n*u,K+=n*I,P+=n*nt,F+=n*it,k+=n*Q,R+=n*tt,x+=n*et,y+=n*dt,A+=n*at,_+=n*ct,v+=n*lt,T+=n*ut,M+=n*ht,G+=n*wt,Z+=n*gt,J+=n*_t,p+=38*K,h+=38*P,b+=38*F,S+=38*k,j+=38*R,U+=38*x,rt+=38*y,B+=38*A,V+=38*_,Y+=38*v,z+=38*T,W+=38*M,q+=38*G,$+=38*Z,H+=38*J,c=1,n=p+c+65535,c=Math.floor(n/65536),p=n-c*65536,n=h+c+65535,c=Math.floor(n/65536),h=n-c*65536,n=b+c+65535,c=Math.floor(n/65536),b=n-c*65536,n=S+c+65535,c=Math.floor(n/65536),S=n-c*65536,n=j+c+65535,c=Math.floor(n/65536),j=n-c*65536,n=U+c+65535,c=Math.floor(n/65536),U=n-c*65536,n=rt+c+65535,c=Math.floor(n/65536),rt=n-c*65536,n=B+c+65535,c=Math.floor(n/65536),B=n-c*65536,n=V+c+65535,c=Math.floor(n/65536),V=n-c*65536,n=Y+c+65535,c=Math.floor(n/65536),Y=n-c*65536,n=z+c+65535,c=Math.floor(n/65536),z=n-c*65536,n=W+c+65535,c=Math.floor(n/65536),W=n-c*65536,n=q+c+65535,c=Math.floor(n/65536),q=n-c*65536,n=$+c+65535,c=Math.floor(n/65536),$=n-c*65536,n=H+c+65535,c=Math.floor(n/65536),H=n-c*65536,n=C+c+65535,c=Math.floor(n/65536),C=n-c*65536,p+=c-1+37*(c-1),c=1,n=p+c+65535,c=Math.floor(n/65536),p=n-c*65536,n=h+c+65535,c=Math.floor(n/65536),h=n-c*65536,n=b+c+65535,c=Math.floor(n/65536),b=n-c*65536,n=S+c+65535,c=Math.floor(n/65536),S=n-c*65536,n=j+c+65535,c=Math.floor(n/65536),j=n-c*65536,n=U+c+65535,c=Math.floor(n/65536),U=n-c*65536,n=rt+c+65535,c=Math.floor(n/65536),rt=n-c*65536,n=B+c+65535,c=Math.floor(n/65536),B=n-c*65536,n=V+c+65535,c=Math.floor(n/65536),V=n-c*65536,n=Y+c+65535,c=Math.floor(n/65536),Y=n-c*65536,n=z+c+65535,c=Math.floor(n/65536),z=n-c*65536,n=W+c+65535,c=Math.floor(n/65536),W=n-c*65536,n=q+c+65535,c=Math.floor(n/65536),q=n-c*65536,n=$+c+65535,c=Math.floor(n/65536),$=n-c*65536,n=H+c+65535,c=Math.floor(n/65536),H=n-c*65536,n=C+c+65535,c=Math.floor(n/65536),C=n-c*65536,p+=c-1+37*(c-1),o[0]=p,o[1]=h,o[2]=b,o[3]=S,o[4]=j,o[5]=U,o[6]=rt,o[7]=B,o[8]=V,o[9]=Y,o[10]=z,o[11]=W,o[12]=q,o[13]=$,o[14]=H,o[15]=C}function Ct(o,f){L(o,f,f)}function Rn(o,f){var s=e(),n;for(n=0;n<16;n++)s[n]=f[n];for(n=253;n>=0;n--)Ct(s,s),n!==2&&n!==4&&L(s,s,f);for(n=0;n<16;n++)o[n]=s[n]}function Un(o,f){var s=e(),n;for(n=0;n<16;n++)s[n]=f[n];for(n=250;n>=0;n--)Ct(s,s),n!==1&&L(s,s,f);for(n=0;n<16;n++)o[n]=s[n]}function tr(o,f,s){var n=new Uint8Array(32),c=new Float64Array(80),p,h,b=e(),S=e(),j=e(),U=e(),rt=e(),B=e();for(h=0;h<31;h++)n[h]=f[h];for(n[31]=f[31]&127|64,n[0]&=248,Ue(c,s),h=0;h<16;h++)S[h]=c[h],U[h]=b[h]=j[h]=0;for(b[0]=U[0]=1,h=254;h>=0;--h)p=n[h>>>3]>>>(h&7)&1,Lt(b,S,p),Lt(j,U,p),Rt(rt,b,j),Ut(b,b,j),Rt(j,S,U),Ut(S,S,U),Ct(U,rt),Ct(B,b),L(b,j,b),L(j,S,rt),Rt(rt,b,j),Ut(b,b,j),Ct(S,b),Ut(j,U,B),L(b,j,m),Rt(b,b,U),L(j,j,b),L(b,U,B),L(U,S,c),Ct(S,rt),Lt(b,S,p),Lt(j,U,p);for(h=0;h<16;h++)c[h+16]=b[h],c[h+32]=j[h],c[h+48]=S[h],c[h+64]=U[h];var V=c.subarray(32),Y=c.subarray(16);return Rn(V,V),L(Y,Y,V),te(o,Y),0}function er(o,f){return tr(o,f,a)}function Pn(o,f){return r(f,32),er(o,f)}function rr(o,f,s){var n=new Uint8Array(32);return tr(n,s,f),Nt(o,i,n,Bt)}var Nn=Se,mo=Oe;function wo(o,f,s,n,c,p){var h=new Uint8Array(32);return rr(h,c,p),Nn(o,f,s,n,h)}function go(o,f,s,n,c,p){var h=new Uint8Array(32);return rr(h,c,p),mo(o,f,s,n,h)}var Bn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Cn(o,f,s,n){for(var c=new Int32Array(16),p=new Int32Array(16),h,b,S,j,U,rt,B,V,Y,z,W,q,$,H,C,K,P,F,k,R,x,y,A,_,v,T,M=o[0],G=o[1],Z=o[2],J=o[3],u=o[4],I=o[5],nt=o[6],it=o[7],Q=f[0],tt=f[1],et=f[2],dt=f[3],at=f[4],ct=f[5],lt=f[6],ut=f[7],ht=0;n>=128;){for(k=0;k<16;k++)R=8*k+ht,c[k]=s[R+0]<<24|s[R+1]<<16|s[R+2]<<8|s[R+3],p[k]=s[R+4]<<24|s[R+5]<<16|s[R+6]<<8|s[R+7];for(k=0;k<80;k++)if(h=M,b=G,S=Z,j=J,U=u,rt=I,B=nt,V=it,Y=Q,z=tt,W=et,q=dt,$=at,H=ct,C=lt,K=ut,x=it,y=ut,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=(u>>>14|at<<32-14)^(u>>>18|at<<32-18)^(at>>>41-32|u<<32-(41-32)),y=(at>>>14|u<<32-14)^(at>>>18|u<<32-18)^(u>>>41-32|at<<32-(41-32)),A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=u&I^~u&nt,y=at&ct^~at&lt,A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=Bn[k*2],y=Bn[k*2+1],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=c[k%16],y=p[k%16],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,P=v&65535|T<<16,F=A&65535|_<<16,x=P,y=F,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=(M>>>28|Q<<32-28)^(Q>>>34-32|M<<32-(34-32))^(Q>>>39-32|M<<32-(39-32)),y=(Q>>>28|M<<32-28)^(M>>>34-32|Q<<32-(34-32))^(M>>>39-32|Q<<32-(39-32)),A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=M&G^M&Z^G&Z,y=Q&tt^Q&et^tt&et,A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,V=v&65535|T<<16,K=A&65535|_<<16,x=j,y=q,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=P,y=F,A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,j=v&65535|T<<16,q=A&65535|_<<16,G=h,Z=b,J=S,u=j,I=U,nt=rt,it=B,M=V,tt=Y,et=z,dt=W,at=q,ct=$,lt=H,ut=C,Q=K,k%16===15)for(R=0;R<16;R++)x=c[R],y=p[R],A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=c[(R+9)%16],y=p[(R+9)%16],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,P=c[(R+1)%16],F=p[(R+1)%16],x=(P>>>1|F<<32-1)^(P>>>8|F<<32-8)^P>>>7,y=(F>>>1|P<<32-1)^(F>>>8|P<<32-8)^(F>>>7|P<<32-7),A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,P=c[(R+14)%16],F=p[(R+14)%16],x=(P>>>19|F<<32-19)^(F>>>61-32|P<<32-(61-32))^P>>>6,y=(F>>>19|P<<32-19)^(P>>>61-32|F<<32-(61-32))^(F>>>6|P<<32-6),A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,c[R]=v&65535|T<<16,p[R]=A&65535|_<<16;x=M,y=Q,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[0],y=f[0],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,o[0]=M=v&65535|T<<16,f[0]=Q=A&65535|_<<16,x=G,y=tt,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[1],y=f[1],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,o[1]=G=v&65535|T<<16,f[1]=tt=A&65535|_<<16,x=Z,y=et,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[2],y=f[2],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,o[2]=Z=v&65535|T<<16,f[2]=et=A&65535|_<<16,x=J,y=dt,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[3],y=f[3],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,o[3]=J=v&65535|T<<16,f[3]=dt=A&65535|_<<16,x=u,y=at,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[4],y=f[4],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,o[4]=u=v&65535|T<<16,f[4]=at=A&65535|_<<16,x=I,y=ct,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[5],y=f[5],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,o[5]=I=v&65535|T<<16,f[5]=ct=A&65535|_<<16,x=nt,y=lt,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[6],y=f[6],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,o[6]=nt=v&65535|T<<16,f[6]=lt=A&65535|_<<16,x=it,y=ut,A=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=o[7],y=f[7],A+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=A>>>16,v+=_>>>16,T+=v>>>16,o[7]=it=v&65535|T<<16,f[7]=ut=A&65535|_<<16,ht+=128,n-=128}return n}function ne(o,f,s){var n=new Int32Array(8),c=new Int32Array(8),p=new Uint8Array(256),h,b=s;for(n[0]=1779033703,n[1]=3144134277,n[2]=1013904242,n[3]=2773480762,n[4]=1359893119,n[5]=2600822924,n[6]=528734635,n[7]=1541459225,c[0]=4089235720,c[1]=2227873595,c[2]=4271175723,c[3]=1595750129,c[4]=2917565137,c[5]=725511199,c[6]=4215389547,c[7]=327033209,Cn(n,c,f,s),s%=128,h=0;h<s;h++)p[h]=f[b-s+h];for(p[s]=128,s=256-128*(s<112?1:0),p[s-9]=0,D(p,s-8,b/536870912|0,b<<3),Cn(n,c,p,s),h=0;h<8;h++)D(o,8*h,n[h],c[h]);return 0}function nr(o,f){var s=e(),n=e(),c=e(),p=e(),h=e(),b=e(),S=e(),j=e(),U=e();Ut(s,o[1],o[0]),Ut(U,f[1],f[0]),L(s,s,U),Rt(n,o[0],o[1]),Rt(U,f[0],f[1]),L(n,n,U),L(c,o[3],f[3]),L(c,c,E),L(p,o[2],f[2]),Rt(p,p,p),Ut(h,n,s),Ut(b,p,c),Rt(S,p,c),Rt(j,n,s),L(o[0],h,b),L(o[1],j,S),L(o[2],S,b),L(o[3],h,j)}function Fn(o,f,s){var n;for(n=0;n<4;n++)Lt(o[n],f[n],s)}function Fr(o,f){var s=e(),n=e(),c=e();Rn(c,f[2]),L(s,f[0],c),L(n,f[1],c),te(o,n),o[31]^=Re(s)<<7}function kr(o,f,s){var n,c;for(jt(o[0],l),jt(o[1],d),jt(o[2],d),jt(o[3],l),c=255;c>=0;--c)n=s[c/8|0]>>(c&7)&1,Fn(o,f,n),nr(f,o),nr(o,o),Fn(o,f,n)}function ir(o,f){var s=[e(),e(),e(),e()];jt(s[0],N),jt(s[1],O),jt(s[2],d),L(s[3],N,O),kr(o,s,f)}function jr(o,f,s){var n=new Uint8Array(64),c=[e(),e(),e(),e()],p;for(s||r(f,32),ne(n,f,32),n[0]&=248,n[31]&=127,n[31]|=64,ir(c,n),Fr(o,c),p=0;p<32;p++)f[p+32]=o[p];return 0}var or=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Kr(o,f){var s,n,c,p;for(n=63;n>=32;--n){for(s=0,c=n-32,p=n-12;c<p;++c)f[c]+=s-16*f[n]*or[c-(n-32)],s=Math.floor((f[c]+128)/256),f[c]-=s*256;f[c]+=s,f[n]=0}for(s=0,c=0;c<32;c++)f[c]+=s-(f[31]>>4)*or[c],s=f[c]>>8,f[c]&=255;for(c=0;c<32;c++)f[c]-=s*or[c];for(n=0;n<32;n++)f[n+1]+=f[n]>>8,o[n]=f[n]&255}function Mr(o){var f=new Float64Array(64),s;for(s=0;s<64;s++)f[s]=o[s];for(s=0;s<64;s++)o[s]=0;Kr(o,f)}function kn(o,f,s,n){var c=new Uint8Array(64),p=new Uint8Array(64),h=new Uint8Array(64),b,S,j=new Float64Array(64),U=[e(),e(),e(),e()];ne(c,n,32),c[0]&=248,c[31]&=127,c[31]|=64;var rt=s+64;for(b=0;b<s;b++)o[64+b]=f[b];for(b=0;b<32;b++)o[32+b]=c[32+b];for(ne(h,o.subarray(32),s+32),Mr(h),ir(U,h),Fr(o,U),b=32;b<64;b++)o[b]=n[b];for(ne(p,o,s+64),Mr(p),b=0;b<64;b++)j[b]=0;for(b=0;b<32;b++)j[b]=h[b];for(b=0;b<32;b++)for(S=0;S<32;S++)j[b+S]+=p[b]*c[S];return Kr(o.subarray(32),j),rt}function _o(o,f){var s=e(),n=e(),c=e(),p=e(),h=e(),b=e(),S=e();return jt(o[2],d),Ue(o[1],f),Ct(c,o[1]),L(p,c,w),Ut(c,c,o[2]),Rt(p,o[2],p),Ct(h,p),Ct(b,h),L(S,b,h),L(s,S,c),L(s,s,p),Un(s,s),L(s,s,c),L(s,s,p),L(s,s,p),L(o[0],s,p),Ct(n,o[0]),L(n,n,p),Le(n,c)&&L(o[0],o[0],X),Ct(n,o[0]),L(n,n,p),Le(n,c)?-1:(Re(o[0])===f[31]>>7&&Ut(o[0],l,o[0]),L(o[3],o[0],o[1]),0)}function Vr(o,f,s,n){var c,p=new Uint8Array(32),h=new Uint8Array(64),b=[e(),e(),e(),e()],S=[e(),e(),e(),e()];if(s<64||_o(S,n))return-1;for(c=0;c<s;c++)o[c]=f[c];for(c=0;c<32;c++)o[c+32]=n[c];if(ne(h,o,s),Mr(h),kr(b,S,h),ir(S,f.subarray(32)),nr(b,S),Fr(p,b),s-=64,At(f,0,p,0)){for(c=0;c<s;c++)o[c]=0;return-1}for(c=0;c<s;c++)o[c]=f[c+64];return s}var Yr=32,ar=24,Pe=32,xe=16,Ne=32,sr=32,Be=32,Ce=32,qr=32,jn=ar,bo=Pe,vo=xe,zt=64,ie=32,ye=64,Hr=32,$r=64;t.lowlevel={crypto_core_hsalsa20:Nt,crypto_stream_xor:pe,crypto_stream:Ie,crypto_stream_salsa20_xor:Ze,crypto_stream_salsa20:Qe,crypto_onetimeauth:Te,crypto_onetimeauth_verify:De,crypto_verify_16:ft,crypto_verify_32:At,crypto_secretbox:Se,crypto_secretbox_open:Oe,crypto_scalarmult:tr,crypto_scalarmult_base:er,crypto_box_beforenm:rr,crypto_box_afternm:Nn,crypto_box:wo,crypto_box_open:go,crypto_box_keypair:Pn,crypto_hash:ne,crypto_sign:kn,crypto_sign_keypair:jr,crypto_sign_open:Vr,crypto_secretbox_KEYBYTES:Yr,crypto_secretbox_NONCEBYTES:ar,crypto_secretbox_ZEROBYTES:Pe,crypto_secretbox_BOXZEROBYTES:xe,crypto_scalarmult_BYTES:Ne,crypto_scalarmult_SCALARBYTES:sr,crypto_box_PUBLICKEYBYTES:Be,crypto_box_SECRETKEYBYTES:Ce,crypto_box_BEFORENMBYTES:qr,crypto_box_NONCEBYTES:jn,crypto_box_ZEROBYTES:bo,crypto_box_BOXZEROBYTES:vo,crypto_sign_BYTES:zt,crypto_sign_PUBLICKEYBYTES:ie,crypto_sign_SECRETKEYBYTES:ye,crypto_sign_SEEDBYTES:Hr,crypto_hash_BYTES:$r,gf:e,D:w,L:or,pack25519:te,unpack25519:Ue,M:L,A:Rt,S:Ct,Z:Ut,pow2523:Un,add:nr,set25519:jt,modL:Kr,scalarmult:kr,scalarbase:ir};function Kn(o,f){if(o.length!==Yr)throw new Error("bad key size");if(f.length!==ar)throw new Error("bad nonce size")}function Ao(o,f){if(o.length!==Be)throw new Error("bad public key size");if(f.length!==Ce)throw new Error("bad secret key size")}function Pt(){for(var o=0;o<arguments.length;o++)if(!(arguments[o]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Mn(o){for(var f=0;f<o.length;f++)o[f]=0}t.randomBytes=function(o){var f=new Uint8Array(o);return r(f,o),f},t.secretbox=function(o,f,s){Pt(o,f,s),Kn(s,f);for(var n=new Uint8Array(Pe+o.length),c=new Uint8Array(n.length),p=0;p<o.length;p++)n[p+Pe]=o[p];return Se(c,n,n.length,f,s),c.subarray(xe)},t.secretbox.open=function(o,f,s){Pt(o,f,s),Kn(s,f);for(var n=new Uint8Array(xe+o.length),c=new Uint8Array(n.length),p=0;p<o.length;p++)n[p+xe]=o[p];return n.length<32||Oe(c,n,n.length,f,s)!==0?null:c.subarray(Pe)},t.secretbox.keyLength=Yr,t.secretbox.nonceLength=ar,t.secretbox.overheadLength=xe,t.scalarMult=function(o,f){if(Pt(o,f),o.length!==sr)throw new Error("bad n size");if(f.length!==Ne)throw new Error("bad p size");var s=new Uint8Array(Ne);return tr(s,o,f),s},t.scalarMult.base=function(o){if(Pt(o),o.length!==sr)throw new Error("bad n size");var f=new Uint8Array(Ne);return er(f,o),f},t.scalarMult.scalarLength=sr,t.scalarMult.groupElementLength=Ne,t.box=function(o,f,s,n){var c=t.box.before(s,n);return t.secretbox(o,f,c)},t.box.before=function(o,f){Pt(o,f),Ao(o,f);var s=new Uint8Array(qr);return rr(s,o,f),s},t.box.after=t.secretbox,t.box.open=function(o,f,s,n){var c=t.box.before(s,n);return t.secretbox.open(o,f,c)},t.box.open.after=t.secretbox.open,t.box.keyPair=function(){var o=new Uint8Array(Be),f=new Uint8Array(Ce);return Pn(o,f),{publicKey:o,secretKey:f}},t.box.keyPair.fromSecretKey=function(o){if(Pt(o),o.length!==Ce)throw new Error("bad secret key size");var f=new Uint8Array(Be);return er(f,o),{publicKey:f,secretKey:new Uint8Array(o)}},t.box.publicKeyLength=Be,t.box.secretKeyLength=Ce,t.box.sharedKeyLength=qr,t.box.nonceLength=jn,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(o,f){if(Pt(o,f),f.length!==ye)throw new Error("bad secret key size");var s=new Uint8Array(zt+o.length);return kn(s,o,o.length,f),s},t.sign.open=function(o,f){if(Pt(o,f),f.length!==ie)throw new Error("bad public key size");var s=new Uint8Array(o.length),n=Vr(s,o,o.length,f);if(n<0)return null;for(var c=new Uint8Array(n),p=0;p<c.length;p++)c[p]=s[p];return c},t.sign.detached=function(o,f){for(var s=t.sign(o,f),n=new Uint8Array(zt),c=0;c<n.length;c++)n[c]=s[c];return n},t.sign.detached.verify=function(o,f,s){if(Pt(o,f,s),f.length!==zt)throw new Error("bad signature size");if(s.length!==ie)throw new Error("bad public key size");var n=new Uint8Array(zt+o.length),c=new Uint8Array(zt+o.length),p;for(p=0;p<zt;p++)n[p]=f[p];for(p=0;p<o.length;p++)n[p+zt]=o[p];return Vr(c,n,n.length,s)>=0},t.sign.keyPair=function(){var o=new Uint8Array(ie),f=new Uint8Array(ye);return jr(o,f),{publicKey:o,secretKey:f}},t.sign.keyPair.fromSecretKey=function(o){if(Pt(o),o.length!==ye)throw new Error("bad secret key size");for(var f=new Uint8Array(ie),s=0;s<f.length;s++)f[s]=o[32+s];return{publicKey:f,secretKey:new Uint8Array(o)}},t.sign.keyPair.fromSeed=function(o){if(Pt(o),o.length!==Hr)throw new Error("bad seed size");for(var f=new Uint8Array(ie),s=new Uint8Array(ye),n=0;n<32;n++)s[n]=o[n];return jr(f,s,!0),{publicKey:f,secretKey:s}},t.sign.publicKeyLength=ie,t.sign.secretKeyLength=ye,t.sign.seedLength=Hr,t.sign.signatureLength=zt,t.hash=function(o){Pt(o);var f=new Uint8Array($r);return ne(f,o,o.length),f},t.hash.hashLength=$r,t.verify=function(o,f){return Pt(o,f),o.length===0||f.length===0||o.length!==f.length?!1:st(o,0,f,0,o.length)===0},t.setPRNG=function(o){r=o},function(){var o=typeof self<"u"?self.crypto||self.msCrypto:null;if(o&&o.getRandomValues){var f=65536;t.setPRNG(function(s,n){var c,p=new Uint8Array(n);for(c=0;c<n;c+=f)o.getRandomValues(p.subarray(c,c+Math.min(n-c,f)));for(c=0;c<n;c++)s[c]=p[c];Mn(p)})}else typeof Vn<"u"&&(o=Ui(),o&&o.randomBytes&&t.setPRNG(function(s,n){var c,p=o.randomBytes(n);for(c=0;c<n;c++)s[c]=p[c];Mn(p)}))}()})(typeof Tr<"u"&&Tr.exports?Tr.exports:self.nacl=self.nacl||{})});var yt=t=>t==null,ee=t=>!yt(t);var Wr="__bigint__",zr="__principal__",Gr="__uint8array__",Ro=(t,e)=>typeof e=="bigint"?{[Wr]:`${e}`}:ee(e)&&e instanceof ot?{[zr]:e.toText()}:ee(e)&&e instanceof Uint8Array?{[Gr]:Array.from(e)}:e,Uo=(t,e)=>{let r=i=>e[i];return ee(e)&&typeof e=="object"&&Wr in e?BigInt(r(Wr)):ee(e)&&typeof e=="object"&&zr in e?ot.fromText(r(zr)):ee(e)&&typeof e=="object"&&Gr in e?Uint8Array.from(r(Gr)):e},mt=t=>ee(t)?[t]:[],Tt=t=>t?.[0],Gn=async t=>{let e=new Blob([JSON.stringify(t,Ro)],{type:"application/json; charset=utf-8"});return new Uint8Array(await e.arrayBuffer())},lr=async t=>{let e=new Blob([t instanceof Uint8Array?t:new Uint8Array(t)],{type:"application/json; charset=utf-8"});return JSON.parse(await e.text(),Uo)},ur=()=>typeof window<"u";var we=class{callbacks=[];populate(e){this.callbacks.forEach(({callback:r})=>r(e))}subscribe(e){let r=Symbol();return this.callbacks.push({id:r,callback:e}),()=>this.callbacks=this.callbacks.filter(({id:i})=>i!==r)}};var Jt=class t extends we{static instance;authUser=null;constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}set(e){this.authUser=e,this.populate(e)}get(){return this.authUser}subscribe(e){let r=super.subscribe(e);return e(this.authUser),r}reset(){this.authUser=null,this.populate(this.authUser)}};var Jr=({message:t,detail:e})=>{let r=new CustomEvent(t,{detail:e,bubbles:!0});document.dispatchEvent(r)};var Jn=BigInt(144e11),Xn={width:576,height:576},Zn={width:505,height:705},Qn="internetcomputer.org";var St=class t extends we{static instance;env;constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}set(e){this.env=e,this.populate(e)}get(){return this.env}localIdentity(){return this.get()?.localIdentityCanisterId!==void 0}subscribe(e){let r=super.subscribe(e);return e(this.env),r}};var Xr=({width:t,height:e})=>{if(!ur()||yt(window)||yt(window.top))return;let{top:{innerWidth:r,innerHeight:i}}=window,a=i/2+screenY-e/2,l=r/2+screenX-t/2;return`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=${t}, height=${e}, top=${a}, left=${l}`};var dr=class{#t;constructor({domain:e}){this.#t=e}get id(){return"internet_identity"}signInOptions({windowed:e}){let r=St.getInstance().localIdentity()?`http://${St.getInstance().get()?.localIdentityCanisterId}.localhost:8000`:`https://identity.${this.#t??Qn}`;return{...e!==!1&&{windowOpenerFeatures:Xr(Xn)},identityProvider:r}}},In=class{#t;#e;constructor({appName:e,logoUrl:r}){this.#t=e,this.#e=r}get id(){return"nfid"}signInOptions({windowed:e}){return{...e!==!1&&{windowOpenerFeatures:Xr(Zn)},identityProvider:`https://nfid.one/authenticate/?applicationName=${encodeURI(this.#t)}&applicationLogo=${encodeURI(this.#e)}`}}};var Ti=me(pi());var yr;(function(t){t[t.SysFatal=1]="SysFatal",t[t.SysTransient=2]="SysTransient",t[t.DestinationInvalid=3]="DestinationInvalid",t[t.CanisterReject=4]="CanisterReject",t[t.CanisterError=5]="CanisterError"})(yr||(yr={}));var aa=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(r[i[a]]=t[i[a]]);return r},sa=new TextEncoder().encode(`
2
+ ic-request`),Zt=class{getPrincipal(){return this._principal||(this._principal=ot.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()))),this._principal}async transformRequest(e){let{body:r}=e,i=aa(e,["body"]),a=await ae(r);return Object.assign(Object.assign({},i),{body:{content:r,sender_pubkey:this.getPublicKey().toDer(),sender_sig:await this.sign(Hn(sa,a))}})}},Qt=class{getPrincipal(){return ot.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var hi=me(Wn());var je=()=>{if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){let t=new Uint32Array(1);return window.crypto.getRandomValues(t),t[0]}if(typeof crypto<"u"&&crypto.getRandomValues){let t=new Uint32Array(1);return crypto.getRandomValues(t),t[0]}return typeof crypto<"u"&&crypto.randomInt?crypto.randomInt(0,4294967295):Math.floor(Math.random()*4294967295)};var mr;(function(t){t.Call="call"})(mr||(mr={}));function Ke(){let t=new ArrayBuffer(16),e=new DataView(t),r=je(),i=je(),a=je(),l=je();return e.setUint32(0,r),e.setUint32(4,i),e.setUint32(8,a),e.setUint32(12,l),t}var fa=BigInt(1e6),ca=BigInt(60*1e3),ce=class{constructor(e){this._value=(BigInt(Date.now())+BigInt(e)-ca)*fa}toCBOR(){return hi.value.u64(this._value.toString(16),16)}toHash(){return qn(this._value)}};function xi(t=Ke){return async e=>{let r=t(),i=e.request.headers;e.request.headers=i,e.endpoint==="call"&&(e.body.nonce=t())}}function wr(t){let e=[];return t.forEach((r,i)=>{e.push([i,r])}),e}var gr=class extends Error{constructor(e,r){super(e),this.response=r,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}};var Ht;(function(t){t.Received="received",t.Processing="processing",t.Replied="replied",t.Rejected="rejected",t.Unknown="unknown",t.Done="done"})(Ht||(Ht={}));var _r=5*60*1e3,ua="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",da="ic0.app",pa=".ic0.app",ha="icp0.io",xa=".icp0.io",ya="icp-api.io",ma=".icp-api.io",Me=class extends oe{constructor(e){super(e),this.message=e}},be=class extends oe{constructor(e){super(e),this.message=e}};function wa(){let t;if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new Me("Fetch implementation was not available. You appear to be in a browser context, but window.fetch was not present.");else if(typeof globalThis<"u")if(globalThis.fetch)t=globalThis.fetch.bind(globalThis);else throw new Me("Fetch implementation was not available. You appear to be in a Node.js context, but global.fetch was not available.");else typeof self<"u"&&self.fetch&&(t=self.fetch.bind(self));if(t)return t;throw new Me("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}var Ve=class t{constructor(e={}){if(this.rootKey=$n(ua),this._pipeline=[],this._timeDiffMsecs=0,this._rootKeyFetched=!1,this._isAgent=!0,e.source){if(!(e.source instanceof t))throw new Error("An Agent's source can only be another HttpAgent");this._pipeline=[...e.source._pipeline],this._identity=e.source._identity,this._fetch=e.source._fetch,this._host=e.source._host,this._credentials=e.source._credentials}else this._fetch=e.fetch||wa()||fetch.bind(globalThis),this._fetchOptions=e.fetchOptions,this._callOptions=e.callOptions;if(e.host!==void 0)!e.host.match(/^[a-z]+:/)&&typeof window<"u"?this._host=new URL(window.location.protocol+"//"+e.host):this._host=new URL(e.host);else if(e.source!==void 0)this._host=e.source._host;else{let r=typeof window<"u"?window.location:void 0;r||(this._host=new URL("https://icp-api.io"),console.warn("Could not infer host from window.location, defaulting to mainnet gateway of https://icp-api.io. Please provide a host to the HttpAgent constructor to avoid this warning."));let i=["ic0.app","icp0.io","localhost","127.0.0.1"],a=r?.hostname,l;a&&typeof a=="string"&&(l=i.find(d=>a.endsWith(d))),r&&l?this._host=new URL(`${r.protocol}//${l}${r.port?":"+r.port:""}`):(this._host=new URL("https://icp-api.io"),console.warn("Could not infer host from window.location, defaulting to mainnet gateway of https://icp-api.io. Please provide a host to the HttpAgent constructor to avoid this warning."))}if(this._retryTimes=e.retryTimes!==void 0&&e.retryTimes>=0?e.retryTimes:3,this._host.hostname.endsWith(pa)?this._host.hostname=da:this._host.hostname.endsWith(xa)?this._host.hostname=ha:this._host.hostname.endsWith(ma)&&(this._host.hostname=ya),e.credentials){let{name:r,password:i}=e.credentials;this._credentials=`${r}${i?":"+i:""}`}this._identity=Promise.resolve(e.identity||new Qt),e.disableNonce||this.addTransform(xi(Ke))}isLocal(){let e=this._host.hostname;return e==="127.0.0.1"||e.endsWith("localhost")}addTransform(e,r=e.priority||0){let i=this._pipeline.findIndex(a=>(a.priority||0)<r);this._pipeline.splice(i>=0?i:this._pipeline.length,0,Object.assign(e,{priority:r}))}async getPrincipal(){if(!this._identity)throw new be("This identity has expired due this application's security policy. Please refresh your authentication.");return(await this._identity).getPrincipal()}async call(e,r,i){let a=await(i!==void 0?await i:await this._identity);if(!a)throw new be("This identity has expired due this application's security policy. Please refresh your authentication.");let l=ot.from(e),d=r.effectiveCanisterId?ot.from(r.effectiveCanisterId):l,m=a.getPrincipal()||ot.anonymous(),w=new ce(_r);Math.abs(this._timeDiffMsecs)>1e3*30&&(w=new ce(_r+this._timeDiffMsecs));let E={request_type:mr.Call,canister_id:l,method_name:r.methodName,arg:r.arg,sender:m,ingress_expiry:w},N=await this._transform({request:{body:null,method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{})},endpoint:"call",body:E});N=await a.transformRequest(N);let O=cr(N.body),X=this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${d.toText()}/call`,this._host),Object.assign(Object.assign(Object.assign({},this._callOptions),N.request),{body:O}))),[D,st]=await Promise.all([X,ae(E)]),ft=await D.arrayBuffer(),At=D.status===200&&ft.byteLength>0?ke(ft):null;return{requestId:st,response:{ok:D.ok,status:D.status,statusText:D.statusText,body:At,headers:wr(D.headers)}}}async _requestAndRetry(e,r=0){let i=await e();if(i.ok)return i;let a=await i.clone().text(),l=`Server returned an error:
3
3
  Code: ${i.status} (${i.statusText})
4
4
  Body: ${a}
5
- `;if(this._retryTimes>r)return console.warn(l+" Retrying request."),await this._requestAndRetry(e,r+1);throw new mr(l,{ok:i.ok,status:i.status,statusText:i.statusText,headers:yr(i.headers)})}async query(e,r,i){let a=await(i!==void 0?await i:await this._identity);if(!a)throw new _e("This identity has expired due this application's security policy. Please refresh your authentication.");let l=typeof e=="string"?ot.fromText(e):e,d=a?.getPrincipal()||ot.anonymous(),m={request_type:"query",canister_id:l,method_name:r.methodName,arg:r.arg,sender:d,ingress_expiry:new fe(wr)},w=await this._transform({request:{method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{})},endpoint:"read",body:m});w=await a?.transformRequest(w);let A=sr(w.body),N=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${l.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),w.request),{body:A}))),O=Fe(await N.arrayBuffer());return Object.assign(Object.assign({},O),{httpDetails:{ok:N.ok,status:N.status,statusText:N.statusText,headers:yr(N.headers)}})}async createReadStateRequest(e,r){let i=await(r!==void 0?await r:await this._identity);if(!i)throw new _e("This identity has expired due this application's security policy. Please refresh your authentication.");let a=i?.getPrincipal()||ot.anonymous(),l=await this._transform({request:{method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{})},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:a,ingress_expiry:new fe(wr)}});return i?.transformRequest(l)}async readState(e,r,i,a){let l=typeof e=="string"?ot.fromText(e):e,d=a??await this.createReadStateRequest(r,i),m=sr(d.body),w=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${l}/read_state`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),d.request),{body:m})));if(!w.ok)throw new Error(`Server returned an error:
5
+ `;if(this._retryTimes>r)return console.warn(l+" Retrying request."),await this._requestAndRetry(e,r+1);throw new gr(l,{ok:i.ok,status:i.status,statusText:i.statusText,headers:wr(i.headers)})}async query(e,r,i){let a=await(i!==void 0?await i:await this._identity);if(!a)throw new be("This identity has expired due this application's security policy. Please refresh your authentication.");let l=typeof e=="string"?ot.fromText(e):e,d=a?.getPrincipal()||ot.anonymous(),m={request_type:"query",canister_id:l,method_name:r.methodName,arg:r.arg,sender:d,ingress_expiry:new ce(_r)},w=await this._transform({request:{method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{})},endpoint:"read",body:m});w=await a?.transformRequest(w);let E=cr(w.body),N=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${l.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),w.request),{body:E}))),O=ke(await N.arrayBuffer());return Object.assign(Object.assign({},O),{httpDetails:{ok:N.ok,status:N.status,statusText:N.statusText,headers:wr(N.headers)}})}async createReadStateRequest(e,r){let i=await(r!==void 0?await r:await this._identity);if(!i)throw new be("This identity has expired due this application's security policy. Please refresh your authentication.");let a=i?.getPrincipal()||ot.anonymous(),l=await this._transform({request:{method:"POST",headers:Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{})},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:a,ingress_expiry:new ce(_r)}});return i?.transformRequest(l)}async readState(e,r,i,a){let l=typeof e=="string"?ot.fromText(e):e,d=a??await this.createReadStateRequest(r,i),m=cr(d.body),w=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${l}/read_state`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),d.request),{body:m})));if(!w.ok)throw new Error(`Server returned an error:
6
6
  Code: ${w.status} (${w.statusText})
7
7
  Body: ${await w.text()}
8
- `);return Fe(await w.arrayBuffer())}async syncTime(e){let r=await import("./canisterStatus-N5J2XGIM.js"),i=Date.now();try{e||console.log("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let l=(await r.request({canisterId:e??ot.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");l&&(this._timeDiffMsecs=Number(l)-Number(i))}catch(a){console.error("Caught exception while attempting to sync time:",a)}}async status(){let e=this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{},r=await this._requestAndRetry(()=>this._fetch(""+new URL("/api/v2/status",this._host),Object.assign({headers:e},this._fetchOptions)));return Fe(await r.arrayBuffer())}async fetchRootKey(){return this._rootKeyFetched||(this.rootKey=(await this.status()).root_key,this._rootKeyFetched=!0),this.rootKey}invalidateIdentity(){this._identity=null}replaceIdentity(e){this._identity=Promise.resolve(e)}_transform(e){let r=Promise.resolve(e);for(let i of this._pipeline)r=r.then(a=>i(a).then(l=>l||a));return r}};var pi;(function(t){t.Error="err",t.GetPrincipal="gp",t.GetPrincipalResponse="gpr",t.Query="q",t.QueryResponse="qr",t.Call="c",t.CallResponse="cr",t.ReadState="rs",t.ReadStateResponse="rsr",t.Status="s",t.StatusResponse="sr"})(pi||(pi={}));function Ir(){let t=typeof window>"u"?typeof globalThis>"u"?typeof self>"u"?void 0:self.ic.agent:globalThis.ic.agent:window.ic.agent;if(!t)throw new Error("No Agent could be found.");return t}var gr={};jn(gr,{backoff:()=>wi,chain:()=>gi,conditionalDelay:()=>yi,defaultStrategy:()=>hi,maxAttempts:()=>ha,once:()=>xi,throttle:()=>xa,timeout:()=>mi});var pa=5*60*1e3;function hi(){return gi(yi(xi(),1e3),wi(1e3,1.2),mi(pa))}function xi(){let t=!0;return async()=>t?(t=!1,!0):!1}function yi(t,e){return async(r,i,a)=>{if(await t(r,i,a))return new Promise(l=>setTimeout(l,e))}}function ha(t){let e=t;return async(r,i,a)=>{if(--e<=0)throw new Error(`Failed to retrieve a reply for request after ${t} attempts:
8
+ `);return ke(await w.arrayBuffer())}async syncTime(e){let r=await import("./canisterStatus-GGCM43M3.js"),i=Date.now();try{e||console.log("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let l=(await r.request({canisterId:e??ot.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");l&&(this._timeDiffMsecs=Number(l)-Number(i))}catch(a){console.error("Caught exception while attempting to sync time:",a)}}async status(){let e=this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{},r=await this._requestAndRetry(()=>this._fetch(""+new URL("/api/v2/status",this._host),Object.assign({headers:e},this._fetchOptions)));return ke(await r.arrayBuffer())}async fetchRootKey(){return this._rootKeyFetched||(this.rootKey=(await this.status()).root_key,this._rootKeyFetched=!0),this.rootKey}invalidateIdentity(){this._identity=null}replaceIdentity(e){this._identity=Promise.resolve(e)}_transform(e){let r=Promise.resolve(e);for(let i of this._pipeline)r=r.then(a=>i(a).then(l=>l||a));return r}};var yi;(function(t){t.Error="err",t.GetPrincipal="gp",t.GetPrincipalResponse="gpr",t.Query="q",t.QueryResponse="qr",t.Call="c",t.CallResponse="cr",t.ReadState="rs",t.ReadStateResponse="rsr",t.Status="s",t.StatusResponse="sr"})(yi||(yi={}));function nn(){let t=typeof window>"u"?typeof globalThis>"u"?typeof self>"u"?void 0:self.ic.agent:globalThis.ic.agent:window.ic.agent;if(!t)throw new Error("No Agent could be found.");return t}var br={};Yn(br,{backoff:()=>bi,chain:()=>vi,conditionalDelay:()=>gi,defaultStrategy:()=>mi,maxAttempts:()=>_a,once:()=>wi,throttle:()=>ba,timeout:()=>_i});var ga=5*60*1e3;function mi(){return vi(gi(wi(),1e3),bi(1e3,1.2),_i(ga))}function wi(){let t=!0;return async()=>t?(t=!1,!0):!1}function gi(t,e){return async(r,i,a)=>{if(await t(r,i,a))return new Promise(l=>setTimeout(l,e))}}function _a(t){let e=t;return async(r,i,a)=>{if(--e<=0)throw new Error(`Failed to retrieve a reply for request after ${t} attempts:
9
9
  Request ID: ${Gt(i)}
10
10
  Request status: ${a}
11
- `)}}function xa(t){return()=>new Promise(e=>setTimeout(e,t))}function mi(t){let e=Date.now()+t;return async(r,i,a)=>{if(Date.now()>e)throw new Error(`Request timed out after ${t} msec:
11
+ `)}}function ba(t){return()=>new Promise(e=>setTimeout(e,t))}function _i(t){let e=Date.now()+t;return async(r,i,a)=>{if(Date.now()>e)throw new Error(`Request timed out after ${t} msec:
12
12
  Request ID: ${Gt(i)}
13
13
  Request status: ${a}
14
- `)}}function wi(t,e){let r=t;return()=>new Promise(i=>setTimeout(()=>{r*=e,i()},r))}function gi(...t){return async(e,r,i)=>{for(let a of t)await a(e,r,i)}}async function Dr(t,e,r,i,a,l){var d;let m=[new TextEncoder().encode("request_status"),r],w=a??await((d=t.createReadStateRequest)===null||d===void 0?void 0:d.call(t,{paths:[m]})),A=await t.readState(e,{paths:[m]},void 0,w);if(t.rootKey==null)throw new Error("Agent root key not initialized before polling");let N=await qn.create({certificate:A.certificate,rootKey:t.rootKey,canisterId:e,blsVerify:l}),O=N.lookup([...m,new TextEncoder().encode("status")]),Z;switch(typeof O>"u"?Z=Ht.Unknown:Z=new TextDecoder().decode(O),Z){case Ht.Replied:return N.lookup([...m,"reply"]);case Ht.Received:case Ht.Unknown:case Ht.Processing:return await i(e,r,Z),Dr(t,e,r,i,w);case Ht.Rejected:{let D=new Uint8Array(N.lookup([...m,"reject_code"]))[0],st=new TextDecoder().decode(N.lookup([...m,"reject_message"]));throw new Error(`Call was rejected:
14
+ `)}}function bi(t,e){let r=t;return()=>new Promise(i=>setTimeout(()=>{r*=e,i()},r))}function vi(...t){return async(e,r,i)=>{for(let a of t)await a(e,r,i)}}async function on(t,e,r,i,a,l){var d;let m=[new TextEncoder().encode("request_status"),r],w=a??await((d=t.createReadStateRequest)===null||d===void 0?void 0:d.call(t,{paths:[m]})),E=await t.readState(e,{paths:[m]},void 0,w);if(t.rootKey==null)throw new Error("Agent root key not initialized before polling");let N=await zn.create({certificate:E.certificate,rootKey:t.rootKey,canisterId:e,blsVerify:l}),O=N.lookup([...m,new TextEncoder().encode("status")]),X;switch(typeof O>"u"?X=Ht.Unknown:X=new TextDecoder().decode(O),X){case Ht.Replied:return N.lookup([...m,"reply"]);case Ht.Received:case Ht.Unknown:case Ht.Processing:return await i(e,r,X),on(t,e,r,i,w);case Ht.Rejected:{let D=new Uint8Array(N.lookup([...m,"reject_code"]))[0],st=new TextDecoder().decode(N.lookup([...m,"reject_message"]));throw new Error(`Call was rejected:
15
15
  Request ID: ${Gt(r)}
16
16
  Reject code: ${D}
17
17
  Reject text: ${st}
18
18
  `)}case Ht.Done:throw new Error(`Call was marked as done but we never saw the reply:
19
19
  Request ID: ${Gt(r)}
20
- `)}throw new Error("unreachable")}var _i=({IDL:t})=>{let e=t.Principal,r=t.Record({controllers:t.Vec(t.Principal),freezing_threshold:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),i=t.Record({controllers:t.Opt(t.Vec(t.Principal)),freezing_threshold:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),a=t.Vec(t.Nat8);return t.Service({canister_status:t.Func([t.Record({canister_id:e})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:r,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(i)})],[t.Record({canister_id:e})],[]),delete_canister:t.Func([t.Record({canister_id:e})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:e})],[],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:a,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:e})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(i),amount:t.Opt(t.Nat)})],[t.Record({canister_id:e})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:e,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),start_canister:t.Func([t.Record({canister_id:e})],[],[]),stop_canister:t.Func([t.Record({canister_id:e})],[],[]),uninstall_code:t.Func([t.Record({canister_id:e})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:i})],[],[])})};var br=class extends ie{constructor(e,r,i,a){super(["Call failed:",` Canister: ${e.toText()}`,` Method: ${r} (${i})`,...Object.getOwnPropertyNames(a).map(l=>` "${l}": ${JSON.stringify(a[l])}`)].join(`
21
- `)),this.canisterId=e,this.methodName=r,this.type=i,this.props=a}},Lr=class extends br{constructor(e,r,i){var a;super(e,r,"query",{Status:i.status,Code:(a=hr[i.reject_code])!==null&&a!==void 0?a:`Unknown Code "${i.reject_code}"`,Message:i.reject_message}),this.result=i}},tn=class extends br{constructor(e,r,i,a){super(e,r,"update",Object.assign({"Request ID":Gt(i)},a.body?Object.assign(Object.assign({},a.body.error_code?{"Error code":a.body.error_code}:{}),{"Reject code":String(a.body.reject_code),"Reject message":a.body.reject_message}):{"HTTP status code":a.status.toString(),"HTTP status text":a.statusText})),this.requestId=i,this.response=a}},en;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(en||(en={}));var kt=Symbol.for("ic-agent-metadata"),ce=class t{constructor(e){this[kt]=Object.freeze(e)}static agentOf(e){return e[kt].config.agent}static interfaceOf(e){return e[kt].service}static canisterIdOf(e){return ot.from(e[kt].config.canisterId)}static async install(e,r){let i=e.mode===void 0?en.Install:e.mode,a=e.arg?[...new Uint8Array(e.arg)]:[],l=[...new Uint8Array(e.module)],d=typeof r.canisterId=="string"?ot.fromText(r.canisterId):r.canisterId;await bi(r).install_code({mode:{[i]:null},arg:a,wasm_module:l,canister_id:d})}static async createCanister(e){let{canister_id:r}=await bi(e||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(e,r,i){let a=await this.createCanister(i);return await this.install(Object.assign({},r),Object.assign(Object.assign({},i),{canisterId:a})),this.createActor(e,Object.assign(Object.assign({},i),{canisterId:a}))}static createActorClass(e,r){let i=e({IDL:Ce});class a extends t{constructor(d){if(!d.canisterId)throw new ie(`Canister ID is required, but recieved ${typeof d.canisterId} instead. If you are using automatically generated declarations, this may be because your application is not setting the canister ID in process.env correctly.`);let m=typeof d.canisterId=="string"?ot.fromText(d.canisterId):d.canisterId;super({config:Object.assign(Object.assign(Object.assign({},Ei),d),{canisterId:m}),service:i});for(let[w,A]of i._fields)r?.httpDetails&&A.annotations.push(rn),this[w]=ma(this,w,A,d.blsVerify)}}return a}static createActor(e,r){if(!r.canisterId)throw new ie(`Canister ID is required, but recieved ${typeof r.canisterId} instead. If you are using automatically generated declarations, this may be because your application is not setting the canister ID in process.env correctly.`);return new(this.createActorClass(e))(r)}static createActorWithHttpDetails(e,r){return new(this.createActorClass(e,{httpDetails:!0}))(r)}};function _r(t,e){let r=Ce.decode(t,vi.Buffer.from(e));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var Ei={pollingStrategyFactory:gr.defaultStrategy},rn="http-details";function ma(t,e,r,i){let a;r.annotations.includes("query")||r.annotations.includes("composite_query")?a=async(d,...m)=>{var w,A;d=Object.assign(Object.assign({},d),(A=(w=t[kt].config).queryTransform)===null||A===void 0?void 0:A.call(w,e,m,Object.assign(Object.assign({},t[kt].config),d)));let N=d.agent||t[kt].config.agent||Ir(),O=ot.from(d.canisterId||t[kt].config.canisterId),Z=Ce.encode(r.argTypes,m),D=await N.query(O,{methodName:e,arg:Z});switch(D.status){case"rejected":throw new Lr(O,e,D);case"replied":return r.annotations.includes(rn)?{httpDetails:D.httpDetails,result:_r(r.retTypes,D.reply.arg)}:_r(r.retTypes,D.reply.arg)}}:a=async(d,...m)=>{var w,A;d=Object.assign(Object.assign({},d),(A=(w=t[kt].config).callTransform)===null||A===void 0?void 0:A.call(w,e,m,Object.assign(Object.assign({},t[kt].config),d)));let N=d.agent||t[kt].config.agent||Ir(),{canisterId:O,effectiveCanisterId:Z,pollingStrategyFactory:D}=Object.assign(Object.assign(Object.assign({},Ei),t[kt].config),d),st=ot.from(O),ft=Z!==void 0?ot.from(Z):st,bt=Ce.encode(r.argTypes,m),{requestId:pt,response:vt}=await N.call(st,{methodName:e,arg:bt,effectiveCanisterId:ft});if(!vt.ok||vt.body)throw new tn(st,e,pt,vt);let Vt=D(),Nt=await Dr(N,ft,pt,Vt,i),Bt=r.annotations.includes(rn);if(Nt!==void 0)return Bt?{httpDetails:vt,result:_r(r.retTypes,Nt)}:_r(r.retTypes,Nt);if(r.retTypes.length===0)return Bt?{httpDetails:vt,result:void 0}:void 0;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let l=(...d)=>a({},...d);return l.withOptions=d=>(...m)=>a(d,...m),l}function bi(t){function e(r,i,a){let l=i[0],d=ot.fromHex("");return l&&typeof l=="object"&&l.canister_id&&(d=ot.from(l.canister_id)),{effectiveCanisterId:d}}return ce.createActor(_i,Object.assign(Object.assign(Object.assign({},t),{canisterId:ot.fromHex("")}),{callTransform:e,queryTransform:e}))}var Ve=ye(nn());function be(t){var e;return new Uint8Array(((e=t.match(/.{1,2}/g))!==null&&e!==void 0?e:[]).map(r=>parseInt(r,16))).buffer}function It(t){return new Uint8Array(t).reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}var _a=(t,e)=>{if(t.byteLength!==e.byteLength)return!1;let r=new Uint8Array(t),i=new Uint8Array(e);for(let a=0;a<r.length;a++)if(r[a]!==i[a])return!1;return!0},Oi=t=>{if(t<=127)return 1;if(t<=255)return 2;if(t<=65535)return 3;if(t<=16777215)return 4;throw new Error("Length too long (> 4 bytes)")},Ui=(t,e,r)=>{if(r<=127)return t[e]=r,1;if(r<=255)return t[e]=129,t[e+1]=r,2;if(r<=65535)return t[e]=130,t[e+1]=r>>8,t[e+2]=r,3;if(r<=16777215)return t[e]=131,t[e+1]=r>>16,t[e+2]=r>>8,t[e+3]=r,4;throw new Error("Length too long (> 4 bytes)")},on=(t,e)=>{if(t[e]<128)return 1;if(t[e]===128)throw new Error("Invalid length 0");if(t[e]===129)return 2;if(t[e]===130)return 3;if(t[e]===131)return 4;throw new Error("Length too long (> 4 bytes)")},ba=(t,e)=>{let r=on(t,e);if(r===1)return t[e];if(r===2)return t[e+1];if(r===3)return(t[e+1]<<8)+t[e+2];if(r===4)return(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];throw new Error("Length too long (> 4 bytes)")},Ri=Uint8Array.from([48,12,6,10,43,6,1,4,1,131,184,67,1,1]),Ar=Uint8Array.from([48,5,6,3,43,101,112]),Pf=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function Tr(t,e){let r=2+Oi(t.byteLength+1),i=e.byteLength+r+t.byteLength,a=0,l=new Uint8Array(1+Oi(i)+i);return l[a++]=48,a+=Ui(l,a,i),l.set(e,a),a+=e.byteLength,l[a++]=3,a+=Ui(l,a,t.byteLength+1),l[a++]=0,l.set(new Uint8Array(t),a),l}var an=(t,e)=>{let r=0,i=(m,w)=>{if(a[r++]!==m)throw new Error("Expected: "+w)},a=new Uint8Array(t);if(i(48,"sequence"),r+=on(a,r),!_a(a.slice(r,r+e.byteLength),e))throw new Error("Not the expected OID.");r+=e.byteLength,i(3,"bit string");let l=ba(a,r)-1;r+=on(a,r),i(0,"0 padding");let d=a.slice(r);if(l!==d.length)throw new Error(`DER payload mismatch: Expected length ${l} actual length ${d.length}`);return d};var ee=class t{constructor(e){this.rawKey=e,this.derKey=t.derEncode(e)}static from(e){return this.fromDer(e.toDer())}static fromRaw(e){return new t(e)}static fromDer(e){return new t(this.derDecode(e))}static derEncode(e){return Tr(e,Ar).buffer}static derDecode(e){let r=an(e,Ar);if(r.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return r}toDer(){return this.derKey}toRaw(){return this.rawKey}};ee.RAW_KEY_LENGTH=32;var ue=class t extends Zt{constructor(e,r){super(),this._privateKey=r,this._publicKey=ee.from(e)}static generate(e){if(e&&e.length!==32)throw new Error("Ed25519 Seed needs to be 32 bytes long.");let{publicKey:r,secretKey:i}=e===void 0?Ve.sign.keyPair():Ve.sign.keyPair.fromSeed(e);return new this(ee.fromRaw(r),i)}static fromParsedJson(e){let[r,i]=e;return new t(ee.fromDer(be(r)),be(i))}static fromJSON(e){let r=JSON.parse(e);if(Array.isArray(r)){if(typeof r[0]=="string"&&typeof r[1]=="string")return this.fromParsedJson([r[0],r[1]]);throw new Error("Deserialization error: JSON must have at least 2 items.")}throw new Error(`Deserialization error: Invalid JSON type for string: ${JSON.stringify(e)}`)}static fromKeyPair(e,r){return new t(ee.fromRaw(e),r)}static fromSecretKey(e){let r=Ve.sign.keyPair.fromSecretKey(new Uint8Array(e));return t.fromKeyPair(r.publicKey,r.secretKey)}toJSON(){return[It(this._publicKey.toDer()),It(this._privateKey)]}getKeyPair(){return{secretKey:this._privateKey,publicKey:this._publicKey}}getPublicKey(){return this._publicKey}async sign(e){let r=new Uint8Array(e);return Ve.sign.detached(r,new Uint8Array(this._privateKey)).buffer}};var sn=class t extends Error{constructor(e){super(e),this.message=e,Object.setPrototypeOf(this,t.prototype)}};function Pi(t){if(t)return t;if(typeof crypto<"u"&&crypto.subtle)return crypto.subtle;throw new sn("Global crypto was not available and none was provided. Please inlcude a SubtleCrypto implementation. See https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto")}var Ye=class t extends Zt{constructor(e,r,i){super(),this._keyPair=e,this._derKey=r,this._subtleCrypto=i}static async generate(e){let{extractable:r=!1,keyUsages:i=["sign","verify"],subtleCrypto:a}=e??{},l=Pi(a),d=await l.generateKey({name:"ECDSA",namedCurve:"P-256"},r,i),m=await l.exportKey("spki",d.publicKey);return new this(d,m,l)}static async fromKeyPair(e,r){let i=Pi(r),a=await i.exportKey("spki",e.publicKey);return new t(e,a,i)}getKeyPair(){return this._keyPair}getPublicKey(){let e=this._derKey,r=Object.create(this._keyPair.publicKey);return r.toDer=function(){return e},r}async sign(e){let r={name:"ECDSA",hash:{name:"SHA-256"}};return this._keyPair.privateKey,await this._subtleCrypto.sign(r,this._keyPair.privateKey,e)}};var ve=ye(Yn());var va=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(r[i[a]]=t[i[a]]);return r},Ea=new TextEncoder().encode("ic-request-auth-delegation"),Aa=new TextEncoder().encode(`
22
- ic-request`);function fn(t){if(typeof t!="string"||t.length<64)throw new Error("Invalid public key.");return be(t)}var Ee=class{constructor(e,r,i){this.pubkey=e,this.expiration=r,this.targets=i}toCBOR(){return ve.value.map(Object.assign({pubkey:ve.value.bytes(this.pubkey),expiration:ve.value.u64(this.expiration.toString(16),16)},this.targets&&{targets:ve.value.array(this.targets.map(e=>ve.value.bytes(e.toUint8Array())))}))}toJSON(){return Object.assign({expiration:this.expiration.toString(16),pubkey:It(this.pubkey)},this.targets&&{targets:this.targets.map(e=>e.toHex())})}};async function Ta(t,e,r,i){let a=new Ee(e.toDer(),BigInt(+r)*BigInt(1e6),i),l=new Uint8Array([...Ea,...new Uint8Array(oe(a))]),d=await t.sign(l);return{delegation:a,signature:d}}var qe=class t{constructor(e,r){this.delegations=e,this.publicKey=r}static async create(e,r,i=new Date(Date.now()+15*60*1e3),a={}){var l,d;let m=await Ta(e,r,i,a.targets);return new t([...((l=a.previous)===null||l===void 0?void 0:l.delegations)||[],m],((d=a.previous)===null||d===void 0?void 0:d.publicKey)||e.getPublicKey().toDer())}static fromJSON(e){let{publicKey:r,delegations:i}=typeof e=="string"?JSON.parse(e):e;if(!Array.isArray(i))throw new Error("Invalid delegations.");let a=i.map(l=>{let{delegation:d,signature:m}=l,{pubkey:w,expiration:A,targets:N}=d;if(N!==void 0&&!Array.isArray(N))throw new Error("Invalid targets.");return{delegation:new Ee(fn(w),BigInt(`0x${A}`),N&&N.map(O=>{if(typeof O!="string")throw new Error("Invalid target.");return ot.fromHex(O)})),signature:fn(m)}});return new this(a,fn(r))}static fromDelegations(e,r){return new this(e,r)}toJSON(){return{delegations:this.delegations.map(e=>{let{delegation:r,signature:i}=e,{targets:a}=r;return{delegation:Object.assign({expiration:r.expiration.toString(16),pubkey:It(r.pubkey)},a&&{targets:a.map(l=>l.toHex())}),signature:It(i)}}),publicKey:It(this.publicKey)}}},He=class extends Zt{constructor(e,r){super(),this._inner=e,this._delegation=r}static fromDelegation(e,r){return new this(e,r)}getDelegation(){return this._delegation}getPublicKey(){return{toDer:()=>this._delegation.publicKey}}sign(e){return this._inner.sign(e)}async transformRequest(e){let{body:r}=e,i=va(e,["body"]),a=await oe(r);return Object.assign(Object.assign({},i),{body:{content:r,sender_sig:await this.sign(new Uint8Array([...Aa,...new Uint8Array(a)])),sender_delegation:this._delegation.delegations,sender_pubkey:this._delegation.publicKey}})}};function Ni(t,e){for(let{delegation:a}of t.delegations)if(+new Date(Number(a.expiration/BigInt(1e6)))<=+Date.now())return!1;let r=[],i=e?.scope;i&&(Array.isArray(i)?r.push(...i.map(a=>typeof a=="string"?ot.fromText(a):a)):r.push(typeof i=="string"?ot.fromText(i):i));for(let a of r){let l=a.toText();for(let{delegation:d}of t.delegations){if(d.targets===void 0)continue;let m=!0;for(let w of d.targets)if(w.toText()===l){m=!1;break}if(m)return!1}}return!0}var Sa=ye(vo()),Oa=ye(nn());var Bi;(function(t){t[t.ECDSA_WITH_SHA256=-7]="ECDSA_WITH_SHA256"})(Bi||(Bi={}));var Ci=["mousedown","mousemove","keydown","touchstart","wheel"],$e=class{constructor(e={}){var r;this.callbacks=[],this.idleTimeout=10*60*1e3,this.timeoutID=void 0;let{onIdle:i,idleTimeout:a=10*60*1e3}=e||{};this.callbacks=i?[i]:[],this.idleTimeout=a;let l=this._resetTimer.bind(this);window.addEventListener("load",l,!0),Ci.forEach(function(m){document.addEventListener(m,l,!0)});let d=(m,w)=>{let A;return(...N)=>{let O=this,Z=function(){A=void 0,m.apply(O,N)};clearTimeout(A),A=window.setTimeout(Z,w)}};if(e?.captureScroll){let m=d(l,(r=e?.scrollDebounce)!==null&&r!==void 0?r:100);window.addEventListener("scroll",m,!0)}l()}static create(e={}){return new this(e)}registerCallback(e){this.callbacks.push(e)}exit(){clearTimeout(this.timeoutID),window.removeEventListener("load",this._resetTimer,!0);let e=this._resetTimer.bind(this);Ci.forEach(function(r){document.removeEventListener(r,e,!0)}),this.callbacks.forEach(r=>r())}_resetTimer(){let e=this.exit.bind(this);window.clearTimeout(this.timeoutID),this.timeoutID=window.setTimeout(e,this.idleTimeout)}};var Ua=(t,e)=>e.some(r=>t instanceof r),Fi,ki;function Ra(){return Fi||(Fi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Pa(){return ki||(ki=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var ji=new WeakMap,ln=new WeakMap,Ki=new WeakMap,cn=new WeakMap,dn=new WeakMap;function Na(t){let e=new Promise((r,i)=>{let a=()=>{t.removeEventListener("success",l),t.removeEventListener("error",d)},l=()=>{r($t(t.result)),a()},d=()=>{i(t.error),a()};t.addEventListener("success",l),t.addEventListener("error",d)});return e.then(r=>{r instanceof IDBCursor&&ji.set(r,t)}).catch(()=>{}),dn.set(e,t),e}function Ba(t){if(ln.has(t))return;let e=new Promise((r,i)=>{let a=()=>{t.removeEventListener("complete",l),t.removeEventListener("error",d),t.removeEventListener("abort",d)},l=()=>{r(),a()},d=()=>{i(t.error||new DOMException("AbortError","AbortError")),a()};t.addEventListener("complete",l),t.addEventListener("error",d),t.addEventListener("abort",d)});ln.set(t,e)}var un={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return ln.get(t);if(e==="objectStoreNames")return t.objectStoreNames||Ki.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return $t(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function Mi(t){un=t(un)}function Ca(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let i=t.call(Sr(this),e,...r);return Ki.set(i,e.sort?e.sort():[e]),$t(i)}:Pa().includes(t)?function(...e){return t.apply(Sr(this),e),$t(ji.get(this))}:function(...e){return $t(t.apply(Sr(this),e))}}function Fa(t){return typeof t=="function"?Ca(t):(t instanceof IDBTransaction&&Ba(t),Ua(t,Ra())?new Proxy(t,un):t)}function $t(t){if(t instanceof IDBRequest)return Na(t);if(cn.has(t))return cn.get(t);let e=Fa(t);return e!==t&&(cn.set(t,e),dn.set(e,t)),e}var Sr=t=>dn.get(t);function Yi(t,e,{blocked:r,upgrade:i,blocking:a,terminated:l}={}){let d=indexedDB.open(t,e),m=$t(d);return i&&d.addEventListener("upgradeneeded",w=>{i($t(d.result),w.oldVersion,w.newVersion,$t(d.transaction),w)}),r&&d.addEventListener("blocked",w=>r(w.oldVersion,w.newVersion,w)),m.then(w=>{l&&w.addEventListener("close",()=>l()),a&&w.addEventListener("versionchange",A=>a(A.oldVersion,A.newVersion,A))}).catch(()=>{}),m}var ka=["get","getKey","getAll","getAllKeys","count"],ja=["put","add","delete","clear"],pn=new Map;function Vi(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(pn.get(e))return pn.get(e);let r=e.replace(/FromIndex$/,""),i=e!==r,a=ja.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!(a||ka.includes(r)))return;let l=async function(d,...m){let w=this.transaction(d,a?"readwrite":"readonly"),A=w.store;return i&&(A=A.index(m.shift())),(await Promise.all([A[r](...m),a&&w.done]))[0]};return pn.set(e,l),l}Mi(t=>({...t,get:(e,r,i)=>Vi(e,r)||t.get(e,r,i),has:(e,r)=>!!Vi(e,r)||t.has(e,r)}));var qi="auth-client-db",Hi="ic-keyval",Ka=async(t=qi,e=Hi,r)=>(Or&&(localStorage!=null&&localStorage.getItem(Kt))&&(localStorage.removeItem(Kt),localStorage.removeItem(Mt)),await Yi(t,r,{upgrade:i=>{i.objectStoreNames,i.objectStoreNames.contains(e)&&i.clear(e),i.createObjectStore(e)}}));async function Ma(t,e,r){return await t.get(e,r)}async function Va(t,e,r,i){return await t.put(e,i,r)}async function Ya(t,e,r){return await t.delete(e,r)}var We=class t{constructor(e,r){this._db=e,this._storeName=r}static async create(e){let{dbName:r=qi,storeName:i=Hi,version:a=1}=e??{},l=await Ka(r,i,a);return new t(l,i)}async set(e,r){return await Va(this._db,this._storeName,e,r)}async get(e){var r;return(r=await Ma(this._db,this._storeName,e))!==null&&r!==void 0?r:null}async remove(e){return await Ya(this._db,this._storeName,e)}};var Mt="identity",Kt="delegation",$i="iv",qa=1,Or=typeof window<"u",ze=class{constructor(e="ic-",r){this.prefix=e,this._localStorage=r}get(e){return Promise.resolve(this._getLocalStorage().getItem(this.prefix+e))}set(e,r){return this._getLocalStorage().setItem(this.prefix+e,r),Promise.resolve()}remove(e){return this._getLocalStorage().removeItem(this.prefix+e),Promise.resolve()}_getLocalStorage(){if(this._localStorage)return this._localStorage;let e=typeof window>"u"?typeof globalThis>"u"?typeof self>"u"?void 0:self.localStorage:globalThis.localStorage:window.localStorage;if(!e)throw new Error("Could not find local storage.");return e}},Ge=class{get _db(){return new Promise(e=>{if(this.initializedDb){e(this.initializedDb);return}We.create({version:qa}).then(r=>{this.initializedDb=r,e(r)})})}async get(e){return await(await this._db).get(e)}async set(e,r){await(await this._db).set(e,r)}async remove(e){await(await this._db).remove(e)}};var Ha="https://identity.ic0.app",$a="#authorize",hn="ECDSA",xn="Ed25519",Wa=500,za="UserInterrupt",Ur=class{constructor(e,r,i,a,l,d,m,w){var A;this._identity=e,this._key=r,this._chain=i,this._storage=a,this.idleManager=l,this._createOptions=d,this._idpWindow=m,this._eventHandler=w;let N=this.logout.bind(this),O=d?.idleOptions;!O?.onIdle&&!O?.disableDefaultIdleCallback&&((A=this.idleManager)===null||A===void 0||A.registerCallback(()=>{N(),location.reload()}))}static async create(e={}){var r,i,a;let l=(r=e.storage)!==null&&r!==void 0?r:new Ge,d=(i=e.keyType)!==null&&i!==void 0?i:hn,m=null;if(e.identity)m=e.identity;else{let O=await l.get(Mt);if(!O&&Or)try{let Z=new ze,D=await Z.get(Kt),st=await Z.get(Mt);D&&st&&d===hn&&(console.log("Discovered an identity stored in localstorage. Migrating to IndexedDB"),await l.set(Kt,D),await l.set(Mt,st),O=D,await Z.remove(Kt),await Z.remove(Mt))}catch(Z){console.error("error while attempting to recover localstorage: "+Z)}if(O)try{typeof O=="object"?d===xn&&typeof O=="string"?m=await ue.fromJSON(O):m=await Ye.fromKeyPair(O):typeof O=="string"&&(m=ue.fromJSON(O))}catch{}}let w=new Qt,A=null;if(m)try{let O=await l.get(Kt);if(typeof O=="object"&&O!==null)throw new Error("Delegation chain is incorrectly stored. A delegation chain should be stored as a string.");e.identity?w=e.identity:O&&(A=qe.fromJSON(O),Ni(A)?w=He.fromDelegation(m,A):(await yn(l),m=null))}catch(O){console.error(O),await yn(l),m=null}let N;return!((a=e.idleOptions)===null||a===void 0)&&a.disableIdle?N=void 0:(A||e.identity)&&(N=$e.create(e.idleOptions)),m||(d===xn?(m=await ue.generate(),await l.set(Mt,JSON.stringify(m.toJSON()))):(e.storage&&d===hn&&console.warn(`You are using a custom storage provider that may not support CryptoKey storage. If you are using a custom storage provider that does not support CryptoKey storage, you should use '${xn}' as the key type, as it can serialize to a string`),m=await Ye.generate(),await l.set(Mt,m.getKeyPair()))),new this(w,m,A,l,N,e)}async _handleSuccess(e,r){var i,a,l;let d=e.delegations.map(A=>({delegation:new Ee(A.delegation.pubkey,A.delegation.expiration,A.delegation.targets),signature:A.signature.buffer})),m=qe.fromDelegations(d,e.userPublicKey.buffer),w=this._key;if(w){if(this._chain=m,this._identity=He.fromDelegation(w,this._chain),(i=this._idpWindow)===null||i===void 0||i.close(),!this.idleManager){let A=(a=this._createOptions)===null||a===void 0?void 0:a.idleOptions;this.idleManager=$e.create(A),!A?.onIdle&&!A?.disableDefaultIdleCallback&&((l=this.idleManager)===null||l===void 0||l.registerCallback(()=>{this.logout(),location.reload()}))}this._removeEventListener(),delete this._idpWindow,this._chain&&await this._storage.set(Kt,JSON.stringify(this._chain.toJSON())),r?.()}}getIdentity(){return this._identity}async isAuthenticated(){return!this.getIdentity().getPrincipal().isAnonymous()&&this._chain!==null}async login(e){var r,i,a,l;let d=BigInt(8)*BigInt(36e11),m=new URL(((r=e?.identityProvider)===null||r===void 0?void 0:r.toString())||Ha);m.hash=$a,(i=this._idpWindow)===null||i===void 0||i.close(),this._removeEventListener(),this._eventHandler=this._getEventHandler(m,Object.assign({maxTimeToLive:(a=e?.maxTimeToLive)!==null&&a!==void 0?a:d},e)),window.addEventListener("message",this._eventHandler),this._idpWindow=(l=window.open(m.toString(),"idpWindow",e?.windowOpenerFeatures))!==null&&l!==void 0?l:void 0;let w=()=>{this._idpWindow&&(this._idpWindow.closed?this._handleFailure(za,e?.onError):setTimeout(w,Wa))};w()}_getEventHandler(e,r){return async i=>{var a,l,d;if(i.origin!==e.origin){console.warn(`WARNING: expected origin '${e.origin}', got '${i.origin}' (ignoring)`);return}let m=i.data;switch(m.kind){case"authorize-ready":{let w={kind:"authorize-client",sessionPublicKey:new Uint8Array((a=this._key)===null||a===void 0?void 0:a.getPublicKey().toDer()),maxTimeToLive:r?.maxTimeToLive,derivationOrigin:(l=r?.derivationOrigin)===null||l===void 0?void 0:l.toString()};(d=this._idpWindow)===null||d===void 0||d.postMessage(w,e.origin);break}case"authorize-client-success":try{await this._handleSuccess(m,r?.onSuccess)}catch(w){this._handleFailure(w.message,r?.onError)}break;case"authorize-client-failure":this._handleFailure(m.text,r?.onError);break;default:break}}}_handleFailure(e,r){var i;(i=this._idpWindow)===null||i===void 0||i.close(),r?.(e),this._removeEventListener(),delete this._idpWindow}_removeEventListener(){this._eventHandler&&window.removeEventListener("message",this._eventHandler),this._eventHandler=void 0}async logout(e={}){if(await yn(this._storage),this._identity=new Qt,this._chain=null,e.returnTo)try{window.history.pushState({},"",e.returnTo)}catch{window.location.href=e.returnTo}}};async function yn(t){await t.remove(Mt),await t.remove(Kt),await t.remove($i)}var Rr=()=>Ur.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}});var mn=async({data:t})=>{try{return await fr(t)}catch(e){console.error("The data parsing has failed, mapping to undefined as a fallback.",e);return}};var wn=async t=>{let{data:e,updated_at:r,description:i}=t;return{description:mt(i),data:await Hn(e),updated_at:mt(r)}},gn=t=>{let{updated_at:e}=t;return{updated_at:mt(e)}},_n=async({updatedDoc:t,key:e})=>{let{owner:r,updated_at:i,created_at:a,description:l,data:d}=t;return{key:e,description:Et(l),owner:r.toText(),data:await fr(d),created_at:a,updated_at:i}};var Pr=({matcher:t,paginate:e,order:r,owner:i})=>({matcher:yt(t)?[]:[{key:mt(t.key),description:mt(t.description)}],paginate:mt(yt(e)?void 0:{start_after:mt(e.startAfter),limit:mt(yt(e.limit)?void 0:BigInt(e.limit))}),order:mt(yt(r)?void 0:{desc:r.desc,field:r.field==="created_at"?{CreatedAt:null}:r.field==="updated_at"?{UpdatedAt:null}:{Keys:null}}),owner:mt(yt(i)?void 0:typeof i=="string"?ot.fromText(i):i)});var Wi=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),i=t.Variant({Write:t.Null,Admin:t.Null}),a=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:i,expires_at:t.Opt(t.Nat64)}),l=t.Record({updated_at:t.Opt(t.Nat64)}),d=t.Variant({Db:t.Null,Storage:t.Null}),m=t.Record({cycles:t.Nat,destination_id:t.Principal}),w=t.Variant({Deny:t.Null,AllowAny:t.Null,SameOrigin:t.Null}),A=t.Record({status_code:t.Nat16,location:t.Text}),N=t.Record({iframe:t.Opt(w),rewrites:t.Vec(t.Tuple(t.Text,t.Text)),headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text)))),redirects:t.Opt(t.Vec(t.Tuple(t.Text,A)))}),O=t.Record({storage:N}),Z=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),description:t.Opt(t.Text),created_at:t.Nat64}),D=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),certificate_version:t.Opt(t.Nat16)}),st=t.Variant({Heap:t.Null,Stable:t.Null}),ft=t.Record({memory:st,token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),bt=t.Variant({Callback:t.Record({token:ft,callback:t.Func([],[],["query"])})}),pt=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(bt),status_code:t.Nat16}),vt=t.Record({token:t.Opt(ft),body:t.Vec(t.Nat8)}),Vt=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,description:t.Opt(t.Text),encoding_type:t.Opt(t.Text),full_path:t.Text}),Nt=t.Record({batch_id:t.Nat}),Bt=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),Je=t.Record({field:Bt,desc:t.Bool}),Xe=t.Record({key:t.Opt(t.Text),description:t.Opt(t.Text)}),Ze=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),de=t.Record({order:t.Opt(Je),owner:t.Opt(t.Principal),matcher:t.Opt(Xe),paginate:t.Opt(Ze)}),pe=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,description:t.Opt(t.Text),full_path:t.Text}),Ae=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),Qe=t.Record({key:pe,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,Ae)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),Te=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,Qe)),items_length:t.Nat64}),Se=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),jt=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,Z)),items_length:t.Nat64}),Dt=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),Lt=t.Record({memory:t.Opt(st),updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:Dt,created_at:t.Nat64,mutable_permissions:t.Opt(t.Bool),write:Dt}),te=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:i,expires_at:t.Opt(t.Nat64)}),Ie=t.Record({controller:te,controllers:t.Vec(t.Principal)}),Oe=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8),description:t.Opt(t.Text)}),Ue=t.Record({memory:t.Opt(st),updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:Dt,mutable_permissions:t.Opt(t.Bool),write:Dt}),Ut=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),Rt=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Text],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,a))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,l],[],[]),del_docs:t.Func([t.Text],[],[]),del_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),del_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,l))],[],[]),del_rule:t.Func([d,t.Text,l],[],[]),deposit_cycles:t.Func([m],[],[]),get_config:t.Func([],[O],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(Z)],["query"]),http_request:t.Func([D],[pt],["query"]),http_request_streaming_callback:t.Func([ft],[vt],["query"]),init_asset_upload:t.Func([Vt],[Nt],[]),list_assets:t.Func([t.Text,de],[Te],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,a))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,Se))],["query"]),list_docs:t.Func([t.Text,de],[jt],["query"]),list_rules:t.Func([d],[t.Vec(t.Tuple(t.Text,Lt))],["query"]),set_config:t.Func([O],[],[]),set_controllers:t.Func([Ie],[t.Vec(t.Tuple(t.Principal,a))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,Oe],[Z],[]),set_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,Oe))],[t.Vec(t.Tuple(t.Text,Z))],[]),set_rule:t.Func([d,t.Text,Ue],[],[]),upload_asset_chunk:t.Func([Ut],[Rt],[]),version:t.Func([],[t.Text],["query"])})};var zi=async({satelliteId:t,idlFactory:e,identity:r,fetch:i,env:a="prod"})=>{let l=a==="dev"||At.getInstance().localIdentity(),d=l?"http://127.0.0.1:8000/":"https://icp-api.io",m=new Me({identity:r,...d&&{host:d},...i&&{fetch:i}});return l&&await m.fetchRootKey(),ce.createActor(e,{agent:m,canisterId:t})};var St=async({satelliteId:t,...e})=>{let{satelliteId:r}=t!==void 0?{satelliteId:t}:At.getInstance().get()??{satelliteId:void 0};if(!r)throw new Error("No satellite principal defined.");return zi({satelliteId:r,idlFactory:Wi,...e})};var Gi=async({collection:t,key:e,satellite:r})=>{let i=await St(r),a=Et(await i.get_doc(t,e));if(yt(a))return;let{data:l,owner:d,description:m,...w}=a,A=await mn({data:l});return{key:e,description:Et(m),owner:d.toText(),data:A,...w}},Ji=async({collection:t,doc:e,satellite:r})=>{let{set_doc:i}=await St(r),{key:a}=e,l=await wn(e),d=await i(t,a,l);return await _n({key:a,updatedDoc:d})},Xi=async({docs:t,satellite:e})=>{let{set_many_docs:r}=await St(e),i=[];for(let{collection:d,doc:m}of t){let{key:w}=m;i.push([d,w,await wn(m)])}let a=await r(i),l=[];for(let[d,m]of a)l.push(await _n({key:d,updatedDoc:m}));return l},Zi=async({collection:t,doc:e,satellite:r})=>{let{del_doc:i}=await St(r),{key:a}=e;return i(t,a,gn(e))},Qi=async({collection:t,satellite:e})=>{let{del_docs:r}=await St(e);return r(t)},Ii=async({docs:t,satellite:e})=>{let{del_many_docs:r}=await St(e),i=t.map(({collection:a,doc:l})=>[a,l.key,gn(l)]);await r(i)},Di=async({collection:t,filter:e,satellite:r})=>{let i=await St(r),{items:a,items_page:l,items_length:d,matches_length:m,matches_pages:w}=await i.list_docs(t,Pr(e)),A=[];for(let[N,O]of a){let{data:Z,owner:D,description:st,...ft}=O;A.push({key:N,description:Et(st),owner:D.toText(),data:await mn({data:Z}),...ft})}return{items:A,items_length:d,items_page:Et(l),matches_length:m,matches_pages:Et(w)}};var Ot=t=>t!==void 0?t:Nr()??new Qt;var Li=async({satellite:t,...e})=>{let r=Ot(t?.identity);return Gi({...e,satellite:{...t,identity:r}})},to=async({satellite:t,...e})=>{let r=Ot(t?.identity);return Ji({...e,satellite:{...t,identity:r}})},zc=async({satellite:t,...e})=>{let r=Ot(t?.identity);return Xi({...e,satellite:{...t,identity:r}})},Gc=async({satellite:t,...e})=>{let r=Ot(t?.identity);return Zi({...e,satellite:{...t,identity:r}})},Jc=async({collection:t,satellite:e})=>Qi({collection:t,satellite:{...e,identity:Ot(e?.identity)}}),Xc=async({satellite:t,...e})=>{let r=Ot(t?.identity);return Ii({...e,satellite:{...t,identity:r}})},Zc=async({satellite:t,filter:e,...r})=>{let i=Ot(t?.identity);return Di({...r,filter:e??{},satellite:{...t,identity:i}})};var eo=async t=>{let e=Nr();if(yt(e))throw new Error("No identity to initialize the user. Have you initialized Juno?");let r=e.getPrincipal().toText(),i=await Li({collection:"#user",key:r});return yt(i)?await Ga({userId:r,provider:t}):i},Ga=async({userId:t,...e})=>to({collection:"#user",doc:{key:t,data:e}});var Wt,bn=async t=>{if(Wt=Wt??await Rr(),!(await Wt?.isAuthenticated()??!1))return;let r=await eo(t);Jt.getInstance().set(r)},Ja=async t=>new Promise(async(e,r)=>{Wt=Wt??await Rr();let i=t?.provider??new lr({});await Wt.login({onSuccess:async()=>{await bn(i.id),e()},onError:a=>r(a),maxTimeToLive:t?.maxTimeToLive??Wn,...t?.derivationOrigin!==void 0&&{derivationOrigin:t.derivationOrigin},...i.signInOptions({windowed:t?.windowed})})}),vn=async()=>{await Wt?.logout(),Wt=void 0,Jt.getInstance().reset()},Nr=()=>Wt?.getIdentity(),Xa=async()=>(Wt??await Rr()).getIdentity();var ro=t=>{let e=t===!0?"./workers/auth.worker.js":t,r=new Worker(e),i=async()=>{$n({message:"junoSignOutAuthTimer"}),await vn()};return r.onmessage=async({data:a})=>{let{msg:l}=a;switch(l){case"junoSignOutAuthTimer":await i();return}},Jt.getInstance().subscribe(a=>{if(yt(a)){r.postMessage({msg:"junoStopAuthTimer"});return}r.postMessage({msg:"junoStartAuthTimer"})})};var no=async({data:t,filename:e,collection:r,headers:i,token:a,fullPath:l,encoding:d,description:m,satellite:w})=>{let A=await St(w),{batch_id:N}=await A.init_asset_upload({collection:r,full_path:l,name:e,token:mt(a),encoding_type:mt(d),description:mt(m)}),O=19e5,Z=[],D=cr()?new Blob([await t.arrayBuffer()]):t,st=0n;for(let pt=0;pt<D.size;pt+=O){let vt=D.slice(pt,pt+O);Z.push({batchId:N,chunk:vt,actor:A,orderId:st}),st++}let ft=[];for await(let pt of Za({uploadChunks:Z}))ft=[...ft,...pt];let bt=i.find(([pt,vt])=>pt.toLowerCase()==="content-type")===void 0&&t.type!==void 0&&t.type!==""?[["Content-Type",t.type]]:void 0;await A.commit_asset_upload({batch_id:N,chunk_ids:ft.map(({chunk_id:pt})=>pt),headers:[...i,...bt||[]]})};async function*Za({uploadChunks:t,limit:e=12}){for(let r=0;r<t.length;r=r+e){let i=t.slice(r,r+e);yield await Promise.all(i.map(l=>Qa(l)))}}var Qa=async({batchId:t,chunk:e,actor:r,orderId:i})=>r.upload_asset_chunk({batch_id:t,content:new Uint8Array(await e.arrayBuffer()),order_id:mt(i)}),io=async({collection:t,satellite:e,filter:r})=>{let i=await St(e),{items:a,items_length:l,items_page:d,matches_length:m,matches_pages:w}=await i.list_assets(t,Pr(r));return{items:a.map(([A,N])=>N),items_length:l,items_page:Et(d),matches_length:m,matches_pages:Et(w)}},oo=async({collection:t,fullPath:e,satellite:r})=>(await St(r)).del_asset(t,e),ao=async({collection:t,satellite:e})=>(await St(e)).del_assets(t),so=async({assets:t,satellite:e})=>{let{del_many_assets:r}=await St(e),i=t.map(({collection:a,fullPath:l})=>[a,l]);await r(i)};var fo=t=>btoa([...t].map(e=>String.fromCharCode(e)).join(""));var En=()=>{let t=At.getInstance().get()?.satelliteId??"unknown";return At.getInstance().localIdentity()?`http://${t}.localhost:8000`:`https://${t}.icp0.io`};var co=t=>encodeURI(t.toLowerCase().replace(/\s/g,"-"));var S0=async t=>lo(t),O0=async t=>lo({filename:t.data.name,...t}),lo=async({filename:t,data:e,collection:r,headers:i=[],fullPath:a,token:l,satellite:d,encoding:m,description:w})=>{let A=Ot(d?.identity),N=co(t),O=a??`/${r}/${N}`;return await no({data:e,filename:N,collection:r,token:l,headers:i,fullPath:O,encoding:m,satellite:{...d,identity:A},description:w}),{downloadUrl:`${En()}${O}${l!==void 0?`?token=${l}`:""}`,fullPath:O,name:N}},U0=async({collection:t,satellite:e,filter:r})=>{let{items:i,...a}=await io({collection:t,satellite:{...e,identity:Ot(e?.identity)},filter:r??{}}),l=En();return{assets:i.map(({key:{full_path:d,token:m,name:w,owner:A,description:N},headers:O,encodings:Z,created_at:D,updated_at:st})=>{let ft=Et(m);return{fullPath:d,description:Et(N),name:w,downloadUrl:`${l}${d}${ft!==void 0?`?token=${ft}`:""}`,token:ft,headers:O,encodings:Z.reduce((bt,[pt,{modified:vt,sha256:Vt,total_length:Nt}])=>({...bt,[pt]:{modified:vt,sha256:fo(Vt),total_length:Nt}}),{}),owner:A.toText(),created_at:D,updated_at:st}}),...a}},R0=async({collection:t,fullPath:e,satellite:r})=>oo({collection:t,fullPath:e,satellite:{...r,identity:Ot(r?.identity)}}),P0=async({collection:t,satellite:e})=>ao({collection:t,satellite:{...e,identity:Ot(e?.identity)}}),N0=async({assets:t,satellite:e})=>so({assets:t,satellite:{...e,identity:Ot(e?.identity)}});var K0=async t=>{At.getInstance().set(t),await bn();let e=t.workers?.auth!==void 0?ro(t.workers.auth):void 0;return[...e?[e]:[]]},M0=t=>Jt.getInstance().subscribe(t);export{lr as InternetIdentityProvider,Xn as NFIDProvider,M0 as authSubscribe,R0 as deleteAsset,P0 as deleteAssets,Gc as deleteDoc,Jc as deleteDocs,N0 as deleteManyAssets,Xc as deleteManyDocs,Li as getDoc,K0 as initJuno,U0 as listAssets,Zc as listDocs,to as setDoc,zc as setManyDocs,Ja as signIn,vn as signOut,Xa as unsafeIdentity,S0 as uploadBlob,O0 as uploadFile};
20
+ `)}throw new Error("unreachable")}var Ai=({IDL:t})=>{let e=t.Principal,r=t.Record({controllers:t.Vec(t.Principal),freezing_threshold:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),i=t.Record({controllers:t.Opt(t.Vec(t.Principal)),freezing_threshold:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),a=t.Vec(t.Nat8);return t.Service({canister_status:t.Func([t.Record({canister_id:e})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:r,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(i)})],[t.Record({canister_id:e})],[]),delete_canister:t.Func([t.Record({canister_id:e})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:e})],[],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:a,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:e})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(i),amount:t.Opt(t.Nat)})],[t.Record({canister_id:e})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:e,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),start_canister:t.Func([t.Record({canister_id:e})],[],[]),stop_canister:t.Func([t.Record({canister_id:e})],[],[]),uninstall_code:t.Func([t.Record({canister_id:e})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:i})],[],[])})};var Ar=class extends oe{constructor(e,r,i,a){super(["Call failed:",` Canister: ${e.toText()}`,` Method: ${r} (${i})`,...Object.getOwnPropertyNames(a).map(l=>` "${l}": ${JSON.stringify(a[l])}`)].join(`
21
+ `)),this.canisterId=e,this.methodName=r,this.type=i,this.props=a}},an=class extends Ar{constructor(e,r,i){var a;super(e,r,"query",{Status:i.status,Code:(a=yr[i.reject_code])!==null&&a!==void 0?a:`Unknown Code "${i.reject_code}"`,Message:i.reject_message}),this.result=i}},sn=class extends Ar{constructor(e,r,i,a){super(e,r,"update",Object.assign({"Request ID":Gt(i)},a.body?Object.assign(Object.assign({},a.body.error_code?{"Error code":a.body.error_code}:{}),{"Reject code":String(a.body.reject_code),"Reject message":a.body.reject_message}):{"HTTP status code":a.status.toString(),"HTTP status text":a.statusText})),this.requestId=i,this.response=a}},fn;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(fn||(fn={}));var kt=Symbol.for("ic-agent-metadata"),le=class t{constructor(e){this[kt]=Object.freeze(e)}static agentOf(e){return e[kt].config.agent}static interfaceOf(e){return e[kt].service}static canisterIdOf(e){return ot.from(e[kt].config.canisterId)}static async install(e,r){let i=e.mode===void 0?fn.Install:e.mode,a=e.arg?[...new Uint8Array(e.arg)]:[],l=[...new Uint8Array(e.module)],d=typeof r.canisterId=="string"?ot.fromText(r.canisterId):r.canisterId;await Ei(r).install_code({mode:{[i]:null},arg:a,wasm_module:l,canister_id:d})}static async createCanister(e){let{canister_id:r}=await Ei(e||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(e,r,i){let a=await this.createCanister(i);return await this.install(Object.assign({},r),Object.assign(Object.assign({},i),{canisterId:a})),this.createActor(e,Object.assign(Object.assign({},i),{canisterId:a}))}static createActorClass(e,r){let i=e({IDL:Fe});class a extends t{constructor(d){if(!d.canisterId)throw new oe(`Canister ID is required, but recieved ${typeof d.canisterId} instead. If you are using automatically generated declarations, this may be because your application is not setting the canister ID in process.env correctly.`);let m=typeof d.canisterId=="string"?ot.fromText(d.canisterId):d.canisterId;super({config:Object.assign(Object.assign(Object.assign({},Si),d),{canisterId:m}),service:i});for(let[w,E]of i._fields)r?.httpDetails&&E.annotations.push(cn),this[w]=Aa(this,w,E,d.blsVerify)}}return a}static createActor(e,r){if(!r.canisterId)throw new oe(`Canister ID is required, but recieved ${typeof r.canisterId} instead. If you are using automatically generated declarations, this may be because your application is not setting the canister ID in process.env correctly.`);return new(this.createActorClass(e))(r)}static createActorWithHttpDetails(e,r){return new(this.createActorClass(e,{httpDetails:!0}))(r)}};function vr(t,e){let r=Fe.decode(t,Ti.Buffer.from(e));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var Si={pollingStrategyFactory:br.defaultStrategy},cn="http-details";function Aa(t,e,r,i){let a;r.annotations.includes("query")||r.annotations.includes("composite_query")?a=async(d,...m)=>{var w,E;d=Object.assign(Object.assign({},d),(E=(w=t[kt].config).queryTransform)===null||E===void 0?void 0:E.call(w,e,m,Object.assign(Object.assign({},t[kt].config),d)));let N=d.agent||t[kt].config.agent||nn(),O=ot.from(d.canisterId||t[kt].config.canisterId),X=Fe.encode(r.argTypes,m),D=await N.query(O,{methodName:e,arg:X});switch(D.status){case"rejected":throw new an(O,e,D);case"replied":return r.annotations.includes(cn)?{httpDetails:D.httpDetails,result:vr(r.retTypes,D.reply.arg)}:vr(r.retTypes,D.reply.arg)}}:a=async(d,...m)=>{var w,E;d=Object.assign(Object.assign({},d),(E=(w=t[kt].config).callTransform)===null||E===void 0?void 0:E.call(w,e,m,Object.assign(Object.assign({},t[kt].config),d)));let N=d.agent||t[kt].config.agent||nn(),{canisterId:O,effectiveCanisterId:X,pollingStrategyFactory:D}=Object.assign(Object.assign(Object.assign({},Si),t[kt].config),d),st=ot.from(O),ft=X!==void 0?ot.from(X):st,At=Fe.encode(r.argTypes,m),{requestId:pt,response:Et}=await N.call(st,{methodName:e,arg:At,effectiveCanisterId:ft});if(!Et.ok||Et.body)throw new sn(st,e,pt,Et);let Vt=D(),Nt=await on(N,ft,pt,Vt,i),Bt=r.annotations.includes(cn);if(Nt!==void 0)return Bt?{httpDetails:Et,result:vr(r.retTypes,Nt)}:vr(r.retTypes,Nt);if(r.retTypes.length===0)return Bt?{httpDetails:Et,result:void 0}:void 0;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let l=(...d)=>a({},...d);return l.withOptions=d=>(...m)=>a(d,...m),l}function Ei(t){function e(r,i,a){let l=i[0],d=ot.fromHex("");return l&&typeof l=="object"&&l.canister_id&&(d=ot.from(l.canister_id)),{effectiveCanisterId:d}}return le.createActor(Ai,Object.assign(Object.assign(Object.assign({},t),{canisterId:ot.fromHex("")}),{callTransform:e,queryTransform:e}))}var Ye=me(ln());function ve(t){var e;return new Uint8Array(((e=t.match(/.{1,2}/g))!==null&&e!==void 0?e:[]).map(r=>parseInt(r,16))).buffer}function It(t){return new Uint8Array(t).reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}var Sa=(t,e)=>{if(t.byteLength!==e.byteLength)return!1;let r=new Uint8Array(t),i=new Uint8Array(e);for(let a=0;a<r.length;a++)if(r[a]!==i[a])return!1;return!0},Pi=t=>{if(t<=127)return 1;if(t<=255)return 2;if(t<=65535)return 3;if(t<=16777215)return 4;throw new Error("Length too long (> 4 bytes)")},Ni=(t,e,r)=>{if(r<=127)return t[e]=r,1;if(r<=255)return t[e]=129,t[e+1]=r,2;if(r<=65535)return t[e]=130,t[e+1]=r>>8,t[e+2]=r,3;if(r<=16777215)return t[e]=131,t[e+1]=r>>16,t[e+2]=r>>8,t[e+3]=r,4;throw new Error("Length too long (> 4 bytes)")},un=(t,e)=>{if(t[e]<128)return 1;if(t[e]===128)throw new Error("Invalid length 0");if(t[e]===129)return 2;if(t[e]===130)return 3;if(t[e]===131)return 4;throw new Error("Length too long (> 4 bytes)")},Oa=(t,e)=>{let r=un(t,e);if(r===1)return t[e];if(r===2)return t[e+1];if(r===3)return(t[e+1]<<8)+t[e+2];if(r===4)return(t[e+1]<<16)+(t[e+2]<<8)+t[e+3];throw new Error("Length too long (> 4 bytes)")},Bi=Uint8Array.from([48,12,6,10,43,6,1,4,1,131,184,67,1,1]),Sr=Uint8Array.from([48,5,6,3,43,101,112]),Kf=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function Or(t,e){let r=2+Pi(t.byteLength+1),i=e.byteLength+r+t.byteLength,a=0,l=new Uint8Array(1+Pi(i)+i);return l[a++]=48,a+=Ni(l,a,i),l.set(e,a),a+=e.byteLength,l[a++]=3,a+=Ni(l,a,t.byteLength+1),l[a++]=0,l.set(new Uint8Array(t),a),l}var dn=(t,e)=>{let r=0,i=(m,w)=>{if(a[r++]!==m)throw new Error("Expected: "+w)},a=new Uint8Array(t);if(i(48,"sequence"),r+=un(a,r),!Sa(a.slice(r,r+e.byteLength),e))throw new Error("Not the expected OID.");r+=e.byteLength,i(3,"bit string");let l=Oa(a,r)-1;r+=un(a,r),i(0,"0 padding");let d=a.slice(r);if(l!==d.length)throw new Error(`DER payload mismatch: Expected length ${l} actual length ${d.length}`);return d};var re=class t{constructor(e){this.rawKey=e,this.derKey=t.derEncode(e)}static from(e){return this.fromDer(e.toDer())}static fromRaw(e){return new t(e)}static fromDer(e){return new t(this.derDecode(e))}static derEncode(e){return Or(e,Sr).buffer}static derDecode(e){let r=dn(e,Sr);if(r.length!==this.RAW_KEY_LENGTH)throw new Error("An Ed25519 public key must be exactly 32bytes long");return r}toDer(){return this.derKey}toRaw(){return this.rawKey}};re.RAW_KEY_LENGTH=32;var de=class t extends Zt{constructor(e,r){super(),this._privateKey=r,this._publicKey=re.from(e)}static generate(e){if(e&&e.length!==32)throw new Error("Ed25519 Seed needs to be 32 bytes long.");let{publicKey:r,secretKey:i}=e===void 0?Ye.sign.keyPair():Ye.sign.keyPair.fromSeed(e);return new this(re.fromRaw(r),i)}static fromParsedJson(e){let[r,i]=e;return new t(re.fromDer(ve(r)),ve(i))}static fromJSON(e){let r=JSON.parse(e);if(Array.isArray(r)){if(typeof r[0]=="string"&&typeof r[1]=="string")return this.fromParsedJson([r[0],r[1]]);throw new Error("Deserialization error: JSON must have at least 2 items.")}throw new Error(`Deserialization error: Invalid JSON type for string: ${JSON.stringify(e)}`)}static fromKeyPair(e,r){return new t(re.fromRaw(e),r)}static fromSecretKey(e){let r=Ye.sign.keyPair.fromSecretKey(new Uint8Array(e));return t.fromKeyPair(r.publicKey,r.secretKey)}toJSON(){return[It(this._publicKey.toDer()),It(this._privateKey)]}getKeyPair(){return{secretKey:this._privateKey,publicKey:this._publicKey}}getPublicKey(){return this._publicKey}async sign(e){let r=new Uint8Array(e);return Ye.sign.detached(r,new Uint8Array(this._privateKey)).buffer}};var pn=class t extends Error{constructor(e){super(e),this.message=e,Object.setPrototypeOf(this,t.prototype)}};function Ci(t){if(t)return t;if(typeof crypto<"u"&&crypto.subtle)return crypto.subtle;throw new pn("Global crypto was not available and none was provided. Please inlcude a SubtleCrypto implementation. See https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto")}var qe=class t extends Zt{constructor(e,r,i){super(),this._keyPair=e,this._derKey=r,this._subtleCrypto=i}static async generate(e){let{extractable:r=!1,keyUsages:i=["sign","verify"],subtleCrypto:a}=e??{},l=Ci(a),d=await l.generateKey({name:"ECDSA",namedCurve:"P-256"},r,i),m=await l.exportKey("spki",d.publicKey);return new this(d,m,l)}static async fromKeyPair(e,r){let i=Ci(r),a=await i.exportKey("spki",e.publicKey);return new t(e,a,i)}getKeyPair(){return this._keyPair}getPublicKey(){let e=this._derKey,r=Object.create(this._keyPair.publicKey);return r.toDer=function(){return e},r}async sign(e){let r={name:"ECDSA",hash:{name:"SHA-256"}};return this._keyPair.privateKey,await this._subtleCrypto.sign(r,this._keyPair.privateKey,e)}};var Ae=me(Wn());var Ra=function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(t);a<i.length;a++)e.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(t,i[a])&&(r[i[a]]=t[i[a]]);return r},Ua=new TextEncoder().encode("ic-request-auth-delegation"),Pa=new TextEncoder().encode(`
22
+ ic-request`);function hn(t){if(typeof t!="string"||t.length<64)throw new Error("Invalid public key.");return ve(t)}var Ee=class{constructor(e,r,i){this.pubkey=e,this.expiration=r,this.targets=i}toCBOR(){return Ae.value.map(Object.assign({pubkey:Ae.value.bytes(this.pubkey),expiration:Ae.value.u64(this.expiration.toString(16),16)},this.targets&&{targets:Ae.value.array(this.targets.map(e=>Ae.value.bytes(e.toUint8Array())))}))}toJSON(){return Object.assign({expiration:this.expiration.toString(16),pubkey:It(this.pubkey)},this.targets&&{targets:this.targets.map(e=>e.toHex())})}};async function Na(t,e,r,i){let a=new Ee(e.toDer(),BigInt(+r)*BigInt(1e6),i),l=new Uint8Array([...Ua,...new Uint8Array(ae(a))]),d=await t.sign(l);return{delegation:a,signature:d}}var He=class t{constructor(e,r){this.delegations=e,this.publicKey=r}static async create(e,r,i=new Date(Date.now()+15*60*1e3),a={}){var l,d;let m=await Na(e,r,i,a.targets);return new t([...((l=a.previous)===null||l===void 0?void 0:l.delegations)||[],m],((d=a.previous)===null||d===void 0?void 0:d.publicKey)||e.getPublicKey().toDer())}static fromJSON(e){let{publicKey:r,delegations:i}=typeof e=="string"?JSON.parse(e):e;if(!Array.isArray(i))throw new Error("Invalid delegations.");let a=i.map(l=>{let{delegation:d,signature:m}=l,{pubkey:w,expiration:E,targets:N}=d;if(N!==void 0&&!Array.isArray(N))throw new Error("Invalid targets.");return{delegation:new Ee(hn(w),BigInt(`0x${E}`),N&&N.map(O=>{if(typeof O!="string")throw new Error("Invalid target.");return ot.fromHex(O)})),signature:hn(m)}});return new this(a,hn(r))}static fromDelegations(e,r){return new this(e,r)}toJSON(){return{delegations:this.delegations.map(e=>{let{delegation:r,signature:i}=e,{targets:a}=r;return{delegation:Object.assign({expiration:r.expiration.toString(16),pubkey:It(r.pubkey)},a&&{targets:a.map(l=>l.toHex())}),signature:It(i)}}),publicKey:It(this.publicKey)}}},$e=class extends Zt{constructor(e,r){super(),this._inner=e,this._delegation=r}static fromDelegation(e,r){return new this(e,r)}getDelegation(){return this._delegation}getPublicKey(){return{toDer:()=>this._delegation.publicKey}}sign(e){return this._inner.sign(e)}async transformRequest(e){let{body:r}=e,i=Ra(e,["body"]),a=await ae(r);return Object.assign(Object.assign({},i),{body:{content:r,sender_sig:await this.sign(new Uint8Array([...Pa,...new Uint8Array(a)])),sender_delegation:this._delegation.delegations,sender_pubkey:this._delegation.publicKey}})}};function Fi(t,e){for(let{delegation:a}of t.delegations)if(+new Date(Number(a.expiration/BigInt(1e6)))<=+Date.now())return!1;let r=[],i=e?.scope;i&&(Array.isArray(i)?r.push(...i.map(a=>typeof a=="string"?ot.fromText(a):a)):r.push(typeof i=="string"?ot.fromText(i):i));for(let a of r){let l=a.toText();for(let{delegation:d}of t.delegations){if(d.targets===void 0)continue;let m=!0;for(let w of d.targets)if(w.toText()===l){m=!1;break}if(m)return!1}}return!0}var Ba=me(Oo()),Ca=me(ln());var ki;(function(t){t[t.ECDSA_WITH_SHA256=-7]="ECDSA_WITH_SHA256"})(ki||(ki={}));var ji=["mousedown","mousemove","keydown","touchstart","wheel"],We=class{constructor(e={}){var r;this.callbacks=[],this.idleTimeout=10*60*1e3,this.timeoutID=void 0;let{onIdle:i,idleTimeout:a=10*60*1e3}=e||{};this.callbacks=i?[i]:[],this.idleTimeout=a;let l=this._resetTimer.bind(this);window.addEventListener("load",l,!0),ji.forEach(function(m){document.addEventListener(m,l,!0)});let d=(m,w)=>{let E;return(...N)=>{let O=this,X=function(){E=void 0,m.apply(O,N)};clearTimeout(E),E=window.setTimeout(X,w)}};if(e?.captureScroll){let m=d(l,(r=e?.scrollDebounce)!==null&&r!==void 0?r:100);window.addEventListener("scroll",m,!0)}l()}static create(e={}){return new this(e)}registerCallback(e){this.callbacks.push(e)}exit(){clearTimeout(this.timeoutID),window.removeEventListener("load",this._resetTimer,!0);let e=this._resetTimer.bind(this);ji.forEach(function(r){document.removeEventListener(r,e,!0)}),this.callbacks.forEach(r=>r())}_resetTimer(){let e=this.exit.bind(this);window.clearTimeout(this.timeoutID),this.timeoutID=window.setTimeout(e,this.idleTimeout)}};var Fa=(t,e)=>e.some(r=>t instanceof r),Ki,Mi;function ka(){return Ki||(Ki=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ja(){return Mi||(Mi=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Vi=new WeakMap,yn=new WeakMap,Yi=new WeakMap,xn=new WeakMap,wn=new WeakMap;function Ka(t){let e=new Promise((r,i)=>{let a=()=>{t.removeEventListener("success",l),t.removeEventListener("error",d)},l=()=>{r($t(t.result)),a()},d=()=>{i(t.error),a()};t.addEventListener("success",l),t.addEventListener("error",d)});return e.then(r=>{r instanceof IDBCursor&&Vi.set(r,t)}).catch(()=>{}),wn.set(e,t),e}function Ma(t){if(yn.has(t))return;let e=new Promise((r,i)=>{let a=()=>{t.removeEventListener("complete",l),t.removeEventListener("error",d),t.removeEventListener("abort",d)},l=()=>{r(),a()},d=()=>{i(t.error||new DOMException("AbortError","AbortError")),a()};t.addEventListener("complete",l),t.addEventListener("error",d),t.addEventListener("abort",d)});yn.set(t,e)}var mn={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return yn.get(t);if(e==="objectStoreNames")return t.objectStoreNames||Yi.get(t);if(e==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return $t(t[e])},set(t,e,r){return t[e]=r,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function qi(t){mn=t(mn)}function Va(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let i=t.call(Rr(this),e,...r);return Yi.set(i,e.sort?e.sort():[e]),$t(i)}:ja().includes(t)?function(...e){return t.apply(Rr(this),e),$t(Vi.get(this))}:function(...e){return $t(t.apply(Rr(this),e))}}function Ya(t){return typeof t=="function"?Va(t):(t instanceof IDBTransaction&&Ma(t),Fa(t,ka())?new Proxy(t,mn):t)}function $t(t){if(t instanceof IDBRequest)return Ka(t);if(xn.has(t))return xn.get(t);let e=Ya(t);return e!==t&&(xn.set(t,e),wn.set(e,t)),e}var Rr=t=>wn.get(t);function $i(t,e,{blocked:r,upgrade:i,blocking:a,terminated:l}={}){let d=indexedDB.open(t,e),m=$t(d);return i&&d.addEventListener("upgradeneeded",w=>{i($t(d.result),w.oldVersion,w.newVersion,$t(d.transaction),w)}),r&&d.addEventListener("blocked",w=>r(w.oldVersion,w.newVersion,w)),m.then(w=>{l&&w.addEventListener("close",()=>l()),a&&w.addEventListener("versionchange",E=>a(E.oldVersion,E.newVersion,E))}).catch(()=>{}),m}var qa=["get","getKey","getAll","getAllKeys","count"],Ha=["put","add","delete","clear"],gn=new Map;function Hi(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(gn.get(e))return gn.get(e);let r=e.replace(/FromIndex$/,""),i=e!==r,a=Ha.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!(a||qa.includes(r)))return;let l=async function(d,...m){let w=this.transaction(d,a?"readwrite":"readonly"),E=w.store;return i&&(E=E.index(m.shift())),(await Promise.all([E[r](...m),a&&w.done]))[0]};return gn.set(e,l),l}qi(t=>({...t,get:(e,r,i)=>Hi(e,r)||t.get(e,r,i),has:(e,r)=>!!Hi(e,r)||t.has(e,r)}));var Wi="auth-client-db",zi="ic-keyval",$a=async(t=Wi,e=zi,r)=>(Ur&&(localStorage!=null&&localStorage.getItem(Kt))&&(localStorage.removeItem(Kt),localStorage.removeItem(Mt)),await $i(t,r,{upgrade:i=>{i.objectStoreNames,i.objectStoreNames.contains(e)&&i.clear(e),i.createObjectStore(e)}}));async function Wa(t,e,r){return await t.get(e,r)}async function za(t,e,r,i){return await t.put(e,i,r)}async function Ga(t,e,r){return await t.delete(e,r)}var ze=class t{constructor(e,r){this._db=e,this._storeName=r}static async create(e){let{dbName:r=Wi,storeName:i=zi,version:a=1}=e??{},l=await $a(r,i,a);return new t(l,i)}async set(e,r){return await za(this._db,this._storeName,e,r)}async get(e){var r;return(r=await Wa(this._db,this._storeName,e))!==null&&r!==void 0?r:null}async remove(e){return await Ga(this._db,this._storeName,e)}};var Mt="identity",Kt="delegation",Gi="iv",Ja=1,Ur=typeof window<"u",Ge=class{constructor(e="ic-",r){this.prefix=e,this._localStorage=r}get(e){return Promise.resolve(this._getLocalStorage().getItem(this.prefix+e))}set(e,r){return this._getLocalStorage().setItem(this.prefix+e,r),Promise.resolve()}remove(e){return this._getLocalStorage().removeItem(this.prefix+e),Promise.resolve()}_getLocalStorage(){if(this._localStorage)return this._localStorage;let e=typeof window>"u"?typeof globalThis>"u"?typeof self>"u"?void 0:self.localStorage:globalThis.localStorage:window.localStorage;if(!e)throw new Error("Could not find local storage.");return e}},Je=class{get _db(){return new Promise(e=>{if(this.initializedDb){e(this.initializedDb);return}ze.create({version:Ja}).then(r=>{this.initializedDb=r,e(r)})})}async get(e){return await(await this._db).get(e)}async set(e,r){await(await this._db).set(e,r)}async remove(e){await(await this._db).remove(e)}};var Xa="https://identity.ic0.app",Za="#authorize",_n="ECDSA",bn="Ed25519",Qa=500,Ia="UserInterrupt",Pr=class{constructor(e,r,i,a,l,d,m,w){var E;this._identity=e,this._key=r,this._chain=i,this._storage=a,this.idleManager=l,this._createOptions=d,this._idpWindow=m,this._eventHandler=w;let N=this.logout.bind(this),O=d?.idleOptions;!O?.onIdle&&!O?.disableDefaultIdleCallback&&((E=this.idleManager)===null||E===void 0||E.registerCallback(()=>{N(),location.reload()}))}static async create(e={}){var r,i,a;let l=(r=e.storage)!==null&&r!==void 0?r:new Je,d=(i=e.keyType)!==null&&i!==void 0?i:_n,m=null;if(e.identity)m=e.identity;else{let O=await l.get(Mt);if(!O&&Ur)try{let X=new Ge,D=await X.get(Kt),st=await X.get(Mt);D&&st&&d===_n&&(console.log("Discovered an identity stored in localstorage. Migrating to IndexedDB"),await l.set(Kt,D),await l.set(Mt,st),O=D,await X.remove(Kt),await X.remove(Mt))}catch(X){console.error("error while attempting to recover localstorage: "+X)}if(O)try{typeof O=="object"?d===bn&&typeof O=="string"?m=await de.fromJSON(O):m=await qe.fromKeyPair(O):typeof O=="string"&&(m=de.fromJSON(O))}catch{}}let w=new Qt,E=null;if(m)try{let O=await l.get(Kt);if(typeof O=="object"&&O!==null)throw new Error("Delegation chain is incorrectly stored. A delegation chain should be stored as a string.");e.identity?w=e.identity:O&&(E=He.fromJSON(O),Fi(E)?w=$e.fromDelegation(m,E):(await vn(l),m=null))}catch(O){console.error(O),await vn(l),m=null}let N;return!((a=e.idleOptions)===null||a===void 0)&&a.disableIdle?N=void 0:(E||e.identity)&&(N=We.create(e.idleOptions)),m||(d===bn?(m=await de.generate(),await l.set(Mt,JSON.stringify(m.toJSON()))):(e.storage&&d===_n&&console.warn(`You are using a custom storage provider that may not support CryptoKey storage. If you are using a custom storage provider that does not support CryptoKey storage, you should use '${bn}' as the key type, as it can serialize to a string`),m=await qe.generate(),await l.set(Mt,m.getKeyPair()))),new this(w,m,E,l,N,e)}async _handleSuccess(e,r){var i,a,l;let d=e.delegations.map(E=>({delegation:new Ee(E.delegation.pubkey,E.delegation.expiration,E.delegation.targets),signature:E.signature.buffer})),m=He.fromDelegations(d,e.userPublicKey.buffer),w=this._key;if(w){if(this._chain=m,this._identity=$e.fromDelegation(w,this._chain),(i=this._idpWindow)===null||i===void 0||i.close(),!this.idleManager){let E=(a=this._createOptions)===null||a===void 0?void 0:a.idleOptions;this.idleManager=We.create(E),!E?.onIdle&&!E?.disableDefaultIdleCallback&&((l=this.idleManager)===null||l===void 0||l.registerCallback(()=>{this.logout(),location.reload()}))}this._removeEventListener(),delete this._idpWindow,this._chain&&await this._storage.set(Kt,JSON.stringify(this._chain.toJSON())),r?.()}}getIdentity(){return this._identity}async isAuthenticated(){return!this.getIdentity().getPrincipal().isAnonymous()&&this._chain!==null}async login(e){var r,i,a,l;let d=BigInt(8)*BigInt(36e11),m=new URL(((r=e?.identityProvider)===null||r===void 0?void 0:r.toString())||Xa);m.hash=Za,(i=this._idpWindow)===null||i===void 0||i.close(),this._removeEventListener(),this._eventHandler=this._getEventHandler(m,Object.assign({maxTimeToLive:(a=e?.maxTimeToLive)!==null&&a!==void 0?a:d},e)),window.addEventListener("message",this._eventHandler),this._idpWindow=(l=window.open(m.toString(),"idpWindow",e?.windowOpenerFeatures))!==null&&l!==void 0?l:void 0;let w=()=>{this._idpWindow&&(this._idpWindow.closed?this._handleFailure(Ia,e?.onError):setTimeout(w,Qa))};w()}_getEventHandler(e,r){return async i=>{var a,l,d;if(i.origin!==e.origin){console.warn(`WARNING: expected origin '${e.origin}', got '${i.origin}' (ignoring)`);return}let m=i.data;switch(m.kind){case"authorize-ready":{let w={kind:"authorize-client",sessionPublicKey:new Uint8Array((a=this._key)===null||a===void 0?void 0:a.getPublicKey().toDer()),maxTimeToLive:r?.maxTimeToLive,derivationOrigin:(l=r?.derivationOrigin)===null||l===void 0?void 0:l.toString()};(d=this._idpWindow)===null||d===void 0||d.postMessage(w,e.origin);break}case"authorize-client-success":try{await this._handleSuccess(m,r?.onSuccess)}catch(w){this._handleFailure(w.message,r?.onError)}break;case"authorize-client-failure":this._handleFailure(m.text,r?.onError);break;default:break}}}_handleFailure(e,r){var i;(i=this._idpWindow)===null||i===void 0||i.close(),r?.(e),this._removeEventListener(),delete this._idpWindow}_removeEventListener(){this._eventHandler&&window.removeEventListener("message",this._eventHandler),this._eventHandler=void 0}async logout(e={}){if(await vn(this._storage),this._identity=new Qt,this._chain=null,e.returnTo)try{window.history.pushState({},"",e.returnTo)}catch{window.location.href=e.returnTo}}};async function vn(t){await t.remove(Mt),await t.remove(Kt),await t.remove(Gi)}var Nr=()=>Pr.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}});var Ji=async({data:t})=>{try{return await lr(t)}catch(e){console.error("The data parsing has failed, mapping to undefined as a fallback.",e);return}};var An=async t=>{let{data:e,updated_at:r,description:i}=t;return{description:mt(i),data:await Gn(e),updated_at:mt(r)}},En=t=>{let{updated_at:e}=t;return{updated_at:mt(e)}},Xe=async({doc:t,key:e})=>{let{owner:r,description:i,data:a,...l}=t;return{key:e,description:Tt(i),owner:r.toText(),data:await lr(a),...l}};var Br=({matcher:t,paginate:e,order:r,owner:i})=>({matcher:yt(t)?[]:[{key:mt(t.key),description:mt(t.description)}],paginate:mt(yt(e)?void 0:{start_after:mt(e.startAfter),limit:mt(yt(e.limit)?void 0:BigInt(e.limit))}),order:mt(yt(r)?void 0:{desc:r.desc,field:r.field==="created_at"?{CreatedAt:null}:r.field==="updated_at"?{UpdatedAt:null}:{Keys:null}}),owner:mt(yt(i)?void 0:typeof i=="string"?ot.fromText(i):i)});var Xi=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),i=t.Variant({Write:t.Null,Admin:t.Null}),a=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:i,expires_at:t.Opt(t.Nat64)}),l=t.Record({updated_at:t.Opt(t.Nat64)}),d=t.Variant({Db:t.Null,Storage:t.Null}),m=t.Record({cycles:t.Nat,destination_id:t.Principal}),w=t.Variant({Deny:t.Null,AllowAny:t.Null,SameOrigin:t.Null}),E=t.Record({status_code:t.Nat16,location:t.Text}),N=t.Record({iframe:t.Opt(w),rewrites:t.Vec(t.Tuple(t.Text,t.Text)),headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text)))),redirects:t.Opt(t.Vec(t.Tuple(t.Text,E)))}),O=t.Record({storage:N}),X=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),description:t.Opt(t.Text),created_at:t.Nat64}),D=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),certificate_version:t.Opt(t.Nat16)}),st=t.Variant({Heap:t.Null,Stable:t.Null}),ft=t.Record({memory:st,token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),At=t.Variant({Callback:t.Record({token:ft,callback:t.Func([],[],["query"])})}),pt=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(At),status_code:t.Nat16}),Et=t.Record({token:t.Opt(ft),body:t.Vec(t.Nat8)}),Vt=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,description:t.Opt(t.Text),encoding_type:t.Opt(t.Text),full_path:t.Text}),Nt=t.Record({batch_id:t.Nat}),Bt=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),Ze=t.Record({field:Bt,desc:t.Bool}),Qe=t.Record({key:t.Opt(t.Text),description:t.Opt(t.Text)}),Ie=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),pe=t.Record({order:t.Opt(Ze),owner:t.Opt(t.Principal),matcher:t.Opt(Qe),paginate:t.Opt(Ie)}),he=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,description:t.Opt(t.Text),full_path:t.Text}),Te=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),De=t.Record({key:he,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,Te)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),Se=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,De)),items_length:t.Nat64}),Oe=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),jt=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,X)),items_length:t.Nat64}),Dt=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),Lt=t.Record({memory:t.Opt(st),updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:Dt,created_at:t.Nat64,mutable_permissions:t.Opt(t.Bool),write:Dt}),te=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:i,expires_at:t.Opt(t.Nat64)}),Le=t.Record({controller:te,controllers:t.Vec(t.Principal)}),Re=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8),description:t.Opt(t.Text)}),Ue=t.Record({memory:t.Opt(st),updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:Dt,mutable_permissions:t.Opt(t.Bool),write:Dt}),Rt=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),Ut=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Text],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,a))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,l],[],[]),del_docs:t.Func([t.Text],[],[]),del_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),del_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,l))],[],[]),del_rule:t.Func([d,t.Text,l],[],[]),deposit_cycles:t.Func([m],[],[]),get_config:t.Func([],[O],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(X)],["query"]),get_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(X)))],["query"]),http_request:t.Func([D],[pt],["query"]),http_request_streaming_callback:t.Func([ft],[Et],["query"]),init_asset_upload:t.Func([Vt],[Nt],[]),list_assets:t.Func([t.Text,pe],[Se],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,a))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,Oe))],["query"]),list_docs:t.Func([t.Text,pe],[jt],["query"]),list_rules:t.Func([d],[t.Vec(t.Tuple(t.Text,Lt))],["query"]),set_config:t.Func([O],[],[]),set_controllers:t.Func([Le],[t.Vec(t.Tuple(t.Principal,a))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,Re],[X],[]),set_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,Re))],[t.Vec(t.Tuple(t.Text,X))],[]),set_rule:t.Func([d,t.Text,Ue],[],[]),upload_asset_chunk:t.Func([Rt],[Ut],[]),version:t.Func([],[t.Text],["query"])})};var Zi=async({satelliteId:t,idlFactory:e,identity:r,fetch:i,env:a="prod"})=>{let l=a==="dev"||St.getInstance().localIdentity(),d=l?"http://127.0.0.1:8000/":"https://icp-api.io",m=new Ve({identity:r,...d&&{host:d},...i&&{fetch:i}});return l&&await m.fetchRootKey(),le.createActor(e,{agent:m,canisterId:t})};var bt=async({satelliteId:t,...e})=>{let{satelliteId:r}=t!==void 0?{satelliteId:t}:St.getInstance().get()??{satelliteId:void 0};if(!r)throw new Error("No satellite principal defined.");return Zi({satelliteId:r,idlFactory:Xi,...e})};var Qi=async({collection:t,key:e,satellite:r})=>{let i=await bt(r),a=Tt(await i.get_doc(t,e));if(!yt(a))return Xe({doc:a,key:e})},Ii=async({docs:t,satellite:e})=>{let{get_many_docs:r}=await bt(e),i=t.map(({collection:d,key:m})=>[d,m]),a=await r(i),l=[];for(let[d,m]of a){let w=Tt(m);l.push(ee(w)?await Xe({key:d,doc:w}):void 0)}return l},Di=async({collection:t,doc:e,satellite:r})=>{let{set_doc:i}=await bt(r),{key:a}=e,l=await An(e),d=await i(t,a,l);return await Xe({key:a,doc:d})},Li=async({docs:t,satellite:e})=>{let{set_many_docs:r}=await bt(e),i=[];for(let{collection:d,doc:m}of t){let{key:w}=m;i.push([d,w,await An(m)])}let a=await r(i),l=[];for(let[d,m]of a)l.push(await Xe({key:d,doc:m}));return l},to=async({collection:t,doc:e,satellite:r})=>{let{del_doc:i}=await bt(r),{key:a}=e;return i(t,a,En(e))},eo=async({collection:t,satellite:e})=>{let{del_docs:r}=await bt(e);return r(t)},ro=async({docs:t,satellite:e})=>{let{del_many_docs:r}=await bt(e),i=t.map(({collection:a,doc:l})=>[a,l.key,En(l)]);await r(i)},no=async({collection:t,filter:e,satellite:r})=>{let i=await bt(r),{items:a,items_page:l,items_length:d,matches_length:m,matches_pages:w}=await i.list_docs(t,Br(e)),E=[];for(let[N,O]of a){let{data:X,owner:D,description:st,...ft}=O;E.push({key:N,description:Tt(st),owner:D.toText(),data:await Ji({data:X}),...ft})}return{items:E,items_length:d,items_page:Tt(l),matches_length:m,matches_pages:Tt(w)}};var vt=t=>t!==void 0?t:Cr()??new Qt;var io=async({satellite:t,...e})=>{let r=vt(t?.identity);return Qi({...e,satellite:{...t,identity:r}})},Dc=async({satellite:t,...e})=>{let r=vt(t?.identity);return Ii({...e,satellite:{...t,identity:r}})},oo=async({satellite:t,...e})=>{let r=vt(t?.identity);return Di({...e,satellite:{...t,identity:r}})},Lc=async({satellite:t,...e})=>{let r=vt(t?.identity);return Li({...e,satellite:{...t,identity:r}})},t0=async({satellite:t,...e})=>{let r=vt(t?.identity);return to({...e,satellite:{...t,identity:r}})},e0=async({collection:t,satellite:e})=>eo({collection:t,satellite:{...e,identity:vt(e?.identity)}}),r0=async({satellite:t,...e})=>{let r=vt(t?.identity);return ro({...e,satellite:{...t,identity:r}})},n0=async({satellite:t,filter:e,...r})=>{let i=vt(t?.identity);return no({...r,filter:e??{},satellite:{...t,identity:i}})};var ao=async t=>{let e=Cr();if(yt(e))throw new Error("No identity to initialize the user. Have you initialized Juno?");let r=e.getPrincipal().toText(),i=await io({collection:"#user",key:r});return yt(i)?await Da({userId:r,provider:t}):i},Da=async({userId:t,...e})=>oo({collection:"#user",doc:{key:t,data:e}});var Wt,Tn=async t=>{if(Wt=Wt??await Nr(),!(await Wt?.isAuthenticated()??!1))return;let r=await ao(t);Jt.getInstance().set(r)},La=async t=>new Promise(async(e,r)=>{Wt=Wt??await Nr();let i=t?.provider??new dr({});await Wt.login({onSuccess:async()=>{await Tn(i.id),e()},onError:a=>r(a),maxTimeToLive:t?.maxTimeToLive??Jn,...t?.derivationOrigin!==void 0&&{derivationOrigin:t.derivationOrigin},...i.signInOptions({windowed:t?.windowed})})}),Sn=async()=>{await Wt?.logout(),Wt=void 0,Jt.getInstance().reset()},Cr=()=>Wt?.getIdentity(),ts=async()=>(Wt??await Nr()).getIdentity();var so=t=>{let e=t===!0?"./workers/auth.worker.js":t,r=new Worker(e),i=async()=>{Jr({message:"junoSignOutAuthTimer"}),await Sn()};return r.onmessage=async({data:a})=>{let{msg:l,data:d}=a;switch(l){case"junoSignOutAuthTimer":await i();return;case"junoDelegationRemainingTime":Jr({message:"junoDelegationRemainingTime",detail:d?.authRemainingTime});return}},Jt.getInstance().subscribe(a=>{if(yt(a)){r.postMessage({msg:"junoStopAuthTimer"});return}r.postMessage({msg:"junoStartAuthTimer"})})};var fo=async({data:t,filename:e,collection:r,headers:i,token:a,fullPath:l,encoding:d,description:m,satellite:w})=>{let E=await bt(w),{batch_id:N}=await E.init_asset_upload({collection:r,full_path:l,name:e,token:mt(a),encoding_type:mt(d),description:mt(m)}),O=19e5,X=[],D=ur()?new Blob([await t.arrayBuffer()]):t,st=0n;for(let pt=0;pt<D.size;pt+=O){let Et=D.slice(pt,pt+O);X.push({batchId:N,chunk:Et,actor:E,orderId:st}),st++}let ft=[];for await(let pt of es({uploadChunks:X}))ft=[...ft,...pt];let At=i.find(([pt,Et])=>pt.toLowerCase()==="content-type")===void 0&&t.type!==void 0&&t.type!==""?[["Content-Type",t.type]]:void 0;await E.commit_asset_upload({batch_id:N,chunk_ids:ft.map(({chunk_id:pt})=>pt),headers:[...i,...At||[]]})};async function*es({uploadChunks:t,limit:e=12}){for(let r=0;r<t.length;r=r+e){let i=t.slice(r,r+e);yield await Promise.all(i.map(l=>rs(l)))}}var rs=async({batchId:t,chunk:e,actor:r,orderId:i})=>r.upload_asset_chunk({batch_id:t,content:new Uint8Array(await e.arrayBuffer()),order_id:mt(i)}),co=async({collection:t,satellite:e,filter:r})=>{let i=await bt(e),{items:a,items_length:l,items_page:d,matches_length:m,matches_pages:w}=await i.list_assets(t,Br(r));return{items:a.map(([E,N])=>N),items_length:l,items_page:Tt(d),matches_length:m,matches_pages:Tt(w)}},lo=async({collection:t,fullPath:e,satellite:r})=>(await bt(r)).del_asset(t,e),uo=async({collection:t,satellite:e})=>(await bt(e)).del_assets(t),po=async({assets:t,satellite:e})=>{let{del_many_assets:r}=await bt(e),i=t.map(({collection:a,fullPath:l})=>[a,l]);await r(i)};var ho=t=>btoa([...t].map(e=>String.fromCharCode(e)).join(""));var On=()=>{let t=St.getInstance().get()?.satelliteId??"unknown";return St.getInstance().localIdentity()?`http://${t}.localhost:8000`:`https://${t}.icp0.io`};var xo=t=>encodeURI(t.toLowerCase().replace(/\s/g,"-"));var F0=async t=>yo(t),k0=async t=>yo({filename:t.data.name,...t}),yo=async({filename:t,data:e,collection:r,headers:i=[],fullPath:a,token:l,satellite:d,encoding:m,description:w})=>{let E=vt(d?.identity),N=xo(t),O=a??`/${r}/${N}`;return await fo({data:e,filename:N,collection:r,token:l,headers:i,fullPath:O,encoding:m,satellite:{...d,identity:E},description:w}),{downloadUrl:`${On()}${O}${l!==void 0?`?token=${l}`:""}`,fullPath:O,name:N}},j0=async({collection:t,satellite:e,filter:r})=>{let{items:i,...a}=await co({collection:t,satellite:{...e,identity:vt(e?.identity)},filter:r??{}}),l=On();return{assets:i.map(({key:{full_path:d,token:m,name:w,owner:E,description:N},headers:O,encodings:X,created_at:D,updated_at:st})=>{let ft=Tt(m);return{fullPath:d,description:Tt(N),name:w,downloadUrl:`${l}${d}${ft!==void 0?`?token=${ft}`:""}`,token:ft,headers:O,encodings:X.reduce((At,[pt,{modified:Et,sha256:Vt,total_length:Nt}])=>({...At,[pt]:{modified:Et,sha256:ho(Vt),total_length:Nt}}),{}),owner:E.toText(),created_at:D,updated_at:st}}),...a}},K0=async({collection:t,fullPath:e,satellite:r})=>lo({collection:t,fullPath:e,satellite:{...r,identity:vt(r?.identity)}}),M0=async({collection:t,satellite:e})=>uo({collection:t,satellite:{...e,identity:vt(e?.identity)}}),V0=async({assets:t,satellite:e})=>po({assets:t,satellite:{...e,identity:vt(e?.identity)}});var z0=async t=>{St.getInstance().set(t),await Tn();let e=t.workers?.auth!==void 0?so(t.workers.auth):void 0;return[...e?[e]:[]]},G0=t=>Jt.getInstance().subscribe(t);export{dr as InternetIdentityProvider,In as NFIDProvider,G0 as authSubscribe,K0 as deleteAsset,M0 as deleteAssets,t0 as deleteDoc,e0 as deleteDocs,V0 as deleteManyAssets,r0 as deleteManyDocs,io as getDoc,Dc as getManyDocs,z0 as initJuno,j0 as listAssets,n0 as listDocs,oo as setDoc,Lc as setManyDocs,La as signIn,Sn as signOut,ts as unsafeIdentity,F0 as uploadBlob,k0 as uploadFile};
23
23
  /*! Bundled license information:
24
24
 
25
25
  buffer/index.js: