@junobuild/core 0.0.32 → 0.0.33

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.
Files changed (91) hide show
  1. package/README.md +1 -1
  2. package/{dist/declarations/mission_control/mission_control.did.d.ts → declarations/deprecated/mission_control-0-0-4.did.d.ts} +2 -23
  3. package/declarations/{mission_control/mission_control.factory.did.js → deprecated/mission_control-0-0-4.factory.did.js} +2 -39
  4. package/declarations/deprecated/satellite-0-0-8.did.d.ts +183 -0
  5. package/declarations/deprecated/satellite-0-0-8.factory.did.js +194 -0
  6. package/declarations/deprecated/satellite-0-0-9.did.d.ts +199 -0
  7. package/declarations/deprecated/satellite-0-0-9.factory.did.js +213 -0
  8. package/declarations/satellite/satellite.did.d.ts +6 -0
  9. package/declarations/satellite/satellite.factory.did.js +6 -0
  10. package/declarations/satellite/satellite.factory.did.mjs +6 -0
  11. package/dist/browser/canisterStatus-S2QRROEO.js +2 -0
  12. package/dist/browser/chunk-IRYD4AKF.js +28 -0
  13. package/dist/browser/{chunk-PPPG6IG5.js.map → chunk-IRYD4AKF.js.map} +2 -2
  14. package/dist/browser/index.js +14 -14
  15. package/dist/browser/index.js.map +3 -3
  16. package/{declarations/mission_control/mission_control.did.d.ts → dist/declarations/deprecated/mission_control-0-0-4.did.d.ts} +2 -23
  17. package/dist/declarations/{mission_control/mission_control.factory.did.js → deprecated/mission_control-0-0-4.factory.did.js} +2 -39
  18. package/dist/declarations/deprecated/satellite-0-0-8.did.d.ts +183 -0
  19. package/dist/declarations/deprecated/satellite-0-0-8.factory.did.js +194 -0
  20. package/dist/declarations/deprecated/satellite-0-0-9.did.d.ts +199 -0
  21. package/dist/declarations/deprecated/satellite-0-0-9.factory.did.js +213 -0
  22. package/dist/declarations/satellite/satellite.did.d.ts +6 -0
  23. package/dist/declarations/satellite/satellite.factory.did.js +6 -0
  24. package/dist/declarations/satellite/satellite.factory.did.mjs +6 -0
  25. package/dist/node/index.mjs +23 -23
  26. package/dist/node/index.mjs.map +3 -3
  27. package/dist/workers/auth.worker.js +6 -6
  28. package/dist/workers/auth.worker.js.gz +0 -0
  29. package/dist/workers/auth.worker.js.map +2 -2
  30. package/package.json +3 -3
  31. package/declarations/cmc/cmc.did +0 -122
  32. package/declarations/cmc/cmc.did.d.ts +0 -48
  33. package/declarations/cmc/cmc.factory.did.js +0 -67
  34. package/declarations/cmc/index.d.ts +0 -45
  35. package/declarations/cmc/index.js +0 -37
  36. package/declarations/console/console.did.d.ts +0 -71
  37. package/declarations/console/console.factory.did.js +0 -79
  38. package/declarations/console/console.factory.did.mjs +0 -79
  39. package/declarations/console/index.d.ts +0 -45
  40. package/declarations/console/index.js +0 -37
  41. package/declarations/ic/ic.did +0 -195
  42. package/declarations/ic/ic.did.d.ts +0 -208
  43. package/declarations/ic/ic.factory.did.js +0 -274
  44. package/declarations/index/index.d.ts +0 -45
  45. package/declarations/index/index.did +0 -68
  46. package/declarations/index/index.did.d.ts +0 -97
  47. package/declarations/index/index.factory.did.js +0 -94
  48. package/declarations/index/index.js +0 -37
  49. package/declarations/mission_control/index.d.ts +0 -45
  50. package/declarations/mission_control/index.js +0 -38
  51. package/declarations/observatory/index.d.ts +0 -45
  52. package/declarations/observatory/index.js +0 -38
  53. package/declarations/observatory/observatory.did.d.ts +0 -86
  54. package/declarations/observatory/observatory.factory.did.js +0 -95
  55. package/declarations/observatory/observatory.factory.did.mjs +0 -95
  56. package/declarations/orbiter/index.d.ts +0 -45
  57. package/declarations/orbiter/index.js +0 -37
  58. package/declarations/orbiter/orbiter.did.d.ts +0 -108
  59. package/declarations/orbiter/orbiter.factory.did.js +0 -137
  60. package/dist/browser/canisterStatus-B3CYYH7Z.js +0 -2
  61. package/dist/browser/chunk-PPPG6IG5.js +0 -28
  62. package/dist/declarations/cmc/cmc.did +0 -122
  63. package/dist/declarations/cmc/cmc.did.d.ts +0 -48
  64. package/dist/declarations/cmc/cmc.factory.did.js +0 -67
  65. package/dist/declarations/cmc/index.d.ts +0 -45
  66. package/dist/declarations/cmc/index.js +0 -37
  67. package/dist/declarations/console/console.did.d.ts +0 -71
  68. package/dist/declarations/console/console.factory.did.js +0 -79
  69. package/dist/declarations/console/console.factory.did.mjs +0 -79
  70. package/dist/declarations/console/index.d.ts +0 -45
  71. package/dist/declarations/console/index.js +0 -37
  72. package/dist/declarations/ic/ic.did +0 -195
  73. package/dist/declarations/ic/ic.did.d.ts +0 -208
  74. package/dist/declarations/ic/ic.factory.did.js +0 -274
  75. package/dist/declarations/index/index.d.ts +0 -45
  76. package/dist/declarations/index/index.did +0 -68
  77. package/dist/declarations/index/index.did.d.ts +0 -97
  78. package/dist/declarations/index/index.factory.did.js +0 -94
  79. package/dist/declarations/index/index.js +0 -37
  80. package/dist/declarations/mission_control/index.d.ts +0 -45
  81. package/dist/declarations/mission_control/index.js +0 -38
  82. package/dist/declarations/observatory/index.d.ts +0 -45
  83. package/dist/declarations/observatory/index.js +0 -38
  84. package/dist/declarations/observatory/observatory.did.d.ts +0 -86
  85. package/dist/declarations/observatory/observatory.factory.did.js +0 -95
  86. package/dist/declarations/observatory/observatory.factory.did.mjs +0 -95
  87. package/dist/declarations/orbiter/index.d.ts +0 -45
  88. package/dist/declarations/orbiter/index.js +0 -37
  89. package/dist/declarations/orbiter/orbiter.did.d.ts +0 -108
  90. package/dist/declarations/orbiter/orbiter.factory.did.js +0 -137
  91. /package/dist/browser/{canisterStatus-B3CYYH7Z.js.map → canisterStatus-S2QRROEO.js.map} +0 -0
@@ -1,25 +1,25 @@
1
- import{a as kn,b as xo,c as sr,d as jn,e as we,f as yo,g as fr,h as mo,i as ot,j as Ke,k as Kn,l as Me,m as wo,n as Mn,o as Xt,p as Vn,q as ae,r as Yn,s as cr,t as Ve,u as qn}from"./chunk-PPPG6IG5.js";var Dn=sr(dr=>{"use strict";dr.byteLength=bo;dr.toByteArray=Eo;dr.fromByteArray=So;var qt=[],Bt=[],_o=typeof Uint8Array<"u"?Uint8Array:Array,zr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(se=0,Zn=zr.length;se<Zn;++se)qt[se]=zr[se],Bt[zr.charCodeAt(se)]=se;var se,Zn;Bt["-".charCodeAt(0)]=62;Bt["_".charCodeAt(0)]=63;function Qn(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var i=r===t?0:4-r%4;return[r,i]}function bo(e){var t=Qn(e),r=t[0],i=t[1];return(r+i)*3/4-i}function vo(e,t,r){return(t+r)*3/4-r}function Eo(e){var t,r=Qn(e),i=r[0],a=r[1],u=new _o(vo(e,i,a)),d=0,m=a>0?i-4:i,w;for(w=0;w<m;w+=4)t=Bt[e.charCodeAt(w)]<<18|Bt[e.charCodeAt(w+1)]<<12|Bt[e.charCodeAt(w+2)]<<6|Bt[e.charCodeAt(w+3)],u[d++]=t>>16&255,u[d++]=t>>8&255,u[d++]=t&255;return a===2&&(t=Bt[e.charCodeAt(w)]<<2|Bt[e.charCodeAt(w+1)]>>4,u[d++]=t&255),a===1&&(t=Bt[e.charCodeAt(w)]<<10|Bt[e.charCodeAt(w+1)]<<4|Bt[e.charCodeAt(w+2)]>>2,u[d++]=t>>8&255,u[d++]=t&255),u}function Ao(e){return qt[e>>18&63]+qt[e>>12&63]+qt[e>>6&63]+qt[e&63]}function To(e,t,r){for(var i,a=[],u=t;u<r;u+=3)i=(e[u]<<16&16711680)+(e[u+1]<<8&65280)+(e[u+2]&255),a.push(Ao(i));return a.join("")}function So(e){for(var t,r=e.length,i=r%3,a=[],u=16383,d=0,m=r-i;d<m;d+=u)a.push(To(e,d,d+u>m?m:d+u));return i===1?(t=e[r-1],a.push(qt[t>>2]+qt[t<<4&63]+"==")):i===2&&(t=(e[r-2]<<8)+e[r-1],a.push(qt[t>>10]+qt[t>>4&63]+qt[t<<2&63]+"=")),a.join("")}});var li=sr(Ee=>{"use strict";var Gr=Dn(),ve=mo(),Ln=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ee.Buffer=g;Ee.SlowBuffer=Po;Ee.INSPECT_MAX_BYTES=50;var hr=2147483647;Ee.kMaxLength=hr;g.TYPED_ARRAY_SUPPORT=Oo();!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 Oo(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.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 Zt(e){if(e>hr)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,g.prototype),t}function g(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Zr(e)}return ri(e,t,r)}g.poolSize=8192;function ri(e,t,r){if(typeof e=="string")return Ro(e,t);if(ArrayBuffer.isView(e))return Bo(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Ht(e,ArrayBuffer)||e&&Ht(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ht(e,SharedArrayBuffer)||e&&Ht(e.buffer,SharedArrayBuffer)))return Jr(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return g.from(i,t,r);var a=No(e);if(a)return a;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return g.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}g.from=function(e,t,r){return ri(e,t,r)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function ni(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Uo(e,t,r){return ni(e),e<=0?Zt(e):t!==void 0?typeof r=="string"?Zt(e).fill(t,r):Zt(e).fill(t):Zt(e)}g.alloc=function(e,t,r){return Uo(e,t,r)};function Zr(e){return ni(e),Zt(e<0?0:Qr(e)|0)}g.allocUnsafe=function(e){return Zr(e)};g.allocUnsafeSlow=function(e){return Zr(e)};function Ro(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!g.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=ii(e,t)|0,i=Zt(r),a=i.write(e,t);return a!==r&&(i=i.slice(0,a)),i}function Ir(e){for(var t=e.length<0?0:Qr(e.length)|0,r=Zt(t),i=0;i<t;i+=1)r[i]=e[i]&255;return r}function Bo(e){if(Ht(e,Uint8Array)){var t=new Uint8Array(e);return Jr(t.buffer,t.byteOffset,t.byteLength)}return Ir(e)}function Jr(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var i;return t===void 0&&r===void 0?i=new Uint8Array(e):r===void 0?i=new Uint8Array(e,t):i=new Uint8Array(e,t,r),Object.setPrototypeOf(i,g.prototype),i}function No(e){if(g.isBuffer(e)){var t=Qr(e.length)|0,r=Zt(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||Dr(e.length)?Zt(0):Ir(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Ir(e.data)}function Qr(e){if(e>=hr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+hr.toString(16)+" bytes");return e|0}function Po(e){return+e!=e&&(e=0),g.alloc(+e)}g.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==g.prototype};g.compare=function(t,r){if(Ht(t,Uint8Array)&&(t=g.from(t,t.offset,t.byteLength)),Ht(r,Uint8Array)&&(r=g.from(r,r.offset,r.byteLength)),!g.isBuffer(t)||!g.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;for(var i=t.length,a=r.length,u=0,d=Math.min(i,a);u<d;++u)if(t[u]!==r[u]){i=t[u],a=r[u];break}return i<a?-1:a<i?1:0};g.isEncoding=function(t){switch(String(t).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(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return g.alloc(0);var i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;var a=g.allocUnsafe(r),u=0;for(i=0;i<t.length;++i){var d=t[i];if(Ht(d,Uint8Array))u+d.length>a.length?g.from(d).copy(a,u):Uint8Array.prototype.set.call(a,d,u);else if(g.isBuffer(d))d.copy(a,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=d.length}return a};function ii(e,t){if(g.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Ht(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;for(var a=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Xr(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ui(e).length;default:if(a)return i?-1:Xr(e).length;t=(""+t).toLowerCase(),a=!0}}g.byteLength=ii;function Co(e,t,r){var i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return $o(this,t,r);case"utf8":case"utf-8":return ai(this,t,r);case"ascii":return qo(this,t,r);case"latin1":case"binary":return Ho(this,t,r);case"base64":return Vo(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Wo(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}g.prototype._isBuffer=!0;function fe(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}g.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)fe(this,r,r+1);return this};g.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)fe(this,r,r+3),fe(this,r+1,r+2);return this};g.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;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 t=this.length;return t===0?"":arguments.length===0?ai(this,0,t):Co.apply(this,arguments)};g.prototype.toLocaleString=g.prototype.toString;g.prototype.equals=function(t){if(!g.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:g.compare(this,t)===0};g.prototype.inspect=function(){var t="",r=Ee.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};Ln&&(g.prototype[Ln]=g.prototype.inspect);g.prototype.compare=function(t,r,i,a,u){if(Ht(t,Uint8Array)&&(t=g.from(t,t.offset,t.byteLength)),!g.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),a===void 0&&(a=0),u===void 0&&(u=this.length),r<0||i>t.length||a<0||u>this.length)throw new RangeError("out of range index");if(a>=u&&r>=i)return 0;if(a>=u)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,a>>>=0,u>>>=0,this===t)return 0;for(var d=u-a,m=i-r,w=Math.min(d,m),A=this.slice(a,u),B=t.slice(r,i),O=0;O<w;++O)if(A[O]!==B[O]){d=A[O],m=B[O];break}return d<m?-1:m<d?1:0};function oi(e,t,r,i,a){if(e.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Dr(r)&&(r=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0)if(a)r=0;else return-1;if(typeof t=="string"&&(t=g.from(t,i)),g.isBuffer(t))return t.length===0?-1:ti(e,t,r,i,a);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):ti(e,[t],r,i,a);throw new TypeError("val must be string, number or Buffer")}function ti(e,t,r,i,a){var u=1,d=e.length,m=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;u=2,d/=2,m/=2,r/=2}function w(D,st){return u===1?D[st]:D.readUInt16BE(st*u)}var A;if(a){var B=-1;for(A=r;A<d;A++)if(w(e,A)===w(t,B===-1?0:A-B)){if(B===-1&&(B=A),A-B+1===m)return B*u}else B!==-1&&(A-=A-B),B=-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(e,A+Z)!==w(t,Z)){O=!1;break}if(O)return A}return-1}g.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1};g.prototype.indexOf=function(t,r,i){return oi(this,t,r,i,!0)};g.prototype.lastIndexOf=function(t,r,i){return oi(this,t,r,i,!1)};function Fo(e,t,r,i){r=Number(r)||0;var a=e.length-r;i?(i=Number(i),i>a&&(i=a)):i=a;var u=t.length;i>u/2&&(i=u/2);for(var d=0;d<i;++d){var m=parseInt(t.substr(d*2,2),16);if(Dr(m))return d;e[r+d]=m}return d}function ko(e,t,r,i){return pr(Xr(t,e.length-r),e,r,i)}function jo(e,t,r,i){return pr(Io(t),e,r,i)}function Ko(e,t,r,i){return pr(ui(t),e,r,i)}function Mo(e,t,r,i){return pr(Jo(t,e.length-r),e,r,i)}g.prototype.write=function(t,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 u=this.length-r;if((i===void 0||i>u)&&(i=u),t.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 Fo(this,t,r,i);case"utf8":case"utf-8":return ko(this,t,r,i);case"ascii":case"latin1":case"binary":return jo(this,t,r,i);case"base64":return Ko(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Mo(this,t,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 Vo(e,t,r){return t===0&&r===e.length?Gr.fromByteArray(e):Gr.fromByteArray(e.slice(t,r))}function ai(e,t,r){r=Math.min(e.length,r);for(var i=[],a=t;a<r;){var u=e[a],d=null,m=u>239?4:u>223?3:u>191?2:1;if(a+m<=r){var w,A,B,O;switch(m){case 1:u<128&&(d=u);break;case 2:w=e[a+1],(w&192)===128&&(O=(u&31)<<6|w&63,O>127&&(d=O));break;case 3:w=e[a+1],A=e[a+2],(w&192)===128&&(A&192)===128&&(O=(u&15)<<12|(w&63)<<6|A&63,O>2047&&(O<55296||O>57343)&&(d=O));break;case 4:w=e[a+1],A=e[a+2],B=e[a+3],(w&192)===128&&(A&192)===128&&(B&192)===128&&(O=(u&15)<<18|(w&63)<<12|(A&63)<<6|B&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 Yo(i)}var ei=4096;function Yo(e){var t=e.length;if(t<=ei)return String.fromCharCode.apply(String,e);for(var r="",i=0;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=ei));return r}function qo(e,t,r){var i="";r=Math.min(e.length,r);for(var a=t;a<r;++a)i+=String.fromCharCode(e[a]&127);return i}function Ho(e,t,r){var i="";r=Math.min(e.length,r);for(var a=t;a<r;++a)i+=String.fromCharCode(e[a]);return i}function $o(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var a="",u=t;u<r;++u)a+=Xo[e[u]];return a}function Wo(e,t,r){for(var i=e.slice(t,r),a="",u=0;u<i.length-1;u+=2)a+=String.fromCharCode(i[u]+i[u+1]*256);return a}g.prototype.slice=function(t,r){var i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);var a=this.subarray(t,r);return Object.setPrototypeOf(a,g.prototype),a};function xt(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUintLE=g.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||xt(t,r,this.length);for(var a=this[t],u=1,d=0;++d<r&&(u*=256);)a+=this[t+d]*u;return a};g.prototype.readUintBE=g.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||xt(t,r,this.length);for(var a=this[t+--r],u=1;r>0&&(u*=256);)a+=this[t+--r]*u;return a};g.prototype.readUint8=g.prototype.readUInt8=function(t,r){return t=t>>>0,r||xt(t,1,this.length),this[t]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||xt(t,2,this.length),this[t]|this[t+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||xt(t,2,this.length),this[t]<<8|this[t+1]};g.prototype.readUint32LE=g.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||xt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};g.prototype.readUint32BE=g.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||xt(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};g.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||xt(t,r,this.length);for(var a=this[t],u=1,d=0;++d<r&&(u*=256);)a+=this[t+d]*u;return u*=128,a>=u&&(a-=Math.pow(2,8*r)),a};g.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||xt(t,r,this.length);for(var a=r,u=1,d=this[t+--a];a>0&&(u*=256);)d+=this[t+--a]*u;return u*=128,d>=u&&(d-=Math.pow(2,8*r)),d};g.prototype.readInt8=function(t,r){return t=t>>>0,r||xt(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};g.prototype.readInt16LE=function(t,r){t=t>>>0,r||xt(t,2,this.length);var i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};g.prototype.readInt16BE=function(t,r){t=t>>>0,r||xt(t,2,this.length);var i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};g.prototype.readInt32LE=function(t,r){return t=t>>>0,r||xt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};g.prototype.readInt32BE=function(t,r){return t=t>>>0,r||xt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};g.prototype.readFloatLE=function(t,r){return t=t>>>0,r||xt(t,4,this.length),ve.read(this,t,!0,23,4)};g.prototype.readFloatBE=function(t,r){return t=t>>>0,r||xt(t,4,this.length),ve.read(this,t,!1,23,4)};g.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||xt(t,8,this.length),ve.read(this,t,!0,52,8)};g.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||xt(t,8,this.length),ve.read(this,t,!1,52,8)};function At(e,t,r,i,a,u){if(!g.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||t<u)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(t,r,i,a){if(t=+t,r=r>>>0,i=i>>>0,!a){var u=Math.pow(2,8*i)-1;At(this,t,r,i,u,0)}var d=1,m=0;for(this[r]=t&255;++m<i&&(d*=256);)this[r+m]=t/d&255;return r+i};g.prototype.writeUintBE=g.prototype.writeUIntBE=function(t,r,i,a){if(t=+t,r=r>>>0,i=i>>>0,!a){var u=Math.pow(2,8*i)-1;At(this,t,r,i,u,0)}var d=i-1,m=1;for(this[r+d]=t&255;--d>=0&&(m*=256);)this[r+d]=t/m&255;return r+i};g.prototype.writeUint8=g.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,1,255,0),this[r]=t&255,r+1};g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};g.prototype.writeIntLE=function(t,r,i,a){if(t=+t,r=r>>>0,!a){var u=Math.pow(2,8*i-1);At(this,t,r,i,u-1,-u)}var d=0,m=1,w=0;for(this[r]=t&255;++d<i&&(m*=256);)t<0&&w===0&&this[r+d-1]!==0&&(w=1),this[r+d]=(t/m>>0)-w&255;return r+i};g.prototype.writeIntBE=function(t,r,i,a){if(t=+t,r=r>>>0,!a){var u=Math.pow(2,8*i-1);At(this,t,r,i,u-1,-u)}var d=i-1,m=1,w=0;for(this[r+d]=t&255;--d>=0&&(m*=256);)t<0&&w===0&&this[r+d+1]!==0&&(w=1),this[r+d]=(t/m>>0)-w&255;return r+i};g.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};g.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};g.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};g.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};g.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||At(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function si(e,t,r,i,a,u){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function fi(e,t,r,i,a){return t=+t,r=r>>>0,a||si(e,t,r,4,34028234663852886e22,-34028234663852886e22),ve.write(e,t,r,i,23,4),r+4}g.prototype.writeFloatLE=function(t,r,i){return fi(this,t,r,!0,i)};g.prototype.writeFloatBE=function(t,r,i){return fi(this,t,r,!1,i)};function ci(e,t,r,i,a){return t=+t,r=r>>>0,a||si(e,t,r,8,17976931348623157e292,-17976931348623157e292),ve.write(e,t,r,i,52,8),r+8}g.prototype.writeDoubleLE=function(t,r,i){return ci(this,t,r,!0,i)};g.prototype.writeDoubleBE=function(t,r,i){return ci(this,t,r,!1,i)};g.prototype.copy=function(t,r,i,a){if(!g.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!a&&a!==0&&(a=this.length),r>=t.length&&(r=t.length),r||(r=0),a>0&&a<i&&(a=i),a===i||t.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),t.length-r<a-i&&(a=t.length-r+i);var u=a-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,a):Uint8Array.prototype.set.call(t,this.subarray(i,a),r),u};g.prototype.fill=function(t,r,i,a){if(typeof t=="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(t.length===1){var u=t.charCodeAt(0);(a==="utf8"&&u<128||a==="latin1")&&(t=u)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));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,t||(t=0);var d;if(typeof t=="number")for(d=r;d<i;++d)this[d]=t;else{var m=g.isBuffer(t)?t:g.from(t,a),w=m.length;if(w===0)throw new TypeError('The value "'+t+'" 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 Go(e){if(e=e.split("=")[0],e=e.trim().replace(zo,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function Xr(e,t){t=t||1/0;for(var r,i=e.length,a=null,u=[],d=0;d<i;++d){if(r=e.charCodeAt(d),r>55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&u.push(239,191,189);continue}else if(d+1===i){(t-=3)>-1&&u.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&u.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(t-=3)>-1&&u.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;u.push(r)}else if(r<2048){if((t-=2)<0)break;u.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;u.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;u.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return u}function Io(e){for(var t=[],r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function Jo(e,t){for(var r,i,a,u=[],d=0;d<e.length&&!((t-=2)<0);++d)r=e.charCodeAt(d),i=r>>8,a=r%256,u.push(a),u.push(i);return u}function ui(e){return Gr.toByteArray(Go(e))}function pr(e,t,r,i){for(var a=0;a<i&&!(a+r>=t.length||a>=e.length);++a)t[a+r]=e[a];return a}function Ht(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Dr(e){return e!==e}var Xo=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var i=r*16,a=0;a<16;++a)t[i+a]=e[r]+e[a];return t}()});var Ti={};jn(Ti,{default:()=>xa});var xa,Si=xo(()=>{xa={}});var Oi=sr((Af,Er)=>{var le=(Si(),yo(Ti));if(le&&le.default){Er.exports=le.default;for(let e in le)Er.exports[e]=le[e]}else le&&(Er.exports=le)});var an=sr((Tf,Ar)=>{(function(e){"use strict";var t=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 u=t(),d=t([1]),m=t([56129,1]),w=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),A=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),B=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),O=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Z=t([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 h,p=0;for(h=0;h<c;h++)p|=o[f+h]^s[n+h];return(1&p-1>>>8)-1}function dt(o,f,s,n){return st(o,f,s,n,16)}function vt(o,f,s,n){return st(o,f,s,n,32)}function ht(o,f,s,n){for(var c=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,h=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,p=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,P=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=h,N=p,F=b,k=S,U=j,x=R,y=rt,E=P,_=V,v=Y,T=z,M=W,G=q,J=$,I=H,l,Q=0;Q<20;Q+=2)l=C+M|0,k^=l<<7|l>>>32-7,l=k+C|0,E^=l<<9|l>>>32-9,l=E+k|0,M^=l<<13|l>>>32-13,l=M+E|0,C^=l<<18|l>>>32-18,l=U+K|0,_^=l<<7|l>>>32-7,l=_+U|0,G^=l<<9|l>>>32-9,l=G+_|0,K^=l<<13|l>>>32-13,l=K+G|0,U^=l<<18|l>>>32-18,l=v+x|0,J^=l<<7|l>>>32-7,l=J+v|0,N^=l<<9|l>>>32-9,l=N+J|0,x^=l<<13|l>>>32-13,l=x+N|0,v^=l<<18|l>>>32-18,l=I+T|0,F^=l<<7|l>>>32-7,l=F+I|0,y^=l<<9|l>>>32-9,l=y+F|0,T^=l<<13|l>>>32-13,l=T+y|0,I^=l<<18|l>>>32-18,l=C+F|0,K^=l<<7|l>>>32-7,l=K+C|0,N^=l<<9|l>>>32-9,l=N+K|0,F^=l<<13|l>>>32-13,l=F+N|0,C^=l<<18|l>>>32-18,l=U+k|0,x^=l<<7|l>>>32-7,l=x+U|0,y^=l<<9|l>>>32-9,l=y+x|0,k^=l<<13|l>>>32-13,l=k+y|0,U^=l<<18|l>>>32-18,l=v+_|0,T^=l<<7|l>>>32-7,l=T+v|0,E^=l<<9|l>>>32-9,l=E+T|0,_^=l<<13|l>>>32-13,l=_+E|0,v^=l<<18|l>>>32-18,l=I+J|0,M^=l<<7|l>>>32-7,l=M+I|0,G^=l<<9|l>>>32-9,l=G+M|0,J^=l<<13|l>>>32-13,l=J+G|0,I^=l<<18|l>>>32-18;C=C+c|0,K=K+h|0,N=N+p|0,F=F+b|0,k=k+S|0,U=U+j|0,x=x+R|0,y=y+rt|0,E=E+P|0,_=_+V|0,v=v+Y|0,T=T+z|0,M=M+W|0,G=G+q|0,J=J+$|0,I=I+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]=N>>>0&255,o[9]=N>>>8&255,o[10]=N>>>16&255,o[11]=N>>>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]=J>>>0&255,o[57]=J>>>8&255,o[58]=J>>>16&255,o[59]=J>>>24&255,o[60]=I>>>0&255,o[61]=I>>>8&255,o[62]=I>>>16&255,o[63]=I>>>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,h=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,p=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,P=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=h,N=p,F=b,k=S,U=j,x=R,y=rt,E=P,_=V,v=Y,T=z,M=W,G=q,J=$,I=H,l,Q=0;Q<20;Q+=2)l=C+M|0,k^=l<<7|l>>>32-7,l=k+C|0,E^=l<<9|l>>>32-9,l=E+k|0,M^=l<<13|l>>>32-13,l=M+E|0,C^=l<<18|l>>>32-18,l=U+K|0,_^=l<<7|l>>>32-7,l=_+U|0,G^=l<<9|l>>>32-9,l=G+_|0,K^=l<<13|l>>>32-13,l=K+G|0,U^=l<<18|l>>>32-18,l=v+x|0,J^=l<<7|l>>>32-7,l=J+v|0,N^=l<<9|l>>>32-9,l=N+J|0,x^=l<<13|l>>>32-13,l=x+N|0,v^=l<<18|l>>>32-18,l=I+T|0,F^=l<<7|l>>>32-7,l=F+I|0,y^=l<<9|l>>>32-9,l=y+F|0,T^=l<<13|l>>>32-13,l=T+y|0,I^=l<<18|l>>>32-18,l=C+F|0,K^=l<<7|l>>>32-7,l=K+C|0,N^=l<<9|l>>>32-9,l=N+K|0,F^=l<<13|l>>>32-13,l=F+N|0,C^=l<<18|l>>>32-18,l=U+k|0,x^=l<<7|l>>>32-7,l=x+U|0,y^=l<<9|l>>>32-9,l=y+x|0,k^=l<<13|l>>>32-13,l=k+y|0,U^=l<<18|l>>>32-18,l=v+_|0,T^=l<<7|l>>>32-7,l=T+v|0,E^=l<<9|l>>>32-9,l=E+T|0,_^=l<<13|l>>>32-13,l=_+E|0,v^=l<<18|l>>>32-18,l=I+J|0,M^=l<<7|l>>>32-7,l=M+I|0,G^=l<<9|l>>>32-9,l=G+M|0,J^=l<<13|l>>>32-13,l=J+G|0,I^=l<<18|l>>>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]=I>>>0&255,o[13]=I>>>8&255,o[14]=I>>>16&255,o[15]=I>>>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){ht(o,f,s,n)}function Ut(o,f,s,n){Et(o,f,s,n)}var Tt=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Xe(o,f,s,n,c,h,p){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]=h[R];for(;c>=64;){for(Vt(S,b,p,Tt),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,p,Tt),R=0;R<c;R++)o[f+R]=s[n+R]^S[R];return 0}function Ze(o,f,s,n,c){var h=new Uint8Array(16),p=new Uint8Array(64),b,S;for(S=0;S<16;S++)h[S]=0;for(S=0;S<8;S++)h[S]=n[S];for(;s>=64;){for(Vt(p,h,c,Tt),S=0;S<64;S++)o[f+S]=p[S];for(b=1,S=8;S<16;S++)b=b+(h[S]&255)|0,h[S]=b&255,b>>>=8;s-=64,f+=64}if(s>0)for(Vt(p,h,c,Tt),S=0;S<s;S++)o[f+S]=p[S];return 0}function Qe(o,f,s,n,c){var h=new Uint8Array(32);Ut(h,n,c,Tt);for(var p=new Uint8Array(8),b=0;b<8;b++)p[b]=n[b+16];return Ze(o,f,s,p,h)}function Ue(o,f,s,n,c,h,p){var b=new Uint8Array(32);Ut(b,h,p,Tt);for(var S=new Uint8Array(8),j=0;j<8;j++)S[j]=h[j+16];return Xe(o,f,s,n,c,S,b)}var xe=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,h,p,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,h=o[8]&255|(o[9]&255)<<8,this.r[4]=(c>>>4|h<<12)&255,this.r[5]=h>>>1&8190,p=o[10]&255|(o[11]&255)<<8,this.r[6]=(h>>>14|p<<2)&8191,b=o[12]&255|(o[13]&255)<<8,this.r[7]=(p>>>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};xe.prototype.blocks=function(o,f,s){for(var n=this.fin?0:2048,c,h,p,b,S,j,R,rt,P,V,Y,z,W,q,$,H,C,K,N,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],J=this.r[1],I=this.r[2],l=this.r[3],Q=this.r[4],nt=this.r[5],it=this.r[6],X=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,h=o[f+2]&255|(o[f+3]&255)<<8,k+=(c>>>13|h<<3)&8191,p=o[f+4]&255|(o[f+5]&255)<<8,U+=(h>>>10|p<<6)&8191,b=o[f+6]&255|(o[f+7]&255)<<8,x+=(p>>>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,P=0,V=P,V+=F*G,V+=k*(5*et),V+=U*(5*tt),V+=x*(5*X),V+=y*(5*it),P=V>>>13,V&=8191,V+=E*(5*nt),V+=_*(5*Q),V+=v*(5*l),V+=T*(5*I),V+=M*(5*J),P+=V>>>13,V&=8191,Y=P,Y+=F*J,Y+=k*G,Y+=U*(5*et),Y+=x*(5*tt),Y+=y*(5*X),P=Y>>>13,Y&=8191,Y+=E*(5*it),Y+=_*(5*nt),Y+=v*(5*Q),Y+=T*(5*l),Y+=M*(5*I),P+=Y>>>13,Y&=8191,z=P,z+=F*I,z+=k*J,z+=U*G,z+=x*(5*et),z+=y*(5*tt),P=z>>>13,z&=8191,z+=E*(5*X),z+=_*(5*it),z+=v*(5*nt),z+=T*(5*Q),z+=M*(5*l),P+=z>>>13,z&=8191,W=P,W+=F*l,W+=k*I,W+=U*J,W+=x*G,W+=y*(5*et),P=W>>>13,W&=8191,W+=E*(5*tt),W+=_*(5*X),W+=v*(5*it),W+=T*(5*nt),W+=M*(5*Q),P+=W>>>13,W&=8191,q=P,q+=F*Q,q+=k*l,q+=U*I,q+=x*J,q+=y*G,P=q>>>13,q&=8191,q+=E*(5*et),q+=_*(5*tt),q+=v*(5*X),q+=T*(5*it),q+=M*(5*nt),P+=q>>>13,q&=8191,$=P,$+=F*nt,$+=k*Q,$+=U*l,$+=x*I,$+=y*J,P=$>>>13,$&=8191,$+=E*G,$+=_*(5*et),$+=v*(5*tt),$+=T*(5*X),$+=M*(5*it),P+=$>>>13,$&=8191,H=P,H+=F*it,H+=k*nt,H+=U*Q,H+=x*l,H+=y*I,P=H>>>13,H&=8191,H+=E*J,H+=_*G,H+=v*(5*et),H+=T*(5*tt),H+=M*(5*X),P+=H>>>13,H&=8191,C=P,C+=F*X,C+=k*it,C+=U*nt,C+=x*Q,C+=y*l,P=C>>>13,C&=8191,C+=E*I,C+=_*J,C+=v*G,C+=T*(5*et),C+=M*(5*tt),P+=C>>>13,C&=8191,K=P,K+=F*tt,K+=k*X,K+=U*it,K+=x*nt,K+=y*Q,P=K>>>13,K&=8191,K+=E*l,K+=_*I,K+=v*J,K+=T*G,K+=M*(5*et),P+=K>>>13,K&=8191,N=P,N+=F*et,N+=k*tt,N+=U*X,N+=x*it,N+=y*nt,P=N>>>13,N&=8191,N+=E*Q,N+=_*l,N+=v*I,N+=T*J,N+=M*G,P+=N>>>13,N&=8191,P=(P<<2)+P|0,P=P+V|0,V=P&8191,P=P>>>13,Y+=P,F=V,k=Y,U=z,x=W,y=q,E=$,_=H,v=C,T=K,M=N,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},xe.prototype.finish=function(o,f){var s=new Uint16Array(10),n,c,h,p;if(this.leftover){for(p=this.leftover,this.buffer[p++]=1;p<16;p++)this.buffer[p]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=n,n=this.h[p]>>>13,this.h[p]&=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,p=1;p<10;p++)s[p]=this.h[p]+n,n=s[p]>>>13,s[p]&=8191;for(s[9]-=8192,c=(n^1)-1,p=0;p<10;p++)s[p]&=c;for(c=~c,p=0;p<10;p++)this.h[p]=this.h[p]&c|s[p];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,h=this.h[0]+this.pad[0],this.h[0]=h&65535,p=1;p<8;p++)h=(this.h[p]+this.pad[p]|0)+(h>>>16)|0,this.h[p]=h&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},xe.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 Re(o,f,s,n,c,h){var p=new xe(h);return p.update(s,n,c),p.finish(o,f),0}function ne(o,f,s,n,c,h){var p=new Uint8Array(16);return Re(p,0,s,n,c,h),dt(o,f,p,0)}function Be(o,f,s,n,c){var h;if(s<32)return-1;for(Ue(o,0,f,0,s,n,c),Re(o,16,o,32,s-32,o),h=0;h<16;h++)o[h]=0;return 0}function Ne(o,f,s,n,c){var h,p=new Uint8Array(32);if(s<32||(Qe(p,0,32,n,c),ne(f,16,f,32,s-32,p)!==0))return-1;for(Ue(o,0,f,0,s,n,c),h=0;h<32;h++)o[h]=0;return 0}function Ct(o,f){var s;for(s=0;s<16;s++)o[s]=f[s]|0}function Pe(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 ee(o,f,s){for(var n,c=~(s-1),h=0;h<16;h++)n=c&(o[h]^f[h]),o[h]^=n,f[h]^=n}function re(o,f){var s,n,c,h=t(),p=t();for(s=0;s<16;s++)p[s]=f[s];for(Pe(p),Pe(p),Pe(p),n=0;n<2;n++){for(h[0]=p[0]-65517,s=1;s<15;s++)h[s]=p[s]-65535-(h[s-1]>>16&1),h[s-1]&=65535;h[15]=p[15]-32767-(h[14]>>16&1),c=h[15]>>16&1,h[14]&=65535,ee(p,h,1-c)}for(s=0;s<16;s++)o[2*s]=p[s]&255,o[2*s+1]=p[s]>>8}function De(o,f){var s=new Uint8Array(32),n=new Uint8Array(32);return re(s,o),re(n,f),vt(s,0,n,0)}function En(o){var f=new Uint8Array(32);return re(f,o),f[0]&1}function Cr(o,f){var s;for(s=0;s<16;s++)o[s]=f[2*s]+(f[2*s+1]<<8);o[15]&=32767}function Ft(o,f,s){for(var n=0;n<16;n++)o[n]=f[n]+s[n]}function kt(o,f,s){for(var n=0;n<16;n++)o[n]=f[n]-s[n]}function L(o,f,s){var n,c,h=0,p=0,b=0,S=0,j=0,R=0,rt=0,P=0,V=0,Y=0,z=0,W=0,q=0,$=0,H=0,C=0,K=0,N=0,F=0,k=0,U=0,x=0,y=0,E=0,_=0,v=0,T=0,M=0,G=0,J=0,I=0,l=s[0],Q=s[1],nt=s[2],it=s[3],X=s[4],tt=s[5],et=s[6],lt=s[7],at=s[8],ft=s[9],ct=s[10],ut=s[11],pt=s[12],wt=s[13],gt=s[14],_t=s[15];n=f[0],h+=n*l,p+=n*Q,b+=n*nt,S+=n*it,j+=n*X,R+=n*tt,rt+=n*et,P+=n*lt,V+=n*at,Y+=n*ft,z+=n*ct,W+=n*ut,q+=n*pt,$+=n*wt,H+=n*gt,C+=n*_t,n=f[1],p+=n*l,b+=n*Q,S+=n*nt,j+=n*it,R+=n*X,rt+=n*tt,P+=n*et,V+=n*lt,Y+=n*at,z+=n*ft,W+=n*ct,q+=n*ut,$+=n*pt,H+=n*wt,C+=n*gt,K+=n*_t,n=f[2],b+=n*l,S+=n*Q,j+=n*nt,R+=n*it,rt+=n*X,P+=n*tt,V+=n*et,Y+=n*lt,z+=n*at,W+=n*ft,q+=n*ct,$+=n*ut,H+=n*pt,C+=n*wt,K+=n*gt,N+=n*_t,n=f[3],S+=n*l,j+=n*Q,R+=n*nt,rt+=n*it,P+=n*X,V+=n*tt,Y+=n*et,z+=n*lt,W+=n*at,q+=n*ft,$+=n*ct,H+=n*ut,C+=n*pt,K+=n*wt,N+=n*gt,F+=n*_t,n=f[4],j+=n*l,R+=n*Q,rt+=n*nt,P+=n*it,V+=n*X,Y+=n*tt,z+=n*et,W+=n*lt,q+=n*at,$+=n*ft,H+=n*ct,C+=n*ut,K+=n*pt,N+=n*wt,F+=n*gt,k+=n*_t,n=f[5],R+=n*l,rt+=n*Q,P+=n*nt,V+=n*it,Y+=n*X,z+=n*tt,W+=n*et,q+=n*lt,$+=n*at,H+=n*ft,C+=n*ct,K+=n*ut,N+=n*pt,F+=n*wt,k+=n*gt,U+=n*_t,n=f[6],rt+=n*l,P+=n*Q,V+=n*nt,Y+=n*it,z+=n*X,W+=n*tt,q+=n*et,$+=n*lt,H+=n*at,C+=n*ft,K+=n*ct,N+=n*ut,F+=n*pt,k+=n*wt,U+=n*gt,x+=n*_t,n=f[7],P+=n*l,V+=n*Q,Y+=n*nt,z+=n*it,W+=n*X,q+=n*tt,$+=n*et,H+=n*lt,C+=n*at,K+=n*ft,N+=n*ct,F+=n*ut,k+=n*pt,U+=n*wt,x+=n*gt,y+=n*_t,n=f[8],V+=n*l,Y+=n*Q,z+=n*nt,W+=n*it,q+=n*X,$+=n*tt,H+=n*et,C+=n*lt,K+=n*at,N+=n*ft,F+=n*ct,k+=n*ut,U+=n*pt,x+=n*wt,y+=n*gt,E+=n*_t,n=f[9],Y+=n*l,z+=n*Q,W+=n*nt,q+=n*it,$+=n*X,H+=n*tt,C+=n*et,K+=n*lt,N+=n*at,F+=n*ft,k+=n*ct,U+=n*ut,x+=n*pt,y+=n*wt,E+=n*gt,_+=n*_t,n=f[10],z+=n*l,W+=n*Q,q+=n*nt,$+=n*it,H+=n*X,C+=n*tt,K+=n*et,N+=n*lt,F+=n*at,k+=n*ft,U+=n*ct,x+=n*ut,y+=n*pt,E+=n*wt,_+=n*gt,v+=n*_t,n=f[11],W+=n*l,q+=n*Q,$+=n*nt,H+=n*it,C+=n*X,K+=n*tt,N+=n*et,F+=n*lt,k+=n*at,U+=n*ft,x+=n*ct,y+=n*ut,E+=n*pt,_+=n*wt,v+=n*gt,T+=n*_t,n=f[12],q+=n*l,$+=n*Q,H+=n*nt,C+=n*it,K+=n*X,N+=n*tt,F+=n*et,k+=n*lt,U+=n*at,x+=n*ft,y+=n*ct,E+=n*ut,_+=n*pt,v+=n*wt,T+=n*gt,M+=n*_t,n=f[13],$+=n*l,H+=n*Q,C+=n*nt,K+=n*it,N+=n*X,F+=n*tt,k+=n*et,U+=n*lt,x+=n*at,y+=n*ft,E+=n*ct,_+=n*ut,v+=n*pt,T+=n*wt,M+=n*gt,G+=n*_t,n=f[14],H+=n*l,C+=n*Q,K+=n*nt,N+=n*it,F+=n*X,k+=n*tt,U+=n*et,x+=n*lt,y+=n*at,E+=n*ft,_+=n*ct,v+=n*ut,T+=n*pt,M+=n*wt,G+=n*gt,J+=n*_t,n=f[15],C+=n*l,K+=n*Q,N+=n*nt,F+=n*it,k+=n*X,U+=n*tt,x+=n*et,y+=n*lt,E+=n*at,_+=n*ft,v+=n*ct,T+=n*ut,M+=n*pt,G+=n*wt,J+=n*gt,I+=n*_t,h+=38*K,p+=38*N,b+=38*F,S+=38*k,j+=38*U,R+=38*x,rt+=38*y,P+=38*E,V+=38*_,Y+=38*v,z+=38*T,W+=38*M,q+=38*G,$+=38*J,H+=38*I,c=1,n=h+c+65535,c=Math.floor(n/65536),h=n-c*65536,n=p+c+65535,c=Math.floor(n/65536),p=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=P+c+65535,c=Math.floor(n/65536),P=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,h+=c-1+37*(c-1),c=1,n=h+c+65535,c=Math.floor(n/65536),h=n-c*65536,n=p+c+65535,c=Math.floor(n/65536),p=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=P+c+65535,c=Math.floor(n/65536),P=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,h+=c-1+37*(c-1),o[0]=h,o[1]=p,o[2]=b,o[3]=S,o[4]=j,o[5]=R,o[6]=rt,o[7]=P,o[8]=V,o[9]=Y,o[10]=z,o[11]=W,o[12]=q,o[13]=$,o[14]=H,o[15]=C}function Rt(o,f){L(o,f,f)}function An(o,f){var s=t(),n;for(n=0;n<16;n++)s[n]=f[n];for(n=253;n>=0;n--)Rt(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=t(),n;for(n=0;n<16;n++)s[n]=f[n];for(n=250;n>=0;n--)Rt(s,s),n!==1&&L(s,s,f);for(n=0;n<16;n++)o[n]=s[n]}function Le(o,f,s){var n=new Uint8Array(32),c=new Float64Array(80),h,p,b=t(),S=t(),j=t(),R=t(),rt=t(),P=t();for(p=0;p<31;p++)n[p]=f[p];for(n[31]=f[31]&127|64,n[0]&=248,Cr(c,s),p=0;p<16;p++)S[p]=c[p],R[p]=b[p]=j[p]=0;for(b[0]=R[0]=1,p=254;p>=0;--p)h=n[p>>>3]>>>(p&7)&1,ee(b,S,h),ee(j,R,h),Ft(rt,b,j),kt(b,b,j),Ft(j,S,R),kt(S,S,R),Rt(R,rt),Rt(P,b),L(b,j,b),L(j,S,rt),Ft(rt,b,j),kt(b,b,j),Rt(S,b),kt(j,R,P),L(b,j,m),Ft(b,b,R),L(j,j,b),L(b,R,P),L(R,S,c),Rt(S,rt),ee(b,S,h),ee(j,R,h);for(p=0;p<16;p++)c[p+16]=b[p],c[p+32]=j[p],c[p+48]=S[p],c[p+64]=R[p];var V=c.subarray(32),Y=c.subarray(16);return An(V,V),L(Y,Y,V),re(o,Y),0}function tr(o,f){return Le(o,f,a)}function Sn(o,f){return r(f,32),tr(o,f)}function er(o,f,s){var n=new Uint8Array(32);return Le(n,s,f),Ut(o,i,n,Tt)}var On=Be,so=Ne;function fo(o,f,s,n,c,h){var p=new Uint8Array(32);return er(p,c,h),On(o,f,s,n,p)}function co(o,f,s,n,c,h){var p=new Uint8Array(32);return er(p,c,h),so(o,f,s,n,p)}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),h=new Int32Array(16),p,b,S,j,R,rt,P,V,Y,z,W,q,$,H,C,K,N,F,k,U,x,y,E,_,v,T,M=o[0],G=o[1],J=o[2],I=o[3],l=o[4],Q=o[5],nt=o[6],it=o[7],X=f[0],tt=f[1],et=f[2],lt=f[3],at=f[4],ft=f[5],ct=f[6],ut=f[7],pt=0;n>=128;){for(k=0;k<16;k++)U=8*k+pt,c[k]=s[U+0]<<24|s[U+1]<<16|s[U+2]<<8|s[U+3],h[k]=s[U+4]<<24|s[U+5]<<16|s[U+6]<<8|s[U+7];for(k=0;k<80;k++)if(p=M,b=G,S=J,j=I,R=l,rt=Q,P=nt,V=it,Y=X,z=tt,W=et,q=lt,$=at,H=ft,C=ct,K=ut,x=it,y=ut,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=(l>>>14|at<<32-14)^(l>>>18|at<<32-18)^(at>>>41-32|l<<32-(41-32)),y=(at>>>14|l<<32-14)^(at>>>18|l<<32-18)^(l>>>41-32|at<<32-(41-32)),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=l&Q^~l&nt,y=at&ft^~at&ct,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=h[k%16],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,_+=E>>>16,v+=_>>>16,T+=v>>>16,N=v&65535|T<<16,F=E&65535|_<<16,x=N,y=F,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=(M>>>28|X<<32-28)^(X>>>34-32|M<<32-(34-32))^(X>>>39-32|M<<32-(39-32)),y=(X>>>28|M<<32-28)^(M>>>34-32|X<<32-(34-32))^(M>>>39-32|X<<32-(39-32)),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=M&G^M&J^G&J,y=X&tt^X&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=N,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=p,J=b,I=S,l=j,Q=R,nt=rt,it=P,M=V,tt=Y,et=z,lt=W,at=q,ft=$,ct=H,ut=C,X=K,k%16===15)for(U=0;U<16;U++)x=c[U],y=h[U],E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=c[(U+9)%16],y=h[(U+9)%16],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,N=c[(U+1)%16],F=h[(U+1)%16],x=(N>>>1|F<<32-1)^(N>>>8|F<<32-8)^N>>>7,y=(F>>>1|N<<32-1)^(F>>>8|N<<32-8)^(F>>>7|N<<32-7),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,N=c[(U+14)%16],F=h[(U+14)%16],x=(N>>>19|F<<32-19)^(F>>>61-32|N<<32-(61-32))^N>>>6,y=(F>>>19|N<<32-19)^(N>>>61-32|F<<32-(61-32))^(F>>>6|N<<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,h[U]=E&65535|_<<16;x=M,y=X,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]=X=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=J,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]=J=v&65535|T<<16,f[2]=et=E&65535|_<<16,x=I,y=lt,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]=I=v&65535|T<<16,f[3]=lt=E&65535|_<<16,x=l,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]=l=v&65535|T<<16,f[4]=at=E&65535|_<<16,x=Q,y=ft,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]=Q=v&65535|T<<16,f[5]=ft=E&65535|_<<16,x=nt,y=ct,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]=ct=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,pt+=128,n-=128}return n}function ie(o,f,s){var n=new Int32Array(8),c=new Int32Array(8),h=new Uint8Array(256),p,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,p=0;p<s;p++)h[p]=f[b-s+p];for(h[s]=128,s=256-128*(s<112?1:0),h[s-9]=0,D(h,s-8,b/536870912|0,b<<3),Rn(n,c,h,s),p=0;p<8;p++)D(o,8*p,n[p],c[p]);return 0}function rr(o,f){var s=t(),n=t(),c=t(),h=t(),p=t(),b=t(),S=t(),j=t(),R=t();kt(s,o[1],o[0]),kt(R,f[1],f[0]),L(s,s,R),Ft(n,o[0],o[1]),Ft(R,f[0],f[1]),L(n,n,R),L(c,o[3],f[3]),L(c,c,A),L(h,o[2],f[2]),Ft(h,h,h),kt(p,n,s),kt(b,h,c),Ft(S,h,c),Ft(j,n,s),L(o[0],p,b),L(o[1],j,S),L(o[2],S,b),L(o[3],p,j)}function Bn(o,f,s){var n;for(n=0;n<4;n++)ee(o[n],f[n],s)}function Fr(o,f){var s=t(),n=t(),c=t();An(c,f[2]),L(s,f[0],c),L(n,f[1],c),re(o,n),o[31]^=En(s)<<7}function kr(o,f,s){var n,c;for(Ct(o[0],u),Ct(o[1],d),Ct(o[2],d),Ct(o[3],u),c=255;c>=0;--c)n=s[c/8|0]>>(c&7)&1,Bn(o,f,n),rr(f,o),rr(o,o),Bn(o,f,n)}function nr(o,f){var s=[t(),t(),t(),t()];Ct(s[0],B),Ct(s[1],O),Ct(s[2],d),L(s[3],B,O),kr(o,s,f)}function jr(o,f,s){var n=new Uint8Array(64),c=[t(),t(),t(),t()],h;for(s||r(f,32),ie(n,f,32),n[0]&=248,n[31]&=127,n[31]|=64,nr(c,n),Fr(o,c),h=0;h<32;h++)f[h+32]=o[h];return 0}var ir=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,h;for(n=63;n>=32;--n){for(s=0,c=n-32,h=n-12;c<h;++c)f[c]+=s-16*f[n]*ir[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)*ir[c],s=f[c]>>8,f[c]&=255;for(c=0;c<32;c++)f[c]-=s*ir[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 Nn(o,f,s,n){var c=new Uint8Array(64),h=new Uint8Array(64),p=new Uint8Array(64),b,S,j=new Float64Array(64),R=[t(),t(),t(),t()];ie(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(ie(p,o.subarray(32),s+32),Mr(p),nr(R,p),Fr(o,R),b=32;b<64;b++)o[b]=n[b];for(ie(h,o,s+64),Mr(h),b=0;b<64;b++)j[b]=0;for(b=0;b<32;b++)j[b]=p[b];for(b=0;b<32;b++)for(S=0;S<32;S++)j[b+S]+=h[b]*c[S];return Kr(o.subarray(32),j),rt}function uo(o,f){var s=t(),n=t(),c=t(),h=t(),p=t(),b=t(),S=t();return Ct(o[2],d),Cr(o[1],f),Rt(c,o[1]),L(h,c,w),kt(c,c,o[2]),Ft(h,o[2],h),Rt(p,h),Rt(b,p),L(S,b,p),L(s,S,c),L(s,s,h),Tn(s,s),L(s,s,c),L(s,s,h),L(s,s,h),L(o[0],s,h),Rt(n,o[0]),L(n,n,h),De(n,c)&&L(o[0],o[0],Z),Rt(n,o[0]),L(n,n,h),De(n,c)?-1:(En(o[0])===f[31]>>7&&kt(o[0],u,o[0]),L(o[3],o[0],o[1]),0)}function Vr(o,f,s,n){var c,h=new Uint8Array(32),p=new Uint8Array(64),b=[t(),t(),t(),t()],S=[t(),t(),t(),t()];if(s<64||uo(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(ie(p,o,s),Mr(p),kr(b,S,p),nr(S,f.subarray(32)),rr(b,S),Fr(h,b),s-=64,vt(f,0,h,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,or=24,Ce=32,ye=16,Fe=32,ar=32,ke=32,je=32,qr=32,Pn=or,lo=Ce,ho=ye,Jt=64,oe=32,me=64,Hr=32,$r=64;e.lowlevel={crypto_core_hsalsa20:Ut,crypto_stream_xor:Ue,crypto_stream:Qe,crypto_stream_salsa20_xor:Xe,crypto_stream_salsa20:Ze,crypto_onetimeauth:Re,crypto_onetimeauth_verify:ne,crypto_verify_16:dt,crypto_verify_32:vt,crypto_secretbox:Be,crypto_secretbox_open:Ne,crypto_scalarmult:Le,crypto_scalarmult_base:tr,crypto_box_beforenm:er,crypto_box_afternm:On,crypto_box:fo,crypto_box_open:co,crypto_box_keypair:Sn,crypto_hash:ie,crypto_sign:Nn,crypto_sign_keypair:jr,crypto_sign_open:Vr,crypto_secretbox_KEYBYTES:Yr,crypto_secretbox_NONCEBYTES:or,crypto_secretbox_ZEROBYTES:Ce,crypto_secretbox_BOXZEROBYTES:ye,crypto_scalarmult_BYTES:Fe,crypto_scalarmult_SCALARBYTES:ar,crypto_box_PUBLICKEYBYTES:ke,crypto_box_SECRETKEYBYTES:je,crypto_box_BEFORENMBYTES:qr,crypto_box_NONCEBYTES:Pn,crypto_box_ZEROBYTES:lo,crypto_box_BOXZEROBYTES:ho,crypto_sign_BYTES:Jt,crypto_sign_PUBLICKEYBYTES:oe,crypto_sign_SECRETKEYBYTES:me,crypto_sign_SEEDBYTES:Hr,crypto_hash_BYTES:$r,gf:t,D:w,L:ir,pack25519:re,unpack25519:Cr,M:L,A:Ft,S:Rt,Z:kt,pow2523:Tn,add:rr,set25519:Ct,modL:Kr,scalarmult:kr,scalarbase:nr};function Cn(o,f){if(o.length!==Yr)throw new Error("bad key size");if(f.length!==or)throw new Error("bad nonce size")}function po(o,f){if(o.length!==ke)throw new Error("bad public key size");if(f.length!==je)throw new Error("bad secret key size")}function St(){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}e.randomBytes=function(o){var f=new Uint8Array(o);return r(f,o),f},e.secretbox=function(o,f,s){St(o,f,s),Cn(s,f);for(var n=new Uint8Array(Ce+o.length),c=new Uint8Array(n.length),h=0;h<o.length;h++)n[h+Ce]=o[h];return Be(c,n,n.length,f,s),c.subarray(ye)},e.secretbox.open=function(o,f,s){St(o,f,s),Cn(s,f);for(var n=new Uint8Array(ye+o.length),c=new Uint8Array(n.length),h=0;h<o.length;h++)n[h+ye]=o[h];return n.length<32||Ne(c,n,n.length,f,s)!==0?null:c.subarray(Ce)},e.secretbox.keyLength=Yr,e.secretbox.nonceLength=or,e.secretbox.overheadLength=ye,e.scalarMult=function(o,f){if(St(o,f),o.length!==ar)throw new Error("bad n size");if(f.length!==Fe)throw new Error("bad p size");var s=new Uint8Array(Fe);return Le(s,o,f),s},e.scalarMult.base=function(o){if(St(o),o.length!==ar)throw new Error("bad n size");var f=new Uint8Array(Fe);return tr(f,o),f},e.scalarMult.scalarLength=ar,e.scalarMult.groupElementLength=Fe,e.box=function(o,f,s,n){var c=e.box.before(s,n);return e.secretbox(o,f,c)},e.box.before=function(o,f){St(o,f),po(o,f);var s=new Uint8Array(qr);return er(s,o,f),s},e.box.after=e.secretbox,e.box.open=function(o,f,s,n){var c=e.box.before(s,n);return e.secretbox.open(o,f,c)},e.box.open.after=e.secretbox.open,e.box.keyPair=function(){var o=new Uint8Array(ke),f=new Uint8Array(je);return Sn(o,f),{publicKey:o,secretKey:f}},e.box.keyPair.fromSecretKey=function(o){if(St(o),o.length!==je)throw new Error("bad secret key size");var f=new Uint8Array(ke);return tr(f,o),{publicKey:f,secretKey:new Uint8Array(o)}},e.box.publicKeyLength=ke,e.box.secretKeyLength=je,e.box.sharedKeyLength=qr,e.box.nonceLength=Pn,e.box.overheadLength=e.secretbox.overheadLength,e.sign=function(o,f){if(St(o,f),f.length!==me)throw new Error("bad secret key size");var s=new Uint8Array(Jt+o.length);return Nn(s,o,o.length,f),s},e.sign.open=function(o,f){if(St(o,f),f.length!==oe)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),h=0;h<c.length;h++)c[h]=s[h];return c},e.sign.detached=function(o,f){for(var s=e.sign(o,f),n=new Uint8Array(Jt),c=0;c<n.length;c++)n[c]=s[c];return n},e.sign.detached.verify=function(o,f,s){if(St(o,f,s),f.length!==Jt)throw new Error("bad signature size");if(s.length!==oe)throw new Error("bad public key size");var n=new Uint8Array(Jt+o.length),c=new Uint8Array(Jt+o.length),h;for(h=0;h<Jt;h++)n[h]=f[h];for(h=0;h<o.length;h++)n[h+Jt]=o[h];return Vr(c,n,n.length,s)>=0},e.sign.keyPair=function(){var o=new Uint8Array(oe),f=new Uint8Array(me);return jr(o,f),{publicKey:o,secretKey:f}},e.sign.keyPair.fromSecretKey=function(o){if(St(o),o.length!==me)throw new Error("bad secret key size");for(var f=new Uint8Array(oe),s=0;s<f.length;s++)f[s]=o[32+s];return{publicKey:f,secretKey:new Uint8Array(o)}},e.sign.keyPair.fromSeed=function(o){if(St(o),o.length!==Hr)throw new Error("bad seed size");for(var f=new Uint8Array(oe),s=new Uint8Array(me),n=0;n<32;n++)s[n]=o[n];return jr(f,s,!0),{publicKey:f,secretKey:s}},e.sign.publicKeyLength=oe,e.sign.secretKeyLength=me,e.sign.seedLength=Hr,e.sign.signatureLength=Jt,e.hash=function(o){St(o);var f=new Uint8Array($r);return ie(f,o,o.length),f},e.hash.hashLength=$r,e.verify=function(o,f){return St(o,f),o.length===0||f.length===0||o.length!==f.length?!1:st(o,0,f,0,o.length)===0},e.setPRNG=function(o){r=o},function(){var o=typeof self<"u"?self.crypto||self.msCrypto:null;if(o&&o.getRandomValues){var f=65536;e.setPRNG(function(s,n){var c,h=new Uint8Array(n);for(c=0;c<n;c+=f)o.getRandomValues(h.subarray(c,c+Math.min(n-c,f)));for(c=0;c<n;c++)s[c]=h[c];Fn(h)})}else typeof kn<"u"&&(o=Oi(),o&&o.randomBytes&&e.setPRNG(function(s,n){var c,h=o.randomBytes(n);for(c=0;c<n;c++)s[c]=h[c];Fn(h)}))}()})(typeof Ar<"u"&&Ar.exports?Ar.exports:self.nacl=self.nacl||{})});var yt=e=>e==null,go=e=>!yt(e);var mt=e=>go(e)?[e]:[],Ot=e=>e?.[0],Hn=async e=>{let t=new Blob([JSON.stringify(e)],{type:"application/json; charset=utf-8"});return new Uint8Array(await t.arrayBuffer())},$n=async e=>{let t=new Blob([e instanceof Uint8Array?e:new Uint8Array(e)],{type:"application/json; charset=utf-8"});return JSON.parse(await t.text())},ur=()=>typeof window<"u";var ge=class{callbacks=[];populate(t){this.callbacks.forEach(({callback:r})=>r(t))}subscribe(t){let r=Symbol();return this.callbacks.push({id:r,callback:t}),()=>this.callbacks=this.callbacks.filter(({id:i})=>i!==r)}};var _e=class extends ge{authUser=null;constructor(){super()}static getInstance(){return _e.instance||(_e.instance=new _e),_e.instance}set(t){this.authUser=t,this.populate(t)}get(){return this.authUser}subscribe(t){let r=super.subscribe(t);return t(this.authUser),r}reset(){this.authUser=null,this.populate(this.authUser)}},Yt=_e;fr(Yt,"instance");var Wn=({message:e,detail:t})=>{let r=new CustomEvent(e,{detail:t,bubbles:!0});document.dispatchEvent(r)};var zn=BigInt(144e11),Gn={width:576,height:576},In={width:505,height:705},Jn="internetcomputer.org";var be=class extends ge{env;constructor(){super()}static getInstance(){return be.instance||(be.instance=new be),be.instance}set(t){this.env=t,this.populate(t)}get(){return this.env}localIdentity(){return this.get()?.localIdentityCanisterId!==void 0}subscribe(t){let r=super.subscribe(t);return t(this.env),r}},bt=be;fr(bt,"instance");var Wr=({width:e,height:t})=>{if(!ur()||yt(window)||yt(window.top))return;let{top:{innerWidth:r,innerHeight:i}}=window,a=i/2+screenY-t/2,u=r/2+screenX-e/2;return`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=${e}, height=${t}, top=${a}, left=${u}`};var lr=class{#t;constructor({domain:t}){this.#t=t}get id(){return"internet_identity"}signInOptions({windowed:t}){let r=bt.getInstance().localIdentity()?`http://${bt.getInstance().get()?.localIdentityCanisterId}.localhost:8000`:`https://identity.${this.#t??Jn}`;return{...t!==!1&&{windowOpenerFeatures:Wr(Gn)},identityProvider:r}}},Xn=class{#t;#e;constructor({appName:t,logoUrl:r}){this.#t=t,this.#e=r}get id(){return"nfid"}signInOptions({windowed:t}){return{...t!==!1&&{windowOpenerFeatures:Wr(In)},identityProvider:`https://nfid.one/authenticate/?applicationName=${encodeURI(this.#t)}&applicationLogo=${encodeURI(this.#e)}`}}};var Ei=we(li());var xr;(function(e){e[e.SysFatal=1]="SysFatal",e[e.SysTransient=2]="SysTransient",e[e.DestinationInvalid=3]="DestinationInvalid",e[e.CanisterReject=4]="CanisterReject",e[e.CanisterError=5]="CanisterError"})(xr||(xr={}));var Zo=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]]);return r},Qo=new TextEncoder().encode(`
2
- ic-request`),Qt=class{getPrincipal(){return this._principal||(this._principal=ot.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()))),this._principal}async transformRequest(t){let{body:r}=t,i=Zo(t,["body"]),a=await ae(r);return Object.assign(Object.assign({},i),{body:{content:r,sender_pubkey:this.getPublicKey().toDer(),sender_sig:await this.sign(Mn(Qo,a))}})}},Dt=class{getPrincipal(){return ot.anonymous()}async transformRequest(t){return Object.assign(Object.assign({},t),{body:{content:t.body}})}};var di=we(Yn());var Ye=()=>{if(typeof window<"u"&&window.crypto&&window.crypto.getRandomValues){let e=new Uint32Array(1);return window.crypto.getRandomValues(e),e[0]}if(typeof crypto<"u"&&crypto.getRandomValues){let e=new Uint32Array(1);return crypto.getRandomValues(e),e[0]}return typeof crypto<"u"&&crypto.randomInt?crypto.randomInt(0,4294967295):Math.floor(Math.random()*4294967295)};var yr;(function(e){e.Call="call"})(yr||(yr={}));function qe(){let e=new ArrayBuffer(16),t=new DataView(e),r=Ye(),i=Ye(),a=Ye(),u=Ye();return t.setUint32(0,r),t.setUint32(4,i),t.setUint32(8,a),t.setUint32(12,u),e}var Do=BigInt(1e6),Lo=BigInt(60*1e3),ce=class{constructor(t){this._value=(BigInt(Date.now())+BigInt(t)-Lo)*Do}toCBOR(){return di.value.u64(this._value.toString(16),16)}toHash(){return Kn(this._value)}};function hi(e=qe){return async t=>{let r=e(),i=t.request.headers;t.request.headers=i,t.endpoint==="call"&&(t.body.nonce=e())}}function mr(e){let t=[];return e.forEach((r,i)=>{t.push([i,r])}),t}var wr=class extends Error{constructor(t,r){super(t),this.response=r,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}};var $t;(function(e){e.Received="received",e.Processing="processing",e.Replied="replied",e.Rejected="rejected",e.Unknown="unknown",e.Done="done"})($t||($t={}));var gr=5*60*1e3,ea="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",ra="ic0.app",na=".ic0.app",ia="icp0.io",oa=".icp0.io",aa="icp-api.io",sa=".icp-api.io",He=class extends Ke{constructor(t){super(t),this.message=t}},Ae=class extends Ke{constructor(t){super(t),this.message=t}};function fa(){let e;if(typeof window<"u")if(window.fetch)e=window.fetch.bind(window);else throw new He("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)e=globalThis.fetch.bind(globalThis);else throw new He("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&&(e=self.fetch.bind(self));if(e)return e;throw new He("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}var ue=class{constructor(t={}){if(this.rootKey=Vn(ea),this._pipeline=[],this._timeDiffMsecs=0,this._rootKeyFetched=!1,this._isAgent=!0,t.source){if(!(t.source instanceof ue))throw new Error("An Agent's source can only be another HttpAgent");this._pipeline=[...t.source._pipeline],this._identity=t.source._identity,this._fetch=t.source._fetch,this._host=t.source._host,this._credentials=t.source._credentials}else this._fetch=t.fetch||fa()||fetch.bind(globalThis),this._fetchOptions=t.fetchOptions,this._callOptions=t.callOptions;if(t.host!==void 0)!t.host.match(/^[a-z]+:/)&&typeof window<"u"?this._host=new URL(window.location.protocol+"//"+t.host):this._host=new URL(t.host);else if(t.source!==void 0)this._host=t.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,u;a&&typeof a=="string"&&(u=i.find(d=>a.endsWith(d))),r&&u?this._host=new URL(`${r.protocol}//${u}${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=t.retryTimes!==void 0&&t.retryTimes>=0?t.retryTimes:3,this._host.hostname.endsWith(na)?this._host.hostname=ra:this._host.hostname.endsWith(oa)?this._host.hostname=ia:this._host.hostname.endsWith(sa)&&(this._host.hostname=aa),t.credentials){let{name:r,password:i}=t.credentials;this._credentials=`${r}${i?":"+i:""}`}this._identity=Promise.resolve(t.identity||new Dt),t.disableNonce||this.addTransform(hi(qe))}isLocal(){let t=this._host.hostname;return t==="127.0.0.1"||t.endsWith("localhost")}addTransform(t,r=t.priority||0){let i=this._pipeline.findIndex(a=>(a.priority||0)<r);this._pipeline.splice(i>=0?i:this._pipeline.length,0,Object.assign(t,{priority:r}))}async getPrincipal(){if(!this._identity)throw new Ae("This identity has expired due this application's security policy. Please refresh your authentication.");return(await this._identity).getPrincipal()}async call(t,r,i){let a=await(i!==void 0?await i:await this._identity);if(!a)throw new Ae("This identity has expired due this application's security policy. Please refresh your authentication.");let u=ot.from(t),d=r.effectiveCanisterId?ot.from(r.effectiveCanisterId):u,m=a.getPrincipal()||ot.anonymous(),w=new ce(gr);Math.abs(this._timeDiffMsecs)>1e3*30&&(w=new ce(gr+this._timeDiffMsecs));let A={request_type:yr.Call,canister_id:u,method_name:r.methodName,arg:r.arg,sender:m,ingress_expiry:w},B=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});B=await a.transformRequest(B);let O=cr(B.body),Z=this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${d.toText()}/call`,this._host),Object.assign(Object.assign(Object.assign({},this._callOptions),B.request),{body:O}))),[D,st]=await Promise.all([Z,ae(A)]),dt=await D.arrayBuffer(),vt=D.status===200&&dt.byteLength>0?Ve(dt):null;return{requestId:st,response:{ok:D.ok,status:D.status,statusText:D.statusText,body:vt,headers:mr(D.headers)}}}async _requestAndRetry(t,r=0){let i=await t();if(i.ok)return i;let a=await i.clone().text(),u=`Server returned an error:
1
+ import{a as Nn,b as lo,c as or,d as Cn,e as pe,f as ho,g as po,h as ot,i as Pe,j as Fn,k as Ne,l as xo,m as kn,n as Gt,o as jn,p as ie,q as Kn,r as ar,s as Ce,t as Mn}from"./chunk-IRYD4AKF.js";var Xn=or(cr=>{"use strict";cr.byteLength=wo;cr.toByteArray=_o;cr.fromByteArray=Eo;var Mt=[],Bt=[],mo=typeof Uint8Array<"u"?Uint8Array:Array,Hr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(oe=0,Jn=Hr.length;oe<Jn;++oe)Mt[oe]=Hr[oe],Bt[Hr.charCodeAt(oe)]=oe;var oe,Jn;Bt["-".charCodeAt(0)]=62;Bt["_".charCodeAt(0)]=63;function In(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 wo(t){var e=In(t),r=e[0],i=e[1];return(r+i)*3/4-i}function go(t,e,r){return(e+r)*3/4-r}function _o(t){var e,r=In(t),i=r[0],a=r[1],u=new mo(go(t,i,a)),d=0,m=a>0?i-4:i,w;for(w=0;w<m;w+=4)e=Bt[t.charCodeAt(w)]<<18|Bt[t.charCodeAt(w+1)]<<12|Bt[t.charCodeAt(w+2)]<<6|Bt[t.charCodeAt(w+3)],u[d++]=e>>16&255,u[d++]=e>>8&255,u[d++]=e&255;return a===2&&(e=Bt[t.charCodeAt(w)]<<2|Bt[t.charCodeAt(w+1)]>>4,u[d++]=e&255),a===1&&(e=Bt[t.charCodeAt(w)]<<10|Bt[t.charCodeAt(w+1)]<<4|Bt[t.charCodeAt(w+2)]>>2,u[d++]=e>>8&255,u[d++]=e&255),u}function bo(t){return Mt[t>>18&63]+Mt[t>>12&63]+Mt[t>>6&63]+Mt[t&63]}function vo(t,e,r){for(var i,a=[],u=e;u<r;u+=3)i=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(t[u+2]&255),a.push(bo(i));return a.join("")}function Eo(t){for(var e,r=t.length,i=r%3,a=[],u=16383,d=0,m=r-i;d<m;d+=u)a.push(vo(t,d,d+u>m?m:d+u));return i===1?(e=t[r-1],a.push(Mt[e>>2]+Mt[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],a.push(Mt[e>>10]+Mt[e>>4&63]+Mt[e<<2&63]+"=")),a.join("")}});var fi=or(me=>{"use strict";var $r=Xn(),ye=po(),Zn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;me.Buffer=g;me.SlowBuffer=Ro;me.INSPECT_MAX_BYTES=50;var ur=2147483647;me.kMaxLength=ur;g.TYPED_ARRAY_SUPPORT=Ao();!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 Ao(){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 It(t){if(t>ur)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 Jr(t)}return Ln(t,e,r)}g.poolSize=8192;function Ln(t,e,r){if(typeof t=="string")return So(t,e);if(ArrayBuffer.isView(t))return Oo(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(Vt(t,ArrayBuffer)||t&&Vt(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Vt(t,SharedArrayBuffer)||t&&Vt(t.buffer,SharedArrayBuffer)))return zr(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=Uo(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 Ln(t,e,r)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function ti(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 To(t,e,r){return ti(t),t<=0?It(t):e!==void 0?typeof r=="string"?It(t).fill(e,r):It(t).fill(e):It(t)}g.alloc=function(t,e,r){return To(t,e,r)};function Jr(t){return ti(t),It(t<0?0:Ir(t)|0)}g.allocUnsafe=function(t){return Jr(t)};g.allocUnsafeSlow=function(t){return Jr(t)};function So(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!g.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=ei(t,e)|0,i=It(r),a=i.write(t,e);return a!==r&&(i=i.slice(0,a)),i}function Wr(t){for(var e=t.length<0?0:Ir(t.length)|0,r=It(e),i=0;i<e;i+=1)r[i]=t[i]&255;return r}function Oo(t){if(Vt(t,Uint8Array)){var e=new Uint8Array(t);return zr(e.buffer,e.byteOffset,e.byteLength)}return Wr(t)}function zr(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 Uo(t){if(g.isBuffer(t)){var e=Ir(t.length)|0,r=It(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Xr(t.length)?It(0):Wr(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Wr(t.data)}function Ir(t){if(t>=ur)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ur.toString(16)+" bytes");return t|0}function Ro(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(Vt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),Vt(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,u=0,d=Math.min(i,a);u<d;++u)if(e[u]!==r[u]){i=e[u],a=r[u];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),u=0;for(i=0;i<e.length;++i){var d=e[i];if(Vt(d,Uint8Array))u+d.length>a.length?g.from(d).copy(a,u):Uint8Array.prototype.set.call(a,d,u);else if(g.isBuffer(d))d.copy(a,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=d.length}return a};function ei(t,e){if(g.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Vt(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 Gr(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return si(t).length;default:if(a)return i?-1:Gr(t).length;e=(""+e).toLowerCase(),a=!0}}g.byteLength=ei;function Bo(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 Yo(this,e,r);case"utf8":case"utf-8":return ni(this,e,r);case"ascii":return Mo(this,e,r);case"latin1":case"binary":return Vo(this,e,r);case"base64":return jo(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qo(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}g.prototype._isBuffer=!0;function ae(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)ae(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)ae(this,r,r+3),ae(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)ae(this,r,r+7),ae(this,r+1,r+6),ae(this,r+2,r+5),ae(this,r+3,r+4);return this};g.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?ni(this,0,e):Bo.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=me.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Zn&&(g.prototype[Zn]=g.prototype.inspect);g.prototype.compare=function(e,r,i,a,u){if(Vt(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),u===void 0&&(u=this.length),r<0||i>e.length||a<0||u>this.length)throw new RangeError("out of range index");if(a>=u&&r>=i)return 0;if(a>=u)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,a>>>=0,u>>>=0,this===e)return 0;for(var d=u-a,m=i-r,w=Math.min(d,m),A=this.slice(a,u),B=e.slice(r,i),O=0;O<w;++O)if(A[O]!==B[O]){d=A[O],m=B[O];break}return d<m?-1:m<d?1:0};function ri(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,Xr(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:Qn(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):Qn(t,[e],r,i,a);throw new TypeError("val must be string, number or Buffer")}function Qn(t,e,r,i,a){var u=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;u=2,d/=2,m/=2,r/=2}function w(D,st){return u===1?D[st]:D.readUInt16BE(st*u)}var A;if(a){var B=-1;for(A=r;A<d;A++)if(w(t,A)===w(e,B===-1?0:A-B)){if(B===-1&&(B=A),A-B+1===m)return B*u}else B!==-1&&(A-=A-B),B=-1}else for(r+m>d&&(r=d-m),A=r;A>=0;A--){for(var O=!0,I=0;I<m;I++)if(w(t,A+I)!==w(e,I)){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 ri(this,e,r,i,!0)};g.prototype.lastIndexOf=function(e,r,i){return ri(this,e,r,i,!1)};function Po(t,e,r,i){r=Number(r)||0;var a=t.length-r;i?(i=Number(i),i>a&&(i=a)):i=a;var u=e.length;i>u/2&&(i=u/2);for(var d=0;d<i;++d){var m=parseInt(e.substr(d*2,2),16);if(Xr(m))return d;t[r+d]=m}return d}function No(t,e,r,i){return lr(Gr(e,t.length-r),t,r,i)}function Co(t,e,r,i){return lr(Wo(e),t,r,i)}function Fo(t,e,r,i){return lr(si(e),t,r,i)}function ko(t,e,r,i){return lr(zo(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 u=this.length-r;if((i===void 0||i>u)&&(i=u),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 Po(this,e,r,i);case"utf8":case"utf-8":return No(this,e,r,i);case"ascii":case"latin1":case"binary":return Co(this,e,r,i);case"base64":return Fo(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ko(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 jo(t,e,r){return e===0&&r===t.length?$r.fromByteArray(t):$r.fromByteArray(t.slice(e,r))}function ni(t,e,r){r=Math.min(t.length,r);for(var i=[],a=e;a<r;){var u=t[a],d=null,m=u>239?4:u>223?3:u>191?2:1;if(a+m<=r){var w,A,B,O;switch(m){case 1:u<128&&(d=u);break;case 2:w=t[a+1],(w&192)===128&&(O=(u&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=(u&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],B=t[a+3],(w&192)===128&&(A&192)===128&&(B&192)===128&&(O=(u&15)<<18|(w&63)<<12|(A&63)<<6|B&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 Ko(i)}var Dn=4096;function Ko(t){var e=t.length;if(e<=Dn)return String.fromCharCode.apply(String,t);for(var r="",i=0;i<e;)r+=String.fromCharCode.apply(String,t.slice(i,i+=Dn));return r}function Mo(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 Vo(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 Yo(t,e,r){var i=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>i)&&(r=i);for(var a="",u=e;u<r;++u)a+=Go[t[u]];return a}function qo(t,e,r){for(var i=t.slice(e,r),a="",u=0;u<i.length-1;u+=2)a+=String.fromCharCode(i[u]+i[u+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],u=1,d=0;++d<r&&(u*=256);)a+=this[e+d]*u;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],u=1;r>0&&(u*=256);)a+=this[e+--r]*u;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],u=1,d=0;++d<r&&(u*=256);)a+=this[e+d]*u;return u*=128,a>=u&&(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,u=1,d=this[e+--a];a>0&&(u*=256);)d+=this[e+--a]*u;return u*=128,d>=u&&(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),ye.read(this,e,!0,23,4)};g.prototype.readFloatBE=function(e,r){return e=e>>>0,r||xt(e,4,this.length),ye.read(this,e,!1,23,4)};g.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||xt(e,8,this.length),ye.read(this,e,!0,52,8)};g.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||xt(e,8,this.length),ye.read(this,e,!1,52,8)};function At(t,e,r,i,a,u){if(!g.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<u)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 u=Math.pow(2,8*i)-1;At(this,e,r,i,u,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 u=Math.pow(2,8*i)-1;At(this,e,r,i,u,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||At(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||At(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||At(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||At(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||At(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 u=Math.pow(2,8*i-1);At(this,e,r,i,u-1,-u)}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 u=Math.pow(2,8*i-1);At(this,e,r,i,u-1,-u)}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||At(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||At(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||At(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||At(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||At(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 ii(t,e,r,i,a,u){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function oi(t,e,r,i,a){return e=+e,r=r>>>0,a||ii(t,e,r,4,34028234663852886e22,-34028234663852886e22),ye.write(t,e,r,i,23,4),r+4}g.prototype.writeFloatLE=function(e,r,i){return oi(this,e,r,!0,i)};g.prototype.writeFloatBE=function(e,r,i){return oi(this,e,r,!1,i)};function ai(t,e,r,i,a){return e=+e,r=r>>>0,a||ii(t,e,r,8,17976931348623157e292,-17976931348623157e292),ye.write(t,e,r,i,52,8),r+8}g.prototype.writeDoubleLE=function(e,r,i){return ai(this,e,r,!0,i)};g.prototype.writeDoubleBE=function(e,r,i){return ai(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 u=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),u};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 u=e.charCodeAt(0);(a==="utf8"&&u<128||a==="latin1")&&(e=u)}}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 Ho=/[^+/0-9A-Za-z-_]/g;function $o(t){if(t=t.split("=")[0],t=t.trim().replace(Ho,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Gr(t,e){e=e||1/0;for(var r,i=t.length,a=null,u=[],d=0;d<i;++d){if(r=t.charCodeAt(d),r>55295&&r<57344){if(!a){if(r>56319){(e-=3)>-1&&u.push(239,191,189);continue}else if(d+1===i){(e-=3)>-1&&u.push(239,191,189);continue}a=r;continue}if(r<56320){(e-=3)>-1&&u.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(e-=3)>-1&&u.push(239,191,189);if(a=null,r<128){if((e-=1)<0)break;u.push(r)}else if(r<2048){if((e-=2)<0)break;u.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;u.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;u.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return u}function Wo(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function zo(t,e){for(var r,i,a,u=[],d=0;d<t.length&&!((e-=2)<0);++d)r=t.charCodeAt(d),i=r>>8,a=r%256,u.push(a),u.push(i);return u}function si(t){return $r.toByteArray($o(t))}function lr(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 Vt(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Xr(t){return t!==t}var Go=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 vi={};Cn(vi,{default:()=>da});var da,Ei=lo(()=>{da={}});var Ai=or((gf,_r)=>{var ce=(Ei(),ho(vi));if(ce&&ce.default){_r.exports=ce.default;for(let t in ce)_r.exports[t]=ce[t]}else ce&&(_r.exports=ce)});var rn=or((_f,br)=>{(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 u=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]),B=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]),I=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 h,p=0;for(h=0;h<c;h++)p|=o[f+h]^s[n+h];return(1&p-1>>>8)-1}function dt(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 ht(o,f,s,n){for(var c=n[0]&255|(n[1]&255)<<8|(n[2]&255)<<16|(n[3]&255)<<24,h=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,p=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,N=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=h,P=p,F=b,k=S,U=j,x=R,y=rt,E=N,_=V,v=Y,T=z,M=W,G=q,X=$,J=H,l,Q=0;Q<20;Q+=2)l=C+M|0,k^=l<<7|l>>>32-7,l=k+C|0,E^=l<<9|l>>>32-9,l=E+k|0,M^=l<<13|l>>>32-13,l=M+E|0,C^=l<<18|l>>>32-18,l=U+K|0,_^=l<<7|l>>>32-7,l=_+U|0,G^=l<<9|l>>>32-9,l=G+_|0,K^=l<<13|l>>>32-13,l=K+G|0,U^=l<<18|l>>>32-18,l=v+x|0,X^=l<<7|l>>>32-7,l=X+v|0,P^=l<<9|l>>>32-9,l=P+X|0,x^=l<<13|l>>>32-13,l=x+P|0,v^=l<<18|l>>>32-18,l=J+T|0,F^=l<<7|l>>>32-7,l=F+J|0,y^=l<<9|l>>>32-9,l=y+F|0,T^=l<<13|l>>>32-13,l=T+y|0,J^=l<<18|l>>>32-18,l=C+F|0,K^=l<<7|l>>>32-7,l=K+C|0,P^=l<<9|l>>>32-9,l=P+K|0,F^=l<<13|l>>>32-13,l=F+P|0,C^=l<<18|l>>>32-18,l=U+k|0,x^=l<<7|l>>>32-7,l=x+U|0,y^=l<<9|l>>>32-9,l=y+x|0,k^=l<<13|l>>>32-13,l=k+y|0,U^=l<<18|l>>>32-18,l=v+_|0,T^=l<<7|l>>>32-7,l=T+v|0,E^=l<<9|l>>>32-9,l=E+T|0,_^=l<<13|l>>>32-13,l=_+E|0,v^=l<<18|l>>>32-18,l=J+X|0,M^=l<<7|l>>>32-7,l=M+J|0,G^=l<<9|l>>>32-9,l=G+M|0,X^=l<<13|l>>>32-13,l=X+G|0,J^=l<<18|l>>>32-18;C=C+c|0,K=K+h|0,P=P+p|0,F=F+b|0,k=k+S|0,U=U+j|0,x=x+R|0,y=y+rt|0,E=E+N|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,h=s[0]&255|(s[1]&255)<<8|(s[2]&255)<<16|(s[3]&255)<<24,p=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,N=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=h,P=p,F=b,k=S,U=j,x=R,y=rt,E=N,_=V,v=Y,T=z,M=W,G=q,X=$,J=H,l,Q=0;Q<20;Q+=2)l=C+M|0,k^=l<<7|l>>>32-7,l=k+C|0,E^=l<<9|l>>>32-9,l=E+k|0,M^=l<<13|l>>>32-13,l=M+E|0,C^=l<<18|l>>>32-18,l=U+K|0,_^=l<<7|l>>>32-7,l=_+U|0,G^=l<<9|l>>>32-9,l=G+_|0,K^=l<<13|l>>>32-13,l=K+G|0,U^=l<<18|l>>>32-18,l=v+x|0,X^=l<<7|l>>>32-7,l=X+v|0,P^=l<<9|l>>>32-9,l=P+X|0,x^=l<<13|l>>>32-13,l=x+P|0,v^=l<<18|l>>>32-18,l=J+T|0,F^=l<<7|l>>>32-7,l=F+J|0,y^=l<<9|l>>>32-9,l=y+F|0,T^=l<<13|l>>>32-13,l=T+y|0,J^=l<<18|l>>>32-18,l=C+F|0,K^=l<<7|l>>>32-7,l=K+C|0,P^=l<<9|l>>>32-9,l=P+K|0,F^=l<<13|l>>>32-13,l=F+P|0,C^=l<<18|l>>>32-18,l=U+k|0,x^=l<<7|l>>>32-7,l=x+U|0,y^=l<<9|l>>>32-9,l=y+x|0,k^=l<<13|l>>>32-13,l=k+y|0,U^=l<<18|l>>>32-18,l=v+_|0,T^=l<<7|l>>>32-7,l=T+v|0,E^=l<<9|l>>>32-9,l=E+T|0,_^=l<<13|l>>>32-13,l=_+E|0,v^=l<<18|l>>>32-18,l=J+X|0,M^=l<<7|l>>>32-7,l=M+J|0,G^=l<<9|l>>>32-9,l=G+M|0,X^=l<<13|l>>>32-13,l=X+G|0,J^=l<<18|l>>>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 Kt(o,f,s,n){ht(o,f,s,n)}function Ot(o,f,s,n){vt(o,f,s,n)}var Ut=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function ve(o,f,s,n,c,h,p){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]=h[R];for(;c>=64;){for(Kt(S,b,p,Ut),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(Kt(S,b,p,Ut),R=0;R<c;R++)o[f+R]=s[n+R]^S[R];return 0}function Ge(o,f,s,n,c){var h=new Uint8Array(16),p=new Uint8Array(64),b,S;for(S=0;S<16;S++)h[S]=0;for(S=0;S<8;S++)h[S]=n[S];for(;s>=64;){for(Kt(p,h,c,Ut),S=0;S<64;S++)o[f+S]=p[S];for(b=1,S=8;S<16;S++)b=b+(h[S]&255)|0,h[S]=b&255,b>>>=8;s-=64,f+=64}if(s>0)for(Kt(p,h,c,Ut),S=0;S<s;S++)o[f+S]=p[S];return 0}function Je(o,f,s,n,c){var h=new Uint8Array(32);Ot(h,n,c,Ut);for(var p=new Uint8Array(8),b=0;b<8;b++)p[b]=n[b+16];return Ge(o,f,s,p,h)}function Ee(o,f,s,n,c,h,p){var b=new Uint8Array(32);Ot(b,h,p,Ut);for(var S=new Uint8Array(8),j=0;j<8;j++)S[j]=h[j+16];return ve(o,f,s,n,c,S,b)}var le=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,h,p,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,h=o[8]&255|(o[9]&255)<<8,this.r[4]=(c>>>4|h<<12)&255,this.r[5]=h>>>1&8190,p=o[10]&255|(o[11]&255)<<8,this.r[6]=(h>>>14|p<<2)&8191,b=o[12]&255|(o[13]&255)<<8,this.r[7]=(p>>>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};le.prototype.blocks=function(o,f,s){for(var n=this.fin?0:2048,c,h,p,b,S,j,R,rt,N,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],l=this.r[3],Q=this.r[4],nt=this.r[5],it=this.r[6],Z=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,h=o[f+2]&255|(o[f+3]&255)<<8,k+=(c>>>13|h<<3)&8191,p=o[f+4]&255|(o[f+5]&255)<<8,U+=(h>>>10|p<<6)&8191,b=o[f+6]&255|(o[f+7]&255)<<8,x+=(p>>>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,N=0,V=N,V+=F*G,V+=k*(5*et),V+=U*(5*tt),V+=x*(5*Z),V+=y*(5*it),N=V>>>13,V&=8191,V+=E*(5*nt),V+=_*(5*Q),V+=v*(5*l),V+=T*(5*J),V+=M*(5*X),N+=V>>>13,V&=8191,Y=N,Y+=F*X,Y+=k*G,Y+=U*(5*et),Y+=x*(5*tt),Y+=y*(5*Z),N=Y>>>13,Y&=8191,Y+=E*(5*it),Y+=_*(5*nt),Y+=v*(5*Q),Y+=T*(5*l),Y+=M*(5*J),N+=Y>>>13,Y&=8191,z=N,z+=F*J,z+=k*X,z+=U*G,z+=x*(5*et),z+=y*(5*tt),N=z>>>13,z&=8191,z+=E*(5*Z),z+=_*(5*it),z+=v*(5*nt),z+=T*(5*Q),z+=M*(5*l),N+=z>>>13,z&=8191,W=N,W+=F*l,W+=k*J,W+=U*X,W+=x*G,W+=y*(5*et),N=W>>>13,W&=8191,W+=E*(5*tt),W+=_*(5*Z),W+=v*(5*it),W+=T*(5*nt),W+=M*(5*Q),N+=W>>>13,W&=8191,q=N,q+=F*Q,q+=k*l,q+=U*J,q+=x*X,q+=y*G,N=q>>>13,q&=8191,q+=E*(5*et),q+=_*(5*tt),q+=v*(5*Z),q+=T*(5*it),q+=M*(5*nt),N+=q>>>13,q&=8191,$=N,$+=F*nt,$+=k*Q,$+=U*l,$+=x*J,$+=y*X,N=$>>>13,$&=8191,$+=E*G,$+=_*(5*et),$+=v*(5*tt),$+=T*(5*Z),$+=M*(5*it),N+=$>>>13,$&=8191,H=N,H+=F*it,H+=k*nt,H+=U*Q,H+=x*l,H+=y*J,N=H>>>13,H&=8191,H+=E*X,H+=_*G,H+=v*(5*et),H+=T*(5*tt),H+=M*(5*Z),N+=H>>>13,H&=8191,C=N,C+=F*Z,C+=k*it,C+=U*nt,C+=x*Q,C+=y*l,N=C>>>13,C&=8191,C+=E*J,C+=_*X,C+=v*G,C+=T*(5*et),C+=M*(5*tt),N+=C>>>13,C&=8191,K=N,K+=F*tt,K+=k*Z,K+=U*it,K+=x*nt,K+=y*Q,N=K>>>13,K&=8191,K+=E*l,K+=_*J,K+=v*X,K+=T*G,K+=M*(5*et),N+=K>>>13,K&=8191,P=N,P+=F*et,P+=k*tt,P+=U*Z,P+=x*it,P+=y*nt,N=P>>>13,P&=8191,P+=E*Q,P+=_*l,P+=v*J,P+=T*X,P+=M*G,N+=P>>>13,P&=8191,N=(N<<2)+N|0,N=N+V|0,V=N&8191,N=N>>>13,Y+=N,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},le.prototype.finish=function(o,f){var s=new Uint16Array(10),n,c,h,p;if(this.leftover){for(p=this.leftover,this.buffer[p++]=1;p<16;p++)this.buffer[p]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,p=2;p<10;p++)this.h[p]+=n,n=this.h[p]>>>13,this.h[p]&=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,p=1;p<10;p++)s[p]=this.h[p]+n,n=s[p]>>>13,s[p]&=8191;for(s[9]-=8192,c=(n^1)-1,p=0;p<10;p++)s[p]&=c;for(c=~c,p=0;p<10;p++)this.h[p]=this.h[p]&c|s[p];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,h=this.h[0]+this.pad[0],this.h[0]=h&65535,p=1;p<8;p++)h=(this.h[p]+this.pad[p]|0)+(h>>>16)|0,this.h[p]=h&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},le.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,h){var p=new le(h);return p.update(s,n,c),p.finish(o,f),0}function Ie(o,f,s,n,c,h){var p=new Uint8Array(16);return Ae(p,0,s,n,c,h),dt(o,f,p,0)}function Dt(o,f,s,n,c){var h;if(s<32)return-1;for(Ee(o,0,f,0,s,n,c),Ae(o,16,o,32,s-32,o),h=0;h<16;h++)o[h]=0;return 0}function Te(o,f,s,n,c){var h,p=new Uint8Array(32);if(s<32||(Je(p,0,32,n,c),Ie(f,16,f,32,s-32,p)!==0))return-1;for(Ee(o,0,f,0,s,n,c),h=0;h<32;h++)o[h]=0;return 0}function Nt(o,f){var s;for(s=0;s<16;s++)o[s]=f[s]|0}function Se(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),h=0;h<16;h++)n=c&(o[h]^f[h]),o[h]^=n,f[h]^=n}function te(o,f){var s,n,c,h=e(),p=e();for(s=0;s<16;s++)p[s]=f[s];for(Se(p),Se(p),Se(p),n=0;n<2;n++){for(h[0]=p[0]-65517,s=1;s<15;s++)h[s]=p[s]-65535-(h[s-1]>>16&1),h[s-1]&=65535;h[15]=p[15]-32767-(h[14]>>16&1),c=h[15]>>16&1,h[14]&=65535,Lt(p,h,1-c)}for(s=0;s<16;s++)o[2*s]=p[s]&255,o[2*s+1]=p[s]>>8}function Xe(o,f){var s=new Uint8Array(32),n=new Uint8Array(32);return te(s,o),te(n,f),bt(s,0,n,0)}function Ze(o){var f=new Uint8Array(32);return te(f,o),f[0]&1}function Br(o,f){var s;for(s=0;s<16;s++)o[s]=f[2*s]+(f[2*s+1]<<8);o[15]&=32767}function Ct(o,f,s){for(var n=0;n<16;n++)o[n]=f[n]+s[n]}function Ft(o,f,s){for(var n=0;n<16;n++)o[n]=f[n]-s[n]}function L(o,f,s){var n,c,h=0,p=0,b=0,S=0,j=0,R=0,rt=0,N=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,l=s[0],Q=s[1],nt=s[2],it=s[3],Z=s[4],tt=s[5],et=s[6],lt=s[7],at=s[8],ft=s[9],ct=s[10],ut=s[11],pt=s[12],wt=s[13],gt=s[14],_t=s[15];n=f[0],h+=n*l,p+=n*Q,b+=n*nt,S+=n*it,j+=n*Z,R+=n*tt,rt+=n*et,N+=n*lt,V+=n*at,Y+=n*ft,z+=n*ct,W+=n*ut,q+=n*pt,$+=n*wt,H+=n*gt,C+=n*_t,n=f[1],p+=n*l,b+=n*Q,S+=n*nt,j+=n*it,R+=n*Z,rt+=n*tt,N+=n*et,V+=n*lt,Y+=n*at,z+=n*ft,W+=n*ct,q+=n*ut,$+=n*pt,H+=n*wt,C+=n*gt,K+=n*_t,n=f[2],b+=n*l,S+=n*Q,j+=n*nt,R+=n*it,rt+=n*Z,N+=n*tt,V+=n*et,Y+=n*lt,z+=n*at,W+=n*ft,q+=n*ct,$+=n*ut,H+=n*pt,C+=n*wt,K+=n*gt,P+=n*_t,n=f[3],S+=n*l,j+=n*Q,R+=n*nt,rt+=n*it,N+=n*Z,V+=n*tt,Y+=n*et,z+=n*lt,W+=n*at,q+=n*ft,$+=n*ct,H+=n*ut,C+=n*pt,K+=n*wt,P+=n*gt,F+=n*_t,n=f[4],j+=n*l,R+=n*Q,rt+=n*nt,N+=n*it,V+=n*Z,Y+=n*tt,z+=n*et,W+=n*lt,q+=n*at,$+=n*ft,H+=n*ct,C+=n*ut,K+=n*pt,P+=n*wt,F+=n*gt,k+=n*_t,n=f[5],R+=n*l,rt+=n*Q,N+=n*nt,V+=n*it,Y+=n*Z,z+=n*tt,W+=n*et,q+=n*lt,$+=n*at,H+=n*ft,C+=n*ct,K+=n*ut,P+=n*pt,F+=n*wt,k+=n*gt,U+=n*_t,n=f[6],rt+=n*l,N+=n*Q,V+=n*nt,Y+=n*it,z+=n*Z,W+=n*tt,q+=n*et,$+=n*lt,H+=n*at,C+=n*ft,K+=n*ct,P+=n*ut,F+=n*pt,k+=n*wt,U+=n*gt,x+=n*_t,n=f[7],N+=n*l,V+=n*Q,Y+=n*nt,z+=n*it,W+=n*Z,q+=n*tt,$+=n*et,H+=n*lt,C+=n*at,K+=n*ft,P+=n*ct,F+=n*ut,k+=n*pt,U+=n*wt,x+=n*gt,y+=n*_t,n=f[8],V+=n*l,Y+=n*Q,z+=n*nt,W+=n*it,q+=n*Z,$+=n*tt,H+=n*et,C+=n*lt,K+=n*at,P+=n*ft,F+=n*ct,k+=n*ut,U+=n*pt,x+=n*wt,y+=n*gt,E+=n*_t,n=f[9],Y+=n*l,z+=n*Q,W+=n*nt,q+=n*it,$+=n*Z,H+=n*tt,C+=n*et,K+=n*lt,P+=n*at,F+=n*ft,k+=n*ct,U+=n*ut,x+=n*pt,y+=n*wt,E+=n*gt,_+=n*_t,n=f[10],z+=n*l,W+=n*Q,q+=n*nt,$+=n*it,H+=n*Z,C+=n*tt,K+=n*et,P+=n*lt,F+=n*at,k+=n*ft,U+=n*ct,x+=n*ut,y+=n*pt,E+=n*wt,_+=n*gt,v+=n*_t,n=f[11],W+=n*l,q+=n*Q,$+=n*nt,H+=n*it,C+=n*Z,K+=n*tt,P+=n*et,F+=n*lt,k+=n*at,U+=n*ft,x+=n*ct,y+=n*ut,E+=n*pt,_+=n*wt,v+=n*gt,T+=n*_t,n=f[12],q+=n*l,$+=n*Q,H+=n*nt,C+=n*it,K+=n*Z,P+=n*tt,F+=n*et,k+=n*lt,U+=n*at,x+=n*ft,y+=n*ct,E+=n*ut,_+=n*pt,v+=n*wt,T+=n*gt,M+=n*_t,n=f[13],$+=n*l,H+=n*Q,C+=n*nt,K+=n*it,P+=n*Z,F+=n*tt,k+=n*et,U+=n*lt,x+=n*at,y+=n*ft,E+=n*ct,_+=n*ut,v+=n*pt,T+=n*wt,M+=n*gt,G+=n*_t,n=f[14],H+=n*l,C+=n*Q,K+=n*nt,P+=n*it,F+=n*Z,k+=n*tt,U+=n*et,x+=n*lt,y+=n*at,E+=n*ft,_+=n*ct,v+=n*ut,T+=n*pt,M+=n*wt,G+=n*gt,X+=n*_t,n=f[15],C+=n*l,K+=n*Q,P+=n*nt,F+=n*it,k+=n*Z,U+=n*tt,x+=n*et,y+=n*lt,E+=n*at,_+=n*ft,v+=n*ct,T+=n*ut,M+=n*pt,G+=n*wt,X+=n*gt,J+=n*_t,h+=38*K,p+=38*P,b+=38*F,S+=38*k,j+=38*U,R+=38*x,rt+=38*y,N+=38*E,V+=38*_,Y+=38*v,z+=38*T,W+=38*M,q+=38*G,$+=38*X,H+=38*J,c=1,n=h+c+65535,c=Math.floor(n/65536),h=n-c*65536,n=p+c+65535,c=Math.floor(n/65536),p=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=N+c+65535,c=Math.floor(n/65536),N=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,h+=c-1+37*(c-1),c=1,n=h+c+65535,c=Math.floor(n/65536),h=n-c*65536,n=p+c+65535,c=Math.floor(n/65536),p=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=N+c+65535,c=Math.floor(n/65536),N=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,h+=c-1+37*(c-1),o[0]=h,o[1]=p,o[2]=b,o[3]=S,o[4]=j,o[5]=R,o[6]=rt,o[7]=N,o[8]=V,o[9]=Y,o[10]=z,o[11]=W,o[12]=q,o[13]=$,o[14]=H,o[15]=C}function Rt(o,f){L(o,f,f)}function bn(o,f){var s=e(),n;for(n=0;n<16;n++)s[n]=f[n];for(n=253;n>=0;n--)Rt(s,s),n!==2&&n!==4&&L(s,s,f);for(n=0;n<16;n++)o[n]=s[n]}function vn(o,f){var s=e(),n;for(n=0;n<16;n++)s[n]=f[n];for(n=250;n>=0;n--)Rt(s,s),n!==1&&L(s,s,f);for(n=0;n<16;n++)o[n]=s[n]}function Qe(o,f,s){var n=new Uint8Array(32),c=new Float64Array(80),h,p,b=e(),S=e(),j=e(),R=e(),rt=e(),N=e();for(p=0;p<31;p++)n[p]=f[p];for(n[31]=f[31]&127|64,n[0]&=248,Br(c,s),p=0;p<16;p++)S[p]=c[p],R[p]=b[p]=j[p]=0;for(b[0]=R[0]=1,p=254;p>=0;--p)h=n[p>>>3]>>>(p&7)&1,Lt(b,S,h),Lt(j,R,h),Ct(rt,b,j),Ft(b,b,j),Ct(j,S,R),Ft(S,S,R),Rt(R,rt),Rt(N,b),L(b,j,b),L(j,S,rt),Ct(rt,b,j),Ft(b,b,j),Rt(S,b),Ft(j,R,N),L(b,j,m),Ct(b,b,R),L(j,j,b),L(b,R,N),L(R,S,c),Rt(S,rt),Lt(b,S,h),Lt(j,R,h);for(p=0;p<16;p++)c[p+16]=b[p],c[p+32]=j[p],c[p+48]=S[p],c[p+64]=R[p];var V=c.subarray(32),Y=c.subarray(16);return bn(V,V),L(Y,Y,V),te(o,Y),0}function De(o,f){return Qe(o,f,a)}function En(o,f){return r(f,32),De(o,f)}function Le(o,f,s){var n=new Uint8Array(32);return Qe(n,s,f),Ot(o,i,n,Ut)}var An=Dt,io=Te;function oo(o,f,s,n,c,h){var p=new Uint8Array(32);return Le(p,c,h),An(o,f,s,n,p)}function ao(o,f,s,n,c,h){var p=new Uint8Array(32);return Le(p,c,h),io(o,f,s,n,p)}var Tn=[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 Sn(o,f,s,n){for(var c=new Int32Array(16),h=new Int32Array(16),p,b,S,j,R,rt,N,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],l=o[4],Q=o[5],nt=o[6],it=o[7],Z=f[0],tt=f[1],et=f[2],lt=f[3],at=f[4],ft=f[5],ct=f[6],ut=f[7],pt=0;n>=128;){for(k=0;k<16;k++)U=8*k+pt,c[k]=s[U+0]<<24|s[U+1]<<16|s[U+2]<<8|s[U+3],h[k]=s[U+4]<<24|s[U+5]<<16|s[U+6]<<8|s[U+7];for(k=0;k<80;k++)if(p=M,b=G,S=X,j=J,R=l,rt=Q,N=nt,V=it,Y=Z,z=tt,W=et,q=lt,$=at,H=ft,C=ct,K=ut,x=it,y=ut,E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=(l>>>14|at<<32-14)^(l>>>18|at<<32-18)^(at>>>41-32|l<<32-(41-32)),y=(at>>>14|l<<32-14)^(at>>>18|l<<32-18)^(l>>>41-32|at<<32-(41-32)),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=l&Q^~l&nt,y=at&ft^~at&ct,E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=Tn[k*2],y=Tn[k*2+1],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=c[k%16],y=h[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|Z<<32-28)^(Z>>>34-32|M<<32-(34-32))^(Z>>>39-32|M<<32-(39-32)),y=(Z>>>28|M<<32-28)^(M>>>34-32|Z<<32-(34-32))^(M>>>39-32|Z<<32-(39-32)),E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,x=M&G^M&X^G&X,y=Z&tt^Z&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=p,X=b,J=S,l=j,Q=R,nt=rt,it=N,M=V,tt=Y,et=z,lt=W,at=q,ft=$,ct=H,ut=C,Z=K,k%16===15)for(U=0;U<16;U++)x=c[U],y=h[U],E=y&65535,_=y>>>16,v=x&65535,T=x>>>16,x=c[(U+9)%16],y=h[(U+9)%16],E+=y&65535,_+=y>>>16,v+=x&65535,T+=x>>>16,P=c[(U+1)%16],F=h[(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=h[(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,h[U]=E&65535|_<<16;x=M,y=Z,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]=Z=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=lt,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]=lt=E&65535|_<<16,x=l,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]=l=v&65535|T<<16,f[4]=at=E&65535|_<<16,x=Q,y=ft,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]=Q=v&65535|T<<16,f[5]=ft=E&65535|_<<16,x=nt,y=ct,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]=ct=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,pt+=128,n-=128}return n}function re(o,f,s){var n=new Int32Array(8),c=new Int32Array(8),h=new Uint8Array(256),p,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,Sn(n,c,f,s),s%=128,p=0;p<s;p++)h[p]=f[b-s+p];for(h[s]=128,s=256-128*(s<112?1:0),h[s-9]=0,D(h,s-8,b/536870912|0,b<<3),Sn(n,c,h,s),p=0;p<8;p++)D(o,8*p,n[p],c[p]);return 0}function tr(o,f){var s=e(),n=e(),c=e(),h=e(),p=e(),b=e(),S=e(),j=e(),R=e();Ft(s,o[1],o[0]),Ft(R,f[1],f[0]),L(s,s,R),Ct(n,o[0],o[1]),Ct(R,f[0],f[1]),L(n,n,R),L(c,o[3],f[3]),L(c,c,A),L(h,o[2],f[2]),Ct(h,h,h),Ft(p,n,s),Ft(b,h,c),Ct(S,h,c),Ct(j,n,s),L(o[0],p,b),L(o[1],j,S),L(o[2],S,b),L(o[3],p,j)}function On(o,f,s){var n;for(n=0;n<4;n++)Lt(o[n],f[n],s)}function Pr(o,f){var s=e(),n=e(),c=e();bn(c,f[2]),L(s,f[0],c),L(n,f[1],c),te(o,n),o[31]^=Ze(s)<<7}function Nr(o,f,s){var n,c;for(Nt(o[0],u),Nt(o[1],d),Nt(o[2],d),Nt(o[3],u),c=255;c>=0;--c)n=s[c/8|0]>>(c&7)&1,On(o,f,n),tr(f,o),tr(o,o),On(o,f,n)}function er(o,f){var s=[e(),e(),e(),e()];Nt(s[0],B),Nt(s[1],O),Nt(s[2],d),L(s[3],B,O),Nr(o,s,f)}function Cr(o,f,s){var n=new Uint8Array(64),c=[e(),e(),e(),e()],h;for(s||r(f,32),re(n,f,32),n[0]&=248,n[31]&=127,n[31]|=64,er(c,n),Pr(o,c),h=0;h<32;h++)f[h+32]=o[h];return 0}var rr=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 Fr(o,f){var s,n,c,h;for(n=63;n>=32;--n){for(s=0,c=n-32,h=n-12;c<h;++c)f[c]+=s-16*f[n]*rr[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)*rr[c],s=f[c]>>8,f[c]&=255;for(c=0;c<32;c++)f[c]-=s*rr[c];for(n=0;n<32;n++)f[n+1]+=f[n]>>8,o[n]=f[n]&255}function kr(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;Fr(o,f)}function Un(o,f,s,n){var c=new Uint8Array(64),h=new Uint8Array(64),p=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(p,o.subarray(32),s+32),kr(p),er(R,p),Pr(o,R),b=32;b<64;b++)o[b]=n[b];for(re(h,o,s+64),kr(h),b=0;b<64;b++)j[b]=0;for(b=0;b<32;b++)j[b]=p[b];for(b=0;b<32;b++)for(S=0;S<32;S++)j[b+S]+=h[b]*c[S];return Fr(o.subarray(32),j),rt}function so(o,f){var s=e(),n=e(),c=e(),h=e(),p=e(),b=e(),S=e();return Nt(o[2],d),Br(o[1],f),Rt(c,o[1]),L(h,c,w),Ft(c,c,o[2]),Ct(h,o[2],h),Rt(p,h),Rt(b,p),L(S,b,p),L(s,S,c),L(s,s,h),vn(s,s),L(s,s,c),L(s,s,h),L(s,s,h),L(o[0],s,h),Rt(n,o[0]),L(n,n,h),Xe(n,c)&&L(o[0],o[0],I),Rt(n,o[0]),L(n,n,h),Xe(n,c)?-1:(Ze(o[0])===f[31]>>7&&Ft(o[0],u,o[0]),L(o[3],o[0],o[1]),0)}function jr(o,f,s,n){var c,h=new Uint8Array(32),p=new Uint8Array(64),b=[e(),e(),e(),e()],S=[e(),e(),e(),e()];if(s<64||so(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(p,o,s),kr(p),Nr(b,S,p),er(S,f.subarray(32)),tr(b,S),Pr(h,b),s-=64,bt(f,0,h,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 Kr=32,nr=24,Oe=32,de=16,Ue=32,ir=32,Re=32,Be=32,Mr=32,Rn=nr,fo=Oe,co=de,zt=64,ne=32,he=64,Vr=32,Yr=64;t.lowlevel={crypto_core_hsalsa20:Ot,crypto_stream_xor:Ee,crypto_stream:Je,crypto_stream_salsa20_xor:ve,crypto_stream_salsa20:Ge,crypto_onetimeauth:Ae,crypto_onetimeauth_verify:Ie,crypto_verify_16:dt,crypto_verify_32:bt,crypto_secretbox:Dt,crypto_secretbox_open:Te,crypto_scalarmult:Qe,crypto_scalarmult_base:De,crypto_box_beforenm:Le,crypto_box_afternm:An,crypto_box:oo,crypto_box_open:ao,crypto_box_keypair:En,crypto_hash:re,crypto_sign:Un,crypto_sign_keypair:Cr,crypto_sign_open:jr,crypto_secretbox_KEYBYTES:Kr,crypto_secretbox_NONCEBYTES:nr,crypto_secretbox_ZEROBYTES:Oe,crypto_secretbox_BOXZEROBYTES:de,crypto_scalarmult_BYTES:Ue,crypto_scalarmult_SCALARBYTES:ir,crypto_box_PUBLICKEYBYTES:Re,crypto_box_SECRETKEYBYTES:Be,crypto_box_BEFORENMBYTES:Mr,crypto_box_NONCEBYTES:Rn,crypto_box_ZEROBYTES:fo,crypto_box_BOXZEROBYTES:co,crypto_sign_BYTES:zt,crypto_sign_PUBLICKEYBYTES:ne,crypto_sign_SECRETKEYBYTES:he,crypto_sign_SEEDBYTES:Vr,crypto_hash_BYTES:Yr,gf:e,D:w,L:rr,pack25519:te,unpack25519:Br,M:L,A:Ct,S:Rt,Z:Ft,pow2523:vn,add:tr,set25519:Nt,modL:Fr,scalarmult:Nr,scalarbase:er};function Bn(o,f){if(o.length!==Kr)throw new Error("bad key size");if(f.length!==nr)throw new Error("bad nonce size")}function uo(o,f){if(o.length!==Re)throw new Error("bad public key size");if(f.length!==Be)throw new Error("bad secret key size")}function Tt(){for(var o=0;o<arguments.length;o++)if(!(arguments[o]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Pn(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){Tt(o,f,s),Bn(s,f);for(var n=new Uint8Array(Oe+o.length),c=new Uint8Array(n.length),h=0;h<o.length;h++)n[h+Oe]=o[h];return Dt(c,n,n.length,f,s),c.subarray(de)},t.secretbox.open=function(o,f,s){Tt(o,f,s),Bn(s,f);for(var n=new Uint8Array(de+o.length),c=new Uint8Array(n.length),h=0;h<o.length;h++)n[h+de]=o[h];return n.length<32||Te(c,n,n.length,f,s)!==0?null:c.subarray(Oe)},t.secretbox.keyLength=Kr,t.secretbox.nonceLength=nr,t.secretbox.overheadLength=de,t.scalarMult=function(o,f){if(Tt(o,f),o.length!==ir)throw new Error("bad n size");if(f.length!==Ue)throw new Error("bad p size");var s=new Uint8Array(Ue);return Qe(s,o,f),s},t.scalarMult.base=function(o){if(Tt(o),o.length!==ir)throw new Error("bad n size");var f=new Uint8Array(Ue);return De(f,o),f},t.scalarMult.scalarLength=ir,t.scalarMult.groupElementLength=Ue,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){Tt(o,f),uo(o,f);var s=new Uint8Array(Mr);return Le(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(Re),f=new Uint8Array(Be);return En(o,f),{publicKey:o,secretKey:f}},t.box.keyPair.fromSecretKey=function(o){if(Tt(o),o.length!==Be)throw new Error("bad secret key size");var f=new Uint8Array(Re);return De(f,o),{publicKey:f,secretKey:new Uint8Array(o)}},t.box.publicKeyLength=Re,t.box.secretKeyLength=Be,t.box.sharedKeyLength=Mr,t.box.nonceLength=Rn,t.box.overheadLength=t.secretbox.overheadLength,t.sign=function(o,f){if(Tt(o,f),f.length!==he)throw new Error("bad secret key size");var s=new Uint8Array(zt+o.length);return Un(s,o,o.length,f),s},t.sign.open=function(o,f){if(Tt(o,f),f.length!==ne)throw new Error("bad public key size");var s=new Uint8Array(o.length),n=jr(s,o,o.length,f);if(n<0)return null;for(var c=new Uint8Array(n),h=0;h<c.length;h++)c[h]=s[h];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(Tt(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),h;for(h=0;h<zt;h++)n[h]=f[h];for(h=0;h<o.length;h++)n[h+zt]=o[h];return jr(c,n,n.length,s)>=0},t.sign.keyPair=function(){var o=new Uint8Array(ne),f=new Uint8Array(he);return Cr(o,f),{publicKey:o,secretKey:f}},t.sign.keyPair.fromSecretKey=function(o){if(Tt(o),o.length!==he)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(Tt(o),o.length!==Vr)throw new Error("bad seed size");for(var f=new Uint8Array(ne),s=new Uint8Array(he),n=0;n<32;n++)s[n]=o[n];return Cr(f,s,!0),{publicKey:f,secretKey:s}},t.sign.publicKeyLength=ne,t.sign.secretKeyLength=he,t.sign.seedLength=Vr,t.sign.signatureLength=zt,t.hash=function(o){Tt(o);var f=new Uint8Array(Yr);return re(f,o,o.length),f},t.hash.hashLength=Yr,t.verify=function(o,f){return Tt(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,h=new Uint8Array(n);for(c=0;c<n;c+=f)o.getRandomValues(h.subarray(c,c+Math.min(n-c,f)));for(c=0;c<n;c++)s[c]=h[c];Pn(h)})}else typeof Nn<"u"&&(o=Ai(),o&&o.randomBytes&&t.setPRNG(function(s,n){var c,h=o.randomBytes(n);for(c=0;c<n;c++)s[c]=h[c];Pn(h)}))}()})(typeof br<"u"&&br.exports?br.exports:self.nacl=self.nacl||{})});var yt=t=>t==null,yo=t=>!yt(t);var mt=t=>yo(t)?[t]:[],St=t=>t?.[0],Vn=async t=>{let e=new Blob([JSON.stringify(t)],{type:"application/json; charset=utf-8"});return new Uint8Array(await e.arrayBuffer())},Yn=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())},sr=()=>typeof window<"u";var xe=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 xe{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 qn=({message:t,detail:e})=>{let r=new CustomEvent(t,{detail:e,bubbles:!0});document.dispatchEvent(r)};var Hn=BigInt(144e11),$n={width:576,height:576},Wn={width:505,height:705},zn="internetcomputer.org";var Et=class t extends xe{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 qr=({width:t,height:e})=>{if(!sr()||yt(window)||yt(window.top))return;let{top:{innerWidth:r,innerHeight:i}}=window,a=i/2+screenY-e/2,u=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=${u}`};var fr=class{#t;constructor({domain:e}){this.#t=e}get id(){return"internet_identity"}signInOptions({windowed:e}){let r=Et.getInstance().localIdentity()?`http://${Et.getInstance().get()?.localIdentityCanisterId}.localhost:8000`:`https://identity.${this.#t??zn}`;return{...e!==!1&&{windowOpenerFeatures:qr($n)},identityProvider:r}}},Gn=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:qr(Wn)},identityProvider:`https://nfid.one/authenticate/?applicationName=${encodeURI(this.#t)}&applicationLogo=${encodeURI(this.#e)}`}}};var _i=pe(fi());var dr;(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"})(dr||(dr={}));var Jo=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},Io=new TextEncoder().encode(`
2
+ ic-request`),Xt=class{getPrincipal(){return this._principal||(this._principal=ot.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()))),this._principal}async transformRequest(e){let{body:r}=e,i=Jo(e,["body"]),a=await ie(r);return Object.assign(Object.assign({},i),{body:{content:r,sender_pubkey:this.getPublicKey().toDer(),sender_sig:await this.sign(kn(Io,a))}})}},Zt=class{getPrincipal(){return ot.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var ci=pe(Kn());var Fe=()=>{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 hr;(function(t){t.Call="call"})(hr||(hr={}));function ke(){let t=new ArrayBuffer(16),e=new DataView(t),r=Fe(),i=Fe(),a=Fe(),u=Fe();return e.setUint32(0,r),e.setUint32(4,i),e.setUint32(8,a),e.setUint32(12,u),t}var Xo=BigInt(1e6),Zo=BigInt(60*1e3),se=class{constructor(e){this._value=(BigInt(Date.now())+BigInt(e)-Zo)*Xo}toCBOR(){return ci.value.u64(this._value.toString(16),16)}toHash(){return Fn(this._value)}};function ui(t=ke){return async e=>{let r=t(),i=e.request.headers;e.request.headers=i,e.endpoint==="call"&&(e.body.nonce=t())}}function pr(t){let e=[];return t.forEach((r,i)=>{e.push([i,r])}),e}var xr=class extends Error{constructor(e,r){super(e),this.response=r,this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}};var Yt;(function(t){t.Received="received",t.Processing="processing",t.Replied="replied",t.Rejected="rejected",t.Unknown="unknown",t.Done="done"})(Yt||(Yt={}));var yr=5*60*1e3,Do="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",Lo="ic0.app",ta=".ic0.app",ea="icp0.io",ra=".icp0.io",na="icp-api.io",ia=".icp-api.io",je=class extends Pe{constructor(e){super(e),this.message=e}},we=class extends Pe{constructor(e){super(e),this.message=e}};function oa(){let t;if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new je("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 je("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 je("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}var Ke=class t{constructor(e={}){if(this.rootKey=jn(Do),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||oa()||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,u;a&&typeof a=="string"&&(u=i.find(d=>a.endsWith(d))),r&&u?this._host=new URL(`${r.protocol}//${u}${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(ta)?this._host.hostname=Lo:this._host.hostname.endsWith(ra)?this._host.hostname=ea:this._host.hostname.endsWith(ia)&&(this._host.hostname=na),e.credentials){let{name:r,password:i}=e.credentials;this._credentials=`${r}${i?":"+i:""}`}this._identity=Promise.resolve(e.identity||new Zt),e.disableNonce||this.addTransform(ui(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 we("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 we("This identity has expired due this application's security policy. Please refresh your authentication.");let u=ot.from(e),d=r.effectiveCanisterId?ot.from(r.effectiveCanisterId):u,m=a.getPrincipal()||ot.anonymous(),w=new se(yr);Math.abs(this._timeDiffMsecs)>1e3*30&&(w=new se(yr+this._timeDiffMsecs));let A={request_type:hr.Call,canister_id:u,method_name:r.methodName,arg:r.arg,sender:m,ingress_expiry:w},B=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});B=await a.transformRequest(B);let O=ar(B.body),I=this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${d.toText()}/call`,this._host),Object.assign(Object.assign(Object.assign({},this._callOptions),B.request),{body:O}))),[D,st]=await Promise.all([I,ie(A)]),dt=await D.arrayBuffer(),bt=D.status===200&&dt.byteLength>0?Ce(dt):null;return{requestId:st,response:{ok:D.ok,status:D.status,statusText:D.statusText,body:bt,headers:pr(D.headers)}}}async _requestAndRetry(e,r=0){let i=await e();if(i.ok)return i;let a=await i.clone().text(),u=`Server returned an error:
3
3
  Code: ${i.status} (${i.statusText})
4
4
  Body: ${a}
5
- `;if(this._retryTimes>r)return console.warn(u+" Retrying request."),await this._requestAndRetry(t,r+1);throw new wr(u,{ok:i.ok,status:i.status,statusText:i.statusText,headers:mr(i.headers)})}async query(t,r,i){let a=await(i!==void 0?await i:await this._identity);if(!a)throw new Ae("This identity has expired due this application's security policy. Please refresh your authentication.");let u=typeof t=="string"?ot.fromText(t):t,d=a?.getPrincipal()||ot.anonymous(),m={request_type:"query",canister_id:u,method_name:r.methodName,arg:r.arg,sender:d,ingress_expiry:new ce(gr)},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=cr(w.body),B=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${u.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),w.request),{body:A}))),O=Ve(await B.arrayBuffer());return Object.assign(Object.assign({},O),{httpDetails:{ok:B.ok,status:B.status,statusText:B.statusText,headers:mr(B.headers)}})}async createReadStateRequest(t,r){let i=await(r!==void 0?await r:await this._identity);if(!i)throw new Ae("This identity has expired due this application's security policy. Please refresh your authentication.");let a=i?.getPrincipal()||ot.anonymous(),u=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:t.paths,sender:a,ingress_expiry:new ce(gr)}});return i?.transformRequest(u)}async readState(t,r,i,a){let u=typeof t=="string"?ot.fromText(t):t,d=a??await this.createReadStateRequest(r,i),m=cr(d.body),w=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${u}/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(u+" Retrying request."),await this._requestAndRetry(e,r+1);throw new xr(u,{ok:i.ok,status:i.status,statusText:i.statusText,headers:pr(i.headers)})}async query(e,r,i){let a=await(i!==void 0?await i:await this._identity);if(!a)throw new we("This identity has expired due this application's security policy. Please refresh your authentication.");let u=typeof e=="string"?ot.fromText(e):e,d=a?.getPrincipal()||ot.anonymous(),m={request_type:"query",canister_id:u,method_name:r.methodName,arg:r.arg,sender:d,ingress_expiry:new se(yr)},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=ar(w.body),B=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${u.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),w.request),{body:A}))),O=Ce(await B.arrayBuffer());return Object.assign(Object.assign({},O),{httpDetails:{ok:B.ok,status:B.status,statusText:B.statusText,headers:pr(B.headers)}})}async createReadStateRequest(e,r){let i=await(r!==void 0?await r:await this._identity);if(!i)throw new we("This identity has expired due this application's security policy. Please refresh your authentication.");let a=i?.getPrincipal()||ot.anonymous(),u=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 se(yr)}});return i?.transformRequest(u)}async readState(e,r,i,a){let u=typeof e=="string"?ot.fromText(e):e,d=a??await this.createReadStateRequest(r,i),m=ar(d.body),w=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${u}/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 Ve(await w.arrayBuffer())}async syncTime(t){let r=await import("./canisterStatus-B3CYYH7Z.js"),i=Date.now();try{t||console.log("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let u=(await r.request({canisterId:t??ot.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");u&&(this._timeDiffMsecs=Number(u)-Number(i))}catch(a){console.error("Caught exception while attempting to sync time:",a)}}async status(){let t=this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{},r=await this._requestAndRetry(()=>this._fetch(""+new URL("/api/v2/status",this._host),Object.assign({headers:t},this._fetchOptions)));return Ve(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(t){this._identity=Promise.resolve(t)}_transform(t){let r=Promise.resolve(t);for(let i of this._pipeline)r=r.then(a=>i(a).then(u=>u||a));return r}};var pi;(function(e){e.Error="err",e.GetPrincipal="gp",e.GetPrincipalResponse="gpr",e.Query="q",e.QueryResponse="qr",e.Call="c",e.CallResponse="cr",e.ReadState="rs",e.ReadStateResponse="rsr",e.Status="s",e.StatusResponse="sr"})(pi||(pi={}));function Lr(){let e=typeof window>"u"?typeof globalThis>"u"?typeof self>"u"?void 0:self.ic.agent:globalThis.ic.agent:window.ic.agent;if(!e)throw new Error("No Agent could be found.");return e}var _r={};jn(_r,{backoff:()=>gi,chain:()=>_i,conditionalDelay:()=>mi,defaultStrategy:()=>xi,maxAttempts:()=>ua,once:()=>yi,throttle:()=>la,timeout:()=>wi});var ca=5*60*1e3;function xi(){return _i(mi(yi(),1e3),gi(1e3,1.2),wi(ca))}function yi(){let e=!0;return async()=>e?(e=!1,!0):!1}function mi(e,t){return async(r,i,a)=>{if(await e(r,i,a))return new Promise(u=>setTimeout(u,t))}}function ua(e){let t=e;return async(r,i,a)=>{if(--t<=0)throw new Error(`Failed to retrieve a reply for request after ${e} attempts:
9
- Request ID: ${Xt(i)}
8
+ `);return Ce(await w.arrayBuffer())}async syncTime(e){let r=await import("./canisterStatus-S2QRROEO.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 u=(await r.request({canisterId:e??ot.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");u&&(this._timeDiffMsecs=Number(u)-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 Ce(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(u=>u||a));return r}};var li;(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"})(li||(li={}));function Zr(){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 mr={};Cn(mr,{backoff:()=>yi,chain:()=>mi,conditionalDelay:()=>pi,defaultStrategy:()=>di,maxAttempts:()=>sa,once:()=>hi,throttle:()=>fa,timeout:()=>xi});var aa=5*60*1e3;function di(){return mi(pi(hi(),1e3),yi(1e3,1.2),xi(aa))}function hi(){let t=!0;return async()=>t?(t=!1,!0):!1}function pi(t,e){return async(r,i,a)=>{if(await t(r,i,a))return new Promise(u=>setTimeout(u,e))}}function sa(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
+ Request ID: ${Gt(i)}
10
10
  Request status: ${a}
11
- `)}}function la(e){return()=>new Promise(t=>setTimeout(t,e))}function wi(e){let t=Date.now()+e;return async(r,i,a)=>{if(Date.now()>t)throw new Error(`Request timed out after ${e} msec:
12
- Request ID: ${Xt(i)}
11
+ `)}}function fa(t){return()=>new Promise(e=>setTimeout(e,t))}function xi(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
+ Request ID: ${Gt(i)}
13
13
  Request status: ${a}
14
- `)}}function gi(e,t){let r=e;return()=>new Promise(i=>setTimeout(()=>{r*=t,i()},r))}function _i(...e){return async(t,r,i)=>{for(let a of e)await a(t,r,i)}}async function tn(e,t,r,i,a,u){var d;let m=[new TextEncoder().encode("request_status"),r],w=a??await((d=e.createReadStateRequest)===null||d===void 0?void 0:d.call(e,{paths:[m]})),A=await e.readState(t,{paths:[m]},void 0,w);if(e.rootKey==null)throw new Error("Agent root key not initialized before polling");let B=await qn.create({certificate:A.certificate,rootKey:e.rootKey,canisterId:t,blsVerify:u}),O=B.lookup([...m,new TextEncoder().encode("status")]),Z;switch(typeof O>"u"?Z=$t.Unknown:Z=new TextDecoder().decode(O),Z){case $t.Replied:return B.lookup([...m,"reply"]);case $t.Received:case $t.Unknown:case $t.Processing:return await i(t,r,Z),tn(e,t,r,i,w);case $t.Rejected:{let D=new Uint8Array(B.lookup([...m,"reject_code"]))[0],st=new TextDecoder().decode(B.lookup([...m,"reject_message"]));throw new Error(`Call was rejected:
15
- Request ID: ${Xt(r)}
14
+ `)}}function yi(t,e){let r=t;return()=>new Promise(i=>setTimeout(()=>{r*=e,i()},r))}function mi(...t){return async(e,r,i)=>{for(let a of t)await a(e,r,i)}}async function Qr(t,e,r,i,a,u){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 B=await Mn.create({certificate:A.certificate,rootKey:t.rootKey,canisterId:e,blsVerify:u}),O=B.lookup([...m,new TextEncoder().encode("status")]),I;switch(typeof O>"u"?I=Yt.Unknown:I=new TextDecoder().decode(O),I){case Yt.Replied:return B.lookup([...m,"reply"]);case Yt.Received:case Yt.Unknown:case Yt.Processing:return await i(e,r,I),Qr(t,e,r,i,w);case Yt.Rejected:{let D=new Uint8Array(B.lookup([...m,"reject_code"]))[0],st=new TextDecoder().decode(B.lookup([...m,"reject_message"]));throw new Error(`Call was rejected:
15
+ Request ID: ${Gt(r)}
16
16
  Reject code: ${D}
17
17
  Reject text: ${st}
18
- `)}case $t.Done:throw new Error(`Call was marked as done but we never saw the reply:
19
- Request ID: ${Xt(r)}
20
- `)}throw new Error("unreachable")}var bi=({IDL:e})=>{let t=e.Principal,r=e.Record({controllers:e.Vec(e.Principal),freezing_threshold:e.Nat,memory_allocation:e.Nat,compute_allocation:e.Nat}),i=e.Record({controllers:e.Opt(e.Vec(e.Principal)),freezing_threshold:e.Opt(e.Nat),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),a=e.Vec(e.Nat8);return e.Service({canister_status:e.Func([e.Record({canister_id:t})],[e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:r,module_hash:e.Opt(e.Vec(e.Nat8))})],[]),create_canister:e.Func([e.Record({settings:e.Opt(i)})],[e.Record({canister_id:t})],[]),delete_canister:e.Func([e.Record({canister_id:t})],[],[]),deposit_cycles:e.Func([e.Record({canister_id:t})],[],[]),install_code:e.Func([e.Record({arg:e.Vec(e.Nat8),wasm_module:a,mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),canister_id:t})],[],[]),provisional_create_canister_with_cycles:e.Func([e.Record({settings:e.Opt(i),amount:e.Opt(e.Nat)})],[e.Record({canister_id:t})],[]),provisional_top_up_canister:e.Func([e.Record({canister_id:t,amount:e.Nat})],[],[]),raw_rand:e.Func([],[e.Vec(e.Nat8)],[]),start_canister:e.Func([e.Record({canister_id:t})],[],[]),stop_canister:e.Func([e.Record({canister_id:t})],[],[]),uninstall_code:e.Func([e.Record({canister_id:t})],[],[]),update_settings:e.Func([e.Record({canister_id:e.Principal,settings:i})],[],[])})};var vr=class extends Ke{constructor(t,r,i,a){super(["Call failed:",` Canister: ${t.toText()}`,` Method: ${r} (${i})`,...Object.getOwnPropertyNames(a).map(u=>` "${u}": ${JSON.stringify(a[u])}`)].join(`
21
- `)),this.canisterId=t,this.methodName=r,this.type=i,this.props=a}},en=class extends vr{constructor(t,r,i){var a;super(t,r,"query",{Status:i.status,Code:(a=xr[i.reject_code])!==null&&a!==void 0?a:`Unknown Code "${i.reject_code}"`,Message:i.reject_message}),this.result=i}},rn=class extends vr{constructor(t,r,i,a){super(t,r,"update",Object.assign({"Request ID":Xt(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}},nn;(function(e){e.Install="install",e.Reinstall="reinstall",e.Upgrade="upgrade"})(nn||(nn={}));var Nt=Symbol.for("ic-agent-metadata"),Lt=class{constructor(t){this[Nt]=Object.freeze(t)}static agentOf(t){return t[Nt].config.agent}static interfaceOf(t){return t[Nt].service}static canisterIdOf(t){return ot.from(t[Nt].config.canisterId)}static async install(t,r){let i=t.mode===void 0?nn.Install:t.mode,a=t.arg?[...new Uint8Array(t.arg)]:[],u=[...new Uint8Array(t.module)],d=typeof r.canisterId=="string"?ot.fromText(r.canisterId):r.canisterId;await vi(r).install_code({mode:{[i]:null},arg:a,wasm_module:u,canister_id:d})}static async createCanister(t){let{canister_id:r}=await vi(t||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(t,r,i){let a=await this.createCanister(i);return await this.install(Object.assign({},r),Object.assign(Object.assign({},i),{canisterId:a})),this.createActor(t,Object.assign(Object.assign({},i),{canisterId:a}))}static createActorClass(t,r){let i=t({IDL:Me});class a extends Lt{constructor(d){let m=typeof d.canisterId=="string"?ot.fromText(d.canisterId):d.canisterId;super({config:Object.assign(Object.assign(Object.assign({},Ai),d),{canisterId:m}),service:i});for(let[w,A]of i._fields)r?.httpDetails&&A.annotations.push(on),this[w]=ha(this,w,A,d.blsVerify)}}return a}static createActor(t,r){return new(this.createActorClass(t))(r)}static createActorWithHttpDetails(t,r){return new(this.createActorClass(t,{httpDetails:!0}))(r)}};function br(e,t){let r=Me.decode(e,Ei.Buffer.from(t));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var Ai={pollingStrategyFactory:_r.defaultStrategy},on="http-details";function ha(e,t,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=e[Nt].config).queryTransform)===null||A===void 0?void 0:A.call(w,t,m,Object.assign(Object.assign({},e[Nt].config),d)));let B=d.agent||e[Nt].config.agent||Lr(),O=ot.from(d.canisterId||e[Nt].config.canisterId),Z=Me.encode(r.argTypes,m),D=await B.query(O,{methodName:t,arg:Z});switch(D.status){case"rejected":throw new en(O,t,D);case"replied":return r.annotations.includes(on)?{httpDetails:D.httpDetails,result:br(r.retTypes,D.reply.arg)}:br(r.retTypes,D.reply.arg)}}:a=async(d,...m)=>{var w,A;d=Object.assign(Object.assign({},d),(A=(w=e[Nt].config).callTransform)===null||A===void 0?void 0:A.call(w,t,m,Object.assign(Object.assign({},e[Nt].config),d)));let B=d.agent||e[Nt].config.agent||Lr(),{canisterId:O,effectiveCanisterId:Z,pollingStrategyFactory:D}=Object.assign(Object.assign(Object.assign({},Ai),e[Nt].config),d),st=ot.from(O),dt=Z!==void 0?ot.from(Z):st,vt=Me.encode(r.argTypes,m),{requestId:ht,response:Et}=await B.call(st,{methodName:t,arg:vt,effectiveCanisterId:dt});if(!Et.ok||Et.body)throw new rn(st,t,ht,Et);let Vt=D(),Ut=await tn(B,dt,ht,Vt,i),Tt=r.annotations.includes(on);if(Ut!==void 0)return Tt?{httpDetails:Et,result:br(r.retTypes,Ut)}:br(r.retTypes,Ut);if(r.retTypes.length===0)return Tt?{httpDetails:Et,result:void 0}:void 0;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let u=(...d)=>a({},...d);return u.withOptions=d=>(...m)=>a(d,...m),u}function vi(e){function t(r,i,a){let u=i[0],d=ot.fromHex("");return u&&typeof u=="object"&&u.canister_id&&(d=ot.from(u.canister_id)),{effectiveCanisterId:d}}return Lt.createActor(bi,Object.assign(Object.assign(Object.assign({},e),{canisterId:ot.fromHex("")}),{callTransform:t,queryTransform:t}))}var $e=we(an());function Te(e){var t;return new Uint8Array(((t=e.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(r=>parseInt(r,16))).buffer}function te(e){return new Uint8Array(e).reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}var ya=(e,t)=>{if(e.byteLength!==t.byteLength)return!1;let r=new Uint8Array(e),i=new Uint8Array(t);for(let a=0;a<r.length;a++)if(r[a]!==i[a])return!1;return!0},Ui=e=>{if(e<=127)return 1;if(e<=255)return 2;if(e<=65535)return 3;if(e<=16777215)return 4;throw new Error("Length too long (> 4 bytes)")},Ri=(e,t,r)=>{if(r<=127)return e[t]=r,1;if(r<=255)return e[t]=129,e[t+1]=r,2;if(r<=65535)return e[t]=130,e[t+1]=r>>8,e[t+2]=r,3;if(r<=16777215)return e[t]=131,e[t+1]=r>>16,e[t+2]=r>>8,e[t+3]=r,4;throw new Error("Length too long (> 4 bytes)")},sn=(e,t)=>{if(e[t]<128)return 1;if(e[t]===128)throw new Error("Invalid length 0");if(e[t]===129)return 2;if(e[t]===130)return 3;if(e[t]===131)return 4;throw new Error("Length too long (> 4 bytes)")},ma=(e,t)=>{let r=sn(e,t);if(r===1)return e[t];if(r===2)return e[t+1];if(r===3)return(e[t+1]<<8)+e[t+2];if(r===4)return(e[t+1]<<16)+(e[t+2]<<8)+e[t+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]),Tr=Uint8Array.from([48,5,6,3,43,101,112]),Uf=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function Sr(e,t){let r=2+Ui(e.byteLength+1),i=t.byteLength+r+e.byteLength,a=0,u=new Uint8Array(1+Ui(i)+i);return u[a++]=48,a+=Ri(u,a,i),u.set(t,a),a+=t.byteLength,u[a++]=3,a+=Ri(u,a,e.byteLength+1),u[a++]=0,u.set(new Uint8Array(e),a),u}var fn=(e,t)=>{let r=0,i=(m,w)=>{if(a[r++]!==m)throw new Error("Expected: "+w)},a=new Uint8Array(e);if(i(48,"sequence"),r+=sn(a,r),!ya(a.slice(r,r+t.byteLength),t))throw new Error("Not the expected OID.");r+=t.byteLength,i(3,"bit string");let u=ma(a,r)-1;r+=sn(a,r),i(0,"0 padding");let d=a.slice(r);if(u!==d.length)throw new Error(`DER payload mismatch: Expected length ${u} actual length ${d.length}`);return d};var Pt=class{constructor(t){this.rawKey=t,this.derKey=Pt.derEncode(t)}static from(t){return this.fromDer(t.toDer())}static fromRaw(t){return new Pt(t)}static fromDer(t){return new Pt(this.derDecode(t))}static derEncode(t){return Sr(t,Tr).buffer}static derDecode(t){let r=fn(t,Tr);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}};Pt.RAW_KEY_LENGTH=32;var jt=class extends Qt{constructor(t,r){super(),this._privateKey=r,this._publicKey=Pt.from(t)}static generate(t){if(t&&t.length!==32)throw new Error("Ed25519 Seed needs to be 32 bytes long.");let{publicKey:r,secretKey:i}=t===void 0?$e.sign.keyPair():$e.sign.keyPair.fromSeed(t);return new this(Pt.fromRaw(r),i)}static fromParsedJson(t){let[r,i]=t;return new jt(Pt.fromDer(Te(r)),Te(i))}static fromJSON(t){let r=JSON.parse(t);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(t)}`)}static fromKeyPair(t,r){return new jt(Pt.fromRaw(t),r)}static fromSecretKey(t){let r=$e.sign.keyPair.fromSecretKey(new Uint8Array(t));return jt.fromKeyPair(r.publicKey,r.secretKey)}toJSON(){return[te(this._publicKey.toDer()),te(this._privateKey)]}getKeyPair(){return{secretKey:this._privateKey,publicKey:this._publicKey}}getPublicKey(){return this._publicKey}async sign(t){let r=new Uint8Array(t);return $e.sign.detached(r,new Uint8Array(this._privateKey)).buffer}};var We=class extends Error{constructor(t){super(t),this.message=t,Object.setPrototypeOf(this,We.prototype)}};function Ni(e){if(e)return e;if(typeof crypto<"u"&&crypto.subtle)return crypto.subtle;throw new We("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 de=class extends Qt{constructor(t,r,i){super(),this._keyPair=t,this._derKey=r,this._subtleCrypto=i}static async generate(t){let{extractable:r=!1,keyUsages:i=["sign","verify"],subtleCrypto:a}=t??{},u=Ni(a),d=await u.generateKey({name:"ECDSA",namedCurve:"P-256"},r,i),m=await u.exportKey("spki",d.publicKey);return new this(d,m,u)}static async fromKeyPair(t,r){let i=Ni(r),a=await i.exportKey("spki",t.publicKey);return new de(t,a,i)}getKeyPair(){return this._keyPair}getPublicKey(){let t=this._derKey,r=Object.create(this._keyPair.publicKey);return r.toDer=function(){return t},r}async sign(t){let r={name:"ECDSA",hash:{name:"SHA-256"}};return this._keyPair.privateKey,await this._subtleCrypto.sign(r,this._keyPair.privateKey,t)}};var Se=we(Yn());var wa=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,i=Object.getOwnPropertySymbols(e);a<i.length;a++)t.indexOf(i[a])<0&&Object.prototype.propertyIsEnumerable.call(e,i[a])&&(r[i[a]]=e[i[a]]);return r},ga=new TextEncoder().encode("ic-request-auth-delegation"),_a=new TextEncoder().encode(`
22
- ic-request`);function cn(e){if(typeof e!="string"||e.length<64)throw new Error("Invalid public key.");return Te(e)}var Oe=class{constructor(t,r,i){this.pubkey=t,this.expiration=r,this.targets=i}toCBOR(){return Se.value.map(Object.assign({pubkey:Se.value.bytes(this.pubkey),expiration:Se.value.u64(this.expiration.toString(16),16)},this.targets&&{targets:Se.value.array(this.targets.map(t=>Se.value.bytes(t.toUint8Array())))}))}toJSON(){return Object.assign({expiration:this.expiration.toString(16),pubkey:te(this.pubkey)},this.targets&&{targets:this.targets.map(t=>t.toHex())})}};async function ba(e,t,r,i){let a=new Oe(t.toDer(),BigInt(+r)*BigInt(1e6),i),u=new Uint8Array([...ga,...new Uint8Array(ae(a))]),d=await e.sign(u);return{delegation:a,signature:d}}var he=class{constructor(t,r){this.delegations=t,this.publicKey=r}static async create(t,r,i=new Date(Date.now()+15*60*1e3),a={}){var u,d;let m=await ba(t,r,i,a.targets);return new he([...((u=a.previous)===null||u===void 0?void 0:u.delegations)||[],m],((d=a.previous)===null||d===void 0?void 0:d.publicKey)||t.getPublicKey().toDer())}static fromJSON(t){let{publicKey:r,delegations:i}=typeof t=="string"?JSON.parse(t):t;if(!Array.isArray(i))throw new Error("Invalid delegations.");let a=i.map(u=>{let{delegation:d,signature:m}=u,{pubkey:w,expiration:A,targets:B}=d;if(B!==void 0&&!Array.isArray(B))throw new Error("Invalid targets.");return{delegation:new Oe(cn(w),BigInt(`0x${A}`),B&&B.map(O=>{if(typeof O!="string")throw new Error("Invalid target.");return ot.fromHex(O)})),signature:cn(m)}});return new this(a,cn(r))}static fromDelegations(t,r){return new this(t,r)}toJSON(){return{delegations:this.delegations.map(t=>{let{delegation:r,signature:i}=t,{targets:a}=r;return{delegation:Object.assign({expiration:r.expiration.toString(16),pubkey:te(r.pubkey)},a&&{targets:a.map(u=>u.toHex())}),signature:te(i)}}),publicKey:te(this.publicKey)}}},ze=class extends Qt{constructor(t,r){super(),this._inner=t,this._delegation=r}static fromDelegation(t,r){return new this(t,r)}getDelegation(){return this._delegation}getPublicKey(){return{toDer:()=>this._delegation.publicKey}}sign(t){return this._inner.sign(t)}async transformRequest(t){let{body:r}=t,i=wa(t,["body"]),a=await ae(r);return Object.assign(Object.assign({},i),{body:{content:r,sender_sig:await this.sign(new Uint8Array([..._a,...new Uint8Array(a)])),sender_delegation:this._delegation.delegations,sender_pubkey:this._delegation.publicKey}})}};function Pi(e,t){for(let{delegation:a}of e.delegations)if(+new Date(Number(a.expiration/BigInt(1e6)))<=+Date.now())return!1;let r=[],i=t?.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 u=a.toText();for(let{delegation:d}of e.delegations){if(d.targets===void 0)continue;let m=!0;for(let w of d.targets)if(w.toText()===u){m=!1;break}if(m)return!1}}return!0}var va=we(wo()),Ea=we(an());var Ci;(function(e){e[e.ECDSA_WITH_SHA256=-7]="ECDSA_WITH_SHA256"})(Ci||(Ci={}));var Fi=["mousedown","mousemove","keydown","touchstart","wheel"],Ge=class{constructor(t={}){var r;this.callbacks=[],this.idleTimeout=10*60*1e3,this.timeoutID=void 0;let{onIdle:i,idleTimeout:a=10*60*1e3}=t||{};this.callbacks=i?[i]:[],this.idleTimeout=a;let u=this._resetTimer.bind(this);window.addEventListener("load",u,!0),Fi.forEach(function(m){document.addEventListener(m,u,!0)});let d=(m,w)=>{let A;return(...B)=>{let O=this,Z=function(){A=void 0,m.apply(O,B)};clearTimeout(A),A=window.setTimeout(Z,w)}};if(t?.captureScroll){let m=d(u,(r=t?.scrollDebounce)!==null&&r!==void 0?r:100);window.addEventListener("scroll",m,!0)}u()}static create(t={}){return new this(t)}registerCallback(t){this.callbacks.push(t)}exit(){clearTimeout(this.timeoutID),window.removeEventListener("load",this._resetTimer,!0);let t=this._resetTimer.bind(this);Fi.forEach(function(r){document.removeEventListener(r,t,!0)}),this.callbacks.forEach(r=>r())}_resetTimer(){let t=this.exit.bind(this);window.clearTimeout(this.timeoutID),this.timeoutID=window.setTimeout(t,this.idleTimeout)}};var Aa=(e,t)=>t.some(r=>e instanceof r),ki,ji;function Ta(){return ki||(ki=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Sa(){return ji||(ji=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Ki=new WeakMap,ln=new WeakMap,Mi=new WeakMap,un=new WeakMap,hn=new WeakMap;function Oa(e){let t=new Promise((r,i)=>{let a=()=>{e.removeEventListener("success",u),e.removeEventListener("error",d)},u=()=>{r(Wt(e.result)),a()},d=()=>{i(e.error),a()};e.addEventListener("success",u),e.addEventListener("error",d)});return t.then(r=>{r instanceof IDBCursor&&Ki.set(r,e)}).catch(()=>{}),hn.set(t,e),t}function Ua(e){if(ln.has(e))return;let t=new Promise((r,i)=>{let a=()=>{e.removeEventListener("complete",u),e.removeEventListener("error",d),e.removeEventListener("abort",d)},u=()=>{r(),a()},d=()=>{i(e.error||new DOMException("AbortError","AbortError")),a()};e.addEventListener("complete",u),e.addEventListener("error",d),e.addEventListener("abort",d)});ln.set(e,t)}var dn={get(e,t,r){if(e instanceof IDBTransaction){if(t==="done")return ln.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Mi.get(e);if(t==="store")return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return Wt(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function Vi(e){dn=e(dn)}function Ra(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...r){let i=e.call(Or(this),t,...r);return Mi.set(i,t.sort?t.sort():[t]),Wt(i)}:Sa().includes(e)?function(...t){return e.apply(Or(this),t),Wt(Ki.get(this))}:function(...t){return Wt(e.apply(Or(this),t))}}function Ba(e){return typeof e=="function"?Ra(e):(e instanceof IDBTransaction&&Ua(e),Aa(e,Ta())?new Proxy(e,dn):e)}function Wt(e){if(e instanceof IDBRequest)return Oa(e);if(un.has(e))return un.get(e);let t=Ba(e);return t!==e&&(un.set(e,t),hn.set(t,e)),t}var Or=e=>hn.get(e);function qi(e,t,{blocked:r,upgrade:i,blocking:a,terminated:u}={}){let d=indexedDB.open(e,t),m=Wt(d);return i&&d.addEventListener("upgradeneeded",w=>{i(Wt(d.result),w.oldVersion,w.newVersion,Wt(d.transaction),w)}),r&&d.addEventListener("blocked",w=>r(w.oldVersion,w.newVersion,w)),m.then(w=>{u&&w.addEventListener("close",()=>u()),a&&w.addEventListener("versionchange",A=>a(A.oldVersion,A.newVersion,A))}).catch(()=>{}),m}var Na=["get","getKey","getAll","getAllKeys","count"],Pa=["put","add","delete","clear"],pn=new Map;function Yi(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(pn.get(t))return pn.get(t);let r=t.replace(/FromIndex$/,""),i=t!==r,a=Pa.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!(a||Na.includes(r)))return;let u=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(t,u),u}Vi(e=>({...e,get:(t,r,i)=>Yi(t,r)||e.get(t,r,i),has:(t,r)=>!!Yi(t,r)||e.has(t,r)}));var Hi="auth-client-db",$i="ic-keyval",Ca=async(e=Hi,t=$i,r)=>(Ur&&(localStorage!=null&&localStorage.getItem(Kt))&&(localStorage.removeItem(Kt),localStorage.removeItem(Mt)),await qi(e,r,{upgrade:i=>{i.objectStoreNames,i.objectStoreNames.contains(t)&&i.clear(t),i.createObjectStore(t)}}));async function Fa(e,t,r){return await e.get(t,r)}async function ka(e,t,r,i){return await e.put(t,i,r)}async function ja(e,t,r){return await e.delete(t,r)}var pe=class{constructor(t,r){this._db=t,this._storeName=r}static async create(t){let{dbName:r=Hi,storeName:i=$i,version:a=1}=t??{},u=await Ca(r,i,a);return new pe(u,i)}async set(t,r){return await ka(this._db,this._storeName,t,r)}async get(t){var r;return(r=await Fa(this._db,this._storeName,t))!==null&&r!==void 0?r:null}async remove(t){return await ja(this._db,this._storeName,t)}};var Mt="identity",Kt="delegation",Wi="iv",Ka=1,Ur=typeof window<"u",Ie=class{constructor(t="ic-",r){this.prefix=t,this._localStorage=r}get(t){return Promise.resolve(this._getLocalStorage().getItem(this.prefix+t))}set(t,r){return this._getLocalStorage().setItem(this.prefix+t,r),Promise.resolve()}remove(t){return this._getLocalStorage().removeItem(this.prefix+t),Promise.resolve()}_getLocalStorage(){if(this._localStorage)return this._localStorage;let t=typeof window>"u"?typeof globalThis>"u"?typeof self>"u"?void 0:self.localStorage:globalThis.localStorage:window.localStorage;if(!t)throw new Error("Could not find local storage.");return t}},Je=class{get _db(){return new Promise(t=>{if(this.initializedDb){t(this.initializedDb);return}pe.create({version:Ka}).then(r=>{this.initializedDb=r,t(r)})})}async get(t){return await(await this._db).get(t)}async set(t,r){await(await this._db).set(t,r)}async remove(t){await(await this._db).remove(t)}};var Ma="https://identity.ic0.app",Va="#authorize",xn="ECDSA",yn="Ed25519",Ya=500,qa="UserInterrupt",Rr=class{constructor(t,r,i,a,u,d,m,w){var A;this._identity=t,this._key=r,this._chain=i,this._storage=a,this.idleManager=u,this._createOptions=d,this._idpWindow=m,this._eventHandler=w;let B=this.logout.bind(this),O=d?.idleOptions;!O?.onIdle&&!O?.disableDefaultIdleCallback&&((A=this.idleManager)===null||A===void 0||A.registerCallback(()=>{B(),location.reload()}))}static async create(t={}){var r,i,a;let u=(r=t.storage)!==null&&r!==void 0?r:new Je,d=(i=t.keyType)!==null&&i!==void 0?i:xn,m=null;if(t.identity)m=t.identity;else{let O=await u.get(Mt);if(!O&&Ur)try{let Z=new Ie,D=await Z.get(Kt),st=await Z.get(Mt);D&&st&&d===xn&&(console.log("Discovered an identity stored in localstorage. Migrating to IndexedDB"),await u.set(Kt,D),await u.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===yn&&typeof O=="string"?m=await jt.fromJSON(O):m=await de.fromKeyPair(O):typeof O=="string"&&(m=jt.fromJSON(O))}catch{}}let w=new Dt,A=null;if(m)try{let O=await u.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.");t.identity?w=t.identity:O&&(A=he.fromJSON(O),Pi(A)?w=ze.fromDelegation(m,A):(await mn(u),m=null))}catch(O){console.error(O),await mn(u),m=null}let B;return!((a=t.idleOptions)===null||a===void 0)&&a.disableIdle?B=void 0:(A||t.identity)&&(B=Ge.create(t.idleOptions)),m||(d===yn?(m=await jt.generate(),await u.set(Mt,JSON.stringify(m.toJSON()))):(t.storage&&d===xn&&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 '${yn}' as the key type, as it can serialize to a string`),m=await de.generate(),await u.set(Mt,m.getKeyPair()))),new this(w,m,A,u,B,t)}async _handleSuccess(t,r){var i,a,u;let d=t.delegations.map(A=>({delegation:new Oe(A.delegation.pubkey,A.delegation.expiration,A.delegation.targets),signature:A.signature.buffer})),m=he.fromDelegations(d,t.userPublicKey.buffer),w=this._key;if(w){if(this._chain=m,this._identity=ze.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=Ge.create(A),!A?.onIdle&&!A?.disableDefaultIdleCallback&&((u=this.idleManager)===null||u===void 0||u.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(t){var r,i,a,u;let d=BigInt(8)*BigInt(36e11),m=new URL(((r=t?.identityProvider)===null||r===void 0?void 0:r.toString())||Ma);m.hash=Va,(i=this._idpWindow)===null||i===void 0||i.close(),this._removeEventListener(),this._eventHandler=this._getEventHandler(m,Object.assign({maxTimeToLive:(a=t?.maxTimeToLive)!==null&&a!==void 0?a:d},t)),window.addEventListener("message",this._eventHandler),this._idpWindow=(u=window.open(m.toString(),"idpWindow",t?.windowOpenerFeatures))!==null&&u!==void 0?u:void 0;let w=()=>{this._idpWindow&&(this._idpWindow.closed?this._handleFailure(qa,t?.onError):setTimeout(w,Ya))};w()}_getEventHandler(t,r){return async i=>{var a,u,d;if(i.origin!==t.origin){console.warn(`WARNING: expected origin '${t.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:(u=r?.derivationOrigin)===null||u===void 0?void 0:u.toString()};(d=this._idpWindow)===null||d===void 0||d.postMessage(w,t.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(t,r){var i;(i=this._idpWindow)===null||i===void 0||i.close(),r?.(t),this._removeEventListener(),delete this._idpWindow}_removeEventListener(){this._eventHandler&&window.removeEventListener("message",this._eventHandler),this._eventHandler=void 0}async logout(t={}){if(await mn(this._storage),this._identity=new Dt,this._chain=null,t.returnTo)try{window.history.pushState({},"",t.returnTo)}catch{window.location.href=t.returnTo}}};async function mn(e){await e.remove(Mt),await e.remove(Kt),await e.remove(Wi)}var Br=()=>Rr.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}});var wn=async({data:e})=>{try{return await $n(e)}catch(t){console.error("The data parsing has failed, mapping to undefined as a fallback.",t);return}};var Nr=({matcher:e,paginate:t,order:r,owner:i})=>({matcher:yt(e)?[]:[{key:mt(e.key),description:mt(e.description)}],paginate:mt(yt(t)?void 0:{start_after:mt(t.startAfter),limit:mt(yt(t.limit)?void 0:BigInt(t.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 zi=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),i=e.Variant({Write:e.Null,Admin:e.Null}),a=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:i,expires_at:e.Opt(e.Nat64)}),u=e.Record({updated_at:e.Opt(e.Nat64)}),d=e.Variant({Db:e.Null,Storage:e.Null}),m=e.Record({rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),w=e.Record({storage:m}),A=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64}),B=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),O=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),Z=e.Variant({Callback:e.Record({token:O,callback:e.Func([],[],["query"])})}),D=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Z),status_code:e.Nat16}),st=e.Record({token:e.Opt(O),body:e.Vec(e.Nat8)}),dt=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,description:e.Opt(e.Text),encoding_type:e.Opt(e.Text),full_path:e.Text}),vt=e.Record({batch_id:e.Nat}),ht=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),Et=e.Record({field:ht,desc:e.Bool}),Vt=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),Ut=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),Tt=e.Record({order:e.Opt(Et),owner:e.Opt(e.Principal),matcher:e.Opt(Vt),paginate:e.Opt(Ut)}),Xe=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),Ze=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),Qe=e.Record({key:Xe,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,Ze)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),Ue=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,Qe)),items_length:e.Nat64}),xe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),Re=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,A)),items_length:e.Nat64}),ne=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Be=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ne,created_at:e.Nat64,write:ne}),Ne=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:i,expires_at:e.Opt(e.Nat64)}),Ct=e.Record({controller:Ne,controllers:e.Vec(e.Principal)}),Pe=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:ne,write:ne}),re=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),De=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,a))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,u],[],[]),del_rule:e.Func([d,e.Text,u],[],[]),get_config:e.Func([],[w],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(A)],["query"]),http_request:e.Func([B],[D],["query"]),http_request_streaming_callback:e.Func([O],[st],["query"]),init_asset_upload:e.Func([dt],[vt],[]),list_assets:e.Func([e.Text,Tt],[Ue],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,a))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,xe))],["query"]),list_docs:e.Func([e.Text,Tt],[Re],["query"]),list_rules:e.Func([d],[e.Vec(e.Tuple(e.Text,Be))],["query"]),set_config:e.Func([w],[],[]),set_controllers:e.Func([Ct],[e.Vec(e.Tuple(e.Principal,a))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,Pe],[A],[]),set_rule:e.Func([d,e.Text,ee],[],[]),upload_asset_chunk:e.Func([re],[De],[]),version:e.Func([],[e.Text],["query"])})};var Gi=async({satelliteId:e,idlFactory:t,identity:r,fetch:i,env:a="prod"})=>{let u=a==="dev"||bt.getInstance().localIdentity(),d=u?"http://127.0.0.1:8000/":"https://icp-api.io",m=new ue({identity:r,...d&&{host:d},...i&&{fetch:i}});return u&&await m.fetchRootKey(),Lt.createActor(t,{agent:m,canisterId:e})};var zt=async({satelliteId:e,...t})=>{let{satelliteId:r}=e!==void 0?{satelliteId:e}:bt.getInstance().get()??{satelliteId:void 0};if(!r)throw new Error("No satellite principal defined.");return Gi({satelliteId:r,idlFactory:zi,...t})};var Ii=async({collection:e,key:t,satellite:r})=>{let i=await zt(r),a=Ot(await i.get_doc(e,t));if(yt(a))return;let{data:u,owner:d,description:m,...w}=a,A=await wn({data:u});return{key:t,description:Ot(m),owner:d.toText(),data:A,...w}},Ji=async({collection:e,doc:t,satellite:r})=>{let i=await zt(r),{key:a,data:u,updated_at:d,description:m}=t,w=await i.set_doc(e,a,{description:mt(m),data:await Hn(u),updated_at:mt(d)}),{owner:A,updated_at:B,created_at:O,description:Z}=w;return{key:a,description:Ot(Z),owner:A.toText(),data:u,created_at:O,updated_at:B}},Xi=async({collection:e,doc:t,satellite:r})=>{let i=await zt(r),{key:a,updated_at:u}=t;return i.del_doc(e,a,{updated_at:mt(u)})},Zi=async({collection:e,filter:t,satellite:r})=>{let i=await zt(r),{items:a,items_page:u,items_length:d,matches_length:m,matches_pages:w}=await i.list_docs(e,Nr(t)),A=[];for(let[B,O]of a){let{data:Z,owner:D,description:st,...dt}=O;A.push({key:B,description:Ot(st),owner:D.toText(),data:await wn({data:Z}),...dt})}return{items:A,items_length:d,items_page:Ot(u),matches_length:m,matches_pages:Ot(w)}};var Gt=e=>e!==void 0?e:Pr()??new Dt;var Qi=async({satellite:e,...t})=>{let r=Gt(e?.identity);return Ii({...t,satellite:{...e,identity:r}})},Di=async({satellite:e,...t})=>{let r=Gt(e?.identity);return Ji({...t,satellite:{...e,identity:r}})},Yc=async({satellite:e,...t})=>{let r=Gt(e?.identity);return Xi({...t,satellite:{...e,identity:r}})},qc=async({satellite:e,filter:t,...r})=>{let i=Gt(e?.identity);return Zi({...r,filter:t??{},satellite:{...e,identity:i}})};var Li=async e=>{let t=Pr();if(yt(t))throw new Error("No identity to initialize the user. Have you initialized Juno?");let r=t.getPrincipal().toText(),i=await Qi({collection:"#user",key:r});return yt(i)?await Ha({userId:r,provider:e}):i},Ha=async({userId:e,...t})=>Di({collection:"#user",doc:{key:e,data:t}});var It,gn=async e=>{if(It=It??await Br(),!(await It?.isAuthenticated()??!1))return;let r=await Li(e);Yt.getInstance().set(r)},$a=async e=>new Promise(async(t,r)=>{It=It??await Br();let i=e?.provider??new lr({});await It.login({onSuccess:async()=>{await gn(i.id),t()},onError:a=>r(a),maxTimeToLive:e?.maxTimeToLive??zn,...e?.derivationOrigin!==void 0&&{derivationOrigin:e.derivationOrigin},...i.signInOptions({windowed:e?.windowed})})}),_n=async()=>{await It?.logout(),It=void 0,Yt.getInstance().reset()},Pr=()=>It?.getIdentity(),Wa=async()=>(It??await Br()).getIdentity();var to=e=>{let t=e===!0?"./workers/auth.worker.js":e,r=new Worker(t),i=async()=>{Wn({message:"junoSignOutAuthTimer"}),await _n()};return r.onmessage=async({data:a})=>{let{msg:u}=a;switch(u){case"junoSignOutAuthTimer":await i();return}},Yt.getInstance().subscribe(a=>{if(yt(a)){r.postMessage({msg:"junoStopAuthTimer"});return}r.postMessage({msg:"junoStartAuthTimer"})})};var eo=async({data:e,filename:t,collection:r,headers:i,token:a,fullPath:u,encoding:d,description:m,satellite:w})=>{let A=await zt(w),{batch_id:B}=await A.init_asset_upload({collection:r,full_path:u,name:t,token:mt(a),encoding_type:mt(d),description:mt(m)}),O=19e5,Z=[],D=ur()?new Blob([await e.arrayBuffer()]):e,st=0n;for(let ht=0;ht<D.size;ht+=O){let Et=D.slice(ht,ht+O);Z.push({batchId:B,chunk:Et,actor:A,orderId:st}),st++}let dt=[];for await(let ht of za({uploadChunks:Z}))dt=[...dt,...ht];let vt=i.find(([ht,Et])=>ht.toLowerCase()==="content-type")===void 0&&e.type!==void 0&&e.type!==""?[["Content-Type",e.type]]:void 0;await A.commit_asset_upload({batch_id:B,chunk_ids:dt.map(({chunk_id:ht})=>ht),headers:[...i,...vt||[]]})};async function*za({uploadChunks:e,limit:t=12}){for(let r=0;r<e.length;r=r+t){let i=e.slice(r,r+t);yield await Promise.all(i.map(u=>Ga(u)))}}var Ga=async({batchId:e,chunk:t,actor:r,orderId:i})=>r.upload_asset_chunk({batch_id:e,content:new Uint8Array(await t.arrayBuffer()),order_id:mt(i)}),ro=async({collection:e,satellite:t,filter:r})=>{let i=await zt(t),{items:a,items_length:u,items_page:d,matches_length:m,matches_pages:w}=await i.list_assets(e,Nr(r));return{items:a.map(([A,B])=>B),items_length:u,items_page:Ot(d),matches_length:m,matches_pages:Ot(w)}},no=async({collection:e,fullPath:t,satellite:r})=>(await zt(r)).del_asset(e,t),io=async({collection:e,satellite:t})=>(await zt(t)).del_assets(e);var oo=e=>btoa([...e].map(t=>String.fromCharCode(t)).join(""));var bn=()=>{let e=bt.getInstance().get()?.satelliteId??"unknown";return bt.getInstance().localIdentity()?`http://${e}.localhost:8000`:`https://${e}.icp0.io`};var vn=e=>encodeURI(e.toLowerCase().replace(/\s/g,"-"));var w0=async e=>ao(e),g0=async e=>ao({filename:e.data.name,...e}),ao=async({filename:e,data:t,collection:r,headers:i=[],fullPath:a,token:u,satellite:d,encoding:m,description:w})=>{let A=Gt(d?.identity),B=vn(e),O=a||`/${r}/${B}`;return await eo({data:t,filename:vn(B),collection:r,token:u,headers:i,fullPath:O,encoding:m,satellite:{...d,identity:A},description:w}),{downloadUrl:`${bn()}${O}${u!==void 0?`?token=${u}`:""}`,fullPath:O,name:B}},_0=async({collection:e,satellite:t,filter:r})=>{let{items:i,...a}=await ro({collection:e,satellite:{...t,identity:Gt(t?.identity)},filter:r??{}}),u=bn();return{assets:i.map(({key:{full_path:d,token:m,name:w,owner:A,description:B},headers:O,encodings:Z,created_at:D,updated_at:st})=>{let dt=Ot(m);return{fullPath:d,description:Ot(B),name:w,downloadUrl:`${u}${d}${dt!==void 0?`?token=${dt}`:""}`,token:dt,headers:O,encodings:Z.reduce((vt,[ht,{modified:Et,sha256:Vt,total_length:Ut}])=>({...vt,[ht]:{modified:Et,sha256:oo(Vt),total_length:Ut}}),{}),owner:A.toText(),created_at:D,updated_at:st}}),...a}},b0=async({collection:e,fullPath:t,satellite:r})=>no({collection:e,fullPath:t,satellite:{...r,identity:Gt(r?.identity)}}),v0=async({collection:e,satellite:t})=>io({collection:e,satellite:{...t,identity:Gt(t?.identity)}});var U0=async e=>{bt.getInstance().set(e),await gn();let t=e.workers?.auth!==void 0?to(e.workers.auth):void 0;return[...t?[t]:[]]},R0=e=>Yt.getInstance().subscribe(e);export{lr as InternetIdentityProvider,Xn as NFIDProvider,R0 as authSubscribe,b0 as deleteAsset,v0 as deleteAssets,Yc as deleteDoc,Qi as getDoc,U0 as initJuno,_0 as listAssets,qc as listDocs,Di as setDoc,$a as signIn,_n as signOut,Wa as unsafeIdentity,w0 as uploadBlob,g0 as uploadFile};
18
+ `)}case Yt.Done:throw new Error(`Call was marked as done but we never saw the reply:
19
+ Request ID: ${Gt(r)}
20
+ `)}throw new Error("unreachable")}var wi=({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 gr=class extends Pe{constructor(e,r,i,a){super(["Call failed:",` Canister: ${e.toText()}`,` Method: ${r} (${i})`,...Object.getOwnPropertyNames(a).map(u=>` "${u}": ${JSON.stringify(a[u])}`)].join(`
21
+ `)),this.canisterId=e,this.methodName=r,this.type=i,this.props=a}},Dr=class extends gr{constructor(e,r,i){var a;super(e,r,"query",{Status:i.status,Code:(a=dr[i.reject_code])!==null&&a!==void 0?a:`Unknown Code "${i.reject_code}"`,Message:i.reject_message}),this.result=i}},Lr=class extends gr{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}},tn;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(tn||(tn={}));var Pt=Symbol.for("ic-agent-metadata"),fe=class t{constructor(e){this[Pt]=Object.freeze(e)}static agentOf(e){return e[Pt].config.agent}static interfaceOf(e){return e[Pt].service}static canisterIdOf(e){return ot.from(e[Pt].config.canisterId)}static async install(e,r){let i=e.mode===void 0?tn.Install:e.mode,a=e.arg?[...new Uint8Array(e.arg)]:[],u=[...new Uint8Array(e.module)],d=typeof r.canisterId=="string"?ot.fromText(r.canisterId):r.canisterId;await gi(r).install_code({mode:{[i]:null},arg:a,wasm_module:u,canister_id:d})}static async createCanister(e){let{canister_id:r}=await gi(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:Ne});class a extends t{constructor(d){let m=typeof d.canisterId=="string"?ot.fromText(d.canisterId):d.canisterId;super({config:Object.assign(Object.assign(Object.assign({},bi),d),{canisterId:m}),service:i});for(let[w,A]of i._fields)r?.httpDetails&&A.annotations.push(en),this[w]=ua(this,w,A,d.blsVerify)}}return a}static createActor(e,r){return new(this.createActorClass(e))(r)}static createActorWithHttpDetails(e,r){return new(this.createActorClass(e,{httpDetails:!0}))(r)}};function wr(t,e){let r=Ne.decode(t,_i.Buffer.from(e));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var bi={pollingStrategyFactory:mr.defaultStrategy},en="http-details";function ua(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[Pt].config).queryTransform)===null||A===void 0?void 0:A.call(w,e,m,Object.assign(Object.assign({},t[Pt].config),d)));let B=d.agent||t[Pt].config.agent||Zr(),O=ot.from(d.canisterId||t[Pt].config.canisterId),I=Ne.encode(r.argTypes,m),D=await B.query(O,{methodName:e,arg:I});switch(D.status){case"rejected":throw new Dr(O,e,D);case"replied":return r.annotations.includes(en)?{httpDetails:D.httpDetails,result:wr(r.retTypes,D.reply.arg)}:wr(r.retTypes,D.reply.arg)}}:a=async(d,...m)=>{var w,A;d=Object.assign(Object.assign({},d),(A=(w=t[Pt].config).callTransform)===null||A===void 0?void 0:A.call(w,e,m,Object.assign(Object.assign({},t[Pt].config),d)));let B=d.agent||t[Pt].config.agent||Zr(),{canisterId:O,effectiveCanisterId:I,pollingStrategyFactory:D}=Object.assign(Object.assign(Object.assign({},bi),t[Pt].config),d),st=ot.from(O),dt=I!==void 0?ot.from(I):st,bt=Ne.encode(r.argTypes,m),{requestId:ht,response:vt}=await B.call(st,{methodName:e,arg:bt,effectiveCanisterId:dt});if(!vt.ok||vt.body)throw new Lr(st,e,ht,vt);let Kt=D(),Ot=await Qr(B,dt,ht,Kt,i),Ut=r.annotations.includes(en);if(Ot!==void 0)return Ut?{httpDetails:vt,result:wr(r.retTypes,Ot)}:wr(r.retTypes,Ot);if(r.retTypes.length===0)return Ut?{httpDetails:vt,result:void 0}:void 0;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let u=(...d)=>a({},...d);return u.withOptions=d=>(...m)=>a(d,...m),u}function gi(t){function e(r,i,a){let u=i[0],d=ot.fromHex("");return u&&typeof u=="object"&&u.canister_id&&(d=ot.from(u.canister_id)),{effectiveCanisterId:d}}return fe.createActor(wi,Object.assign(Object.assign(Object.assign({},t),{canisterId:ot.fromHex("")}),{callTransform:e,queryTransform:e}))}var Me=pe(rn());function ge(t){var e;return new Uint8Array(((e=t.match(/.{1,2}/g))!==null&&e!==void 0?e:[]).map(r=>parseInt(r,16))).buffer}function Qt(t){return new Uint8Array(t).reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}var ha=(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},Ti=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)")},Si=(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)")},nn=(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)")},pa=(t,e)=>{let r=nn(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)")},Oi=Uint8Array.from([48,12,6,10,43,6,1,4,1,131,184,67,1,1]),vr=Uint8Array.from([48,5,6,3,43,101,112]),Ef=Uint8Array.from([48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10]);function Er(t,e){let r=2+Ti(t.byteLength+1),i=e.byteLength+r+t.byteLength,a=0,u=new Uint8Array(1+Ti(i)+i);return u[a++]=48,a+=Si(u,a,i),u.set(e,a),a+=e.byteLength,u[a++]=3,a+=Si(u,a,t.byteLength+1),u[a++]=0,u.set(new Uint8Array(t),a),u}var on=(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+=nn(a,r),!ha(a.slice(r,r+e.byteLength),e))throw new Error("Not the expected OID.");r+=e.byteLength,i(3,"bit string");let u=pa(a,r)-1;r+=nn(a,r),i(0,"0 padding");let d=a.slice(r);if(u!==d.length)throw new Error(`DER payload mismatch: Expected length ${u} 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 Er(e,vr).buffer}static derDecode(e){let r=on(e,vr);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 Xt{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?Me.sign.keyPair():Me.sign.keyPair.fromSeed(e);return new this(ee.fromRaw(r),i)}static fromParsedJson(e){let[r,i]=e;return new t(ee.fromDer(ge(r)),ge(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=Me.sign.keyPair.fromSecretKey(new Uint8Array(e));return t.fromKeyPair(r.publicKey,r.secretKey)}toJSON(){return[Qt(this._publicKey.toDer()),Qt(this._privateKey)]}getKeyPair(){return{secretKey:this._privateKey,publicKey:this._publicKey}}getPublicKey(){return this._publicKey}async sign(e){let r=new Uint8Array(e);return Me.sign.detached(r,new Uint8Array(this._privateKey)).buffer}};var an=class t extends Error{constructor(e){super(e),this.message=e,Object.setPrototypeOf(this,t.prototype)}};function Ui(t){if(t)return t;if(typeof crypto<"u"&&crypto.subtle)return crypto.subtle;throw new an("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 Ve=class t extends Xt{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??{},u=Ui(a),d=await u.generateKey({name:"ECDSA",namedCurve:"P-256"},r,i),m=await u.exportKey("spki",d.publicKey);return new this(d,m,u)}static async fromKeyPair(e,r){let i=Ui(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 _e=pe(Kn());var xa=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},ya=new TextEncoder().encode("ic-request-auth-delegation"),ma=new TextEncoder().encode(`
22
+ ic-request`);function sn(t){if(typeof t!="string"||t.length<64)throw new Error("Invalid public key.");return ge(t)}var be=class{constructor(e,r,i){this.pubkey=e,this.expiration=r,this.targets=i}toCBOR(){return _e.value.map(Object.assign({pubkey:_e.value.bytes(this.pubkey),expiration:_e.value.u64(this.expiration.toString(16),16)},this.targets&&{targets:_e.value.array(this.targets.map(e=>_e.value.bytes(e.toUint8Array())))}))}toJSON(){return Object.assign({expiration:this.expiration.toString(16),pubkey:Qt(this.pubkey)},this.targets&&{targets:this.targets.map(e=>e.toHex())})}};async function wa(t,e,r,i){let a=new be(e.toDer(),BigInt(+r)*BigInt(1e6),i),u=new Uint8Array([...ya,...new Uint8Array(ie(a))]),d=await t.sign(u);return{delegation:a,signature:d}}var Ye=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 u,d;let m=await wa(e,r,i,a.targets);return new t([...((u=a.previous)===null||u===void 0?void 0:u.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(u=>{let{delegation:d,signature:m}=u,{pubkey:w,expiration:A,targets:B}=d;if(B!==void 0&&!Array.isArray(B))throw new Error("Invalid targets.");return{delegation:new be(sn(w),BigInt(`0x${A}`),B&&B.map(O=>{if(typeof O!="string")throw new Error("Invalid target.");return ot.fromHex(O)})),signature:sn(m)}});return new this(a,sn(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:Qt(r.pubkey)},a&&{targets:a.map(u=>u.toHex())}),signature:Qt(i)}}),publicKey:Qt(this.publicKey)}}},qe=class extends Xt{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=xa(e,["body"]),a=await ie(r);return Object.assign(Object.assign({},i),{body:{content:r,sender_sig:await this.sign(new Uint8Array([...ma,...new Uint8Array(a)])),sender_delegation:this._delegation.delegations,sender_pubkey:this._delegation.publicKey}})}};function Ri(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 u=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()===u){m=!1;break}if(m)return!1}}return!0}var ga=pe(xo()),_a=pe(rn());var Bi;(function(t){t[t.ECDSA_WITH_SHA256=-7]="ECDSA_WITH_SHA256"})(Bi||(Bi={}));var Pi=["mousedown","mousemove","keydown","touchstart","wheel"],He=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 u=this._resetTimer.bind(this);window.addEventListener("load",u,!0),Pi.forEach(function(m){document.addEventListener(m,u,!0)});let d=(m,w)=>{let A;return(...B)=>{let O=this,I=function(){A=void 0,m.apply(O,B)};clearTimeout(A),A=window.setTimeout(I,w)}};if(e?.captureScroll){let m=d(u,(r=e?.scrollDebounce)!==null&&r!==void 0?r:100);window.addEventListener("scroll",m,!0)}u()}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);Pi.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 ba=(t,e)=>e.some(r=>t instanceof r),Ni,Ci;function va(){return Ni||(Ni=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ea(){return Ci||(Ci=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}var Fi=new WeakMap,cn=new WeakMap,ki=new WeakMap,fn=new WeakMap,ln=new WeakMap;function Aa(t){let e=new Promise((r,i)=>{let a=()=>{t.removeEventListener("success",u),t.removeEventListener("error",d)},u=()=>{r(qt(t.result)),a()},d=()=>{i(t.error),a()};t.addEventListener("success",u),t.addEventListener("error",d)});return e.then(r=>{r instanceof IDBCursor&&Fi.set(r,t)}).catch(()=>{}),ln.set(e,t),e}function Ta(t){if(cn.has(t))return;let e=new Promise((r,i)=>{let a=()=>{t.removeEventListener("complete",u),t.removeEventListener("error",d),t.removeEventListener("abort",d)},u=()=>{r(),a()},d=()=>{i(t.error||new DOMException("AbortError","AbortError")),a()};t.addEventListener("complete",u),t.addEventListener("error",d),t.addEventListener("abort",d)});cn.set(t,e)}var un={get(t,e,r){if(t instanceof IDBTransaction){if(e==="done")return cn.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 qt(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 ji(t){un=t(un)}function Sa(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...r){let i=t.call(Ar(this),e,...r);return ki.set(i,e.sort?e.sort():[e]),qt(i)}:Ea().includes(t)?function(...e){return t.apply(Ar(this),e),qt(Fi.get(this))}:function(...e){return qt(t.apply(Ar(this),e))}}function Oa(t){return typeof t=="function"?Sa(t):(t instanceof IDBTransaction&&Ta(t),ba(t,va())?new Proxy(t,un):t)}function qt(t){if(t instanceof IDBRequest)return Aa(t);if(fn.has(t))return fn.get(t);let e=Oa(t);return e!==t&&(fn.set(t,e),ln.set(e,t)),e}var Ar=t=>ln.get(t);function Mi(t,e,{blocked:r,upgrade:i,blocking:a,terminated:u}={}){let d=indexedDB.open(t,e),m=qt(d);return i&&d.addEventListener("upgradeneeded",w=>{i(qt(d.result),w.oldVersion,w.newVersion,qt(d.transaction),w)}),r&&d.addEventListener("blocked",w=>r(w.oldVersion,w.newVersion,w)),m.then(w=>{u&&w.addEventListener("close",()=>u()),a&&w.addEventListener("versionchange",A=>a(A.oldVersion,A.newVersion,A))}).catch(()=>{}),m}var Ua=["get","getKey","getAll","getAllKeys","count"],Ra=["put","add","delete","clear"],dn=new Map;function Ki(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(dn.get(e))return dn.get(e);let r=e.replace(/FromIndex$/,""),i=e!==r,a=Ra.includes(r);if(!(r in(i?IDBIndex:IDBObjectStore).prototype)||!(a||Ua.includes(r)))return;let u=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 dn.set(e,u),u}ji(t=>({...t,get:(e,r,i)=>Ki(e,r)||t.get(e,r,i),has:(e,r)=>!!Ki(e,r)||t.has(e,r)}));var Vi="auth-client-db",Yi="ic-keyval",Ba=async(t=Vi,e=Yi,r)=>(Tr&&(localStorage!=null&&localStorage.getItem(kt))&&(localStorage.removeItem(kt),localStorage.removeItem(jt)),await Mi(t,r,{upgrade:i=>{i.objectStoreNames,i.objectStoreNames.contains(e)&&i.clear(e),i.createObjectStore(e)}}));async function Pa(t,e,r){return await t.get(e,r)}async function Na(t,e,r,i){return await t.put(e,i,r)}async function Ca(t,e,r){return await t.delete(e,r)}var $e=class t{constructor(e,r){this._db=e,this._storeName=r}static async create(e){let{dbName:r=Vi,storeName:i=Yi,version:a=1}=e??{},u=await Ba(r,i,a);return new t(u,i)}async set(e,r){return await Na(this._db,this._storeName,e,r)}async get(e){var r;return(r=await Pa(this._db,this._storeName,e))!==null&&r!==void 0?r:null}async remove(e){return await Ca(this._db,this._storeName,e)}};var jt="identity",kt="delegation",qi="iv",Fa=1,Tr=typeof window<"u",We=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}},ze=class{get _db(){return new Promise(e=>{if(this.initializedDb){e(this.initializedDb);return}$e.create({version:Fa}).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 ka="https://identity.ic0.app",ja="#authorize",hn="ECDSA",pn="Ed25519",Ka=500,Ma="UserInterrupt",Sr=class{constructor(e,r,i,a,u,d,m,w){var A;this._identity=e,this._key=r,this._chain=i,this._storage=a,this.idleManager=u,this._createOptions=d,this._idpWindow=m,this._eventHandler=w;let B=this.logout.bind(this),O=d?.idleOptions;!O?.onIdle&&!O?.disableDefaultIdleCallback&&((A=this.idleManager)===null||A===void 0||A.registerCallback(()=>{B(),location.reload()}))}static async create(e={}){var r,i,a;let u=(r=e.storage)!==null&&r!==void 0?r:new ze,d=(i=e.keyType)!==null&&i!==void 0?i:hn,m=null;if(e.identity)m=e.identity;else{let O=await u.get(jt);if(!O&&Tr)try{let I=new We,D=await I.get(kt),st=await I.get(jt);D&&st&&d===hn&&(console.log("Discovered an identity stored in localstorage. Migrating to IndexedDB"),await u.set(kt,D),await u.set(jt,st),O=D,await I.remove(kt),await I.remove(jt))}catch(I){console.error("error while attempting to recover localstorage: "+I)}if(O)try{typeof O=="object"?d===pn&&typeof O=="string"?m=await ue.fromJSON(O):m=await Ve.fromKeyPair(O):typeof O=="string"&&(m=ue.fromJSON(O))}catch{}}let w=new Zt,A=null;if(m)try{let O=await u.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=Ye.fromJSON(O),Ri(A)?w=qe.fromDelegation(m,A):(await xn(u),m=null))}catch(O){console.error(O),await xn(u),m=null}let B;return!((a=e.idleOptions)===null||a===void 0)&&a.disableIdle?B=void 0:(A||e.identity)&&(B=He.create(e.idleOptions)),m||(d===pn?(m=await ue.generate(),await u.set(jt,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 '${pn}' as the key type, as it can serialize to a string`),m=await Ve.generate(),await u.set(jt,m.getKeyPair()))),new this(w,m,A,u,B,e)}async _handleSuccess(e,r){var i,a,u;let d=e.delegations.map(A=>({delegation:new be(A.delegation.pubkey,A.delegation.expiration,A.delegation.targets),signature:A.signature.buffer})),m=Ye.fromDelegations(d,e.userPublicKey.buffer),w=this._key;if(w){if(this._chain=m,this._identity=qe.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=He.create(A),!A?.onIdle&&!A?.disableDefaultIdleCallback&&((u=this.idleManager)===null||u===void 0||u.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,u;let d=BigInt(8)*BigInt(36e11),m=new URL(((r=e?.identityProvider)===null||r===void 0?void 0:r.toString())||ka);m.hash=ja,(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=(u=window.open(m.toString(),"idpWindow",e?.windowOpenerFeatures))!==null&&u!==void 0?u:void 0;let w=()=>{this._idpWindow&&(this._idpWindow.closed?this._handleFailure(Ma,e?.onError):setTimeout(w,Ka))};w()}_getEventHandler(e,r){return async i=>{var a,u,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:(u=r?.derivationOrigin)===null||u===void 0?void 0:u.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 xn(this._storage),this._identity=new Zt,this._chain=null,e.returnTo)try{window.history.pushState({},"",e.returnTo)}catch{window.location.href=e.returnTo}}};async function xn(t){await t.remove(jt),await t.remove(kt),await t.remove(qi)}var Or=()=>Sr.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}});var yn=async({data:t})=>{try{return await Yn(t)}catch(e){console.error("The data parsing has failed, mapping to undefined as a fallback.",e);return}};var Ur=({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 Hi=({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)}),u=t.Record({updated_at:t.Opt(t.Nat64)}),d=t.Variant({Db:t.Null,Storage:t.Null}),m=t.Record({rewrites:t.Vec(t.Tuple(t.Text,t.Text)),headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),w=t.Record({storage:m}),A=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),description:t.Opt(t.Text),created_at:t.Nat64}),B=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),O=t.Variant({Heap:t.Null,Stable:t.Null}),I=t.Record({memory:O,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}),D=t.Variant({Callback:t.Record({token:I,callback:t.Func([],[],["query"])})}),st=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(D),status_code:t.Nat16}),dt=t.Record({token:t.Opt(I),body:t.Vec(t.Nat8)}),bt=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}),ht=t.Record({batch_id:t.Nat}),vt=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),Kt=t.Record({field:vt,desc:t.Bool}),Ot=t.Record({key:t.Opt(t.Text),description:t.Opt(t.Text)}),Ut=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),ve=t.Record({order:t.Opt(Kt),owner:t.Opt(t.Principal),matcher:t.Opt(Ot),paginate:t.Opt(Ut)}),Ge=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}),Je=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),Ee=t.Record({key:Ge,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,Je)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),le=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,Ee)),items_length:t.Nat64}),Ae=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),Ie=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,A)),items_length:t.Nat64}),Dt=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),Te=t.Record({memory:t.Opt(O),updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:Dt,created_at:t.Nat64,mutable_permissions:t.Opt(t.Bool),write:Dt}),Nt=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:i,expires_at:t.Opt(t.Nat64)}),Se=t.Record({controller:Nt,controllers:t.Vec(t.Principal)}),Lt=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8),description:t.Opt(t.Text)}),te=t.Record({memory:t.Opt(O),updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:Dt,mutable_permissions:t.Opt(t.Bool),write:Dt}),Xe=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),Ze=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,u],[],[]),del_rule:t.Func([d,t.Text,u],[],[]),get_config:t.Func([],[w],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(A)],["query"]),http_request:t.Func([B],[st],["query"]),http_request_streaming_callback:t.Func([I],[dt],["query"]),init_asset_upload:t.Func([bt],[ht],[]),list_assets:t.Func([t.Text,ve],[le],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,a))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,Ae))],["query"]),list_docs:t.Func([t.Text,ve],[Ie],["query"]),list_rules:t.Func([d],[t.Vec(t.Tuple(t.Text,Te))],["query"]),set_config:t.Func([w],[],[]),set_controllers:t.Func([Se],[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,Lt],[A],[]),set_rule:t.Func([d,t.Text,te],[],[]),upload_asset_chunk:t.Func([Xe],[Ze],[]),version:t.Func([],[t.Text],["query"])})};var $i=async({satelliteId:t,idlFactory:e,identity:r,fetch:i,env:a="prod"})=>{let u=a==="dev"||Et.getInstance().localIdentity(),d=u?"http://127.0.0.1:8000/":"https://icp-api.io",m=new Ke({identity:r,...d&&{host:d},...i&&{fetch:i}});return u&&await m.fetchRootKey(),fe.createActor(e,{agent:m,canisterId:t})};var Ht=async({satelliteId:t,...e})=>{let{satelliteId:r}=t!==void 0?{satelliteId:t}:Et.getInstance().get()??{satelliteId:void 0};if(!r)throw new Error("No satellite principal defined.");return $i({satelliteId:r,idlFactory:Hi,...e})};var Wi=async({collection:t,key:e,satellite:r})=>{let i=await Ht(r),a=St(await i.get_doc(t,e));if(yt(a))return;let{data:u,owner:d,description:m,...w}=a,A=await yn({data:u});return{key:e,description:St(m),owner:d.toText(),data:A,...w}},zi=async({collection:t,doc:e,satellite:r})=>{let i=await Ht(r),{key:a,data:u,updated_at:d,description:m}=e,w=await i.set_doc(t,a,{description:mt(m),data:await Vn(u),updated_at:mt(d)}),{owner:A,updated_at:B,created_at:O,description:I}=w;return{key:a,description:St(I),owner:A.toText(),data:u,created_at:O,updated_at:B}},Gi=async({collection:t,doc:e,satellite:r})=>{let i=await Ht(r),{key:a,updated_at:u}=e;return i.del_doc(t,a,{updated_at:mt(u)})},Ji=async({collection:t,filter:e,satellite:r})=>{let i=await Ht(r),{items:a,items_page:u,items_length:d,matches_length:m,matches_pages:w}=await i.list_docs(t,Ur(e)),A=[];for(let[B,O]of a){let{data:I,owner:D,description:st,...dt}=O;A.push({key:B,description:St(st),owner:D.toText(),data:await yn({data:I}),...dt})}return{items:A,items_length:d,items_page:St(u),matches_length:m,matches_pages:St(w)}};var $t=t=>t!==void 0?t:Rr()??new Zt;var Ii=async({satellite:t,...e})=>{let r=$t(t?.identity);return Wi({...e,satellite:{...t,identity:r}})},Xi=async({satellite:t,...e})=>{let r=$t(t?.identity);return zi({...e,satellite:{...t,identity:r}})},kc=async({satellite:t,...e})=>{let r=$t(t?.identity);return Gi({...e,satellite:{...t,identity:r}})},jc=async({satellite:t,filter:e,...r})=>{let i=$t(t?.identity);return Ji({...r,filter:e??{},satellite:{...t,identity:i}})};var Zi=async t=>{let e=Rr();if(yt(e))throw new Error("No identity to initialize the user. Have you initialized Juno?");let r=e.getPrincipal().toText(),i=await Ii({collection:"#user",key:r});return yt(i)?await Va({userId:r,provider:t}):i},Va=async({userId:t,...e})=>Xi({collection:"#user",doc:{key:t,data:e}});var Wt,mn=async t=>{if(Wt=Wt??await Or(),!(await Wt?.isAuthenticated()??!1))return;let r=await Zi(t);Jt.getInstance().set(r)},Ya=async t=>new Promise(async(e,r)=>{Wt=Wt??await Or();let i=t?.provider??new fr({});await Wt.login({onSuccess:async()=>{await mn(i.id),e()},onError:a=>r(a),maxTimeToLive:t?.maxTimeToLive??Hn,...t?.derivationOrigin!==void 0&&{derivationOrigin:t.derivationOrigin},...i.signInOptions({windowed:t?.windowed})})}),wn=async()=>{await Wt?.logout(),Wt=void 0,Jt.getInstance().reset()},Rr=()=>Wt?.getIdentity(),qa=async()=>(Wt??await Or()).getIdentity();var Qi=t=>{let e=t===!0?"./workers/auth.worker.js":t,r=new Worker(e),i=async()=>{qn({message:"junoSignOutAuthTimer"}),await wn()};return r.onmessage=async({data:a})=>{let{msg:u}=a;switch(u){case"junoSignOutAuthTimer":await i();return}},Jt.getInstance().subscribe(a=>{if(yt(a)){r.postMessage({msg:"junoStopAuthTimer"});return}r.postMessage({msg:"junoStartAuthTimer"})})};var Di=async({data:t,filename:e,collection:r,headers:i,token:a,fullPath:u,encoding:d,description:m,satellite:w})=>{let A=await Ht(w),{batch_id:B}=await A.init_asset_upload({collection:r,full_path:u,name:e,token:mt(a),encoding_type:mt(d),description:mt(m)}),O=19e5,I=[],D=sr()?new Blob([await t.arrayBuffer()]):t,st=0n;for(let ht=0;ht<D.size;ht+=O){let vt=D.slice(ht,ht+O);I.push({batchId:B,chunk:vt,actor:A,orderId:st}),st++}let dt=[];for await(let ht of Ha({uploadChunks:I}))dt=[...dt,...ht];let bt=i.find(([ht,vt])=>ht.toLowerCase()==="content-type")===void 0&&t.type!==void 0&&t.type!==""?[["Content-Type",t.type]]:void 0;await A.commit_asset_upload({batch_id:B,chunk_ids:dt.map(({chunk_id:ht})=>ht),headers:[...i,...bt||[]]})};async function*Ha({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(u=>$a(u)))}}var $a=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)}),Li=async({collection:t,satellite:e,filter:r})=>{let i=await Ht(e),{items:a,items_length:u,items_page:d,matches_length:m,matches_pages:w}=await i.list_assets(t,Ur(r));return{items:a.map(([A,B])=>B),items_length:u,items_page:St(d),matches_length:m,matches_pages:St(w)}},to=async({collection:t,fullPath:e,satellite:r})=>(await Ht(r)).del_asset(t,e),eo=async({collection:t,satellite:e})=>(await Ht(e)).del_assets(t);var ro=t=>btoa([...t].map(e=>String.fromCharCode(e)).join(""));var gn=()=>{let t=Et.getInstance().get()?.satelliteId??"unknown";return Et.getInstance().localIdentity()?`http://${t}.localhost:8000`:`https://${t}.icp0.io`};var _n=t=>encodeURI(t.toLowerCase().replace(/\s/g,"-"));var h0=async t=>no(t),p0=async t=>no({filename:t.data.name,...t}),no=async({filename:t,data:e,collection:r,headers:i=[],fullPath:a,token:u,satellite:d,encoding:m,description:w})=>{let A=$t(d?.identity),B=_n(t),O=a||`/${r}/${B}`;return await Di({data:e,filename:_n(B),collection:r,token:u,headers:i,fullPath:O,encoding:m,satellite:{...d,identity:A},description:w}),{downloadUrl:`${gn()}${O}${u!==void 0?`?token=${u}`:""}`,fullPath:O,name:B}},x0=async({collection:t,satellite:e,filter:r})=>{let{items:i,...a}=await Li({collection:t,satellite:{...e,identity:$t(e?.identity)},filter:r??{}}),u=gn();return{assets:i.map(({key:{full_path:d,token:m,name:w,owner:A,description:B},headers:O,encodings:I,created_at:D,updated_at:st})=>{let dt=St(m);return{fullPath:d,description:St(B),name:w,downloadUrl:`${u}${d}${dt!==void 0?`?token=${dt}`:""}`,token:dt,headers:O,encodings:I.reduce((bt,[ht,{modified:vt,sha256:Kt,total_length:Ot}])=>({...bt,[ht]:{modified:vt,sha256:ro(Kt),total_length:Ot}}),{}),owner:A.toText(),created_at:D,updated_at:st}}),...a}},y0=async({collection:t,fullPath:e,satellite:r})=>to({collection:t,fullPath:e,satellite:{...r,identity:$t(r?.identity)}}),m0=async({collection:t,satellite:e})=>eo({collection:t,satellite:{...e,identity:$t(e?.identity)}});var E0=async t=>{Et.getInstance().set(t),await mn();let e=t.workers?.auth!==void 0?Qi(t.workers.auth):void 0;return[...e?[e]:[]]},A0=t=>Jt.getInstance().subscribe(t);export{fr as InternetIdentityProvider,Gn as NFIDProvider,A0 as authSubscribe,y0 as deleteAsset,m0 as deleteAssets,kc as deleteDoc,Ii as getDoc,E0 as initJuno,x0 as listAssets,jc as listDocs,Xi as setDoc,Ya as signIn,wn as signOut,qa as unsafeIdentity,h0 as uploadBlob,p0 as uploadFile};
23
23
  /*! Bundled license information:
24
24
 
25
25
  buffer/index.js: