@matchain/matchid-sdk-react 0.1.53-alpha.2 → 0.1.53-alpha.4

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 (92) hide show
  1. package/dist/assets/icon/index.d.mts +4 -2
  2. package/dist/assets/icon/index.d.ts +4 -2
  3. package/dist/assets/icon/index.js +19 -0
  4. package/dist/assets/icon/index.js.map +1 -1
  5. package/dist/assets/icon/index.mjs +3 -1
  6. package/dist/chunk-3CR66BEX.mjs +19 -0
  7. package/dist/chunk-3CR66BEX.mjs.map +1 -0
  8. package/dist/{chunk-LHNKZISB.mjs → chunk-3USZ4ZZY.mjs} +20 -2
  9. package/dist/chunk-3USZ4ZZY.mjs.map +1 -0
  10. package/dist/{chunk-4A2YPGO3.mjs → chunk-4J3KZCLG.mjs} +2 -2
  11. package/dist/{chunk-HYQ3T6WW.mjs → chunk-JX73EY6V.mjs} +2 -14
  12. package/dist/chunk-JX73EY6V.mjs.map +1 -0
  13. package/dist/{chunk-MX7N57AH.mjs → chunk-OCQ2AIM3.mjs} +7 -2
  14. package/dist/{chunk-MX7N57AH.mjs.map → chunk-OCQ2AIM3.mjs.map} +1 -1
  15. package/dist/{chunk-FB5MHLWX.mjs → chunk-V2S54LGG.mjs} +2 -2
  16. package/dist/{chunk-W5A6WY7Y.mjs → chunk-XXZZYALJ.mjs} +807 -191
  17. package/dist/chunk-XXZZYALJ.mjs.map +1 -0
  18. package/dist/components/index.d.mts +3 -3
  19. package/dist/components/index.d.ts +3 -3
  20. package/dist/components/index.js +1111 -442
  21. package/dist/components/index.js.map +1 -1
  22. package/dist/components/index.mjs +7 -4
  23. package/dist/config/chains/index.mjs +2 -1
  24. package/dist/hooks/api/index.d.mts +2 -2
  25. package/dist/hooks/api/index.d.ts +2 -2
  26. package/dist/hooks/api/index.js +202 -88
  27. package/dist/hooks/api/index.js.map +1 -1
  28. package/dist/hooks/api/index.mjs +6 -5
  29. package/dist/hooks/index.d.mts +2 -2
  30. package/dist/hooks/index.d.ts +2 -2
  31. package/dist/hooks/index.js +515 -401
  32. package/dist/hooks/index.js.map +1 -1
  33. package/dist/hooks/index.mjs +5 -4
  34. package/dist/{index-IwwXQ_QV.d.ts → index-BaYTgL99.d.mts} +3 -2
  35. package/dist/{index-B8cUP7cH.d.ts → index-BhU3hF7y.d.ts} +2 -2
  36. package/dist/{index-iWHaT8HV.d.mts → index-Bpd2gBNh.d.mts} +1 -1
  37. package/dist/{index-Df-WlkXq.d.ts → index-C5StsjWY.d.ts} +11 -4
  38. package/dist/{index-BS-NO8Y2.d.ts → index-CFqk8eNo.d.ts} +12 -12
  39. package/dist/{index-BCGJczpk.d.mts → index-D1QeVZyN.d.ts} +3 -2
  40. package/dist/{index-DNJuiNdz.d.mts → index-D_UNctDI.d.mts} +11 -4
  41. package/dist/{index-BsL6zo6a.d.ts → index-DaXXoRxr.d.ts} +1 -1
  42. package/dist/{index-K5vXmiRX.d.ts → index-Dt92N6yZ.d.ts} +1 -1
  43. package/dist/{index-CZqdmQu1.d.mts → index-W6yjuOKT.d.mts} +1 -1
  44. package/dist/{index-Bil_db2f.d.mts → index-mxbJ8CFx.d.mts} +12 -12
  45. package/dist/{index-yy3VTdFU.d.mts → index-wqqEUufi.d.mts} +2 -2
  46. package/dist/index.css +3 -0
  47. package/dist/index.d.mts +7 -7
  48. package/dist/index.d.ts +7 -7
  49. package/dist/index.js +1297 -680
  50. package/dist/index.js.map +1 -1
  51. package/dist/index.mjs +12 -11
  52. package/dist/types/index.d.mts +1 -1
  53. package/dist/types/index.d.ts +1 -1
  54. package/dist/{types-CZbR7ERa.d.mts → types-Bx_FJ11s.d.mts} +2 -1
  55. package/dist/{types-CZbR7ERa.d.ts → types-Bx_FJ11s.d.ts} +2 -1
  56. package/dist/ui/index.d.mts +3 -3
  57. package/dist/ui/index.d.ts +3 -3
  58. package/dist/ui/index.js +62 -59
  59. package/dist/ui/index.js.map +1 -1
  60. package/dist/ui/index.mjs +2 -2
  61. package/dist/utils/index.d.mts +2 -1
  62. package/dist/utils/index.d.ts +2 -1
  63. package/dist/utils/index.js +6 -0
  64. package/dist/utils/index.js.map +1 -1
  65. package/dist/utils/index.mjs +3 -1
  66. package/example/dist/assets/ccip-nxE3Zma4.js +1 -0
  67. package/example/dist/assets/index-BFAv3rdU.css +1 -0
  68. package/example/dist/assets/index-DMWWRDPI.js +1658 -0
  69. package/example/dist/index.html +2 -2
  70. package/example/src/pages/User/index.tsx +7 -1
  71. package/package.json +2 -1
  72. package/dist/chunk-HYQ3T6WW.mjs.map +0 -1
  73. package/dist/chunk-LHNKZISB.mjs.map +0 -1
  74. package/dist/chunk-W5A6WY7Y.mjs.map +0 -1
  75. package/example/dist/assets/TransportWebHID-BEu7tC0r.js +0 -1
  76. package/example/dist/assets/bignumber-iG7K-qxw.js +0 -10
  77. package/example/dist/assets/ccip-a6wQ1Vcb.js +0 -1
  78. package/example/dist/assets/draggabilly-CRYR_S0q.js +0 -14
  79. package/example/dist/assets/index--dp9m9Ep.js +0 -1
  80. package/example/dist/assets/index-BDTHolFv.js +0 -569
  81. package/example/dist/assets/index-BZl59qLb.js +0 -179
  82. package/example/dist/assets/index-BmMbYNHO.js +0 -303
  83. package/example/dist/assets/index-C7cxVRDF.js +0 -1677
  84. package/example/dist/assets/index-CJk171Yb.js +0 -1
  85. package/example/dist/assets/index-CQiBesAa.js +0 -3
  86. package/example/dist/assets/index-D62loNA9.js +0 -3
  87. package/example/dist/assets/index-DqyX3FG6.js +0 -1
  88. package/example/dist/assets/index-Gy3FXGhr.css +0 -1
  89. package/example/dist/assets/inherits_browser-BlmhoU4v.js +0 -1
  90. package/example/dist/assets/solanaEmbed.esm-Djn-u4Vn.js +0 -38
  91. /package/dist/{chunk-4A2YPGO3.mjs.map → chunk-4J3KZCLG.mjs.map} +0 -0
  92. /package/dist/{chunk-FB5MHLWX.mjs.map → chunk-V2S54LGG.mjs.map} +0 -0
@@ -1,569 +0,0 @@
1
- import{r as kf,c as $r,g as Ma,a as n2,i as s2,d as o2,e as $f,f as a2,h as li,j as c2,k as B0,P as f2,T as h2,b as ac}from"./index-C7cxVRDF.js";import{i as Ia}from"./inherits_browser-BlmhoU4v.js";var F0={};const u2="elliptic",l2="6.6.1",d2="EC cryptography",p2="lib/elliptic.js",g2=["lib"],b2={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},v2={type:"git",url:"git@github.com:indutny/elliptic"},m2=["EC","Elliptic","curve","Cryptography"],y2="Fedor Indutny <fedor@indutny.com>",w2="MIT",_2={url:"https://github.com/indutny/elliptic/issues"},E2="https://github.com/indutny/elliptic",A2={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},x2={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},S2={name:u2,version:l2,description:d2,main:p2,files:g2,scripts:b2,repository:v2,keywords:m2,author:y2,license:w2,bugs:_2,homepage:E2,devDependencies:A2,dependencies:x2};var br={},qf={exports:{}};qf.exports;(function(t){(function(e,r){function i(U,b){if(!U)throw new Error(b||"Assertion failed")}function n(U,b){U.super_=b;var c=function(){};c.prototype=b.prototype,U.prototype=new c,U.prototype.constructor=U}function s(U,b,c){if(s.isBN(U))return U;this.negative=0,this.words=null,this.length=0,this.red=null,U!==null&&((b==="le"||b==="be")&&(c=b,b=10),this._init(U||0,b||10,c||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=kf.Buffer}catch{}s.isBN=function(b){return b instanceof s?!0:b!==null&&typeof b=="object"&&b.constructor.wordSize===s.wordSize&&Array.isArray(b.words)},s.max=function(b,c){return b.cmp(c)>0?b:c},s.min=function(b,c){return b.cmp(c)<0?b:c},s.prototype._init=function(b,c,u){if(typeof b=="number")return this._initNumber(b,c,u);if(typeof b=="object")return this._initArray(b,c,u);c==="hex"&&(c=16),i(c===(c|0)&&c>=2&&c<=36),b=b.toString().replace(/\s+/g,"");var g=0;b[0]==="-"&&(g++,this.negative=1),g<b.length&&(c===16?this._parseHex(b,g,u):(this._parseBase(b,c,g),u==="le"&&this._initArray(this.toArray(),c,u)))},s.prototype._initNumber=function(b,c,u){b<0&&(this.negative=1,b=-b),b<67108864?(this.words=[b&67108863],this.length=1):b<4503599627370496?(this.words=[b&67108863,b/67108864&67108863],this.length=2):(i(b<9007199254740992),this.words=[b&67108863,b/67108864&67108863,1],this.length=3),u==="le"&&this._initArray(this.toArray(),c,u)},s.prototype._initArray=function(b,c,u){if(i(typeof b.length=="number"),b.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(b.length/3),this.words=new Array(this.length);for(var g=0;g<this.length;g++)this.words[g]=0;var w,S,C=0;if(u==="be")for(g=b.length-1,w=0;g>=0;g-=3)S=b[g]|b[g-1]<<8|b[g-2]<<16,this.words[w]|=S<<C&67108863,this.words[w+1]=S>>>26-C&67108863,C+=24,C>=26&&(C-=26,w++);else if(u==="le")for(g=0,w=0;g<b.length;g+=3)S=b[g]|b[g+1]<<8|b[g+2]<<16,this.words[w]|=S<<C&67108863,this.words[w+1]=S>>>26-C&67108863,C+=24,C>=26&&(C-=26,w++);return this.strip()};function a(U,b){var c=U.charCodeAt(b);return c>=65&&c<=70?c-55:c>=97&&c<=102?c-87:c-48&15}function h(U,b,c){var u=a(U,c);return c-1>=b&&(u|=a(U,c-1)<<4),u}s.prototype._parseHex=function(b,c,u){this.length=Math.ceil((b.length-c)/6),this.words=new Array(this.length);for(var g=0;g<this.length;g++)this.words[g]=0;var w=0,S=0,C;if(u==="be")for(g=b.length-1;g>=c;g-=2)C=h(b,c,g)<<w,this.words[S]|=C&67108863,w>=18?(w-=18,S+=1,this.words[S]|=C>>>26):w+=8;else{var _=b.length-c;for(g=_%2===0?c+1:c;g<b.length;g+=2)C=h(b,c,g)<<w,this.words[S]|=C&67108863,w>=18?(w-=18,S+=1,this.words[S]|=C>>>26):w+=8}this.strip()};function f(U,b,c,u){for(var g=0,w=Math.min(U.length,c),S=b;S<w;S++){var C=U.charCodeAt(S)-48;g*=u,C>=49?g+=C-49+10:C>=17?g+=C-17+10:g+=C}return g}s.prototype._parseBase=function(b,c,u){this.words=[0],this.length=1;for(var g=0,w=1;w<=67108863;w*=c)g++;g--,w=w/c|0;for(var S=b.length-u,C=S%g,_=Math.min(S,S-C)+u,l=0,d=u;d<_;d+=g)l=f(b,d,d+g,c),this.imuln(w),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(C!==0){var N=1;for(l=f(b,d,b.length,c),d=0;d<C;d++)N*=c;this.imuln(N),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}this.strip()},s.prototype.copy=function(b){b.words=new Array(this.length);for(var c=0;c<this.length;c++)b.words[c]=this.words[c];b.length=this.length,b.negative=this.negative,b.red=this.red},s.prototype.clone=function(){var b=new s(null);return this.copy(b),b},s.prototype._expand=function(b){for(;this.length<b;)this.words[this.length++]=0;return this},s.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(b,c){b=b||10,c=c|0||1;var u;if(b===16||b==="hex"){u="";for(var g=0,w=0,S=0;S<this.length;S++){var C=this.words[S],_=((C<<g|w)&16777215).toString(16);w=C>>>24-g&16777215,g+=2,g>=26&&(g-=26,S--),w!==0||S!==this.length-1?u=p[6-_.length]+_+u:u=_+u}for(w!==0&&(u=w.toString(16)+u);u.length%c!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(b===(b|0)&&b>=2&&b<=36){var l=v[b],d=x[b];u="";var N=this.clone();for(N.negative=0;!N.isZero();){var Y=N.modn(d).toString(b);N=N.idivn(d),N.isZero()?u=Y+u:u=p[l-Y.length]+Y+u}for(this.isZero()&&(u="0"+u);u.length%c!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var b=this.words[0];return this.length===2?b+=this.words[1]*67108864:this.length===3&&this.words[2]===1?b+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-b:b},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(b,c){return i(typeof o<"u"),this.toArrayLike(o,b,c)},s.prototype.toArray=function(b,c){return this.toArrayLike(Array,b,c)},s.prototype.toArrayLike=function(b,c,u){var g=this.byteLength(),w=u||Math.max(1,g);i(g<=w,"byte array longer than desired length"),i(w>0,"Requested array length <= 0"),this.strip();var S=c==="le",C=new b(w),_,l,d=this.clone();if(S){for(l=0;!d.isZero();l++)_=d.andln(255),d.iushrn(8),C[l]=_;for(;l<w;l++)C[l]=0}else{for(l=0;l<w-g;l++)C[l]=0;for(l=0;!d.isZero();l++)_=d.andln(255),d.iushrn(8),C[w-l-1]=_}return C},Math.clz32?s.prototype._countBits=function(b){return 32-Math.clz32(b)}:s.prototype._countBits=function(b){var c=b,u=0;return c>=4096&&(u+=13,c>>>=13),c>=64&&(u+=7,c>>>=7),c>=8&&(u+=4,c>>>=4),c>=2&&(u+=2,c>>>=2),u+c},s.prototype._zeroBits=function(b){if(b===0)return 26;var c=b,u=0;return c&8191||(u+=13,c>>>=13),c&127||(u+=7,c>>>=7),c&15||(u+=4,c>>>=4),c&3||(u+=2,c>>>=2),c&1||u++,u},s.prototype.bitLength=function(){var b=this.words[this.length-1],c=this._countBits(b);return(this.length-1)*26+c};function E(U){for(var b=new Array(U.bitLength()),c=0;c<b.length;c++){var u=c/26|0,g=c%26;b[c]=(U.words[u]&1<<g)>>>g}return b}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var b=0,c=0;c<this.length;c++){var u=this._zeroBits(this.words[c]);if(b+=u,u!==26)break}return b},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(b){return this.negative!==0?this.abs().inotn(b).iaddn(1):this.clone()},s.prototype.fromTwos=function(b){return this.testn(b-1)?this.notn(b).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(b){for(;this.length<b.length;)this.words[this.length++]=0;for(var c=0;c<b.length;c++)this.words[c]=this.words[c]|b.words[c];return this.strip()},s.prototype.ior=function(b){return i((this.negative|b.negative)===0),this.iuor(b)},s.prototype.or=function(b){return this.length>b.length?this.clone().ior(b):b.clone().ior(this)},s.prototype.uor=function(b){return this.length>b.length?this.clone().iuor(b):b.clone().iuor(this)},s.prototype.iuand=function(b){var c;this.length>b.length?c=b:c=this;for(var u=0;u<c.length;u++)this.words[u]=this.words[u]&b.words[u];return this.length=c.length,this.strip()},s.prototype.iand=function(b){return i((this.negative|b.negative)===0),this.iuand(b)},s.prototype.and=function(b){return this.length>b.length?this.clone().iand(b):b.clone().iand(this)},s.prototype.uand=function(b){return this.length>b.length?this.clone().iuand(b):b.clone().iuand(this)},s.prototype.iuxor=function(b){var c,u;this.length>b.length?(c=this,u=b):(c=b,u=this);for(var g=0;g<u.length;g++)this.words[g]=c.words[g]^u.words[g];if(this!==c)for(;g<c.length;g++)this.words[g]=c.words[g];return this.length=c.length,this.strip()},s.prototype.ixor=function(b){return i((this.negative|b.negative)===0),this.iuxor(b)},s.prototype.xor=function(b){return this.length>b.length?this.clone().ixor(b):b.clone().ixor(this)},s.prototype.uxor=function(b){return this.length>b.length?this.clone().iuxor(b):b.clone().iuxor(this)},s.prototype.inotn=function(b){i(typeof b=="number"&&b>=0);var c=Math.ceil(b/26)|0,u=b%26;this._expand(c),u>0&&c--;for(var g=0;g<c;g++)this.words[g]=~this.words[g]&67108863;return u>0&&(this.words[g]=~this.words[g]&67108863>>26-u),this.strip()},s.prototype.notn=function(b){return this.clone().inotn(b)},s.prototype.setn=function(b,c){i(typeof b=="number"&&b>=0);var u=b/26|0,g=b%26;return this._expand(u+1),c?this.words[u]=this.words[u]|1<<g:this.words[u]=this.words[u]&~(1<<g),this.strip()},s.prototype.iadd=function(b){var c;if(this.negative!==0&&b.negative===0)return this.negative=0,c=this.isub(b),this.negative^=1,this._normSign();if(this.negative===0&&b.negative!==0)return b.negative=0,c=this.isub(b),b.negative=1,c._normSign();var u,g;this.length>b.length?(u=this,g=b):(u=b,g=this);for(var w=0,S=0;S<g.length;S++)c=(u.words[S]|0)+(g.words[S]|0)+w,this.words[S]=c&67108863,w=c>>>26;for(;w!==0&&S<u.length;S++)c=(u.words[S]|0)+w,this.words[S]=c&67108863,w=c>>>26;if(this.length=u.length,w!==0)this.words[this.length]=w,this.length++;else if(u!==this)for(;S<u.length;S++)this.words[S]=u.words[S];return this},s.prototype.add=function(b){var c;return b.negative!==0&&this.negative===0?(b.negative=0,c=this.sub(b),b.negative^=1,c):b.negative===0&&this.negative!==0?(this.negative=0,c=b.sub(this),this.negative=1,c):this.length>b.length?this.clone().iadd(b):b.clone().iadd(this)},s.prototype.isub=function(b){if(b.negative!==0){b.negative=0;var c=this.iadd(b);return b.negative=1,c._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(b),this.negative=1,this._normSign();var u=this.cmp(b);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var g,w;u>0?(g=this,w=b):(g=b,w=this);for(var S=0,C=0;C<w.length;C++)c=(g.words[C]|0)-(w.words[C]|0)+S,S=c>>26,this.words[C]=c&67108863;for(;S!==0&&C<g.length;C++)c=(g.words[C]|0)+S,S=c>>26,this.words[C]=c&67108863;if(S===0&&C<g.length&&g!==this)for(;C<g.length;C++)this.words[C]=g.words[C];return this.length=Math.max(this.length,C),g!==this&&(this.negative=1),this.strip()},s.prototype.sub=function(b){return this.clone().isub(b)};function D(U,b,c){c.negative=b.negative^U.negative;var u=U.length+b.length|0;c.length=u,u=u-1|0;var g=U.words[0]|0,w=b.words[0]|0,S=g*w,C=S&67108863,_=S/67108864|0;c.words[0]=C;for(var l=1;l<u;l++){for(var d=_>>>26,N=_&67108863,Y=Math.min(l,b.length-1),te=Math.max(0,l-U.length+1);te<=Y;te++){var I=l-te|0;g=U.words[I]|0,w=b.words[te]|0,S=g*w+N,d+=S/67108864|0,N=S&67108863}c.words[l]=N|0,_=d|0}return _!==0?c.words[l]=_|0:c.length--,c.strip()}var B=function(b,c,u){var g=b.words,w=c.words,S=u.words,C=0,_,l,d,N=g[0]|0,Y=N&8191,te=N>>>13,I=g[1]|0,J=I&8191,k=I>>>13,H=g[2]|0,V=H&8191,m=H>>>13,z=g[3]|0,ee=z&8191,ie=z>>>13,se=g[4]|0,de=se&8191,O=se>>>13,A=g[5]|0,M=A&8191,$=A>>>13,G=g[6]|0,re=G&8191,X=G>>>13,ce=g[7]|0,fe=ce&8191,oe=ce>>>13,le=g[8]|0,he=le&8191,ue=le>>>13,we=g[9]|0,me=we&8191,ge=we>>>13,De=w[0]|0,Ne=De&8191,ve=De>>>13,Ce=w[1]|0,Ye=Ce&8191,Te=Ce>>>13,Qe=w[2]|0,Ve=Qe&8191,Re=Qe>>>13,it=w[3]|0,nt=it&8191,_e=it>>>13,Pe=w[4]|0,Fe=Pe&8191,Ee=Pe>>>13,Le=w[5]|0,Be=Le&8191,Se=Le>>>13,$e=w[6]|0,qe=$e&8191,Me=$e>>>13,ze=w[7]|0,Ue=ze&8191,Ae=ze>>>13,Oe=w[8]|0,Ke=Oe&8191,Ie=Oe>>>13,st=w[9]|0,ot=st&8191,ke=st>>>13;u.negative=b.negative^c.negative,u.length=19,_=Math.imul(Y,Ne),l=Math.imul(Y,ve),l=l+Math.imul(te,Ne)|0,d=Math.imul(te,ve);var Je=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(Je>>>26)|0,Je&=67108863,_=Math.imul(J,Ne),l=Math.imul(J,ve),l=l+Math.imul(k,Ne)|0,d=Math.imul(k,ve),_=_+Math.imul(Y,Ye)|0,l=l+Math.imul(Y,Te)|0,l=l+Math.imul(te,Ye)|0,d=d+Math.imul(te,Te)|0;var Qt=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,_=Math.imul(V,Ne),l=Math.imul(V,ve),l=l+Math.imul(m,Ne)|0,d=Math.imul(m,ve),_=_+Math.imul(J,Ye)|0,l=l+Math.imul(J,Te)|0,l=l+Math.imul(k,Ye)|0,d=d+Math.imul(k,Te)|0,_=_+Math.imul(Y,Ve)|0,l=l+Math.imul(Y,Re)|0,l=l+Math.imul(te,Ve)|0,d=d+Math.imul(te,Re)|0;var Xt=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,_=Math.imul(ee,Ne),l=Math.imul(ee,ve),l=l+Math.imul(ie,Ne)|0,d=Math.imul(ie,ve),_=_+Math.imul(V,Ye)|0,l=l+Math.imul(V,Te)|0,l=l+Math.imul(m,Ye)|0,d=d+Math.imul(m,Te)|0,_=_+Math.imul(J,Ve)|0,l=l+Math.imul(J,Re)|0,l=l+Math.imul(k,Ve)|0,d=d+Math.imul(k,Re)|0,_=_+Math.imul(Y,nt)|0,l=l+Math.imul(Y,_e)|0,l=l+Math.imul(te,nt)|0,d=d+Math.imul(te,_e)|0;var Zt=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,_=Math.imul(de,Ne),l=Math.imul(de,ve),l=l+Math.imul(O,Ne)|0,d=Math.imul(O,ve),_=_+Math.imul(ee,Ye)|0,l=l+Math.imul(ee,Te)|0,l=l+Math.imul(ie,Ye)|0,d=d+Math.imul(ie,Te)|0,_=_+Math.imul(V,Ve)|0,l=l+Math.imul(V,Re)|0,l=l+Math.imul(m,Ve)|0,d=d+Math.imul(m,Re)|0,_=_+Math.imul(J,nt)|0,l=l+Math.imul(J,_e)|0,l=l+Math.imul(k,nt)|0,d=d+Math.imul(k,_e)|0,_=_+Math.imul(Y,Fe)|0,l=l+Math.imul(Y,Ee)|0,l=l+Math.imul(te,Fe)|0,d=d+Math.imul(te,Ee)|0;var er=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(er>>>26)|0,er&=67108863,_=Math.imul(M,Ne),l=Math.imul(M,ve),l=l+Math.imul($,Ne)|0,d=Math.imul($,ve),_=_+Math.imul(de,Ye)|0,l=l+Math.imul(de,Te)|0,l=l+Math.imul(O,Ye)|0,d=d+Math.imul(O,Te)|0,_=_+Math.imul(ee,Ve)|0,l=l+Math.imul(ee,Re)|0,l=l+Math.imul(ie,Ve)|0,d=d+Math.imul(ie,Re)|0,_=_+Math.imul(V,nt)|0,l=l+Math.imul(V,_e)|0,l=l+Math.imul(m,nt)|0,d=d+Math.imul(m,_e)|0,_=_+Math.imul(J,Fe)|0,l=l+Math.imul(J,Ee)|0,l=l+Math.imul(k,Fe)|0,d=d+Math.imul(k,Ee)|0,_=_+Math.imul(Y,Be)|0,l=l+Math.imul(Y,Se)|0,l=l+Math.imul(te,Be)|0,d=d+Math.imul(te,Se)|0;var tr=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(tr>>>26)|0,tr&=67108863,_=Math.imul(re,Ne),l=Math.imul(re,ve),l=l+Math.imul(X,Ne)|0,d=Math.imul(X,ve),_=_+Math.imul(M,Ye)|0,l=l+Math.imul(M,Te)|0,l=l+Math.imul($,Ye)|0,d=d+Math.imul($,Te)|0,_=_+Math.imul(de,Ve)|0,l=l+Math.imul(de,Re)|0,l=l+Math.imul(O,Ve)|0,d=d+Math.imul(O,Re)|0,_=_+Math.imul(ee,nt)|0,l=l+Math.imul(ee,_e)|0,l=l+Math.imul(ie,nt)|0,d=d+Math.imul(ie,_e)|0,_=_+Math.imul(V,Fe)|0,l=l+Math.imul(V,Ee)|0,l=l+Math.imul(m,Fe)|0,d=d+Math.imul(m,Ee)|0,_=_+Math.imul(J,Be)|0,l=l+Math.imul(J,Se)|0,l=l+Math.imul(k,Be)|0,d=d+Math.imul(k,Se)|0,_=_+Math.imul(Y,qe)|0,l=l+Math.imul(Y,Me)|0,l=l+Math.imul(te,qe)|0,d=d+Math.imul(te,Me)|0;var Et=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(Et>>>26)|0,Et&=67108863,_=Math.imul(fe,Ne),l=Math.imul(fe,ve),l=l+Math.imul(oe,Ne)|0,d=Math.imul(oe,ve),_=_+Math.imul(re,Ye)|0,l=l+Math.imul(re,Te)|0,l=l+Math.imul(X,Ye)|0,d=d+Math.imul(X,Te)|0,_=_+Math.imul(M,Ve)|0,l=l+Math.imul(M,Re)|0,l=l+Math.imul($,Ve)|0,d=d+Math.imul($,Re)|0,_=_+Math.imul(de,nt)|0,l=l+Math.imul(de,_e)|0,l=l+Math.imul(O,nt)|0,d=d+Math.imul(O,_e)|0,_=_+Math.imul(ee,Fe)|0,l=l+Math.imul(ee,Ee)|0,l=l+Math.imul(ie,Fe)|0,d=d+Math.imul(ie,Ee)|0,_=_+Math.imul(V,Be)|0,l=l+Math.imul(V,Se)|0,l=l+Math.imul(m,Be)|0,d=d+Math.imul(m,Se)|0,_=_+Math.imul(J,qe)|0,l=l+Math.imul(J,Me)|0,l=l+Math.imul(k,qe)|0,d=d+Math.imul(k,Me)|0,_=_+Math.imul(Y,Ue)|0,l=l+Math.imul(Y,Ae)|0,l=l+Math.imul(te,Ue)|0,d=d+Math.imul(te,Ae)|0;var vi=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(vi>>>26)|0,vi&=67108863,_=Math.imul(he,Ne),l=Math.imul(he,ve),l=l+Math.imul(ue,Ne)|0,d=Math.imul(ue,ve),_=_+Math.imul(fe,Ye)|0,l=l+Math.imul(fe,Te)|0,l=l+Math.imul(oe,Ye)|0,d=d+Math.imul(oe,Te)|0,_=_+Math.imul(re,Ve)|0,l=l+Math.imul(re,Re)|0,l=l+Math.imul(X,Ve)|0,d=d+Math.imul(X,Re)|0,_=_+Math.imul(M,nt)|0,l=l+Math.imul(M,_e)|0,l=l+Math.imul($,nt)|0,d=d+Math.imul($,_e)|0,_=_+Math.imul(de,Fe)|0,l=l+Math.imul(de,Ee)|0,l=l+Math.imul(O,Fe)|0,d=d+Math.imul(O,Ee)|0,_=_+Math.imul(ee,Be)|0,l=l+Math.imul(ee,Se)|0,l=l+Math.imul(ie,Be)|0,d=d+Math.imul(ie,Se)|0,_=_+Math.imul(V,qe)|0,l=l+Math.imul(V,Me)|0,l=l+Math.imul(m,qe)|0,d=d+Math.imul(m,Me)|0,_=_+Math.imul(J,Ue)|0,l=l+Math.imul(J,Ae)|0,l=l+Math.imul(k,Ue)|0,d=d+Math.imul(k,Ae)|0,_=_+Math.imul(Y,Ke)|0,l=l+Math.imul(Y,Ie)|0,l=l+Math.imul(te,Ke)|0,d=d+Math.imul(te,Ie)|0;var mi=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(mi>>>26)|0,mi&=67108863,_=Math.imul(me,Ne),l=Math.imul(me,ve),l=l+Math.imul(ge,Ne)|0,d=Math.imul(ge,ve),_=_+Math.imul(he,Ye)|0,l=l+Math.imul(he,Te)|0,l=l+Math.imul(ue,Ye)|0,d=d+Math.imul(ue,Te)|0,_=_+Math.imul(fe,Ve)|0,l=l+Math.imul(fe,Re)|0,l=l+Math.imul(oe,Ve)|0,d=d+Math.imul(oe,Re)|0,_=_+Math.imul(re,nt)|0,l=l+Math.imul(re,_e)|0,l=l+Math.imul(X,nt)|0,d=d+Math.imul(X,_e)|0,_=_+Math.imul(M,Fe)|0,l=l+Math.imul(M,Ee)|0,l=l+Math.imul($,Fe)|0,d=d+Math.imul($,Ee)|0,_=_+Math.imul(de,Be)|0,l=l+Math.imul(de,Se)|0,l=l+Math.imul(O,Be)|0,d=d+Math.imul(O,Se)|0,_=_+Math.imul(ee,qe)|0,l=l+Math.imul(ee,Me)|0,l=l+Math.imul(ie,qe)|0,d=d+Math.imul(ie,Me)|0,_=_+Math.imul(V,Ue)|0,l=l+Math.imul(V,Ae)|0,l=l+Math.imul(m,Ue)|0,d=d+Math.imul(m,Ae)|0,_=_+Math.imul(J,Ke)|0,l=l+Math.imul(J,Ie)|0,l=l+Math.imul(k,Ke)|0,d=d+Math.imul(k,Ie)|0,_=_+Math.imul(Y,ot)|0,l=l+Math.imul(Y,ke)|0,l=l+Math.imul(te,ot)|0,d=d+Math.imul(te,ke)|0;var yi=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(yi>>>26)|0,yi&=67108863,_=Math.imul(me,Ye),l=Math.imul(me,Te),l=l+Math.imul(ge,Ye)|0,d=Math.imul(ge,Te),_=_+Math.imul(he,Ve)|0,l=l+Math.imul(he,Re)|0,l=l+Math.imul(ue,Ve)|0,d=d+Math.imul(ue,Re)|0,_=_+Math.imul(fe,nt)|0,l=l+Math.imul(fe,_e)|0,l=l+Math.imul(oe,nt)|0,d=d+Math.imul(oe,_e)|0,_=_+Math.imul(re,Fe)|0,l=l+Math.imul(re,Ee)|0,l=l+Math.imul(X,Fe)|0,d=d+Math.imul(X,Ee)|0,_=_+Math.imul(M,Be)|0,l=l+Math.imul(M,Se)|0,l=l+Math.imul($,Be)|0,d=d+Math.imul($,Se)|0,_=_+Math.imul(de,qe)|0,l=l+Math.imul(de,Me)|0,l=l+Math.imul(O,qe)|0,d=d+Math.imul(O,Me)|0,_=_+Math.imul(ee,Ue)|0,l=l+Math.imul(ee,Ae)|0,l=l+Math.imul(ie,Ue)|0,d=d+Math.imul(ie,Ae)|0,_=_+Math.imul(V,Ke)|0,l=l+Math.imul(V,Ie)|0,l=l+Math.imul(m,Ke)|0,d=d+Math.imul(m,Ie)|0,_=_+Math.imul(J,ot)|0,l=l+Math.imul(J,ke)|0,l=l+Math.imul(k,ot)|0,d=d+Math.imul(k,ke)|0;var wi=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(wi>>>26)|0,wi&=67108863,_=Math.imul(me,Ve),l=Math.imul(me,Re),l=l+Math.imul(ge,Ve)|0,d=Math.imul(ge,Re),_=_+Math.imul(he,nt)|0,l=l+Math.imul(he,_e)|0,l=l+Math.imul(ue,nt)|0,d=d+Math.imul(ue,_e)|0,_=_+Math.imul(fe,Fe)|0,l=l+Math.imul(fe,Ee)|0,l=l+Math.imul(oe,Fe)|0,d=d+Math.imul(oe,Ee)|0,_=_+Math.imul(re,Be)|0,l=l+Math.imul(re,Se)|0,l=l+Math.imul(X,Be)|0,d=d+Math.imul(X,Se)|0,_=_+Math.imul(M,qe)|0,l=l+Math.imul(M,Me)|0,l=l+Math.imul($,qe)|0,d=d+Math.imul($,Me)|0,_=_+Math.imul(de,Ue)|0,l=l+Math.imul(de,Ae)|0,l=l+Math.imul(O,Ue)|0,d=d+Math.imul(O,Ae)|0,_=_+Math.imul(ee,Ke)|0,l=l+Math.imul(ee,Ie)|0,l=l+Math.imul(ie,Ke)|0,d=d+Math.imul(ie,Ie)|0,_=_+Math.imul(V,ot)|0,l=l+Math.imul(V,ke)|0,l=l+Math.imul(m,ot)|0,d=d+Math.imul(m,ke)|0;var _i=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(_i>>>26)|0,_i&=67108863,_=Math.imul(me,nt),l=Math.imul(me,_e),l=l+Math.imul(ge,nt)|0,d=Math.imul(ge,_e),_=_+Math.imul(he,Fe)|0,l=l+Math.imul(he,Ee)|0,l=l+Math.imul(ue,Fe)|0,d=d+Math.imul(ue,Ee)|0,_=_+Math.imul(fe,Be)|0,l=l+Math.imul(fe,Se)|0,l=l+Math.imul(oe,Be)|0,d=d+Math.imul(oe,Se)|0,_=_+Math.imul(re,qe)|0,l=l+Math.imul(re,Me)|0,l=l+Math.imul(X,qe)|0,d=d+Math.imul(X,Me)|0,_=_+Math.imul(M,Ue)|0,l=l+Math.imul(M,Ae)|0,l=l+Math.imul($,Ue)|0,d=d+Math.imul($,Ae)|0,_=_+Math.imul(de,Ke)|0,l=l+Math.imul(de,Ie)|0,l=l+Math.imul(O,Ke)|0,d=d+Math.imul(O,Ie)|0,_=_+Math.imul(ee,ot)|0,l=l+Math.imul(ee,ke)|0,l=l+Math.imul(ie,ot)|0,d=d+Math.imul(ie,ke)|0;var yr=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(yr>>>26)|0,yr&=67108863,_=Math.imul(me,Fe),l=Math.imul(me,Ee),l=l+Math.imul(ge,Fe)|0,d=Math.imul(ge,Ee),_=_+Math.imul(he,Be)|0,l=l+Math.imul(he,Se)|0,l=l+Math.imul(ue,Be)|0,d=d+Math.imul(ue,Se)|0,_=_+Math.imul(fe,qe)|0,l=l+Math.imul(fe,Me)|0,l=l+Math.imul(oe,qe)|0,d=d+Math.imul(oe,Me)|0,_=_+Math.imul(re,Ue)|0,l=l+Math.imul(re,Ae)|0,l=l+Math.imul(X,Ue)|0,d=d+Math.imul(X,Ae)|0,_=_+Math.imul(M,Ke)|0,l=l+Math.imul(M,Ie)|0,l=l+Math.imul($,Ke)|0,d=d+Math.imul($,Ie)|0,_=_+Math.imul(de,ot)|0,l=l+Math.imul(de,ke)|0,l=l+Math.imul(O,ot)|0,d=d+Math.imul(O,ke)|0;var Ei=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,_=Math.imul(me,Be),l=Math.imul(me,Se),l=l+Math.imul(ge,Be)|0,d=Math.imul(ge,Se),_=_+Math.imul(he,qe)|0,l=l+Math.imul(he,Me)|0,l=l+Math.imul(ue,qe)|0,d=d+Math.imul(ue,Me)|0,_=_+Math.imul(fe,Ue)|0,l=l+Math.imul(fe,Ae)|0,l=l+Math.imul(oe,Ue)|0,d=d+Math.imul(oe,Ae)|0,_=_+Math.imul(re,Ke)|0,l=l+Math.imul(re,Ie)|0,l=l+Math.imul(X,Ke)|0,d=d+Math.imul(X,Ie)|0,_=_+Math.imul(M,ot)|0,l=l+Math.imul(M,ke)|0,l=l+Math.imul($,ot)|0,d=d+Math.imul($,ke)|0;var Ai=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,_=Math.imul(me,qe),l=Math.imul(me,Me),l=l+Math.imul(ge,qe)|0,d=Math.imul(ge,Me),_=_+Math.imul(he,Ue)|0,l=l+Math.imul(he,Ae)|0,l=l+Math.imul(ue,Ue)|0,d=d+Math.imul(ue,Ae)|0,_=_+Math.imul(fe,Ke)|0,l=l+Math.imul(fe,Ie)|0,l=l+Math.imul(oe,Ke)|0,d=d+Math.imul(oe,Ie)|0,_=_+Math.imul(re,ot)|0,l=l+Math.imul(re,ke)|0,l=l+Math.imul(X,ot)|0,d=d+Math.imul(X,ke)|0;var $t=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+($t>>>26)|0,$t&=67108863,_=Math.imul(me,Ue),l=Math.imul(me,Ae),l=l+Math.imul(ge,Ue)|0,d=Math.imul(ge,Ae),_=_+Math.imul(he,Ke)|0,l=l+Math.imul(he,Ie)|0,l=l+Math.imul(ue,Ke)|0,d=d+Math.imul(ue,Ie)|0,_=_+Math.imul(fe,ot)|0,l=l+Math.imul(fe,ke)|0,l=l+Math.imul(oe,ot)|0,d=d+Math.imul(oe,ke)|0;var xi=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(xi>>>26)|0,xi&=67108863,_=Math.imul(me,Ke),l=Math.imul(me,Ie),l=l+Math.imul(ge,Ke)|0,d=Math.imul(ge,Ie),_=_+Math.imul(he,ot)|0,l=l+Math.imul(he,ke)|0,l=l+Math.imul(ue,ot)|0,d=d+Math.imul(ue,ke)|0;var Si=(C+_|0)+((l&8191)<<13)|0;C=(d+(l>>>13)|0)+(Si>>>26)|0,Si&=67108863,_=Math.imul(me,ot),l=Math.imul(me,ke),l=l+Math.imul(ge,ot)|0,d=Math.imul(ge,ke);var Mi=(C+_|0)+((l&8191)<<13)|0;return C=(d+(l>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,S[0]=Je,S[1]=Qt,S[2]=Xt,S[3]=Zt,S[4]=er,S[5]=tr,S[6]=Et,S[7]=vi,S[8]=mi,S[9]=yi,S[10]=wi,S[11]=_i,S[12]=yr,S[13]=Ei,S[14]=Ai,S[15]=$t,S[16]=xi,S[17]=Si,S[18]=Mi,C!==0&&(S[19]=C,u.length++),u};Math.imul||(B=D);function F(U,b,c){c.negative=b.negative^U.negative,c.length=U.length+b.length;for(var u=0,g=0,w=0;w<c.length-1;w++){var S=g;g=0;for(var C=u&67108863,_=Math.min(w,b.length-1),l=Math.max(0,w-U.length+1);l<=_;l++){var d=w-l,N=U.words[d]|0,Y=b.words[l]|0,te=N*Y,I=te&67108863;S=S+(te/67108864|0)|0,I=I+C|0,C=I&67108863,S=S+(I>>>26)|0,g+=S>>>26,S&=67108863}c.words[w]=C,u=S,S=g}return u!==0?c.words[w]=u:c.length--,c.strip()}function j(U,b,c){var u=new R;return u.mulp(U,b,c)}s.prototype.mulTo=function(b,c){var u,g=this.length+b.length;return this.length===10&&b.length===10?u=B(this,b,c):g<63?u=D(this,b,c):g<1024?u=F(this,b,c):u=j(this,b,c),u};function R(U,b){this.x=U,this.y=b}R.prototype.makeRBT=function(b){for(var c=new Array(b),u=s.prototype._countBits(b)-1,g=0;g<b;g++)c[g]=this.revBin(g,u,b);return c},R.prototype.revBin=function(b,c,u){if(b===0||b===u-1)return b;for(var g=0,w=0;w<c;w++)g|=(b&1)<<c-w-1,b>>=1;return g},R.prototype.permute=function(b,c,u,g,w,S){for(var C=0;C<S;C++)g[C]=c[b[C]],w[C]=u[b[C]]},R.prototype.transform=function(b,c,u,g,w,S){this.permute(S,b,c,u,g,w);for(var C=1;C<w;C<<=1)for(var _=C<<1,l=Math.cos(2*Math.PI/_),d=Math.sin(2*Math.PI/_),N=0;N<w;N+=_)for(var Y=l,te=d,I=0;I<C;I++){var J=u[N+I],k=g[N+I],H=u[N+I+C],V=g[N+I+C],m=Y*H-te*V;V=Y*V+te*H,H=m,u[N+I]=J+H,g[N+I]=k+V,u[N+I+C]=J-H,g[N+I+C]=k-V,I!==_&&(m=l*Y-d*te,te=l*te+d*Y,Y=m)}},R.prototype.guessLen13b=function(b,c){var u=Math.max(c,b)|1,g=u&1,w=0;for(u=u/2|0;u;u=u>>>1)w++;return 1<<w+1+g},R.prototype.conjugate=function(b,c,u){if(!(u<=1))for(var g=0;g<u/2;g++){var w=b[g];b[g]=b[u-g-1],b[u-g-1]=w,w=c[g],c[g]=-c[u-g-1],c[u-g-1]=-w}},R.prototype.normalize13b=function(b,c){for(var u=0,g=0;g<c/2;g++){var w=Math.round(b[2*g+1]/c)*8192+Math.round(b[2*g]/c)+u;b[g]=w&67108863,w<67108864?u=0:u=w/67108864|0}return b},R.prototype.convert13b=function(b,c,u,g){for(var w=0,S=0;S<c;S++)w=w+(b[S]|0),u[2*S]=w&8191,w=w>>>13,u[2*S+1]=w&8191,w=w>>>13;for(S=2*c;S<g;++S)u[S]=0;i(w===0),i((w&-8192)===0)},R.prototype.stub=function(b){for(var c=new Array(b),u=0;u<b;u++)c[u]=0;return c},R.prototype.mulp=function(b,c,u){var g=2*this.guessLen13b(b.length,c.length),w=this.makeRBT(g),S=this.stub(g),C=new Array(g),_=new Array(g),l=new Array(g),d=new Array(g),N=new Array(g),Y=new Array(g),te=u.words;te.length=g,this.convert13b(b.words,b.length,C,g),this.convert13b(c.words,c.length,d,g),this.transform(C,S,_,l,g,w),this.transform(d,S,N,Y,g,w);for(var I=0;I<g;I++){var J=_[I]*N[I]-l[I]*Y[I];l[I]=_[I]*Y[I]+l[I]*N[I],_[I]=J}return this.conjugate(_,l,g),this.transform(_,l,te,S,g,w),this.conjugate(te,S,g),this.normalize13b(te,g),u.negative=b.negative^c.negative,u.length=b.length+c.length,u.strip()},s.prototype.mul=function(b){var c=new s(null);return c.words=new Array(this.length+b.length),this.mulTo(b,c)},s.prototype.mulf=function(b){var c=new s(null);return c.words=new Array(this.length+b.length),j(this,b,c)},s.prototype.imul=function(b){return this.clone().mulTo(b,this)},s.prototype.imuln=function(b){i(typeof b=="number"),i(b<67108864);for(var c=0,u=0;u<this.length;u++){var g=(this.words[u]|0)*b,w=(g&67108863)+(c&67108863);c>>=26,c+=g/67108864|0,c+=w>>>26,this.words[u]=w&67108863}return c!==0&&(this.words[u]=c,this.length++),this},s.prototype.muln=function(b){return this.clone().imuln(b)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(b){var c=E(b);if(c.length===0)return new s(1);for(var u=this,g=0;g<c.length&&c[g]===0;g++,u=u.sqr());if(++g<c.length)for(var w=u.sqr();g<c.length;g++,w=w.sqr())c[g]!==0&&(u=u.mul(w));return u},s.prototype.iushln=function(b){i(typeof b=="number"&&b>=0);var c=b%26,u=(b-c)/26,g=67108863>>>26-c<<26-c,w;if(c!==0){var S=0;for(w=0;w<this.length;w++){var C=this.words[w]&g,_=(this.words[w]|0)-C<<c;this.words[w]=_|S,S=C>>>26-c}S&&(this.words[w]=S,this.length++)}if(u!==0){for(w=this.length-1;w>=0;w--)this.words[w+u]=this.words[w];for(w=0;w<u;w++)this.words[w]=0;this.length+=u}return this.strip()},s.prototype.ishln=function(b){return i(this.negative===0),this.iushln(b)},s.prototype.iushrn=function(b,c,u){i(typeof b=="number"&&b>=0);var g;c?g=(c-c%26)/26:g=0;var w=b%26,S=Math.min((b-w)/26,this.length),C=67108863^67108863>>>w<<w,_=u;if(g-=S,g=Math.max(0,g),_){for(var l=0;l<S;l++)_.words[l]=this.words[l];_.length=S}if(S!==0)if(this.length>S)for(this.length-=S,l=0;l<this.length;l++)this.words[l]=this.words[l+S];else this.words[0]=0,this.length=1;var d=0;for(l=this.length-1;l>=0&&(d!==0||l>=g);l--){var N=this.words[l]|0;this.words[l]=d<<26-w|N>>>w,d=N&C}return _&&d!==0&&(_.words[_.length++]=d),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(b,c,u){return i(this.negative===0),this.iushrn(b,c,u)},s.prototype.shln=function(b){return this.clone().ishln(b)},s.prototype.ushln=function(b){return this.clone().iushln(b)},s.prototype.shrn=function(b){return this.clone().ishrn(b)},s.prototype.ushrn=function(b){return this.clone().iushrn(b)},s.prototype.testn=function(b){i(typeof b=="number"&&b>=0);var c=b%26,u=(b-c)/26,g=1<<c;if(this.length<=u)return!1;var w=this.words[u];return!!(w&g)},s.prototype.imaskn=function(b){i(typeof b=="number"&&b>=0);var c=b%26,u=(b-c)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(c!==0&&u++,this.length=Math.min(u,this.length),c!==0){var g=67108863^67108863>>>c<<c;this.words[this.length-1]&=g}return this.strip()},s.prototype.maskn=function(b){return this.clone().imaskn(b)},s.prototype.iaddn=function(b){return i(typeof b=="number"),i(b<67108864),b<0?this.isubn(-b):this.negative!==0?this.length===1&&(this.words[0]|0)<b?(this.words[0]=b-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(b),this.negative=1,this):this._iaddn(b)},s.prototype._iaddn=function(b){this.words[0]+=b;for(var c=0;c<this.length&&this.words[c]>=67108864;c++)this.words[c]-=67108864,c===this.length-1?this.words[c+1]=1:this.words[c+1]++;return this.length=Math.max(this.length,c+1),this},s.prototype.isubn=function(b){if(i(typeof b=="number"),i(b<67108864),b<0)return this.iaddn(-b);if(this.negative!==0)return this.negative=0,this.iaddn(b),this.negative=1,this;if(this.words[0]-=b,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var c=0;c<this.length&&this.words[c]<0;c++)this.words[c]+=67108864,this.words[c+1]-=1;return this.strip()},s.prototype.addn=function(b){return this.clone().iaddn(b)},s.prototype.subn=function(b){return this.clone().isubn(b)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(b,c,u){var g=b.length+u,w;this._expand(g);var S,C=0;for(w=0;w<b.length;w++){S=(this.words[w+u]|0)+C;var _=(b.words[w]|0)*c;S-=_&67108863,C=(S>>26)-(_/67108864|0),this.words[w+u]=S&67108863}for(;w<this.length-u;w++)S=(this.words[w+u]|0)+C,C=S>>26,this.words[w+u]=S&67108863;if(C===0)return this.strip();for(i(C===-1),C=0,w=0;w<this.length;w++)S=-(this.words[w]|0)+C,C=S>>26,this.words[w]=S&67108863;return this.negative=1,this.strip()},s.prototype._wordDiv=function(b,c){var u=this.length-b.length,g=this.clone(),w=b,S=w.words[w.length-1]|0,C=this._countBits(S);u=26-C,u!==0&&(w=w.ushln(u),g.iushln(u),S=w.words[w.length-1]|0);var _=g.length-w.length,l;if(c!=="mod"){l=new s(null),l.length=_+1,l.words=new Array(l.length);for(var d=0;d<l.length;d++)l.words[d]=0}var N=g.clone()._ishlnsubmul(w,1,_);N.negative===0&&(g=N,l&&(l.words[_]=1));for(var Y=_-1;Y>=0;Y--){var te=(g.words[w.length+Y]|0)*67108864+(g.words[w.length+Y-1]|0);for(te=Math.min(te/S|0,67108863),g._ishlnsubmul(w,te,Y);g.negative!==0;)te--,g.negative=0,g._ishlnsubmul(w,1,Y),g.isZero()||(g.negative^=1);l&&(l.words[Y]=te)}return l&&l.strip(),g.strip(),c!=="div"&&u!==0&&g.iushrn(u),{div:l||null,mod:g}},s.prototype.divmod=function(b,c,u){if(i(!b.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var g,w,S;return this.negative!==0&&b.negative===0?(S=this.neg().divmod(b,c),c!=="mod"&&(g=S.div.neg()),c!=="div"&&(w=S.mod.neg(),u&&w.negative!==0&&w.iadd(b)),{div:g,mod:w}):this.negative===0&&b.negative!==0?(S=this.divmod(b.neg(),c),c!=="mod"&&(g=S.div.neg()),{div:g,mod:S.mod}):this.negative&b.negative?(S=this.neg().divmod(b.neg(),c),c!=="div"&&(w=S.mod.neg(),u&&w.negative!==0&&w.isub(b)),{div:S.div,mod:w}):b.length>this.length||this.cmp(b)<0?{div:new s(0),mod:this}:b.length===1?c==="div"?{div:this.divn(b.words[0]),mod:null}:c==="mod"?{div:null,mod:new s(this.modn(b.words[0]))}:{div:this.divn(b.words[0]),mod:new s(this.modn(b.words[0]))}:this._wordDiv(b,c)},s.prototype.div=function(b){return this.divmod(b,"div",!1).div},s.prototype.mod=function(b){return this.divmod(b,"mod",!1).mod},s.prototype.umod=function(b){return this.divmod(b,"mod",!0).mod},s.prototype.divRound=function(b){var c=this.divmod(b);if(c.mod.isZero())return c.div;var u=c.div.negative!==0?c.mod.isub(b):c.mod,g=b.ushrn(1),w=b.andln(1),S=u.cmp(g);return S<0||w===1&&S===0?c.div:c.div.negative!==0?c.div.isubn(1):c.div.iaddn(1)},s.prototype.modn=function(b){i(b<=67108863);for(var c=(1<<26)%b,u=0,g=this.length-1;g>=0;g--)u=(c*u+(this.words[g]|0))%b;return u},s.prototype.idivn=function(b){i(b<=67108863);for(var c=0,u=this.length-1;u>=0;u--){var g=(this.words[u]|0)+c*67108864;this.words[u]=g/b|0,c=g%b}return this.strip()},s.prototype.divn=function(b){return this.clone().idivn(b)},s.prototype.egcd=function(b){i(b.negative===0),i(!b.isZero());var c=this,u=b.clone();c.negative!==0?c=c.umod(b):c=c.clone();for(var g=new s(1),w=new s(0),S=new s(0),C=new s(1),_=0;c.isEven()&&u.isEven();)c.iushrn(1),u.iushrn(1),++_;for(var l=u.clone(),d=c.clone();!c.isZero();){for(var N=0,Y=1;!(c.words[0]&Y)&&N<26;++N,Y<<=1);if(N>0)for(c.iushrn(N);N-- >0;)(g.isOdd()||w.isOdd())&&(g.iadd(l),w.isub(d)),g.iushrn(1),w.iushrn(1);for(var te=0,I=1;!(u.words[0]&I)&&te<26;++te,I<<=1);if(te>0)for(u.iushrn(te);te-- >0;)(S.isOdd()||C.isOdd())&&(S.iadd(l),C.isub(d)),S.iushrn(1),C.iushrn(1);c.cmp(u)>=0?(c.isub(u),g.isub(S),w.isub(C)):(u.isub(c),S.isub(g),C.isub(w))}return{a:S,b:C,gcd:u.iushln(_)}},s.prototype._invmp=function(b){i(b.negative===0),i(!b.isZero());var c=this,u=b.clone();c.negative!==0?c=c.umod(b):c=c.clone();for(var g=new s(1),w=new s(0),S=u.clone();c.cmpn(1)>0&&u.cmpn(1)>0;){for(var C=0,_=1;!(c.words[0]&_)&&C<26;++C,_<<=1);if(C>0)for(c.iushrn(C);C-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);for(var l=0,d=1;!(u.words[0]&d)&&l<26;++l,d<<=1);if(l>0)for(u.iushrn(l);l-- >0;)w.isOdd()&&w.iadd(S),w.iushrn(1);c.cmp(u)>=0?(c.isub(u),g.isub(w)):(u.isub(c),w.isub(g))}var N;return c.cmpn(1)===0?N=g:N=w,N.cmpn(0)<0&&N.iadd(b),N},s.prototype.gcd=function(b){if(this.isZero())return b.abs();if(b.isZero())return this.abs();var c=this.clone(),u=b.clone();c.negative=0,u.negative=0;for(var g=0;c.isEven()&&u.isEven();g++)c.iushrn(1),u.iushrn(1);do{for(;c.isEven();)c.iushrn(1);for(;u.isEven();)u.iushrn(1);var w=c.cmp(u);if(w<0){var S=c;c=u,u=S}else if(w===0||u.cmpn(1)===0)break;c.isub(u)}while(!0);return u.iushln(g)},s.prototype.invm=function(b){return this.egcd(b).a.umod(b)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(b){return this.words[0]&b},s.prototype.bincn=function(b){i(typeof b=="number");var c=b%26,u=(b-c)/26,g=1<<c;if(this.length<=u)return this._expand(u+1),this.words[u]|=g,this;for(var w=g,S=u;w!==0&&S<this.length;S++){var C=this.words[S]|0;C+=w,w=C>>>26,C&=67108863,this.words[S]=C}return w!==0&&(this.words[S]=w,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(b){var c=b<0;if(this.negative!==0&&!c)return-1;if(this.negative===0&&c)return 1;this.strip();var u;if(this.length>1)u=1;else{c&&(b=-b),i(b<=67108863,"Number is too big");var g=this.words[0]|0;u=g===b?0:g<b?-1:1}return this.negative!==0?-u|0:u},s.prototype.cmp=function(b){if(this.negative!==0&&b.negative===0)return-1;if(this.negative===0&&b.negative!==0)return 1;var c=this.ucmp(b);return this.negative!==0?-c|0:c},s.prototype.ucmp=function(b){if(this.length>b.length)return 1;if(this.length<b.length)return-1;for(var c=0,u=this.length-1;u>=0;u--){var g=this.words[u]|0,w=b.words[u]|0;if(g!==w){g<w?c=-1:g>w&&(c=1);break}}return c},s.prototype.gtn=function(b){return this.cmpn(b)===1},s.prototype.gt=function(b){return this.cmp(b)===1},s.prototype.gten=function(b){return this.cmpn(b)>=0},s.prototype.gte=function(b){return this.cmp(b)>=0},s.prototype.ltn=function(b){return this.cmpn(b)===-1},s.prototype.lt=function(b){return this.cmp(b)===-1},s.prototype.lten=function(b){return this.cmpn(b)<=0},s.prototype.lte=function(b){return this.cmp(b)<=0},s.prototype.eqn=function(b){return this.cmpn(b)===0},s.prototype.eq=function(b){return this.cmp(b)===0},s.red=function(b){return new Z(b)},s.prototype.toRed=function(b){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),b.convertTo(this)._forceRed(b)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(b){return this.red=b,this},s.prototype.forceRed=function(b){return i(!this.red,"Already a number in reduction context"),this._forceRed(b)},s.prototype.redAdd=function(b){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,b)},s.prototype.redIAdd=function(b){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,b)},s.prototype.redSub=function(b){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,b)},s.prototype.redISub=function(b){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,b)},s.prototype.redShl=function(b){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,b)},s.prototype.redMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.mul(this,b)},s.prototype.redIMul=function(b){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,b),this.red.imul(this,b)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(b){return i(this.red&&!b.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,b)};var K={k256:null,p224:null,p192:null,p25519:null};function T(U,b){this.name=U,this.p=new s(b,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}T.prototype._tmp=function(){var b=new s(null);return b.words=new Array(Math.ceil(this.n/13)),b},T.prototype.ireduce=function(b){var c=b,u;do this.split(c,this.tmp),c=this.imulK(c),c=c.iadd(this.tmp),u=c.bitLength();while(u>this.n);var g=u<this.n?-1:c.ucmp(this.p);return g===0?(c.words[0]=0,c.length=1):g>0?c.isub(this.p):c.strip!==void 0?c.strip():c._strip(),c},T.prototype.split=function(b,c){b.iushrn(this.n,0,c)},T.prototype.imulK=function(b){return b.imul(this.k)};function L(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(L,T),L.prototype.split=function(b,c){for(var u=4194303,g=Math.min(b.length,9),w=0;w<g;w++)c.words[w]=b.words[w];if(c.length=g,b.length<=9){b.words[0]=0,b.length=1;return}var S=b.words[9];for(c.words[c.length++]=S&u,w=10;w<b.length;w++){var C=b.words[w]|0;b.words[w-10]=(C&u)<<4|S>>>22,S=C}S>>>=22,b.words[w-10]=S,S===0&&b.length>10?b.length-=10:b.length-=9},L.prototype.imulK=function(b){b.words[b.length]=0,b.words[b.length+1]=0,b.length+=2;for(var c=0,u=0;u<b.length;u++){var g=b.words[u]|0;c+=g*977,b.words[u]=c&67108863,c=g*64+(c/67108864|0)}return b.words[b.length-1]===0&&(b.length--,b.words[b.length-1]===0&&b.length--),b};function q(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(q,T);function y(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(y,T);function P(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(P,T),P.prototype.imulK=function(b){for(var c=0,u=0;u<b.length;u++){var g=(b.words[u]|0)*19+c,w=g&67108863;g>>>=26,b.words[u]=w,c=g}return c!==0&&(b.words[b.length++]=c),b},s._prime=function(b){if(K[b])return K[b];var c;if(b==="k256")c=new L;else if(b==="p224")c=new q;else if(b==="p192")c=new y;else if(b==="p25519")c=new P;else throw new Error("Unknown prime "+b);return K[b]=c,c};function Z(U){if(typeof U=="string"){var b=s._prime(U);this.m=b.p,this.prime=b}else i(U.gtn(1),"modulus must be greater than 1"),this.m=U,this.prime=null}Z.prototype._verify1=function(b){i(b.negative===0,"red works only with positives"),i(b.red,"red works only with red numbers")},Z.prototype._verify2=function(b,c){i((b.negative|c.negative)===0,"red works only with positives"),i(b.red&&b.red===c.red,"red works only with red numbers")},Z.prototype.imod=function(b){return this.prime?this.prime.ireduce(b)._forceRed(this):b.umod(this.m)._forceRed(this)},Z.prototype.neg=function(b){return b.isZero()?b.clone():this.m.sub(b)._forceRed(this)},Z.prototype.add=function(b,c){this._verify2(b,c);var u=b.add(c);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},Z.prototype.iadd=function(b,c){this._verify2(b,c);var u=b.iadd(c);return u.cmp(this.m)>=0&&u.isub(this.m),u},Z.prototype.sub=function(b,c){this._verify2(b,c);var u=b.sub(c);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},Z.prototype.isub=function(b,c){this._verify2(b,c);var u=b.isub(c);return u.cmpn(0)<0&&u.iadd(this.m),u},Z.prototype.shl=function(b,c){return this._verify1(b),this.imod(b.ushln(c))},Z.prototype.imul=function(b,c){return this._verify2(b,c),this.imod(b.imul(c))},Z.prototype.mul=function(b,c){return this._verify2(b,c),this.imod(b.mul(c))},Z.prototype.isqr=function(b){return this.imul(b,b.clone())},Z.prototype.sqr=function(b){return this.mul(b,b)},Z.prototype.sqrt=function(b){if(b.isZero())return b.clone();var c=this.m.andln(3);if(i(c%2===1),c===3){var u=this.m.add(new s(1)).iushrn(2);return this.pow(b,u)}for(var g=this.m.subn(1),w=0;!g.isZero()&&g.andln(1)===0;)w++,g.iushrn(1);i(!g.isZero());var S=new s(1).toRed(this),C=S.redNeg(),_=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new s(2*l*l).toRed(this);this.pow(l,_).cmp(C)!==0;)l.redIAdd(C);for(var d=this.pow(l,g),N=this.pow(b,g.addn(1).iushrn(1)),Y=this.pow(b,g),te=w;Y.cmp(S)!==0;){for(var I=Y,J=0;I.cmp(S)!==0;J++)I=I.redSqr();i(J<te);var k=this.pow(d,new s(1).iushln(te-J-1));N=N.redMul(k),d=k.redSqr(),Y=Y.redMul(d),te=J}return N},Z.prototype.invm=function(b){var c=b._invmp(this.m);return c.negative!==0?(c.negative=0,this.imod(c).redNeg()):this.imod(c)},Z.prototype.pow=function(b,c){if(c.isZero())return new s(1).toRed(this);if(c.cmpn(1)===0)return b.clone();var u=4,g=new Array(1<<u);g[0]=new s(1).toRed(this),g[1]=b;for(var w=2;w<g.length;w++)g[w]=this.mul(g[w-1],b);var S=g[0],C=0,_=0,l=c.bitLength()%26;for(l===0&&(l=26),w=c.length-1;w>=0;w--){for(var d=c.words[w],N=l-1;N>=0;N--){var Y=d>>N&1;if(S!==g[0]&&(S=this.sqr(S)),Y===0&&C===0){_=0;continue}C<<=1,C|=Y,_++,!(_!==u&&(w!==0||N!==0))&&(S=this.mul(S,g[C]),_=0,C=0)}l=26}return S},Z.prototype.convertTo=function(b){var c=b.umod(this.m);return c===b?c.clone():c},Z.prototype.convertFrom=function(b){var c=b.clone();return c.red=null,c},s.mont=function(b){return new ne(b)};function ne(U){Z.call(this,U),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(ne,Z),ne.prototype.convertTo=function(b){return this.imod(b.ushln(this.shift))},ne.prototype.convertFrom=function(b){var c=this.imod(b.mul(this.rinv));return c.red=null,c},ne.prototype.imul=function(b,c){if(b.isZero()||c.isZero())return b.words[0]=0,b.length=1,b;var u=b.imul(c),g=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=u.isub(g).iushrn(this.shift),S=w;return w.cmp(this.m)>=0?S=w.isub(this.m):w.cmpn(0)<0&&(S=w.iadd(this.m)),S._forceRed(this)},ne.prototype.mul=function(b,c){if(b.isZero()||c.isZero())return new s(0)._forceRed(this);var u=b.mul(c),g=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),w=u.isub(g).iushrn(this.shift),S=w;return w.cmp(this.m)>=0?S=w.isub(this.m):w.cmpn(0)<0&&(S=w.iadd(this.m)),S._forceRed(this)},ne.prototype.invm=function(b){var c=this.imod(b._invmp(this.m).mul(this.r2));return c._forceRed(this)}})(t,$r)})(qf);var zi=qf.exports,Nn=L0;function L0(t,e){if(!t)throw new Error(e||"Assertion failed")}L0.equal=function(e,r,i){if(e!=r)throw new Error(i||"Assertion failed: "+e+" != "+r)};var zf={};(function(t){var e=t;function r(s,o){if(Array.isArray(s))return s.slice();if(!s)return[];var a=[];if(typeof s!="string"){for(var h=0;h<s.length;h++)a[h]=s[h]|0;return a}if(o==="hex"){s=s.replace(/[^a-z0-9]+/ig,""),s.length%2!==0&&(s="0"+s);for(var h=0;h<s.length;h+=2)a.push(parseInt(s[h]+s[h+1],16))}else for(var h=0;h<s.length;h++){var f=s.charCodeAt(h),p=f>>8,v=f&255;p?a.push(p,v):a.push(v)}return a}e.toArray=r;function i(s){return s.length===1?"0"+s:s}e.zero2=i;function n(s){for(var o="",a=0;a<s.length;a++)o+=i(s[a].toString(16));return o}e.toHex=n,e.encode=function(o,a){return a==="hex"?n(o):o}})(zf);(function(t){var e=t,r=zi,i=Nn,n=zf;e.assert=i,e.toArray=n.toArray,e.zero2=n.zero2,e.toHex=n.toHex,e.encode=n.encode;function s(p,v,x){var E=new Array(Math.max(p.bitLength(),x)+1),D;for(D=0;D<E.length;D+=1)E[D]=0;var B=1<<v+1,F=p.clone();for(D=0;D<E.length;D++){var j,R=F.andln(B-1);F.isOdd()?(R>(B>>1)-1?j=(B>>1)-R:j=R,F.isubn(j)):j=0,E[D]=j,F.iushrn(1)}return E}e.getNAF=s;function o(p,v){var x=[[],[]];p=p.clone(),v=v.clone();for(var E=0,D=0,B;p.cmpn(-E)>0||v.cmpn(-D)>0;){var F=p.andln(3)+E&3,j=v.andln(3)+D&3;F===3&&(F=-1),j===3&&(j=-1);var R;F&1?(B=p.andln(7)+E&7,(B===3||B===5)&&j===2?R=-F:R=F):R=0,x[0].push(R);var K;j&1?(B=v.andln(7)+D&7,(B===3||B===5)&&F===2?K=-j:K=j):K=0,x[1].push(K),2*E===R+1&&(E=1-E),2*D===K+1&&(D=1-D),p.iushrn(1),v.iushrn(1)}return x}e.getJSF=o;function a(p,v,x){var E="_"+v;p.prototype[v]=function(){return this[E]!==void 0?this[E]:this[E]=x.call(this)}}e.cachedProperty=a;function h(p){return typeof p=="string"?e.toArray(p,"hex"):p}e.parseBytes=h;function f(p){return new r(p,"hex","le")}e.intFromLE=f})(br);var Kf={exports:{}},cc;Kf.exports=function(e){return cc||(cc=new Zi(null)),cc.generate(e)};function Zi(t){this.rand=t}Kf.exports.Rand=Zi;Zi.prototype.generate=function(e){return this._rand(e)};Zi.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var r=new Uint8Array(e),i=0;i<r.length;i++)r[i]=this.rand.getByte();return r};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?Zi.prototype._rand=function(e){var r=new Uint8Array(e);return self.crypto.getRandomValues(r),r}:self.msCrypto&&self.msCrypto.getRandomValues?Zi.prototype._rand=function(e){var r=new Uint8Array(e);return self.msCrypto.getRandomValues(r),r}:typeof window=="object"&&(Zi.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var Gh=kf;if(typeof Gh.randomBytes!="function")throw new Error("Not supported");Zi.prototype._rand=function(e){return Gh.randomBytes(e)}}catch{}var U0=Kf.exports,jf={},ln=zi,lo=br,ia=lo.getNAF,M2=lo.getJSF,na=lo.assert;function sn(t,e){this.type=t,this.p=new ln(e.p,16),this.red=e.prime?ln.red(e.prime):ln.mont(this.p),this.zero=new ln(0).toRed(this.red),this.one=new ln(1).toRed(this.red),this.two=new ln(2).toRed(this.red),this.n=e.n&&new ln(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Da=sn;sn.prototype.point=function(){throw new Error("Not implemented")};sn.prototype.validate=function(){throw new Error("Not implemented")};sn.prototype._fixedNafMul=function(e,r){na(e.precomputed);var i=e._getDoubles(),n=ia(r,1,this._bitLength),s=(1<<i.step+1)-(i.step%2===0?2:1);s/=3;var o=[],a,h;for(a=0;a<n.length;a+=i.step){h=0;for(var f=a+i.step-1;f>=a;f--)h=(h<<1)+n[f];o.push(h)}for(var p=this.jpoint(null,null,null),v=this.jpoint(null,null,null),x=s;x>0;x--){for(a=0;a<o.length;a++)h=o[a],h===x?v=v.mixedAdd(i.points[a]):h===-x&&(v=v.mixedAdd(i.points[a].neg()));p=p.add(v)}return p.toP()};sn.prototype._wnafMul=function(e,r){var i=4,n=e._getNAFPoints(i);i=n.wnd;for(var s=n.points,o=ia(r,i,this._bitLength),a=this.jpoint(null,null,null),h=o.length-1;h>=0;h--){for(var f=0;h>=0&&o[h]===0;h--)f++;if(h>=0&&f++,a=a.dblp(f),h<0)break;var p=o[h];na(p!==0),e.type==="affine"?p>0?a=a.mixedAdd(s[p-1>>1]):a=a.mixedAdd(s[-p-1>>1].neg()):p>0?a=a.add(s[p-1>>1]):a=a.add(s[-p-1>>1].neg())}return e.type==="affine"?a.toP():a};sn.prototype._wnafMulAdd=function(e,r,i,n,s){var o=this._wnafT1,a=this._wnafT2,h=this._wnafT3,f=0,p,v,x;for(p=0;p<n;p++){x=r[p];var E=x._getNAFPoints(e);o[p]=E.wnd,a[p]=E.points}for(p=n-1;p>=1;p-=2){var D=p-1,B=p;if(o[D]!==1||o[B]!==1){h[D]=ia(i[D],o[D],this._bitLength),h[B]=ia(i[B],o[B],this._bitLength),f=Math.max(h[D].length,f),f=Math.max(h[B].length,f);continue}var F=[r[D],null,null,r[B]];r[D].y.cmp(r[B].y)===0?(F[1]=r[D].add(r[B]),F[2]=r[D].toJ().mixedAdd(r[B].neg())):r[D].y.cmp(r[B].y.redNeg())===0?(F[1]=r[D].toJ().mixedAdd(r[B]),F[2]=r[D].add(r[B].neg())):(F[1]=r[D].toJ().mixedAdd(r[B]),F[2]=r[D].toJ().mixedAdd(r[B].neg()));var j=[-3,-1,-5,-7,0,7,5,1,3],R=M2(i[D],i[B]);for(f=Math.max(R[0].length,f),h[D]=new Array(f),h[B]=new Array(f),v=0;v<f;v++){var K=R[0][v]|0,T=R[1][v]|0;h[D][v]=j[(K+1)*3+(T+1)],h[B][v]=0,a[D]=F}}var L=this.jpoint(null,null,null),q=this._wnafT4;for(p=f;p>=0;p--){for(var y=0;p>=0;){var P=!0;for(v=0;v<n;v++)q[v]=h[v][p]|0,q[v]!==0&&(P=!1);if(!P)break;y++,p--}if(p>=0&&y++,L=L.dblp(y),p<0)break;for(v=0;v<n;v++){var Z=q[v];Z!==0&&(Z>0?x=a[v][Z-1>>1]:Z<0&&(x=a[v][-Z-1>>1].neg()),x.type==="affine"?L=L.mixedAdd(x):L=L.add(x))}}for(p=0;p<n;p++)a[p]=null;return s?L:L.toP()};function Nr(t,e){this.curve=t,this.type=e,this.precomputed=null}sn.BasePoint=Nr;Nr.prototype.eq=function(){throw new Error("Not implemented")};Nr.prototype.validate=function(){return this.curve.validate(this)};sn.prototype.decodePoint=function(e,r){e=lo.toArray(e,r);var i=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1===2*i){e[0]===6?na(e[e.length-1]%2===0):e[0]===7&&na(e[e.length-1]%2===1);var n=this.point(e.slice(1,1+i),e.slice(1+i,1+2*i));return n}else if((e[0]===2||e[0]===3)&&e.length-1===i)return this.pointFromX(e.slice(1,1+i),e[0]===3);throw new Error("Unknown point format")};Nr.prototype.encodeCompressed=function(e){return this.encode(e,!0)};Nr.prototype._encode=function(e){var r=this.curve.p.byteLength(),i=this.getX().toArray("be",r);return e?[this.getY().isEven()?2:3].concat(i):[4].concat(i,this.getY().toArray("be",r))};Nr.prototype.encode=function(e,r){return lo.encode(this._encode(r),e)};Nr.prototype.precompute=function(e){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,e),r.beta=this._getBeta(),this.precomputed=r,this};Nr.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((e.bitLength()+1)/r.step):!1};Nr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],n=this,s=0;s<r;s+=e){for(var o=0;o<e;o++)n=n.dbl();i.push(n)}return{step:e,points:i}};Nr.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],i=(1<<e)-1,n=i===1?null:this.dbl(),s=1;s<i;s++)r[s]=r[s-1].add(n);return{wnd:e,points:r}};Nr.prototype._getBeta=function(){return null};Nr.prototype.dblp=function(e){for(var r=this,i=0;i<e;i++)r=r.dbl();return r};var I2=br,yt=zi,Hf=Ia,ls=Da,D2=I2.assert;function Tr(t){ls.call(this,"short",t),this.a=new yt(t.a,16).toRed(this.red),this.b=new yt(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Hf(Tr,ls);var C2=Tr;Tr.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,i;if(e.beta)r=new yt(e.beta,16).toRed(this.red);else{var n=this._getEndoRoots(this.p);r=n[0].cmp(n[1])<0?n[0]:n[1],r=r.toRed(this.red)}if(e.lambda)i=new yt(e.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?i=s[0]:(i=s[1],D2(this.g.mul(i).x.cmp(this.g.x.redMul(r))===0))}var o;return e.basis?o=e.basis.map(function(a){return{a:new yt(a.a,16),b:new yt(a.b,16)}}):o=this._getEndoBasis(i),{beta:r,lambda:i,basis:o}}};Tr.prototype._getEndoRoots=function(e){var r=e===this.p?this.red:yt.mont(e),i=new yt(2).toRed(r).redInvm(),n=i.redNeg(),s=new yt(3).toRed(r).redNeg().redSqrt().redMul(i),o=n.redAdd(s).fromRed(),a=n.redSub(s).fromRed();return[o,a]};Tr.prototype._getEndoBasis=function(e){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),i=e,n=this.n.clone(),s=new yt(1),o=new yt(0),a=new yt(0),h=new yt(1),f,p,v,x,E,D,B,F=0,j,R;i.cmpn(0)!==0;){var K=n.div(i);j=n.sub(K.mul(i)),R=a.sub(K.mul(s));var T=h.sub(K.mul(o));if(!v&&j.cmp(r)<0)f=B.neg(),p=s,v=j.neg(),x=R;else if(v&&++F===2)break;B=j,n=i,i=j,a=s,s=R,h=o,o=T}E=j.neg(),D=R;var L=v.sqr().add(x.sqr()),q=E.sqr().add(D.sqr());return q.cmp(L)>=0&&(E=f,D=p),v.negative&&(v=v.neg(),x=x.neg()),E.negative&&(E=E.neg(),D=D.neg()),[{a:v,b:x},{a:E,b:D}]};Tr.prototype._endoSplit=function(e){var r=this.endo.basis,i=r[0],n=r[1],s=n.b.mul(e).divRound(this.n),o=i.b.neg().mul(e).divRound(this.n),a=s.mul(i.a),h=o.mul(n.a),f=s.mul(i.b),p=o.mul(n.b),v=e.sub(a).sub(h),x=f.add(p).neg();return{k1:v,k2:x}};Tr.prototype.pointFromX=function(e,r){e=new yt(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=i.redSqrt();if(n.redSqr().redSub(i).cmp(this.zero)!==0)throw new Error("invalid point");var s=n.fromRed().isOdd();return(r&&!s||!r&&s)&&(n=n.redNeg()),this.point(e,n)};Tr.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,i=e.y,n=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(n).redIAdd(this.b);return i.redSqr().redISub(s).cmpn(0)===0};Tr.prototype._endoWnafMulAdd=function(e,r,i){for(var n=this._endoWnafT1,s=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(r[o]),h=e[o],f=h._getBeta();a.k1.negative&&(a.k1.ineg(),h=h.neg(!0)),a.k2.negative&&(a.k2.ineg(),f=f.neg(!0)),n[o*2]=h,n[o*2+1]=f,s[o*2]=a.k1,s[o*2+1]=a.k2}for(var p=this._wnafMulAdd(1,n,s,o*2,i),v=0;v<o*2;v++)n[v]=null,s[v]=null;return p};function Ot(t,e,r,i){ls.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new yt(e,16),this.y=new yt(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Hf(Ot,ls.BasePoint);Tr.prototype.point=function(e,r,i){return new Ot(this,e,r,i)};Tr.prototype.pointFromJSON=function(e,r){return Ot.fromJSON(this,e,r)};Ot.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var i=this.curve,n=function(s){return i.point(s.x.redMul(i.endo.beta),s.y)};e.beta=r,r.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(n)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(n)}}}return r}};Ot.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Ot.fromJSON=function(e,r,i){typeof r=="string"&&(r=JSON.parse(r));var n=e.point(r[0],r[1],i);if(!r[2])return n;function s(a){return e.point(a[0],a[1],i)}var o=r[2];return n.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[n].concat(o.doubles.points.map(s))},naf:o.naf&&{wnd:o.naf.wnd,points:[n].concat(o.naf.points.map(s))}},n};Ot.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Ot.prototype.isInfinity=function(){return this.inf};Ot.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var i=r.redSqr().redISub(this.x).redISub(e.x),n=r.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,n)};Ot.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,i=this.x.redSqr(),n=e.redInvm(),s=i.redAdd(i).redIAdd(i).redIAdd(r).redMul(n),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Ot.prototype.getX=function(){return this.x.fromRed()};Ot.prototype.getY=function(){return this.y.fromRed()};Ot.prototype.mul=function(e){return e=new yt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Ot.prototype.mulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s):this.curve._wnafMulAdd(1,n,s,2)};Ot.prototype.jmulAdd=function(e,r,i){var n=[this,r],s=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(n,s,!0):this.curve._wnafMulAdd(1,n,s,2,!0)};Ot.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Ot.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,n=function(s){return s.neg()};r.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(n)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(n)}}}return r};Ot.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Lt(t,e,r,i){ls.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new yt(0)):(this.x=new yt(e,16),this.y=new yt(r,16),this.z=new yt(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Hf(Lt,ls.BasePoint);Tr.prototype.jpoint=function(e,r,i){return new Lt(this,e,r,i)};Lt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),i=this.x.redMul(r),n=this.y.redMul(r).redMul(e);return this.curve.point(i,n)};Lt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Lt.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),i=this.z.redSqr(),n=this.x.redMul(r),s=e.x.redMul(i),o=this.y.redMul(r.redMul(e.z)),a=e.y.redMul(i.redMul(this.z)),h=n.redSub(s),f=o.redSub(a);if(h.cmpn(0)===0)return f.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=h.redSqr(),v=p.redMul(h),x=n.redMul(p),E=f.redSqr().redIAdd(v).redISub(x).redISub(x),D=f.redMul(x.redISub(E)).redISub(o.redMul(v)),B=this.z.redMul(e.z).redMul(h);return this.curve.jpoint(E,D,B)};Lt.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),i=this.x,n=e.x.redMul(r),s=this.y,o=e.y.redMul(r).redMul(this.z),a=i.redSub(n),h=s.redSub(o);if(a.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),p=f.redMul(a),v=i.redMul(f),x=h.redSqr().redIAdd(p).redISub(v).redISub(v),E=h.redMul(v.redISub(x)).redISub(s.redMul(p)),D=this.z.redMul(a);return this.curve.jpoint(x,E,D)};Lt.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var i=this;for(r=0;r<e;r++)i=i.dbl();return i}var n=this.curve.a,s=this.curve.tinv,o=this.x,a=this.y,h=this.z,f=h.redSqr().redSqr(),p=a.redAdd(a);for(r=0;r<e;r++){var v=o.redSqr(),x=p.redSqr(),E=x.redSqr(),D=v.redAdd(v).redIAdd(v).redIAdd(n.redMul(f)),B=o.redMul(x),F=D.redSqr().redISub(B.redAdd(B)),j=B.redISub(F),R=D.redMul(j);R=R.redIAdd(R).redISub(E);var K=p.redMul(h);r+1<e&&(f=f.redMul(E)),o=F,h=K,p=R}return this.curve.jpoint(o,p.redMul(s),h)};Lt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Lt.prototype._zeroDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),a=this.x.redAdd(s).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var h=n.redAdd(n).redIAdd(n),f=h.redSqr().redISub(a).redISub(a),p=o.redIAdd(o);p=p.redIAdd(p),p=p.redIAdd(p),e=f,r=h.redMul(a.redISub(f)).redISub(p),i=this.y.redAdd(this.y)}else{var v=this.x.redSqr(),x=this.y.redSqr(),E=x.redSqr(),D=this.x.redAdd(x).redSqr().redISub(v).redISub(E);D=D.redIAdd(D);var B=v.redAdd(v).redIAdd(v),F=B.redSqr(),j=E.redIAdd(E);j=j.redIAdd(j),j=j.redIAdd(j),e=F.redISub(D).redISub(D),r=B.redMul(D.redISub(e)).redISub(j),i=this.y.redMul(this.z),i=i.redIAdd(i)}return this.curve.jpoint(e,r,i)};Lt.prototype._threeDbl=function(){var e,r,i;if(this.zOne){var n=this.x.redSqr(),s=this.y.redSqr(),o=s.redSqr(),a=this.x.redAdd(s).redSqr().redISub(n).redISub(o);a=a.redIAdd(a);var h=n.redAdd(n).redIAdd(n).redIAdd(this.curve.a),f=h.redSqr().redISub(a).redISub(a);e=f;var p=o.redIAdd(o);p=p.redIAdd(p),p=p.redIAdd(p),r=h.redMul(a.redISub(f)).redISub(p),i=this.y.redAdd(this.y)}else{var v=this.z.redSqr(),x=this.y.redSqr(),E=this.x.redMul(x),D=this.x.redSub(v).redMul(this.x.redAdd(v));D=D.redAdd(D).redIAdd(D);var B=E.redIAdd(E);B=B.redIAdd(B);var F=B.redAdd(B);e=D.redSqr().redISub(F),i=this.y.redAdd(this.z).redSqr().redISub(x).redISub(v);var j=x.redSqr();j=j.redIAdd(j),j=j.redIAdd(j),j=j.redIAdd(j),r=D.redMul(B.redISub(e)).redISub(j)}return this.curve.jpoint(e,r,i)};Lt.prototype._dbl=function(){var e=this.curve.a,r=this.x,i=this.y,n=this.z,s=n.redSqr().redSqr(),o=r.redSqr(),a=i.redSqr(),h=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(s)),f=r.redAdd(r);f=f.redIAdd(f);var p=f.redMul(a),v=h.redSqr().redISub(p.redAdd(p)),x=p.redISub(v),E=a.redSqr();E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var D=h.redMul(x).redISub(E),B=i.redAdd(i).redMul(n);return this.curve.jpoint(v,D,B)};Lt.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr(),n=r.redSqr(),s=e.redAdd(e).redIAdd(e),o=s.redSqr(),a=this.x.redAdd(r).redSqr().redISub(e).redISub(n);a=a.redIAdd(a),a=a.redAdd(a).redIAdd(a),a=a.redISub(o);var h=a.redSqr(),f=n.redIAdd(n);f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var p=s.redIAdd(a).redSqr().redISub(o).redISub(h).redISub(f),v=r.redMul(p);v=v.redIAdd(v),v=v.redIAdd(v);var x=this.x.redMul(h).redISub(v);x=x.redIAdd(x),x=x.redIAdd(x);var E=this.y.redMul(p.redMul(f.redISub(p)).redISub(a.redMul(h)));E=E.redIAdd(E),E=E.redIAdd(E),E=E.redIAdd(E);var D=this.z.redAdd(a).redSqr().redISub(i).redISub(h);return this.curve.jpoint(x,E,D)};Lt.prototype.mul=function(e,r){return e=new yt(e,r),this.curve._wnafMul(this,e)};Lt.prototype.eq=function(e){if(e.type==="affine")return this.eq(e.toJ());if(this===e)return!0;var r=this.z.redSqr(),i=e.z.redSqr();if(this.x.redMul(i).redISub(e.x.redMul(r)).cmpn(0)!==0)return!1;var n=r.redMul(this.z),s=i.redMul(e.z);return this.y.redMul(s).redISub(e.y.redMul(n)).cmpn(0)===0};Lt.prototype.eqXToP=function(e){var r=this.z.redSqr(),i=e.toRed(this.curve.red).redMul(r);if(this.x.cmp(i)===0)return!0;for(var n=e.clone(),s=this.curve.redN.redMul(r);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(i.redIAdd(s),this.x.cmp(i)===0)return!0}};Lt.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Lt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Wn=zi,k0=Ia,Ca=Da,N2=br;function ds(t){Ca.call(this,"mont",t),this.a=new Wn(t.a,16).toRed(this.red),this.b=new Wn(t.b,16).toRed(this.red),this.i4=new Wn(4).toRed(this.red).redInvm(),this.two=new Wn(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}k0(ds,Ca);var T2=ds;ds.prototype.validate=function(e){var r=e.normalize().x,i=r.redSqr(),n=i.redMul(r).redAdd(i.redMul(this.a)).redAdd(r),s=n.redSqrt();return s.redSqr().cmp(n)===0};function Rt(t,e,r){Ca.BasePoint.call(this,t,"projective"),e===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Wn(e,16),this.z=new Wn(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}k0(Rt,Ca.BasePoint);ds.prototype.decodePoint=function(e,r){return this.point(N2.toArray(e,r),1)};ds.prototype.point=function(e,r){return new Rt(this,e,r)};ds.prototype.pointFromJSON=function(e){return Rt.fromJSON(this,e)};Rt.prototype.precompute=function(){};Rt.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};Rt.fromJSON=function(e,r){return new Rt(e,r[0],r[1]||e.one)};Rt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};Rt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};Rt.prototype.dbl=function(){var e=this.x.redAdd(this.z),r=e.redSqr(),i=this.x.redSub(this.z),n=i.redSqr(),s=r.redSub(n),o=r.redMul(n),a=s.redMul(n.redAdd(this.curve.a24.redMul(s)));return this.curve.point(o,a)};Rt.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};Rt.prototype.diffAdd=function(e,r){var i=this.x.redAdd(this.z),n=this.x.redSub(this.z),s=e.x.redAdd(e.z),o=e.x.redSub(e.z),a=o.redMul(i),h=s.redMul(n),f=r.z.redMul(a.redAdd(h).redSqr()),p=r.x.redMul(a.redISub(h).redSqr());return this.curve.point(f,p)};Rt.prototype.mul=function(e){for(var r=e.clone(),i=this,n=this.curve.point(null,null),s=this,o=[];r.cmpn(0)!==0;r.iushrn(1))o.push(r.andln(1));for(var a=o.length-1;a>=0;a--)o[a]===0?(i=i.diffAdd(n,s),n=n.dbl()):(n=i.diffAdd(n,s),i=i.dbl());return n};Rt.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};Rt.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};Rt.prototype.eq=function(e){return this.getX().cmp(e.getX())===0};Rt.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};Rt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var R2=br,Fi=zi,$0=Ia,Na=Da,O2=R2.assert;function di(t){this.twisted=(t.a|0)!==1,this.mOneA=this.twisted&&(t.a|0)===-1,this.extended=this.mOneA,Na.call(this,"edwards",t),this.a=new Fi(t.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Fi(t.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Fi(t.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),O2(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(t.c|0)===1}$0(di,Na);var P2=di;di.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)};di.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)};di.prototype.jpoint=function(e,r,i,n){return this.point(e,r,i,n)};di.prototype.pointFromX=function(e,r){e=new Fi(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=this.c2.redSub(this.a.redMul(i)),s=this.one.redSub(this.c2.redMul(this.d).redMul(i)),o=n.redMul(s.redInvm()),a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");var h=a.fromRed().isOdd();return(r&&!h||!r&&h)&&(a=a.redNeg()),this.point(e,a)};di.prototype.pointFromY=function(e,r){e=new Fi(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr(),n=i.redSub(this.c2),s=i.redMul(this.d).redMul(this.c2).redSub(this.a),o=n.redMul(s.redInvm());if(o.cmp(this.zero)===0){if(r)throw new Error("invalid point");return this.point(this.zero,e)}var a=o.redSqrt();if(a.redSqr().redSub(o).cmp(this.zero)!==0)throw new Error("invalid point");return a.fromRed().isOdd()!==r&&(a=a.redNeg()),this.point(a,e)};di.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var r=e.x.redSqr(),i=e.y.redSqr(),n=r.redMul(this.a).redAdd(i),s=this.c2.redMul(this.one.redAdd(this.d.redMul(r).redMul(i)));return n.cmp(s)===0};function lt(t,e,r,i,n){Na.BasePoint.call(this,t,"projective"),e===null&&r===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new Fi(e,16),this.y=new Fi(r,16),this.z=i?new Fi(i,16):this.curve.one,this.t=n&&new Fi(n,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}$0(lt,Na.BasePoint);di.prototype.pointFromJSON=function(e){return lt.fromJSON(this,e)};di.prototype.point=function(e,r,i,n){return new lt(this,e,r,i,n)};lt.fromJSON=function(e,r){return new lt(e,r[0],r[1],r[2])};lt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};lt.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};lt.prototype._extDbl=function(){var e=this.x.redSqr(),r=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var n=this.curve._mulA(e),s=this.x.redAdd(this.y).redSqr().redISub(e).redISub(r),o=n.redAdd(r),a=o.redSub(i),h=n.redSub(r),f=s.redMul(a),p=o.redMul(h),v=s.redMul(h),x=a.redMul(o);return this.curve.point(f,p,x,v)};lt.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),r=this.x.redSqr(),i=this.y.redSqr(),n,s,o,a,h,f;if(this.curve.twisted){a=this.curve._mulA(r);var p=a.redAdd(i);this.zOne?(n=e.redSub(r).redSub(i).redMul(p.redSub(this.curve.two)),s=p.redMul(a.redSub(i)),o=p.redSqr().redSub(p).redSub(p)):(h=this.z.redSqr(),f=p.redSub(h).redISub(h),n=e.redSub(r).redISub(i).redMul(f),s=p.redMul(a.redSub(i)),o=p.redMul(f))}else a=r.redAdd(i),h=this.curve._mulC(this.z).redSqr(),f=a.redSub(h).redSub(h),n=this.curve._mulC(e.redISub(a)).redMul(f),s=this.curve._mulC(a).redMul(r.redISub(i)),o=a.redMul(f);return this.curve.point(n,s,o)};lt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};lt.prototype._extAdd=function(e){var r=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),n=this.t.redMul(this.curve.dd).redMul(e.t),s=this.z.redMul(e.z.redAdd(e.z)),o=i.redSub(r),a=s.redSub(n),h=s.redAdd(n),f=i.redAdd(r),p=o.redMul(a),v=h.redMul(f),x=o.redMul(f),E=a.redMul(h);return this.curve.point(p,v,E,x)};lt.prototype._projAdd=function(e){var r=this.z.redMul(e.z),i=r.redSqr(),n=this.x.redMul(e.x),s=this.y.redMul(e.y),o=this.curve.d.redMul(n).redMul(s),a=i.redSub(o),h=i.redAdd(o),f=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(n).redISub(s),p=r.redMul(a).redMul(f),v,x;return this.curve.twisted?(v=r.redMul(h).redMul(s.redSub(this.curve._mulA(n))),x=a.redMul(h)):(v=r.redMul(h).redMul(s.redSub(n)),x=this.curve._mulC(a).redMul(h)),this.curve.point(p,v,x)};lt.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)};lt.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)};lt.prototype.mulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!1)};lt.prototype.jmulAdd=function(e,r,i){return this.curve._wnafMulAdd(1,[this,r],[e,i],2,!0)};lt.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this};lt.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};lt.prototype.getX=function(){return this.normalize(),this.x.fromRed()};lt.prototype.getY=function(){return this.normalize(),this.y.fromRed()};lt.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0};lt.prototype.eqXToP=function(e){var r=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(r)===0)return!0;for(var i=e.clone(),n=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),this.x.cmp(r)===0)return!0}};lt.prototype.toP=lt.prototype.normalize;lt.prototype.mixedAdd=lt.prototype.add;(function(t){var e=t;e.base=Da,e.short=C2,e.mont=T2,e.edwards=P2})(jf);var Ta={},Ra={},tt={},B2=Nn,F2=Ia;tt.inherits=F2;function L2(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function U2(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):L2(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}tt.toArray=U2;function k2(t){for(var e="",r=0;r<t.length;r++)e+=z0(t[r].toString(16));return e}tt.toHex=k2;function q0(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}tt.htonl=q0;function $2(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=q0(n)),r+=K0(n.toString(16))}return r}tt.toHex32=$2;function z0(t){return t.length===1?"0"+t:t}tt.zero2=z0;function K0(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}tt.zero8=K0;function q2(t,e,r,i){var n=r-e;B2(n%4===0);for(var s=new Array(n/4),o=0,a=e;o<s.length;o++,a+=4){var h;i==="big"?h=t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:h=t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],s[o]=h>>>0}return s}tt.join32=q2;function z2(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}tt.split32=z2;function K2(t,e){return t>>>e|t<<32-e}tt.rotr32=K2;function j2(t,e){return t<<e|t>>>32-e}tt.rotl32=j2;function H2(t,e){return t+e>>>0}tt.sum32=H2;function V2(t,e,r){return t+e+r>>>0}tt.sum32_3=V2;function W2(t,e,r,i){return t+e+r+i>>>0}tt.sum32_4=W2;function G2(t,e,r,i,n){return t+e+r+i+n>>>0}tt.sum32_5=G2;function Y2(t,e,r,i){var n=t[e],s=t[e+1],o=i+s>>>0,a=(o<i?1:0)+r+n;t[e]=a>>>0,t[e+1]=o}tt.sum64=Y2;function J2(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}tt.sum64_hi=J2;function Q2(t,e,r,i){var n=e+i;return n>>>0}tt.sum64_lo=Q2;function X2(t,e,r,i,n,s,o,a){var h=0,f=e;f=f+i>>>0,h+=f<e?1:0,f=f+s>>>0,h+=f<s?1:0,f=f+a>>>0,h+=f<a?1:0;var p=t+r+n+o+h;return p>>>0}tt.sum64_4_hi=X2;function Z2(t,e,r,i,n,s,o,a){var h=e+i+s+a;return h>>>0}tt.sum64_4_lo=Z2;function eb(t,e,r,i,n,s,o,a,h,f){var p=0,v=e;v=v+i>>>0,p+=v<e?1:0,v=v+s>>>0,p+=v<s?1:0,v=v+a>>>0,p+=v<a?1:0,v=v+f>>>0,p+=v<f?1:0;var x=t+r+n+o+h+p;return x>>>0}tt.sum64_5_hi=eb;function tb(t,e,r,i,n,s,o,a,h,f){var p=e+i+s+a+f;return p>>>0}tt.sum64_5_lo=tb;function rb(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}tt.rotr64_hi=rb;function ib(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}tt.rotr64_lo=ib;function nb(t,e,r){return t>>>r}tt.shr64_hi=nb;function sb(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}tt.shr64_lo=sb;var ps={},Yh=tt,ob=Nn;function Oa(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}ps.BlockHash=Oa;Oa.prototype.update=function(e,r){if(e=Yh.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),this.pending.length===0&&(this.pending=null),e=Yh.join32(e,0,e.length-i,this.endian);for(var n=0;n<e.length;n+=this._delta32)this._update(e,n,n+this._delta32)}return this};Oa.prototype.digest=function(e){return this.update(this._pad()),ob(this.pending===null),this._digest(e)};Oa.prototype._pad=function(){var e=this.pendingTotal,r=this._delta8,i=r-(e+this.padLength)%r,n=new Array(i+this.padLength);n[0]=128;for(var s=1;s<i;s++)n[s]=0;if(e<<=3,this.endian==="big"){for(var o=8;o<this.padLength;o++)n[s++]=0;n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=e>>>24&255,n[s++]=e>>>16&255,n[s++]=e>>>8&255,n[s++]=e&255}else for(n[s++]=e&255,n[s++]=e>>>8&255,n[s++]=e>>>16&255,n[s++]=e>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,o=8;o<this.padLength;o++)n[s++]=0;return n};var gs={},pi={},ab=tt,ei=ab.rotr32;function cb(t,e,r,i){if(t===0)return j0(e,r,i);if(t===1||t===3)return V0(e,r,i);if(t===2)return H0(e,r,i)}pi.ft_1=cb;function j0(t,e,r){return t&e^~t&r}pi.ch32=j0;function H0(t,e,r){return t&e^t&r^e&r}pi.maj32=H0;function V0(t,e,r){return t^e^r}pi.p32=V0;function fb(t){return ei(t,2)^ei(t,13)^ei(t,22)}pi.s0_256=fb;function hb(t){return ei(t,6)^ei(t,11)^ei(t,25)}pi.s1_256=hb;function ub(t){return ei(t,7)^ei(t,18)^t>>>3}pi.g0_256=ub;function lb(t){return ei(t,17)^ei(t,19)^t>>>10}pi.g1_256=lb;var Xn=tt,db=ps,pb=pi,fc=Xn.rotl32,Rs=Xn.sum32,gb=Xn.sum32_5,bb=pb.ft_1,W0=db.BlockHash,vb=[1518500249,1859775393,2400959708,3395469782];function ci(){if(!(this instanceof ci))return new ci;W0.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Xn.inherits(ci,W0);var mb=ci;ci.blockSize=512;ci.outSize=160;ci.hmacStrength=80;ci.padLength=64;ci.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=fc(i[n-3]^i[n-8]^i[n-14]^i[n-16],1);var s=this.h[0],o=this.h[1],a=this.h[2],h=this.h[3],f=this.h[4];for(n=0;n<i.length;n++){var p=~~(n/20),v=gb(fc(s,5),bb(p,o,a,h),f,i[n],vb[p]);f=h,h=a,a=fc(o,30),o=s,s=v}this.h[0]=Rs(this.h[0],s),this.h[1]=Rs(this.h[1],o),this.h[2]=Rs(this.h[2],a),this.h[3]=Rs(this.h[3],h),this.h[4]=Rs(this.h[4],f)};ci.prototype._digest=function(e){return e==="hex"?Xn.toHex32(this.h,"big"):Xn.split32(this.h,"big")};var Zn=tt,yb=ps,bs=pi,wb=Nn,Or=Zn.sum32,_b=Zn.sum32_4,Eb=Zn.sum32_5,Ab=bs.ch32,xb=bs.maj32,Sb=bs.s0_256,Mb=bs.s1_256,Ib=bs.g0_256,Db=bs.g1_256,G0=yb.BlockHash,Cb=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function fi(){if(!(this instanceof fi))return new fi;G0.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Cb,this.W=new Array(64)}Zn.inherits(fi,G0);var Y0=fi;fi.blockSize=512;fi.outSize=256;fi.hmacStrength=192;fi.padLength=64;fi.prototype._update=function(e,r){for(var i=this.W,n=0;n<16;n++)i[n]=e[r+n];for(;n<i.length;n++)i[n]=_b(Db(i[n-2]),i[n-7],Ib(i[n-15]),i[n-16]);var s=this.h[0],o=this.h[1],a=this.h[2],h=this.h[3],f=this.h[4],p=this.h[5],v=this.h[6],x=this.h[7];for(wb(this.k.length===i.length),n=0;n<i.length;n++){var E=Eb(x,Mb(f),Ab(f,p,v),this.k[n],i[n]),D=Or(Sb(s),xb(s,o,a));x=v,v=p,p=f,f=Or(h,E),h=a,a=o,o=s,s=Or(E,D)}this.h[0]=Or(this.h[0],s),this.h[1]=Or(this.h[1],o),this.h[2]=Or(this.h[2],a),this.h[3]=Or(this.h[3],h),this.h[4]=Or(this.h[4],f),this.h[5]=Or(this.h[5],p),this.h[6]=Or(this.h[6],v),this.h[7]=Or(this.h[7],x)};fi.prototype._digest=function(e){return e==="hex"?Zn.toHex32(this.h,"big"):Zn.split32(this.h,"big")};var Zc=tt,J0=Y0;function $i(){if(!(this instanceof $i))return new $i;J0.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Zc.inherits($i,J0);var Nb=$i;$i.blockSize=512;$i.outSize=224;$i.hmacStrength=192;$i.padLength=64;$i.prototype._digest=function(e){return e==="hex"?Zc.toHex32(this.h.slice(0,7),"big"):Zc.split32(this.h.slice(0,7),"big")};var cr=tt,Tb=ps,Rb=Nn,ti=cr.rotr64_hi,ri=cr.rotr64_lo,Q0=cr.shr64_hi,X0=cr.shr64_lo,Vi=cr.sum64,hc=cr.sum64_hi,uc=cr.sum64_lo,Ob=cr.sum64_4_hi,Pb=cr.sum64_4_lo,Bb=cr.sum64_5_hi,Fb=cr.sum64_5_lo,Z0=Tb.BlockHash,Lb=[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 jr(){if(!(this instanceof jr))return new jr;Z0.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Lb,this.W=new Array(160)}cr.inherits(jr,Z0);var ed=jr;jr.blockSize=1024;jr.outSize=512;jr.hmacStrength=192;jr.padLength=128;jr.prototype._prepareBlock=function(e,r){for(var i=this.W,n=0;n<32;n++)i[n]=e[r+n];for(;n<i.length;n+=2){var s=Gb(i[n-4],i[n-3]),o=Yb(i[n-4],i[n-3]),a=i[n-14],h=i[n-13],f=Vb(i[n-30],i[n-29]),p=Wb(i[n-30],i[n-29]),v=i[n-32],x=i[n-31];i[n]=Ob(s,o,a,h,f,p,v,x),i[n+1]=Pb(s,o,a,h,f,p,v,x)}};jr.prototype._update=function(e,r){this._prepareBlock(e,r);var i=this.W,n=this.h[0],s=this.h[1],o=this.h[2],a=this.h[3],h=this.h[4],f=this.h[5],p=this.h[6],v=this.h[7],x=this.h[8],E=this.h[9],D=this.h[10],B=this.h[11],F=this.h[12],j=this.h[13],R=this.h[14],K=this.h[15];Rb(this.k.length===i.length);for(var T=0;T<i.length;T+=2){var L=R,q=K,y=jb(x,E),P=Hb(x,E),Z=Ub(x,E,D,B,F),ne=kb(x,E,D,B,F,j),U=this.k[T],b=this.k[T+1],c=i[T],u=i[T+1],g=Bb(L,q,y,P,Z,ne,U,b,c,u),w=Fb(L,q,y,P,Z,ne,U,b,c,u);L=zb(n,s),q=Kb(n,s),y=$b(n,s,o,a,h),P=qb(n,s,o,a,h,f);var S=hc(L,q,y,P),C=uc(L,q,y,P);R=F,K=j,F=D,j=B,D=x,B=E,x=hc(p,v,g,w),E=uc(v,v,g,w),p=h,v=f,h=o,f=a,o=n,a=s,n=hc(g,w,S,C),s=uc(g,w,S,C)}Vi(this.h,0,n,s),Vi(this.h,2,o,a),Vi(this.h,4,h,f),Vi(this.h,6,p,v),Vi(this.h,8,x,E),Vi(this.h,10,D,B),Vi(this.h,12,F,j),Vi(this.h,14,R,K)};jr.prototype._digest=function(e){return e==="hex"?cr.toHex32(this.h,"big"):cr.split32(this.h,"big")};function Ub(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function kb(t,e,r,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function $b(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function qb(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function zb(t,e){var r=ti(t,e,28),i=ti(e,t,2),n=ti(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function Kb(t,e){var r=ri(t,e,28),i=ri(e,t,2),n=ri(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function jb(t,e){var r=ti(t,e,14),i=ti(t,e,18),n=ti(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function Hb(t,e){var r=ri(t,e,14),i=ri(t,e,18),n=ri(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function Vb(t,e){var r=ti(t,e,1),i=ti(t,e,8),n=Q0(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function Wb(t,e){var r=ri(t,e,1),i=ri(t,e,8),n=X0(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function Gb(t,e){var r=ti(t,e,19),i=ti(e,t,29),n=Q0(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function Yb(t,e){var r=ri(t,e,19),i=ri(e,t,29),n=X0(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}var ef=tt,td=ed;function qi(){if(!(this instanceof qi))return new qi;td.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}ef.inherits(qi,td);var Jb=qi;qi.blockSize=1024;qi.outSize=384;qi.hmacStrength=192;qi.padLength=128;qi.prototype._digest=function(e){return e==="hex"?ef.toHex32(this.h.slice(0,12),"big"):ef.split32(this.h.slice(0,12),"big")};gs.sha1=mb;gs.sha224=Nb;gs.sha256=Y0;gs.sha384=Jb;gs.sha512=ed;var rd={},Mn=tt,Qb=ps,Bo=Mn.rotl32,Jh=Mn.sum32,Os=Mn.sum32_3,Qh=Mn.sum32_4,id=Qb.BlockHash;function hi(){if(!(this instanceof hi))return new hi;id.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Mn.inherits(hi,id);rd.ripemd160=hi;hi.blockSize=512;hi.outSize=160;hi.hmacStrength=192;hi.padLength=64;hi.prototype._update=function(e,r){for(var i=this.h[0],n=this.h[1],s=this.h[2],o=this.h[3],a=this.h[4],h=i,f=n,p=s,v=o,x=a,E=0;E<80;E++){var D=Jh(Bo(Qh(i,Xh(E,n,s,o),e[ev[E]+r],Xb(E)),rv[E]),a);i=a,a=o,o=Bo(s,10),s=n,n=D,D=Jh(Bo(Qh(h,Xh(79-E,f,p,v),e[tv[E]+r],Zb(E)),iv[E]),x),h=x,x=v,v=Bo(p,10),p=f,f=D}D=Os(this.h[1],s,v),this.h[1]=Os(this.h[2],o,x),this.h[2]=Os(this.h[3],a,h),this.h[3]=Os(this.h[4],i,f),this.h[4]=Os(this.h[0],n,p),this.h[0]=D};hi.prototype._digest=function(e){return e==="hex"?Mn.toHex32(this.h,"little"):Mn.split32(this.h,"little")};function Xh(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function Xb(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function Zb(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var ev=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],tv=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],rv=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],iv=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],nv=tt,sv=Nn;function es(t,e,r){if(!(this instanceof es))return new es(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(nv.toArray(e,r))}var ov=es;es.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),sv(e.length<=this.blockSize);for(var r=e.length;r<this.blockSize;r++)e.push(0);for(r=0;r<e.length;r++)e[r]^=54;for(this.inner=new this.Hash().update(e),r=0;r<e.length;r++)e[r]^=106;this.outer=new this.Hash().update(e)};es.prototype.update=function(e,r){return this.inner.update(e,r),this};es.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)};(function(t){var e=t;e.utils=tt,e.common=ps,e.sha=gs,e.ripemd=rd,e.hmac=ov,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160})(Ra);var lc,Zh;function av(){return Zh||(Zh=1,lc={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),lc}(function(t){var e=t,r=Ra,i=jf,n=br,s=n.assert;function o(f){f.type==="short"?this.curve=new i.short(f):f.type==="edwards"?this.curve=new i.edwards(f):this.curve=new i.mont(f),this.g=this.curve.g,this.n=this.curve.n,this.hash=f.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}e.PresetCurve=o;function a(f,p){Object.defineProperty(e,f,{configurable:!0,enumerable:!0,get:function(){var v=new o(p);return Object.defineProperty(e,f,{configurable:!0,enumerable:!0,value:v}),v}})}a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:r.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:r.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:r.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:r.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:r.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:r.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=av()}catch{h=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:r.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})})(Ta);var cv=Ra,xn=zf,nd=Nn;function nn(t){if(!(this instanceof nn))return new nn(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=xn.toArray(t.entropy,t.entropyEnc||"hex"),r=xn.toArray(t.nonce,t.nonceEnc||"hex"),i=xn.toArray(t.pers,t.persEnc||"hex");nd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var fv=nn;nn.prototype._init=function(e,r,i){var n=e.concat(r).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(n),this._reseed=1,this.reseedInterval=281474976710656};nn.prototype._hmac=function(){return new cv.hmac(this.hash,this.K)};nn.prototype._update=function(e){var r=this._hmac().update(this.V).update([0]);e&&(r=r.update(e)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())};nn.prototype.reseed=function(e,r,i,n){typeof r!="string"&&(n=i,i=r,r=null),e=xn.toArray(e,r),i=xn.toArray(i,n),nd(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this._reseed=1};nn.prototype.generate=function(e,r,i,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(n=i,i=r,r=null),i&&(i=xn.toArray(i,n||"hex"),this._update(i));for(var s=[];s.length<e;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var o=s.slice(0,e);return this._update(i),this._reseed++,xn.encode(o,r)};var hv=zi,uv=br,tf=uv.assert;function jt(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var lv=jt;jt.fromPublic=function(e,r,i){return r instanceof jt?r:new jt(e,{pub:r,pubEnc:i})};jt.fromPrivate=function(e,r,i){return r instanceof jt?r:new jt(e,{priv:r,privEnc:i})};jt.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};jt.prototype.getPublic=function(e,r){return typeof e=="string"&&(r=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,e):this.pub};jt.prototype.getPrivate=function(e){return e==="hex"?this.priv.toString(16,2):this.priv};jt.prototype._importPrivate=function(e,r){this.priv=new hv(e,r||16),this.priv=this.priv.umod(this.ec.curve.n)};jt.prototype._importPublic=function(e,r){if(e.x||e.y){this.ec.curve.type==="mont"?tf(e.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&tf(e.x&&e.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,r)};jt.prototype.derive=function(e){return e.validate()||tf(e.validate(),"public point not validated"),e.mul(this.priv).getX()};jt.prototype.sign=function(e,r,i){return this.ec.sign(e,this,r,i)};jt.prototype.verify=function(e,r,i){return this.ec.verify(e,r,this,void 0,i)};jt.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var sa=zi,Vf=br,dv=Vf.assert;function Pa(t,e){if(t instanceof Pa)return t;this._importDER(t,e)||(dv(t.r&&t.s,"Signature without r or s"),this.r=new sa(t.r,16),this.s=new sa(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var pv=Pa;function gv(){this.place=0}function dc(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4||t[e.place]===0)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function eu(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}Pa.prototype._importDER=function(e,r){e=Vf.toArray(e,r);var i=new gv;if(e[i.place++]!==48)return!1;var n=dc(e,i);if(n===!1||n+i.place!==e.length||e[i.place++]!==2)return!1;var s=dc(e,i);if(s===!1||e[i.place]&128)return!1;var o=e.slice(i.place,s+i.place);if(i.place+=s,e[i.place++]!==2)return!1;var a=dc(e,i);if(a===!1||e.length!==a+i.place||e[i.place]&128)return!1;var h=e.slice(i.place,a+i.place);if(o[0]===0)if(o[1]&128)o=o.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new sa(o),this.s=new sa(h),this.recoveryParam=null,!0};function pc(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}Pa.prototype.toDER=function(e){var r=this.r.toArray(),i=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),i[0]&128&&(i=[0].concat(i)),r=eu(r),i=eu(i);!i[0]&&!(i[1]&128);)i=i.slice(1);var n=[2];pc(n,r.length),n=n.concat(r),n.push(2),pc(n,i.length);var s=n.concat(i),o=[48];return pc(o,s.length),o=o.concat(s),Vf.encode(o,e)};var qr=zi,sd=fv,bv=br,gc=Ta,vv=U0,mn=bv.assert,Wf=lv,Ba=pv;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(mn(Object.prototype.hasOwnProperty.call(gc,t),"Unknown curve "+t),t=gc[t]),t instanceof gc.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var mv=Cr;Cr.prototype.keyPair=function(e){return new Wf(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Wf.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Wf.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new sd({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||vv(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),i=this.n.byteLength(),n=this.n.sub(new qr(2));;){var s=new qr(r.generate(i));if(!(s.cmp(n)>0))return s.iaddn(1),this.keyFromPrivate(s)}};Cr.prototype._truncateToN=function(e,r,i){var n;if(qr.isBN(e)||typeof e=="number")e=new qr(e,16),n=e.byteLength();else if(typeof e=="object")n=e.length,e=new qr(e,16);else{var s=e.toString();n=s.length+1>>>1,e=new qr(s,16)}typeof i!="number"&&(i=n*8);var o=i-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,i,n){if(typeof i=="object"&&(n=i,i=null),n||(n={}),typeof e!="string"&&typeof e!="number"&&!qr.isBN(e)){mn(typeof e=="object"&&e&&typeof e.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),mn(e.length>>>0===e.length);for(var s=0;s<e.length;s++)mn((e[s]&255)===e[s])}r=this.keyFromPrivate(r,i),e=this._truncateToN(e,!1,n.msgBitLength),mn(!e.isNeg(),"Can not sign a negative message");var o=this.n.byteLength(),a=r.getPrivate().toArray("be",o),h=e.toArray("be",o);mn(new qr(h).eq(e),"Can not sign message");for(var f=new sd({hash:this.hash,entropy:a,nonce:h,pers:n.pers,persEnc:n.persEnc||"utf8"}),p=this.n.sub(new qr(1)),v=0;;v++){var x=n.k?n.k(v):new qr(f.generate(this.n.byteLength()));if(x=this._truncateToN(x,!0),!(x.cmpn(1)<=0||x.cmp(p)>=0)){var E=this.g.mul(x);if(!E.isInfinity()){var D=E.getX(),B=D.umod(this.n);if(B.cmpn(0)!==0){var F=x.invm(this.n).mul(B.mul(r.getPrivate()).iadd(e));if(F=F.umod(this.n),F.cmpn(0)!==0){var j=(E.getY().isOdd()?1:0)|(D.cmp(B)!==0?2:0);return n.canonical&&F.cmp(this.nh)>0&&(F=this.n.sub(F),j^=1),new Ba({r:B,s:F,recoveryParam:j})}}}}}};Cr.prototype.verify=function(e,r,i,n,s){s||(s={}),e=this._truncateToN(e,!1,s.msgBitLength),i=this.keyFromPublic(i,n),r=new Ba(r,"hex");var o=r.r,a=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var h=a.invm(this.n),f=h.mul(e).umod(this.n),p=h.mul(o).umod(this.n),v;return this.curve._maxwellTrick?(v=this.g.jmulAdd(f,i.getPublic(),p),v.isInfinity()?!1:v.eqXToP(o)):(v=this.g.mulAdd(f,i.getPublic(),p),v.isInfinity()?!1:v.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,i){mn((3&r)===r,"The recovery param is more than two bits"),e=new Ba(e,i);var n=this.n,s=new qr(t),o=e.r,a=e.s,h=r&1,f=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");f?o=this.curve.pointFromX(o.add(this.curve.n),h):o=this.curve.pointFromX(o,h);var p=e.r.invm(n),v=n.sub(s).mul(p).umod(n),x=a.mul(p).umod(n);return this.g.mulAdd(v,o,x)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new Ba(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var po=br,od=po.assert,tu=po.parseBytes,vs=po.cachedProperty;function Nt(t,e){this.eddsa=t,this._secret=tu(e.secret),t.isPoint(e.pub)?this._pub=e.pub:this._pubBytes=tu(e.pub)}Nt.fromPublic=function(e,r){return r instanceof Nt?r:new Nt(e,{pub:r})};Nt.fromSecret=function(e,r){return r instanceof Nt?r:new Nt(e,{secret:r})};Nt.prototype.secret=function(){return this._secret};vs(Nt,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});vs(Nt,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});vs(Nt,"privBytes",function(){var e=this.eddsa,r=this.hash(),i=e.encodingLength-1,n=r.slice(0,e.encodingLength);return n[0]&=248,n[i]&=127,n[i]|=64,n});vs(Nt,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});vs(Nt,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});vs(Nt,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Nt.prototype.sign=function(e){return od(this._secret,"KeyPair can only verify"),this.eddsa.sign(e,this)};Nt.prototype.verify=function(e,r){return this.eddsa.verify(e,r,this)};Nt.prototype.getSecret=function(e){return od(this._secret,"KeyPair is public only"),po.encode(this.secret(),e)};Nt.prototype.getPublic=function(e){return po.encode(this.pubBytes(),e)};var yv=Nt,wv=zi,Fa=br,ru=Fa.assert,La=Fa.cachedProperty,_v=Fa.parseBytes;function Tn(t,e){this.eddsa=t,typeof e!="object"&&(e=_v(e)),Array.isArray(e)&&(ru(e.length===t.encodingLength*2,"Signature has invalid size"),e={R:e.slice(0,t.encodingLength),S:e.slice(t.encodingLength)}),ru(e.R&&e.S,"Signature without R or S"),t.isPoint(e.R)&&(this._R=e.R),e.S instanceof wv&&(this._S=e.S),this._Rencoded=Array.isArray(e.R)?e.R:e.Rencoded,this._Sencoded=Array.isArray(e.S)?e.S:e.Sencoded}La(Tn,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});La(Tn,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});La(Tn,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});La(Tn,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Tn.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Tn.prototype.toHex=function(){return Fa.encode(this.toBytes(),"hex").toUpperCase()};var Ev=Tn,Av=Ra,xv=Ta,ts=br,Sv=ts.assert,ad=ts.parseBytes,cd=yv,iu=Ev;function fr(t){if(Sv(t==="ed25519","only tested with ed25519 so far"),!(this instanceof fr))return new fr(t);t=xv[t].curve,this.curve=t,this.g=t.g,this.g.precompute(t.n.bitLength()+1),this.pointClass=t.point().constructor,this.encodingLength=Math.ceil(t.n.bitLength()/8),this.hash=Av.sha512}var Mv=fr;fr.prototype.sign=function(e,r){e=ad(e);var i=this.keyFromSecret(r),n=this.hashInt(i.messagePrefix(),e),s=this.g.mul(n),o=this.encodePoint(s),a=this.hashInt(o,i.pubBytes(),e).mul(i.priv()),h=n.add(a).umod(this.curve.n);return this.makeSignature({R:s,S:h,Rencoded:o})};fr.prototype.verify=function(e,r,i){if(e=ad(e),r=this.makeSignature(r),r.S().gte(r.eddsa.curve.n)||r.S().isNeg())return!1;var n=this.keyFromPublic(i),s=this.hashInt(r.Rencoded(),n.pubBytes(),e),o=this.g.mul(r.S()),a=r.R().add(n.pub().mul(s));return a.eq(o)};fr.prototype.hashInt=function(){for(var e=this.hash(),r=0;r<arguments.length;r++)e.update(arguments[r]);return ts.intFromLE(e.digest()).umod(this.curve.n)};fr.prototype.keyFromPublic=function(e){return cd.fromPublic(this,e)};fr.prototype.keyFromSecret=function(e){return cd.fromSecret(this,e)};fr.prototype.makeSignature=function(e){return e instanceof iu?e:new iu(this,e)};fr.prototype.encodePoint=function(e){var r=e.getY().toArray("le",this.encodingLength);return r[this.encodingLength-1]|=e.getX().isOdd()?128:0,r};fr.prototype.decodePoint=function(e){e=ts.parseBytes(e);var r=e.length-1,i=e.slice(0,r).concat(e[r]&-129),n=(e[r]&128)!==0,s=ts.intFromLE(i);return this.curve.pointFromY(s,n)};fr.prototype.encodeInt=function(e){return e.toArray("le",this.encodingLength)};fr.prototype.decodeInt=function(e){return ts.intFromLE(e)};fr.prototype.isPoint=function(e){return e instanceof this.pointClass};(function(t){var e=t;e.version=S2.version,e.utils=br,e.rand=U0,e.curve=jf,e.curves=Ta,e.ec=mv,e.eddsa=Mv})(F0);var Gf={},ft={};Object.defineProperty(ft,"__esModule",{value:!0});var fd=ft.getLocalStorage=wd=ft.getLocalStorageOrThrow=yd=ft.getCrypto=md=ft.getCryptoOrThrow=vd=ft.getLocation=bd=ft.getLocationOrThrow=gd=ft.getNavigator=pd=ft.getNavigatorOrThrow=dd=ft.getDocument=ld=ft.getDocumentOrThrow=ud=ft.getFromWindowOrThrow=hd=ft.getFromWindow=void 0;function Rn(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var hd=ft.getFromWindow=Rn;function ms(t){const e=Rn(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var ud=ft.getFromWindowOrThrow=ms;function Iv(){return ms("document")}var ld=ft.getDocumentOrThrow=Iv;function Dv(){return Rn("document")}var dd=ft.getDocument=Dv;function Cv(){return ms("navigator")}var pd=ft.getNavigatorOrThrow=Cv;function Nv(){return Rn("navigator")}var gd=ft.getNavigator=Nv;function Tv(){return ms("location")}var bd=ft.getLocationOrThrow=Tv;function Rv(){return Rn("location")}var vd=ft.getLocation=Rv;function Ov(){return ms("crypto")}var md=ft.getCryptoOrThrow=Ov;function Pv(){return Rn("crypto")}var yd=ft.getCrypto=Pv;function Bv(){return ms("localStorage")}var wd=ft.getLocalStorageOrThrow=Bv;function Fv(){return Rn("localStorage")}fd=ft.getLocalStorage=Fv;Object.defineProperty(Gf,"__esModule",{value:!0});var _d=Gf.getWindowMetadata=void 0;const nu=ft;function Lv(){let t,e;try{t=nu.getDocumentOrThrow(),e=nu.getLocationOrThrow()}catch{return null}function r(){const v=t.getElementsByTagName("link"),x=[];for(let E=0;E<v.length;E++){const D=v[E],B=D.getAttribute("rel");if(B&&B.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let j=e.protocol+"//"+e.host;if(F.indexOf("/")===0)j+=F;else{const R=e.pathname.split("/");R.pop();const K=R.join("/");j+=K+"/"+F}x.push(j)}else if(F.indexOf("//")===0){const j=e.protocol+F;x.push(j)}else x.push(F)}}return x}function i(...v){const x=t.getElementsByTagName("meta");for(let E=0;E<x.length;E++){const D=x[E],B=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?v.includes(F):!1);if(B.length&&B){const F=D.getAttribute("content");if(F)return F}}return""}function n(){let v=i("name","og:site_name","og:title","twitter:title");return v||(v=t.title),v}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,f=r();return{description:a,url:h,icons:f,name:o}}_d=Gf.getWindowMetadata=Lv;var Uv=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},kv=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),$v=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),qv=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),zv=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Kv=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),jv=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Hv=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,su=3,Vv=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",jv]],ou=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Wv(t){return t?au(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Kv:typeof navigator<"u"?au(navigator.userAgent):Jv()}function Gv(t){return t!==""&&Vv.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function au(t){var e=Gv(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new zv;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<su&&(n=Uv(n,Qv(su-n.length))):n=[];var s=n.join("."),o=Yv(t),a=Hv.exec(t);return a&&a[1]?new qv(r,s,o,a[1]):new kv(r,s,o)}function Yv(t){for(var e=0,r=ou.length;e<r;e++){var i=ou[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function Jv(){var t=typeof process<"u"&&process.version;return t?new $v(process.version.slice(1)):null}function Qv(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function Yf(t){return Wv(t)}function Ua(){const t=Yf();return t&&t.os?t.os:void 0}function Ed(){const t=Ua();return t?t.toLowerCase().includes("android"):!1}function Ad(){const t=Ua();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Xv(){return Ua()?Ed()||Ad():!1}function xd(){const t=Yf();return t&&t.name?t.name.toLowerCase()==="node":!1}function Zv(){return!xd()&&!!Sd()}const em=hd,tm=ud,rm=ld,im=dd,nm=pd,Sd=gd,sm=bd,om=vd,am=md,cm=yd,fm=wd,ka=fd;function hm(){return _d()}function um(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function lm(t){return typeof t=="string"?t:JSON.stringify(t)}const Md=um,Id=lm;function Dd(t,e){const r=Id(e),i=ka();i&&i.setItem(t,r)}function dm(t){let e=null,r=null;const i=ka();return i&&(r=i.getItem(t)),e=r&&Md(r),e}function pm(t){const e=ka();e&&e.removeItem(t)}const Cd="WALLETCONNECT_DEEPLINK_CHOICE";function gm(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function bm(t){const e=t.href.split("?")[0];Dd(Cd,Object.assign(Object.assign({},t),{href:e}))}function Nd(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function vm(t,e){let r=t;return e&&(r=e.map(i=>Nd(t,i)).filter(Boolean)),r}const Td="https://registry.walletconnect.com";function mm(){return Td+"/api/v2/wallets"}function ym(){return Td+"/api/v2/dapps"}function Rd(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function wm(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>Rd(r,e))}const _m=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:Yf,detectOS:Ua,formatIOSMobile:gm,formatMobileRegistry:wm,formatMobileRegistryEntry:Rd,getClientMeta:hm,getCrypto:cm,getCryptoOrThrow:am,getDappRegistryUrl:ym,getDocument:im,getDocumentOrThrow:rm,getFromWindow:em,getFromWindowOrThrow:tm,getLocal:dm,getLocalStorage:ka,getLocalStorageOrThrow:fm,getLocation:om,getLocationOrThrow:sm,getMobileLinkRegistry:vm,getMobileRegistryEntry:Nd,getNavigator:Sd,getNavigatorOrThrow:nm,getWalletRegistryUrl:mm,isAndroid:Ed,isBrowser:Zv,isIOS:Ad,isMobile:Xv,isNode:xd,mobileLinkChoiceKey:Cd,removeLocal:pm,safeJsonParse:Md,safeJsonStringify:Id,saveMobileLinkInfo:bm,setLocal:Dd},Symbol.toStringTag,{value:"Module"})),Em=Ma(_m);var go={},Am=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Od={},on={},xm={}.toString,Jf=Array.isArray||function(t){return xm.call(t)=="[object Array]"},Sm=Jf;function Mm(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}et.TYPED_ARRAY_SUPPORT=Mm();var cu=et.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function et(t,e,r){return!et.TYPED_ARRAY_SUPPORT&&!(this instanceof et)?new et(t,e,r):typeof t=="number"?Pd(this,t):Om(this,t,e,r)}et.TYPED_ARRAY_SUPPORT&&(et.prototype.__proto__=Uint8Array.prototype,et.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&et[Symbol.species]===et&&Object.defineProperty(et,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function Qf(t){if(t>=cu)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+cu.toString(16)+" bytes");return t|0}function Im(t){return t!==t}function rs(t,e){var r;return et.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=et.prototype):(r=t,r===null&&(r=new et(e)),r.length=e),r}function Pd(t,e){var r=rs(t,e<0?0:Qf(e)|0);if(!et.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function Dm(t,e){var r=Fd(e)|0,i=rs(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function rf(t,e){for(var r=e.length<0?0:Qf(e.length)|0,i=rs(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Cm(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),et.TYPED_ARRAY_SUPPORT?n.__proto__=et.prototype:n=rf(t,n),n}function Nm(t,e){if(et.isBuffer(e)){var r=Qf(e.length)|0,i=rs(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Im(e.length)?rs(t,0):rf(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return rf(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Bd(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function Fd(t){if(et.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:Bd(t).length}function Tm(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function Rm(t,e,r,i){return Tm(Bd(e,t.length-r),t,r,i)}function Om(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Cm(t,e,r,i):typeof e=="string"?Dm(t,e):Nm(t,e)}et.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return Rm(this,e,r,i)};et.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 n;if(et.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=et.prototype;else{var s=r-e;n=new et(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};et.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===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("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!et.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};et.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);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 s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=et.isBuffer(e)?e:new et(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};et.concat=function(e,r){if(!Sm(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return rs(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=Pd(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!et.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};et.byteLength=Fd;et.prototype._isBuffer=!0;et.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};on.alloc=function(t){var e=new et(t);return e.fill(0),e};on.from=function(t){return new et(t)};var vr={},Xf,Pm=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];vr.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};vr.getSymbolTotalCodewords=function(e){return Pm[e]};vr.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};vr.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');Xf=e};vr.isKanjiModeEnabled=function(){return typeof Xf<"u"};vr.toSJIS=function(e){return Xf(e)};var $a={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})($a);function Ld(){this.buffer=[],this.length=0}Ld.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Bm=Ld,fu=on;function bo(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=fu.alloc(t*t),this.reservedBit=fu.alloc(t*t)}bo.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};bo.prototype.get=function(t,e){return this.data[t*this.size+e]};bo.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};bo.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var Fm=bo,Ud={};(function(t){var e=vr.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(Ud);var kd={},Lm=vr.getSymbolSize,hu=7;kd.getPositions=function(e){var r=Lm(e);return[[0,0],[r-hu,0],[0,r-hu]]};var $d={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,f=null,p=null,v=0;v<s;v++){a=h=0,f=p=null;for(var x=0;x<s;x++){var E=n.get(v,x);E===f?a++:(a>=5&&(o+=e.N1+(a-5)),f=E,a=1),E=n.get(x,v),E===p?h++:(h>=5&&(o+=e.N1+(h-5)),p=E,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var f=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(f===4||f===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,f=0;f<s;f++){a=h=0;for(var p=0;p<s;p++)a=a<<1&2047|n.get(f,p),p>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(p,f),p>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,f=0;f<o;f++){s(f),t.applyMask(f,n);var p=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(f,n),p<h&&(h=p,a=f)}return a}})($d);var qa={},en=$a,Fo=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Lo=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];qa.getBlocksCount=function(e,r){switch(r){case en.L:return Fo[(e-1)*4+0];case en.M:return Fo[(e-1)*4+1];case en.Q:return Fo[(e-1)*4+2];case en.H:return Fo[(e-1)*4+3];default:return}};qa.getTotalCodewordsCount=function(e,r){switch(r){case en.L:return Lo[(e-1)*4+0];case en.M:return Lo[(e-1)*4+1];case en.Q:return Lo[(e-1)*4+2];case en.H:return Lo[(e-1)*4+3];default:return}};var qd={},za={},zd=on,Ws=zd.alloc(512),oa=zd.alloc(256);(function(){for(var e=1,r=0;r<255;r++)Ws[r]=e,oa[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)Ws[r]=Ws[r-255]})();za.log=function(e){if(e<1)throw new Error("log("+e+")");return oa[e]};za.exp=function(e){return Ws[e]};za.mul=function(e,r){return e===0||r===0?0:Ws[oa[e]+oa[r]]};(function(t){var e=on,r=za;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var f=0;f<o.length&&o[f]===0;)f++;o=o.slice(f)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(qd);var Kd={};/*!
2
- * The buffer module from node.js, for the browser.
3
- *
4
- * @author Feross Aboukhadijeh <https://feross.org>
5
- * @license MIT
6
- */(function(t){var e=n2,r=s2,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=a,t.SlowBuffer=R,t.INSPECT_MAX_BYTES=50;var n=2147483647;t.kMaxLength=n,a.TYPED_ARRAY_SUPPORT=s(),!a.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 s(){try{var O=new Uint8Array(1),A={foo:function(){return 42}};return Object.setPrototypeOf(A,Uint8Array.prototype),Object.setPrototypeOf(O,A),O.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(O){if(O>n)throw new RangeError('The value "'+O+'" is invalid for option "size"');var A=new Uint8Array(O);return Object.setPrototypeOf(A,a.prototype),A}function a(O,A,M){if(typeof O=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(O)}return h(O,A,M)}a.poolSize=8192;function h(O,A,M){if(typeof O=="string")return x(O,A);if(ArrayBuffer.isView(O))return D(O);if(O==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof O);if(ie(O,ArrayBuffer)||O&&ie(O.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ie(O,SharedArrayBuffer)||O&&ie(O.buffer,SharedArrayBuffer)))return B(O,A,M);if(typeof O=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var $=O.valueOf&&O.valueOf();if($!=null&&$!==O)return a.from($,A,M);var G=F(O);if(G)return G;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof O[Symbol.toPrimitive]=="function")return a.from(O[Symbol.toPrimitive]("string"),A,M);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof O)}a.from=function(O,A,M){return h(O,A,M)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function f(O){if(typeof O!="number")throw new TypeError('"size" argument must be of type number');if(O<0)throw new RangeError('The value "'+O+'" is invalid for option "size"')}function p(O,A,M){return f(O),O<=0?o(O):A!==void 0?typeof M=="string"?o(O).fill(A,M):o(O).fill(A):o(O)}a.alloc=function(O,A,M){return p(O,A,M)};function v(O){return f(O),o(O<0?0:j(O)|0)}a.allocUnsafe=function(O){return v(O)},a.allocUnsafeSlow=function(O){return v(O)};function x(O,A){if((typeof A!="string"||A==="")&&(A="utf8"),!a.isEncoding(A))throw new TypeError("Unknown encoding: "+A);var M=K(O,A)|0,$=o(M),G=$.write(O,A);return G!==M&&($=$.slice(0,G)),$}function E(O){for(var A=O.length<0?0:j(O.length)|0,M=o(A),$=0;$<A;$+=1)M[$]=O[$]&255;return M}function D(O){if(ie(O,Uint8Array)){var A=new Uint8Array(O);return B(A.buffer,A.byteOffset,A.byteLength)}return E(O)}function B(O,A,M){if(A<0||O.byteLength<A)throw new RangeError('"offset" is outside of buffer bounds');if(O.byteLength<A+(M||0))throw new RangeError('"length" is outside of buffer bounds');var $;return A===void 0&&M===void 0?$=new Uint8Array(O):M===void 0?$=new Uint8Array(O,A):$=new Uint8Array(O,A,M),Object.setPrototypeOf($,a.prototype),$}function F(O){if(a.isBuffer(O)){var A=j(O.length)|0,M=o(A);return M.length===0||O.copy(M,0,0,A),M}if(O.length!==void 0)return typeof O.length!="number"||se(O.length)?o(0):E(O);if(O.type==="Buffer"&&Array.isArray(O.data))return E(O.data)}function j(O){if(O>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return O|0}function R(O){return+O!=O&&(O=0),a.alloc(+O)}a.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==a.prototype},a.compare=function(A,M){if(ie(A,Uint8Array)&&(A=a.from(A,A.offset,A.byteLength)),ie(M,Uint8Array)&&(M=a.from(M,M.offset,M.byteLength)),!a.isBuffer(A)||!a.isBuffer(M))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===M)return 0;for(var $=A.length,G=M.length,re=0,X=Math.min($,G);re<X;++re)if(A[re]!==M[re]){$=A[re],G=M[re];break}return $<G?-1:G<$?1:0},a.isEncoding=function(A){switch(String(A).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}},a.concat=function(A,M){if(!Array.isArray(A))throw new TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return a.alloc(0);var $;if(M===void 0)for(M=0,$=0;$<A.length;++$)M+=A[$].length;var G=a.allocUnsafe(M),re=0;for($=0;$<A.length;++$){var X=A[$];if(ie(X,Uint8Array))re+X.length>G.length?a.from(X).copy(G,re):Uint8Array.prototype.set.call(G,X,re);else if(a.isBuffer(X))X.copy(G,re);else throw new TypeError('"list" argument must be an Array of Buffers');re+=X.length}return G};function K(O,A){if(a.isBuffer(O))return O.length;if(ArrayBuffer.isView(O)||ie(O,ArrayBuffer))return O.byteLength;if(typeof O!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof O);var M=O.length,$=arguments.length>2&&arguments[2]===!0;if(!$&&M===0)return 0;for(var G=!1;;)switch(A){case"ascii":case"latin1":case"binary":return M;case"utf8":case"utf-8":return H(O).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M*2;case"hex":return M>>>1;case"base64":return z(O).length;default:if(G)return $?-1:H(O).length;A=(""+A).toLowerCase(),G=!0}}a.byteLength=K;function T(O,A,M){var $=!1;if((A===void 0||A<0)&&(A=0),A>this.length||((M===void 0||M>this.length)&&(M=this.length),M<=0)||(M>>>=0,A>>>=0,M<=A))return"";for(O||(O="utf8");;)switch(O){case"hex":return _(this,A,M);case"utf8":case"utf-8":return u(this,A,M);case"ascii":return S(this,A,M);case"latin1":case"binary":return C(this,A,M);case"base64":return c(this,A,M);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l(this,A,M);default:if($)throw new TypeError("Unknown encoding: "+O);O=(O+"").toLowerCase(),$=!0}}a.prototype._isBuffer=!0;function L(O,A,M){var $=O[A];O[A]=O[M],O[M]=$}a.prototype.swap16=function(){var A=this.length;if(A%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var M=0;M<A;M+=2)L(this,M,M+1);return this},a.prototype.swap32=function(){var A=this.length;if(A%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var M=0;M<A;M+=4)L(this,M,M+3),L(this,M+1,M+2);return this},a.prototype.swap64=function(){var A=this.length;if(A%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var M=0;M<A;M+=8)L(this,M,M+7),L(this,M+1,M+6),L(this,M+2,M+5),L(this,M+3,M+4);return this},a.prototype.toString=function(){var A=this.length;return A===0?"":arguments.length===0?u(this,0,A):T.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(A){if(!a.isBuffer(A))throw new TypeError("Argument must be a Buffer");return this===A?!0:a.compare(this,A)===0},a.prototype.inspect=function(){var A="",M=t.INSPECT_MAX_BYTES;return A=this.toString("hex",0,M).replace(/(.{2})/g,"$1 ").trim(),this.length>M&&(A+=" ... "),"<Buffer "+A+">"},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(A,M,$,G,re){if(ie(A,Uint8Array)&&(A=a.from(A,A.offset,A.byteLength)),!a.isBuffer(A))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(M===void 0&&(M=0),$===void 0&&($=A?A.length:0),G===void 0&&(G=0),re===void 0&&(re=this.length),M<0||$>A.length||G<0||re>this.length)throw new RangeError("out of range index");if(G>=re&&M>=$)return 0;if(G>=re)return-1;if(M>=$)return 1;if(M>>>=0,$>>>=0,G>>>=0,re>>>=0,this===A)return 0;for(var X=re-G,ce=$-M,fe=Math.min(X,ce),oe=this.slice(G,re),le=A.slice(M,$),he=0;he<fe;++he)if(oe[he]!==le[he]){X=oe[he],ce=le[he];break}return X<ce?-1:ce<X?1:0};function q(O,A,M,$,G){if(O.length===0)return-1;if(typeof M=="string"?($=M,M=0):M>2147483647?M=2147483647:M<-2147483648&&(M=-2147483648),M=+M,se(M)&&(M=G?0:O.length-1),M<0&&(M=O.length+M),M>=O.length){if(G)return-1;M=O.length-1}else if(M<0)if(G)M=0;else return-1;if(typeof A=="string"&&(A=a.from(A,$)),a.isBuffer(A))return A.length===0?-1:y(O,A,M,$,G);if(typeof A=="number")return A=A&255,typeof Uint8Array.prototype.indexOf=="function"?G?Uint8Array.prototype.indexOf.call(O,A,M):Uint8Array.prototype.lastIndexOf.call(O,A,M):y(O,[A],M,$,G);throw new TypeError("val must be string, number or Buffer")}function y(O,A,M,$,G){var re=1,X=O.length,ce=A.length;if($!==void 0&&($=String($).toLowerCase(),$==="ucs2"||$==="ucs-2"||$==="utf16le"||$==="utf-16le")){if(O.length<2||A.length<2)return-1;re=2,X/=2,ce/=2,M/=2}function fe(we,me){return re===1?we[me]:we.readUInt16BE(me*re)}var oe;if(G){var le=-1;for(oe=M;oe<X;oe++)if(fe(O,oe)===fe(A,le===-1?0:oe-le)){if(le===-1&&(le=oe),oe-le+1===ce)return le*re}else le!==-1&&(oe-=oe-le),le=-1}else for(M+ce>X&&(M=X-ce),oe=M;oe>=0;oe--){for(var he=!0,ue=0;ue<ce;ue++)if(fe(O,oe+ue)!==fe(A,ue)){he=!1;break}if(he)return oe}return-1}a.prototype.includes=function(A,M,$){return this.indexOf(A,M,$)!==-1},a.prototype.indexOf=function(A,M,$){return q(this,A,M,$,!0)},a.prototype.lastIndexOf=function(A,M,$){return q(this,A,M,$,!1)};function P(O,A,M,$){M=Number(M)||0;var G=O.length-M;$?($=Number($),$>G&&($=G)):$=G;var re=A.length;$>re/2&&($=re/2);for(var X=0;X<$;++X){var ce=parseInt(A.substr(X*2,2),16);if(se(ce))return X;O[M+X]=ce}return X}function Z(O,A,M,$){return ee(H(A,O.length-M),O,M,$)}function ne(O,A,M,$){return ee(V(A),O,M,$)}function U(O,A,M,$){return ee(z(A),O,M,$)}function b(O,A,M,$){return ee(m(A,O.length-M),O,M,$)}a.prototype.write=function(A,M,$,G){if(M===void 0)G="utf8",$=this.length,M=0;else if($===void 0&&typeof M=="string")G=M,$=this.length,M=0;else if(isFinite(M))M=M>>>0,isFinite($)?($=$>>>0,G===void 0&&(G="utf8")):(G=$,$=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var re=this.length-M;if(($===void 0||$>re)&&($=re),A.length>0&&($<0||M<0)||M>this.length)throw new RangeError("Attempt to write outside buffer bounds");G||(G="utf8");for(var X=!1;;)switch(G){case"hex":return P(this,A,M,$);case"utf8":case"utf-8":return Z(this,A,M,$);case"ascii":case"latin1":case"binary":return ne(this,A,M,$);case"base64":return U(this,A,M,$);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,A,M,$);default:if(X)throw new TypeError("Unknown encoding: "+G);G=(""+G).toLowerCase(),X=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function c(O,A,M){return A===0&&M===O.length?e.fromByteArray(O):e.fromByteArray(O.slice(A,M))}function u(O,A,M){M=Math.min(O.length,M);for(var $=[],G=A;G<M;){var re=O[G],X=null,ce=re>239?4:re>223?3:re>191?2:1;if(G+ce<=M){var fe,oe,le,he;switch(ce){case 1:re<128&&(X=re);break;case 2:fe=O[G+1],(fe&192)===128&&(he=(re&31)<<6|fe&63,he>127&&(X=he));break;case 3:fe=O[G+1],oe=O[G+2],(fe&192)===128&&(oe&192)===128&&(he=(re&15)<<12|(fe&63)<<6|oe&63,he>2047&&(he<55296||he>57343)&&(X=he));break;case 4:fe=O[G+1],oe=O[G+2],le=O[G+3],(fe&192)===128&&(oe&192)===128&&(le&192)===128&&(he=(re&15)<<18|(fe&63)<<12|(oe&63)<<6|le&63,he>65535&&he<1114112&&(X=he))}}X===null?(X=65533,ce=1):X>65535&&(X-=65536,$.push(X>>>10&1023|55296),X=56320|X&1023),$.push(X),G+=ce}return w($)}var g=4096;function w(O){var A=O.length;if(A<=g)return String.fromCharCode.apply(String,O);for(var M="",$=0;$<A;)M+=String.fromCharCode.apply(String,O.slice($,$+=g));return M}function S(O,A,M){var $="";M=Math.min(O.length,M);for(var G=A;G<M;++G)$+=String.fromCharCode(O[G]&127);return $}function C(O,A,M){var $="";M=Math.min(O.length,M);for(var G=A;G<M;++G)$+=String.fromCharCode(O[G]);return $}function _(O,A,M){var $=O.length;(!A||A<0)&&(A=0),(!M||M<0||M>$)&&(M=$);for(var G="",re=A;re<M;++re)G+=de[O[re]];return G}function l(O,A,M){for(var $=O.slice(A,M),G="",re=0;re<$.length-1;re+=2)G+=String.fromCharCode($[re]+$[re+1]*256);return G}a.prototype.slice=function(A,M){var $=this.length;A=~~A,M=M===void 0?$:~~M,A<0?(A+=$,A<0&&(A=0)):A>$&&(A=$),M<0?(M+=$,M<0&&(M=0)):M>$&&(M=$),M<A&&(M=A);var G=this.subarray(A,M);return Object.setPrototypeOf(G,a.prototype),G};function d(O,A,M){if(O%1!==0||O<0)throw new RangeError("offset is not uint");if(O+A>M)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(A,M,$){A=A>>>0,M=M>>>0,$||d(A,M,this.length);for(var G=this[A],re=1,X=0;++X<M&&(re*=256);)G+=this[A+X]*re;return G},a.prototype.readUintBE=a.prototype.readUIntBE=function(A,M,$){A=A>>>0,M=M>>>0,$||d(A,M,this.length);for(var G=this[A+--M],re=1;M>0&&(re*=256);)G+=this[A+--M]*re;return G},a.prototype.readUint8=a.prototype.readUInt8=function(A,M){return A=A>>>0,M||d(A,1,this.length),this[A]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(A,M){return A=A>>>0,M||d(A,2,this.length),this[A]|this[A+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(A,M){return A=A>>>0,M||d(A,2,this.length),this[A]<<8|this[A+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(A,M){return A=A>>>0,M||d(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(A,M){return A=A>>>0,M||d(A,4,this.length),this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])},a.prototype.readIntLE=function(A,M,$){A=A>>>0,M=M>>>0,$||d(A,M,this.length);for(var G=this[A],re=1,X=0;++X<M&&(re*=256);)G+=this[A+X]*re;return re*=128,G>=re&&(G-=Math.pow(2,8*M)),G},a.prototype.readIntBE=function(A,M,$){A=A>>>0,M=M>>>0,$||d(A,M,this.length);for(var G=M,re=1,X=this[A+--G];G>0&&(re*=256);)X+=this[A+--G]*re;return re*=128,X>=re&&(X-=Math.pow(2,8*M)),X},a.prototype.readInt8=function(A,M){return A=A>>>0,M||d(A,1,this.length),this[A]&128?(255-this[A]+1)*-1:this[A]},a.prototype.readInt16LE=function(A,M){A=A>>>0,M||d(A,2,this.length);var $=this[A]|this[A+1]<<8;return $&32768?$|4294901760:$},a.prototype.readInt16BE=function(A,M){A=A>>>0,M||d(A,2,this.length);var $=this[A+1]|this[A]<<8;return $&32768?$|4294901760:$},a.prototype.readInt32LE=function(A,M){return A=A>>>0,M||d(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},a.prototype.readInt32BE=function(A,M){return A=A>>>0,M||d(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},a.prototype.readFloatLE=function(A,M){return A=A>>>0,M||d(A,4,this.length),r.read(this,A,!0,23,4)},a.prototype.readFloatBE=function(A,M){return A=A>>>0,M||d(A,4,this.length),r.read(this,A,!1,23,4)},a.prototype.readDoubleLE=function(A,M){return A=A>>>0,M||d(A,8,this.length),r.read(this,A,!0,52,8)},a.prototype.readDoubleBE=function(A,M){return A=A>>>0,M||d(A,8,this.length),r.read(this,A,!1,52,8)};function N(O,A,M,$,G,re){if(!a.isBuffer(O))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>G||A<re)throw new RangeError('"value" argument is out of bounds');if(M+$>O.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(A,M,$,G){if(A=+A,M=M>>>0,$=$>>>0,!G){var re=Math.pow(2,8*$)-1;N(this,A,M,$,re,0)}var X=1,ce=0;for(this[M]=A&255;++ce<$&&(X*=256);)this[M+ce]=A/X&255;return M+$},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(A,M,$,G){if(A=+A,M=M>>>0,$=$>>>0,!G){var re=Math.pow(2,8*$)-1;N(this,A,M,$,re,0)}var X=$-1,ce=1;for(this[M+X]=A&255;--X>=0&&(ce*=256);)this[M+X]=A/ce&255;return M+$},a.prototype.writeUint8=a.prototype.writeUInt8=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,1,255,0),this[M]=A&255,M+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,2,65535,0),this[M]=A&255,this[M+1]=A>>>8,M+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,2,65535,0),this[M]=A>>>8,this[M+1]=A&255,M+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,4,4294967295,0),this[M+3]=A>>>24,this[M+2]=A>>>16,this[M+1]=A>>>8,this[M]=A&255,M+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,4,4294967295,0),this[M]=A>>>24,this[M+1]=A>>>16,this[M+2]=A>>>8,this[M+3]=A&255,M+4},a.prototype.writeIntLE=function(A,M,$,G){if(A=+A,M=M>>>0,!G){var re=Math.pow(2,8*$-1);N(this,A,M,$,re-1,-re)}var X=0,ce=1,fe=0;for(this[M]=A&255;++X<$&&(ce*=256);)A<0&&fe===0&&this[M+X-1]!==0&&(fe=1),this[M+X]=(A/ce>>0)-fe&255;return M+$},a.prototype.writeIntBE=function(A,M,$,G){if(A=+A,M=M>>>0,!G){var re=Math.pow(2,8*$-1);N(this,A,M,$,re-1,-re)}var X=$-1,ce=1,fe=0;for(this[M+X]=A&255;--X>=0&&(ce*=256);)A<0&&fe===0&&this[M+X+1]!==0&&(fe=1),this[M+X]=(A/ce>>0)-fe&255;return M+$},a.prototype.writeInt8=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,1,127,-128),A<0&&(A=255+A+1),this[M]=A&255,M+1},a.prototype.writeInt16LE=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,2,32767,-32768),this[M]=A&255,this[M+1]=A>>>8,M+2},a.prototype.writeInt16BE=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,2,32767,-32768),this[M]=A>>>8,this[M+1]=A&255,M+2},a.prototype.writeInt32LE=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,4,2147483647,-2147483648),this[M]=A&255,this[M+1]=A>>>8,this[M+2]=A>>>16,this[M+3]=A>>>24,M+4},a.prototype.writeInt32BE=function(A,M,$){return A=+A,M=M>>>0,$||N(this,A,M,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),this[M]=A>>>24,this[M+1]=A>>>16,this[M+2]=A>>>8,this[M+3]=A&255,M+4};function Y(O,A,M,$,G,re){if(M+$>O.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("Index out of range")}function te(O,A,M,$,G){return A=+A,M=M>>>0,G||Y(O,A,M,4),r.write(O,A,M,$,23,4),M+4}a.prototype.writeFloatLE=function(A,M,$){return te(this,A,M,!0,$)},a.prototype.writeFloatBE=function(A,M,$){return te(this,A,M,!1,$)};function I(O,A,M,$,G){return A=+A,M=M>>>0,G||Y(O,A,M,8),r.write(O,A,M,$,52,8),M+8}a.prototype.writeDoubleLE=function(A,M,$){return I(this,A,M,!0,$)},a.prototype.writeDoubleBE=function(A,M,$){return I(this,A,M,!1,$)},a.prototype.copy=function(A,M,$,G){if(!a.isBuffer(A))throw new TypeError("argument should be a Buffer");if($||($=0),!G&&G!==0&&(G=this.length),M>=A.length&&(M=A.length),M||(M=0),G>0&&G<$&&(G=$),G===$||A.length===0||this.length===0)return 0;if(M<0)throw new RangeError("targetStart out of bounds");if($<0||$>=this.length)throw new RangeError("Index out of range");if(G<0)throw new RangeError("sourceEnd out of bounds");G>this.length&&(G=this.length),A.length-M<G-$&&(G=A.length-M+$);var re=G-$;return this===A&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(M,$,G):Uint8Array.prototype.set.call(A,this.subarray($,G),M),re},a.prototype.fill=function(A,M,$,G){if(typeof A=="string"){if(typeof M=="string"?(G=M,M=0,$=this.length):typeof $=="string"&&(G=$,$=this.length),G!==void 0&&typeof G!="string")throw new TypeError("encoding must be a string");if(typeof G=="string"&&!a.isEncoding(G))throw new TypeError("Unknown encoding: "+G);if(A.length===1){var re=A.charCodeAt(0);(G==="utf8"&&re<128||G==="latin1")&&(A=re)}}else typeof A=="number"?A=A&255:typeof A=="boolean"&&(A=Number(A));if(M<0||this.length<M||this.length<$)throw new RangeError("Out of range index");if($<=M)return this;M=M>>>0,$=$===void 0?this.length:$>>>0,A||(A=0);var X;if(typeof A=="number")for(X=M;X<$;++X)this[X]=A;else{var ce=a.isBuffer(A)?A:a.from(A,G),fe=ce.length;if(fe===0)throw new TypeError('The value "'+A+'" is invalid for argument "value"');for(X=0;X<$-M;++X)this[X+M]=ce[X%fe]}return this};var J=/[^+/0-9A-Za-z-_]/g;function k(O){if(O=O.split("=")[0],O=O.trim().replace(J,""),O.length<2)return"";for(;O.length%4!==0;)O=O+"=";return O}function H(O,A){A=A||1/0;for(var M,$=O.length,G=null,re=[],X=0;X<$;++X){if(M=O.charCodeAt(X),M>55295&&M<57344){if(!G){if(M>56319){(A-=3)>-1&&re.push(239,191,189);continue}else if(X+1===$){(A-=3)>-1&&re.push(239,191,189);continue}G=M;continue}if(M<56320){(A-=3)>-1&&re.push(239,191,189),G=M;continue}M=(G-55296<<10|M-56320)+65536}else G&&(A-=3)>-1&&re.push(239,191,189);if(G=null,M<128){if((A-=1)<0)break;re.push(M)}else if(M<2048){if((A-=2)<0)break;re.push(M>>6|192,M&63|128)}else if(M<65536){if((A-=3)<0)break;re.push(M>>12|224,M>>6&63|128,M&63|128)}else if(M<1114112){if((A-=4)<0)break;re.push(M>>18|240,M>>12&63|128,M>>6&63|128,M&63|128)}else throw new Error("Invalid code point")}return re}function V(O){for(var A=[],M=0;M<O.length;++M)A.push(O.charCodeAt(M)&255);return A}function m(O,A){for(var M,$,G,re=[],X=0;X<O.length&&!((A-=2)<0);++X)M=O.charCodeAt(X),$=M>>8,G=M%256,re.push(G),re.push($);return re}function z(O){return e.toByteArray(k(O))}function ee(O,A,M,$){for(var G=0;G<$&&!(G+M>=A.length||G>=O.length);++G)A[G+M]=O[G];return G}function ie(O,A){return O instanceof A||O!=null&&O.constructor!=null&&O.constructor.name!=null&&O.constructor.name===A.name}function se(O){return O!==O}var de=function(){for(var O="0123456789abcdef",A=new Array(256),M=0;M<16;++M)for(var $=M*16,G=0;G<16;++G)A[$+G]=O[M]+O[G];return A}()})(Kd);var uu=on,jd=qd,Um=Kd.Buffer;function Zf(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}Zf.prototype.initialize=function(e){this.degree=e,this.genPoly=jd.generateECPolynomial(this.degree)};Zf.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=uu.alloc(this.degree),i=Um.concat([e,r],e.length+this.degree),n=jd.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=uu.alloc(this.degree);return n.copy(o,s),o}return n};var km=Zf,Hd={},an={},eh={};eh.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var gi={},Vd="[0-9]+",$m="[A-Z $%*+\\-./:]+",to="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";to=to.replace(/u/g,"\\u");var qm="(?:(?![A-Z0-9 $%*+\\-./:]|"+to+`)(?:.|[\r
7
- ]))+`;gi.KANJI=new RegExp(to,"g");gi.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");gi.BYTE=new RegExp(qm,"g");gi.NUMERIC=new RegExp(Vd,"g");gi.ALPHANUMERIC=new RegExp($m,"g");var zm=new RegExp("^"+to+"$"),Km=new RegExp("^"+Vd+"$"),jm=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");gi.testKanji=function(e){return zm.test(e)};gi.testNumeric=function(e){return Km.test(e)};gi.testAlphanumeric=function(e){return jm.test(e)};(function(t){var e=eh,r=gi;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");var s=n.toLowerCase();switch(s){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}t.from=function(s,o){if(t.isValid(s))return s;try{return i(s)}catch{return o}}})(an);(function(t){var e=vr,r=qa,i=$a,n=an,s=eh,o=Jf,a=7973,h=e.getBCHDigit(a);function f(E,D,B){for(var F=1;F<=40;F++)if(D<=t.getCapacity(F,B,E))return F}function p(E,D){return n.getCharCountIndicator(E,D)+4}function v(E,D){var B=0;return E.forEach(function(F){var j=p(F.mode,D);B+=j+F.getBitsLength()}),B}function x(E,D){for(var B=1;B<=40;B++){var F=v(E,B);if(F<=t.getCapacity(B,D,n.MIXED))return B}}t.from=function(D,B){return s.isValid(D)?parseInt(D,10):B},t.getCapacity=function(D,B,F){if(!s.isValid(D))throw new Error("Invalid QR Code version");typeof F>"u"&&(F=n.BYTE);var j=e.getSymbolTotalCodewords(D),R=r.getTotalCodewordsCount(D,B),K=(j-R)*8;if(F===n.MIXED)return K;var T=K-p(F,D);switch(F){case n.NUMERIC:return Math.floor(T/10*3);case n.ALPHANUMERIC:return Math.floor(T/11*2);case n.KANJI:return Math.floor(T/13);case n.BYTE:default:return Math.floor(T/8)}},t.getBestVersionForData=function(D,B){var F,j=i.from(B,i.M);if(o(D)){if(D.length>1)return x(D,j);if(D.length===0)return 1;F=D[0]}else F=D;return f(F.mode,F.getLength(),j)},t.getEncodedBits=function(D){if(!s.isValid(D)||D<7)throw new Error("Invalid QR Code version");for(var B=D<<12;e.getBCHDigit(B)-h>=0;)B^=a<<e.getBCHDigit(B)-h;return D<<12|B}})(Hd);var Wd={},nf=vr,Gd=1335,Hm=21522,lu=nf.getBCHDigit(Gd);Wd.getEncodedBits=function(e,r){for(var i=e.bit<<3|r,n=i<<10;nf.getBCHDigit(n)-lu>=0;)n^=Gd<<nf.getBCHDigit(n)-lu;return(i<<10|n)^Hm};var Yd={},Vm=an;function is(t){this.mode=Vm.NUMERIC,this.data=t.toString()}is.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};is.prototype.getLength=function(){return this.data.length};is.prototype.getBitsLength=function(){return is.getBitsLength(this.data.length)};is.prototype.write=function(e){var r,i,n;for(r=0;r+3<=this.data.length;r+=3)i=this.data.substr(r,3),n=parseInt(i,10),e.put(n,10);var s=this.data.length-r;s>0&&(i=this.data.substr(r),n=parseInt(i,10),e.put(n,s*3+1))};var Wm=is,Gm=an,bc=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function ns(t){this.mode=Gm.ALPHANUMERIC,this.data=t}ns.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};ns.prototype.getLength=function(){return this.data.length};ns.prototype.getBitsLength=function(){return ns.getBitsLength(this.data.length)};ns.prototype.write=function(e){var r;for(r=0;r+2<=this.data.length;r+=2){var i=bc.indexOf(this.data[r])*45;i+=bc.indexOf(this.data[r+1]),e.put(i,11)}this.data.length%2&&e.put(bc.indexOf(this.data[r]),6)};var Ym=ns,Jm=on,Qm=an;function ss(t){this.mode=Qm.BYTE,this.data=Jm.from(t)}ss.getBitsLength=function(e){return e*8};ss.prototype.getLength=function(){return this.data.length};ss.prototype.getBitsLength=function(){return ss.getBitsLength(this.data.length)};ss.prototype.write=function(t){for(var e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var Xm=ss,Zm=an,e3=vr;function os(t){this.mode=Zm.KANJI,this.data=t}os.getBitsLength=function(e){return e*13};os.prototype.getLength=function(){return this.data.length};os.prototype.getBitsLength=function(){return os.getBitsLength(this.data.length)};os.prototype.write=function(t){var e;for(e=0;e<this.data.length;e++){var r=e3.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
8
- Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var t3=os;(function(t){var e=an,r=Wm,i=Ym,n=Xm,s=t3,o=gi,a=vr,h=o2;function f(j){return unescape(encodeURIComponent(j)).length}function p(j,R,K){for(var T=[],L;(L=j.exec(K))!==null;)T.push({data:L[0],index:L.index,mode:R,length:L[0].length});return T}function v(j){var R=p(o.NUMERIC,e.NUMERIC,j),K=p(o.ALPHANUMERIC,e.ALPHANUMERIC,j),T,L;a.isKanjiModeEnabled()?(T=p(o.BYTE,e.BYTE,j),L=p(o.KANJI,e.KANJI,j)):(T=p(o.BYTE_KANJI,e.BYTE,j),L=[]);var q=R.concat(K,T,L);return q.sort(function(y,P){return y.index-P.index}).map(function(y){return{data:y.data,mode:y.mode,length:y.length}})}function x(j,R){switch(R){case e.NUMERIC:return r.getBitsLength(j);case e.ALPHANUMERIC:return i.getBitsLength(j);case e.KANJI:return s.getBitsLength(j);case e.BYTE:return n.getBitsLength(j)}}function E(j){return j.reduce(function(R,K){var T=R.length-1>=0?R[R.length-1]:null;return T&&T.mode===K.mode?(R[R.length-1].data+=K.data,R):(R.push(K),R)},[])}function D(j){for(var R=[],K=0;K<j.length;K++){var T=j[K];switch(T.mode){case e.NUMERIC:R.push([T,{data:T.data,mode:e.ALPHANUMERIC,length:T.length},{data:T.data,mode:e.BYTE,length:T.length}]);break;case e.ALPHANUMERIC:R.push([T,{data:T.data,mode:e.BYTE,length:T.length}]);break;case e.KANJI:R.push([T,{data:T.data,mode:e.BYTE,length:f(T.data)}]);break;case e.BYTE:R.push([{data:T.data,mode:e.BYTE,length:f(T.data)}])}}return R}function B(j,R){for(var K={},T={start:{}},L=["start"],q=0;q<j.length;q++){for(var y=j[q],P=[],Z=0;Z<y.length;Z++){var ne=y[Z],U=""+q+Z;P.push(U),K[U]={node:ne,lastCount:0},T[U]={};for(var b=0;b<L.length;b++){var c=L[b];K[c]&&K[c].node.mode===ne.mode?(T[c][U]=x(K[c].lastCount+ne.length,ne.mode)-x(K[c].lastCount,ne.mode),K[c].lastCount+=ne.length):(K[c]&&(K[c].lastCount=ne.length),T[c][U]=x(ne.length,ne.mode)+4+e.getCharCountIndicator(ne.mode,R))}}L=P}for(b=0;b<L.length;b++)T[L[b]].end=0;return{map:T,table:K}}function F(j,R){var K,T=e.getBestModeForData(j);if(K=e.from(R,T),K!==e.BYTE&&K.bit<T.bit)throw new Error('"'+j+'" cannot be encoded with mode '+e.toString(K)+`.
9
- Suggested mode is: `+e.toString(T));switch(K===e.KANJI&&!a.isKanjiModeEnabled()&&(K=e.BYTE),K){case e.NUMERIC:return new r(j);case e.ALPHANUMERIC:return new i(j);case e.KANJI:return new s(j);case e.BYTE:return new n(j)}}t.fromArray=function(R){return R.reduce(function(K,T){return typeof T=="string"?K.push(F(T,null)):T.data&&K.push(F(T.data,T.mode)),K},[])},t.fromString=function(R,K){for(var T=v(R,a.isKanjiModeEnabled()),L=D(T),q=B(L,K),y=h.find_path(q.map,"start","end"),P=[],Z=1;Z<y.length-1;Z++)P.push(q.table[y[Z]].node);return t.fromArray(E(P))},t.rawSplit=function(R){return t.fromArray(v(R,a.isKanjiModeEnabled()))}})(Yd);var du=on,Ka=vr,vc=$a,r3=Bm,i3=Fm,n3=Ud,s3=kd,sf=$d,of=qa,o3=km,aa=Hd,a3=Wd,c3=an,mc=Yd,f3=Jf;function h3(t,e){for(var r=t.size,i=s3.getPositions(e),n=0;n<i.length;n++)for(var s=i[n][0],o=i[n][1],a=-1;a<=7;a++)if(!(s+a<=-1||r<=s+a))for(var h=-1;h<=7;h++)o+h<=-1||r<=o+h||(a>=0&&a<=6&&(h===0||h===6)||h>=0&&h<=6&&(a===0||a===6)||a>=2&&a<=4&&h>=2&&h<=4?t.set(s+a,o+h,!0,!0):t.set(s+a,o+h,!1,!0))}function u3(t){for(var e=t.size,r=8;r<e-8;r++){var i=r%2===0;t.set(r,6,i,!0),t.set(6,r,i,!0)}}function l3(t,e){for(var r=n3.getPositions(e),i=0;i<r.length;i++)for(var n=r[i][0],s=r[i][1],o=-2;o<=2;o++)for(var a=-2;a<=2;a++)o===-2||o===2||a===-2||a===2||o===0&&a===0?t.set(n+o,s+a,!0,!0):t.set(n+o,s+a,!1,!0)}function d3(t,e){for(var r=t.size,i=aa.getEncodedBits(e),n,s,o,a=0;a<18;a++)n=Math.floor(a/3),s=a%3+r-8-3,o=(i>>a&1)===1,t.set(n,s,o,!0),t.set(s,n,o,!0)}function yc(t,e,r){var i=t.size,n=a3.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(i-15+s,8,o,!0),s<8?t.set(8,i-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(i-8,8,1,!0)}function p3(t,e){for(var r=t.size,i=-1,n=r-1,s=7,o=0,a=r-1;a>0;a-=2)for(a===6&&a--;;){for(var h=0;h<2;h++)if(!t.isReserved(n,a-h)){var f=!1;o<e.length&&(f=(e[o]>>>s&1)===1),t.set(n,a-h,f),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}function g3(t,e,r){var i=new r3;r.forEach(function(f){i.put(f.mode.bit,4),i.put(f.getLength(),c3.getCharCountIndicator(f.mode,t)),f.write(i)});var n=Ka.getSymbolTotalCodewords(t),s=of.getTotalCodewordsCount(t,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);for(var a=(o-i.getLengthInBits())/8,h=0;h<a;h++)i.put(h%2?17:236,8);return b3(i,t,e)}function b3(t,e,r){for(var i=Ka.getSymbolTotalCodewords(e),n=of.getTotalCodewordsCount(e,r),s=i-n,o=of.getBlocksCount(e,r),a=i%o,h=o-a,f=Math.floor(i/o),p=Math.floor(s/o),v=p+1,x=f-p,E=new o3(x),D=0,B=new Array(o),F=new Array(o),j=0,R=du.from(t.buffer),K=0;K<o;K++){var T=K<h?p:v;B[K]=R.slice(D,D+T),F[K]=E.encode(B[K]),D+=T,j=Math.max(j,T)}var L=du.alloc(i),q=0,y,P;for(y=0;y<j;y++)for(P=0;P<o;P++)y<B[P].length&&(L[q++]=B[P][y]);for(y=0;y<x;y++)for(P=0;P<o;P++)L[q++]=F[P][y];return L}function v3(t,e,r,i){var n;if(f3(t))n=mc.fromArray(t);else if(typeof t=="string"){var s=e;if(!s){var o=mc.rawSplit(t);s=aa.getBestVersionForData(o,r)}n=mc.fromString(t,s||40)}else throw new Error("Invalid data");var a=aa.getBestVersionForData(n,r);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`
10
- The chosen QR Code version cannot contain this amount of data.
11
- Minimum version required to store current data is: `+a+`.
12
- `);var h=g3(e,r,n),f=Ka.getSymbolSize(e),p=new i3(f);return h3(p,e),u3(p),l3(p,e),yc(p,r,0),e>=7&&d3(p,e),p3(p,h),isNaN(i)&&(i=sf.getBestMask(p,yc.bind(null,p,r))),sf.applyMask(i,p),yc(p,r,i),{modules:p,version:e,errorCorrectionLevel:r,maskPattern:i,segments:n}}Od.create=function(e,r){if(typeof e>"u"||e==="")throw new Error("No input text");var i=vc.M,n,s;return typeof r<"u"&&(i=vc.from(r.errorCorrectionLevel,vc.M),n=aa.from(r.version),s=sf.from(r.maskPattern),r.toSJISFunc&&Ka.setToSJISFunction(r.toSJISFunc)),v3(e,n,i,s)};var Jd={},th={};(function(t){function e(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");var i=r.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+r);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(s){return[s,s]}))),i.length===6&&i.push("F","F");var n=parseInt(i.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+i.slice(0,6).join("")}}t.getOptions=function(i){i||(i={}),i.color||(i.color={});var n=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,s=i.width&&i.width>=21?i.width:void 0,o=i.scale||4;return{width:s,scale:s?4:o,margin:n,color:{dark:e(i.color.dark||"#000000ff"),light:e(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},t.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},t.getImageWidth=function(i,n){var s=t.getScale(i,n);return Math.floor((i+n.margin*2)*s)},t.qrToImageData=function(i,n,s){for(var o=n.modules.size,a=n.modules.data,h=t.getScale(o,s),f=Math.floor((o+s.margin*2)*h),p=s.margin*h,v=[s.color.light,s.color.dark],x=0;x<f;x++)for(var E=0;E<f;E++){var D=(x*f+E)*4,B=s.color.light;if(x>=p&&E>=p&&x<f-p&&E<f-p){var F=Math.floor((x-p)/h),j=Math.floor((E-p)/h);B=v[a[F*o+j]?1:0]}i[D++]=B.r,i[D++]=B.g,i[D++]=B.b,i[D]=B.a}}})(th);(function(t){var e=th;function r(n,s,o){n.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=o,s.width=o,s.style.height=o+"px",s.style.width=o+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}t.render=function(s,o,a){var h=a,f=o;typeof h>"u"&&(!o||!o.getContext)&&(h=o,o=void 0),o||(f=i()),h=e.getOptions(h);var p=e.getImageWidth(s.modules.size,h),v=f.getContext("2d"),x=v.createImageData(p,p);return e.qrToImageData(x.data,s,h),r(v,f,p),v.putImageData(x,0,0),f},t.renderToDataURL=function(s,o,a){var h=a;typeof h>"u"&&(!o||!o.getContext)&&(h=o,o=void 0),h||(h={});var f=t.render(s,o,h),p=h.type||"image/png",v=h.rendererOpts||{};return f.toDataURL(p,v.quality)}})(Jd);var Qd={},m3=th;function pu(t,e){var r=t.a/255,i=e+'="'+t.hex+'"';return r<1?i+" "+e+'-opacity="'+r.toFixed(2).slice(1)+'"':i}function wc(t,e,r){var i=t+e;return typeof r<"u"&&(i+=" "+r),i}function y3(t,e,r){for(var i="",n=0,s=!1,o=0,a=0;a<t.length;a++){var h=Math.floor(a%e),f=Math.floor(a/e);!h&&!s&&(s=!0),t[a]?(o++,a>0&&h>0&&t[a-1]||(i+=s?wc("M",h+r,.5+f+r):wc("m",n,0),n=0,s=!1),h+1<e&&t[a+1]||(i+=wc("h",o),o=0)):n++}return i}Qd.render=function(e,r,i){var n=m3.getOptions(r),s=e.modules.size,o=e.modules.data,a=s+n.margin*2,h=n.color.light.a?"<path "+pu(n.color.light,"fill")+' d="M0 0h'+a+"v"+a+'H0z"/>':"",f="<path "+pu(n.color.dark,"stroke")+' d="'+y3(o,s,n.margin)+'"/>',p='viewBox="0 0 '+a+" "+a+'"',v=n.width?'width="'+n.width+'" height="'+n.width+'" ':"",x='<svg xmlns="http://www.w3.org/2000/svg" '+v+p+' shape-rendering="crispEdges">'+h+f+`</svg>
13
- `;return typeof i=="function"&&i(null,x),x};var w3=Am,af=Od,Xd=Jd,_3=Qd;function rh(t,e,r,i,n){var s=[].slice.call(arguments,1),o=s.length,a=typeof s[o-1]=="function";if(!a&&!w3())throw new Error("Callback required as last argument");if(a){if(o<2)throw new Error("Too few arguments provided");o===2?(n=r,r=e,e=i=void 0):o===3&&(e.getContext&&typeof n>"u"?(n=i,i=void 0):(n=i,i=r,r=e,e=void 0))}else{if(o<1)throw new Error("Too few arguments provided");return o===1?(r=e,e=i=void 0):o===2&&!e.getContext&&(i=r,r=e,e=void 0),new Promise(function(f,p){try{var v=af.create(r,i);f(t(v,e,i))}catch(x){p(x)}})}try{var h=af.create(r,i);n(null,t(h,e,i))}catch(f){n(f)}}go.create=af.create;go.toCanvas=rh.bind(null,Xd.render);go.toDataURL=rh.bind(null,Xd.renderToDataURL);go.toString=rh.bind(null,function(t,e,r){return _3.render(t,r)});var je,Gs,ih,Zd,gu,nh,e1,Ui={},ja=[],E3=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function Li(t,e){for(var r in e)t[r]=e[r];return t}function t1(t){var e=t.parentNode;e&&e.removeChild(t)}function Ki(t,e,r){var i,n=arguments,s={};for(i in e)i!=="key"&&i!=="ref"&&(s[i]=e[i]);if(arguments.length>3)for(r=[r],i=3;i<arguments.length;i++)r.push(n[i]);if(r!=null&&(s.children=r),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)s[i]===void 0&&(s[i]=t.defaultProps[i]);return ca(t,s,e&&e.key,e&&e.ref,null)}function ca(t,e,r,i,n){var s={type:t,props:e,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n};return n==null&&(s.__v=s),je.vnode&&je.vnode(s),s}function r1(){return{}}function vo(t){return t.children}function Kr(t,e){this.props=t,this.context=e}function ro(t,e){if(e==null)return t.__?ro(t.__,t.__.__k.indexOf(t)+1):null;for(var r;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null)return r.__e;return typeof t.type=="function"?ro(t):null}function i1(t){var e,r;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((r=t.__k[e])!=null&&r.__e!=null){t.__e=t.__c.base=r.__e;break}return i1(t)}}function Wo(t){(!t.__d&&(t.__d=!0)&&Gs.push(t)&&!ih++||gu!==je.debounceRendering)&&((gu=je.debounceRendering)||Zd)(A3)}function A3(){for(var t;ih=Gs.length;)t=Gs.sort(function(e,r){return e.__v.__b-r.__v.__b}),Gs=[],t.some(function(e){var r,i,n,s,o,a,h;e.__d&&(a=(o=(r=e).__v).__e,(h=r.__P)&&(i=[],(n=Li({},o)).__v=n,s=sh(h,o,n,r.__n,h.ownerSVGElement!==void 0,null,i,a??ro(o)),s1(i,o),s!=a&&i1(o)))})}function n1(t,e,r,i,n,s,o,a,h){var f,p,v,x,E,D,B,F=r&&r.__k||ja,j=F.length;if(a==Ui&&(a=s!=null?s[0]:j?ro(r,0):null),f=0,e.__k=rn(e.__k,function(R){if(R!=null){if(R.__=e,R.__b=e.__b+1,(v=F[f])===null||v&&R.key==v.key&&R.type===v.type)F[f]=void 0;else for(p=0;p<j;p++){if((v=F[p])&&R.key==v.key&&R.type===v.type){F[p]=void 0;break}v=null}if(x=sh(t,R,v=v||Ui,i,n,s,o,a,h),(p=R.ref)&&v.ref!=p&&(B||(B=[]),v.ref&&B.push(v.ref,null,R),B.push(p,R.__c||x,R)),x!=null){var K;if(D==null&&(D=x),R.__d!==void 0)K=R.__d,R.__d=void 0;else if(s==v||x!=a||x.parentNode==null){e:if(a==null||a.parentNode!==t)t.appendChild(x),K=null;else{for(E=a,p=0;(E=E.nextSibling)&&p<j;p+=2)if(E==x)break e;t.insertBefore(x,a),K=a}e.type=="option"&&(t.value="")}a=K!==void 0?K:x.nextSibling,typeof e.type=="function"&&(e.__d=a)}else a&&v.__e==a&&a.parentNode!=t&&(a=ro(v))}return f++,R}),e.__e=D,s!=null&&typeof e.type!="function")for(f=s.length;f--;)s[f]!=null&&t1(s[f]);for(f=j;f--;)F[f]!=null&&Ys(F[f],F[f]);if(B)for(f=0;f<B.length;f++)o1(B[f],B[++f],B[++f])}function rn(t,e,r){if(r==null&&(r=[]),t==null||typeof t=="boolean")e&&r.push(e(null));else if(Array.isArray(t))for(var i=0;i<t.length;i++)rn(t[i],e,r);else r.push(e?e(typeof t=="string"||typeof t=="number"?ca(null,t,null,null,t):t.__e!=null||t.__c!=null?ca(t.type,t.props,t.key,null,t.__v):t):t);return r}function x3(t,e,r,i,n){var s;for(s in r)s==="children"||s==="key"||s in e||fa(t,s,null,r[s],i);for(s in e)n&&typeof e[s]!="function"||s==="children"||s==="key"||s==="value"||s==="checked"||r[s]===e[s]||fa(t,s,e[s],r[s],i)}function bu(t,e,r){e[0]==="-"?t.setProperty(e,r):t[e]=typeof r=="number"&&E3.test(e)===!1?r+"px":r??""}function fa(t,e,r,i,n){var s,o,a,h,f;if(n?e==="className"&&(e="class"):e==="class"&&(e="className"),e==="style")if(s=t.style,typeof r=="string")s.cssText=r;else{if(typeof i=="string"&&(s.cssText="",i=null),i)for(h in i)r&&h in r||bu(s,h,"");if(r)for(f in r)i&&r[f]===i[f]||bu(s,f,r[f])}else e[0]==="o"&&e[1]==="n"?(o=e!==(e=e.replace(/Capture$/,"")),a=e.toLowerCase(),e=(a in t?a:e).slice(2),r?(i||t.addEventListener(e,vu,o),(t.l||(t.l={}))[e]=r):t.removeEventListener(e,vu,o)):e!=="list"&&e!=="tagName"&&e!=="form"&&e!=="type"&&e!=="size"&&!n&&e in t?t[e]=r??"":typeof r!="function"&&e!=="dangerouslySetInnerHTML"&&(e!==(e=e.replace(/^xlink:?/,""))?r==null||r===!1?t.removeAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase()):t.setAttributeNS("http://www.w3.org/1999/xlink",e.toLowerCase(),r):r==null||r===!1&&!/^ar/.test(e)?t.removeAttribute(e):t.setAttribute(e,r))}function vu(t){this.l[t.type](je.event?je.event(t):t)}function sh(t,e,r,i,n,s,o,a,h){var f,p,v,x,E,D,B,F,j,R,K=e.type;if(e.constructor!==void 0)return null;(f=je.__b)&&f(e);try{e:if(typeof K=="function"){if(F=e.props,j=(f=K.contextType)&&i[f.__c],R=f?j?j.props.value:f.__:i,r.__c?B=(p=e.__c=r.__c).__=p.__E:("prototype"in K&&K.prototype.render?e.__c=p=new K(F,R):(e.__c=p=new Kr(F,R),p.constructor=K,p.render=M3),j&&j.sub(p),p.props=F,p.state||(p.state={}),p.context=R,p.__n=i,v=p.__d=!0,p.__h=[]),p.__s==null&&(p.__s=p.state),K.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Li({},p.__s)),Li(p.__s,K.getDerivedStateFromProps(F,p.__s))),x=p.props,E=p.state,v)K.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(K.getDerivedStateFromProps==null&&F!==x&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(F,R),!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(F,p.__s,R)===!1||e.__v===r.__v&&!p.__){for(p.props=F,p.state=p.__s,e.__v!==r.__v&&(p.__d=!1),p.__v=e,e.__e=r.__e,e.__k=r.__k,p.__h.length&&o.push(p),f=0;f<e.__k.length;f++)e.__k[f]&&(e.__k[f].__=e);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(F,p.__s,R),p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(x,E,D)})}p.context=R,p.props=F,p.state=p.__s,(f=je.__r)&&f(e),p.__d=!1,p.__v=e,p.__P=t,f=p.render(p.props,p.state,p.context),e.__k=f!=null&&f.type==vo&&f.key==null?f.props.children:Array.isArray(f)?f:[f],p.getChildContext!=null&&(i=Li(Li({},i),p.getChildContext())),v||p.getSnapshotBeforeUpdate==null||(D=p.getSnapshotBeforeUpdate(x,E)),n1(t,e,r,i,n,s,o,a,h),p.base=e.__e,p.__h.length&&o.push(p),B&&(p.__E=p.__=null),p.__e=!1}else s==null&&e.__v===r.__v?(e.__k=r.__k,e.__e=r.__e):e.__e=S3(r.__e,e,r,i,n,s,o,h);(f=je.diffed)&&f(e)}catch(T){e.__v=null,je.__e(T,e,r)}return e.__e}function s1(t,e){je.__c&&je.__c(e,t),t.some(function(r){try{t=r.__h,r.__h=[],t.some(function(i){i.call(r)})}catch(i){je.__e(i,r.__v)}})}function S3(t,e,r,i,n,s,o,a){var h,f,p,v,x,E=r.props,D=e.props;if(n=e.type==="svg"||n,s!=null){for(h=0;h<s.length;h++)if((f=s[h])!=null&&((e.type===null?f.nodeType===3:f.localName===e.type)||t==f)){t=f,s[h]=null;break}}if(t==null){if(e.type===null)return document.createTextNode(D);t=n?document.createElementNS("http://www.w3.org/2000/svg",e.type):document.createElement(e.type,D.is&&{is:D.is}),s=null,a=!1}if(e.type===null)E!==D&&t.data!=D&&(t.data=D);else{if(s!=null&&(s=ja.slice.call(t.childNodes)),p=(E=r.props||Ui).dangerouslySetInnerHTML,v=D.dangerouslySetInnerHTML,!a){if(E===Ui)for(E={},x=0;x<t.attributes.length;x++)E[t.attributes[x].name]=t.attributes[x].value;(v||p)&&(v&&p&&v.__html==p.__html||(t.innerHTML=v&&v.__html||""))}x3(t,D,E,n,a),v?e.__k=[]:(e.__k=e.props.children,n1(t,e,r,i,e.type!=="foreignObject"&&n,s,o,Ui,a)),a||("value"in D&&(h=D.value)!==void 0&&h!==t.value&&fa(t,"value",h,E.value,!1),"checked"in D&&(h=D.checked)!==void 0&&h!==t.checked&&fa(t,"checked",h,E.checked,!1))}return t}function o1(t,e,r){try{typeof t=="function"?t(e):t.current=e}catch(i){je.__e(i,r)}}function Ys(t,e,r){var i,n,s;if(je.unmount&&je.unmount(t),(i=t.ref)&&(i.current&&i.current!==t.__e||o1(i,null,e)),r||typeof t.type=="function"||(r=(n=t.__e)!=null),t.__e=t.__d=void 0,(i=t.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){je.__e(o,e)}i.base=i.__P=null}if(i=t.__k)for(s=0;s<i.length;s++)i[s]&&Ys(i[s],e,r);n!=null&&t1(n)}function M3(t,e,r){return this.constructor(t,r)}function io(t,e,r){var i,n,s;je.__&&je.__(t,e),n=(i=r===nh)?null:r&&r.__k||e.__k,t=Ki(vo,null,[t]),s=[],sh(e,(i?e:r||e).__k=t,n||Ui,Ui,e.ownerSVGElement!==void 0,r&&!i?[r]:n?null:ja.slice.call(e.childNodes),s,r||Ui,i),s1(s,t)}function a1(t,e){io(t,e,nh)}function I3(t,e){var r,i;for(i in e=Li(Li({},t.props),e),arguments.length>2&&(e.children=ja.slice.call(arguments,2)),r={},e)i!=="key"&&i!=="ref"&&(r[i]=e[i]);return ca(t.type,r,e.key||t.key,e.ref||t.ref,null)}function c1(t){var e={},r={__c:"__cC"+e1++,__:t,Consumer:function(i,n){return i.children(n)},Provider:function(i){var n,s=this;return this.getChildContext||(n=[],this.getChildContext=function(){return e[r.__c]=s,e},this.shouldComponentUpdate=function(o){s.props.value!==o.value&&n.some(function(a){a.context=o.value,Wo(a)})},this.sub=function(o){n.push(o);var a=o.componentWillUnmount;o.componentWillUnmount=function(){n.splice(n.indexOf(o),1),a&&a.call(o)}}),i.children}};return r.Consumer.contextType=r,r.Provider.__=r,r}je={__e:function(t,e){for(var r,i;e=e.__;)if((r=e.__c)&&!r.__)try{if(r.constructor&&r.constructor.getDerivedStateFromError!=null&&(i=!0,r.setState(r.constructor.getDerivedStateFromError(t))),r.componentDidCatch!=null&&(i=!0,r.componentDidCatch(t)),i)return Wo(r.__E=r)}catch(n){t=n}throw t}},Kr.prototype.setState=function(t,e){var r;r=this.__s!==this.state?this.__s:this.__s=Li({},this.state),typeof t=="function"&&(t=t(r,this.props)),t&&Li(r,t),t!=null&&this.__v&&(e&&this.__h.push(e),Wo(this))},Kr.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Wo(this))},Kr.prototype.render=vo,Gs=[],ih=0,Zd=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,nh=Ui,e1=0;var On,ar,mu,as=0,cf=[],yu=je.__r,wu=je.diffed,_u=je.__c,Eu=je.unmount;function ys(t,e){je.__h&&je.__h(ar,t,as||e),as=0;var r=ar.__H||(ar.__H={__:[],__h:[]});return t>=r.__.length&&r.__.push({}),r.__[t]}function oh(t){return as=1,ah(g1,t)}function ah(t,e,r){var i=ys(On++,2);return i.__c||(i.__c=ar,i.__=[r?r(e):g1(void 0,e),function(n){var s=t(i.__[0],n);i.__[0]!==s&&(i.__[0]=s,i.__c.setState({}))}]),i.__}function f1(t,e){var r=ys(On++,3);!je.__s&&fh(r.__H,e)&&(r.__=t,r.__H=e,ar.__H.__h.push(r))}function ch(t,e){var r=ys(On++,4);!je.__s&&fh(r.__H,e)&&(r.__=t,r.__H=e,ar.__h.push(r))}function h1(t){return as=5,Ha(function(){return{current:t}},[])}function u1(t,e,r){as=6,ch(function(){typeof t=="function"?t(e()):t&&(t.current=e())},r==null?r:r.concat(t))}function Ha(t,e){var r=ys(On++,7);return fh(r.__H,e)?(r.__H=e,r.__h=t,r.__=t()):r.__}function l1(t,e){return as=8,Ha(function(){return t},e)}function d1(t){var e=ar.context[t.__c],r=ys(On++,9);return r.__c=t,e?(r.__==null&&(r.__=!0,e.sub(ar)),e.props.value):t.__}function p1(t,e){je.useDebugValue&&je.useDebugValue(e?e(t):t)}function D3(t){var e=ys(On++,10),r=oh();return e.__=t,ar.componentDidCatch||(ar.componentDidCatch=function(i){e.__&&e.__(i),r[1](i)}),[r[0],function(){r[1](void 0)}]}function C3(){cf.some(function(t){if(t.__P)try{t.__H.__h.forEach(ff),t.__H.__h.forEach(hf),t.__H.__h=[]}catch(e){return t.__H.__h=[],je.__e(e,t.__v),!0}}),cf=[]}function ff(t){t.t&&t.t()}function hf(t){var e=t.__();typeof e=="function"&&(t.t=e)}function fh(t,e){return!t||e.some(function(r,i){return r!==t[i]})}function g1(t,e){return typeof e=="function"?e(t):e}je.__r=function(t){yu&&yu(t),On=0,(ar=t.__c).__H&&(ar.__H.__h.forEach(ff),ar.__H.__h.forEach(hf),ar.__H.__h=[])},je.diffed=function(t){wu&&wu(t);var e=t.__c;if(e){var r=e.__H;r&&r.__h.length&&(cf.push(e)!==1&&mu===je.requestAnimationFrame||((mu=je.requestAnimationFrame)||function(i){var n,s=function(){clearTimeout(o),cancelAnimationFrame(n),setTimeout(i)},o=setTimeout(s,100);typeof window<"u"&&(n=requestAnimationFrame(s))})(C3))}},je.__c=function(t,e){e.some(function(r){try{r.__h.forEach(ff),r.__h=r.__h.filter(function(i){return!i.__||hf(i)})}catch(i){e.some(function(n){n.__h&&(n.__h=[])}),e=[],je.__e(i,r.__v)}}),_u&&_u(t,e)},je.unmount=function(t){Eu&&Eu(t);var e=t.__c;if(e){var r=e.__H;if(r)try{r.__.forEach(function(i){return i.t&&i.t()})}catch(i){je.__e(i,e.__v)}}};function hh(t,e){for(var r in e)t[r]=e[r];return t}function uf(t,e){for(var r in t)if(r!=="__source"&&!(r in e))return!0;for(var i in e)if(i!=="__source"&&t[i]!==e[i])return!0;return!1}var b1=function(t){var e,r;function i(n){var s;return(s=t.call(this,n)||this).isPureReactComponent=!0,s}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i.prototype.shouldComponentUpdate=function(n,s){return uf(this.props,n)||uf(this.state,s)},i}(Kr);function v1(t,e){function r(n){var s=this.props.ref,o=s==n.ref;return!o&&s&&(s.call?s(null):s.current=null),e?!e(this.props,n)||!o:uf(this.props,n)}function i(n){return this.shouldComponentUpdate=r,Ki(t,hh({},n))}return i.prototype.isReactComponent=!0,i.displayName="Memo("+(t.displayName||t.name)+")",i.t=!0,i}var Au=je.__b;function m1(t){function e(r){var i=hh({},r);return delete i.ref,t(i,r.ref)}return e.prototype.isReactComponent=e.t=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}je.__b=function(t){t.type&&t.type.t&&t.ref&&(t.props.ref=t.ref,t.ref=null),Au&&Au(t)};var xu=function(t,e){return t?rn(t).reduce(function(r,i,n){return r.concat(e(i,n))},[]):null},y1={map:xu,forEach:xu,count:function(t){return t?rn(t).length:0},only:function(t){if((t=rn(t)).length!==1)throw new Error("Children.only() expects only one child.");return t[0]},toArray:rn},N3=je.__e;function w1(t){return t&&((t=hh({},t)).__c=null,t.__k=t.__k&&t.__k.map(w1)),t}function ha(){this.__u=0,this.o=null,this.__b=null}function _1(t){var e=t.__.__c;return e&&e.u&&e.u(t)}function E1(t){var e,r,i;function n(s){if(e||(e=t()).then(function(o){r=o.default||o},function(o){i=o}),i)throw i;if(!r)throw e;return Ki(r,s)}return n.displayName="Lazy",n.t=!0,n}function Gn(){this.i=null,this.l=null}je.__e=function(t,e,r){if(t.then){for(var i,n=e;n=n.__;)if((i=n.__c)&&i.__c)return i.__c(t,e.__c)}N3(t,e,r)},(ha.prototype=new Kr).__c=function(t,e){var r=this;r.o==null&&(r.o=[]),r.o.push(e);var i=_1(r.__v),n=!1,s=function(){n||(n=!0,i?i(o):o())};e.__c=e.componentWillUnmount,e.componentWillUnmount=function(){s(),e.__c&&e.__c()};var o=function(){var a;if(!--r.__u)for(r.__v.__k[0]=r.state.u,r.setState({u:r.__b=null});a=r.o.pop();)a.forceUpdate()};r.__u++||r.setState({u:r.__b=r.__v.__k[0]}),t.then(s,s)},ha.prototype.render=function(t,e){return this.__b&&(this.__v.__k[0]=w1(this.__b),this.__b=null),[Ki(Kr,null,e.u?null:t.children),e.u&&t.fallback]};var Su=function(t,e,r){if(++r[1]===r[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(r=t.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;t.i=r=r[2]}};(Gn.prototype=new Kr).u=function(t){var e=this,r=_1(e.__v),i=e.l.get(t);return i[0]++,function(n){var s=function(){e.props.revealOrder?(i.push(n),Su(e,t,i)):n()};r?r(s):s()}},Gn.prototype.render=function(t){this.i=null,this.l=new Map;var e=rn(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var r=e.length;r--;)this.l.set(e[r],this.i=[1,0,this.i]);return t.children},Gn.prototype.componentDidUpdate=Gn.prototype.componentDidMount=function(){var t=this;t.l.forEach(function(e,r){Su(t,r,e)})};var T3=function(){function t(){}var e=t.prototype;return e.getChildContext=function(){return this.props.context},e.render=function(r){return r.children},t}();function R3(t){var e=this,r=t.container,i=Ki(T3,{context:e.context},t.vnode);return e.s&&e.s!==r&&(e.v.parentNode&&e.s.removeChild(e.v),Ys(e.h),e.p=!1),t.vnode?e.p?(r.__k=e.__k,io(i,r),e.__k=r.__k):(e.v=document.createTextNode(""),a1("",r),r.appendChild(e.v),e.p=!0,e.s=r,io(i,r,e.v),e.__k=e.v.__k):e.p&&(e.v.parentNode&&e.s.removeChild(e.v),Ys(e.h)),e.h=i,e.componentWillUnmount=function(){e.v.parentNode&&e.s.removeChild(e.v),Ys(e.h)},null}function A1(t,e){return Ki(R3,{vnode:t,container:e})}var Mu=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;Kr.prototype.isReactComponent={};var x1=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103;function lf(t,e,r){if(e.__k==null)for(;e.firstChild;)e.removeChild(e.firstChild);return io(t,e),typeof r=="function"&&r(),t?t.__c:null}function O3(t,e,r){return a1(t,e),typeof r=="function"&&r(),t?t.__c:null}var Iu=je.event;function _c(t,e){t["UNSAFE_"+e]&&!t[e]&&Object.defineProperty(t,e,{configurable:!1,get:function(){return this["UNSAFE_"+e]},set:function(r){this["UNSAFE_"+e]=r}})}je.event=function(t){Iu&&(t=Iu(t)),t.persist=function(){};var e=!1,r=!1,i=t.stopPropagation;t.stopPropagation=function(){i.call(t),e=!0};var n=t.preventDefault;return t.preventDefault=function(){n.call(t),r=!0},t.isPropagationStopped=function(){return e},t.isDefaultPrevented=function(){return r},t.nativeEvent=t};var Du={configurable:!0,get:function(){return this.class}},Cu=je.vnode;je.vnode=function(t){t.$$typeof=x1;var e=t.type,r=t.props;if(e){if(r.class!=r.className&&(Du.enumerable="className"in r,r.className!=null&&(r.class=r.className),Object.defineProperty(r,"className",Du)),typeof e!="function"){var i,n,s;for(s in r.defaultValue&&r.value!==void 0&&(r.value||r.value===0||(r.value=r.defaultValue),delete r.defaultValue),Array.isArray(r.value)&&r.multiple&&e==="select"&&(rn(r.children).forEach(function(o){r.value.indexOf(o.props.value)!=-1&&(o.props.selected=!0)}),delete r.value),r)if(i=Mu.test(s))break;if(i)for(s in n=t.props={},r)n[Mu.test(s)?s.replace(/[A-Z0-9]/,"-$&").toLowerCase():s]=r[s]}(function(o){var a=t.type,h=t.props;if(h&&typeof a=="string"){var f={};for(var p in h)/^on(Ani|Tra|Tou)/.test(p)&&(h[p.toLowerCase()]=h[p],delete h[p]),f[p.toLowerCase()]=p;if(f.ondoubleclick&&(h.ondblclick=h[f.ondoubleclick],delete h[f.ondoubleclick]),f.onbeforeinput&&(h.onbeforeinput=h[f.onbeforeinput],delete h[f.onbeforeinput]),f.onchange&&(a==="textarea"||a.toLowerCase()==="input"&&!/^fil|che|ra/i.test(h.type))){var v=f.oninput||"oninput";h[v]||(h[v]=h[f.onchange],delete h[f.onchange])}}})(),typeof e=="function"&&!e.m&&e.prototype&&(_c(e.prototype,"componentWillMount"),_c(e.prototype,"componentWillReceiveProps"),_c(e.prototype,"componentWillUpdate"),e.m=!0)}Cu&&Cu(t)};var P3="16.8.0";function S1(t){return Ki.bind(null,t)}function uh(t){return!!t&&t.$$typeof===x1}function M1(t){return uh(t)?I3.apply(null,arguments):t}function I1(t){return!!t.__k&&(io(null,t),!0)}function D1(t){return t&&(t.base||t.nodeType===1&&t)||null}var C1=function(t,e){return t(e)};const B3={useState:oh,useReducer:ah,useEffect:f1,useLayoutEffect:ch,useRef:h1,useImperativeHandle:u1,useMemo:Ha,useCallback:l1,useContext:d1,useDebugValue:p1,version:"16.8.0",Children:y1,render:lf,hydrate:lf,unmountComponentAtNode:I1,createPortal:A1,createElement:Ki,createContext:c1,createFactory:S1,cloneElement:M1,createRef:r1,Fragment:vo,isValidElement:uh,findDOMNode:D1,Component:Kr,PureComponent:b1,memo:v1,forwardRef:m1,unstable_batchedUpdates:C1,Suspense:ha,SuspenseList:Gn,lazy:E1},F3=Object.freeze(Object.defineProperty({__proto__:null,Children:y1,Component:Kr,Fragment:vo,PureComponent:b1,Suspense:ha,SuspenseList:Gn,cloneElement:M1,createContext:c1,createElement:Ki,createFactory:S1,createPortal:A1,createRef:r1,default:B3,findDOMNode:D1,forwardRef:m1,hydrate:O3,isValidElement:uh,lazy:E1,memo:v1,render:lf,unmountComponentAtNode:I1,unstable_batchedUpdates:C1,useCallback:l1,useContext:d1,useDebugValue:p1,useEffect:f1,useErrorBoundary:D3,useImperativeHandle:u1,useLayoutEffect:ch,useMemo:Ha,useReducer:ah,useRef:h1,useState:oh,version:P3},Symbol.toStringTag,{value:"Module"})),L3=Ma(F3);function N1(t){return t&&typeof t=="object"&&"default"in t?t.default:t}var Vt=Em,T1=N1(go),U3=N1(a2),ye=L3;function k3(t){T1.toString(t,{type:"terminal"}).then(console.log)}var $3=`:root {
14
- --animation-duration: 300ms;
15
- }
16
-
17
- @keyframes fadeIn {
18
- from {
19
- opacity: 0;
20
- }
21
- to {
22
- opacity: 1;
23
- }
24
- }
25
-
26
- @keyframes fadeOut {
27
- from {
28
- opacity: 1;
29
- }
30
- to {
31
- opacity: 0;
32
- }
33
- }
34
-
35
- .animated {
36
- animation-duration: var(--animation-duration);
37
- animation-fill-mode: both;
38
- }
39
-
40
- .fadeIn {
41
- animation-name: fadeIn;
42
- }
43
-
44
- .fadeOut {
45
- animation-name: fadeOut;
46
- }
47
-
48
- #walletconnect-wrapper {
49
- -webkit-user-select: none;
50
- align-items: center;
51
- display: flex;
52
- height: 100%;
53
- justify-content: center;
54
- left: 0;
55
- pointer-events: none;
56
- position: fixed;
57
- top: 0;
58
- user-select: none;
59
- width: 100%;
60
- z-index: 99999999999999;
61
- }
62
-
63
- .walletconnect-modal__headerLogo {
64
- height: 21px;
65
- }
66
-
67
- .walletconnect-modal__header p {
68
- color: #ffffff;
69
- font-size: 20px;
70
- font-weight: 600;
71
- margin: 0;
72
- align-items: flex-start;
73
- display: flex;
74
- flex: 1;
75
- margin-left: 5px;
76
- }
77
-
78
- .walletconnect-modal__close__wrapper {
79
- position: absolute;
80
- top: 0px;
81
- right: 0px;
82
- z-index: 10000;
83
- background: white;
84
- border-radius: 26px;
85
- padding: 6px;
86
- box-sizing: border-box;
87
- width: 26px;
88
- height: 26px;
89
- cursor: pointer;
90
- }
91
-
92
- .walletconnect-modal__close__icon {
93
- position: relative;
94
- top: 7px;
95
- right: 0;
96
- display: flex;
97
- align-items: center;
98
- justify-content: center;
99
- transform: rotate(45deg);
100
- }
101
-
102
- .walletconnect-modal__close__line1 {
103
- position: absolute;
104
- width: 100%;
105
- border: 1px solid rgb(48, 52, 59);
106
- }
107
-
108
- .walletconnect-modal__close__line2 {
109
- position: absolute;
110
- width: 100%;
111
- border: 1px solid rgb(48, 52, 59);
112
- transform: rotate(90deg);
113
- }
114
-
115
- .walletconnect-qrcode__base {
116
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
117
- background: rgba(37, 41, 46, 0.95);
118
- height: 100%;
119
- left: 0;
120
- pointer-events: auto;
121
- position: fixed;
122
- top: 0;
123
- transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);
124
- width: 100%;
125
- will-change: opacity;
126
- padding: 40px;
127
- box-sizing: border-box;
128
- }
129
-
130
- .walletconnect-qrcode__text {
131
- color: rgba(60, 66, 82, 0.6);
132
- font-size: 16px;
133
- font-weight: 600;
134
- letter-spacing: 0;
135
- line-height: 1.1875em;
136
- margin: 10px 0 20px 0;
137
- text-align: center;
138
- width: 100%;
139
- }
140
-
141
- @media only screen and (max-width: 768px) {
142
- .walletconnect-qrcode__text {
143
- font-size: 4vw;
144
- }
145
- }
146
-
147
- @media only screen and (max-width: 320px) {
148
- .walletconnect-qrcode__text {
149
- font-size: 14px;
150
- }
151
- }
152
-
153
- .walletconnect-qrcode__image {
154
- width: calc(100% - 30px);
155
- box-sizing: border-box;
156
- cursor: none;
157
- margin: 0 auto;
158
- }
159
-
160
- .walletconnect-qrcode__notification {
161
- position: absolute;
162
- bottom: 0;
163
- left: 0;
164
- right: 0;
165
- font-size: 16px;
166
- padding: 16px 20px;
167
- border-radius: 16px;
168
- text-align: center;
169
- transition: all 0.1s ease-in-out;
170
- background: white;
171
- color: black;
172
- margin-bottom: -60px;
173
- opacity: 0;
174
- }
175
-
176
- .walletconnect-qrcode__notification.notification__show {
177
- opacity: 1;
178
- }
179
-
180
- @media only screen and (max-width: 768px) {
181
- .walletconnect-modal__header {
182
- height: 130px;
183
- }
184
- .walletconnect-modal__base {
185
- overflow: auto;
186
- }
187
- }
188
-
189
- @media only screen and (min-device-width: 415px) and (max-width: 768px) {
190
- #content {
191
- max-width: 768px;
192
- box-sizing: border-box;
193
- }
194
- }
195
-
196
- @media only screen and (min-width: 375px) and (max-width: 415px) {
197
- #content {
198
- max-width: 414px;
199
- box-sizing: border-box;
200
- }
201
- }
202
-
203
- @media only screen and (min-width: 320px) and (max-width: 375px) {
204
- #content {
205
- max-width: 375px;
206
- box-sizing: border-box;
207
- }
208
- }
209
-
210
- @media only screen and (max-width: 320px) {
211
- #content {
212
- max-width: 320px;
213
- box-sizing: border-box;
214
- }
215
- }
216
-
217
- .walletconnect-modal__base {
218
- -webkit-font-smoothing: antialiased;
219
- background: #ffffff;
220
- border-radius: 24px;
221
- box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);
222
- font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,
223
- -apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
224
- "Open Sans", "Helvetica Neue", sans-serif;
225
- margin-top: 41px;
226
- padding: 24px 24px 22px;
227
- pointer-events: auto;
228
- position: relative;
229
- text-align: center;
230
- transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);
231
- will-change: transform;
232
- overflow: visible;
233
- transform: translateY(-50%);
234
- top: 50%;
235
- max-width: 500px;
236
- margin: auto;
237
- }
238
-
239
- @media only screen and (max-width: 320px) {
240
- .walletconnect-modal__base {
241
- padding: 24px 12px;
242
- }
243
- }
244
-
245
- .walletconnect-modal__base .hidden {
246
- transform: translateY(150%);
247
- transition: 0.125s cubic-bezier(0.4, 0, 1, 1);
248
- }
249
-
250
- .walletconnect-modal__header {
251
- align-items: center;
252
- display: flex;
253
- height: 26px;
254
- left: 0;
255
- justify-content: space-between;
256
- position: absolute;
257
- top: -42px;
258
- width: 100%;
259
- }
260
-
261
- .walletconnect-modal__base .wc-logo {
262
- align-items: center;
263
- display: flex;
264
- height: 26px;
265
- margin-top: 15px;
266
- padding-bottom: 15px;
267
- pointer-events: auto;
268
- }
269
-
270
- .walletconnect-modal__base .wc-logo div {
271
- background-color: #3399ff;
272
- height: 21px;
273
- margin-right: 5px;
274
- mask-image: url("images/wc-logo.svg") center no-repeat;
275
- width: 32px;
276
- }
277
-
278
- .walletconnect-modal__base .wc-logo p {
279
- color: #ffffff;
280
- font-size: 20px;
281
- font-weight: 600;
282
- margin: 0;
283
- }
284
-
285
- .walletconnect-modal__base h2 {
286
- color: rgba(60, 66, 82, 0.6);
287
- font-size: 16px;
288
- font-weight: 600;
289
- letter-spacing: 0;
290
- line-height: 1.1875em;
291
- margin: 0 0 19px 0;
292
- text-align: center;
293
- width: 100%;
294
- }
295
-
296
- .walletconnect-modal__base__row {
297
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
298
- align-items: center;
299
- border-radius: 20px;
300
- cursor: pointer;
301
- display: flex;
302
- height: 56px;
303
- justify-content: space-between;
304
- padding: 0 15px;
305
- position: relative;
306
- margin: 0px 0px 8px;
307
- text-align: left;
308
- transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
309
- will-change: transform;
310
- text-decoration: none;
311
- }
312
-
313
- .walletconnect-modal__base__row:hover {
314
- background: rgba(60, 66, 82, 0.06);
315
- }
316
-
317
- .walletconnect-modal__base__row:active {
318
- background: rgba(60, 66, 82, 0.06);
319
- transform: scale(0.975);
320
- transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
321
- }
322
-
323
- .walletconnect-modal__base__row__h3 {
324
- color: #25292e;
325
- font-size: 20px;
326
- font-weight: 700;
327
- margin: 0;
328
- padding-bottom: 3px;
329
- }
330
-
331
- .walletconnect-modal__base__row__right {
332
- align-items: center;
333
- display: flex;
334
- justify-content: center;
335
- }
336
-
337
- .walletconnect-modal__base__row__right__app-icon {
338
- border-radius: 8px;
339
- height: 34px;
340
- margin: 0 11px 2px 0;
341
- width: 34px;
342
- background-size: 100%;
343
- box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);
344
- }
345
-
346
- .walletconnect-modal__base__row__right__caret {
347
- height: 18px;
348
- opacity: 0.3;
349
- transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
350
- width: 8px;
351
- will-change: opacity;
352
- }
353
-
354
- .walletconnect-modal__base__row:hover .caret,
355
- .walletconnect-modal__base__row:active .caret {
356
- opacity: 0.6;
357
- }
358
-
359
- .walletconnect-modal__mobile__toggle {
360
- width: 80%;
361
- display: flex;
362
- margin: 0 auto;
363
- position: relative;
364
- overflow: hidden;
365
- border-radius: 8px;
366
- margin-bottom: 18px;
367
- background: #d4d5d9;
368
- }
369
-
370
- .walletconnect-modal__single_wallet {
371
- display: flex;
372
- justify-content: center;
373
- margin-top: 7px;
374
- margin-bottom: 18px;
375
- }
376
-
377
- .walletconnect-modal__single_wallet a {
378
- cursor: pointer;
379
- color: rgb(64, 153, 255);
380
- font-size: 21px;
381
- font-weight: 800;
382
- text-decoration: none !important;
383
- margin: 0 auto;
384
- }
385
-
386
- .walletconnect-modal__mobile__toggle_selector {
387
- width: calc(50% - 8px);
388
- background: white;
389
- position: absolute;
390
- border-radius: 5px;
391
- height: calc(100% - 8px);
392
- top: 4px;
393
- transition: all 0.2s ease-in-out;
394
- transform: translate3d(4px, 0, 0);
395
- }
396
-
397
- .walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {
398
- transform: translate3d(calc(100% + 12px), 0, 0);
399
- }
400
-
401
- .walletconnect-modal__mobile__toggle a {
402
- font-size: 12px;
403
- width: 50%;
404
- text-align: center;
405
- padding: 8px;
406
- margin: 0;
407
- font-weight: 600;
408
- z-index: 1;
409
- }
410
-
411
- .walletconnect-modal__footer {
412
- display: flex;
413
- justify-content: center;
414
- margin-top: 20px;
415
- }
416
-
417
- @media only screen and (max-width: 768px) {
418
- .walletconnect-modal__footer {
419
- margin-top: 5vw;
420
- }
421
- }
422
-
423
- .walletconnect-modal__footer a {
424
- cursor: pointer;
425
- color: #898d97;
426
- font-size: 15px;
427
- margin: 0 auto;
428
- }
429
-
430
- @media only screen and (max-width: 320px) {
431
- .walletconnect-modal__footer a {
432
- font-size: 14px;
433
- }
434
- }
435
-
436
- .walletconnect-connect__buttons__wrapper {
437
- max-height: 44vh;
438
- }
439
-
440
- .walletconnect-connect__buttons__wrapper__android {
441
- margin: 50% 0;
442
- }
443
-
444
- .walletconnect-connect__buttons__wrapper__wrap {
445
- display: grid;
446
- grid-template-columns: repeat(4, 1fr);
447
- margin: 10px 0;
448
- }
449
-
450
- @media only screen and (min-width: 768px) {
451
- .walletconnect-connect__buttons__wrapper__wrap {
452
- margin-top: 40px;
453
- }
454
- }
455
-
456
- .walletconnect-connect__button {
457
- background-color: rgb(64, 153, 255);
458
- padding: 12px;
459
- border-radius: 8px;
460
- text-decoration: none;
461
- color: rgb(255, 255, 255);
462
- font-weight: 500;
463
- }
464
-
465
- .walletconnect-connect__button__icon_anchor {
466
- cursor: pointer;
467
- display: flex;
468
- justify-content: flex-start;
469
- align-items: center;
470
- margin: 8px;
471
- width: 42px;
472
- justify-self: center;
473
- flex-direction: column;
474
- text-decoration: none !important;
475
- }
476
-
477
- @media only screen and (max-width: 320px) {
478
- .walletconnect-connect__button__icon_anchor {
479
- margin: 4px;
480
- }
481
- }
482
-
483
- .walletconnect-connect__button__icon {
484
- border-radius: 10px;
485
- height: 42px;
486
- margin: 0;
487
- width: 42px;
488
- background-size: cover !important;
489
- box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);
490
- }
491
-
492
- .walletconnect-connect__button__text {
493
- color: #424952;
494
- font-size: 2.7vw;
495
- text-decoration: none !important;
496
- padding: 0;
497
- margin-top: 1.8vw;
498
- font-weight: 600;
499
- }
500
-
501
- @media only screen and (min-width: 768px) {
502
- .walletconnect-connect__button__text {
503
- font-size: 16px;
504
- margin-top: 12px;
505
- }
506
- }
507
-
508
- .walletconnect-search__input {
509
- border: none;
510
- background: #d4d5d9;
511
- border-style: none;
512
- padding: 8px 16px;
513
- outline: none;
514
- font-style: normal;
515
- font-stretch: normal;
516
- font-size: 16px;
517
- font-style: normal;
518
- font-stretch: normal;
519
- line-height: normal;
520
- letter-spacing: normal;
521
- text-align: left;
522
- border-radius: 8px;
523
- width: calc(100% - 16px);
524
- margin: 0;
525
- margin-bottom: 8px;
526
- }
527
- `;typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function q3(t,e){try{var r=t()}catch(i){return e(i)}return r&&r.then?r.then(void 0,e):r}var z3="data:image/svg+xml,%3Csvg height='185' viewBox='0 0 300 185' width='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m61.4385429 36.2562612c48.9112241-47.8881663 128.2119871-47.8881663 177.1232091 0l5.886545 5.7634174c2.445561 2.3944081 2.445561 6.2765112 0 8.6709204l-20.136695 19.715503c-1.222781 1.1972051-3.2053 1.1972051-4.428081 0l-8.100584-7.9311479c-34.121692-33.4079817-89.443886-33.4079817-123.5655788 0l-8.6750562 8.4936051c-1.2227816 1.1972041-3.205301 1.1972041-4.4280806 0l-20.1366949-19.7155031c-2.4455612-2.3944092-2.4455612-6.2765122 0-8.6709204zm218.7677961 40.7737449 17.921697 17.546897c2.445549 2.3943969 2.445563 6.2764769.000031 8.6708899l-80.810171 79.121134c-2.445544 2.394426-6.410582 2.394453-8.85616.000062-.00001-.00001-.000022-.000022-.000032-.000032l-57.354143-56.154572c-.61139-.598602-1.60265-.598602-2.21404 0-.000004.000004-.000007.000008-.000011.000011l-57.3529212 56.154531c-2.4455368 2.394432-6.4105755 2.394472-8.8561612.000087-.0000143-.000014-.0000296-.000028-.0000449-.000044l-80.81241943-79.122185c-2.44556021-2.394408-2.44556021-6.2765115 0-8.6709197l17.92172963-17.5468673c2.4455602-2.3944082 6.4105989-2.3944082 8.8561602 0l57.3549775 56.155357c.6113908.598602 1.602649.598602 2.2140398 0 .0000092-.000009.0000174-.000017.0000265-.000024l57.3521031-56.155333c2.445505-2.3944633 6.410544-2.3945531 8.856161-.0002.000034.0000336.000068.0000673.000101.000101l57.354902 56.155432c.61139.598601 1.60265.598601 2.21404 0l57.353975-56.1543249c2.445561-2.3944092 6.410599-2.3944092 8.85616 0z' fill='%233b99fc'/%3E%3C/svg%3E",K3="WalletConnect",j3=300,H3="rgb(64, 153, 255)",R1="walletconnect-wrapper",Nu="walletconnect-style-sheet",O1="walletconnect-qrcode-modal",V3="walletconnect-qrcode-close",P1="walletconnect-qrcode-text",W3="walletconnect-connect-button";function G3(t){return ye.createElement("div",{className:"walletconnect-modal__header"},ye.createElement("img",{src:z3,className:"walletconnect-modal__headerLogo"}),ye.createElement("p",null,K3),ye.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:t.onClose},ye.createElement("div",{id:V3,className:"walletconnect-modal__close__icon"},ye.createElement("div",{className:"walletconnect-modal__close__line1"}),ye.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function Y3(t){return ye.createElement("a",{className:"walletconnect-connect__button",href:t.href,id:W3+"-"+t.name,onClick:t.onClick,rel:"noopener noreferrer",style:{backgroundColor:t.color},target:"_blank"},t.name)}var J3="data:image/svg+xml,%3Csvg fill='none' height='18' viewBox='0 0 8 18' width='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath clip-rule='evenodd' d='m.586301.213898c-.435947.33907-.5144813.967342-.175411 1.403292l4.87831 6.27212c.28087.36111.28087.86677 0 1.22788l-4.878311 6.27211c-.33907.436-.260536 1.0642.175412 1.4033.435949.3391 1.064219.2605 1.403289-.1754l4.87832-6.2721c.84259-1.08336.84259-2.60034 0-3.68367l-4.87832-6.27212c-.33907-.4359474-.96734-.514482-1.403289-.175412z' fill='%233c4252' fill-rule='evenodd'/%3E%3C/svg%3E";function Q3(t){var e=t.color,r=t.href,i=t.name,n=t.logo,s=t.onClick;return ye.createElement("a",{className:"walletconnect-modal__base__row",href:r,onClick:s,rel:"noopener noreferrer",target:"_blank"},ye.createElement("h3",{className:"walletconnect-modal__base__row__h3"},i),ye.createElement("div",{className:"walletconnect-modal__base__row__right"},ye.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+n+"') "+e,backgroundSize:"100%"}}),ye.createElement("img",{src:J3,className:"walletconnect-modal__base__row__right__caret"})))}function X3(t){var e=t.color,r=t.href,i=t.name,n=t.logo,s=t.onClick,o=window.innerWidth<768?(i.length>8?2.5:2.7)+"vw":"inherit";return ye.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:r,onClick:s,rel:"noopener noreferrer",target:"_blank"},ye.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+n+"') "+e,backgroundSize:"100%"}}),ye.createElement("div",{style:{fontSize:o},className:"walletconnect-connect__button__text"},i))}var Z3=5,Ec=12;function e6(t){var e=Vt.isAndroid(),r=ye.useState(""),i=r[0],n=r[1],s=ye.useState(""),o=s[0],a=s[1],h=ye.useState(1),f=h[0],p=h[1],v=o?t.links.filter(function(T){return T.name.toLowerCase().includes(o.toLowerCase())}):t.links,x=t.errorMessage,E=o||v.length>Z3,D=Math.ceil(v.length/Ec),B=[(f-1)*Ec+1,f*Ec],F=v.length?v.filter(function(T,L){return L+1>=B[0]&&L+1<=B[1]}):[],j=!e&&D>1,R=void 0;function K(T){n(T.target.value),clearTimeout(R),T.target.value?R=setTimeout(function(){a(T.target.value),p(1)},1e3):(n(""),a(""),p(1))}return ye.createElement("div",null,ye.createElement("p",{id:P1,className:"walletconnect-qrcode__text"},e?t.text.connect_mobile_wallet:t.text.choose_preferred_wallet),!e&&ye.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:i,onChange:K}),ye.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(e?"__android":E&&v.length?"__wrap":"")},e?ye.createElement(Y3,{name:t.text.connect,color:H3,href:t.uri,onClick:ye.useCallback(function(){Vt.saveMobileLinkInfo({name:"Unknown",href:t.uri})},[])}):F.length?F.map(function(T){var L=T.color,q=T.name,y=T.shortName,P=T.logo,Z=Vt.formatIOSMobile(t.uri,T),ne=ye.useCallback(function(){Vt.saveMobileLinkInfo({name:q,href:Z})},[F]);return E?ye.createElement(X3,{color:L,href:Z,name:y||q,logo:P,onClick:ne}):ye.createElement(Q3,{color:L,href:Z,name:q,logo:P,onClick:ne})}):ye.createElement(ye.Fragment,null,ye.createElement("p",null,x.length?t.errorMessage:t.links.length&&!v.length?t.text.no_wallets_found:t.text.loading))),j&&ye.createElement("div",{className:"walletconnect-modal__footer"},Array(D).fill(0).map(function(T,L){var q=L+1,y=f===q;return ye.createElement("a",{style:{margin:"auto 10px",fontWeight:y?"bold":"normal"},onClick:function(){return p(q)}},q)})))}function t6(t){var e=!!t.message.trim();return ye.createElement("div",{className:"walletconnect-qrcode__notification"+(e?" notification__show":"")},t.message)}var r6=function(t){try{var e="";return Promise.resolve(T1.toString(t,{margin:0,type:"svg"})).then(function(r){return typeof r=="string"&&(e=r.replace("<svg",'<svg class="walletconnect-qrcode__image"')),e})}catch(r){return Promise.reject(r)}};function i6(t){var e=ye.useState(""),r=e[0],i=e[1],n=ye.useState(""),s=n[0],o=n[1];ye.useEffect(function(){try{return Promise.resolve(r6(t.uri)).then(function(h){o(h)})}catch(h){Promise.reject(h)}},[]);var a=function(){var h=U3(t.uri);h?(i(t.text.copied_to_clipboard),setInterval(function(){return i("")},1200)):(i("Error"),setInterval(function(){return i("")},1200))};return ye.createElement("div",null,ye.createElement("p",{id:P1,className:"walletconnect-qrcode__text"},t.text.scan_qrcode_with_wallet),ye.createElement("div",{dangerouslySetInnerHTML:{__html:s}}),ye.createElement("div",{className:"walletconnect-modal__footer"},ye.createElement("a",{onClick:a},t.text.copy_to_clipboard)),ye.createElement(t6,{message:r}))}function n6(t){var e=Vt.isAndroid(),r=Vt.isMobile(),i=r?t.qrcodeModalOptions&&t.qrcodeModalOptions.mobileLinks?t.qrcodeModalOptions.mobileLinks:void 0:t.qrcodeModalOptions&&t.qrcodeModalOptions.desktopLinks?t.qrcodeModalOptions.desktopLinks:void 0,n=ye.useState(!1),s=n[0],o=n[1],a=ye.useState(!1),h=a[0],f=a[1],p=ye.useState(!r),v=p[0],x=p[1],E={mobile:r,text:t.text,uri:t.uri,qrcodeModalOptions:t.qrcodeModalOptions},D=ye.useState(""),B=D[0],F=D[1],j=ye.useState(!1),R=j[0],K=j[1],T=ye.useState([]),L=T[0],q=T[1],y=ye.useState(""),P=y[0],Z=y[1],ne=function(){h||s||i&&!i.length||L.length>0||ye.useEffect(function(){var b=function(){try{if(e)return Promise.resolve();o(!0);var c=q3(function(){var u=t.qrcodeModalOptions&&t.qrcodeModalOptions.registryUrl?t.qrcodeModalOptions.registryUrl:Vt.getWalletRegistryUrl();return Promise.resolve(fetch(u)).then(function(g){return Promise.resolve(g.json()).then(function(w){var S=w.listings,C=r?"mobile":"desktop",_=Vt.getMobileLinkRegistry(Vt.formatMobileRegistry(S,C),i);o(!1),f(!0),Z(_.length?"":t.text.no_supported_wallets),q(_);var l=_.length===1;l&&(F(Vt.formatIOSMobile(t.uri,_[0])),x(!0)),K(l)})})},function(u){o(!1),f(!0),Z(t.text.something_went_wrong),console.error(u)});return Promise.resolve(c&&c.then?c.then(function(){}):void 0)}catch(u){return Promise.reject(u)}};b()})};ne();var U=r?v:!v;return ye.createElement("div",{id:O1,className:"walletconnect-qrcode__base animated fadeIn"},ye.createElement("div",{className:"walletconnect-modal__base"},ye.createElement(G3,{onClose:t.onClose}),R&&v?ye.createElement("div",{className:"walletconnect-modal__single_wallet"},ye.createElement("a",{onClick:function(){return Vt.saveMobileLinkInfo({name:L[0].name,href:B})},href:B,rel:"noopener noreferrer",target:"_blank"},t.text.connect_with+" "+(R?L[0].name:"")+" ›")):e||s||!s&&L.length?ye.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(U?" right__selected":"")},ye.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),r?ye.createElement(ye.Fragment,null,ye.createElement("a",{onClick:function(){return x(!1),ne()}},t.text.mobile),ye.createElement("a",{onClick:function(){return x(!0)}},t.text.qrcode)):ye.createElement(ye.Fragment,null,ye.createElement("a",{onClick:function(){return x(!0)}},t.text.qrcode),ye.createElement("a",{onClick:function(){return x(!1),ne()}},t.text.desktop))):null,ye.createElement("div",null,v||!e&&!s&&!L.length?ye.createElement(i6,Object.assign({},E)):ye.createElement(e6,Object.assign({},E,{links:L,errorMessage:P})))))}var s6={choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},o6={choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},a6={choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},c6={choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},f6={choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},h6={choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},u6={choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},l6={choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"},Tu={de:s6,en:o6,es:a6,fr:c6,ko:f6,pt:h6,zh:u6,fa:l6};function d6(){var t=Vt.getDocumentOrThrow(),e=t.getElementById(Nu);e&&t.head.removeChild(e);var r=t.createElement("style");r.setAttribute("id",Nu),r.innerText=$3,t.head.appendChild(r)}function p6(){var t=Vt.getDocumentOrThrow(),e=t.createElement("div");return e.setAttribute("id",R1),t.body.appendChild(e),e}function B1(){var t=Vt.getDocumentOrThrow(),e=t.getElementById(O1);e&&(e.className=e.className.replace("fadeIn","fadeOut"),setTimeout(function(){var r=t.getElementById(R1);r&&t.body.removeChild(r)},j3))}function g6(t){return function(){B1(),t&&t()}}function b6(){var t=Vt.getNavigatorOrThrow().language.split("-")[0]||"en";return Tu[t]||Tu.en}function v6(t,e,r){d6();var i=p6();ye.render(ye.createElement(n6,{text:b6(),uri:t,onClose:g6(e),qrcodeModalOptions:r}),i)}function m6(){B1()}var F1=function(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"};function y6(t,e,r){console.log(t),F1()?k3(t):v6(t,e,r)}function w6(){F1()||m6()}var _6={open:y6,close:w6},E6=_6;const Ru=$f(E6);var be={};/*! *****************************************************************************
528
- Copyright (c) Microsoft Corporation.
529
-
530
- Permission to use, copy, modify, and/or distribute this software for any
531
- purpose with or without fee is hereby granted.
532
-
533
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
534
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
535
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
536
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
537
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
538
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
539
- PERFORMANCE OF THIS SOFTWARE.
540
- ***************************************************************************** */var df=function(t,e){return df=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},df(t,e)};function A6(t,e){df(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var pf=function(){return pf=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},pf.apply(this,arguments)};function x6(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 n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function S6(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function M6(t,e){return function(r,i){e(r,i,t)}}function I6(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function D6(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(p){try{f(i.next(p))}catch(v){o(v)}}function h(p){try{f(i.throw(p))}catch(v){o(v)}}function f(p){p.done?s(p.value):n(p.value).then(a,h)}f((i=i.apply(t,e||[])).next())})}function C6(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(p){return h([f,p])}}function h(f){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=f[0]&2?n.return:f[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,f[1])).done)return s;switch(n=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,n=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(p){f=[6,p],n=0}finally{i=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function N6(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function T6(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function gf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function L1(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function R6(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(L1(arguments[e]));return t}function O6(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i}function no(t){return this instanceof no?(this.v=t,this):new no(t)}function P6(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(x){i[x]&&(n[x]=function(E){return new Promise(function(D,B){s.push([x,E,D,B])>1||a(x,E)})})}function a(x,E){try{h(i[x](E))}catch(D){v(s[0][3],D)}}function h(x){x.value instanceof no?Promise.resolve(x.value.v).then(f,p):v(s[0][2],x)}function f(x){a("next",x)}function p(x){a("throw",x)}function v(x,E){x(E),s.shift(),s.length&&a(s[0][0],s[0][1])}}function B6(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:no(t[n](o)),done:n==="return"}:s?s(o):o}:s}}function F6(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof gf=="function"?gf(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(a,h){o=t[s](o),n(a,h,o.done,o.value)})}}function n(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function L6(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function U6(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function k6(t){return t&&t.__esModule?t:{default:t}}function $6(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function q6(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const z6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return pf},__asyncDelegator:B6,__asyncGenerator:P6,__asyncValues:F6,__await:no,__awaiter:D6,__classPrivateFieldGet:$6,__classPrivateFieldSet:q6,__createBinding:N6,__decorate:S6,__exportStar:T6,__extends:A6,__generator:C6,__importDefault:k6,__importStar:U6,__makeTemplateObject:L6,__metadata:I6,__param:M6,__read:L1,__rest:x6,__spread:R6,__spreadArrays:O6,__values:gf},Symbol.toStringTag,{value:"Module"})),Va=Ma(z6);var Ac={},Ps={},Ou;function K6(){if(Ou)return Ps;Ou=1,Object.defineProperty(Ps,"__esModule",{value:!0}),Ps.delay=void 0;function t(e){return new Promise(r=>{setTimeout(()=>{r(!0)},e)})}return Ps.delay=t,Ps}var dn={},xc={},pn={},Pu;function j6(){return Pu||(Pu=1,Object.defineProperty(pn,"__esModule",{value:!0}),pn.ONE_THOUSAND=pn.ONE_HUNDRED=void 0,pn.ONE_HUNDRED=100,pn.ONE_THOUSAND=1e3),pn}var Sc={},Bu;function H6(){return Bu||(Bu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=t.ONE_MINUTE*5,t.TEN_MINUTES=t.ONE_MINUTE*10,t.THIRTY_MINUTES=t.ONE_MINUTE*30,t.SIXTY_MINUTES=t.ONE_MINUTE*60,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=t.ONE_HOUR*3,t.SIX_HOURS=t.ONE_HOUR*6,t.TWELVE_HOURS=t.ONE_HOUR*12,t.TWENTY_FOUR_HOURS=t.ONE_HOUR*24,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=t.ONE_DAY*3,t.FIVE_DAYS=t.ONE_DAY*5,t.SEVEN_DAYS=t.ONE_DAY*7,t.THIRTY_DAYS=t.ONE_DAY*30,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=t.ONE_WEEK*2,t.THREE_WEEKS=t.ONE_WEEK*3,t.FOUR_WEEKS=t.ONE_WEEK*4,t.ONE_YEAR=t.ONE_DAY*365}(Sc)),Sc}var Fu;function U1(){return Fu||(Fu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Va;e.__exportStar(j6(),t),e.__exportStar(H6(),t)}(xc)),xc}var Lu;function V6(){if(Lu)return dn;Lu=1,Object.defineProperty(dn,"__esModule",{value:!0}),dn.fromMiliseconds=dn.toMiliseconds=void 0;const t=U1();function e(i){return i*t.ONE_THOUSAND}dn.toMiliseconds=e;function r(i){return Math.floor(i/t.ONE_THOUSAND)}return dn.fromMiliseconds=r,dn}var Uu;function W6(){return Uu||(Uu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Va;e.__exportStar(K6(),t),e.__exportStar(V6(),t)}(Ac)),Ac}var qn={},ku;function G6(){if(ku)return qn;ku=1,Object.defineProperty(qn,"__esModule",{value:!0}),qn.Watch=void 0;class t{constructor(){this.timestamps=new Map}start(r){if(this.timestamps.has(r))throw new Error(`Watch already started for label: ${r}`);this.timestamps.set(r,{started:Date.now()})}stop(r){const i=this.get(r);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${r}`);const n=Date.now()-i.started;this.timestamps.set(r,{started:i.started,elapsed:n})}get(r){const i=this.timestamps.get(r);if(typeof i>"u")throw new Error(`No timestamp found for label: ${r}`);return i}elapsed(r){const i=this.get(r);return i.elapsed||Date.now()-i.started}}return qn.Watch=t,qn.default=t,qn}var Mc={},Bs={},$u;function Y6(){if($u)return Bs;$u=1,Object.defineProperty(Bs,"__esModule",{value:!0}),Bs.IWatch=void 0;class t{}return Bs.IWatch=t,Bs}var qu;function J6(){return qu||(qu=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),Va.__exportStar(Y6(),t)}(Mc)),Mc}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=Va;e.__exportStar(W6(),t),e.__exportStar(G6(),t),e.__exportStar(J6(),t),e.__exportStar(U1(),t)})(be);class Pn{}let Q6=class extends Pn{constructor(e){super()}};const zu=be.FIVE_SECONDS,ws={pulse:"heartbeat_pulse"};let X6=class k1 extends Q6{constructor(e){super(e),this.events=new li.EventEmitter,this.interval=zu,this.interval=(e==null?void 0:e.interval)||zu}static async init(e){const r=new k1(e);return await r.init(),r}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),be.toMiliseconds(this.interval))}pulse(){this.events.emit(ws.pulse)}};const Z6=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,ey=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,ty=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function ry(t,e){if(t==="__proto__"||t==="constructor"&&e&&typeof e=="object"&&"prototype"in e){iy(t);return}return e}function iy(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Uo(t,e={}){if(typeof t!="string")return t;const r=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return r.slice(1,-1);if(r.length<=9){const i=r.toLowerCase();if(i==="true")return!0;if(i==="false")return!1;if(i==="undefined")return;if(i==="null")return null;if(i==="nan")return Number.NaN;if(i==="infinity")return Number.POSITIVE_INFINITY;if(i==="-infinity")return Number.NEGATIVE_INFINITY}if(!ty.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Z6.test(t)||ey.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,ry)}return JSON.parse(t)}catch(i){if(e.strict)throw i;return t}}function ny(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Dt(t,...e){try{return ny(t(...e))}catch(r){return Promise.reject(r)}}function sy(t){const e=typeof t;return t===null||e!=="object"&&e!=="function"}function oy(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}function Go(t){if(sy(t))return String(t);if(oy(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return Go(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const bf="base64:";function ay(t){return typeof t=="string"?t:bf+hy(t)}function cy(t){return typeof t!="string"||!t.startsWith(bf)?t:fy(t.slice(bf.length))}function fy(t){return globalThis.Buffer?Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}function hy(t){return globalThis.Buffer?Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function ir(t){var e;return t&&((e=t.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function uy(...t){return ir(t.join(":"))}function ko(t){return t=ir(t),t?t+":":""}const ly="memory",dy=()=>{const t=new Map;return{name:ly,getInstance:()=>t,hasItem(e){return t.has(e)},getItem(e){return t.get(e)??null},getItemRaw(e){return t.get(e)??null},setItem(e,r){t.set(e,r)},setItemRaw(e,r){t.set(e,r)},removeItem(e){t.delete(e)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function py(t={}){const e={mounts:{"":t.driver||dy()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},r=f=>{for(const p of e.mountpoints)if(f.startsWith(p))return{base:p,relativeKey:f.slice(p.length),driver:e.mounts[p]};return{base:"",relativeKey:f,driver:e.mounts[""]}},i=(f,p)=>e.mountpoints.filter(v=>v.startsWith(f)||p&&f.startsWith(v)).map(v=>({relativeBase:f.length>v.length?f.slice(v.length):void 0,mountpoint:v,driver:e.mounts[v]})),n=(f,p)=>{if(e.watching){p=ir(p);for(const v of e.watchListeners)v(f,p)}},s=async()=>{if(!e.watching){e.watching=!0;for(const f in e.mounts)e.unwatch[f]=await Ku(e.mounts[f],n,f)}},o=async()=>{if(e.watching){for(const f in e.unwatch)await e.unwatch[f]();e.unwatch={},e.watching=!1}},a=(f,p,v)=>{const x=new Map,E=D=>{let B=x.get(D.base);return B||(B={driver:D.driver,base:D.base,items:[]},x.set(D.base,B)),B};for(const D of f){const B=typeof D=="string",F=ir(B?D:D.key),j=B?void 0:D.value,R=B||!D.options?p:{...p,...D.options},K=r(F);E(K).items.push({key:F,value:j,relativeKey:K.relativeKey,options:R})}return Promise.all([...x.values()].map(D=>v(D))).then(D=>D.flat())},h={hasItem(f,p={}){f=ir(f);const{relativeKey:v,driver:x}=r(f);return Dt(x.hasItem,v,p)},getItem(f,p={}){f=ir(f);const{relativeKey:v,driver:x}=r(f);return Dt(x.getItem,v,p).then(E=>Uo(E))},getItems(f,p={}){return a(f,p,v=>v.driver.getItems?Dt(v.driver.getItems,v.items.map(x=>({key:x.relativeKey,options:x.options})),p).then(x=>x.map(E=>({key:uy(v.base,E.key),value:Uo(E.value)}))):Promise.all(v.items.map(x=>Dt(v.driver.getItem,x.relativeKey,x.options).then(E=>({key:x.key,value:Uo(E)})))))},getItemRaw(f,p={}){f=ir(f);const{relativeKey:v,driver:x}=r(f);return x.getItemRaw?Dt(x.getItemRaw,v,p):Dt(x.getItem,v,p).then(E=>cy(E))},async setItem(f,p,v={}){if(p===void 0)return h.removeItem(f);f=ir(f);const{relativeKey:x,driver:E}=r(f);E.setItem&&(await Dt(E.setItem,x,Go(p),v),E.watch||n("update",f))},async setItems(f,p){await a(f,p,async v=>{if(v.driver.setItems)return Dt(v.driver.setItems,v.items.map(x=>({key:x.relativeKey,value:Go(x.value),options:x.options})),p);v.driver.setItem&&await Promise.all(v.items.map(x=>Dt(v.driver.setItem,x.relativeKey,Go(x.value),x.options)))})},async setItemRaw(f,p,v={}){if(p===void 0)return h.removeItem(f,v);f=ir(f);const{relativeKey:x,driver:E}=r(f);if(E.setItemRaw)await Dt(E.setItemRaw,x,p,v);else if(E.setItem)await Dt(E.setItem,x,ay(p),v);else return;E.watch||n("update",f)},async removeItem(f,p={}){typeof p=="boolean"&&(p={removeMeta:p}),f=ir(f);const{relativeKey:v,driver:x}=r(f);x.removeItem&&(await Dt(x.removeItem,v,p),(p.removeMeta||p.removeMata)&&await Dt(x.removeItem,v+"$",p),x.watch||n("remove",f))},async getMeta(f,p={}){typeof p=="boolean"&&(p={nativeOnly:p}),f=ir(f);const{relativeKey:v,driver:x}=r(f),E=Object.create(null);if(x.getMeta&&Object.assign(E,await Dt(x.getMeta,v,p)),!p.nativeOnly){const D=await Dt(x.getItem,v+"$",p).then(B=>Uo(B));D&&typeof D=="object"&&(typeof D.atime=="string"&&(D.atime=new Date(D.atime)),typeof D.mtime=="string"&&(D.mtime=new Date(D.mtime)),Object.assign(E,D))}return E},setMeta(f,p,v={}){return this.setItem(f+"$",p,v)},removeMeta(f,p={}){return this.removeItem(f+"$",p)},async getKeys(f,p={}){f=ko(f);const v=i(f,!0);let x=[];const E=[];for(const D of v){const B=await Dt(D.driver.getKeys,D.relativeBase,p);for(const F of B){const j=D.mountpoint+ir(F);x.some(R=>j.startsWith(R))||E.push(j)}x=[D.mountpoint,...x.filter(F=>!F.startsWith(D.mountpoint))]}return f?E.filter(D=>D.startsWith(f)&&D[D.length-1]!=="$"):E.filter(D=>D[D.length-1]!=="$")},async clear(f,p={}){f=ko(f),await Promise.all(i(f,!1).map(async v=>{if(v.driver.clear)return Dt(v.driver.clear,v.relativeBase,p);if(v.driver.removeItem){const x=await v.driver.getKeys(v.relativeBase||"",p);return Promise.all(x.map(E=>v.driver.removeItem(E,p)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(f=>ju(f)))},async watch(f){return await s(),e.watchListeners.push(f),async()=>{e.watchListeners=e.watchListeners.filter(p=>p!==f),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(f,p){if(f=ko(f),f&&e.mounts[f])throw new Error(`already mounted at ${f}`);return f&&(e.mountpoints.push(f),e.mountpoints.sort((v,x)=>x.length-v.length)),e.mounts[f]=p,e.watching&&Promise.resolve(Ku(p,n,f)).then(v=>{e.unwatch[f]=v}).catch(console.error),h},async unmount(f,p=!0){var v,x;f=ko(f),!(!f||!e.mounts[f])&&(e.watching&&f in e.unwatch&&((x=(v=e.unwatch)[f])==null||x.call(v),delete e.unwatch[f]),p&&await ju(e.mounts[f]),e.mountpoints=e.mountpoints.filter(E=>E!==f),delete e.mounts[f])},getMount(f=""){f=ir(f)+":";const p=r(f);return{driver:p.driver,base:p.base}},getMounts(f="",p={}){return f=ir(f),i(f,p.parents).map(x=>({driver:x.driver,base:x.mountpoint}))},keys:(f,p={})=>h.getKeys(f,p),get:(f,p={})=>h.getItem(f,p),set:(f,p,v={})=>h.setItem(f,p,v),has:(f,p={})=>h.hasItem(f,p),del:(f,p={})=>h.removeItem(f,p),remove:(f,p={})=>h.removeItem(f,p)};return h}function Ku(t,e,r){return t.watch?t.watch((i,n)=>e(i,r+n)):()=>{}}async function ju(t){typeof t.dispose=="function"&&await Dt(t.dispose)}function Bn(t){return new Promise((e,r)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>r(t.error)})}function $1(t,e){const r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(e);const i=Bn(r);return(n,s)=>i.then(o=>s(o.transaction(e,n).objectStore(e)))}let Ic;function mo(){return Ic||(Ic=$1("keyval-store","keyval")),Ic}function Hu(t,e=mo()){return e("readonly",r=>Bn(r.get(t)))}function gy(t,e,r=mo()){return r("readwrite",i=>(i.put(e,t),Bn(i.transaction)))}function by(t,e=mo()){return e("readwrite",r=>(r.delete(t),Bn(r.transaction)))}function vy(t=mo()){return t("readwrite",e=>(e.clear(),Bn(e.transaction)))}function my(t,e){return t.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Bn(t.transaction)}function yy(t=mo()){return t("readonly",e=>{if(e.getAllKeys)return Bn(e.getAllKeys());const r=[];return my(e,i=>r.push(i.key)).then(()=>r)})}const wy=t=>JSON.stringify(t,(e,r)=>typeof r=="bigint"?r.toString()+"n":r),_y=t=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,r=t.replace(e,'$1"$2n"$3');return JSON.parse(r,(i,n)=>typeof n=="string"&&n.match(/^\d+n$/)?BigInt(n.substring(0,n.length-1)):n)};function cs(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return _y(t)}catch{return t}}function In(t){return typeof t=="string"?t:wy(t)||""}const Ey="idb-keyval";var Ay=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",r=n=>e+n;let i;return t.dbName&&t.storeName&&(i=$1(t.dbName,t.storeName)),{name:Ey,options:t,async hasItem(n){return!(typeof await Hu(r(n),i)>"u")},async getItem(n){return await Hu(r(n),i)??null},setItem(n,s){return gy(r(n),s,i)},removeItem(n){return by(r(n),i)},getKeys(){return yy(i)},clear(){return vy(i)}}};const xy="WALLET_CONNECT_V2_INDEXED_DB",Sy="keyvaluestorage";let My=class{constructor(){this.indexedDb=py({driver:Ay({dbName:xy,storeName:Sy})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const r=await this.indexedDb.getItem(e);if(r!==null)return r}async setItem(e,r){await this.indexedDb.setItem(e,In(r))}async removeItem(e){await this.indexedDb.removeItem(e)}};var Dc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Yo={exports:{}};(function(){let t;function e(){}t=e,t.prototype.getItem=function(r){return this.hasOwnProperty(r)?String(this[r]):null},t.prototype.setItem=function(r,i){this[r]=String(i)},t.prototype.removeItem=function(r){delete this[r]},t.prototype.clear=function(){const r=this;Object.keys(r).forEach(function(i){r[i]=void 0,delete r[i]})},t.prototype.key=function(r){return r=r||0,Object.keys(this)[r]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Dc<"u"&&Dc.localStorage?Yo.exports=Dc.localStorage:typeof window<"u"&&window.localStorage?Yo.exports=window.localStorage:Yo.exports=new e})();function Iy(t){var e;return[t[0],cs((e=t[1])!=null?e:"")]}let Dy=class{constructor(){this.localStorage=Yo.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Iy)}async getItem(e){const r=this.localStorage.getItem(e);if(r!==null)return cs(r)}async setItem(e,r){this.localStorage.setItem(e,In(r))}async removeItem(e){this.localStorage.removeItem(e)}};const Cy="wc_storage_version",Vu=1,Ny=async(t,e,r)=>{const i=Cy,n=await e.getItem(i);if(n&&n>=Vu){r(e);return}const s=await t.getKeys();if(!s.length){r(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const h=a.toLowerCase();if(h.includes("wc@")||h.includes("walletconnect")||h.includes("wc_")||h.includes("wallet_connect")){const f=await t.getItem(a);await e.setItem(a,f),o.push(a)}}await e.setItem(i,Vu),r(e),Ty(t,o)},Ty=async(t,e)=>{e.length&&e.forEach(async r=>{await t.removeItem(r)})};let Ry=class{constructor(){this.initialized=!1,this.setInitialized=r=>{this.storage=r,this.initialized=!0};const e=new Dy;this.storage=e;try{const r=new My;Ny(e,r,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,r){return await this.initialize(),this.storage.setItem(e,r)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const r=setInterval(()=>{this.initialized&&(clearInterval(r),e())},20)})}};function Oy(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var Py=By;function By(t,e,r){var i=r&&r.stringify||Oy,n=1;if(typeof t=="object"&&t!==null){var s=e.length+n;if(s===1)return t;var o=new Array(s);o[0]=i(t);for(var a=1;a<s;a++)o[a]=i(e[a]);return o.join(" ")}if(typeof t!="string")return t;var h=e.length;if(h===0)return t;for(var f="",p=1-n,v=-1,x=t&&t.length||0,E=0;E<x;){if(t.charCodeAt(E)===37&&E+1<x){switch(v=v>-1?v:0,t.charCodeAt(E+1)){case 100:case 102:if(p>=h||e[p]==null)break;v<E&&(f+=t.slice(v,E)),f+=Number(e[p]),v=E+2,E++;break;case 105:if(p>=h||e[p]==null)break;v<E&&(f+=t.slice(v,E)),f+=Math.floor(Number(e[p])),v=E+2,E++;break;case 79:case 111:case 106:if(p>=h||e[p]===void 0)break;v<E&&(f+=t.slice(v,E));var D=typeof e[p];if(D==="string"){f+="'"+e[p]+"'",v=E+2,E++;break}if(D==="function"){f+=e[p].name||"<anonymous>",v=E+2,E++;break}f+=i(e[p]),v=E+2,E++;break;case 115:if(p>=h)break;v<E&&(f+=t.slice(v,E)),f+=String(e[p]),v=E+2,E++;break;case 37:v<E&&(f+=t.slice(v,E)),f+="%",v=E+2,E++,p--;break}++p}++E}return v===-1?t:(v<x&&(f+=t.slice(v)),f)}const Wu=Py;var Hn=ii;const so=Hy().console||{},Fy={mapHttpRequest:$o,mapHttpResponse:$o,wrapRequestSerializer:Cc,wrapResponseSerializer:Cc,wrapErrorSerializer:Cc,req:$o,res:$o,err:qy};function Ly(t,e){return Array.isArray(t)?t.filter(function(i){return i!=="!stdSerializers.err"}):t===!0?Object.keys(e):!1}function ii(t){t=t||{},t.browser=t.browser||{};const e=t.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const r=t.browser.write||so;t.browser.write&&(t.browser.asObject=!0);const i=t.serializers||{},n=Ly(t.browser.serialize,i);let s=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=["error","fatal","warn","info","debug","trace"];typeof r=="function"&&(r.error=r.fatal=r.warn=r.info=r.debug=r.trace=r),t.enabled===!1&&(t.level="silent");const a=t.level||"info",h=Object.create(r);h.log||(h.log=oo),Object.defineProperty(h,"levelVal",{get:p}),Object.defineProperty(h,"level",{get:v,set:x});const f={transmit:e,serialize:n,asObject:t.browser.asObject,levels:o,timestamp:zy(t)};h.levels=ii.levels,h.level=a,h.setMaxListeners=h.getMaxListeners=h.emit=h.addListener=h.on=h.prependListener=h.once=h.prependOnceListener=h.removeListener=h.removeAllListeners=h.listeners=h.listenerCount=h.eventNames=h.write=h.flush=oo,h.serializers=i,h._serialize=n,h._stdErrSerialize=s,h.child=E,e&&(h._logEvent=vf());function p(){return this.level==="silent"?1/0:this.levels.values[this.level]}function v(){return this._level}function x(D){if(D!=="silent"&&!this.levels.values[D])throw Error("unknown level "+D);this._level=D,zn(f,h,"error","log"),zn(f,h,"fatal","error"),zn(f,h,"warn","error"),zn(f,h,"info","log"),zn(f,h,"debug","log"),zn(f,h,"trace","log")}function E(D,B){if(!D)throw new Error("missing bindings for child Pino");B=B||{},n&&D.serializers&&(B.serializers=D.serializers);const F=B.serializers;if(n&&F){var j=Object.assign({},i,F),R=t.browser.serialize===!0?Object.keys(j):n;delete D.serializers,Wa([D],R,j,this._stdErrSerialize)}function K(T){this._childLevel=(T._childLevel|0)+1,this.error=Kn(T,D,"error"),this.fatal=Kn(T,D,"fatal"),this.warn=Kn(T,D,"warn"),this.info=Kn(T,D,"info"),this.debug=Kn(T,D,"debug"),this.trace=Kn(T,D,"trace"),j&&(this.serializers=j,this._serialize=R),e&&(this._logEvent=vf([].concat(T._logEvent.bindings,D)))}return K.prototype=this,new K(this)}return h}ii.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};ii.stdSerializers=Fy;ii.stdTimeFunctions=Object.assign({},{nullTime:q1,epochTime:z1,unixTime:Ky,isoTime:jy});function zn(t,e,r,i){const n=Object.getPrototypeOf(e);e[r]=e.levelVal>e.levels.values[r]?oo:n[r]?n[r]:so[r]||so[i]||oo,Uy(t,e,r)}function Uy(t,e,r){!t.transmit&&e[r]===oo||(e[r]=function(i){return function(){const s=t.timestamp(),o=new Array(arguments.length),a=Object.getPrototypeOf&&Object.getPrototypeOf(this)===so?so:this;for(var h=0;h<o.length;h++)o[h]=arguments[h];if(t.serialize&&!t.asObject&&Wa(o,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?i.call(a,ky(this,r,o,s)):i.apply(a,o),t.transmit){const f=t.transmit.level||e.level,p=ii.levels.values[f],v=ii.levels.values[r];if(v<p)return;$y(this,{ts:s,methodLevel:r,methodValue:v,transmitLevel:f,transmitValue:ii.levels.values[t.transmit.level||e.level],send:t.transmit.send,val:e.levelVal},o)}}}(e[r]))}function ky(t,e,r,i){t._serialize&&Wa(r,t._serialize,t.serializers,t._stdErrSerialize);const n=r.slice();let s=n[0];const o={};i&&(o.time=i),o.level=ii.levels.values[e];let a=(t._childLevel|0)+1;if(a<1&&(a=1),s!==null&&typeof s=="object"){for(;a--&&typeof n[0]=="object";)Object.assign(o,n.shift());s=n.length?Wu(n.shift(),n):void 0}else typeof s=="string"&&(s=Wu(n.shift(),n));return s!==void 0&&(o.msg=s),o}function Wa(t,e,r,i){for(const n in t)if(i&&t[n]instanceof Error)t[n]=ii.stdSerializers.err(t[n]);else if(typeof t[n]=="object"&&!Array.isArray(t[n]))for(const s in t[n])e&&e.indexOf(s)>-1&&s in r&&(t[n][s]=r[s](t[n][s]))}function Kn(t,e,r){return function(){const i=new Array(1+arguments.length);i[0]=e;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return t[r].apply(this,i)}}function $y(t,e,r){const i=e.send,n=e.ts,s=e.methodLevel,o=e.methodValue,a=e.val,h=t._logEvent.bindings;Wa(r,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=n,t._logEvent.messages=r.filter(function(f){return h.indexOf(f)===-1}),t._logEvent.level.label=s,t._logEvent.level.value=o,i(s,t._logEvent,a),t._logEvent=vf(h)}function vf(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function qy(t){const e={type:t.constructor.name,msg:t.message,stack:t.stack};for(const r in t)e[r]===void 0&&(e[r]=t[r]);return e}function zy(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?q1:z1}function $o(){return{}}function Cc(t){return t}function oo(){}function q1(){return!1}function z1(){return Date.now()}function Ky(){return Math.round(Date.now()/1e3)}function jy(){return new Date(Date.now()).toISOString()}function Hy(){function t(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const Ga=$f(Hn),Vy={level:"info"},yo="custom_context",lh=1e3*1024;let Wy=class{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},Gu=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const r=new Wy(e);if(r.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${r.size}`);for(;this.size+r.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=r),this.tail=r):(this.head=r,this.tail=r),this.lengthInNodes++,this.sizeInBytes+=r.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let r=this.head;for(;r!==null;)e.push(r.value),r=r.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const r=e.value;return e=e.next,{done:!1,value:r}}}}};class K1{constructor(e,r=lh){this.level=e??"error",this.levelValue=Hn.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=r,this.logs=new Gu(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,r){r===Hn.levels.values.error?console.error(e):r===Hn.levels.values.warn?console.warn(e):r===Hn.levels.values.debug?console.debug(e):r===Hn.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(In({timestamp:new Date().toISOString(),log:e}));const r=typeof e=="string"?JSON.parse(e).level:e.level;r>=this.levelValue&&this.forwardToConsole(e,r)}getLogs(){return this.logs}clearLogs(){this.logs=new Gu(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const r=this.getLogArray();return r.push(In({extraMetadata:e})),new Blob(r,{type:"application/json"})}}class Gy{constructor(e,r=lh){this.baseChunkLogger=new K1(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const r=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=r,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}}class Yy{constructor(e,r=lh){this.baseChunkLogger=new K1(e,r)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var Jy=Object.defineProperty,Qy=Object.defineProperties,Xy=Object.getOwnPropertyDescriptors,Yu=Object.getOwnPropertySymbols,Zy=Object.prototype.hasOwnProperty,ew=Object.prototype.propertyIsEnumerable,Ju=(t,e,r)=>e in t?Jy(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ua=(t,e)=>{for(var r in e||(e={}))Zy.call(e,r)&&Ju(t,r,e[r]);if(Yu)for(var r of Yu(e))ew.call(e,r)&&Ju(t,r,e[r]);return t},la=(t,e)=>Qy(t,Xy(e));function dh(t){return la(ua({},t),{level:(t==null?void 0:t.level)||Vy.level})}function tw(t,e=yo){return t[e]||""}function rw(t,e,r=yo){return t[r]=e,t}function ur(t,e=yo){let r="";return typeof t.bindings>"u"?r=tw(t,e):r=t.bindings().context||"",r}function iw(t,e,r=yo){const i=ur(t,r);return i.trim()?`${i}/${e}`:e}function Jt(t,e,r=yo){const i=iw(t,e,r),n=t.child({context:i});return rw(n,i,r)}function nw(t){var e,r;const i=new Gy((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Ga(la(ua({},t.opts),{level:"trace",browser:la(ua({},(r=t.opts)==null?void 0:r.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function sw(t){var e;const r=new Yy((e=t.opts)==null?void 0:e.level,t.maxSizeInBytes);return{logger:Ga(la(ua({},t.opts),{level:"trace"}),r),chunkLoggerController:r}}function ow(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?nw(t):sw(t)}let aw=class extends Pn{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}},cw=class extends Pn{constructor(e,r){super(),this.core=e,this.logger=r,this.records=new Map}},fw=class{constructor(e,r){this.logger=e,this.core=r}};class hw extends Pn{constructor(e,r){super(),this.relayer=e,this.logger=r}}class uw extends Pn{constructor(e){super()}}class lw{constructor(e,r,i,n){this.core=e,this.logger=r,this.name=i}}class dw extends Pn{constructor(e,r){super(),this.relayer=e,this.logger=r}}let pw=class extends Pn{constructor(e,r){super(),this.core=e,this.logger=r}},gw=class{constructor(e,r,i){this.core=e,this.logger=r,this.store=i}},bw=class{constructor(e,r){this.projectId=e,this.logger=r}},vw=class{constructor(e,r,i){this.core=e,this.logger=r,this.telemetryEnabled=i}},mw=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},yw=class{constructor(e){this.client=e}};var ph={},cn={},Ya={},Ja={};Object.defineProperty(Ja,"__esModule",{value:!0});Ja.BrowserRandomSource=void 0;const Qu=65536;class ww{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const e=typeof self<"u"?self.crypto||self.msCrypto:null;e&&e.getRandomValues!==void 0&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const r=new Uint8Array(e);for(let i=0;i<r.length;i+=Qu)this._crypto.getRandomValues(r.subarray(i,i+Math.min(r.length-i,Qu)));return r}}Ja.BrowserRandomSource=ww;var Qa={},mr={};Object.defineProperty(mr,"__esModule",{value:!0});function _w(t){for(var e=0;e<t.length;e++)t[e]=0;return t}mr.wipe=_w;Object.defineProperty(Qa,"__esModule",{value:!0});Qa.NodeRandomSource=void 0;const Ew=mr;class Aw{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof c2<"u"){const e=kf;e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let r=this._crypto.randomBytes(e);if(r.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(e);for(let n=0;n<i.length;n++)i[n]=r[n];return(0,Ew.wipe)(r),i}}Qa.NodeRandomSource=Aw;Object.defineProperty(Ya,"__esModule",{value:!0});Ya.SystemRandomSource=void 0;const xw=Ja,Sw=Qa;class Mw{constructor(){if(this.isAvailable=!1,this.name="",this._source=new xw.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new Sw.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(e){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(e)}}Ya.SystemRandomSource=Mw;var We={},j1={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});function e(a,h){var f=a>>>16&65535,p=a&65535,v=h>>>16&65535,x=h&65535;return p*x+(f*x+p*v<<16>>>0)|0}t.mul=Math.imul||e;function r(a,h){return a+h|0}t.add=r;function i(a,h){return a-h|0}t.sub=i;function n(a,h){return a<<h|a>>>32-h}t.rotl=n;function s(a,h){return a<<32-h|a>>>h}t.rotr=s;function o(a){return typeof a=="number"&&isFinite(a)&&Math.floor(a)===a}t.isInteger=Number.isInteger||o,t.MAX_SAFE_INTEGER=9007199254740991,t.isSafeInteger=function(a){return t.isInteger(a)&&a>=-t.MAX_SAFE_INTEGER&&a<=t.MAX_SAFE_INTEGER}})(j1);Object.defineProperty(We,"__esModule",{value:!0});var H1=j1;function Iw(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])<<16>>16}We.readInt16BE=Iw;function Dw(t,e){return e===void 0&&(e=0),(t[e+0]<<8|t[e+1])>>>0}We.readUint16BE=Dw;function Cw(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])<<16>>16}We.readInt16LE=Cw;function Nw(t,e){return e===void 0&&(e=0),(t[e+1]<<8|t[e])>>>0}We.readUint16LE=Nw;function V1(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>8,e[r+1]=t>>>0,e}We.writeUint16BE=V1;We.writeInt16BE=V1;function W1(t,e,r){return e===void 0&&(e=new Uint8Array(2)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e}We.writeUint16LE=W1;We.writeInt16LE=W1;function mf(t,e){return e===void 0&&(e=0),t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}We.readInt32BE=mf;function yf(t,e){return e===void 0&&(e=0),(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}We.readUint32BE=yf;function wf(t,e){return e===void 0&&(e=0),t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e]}We.readInt32LE=wf;function _f(t,e){return e===void 0&&(e=0),(t[e+3]<<24|t[e+2]<<16|t[e+1]<<8|t[e])>>>0}We.readUint32LE=_f;function da(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>24,e[r+1]=t>>>16,e[r+2]=t>>>8,e[r+3]=t>>>0,e}We.writeUint32BE=da;We.writeInt32BE=da;function pa(t,e,r){return e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0),e[r+0]=t>>>0,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24,e}We.writeUint32LE=pa;We.writeInt32LE=pa;function Tw(t,e){e===void 0&&(e=0);var r=mf(t,e),i=mf(t,e+4);return r*4294967296+i-(i>>31)*4294967296}We.readInt64BE=Tw;function Rw(t,e){e===void 0&&(e=0);var r=yf(t,e),i=yf(t,e+4);return r*4294967296+i}We.readUint64BE=Rw;function Ow(t,e){e===void 0&&(e=0);var r=wf(t,e),i=wf(t,e+4);return i*4294967296+r-(r>>31)*4294967296}We.readInt64LE=Ow;function Pw(t,e){e===void 0&&(e=0);var r=_f(t,e),i=_f(t,e+4);return i*4294967296+r}We.readUint64LE=Pw;function G1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),da(t/4294967296>>>0,e,r),da(t>>>0,e,r+4),e}We.writeUint64BE=G1;We.writeInt64BE=G1;function Y1(t,e,r){return e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0),pa(t>>>0,e,r),pa(t/4294967296>>>0,e,r+4),e}We.writeUint64LE=Y1;We.writeInt64LE=Y1;function Bw(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,n=1,s=t/8+r-1;s>=r;s--)i+=e[s]*n,n*=256;return i}We.readUintBE=Bw;function Fw(t,e,r){if(r===void 0&&(r=0),t%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(t/8>e.length-r)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,n=1,s=r;s<r+t/8;s++)i+=e[s]*n,n*=256;return i}We.readUintLE=Fw;function Lw(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!H1.isSafeInteger(e))throw new Error("writeUintBE value must be an integer");for(var n=1,s=t/8+i-1;s>=i;s--)r[s]=e/n&255,n*=256;return r}We.writeUintBE=Lw;function Uw(t,e,r,i){if(r===void 0&&(r=new Uint8Array(t/8)),i===void 0&&(i=0),t%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!H1.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var n=1,s=i;s<i+t/8;s++)r[s]=e/n&255,n*=256;return r}We.writeUintLE=Uw;function kw(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e)}We.readFloat32BE=kw;function $w(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat32(e,!0)}We.readFloat32LE=$w;function qw(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e)}We.readFloat64BE=qw;function zw(t,e){e===void 0&&(e=0);var r=new DataView(t.buffer,t.byteOffset,t.byteLength);return r.getFloat64(e,!0)}We.readFloat64LE=zw;function Kw(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t),e}We.writeFloat32BE=Kw;function jw(t,e,r){e===void 0&&(e=new Uint8Array(4)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat32(r,t,!0),e}We.writeFloat32LE=jw;function Hw(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t),e}We.writeFloat64BE=Hw;function Vw(t,e,r){e===void 0&&(e=new Uint8Array(8)),r===void 0&&(r=0);var i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.setFloat64(r,t,!0),e}We.writeFloat64LE=Vw;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.randomStringForEntropy=t.randomString=t.randomUint32=t.randomBytes=t.defaultRandomSource=void 0;const e=Ya,r=We,i=mr;t.defaultRandomSource=new e.SystemRandomSource;function n(f,p=t.defaultRandomSource){return p.randomBytes(f)}t.randomBytes=n;function s(f=t.defaultRandomSource){const p=n(4,f),v=(0,r.readUint32LE)(p);return(0,i.wipe)(p),v}t.randomUint32=s;const o="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function a(f,p=o,v=t.defaultRandomSource){if(p.length<2)throw new Error("randomString charset is too short");if(p.length>256)throw new Error("randomString charset is too long");let x="";const E=p.length,D=256-256%E;for(;f>0;){const B=n(Math.ceil(f*256/D),v);for(let F=0;F<B.length&&f>0;F++){const j=B[F];j<D&&(x+=p.charAt(j%E),f--)}(0,i.wipe)(B)}return x}t.randomString=a;function h(f,p=o,v=t.defaultRandomSource){const x=Math.ceil(f/(Math.log(p.length)/Math.LN2));return a(x,p,v)}t.randomStringForEntropy=h})(cn);var J1={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=We,r=mr;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var i=function(){function a(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return a.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._tempHi),r.wipe(this._tempLo),this.reset()},a.prototype.update=function(h,f){if(f===void 0&&(f=h.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var p=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&f>0;)this._buffer[this._bufferLength++]=h[p++],f--;this._bufferLength===this.blockSize&&(s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(p=s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,h,p,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=h[p++],f--;return this},a.prototype.finish=function(h){if(!this._finished){var f=this._bytesHashed,p=this._bufferLength,v=f/536870912|0,x=f<<3,E=f%128<112?128:256;this._buffer[p]=128;for(var D=p+1;D<E-8;D++)this._buffer[D]=0;e.writeUint32BE(v,this._buffer,E-8),e.writeUint32BE(x,this._buffer,E-4),s(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,E),this._finished=!0}for(var D=0;D<this.digestLength/8;D++)e.writeUint32BE(this._stateHi[D],h,D*8),e.writeUint32BE(this._stateLo[D],h,D*8+4);return this},a.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},a.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(h){return this._stateHi.set(h.stateHi),this._stateLo.set(h.stateLo),this._bufferLength=h.bufferLength,h.buffer&&this._buffer.set(h.buffer),this._bytesHashed=h.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(h){r.wipe(h.stateHi),r.wipe(h.stateLo),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},a}();t.SHA512=i;var n=new Int32Array([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 s(a,h,f,p,v,x,E){for(var D=f[0],B=f[1],F=f[2],j=f[3],R=f[4],K=f[5],T=f[6],L=f[7],q=p[0],y=p[1],P=p[2],Z=p[3],ne=p[4],U=p[5],b=p[6],c=p[7],u,g,w,S,C,_,l,d;E>=128;){for(var N=0;N<16;N++){var Y=8*N+x;a[N]=e.readUint32BE(v,Y),h[N]=e.readUint32BE(v,Y+4)}for(var N=0;N<80;N++){var te=D,I=B,J=F,k=j,H=R,V=K,m=T,z=L,ee=q,ie=y,se=P,de=Z,O=ne,A=U,M=b,$=c;if(u=L,g=c,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=(R>>>14|ne<<18)^(R>>>18|ne<<14)^(ne>>>9|R<<23),g=(ne>>>14|R<<18)^(ne>>>18|R<<14)^(R>>>9|ne<<23),C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,u=R&K^~R&T,g=ne&U^~ne&b,C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,u=n[N*2],g=n[N*2+1],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,u=a[N%16],g=h[N%16],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,w=l&65535|d<<16,S=C&65535|_<<16,u=w,g=S,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=(D>>>28|q<<4)^(q>>>2|D<<30)^(q>>>7|D<<25),g=(q>>>28|D<<4)^(D>>>2|q<<30)^(D>>>7|q<<25),C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,u=D&B^D&F^B&F,g=q&y^q&P^y&P,C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,z=l&65535|d<<16,$=C&65535|_<<16,u=k,g=de,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=w,g=S,C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,k=l&65535|d<<16,de=C&65535|_<<16,B=te,F=I,j=J,R=k,K=H,T=V,L=m,D=z,y=ee,P=ie,Z=se,ne=de,U=O,b=A,c=M,q=$,N%16===15)for(var Y=0;Y<16;Y++)u=a[Y],g=h[Y],C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=a[(Y+9)%16],g=h[(Y+9)%16],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,w=a[(Y+1)%16],S=h[(Y+1)%16],u=(w>>>1|S<<31)^(w>>>8|S<<24)^w>>>7,g=(S>>>1|w<<31)^(S>>>8|w<<24)^(S>>>7|w<<25),C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,w=a[(Y+14)%16],S=h[(Y+14)%16],u=(w>>>19|S<<13)^(S>>>29|w<<3)^w>>>6,g=(S>>>19|w<<13)^(w>>>29|S<<3)^(S>>>6|w<<26),C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,a[Y]=l&65535|d<<16,h[Y]=C&65535|_<<16}u=D,g=q,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=f[0],g=p[0],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,f[0]=D=l&65535|d<<16,p[0]=q=C&65535|_<<16,u=B,g=y,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=f[1],g=p[1],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,f[1]=B=l&65535|d<<16,p[1]=y=C&65535|_<<16,u=F,g=P,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=f[2],g=p[2],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,f[2]=F=l&65535|d<<16,p[2]=P=C&65535|_<<16,u=j,g=Z,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=f[3],g=p[3],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,f[3]=j=l&65535|d<<16,p[3]=Z=C&65535|_<<16,u=R,g=ne,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=f[4],g=p[4],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,f[4]=R=l&65535|d<<16,p[4]=ne=C&65535|_<<16,u=K,g=U,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=f[5],g=p[5],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,f[5]=K=l&65535|d<<16,p[5]=U=C&65535|_<<16,u=T,g=b,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=f[6],g=p[6],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,f[6]=T=l&65535|d<<16,p[6]=b=C&65535|_<<16,u=L,g=c,C=g&65535,_=g>>>16,l=u&65535,d=u>>>16,u=f[7],g=p[7],C+=g&65535,_+=g>>>16,l+=u&65535,d+=u>>>16,_+=C>>>16,l+=_>>>16,d+=l>>>16,f[7]=L=l&65535|d<<16,p[7]=c=C&65535|_<<16,x+=128,E-=128}return x}function o(a){var h=new i;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(J1);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const e=cn,r=J1,i=mr;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function n(k){const H=new Float64Array(16);if(k)for(let V=0;V<k.length;V++)H[V]=k[V];return H}const s=new Uint8Array(32);s[0]=9;const o=n(),a=n([1]),h=n([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),f=n([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),p=n([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=n([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),x=n([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function E(k,H){for(let V=0;V<16;V++)k[V]=H[V]|0}function D(k){let H=1;for(let V=0;V<16;V++){let m=k[V]+H+65535;H=Math.floor(m/65536),k[V]=m-H*65536}k[0]+=H-1+37*(H-1)}function B(k,H,V){const m=~(V-1);for(let z=0;z<16;z++){const ee=m&(k[z]^H[z]);k[z]^=ee,H[z]^=ee}}function F(k,H){const V=n(),m=n();for(let z=0;z<16;z++)m[z]=H[z];D(m),D(m),D(m);for(let z=0;z<2;z++){V[0]=m[0]-65517;for(let ie=1;ie<15;ie++)V[ie]=m[ie]-65535-(V[ie-1]>>16&1),V[ie-1]&=65535;V[15]=m[15]-32767-(V[14]>>16&1);const ee=V[15]>>16&1;V[14]&=65535,B(m,V,1-ee)}for(let z=0;z<16;z++)k[2*z]=m[z]&255,k[2*z+1]=m[z]>>8}function j(k,H){let V=0;for(let m=0;m<32;m++)V|=k[m]^H[m];return(1&V-1>>>8)-1}function R(k,H){const V=new Uint8Array(32),m=new Uint8Array(32);return F(V,k),F(m,H),j(V,m)}function K(k){const H=new Uint8Array(32);return F(H,k),H[0]&1}function T(k,H){for(let V=0;V<16;V++)k[V]=H[2*V]+(H[2*V+1]<<8);k[15]&=32767}function L(k,H,V){for(let m=0;m<16;m++)k[m]=H[m]+V[m]}function q(k,H,V){for(let m=0;m<16;m++)k[m]=H[m]-V[m]}function y(k,H,V){let m,z,ee=0,ie=0,se=0,de=0,O=0,A=0,M=0,$=0,G=0,re=0,X=0,ce=0,fe=0,oe=0,le=0,he=0,ue=0,we=0,me=0,ge=0,De=0,Ne=0,ve=0,Ce=0,Ye=0,Te=0,Qe=0,Ve=0,Re=0,it=0,nt=0,_e=V[0],Pe=V[1],Fe=V[2],Ee=V[3],Le=V[4],Be=V[5],Se=V[6],$e=V[7],qe=V[8],Me=V[9],ze=V[10],Ue=V[11],Ae=V[12],Oe=V[13],Ke=V[14],Ie=V[15];m=H[0],ee+=m*_e,ie+=m*Pe,se+=m*Fe,de+=m*Ee,O+=m*Le,A+=m*Be,M+=m*Se,$+=m*$e,G+=m*qe,re+=m*Me,X+=m*ze,ce+=m*Ue,fe+=m*Ae,oe+=m*Oe,le+=m*Ke,he+=m*Ie,m=H[1],ie+=m*_e,se+=m*Pe,de+=m*Fe,O+=m*Ee,A+=m*Le,M+=m*Be,$+=m*Se,G+=m*$e,re+=m*qe,X+=m*Me,ce+=m*ze,fe+=m*Ue,oe+=m*Ae,le+=m*Oe,he+=m*Ke,ue+=m*Ie,m=H[2],se+=m*_e,de+=m*Pe,O+=m*Fe,A+=m*Ee,M+=m*Le,$+=m*Be,G+=m*Se,re+=m*$e,X+=m*qe,ce+=m*Me,fe+=m*ze,oe+=m*Ue,le+=m*Ae,he+=m*Oe,ue+=m*Ke,we+=m*Ie,m=H[3],de+=m*_e,O+=m*Pe,A+=m*Fe,M+=m*Ee,$+=m*Le,G+=m*Be,re+=m*Se,X+=m*$e,ce+=m*qe,fe+=m*Me,oe+=m*ze,le+=m*Ue,he+=m*Ae,ue+=m*Oe,we+=m*Ke,me+=m*Ie,m=H[4],O+=m*_e,A+=m*Pe,M+=m*Fe,$+=m*Ee,G+=m*Le,re+=m*Be,X+=m*Se,ce+=m*$e,fe+=m*qe,oe+=m*Me,le+=m*ze,he+=m*Ue,ue+=m*Ae,we+=m*Oe,me+=m*Ke,ge+=m*Ie,m=H[5],A+=m*_e,M+=m*Pe,$+=m*Fe,G+=m*Ee,re+=m*Le,X+=m*Be,ce+=m*Se,fe+=m*$e,oe+=m*qe,le+=m*Me,he+=m*ze,ue+=m*Ue,we+=m*Ae,me+=m*Oe,ge+=m*Ke,De+=m*Ie,m=H[6],M+=m*_e,$+=m*Pe,G+=m*Fe,re+=m*Ee,X+=m*Le,ce+=m*Be,fe+=m*Se,oe+=m*$e,le+=m*qe,he+=m*Me,ue+=m*ze,we+=m*Ue,me+=m*Ae,ge+=m*Oe,De+=m*Ke,Ne+=m*Ie,m=H[7],$+=m*_e,G+=m*Pe,re+=m*Fe,X+=m*Ee,ce+=m*Le,fe+=m*Be,oe+=m*Se,le+=m*$e,he+=m*qe,ue+=m*Me,we+=m*ze,me+=m*Ue,ge+=m*Ae,De+=m*Oe,Ne+=m*Ke,ve+=m*Ie,m=H[8],G+=m*_e,re+=m*Pe,X+=m*Fe,ce+=m*Ee,fe+=m*Le,oe+=m*Be,le+=m*Se,he+=m*$e,ue+=m*qe,we+=m*Me,me+=m*ze,ge+=m*Ue,De+=m*Ae,Ne+=m*Oe,ve+=m*Ke,Ce+=m*Ie,m=H[9],re+=m*_e,X+=m*Pe,ce+=m*Fe,fe+=m*Ee,oe+=m*Le,le+=m*Be,he+=m*Se,ue+=m*$e,we+=m*qe,me+=m*Me,ge+=m*ze,De+=m*Ue,Ne+=m*Ae,ve+=m*Oe,Ce+=m*Ke,Ye+=m*Ie,m=H[10],X+=m*_e,ce+=m*Pe,fe+=m*Fe,oe+=m*Ee,le+=m*Le,he+=m*Be,ue+=m*Se,we+=m*$e,me+=m*qe,ge+=m*Me,De+=m*ze,Ne+=m*Ue,ve+=m*Ae,Ce+=m*Oe,Ye+=m*Ke,Te+=m*Ie,m=H[11],ce+=m*_e,fe+=m*Pe,oe+=m*Fe,le+=m*Ee,he+=m*Le,ue+=m*Be,we+=m*Se,me+=m*$e,ge+=m*qe,De+=m*Me,Ne+=m*ze,ve+=m*Ue,Ce+=m*Ae,Ye+=m*Oe,Te+=m*Ke,Qe+=m*Ie,m=H[12],fe+=m*_e,oe+=m*Pe,le+=m*Fe,he+=m*Ee,ue+=m*Le,we+=m*Be,me+=m*Se,ge+=m*$e,De+=m*qe,Ne+=m*Me,ve+=m*ze,Ce+=m*Ue,Ye+=m*Ae,Te+=m*Oe,Qe+=m*Ke,Ve+=m*Ie,m=H[13],oe+=m*_e,le+=m*Pe,he+=m*Fe,ue+=m*Ee,we+=m*Le,me+=m*Be,ge+=m*Se,De+=m*$e,Ne+=m*qe,ve+=m*Me,Ce+=m*ze,Ye+=m*Ue,Te+=m*Ae,Qe+=m*Oe,Ve+=m*Ke,Re+=m*Ie,m=H[14],le+=m*_e,he+=m*Pe,ue+=m*Fe,we+=m*Ee,me+=m*Le,ge+=m*Be,De+=m*Se,Ne+=m*$e,ve+=m*qe,Ce+=m*Me,Ye+=m*ze,Te+=m*Ue,Qe+=m*Ae,Ve+=m*Oe,Re+=m*Ke,it+=m*Ie,m=H[15],he+=m*_e,ue+=m*Pe,we+=m*Fe,me+=m*Ee,ge+=m*Le,De+=m*Be,Ne+=m*Se,ve+=m*$e,Ce+=m*qe,Ye+=m*Me,Te+=m*ze,Qe+=m*Ue,Ve+=m*Ae,Re+=m*Oe,it+=m*Ke,nt+=m*Ie,ee+=38*ue,ie+=38*we,se+=38*me,de+=38*ge,O+=38*De,A+=38*Ne,M+=38*ve,$+=38*Ce,G+=38*Ye,re+=38*Te,X+=38*Qe,ce+=38*Ve,fe+=38*Re,oe+=38*it,le+=38*nt,z=1,m=ee+z+65535,z=Math.floor(m/65536),ee=m-z*65536,m=ie+z+65535,z=Math.floor(m/65536),ie=m-z*65536,m=se+z+65535,z=Math.floor(m/65536),se=m-z*65536,m=de+z+65535,z=Math.floor(m/65536),de=m-z*65536,m=O+z+65535,z=Math.floor(m/65536),O=m-z*65536,m=A+z+65535,z=Math.floor(m/65536),A=m-z*65536,m=M+z+65535,z=Math.floor(m/65536),M=m-z*65536,m=$+z+65535,z=Math.floor(m/65536),$=m-z*65536,m=G+z+65535,z=Math.floor(m/65536),G=m-z*65536,m=re+z+65535,z=Math.floor(m/65536),re=m-z*65536,m=X+z+65535,z=Math.floor(m/65536),X=m-z*65536,m=ce+z+65535,z=Math.floor(m/65536),ce=m-z*65536,m=fe+z+65535,z=Math.floor(m/65536),fe=m-z*65536,m=oe+z+65535,z=Math.floor(m/65536),oe=m-z*65536,m=le+z+65535,z=Math.floor(m/65536),le=m-z*65536,m=he+z+65535,z=Math.floor(m/65536),he=m-z*65536,ee+=z-1+37*(z-1),z=1,m=ee+z+65535,z=Math.floor(m/65536),ee=m-z*65536,m=ie+z+65535,z=Math.floor(m/65536),ie=m-z*65536,m=se+z+65535,z=Math.floor(m/65536),se=m-z*65536,m=de+z+65535,z=Math.floor(m/65536),de=m-z*65536,m=O+z+65535,z=Math.floor(m/65536),O=m-z*65536,m=A+z+65535,z=Math.floor(m/65536),A=m-z*65536,m=M+z+65535,z=Math.floor(m/65536),M=m-z*65536,m=$+z+65535,z=Math.floor(m/65536),$=m-z*65536,m=G+z+65535,z=Math.floor(m/65536),G=m-z*65536,m=re+z+65535,z=Math.floor(m/65536),re=m-z*65536,m=X+z+65535,z=Math.floor(m/65536),X=m-z*65536,m=ce+z+65535,z=Math.floor(m/65536),ce=m-z*65536,m=fe+z+65535,z=Math.floor(m/65536),fe=m-z*65536,m=oe+z+65535,z=Math.floor(m/65536),oe=m-z*65536,m=le+z+65535,z=Math.floor(m/65536),le=m-z*65536,m=he+z+65535,z=Math.floor(m/65536),he=m-z*65536,ee+=z-1+37*(z-1),k[0]=ee,k[1]=ie,k[2]=se,k[3]=de,k[4]=O,k[5]=A,k[6]=M,k[7]=$,k[8]=G,k[9]=re,k[10]=X,k[11]=ce,k[12]=fe,k[13]=oe,k[14]=le,k[15]=he}function P(k,H){y(k,H,H)}function Z(k,H){const V=n();let m;for(m=0;m<16;m++)V[m]=H[m];for(m=253;m>=0;m--)P(V,V),m!==2&&m!==4&&y(V,V,H);for(m=0;m<16;m++)k[m]=V[m]}function ne(k,H){const V=n();let m;for(m=0;m<16;m++)V[m]=H[m];for(m=250;m>=0;m--)P(V,V),m!==1&&y(V,V,H);for(m=0;m<16;m++)k[m]=V[m]}function U(k,H){const V=n(),m=n(),z=n(),ee=n(),ie=n(),se=n(),de=n(),O=n(),A=n();q(V,k[1],k[0]),q(A,H[1],H[0]),y(V,V,A),L(m,k[0],k[1]),L(A,H[0],H[1]),y(m,m,A),y(z,k[3],H[3]),y(z,z,f),y(ee,k[2],H[2]),L(ee,ee,ee),q(ie,m,V),q(se,ee,z),L(de,ee,z),L(O,m,V),y(k[0],ie,se),y(k[1],O,de),y(k[2],de,se),y(k[3],ie,O)}function b(k,H,V){for(let m=0;m<4;m++)B(k[m],H[m],V)}function c(k,H){const V=n(),m=n(),z=n();Z(z,H[2]),y(V,H[0],z),y(m,H[1],z),F(k,m),k[31]^=K(V)<<7}function u(k,H,V){E(k[0],o),E(k[1],a),E(k[2],a),E(k[3],o);for(let m=255;m>=0;--m){const z=V[m/8|0]>>(m&7)&1;b(k,H,z),U(H,k),U(k,k),b(k,H,z)}}function g(k,H){const V=[n(),n(),n(),n()];E(V[0],p),E(V[1],v),E(V[2],a),y(V[3],p,v),u(k,V,H)}function w(k){if(k.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const H=(0,r.hash)(k);H[0]&=248,H[31]&=127,H[31]|=64;const V=new Uint8Array(32),m=[n(),n(),n(),n()];g(m,H),c(V,m);const z=new Uint8Array(64);return z.set(k),z.set(V,32),{publicKey:V,secretKey:z}}t.generateKeyPairFromSeed=w;function S(k){const H=(0,e.randomBytes)(32,k),V=w(H);return(0,i.wipe)(H),V}t.generateKeyPair=S;function C(k){if(k.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(k.subarray(32))}t.extractPublicKeyFromSecretKey=C;const _=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 l(k,H){let V,m,z,ee;for(m=63;m>=32;--m){for(V=0,z=m-32,ee=m-12;z<ee;++z)H[z]+=V-16*H[m]*_[z-(m-32)],V=Math.floor((H[z]+128)/256),H[z]-=V*256;H[z]+=V,H[m]=0}for(V=0,z=0;z<32;z++)H[z]+=V-(H[31]>>4)*_[z],V=H[z]>>8,H[z]&=255;for(z=0;z<32;z++)H[z]-=V*_[z];for(m=0;m<32;m++)H[m+1]+=H[m]>>8,k[m]=H[m]&255}function d(k){const H=new Float64Array(64);for(let V=0;V<64;V++)H[V]=k[V];for(let V=0;V<64;V++)k[V]=0;l(k,H)}function N(k,H){const V=new Float64Array(64),m=[n(),n(),n(),n()],z=(0,r.hash)(k.subarray(0,32));z[0]&=248,z[31]&=127,z[31]|=64;const ee=new Uint8Array(64);ee.set(z.subarray(32),32);const ie=new r.SHA512;ie.update(ee.subarray(32)),ie.update(H);const se=ie.digest();ie.clean(),d(se),g(m,se),c(ee,m),ie.reset(),ie.update(ee.subarray(0,32)),ie.update(k.subarray(32)),ie.update(H);const de=ie.digest();d(de);for(let O=0;O<32;O++)V[O]=se[O];for(let O=0;O<32;O++)for(let A=0;A<32;A++)V[O+A]+=de[O]*z[A];return l(ee.subarray(32),V),ee}t.sign=N;function Y(k,H){const V=n(),m=n(),z=n(),ee=n(),ie=n(),se=n(),de=n();return E(k[2],a),T(k[1],H),P(z,k[1]),y(ee,z,h),q(z,z,k[2]),L(ee,k[2],ee),P(ie,ee),P(se,ie),y(de,se,ie),y(V,de,z),y(V,V,ee),ne(V,V),y(V,V,z),y(V,V,ee),y(V,V,ee),y(k[0],V,ee),P(m,k[0]),y(m,m,ee),R(m,z)&&y(k[0],k[0],x),P(m,k[0]),y(m,m,ee),R(m,z)?-1:(K(k[0])===H[31]>>7&&q(k[0],o,k[0]),y(k[3],k[0],k[1]),0)}function te(k,H,V){const m=new Uint8Array(32),z=[n(),n(),n(),n()],ee=[n(),n(),n(),n()];if(V.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(Y(ee,k))return!1;const ie=new r.SHA512;ie.update(V.subarray(0,32)),ie.update(k),ie.update(H);const se=ie.digest();return d(se),u(z,ee,se),g(ee,V.subarray(32)),U(z,ee),c(m,z),!j(V,m)}t.verify=te;function I(k){let H=[n(),n(),n(),n()];if(Y(H,k))throw new Error("Ed25519: invalid public key");let V=n(),m=n(),z=H[1];L(V,a,z),q(m,a,z),Z(m,m),y(V,V,m);let ee=new Uint8Array(32);return F(ee,V),ee}t.convertPublicKeyToX25519=I;function J(k){const H=(0,r.hash)(k.subarray(0,32));H[0]&=248,H[31]&=127,H[31]|=64;const V=new Uint8Array(H.subarray(0,32));return(0,i.wipe)(H),V}t.convertSecretKeyToX25519=J})(ph);const Ww="EdDSA",Gw="JWT",ga=".",Xa="base64url",Q1="utf8",X1="utf8",Yw=":",Jw="did",Qw="key",Xu="base58btc",Xw="z",Zw="K36",e5=32;function Z1(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Jo(t,e){e||(e=t.reduce((n,s)=>n+s.length,0));const r=Z1(e);let i=0;for(const n of t)r.set(n,i),i+=n.length;return r}function t5(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=n}var a=t.length,h=t.charAt(0),f=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function v(D){if(D instanceof Uint8Array||(ArrayBuffer.isView(D)?D=new Uint8Array(D.buffer,D.byteOffset,D.byteLength):Array.isArray(D)&&(D=Uint8Array.from(D))),!(D instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(D.length===0)return"";for(var B=0,F=0,j=0,R=D.length;j!==R&&D[j]===0;)j++,B++;for(var K=(R-j)*p+1>>>0,T=new Uint8Array(K);j!==R;){for(var L=D[j],q=0,y=K-1;(L!==0||q<F)&&y!==-1;y--,q++)L+=256*T[y]>>>0,T[y]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");F=q,j++}for(var P=K-F;P!==K&&T[P]===0;)P++;for(var Z=h.repeat(B);P<K;++P)Z+=t.charAt(T[P]);return Z}function x(D){if(typeof D!="string")throw new TypeError("Expected String");if(D.length===0)return new Uint8Array;var B=0;if(D[B]!==" "){for(var F=0,j=0;D[B]===h;)F++,B++;for(var R=(D.length-B)*f+1>>>0,K=new Uint8Array(R);D[B];){var T=r[D.charCodeAt(B)];if(T===255)return;for(var L=0,q=R-1;(T!==0||L<j)&&q!==-1;q--,L++)T+=a*K[q]>>>0,K[q]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");j=L,B++}if(D[B]!==" "){for(var y=R-j;y!==R&&K[y]===0;)y++;for(var P=new Uint8Array(F+(R-y)),Z=F;y!==R;)P[Z++]=K[y++];return P}}}function E(D){var B=x(D);if(B)return B;throw new Error(`Non-${e} character`)}return{encode:v,decodeUnsafe:x,decode:E}}var r5=t5,i5=r5;const n5=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},s5=t=>new TextEncoder().encode(t),o5=t=>new TextDecoder().decode(t);class a5{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class c5{constructor(e,r,i){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return ep(this,e)}}class f5{constructor(e){this.decoders=e}or(e){return ep(this,e)}decode(e){const r=e[0],i=this.decoders[r];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ep=(t,e)=>new f5({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class h5{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new a5(e,r,i),this.decoder=new c5(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const Za=({name:t,prefix:e,encode:r,decode:i})=>new h5(t,e,r,i),wo=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=i5(r,e);return Za({prefix:t,name:e,encode:i,decode:s=>n5(n(s))})},u5=(t,e,r,i)=>{const n={};for(let p=0;p<e.length;++p)n[e[p]]=p;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,h=0,f=0;for(let p=0;p<s;++p){const v=n[t[p]];if(v===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<r|v,a+=r,a>=8&&(a-=8,o[f++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o},l5=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",o=0,a=0;for(let h=0;h<t.length;++h)for(a=a<<8|t[h],o+=8;o>r;)o-=r,s+=e[n&a>>o];if(o&&(s+=e[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s},Ut=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>Za({prefix:e,name:t,encode(n){return l5(n,i,r)},decode(n){return u5(n,i,r,t)}}),d5=Za({prefix:"\0",name:"identity",encode:t=>o5(t),decode:t=>s5(t)}),p5=Object.freeze(Object.defineProperty({__proto__:null,identity:d5},Symbol.toStringTag,{value:"Module"})),g5=Ut({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),b5=Object.freeze(Object.defineProperty({__proto__:null,base2:g5},Symbol.toStringTag,{value:"Module"})),v5=Ut({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),m5=Object.freeze(Object.defineProperty({__proto__:null,base8:v5},Symbol.toStringTag,{value:"Module"})),y5=wo({prefix:"9",name:"base10",alphabet:"0123456789"}),w5=Object.freeze(Object.defineProperty({__proto__:null,base10:y5},Symbol.toStringTag,{value:"Module"})),_5=Ut({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),E5=Ut({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),A5=Object.freeze(Object.defineProperty({__proto__:null,base16:_5,base16upper:E5},Symbol.toStringTag,{value:"Module"})),x5=Ut({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),S5=Ut({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),M5=Ut({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),I5=Ut({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),D5=Ut({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),C5=Ut({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),N5=Ut({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),T5=Ut({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),R5=Ut({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),O5=Object.freeze(Object.defineProperty({__proto__:null,base32:x5,base32hex:D5,base32hexpad:N5,base32hexpadupper:T5,base32hexupper:C5,base32pad:M5,base32padupper:I5,base32upper:S5,base32z:R5},Symbol.toStringTag,{value:"Module"})),P5=wo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),B5=wo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),F5=Object.freeze(Object.defineProperty({__proto__:null,base36:P5,base36upper:B5},Symbol.toStringTag,{value:"Module"})),L5=wo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),U5=wo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),k5=Object.freeze(Object.defineProperty({__proto__:null,base58btc:L5,base58flickr:U5},Symbol.toStringTag,{value:"Module"})),$5=Ut({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),q5=Ut({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),z5=Ut({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),K5=Ut({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),j5=Object.freeze(Object.defineProperty({__proto__:null,base64:$5,base64pad:q5,base64url:z5,base64urlpad:K5},Symbol.toStringTag,{value:"Module"})),tp=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),H5=tp.reduce((t,e,r)=>(t[r]=e,t),[]),V5=tp.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function W5(t){return t.reduce((e,r)=>(e+=H5[r],e),"")}function G5(t){const e=[];for(const r of t){const i=V5[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const Y5=Za({prefix:"🚀",name:"base256emoji",encode:W5,decode:G5}),J5=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:Y5},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const Zu={...p5,...b5,...m5,...w5,...A5,...O5,...F5,...k5,...j5,...J5};function rp(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const el=rp("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Nc=rp("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=Z1(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),ip={utf8:el,"utf-8":el,hex:Zu.base16,latin1:Nc,ascii:Nc,binary:Nc,...Zu};function Tt(t,e="utf8"){const r=ip[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):r.encoder.encode(t).substring(1)}function Ct(t,e="utf8"){const r=ip[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}function tl(t){return cs(Tt(Ct(t,Xa),Q1))}function ba(t){return Tt(Ct(In(t),Q1),Xa)}function np(t){const e=Ct(Zw,Xu),r=Xw+Tt(Jo([e,t]),Xu);return[Jw,Qw,r].join(Yw)}function Q5(t){return Tt(t,Xa)}function X5(t){return Ct(t,Xa)}function Z5(t){return Ct([ba(t.header),ba(t.payload)].join(ga),X1)}function e8(t){return[ba(t.header),ba(t.payload),Q5(t.signature)].join(ga)}function Ef(t){const e=t.split(ga),r=tl(e[0]),i=tl(e[1]),n=X5(e[2]),s=Ct(e.slice(0,2).join(ga),X1);return{header:r,payload:i,signature:n,data:s}}function rl(t=cn.randomBytes(e5)){return ph.generateKeyPairFromSeed(t)}async function t8(t,e,r,i,n=be.fromMiliseconds(Date.now())){const s={alg:Ww,typ:Gw},o=np(i.publicKey),a=n+r,h={iss:o,sub:t,aud:e,iat:n,exp:a},f=Z5({header:s,payload:h}),p=ph.sign(i.secretKey,f);return e8({header:s,payload:h,signature:p})}var il=function(t,e,r){if(r||arguments.length===2)for(var i=0,n=e.length,s;i<n;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))},r8=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),i8=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return t}(),n8=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),s8=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),o8=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),a8=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,c8=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,nl=3,f8=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",a8]],sl=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function h8(t){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new o8:typeof navigator<"u"?l8(navigator.userAgent):p8()}function u8(t){return t!==""&&f8.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function l8(t){var e=u8(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new s8;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<nl&&(n=il(il([],n,!0),g8(nl-n.length),!0)):n=[];var s=n.join("."),o=d8(t),a=c8.exec(t);return a&&a[1]?new n8(r,s,o,a[1]):new r8(r,s,o)}function d8(t){for(var e=0,r=sl.length;e<r;e++){var i=sl[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function p8(){var t=typeof process<"u"&&process.version;return t?new i8(process.version.slice(1)):null}function g8(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}var ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.getLocalStorage=ht.getLocalStorageOrThrow=ht.getCrypto=ht.getCryptoOrThrow=sp=ht.getLocation=ht.getLocationOrThrow=gh=ht.getNavigator=ht.getNavigatorOrThrow=ec=ht.getDocument=ht.getDocumentOrThrow=ht.getFromWindowOrThrow=ht.getFromWindow=void 0;function Fn(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}ht.getFromWindow=Fn;function _s(t){const e=Fn(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}ht.getFromWindowOrThrow=_s;function b8(){return _s("document")}ht.getDocumentOrThrow=b8;function v8(){return Fn("document")}var ec=ht.getDocument=v8;function m8(){return _s("navigator")}ht.getNavigatorOrThrow=m8;function y8(){return Fn("navigator")}var gh=ht.getNavigator=y8;function w8(){return _s("location")}ht.getLocationOrThrow=w8;function _8(){return Fn("location")}var sp=ht.getLocation=_8;function E8(){return _s("crypto")}ht.getCryptoOrThrow=E8;function A8(){return Fn("crypto")}ht.getCrypto=A8;function x8(){return _s("localStorage")}ht.getLocalStorageOrThrow=x8;function S8(){return Fn("localStorage")}ht.getLocalStorage=S8;var bh={};Object.defineProperty(bh,"__esModule",{value:!0});var op=bh.getWindowMetadata=void 0;const ol=ht;function M8(){let t,e;try{t=ol.getDocumentOrThrow(),e=ol.getLocationOrThrow()}catch{return null}function r(){const v=t.getElementsByTagName("link"),x=[];for(let E=0;E<v.length;E++){const D=v[E],B=D.getAttribute("rel");if(B&&B.toLowerCase().indexOf("icon")>-1){const F=D.getAttribute("href");if(F)if(F.toLowerCase().indexOf("https:")===-1&&F.toLowerCase().indexOf("http:")===-1&&F.indexOf("//")!==0){let j=e.protocol+"//"+e.host;if(F.indexOf("/")===0)j+=F;else{const R=e.pathname.split("/");R.pop();const K=R.join("/");j+=K+"/"+F}x.push(j)}else if(F.indexOf("//")===0){const j=e.protocol+F;x.push(j)}else x.push(F)}}return x}function i(...v){const x=t.getElementsByTagName("meta");for(let E=0;E<x.length;E++){const D=x[E],B=["itemprop","property","name"].map(F=>D.getAttribute(F)).filter(F=>F?v.includes(F):!1);if(B.length&&B){const F=D.getAttribute("content");if(F)return F}}return""}function n(){let v=i("name","og:site_name","og:title","twitter:title");return v||(v=t.title),v}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,f=r();return{description:a,url:h,icons:f,name:o}}op=bh.getWindowMetadata=M8;var ao={},I8=t=>encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),ap="%[a-f0-9]{2}",al=new RegExp("("+ap+")|([^%]+?)","gi"),cl=new RegExp("("+ap+")+","gi");function Af(t,e){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;e=e||1;var r=t.slice(0,e),i=t.slice(e);return Array.prototype.concat.call([],Af(r),Af(i))}function D8(t){try{return decodeURIComponent(t)}catch{for(var e=t.match(al)||[],r=1;r<e.length;r++)t=Af(e,r).join(""),e=t.match(al)||[];return t}}function C8(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},r=cl.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch{var i=D8(r[0]);i!==r[0]&&(e[r[0]]=i)}r=cl.exec(t)}e["%C2"]="�";for(var n=Object.keys(e),s=0;s<n.length;s++){var o=n[s];t=t.replace(new RegExp(o,"g"),e[o])}return t}var N8=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return C8(t)}},T8=(t,e)=>{if(!(typeof t=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[t];const r=t.indexOf(e);return r===-1?[t]:[t.slice(0,r),t.slice(r+e.length)]},R8=function(t,e){for(var r={},i=Object.keys(t),n=Array.isArray(e),s=0;s<i.length;s++){var o=i[s],a=t[o];(n?e.indexOf(o)!==-1:e(o,a,t))&&(r[o]=a)}return r};(function(t){const e=I8,r=N8,i=T8,n=R8,s=R=>R==null,o=Symbol("encodeFragmentIdentifier");function a(R){switch(R.arrayFormat){case"index":return K=>(T,L)=>{const q=T.length;return L===void 0||R.skipNull&&L===null||R.skipEmptyString&&L===""?T:L===null?[...T,[p(K,R),"[",q,"]"].join("")]:[...T,[p(K,R),"[",p(q,R),"]=",p(L,R)].join("")]};case"bracket":return K=>(T,L)=>L===void 0||R.skipNull&&L===null||R.skipEmptyString&&L===""?T:L===null?[...T,[p(K,R),"[]"].join("")]:[...T,[p(K,R),"[]=",p(L,R)].join("")];case"colon-list-separator":return K=>(T,L)=>L===void 0||R.skipNull&&L===null||R.skipEmptyString&&L===""?T:L===null?[...T,[p(K,R),":list="].join("")]:[...T,[p(K,R),":list=",p(L,R)].join("")];case"comma":case"separator":case"bracket-separator":{const K=R.arrayFormat==="bracket-separator"?"[]=":"=";return T=>(L,q)=>q===void 0||R.skipNull&&q===null||R.skipEmptyString&&q===""?L:(q=q===null?"":q,L.length===0?[[p(T,R),K,p(q,R)].join("")]:[[L,p(q,R)].join(R.arrayFormatSeparator)])}default:return K=>(T,L)=>L===void 0||R.skipNull&&L===null||R.skipEmptyString&&L===""?T:L===null?[...T,p(K,R)]:[...T,[p(K,R),"=",p(L,R)].join("")]}}function h(R){let K;switch(R.arrayFormat){case"index":return(T,L,q)=>{if(K=/\[(\d*)\]$/.exec(T),T=T.replace(/\[\d*\]$/,""),!K){q[T]=L;return}q[T]===void 0&&(q[T]={}),q[T][K[1]]=L};case"bracket":return(T,L,q)=>{if(K=/(\[\])$/.exec(T),T=T.replace(/\[\]$/,""),!K){q[T]=L;return}if(q[T]===void 0){q[T]=[L];return}q[T]=[].concat(q[T],L)};case"colon-list-separator":return(T,L,q)=>{if(K=/(:list)$/.exec(T),T=T.replace(/:list$/,""),!K){q[T]=L;return}if(q[T]===void 0){q[T]=[L];return}q[T]=[].concat(q[T],L)};case"comma":case"separator":return(T,L,q)=>{const y=typeof L=="string"&&L.includes(R.arrayFormatSeparator),P=typeof L=="string"&&!y&&v(L,R).includes(R.arrayFormatSeparator);L=P?v(L,R):L;const Z=y||P?L.split(R.arrayFormatSeparator).map(ne=>v(ne,R)):L===null?L:v(L,R);q[T]=Z};case"bracket-separator":return(T,L,q)=>{const y=/(\[\])$/.test(T);if(T=T.replace(/\[\]$/,""),!y){q[T]=L&&v(L,R);return}const P=L===null?[]:L.split(R.arrayFormatSeparator).map(Z=>v(Z,R));if(q[T]===void 0){q[T]=P;return}q[T]=[].concat(q[T],P)};default:return(T,L,q)=>{if(q[T]===void 0){q[T]=L;return}q[T]=[].concat(q[T],L)}}}function f(R){if(typeof R!="string"||R.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function p(R,K){return K.encode?K.strict?e(R):encodeURIComponent(R):R}function v(R,K){return K.decode?r(R):R}function x(R){return Array.isArray(R)?R.sort():typeof R=="object"?x(Object.keys(R)).sort((K,T)=>Number(K)-Number(T)).map(K=>R[K]):R}function E(R){const K=R.indexOf("#");return K!==-1&&(R=R.slice(0,K)),R}function D(R){let K="";const T=R.indexOf("#");return T!==-1&&(K=R.slice(T)),K}function B(R){R=E(R);const K=R.indexOf("?");return K===-1?"":R.slice(K+1)}function F(R,K){return K.parseNumbers&&!Number.isNaN(Number(R))&&typeof R=="string"&&R.trim()!==""?R=Number(R):K.parseBooleans&&R!==null&&(R.toLowerCase()==="true"||R.toLowerCase()==="false")&&(R=R.toLowerCase()==="true"),R}function j(R,K){K=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},K),f(K.arrayFormatSeparator);const T=h(K),L=Object.create(null);if(typeof R!="string"||(R=R.trim().replace(/^[?#&]/,""),!R))return L;for(const q of R.split("&")){if(q==="")continue;let[y,P]=i(K.decode?q.replace(/\+/g," "):q,"=");P=P===void 0?null:["comma","separator","bracket-separator"].includes(K.arrayFormat)?P:v(P,K),T(v(y,K),P,L)}for(const q of Object.keys(L)){const y=L[q];if(typeof y=="object"&&y!==null)for(const P of Object.keys(y))y[P]=F(y[P],K);else L[q]=F(y,K)}return K.sort===!1?L:(K.sort===!0?Object.keys(L).sort():Object.keys(L).sort(K.sort)).reduce((q,y)=>{const P=L[y];return P&&typeof P=="object"&&!Array.isArray(P)?q[y]=x(P):q[y]=P,q},Object.create(null))}t.extract=B,t.parse=j,t.stringify=(R,K)=>{if(!R)return"";K=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},K),f(K.arrayFormatSeparator);const T=P=>K.skipNull&&s(R[P])||K.skipEmptyString&&R[P]==="",L=a(K),q={};for(const P of Object.keys(R))T(P)||(q[P]=R[P]);const y=Object.keys(q);return K.sort!==!1&&y.sort(K.sort),y.map(P=>{const Z=R[P];return Z===void 0?"":Z===null?p(P,K):Array.isArray(Z)?Z.length===0&&K.arrayFormat==="bracket-separator"?p(P,K)+"[]":Z.reduce(L(P),[]).join("&"):p(P,K)+"="+p(Z,K)}).filter(P=>P.length>0).join("&")},t.parseUrl=(R,K)=>{K=Object.assign({decode:!0},K);const[T,L]=i(R,"#");return Object.assign({url:T.split("?")[0]||"",query:j(B(R),K)},K&&K.parseFragmentIdentifier&&L?{fragmentIdentifier:v(L,K)}:{})},t.stringifyUrl=(R,K)=>{K=Object.assign({encode:!0,strict:!0,[o]:!0},K);const T=E(R.url).split("?")[0]||"",L=t.extract(R.url),q=t.parse(L,{sort:!1}),y=Object.assign(q,R.query);let P=t.stringify(y,K);P&&(P=`?${P}`);let Z=D(R.url);return R.fragmentIdentifier&&(Z=`#${K[o]?p(R.fragmentIdentifier,K):R.fragmentIdentifier}`),`${T}${P}${Z}`},t.pick=(R,K,T)=>{T=Object.assign({parseFragmentIdentifier:!0,[o]:!1},T);const{url:L,query:q,fragmentIdentifier:y}=t.parseUrl(R,T);return t.stringifyUrl({url:L,query:n(q,K),fragmentIdentifier:y},T)},t.exclude=(R,K,T)=>{const L=Array.isArray(K)?q=>!K.includes(q):(q,y)=>!K(q,y);return t.pick(R,L,T)}})(ao);var vh={},tc={};Object.defineProperty(tc,"__esModule",{value:!0});var zt=We,xf=mr,O8=20;function P8(t,e,r){for(var i=1634760805,n=857760878,s=2036477234,o=1797285236,a=r[3]<<24|r[2]<<16|r[1]<<8|r[0],h=r[7]<<24|r[6]<<16|r[5]<<8|r[4],f=r[11]<<24|r[10]<<16|r[9]<<8|r[8],p=r[15]<<24|r[14]<<16|r[13]<<8|r[12],v=r[19]<<24|r[18]<<16|r[17]<<8|r[16],x=r[23]<<24|r[22]<<16|r[21]<<8|r[20],E=r[27]<<24|r[26]<<16|r[25]<<8|r[24],D=r[31]<<24|r[30]<<16|r[29]<<8|r[28],B=e[3]<<24|e[2]<<16|e[1]<<8|e[0],F=e[7]<<24|e[6]<<16|e[5]<<8|e[4],j=e[11]<<24|e[10]<<16|e[9]<<8|e[8],R=e[15]<<24|e[14]<<16|e[13]<<8|e[12],K=i,T=n,L=s,q=o,y=a,P=h,Z=f,ne=p,U=v,b=x,c=E,u=D,g=B,w=F,S=j,C=R,_=0;_<O8;_+=2)K=K+y|0,g^=K,g=g>>>16|g<<16,U=U+g|0,y^=U,y=y>>>20|y<<12,T=T+P|0,w^=T,w=w>>>16|w<<16,b=b+w|0,P^=b,P=P>>>20|P<<12,L=L+Z|0,S^=L,S=S>>>16|S<<16,c=c+S|0,Z^=c,Z=Z>>>20|Z<<12,q=q+ne|0,C^=q,C=C>>>16|C<<16,u=u+C|0,ne^=u,ne=ne>>>20|ne<<12,L=L+Z|0,S^=L,S=S>>>24|S<<8,c=c+S|0,Z^=c,Z=Z>>>25|Z<<7,q=q+ne|0,C^=q,C=C>>>24|C<<8,u=u+C|0,ne^=u,ne=ne>>>25|ne<<7,T=T+P|0,w^=T,w=w>>>24|w<<8,b=b+w|0,P^=b,P=P>>>25|P<<7,K=K+y|0,g^=K,g=g>>>24|g<<8,U=U+g|0,y^=U,y=y>>>25|y<<7,K=K+P|0,C^=K,C=C>>>16|C<<16,c=c+C|0,P^=c,P=P>>>20|P<<12,T=T+Z|0,g^=T,g=g>>>16|g<<16,u=u+g|0,Z^=u,Z=Z>>>20|Z<<12,L=L+ne|0,w^=L,w=w>>>16|w<<16,U=U+w|0,ne^=U,ne=ne>>>20|ne<<12,q=q+y|0,S^=q,S=S>>>16|S<<16,b=b+S|0,y^=b,y=y>>>20|y<<12,L=L+ne|0,w^=L,w=w>>>24|w<<8,U=U+w|0,ne^=U,ne=ne>>>25|ne<<7,q=q+y|0,S^=q,S=S>>>24|S<<8,b=b+S|0,y^=b,y=y>>>25|y<<7,T=T+Z|0,g^=T,g=g>>>24|g<<8,u=u+g|0,Z^=u,Z=Z>>>25|Z<<7,K=K+P|0,C^=K,C=C>>>24|C<<8,c=c+C|0,P^=c,P=P>>>25|P<<7;zt.writeUint32LE(K+i|0,t,0),zt.writeUint32LE(T+n|0,t,4),zt.writeUint32LE(L+s|0,t,8),zt.writeUint32LE(q+o|0,t,12),zt.writeUint32LE(y+a|0,t,16),zt.writeUint32LE(P+h|0,t,20),zt.writeUint32LE(Z+f|0,t,24),zt.writeUint32LE(ne+p|0,t,28),zt.writeUint32LE(U+v|0,t,32),zt.writeUint32LE(b+x|0,t,36),zt.writeUint32LE(c+E|0,t,40),zt.writeUint32LE(u+D|0,t,44),zt.writeUint32LE(g+B|0,t,48),zt.writeUint32LE(w+F|0,t,52),zt.writeUint32LE(S+j|0,t,56),zt.writeUint32LE(C+R|0,t,60)}function cp(t,e,r,i,n){if(n===void 0&&(n=0),t.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<r.length)throw new Error("ChaCha: destination is shorter than source");var s,o;if(n===0){if(e.length!==8&&e.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");s=new Uint8Array(16),o=s.length-e.length,s.set(e,o)}else{if(e.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");s=e,o=n}for(var a=new Uint8Array(64),h=0;h<r.length;h+=64){P8(a,s,t);for(var f=h;f<h+64&&f<r.length;f++)i[f]=r[f]^a[f-h];F8(s,0,o)}return xf.wipe(a),n===0&&xf.wipe(s),i}tc.streamXOR=cp;function B8(t,e,r,i){return i===void 0&&(i=0),xf.wipe(r),cp(t,e,r,r,i)}tc.stream=B8;function F8(t,e,r){for(var i=1;r--;)i=i+(t[e]&255)|0,t[e]=i&255,i>>>=8,e++;if(i>0)throw new Error("ChaCha: counter overflow")}var fp={},fn={};Object.defineProperty(fn,"__esModule",{value:!0});function L8(t,e,r){return~(t-1)&e|t-1&r}fn.select=L8;function U8(t,e){return(t|0)-(e|0)-1>>>31&1}fn.lessOrEqual=U8;function hp(t,e){if(t.length!==e.length)return 0;for(var r=0,i=0;i<t.length;i++)r|=t[i]^e[i];return 1&r-1>>>8}fn.compare=hp;function k8(t,e){return t.length===0||e.length===0?!1:hp(t,e)!==0}fn.equal=k8;(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=fn,r=mr;t.DIGEST_LENGTH=16;var i=function(){function o(a){this.digestLength=t.DIGEST_LENGTH,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,this._finished=!1;var h=a[0]|a[1]<<8;this._r[0]=h&8191;var f=a[2]|a[3]<<8;this._r[1]=(h>>>13|f<<3)&8191;var p=a[4]|a[5]<<8;this._r[2]=(f>>>10|p<<6)&7939;var v=a[6]|a[7]<<8;this._r[3]=(p>>>7|v<<9)&8191;var x=a[8]|a[9]<<8;this._r[4]=(v>>>4|x<<12)&255,this._r[5]=x>>>1&8190;var E=a[10]|a[11]<<8;this._r[6]=(x>>>14|E<<2)&8191;var D=a[12]|a[13]<<8;this._r[7]=(E>>>11|D<<5)&8065;var B=a[14]|a[15]<<8;this._r[8]=(D>>>8|B<<8)&8191,this._r[9]=B>>>5&127,this._pad[0]=a[16]|a[17]<<8,this._pad[1]=a[18]|a[19]<<8,this._pad[2]=a[20]|a[21]<<8,this._pad[3]=a[22]|a[23]<<8,this._pad[4]=a[24]|a[25]<<8,this._pad[5]=a[26]|a[27]<<8,this._pad[6]=a[28]|a[29]<<8,this._pad[7]=a[30]|a[31]<<8}return o.prototype._blocks=function(a,h,f){for(var p=this._fin?0:2048,v=this._h[0],x=this._h[1],E=this._h[2],D=this._h[3],B=this._h[4],F=this._h[5],j=this._h[6],R=this._h[7],K=this._h[8],T=this._h[9],L=this._r[0],q=this._r[1],y=this._r[2],P=this._r[3],Z=this._r[4],ne=this._r[5],U=this._r[6],b=this._r[7],c=this._r[8],u=this._r[9];f>=16;){var g=a[h+0]|a[h+1]<<8;v+=g&8191;var w=a[h+2]|a[h+3]<<8;x+=(g>>>13|w<<3)&8191;var S=a[h+4]|a[h+5]<<8;E+=(w>>>10|S<<6)&8191;var C=a[h+6]|a[h+7]<<8;D+=(S>>>7|C<<9)&8191;var _=a[h+8]|a[h+9]<<8;B+=(C>>>4|_<<12)&8191,F+=_>>>1&8191;var l=a[h+10]|a[h+11]<<8;j+=(_>>>14|l<<2)&8191;var d=a[h+12]|a[h+13]<<8;R+=(l>>>11|d<<5)&8191;var N=a[h+14]|a[h+15]<<8;K+=(d>>>8|N<<8)&8191,T+=N>>>5|p;var Y=0,te=Y;te+=v*L,te+=x*(5*u),te+=E*(5*c),te+=D*(5*b),te+=B*(5*U),Y=te>>>13,te&=8191,te+=F*(5*ne),te+=j*(5*Z),te+=R*(5*P),te+=K*(5*y),te+=T*(5*q),Y+=te>>>13,te&=8191;var I=Y;I+=v*q,I+=x*L,I+=E*(5*u),I+=D*(5*c),I+=B*(5*b),Y=I>>>13,I&=8191,I+=F*(5*U),I+=j*(5*ne),I+=R*(5*Z),I+=K*(5*P),I+=T*(5*y),Y+=I>>>13,I&=8191;var J=Y;J+=v*y,J+=x*q,J+=E*L,J+=D*(5*u),J+=B*(5*c),Y=J>>>13,J&=8191,J+=F*(5*b),J+=j*(5*U),J+=R*(5*ne),J+=K*(5*Z),J+=T*(5*P),Y+=J>>>13,J&=8191;var k=Y;k+=v*P,k+=x*y,k+=E*q,k+=D*L,k+=B*(5*u),Y=k>>>13,k&=8191,k+=F*(5*c),k+=j*(5*b),k+=R*(5*U),k+=K*(5*ne),k+=T*(5*Z),Y+=k>>>13,k&=8191;var H=Y;H+=v*Z,H+=x*P,H+=E*y,H+=D*q,H+=B*L,Y=H>>>13,H&=8191,H+=F*(5*u),H+=j*(5*c),H+=R*(5*b),H+=K*(5*U),H+=T*(5*ne),Y+=H>>>13,H&=8191;var V=Y;V+=v*ne,V+=x*Z,V+=E*P,V+=D*y,V+=B*q,Y=V>>>13,V&=8191,V+=F*L,V+=j*(5*u),V+=R*(5*c),V+=K*(5*b),V+=T*(5*U),Y+=V>>>13,V&=8191;var m=Y;m+=v*U,m+=x*ne,m+=E*Z,m+=D*P,m+=B*y,Y=m>>>13,m&=8191,m+=F*q,m+=j*L,m+=R*(5*u),m+=K*(5*c),m+=T*(5*b),Y+=m>>>13,m&=8191;var z=Y;z+=v*b,z+=x*U,z+=E*ne,z+=D*Z,z+=B*P,Y=z>>>13,z&=8191,z+=F*y,z+=j*q,z+=R*L,z+=K*(5*u),z+=T*(5*c),Y+=z>>>13,z&=8191;var ee=Y;ee+=v*c,ee+=x*b,ee+=E*U,ee+=D*ne,ee+=B*Z,Y=ee>>>13,ee&=8191,ee+=F*P,ee+=j*y,ee+=R*q,ee+=K*L,ee+=T*(5*u),Y+=ee>>>13,ee&=8191;var ie=Y;ie+=v*u,ie+=x*c,ie+=E*b,ie+=D*U,ie+=B*ne,Y=ie>>>13,ie&=8191,ie+=F*Z,ie+=j*P,ie+=R*y,ie+=K*q,ie+=T*L,Y+=ie>>>13,ie&=8191,Y=(Y<<2)+Y|0,Y=Y+te|0,te=Y&8191,Y=Y>>>13,I+=Y,v=te,x=I,E=J,D=k,B=H,F=V,j=m,R=z,K=ee,T=ie,h+=16,f-=16}this._h[0]=v,this._h[1]=x,this._h[2]=E,this._h[3]=D,this._h[4]=B,this._h[5]=F,this._h[6]=j,this._h[7]=R,this._h[8]=K,this._h[9]=T},o.prototype.finish=function(a,h){h===void 0&&(h=0);var f=new Uint16Array(10),p,v,x,E;if(this._leftover){for(E=this._leftover,this._buffer[E++]=1;E<16;E++)this._buffer[E]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(p=this._h[1]>>>13,this._h[1]&=8191,E=2;E<10;E++)this._h[E]+=p,p=this._h[E]>>>13,this._h[E]&=8191;for(this._h[0]+=p*5,p=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=p,p=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=p,f[0]=this._h[0]+5,p=f[0]>>>13,f[0]&=8191,E=1;E<10;E++)f[E]=this._h[E]+p,p=f[E]>>>13,f[E]&=8191;for(f[9]-=8192,v=(p^1)-1,E=0;E<10;E++)f[E]&=v;for(v=~v,E=0;E<10;E++)this._h[E]=this._h[E]&v|f[E];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,x=this._h[0]+this._pad[0],this._h[0]=x&65535,E=1;E<8;E++)x=(this._h[E]+this._pad[E]|0)+(x>>>16)|0,this._h[E]=x&65535;return a[h+0]=this._h[0]>>>0,a[h+1]=this._h[0]>>>8,a[h+2]=this._h[1]>>>0,a[h+3]=this._h[1]>>>8,a[h+4]=this._h[2]>>>0,a[h+5]=this._h[2]>>>8,a[h+6]=this._h[3]>>>0,a[h+7]=this._h[3]>>>8,a[h+8]=this._h[4]>>>0,a[h+9]=this._h[4]>>>8,a[h+10]=this._h[5]>>>0,a[h+11]=this._h[5]>>>8,a[h+12]=this._h[6]>>>0,a[h+13]=this._h[6]>>>8,a[h+14]=this._h[7]>>>0,a[h+15]=this._h[7]>>>8,this._finished=!0,this},o.prototype.update=function(a){var h=0,f=a.length,p;if(this._leftover){p=16-this._leftover,p>f&&(p=f);for(var v=0;v<p;v++)this._buffer[this._leftover+v]=a[h+v];if(f-=p,h+=p,this._leftover+=p,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(p=f-f%16,this._blocks(a,h,p),h+=p,f-=p),f){for(var v=0;v<f;v++)this._buffer[this._leftover+v]=a[h+v];this._leftover+=f}return this},o.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var a=new Uint8Array(16);return this.finish(a),a},o.prototype.clean=function(){return r.wipe(this._buffer),r.wipe(this._r),r.wipe(this._h),r.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},o}();t.Poly1305=i;function n(o,a){var h=new i(o);h.update(a);var f=h.digest();return h.clean(),f}t.oneTimeAuth=n;function s(o,a){return o.length!==t.DIGEST_LENGTH||a.length!==t.DIGEST_LENGTH?!1:e.equal(o,a)}t.equal=s})(fp);(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=tc,r=fp,i=mr,n=We,s=fn;t.KEY_LENGTH=32,t.NONCE_LENGTH=12,t.TAG_LENGTH=16;var o=new Uint8Array(16),a=function(){function h(f){if(this.nonceLength=t.NONCE_LENGTH,this.tagLength=t.TAG_LENGTH,f.length!==t.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return h.prototype.seal=function(f,p,v,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var E=new Uint8Array(16);E.set(f,E.length-f.length);var D=new Uint8Array(32);e.stream(this._key,E,D,4);var B=p.length+this.tagLength,F;if(x){if(x.length!==B)throw new Error("ChaCha20Poly1305: incorrect destination length");F=x}else F=new Uint8Array(B);return e.streamXOR(this._key,E,p,F,4),this._authenticate(F.subarray(F.length-this.tagLength,F.length),D,F.subarray(0,F.length-this.tagLength),v),i.wipe(E),F},h.prototype.open=function(f,p,v,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(p.length<this.tagLength)return null;var E=new Uint8Array(16);E.set(f,E.length-f.length);var D=new Uint8Array(32);e.stream(this._key,E,D,4);var B=new Uint8Array(this.tagLength);if(this._authenticate(B,D,p.subarray(0,p.length-this.tagLength),v),!s.equal(B,p.subarray(p.length-this.tagLength,p.length)))return null;var F=p.length-this.tagLength,j;if(x){if(x.length!==F)throw new Error("ChaCha20Poly1305: incorrect destination length");j=x}else j=new Uint8Array(F);return e.streamXOR(this._key,E,p.subarray(0,p.length-this.tagLength),j,4),i.wipe(E),j},h.prototype.clean=function(){return i.wipe(this._key),this},h.prototype._authenticate=function(f,p,v,x){var E=new r.Poly1305(p);x&&(E.update(x),x.length%16>0&&E.update(o.subarray(x.length%16))),E.update(v),v.length%16>0&&E.update(o.subarray(v.length%16));var D=new Uint8Array(8);x&&n.writeUint64LE(x.length,D),E.update(D),n.writeUint64LE(v.length,D),E.update(D);for(var B=E.digest(),F=0;F<B.length;F++)f[F]=B[F];E.clean(),i.wipe(B),i.wipe(D)},h}();t.ChaCha20Poly1305=a})(vh);var up={},_o={},mh={};Object.defineProperty(mh,"__esModule",{value:!0});function $8(t){return typeof t.saveState<"u"&&typeof t.restoreState<"u"&&typeof t.cleanSavedState<"u"}mh.isSerializableHash=$8;Object.defineProperty(_o,"__esModule",{value:!0});var Hr=mh,q8=fn,z8=mr,lp=function(){function t(e,r){this._finished=!1,this._inner=new e,this._outer=new e,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);r.length>this.blockSize?this._inner.update(r).finish(i).clean():i.set(r);for(var n=0;n<i.length;n++)i[n]^=54;this._inner.update(i);for(var n=0;n<i.length;n++)i[n]^=106;this._outer.update(i),Hr.isSerializableHash(this._inner)&&Hr.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),z8.wipe(i)}return t.prototype.reset=function(){if(!Hr.isSerializableHash(this._inner)||!Hr.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.clean=function(){Hr.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Hr.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},t.prototype.update=function(e){return this._inner.update(e),this},t.prototype.finish=function(e){return this._finished?(this._outer.finish(e),this):(this._inner.finish(e),this._outer.update(e.subarray(0,this.digestLength)).finish(e),this._finished=!0,this)},t.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},t.prototype.saveState=function(){if(!Hr.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},t.prototype.restoreState=function(e){if(!Hr.isSerializableHash(this._inner)||!Hr.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(e),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},t.prototype.cleanSavedState=function(e){if(!Hr.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(e)},t}();_o.HMAC=lp;function K8(t,e,r){var i=new lp(t,e);i.update(r);var n=i.digest();return i.clean(),n}_o.hmac=K8;_o.equal=q8.equal;Object.defineProperty(up,"__esModule",{value:!0});var fl=_o,hl=mr,j8=function(){function t(e,r,i,n){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=e,this._info=n;var s=fl.hmac(this._hash,i,r);this._hmac=new fl.HMAC(e,s),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return t.prototype._fillBuffer=function(){this._counter[0]++;var e=this._counter[0];if(e===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),e>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},t.prototype.expand=function(e){for(var r=new Uint8Array(e),i=0;i<r.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),r[i]=this._buffer[this._bufpos++];return r},t.prototype.clean=function(){this._hmac.clean(),hl.wipe(this._buffer),hl.wipe(this._counter),this._bufpos=0},t}(),H8=up.HKDF=j8,Eo={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var e=We,r=mr;t.DIGEST_LENGTH=32,t.BLOCK_SIZE=64;var i=function(){function a(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return a.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},a.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},a.prototype.clean=function(){r.wipe(this._buffer),r.wipe(this._temp),this.reset()},a.prototype.update=function(h,f){if(f===void 0&&(f=h.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var p=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=h[p++],f--;this._bufferLength===this.blockSize&&(s(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(p=s(this._temp,this._state,h,p,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=h[p++],f--;return this},a.prototype.finish=function(h){if(!this._finished){var f=this._bytesHashed,p=this._bufferLength,v=f/536870912|0,x=f<<3,E=f%64<56?64:128;this._buffer[p]=128;for(var D=p+1;D<E-8;D++)this._buffer[D]=0;e.writeUint32BE(v,this._buffer,E-8),e.writeUint32BE(x,this._buffer,E-4),s(this._temp,this._state,this._buffer,0,E),this._finished=!0}for(var D=0;D<this.digestLength/4;D++)e.writeUint32BE(this._state[D],h,D*4);return this},a.prototype.digest=function(){var h=new Uint8Array(this.digestLength);return this.finish(h),h},a.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},a.prototype.restoreState=function(h){return this._state.set(h.state),this._bufferLength=h.bufferLength,h.buffer&&this._buffer.set(h.buffer),this._bytesHashed=h.bytesHashed,this._finished=!1,this},a.prototype.cleanSavedState=function(h){r.wipe(h.state),h.buffer&&r.wipe(h.buffer),h.bufferLength=0,h.bytesHashed=0},a}();t.SHA256=i;var n=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function s(a,h,f,p,v){for(;v>=64;){for(var x=h[0],E=h[1],D=h[2],B=h[3],F=h[4],j=h[5],R=h[6],K=h[7],T=0;T<16;T++){var L=p+T*4;a[T]=e.readUint32BE(f,L)}for(var T=16;T<64;T++){var q=a[T-2],y=(q>>>17|q<<15)^(q>>>19|q<<13)^q>>>10;q=a[T-15];var P=(q>>>7|q<<25)^(q>>>18|q<<14)^q>>>3;a[T]=(y+a[T-7]|0)+(P+a[T-16]|0)}for(var T=0;T<64;T++){var y=(((F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7))+(F&j^~F&R)|0)+(K+(n[T]+a[T]|0)|0)|0,P=((x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10))+(x&E^x&D^E&D)|0;K=R,R=j,j=F,F=B+y|0,B=D,D=E,E=x,x=y+P|0}h[0]+=x,h[1]+=E,h[2]+=D,h[3]+=B,h[4]+=F,h[5]+=j,h[6]+=R,h[7]+=K,p+=64,v-=64}return p}function o(a){var h=new i;h.update(a);var f=h.digest();return h.clean(),f}t.hash=o})(Eo);var yh={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sharedKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.scalarMultBase=t.scalarMult=t.SHARED_KEY_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=void 0;const e=cn,r=mr;t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=32,t.SHARED_KEY_LENGTH=32;function i(T){const L=new Float64Array(16);if(T)for(let q=0;q<T.length;q++)L[q]=T[q];return L}const n=new Uint8Array(32);n[0]=9;const s=i([56129,1]);function o(T){let L=1;for(let q=0;q<16;q++){let y=T[q]+L+65535;L=Math.floor(y/65536),T[q]=y-L*65536}T[0]+=L-1+37*(L-1)}function a(T,L,q){const y=~(q-1);for(let P=0;P<16;P++){const Z=y&(T[P]^L[P]);T[P]^=Z,L[P]^=Z}}function h(T,L){const q=i(),y=i();for(let P=0;P<16;P++)y[P]=L[P];o(y),o(y),o(y);for(let P=0;P<2;P++){q[0]=y[0]-65517;for(let ne=1;ne<15;ne++)q[ne]=y[ne]-65535-(q[ne-1]>>16&1),q[ne-1]&=65535;q[15]=y[15]-32767-(q[14]>>16&1);const Z=q[15]>>16&1;q[14]&=65535,a(y,q,1-Z)}for(let P=0;P<16;P++)T[2*P]=y[P]&255,T[2*P+1]=y[P]>>8}function f(T,L){for(let q=0;q<16;q++)T[q]=L[2*q]+(L[2*q+1]<<8);T[15]&=32767}function p(T,L,q){for(let y=0;y<16;y++)T[y]=L[y]+q[y]}function v(T,L,q){for(let y=0;y<16;y++)T[y]=L[y]-q[y]}function x(T,L,q){let y,P,Z=0,ne=0,U=0,b=0,c=0,u=0,g=0,w=0,S=0,C=0,_=0,l=0,d=0,N=0,Y=0,te=0,I=0,J=0,k=0,H=0,V=0,m=0,z=0,ee=0,ie=0,se=0,de=0,O=0,A=0,M=0,$=0,G=q[0],re=q[1],X=q[2],ce=q[3],fe=q[4],oe=q[5],le=q[6],he=q[7],ue=q[8],we=q[9],me=q[10],ge=q[11],De=q[12],Ne=q[13],ve=q[14],Ce=q[15];y=L[0],Z+=y*G,ne+=y*re,U+=y*X,b+=y*ce,c+=y*fe,u+=y*oe,g+=y*le,w+=y*he,S+=y*ue,C+=y*we,_+=y*me,l+=y*ge,d+=y*De,N+=y*Ne,Y+=y*ve,te+=y*Ce,y=L[1],ne+=y*G,U+=y*re,b+=y*X,c+=y*ce,u+=y*fe,g+=y*oe,w+=y*le,S+=y*he,C+=y*ue,_+=y*we,l+=y*me,d+=y*ge,N+=y*De,Y+=y*Ne,te+=y*ve,I+=y*Ce,y=L[2],U+=y*G,b+=y*re,c+=y*X,u+=y*ce,g+=y*fe,w+=y*oe,S+=y*le,C+=y*he,_+=y*ue,l+=y*we,d+=y*me,N+=y*ge,Y+=y*De,te+=y*Ne,I+=y*ve,J+=y*Ce,y=L[3],b+=y*G,c+=y*re,u+=y*X,g+=y*ce,w+=y*fe,S+=y*oe,C+=y*le,_+=y*he,l+=y*ue,d+=y*we,N+=y*me,Y+=y*ge,te+=y*De,I+=y*Ne,J+=y*ve,k+=y*Ce,y=L[4],c+=y*G,u+=y*re,g+=y*X,w+=y*ce,S+=y*fe,C+=y*oe,_+=y*le,l+=y*he,d+=y*ue,N+=y*we,Y+=y*me,te+=y*ge,I+=y*De,J+=y*Ne,k+=y*ve,H+=y*Ce,y=L[5],u+=y*G,g+=y*re,w+=y*X,S+=y*ce,C+=y*fe,_+=y*oe,l+=y*le,d+=y*he,N+=y*ue,Y+=y*we,te+=y*me,I+=y*ge,J+=y*De,k+=y*Ne,H+=y*ve,V+=y*Ce,y=L[6],g+=y*G,w+=y*re,S+=y*X,C+=y*ce,_+=y*fe,l+=y*oe,d+=y*le,N+=y*he,Y+=y*ue,te+=y*we,I+=y*me,J+=y*ge,k+=y*De,H+=y*Ne,V+=y*ve,m+=y*Ce,y=L[7],w+=y*G,S+=y*re,C+=y*X,_+=y*ce,l+=y*fe,d+=y*oe,N+=y*le,Y+=y*he,te+=y*ue,I+=y*we,J+=y*me,k+=y*ge,H+=y*De,V+=y*Ne,m+=y*ve,z+=y*Ce,y=L[8],S+=y*G,C+=y*re,_+=y*X,l+=y*ce,d+=y*fe,N+=y*oe,Y+=y*le,te+=y*he,I+=y*ue,J+=y*we,k+=y*me,H+=y*ge,V+=y*De,m+=y*Ne,z+=y*ve,ee+=y*Ce,y=L[9],C+=y*G,_+=y*re,l+=y*X,d+=y*ce,N+=y*fe,Y+=y*oe,te+=y*le,I+=y*he,J+=y*ue,k+=y*we,H+=y*me,V+=y*ge,m+=y*De,z+=y*Ne,ee+=y*ve,ie+=y*Ce,y=L[10],_+=y*G,l+=y*re,d+=y*X,N+=y*ce,Y+=y*fe,te+=y*oe,I+=y*le,J+=y*he,k+=y*ue,H+=y*we,V+=y*me,m+=y*ge,z+=y*De,ee+=y*Ne,ie+=y*ve,se+=y*Ce,y=L[11],l+=y*G,d+=y*re,N+=y*X,Y+=y*ce,te+=y*fe,I+=y*oe,J+=y*le,k+=y*he,H+=y*ue,V+=y*we,m+=y*me,z+=y*ge,ee+=y*De,ie+=y*Ne,se+=y*ve,de+=y*Ce,y=L[12],d+=y*G,N+=y*re,Y+=y*X,te+=y*ce,I+=y*fe,J+=y*oe,k+=y*le,H+=y*he,V+=y*ue,m+=y*we,z+=y*me,ee+=y*ge,ie+=y*De,se+=y*Ne,de+=y*ve,O+=y*Ce,y=L[13],N+=y*G,Y+=y*re,te+=y*X,I+=y*ce,J+=y*fe,k+=y*oe,H+=y*le,V+=y*he,m+=y*ue,z+=y*we,ee+=y*me,ie+=y*ge,se+=y*De,de+=y*Ne,O+=y*ve,A+=y*Ce,y=L[14],Y+=y*G,te+=y*re,I+=y*X,J+=y*ce,k+=y*fe,H+=y*oe,V+=y*le,m+=y*he,z+=y*ue,ee+=y*we,ie+=y*me,se+=y*ge,de+=y*De,O+=y*Ne,A+=y*ve,M+=y*Ce,y=L[15],te+=y*G,I+=y*re,J+=y*X,k+=y*ce,H+=y*fe,V+=y*oe,m+=y*le,z+=y*he,ee+=y*ue,ie+=y*we,se+=y*me,de+=y*ge,O+=y*De,A+=y*Ne,M+=y*ve,$+=y*Ce,Z+=38*I,ne+=38*J,U+=38*k,b+=38*H,c+=38*V,u+=38*m,g+=38*z,w+=38*ee,S+=38*ie,C+=38*se,_+=38*de,l+=38*O,d+=38*A,N+=38*M,Y+=38*$,P=1,y=Z+P+65535,P=Math.floor(y/65536),Z=y-P*65536,y=ne+P+65535,P=Math.floor(y/65536),ne=y-P*65536,y=U+P+65535,P=Math.floor(y/65536),U=y-P*65536,y=b+P+65535,P=Math.floor(y/65536),b=y-P*65536,y=c+P+65535,P=Math.floor(y/65536),c=y-P*65536,y=u+P+65535,P=Math.floor(y/65536),u=y-P*65536,y=g+P+65535,P=Math.floor(y/65536),g=y-P*65536,y=w+P+65535,P=Math.floor(y/65536),w=y-P*65536,y=S+P+65535,P=Math.floor(y/65536),S=y-P*65536,y=C+P+65535,P=Math.floor(y/65536),C=y-P*65536,y=_+P+65535,P=Math.floor(y/65536),_=y-P*65536,y=l+P+65535,P=Math.floor(y/65536),l=y-P*65536,y=d+P+65535,P=Math.floor(y/65536),d=y-P*65536,y=N+P+65535,P=Math.floor(y/65536),N=y-P*65536,y=Y+P+65535,P=Math.floor(y/65536),Y=y-P*65536,y=te+P+65535,P=Math.floor(y/65536),te=y-P*65536,Z+=P-1+37*(P-1),P=1,y=Z+P+65535,P=Math.floor(y/65536),Z=y-P*65536,y=ne+P+65535,P=Math.floor(y/65536),ne=y-P*65536,y=U+P+65535,P=Math.floor(y/65536),U=y-P*65536,y=b+P+65535,P=Math.floor(y/65536),b=y-P*65536,y=c+P+65535,P=Math.floor(y/65536),c=y-P*65536,y=u+P+65535,P=Math.floor(y/65536),u=y-P*65536,y=g+P+65535,P=Math.floor(y/65536),g=y-P*65536,y=w+P+65535,P=Math.floor(y/65536),w=y-P*65536,y=S+P+65535,P=Math.floor(y/65536),S=y-P*65536,y=C+P+65535,P=Math.floor(y/65536),C=y-P*65536,y=_+P+65535,P=Math.floor(y/65536),_=y-P*65536,y=l+P+65535,P=Math.floor(y/65536),l=y-P*65536,y=d+P+65535,P=Math.floor(y/65536),d=y-P*65536,y=N+P+65535,P=Math.floor(y/65536),N=y-P*65536,y=Y+P+65535,P=Math.floor(y/65536),Y=y-P*65536,y=te+P+65535,P=Math.floor(y/65536),te=y-P*65536,Z+=P-1+37*(P-1),T[0]=Z,T[1]=ne,T[2]=U,T[3]=b,T[4]=c,T[5]=u,T[6]=g,T[7]=w,T[8]=S,T[9]=C,T[10]=_,T[11]=l,T[12]=d,T[13]=N,T[14]=Y,T[15]=te}function E(T,L){x(T,L,L)}function D(T,L){const q=i();for(let y=0;y<16;y++)q[y]=L[y];for(let y=253;y>=0;y--)E(q,q),y!==2&&y!==4&&x(q,q,L);for(let y=0;y<16;y++)T[y]=q[y]}function B(T,L){const q=new Uint8Array(32),y=new Float64Array(80),P=i(),Z=i(),ne=i(),U=i(),b=i(),c=i();for(let S=0;S<31;S++)q[S]=T[S];q[31]=T[31]&127|64,q[0]&=248,f(y,L);for(let S=0;S<16;S++)Z[S]=y[S];P[0]=U[0]=1;for(let S=254;S>=0;--S){const C=q[S>>>3]>>>(S&7)&1;a(P,Z,C),a(ne,U,C),p(b,P,ne),v(P,P,ne),p(ne,Z,U),v(Z,Z,U),E(U,b),E(c,P),x(P,ne,P),x(ne,Z,b),p(b,P,ne),v(P,P,ne),E(Z,P),v(ne,U,c),x(P,ne,s),p(P,P,U),x(ne,ne,P),x(P,U,c),x(U,Z,y),E(Z,b),a(P,Z,C),a(ne,U,C)}for(let S=0;S<16;S++)y[S+16]=P[S],y[S+32]=ne[S],y[S+48]=Z[S],y[S+64]=U[S];const u=y.subarray(32),g=y.subarray(16);D(u,u),x(g,g,u);const w=new Uint8Array(32);return h(w,g),w}t.scalarMult=B;function F(T){return B(T,n)}t.scalarMultBase=F;function j(T){if(T.length!==t.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${t.SECRET_KEY_LENGTH} bytes`);const L=new Uint8Array(T);return{publicKey:F(L),secretKey:L}}t.generateKeyPairFromSeed=j;function R(T){const L=(0,e.randomBytes)(32,T),q=j(L);return(0,r.wipe)(L),q}t.generateKeyPair=R;function K(T,L,q=!1){if(T.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(L.length!==t.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const y=B(T,L);if(q){let P=0;for(let Z=0;Z<y.length;Z++)P|=y[Z];if(P===0)throw new Error("X25519: invalid shared key")}return y}t.sharedKey=K})(yh);const V8={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}};var W8={};const dp=":";function Tc(t){const[e,r]=t.split(dp);return{namespace:e,reference:r}}function G8(t){const[e,r,i]=t.split(dp);return{namespace:e,reference:r,address:i}}function pp(t,e){return t.includes(":")?[t]:e.chains||[]}var Y8=Object.defineProperty,ul=Object.getOwnPropertySymbols,J8=Object.prototype.hasOwnProperty,Q8=Object.prototype.propertyIsEnumerable,ll=(t,e,r)=>e in t?Y8(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,dl=(t,e)=>{for(var r in e||(e={}))J8.call(e,r)&&ll(t,r,e[r]);if(ul)for(var r of ul(e))Q8.call(e,r)&&ll(t,r,e[r]);return t};const X8="ReactNative",dr={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Z8="js";function va(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Es(){return!ec()&&!!gh()&&navigator.product===X8}function Ao(){return!va()&&!!gh()&&!!ec()}function xo(){return Es()?dr.reactNative:va()?dr.node:Ao()?dr.browser:dr.unknown}function e4(){var t;try{return Es()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(t=global.Application)==null?void 0:t.applicationId:void 0}catch{return}}function t4(t,e){let r=ao.parse(t);return r=dl(dl({},r),e),t=ao.stringify(r),t}function gp(){return op()||{name:"",description:"",url:"",icons:[""]}}function r4(){if(xo()===dr.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:r,Version:i}=global.Platform;return[r,i].join("-")}const t=h8();if(t===null)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return t.type==="browser"?[e,t.name,t.version].join("-"):[e,t.version].join("-")}function i4(){var t;const e=xo();return e===dr.browser?[e,((t=sp())==null?void 0:t.host)||"unknown"].join(":"):e}function bp(t,e,r){const i=r4(),n=i4();return[[t,e].join("-"),[Z8,r].join("-"),i,n].join("/")}function n4({protocol:t,version:e,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o,bundleId:a}){const h=r.split("?"),f=bp(t,e,i),p={auth:n,ua:f,projectId:s,useOnCloseEvent:o||void 0,origin:a||void 0},v=t4(h[1]||"",p);return h[0]+"?"+v}function _n(t,e){return t.filter(r=>e.includes(r)).length===t.length}function vp(t){return Object.fromEntries(t.entries())}function mp(t){return new Map(Object.entries(t))}function vn(t=be.FIVE_MINUTES,e){const r=be.toMiliseconds(t||be.FIVE_MINUTES);let i,n,s;return{resolve:o=>{s&&i&&(clearTimeout(s),i(o))},reject:o=>{s&&n&&(clearTimeout(s),n(o))},done:()=>new Promise((o,a)=>{s=setTimeout(()=>{a(new Error(e))},r),i=o,n=a})}}function Yn(t,e,r){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(r)),e);try{const o=await t;i(o)}catch(o){n(o)}clearTimeout(s)})}function yp(t,e){if(typeof e=="string"&&e.startsWith(`${t}:`))return e;if(t.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(t.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function s4(t){return yp("topic",t)}function o4(t){return yp("id",t)}function wp(t){const[e,r]=t.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof r=="string")i.topic=r;else if(e==="id"&&Number.isInteger(Number(r)))i.id=Number(r);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${r}`);return i}function xt(t,e){return be.fromMiliseconds(Date.now()+be.toMiliseconds(t))}function Gi(t){return Date.now()>=be.toMiliseconds(t)}function Xe(t,e){return`${t}${e?`:${e}`:""}`}function a4(t=[],e=[]){return[...new Set([...t,...e])]}async function c4({id:t,topic:e,wcDeepLink:r}){var i;try{if(!r)return;const n=typeof r=="string"?JSON.parse(r):r,s=n==null?void 0:n.href;if(typeof s!="string")return;const o=f4(s,t,e),a=xo();if(a===dr.browser){if(!((i=ec())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}o.startsWith("https://")||o.startsWith("http://")?window.open(o,"_blank","noreferrer noopener"):window.open(o,u4()?"_blank":"_self","noreferrer noopener")}else a===dr.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(n){console.error(n)}}function f4(t,e,r){const i=`requestId=${e}&sessionTopic=${r}`;t.endsWith("/")&&(t=t.slice(0,-1));let n=`${t}`;if(t.startsWith("https://t.me")){const s=t.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${l4(i,!0)}`}else n=`${n}/wc?${i}`;return n}async function h4(t,e){let r="";try{if(Ao()&&(r=localStorage.getItem(e),r))return r;r=await t.getItem(e)}catch(i){console.error(i)}return r}function pl(t,e){if(!t.includes(e))return null;const r=t.split(/([&,?,=])/),i=r.indexOf(e);return r[i+2]}function gl(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function wh(){return typeof process<"u"&&W8.IS_VITEST==="true"}function u4(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function l4(t,e=!1){const r=Buffer.from(t).toString("base64");return e?r.replace(/[=]/g,""):r}function _p(t){return Buffer.from(t,"base64").toString("utf-8")}var Ep=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function d4(t){var e=t.default;if(typeof e=="function"){var r=function(){return e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}),r}var Ap={exports:{}};/**
541
- * [js-sha3]{@link https://github.com/emn178/js-sha3}
542
- *
543
- * @version 0.8.0
544
- * @author Chen, Yi-Cyuan [emn178@gmail.com]
545
- * @copyright Chen, Yi-Cyuan 2015-2018
546
- * @license MIT
547
- */(function(t){(function(){var e="input is invalid type",r="finalize already called",i=typeof window=="object",n=i?window:{};n.JS_SHA3_NO_WINDOW&&(i=!1);var s=!i&&typeof self=="object",o=!n.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?n=Ep:s&&(n=self);var a=!n.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,h=!n.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",f="0123456789abcdef".split(""),p=[31,7936,2031616,520093696],v=[4,1024,262144,67108864],x=[1,256,65536,16777216],E=[6,1536,393216,100663296],D=[0,8,16,24],B=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],F=[224,256,384,512],j=[128,256],R=["hex","buffer","arrayBuffer","array","digest"],K={128:168,256:136};(n.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(I){return Object.prototype.toString.call(I)==="[object Array]"}),h&&(n.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(I){return typeof I=="object"&&I.buffer&&I.buffer.constructor===ArrayBuffer});for(var T=function(I,J,k){return function(H){return new N(I,J,I).update(H)[k]()}},L=function(I,J,k){return function(H,V){return new N(I,J,V).update(H)[k]()}},q=function(I,J,k){return function(H,V,m,z){return u["cshake"+I].update(H,V,m,z)[k]()}},y=function(I,J,k){return function(H,V,m,z){return u["kmac"+I].update(H,V,m,z)[k]()}},P=function(I,J,k,H){for(var V=0;V<R.length;++V){var m=R[V];I[m]=J(k,H,m)}return I},Z=function(I,J){var k=T(I,J,"hex");return k.create=function(){return new N(I,J,I)},k.update=function(H){return k.create().update(H)},P(k,T,I,J)},ne=function(I,J){var k=L(I,J,"hex");return k.create=function(H){return new N(I,J,H)},k.update=function(H,V){return k.create(V).update(H)},P(k,L,I,J)},U=function(I,J){var k=K[I],H=q(I,J,"hex");return H.create=function(V,m,z){return!m&&!z?u["shake"+I].create(V):new N(I,J,V).bytepad([m,z],k)},H.update=function(V,m,z,ee){return H.create(m,z,ee).update(V)},P(H,q,I,J)},b=function(I,J){var k=K[I],H=y(I,J,"hex");return H.create=function(V,m,z){return new Y(I,J,m).bytepad(["KMAC",z],k).bytepad([V],k)},H.update=function(V,m,z,ee){return H.create(V,z,ee).update(m)},P(H,y,I,J)},c=[{name:"keccak",padding:x,bits:F,createMethod:Z},{name:"sha3",padding:E,bits:F,createMethod:Z},{name:"shake",padding:p,bits:j,createMethod:ne},{name:"cshake",padding:v,bits:j,createMethod:U},{name:"kmac",padding:v,bits:j,createMethod:b}],u={},g=[],w=0;w<c.length;++w)for(var S=c[w],C=S.bits,_=0;_<C.length;++_){var l=S.name+"_"+C[_];if(g.push(l),u[l]=S.createMethod(C[_],S.padding),S.name!=="sha3"){var d=S.name+C[_];g.push(d),u[d]=u[l]}}function N(I,J,k){this.blocks=[],this.s=[],this.padding=J,this.outputBits=k,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(I<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=k>>5,this.extraBytes=(k&31)>>3;for(var H=0;H<50;++H)this.s[H]=0}N.prototype.update=function(I){if(this.finalized)throw new Error(r);var J,k=typeof I;if(k!=="string"){if(k==="object"){if(I===null)throw new Error(e);if(h&&I.constructor===ArrayBuffer)I=new Uint8Array(I);else if(!Array.isArray(I)&&(!h||!ArrayBuffer.isView(I)))throw new Error(e)}else throw new Error(e);J=!0}for(var H=this.blocks,V=this.byteCount,m=I.length,z=this.blockCount,ee=0,ie=this.s,se,de;ee<m;){if(this.reset)for(this.reset=!1,H[0]=this.block,se=1;se<z+1;++se)H[se]=0;if(J)for(se=this.start;ee<m&&se<V;++ee)H[se>>2]|=I[ee]<<D[se++&3];else for(se=this.start;ee<m&&se<V;++ee)de=I.charCodeAt(ee),de<128?H[se>>2]|=de<<D[se++&3]:de<2048?(H[se>>2]|=(192|de>>6)<<D[se++&3],H[se>>2]|=(128|de&63)<<D[se++&3]):de<55296||de>=57344?(H[se>>2]|=(224|de>>12)<<D[se++&3],H[se>>2]|=(128|de>>6&63)<<D[se++&3],H[se>>2]|=(128|de&63)<<D[se++&3]):(de=65536+((de&1023)<<10|I.charCodeAt(++ee)&1023),H[se>>2]|=(240|de>>18)<<D[se++&3],H[se>>2]|=(128|de>>12&63)<<D[se++&3],H[se>>2]|=(128|de>>6&63)<<D[se++&3],H[se>>2]|=(128|de&63)<<D[se++&3]);if(this.lastByteIndex=se,se>=V){for(this.start=se-V,this.block=H[z],se=0;se<z;++se)ie[se]^=H[se];te(ie),this.reset=!0}else this.start=se}return this},N.prototype.encode=function(I,J){var k=I&255,H=1,V=[k];for(I=I>>8,k=I&255;k>0;)V.unshift(k),I=I>>8,k=I&255,++H;return J?V.push(H):V.unshift(H),this.update(V),V.length},N.prototype.encodeString=function(I){var J,k=typeof I;if(k!=="string"){if(k==="object"){if(I===null)throw new Error(e);if(h&&I.constructor===ArrayBuffer)I=new Uint8Array(I);else if(!Array.isArray(I)&&(!h||!ArrayBuffer.isView(I)))throw new Error(e)}else throw new Error(e);J=!0}var H=0,V=I.length;if(J)H=V;else for(var m=0;m<I.length;++m){var z=I.charCodeAt(m);z<128?H+=1:z<2048?H+=2:z<55296||z>=57344?H+=3:(z=65536+((z&1023)<<10|I.charCodeAt(++m)&1023),H+=4)}return H+=this.encode(H*8),this.update(I),H},N.prototype.bytepad=function(I,J){for(var k=this.encode(J),H=0;H<I.length;++H)k+=this.encodeString(I[H]);var V=J-k%J,m=[];return m.length=V,this.update(m),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var I=this.blocks,J=this.lastByteIndex,k=this.blockCount,H=this.s;if(I[J>>2]|=this.padding[J&3],this.lastByteIndex===this.byteCount)for(I[0]=I[k],J=1;J<k+1;++J)I[J]=0;for(I[k-1]|=2147483648,J=0;J<k;++J)H[J]^=I[J];te(H)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var I=this.blockCount,J=this.s,k=this.outputBlocks,H=this.extraBytes,V=0,m=0,z="",ee;m<k;){for(V=0;V<I&&m<k;++V,++m)ee=J[V],z+=f[ee>>4&15]+f[ee&15]+f[ee>>12&15]+f[ee>>8&15]+f[ee>>20&15]+f[ee>>16&15]+f[ee>>28&15]+f[ee>>24&15];m%I===0&&(te(J),V=0)}return H&&(ee=J[V],z+=f[ee>>4&15]+f[ee&15],H>1&&(z+=f[ee>>12&15]+f[ee>>8&15]),H>2&&(z+=f[ee>>20&15]+f[ee>>16&15])),z},N.prototype.arrayBuffer=function(){this.finalize();var I=this.blockCount,J=this.s,k=this.outputBlocks,H=this.extraBytes,V=0,m=0,z=this.outputBits>>3,ee;H?ee=new ArrayBuffer(k+1<<2):ee=new ArrayBuffer(z);for(var ie=new Uint32Array(ee);m<k;){for(V=0;V<I&&m<k;++V,++m)ie[m]=J[V];m%I===0&&te(J)}return H&&(ie[V]=J[V],ee=ee.slice(0,z)),ee},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var I=this.blockCount,J=this.s,k=this.outputBlocks,H=this.extraBytes,V=0,m=0,z=[],ee,ie;m<k;){for(V=0;V<I&&m<k;++V,++m)ee=m<<2,ie=J[V],z[ee]=ie&255,z[ee+1]=ie>>8&255,z[ee+2]=ie>>16&255,z[ee+3]=ie>>24&255;m%I===0&&te(J)}return H&&(ee=m<<2,ie=J[V],z[ee]=ie&255,H>1&&(z[ee+1]=ie>>8&255),H>2&&(z[ee+2]=ie>>16&255)),z};function Y(I,J,k){N.call(this,I,J,k)}Y.prototype=new N,Y.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var te=function(I){var J,k,H,V,m,z,ee,ie,se,de,O,A,M,$,G,re,X,ce,fe,oe,le,he,ue,we,me,ge,De,Ne,ve,Ce,Ye,Te,Qe,Ve,Re,it,nt,_e,Pe,Fe,Ee,Le,Be,Se,$e,qe,Me,ze,Ue,Ae,Oe,Ke,Ie,st,ot,ke,Je,Qt,Xt,Zt,er,tr,Et;for(H=0;H<48;H+=2)V=I[0]^I[10]^I[20]^I[30]^I[40],m=I[1]^I[11]^I[21]^I[31]^I[41],z=I[2]^I[12]^I[22]^I[32]^I[42],ee=I[3]^I[13]^I[23]^I[33]^I[43],ie=I[4]^I[14]^I[24]^I[34]^I[44],se=I[5]^I[15]^I[25]^I[35]^I[45],de=I[6]^I[16]^I[26]^I[36]^I[46],O=I[7]^I[17]^I[27]^I[37]^I[47],A=I[8]^I[18]^I[28]^I[38]^I[48],M=I[9]^I[19]^I[29]^I[39]^I[49],J=A^(z<<1|ee>>>31),k=M^(ee<<1|z>>>31),I[0]^=J,I[1]^=k,I[10]^=J,I[11]^=k,I[20]^=J,I[21]^=k,I[30]^=J,I[31]^=k,I[40]^=J,I[41]^=k,J=V^(ie<<1|se>>>31),k=m^(se<<1|ie>>>31),I[2]^=J,I[3]^=k,I[12]^=J,I[13]^=k,I[22]^=J,I[23]^=k,I[32]^=J,I[33]^=k,I[42]^=J,I[43]^=k,J=z^(de<<1|O>>>31),k=ee^(O<<1|de>>>31),I[4]^=J,I[5]^=k,I[14]^=J,I[15]^=k,I[24]^=J,I[25]^=k,I[34]^=J,I[35]^=k,I[44]^=J,I[45]^=k,J=ie^(A<<1|M>>>31),k=se^(M<<1|A>>>31),I[6]^=J,I[7]^=k,I[16]^=J,I[17]^=k,I[26]^=J,I[27]^=k,I[36]^=J,I[37]^=k,I[46]^=J,I[47]^=k,J=de^(V<<1|m>>>31),k=O^(m<<1|V>>>31),I[8]^=J,I[9]^=k,I[18]^=J,I[19]^=k,I[28]^=J,I[29]^=k,I[38]^=J,I[39]^=k,I[48]^=J,I[49]^=k,$=I[0],G=I[1],qe=I[11]<<4|I[10]>>>28,Me=I[10]<<4|I[11]>>>28,Ne=I[20]<<3|I[21]>>>29,ve=I[21]<<3|I[20]>>>29,Zt=I[31]<<9|I[30]>>>23,er=I[30]<<9|I[31]>>>23,Le=I[40]<<18|I[41]>>>14,Be=I[41]<<18|I[40]>>>14,Ve=I[2]<<1|I[3]>>>31,Re=I[3]<<1|I[2]>>>31,re=I[13]<<12|I[12]>>>20,X=I[12]<<12|I[13]>>>20,ze=I[22]<<10|I[23]>>>22,Ue=I[23]<<10|I[22]>>>22,Ce=I[33]<<13|I[32]>>>19,Ye=I[32]<<13|I[33]>>>19,tr=I[42]<<2|I[43]>>>30,Et=I[43]<<2|I[42]>>>30,st=I[5]<<30|I[4]>>>2,ot=I[4]<<30|I[5]>>>2,it=I[14]<<6|I[15]>>>26,nt=I[15]<<6|I[14]>>>26,ce=I[25]<<11|I[24]>>>21,fe=I[24]<<11|I[25]>>>21,Ae=I[34]<<15|I[35]>>>17,Oe=I[35]<<15|I[34]>>>17,Te=I[45]<<29|I[44]>>>3,Qe=I[44]<<29|I[45]>>>3,we=I[6]<<28|I[7]>>>4,me=I[7]<<28|I[6]>>>4,ke=I[17]<<23|I[16]>>>9,Je=I[16]<<23|I[17]>>>9,_e=I[26]<<25|I[27]>>>7,Pe=I[27]<<25|I[26]>>>7,oe=I[36]<<21|I[37]>>>11,le=I[37]<<21|I[36]>>>11,Ke=I[47]<<24|I[46]>>>8,Ie=I[46]<<24|I[47]>>>8,Se=I[8]<<27|I[9]>>>5,$e=I[9]<<27|I[8]>>>5,ge=I[18]<<20|I[19]>>>12,De=I[19]<<20|I[18]>>>12,Qt=I[29]<<7|I[28]>>>25,Xt=I[28]<<7|I[29]>>>25,Fe=I[38]<<8|I[39]>>>24,Ee=I[39]<<8|I[38]>>>24,he=I[48]<<14|I[49]>>>18,ue=I[49]<<14|I[48]>>>18,I[0]=$^~re&ce,I[1]=G^~X&fe,I[10]=we^~ge&Ne,I[11]=me^~De&ve,I[20]=Ve^~it&_e,I[21]=Re^~nt&Pe,I[30]=Se^~qe&ze,I[31]=$e^~Me&Ue,I[40]=st^~ke&Qt,I[41]=ot^~Je&Xt,I[2]=re^~ce&oe,I[3]=X^~fe&le,I[12]=ge^~Ne&Ce,I[13]=De^~ve&Ye,I[22]=it^~_e&Fe,I[23]=nt^~Pe&Ee,I[32]=qe^~ze&Ae,I[33]=Me^~Ue&Oe,I[42]=ke^~Qt&Zt,I[43]=Je^~Xt&er,I[4]=ce^~oe&he,I[5]=fe^~le&ue,I[14]=Ne^~Ce&Te,I[15]=ve^~Ye&Qe,I[24]=_e^~Fe&Le,I[25]=Pe^~Ee&Be,I[34]=ze^~Ae&Ke,I[35]=Ue^~Oe&Ie,I[44]=Qt^~Zt&tr,I[45]=Xt^~er&Et,I[6]=oe^~he&$,I[7]=le^~ue&G,I[16]=Ce^~Te&we,I[17]=Ye^~Qe&me,I[26]=Fe^~Le&Ve,I[27]=Ee^~Be&Re,I[36]=Ae^~Ke&Se,I[37]=Oe^~Ie&$e,I[46]=Zt^~tr&st,I[47]=er^~Et&ot,I[8]=he^~$&re,I[9]=ue^~G&X,I[18]=Te^~we&ge,I[19]=Qe^~me&De,I[28]=Le^~Ve&it,I[29]=Be^~Re&nt,I[38]=Ke^~Se&qe,I[39]=Ie^~$e&Me,I[48]=tr^~st&ke,I[49]=Et^~ot&Je,I[0]^=B[H],I[1]^=B[H+1]};if(a)t.exports=u;else for(w=0;w<g.length;++w)n[g[w]]=u[g[w]]})()})(Ap);var p4=Ap.exports;const g4="logger/5.7.0";let bl=!1,vl=!1;const Qo={debug:1,default:2,info:2,warning:3,error:4,off:5};let ml=Qo.default,Rc=null;function b4(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const yl=b4();var Sf;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(Sf||(Sf={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const wl="0123456789abcdef";let Ft=class At{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const i=e.toLowerCase();Qo[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(ml>Qo[i])&&console.log.apply(console,r)}debug(...e){this._log(At.levels.DEBUG,e)}info(...e){this._log(At.levels.INFO,e)}warn(...e){this._log(At.levels.WARNING,e)}makeError(e,r,i){if(vl)return this.makeError("censored error",r,{});r||(r=At.errors.UNKNOWN_ERROR),i||(i={});const n=[];Object.keys(i).forEach(h=>{const f=i[h];try{if(f instanceof Uint8Array){let p="";for(let v=0;v<f.length;v++)p+=wl[f[v]>>4],p+=wl[f[v]&15];n.push(h+"=Uint8Array(0x"+p+")")}else n.push(h+"="+JSON.stringify(f))}catch{n.push(h+"="+JSON.stringify(i[h].toString()))}}),n.push(`code=${r}`),n.push(`version=${this.version}`);const s=e;let o="";switch(r){case Ur.NUMERIC_FAULT:{o="NUMERIC_FAULT";const h=e;switch(h){case"overflow":case"underflow":case"division-by-zero":o+="-"+h;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),n.length&&(e+=" ("+n.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=r,Object.keys(i).forEach(function(h){a[h]=i[h]}),a}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,At.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,n){e||this.throwError(r,i,n)}assertArgument(e,r,i,n){e||this.throwArgumentError(r,i,n)}checkNormalize(e){yl&&this.throwError("platform missing String.prototype.normalize",At.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:yl})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,At.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,At.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,At.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,At.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",At.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",At.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",At.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Rc||(Rc=new At(g4)),Rc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",At.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bl){if(!e)return;this.globalLogger().throwError("error censorship permanent",At.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}vl=!!e,bl=!!r}static setLogLevel(e){const r=Qo[e.toLowerCase()];if(r==null){At.globalLogger().warn("invalid log level - "+e);return}ml=r}static from(e){return new At(e)}};Ft.errors=Ur,Ft.levels=Sf;const v4="bytes/5.7.0",wt=new Ft(v4);function xp(t){return!!t.toHexString}function Jn(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Jn(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function m4(t){return pr(t)&&!(t.length%2)||As(t)}function _l(t){return typeof t=="number"&&t==t&&t%1===0}function As(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!_l(t.length)||t.length<0)return!1;for(let e=0;e<t.length;e++){const r=t[e];if(!_l(r)||r<0||r>=256)return!1}return!0}function mt(t,e){if(e||(e={}),typeof t=="number"){wt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Jn(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),xp(t)&&(t=t.toHexString()),pr(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":wt.throwArgumentError("hex data is odd-length","value",t));const i=[];for(let n=0;n<r.length;n+=2)i.push(parseInt(r.substring(n,n+2),16));return Jn(new Uint8Array(i))}return As(t)?Jn(new Uint8Array(t)):wt.throwArgumentError("invalid arrayify value","value",t)}function y4(t){const e=t.map(n=>mt(n)),r=e.reduce((n,s)=>n+s.length,0),i=new Uint8Array(r);return e.reduce((n,s)=>(i.set(s,n),n+s.length),0),Jn(i)}function w4(t,e){t=mt(t),t.length>e&&wt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Jn(r)}function pr(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Oc="0123456789abcdef";function sr(t,e){if(e||(e={}),typeof t=="number"){wt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Oc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),xp(t))return t.toHexString();if(pr(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":wt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(As(t)){let r="0x";for(let i=0;i<t.length;i++){let n=t[i];r+=Oc[(n&240)>>4]+Oc[n&15]}return r}return wt.throwArgumentError("invalid hexlify value","value",t)}function _4(t){if(typeof t!="string")t=sr(t);else if(!pr(t)||t.length%2)return null;return(t.length-2)/2}function El(t,e,r){return typeof t!="string"?t=sr(t):(!pr(t)||t.length%2)&&wt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function ni(t,e){for(typeof t!="string"?t=sr(t):pr(t)||wt.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&wt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Sp(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(m4(t)){let r=mt(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=sr(r.slice(0,32)),e.s=sr(r.slice(32,64))):r.length===65?(e.r=sr(r.slice(0,32)),e.s=sr(r.slice(32,64)),e.v=r[64]):wt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:wt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=sr(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const n=w4(mt(e._vs),32);e._vs=sr(n);const s=n[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&wt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),n[0]&=127;const o=sr(n);e.s==null?e.s=o:e.s!==o&&wt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?wt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const n=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==n&&wt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pr(e.r)?wt.throwArgumentError("signature missing or invalid r","signature",t):e.r=ni(e.r,32),e.s==null||!pr(e.s)?wt.throwArgumentError("signature missing or invalid s","signature",t):e.s=ni(e.s,32);const r=mt(e.s);r[0]>=128&&wt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const i=sr(r);e._vs&&(pr(e._vs)||wt.throwArgumentError("signature invalid _vs","signature",t),e._vs=ni(e._vs,32)),e._vs==null?e._vs=i:e._vs!==i&&wt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function _h(t){return"0x"+p4.keccak_256(mt(t))}var Mp={exports:{}},E4={},A4=Object.freeze({__proto__:null,default:E4}),x4=d4(A4);(function(t){(function(e,r){function i(c,u){if(!c)throw new Error(u||"Assertion failed")}function n(c,u){c.super_=u;var g=function(){};g.prototype=u.prototype,c.prototype=new g,c.prototype.constructor=c}function s(c,u,g){if(s.isBN(c))return c;this.negative=0,this.words=null,this.length=0,this.red=null,c!==null&&((u==="le"||u==="be")&&(g=u,u=10),this._init(c||0,u||10,g||"be"))}typeof e=="object"?e.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=x4.Buffer}catch{}s.isBN=function(c){return c instanceof s?!0:c!==null&&typeof c=="object"&&c.constructor.wordSize===s.wordSize&&Array.isArray(c.words)},s.max=function(c,u){return c.cmp(u)>0?c:u},s.min=function(c,u){return c.cmp(u)<0?c:u},s.prototype._init=function(c,u,g){if(typeof c=="number")return this._initNumber(c,u,g);if(typeof c=="object")return this._initArray(c,u,g);u==="hex"&&(u=16),i(u===(u|0)&&u>=2&&u<=36),c=c.toString().replace(/\s+/g,"");var w=0;c[0]==="-"&&(w++,this.negative=1),w<c.length&&(u===16?this._parseHex(c,w,g):(this._parseBase(c,u,w),g==="le"&&this._initArray(this.toArray(),u,g)))},s.prototype._initNumber=function(c,u,g){c<0&&(this.negative=1,c=-c),c<67108864?(this.words=[c&67108863],this.length=1):c<4503599627370496?(this.words=[c&67108863,c/67108864&67108863],this.length=2):(i(c<9007199254740992),this.words=[c&67108863,c/67108864&67108863,1],this.length=3),g==="le"&&this._initArray(this.toArray(),u,g)},s.prototype._initArray=function(c,u,g){if(i(typeof c.length=="number"),c.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(c.length/3),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var S,C,_=0;if(g==="be")for(w=c.length-1,S=0;w>=0;w-=3)C=c[w]|c[w-1]<<8|c[w-2]<<16,this.words[S]|=C<<_&67108863,this.words[S+1]=C>>>26-_&67108863,_+=24,_>=26&&(_-=26,S++);else if(g==="le")for(w=0,S=0;w<c.length;w+=3)C=c[w]|c[w+1]<<8|c[w+2]<<16,this.words[S]|=C<<_&67108863,this.words[S+1]=C>>>26-_&67108863,_+=24,_>=26&&(_-=26,S++);return this._strip()};function a(c,u){var g=c.charCodeAt(u);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;i(!1,"Invalid character in "+c)}function h(c,u,g){var w=a(c,g);return g-1>=u&&(w|=a(c,g-1)<<4),w}s.prototype._parseHex=function(c,u,g){this.length=Math.ceil((c.length-u)/6),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var S=0,C=0,_;if(g==="be")for(w=c.length-1;w>=u;w-=2)_=h(c,u,w)<<S,this.words[C]|=_&67108863,S>=18?(S-=18,C+=1,this.words[C]|=_>>>26):S+=8;else{var l=c.length-u;for(w=l%2===0?u+1:u;w<c.length;w+=2)_=h(c,u,w)<<S,this.words[C]|=_&67108863,S>=18?(S-=18,C+=1,this.words[C]|=_>>>26):S+=8}this._strip()};function f(c,u,g,w){for(var S=0,C=0,_=Math.min(c.length,g),l=u;l<_;l++){var d=c.charCodeAt(l)-48;S*=w,d>=49?C=d-49+10:d>=17?C=d-17+10:C=d,i(d>=0&&C<w,"Invalid character"),S+=C}return S}s.prototype._parseBase=function(c,u,g){this.words=[0],this.length=1;for(var w=0,S=1;S<=67108863;S*=u)w++;w--,S=S/u|0;for(var C=c.length-g,_=C%w,l=Math.min(C,C-_)+g,d=0,N=g;N<l;N+=w)d=f(c,N,N+w,u),this.imuln(S),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d);if(_!==0){var Y=1;for(d=f(c,N,c.length,u),N=0;N<_;N++)Y*=u;this.imuln(Y),this.words[0]+d<67108864?this.words[0]+=d:this._iaddn(d)}this._strip()},s.prototype.copy=function(c){c.words=new Array(this.length);for(var u=0;u<this.length;u++)c.words[u]=this.words[u];c.length=this.length,c.negative=this.negative,c.red=this.red};function p(c,u){c.words=u.words,c.length=u.length,c.negative=u.negative,c.red=u.red}if(s.prototype._move=function(c){p(c,this)},s.prototype.clone=function(){var c=new s(null);return this.copy(c),c},s.prototype._expand=function(c){for(;this.length<c;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=v}catch{s.prototype.inspect=v}else s.prototype.inspect=v;function v(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var x=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],D=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(c,u){c=c||10,u=u|0||1;var g;if(c===16||c==="hex"){g="";for(var w=0,S=0,C=0;C<this.length;C++){var _=this.words[C],l=((_<<w|S)&16777215).toString(16);S=_>>>24-w&16777215,w+=2,w>=26&&(w-=26,C--),S!==0||C!==this.length-1?g=x[6-l.length]+l+g:g=l+g}for(S!==0&&(g=S.toString(16)+g);g.length%u!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(c===(c|0)&&c>=2&&c<=36){var d=E[c],N=D[c];g="";var Y=this.clone();for(Y.negative=0;!Y.isZero();){var te=Y.modrn(N).toString(c);Y=Y.idivn(N),Y.isZero()?g=te+g:g=x[d-te.length]+te+g}for(this.isZero()&&(g="0"+g);g.length%u!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}i(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var c=this.words[0];return this.length===2?c+=this.words[1]*67108864:this.length===3&&this.words[2]===1?c+=4503599627370496+this.words[1]*67108864:this.length>2&&i(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-c:c},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(c,u){return this.toArrayLike(o,c,u)}),s.prototype.toArray=function(c,u){return this.toArrayLike(Array,c,u)};var B=function(c,u){return c.allocUnsafe?c.allocUnsafe(u):new c(u)};s.prototype.toArrayLike=function(c,u,g){this._strip();var w=this.byteLength(),S=g||Math.max(1,w);i(w<=S,"byte array longer than desired length"),i(S>0,"Requested array length <= 0");var C=B(c,S),_=u==="le"?"LE":"BE";return this["_toArrayLike"+_](C,w),C},s.prototype._toArrayLikeLE=function(c,u){for(var g=0,w=0,S=0,C=0;S<this.length;S++){var _=this.words[S]<<C|w;c[g++]=_&255,g<c.length&&(c[g++]=_>>8&255),g<c.length&&(c[g++]=_>>16&255),C===6?(g<c.length&&(c[g++]=_>>24&255),w=0,C=0):(w=_>>>24,C+=2)}if(g<c.length)for(c[g++]=w;g<c.length;)c[g++]=0},s.prototype._toArrayLikeBE=function(c,u){for(var g=c.length-1,w=0,S=0,C=0;S<this.length;S++){var _=this.words[S]<<C|w;c[g--]=_&255,g>=0&&(c[g--]=_>>8&255),g>=0&&(c[g--]=_>>16&255),C===6?(g>=0&&(c[g--]=_>>24&255),w=0,C=0):(w=_>>>24,C+=2)}if(g>=0)for(c[g--]=w;g>=0;)c[g--]=0},Math.clz32?s.prototype._countBits=function(c){return 32-Math.clz32(c)}:s.prototype._countBits=function(c){var u=c,g=0;return u>=4096&&(g+=13,u>>>=13),u>=64&&(g+=7,u>>>=7),u>=8&&(g+=4,u>>>=4),u>=2&&(g+=2,u>>>=2),g+u},s.prototype._zeroBits=function(c){if(c===0)return 26;var u=c,g=0;return u&8191||(g+=13,u>>>=13),u&127||(g+=7,u>>>=7),u&15||(g+=4,u>>>=4),u&3||(g+=2,u>>>=2),u&1||g++,g},s.prototype.bitLength=function(){var c=this.words[this.length-1],u=this._countBits(c);return(this.length-1)*26+u};function F(c){for(var u=new Array(c.bitLength()),g=0;g<u.length;g++){var w=g/26|0,S=g%26;u[g]=c.words[w]>>>S&1}return u}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var c=0,u=0;u<this.length;u++){var g=this._zeroBits(this.words[u]);if(c+=g,g!==26)break}return c},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(c){return this.negative!==0?this.abs().inotn(c).iaddn(1):this.clone()},s.prototype.fromTwos=function(c){return this.testn(c-1)?this.notn(c).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(c){for(;this.length<c.length;)this.words[this.length++]=0;for(var u=0;u<c.length;u++)this.words[u]=this.words[u]|c.words[u];return this._strip()},s.prototype.ior=function(c){return i((this.negative|c.negative)===0),this.iuor(c)},s.prototype.or=function(c){return this.length>c.length?this.clone().ior(c):c.clone().ior(this)},s.prototype.uor=function(c){return this.length>c.length?this.clone().iuor(c):c.clone().iuor(this)},s.prototype.iuand=function(c){var u;this.length>c.length?u=c:u=this;for(var g=0;g<u.length;g++)this.words[g]=this.words[g]&c.words[g];return this.length=u.length,this._strip()},s.prototype.iand=function(c){return i((this.negative|c.negative)===0),this.iuand(c)},s.prototype.and=function(c){return this.length>c.length?this.clone().iand(c):c.clone().iand(this)},s.prototype.uand=function(c){return this.length>c.length?this.clone().iuand(c):c.clone().iuand(this)},s.prototype.iuxor=function(c){var u,g;this.length>c.length?(u=this,g=c):(u=c,g=this);for(var w=0;w<g.length;w++)this.words[w]=u.words[w]^g.words[w];if(this!==u)for(;w<u.length;w++)this.words[w]=u.words[w];return this.length=u.length,this._strip()},s.prototype.ixor=function(c){return i((this.negative|c.negative)===0),this.iuxor(c)},s.prototype.xor=function(c){return this.length>c.length?this.clone().ixor(c):c.clone().ixor(this)},s.prototype.uxor=function(c){return this.length>c.length?this.clone().iuxor(c):c.clone().iuxor(this)},s.prototype.inotn=function(c){i(typeof c=="number"&&c>=0);var u=Math.ceil(c/26)|0,g=c%26;this._expand(u),g>0&&u--;for(var w=0;w<u;w++)this.words[w]=~this.words[w]&67108863;return g>0&&(this.words[w]=~this.words[w]&67108863>>26-g),this._strip()},s.prototype.notn=function(c){return this.clone().inotn(c)},s.prototype.setn=function(c,u){i(typeof c=="number"&&c>=0);var g=c/26|0,w=c%26;return this._expand(g+1),u?this.words[g]=this.words[g]|1<<w:this.words[g]=this.words[g]&~(1<<w),this._strip()},s.prototype.iadd=function(c){var u;if(this.negative!==0&&c.negative===0)return this.negative=0,u=this.isub(c),this.negative^=1,this._normSign();if(this.negative===0&&c.negative!==0)return c.negative=0,u=this.isub(c),c.negative=1,u._normSign();var g,w;this.length>c.length?(g=this,w=c):(g=c,w=this);for(var S=0,C=0;C<w.length;C++)u=(g.words[C]|0)+(w.words[C]|0)+S,this.words[C]=u&67108863,S=u>>>26;for(;S!==0&&C<g.length;C++)u=(g.words[C]|0)+S,this.words[C]=u&67108863,S=u>>>26;if(this.length=g.length,S!==0)this.words[this.length]=S,this.length++;else if(g!==this)for(;C<g.length;C++)this.words[C]=g.words[C];return this},s.prototype.add=function(c){var u;return c.negative!==0&&this.negative===0?(c.negative=0,u=this.sub(c),c.negative^=1,u):c.negative===0&&this.negative!==0?(this.negative=0,u=c.sub(this),this.negative=1,u):this.length>c.length?this.clone().iadd(c):c.clone().iadd(this)},s.prototype.isub=function(c){if(c.negative!==0){c.negative=0;var u=this.iadd(c);return c.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(c),this.negative=1,this._normSign();var g=this.cmp(c);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,S;g>0?(w=this,S=c):(w=c,S=this);for(var C=0,_=0;_<S.length;_++)u=(w.words[_]|0)-(S.words[_]|0)+C,C=u>>26,this.words[_]=u&67108863;for(;C!==0&&_<w.length;_++)u=(w.words[_]|0)+C,C=u>>26,this.words[_]=u&67108863;if(C===0&&_<w.length&&w!==this)for(;_<w.length;_++)this.words[_]=w.words[_];return this.length=Math.max(this.length,_),w!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(c){return this.clone().isub(c)};function j(c,u,g){g.negative=u.negative^c.negative;var w=c.length+u.length|0;g.length=w,w=w-1|0;var S=c.words[0]|0,C=u.words[0]|0,_=S*C,l=_&67108863,d=_/67108864|0;g.words[0]=l;for(var N=1;N<w;N++){for(var Y=d>>>26,te=d&67108863,I=Math.min(N,u.length-1),J=Math.max(0,N-c.length+1);J<=I;J++){var k=N-J|0;S=c.words[k]|0,C=u.words[J]|0,_=S*C+te,Y+=_/67108864|0,te=_&67108863}g.words[N]=te|0,d=Y|0}return d!==0?g.words[N]=d|0:g.length--,g._strip()}var R=function(c,u,g){var w=c.words,S=u.words,C=g.words,_=0,l,d,N,Y=w[0]|0,te=Y&8191,I=Y>>>13,J=w[1]|0,k=J&8191,H=J>>>13,V=w[2]|0,m=V&8191,z=V>>>13,ee=w[3]|0,ie=ee&8191,se=ee>>>13,de=w[4]|0,O=de&8191,A=de>>>13,M=w[5]|0,$=M&8191,G=M>>>13,re=w[6]|0,X=re&8191,ce=re>>>13,fe=w[7]|0,oe=fe&8191,le=fe>>>13,he=w[8]|0,ue=he&8191,we=he>>>13,me=w[9]|0,ge=me&8191,De=me>>>13,Ne=S[0]|0,ve=Ne&8191,Ce=Ne>>>13,Ye=S[1]|0,Te=Ye&8191,Qe=Ye>>>13,Ve=S[2]|0,Re=Ve&8191,it=Ve>>>13,nt=S[3]|0,_e=nt&8191,Pe=nt>>>13,Fe=S[4]|0,Ee=Fe&8191,Le=Fe>>>13,Be=S[5]|0,Se=Be&8191,$e=Be>>>13,qe=S[6]|0,Me=qe&8191,ze=qe>>>13,Ue=S[7]|0,Ae=Ue&8191,Oe=Ue>>>13,Ke=S[8]|0,Ie=Ke&8191,st=Ke>>>13,ot=S[9]|0,ke=ot&8191,Je=ot>>>13;g.negative=c.negative^u.negative,g.length=19,l=Math.imul(te,ve),d=Math.imul(te,Ce),d=d+Math.imul(I,ve)|0,N=Math.imul(I,Ce);var Qt=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,l=Math.imul(k,ve),d=Math.imul(k,Ce),d=d+Math.imul(H,ve)|0,N=Math.imul(H,Ce),l=l+Math.imul(te,Te)|0,d=d+Math.imul(te,Qe)|0,d=d+Math.imul(I,Te)|0,N=N+Math.imul(I,Qe)|0;var Xt=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,l=Math.imul(m,ve),d=Math.imul(m,Ce),d=d+Math.imul(z,ve)|0,N=Math.imul(z,Ce),l=l+Math.imul(k,Te)|0,d=d+Math.imul(k,Qe)|0,d=d+Math.imul(H,Te)|0,N=N+Math.imul(H,Qe)|0,l=l+Math.imul(te,Re)|0,d=d+Math.imul(te,it)|0,d=d+Math.imul(I,Re)|0,N=N+Math.imul(I,it)|0;var Zt=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,l=Math.imul(ie,ve),d=Math.imul(ie,Ce),d=d+Math.imul(se,ve)|0,N=Math.imul(se,Ce),l=l+Math.imul(m,Te)|0,d=d+Math.imul(m,Qe)|0,d=d+Math.imul(z,Te)|0,N=N+Math.imul(z,Qe)|0,l=l+Math.imul(k,Re)|0,d=d+Math.imul(k,it)|0,d=d+Math.imul(H,Re)|0,N=N+Math.imul(H,it)|0,l=l+Math.imul(te,_e)|0,d=d+Math.imul(te,Pe)|0,d=d+Math.imul(I,_e)|0,N=N+Math.imul(I,Pe)|0;var er=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(er>>>26)|0,er&=67108863,l=Math.imul(O,ve),d=Math.imul(O,Ce),d=d+Math.imul(A,ve)|0,N=Math.imul(A,Ce),l=l+Math.imul(ie,Te)|0,d=d+Math.imul(ie,Qe)|0,d=d+Math.imul(se,Te)|0,N=N+Math.imul(se,Qe)|0,l=l+Math.imul(m,Re)|0,d=d+Math.imul(m,it)|0,d=d+Math.imul(z,Re)|0,N=N+Math.imul(z,it)|0,l=l+Math.imul(k,_e)|0,d=d+Math.imul(k,Pe)|0,d=d+Math.imul(H,_e)|0,N=N+Math.imul(H,Pe)|0,l=l+Math.imul(te,Ee)|0,d=d+Math.imul(te,Le)|0,d=d+Math.imul(I,Ee)|0,N=N+Math.imul(I,Le)|0;var tr=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(tr>>>26)|0,tr&=67108863,l=Math.imul($,ve),d=Math.imul($,Ce),d=d+Math.imul(G,ve)|0,N=Math.imul(G,Ce),l=l+Math.imul(O,Te)|0,d=d+Math.imul(O,Qe)|0,d=d+Math.imul(A,Te)|0,N=N+Math.imul(A,Qe)|0,l=l+Math.imul(ie,Re)|0,d=d+Math.imul(ie,it)|0,d=d+Math.imul(se,Re)|0,N=N+Math.imul(se,it)|0,l=l+Math.imul(m,_e)|0,d=d+Math.imul(m,Pe)|0,d=d+Math.imul(z,_e)|0,N=N+Math.imul(z,Pe)|0,l=l+Math.imul(k,Ee)|0,d=d+Math.imul(k,Le)|0,d=d+Math.imul(H,Ee)|0,N=N+Math.imul(H,Le)|0,l=l+Math.imul(te,Se)|0,d=d+Math.imul(te,$e)|0,d=d+Math.imul(I,Se)|0,N=N+Math.imul(I,$e)|0;var Et=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(Et>>>26)|0,Et&=67108863,l=Math.imul(X,ve),d=Math.imul(X,Ce),d=d+Math.imul(ce,ve)|0,N=Math.imul(ce,Ce),l=l+Math.imul($,Te)|0,d=d+Math.imul($,Qe)|0,d=d+Math.imul(G,Te)|0,N=N+Math.imul(G,Qe)|0,l=l+Math.imul(O,Re)|0,d=d+Math.imul(O,it)|0,d=d+Math.imul(A,Re)|0,N=N+Math.imul(A,it)|0,l=l+Math.imul(ie,_e)|0,d=d+Math.imul(ie,Pe)|0,d=d+Math.imul(se,_e)|0,N=N+Math.imul(se,Pe)|0,l=l+Math.imul(m,Ee)|0,d=d+Math.imul(m,Le)|0,d=d+Math.imul(z,Ee)|0,N=N+Math.imul(z,Le)|0,l=l+Math.imul(k,Se)|0,d=d+Math.imul(k,$e)|0,d=d+Math.imul(H,Se)|0,N=N+Math.imul(H,$e)|0,l=l+Math.imul(te,Me)|0,d=d+Math.imul(te,ze)|0,d=d+Math.imul(I,Me)|0,N=N+Math.imul(I,ze)|0;var vi=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(vi>>>26)|0,vi&=67108863,l=Math.imul(oe,ve),d=Math.imul(oe,Ce),d=d+Math.imul(le,ve)|0,N=Math.imul(le,Ce),l=l+Math.imul(X,Te)|0,d=d+Math.imul(X,Qe)|0,d=d+Math.imul(ce,Te)|0,N=N+Math.imul(ce,Qe)|0,l=l+Math.imul($,Re)|0,d=d+Math.imul($,it)|0,d=d+Math.imul(G,Re)|0,N=N+Math.imul(G,it)|0,l=l+Math.imul(O,_e)|0,d=d+Math.imul(O,Pe)|0,d=d+Math.imul(A,_e)|0,N=N+Math.imul(A,Pe)|0,l=l+Math.imul(ie,Ee)|0,d=d+Math.imul(ie,Le)|0,d=d+Math.imul(se,Ee)|0,N=N+Math.imul(se,Le)|0,l=l+Math.imul(m,Se)|0,d=d+Math.imul(m,$e)|0,d=d+Math.imul(z,Se)|0,N=N+Math.imul(z,$e)|0,l=l+Math.imul(k,Me)|0,d=d+Math.imul(k,ze)|0,d=d+Math.imul(H,Me)|0,N=N+Math.imul(H,ze)|0,l=l+Math.imul(te,Ae)|0,d=d+Math.imul(te,Oe)|0,d=d+Math.imul(I,Ae)|0,N=N+Math.imul(I,Oe)|0;var mi=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(mi>>>26)|0,mi&=67108863,l=Math.imul(ue,ve),d=Math.imul(ue,Ce),d=d+Math.imul(we,ve)|0,N=Math.imul(we,Ce),l=l+Math.imul(oe,Te)|0,d=d+Math.imul(oe,Qe)|0,d=d+Math.imul(le,Te)|0,N=N+Math.imul(le,Qe)|0,l=l+Math.imul(X,Re)|0,d=d+Math.imul(X,it)|0,d=d+Math.imul(ce,Re)|0,N=N+Math.imul(ce,it)|0,l=l+Math.imul($,_e)|0,d=d+Math.imul($,Pe)|0,d=d+Math.imul(G,_e)|0,N=N+Math.imul(G,Pe)|0,l=l+Math.imul(O,Ee)|0,d=d+Math.imul(O,Le)|0,d=d+Math.imul(A,Ee)|0,N=N+Math.imul(A,Le)|0,l=l+Math.imul(ie,Se)|0,d=d+Math.imul(ie,$e)|0,d=d+Math.imul(se,Se)|0,N=N+Math.imul(se,$e)|0,l=l+Math.imul(m,Me)|0,d=d+Math.imul(m,ze)|0,d=d+Math.imul(z,Me)|0,N=N+Math.imul(z,ze)|0,l=l+Math.imul(k,Ae)|0,d=d+Math.imul(k,Oe)|0,d=d+Math.imul(H,Ae)|0,N=N+Math.imul(H,Oe)|0,l=l+Math.imul(te,Ie)|0,d=d+Math.imul(te,st)|0,d=d+Math.imul(I,Ie)|0,N=N+Math.imul(I,st)|0;var yi=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(yi>>>26)|0,yi&=67108863,l=Math.imul(ge,ve),d=Math.imul(ge,Ce),d=d+Math.imul(De,ve)|0,N=Math.imul(De,Ce),l=l+Math.imul(ue,Te)|0,d=d+Math.imul(ue,Qe)|0,d=d+Math.imul(we,Te)|0,N=N+Math.imul(we,Qe)|0,l=l+Math.imul(oe,Re)|0,d=d+Math.imul(oe,it)|0,d=d+Math.imul(le,Re)|0,N=N+Math.imul(le,it)|0,l=l+Math.imul(X,_e)|0,d=d+Math.imul(X,Pe)|0,d=d+Math.imul(ce,_e)|0,N=N+Math.imul(ce,Pe)|0,l=l+Math.imul($,Ee)|0,d=d+Math.imul($,Le)|0,d=d+Math.imul(G,Ee)|0,N=N+Math.imul(G,Le)|0,l=l+Math.imul(O,Se)|0,d=d+Math.imul(O,$e)|0,d=d+Math.imul(A,Se)|0,N=N+Math.imul(A,$e)|0,l=l+Math.imul(ie,Me)|0,d=d+Math.imul(ie,ze)|0,d=d+Math.imul(se,Me)|0,N=N+Math.imul(se,ze)|0,l=l+Math.imul(m,Ae)|0,d=d+Math.imul(m,Oe)|0,d=d+Math.imul(z,Ae)|0,N=N+Math.imul(z,Oe)|0,l=l+Math.imul(k,Ie)|0,d=d+Math.imul(k,st)|0,d=d+Math.imul(H,Ie)|0,N=N+Math.imul(H,st)|0,l=l+Math.imul(te,ke)|0,d=d+Math.imul(te,Je)|0,d=d+Math.imul(I,ke)|0,N=N+Math.imul(I,Je)|0;var wi=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(wi>>>26)|0,wi&=67108863,l=Math.imul(ge,Te),d=Math.imul(ge,Qe),d=d+Math.imul(De,Te)|0,N=Math.imul(De,Qe),l=l+Math.imul(ue,Re)|0,d=d+Math.imul(ue,it)|0,d=d+Math.imul(we,Re)|0,N=N+Math.imul(we,it)|0,l=l+Math.imul(oe,_e)|0,d=d+Math.imul(oe,Pe)|0,d=d+Math.imul(le,_e)|0,N=N+Math.imul(le,Pe)|0,l=l+Math.imul(X,Ee)|0,d=d+Math.imul(X,Le)|0,d=d+Math.imul(ce,Ee)|0,N=N+Math.imul(ce,Le)|0,l=l+Math.imul($,Se)|0,d=d+Math.imul($,$e)|0,d=d+Math.imul(G,Se)|0,N=N+Math.imul(G,$e)|0,l=l+Math.imul(O,Me)|0,d=d+Math.imul(O,ze)|0,d=d+Math.imul(A,Me)|0,N=N+Math.imul(A,ze)|0,l=l+Math.imul(ie,Ae)|0,d=d+Math.imul(ie,Oe)|0,d=d+Math.imul(se,Ae)|0,N=N+Math.imul(se,Oe)|0,l=l+Math.imul(m,Ie)|0,d=d+Math.imul(m,st)|0,d=d+Math.imul(z,Ie)|0,N=N+Math.imul(z,st)|0,l=l+Math.imul(k,ke)|0,d=d+Math.imul(k,Je)|0,d=d+Math.imul(H,ke)|0,N=N+Math.imul(H,Je)|0;var _i=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(_i>>>26)|0,_i&=67108863,l=Math.imul(ge,Re),d=Math.imul(ge,it),d=d+Math.imul(De,Re)|0,N=Math.imul(De,it),l=l+Math.imul(ue,_e)|0,d=d+Math.imul(ue,Pe)|0,d=d+Math.imul(we,_e)|0,N=N+Math.imul(we,Pe)|0,l=l+Math.imul(oe,Ee)|0,d=d+Math.imul(oe,Le)|0,d=d+Math.imul(le,Ee)|0,N=N+Math.imul(le,Le)|0,l=l+Math.imul(X,Se)|0,d=d+Math.imul(X,$e)|0,d=d+Math.imul(ce,Se)|0,N=N+Math.imul(ce,$e)|0,l=l+Math.imul($,Me)|0,d=d+Math.imul($,ze)|0,d=d+Math.imul(G,Me)|0,N=N+Math.imul(G,ze)|0,l=l+Math.imul(O,Ae)|0,d=d+Math.imul(O,Oe)|0,d=d+Math.imul(A,Ae)|0,N=N+Math.imul(A,Oe)|0,l=l+Math.imul(ie,Ie)|0,d=d+Math.imul(ie,st)|0,d=d+Math.imul(se,Ie)|0,N=N+Math.imul(se,st)|0,l=l+Math.imul(m,ke)|0,d=d+Math.imul(m,Je)|0,d=d+Math.imul(z,ke)|0,N=N+Math.imul(z,Je)|0;var yr=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(yr>>>26)|0,yr&=67108863,l=Math.imul(ge,_e),d=Math.imul(ge,Pe),d=d+Math.imul(De,_e)|0,N=Math.imul(De,Pe),l=l+Math.imul(ue,Ee)|0,d=d+Math.imul(ue,Le)|0,d=d+Math.imul(we,Ee)|0,N=N+Math.imul(we,Le)|0,l=l+Math.imul(oe,Se)|0,d=d+Math.imul(oe,$e)|0,d=d+Math.imul(le,Se)|0,N=N+Math.imul(le,$e)|0,l=l+Math.imul(X,Me)|0,d=d+Math.imul(X,ze)|0,d=d+Math.imul(ce,Me)|0,N=N+Math.imul(ce,ze)|0,l=l+Math.imul($,Ae)|0,d=d+Math.imul($,Oe)|0,d=d+Math.imul(G,Ae)|0,N=N+Math.imul(G,Oe)|0,l=l+Math.imul(O,Ie)|0,d=d+Math.imul(O,st)|0,d=d+Math.imul(A,Ie)|0,N=N+Math.imul(A,st)|0,l=l+Math.imul(ie,ke)|0,d=d+Math.imul(ie,Je)|0,d=d+Math.imul(se,ke)|0,N=N+Math.imul(se,Je)|0;var Ei=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(Ei>>>26)|0,Ei&=67108863,l=Math.imul(ge,Ee),d=Math.imul(ge,Le),d=d+Math.imul(De,Ee)|0,N=Math.imul(De,Le),l=l+Math.imul(ue,Se)|0,d=d+Math.imul(ue,$e)|0,d=d+Math.imul(we,Se)|0,N=N+Math.imul(we,$e)|0,l=l+Math.imul(oe,Me)|0,d=d+Math.imul(oe,ze)|0,d=d+Math.imul(le,Me)|0,N=N+Math.imul(le,ze)|0,l=l+Math.imul(X,Ae)|0,d=d+Math.imul(X,Oe)|0,d=d+Math.imul(ce,Ae)|0,N=N+Math.imul(ce,Oe)|0,l=l+Math.imul($,Ie)|0,d=d+Math.imul($,st)|0,d=d+Math.imul(G,Ie)|0,N=N+Math.imul(G,st)|0,l=l+Math.imul(O,ke)|0,d=d+Math.imul(O,Je)|0,d=d+Math.imul(A,ke)|0,N=N+Math.imul(A,Je)|0;var Ai=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,l=Math.imul(ge,Se),d=Math.imul(ge,$e),d=d+Math.imul(De,Se)|0,N=Math.imul(De,$e),l=l+Math.imul(ue,Me)|0,d=d+Math.imul(ue,ze)|0,d=d+Math.imul(we,Me)|0,N=N+Math.imul(we,ze)|0,l=l+Math.imul(oe,Ae)|0,d=d+Math.imul(oe,Oe)|0,d=d+Math.imul(le,Ae)|0,N=N+Math.imul(le,Oe)|0,l=l+Math.imul(X,Ie)|0,d=d+Math.imul(X,st)|0,d=d+Math.imul(ce,Ie)|0,N=N+Math.imul(ce,st)|0,l=l+Math.imul($,ke)|0,d=d+Math.imul($,Je)|0,d=d+Math.imul(G,ke)|0,N=N+Math.imul(G,Je)|0;var $t=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+($t>>>26)|0,$t&=67108863,l=Math.imul(ge,Me),d=Math.imul(ge,ze),d=d+Math.imul(De,Me)|0,N=Math.imul(De,ze),l=l+Math.imul(ue,Ae)|0,d=d+Math.imul(ue,Oe)|0,d=d+Math.imul(we,Ae)|0,N=N+Math.imul(we,Oe)|0,l=l+Math.imul(oe,Ie)|0,d=d+Math.imul(oe,st)|0,d=d+Math.imul(le,Ie)|0,N=N+Math.imul(le,st)|0,l=l+Math.imul(X,ke)|0,d=d+Math.imul(X,Je)|0,d=d+Math.imul(ce,ke)|0,N=N+Math.imul(ce,Je)|0;var xi=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(xi>>>26)|0,xi&=67108863,l=Math.imul(ge,Ae),d=Math.imul(ge,Oe),d=d+Math.imul(De,Ae)|0,N=Math.imul(De,Oe),l=l+Math.imul(ue,Ie)|0,d=d+Math.imul(ue,st)|0,d=d+Math.imul(we,Ie)|0,N=N+Math.imul(we,st)|0,l=l+Math.imul(oe,ke)|0,d=d+Math.imul(oe,Je)|0,d=d+Math.imul(le,ke)|0,N=N+Math.imul(le,Je)|0;var Si=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(Si>>>26)|0,Si&=67108863,l=Math.imul(ge,Ie),d=Math.imul(ge,st),d=d+Math.imul(De,Ie)|0,N=Math.imul(De,st),l=l+Math.imul(ue,ke)|0,d=d+Math.imul(ue,Je)|0,d=d+Math.imul(we,ke)|0,N=N+Math.imul(we,Je)|0;var Mi=(_+l|0)+((d&8191)<<13)|0;_=(N+(d>>>13)|0)+(Mi>>>26)|0,Mi&=67108863,l=Math.imul(ge,ke),d=Math.imul(ge,Je),d=d+Math.imul(De,ke)|0,N=Math.imul(De,Je);var Cs=(_+l|0)+((d&8191)<<13)|0;return _=(N+(d>>>13)|0)+(Cs>>>26)|0,Cs&=67108863,C[0]=Qt,C[1]=Xt,C[2]=Zt,C[3]=er,C[4]=tr,C[5]=Et,C[6]=vi,C[7]=mi,C[8]=yi,C[9]=wi,C[10]=_i,C[11]=yr,C[12]=Ei,C[13]=Ai,C[14]=$t,C[15]=xi,C[16]=Si,C[17]=Mi,C[18]=Cs,_!==0&&(C[19]=_,g.length++),g};Math.imul||(R=j);function K(c,u,g){g.negative=u.negative^c.negative,g.length=c.length+u.length;for(var w=0,S=0,C=0;C<g.length-1;C++){var _=S;S=0;for(var l=w&67108863,d=Math.min(C,u.length-1),N=Math.max(0,C-c.length+1);N<=d;N++){var Y=C-N,te=c.words[Y]|0,I=u.words[N]|0,J=te*I,k=J&67108863;_=_+(J/67108864|0)|0,k=k+l|0,l=k&67108863,_=_+(k>>>26)|0,S+=_>>>26,_&=67108863}g.words[C]=l,w=_,_=S}return w!==0?g.words[C]=w:g.length--,g._strip()}function T(c,u,g){return K(c,u,g)}s.prototype.mulTo=function(c,u){var g,w=this.length+c.length;return this.length===10&&c.length===10?g=R(this,c,u):w<63?g=j(this,c,u):w<1024?g=K(this,c,u):g=T(this,c,u),g},s.prototype.mul=function(c){var u=new s(null);return u.words=new Array(this.length+c.length),this.mulTo(c,u)},s.prototype.mulf=function(c){var u=new s(null);return u.words=new Array(this.length+c.length),T(this,c,u)},s.prototype.imul=function(c){return this.clone().mulTo(c,this)},s.prototype.imuln=function(c){var u=c<0;u&&(c=-c),i(typeof c=="number"),i(c<67108864);for(var g=0,w=0;w<this.length;w++){var S=(this.words[w]|0)*c,C=(S&67108863)+(g&67108863);g>>=26,g+=S/67108864|0,g+=C>>>26,this.words[w]=C&67108863}return g!==0&&(this.words[w]=g,this.length++),u?this.ineg():this},s.prototype.muln=function(c){return this.clone().imuln(c)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(c){var u=F(c);if(u.length===0)return new s(1);for(var g=this,w=0;w<u.length&&u[w]===0;w++,g=g.sqr());if(++w<u.length)for(var S=g.sqr();w<u.length;w++,S=S.sqr())u[w]!==0&&(g=g.mul(S));return g},s.prototype.iushln=function(c){i(typeof c=="number"&&c>=0);var u=c%26,g=(c-u)/26,w=67108863>>>26-u<<26-u,S;if(u!==0){var C=0;for(S=0;S<this.length;S++){var _=this.words[S]&w,l=(this.words[S]|0)-_<<u;this.words[S]=l|C,C=_>>>26-u}C&&(this.words[S]=C,this.length++)}if(g!==0){for(S=this.length-1;S>=0;S--)this.words[S+g]=this.words[S];for(S=0;S<g;S++)this.words[S]=0;this.length+=g}return this._strip()},s.prototype.ishln=function(c){return i(this.negative===0),this.iushln(c)},s.prototype.iushrn=function(c,u,g){i(typeof c=="number"&&c>=0);var w;u?w=(u-u%26)/26:w=0;var S=c%26,C=Math.min((c-S)/26,this.length),_=67108863^67108863>>>S<<S,l=g;if(w-=C,w=Math.max(0,w),l){for(var d=0;d<C;d++)l.words[d]=this.words[d];l.length=C}if(C!==0)if(this.length>C)for(this.length-=C,d=0;d<this.length;d++)this.words[d]=this.words[d+C];else this.words[0]=0,this.length=1;var N=0;for(d=this.length-1;d>=0&&(N!==0||d>=w);d--){var Y=this.words[d]|0;this.words[d]=N<<26-S|Y>>>S,N=Y&_}return l&&N!==0&&(l.words[l.length++]=N),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(c,u,g){return i(this.negative===0),this.iushrn(c,u,g)},s.prototype.shln=function(c){return this.clone().ishln(c)},s.prototype.ushln=function(c){return this.clone().iushln(c)},s.prototype.shrn=function(c){return this.clone().ishrn(c)},s.prototype.ushrn=function(c){return this.clone().iushrn(c)},s.prototype.testn=function(c){i(typeof c=="number"&&c>=0);var u=c%26,g=(c-u)/26,w=1<<u;if(this.length<=g)return!1;var S=this.words[g];return!!(S&w)},s.prototype.imaskn=function(c){i(typeof c=="number"&&c>=0);var u=c%26,g=(c-u)/26;if(i(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(u!==0&&g++,this.length=Math.min(g,this.length),u!==0){var w=67108863^67108863>>>u<<u;this.words[this.length-1]&=w}return this._strip()},s.prototype.maskn=function(c){return this.clone().imaskn(c)},s.prototype.iaddn=function(c){return i(typeof c=="number"),i(c<67108864),c<0?this.isubn(-c):this.negative!==0?this.length===1&&(this.words[0]|0)<=c?(this.words[0]=c-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(c),this.negative=1,this):this._iaddn(c)},s.prototype._iaddn=function(c){this.words[0]+=c;for(var u=0;u<this.length&&this.words[u]>=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},s.prototype.isubn=function(c){if(i(typeof c=="number"),i(c<67108864),c<0)return this.iaddn(-c);if(this.negative!==0)return this.negative=0,this.iaddn(c),this.negative=1,this;if(this.words[0]-=c,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u<this.length&&this.words[u]<0;u++)this.words[u]+=67108864,this.words[u+1]-=1;return this._strip()},s.prototype.addn=function(c){return this.clone().iaddn(c)},s.prototype.subn=function(c){return this.clone().isubn(c)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(c,u,g){var w=c.length+g,S;this._expand(w);var C,_=0;for(S=0;S<c.length;S++){C=(this.words[S+g]|0)+_;var l=(c.words[S]|0)*u;C-=l&67108863,_=(C>>26)-(l/67108864|0),this.words[S+g]=C&67108863}for(;S<this.length-g;S++)C=(this.words[S+g]|0)+_,_=C>>26,this.words[S+g]=C&67108863;if(_===0)return this._strip();for(i(_===-1),_=0,S=0;S<this.length;S++)C=-(this.words[S]|0)+_,_=C>>26,this.words[S]=C&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(c,u){var g=this.length-c.length,w=this.clone(),S=c,C=S.words[S.length-1]|0,_=this._countBits(C);g=26-_,g!==0&&(S=S.ushln(g),w.iushln(g),C=S.words[S.length-1]|0);var l=w.length-S.length,d;if(u!=="mod"){d=new s(null),d.length=l+1,d.words=new Array(d.length);for(var N=0;N<d.length;N++)d.words[N]=0}var Y=w.clone()._ishlnsubmul(S,1,l);Y.negative===0&&(w=Y,d&&(d.words[l]=1));for(var te=l-1;te>=0;te--){var I=(w.words[S.length+te]|0)*67108864+(w.words[S.length+te-1]|0);for(I=Math.min(I/C|0,67108863),w._ishlnsubmul(S,I,te);w.negative!==0;)I--,w.negative=0,w._ishlnsubmul(S,1,te),w.isZero()||(w.negative^=1);d&&(d.words[te]=I)}return d&&d._strip(),w._strip(),u!=="div"&&g!==0&&w.iushrn(g),{div:d||null,mod:w}},s.prototype.divmod=function(c,u,g){if(i(!c.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var w,S,C;return this.negative!==0&&c.negative===0?(C=this.neg().divmod(c,u),u!=="mod"&&(w=C.div.neg()),u!=="div"&&(S=C.mod.neg(),g&&S.negative!==0&&S.iadd(c)),{div:w,mod:S}):this.negative===0&&c.negative!==0?(C=this.divmod(c.neg(),u),u!=="mod"&&(w=C.div.neg()),{div:w,mod:C.mod}):this.negative&c.negative?(C=this.neg().divmod(c.neg(),u),u!=="div"&&(S=C.mod.neg(),g&&S.negative!==0&&S.isub(c)),{div:C.div,mod:S}):c.length>this.length||this.cmp(c)<0?{div:new s(0),mod:this}:c.length===1?u==="div"?{div:this.divn(c.words[0]),mod:null}:u==="mod"?{div:null,mod:new s(this.modrn(c.words[0]))}:{div:this.divn(c.words[0]),mod:new s(this.modrn(c.words[0]))}:this._wordDiv(c,u)},s.prototype.div=function(c){return this.divmod(c,"div",!1).div},s.prototype.mod=function(c){return this.divmod(c,"mod",!1).mod},s.prototype.umod=function(c){return this.divmod(c,"mod",!0).mod},s.prototype.divRound=function(c){var u=this.divmod(c);if(u.mod.isZero())return u.div;var g=u.div.negative!==0?u.mod.isub(c):u.mod,w=c.ushrn(1),S=c.andln(1),C=g.cmp(w);return C<0||S===1&&C===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modrn=function(c){var u=c<0;u&&(c=-c),i(c<=67108863);for(var g=(1<<26)%c,w=0,S=this.length-1;S>=0;S--)w=(g*w+(this.words[S]|0))%c;return u?-w:w},s.prototype.modn=function(c){return this.modrn(c)},s.prototype.idivn=function(c){var u=c<0;u&&(c=-c),i(c<=67108863);for(var g=0,w=this.length-1;w>=0;w--){var S=(this.words[w]|0)+g*67108864;this.words[w]=S/c|0,g=S%c}return this._strip(),u?this.ineg():this},s.prototype.divn=function(c){return this.clone().idivn(c)},s.prototype.egcd=function(c){i(c.negative===0),i(!c.isZero());var u=this,g=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var w=new s(1),S=new s(0),C=new s(0),_=new s(1),l=0;u.isEven()&&g.isEven();)u.iushrn(1),g.iushrn(1),++l;for(var d=g.clone(),N=u.clone();!u.isZero();){for(var Y=0,te=1;!(u.words[0]&te)&&Y<26;++Y,te<<=1);if(Y>0)for(u.iushrn(Y);Y-- >0;)(w.isOdd()||S.isOdd())&&(w.iadd(d),S.isub(N)),w.iushrn(1),S.iushrn(1);for(var I=0,J=1;!(g.words[0]&J)&&I<26;++I,J<<=1);if(I>0)for(g.iushrn(I);I-- >0;)(C.isOdd()||_.isOdd())&&(C.iadd(d),_.isub(N)),C.iushrn(1),_.iushrn(1);u.cmp(g)>=0?(u.isub(g),w.isub(C),S.isub(_)):(g.isub(u),C.isub(w),_.isub(S))}return{a:C,b:_,gcd:g.iushln(l)}},s.prototype._invmp=function(c){i(c.negative===0),i(!c.isZero());var u=this,g=c.clone();u.negative!==0?u=u.umod(c):u=u.clone();for(var w=new s(1),S=new s(0),C=g.clone();u.cmpn(1)>0&&g.cmpn(1)>0;){for(var _=0,l=1;!(u.words[0]&l)&&_<26;++_,l<<=1);if(_>0)for(u.iushrn(_);_-- >0;)w.isOdd()&&w.iadd(C),w.iushrn(1);for(var d=0,N=1;!(g.words[0]&N)&&d<26;++d,N<<=1);if(d>0)for(g.iushrn(d);d-- >0;)S.isOdd()&&S.iadd(C),S.iushrn(1);u.cmp(g)>=0?(u.isub(g),w.isub(S)):(g.isub(u),S.isub(w))}var Y;return u.cmpn(1)===0?Y=w:Y=S,Y.cmpn(0)<0&&Y.iadd(c),Y},s.prototype.gcd=function(c){if(this.isZero())return c.abs();if(c.isZero())return this.abs();var u=this.clone(),g=c.clone();u.negative=0,g.negative=0;for(var w=0;u.isEven()&&g.isEven();w++)u.iushrn(1),g.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;g.isEven();)g.iushrn(1);var S=u.cmp(g);if(S<0){var C=u;u=g,g=C}else if(S===0||g.cmpn(1)===0)break;u.isub(g)}while(!0);return g.iushln(w)},s.prototype.invm=function(c){return this.egcd(c).a.umod(c)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(c){return this.words[0]&c},s.prototype.bincn=function(c){i(typeof c=="number");var u=c%26,g=(c-u)/26,w=1<<u;if(this.length<=g)return this._expand(g+1),this.words[g]|=w,this;for(var S=w,C=g;S!==0&&C<this.length;C++){var _=this.words[C]|0;_+=S,S=_>>>26,_&=67108863,this.words[C]=_}return S!==0&&(this.words[C]=S,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(c){var u=c<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var g;if(this.length>1)g=1;else{u&&(c=-c),i(c<=67108863,"Number is too big");var w=this.words[0]|0;g=w===c?0:w<c?-1:1}return this.negative!==0?-g|0:g},s.prototype.cmp=function(c){if(this.negative!==0&&c.negative===0)return-1;if(this.negative===0&&c.negative!==0)return 1;var u=this.ucmp(c);return this.negative!==0?-u|0:u},s.prototype.ucmp=function(c){if(this.length>c.length)return 1;if(this.length<c.length)return-1;for(var u=0,g=this.length-1;g>=0;g--){var w=this.words[g]|0,S=c.words[g]|0;if(w!==S){w<S?u=-1:w>S&&(u=1);break}}return u},s.prototype.gtn=function(c){return this.cmpn(c)===1},s.prototype.gt=function(c){return this.cmp(c)===1},s.prototype.gten=function(c){return this.cmpn(c)>=0},s.prototype.gte=function(c){return this.cmp(c)>=0},s.prototype.ltn=function(c){return this.cmpn(c)===-1},s.prototype.lt=function(c){return this.cmp(c)===-1},s.prototype.lten=function(c){return this.cmpn(c)<=0},s.prototype.lte=function(c){return this.cmp(c)<=0},s.prototype.eqn=function(c){return this.cmpn(c)===0},s.prototype.eq=function(c){return this.cmp(c)===0},s.red=function(c){return new U(c)},s.prototype.toRed=function(c){return i(!this.red,"Already a number in reduction context"),i(this.negative===0,"red works only with positives"),c.convertTo(this)._forceRed(c)},s.prototype.fromRed=function(){return i(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(c){return this.red=c,this},s.prototype.forceRed=function(c){return i(!this.red,"Already a number in reduction context"),this._forceRed(c)},s.prototype.redAdd=function(c){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,c)},s.prototype.redIAdd=function(c){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,c)},s.prototype.redSub=function(c){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,c)},s.prototype.redISub=function(c){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,c)},s.prototype.redShl=function(c){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,c)},s.prototype.redMul=function(c){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.mul(this,c)},s.prototype.redIMul=function(c){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,c),this.red.imul(this,c)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(c){return i(this.red&&!c.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,c)};var L={k256:null,p224:null,p192:null,p25519:null};function q(c,u){this.name=c,this.p=new s(u,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}q.prototype._tmp=function(){var c=new s(null);return c.words=new Array(Math.ceil(this.n/13)),c},q.prototype.ireduce=function(c){var u=c,g;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),g=u.bitLength();while(g>this.n);var w=g<this.n?-1:u.ucmp(this.p);return w===0?(u.words[0]=0,u.length=1):w>0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},q.prototype.split=function(c,u){c.iushrn(this.n,0,u)},q.prototype.imulK=function(c){return c.imul(this.k)};function y(){q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}n(y,q),y.prototype.split=function(c,u){for(var g=4194303,w=Math.min(c.length,9),S=0;S<w;S++)u.words[S]=c.words[S];if(u.length=w,c.length<=9){c.words[0]=0,c.length=1;return}var C=c.words[9];for(u.words[u.length++]=C&g,S=10;S<c.length;S++){var _=c.words[S]|0;c.words[S-10]=(_&g)<<4|C>>>22,C=_}C>>>=22,c.words[S-10]=C,C===0&&c.length>10?c.length-=10:c.length-=9},y.prototype.imulK=function(c){c.words[c.length]=0,c.words[c.length+1]=0,c.length+=2;for(var u=0,g=0;g<c.length;g++){var w=c.words[g]|0;u+=w*977,c.words[g]=u&67108863,u=w*64+(u/67108864|0)}return c.words[c.length-1]===0&&(c.length--,c.words[c.length-1]===0&&c.length--),c};function P(){q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}n(P,q);function Z(){q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}n(Z,q);function ne(){q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}n(ne,q),ne.prototype.imulK=function(c){for(var u=0,g=0;g<c.length;g++){var w=(c.words[g]|0)*19+u,S=w&67108863;w>>>=26,c.words[g]=S,u=w}return u!==0&&(c.words[c.length++]=u),c},s._prime=function(c){if(L[c])return L[c];var u;if(c==="k256")u=new y;else if(c==="p224")u=new P;else if(c==="p192")u=new Z;else if(c==="p25519")u=new ne;else throw new Error("Unknown prime "+c);return L[c]=u,u};function U(c){if(typeof c=="string"){var u=s._prime(c);this.m=u.p,this.prime=u}else i(c.gtn(1),"modulus must be greater than 1"),this.m=c,this.prime=null}U.prototype._verify1=function(c){i(c.negative===0,"red works only with positives"),i(c.red,"red works only with red numbers")},U.prototype._verify2=function(c,u){i((c.negative|u.negative)===0,"red works only with positives"),i(c.red&&c.red===u.red,"red works only with red numbers")},U.prototype.imod=function(c){return this.prime?this.prime.ireduce(c)._forceRed(this):(p(c,c.umod(this.m)._forceRed(this)),c)},U.prototype.neg=function(c){return c.isZero()?c.clone():this.m.sub(c)._forceRed(this)},U.prototype.add=function(c,u){this._verify2(c,u);var g=c.add(u);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},U.prototype.iadd=function(c,u){this._verify2(c,u);var g=c.iadd(u);return g.cmp(this.m)>=0&&g.isub(this.m),g},U.prototype.sub=function(c,u){this._verify2(c,u);var g=c.sub(u);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},U.prototype.isub=function(c,u){this._verify2(c,u);var g=c.isub(u);return g.cmpn(0)<0&&g.iadd(this.m),g},U.prototype.shl=function(c,u){return this._verify1(c),this.imod(c.ushln(u))},U.prototype.imul=function(c,u){return this._verify2(c,u),this.imod(c.imul(u))},U.prototype.mul=function(c,u){return this._verify2(c,u),this.imod(c.mul(u))},U.prototype.isqr=function(c){return this.imul(c,c.clone())},U.prototype.sqr=function(c){return this.mul(c,c)},U.prototype.sqrt=function(c){if(c.isZero())return c.clone();var u=this.m.andln(3);if(i(u%2===1),u===3){var g=this.m.add(new s(1)).iushrn(2);return this.pow(c,g)}for(var w=this.m.subn(1),S=0;!w.isZero()&&w.andln(1)===0;)S++,w.iushrn(1);i(!w.isZero());var C=new s(1).toRed(this),_=C.redNeg(),l=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new s(2*d*d).toRed(this);this.pow(d,l).cmp(_)!==0;)d.redIAdd(_);for(var N=this.pow(d,w),Y=this.pow(c,w.addn(1).iushrn(1)),te=this.pow(c,w),I=S;te.cmp(C)!==0;){for(var J=te,k=0;J.cmp(C)!==0;k++)J=J.redSqr();i(k<I);var H=this.pow(N,new s(1).iushln(I-k-1));Y=Y.redMul(H),N=H.redSqr(),te=te.redMul(N),I=k}return Y},U.prototype.invm=function(c){var u=c._invmp(this.m);return u.negative!==0?(u.negative=0,this.imod(u).redNeg()):this.imod(u)},U.prototype.pow=function(c,u){if(u.isZero())return new s(1).toRed(this);if(u.cmpn(1)===0)return c.clone();var g=4,w=new Array(1<<g);w[0]=new s(1).toRed(this),w[1]=c;for(var S=2;S<w.length;S++)w[S]=this.mul(w[S-1],c);var C=w[0],_=0,l=0,d=u.bitLength()%26;for(d===0&&(d=26),S=u.length-1;S>=0;S--){for(var N=u.words[S],Y=d-1;Y>=0;Y--){var te=N>>Y&1;if(C!==w[0]&&(C=this.sqr(C)),te===0&&_===0){l=0;continue}_<<=1,_|=te,l++,!(l!==g&&(S!==0||Y!==0))&&(C=this.mul(C,w[_]),l=0,_=0)}d=26}return C},U.prototype.convertTo=function(c){var u=c.umod(this.m);return u===c?u.clone():u},U.prototype.convertFrom=function(c){var u=c.clone();return u.red=null,u},s.mont=function(c){return new b(c)};function b(c){U.call(this,c),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}n(b,U),b.prototype.convertTo=function(c){return this.imod(c.ushln(this.shift))},b.prototype.convertFrom=function(c){var u=this.imod(c.mul(this.rinv));return u.red=null,u},b.prototype.imul=function(c,u){if(c.isZero()||u.isZero())return c.words[0]=0,c.length=1,c;var g=c.imul(u),w=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=g.isub(w).iushrn(this.shift),C=S;return S.cmp(this.m)>=0?C=S.isub(this.m):S.cmpn(0)<0&&(C=S.iadd(this.m)),C._forceRed(this)},b.prototype.mul=function(c,u){if(c.isZero()||u.isZero())return new s(0)._forceRed(this);var g=c.mul(u),w=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),S=g.isub(w).iushrn(this.shift),C=S;return S.cmp(this.m)>=0?C=S.isub(this.m):S.cmpn(0)<0&&(C=S.iadd(this.m)),C._forceRed(this)},b.prototype.invm=function(c){var u=this.imod(c._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(t,Ep)})(Mp);var He=Mp.exports;const Ip="bignumber/5.7.0";var ma=He.BN;const Ri=new Ft(Ip),Pc={},Al=9007199254740991;function S4(t){return t!=null&&(ut.isBigNumber(t)||typeof t=="number"&&t%1===0||typeof t=="string"&&!!t.match(/^-?[0-9]+$/)||pr(t)||typeof t=="bigint"||As(t))}let xl=!1;class ut{constructor(e,r){e!==Pc&&Ri.throwError("cannot call constructor directly; use BigNumber.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return rr(Ze(this).fromTwos(e))}toTwos(e){return rr(Ze(this).toTwos(e))}abs(){return this._hex[0]==="-"?ut.from(this._hex.substring(1)):this}add(e){return rr(Ze(this).add(Ze(e)))}sub(e){return rr(Ze(this).sub(Ze(e)))}div(e){return ut.from(e).isZero()&&Er("division-by-zero","div"),rr(Ze(this).div(Ze(e)))}mul(e){return rr(Ze(this).mul(Ze(e)))}mod(e){const r=Ze(e);return r.isNeg()&&Er("division-by-zero","mod"),rr(Ze(this).umod(r))}pow(e){const r=Ze(e);return r.isNeg()&&Er("negative-power","pow"),rr(Ze(this).pow(r))}and(e){const r=Ze(e);return(this.isNegative()||r.isNeg())&&Er("unbound-bitwise-result","and"),rr(Ze(this).and(r))}or(e){const r=Ze(e);return(this.isNegative()||r.isNeg())&&Er("unbound-bitwise-result","or"),rr(Ze(this).or(r))}xor(e){const r=Ze(e);return(this.isNegative()||r.isNeg())&&Er("unbound-bitwise-result","xor"),rr(Ze(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Er("negative-width","mask"),rr(Ze(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Er("negative-width","shl"),rr(Ze(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Er("negative-width","shr"),rr(Ze(this).shrn(e))}eq(e){return Ze(this).eq(Ze(e))}lt(e){return Ze(this).lt(Ze(e))}lte(e){return Ze(this).lte(Ze(e))}gt(e){return Ze(this).gt(Ze(e))}gte(e){return Ze(this).gte(Ze(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Ze(this).isZero()}toNumber(){try{return Ze(this).toNumber()}catch{Er("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ri.throwError("this platform does not support BigInt",Ft.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?xl||(xl=!0,Ri.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ri.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ft.errors.UNEXPECTED_ARGUMENT,{}):Ri.throwError("BigNumber.toString does not accept parameters",Ft.errors.UNEXPECTED_ARGUMENT,{})),Ze(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof ut)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new ut(Pc,co(e)):e.match(/^-?[0-9]+$/)?new ut(Pc,co(new ma(e))):Ri.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Er("underflow","BigNumber.from",e),(e>=Al||e<=-Al)&&Er("overflow","BigNumber.from",e),ut.from(String(e));const r=e;if(typeof r=="bigint")return ut.from(r.toString());if(As(r))return ut.from(sr(r));if(r)if(r.toHexString){const i=r.toHexString();if(typeof i=="string")return ut.from(i)}else{let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(pr(i)||i[0]==="-"&&pr(i.substring(1))))return ut.from(i)}return Ri.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function co(t){if(typeof t!="string")return co(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ri.throwArgumentError("invalid hex","value",t),t=co(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function rr(t){return ut.from(co(t))}function Ze(t){const e=ut.from(t).toHexString();return e[0]==="-"?new ma("-"+e.substring(3),16):new ma(e.substring(2),16)}function Er(t,e,r){const i={fault:t,operation:e};return r!=null&&(i.value=r),Ri.throwError(t,Ft.errors.NUMERIC_FAULT,i)}function M4(t){return new ma(t,36).toString(16)}const Gt=new Ft(Ip),Js={},Dp=ut.from(0),Cp=ut.from(-1);function Np(t,e,r,i){const n={fault:e,operation:r};return i!==void 0&&(n.value=i),Gt.throwError(t,Ft.errors.NUMERIC_FAULT,n)}let Qs="0";for(;Qs.length<256;)Qs+=Qs;function Eh(t){if(typeof t!="number")try{t=ut.from(t).toNumber()}catch{}return typeof t=="number"&&t>=0&&t<=256&&!(t%1)?"1"+Qs.substring(0,t):Gt.throwArgumentError("invalid decimal size","decimals",t)}function Bc(t,e){e==null&&(e=0);const r=Eh(e);t=ut.from(t);const i=t.lt(Dp);i&&(t=t.mul(Cp));let n=t.mod(r).toString();for(;n.length<r.length-1;)n="0"+n;n=n.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=t.div(r).toString();return r.length===1?t=s:t=s+"."+n,i&&(t="-"+t),t}function Di(t,e){e==null&&(e=0);const r=Eh(e);(typeof t!="string"||!t.match(/^-?[0-9.]+$/))&&Gt.throwArgumentError("invalid decimal value","value",t);const i=t.substring(0,1)==="-";i&&(t=t.substring(1)),t==="."&&Gt.throwArgumentError("missing value","value",t);const n=t.split(".");n.length>2&&Gt.throwArgumentError("too many decimal points","value",t);let s=n[0],o=n[1];for(s||(s="0"),o||(o="0");o[o.length-1]==="0";)o=o.substring(0,o.length-1);for(o.length>r.length-1&&Np("fractional component exceeds decimals","underflow","parseFixed"),o===""&&(o="0");o.length<r.length-1;)o+="0";const a=ut.from(s),h=ut.from(o);let f=a.mul(r).add(h);return i&&(f=f.mul(Cp)),f}let Fc=class Mf{constructor(e,r,i,n){e!==Js&&Gt.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=r,this.width=i,this.decimals=n,this.name=(r?"":"u")+"fixed"+String(i)+"x"+String(n),this._multiplier=Eh(n),Object.freeze(this)}static from(e){if(e instanceof Mf)return e;typeof e=="number"&&(e=`fixed128x${e}`);let r=!0,i=128,n=18;if(typeof e=="string"){if(e!=="fixed")if(e==="ufixed")r=!1;else{const s=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);s||Gt.throwArgumentError("invalid fixed format","format",e),r=s[1]!=="u",i=parseInt(s[2]),n=parseInt(s[3])}}else if(e){const s=(o,a,h)=>e[o]==null?h:(typeof e[o]!==a&&Gt.throwArgumentError("invalid fixed format ("+o+" not "+a+")","format."+o,e[o]),e[o]);r=s("signed","boolean",r),i=s("width","number",i),n=s("decimals","number",n)}return i%8&&Gt.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",i),n>80&&Gt.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",n),new Mf(Js,r,i,n)}},Tp=class Ht{constructor(e,r,i,n){e!==Js&&Gt.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ft.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=n,this._hex=r,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Gt.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const r=Di(this._value,this.format.decimals),i=Di(e._value,e.format.decimals);return Ht.fromValue(r.add(i),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const r=Di(this._value,this.format.decimals),i=Di(e._value,e.format.decimals);return Ht.fromValue(r.sub(i),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const r=Di(this._value,this.format.decimals),i=Di(e._value,e.format.decimals);return Ht.fromValue(r.mul(i).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const r=Di(this._value,this.format.decimals),i=Di(e._value,e.format.decimals);return Ht.fromValue(r.mul(this.format._multiplier).div(i),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Ht.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return this.isNegative()&&i&&(r=r.subUnsafe(Sl.toFormat(r.format))),r}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let r=Ht.from(e[0],this.format);const i=!e[1].match(/^(0*)$/);return!this.isNegative()&&i&&(r=r.addUnsafe(Sl.toFormat(r.format))),r}round(e){e==null&&(e=0);const r=this.toString().split(".");if(r.length===1&&r.push("0"),(e<0||e>80||e%1)&&Gt.throwArgumentError("invalid decimal count","decimals",e),r[1].length<=e)return this;const i=Ht.from("1"+Qs.substring(0,e),this.format),n=I4.toFormat(this.format);return this.mulUnsafe(i).addUnsafe(n).floor().divUnsafe(i)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Gt.throwArgumentError("invalid byte width","width",e);const r=ut.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return ni(r,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Ht.fromString(this._value,e)}static fromValue(e,r,i){return i==null&&r!=null&&!S4(r)&&(i=r,r=null),r==null&&(r=0),i==null&&(i="fixed"),Ht.fromString(Bc(e,r),Fc.from(i))}static fromString(e,r){r==null&&(r="fixed");const i=Fc.from(r),n=Di(e,i.decimals);!i.signed&&n.lt(Dp)&&Np("unsigned value cannot be negative","overflow","value",e);let s=null;i.signed?s=n.toTwos(i.width).toHexString():(s=n.toHexString(),s=ni(s,i.width/8));const o=Bc(n,i.decimals);return new Ht(Js,s,o,i)}static fromBytes(e,r){r==null&&(r="fixed");const i=Fc.from(r);if(mt(e).length>i.width/8)throw new Error("overflow");let n=ut.from(e);i.signed&&(n=n.fromTwos(i.width));const s=n.toTwos((i.signed?0:1)+i.width).toHexString(),o=Bc(n,i.decimals);return new Ht(Js,s,o,i)}static from(e,r){if(typeof e=="string")return Ht.fromString(e,r);if(As(e))return Ht.fromBytes(e,r);try{return Ht.fromValue(e,0,r)}catch(i){if(i.code!==Ft.errors.INVALID_ARGUMENT)throw i}return Gt.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}};const Sl=Tp.from(1),I4=Tp.from("0.5"),D4="strings/5.7.0",C4=new Ft(D4);var ya;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD"})(ya||(ya={}));var Ml;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation"})(Ml||(Ml={}));function Lc(t,e=ya.current){e!=ya.current&&(C4.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){const n=t.charCodeAt(i);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(n&63|128);else if((n&64512)==55296){i++;const s=t.charCodeAt(i);if(i>=t.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((n&1023)<<10)+(s&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(n&63|128)}return mt(r)}function N4(t){if(t.length%4!==0)throw new Error("bad data");let e=[];for(let r=0;r<t.length;r+=4)e.push(parseInt(t.substring(r,r+4),16));return e}function Uc(t,e){e||(e=function(n){return[parseInt(n,16)]});let r=0,i={};return t.split(",").forEach(n=>{let s=n.split(":");r+=parseInt(s[0],16),i[r]=e(s[1])}),i}function Il(t){let e=0;return t.split(",").map(r=>{let i=r.split("-");i.length===1?i[1]="0":i[1]===""&&(i[1]="1");let n=e+parseInt(i[0],16);return e=parseInt(i[1],16),{l:n,h:e}})}Il("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(t=>parseInt(t,16)),Uc("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Uc("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Uc("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",N4),Il("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function T4(t){t=atob(t);const e=[];for(let r=0;r<t.length;r++)e.push(t.charCodeAt(r));return mt(e)}function Rp(t,e){e==null&&(e=1);const r=[],i=r.forEach,n=function(s,o){i.call(s,function(a){o>0&&Array.isArray(a)?n(a,o-1):r.push(a)})};return n(t,e),r}function R4(t){const e={};for(let r=0;r<t.length;r++){const i=t[r];e[i[0]]=i[1]}return e}function O4(t){let e=0;function r(){return t[e++]<<8|t[e++]}let i=r(),n=1,s=[0,1];for(let L=1;L<i;L++)s.push(n+=r());let o=r(),a=e;e+=o;let h=0,f=0;function p(){return h==0&&(f=f<<8|t[e++],h=8),f>>--h&1}const v=31,x=Math.pow(2,v),E=x>>>1,D=E>>1,B=x-1;let F=0;for(let L=0;L<v;L++)F=F<<1|p();let j=[],R=0,K=x;for(;;){let L=Math.floor(((F-R+1)*n-1)/K),q=0,y=i;for(;y-q>1;){let ne=q+y>>>1;L<s[ne]?y=ne:q=ne}if(q==0)break;j.push(q);let P=R+Math.floor(K*s[q]/n),Z=R+Math.floor(K*s[q+1]/n)-1;for(;!((P^Z)&E);)F=F<<1&B|p(),P=P<<1&B,Z=Z<<1&B|1;for(;P&~Z&D;)F=F&E|F<<1&B>>>1|p(),P=P<<1^E,Z=(Z^E)<<1|E|1;R=P,K=1+Z-P}let T=i-4;return j.map(L=>{switch(L-T){case 3:return T+65792+(t[a++]<<16|t[a++]<<8|t[a++]);case 2:return T+256+(t[a++]<<8|t[a++]);case 1:return T+t[a++];default:return L-1}})}function P4(t){let e=0;return()=>t[e++]}function B4(t){return P4(O4(t))}function F4(t){return t&1?~t>>1:t>>1}function L4(t,e){let r=Array(t);for(let i=0;i<t;i++)r[i]=1+e();return r}function Dl(t,e){let r=Array(t);for(let i=0,n=-1;i<t;i++)r[i]=n+=1+e();return r}function U4(t,e){let r=Array(t);for(let i=0,n=0;i<t;i++)r[i]=n+=F4(e());return r}function wa(t,e){let r=Dl(t(),t),i=t(),n=Dl(i,t),s=L4(i,t);for(let o=0;o<i;o++)for(let a=0;a<s[o];a++)r.push(n[o]+a);return e?r.map(o=>e[o]):r}function k4(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(q4(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(z4(r,t))}return R4(Rp(e))}function $4(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Op(t,e,r){let i=Array(t).fill(void 0).map(()=>[]);for(let n=0;n<e;n++)U4(t,r).forEach((s,o)=>i[o].push(s));return i}function q4(t,e){let r=1+e(),i=e(),n=$4(e),s=Op(n.length,1+t,e);return Rp(s.map((o,a)=>{const h=o[0],f=o.slice(1);return Array(n[a]).fill(void 0).map((p,v)=>{let x=v*i;return[h+v*r,f.map(E=>E+x)]})}))}function z4(t,e){let r=1+e();return Op(r,1+t,e).map(i=>[i[0],i.slice(1)])}function K4(t){let e=wa(t).sort((i,n)=>i-n);return r();function r(){let i=[];for(;;){let f=wa(t,e);if(f.length==0)break;i.push({set:new Set(f),node:r()})}i.sort((f,p)=>p.set.size-f.set.size);let n=t(),s=n%3;n=n/3|0;let o=!!(n&1);n>>=1;let a=n==1,h=n==2;return{branches:i,valid:s,fe0f:o,save:a,check:h}}}function j4(){return B4(T4("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const qo=j4();new Set(wa(qo)),new Set(wa(qo)),k4(qo),K4(qo);const H4=new Uint8Array(32);H4.fill(0);const V4=`Ethereum Signed Message:
548
- `;function Pp(t){return typeof t=="string"&&(t=Lc(t)),_h(y4([Lc(V4),Lc(String(t.length)),t]))}const W4="address/5.7.0",Hs=new Ft(W4);function Cl(t){pr(t,20)||Hs.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let n=0;n<40;n++)r[n]=e[n].charCodeAt(0);const i=mt(_h(r));for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&(e[n]=e[n].toUpperCase()),(i[n>>1]&15)>=8&&(e[n+1]=e[n+1].toUpperCase());return"0x"+e.join("")}const G4=9007199254740991;function Y4(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const Ah={};for(let t=0;t<10;t++)Ah[String(t)]=String(t);for(let t=0;t<26;t++)Ah[String.fromCharCode(65+t)]=String(10+t);const Nl=Math.floor(Y4(G4));function J4(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>Ah[i]).join("");for(;e.length>=Nl;){let i=e.substring(0,Nl);e=parseInt(i,10)%97+e.substring(i.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function Q4(t){let e=null;if(typeof t!="string"&&Hs.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Cl(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Hs.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==J4(t)&&Hs.throwArgumentError("bad icap checksum","address",t),e=M4(t.substring(4));e.length<40;)e="0"+e;e=Cl("0x"+e)}else Hs.throwArgumentError("invalid address","address",t);return e}function Fs(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}const X4=new Uint8Array(32);X4.fill(0),ut.from(-1);const Z4=ut.from(0),e_=ut.from(1);ut.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),ni(e_.toHexString(),32),ni(Z4.toHexString(),32);var Gr={},rt={},So=Bp;function Bp(t,e){if(!t)throw new Error(e||"Assertion failed")}Bp.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var If={exports:{}};typeof Object.create=="function"?If.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:If.exports=function(t,e){if(e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}};var t_=So,r_=If.exports;rt.inherits=r_;function i_(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function n_(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),n=0;n<t.length;n+=2)r.push(parseInt(t[n]+t[n+1],16))}else for(var i=0,n=0;n<t.length;n++){var s=t.charCodeAt(n);s<128?r[i++]=s:s<2048?(r[i++]=s>>6|192,r[i++]=s&63|128):i_(t,n)?(s=65536+((s&1023)<<10)+(t.charCodeAt(++n)&1023),r[i++]=s>>18|240,r[i++]=s>>12&63|128,r[i++]=s>>6&63|128,r[i++]=s&63|128):(r[i++]=s>>12|224,r[i++]=s>>6&63|128,r[i++]=s&63|128)}else for(n=0;n<t.length;n++)r[n]=t[n]|0;return r}rt.toArray=n_;function s_(t){for(var e="",r=0;r<t.length;r++)e+=Lp(t[r].toString(16));return e}rt.toHex=s_;function Fp(t){var e=t>>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}rt.htonl=Fp;function o_(t,e){for(var r="",i=0;i<t.length;i++){var n=t[i];e==="little"&&(n=Fp(n)),r+=Up(n.toString(16))}return r}rt.toHex32=o_;function Lp(t){return t.length===1?"0"+t:t}rt.zero2=Lp;function Up(t){return t.length===7?"0"+t:t.length===6?"00"+t:t.length===5?"000"+t:t.length===4?"0000"+t:t.length===3?"00000"+t:t.length===2?"000000"+t:t.length===1?"0000000"+t:t}rt.zero8=Up;function a_(t,e,r,i){var n=r-e;t_(n%4===0);for(var s=new Array(n/4),o=0,a=e;o<s.length;o++,a+=4){var h;i==="big"?h=t[a]<<24|t[a+1]<<16|t[a+2]<<8|t[a+3]:h=t[a+3]<<24|t[a+2]<<16|t[a+1]<<8|t[a],s[o]=h>>>0}return s}rt.join32=a_;function c_(t,e){for(var r=new Array(t.length*4),i=0,n=0;i<t.length;i++,n+=4){var s=t[i];e==="big"?(r[n]=s>>>24,r[n+1]=s>>>16&255,r[n+2]=s>>>8&255,r[n+3]=s&255):(r[n+3]=s>>>24,r[n+2]=s>>>16&255,r[n+1]=s>>>8&255,r[n]=s&255)}return r}rt.split32=c_;function f_(t,e){return t>>>e|t<<32-e}rt.rotr32=f_;function h_(t,e){return t<<e|t>>>32-e}rt.rotl32=h_;function u_(t,e){return t+e>>>0}rt.sum32=u_;function l_(t,e,r){return t+e+r>>>0}rt.sum32_3=l_;function d_(t,e,r,i){return t+e+r+i>>>0}rt.sum32_4=d_;function p_(t,e,r,i,n){return t+e+r+i+n>>>0}rt.sum32_5=p_;function g_(t,e,r,i){var n=t[e],s=t[e+1],o=i+s>>>0,a=(o<i?1:0)+r+n;t[e]=a>>>0,t[e+1]=o}rt.sum64=g_;function b_(t,e,r,i){var n=e+i>>>0,s=(n<e?1:0)+t+r;return s>>>0}rt.sum64_hi=b_;function v_(t,e,r,i){var n=e+i;return n>>>0}rt.sum64_lo=v_;function m_(t,e,r,i,n,s,o,a){var h=0,f=e;f=f+i>>>0,h+=f<e?1:0,f=f+s>>>0,h+=f<s?1:0,f=f+a>>>0,h+=f<a?1:0;var p=t+r+n+o+h;return p>>>0}rt.sum64_4_hi=m_;function y_(t,e,r,i,n,s,o,a){var h=e+i+s+a;return h>>>0}rt.sum64_4_lo=y_;function w_(t,e,r,i,n,s,o,a,h,f){var p=0,v=e;v=v+i>>>0,p+=v<e?1:0,v=v+s>>>0,p+=v<s?1:0,v=v+a>>>0,p+=v<a?1:0,v=v+f>>>0,p+=v<f?1:0;var x=t+r+n+o+h+p;return x>>>0}rt.sum64_5_hi=w_;function __(t,e,r,i,n,s,o,a,h,f){var p=e+i+s+a+f;return p>>>0}rt.sum64_5_lo=__;function E_(t,e,r){var i=e<<32-r|t>>>r;return i>>>0}rt.rotr64_hi=E_;function A_(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}rt.rotr64_lo=A_;function x_(t,e,r){return t>>>r}rt.shr64_hi=x_;function S_(t,e,r){var i=t<<32-r|e>>>r;return i>>>0}rt.shr64_lo=S_;var xs={},Tl=rt,M_=So;function zo(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}xs.BlockHash=zo,zo.prototype.update=function(t,e){if(t=Tl.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var r=t.length%this._delta8;this.pending=t.slice(t.length-r,t.length),this.pending.length===0&&(this.pending=null),t=Tl.join32(t,0,t.length-r,this.endian);for(var i=0;i<t.length;i+=this._delta32)this._update(t,i,i+this._delta32)}return this},zo.prototype.digest=function(t){return this.update(this._pad()),M_(this.pending===null),this._digest(t)},zo.prototype._pad=function(){var t=this.pendingTotal,e=this._delta8,r=e-(t+this.padLength)%e,i=new Array(r+this.padLength);i[0]=128;for(var n=1;n<r;n++)i[n]=0;if(t<<=3,this.endian==="big"){for(var s=8;s<this.padLength;s++)i[n++]=0;i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=t>>>24&255,i[n++]=t>>>16&255,i[n++]=t>>>8&255,i[n++]=t&255}else for(i[n++]=t&255,i[n++]=t>>>8&255,i[n++]=t>>>16&255,i[n++]=t>>>24&255,i[n++]=0,i[n++]=0,i[n++]=0,i[n++]=0,s=8;s<this.padLength;s++)i[n++]=0;return i};var Vn={},bi={},I_=rt,si=I_.rotr32;function D_(t,e,r,i){if(t===0)return kp(e,r,i);if(t===1||t===3)return qp(e,r,i);if(t===2)return $p(e,r,i)}bi.ft_1=D_;function kp(t,e,r){return t&e^~t&r}bi.ch32=kp;function $p(t,e,r){return t&e^t&r^e&r}bi.maj32=$p;function qp(t,e,r){return t^e^r}bi.p32=qp;function C_(t){return si(t,2)^si(t,13)^si(t,22)}bi.s0_256=C_;function N_(t){return si(t,6)^si(t,11)^si(t,25)}bi.s1_256=N_;function T_(t){return si(t,7)^si(t,18)^t>>>3}bi.g0_256=T_;function R_(t){return si(t,17)^si(t,19)^t>>>10}bi.g1_256=R_;var fs=rt,O_=xs,P_=bi,kc=fs.rotl32,Ls=fs.sum32,B_=fs.sum32_5,F_=P_.ft_1,zp=O_.BlockHash,L_=[1518500249,1859775393,2400959708,3395469782];function Xr(){if(!(this instanceof Xr))return new Xr;zp.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}fs.inherits(Xr,zp);var U_=Xr;Xr.blockSize=512,Xr.outSize=160,Xr.hmacStrength=80,Xr.padLength=64,Xr.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=kc(r[i-3]^r[i-8]^r[i-14]^r[i-16],1);var n=this.h[0],s=this.h[1],o=this.h[2],a=this.h[3],h=this.h[4];for(i=0;i<r.length;i++){var f=~~(i/20),p=B_(kc(n,5),F_(f,s,o,a),h,r[i],L_[f]);h=a,a=o,o=kc(s,30),s=n,n=p}this.h[0]=Ls(this.h[0],n),this.h[1]=Ls(this.h[1],s),this.h[2]=Ls(this.h[2],o),this.h[3]=Ls(this.h[3],a),this.h[4]=Ls(this.h[4],h)},Xr.prototype._digest=function(t){return t==="hex"?fs.toHex32(this.h,"big"):fs.split32(this.h,"big")};var hs=rt,k_=xs,Ss=bi,$_=So,Pr=hs.sum32,q_=hs.sum32_4,z_=hs.sum32_5,K_=Ss.ch32,j_=Ss.maj32,H_=Ss.s0_256,V_=Ss.s1_256,W_=Ss.g0_256,G_=Ss.g1_256,Kp=k_.BlockHash,Y_=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Zr(){if(!(this instanceof Zr))return new Zr;Kp.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Y_,this.W=new Array(64)}hs.inherits(Zr,Kp);var jp=Zr;Zr.blockSize=512,Zr.outSize=256,Zr.hmacStrength=192,Zr.padLength=64,Zr.prototype._update=function(t,e){for(var r=this.W,i=0;i<16;i++)r[i]=t[e+i];for(;i<r.length;i++)r[i]=q_(G_(r[i-2]),r[i-7],W_(r[i-15]),r[i-16]);var n=this.h[0],s=this.h[1],o=this.h[2],a=this.h[3],h=this.h[4],f=this.h[5],p=this.h[6],v=this.h[7];for($_(this.k.length===r.length),i=0;i<r.length;i++){var x=z_(v,V_(h),K_(h,f,p),this.k[i],r[i]),E=Pr(H_(n),j_(n,s,o));v=p,p=f,f=h,h=Pr(a,x),a=o,o=s,s=n,n=Pr(x,E)}this.h[0]=Pr(this.h[0],n),this.h[1]=Pr(this.h[1],s),this.h[2]=Pr(this.h[2],o),this.h[3]=Pr(this.h[3],a),this.h[4]=Pr(this.h[4],h),this.h[5]=Pr(this.h[5],f),this.h[6]=Pr(this.h[6],p),this.h[7]=Pr(this.h[7],v)},Zr.prototype._digest=function(t){return t==="hex"?hs.toHex32(this.h,"big"):hs.split32(this.h,"big")};var Df=rt,Hp=jp;function Pi(){if(!(this instanceof Pi))return new Pi;Hp.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Df.inherits(Pi,Hp);var J_=Pi;Pi.blockSize=512,Pi.outSize=224,Pi.hmacStrength=192,Pi.padLength=64,Pi.prototype._digest=function(t){return t==="hex"?Df.toHex32(this.h.slice(0,7),"big"):Df.split32(this.h.slice(0,7),"big")};var hr=rt,Q_=xs,X_=So,oi=hr.rotr64_hi,ai=hr.rotr64_lo,Vp=hr.shr64_hi,Wp=hr.shr64_lo,Wi=hr.sum64,$c=hr.sum64_hi,qc=hr.sum64_lo,Z_=hr.sum64_4_hi,e9=hr.sum64_4_lo,t9=hr.sum64_5_hi,r9=hr.sum64_5_lo,Gp=Q_.BlockHash,i9=[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 kr(){if(!(this instanceof kr))return new kr;Gp.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=i9,this.W=new Array(160)}hr.inherits(kr,Gp);var Yp=kr;kr.blockSize=1024,kr.outSize=512,kr.hmacStrength=192,kr.padLength=128,kr.prototype._prepareBlock=function(t,e){for(var r=this.W,i=0;i<32;i++)r[i]=t[e+i];for(;i<r.length;i+=2){var n=p9(r[i-4],r[i-3]),s=g9(r[i-4],r[i-3]),o=r[i-14],a=r[i-13],h=l9(r[i-30],r[i-29]),f=d9(r[i-30],r[i-29]),p=r[i-32],v=r[i-31];r[i]=Z_(n,s,o,a,h,f,p,v),r[i+1]=e9(n,s,o,a,h,f,p,v)}},kr.prototype._update=function(t,e){this._prepareBlock(t,e);var r=this.W,i=this.h[0],n=this.h[1],s=this.h[2],o=this.h[3],a=this.h[4],h=this.h[5],f=this.h[6],p=this.h[7],v=this.h[8],x=this.h[9],E=this.h[10],D=this.h[11],B=this.h[12],F=this.h[13],j=this.h[14],R=this.h[15];X_(this.k.length===r.length);for(var K=0;K<r.length;K+=2){var T=j,L=R,q=h9(v,x),y=u9(v,x),P=n9(v,x,E,D,B),Z=s9(v,x,E,D,B,F),ne=this.k[K],U=this.k[K+1],b=r[K],c=r[K+1],u=t9(T,L,q,y,P,Z,ne,U,b,c),g=r9(T,L,q,y,P,Z,ne,U,b,c);T=c9(i,n),L=f9(i,n),q=o9(i,n,s,o,a),y=a9(i,n,s,o,a,h);var w=$c(T,L,q,y),S=qc(T,L,q,y);j=B,R=F,B=E,F=D,E=v,D=x,v=$c(f,p,u,g),x=qc(p,p,u,g),f=a,p=h,a=s,h=o,s=i,o=n,i=$c(u,g,w,S),n=qc(u,g,w,S)}Wi(this.h,0,i,n),Wi(this.h,2,s,o),Wi(this.h,4,a,h),Wi(this.h,6,f,p),Wi(this.h,8,v,x),Wi(this.h,10,E,D),Wi(this.h,12,B,F),Wi(this.h,14,j,R)},kr.prototype._digest=function(t){return t==="hex"?hr.toHex32(this.h,"big"):hr.split32(this.h,"big")};function n9(t,e,r,i,n){var s=t&r^~t&n;return s<0&&(s+=4294967296),s}function s9(t,e,r,i,n,s){var o=e&i^~e&s;return o<0&&(o+=4294967296),o}function o9(t,e,r,i,n){var s=t&r^t&n^r&n;return s<0&&(s+=4294967296),s}function a9(t,e,r,i,n,s){var o=e&i^e&s^i&s;return o<0&&(o+=4294967296),o}function c9(t,e){var r=oi(t,e,28),i=oi(e,t,2),n=oi(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function f9(t,e){var r=ai(t,e,28),i=ai(e,t,2),n=ai(e,t,7),s=r^i^n;return s<0&&(s+=4294967296),s}function h9(t,e){var r=oi(t,e,14),i=oi(t,e,18),n=oi(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function u9(t,e){var r=ai(t,e,14),i=ai(t,e,18),n=ai(e,t,9),s=r^i^n;return s<0&&(s+=4294967296),s}function l9(t,e){var r=oi(t,e,1),i=oi(t,e,8),n=Vp(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function d9(t,e){var r=ai(t,e,1),i=ai(t,e,8),n=Wp(t,e,7),s=r^i^n;return s<0&&(s+=4294967296),s}function p9(t,e){var r=oi(t,e,19),i=oi(e,t,29),n=Vp(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}function g9(t,e){var r=ai(t,e,19),i=ai(e,t,29),n=Wp(t,e,6),s=r^i^n;return s<0&&(s+=4294967296),s}var Cf=rt,Jp=Yp;function Bi(){if(!(this instanceof Bi))return new Bi;Jp.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Cf.inherits(Bi,Jp);var b9=Bi;Bi.blockSize=1024,Bi.outSize=384,Bi.hmacStrength=192,Bi.padLength=128,Bi.prototype._digest=function(t){return t==="hex"?Cf.toHex32(this.h.slice(0,12),"big"):Cf.split32(this.h.slice(0,12),"big")},Vn.sha1=U_,Vn.sha224=J_,Vn.sha256=jp,Vn.sha384=b9,Vn.sha512=Yp;var Qp={},Sn=rt,v9=xs,Ko=Sn.rotl32,Rl=Sn.sum32,Us=Sn.sum32_3,Ol=Sn.sum32_4,Xp=v9.BlockHash;function Yr(){if(!(this instanceof Yr))return new Yr;Xp.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Sn.inherits(Yr,Xp),Qp.ripemd160=Yr,Yr.blockSize=512,Yr.outSize=160,Yr.hmacStrength=192,Yr.padLength=64,Yr.prototype._update=function(t,e){for(var r=this.h[0],i=this.h[1],n=this.h[2],s=this.h[3],o=this.h[4],a=r,h=i,f=n,p=s,v=o,x=0;x<80;x++){var E=Rl(Ko(Ol(r,Pl(x,i,n,s),t[w9[x]+e],m9(x)),E9[x]),o);r=o,o=s,s=Ko(n,10),n=i,i=E,E=Rl(Ko(Ol(a,Pl(79-x,h,f,p),t[_9[x]+e],y9(x)),A9[x]),v),a=v,v=p,p=Ko(f,10),f=h,h=E}E=Us(this.h[1],n,p),this.h[1]=Us(this.h[2],s,v),this.h[2]=Us(this.h[3],o,a),this.h[3]=Us(this.h[4],r,h),this.h[4]=Us(this.h[0],i,f),this.h[0]=E},Yr.prototype._digest=function(t){return t==="hex"?Sn.toHex32(this.h,"little"):Sn.split32(this.h,"little")};function Pl(t,e,r,i){return t<=15?e^r^i:t<=31?e&r|~e&i:t<=47?(e|~r)^i:t<=63?e&i|r&~i:e^(r|~i)}function m9(t){return t<=15?0:t<=31?1518500249:t<=47?1859775393:t<=63?2400959708:2840853838}function y9(t){return t<=15?1352829926:t<=31?1548603684:t<=47?1836072691:t<=63?2053994217:0}var w9=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],_9=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],E9=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],A9=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],x9=rt,S9=So;function Qn(t,e,r){if(!(this instanceof Qn))return new Qn(t,e,r);this.Hash=t,this.blockSize=t.blockSize/8,this.outSize=t.outSize/8,this.inner=null,this.outer=null,this._init(x9.toArray(e,r))}var M9=Qn;Qn.prototype._init=function(t){t.length>this.blockSize&&(t=new this.Hash().update(t).digest()),S9(t.length<=this.blockSize);for(var e=t.length;e<this.blockSize;e++)t.push(0);for(e=0;e<t.length;e++)t[e]^=54;for(this.inner=new this.Hash().update(t),e=0;e<t.length;e++)t[e]^=106;this.outer=new this.Hash().update(t)},Qn.prototype.update=function(t,e){return this.inner.update(t,e),this},Qn.prototype.digest=function(t){return this.outer.update(this.inner.digest()),this.outer.digest(t)},function(t){var e=t;e.utils=rt,e.common=xs,e.sha=Vn,e.ripemd=Qp,e.hmac=M9,e.sha1=e.sha.sha1,e.sha256=e.sha.sha256,e.sha224=e.sha.sha224,e.sha384=e.sha.sha384,e.sha512=e.sha.sha512,e.ripemd160=e.ripemd.ripemd160}(Gr);function Ms(t,e,r){return r={path:e,exports:{},require:function(i,n){return I9(i,n??r.path)}},t(r,r.exports),r.exports}function I9(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var xh=Zp;function Zp(t,e){if(!t)throw new Error(e||"Assertion failed")}Zp.equal=function(t,e,r){if(t!=e)throw new Error(r||"Assertion failed: "+t+" != "+e)};var zr=Ms(function(t,e){var r=e;function i(o,a){if(Array.isArray(o))return o.slice();if(!o)return[];var h=[];if(typeof o!="string"){for(var f=0;f<o.length;f++)h[f]=o[f]|0;return h}if(a==="hex"){o=o.replace(/[^a-z0-9]+/ig,""),o.length%2!==0&&(o="0"+o);for(var f=0;f<o.length;f+=2)h.push(parseInt(o[f]+o[f+1],16))}else for(var f=0;f<o.length;f++){var p=o.charCodeAt(f),v=p>>8,x=p&255;v?h.push(v,x):h.push(x)}return h}r.toArray=i;function n(o){return o.length===1?"0"+o:o}r.zero2=n;function s(o){for(var a="",h=0;h<o.length;h++)a+=n(o[h].toString(16));return a}r.toHex=s,r.encode=function(o,a){return a==="hex"?s(o):o}}),gr=Ms(function(t,e){var r=e;r.assert=xh,r.toArray=zr.toArray,r.zero2=zr.zero2,r.toHex=zr.toHex,r.encode=zr.encode;function i(h,f,p){var v=new Array(Math.max(h.bitLength(),p)+1);v.fill(0);for(var x=1<<f+1,E=h.clone(),D=0;D<v.length;D++){var B,F=E.andln(x-1);E.isOdd()?(F>(x>>1)-1?B=(x>>1)-F:B=F,E.isubn(B)):B=0,v[D]=B,E.iushrn(1)}return v}r.getNAF=i;function n(h,f){var p=[[],[]];h=h.clone(),f=f.clone();for(var v=0,x=0,E;h.cmpn(-v)>0||f.cmpn(-x)>0;){var D=h.andln(3)+v&3,B=f.andln(3)+x&3;D===3&&(D=-1),B===3&&(B=-1);var F;D&1?(E=h.andln(7)+v&7,(E===3||E===5)&&B===2?F=-D:F=D):F=0,p[0].push(F);var j;B&1?(E=f.andln(7)+x&7,(E===3||E===5)&&D===2?j=-B:j=B):j=0,p[1].push(j),2*v===F+1&&(v=1-v),2*x===j+1&&(x=1-x),h.iushrn(1),f.iushrn(1)}return p}r.getJSF=n;function s(h,f,p){var v="_"+f;h.prototype[f]=function(){return this[v]!==void 0?this[v]:this[v]=p.call(this)}}r.cachedProperty=s;function o(h){return typeof h=="string"?r.toArray(h,"hex"):h}r.parseBytes=o;function a(h){return new He(h,"hex","le")}r.intFromLE=a}),jo=gr.getNAF,D9=gr.getJSF,_a=gr.assert;function Qi(t,e){this.type=t,this.p=new He(e.p,16),this.red=e.prime?He.red(e.prime):He.mont(this.p),this.zero=new He(0).toRed(this.red),this.one=new He(1).toRed(this.red),this.two=new He(2).toRed(this.red),this.n=e.n&&new He(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ln=Qi;Qi.prototype.point=function(){throw new Error("Not implemented")},Qi.prototype.validate=function(){throw new Error("Not implemented")},Qi.prototype._fixedNafMul=function(t,e){_a(t.precomputed);var r=t._getDoubles(),i=jo(e,1,this._bitLength),n=(1<<r.step+1)-(r.step%2===0?2:1);n/=3;var s=[],o,a;for(o=0;o<i.length;o+=r.step){a=0;for(var h=o+r.step-1;h>=o;h--)a=(a<<1)+i[h];s.push(a)}for(var f=this.jpoint(null,null,null),p=this.jpoint(null,null,null),v=n;v>0;v--){for(o=0;o<s.length;o++)a=s[o],a===v?p=p.mixedAdd(r.points[o]):a===-v&&(p=p.mixedAdd(r.points[o].neg()));f=f.add(p)}return f.toP()},Qi.prototype._wnafMul=function(t,e){var r=4,i=t._getNAFPoints(r);r=i.wnd;for(var n=i.points,s=jo(e,r,this._bitLength),o=this.jpoint(null,null,null),a=s.length-1;a>=0;a--){for(var h=0;a>=0&&s[a]===0;a--)h++;if(a>=0&&h++,o=o.dblp(h),a<0)break;var f=s[a];_a(f!==0),t.type==="affine"?f>0?o=o.mixedAdd(n[f-1>>1]):o=o.mixedAdd(n[-f-1>>1].neg()):f>0?o=o.add(n[f-1>>1]):o=o.add(n[-f-1>>1].neg())}return t.type==="affine"?o.toP():o},Qi.prototype._wnafMulAdd=function(t,e,r,i,n){var s=this._wnafT1,o=this._wnafT2,a=this._wnafT3,h=0,f,p,v;for(f=0;f<i;f++){v=e[f];var x=v._getNAFPoints(t);s[f]=x.wnd,o[f]=x.points}for(f=i-1;f>=1;f-=2){var E=f-1,D=f;if(s[E]!==1||s[D]!==1){a[E]=jo(r[E],s[E],this._bitLength),a[D]=jo(r[D],s[D],this._bitLength),h=Math.max(a[E].length,h),h=Math.max(a[D].length,h);continue}var B=[e[E],null,null,e[D]];e[E].y.cmp(e[D].y)===0?(B[1]=e[E].add(e[D]),B[2]=e[E].toJ().mixedAdd(e[D].neg())):e[E].y.cmp(e[D].y.redNeg())===0?(B[1]=e[E].toJ().mixedAdd(e[D]),B[2]=e[E].add(e[D].neg())):(B[1]=e[E].toJ().mixedAdd(e[D]),B[2]=e[E].toJ().mixedAdd(e[D].neg()));var F=[-3,-1,-5,-7,0,7,5,1,3],j=D9(r[E],r[D]);for(h=Math.max(j[0].length,h),a[E]=new Array(h),a[D]=new Array(h),p=0;p<h;p++){var R=j[0][p]|0,K=j[1][p]|0;a[E][p]=F[(R+1)*3+(K+1)],a[D][p]=0,o[E]=B}}var T=this.jpoint(null,null,null),L=this._wnafT4;for(f=h;f>=0;f--){for(var q=0;f>=0;){var y=!0;for(p=0;p<i;p++)L[p]=a[p][f]|0,L[p]!==0&&(y=!1);if(!y)break;q++,f--}if(f>=0&&q++,T=T.dblp(q),f<0)break;for(p=0;p<i;p++){var P=L[p];P!==0&&(P>0?v=o[p][P-1>>1]:P<0&&(v=o[p][-P-1>>1].neg()),v.type==="affine"?T=T.mixedAdd(v):T=T.add(v))}}for(f=0;f<i;f++)o[f]=null;return n?T:T.toP()};function Ar(t,e){this.curve=t,this.type=e,this.precomputed=null}Qi.BasePoint=Ar,Ar.prototype.eq=function(){throw new Error("Not implemented")},Ar.prototype.validate=function(){return this.curve.validate(this)},Qi.prototype.decodePoint=function(t,e){t=gr.toArray(t,e);var r=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*r){t[0]===6?_a(t[t.length-1]%2===0):t[0]===7&&_a(t[t.length-1]%2===1);var i=this.point(t.slice(1,1+r),t.slice(1+r,1+2*r));return i}else if((t[0]===2||t[0]===3)&&t.length-1===r)return this.pointFromX(t.slice(1,1+r),t[0]===3);throw new Error("Unknown point format")},Ar.prototype.encodeCompressed=function(t){return this.encode(t,!0)},Ar.prototype._encode=function(t){var e=this.curve.p.byteLength(),r=this.getX().toArray("be",e);return t?[this.getY().isEven()?2:3].concat(r):[4].concat(r,this.getY().toArray("be",e))},Ar.prototype.encode=function(t,e){return gr.encode(this._encode(e),t)},Ar.prototype.precompute=function(t){if(this.precomputed)return this;var e={doubles:null,naf:null,beta:null};return e.naf=this._getNAFPoints(8),e.doubles=this._getDoubles(4,t),e.beta=this._getBeta(),this.precomputed=e,this},Ar.prototype._hasDoubles=function(t){if(!this.precomputed)return!1;var e=this.precomputed.doubles;return e?e.points.length>=Math.ceil((t.bitLength()+1)/e.step):!1},Ar.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,n=0;n<e;n+=t){for(var s=0;s<t;s++)i=i.dbl();r.push(i)}return{step:t,points:r}},Ar.prototype._getNAFPoints=function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var e=[this],r=(1<<t)-1,i=r===1?null:this.dbl(),n=1;n<r;n++)e[n]=e[n-1].add(i);return{wnd:t,points:e}},Ar.prototype._getBeta=function(){return null},Ar.prototype.dblp=function(t){for(var e=this,r=0;r<t;r++)e=e.dbl();return e};var Sh=Ms(function(t){typeof Object.create=="function"?t.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}}),C9=gr.assert;function Dr(t){Ln.call(this,"short",t),this.a=new He(t.a,16).toRed(this.red),this.b=new He(t.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(t),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Sh(Dr,Ln);var N9=Dr;Dr.prototype._getEndomorphism=function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var e,r;if(t.beta)e=new He(t.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);e=i[0].cmp(i[1])<0?i[0]:i[1],e=e.toRed(this.red)}if(t.lambda)r=new He(t.lambda,16);else{var n=this._getEndoRoots(this.n);this.g.mul(n[0]).x.cmp(this.g.x.redMul(e))===0?r=n[0]:(r=n[1],C9(this.g.mul(r).x.cmp(this.g.x.redMul(e))===0))}var s;return t.basis?s=t.basis.map(function(o){return{a:new He(o.a,16),b:new He(o.b,16)}}):s=this._getEndoBasis(r),{beta:e,lambda:r,basis:s}}},Dr.prototype._getEndoRoots=function(t){var e=t===this.p?this.red:He.mont(t),r=new He(2).toRed(e).redInvm(),i=r.redNeg(),n=new He(3).toRed(e).redNeg().redSqrt().redMul(r),s=i.redAdd(n).fromRed(),o=i.redSub(n).fromRed();return[s,o]},Dr.prototype._getEndoBasis=function(t){for(var e=this.n.ushrn(Math.floor(this.n.bitLength()/2)),r=t,i=this.n.clone(),n=new He(1),s=new He(0),o=new He(0),a=new He(1),h,f,p,v,x,E,D,B=0,F,j;r.cmpn(0)!==0;){var R=i.div(r);F=i.sub(R.mul(r)),j=o.sub(R.mul(n));var K=a.sub(R.mul(s));if(!p&&F.cmp(e)<0)h=D.neg(),f=n,p=F.neg(),v=j;else if(p&&++B===2)break;D=F,i=r,r=F,o=n,n=j,a=s,s=K}x=F.neg(),E=j;var T=p.sqr().add(v.sqr()),L=x.sqr().add(E.sqr());return L.cmp(T)>=0&&(x=h,E=f),p.negative&&(p=p.neg(),v=v.neg()),x.negative&&(x=x.neg(),E=E.neg()),[{a:p,b:v},{a:x,b:E}]},Dr.prototype._endoSplit=function(t){var e=this.endo.basis,r=e[0],i=e[1],n=i.b.mul(t).divRound(this.n),s=r.b.neg().mul(t).divRound(this.n),o=n.mul(r.a),a=s.mul(i.a),h=n.mul(r.b),f=s.mul(i.b),p=t.sub(o).sub(a),v=h.add(f).neg();return{k1:p,k2:v}},Dr.prototype.pointFromX=function(t,e){t=new He(t,16),t.red||(t=t.toRed(this.red));var r=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var n=i.fromRed().isOdd();return(e&&!n||!e&&n)&&(i=i.redNeg()),this.point(t,i)},Dr.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,r=t.y,i=this.a.redMul(e),n=e.redSqr().redMul(e).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(n).cmpn(0)===0},Dr.prototype._endoWnafMulAdd=function(t,e,r){for(var i=this._endoWnafT1,n=this._endoWnafT2,s=0;s<t.length;s++){var o=this._endoSplit(e[s]),a=t[s],h=a._getBeta();o.k1.negative&&(o.k1.ineg(),a=a.neg(!0)),o.k2.negative&&(o.k2.ineg(),h=h.neg(!0)),i[s*2]=a,i[s*2+1]=h,n[s*2]=o.k1,n[s*2+1]=o.k2}for(var f=this._wnafMulAdd(1,i,n,s*2,r),p=0;p<s*2;p++)i[p]=null,n[p]=null;return f};function Mt(t,e,r,i){Ln.BasePoint.call(this,t,"affine"),e===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new He(e,16),this.y=new He(r,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}Sh(Mt,Ln.BasePoint),Dr.prototype.point=function(t,e,r){return new Mt(this,t,e,r)},Dr.prototype.pointFromJSON=function(t,e){return Mt.fromJSON(this,t,e)},Mt.prototype._getBeta=function(){if(this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var e=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var r=this.curve,i=function(n){return r.point(n.x.redMul(r.endo.beta),n.y)};t.beta=e,e.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(i)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(i)}}}return e}},Mt.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Mt.fromJSON=function(t,e,r){typeof e=="string"&&(e=JSON.parse(e));var i=t.point(e[0],e[1],r);if(!e[2])return i;function n(o){return t.point(o[0],o[1],r)}var s=e[2];return i.precomputed={beta:null,doubles:s.doubles&&{step:s.doubles.step,points:[i].concat(s.doubles.points.map(n))},naf:s.naf&&{wnd:s.naf.wnd,points:[i].concat(s.naf.points.map(n))}},i},Mt.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Mt.prototype.isInfinity=function(){return this.inf},Mt.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var r=e.redSqr().redISub(this.x).redISub(t.x),i=e.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)},Mt.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,r=this.x.redSqr(),i=t.redInvm(),n=r.redAdd(r).redIAdd(r).redIAdd(e).redMul(i),s=n.redSqr().redISub(this.x.redAdd(this.x)),o=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,o)},Mt.prototype.getX=function(){return this.x.fromRed()},Mt.prototype.getY=function(){return this.y.fromRed()},Mt.prototype.mul=function(t){return t=new He(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},Mt.prototype.mulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n):this.curve._wnafMulAdd(1,i,n,2)},Mt.prototype.jmulAdd=function(t,e,r){var i=[this,e],n=[t,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,n,!0):this.curve._wnafMulAdd(1,i,n,2,!0)},Mt.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},Mt.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var r=this.precomputed,i=function(n){return n.neg()};e.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return e},Mt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Bt(t,e,r,i){Ln.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new He(0)):(this.x=new He(e,16),this.y=new He(r,16),this.z=new He(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Sh(Bt,Ln.BasePoint),Dr.prototype.jpoint=function(t,e,r){return new Bt(this,t,e,r)},Bt.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),r=this.x.redMul(e),i=this.y.redMul(e).redMul(t);return this.curve.point(r,i)},Bt.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Bt.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(e),n=t.x.redMul(r),s=this.y.redMul(e.redMul(t.z)),o=t.y.redMul(r.redMul(this.z)),a=i.redSub(n),h=s.redSub(o);if(a.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),p=f.redMul(a),v=i.redMul(f),x=h.redSqr().redIAdd(p).redISub(v).redISub(v),E=h.redMul(v.redISub(x)).redISub(s.redMul(p)),D=this.z.redMul(t.z).redMul(a);return this.curve.jpoint(x,E,D)},Bt.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),r=this.x,i=t.x.redMul(e),n=this.y,s=t.y.redMul(e).redMul(this.z),o=r.redSub(i),a=n.redSub(s);if(o.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var h=o.redSqr(),f=h.redMul(o),p=r.redMul(h),v=a.redSqr().redIAdd(f).redISub(p).redISub(p),x=a.redMul(p.redISub(v)).redISub(n.redMul(f)),E=this.z.redMul(o);return this.curve.jpoint(v,x,E)},Bt.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var r=this;for(e=0;e<t;e++)r=r.dbl();return r}var i=this.curve.a,n=this.curve.tinv,s=this.x,o=this.y,a=this.z,h=a.redSqr().redSqr(),f=o.redAdd(o);for(e=0;e<t;e++){var p=s.redSqr(),v=f.redSqr(),x=v.redSqr(),E=p.redAdd(p).redIAdd(p).redIAdd(i.redMul(h)),D=s.redMul(v),B=E.redSqr().redISub(D.redAdd(D)),F=D.redISub(B),j=E.redMul(F);j=j.redIAdd(j).redISub(x);var R=f.redMul(a);e+1<t&&(h=h.redMul(x)),s=B,a=R,f=j}return this.curve.jpoint(s,f.redMul(n),a)},Bt.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Bt.prototype._zeroDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i),h=a.redSqr().redISub(o).redISub(o),f=s.redIAdd(s);f=f.redIAdd(f),f=f.redIAdd(f),t=h,e=a.redMul(o.redISub(h)).redISub(f),r=this.y.redAdd(this.y)}else{var p=this.x.redSqr(),v=this.y.redSqr(),x=v.redSqr(),E=this.x.redAdd(v).redSqr().redISub(p).redISub(x);E=E.redIAdd(E);var D=p.redAdd(p).redIAdd(p),B=D.redSqr(),F=x.redIAdd(x);F=F.redIAdd(F),F=F.redIAdd(F),t=B.redISub(E).redISub(E),e=D.redMul(E.redISub(t)).redISub(F),r=this.y.redMul(this.z),r=r.redIAdd(r)}return this.curve.jpoint(t,e,r)},Bt.prototype._threeDbl=function(){var t,e,r;if(this.zOne){var i=this.x.redSqr(),n=this.y.redSqr(),s=n.redSqr(),o=this.x.redAdd(n).redSqr().redISub(i).redISub(s);o=o.redIAdd(o);var a=i.redAdd(i).redIAdd(i).redIAdd(this.curve.a),h=a.redSqr().redISub(o).redISub(o);t=h;var f=s.redIAdd(s);f=f.redIAdd(f),f=f.redIAdd(f),e=a.redMul(o.redISub(h)).redISub(f),r=this.y.redAdd(this.y)}else{var p=this.z.redSqr(),v=this.y.redSqr(),x=this.x.redMul(v),E=this.x.redSub(p).redMul(this.x.redAdd(p));E=E.redAdd(E).redIAdd(E);var D=x.redIAdd(x);D=D.redIAdd(D);var B=D.redAdd(D);t=E.redSqr().redISub(B),r=this.y.redAdd(this.z).redSqr().redISub(v).redISub(p);var F=v.redSqr();F=F.redIAdd(F),F=F.redIAdd(F),F=F.redIAdd(F),e=E.redMul(D.redISub(t)).redISub(F)}return this.curve.jpoint(t,e,r)},Bt.prototype._dbl=function(){var t=this.curve.a,e=this.x,r=this.y,i=this.z,n=i.redSqr().redSqr(),s=e.redSqr(),o=r.redSqr(),a=s.redAdd(s).redIAdd(s).redIAdd(t.redMul(n)),h=e.redAdd(e);h=h.redIAdd(h);var f=h.redMul(o),p=a.redSqr().redISub(f.redAdd(f)),v=f.redISub(p),x=o.redSqr();x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var E=a.redMul(v).redISub(x),D=r.redAdd(r).redMul(i);return this.curve.jpoint(p,E,D)},Bt.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),e=this.y.redSqr(),r=this.z.redSqr(),i=e.redSqr(),n=t.redAdd(t).redIAdd(t),s=n.redSqr(),o=this.x.redAdd(e).redSqr().redISub(t).redISub(i);o=o.redIAdd(o),o=o.redAdd(o).redIAdd(o),o=o.redISub(s);var a=o.redSqr(),h=i.redIAdd(i);h=h.redIAdd(h),h=h.redIAdd(h),h=h.redIAdd(h);var f=n.redIAdd(o).redSqr().redISub(s).redISub(a).redISub(h),p=e.redMul(f);p=p.redIAdd(p),p=p.redIAdd(p);var v=this.x.redMul(a).redISub(p);v=v.redIAdd(v),v=v.redIAdd(v);var x=this.y.redMul(f.redMul(h.redISub(f)).redISub(o.redMul(a)));x=x.redIAdd(x),x=x.redIAdd(x),x=x.redIAdd(x);var E=this.z.redAdd(o).redSqr().redISub(r).redISub(a);return this.curve.jpoint(v,x,E)},Bt.prototype.mul=function(t,e){return t=new He(t,e),this.curve._wnafMul(this,t)},Bt.prototype.eq=function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var e=this.z.redSqr(),r=t.z.redSqr();if(this.x.redMul(r).redISub(t.x.redMul(e)).cmpn(0)!==0)return!1;var i=e.redMul(this.z),n=r.redMul(t.z);return this.y.redMul(n).redISub(t.y.redMul(i)).cmpn(0)===0},Bt.prototype.eqXToP=function(t){var e=this.z.redSqr(),r=t.toRed(this.curve.red).redMul(e);if(this.x.cmp(r)===0)return!0;for(var i=t.clone(),n=this.curve.redN.redMul(e);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(r.redIAdd(n),this.x.cmp(r)===0)return!0}},Bt.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Bt.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Xo=Ms(function(t,e){var r=e;r.base=Ln,r.short=N9,r.mont=null,r.edwards=null}),Zo=Ms(function(t,e){var r=e,i=gr.assert;function n(a){a.type==="short"?this.curve=new Xo.short(a):a.type==="edwards"?this.curve=new Xo.edwards(a):this.curve=new Xo.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=n;function s(a,h){Object.defineProperty(r,a,{configurable:!0,enumerable:!0,get:function(){var f=new n(h);return Object.defineProperty(r,a,{configurable:!0,enumerable:!0,value:f}),f}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Gr.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Gr.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Gr.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Gr.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Gr.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Gr.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Gr.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Gr.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function Xi(t){if(!(this instanceof Xi))return new Xi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=zr.toArray(t.entropy,t.entropyEnc||"hex"),r=zr.toArray(t.nonce,t.nonceEnc||"hex"),i=zr.toArray(t.pers,t.persEnc||"hex");xh(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,i)}var Bl=Xi;Xi.prototype._init=function(t,e,r){var i=t.concat(e).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n<this.V.length;n++)this.K[n]=0,this.V[n]=1;this._update(i),this._reseed=1,this.reseedInterval=281474976710656},Xi.prototype._hmac=function(){return new Gr.hmac(this.hash,this.K)},Xi.prototype._update=function(t){var e=this._hmac().update(this.V).update([0]);t&&(e=e.update(t)),this.K=e.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},Xi.prototype.reseed=function(t,e,r,i){typeof e!="string"&&(i=r,r=e,e=null),t=zr.toArray(t,e),r=zr.toArray(r,i),xh(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(r||[])),this._reseed=1},Xi.prototype.generate=function(t,e,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(i=r,r=e,e=null),r&&(r=zr.toArray(r,i||"hex"),this._update(r));for(var n=[];n.length<t;)this.V=this._hmac().update(this.V).digest(),n=n.concat(this.V);var s=n.slice(0,t);return this._update(r),this._reseed++,zr.encode(s,e)};var zc=gr.assert;function Kt(t,e){this.ec=t,this.priv=null,this.pub=null,e.priv&&this._importPrivate(e.priv,e.privEnc),e.pub&&this._importPublic(e.pub,e.pubEnc)}var Kc=Kt;Kt.fromPublic=function(t,e,r){return e instanceof Kt?e:new Kt(t,{pub:e,pubEnc:r})},Kt.fromPrivate=function(t,e,r){return e instanceof Kt?e:new Kt(t,{priv:e,privEnc:r})},Kt.prototype.validate=function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Kt.prototype.getPublic=function(t,e){return typeof t=="string"&&(e=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),e?this.pub.encode(e,t):this.pub},Kt.prototype.getPrivate=function(t){return t==="hex"?this.priv.toString(16,2):this.priv},Kt.prototype._importPrivate=function(t,e){this.priv=new He(t,e||16),this.priv=this.priv.umod(this.ec.curve.n)},Kt.prototype._importPublic=function(t,e){if(t.x||t.y){this.ec.curve.type==="mont"?zc(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&zc(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,e)},Kt.prototype.derive=function(t){return t.validate()||zc(t.validate(),"public point not validated"),t.mul(this.priv).getX()},Kt.prototype.sign=function(t,e,r){return this.ec.sign(t,this,e,r)},Kt.prototype.verify=function(t,e){return this.ec.verify(t,e,this)},Kt.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var T9=gr.assert;function rc(t,e){if(t instanceof rc)return t;this._importDER(t,e)||(T9(t.r&&t.s,"Signature without r or s"),this.r=new He(t.r,16),this.s=new He(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Ho=rc;function R9(){this.place=0}function jc(t,e){var r=t[e.place++];if(!(r&128))return r;var i=r&15;if(i===0||i>4)return!1;for(var n=0,s=0,o=e.place;s<i;s++,o++)n<<=8,n|=t[o],n>>>=0;return n<=127?!1:(e.place=o,n)}function Fl(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e<r;)e++;return e===0?t:t.slice(e)}rc.prototype._importDER=function(t,e){t=gr.toArray(t,e);var r=new R9;if(t[r.place++]!==48)return!1;var i=jc(t,r);if(i===!1||i+r.place!==t.length||t[r.place++]!==2)return!1;var n=jc(t,r);if(n===!1)return!1;var s=t.slice(r.place,n+r.place);if(r.place+=n,t[r.place++]!==2)return!1;var o=jc(t,r);if(o===!1||t.length!==o+r.place)return!1;var a=t.slice(r.place,o+r.place);if(s[0]===0)if(s[1]&128)s=s.slice(1);else return!1;if(a[0]===0)if(a[1]&128)a=a.slice(1);else return!1;return this.r=new He(s),this.s=new He(a),this.recoveryParam=null,!0};function Hc(t,e){if(e<128){t.push(e);return}var r=1+(Math.log(e)/Math.LN2>>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}rc.prototype.toDER=function(t){var e=this.r.toArray(),r=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),r[0]&128&&(r=[0].concat(r)),e=Fl(e),r=Fl(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];Hc(i,e.length),i=i.concat(e),i.push(2),Hc(i,r.length);var n=i.concat(r),s=[48];return Hc(s,n.length),s=s.concat(n),gr.encode(s,t)};var O9=function(){throw new Error("unsupported")},eg=gr.assert;function Mr(t){if(!(this instanceof Mr))return new Mr(t);typeof t=="string"&&(eg(Object.prototype.hasOwnProperty.call(Zo,t),"Unknown curve "+t),t=Zo[t]),t instanceof Zo.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var P9=Mr;Mr.prototype.keyPair=function(t){return new Kc(this,t)},Mr.prototype.keyFromPrivate=function(t,e){return Kc.fromPrivate(this,t,e)},Mr.prototype.keyFromPublic=function(t,e){return Kc.fromPublic(this,t,e)},Mr.prototype.genKeyPair=function(t){t||(t={});for(var e=new Bl({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||O9(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new He(2));;){var n=new He(e.generate(r));if(!(n.cmp(i)>0))return n.iaddn(1),this.keyFromPrivate(n)}},Mr.prototype._truncateToN=function(t,e){var r=t.byteLength()*8-this.n.bitLength();return r>0&&(t=t.ushrn(r)),!e&&t.cmp(this.n)>=0?t.sub(this.n):t},Mr.prototype.sign=function(t,e,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),e=this.keyFromPrivate(e,r),t=this._truncateToN(new He(t,16));for(var n=this.n.byteLength(),s=e.getPrivate().toArray("be",n),o=t.toArray("be",n),a=new Bl({hash:this.hash,entropy:s,nonce:o,pers:i.pers,persEnc:i.persEnc||"utf8"}),h=this.n.sub(new He(1)),f=0;;f++){var p=i.k?i.k(f):new He(a.generate(this.n.byteLength()));if(p=this._truncateToN(p,!0),!(p.cmpn(1)<=0||p.cmp(h)>=0)){var v=this.g.mul(p);if(!v.isInfinity()){var x=v.getX(),E=x.umod(this.n);if(E.cmpn(0)!==0){var D=p.invm(this.n).mul(E.mul(e.getPrivate()).iadd(t));if(D=D.umod(this.n),D.cmpn(0)!==0){var B=(v.getY().isOdd()?1:0)|(x.cmp(E)!==0?2:0);return i.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),B^=1),new Ho({r:E,s:D,recoveryParam:B})}}}}}},Mr.prototype.verify=function(t,e,r,i){t=this._truncateToN(new He(t,16)),r=this.keyFromPublic(r,i),e=new Ho(e,"hex");var n=e.r,s=e.s;if(n.cmpn(1)<0||n.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var o=s.invm(this.n),a=o.mul(t).umod(this.n),h=o.mul(n).umod(this.n),f;return this.curve._maxwellTrick?(f=this.g.jmulAdd(a,r.getPublic(),h),f.isInfinity()?!1:f.eqXToP(n)):(f=this.g.mulAdd(a,r.getPublic(),h),f.isInfinity()?!1:f.getX().umod(this.n).cmp(n)===0)},Mr.prototype.recoverPubKey=function(t,e,r,i){eg((3&r)===r,"The recovery param is more than two bits"),e=new Ho(e,i);var n=this.n,s=new He(t),o=e.r,a=e.s,h=r&1,f=r>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw new Error("Unable to find sencond key candinate");f?o=this.curve.pointFromX(o.add(this.curve.n),h):o=this.curve.pointFromX(o,h);var p=e.r.invm(n),v=n.sub(s).mul(p).umod(n),x=a.mul(p).umod(n);return this.g.mulAdd(v,o,x)},Mr.prototype.getKeyRecoveryParam=function(t,e,r,i){if(e=new Ho(e,i),e.recoveryParam!==null)return e.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(t,e,n)}catch{continue}if(s.eq(r))return n}throw new Error("Unable to find valid recovery factor")};var B9=Ms(function(t,e){var r=e;r.version="6.5.4",r.utils=gr,r.rand=function(){throw new Error("unsupported")},r.curve=Xo,r.curves=Zo,r.ec=P9,r.eddsa=null}),F9=B9.ec;const L9="signing-key/5.7.0",Nf=new Ft(L9);let Vc=null;function Yi(){return Vc||(Vc=new F9("secp256k1")),Vc}class U9{constructor(e){Fs(this,"curve","secp256k1"),Fs(this,"privateKey",sr(e)),_4(this.privateKey)!==32&&Nf.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=Yi().keyFromPrivate(mt(this.privateKey));Fs(this,"publicKey","0x"+r.getPublic(!1,"hex")),Fs(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),Fs(this,"_isSigningKey",!0)}_addPoint(e){const r=Yi().keyFromPublic(mt(this.publicKey)),i=Yi().keyFromPublic(mt(e));return"0x"+r.pub.add(i.pub).encodeCompressed("hex")}signDigest(e){const r=Yi().keyFromPrivate(mt(this.privateKey)),i=mt(e);i.length!==32&&Nf.throwArgumentError("bad digest length","digest",e);const n=r.sign(i,{canonical:!0});return Sp({recoveryParam:n.recoveryParam,r:ni("0x"+n.r.toString(16),32),s:ni("0x"+n.s.toString(16),32)})}computeSharedSecret(e){const r=Yi().keyFromPrivate(mt(this.privateKey)),i=Yi().keyFromPublic(mt(tg(e)));return ni("0x"+r.derive(i.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function k9(t,e){const r=Sp(e),i={r:mt(r.r),s:mt(r.s)};return"0x"+Yi().recoverPubKey(mt(t),i,r.recoveryParam).encode("hex",!1)}function tg(t,e){const r=mt(t);return r.length===32?new U9(r).publicKey:r.length===33?"0x"+Yi().keyFromPublic(r).getPublic(!1,"hex"):r.length===65?sr(r):Nf.throwArgumentError("invalid public or private key","key","[REDACTED]")}var Ll;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Ll||(Ll={}));function $9(t){const e=tg(t);return Q4(El(_h(El(e,1)),12))}function q9(t,e){return $9(k9(mt(t),e))}const z9="https://rpc.walletconnect.org/v1";async function K9(t,e,r,i,n,s){switch(r.t){case"eip191":return j9(t,e,r.s);case"eip1271":return await H9(t,e,r.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}function j9(t,e,r){return q9(Pp(e),r).toLowerCase()===t.toLowerCase()}async function H9(t,e,r,i,n,s){try{const o="0x1626ba7e",a="0000000000000000000000000000000000000000000000000000000000000040",h="0000000000000000000000000000000000000000000000000000000000000041",f=r.substring(2),p=Pp(e).substring(2),v=o+p+a+h+f,x=await fetch(`${s||z9}/?chainId=${i}&projectId=${n}`,{method:"POST",body:JSON.stringify({id:V9(),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:v},"latest"]})}),{result:E}=await x.json();return E?E.slice(0,o.length).toLowerCase()===o.toLowerCase():!1}catch(o){return console.error("isValidEip1271Signature: ",o),!1}}function V9(){return Date.now()+Math.floor(Math.random()*1e3)}var W9=Object.defineProperty,G9=Object.defineProperties,Y9=Object.getOwnPropertyDescriptors,Ul=Object.getOwnPropertySymbols,J9=Object.prototype.hasOwnProperty,Q9=Object.prototype.propertyIsEnumerable,kl=(t,e,r)=>e in t?W9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,X9=(t,e)=>{for(var r in e||(e={}))J9.call(e,r)&&kl(t,r,e[r]);if(Ul)for(var r of Ul(e))Q9.call(e,r)&&kl(t,r,e[r]);return t},Z9=(t,e)=>G9(t,Y9(e));const e7="did:pkh:",Mh=t=>t==null?void 0:t.split(":"),rg=t=>{const e=t&&Mh(t);if(e)return t.includes(e7)?e[3]:e[1]},$l=t=>{const e=t&&Mh(t);if(e)return e[2]+":"+e[3]},Ea=t=>{const e=t&&Mh(t);if(e)return e.pop()};async function ql(t){const{cacao:e,projectId:r}=t,{s:i,p:n}=e,s=ig(n,n.iss),o=Ea(n.iss);return await K9(o,s,i,rg(n.iss),r)}const ig=(t,e)=>{const r=`${t.domain} wants you to sign in with your Ethereum account:`,i=Ea(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=t.statement||void 0;const s=`URI: ${t.aud||t.uri}`,o=`Version: ${t.version}`,a=`Chain ID: ${rg(e)}`,h=`Nonce: ${t.nonce}`,f=`Issued At: ${t.iat}`,p=t.exp?`Expiration Time: ${t.exp}`:void 0,v=t.nbf?`Not Before: ${t.nbf}`:void 0,x=t.requestId?`Request ID: ${t.requestId}`:void 0,E=t.resources?`Resources:${t.resources.map(B=>`
549
- - ${B}`).join("")}`:void 0,D=ea(t.resources);if(D){const B=fo(D);n=f7(n,B)}return[r,i,"",n,"",s,o,a,h,f,p,v,x,E].filter(B=>B!=null).join(`
550
- `)};function t7(t){return Buffer.from(JSON.stringify(t)).toString("base64")}function r7(t){return JSON.parse(Buffer.from(t,"base64").toString("utf-8"))}function Dn(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(r=>{const i=t.att[r];if(Array.isArray(i))throw new Error(`Resource must be an object: ${r}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${r}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${r}`);Object.keys(i).forEach(n=>{const s=i[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${o}`)})})})}function i7(t,e,r,i={}){return r==null||r.sort((n,s)=>n.localeCompare(s)),{att:{[t]:n7(e,r,i)}}}function n7(t,e,r={}){e=e==null?void 0:e.sort((n,s)=>n.localeCompare(s));const i=e.map(n=>({[`${t}/${n}`]:[r]}));return Object.assign({},...i)}function ng(t){return Dn(t),`urn:recap:${t7(t).replace(/=/g,"")}`}function fo(t){const e=r7(t.replace("urn:recap:",""));return Dn(e),e}function s7(t,e,r){const i=i7(t,e,r);return ng(i)}function o7(t){return t&&t.includes("urn:recap:")}function a7(t,e){const r=fo(t),i=fo(e),n=c7(r,i);return ng(n)}function c7(t,e){Dn(t),Dn(e);const r=Object.keys(t.att).concat(Object.keys(e.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return r.forEach(n=>{var s,o;Object.keys(((s=t.att)==null?void 0:s[n])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[n])||{})).sort((a,h)=>a.localeCompare(h)).forEach(a=>{var h,f;i.att[n]=Z9(X9({},i.att[n]),{[a]:((h=t.att[n])==null?void 0:h[a])||((f=e.att[n])==null?void 0:f[a])})})}),i}function f7(t="",e){Dn(e);const r="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(r))return t;const i=[];let n=0;Object.keys(e.att).forEach(a=>{const h=Object.keys(e.att[a]).map(v=>({ability:v.split("/")[0],action:v.split("/")[1]}));h.sort((v,x)=>v.action.localeCompare(x.action));const f={};h.forEach(v=>{f[v.ability]||(f[v.ability]=[]),f[v.ability].push(v.action)});const p=Object.keys(f).map(v=>(n++,`(${n}) '${v}': '${f[v].join("', '")}' for '${a}'.`));i.push(p.join(", ").replace(".,","."))});const s=i.join(" "),o=`${r}${s}`;return`${t?t+" ":""}${o}`}function zl(t){var e;const r=fo(t);Dn(r);const i=(e=r.att)==null?void 0:e.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function Kl(t){const e=fo(t);Dn(e);const r=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n==null?void 0:n[0])!=null&&s.chains&&r.push(n[0].chains)})}),[...new Set(r.flat())]}function ea(t){if(!t)return;const e=t==null?void 0:t[t.length-1];return o7(e)?e:void 0}const sg="base10",Yt="base16",tn="base64pad",ks="base64url",Mo="utf8",og=0,ki=1,Io=2,h7=0,jl=1,Xs=12,Ih=32;function u7(){const t=yh.generateKeyPair();return{privateKey:Tt(t.secretKey,Yt),publicKey:Tt(t.publicKey,Yt)}}function Tf(){const t=cn.randomBytes(Ih);return Tt(t,Yt)}function l7(t,e){const r=yh.sharedKey(Ct(t,Yt),Ct(e,Yt),!0),i=new H8(Eo.SHA256,r).expand(Ih);return Tt(i,Yt)}function ta(t){const e=Eo.hash(Ct(t,Yt));return Tt(e,Yt)}function Oi(t){const e=Eo.hash(Ct(t,Mo));return Tt(e,Yt)}function ag(t){return Ct(`${t}`,sg)}function Cn(t){return Number(Tt(t,sg))}function d7(t){const e=ag(typeof t.type<"u"?t.type:og);if(Cn(e)===ki&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const r=typeof t.senderPublicKey<"u"?Ct(t.senderPublicKey,Yt):void 0,i=typeof t.iv<"u"?Ct(t.iv,Yt):cn.randomBytes(Xs),n=new vh.ChaCha20Poly1305(Ct(t.symKey,Yt)).seal(i,Ct(t.message,Mo));return cg({type:e,sealed:n,iv:i,senderPublicKey:r,encoding:t.encoding})}function p7(t,e){const r=ag(Io),i=cn.randomBytes(Xs),n=Ct(t,Mo);return cg({type:r,sealed:n,iv:i,encoding:e})}function g7(t){const e=new vh.ChaCha20Poly1305(Ct(t.symKey,Yt)),{sealed:r,iv:i}=ho({encoded:t.encoded,encoding:t==null?void 0:t.encoding}),n=e.open(i,r);if(n===null)throw new Error("Failed to decrypt");return Tt(n,Mo)}function b7(t,e){const{sealed:r}=ho({encoded:t,encoding:e});return Tt(r,Mo)}function cg(t){const{encoding:e=tn}=t;if(Cn(t.type)===Io)return Tt(Jo([t.type,t.sealed]),e);if(Cn(t.type)===ki){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Tt(Jo([t.type,t.senderPublicKey,t.iv,t.sealed]),e)}return Tt(Jo([t.type,t.iv,t.sealed]),e)}function ho(t){const{encoded:e,encoding:r=tn}=t,i=Ct(e,r),n=i.slice(h7,jl),s=jl;if(Cn(n)===ki){const f=s+Ih,p=f+Xs,v=i.slice(s,f),x=i.slice(f,p),E=i.slice(p);return{type:n,sealed:E,iv:x,senderPublicKey:v}}if(Cn(n)===Io){const f=i.slice(s),p=cn.randomBytes(Xs);return{type:n,sealed:f,iv:p}}const o=s+Xs,a=i.slice(s,o),h=i.slice(o);return{type:n,sealed:h,iv:a}}function v7(t,e){const r=ho({encoded:t,encoding:e==null?void 0:e.encoding});return fg({type:Cn(r.type),senderPublicKey:typeof r.senderPublicKey<"u"?Tt(r.senderPublicKey,Yt):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function fg(t){const e=(t==null?void 0:t.type)||og;if(e===ki){if(typeof(t==null?void 0:t.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(t==null?void 0:t.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t==null?void 0:t.senderPublicKey,receiverPublicKey:t==null?void 0:t.receiverPublicKey}}function Hl(t){return t.type===ki&&typeof t.senderPublicKey=="string"&&typeof t.receiverPublicKey=="string"}function Vl(t){return t.type===Io}function m7(t){return new F0.ec("p256").keyFromPublic({x:Buffer.from(t.x,"base64").toString("hex"),y:Buffer.from(t.y,"base64").toString("hex")},"hex")}function y7(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const r=e.length%4;return r>0&&(e+="=".repeat(4-r)),e}function w7(t){return Buffer.from(y7(t),"base64")}function _7(t,e){const[r,i,n]=t.split("."),s=w7(n);if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32).toString("hex"),a=s.slice(32,64).toString("hex"),h=`${r}.${i}`,f=new Eo.SHA256().update(Buffer.from(h)).digest(),p=m7(e),v=Buffer.from(f).toString("hex");if(!p.verify(v,{r:o,s:a}))throw new Error("Invalid signature");return Ef(t).payload}const E7="irn";function Rf(t){return(t==null?void 0:t.relay)||{protocol:E7}}function Vs(t){const e=V8[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var A7=Object.defineProperty,x7=Object.defineProperties,S7=Object.getOwnPropertyDescriptors,Wl=Object.getOwnPropertySymbols,M7=Object.prototype.hasOwnProperty,I7=Object.prototype.propertyIsEnumerable,Gl=(t,e,r)=>e in t?A7(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Yl=(t,e)=>{for(var r in e||(e={}))M7.call(e,r)&&Gl(t,r,e[r]);if(Wl)for(var r of Wl(e))I7.call(e,r)&&Gl(t,r,e[r]);return t},D7=(t,e)=>x7(t,S7(e));function C7(t,e="-"){const r={},i="relay"+e;return Object.keys(t).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),o=t[n];r[s]=o}}),r}function Jl(t){if(!t.includes("wc:")){const h=_p(t);h!=null&&h.includes("wc:")&&(t=h)}t=t.includes("wc://")?t.replace("wc://",""):t,t=t.includes("wc:")?t.replace("wc:",""):t;const e=t.indexOf(":"),r=t.indexOf("?")!==-1?t.indexOf("?"):void 0,i=t.substring(0,e),n=t.substring(e+1,r).split("@"),s=typeof r<"u"?t.substring(r):"",o=ao.parse(s),a=typeof o.methods=="string"?o.methods.split(","):void 0;return{protocol:i,topic:N7(n[0]),version:parseInt(n[1],10),symKey:o.symKey,relay:C7(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function N7(t){return t.startsWith("//")?t.substring(2):t}function T7(t,e="-"){const r="relay",i={};return Object.keys(t).forEach(n=>{const s=r+e+n;t[n]&&(i[s]=t[n])}),i}function Ql(t){return`${t.protocol}:${t.topic}@${t.version}?`+ao.stringify(Yl(D7(Yl({symKey:t.symKey},T7(t.relay)),{expiryTimestamp:t.expiryTimestamp}),t.methods?{methods:t.methods.join(",")}:{}))}function Vo(t,e,r){return`${t}?wc_ev=${r}&topic=${e}`}function Is(t){const e=[];return t.forEach(r=>{const[i,n]=r.split(":");e.push(`${i}:${n}`)}),e}function R7(t){const e=[];return Object.values(t).forEach(r=>{e.push(...Is(r.accounts))}),e}function O7(t,e){const r=[];return Object.values(t).forEach(i=>{Is(i.accounts).includes(e)&&r.push(...i.methods)}),r}function P7(t,e){const r=[];return Object.values(t).forEach(i=>{Is(i.accounts).includes(e)&&r.push(...i.events)}),r}function B7(t){const e={};return t==null||t.forEach(r=>{const[i,n]=r.split(":");e[i]||(e[i]={accounts:[],chains:[],events:[]}),e[i].accounts.push(r),e[i].chains.push(`${i}:${n}`)}),e}function Xl(t,e){e=e.map(i=>i.replace("did:pkh:",""));const r=B7(e);for(const[i,n]of Object.entries(r))n.methods?n.methods=a4(n.methods,t):n.methods=t,n.events=["chainChanged","accountsChanged"];return r}const F7={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},L7={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function pe(t,e){const{message:r,code:i}=L7[t];return{message:e?`${r} ${e}`:r,code:i}}function ct(t,e){const{message:r,code:i}=F7[t];return{message:e?`${r} ${e}`:r,code:i}}function Do(t,e){return!!Array.isArray(t)}function Aa(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function or(t){return typeof t>"u"}function _t(t,e){return e&&or(t)?!0:typeof t=="string"&&!!t.trim().length}function Dh(t,e){return typeof t=="number"&&!isNaN(t)}function U7(t,e){const{requiredNamespaces:r}=e,i=Object.keys(t.namespaces),n=Object.keys(r);let s=!0;return _n(n,i)?(i.forEach(o=>{const{accounts:a,methods:h,events:f}=t.namespaces[o],p=Is(a),v=r[o];(!_n(pp(o,v),p)||!_n(v.methods,h)||!_n(v.events,f))&&(s=!1)}),s):!1}function xa(t){return _t(t,!1)&&t.includes(":")?t.split(":").length===2:!1}function k7(t){if(_t(t,!1)&&t.includes(":")){const e=t.split(":");if(e.length===3){const r=e[0]+":"+e[1];return!!e[2]&&xa(r)}}return!1}function $7(t){function e(r){try{return typeof new URL(r)<"u"}catch{return!1}}try{if(_t(t,!1)){if(e(t))return!0;const r=_p(t);return e(r)}}catch{}return!1}function q7(t){var e;return(e=t==null?void 0:t.proposer)==null?void 0:e.publicKey}function z7(t){return t==null?void 0:t.topic}function K7(t,e){let r=null;return _t(t==null?void 0:t.publicKey,!1)||(r=pe("MISSING_OR_INVALID",`${e} controller public key should be a string`)),r}function Zl(t){let e=!0;return Do(t)?t.length&&(e=t.every(r=>_t(r,!1))):e=!1,e}function j7(t,e,r){let i=null;return Do(e)&&e.length?e.forEach(n=>{i||xa(n)||(i=ct("UNSUPPORTED_CHAINS",`${r}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):xa(t)||(i=ct("UNSUPPORTED_CHAINS",`${r}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function H7(t,e,r){let i=null;return Object.entries(t).forEach(([n,s])=>{if(i)return;const o=j7(n,pp(n,s),`${e} ${r}`);o&&(i=o)}),i}function V7(t,e){let r=null;return Do(t)?t.forEach(i=>{r||k7(i)||(r=ct("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):r=ct("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),r}function W7(t,e){let r=null;return Object.values(t).forEach(i=>{if(r)return;const n=V7(i==null?void 0:i.accounts,`${e} namespace`);n&&(r=n)}),r}function G7(t,e){let r=null;return Zl(t==null?void 0:t.methods)?Zl(t==null?void 0:t.events)||(r=ct("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):r=ct("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),r}function hg(t,e){let r=null;return Object.values(t).forEach(i=>{if(r)return;const n=G7(i,`${e}, namespace`);n&&(r=n)}),r}function Y7(t,e,r){let i=null;if(t&&Aa(t)){const n=hg(t,e);n&&(i=n);const s=H7(t,e,r);s&&(i=s)}else i=pe("MISSING_OR_INVALID",`${e}, ${r} should be an object with data`);return i}function Wc(t,e){let r=null;if(t&&Aa(t)){const i=hg(t,e);i&&(r=i);const n=W7(t,e);n&&(r=n)}else r=pe("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return r}function ug(t){return _t(t.protocol,!0)}function J7(t,e){let r=!1;return t?t&&Do(t)&&t.length&&t.forEach(i=>{r=ug(i)}):r=!0,r}function Q7(t){return typeof t=="number"}function nr(t){return typeof t<"u"&&typeof t!==null}function X7(t){return!(!t||typeof t!="object"||!t.code||!Dh(t.code)||!t.message||!_t(t.message,!1))}function Z7(t){return!(or(t)||!_t(t.method,!1))}function eE(t){return!(or(t)||or(t.result)&&or(t.error)||!Dh(t.id)||!_t(t.jsonrpc,!1))}function tE(t){return!(or(t)||!_t(t.name,!1))}function e0(t,e){return!(!xa(e)||!R7(t).includes(e))}function rE(t,e,r){return _t(r,!1)?O7(t,e).includes(r):!1}function iE(t,e,r){return _t(r,!1)?P7(t,e).includes(r):!1}function t0(t,e,r){let i=null;const n=nE(t),s=sE(e),o=Object.keys(n),a=Object.keys(s),h=r0(Object.keys(t)),f=r0(Object.keys(e)),p=h.filter(v=>!f.includes(v));return p.length&&(i=pe("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
551
- Required: ${p.toString()}
552
- Received: ${Object.keys(e).toString()}`)),_n(o,a)||(i=pe("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
553
- Required: ${o.toString()}
554
- Approved: ${a.toString()}`)),Object.keys(e).forEach(v=>{if(!v.includes(":")||i)return;const x=Is(e[v].accounts);x.includes(v)||(i=pe("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${v}
555
- Required: ${v}
556
- Approved: ${x.toString()}`))}),o.forEach(v=>{i||(_n(n[v].methods,s[v].methods)?_n(n[v].events,s[v].events)||(i=pe("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${v}`)):i=pe("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${v}`))}),i}function nE(t){const e={};return Object.keys(t).forEach(r=>{var i;r.includes(":")?e[r]=t[r]:(i=t[r].chains)==null||i.forEach(n=>{e[n]={methods:t[r].methods,events:t[r].events}})}),e}function r0(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function sE(t){const e={};return Object.keys(t).forEach(r=>{if(r.includes(":"))e[r]=t[r];else{const i=Is(t[r].accounts);i==null||i.forEach(n=>{e[n]={accounts:t[r].accounts.filter(s=>s.includes(`${n}:`)),methods:t[r].methods,events:t[r].events}})}}),e}function oE(t,e){return Dh(t)&&t<=e.max&&t>=e.min}function i0(){const t=xo();return new Promise(e=>{switch(t){case dr.browser:e(aE());break;case dr.reactNative:e(cE());break;case dr.node:e(fE());break;default:e(!0)}})}function aE(){return Ao()&&(navigator==null?void 0:navigator.onLine)}async function cE(){if(Es()&&typeof global<"u"&&global!=null&&global.NetInfo){const t=await(global==null?void 0:global.NetInfo.fetch());return t==null?void 0:t.isConnected}return!0}function fE(){return!0}function hE(t){switch(xo()){case dr.browser:uE(t);break;case dr.reactNative:lE(t);break}}function uE(t){!Es()&&Ao()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}function lE(t){Es()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>t(e==null?void 0:e.isConnected)))}const Gc={};class $s{static get(e){return Gc[e]}static set(e,r){Gc[e]=r}static delete(e){delete Gc[e]}}const dE="PARSE_ERROR",pE="INVALID_REQUEST",gE="METHOD_NOT_FOUND",bE="INVALID_PARAMS",lg="INTERNAL_ERROR",Ch="SERVER_ERROR",vE=[-32700,-32600,-32601,-32602,-32603],Zs={[dE]:{code:-32700,message:"Parse error"},[pE]:{code:-32600,message:"Invalid Request"},[gE]:{code:-32601,message:"Method not found"},[bE]:{code:-32602,message:"Invalid params"},[lg]:{code:-32603,message:"Internal error"},[Ch]:{code:-32e3,message:"Server error"}},dg=Ch;function mE(t){return vE.includes(t)}function n0(t){return Object.keys(Zs).includes(t)?Zs[t]:Zs[dg]}function yE(t){const e=Object.values(Zs).find(r=>r.code===t);return e||Zs[dg]}function wE(t,e,r){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${r} RPC url at ${e}`):t}var pg={};/*! *****************************************************************************
557
- Copyright (c) Microsoft Corporation.
558
-
559
- Permission to use, copy, modify, and/or distribute this software for any
560
- purpose with or without fee is hereby granted.
561
-
562
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
563
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
564
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
565
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
566
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
567
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
568
- PERFORMANCE OF THIS SOFTWARE.
569
- ***************************************************************************** */var Of=function(t,e){return Of=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)i.hasOwnProperty(n)&&(r[n]=i[n])},Of(t,e)};function _E(t,e){Of(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Pf=function(){return Pf=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])}return e},Pf.apply(this,arguments)};function EE(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 n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function AE(t,e,r,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,r,s):o(e,r))||s);return n>3&&s&&Object.defineProperty(e,r,s),s}function xE(t,e){return function(r,i){e(r,i,t)}}function SE(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function ME(t,e,r,i){function n(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(p){try{f(i.next(p))}catch(v){o(v)}}function h(p){try{f(i.throw(p))}catch(v){o(v)}}function f(p){p.done?s(p.value):n(p.value).then(a,h)}f((i=i.apply(t,e||[])).next())})}function IE(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,n,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(f){return function(p){return h([f,p])}}function h(f){if(i)throw new TypeError("Generator is already executing.");for(;r;)try{if(i=1,n&&(s=f[0]&2?n.return:f[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,f[1])).done)return s;switch(n=0,s&&(f=[f[0]&2,s.value]),f[0]){case 0:case 1:s=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,n=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!s||f[1]>s[0]&&f[1]<s[3])){r.label=f[1];break}if(f[0]===6&&r.label<s[1]){r.label=s[1],s=f;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(f);break}s[2]&&r.ops.pop(),r.trys.pop();continue}f=e.call(t,r)}catch(p){f=[6,p],n=0}finally{i=s=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function DE(t,e,r,i){i===void 0&&(i=r),t[i]=e[r]}function CE(t,e){for(var r in t)r!=="default"&&!e.hasOwnProperty(r)&&(e[r]=t[r])}function Bf(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function gg(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var i=r.call(t),n,s=[],o;try{for(;(e===void 0||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function NE(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(gg(arguments[e]));return t}function TE(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i}function uo(t){return this instanceof uo?(this.v=t,this):new uo(t)}function RE(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=r.apply(t,e||[]),n,s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(x){i[x]&&(n[x]=function(E){return new Promise(function(D,B){s.push([x,E,D,B])>1||a(x,E)})})}function a(x,E){try{h(i[x](E))}catch(D){v(s[0][3],D)}}function h(x){x.value instanceof uo?Promise.resolve(x.value.v).then(f,p):v(s[0][2],x)}function f(x){a("next",x)}function p(x){a("throw",x)}function v(x,E){x(E),s.shift(),s.length&&a(s[0][0],s[0][1])}}function OE(t){var e,r;return e={},i("next"),i("throw",function(n){throw n}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(n,s){e[n]=t[n]?function(o){return(r=!r)?{value:uo(t[n](o)),done:n==="return"}:s?s(o):o}:s}}function PE(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof Bf=="function"?Bf(t):t[Symbol.iterator](),r={},i("next"),i("throw"),i("return"),r[Symbol.asyncIterator]=function(){return this},r);function i(s){r[s]=t[s]&&function(o){return new Promise(function(a,h){o=t[s](o),n(a,h,o.done,o.value)})}}function n(s,o,a,h){Promise.resolve(h).then(function(f){s({value:f,done:a})},o)}}function BE(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function FE(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e}function LE(t){return t&&t.__esModule?t:{default:t}}function UE(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)}function kE(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r}const $E=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return Pf},__asyncDelegator:OE,__asyncGenerator:RE,__asyncValues:PE,__await:uo,__awaiter:ME,__classPrivateFieldGet:UE,__classPrivateFieldSet:kE,__createBinding:DE,__decorate:AE,__exportStar:CE,__extends:_E,__generator:IE,__importDefault:LE,__importStar:FE,__makeTemplateObject:BE,__metadata:SE,__param:xE,__read:gg,__rest:EE,__spread:NE,__spreadArrays:TE,__values:Bf},Symbol.toStringTag,{value:"Module"})),qE=Ma($E);var Ci={},s0;function zE(){if(s0)return Ci;s0=1,Object.defineProperty(Ci,"__esModule",{value:!0}),Ci.isBrowserCryptoAvailable=Ci.getSubtleCrypto=Ci.getBrowerCrypto=void 0;function t(){return($r===null||$r===void 0?void 0:$r.crypto)||($r===null||$r===void 0?void 0:$r.msCrypto)||{}}Ci.getBrowerCrypto=t;function e(){const i=t();return i.subtle||i.webkitSubtle}Ci.getSubtleCrypto=e;function r(){return!!t()&&!!e()}return Ci.isBrowserCryptoAvailable=r,Ci}var Ni={},o0;function KE(){if(o0)return Ni;o0=1,Object.defineProperty(Ni,"__esModule",{value:!0}),Ni.isBrowser=Ni.isNode=Ni.isReactNative=void 0;function t(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}Ni.isReactNative=t;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Ni.isNode=e;function r(){return!t()&&!e()}return Ni.isBrowser=r,Ni}(function(t){Object.defineProperty(t,"__esModule",{value:!0});const e=qE;e.__exportStar(zE(),t),e.__exportStar(KE(),t)})(pg);function Ji(t=3){const e=Date.now()*Math.pow(10,t),r=Math.floor(Math.random()*Math.pow(10,t));return e+r}function En(t=6){return BigInt(Ji(t))}function An(t,e,r){return{id:r||Ji(),jsonrpc:"2.0",method:t,params:e}}function Nh(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Th(t,e,r){return{id:t,jsonrpc:"2.0",error:jE(e)}}function jE(t,e){return typeof t>"u"?n0(lg):(typeof t=="string"&&(t=Object.assign(Object.assign({},n0(Ch)),{message:t})),mE(t.code)&&(t=yE(t.code)),t)}class HE{}class VE extends HE{constructor(){super()}}class WE extends VE{constructor(e){super()}}const GE="^wss?:";function YE(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function JE(t,e){const r=YE(t);return typeof r>"u"?!1:new RegExp(e).test(r)}function a0(t){return JE(t,GE)}function QE(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function bg(t){return typeof t=="object"&&"id"in t&&"jsonrpc"in t&&t.jsonrpc==="2.0"}function Rh(t){return bg(t)&&"method"in t}function ic(t){return bg(t)&&(Jr(t)||Ir(t))}function Jr(t){return"result"in t}function Ir(t){return"error"in t}class XE extends WE{constructor(e){super(e),this.events=new li.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(An(e.method,e.params||[],e.id||En().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{Ir(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),ic(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const ZE=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),eA=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",c0=t=>t.split("?")[0],f0=10,tA=ZE();class rA{constructor(e){if(this.url=e,this.events=new li.EventEmitter,this.registering=!1,!a0(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,r)=>{if(typeof this.socket>"u"){r(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(In(e))}catch(r){this.onError(e.id,r)}}register(e=this.url){if(!a0(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((i,n)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),n(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return n(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((r,i)=>{const n=new URLSearchParams(e).get("origin"),s=pg.isReactNative()?{headers:{origin:n}}:{rejectUnauthorized:!QE(e)},o=new tA(e,[],s);eA()?o.onerror=a=>{const h=a;i(this.emitError(h.error))}:o.on("error",a=>{i(this.emitError(a))}),o.onopen=()=>{this.onOpen(o),r(o)}})}onOpen(e){e.onmessage=r=>this.onPayload(r),e.onclose=r=>this.onClose(r),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?cs(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const i=this.parseError(r),n=i.message||i.toString(),s=Th(e,n);this.events.emit("payload",s)}parseError(e,r=this.url){return wE(e,c0(r),"WS")}resetMaxListeners(){this.events.getMaxListeners()>f0&&this.events.setMaxListeners(f0)}emitError(e){const r=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${c0(this.url)}`));return this.events.emit("register_error",r),r}}var Sa={exports:{}};Sa.exports;(function(t,e){var r=200,i="__lodash_hash_undefined__",n=1,s=2,o=9007199254740991,a="[object Arguments]",h="[object Array]",f="[object AsyncFunction]",p="[object Boolean]",v="[object Date]",x="[object Error]",E="[object Function]",D="[object GeneratorFunction]",B="[object Map]",F="[object Number]",j="[object Null]",R="[object Object]",K="[object Promise]",T="[object Proxy]",L="[object RegExp]",q="[object Set]",y="[object String]",P="[object Symbol]",Z="[object Undefined]",ne="[object WeakMap]",U="[object ArrayBuffer]",b="[object DataView]",c="[object Float32Array]",u="[object Float64Array]",g="[object Int8Array]",w="[object Int16Array]",S="[object Int32Array]",C="[object Uint8Array]",_="[object Uint8ClampedArray]",l="[object Uint16Array]",d="[object Uint32Array]",N=/[\\^$.*+?()[\]{}|]/g,Y=/^\[object .+?Constructor\]$/,te=/^(?:0|[1-9]\d*)$/,I={};I[c]=I[u]=I[g]=I[w]=I[S]=I[C]=I[_]=I[l]=I[d]=!0,I[a]=I[h]=I[U]=I[p]=I[b]=I[v]=I[x]=I[E]=I[B]=I[F]=I[R]=I[L]=I[q]=I[y]=I[ne]=!1;var J=typeof $r=="object"&&$r&&$r.Object===Object&&$r,k=typeof self=="object"&&self&&self.Object===Object&&self,H=J||k||Function("return this")(),V=e&&!e.nodeType&&e,m=V&&!0&&t&&!t.nodeType&&t,z=m&&m.exports===V,ee=z&&J.process,ie=function(){try{return ee&&ee.binding&&ee.binding("util")}catch{}}(),se=ie&&ie.isTypedArray;function de(W,Q){for(var ae=-1,xe=W==null?0:W.length,dt=0,Ge=[];++ae<xe;){var bt=W[ae];Q(bt,ae,W)&&(Ge[dt++]=bt)}return Ge}function O(W,Q){for(var ae=-1,xe=Q.length,dt=W.length;++ae<xe;)W[dt+ae]=Q[ae];return W}function A(W,Q){for(var ae=-1,xe=W==null?0:W.length;++ae<xe;)if(Q(W[ae],ae,W))return!0;return!1}function M(W,Q){for(var ae=-1,xe=Array(W);++ae<W;)xe[ae]=Q(ae);return xe}function $(W){return function(Q){return W(Q)}}function G(W,Q){return W.has(Q)}function re(W,Q){return W==null?void 0:W[Q]}function X(W){var Q=-1,ae=Array(W.size);return W.forEach(function(xe,dt){ae[++Q]=[dt,xe]}),ae}function ce(W,Q){return function(ae){return W(Q(ae))}}function fe(W){var Q=-1,ae=Array(W.size);return W.forEach(function(xe){ae[++Q]=xe}),ae}var oe=Array.prototype,le=Function.prototype,he=Object.prototype,ue=H["__core-js_shared__"],we=le.toString,me=he.hasOwnProperty,ge=function(){var W=/[^.]+$/.exec(ue&&ue.keys&&ue.keys.IE_PROTO||"");return W?"Symbol(src)_1."+W:""}(),De=he.toString,Ne=RegExp("^"+we.call(me).replace(N,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ve=z?H.Buffer:void 0,Ce=H.Symbol,Ye=H.Uint8Array,Te=he.propertyIsEnumerable,Qe=oe.splice,Ve=Ce?Ce.toStringTag:void 0,Re=Object.getOwnPropertySymbols,it=ve?ve.isBuffer:void 0,nt=ce(Object.keys,Object),_e=$n(H,"DataView"),Pe=$n(H,"Map"),Fe=$n(H,"Promise"),Ee=$n(H,"Set"),Le=$n(H,"WeakMap"),Be=$n(Object,"create"),Se=hn(_e),$e=hn(Pe),qe=hn(Fe),Me=hn(Ee),ze=hn(Le),Ue=Ce?Ce.prototype:void 0,Ae=Ue?Ue.valueOf:void 0;function Oe(W){var Q=-1,ae=W==null?0:W.length;for(this.clear();++Q<ae;){var xe=W[Q];this.set(xe[0],xe[1])}}function Ke(){this.__data__=Be?Be(null):{},this.size=0}function Ie(W){var Q=this.has(W)&&delete this.__data__[W];return this.size-=Q?1:0,Q}function st(W){var Q=this.__data__;if(Be){var ae=Q[W];return ae===i?void 0:ae}return me.call(Q,W)?Q[W]:void 0}function ot(W){var Q=this.__data__;return Be?Q[W]!==void 0:me.call(Q,W)}function ke(W,Q){var ae=this.__data__;return this.size+=this.has(W)?0:1,ae[W]=Be&&Q===void 0?i:Q,this}Oe.prototype.clear=Ke,Oe.prototype.delete=Ie,Oe.prototype.get=st,Oe.prototype.has=ot,Oe.prototype.set=ke;function Je(W){var Q=-1,ae=W==null?0:W.length;for(this.clear();++Q<ae;){var xe=W[Q];this.set(xe[0],xe[1])}}function Qt(){this.__data__=[],this.size=0}function Xt(W){var Q=this.__data__,ae=No(Q,W);if(ae<0)return!1;var xe=Q.length-1;return ae==xe?Q.pop():Qe.call(Q,ae,1),--this.size,!0}function Zt(W){var Q=this.__data__,ae=No(Q,W);return ae<0?void 0:Q[ae][1]}function er(W){return No(this.__data__,W)>-1}function tr(W,Q){var ae=this.__data__,xe=No(ae,W);return xe<0?(++this.size,ae.push([W,Q])):ae[xe][1]=Q,this}Je.prototype.clear=Qt,Je.prototype.delete=Xt,Je.prototype.get=Zt,Je.prototype.has=er,Je.prototype.set=tr;function Et(W){var Q=-1,ae=W==null?0:W.length;for(this.clear();++Q<ae;){var xe=W[Q];this.set(xe[0],xe[1])}}function vi(){this.size=0,this.__data__={hash:new Oe,map:new(Pe||Je),string:new Oe}}function mi(W){var Q=To(this,W).delete(W);return this.size-=Q?1:0,Q}function yi(W){return To(this,W).get(W)}function wi(W){return To(this,W).has(W)}function _i(W,Q){var ae=To(this,W),xe=ae.size;return ae.set(W,Q),this.size+=ae.size==xe?0:1,this}Et.prototype.clear=vi,Et.prototype.delete=mi,Et.prototype.get=yi,Et.prototype.has=wi,Et.prototype.set=_i;function yr(W){var Q=-1,ae=W==null?0:W.length;for(this.__data__=new Et;++Q<ae;)this.add(W[Q])}function Ei(W){return this.__data__.set(W,i),this}function Ai(W){return this.__data__.has(W)}yr.prototype.add=yr.prototype.push=Ei,yr.prototype.has=Ai;function $t(W){var Q=this.__data__=new Je(W);this.size=Q.size}function xi(){this.__data__=new Je,this.size=0}function Si(W){var Q=this.__data__,ae=Q.delete(W);return this.size=Q.size,ae}function Mi(W){return this.__data__.get(W)}function Cs(W){return this.__data__.has(W)}function Fg(W,Q){var ae=this.__data__;if(ae instanceof Je){var xe=ae.__data__;if(!Pe||xe.length<r-1)return xe.push([W,Q]),this.size=++ae.size,this;ae=this.__data__=new Et(xe)}return ae.set(W,Q),this.size=ae.size,this}$t.prototype.clear=xi,$t.prototype.delete=Si,$t.prototype.get=Mi,$t.prototype.has=Cs,$t.prototype.set=Fg;function Lg(W,Q){var ae=Ro(W),xe=!ae&&Xg(W),dt=!ae&&!xe&&oc(W),Ge=!ae&&!xe&&!dt&&Vh(W),bt=ae||xe||dt||Ge,St=bt?M(W.length,String):[],Pt=St.length;for(var gt in W)me.call(W,gt)&&!(bt&&(gt=="length"||dt&&(gt=="offset"||gt=="parent")||Ge&&(gt=="buffer"||gt=="byteLength"||gt=="byteOffset")||Wg(gt,Pt)))&&St.push(gt);return St}function No(W,Q){for(var ae=W.length;ae--;)if(zh(W[ae][0],Q))return ae;return-1}function Ug(W,Q,ae){var xe=Q(W);return Ro(W)?xe:O(xe,ae(W))}function Ns(W){return W==null?W===void 0?Z:j:Ve&&Ve in Object(W)?Hg(W):Qg(W)}function Uh(W){return Ts(W)&&Ns(W)==a}function kh(W,Q,ae,xe,dt){return W===Q?!0:W==null||Q==null||!Ts(W)&&!Ts(Q)?W!==W&&Q!==Q:kg(W,Q,ae,xe,kh,dt)}function kg(W,Q,ae,xe,dt,Ge){var bt=Ro(W),St=Ro(Q),Pt=bt?h:ji(W),gt=St?h:ji(Q);Pt=Pt==a?R:Pt,gt=gt==a?R:gt;var lr=Pt==R,Rr=gt==R,qt=Pt==gt;if(qt&&oc(W)){if(!oc(Q))return!1;bt=!0,lr=!1}if(qt&&!lr)return Ge||(Ge=new $t),bt||Vh(W)?$h(W,Q,ae,xe,dt,Ge):Kg(W,Q,Pt,ae,xe,dt,Ge);if(!(ae&n)){var wr=lr&&me.call(W,"__wrapped__"),_r=Rr&&me.call(Q,"__wrapped__");if(wr||_r){var Hi=wr?W.value():W,Ii=_r?Q.value():Q;return Ge||(Ge=new $t),dt(Hi,Ii,ae,xe,Ge)}}return qt?(Ge||(Ge=new $t),jg(W,Q,ae,xe,dt,Ge)):!1}function $g(W){if(!Hh(W)||Yg(W))return!1;var Q=Kh(W)?Ne:Y;return Q.test(hn(W))}function qg(W){return Ts(W)&&jh(W.length)&&!!I[Ns(W)]}function zg(W){if(!Jg(W))return nt(W);var Q=[];for(var ae in Object(W))me.call(W,ae)&&ae!="constructor"&&Q.push(ae);return Q}function $h(W,Q,ae,xe,dt,Ge){var bt=ae&n,St=W.length,Pt=Q.length;if(St!=Pt&&!(bt&&Pt>St))return!1;var gt=Ge.get(W);if(gt&&Ge.get(Q))return gt==Q;var lr=-1,Rr=!0,qt=ae&s?new yr:void 0;for(Ge.set(W,Q),Ge.set(Q,W);++lr<St;){var wr=W[lr],_r=Q[lr];if(xe)var Hi=bt?xe(_r,wr,lr,Q,W,Ge):xe(wr,_r,lr,W,Q,Ge);if(Hi!==void 0){if(Hi)continue;Rr=!1;break}if(qt){if(!A(Q,function(Ii,un){if(!G(qt,un)&&(wr===Ii||dt(wr,Ii,ae,xe,Ge)))return qt.push(un)})){Rr=!1;break}}else if(!(wr===_r||dt(wr,_r,ae,xe,Ge))){Rr=!1;break}}return Ge.delete(W),Ge.delete(Q),Rr}function Kg(W,Q,ae,xe,dt,Ge,bt){switch(ae){case b:if(W.byteLength!=Q.byteLength||W.byteOffset!=Q.byteOffset)return!1;W=W.buffer,Q=Q.buffer;case U:return!(W.byteLength!=Q.byteLength||!Ge(new Ye(W),new Ye(Q)));case p:case v:case F:return zh(+W,+Q);case x:return W.name==Q.name&&W.message==Q.message;case L:case y:return W==Q+"";case B:var St=X;case q:var Pt=xe&n;if(St||(St=fe),W.size!=Q.size&&!Pt)return!1;var gt=bt.get(W);if(gt)return gt==Q;xe|=s,bt.set(W,Q);var lr=$h(St(W),St(Q),xe,dt,Ge,bt);return bt.delete(W),lr;case P:if(Ae)return Ae.call(W)==Ae.call(Q)}return!1}function jg(W,Q,ae,xe,dt,Ge){var bt=ae&n,St=qh(W),Pt=St.length,gt=qh(Q),lr=gt.length;if(Pt!=lr&&!bt)return!1;for(var Rr=Pt;Rr--;){var qt=St[Rr];if(!(bt?qt in Q:me.call(Q,qt)))return!1}var wr=Ge.get(W);if(wr&&Ge.get(Q))return wr==Q;var _r=!0;Ge.set(W,Q),Ge.set(Q,W);for(var Hi=bt;++Rr<Pt;){qt=St[Rr];var Ii=W[qt],un=Q[qt];if(xe)var Wh=bt?xe(un,Ii,qt,Q,W,Ge):xe(Ii,un,qt,W,Q,Ge);if(!(Wh===void 0?Ii===un||dt(Ii,un,ae,xe,Ge):Wh)){_r=!1;break}Hi||(Hi=qt=="constructor")}if(_r&&!Hi){var Oo=W.constructor,Po=Q.constructor;Oo!=Po&&"constructor"in W&&"constructor"in Q&&!(typeof Oo=="function"&&Oo instanceof Oo&&typeof Po=="function"&&Po instanceof Po)&&(_r=!1)}return Ge.delete(W),Ge.delete(Q),_r}function qh(W){return Ug(W,t2,Vg)}function To(W,Q){var ae=W.__data__;return Gg(Q)?ae[typeof Q=="string"?"string":"hash"]:ae.map}function $n(W,Q){var ae=re(W,Q);return $g(ae)?ae:void 0}function Hg(W){var Q=me.call(W,Ve),ae=W[Ve];try{W[Ve]=void 0;var xe=!0}catch{}var dt=De.call(W);return xe&&(Q?W[Ve]=ae:delete W[Ve]),dt}var Vg=Re?function(W){return W==null?[]:(W=Object(W),de(Re(W),function(Q){return Te.call(W,Q)}))}:r2,ji=Ns;(_e&&ji(new _e(new ArrayBuffer(1)))!=b||Pe&&ji(new Pe)!=B||Fe&&ji(Fe.resolve())!=K||Ee&&ji(new Ee)!=q||Le&&ji(new Le)!=ne)&&(ji=function(W){var Q=Ns(W),ae=Q==R?W.constructor:void 0,xe=ae?hn(ae):"";if(xe)switch(xe){case Se:return b;case $e:return B;case qe:return K;case Me:return q;case ze:return ne}return Q});function Wg(W,Q){return Q=Q??o,!!Q&&(typeof W=="number"||te.test(W))&&W>-1&&W%1==0&&W<Q}function Gg(W){var Q=typeof W;return Q=="string"||Q=="number"||Q=="symbol"||Q=="boolean"?W!=="__proto__":W===null}function Yg(W){return!!ge&&ge in W}function Jg(W){var Q=W&&W.constructor,ae=typeof Q=="function"&&Q.prototype||he;return W===ae}function Qg(W){return De.call(W)}function hn(W){if(W!=null){try{return we.call(W)}catch{}try{return W+""}catch{}}return""}function zh(W,Q){return W===Q||W!==W&&Q!==Q}var Xg=Uh(function(){return arguments}())?Uh:function(W){return Ts(W)&&me.call(W,"callee")&&!Te.call(W,"callee")},Ro=Array.isArray;function Zg(W){return W!=null&&jh(W.length)&&!Kh(W)}var oc=it||i2;function e2(W,Q){return kh(W,Q)}function Kh(W){if(!Hh(W))return!1;var Q=Ns(W);return Q==E||Q==D||Q==f||Q==T}function jh(W){return typeof W=="number"&&W>-1&&W%1==0&&W<=o}function Hh(W){var Q=typeof W;return W!=null&&(Q=="object"||Q=="function")}function Ts(W){return W!=null&&typeof W=="object"}var Vh=se?$(se):qg;function t2(W){return Zg(W)?Lg(W):zg(W)}function r2(){return[]}function i2(){return!1}t.exports=e2})(Sa,Sa.exports);var iA=Sa.exports;const nA=$f(iA),vg="wc",mg=2,Oh="core",ui=`${vg}@2:${Oh}:`,sA={name:Oh,logger:"error"},oA={database:":memory:"},aA="crypto",h0="client_ed25519_seed",cA=be.ONE_DAY,fA="keychain",hA="0.3",uA="messages",lA="0.3",dA=be.SIX_HOURS,pA="publisher",yg="irn",gA="error",wg="wss://relay.walletconnect.org",bA="relayer",Wt={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},vA="_subscription",xr={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},mA=.1,Ff="2.17.0",at={link_mode:"link_mode",relay:"relay"},yA="0.3",wA="WALLETCONNECT_CLIENT_ID",u0="WALLETCONNECT_LINK_MODE_APPS",Qr={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},_A="subscription",EA="0.3",AA=be.FIVE_SECONDS*1e3,xA="pairing",SA="0.3",qs={wc_pairingDelete:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:be.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:be.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:be.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:be.ONE_DAY,prompt:!1,tag:0},res:{ttl:be.ONE_DAY,prompt:!1,tag:0}}},yn={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Br={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},MA="history",IA="0.3",DA="expirer",Sr={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},CA="0.3",NA="verify-api",TA="https://verify.walletconnect.com",_g="https://verify.walletconnect.org",eo=_g,RA=`${eo}/v3`,OA=[TA,_g],PA="echo",BA="https://echo.walletconnect.com",Wr={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},Ti={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},Fr={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},gn={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},bn={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},zs={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},FA=.1,LA="event-client",UA=86400,kA="https://pulse.walletconnect.org/batch";function $A(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<t.length;n++){var s=t.charAt(n),o=s.charCodeAt(0);if(r[o]!==255)throw new TypeError(s+" is ambiguous");r[o]=n}var a=t.length,h=t.charAt(0),f=Math.log(a)/Math.log(256),p=Math.log(256)/Math.log(a);function v(D){if(D instanceof Uint8Array||(ArrayBuffer.isView(D)?D=new Uint8Array(D.buffer,D.byteOffset,D.byteLength):Array.isArray(D)&&(D=Uint8Array.from(D))),!(D instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(D.length===0)return"";for(var B=0,F=0,j=0,R=D.length;j!==R&&D[j]===0;)j++,B++;for(var K=(R-j)*p+1>>>0,T=new Uint8Array(K);j!==R;){for(var L=D[j],q=0,y=K-1;(L!==0||q<F)&&y!==-1;y--,q++)L+=256*T[y]>>>0,T[y]=L%a>>>0,L=L/a>>>0;if(L!==0)throw new Error("Non-zero carry");F=q,j++}for(var P=K-F;P!==K&&T[P]===0;)P++;for(var Z=h.repeat(B);P<K;++P)Z+=t.charAt(T[P]);return Z}function x(D){if(typeof D!="string")throw new TypeError("Expected String");if(D.length===0)return new Uint8Array;var B=0;if(D[B]!==" "){for(var F=0,j=0;D[B]===h;)F++,B++;for(var R=(D.length-B)*f+1>>>0,K=new Uint8Array(R);D[B];){var T=r[D.charCodeAt(B)];if(T===255)return;for(var L=0,q=R-1;(T!==0||L<j)&&q!==-1;q--,L++)T+=a*K[q]>>>0,K[q]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");j=L,B++}if(D[B]!==" "){for(var y=R-j;y!==R&&K[y]===0;)y++;for(var P=new Uint8Array(F+(R-y)),Z=F;y!==R;)P[Z++]=K[y++];return P}}}function E(D){var B=x(D);if(B)return B;throw new Error(`Non-${e} character`)}return{encode:v,decodeUnsafe:x,decode:E}}var qA=$A,zA=qA;const Eg=t=>{if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")},KA=t=>new TextEncoder().encode(t),jA=t=>new TextDecoder().decode(t);class HA{constructor(e,r,i){this.name=e,this.prefix=r,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class VA{constructor(e,r,i){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Ag(this,e)}}class WA{constructor(e){this.decoders=e}or(e){return Ag(this,e)}decode(e){const r=e[0],i=this.decoders[r];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ag=(t,e)=>new WA({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class GA{constructor(e,r,i,n){this.name=e,this.prefix=r,this.baseEncode=i,this.baseDecode=n,this.encoder=new HA(e,r,i),this.decoder=new VA(e,r,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const nc=({name:t,prefix:e,encode:r,decode:i})=>new GA(t,e,r,i),Co=({prefix:t,name:e,alphabet:r})=>{const{encode:i,decode:n}=zA(r,e);return nc({prefix:t,name:e,encode:i,decode:s=>Eg(n(s))})},YA=(t,e,r,i)=>{const n={};for(let p=0;p<e.length;++p)n[e[p]]=p;let s=t.length;for(;t[s-1]==="=";)--s;const o=new Uint8Array(s*r/8|0);let a=0,h=0,f=0;for(let p=0;p<s;++p){const v=n[t[p]];if(v===void 0)throw new SyntaxError(`Non-${i} character`);h=h<<r|v,a+=r,a>=8&&(a-=8,o[f++]=255&h>>a)}if(a>=r||255&h<<8-a)throw new SyntaxError("Unexpected end of data");return o},JA=(t,e,r)=>{const i=e[e.length-1]==="=",n=(1<<r)-1;let s="",o=0,a=0;for(let h=0;h<t.length;++h)for(a=a<<8|t[h],o+=8;o>r;)o-=r,s+=e[n&a>>o];if(o&&(s+=e[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s},kt=({name:t,prefix:e,bitsPerChar:r,alphabet:i})=>nc({prefix:e,name:t,encode(n){return JA(n,i,r)},decode(n){return YA(n,i,r,t)}}),QA=nc({prefix:"\0",name:"identity",encode:t=>jA(t),decode:t=>KA(t)});var XA=Object.freeze({__proto__:null,identity:QA});const ZA=kt({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ex=Object.freeze({__proto__:null,base2:ZA});const tx=kt({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var rx=Object.freeze({__proto__:null,base8:tx});const ix=Co({prefix:"9",name:"base10",alphabet:"0123456789"});var nx=Object.freeze({__proto__:null,base10:ix});const sx=kt({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ox=kt({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ax=Object.freeze({__proto__:null,base16:sx,base16upper:ox});const cx=kt({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),fx=kt({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),hx=kt({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ux=kt({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),lx=kt({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),dx=kt({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),px=kt({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gx=kt({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),bx=kt({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var vx=Object.freeze({__proto__:null,base32:cx,base32upper:fx,base32pad:hx,base32padupper:ux,base32hex:lx,base32hexupper:dx,base32hexpad:px,base32hexpadupper:gx,base32z:bx});const mx=Co({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),yx=Co({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var wx=Object.freeze({__proto__:null,base36:mx,base36upper:yx});const _x=Co({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ex=Co({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ax=Object.freeze({__proto__:null,base58btc:_x,base58flickr:Ex});const xx=kt({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Sx=kt({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Mx=kt({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ix=kt({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Dx=Object.freeze({__proto__:null,base64:xx,base64pad:Sx,base64url:Mx,base64urlpad:Ix});const xg=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Cx=xg.reduce((t,e,r)=>(t[r]=e,t),[]),Nx=xg.reduce((t,e,r)=>(t[e.codePointAt(0)]=r,t),[]);function Tx(t){return t.reduce((e,r)=>(e+=Cx[r],e),"")}function Rx(t){const e=[];for(const r of t){const i=Nx[r.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}const Ox=nc({prefix:"🚀",name:"base256emoji",encode:Tx,decode:Rx});var Px=Object.freeze({__proto__:null,base256emoji:Ox}),Bx=Sg,l0=128,Fx=127,Lx=~Fx,Ux=Math.pow(2,31);function Sg(t,e,r){e=e||[],r=r||0;for(var i=r;t>=Ux;)e[r++]=t&255|l0,t/=128;for(;t&Lx;)e[r++]=t&255|l0,t>>>=7;return e[r]=t|0,Sg.bytes=r-i+1,e}var kx=Lf,$x=128,d0=127;function Lf(t,i){var r=0,i=i||0,n=0,s=i,o,a=t.length;do{if(s>=a)throw Lf.bytes=0,new RangeError("Could not decode varint");o=t[s++],r+=n<28?(o&d0)<<n:(o&d0)*Math.pow(2,n),n+=7}while(o>=$x);return Lf.bytes=s-i,r}var qx=Math.pow(2,7),zx=Math.pow(2,14),Kx=Math.pow(2,21),jx=Math.pow(2,28),Hx=Math.pow(2,35),Vx=Math.pow(2,42),Wx=Math.pow(2,49),Gx=Math.pow(2,56),Yx=Math.pow(2,63),Jx=function(t){return t<qx?1:t<zx?2:t<Kx?3:t<jx?4:t<Hx?5:t<Vx?6:t<Wx?7:t<Gx?8:t<Yx?9:10},Qx={encode:Bx,decode:kx,encodingLength:Jx},Mg=Qx;const p0=(t,e,r=0)=>(Mg.encode(t,e,r),e),g0=t=>Mg.encodingLength(t),Uf=(t,e)=>{const r=e.byteLength,i=g0(t),n=i+g0(r),s=new Uint8Array(n+r);return p0(t,s,0),p0(r,s,i),s.set(e,n),new Xx(t,r,e,s)};class Xx{constructor(e,r,i,n){this.code=e,this.size=r,this.digest=i,this.bytes=n}}const Ig=({name:t,code:e,encode:r})=>new Zx(t,e,r);class Zx{constructor(e,r,i){this.name=e,this.code=r,this.encode=i}digest(e){if(e instanceof Uint8Array){const r=this.encode(e);return r instanceof Uint8Array?Uf(this.code,r):r.then(i=>Uf(this.code,i))}else throw Error("Unknown type, must be binary type")}}const Dg=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),eS=Ig({name:"sha2-256",code:18,encode:Dg("SHA-256")}),tS=Ig({name:"sha2-512",code:19,encode:Dg("SHA-512")});var rS=Object.freeze({__proto__:null,sha256:eS,sha512:tS});const Cg=0,iS="identity",Ng=Eg,nS=t=>Uf(Cg,Ng(t)),sS={code:Cg,name:iS,encode:Ng,digest:nS};var oS=Object.freeze({__proto__:null,identity:sS});new TextEncoder,new TextDecoder;const b0={...XA,...ex,...rx,...nx,...ax,...vx,...wx,...Ax,...Dx,...Px};({...rS,...oS});function aS(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Tg(t,e,r,i){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:i}}}const v0=Tg("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Yc=Tg("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);const e=aS(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),cS={utf8:v0,"utf-8":v0,hex:b0.base16,latin1:Yc,ascii:Yc,binary:Yc,...b0};function fS(t,e="utf8"){const r=cS[e];if(!r)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):r.decoder.decode(`${r.prefix}${t}`)}class hS{constructor(e,r){this.core=e,this.logger=r,this.keychain=new Map,this.name=fA,this.version=hA,this.initialized=!1,this.storagePrefix=ui,this.init=async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}},this.has=i=>(this.isInitialized(),this.keychain.has(i)),this.set=async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()},this.get=i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:s}=pe("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n},this.del=async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()},this.core=e,this.logger=Jt(r,this.name)}get context(){return ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,vp(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?mp(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class uS{constructor(e,r,i){this.core=e,this.logger=r,this.name=aA,this.randomSessionIdentifier=Tf(),this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=n=>(this.isInitialized(),this.keychain.has(n)),this.getClientId=async()=>{this.isInitialized();const n=await this.getClientSeed(),s=rl(n);return np(s.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const n=u7();return this.setPrivateKey(n.publicKey,n.privateKey)},this.signJWT=async n=>{this.isInitialized();const s=await this.getClientSeed(),o=rl(s),a=this.randomSessionIdentifier;return await t8(a,n,cA,o)},this.generateSharedKey=(n,s,o)=>{this.isInitialized();const a=this.getPrivateKey(n),h=l7(a,s);return this.setSymKey(h,o)},this.setSymKey=async(n,s)=>{this.isInitialized();const o=s||ta(n);return await this.keychain.set(o,n),o},this.deleteKeyPair=async n=>{this.isInitialized(),await this.keychain.del(n)},this.deleteSymKey=async n=>{this.isInitialized(),await this.keychain.del(n)},this.encode=async(n,s,o)=>{this.isInitialized();const a=fg(o),h=In(s);if(Vl(a))return p7(h,o==null?void 0:o.encoding);if(Hl(a)){const x=a.senderPublicKey,E=a.receiverPublicKey;n=await this.generateSharedKey(x,E)}const f=this.getSymKey(n),{type:p,senderPublicKey:v}=a;return d7({type:p,symKey:f,message:h,senderPublicKey:v,encoding:o==null?void 0:o.encoding})},this.decode=async(n,s,o)=>{this.isInitialized();const a=v7(s,o);if(Vl(a)){const h=b7(s,o==null?void 0:o.encoding);return cs(h)}if(Hl(a)){const h=a.receiverPublicKey,f=a.senderPublicKey;n=await this.generateSharedKey(h,f)}try{const h=this.getSymKey(n),f=g7({symKey:h,encoded:s,encoding:o==null?void 0:o.encoding});return cs(f)}catch(h){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(h)}},this.getPayloadType=(n,s=tn)=>{const o=ho({encoded:n,encoding:s});return Cn(o.type)},this.getPayloadSenderPublicKey=(n,s=tn)=>{const o=ho({encoded:n,encoding:s});return o.senderPublicKey?Tt(o.senderPublicKey,Yt):void 0},this.core=e,this.logger=Jt(r,this.name),this.keychain=i||new hS(this.core,this.logger)}get context(){return ur(this.logger)}async setPrivateKey(e,r){return await this.keychain.set(e,r),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(h0)}catch{e=Tf(),await this.keychain.set(h0,e)}return fS(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class lS extends fw{constructor(e,r){super(e,r),this.logger=e,this.core=r,this.messages=new Map,this.name=uA,this.version=lA,this.initialized=!1,this.storagePrefix=ui,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}},this.set=async(i,n)=>{this.isInitialized();const s=Oi(n);let o=this.messages.get(i);return typeof o>"u"&&(o={}),typeof o[s]<"u"||(o[s]=n,this.messages.set(i,o),await this.persist()),s},this.get=i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n},this.has=(i,n)=>{this.isInitialized();const s=this.get(i),o=Oi(n);return typeof s[o]<"u"},this.del=async i=>{this.isInitialized(),this.messages.delete(i),await this.persist()},this.logger=Jt(e,this.name),this.core=r}get context(){return ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,vp(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?mp(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class dS extends hw{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.events=new li.EventEmitter,this.name=pA,this.queue=new Map,this.publishTimeout=be.toMiliseconds(be.ONE_MINUTE),this.failedPublishTimeout=be.toMiliseconds(be.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(i,n,s)=>{var o;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});const a=(s==null?void 0:s.ttl)||dA,h=Rf(s),f=(s==null?void 0:s.prompt)||!1,p=(s==null?void 0:s.tag)||0,v=(s==null?void 0:s.id)||En().toString(),x={topic:i,message:n,opts:{ttl:a,relay:h,prompt:f,tag:p,id:v,attestation:s==null?void 0:s.attestation}},E=`Failed to publish payload, please try again. id:${v} tag:${p}`,D=Date.now();let B,F=1;try{for(;B===void 0;){if(Date.now()-D>this.publishTimeout)throw new Error(E);this.logger.trace({id:v,attempts:F},`publisher.publish - attempt ${F}`),B=await await Yn(this.rpcPublish(i,n,a,h,f,p,v,s==null?void 0:s.attestation).catch(j=>this.logger.warn(j)),this.publishTimeout,E),F++,B||await new Promise(j=>setTimeout(j,this.failedPublishTimeout))}this.relayer.events.emit(Wt.publish,x),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:v,topic:i,message:n,opts:s}})}catch(j){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(j),(o=s==null?void 0:s.internal)!=null&&o.throwOnFailedPublish)throw j;this.queue.set(v,x)}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.relayer=e,this.logger=Jt(r,this.name),this.registerEventListeners()}get context(){return ur(this.logger)}rpcPublish(e,r,i,n,s,o,a,h){var f,p,v,x;const E={method:Vs(n.protocol).publish,params:{topic:e,message:r,ttl:i,prompt:s,tag:o,attestation:h},id:a};return or((f=E.params)==null?void 0:f.prompt)&&((p=E.params)==null||delete p.prompt),or((v=E.params)==null?void 0:v.tag)&&((x=E.params)==null||delete x.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:E}),this.relayer.request(E)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:r,message:i,opts:n}=e;await this.publish(r,i,n)})}registerEventListeners(){this.relayer.core.heartbeat.on(ws.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Wt.connection_stalled);return}this.checkQueue()}),this.relayer.on(Wt.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class pS{constructor(){this.map=new Map,this.set=(e,r)=>{const i=this.get(e);this.exists(e,r)||this.map.set(e,[...i,r])},this.get=e=>this.map.get(e)||[],this.exists=(e,r)=>this.get(e).includes(r),this.delete=(e,r)=>{if(typeof r>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,r))return;const n=i.filter(s=>s!==r);if(!n.length){this.map.delete(e);return}this.map.set(e,n)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var gS=Object.defineProperty,bS=Object.defineProperties,vS=Object.getOwnPropertyDescriptors,m0=Object.getOwnPropertySymbols,mS=Object.prototype.hasOwnProperty,yS=Object.prototype.propertyIsEnumerable,y0=(t,e,r)=>e in t?gS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ks=(t,e)=>{for(var r in e||(e={}))mS.call(e,r)&&y0(t,r,e[r]);if(m0)for(var r of m0(e))yS.call(e,r)&&y0(t,r,e[r]);return t},Jc=(t,e)=>bS(t,vS(e));class wS extends dw{constructor(e,r){super(e,r),this.relayer=e,this.logger=r,this.subscriptions=new Map,this.topicMap=new pS,this.events=new li.EventEmitter,this.name=_A,this.version=EA,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=ui,this.subscribeTimeout=be.toMiliseconds(be.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId(),await this.restore()),this.initialized=!0},this.subscribe=async(i,n)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const s=Rf(n),o={topic:i,relay:s,transportType:n==null?void 0:n.transportType};this.pending.set(i,o);const a=await this.rpcSubscribe(i,s,n==null?void 0:n.transportType);return typeof a=="string"&&(this.onSubscribe(a,o),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),a}catch(s){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(s),s}},this.unsubscribe=async(i,n)=>{await this.restartToComplete(),this.isInitialized(),typeof(n==null?void 0:n.id)<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)},this.isSubscribed=async i=>{if(this.topics.includes(i))return!0;const n=`${this.pendingSubscriptionWatchLabel}_${i}`;return await new Promise((s,o)=>{const a=new be.Watch;a.start(n);const h=setInterval(()=>{!this.pending.has(i)&&this.topics.includes(i)&&(clearInterval(h),a.stop(n),s(!0)),a.elapsed(n)>=AA&&(clearInterval(h),a.stop(n),o(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=Jt(r,this.name),this.clientId=""}get context(){return ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(e,r){let i=!1;try{i=this.getSubscription(e).topic===r}catch{}return i}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,r){const i=this.topicMap.get(e);await Promise.all(i.map(async n=>await this.unsubscribeById(e,n,r)))}async unsubscribeById(e,r,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:i}});try{const n=Rf(i);await this.rpcUnsubscribe(e,r,n);const s=ct("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,r,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:r,opts:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(e,r,i=at.relay){i===at.relay&&await this.restartToComplete();const n={method:Vs(r.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{const s=Oi(e+this.clientId);return i===at.link_mode?(setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(o=>this.logger.warn(o))},be.toMiliseconds(be.ONE_SECOND)),s):await await Yn(this.relayer.request(n).catch(o=>this.logger.warn(o)),this.subscribeTimeout)?s:null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(Wt.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const r=e[0].relay,i={method:Vs(r.protocol).batchSubscribe,params:{topics:e.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{return await await Yn(this.relayer.request(i).catch(n=>this.logger.warn(n)),this.subscribeTimeout)}catch{this.relayer.events.emit(Wt.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const r=e[0].relay,i={method:Vs(r.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await Yn(this.relayer.request(i).catch(s=>this.logger.warn(s)),this.subscribeTimeout)}catch{this.relayer.events.emit(Wt.connection_stalled)}return n}rpcUnsubscribe(e,r,i){const n={method:Vs(i.protocol).unsubscribe,params:{topic:e,id:r}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,r){this.setSubscription(e,Jc(Ks({},r),{id:e})),this.pending.delete(r.topic)}onBatchSubscribe(e){e.length&&e.forEach(r=>{this.setSubscription(r.id,Ks({},r)),this.pending.delete(r.topic)})}async onUnsubscribe(e,r,i){this.events.removeAllListeners(r),this.hasSubscription(r,e)&&this.deleteSubscription(r,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,r){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:r}),this.addSubscription(e,r)}addSubscription(e,r){this.subscriptions.set(e,Ks({},r)),this.topicMap.set(r.topic,e),this.events.emit(Qr.created,r)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const r=this.subscriptions.get(e);if(!r){const{message:i}=pe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return r}deleteSubscription(e,r){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:r});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(Qr.deleted,Jc(Ks({},i),{reason:r}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Qr.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const i=this.cached.splice(0,this.batchSubscribeTopicsLimit);await this.batchFetchMessages(i),await this.batchSubscribe(i)}}this.events.emit(Qr.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){const{message:r}=pe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const r=await this.rpcBatchSubscribe(e);Do(r)&&this.onBatchSubscribe(r.map((i,n)=>Jc(Ks({},e[n]),{id:i})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(r.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(r=>{e.push(r)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(ws.pulse,async()=>{await this.checkPending()}),this.events.on(Qr.created,async e=>{const r=Qr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()}),this.events.on(Qr.deleted,async e=>{const r=Qr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){!this.relayer.connected&&!this.relayer.connecting&&await this.relayer.transportOpen(),this.restartInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.restartInProgress||(clearInterval(r),e())},this.pollingInterval)})}}var _S=Object.defineProperty,w0=Object.getOwnPropertySymbols,ES=Object.prototype.hasOwnProperty,AS=Object.prototype.propertyIsEnumerable,_0=(t,e,r)=>e in t?_S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,xS=(t,e)=>{for(var r in e||(e={}))ES.call(e,r)&&_0(t,r,e[r]);if(w0)for(var r of w0(e))AS.call(e,r)&&_0(t,r,e[r]);return t};class SS extends uw{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new li.EventEmitter,this.name=bA,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=be.toMiliseconds(be.THIRTY_SECONDS+be.ONE_SECOND),this.request=async r=>{var i,n;this.logger.debug("Publishing Request Payload");const s=r.id||En().toString();await this.toEstablishConnection();try{const o=this.provider.request(r);this.requestsInFlight.set(s,{promise:o,request:r}),this.logger.trace({id:s,method:r.method,topic:(i=r.params)==null?void 0:i.topic},"relayer.request - attempt to publish...");const a=await new Promise(async(h,f)=>{const p=()=>{f(new Error(`relayer.request - publish interrupted, id: ${s}`))};this.provider.on(xr.disconnect,p);const v=await o;this.provider.off(xr.disconnect,p),h(v)});return this.logger.trace({id:s,method:r.method,topic:(n=r.params)==null?void 0:n.topic},"relayer.request - published"),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}finally{this.requestsInFlight.delete(s)}},this.resetPingTimeout=()=>{if(va())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var r,i,n;(n=(i=(r=this.provider)==null?void 0:r.connection)==null?void 0:i.socket)==null||n.terminate()},this.heartBeatTimeout)}catch(r){this.logger.warn(r)}},this.onPayloadHandler=r=>{this.onProviderPayload(r),this.resetPingTimeout()},this.onConnectHandler=()=>{this.logger.trace("relayer connected"),this.startPingTimeout(),this.events.emit(Wt.connect)},this.onDisconnectHandler=()=>{this.logger.trace("relayer disconnected"),this.onProviderDisconnect()},this.onProviderErrorHandler=r=>{this.logger.error(r),this.events.emit(Wt.error,r),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(xr.payload,this.onPayloadHandler),this.provider.on(xr.connect,this.onConnectHandler),this.provider.on(xr.disconnect,this.onDisconnectHandler),this.provider.on(xr.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?Jt(e.logger,this.name):Ga(dh({level:e.logger||gA})),this.messages=new lS(this.logger,e.core),this.subscriber=new wS(this,this.logger),this.publisher=new dS(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||wg,this.projectId=e.projectId,this.bundleId=e4(),this.provider={}}async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.cached.length>0)try{await this.transportOpen()}catch(e){this.logger.warn(e)}}get context(){return ur(this.logger)}get connected(){var e,r,i;return((i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.readyState)===1}get connecting(){var e,r,i;return((i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.readyState)===0}async publish(e,r,i){this.isInitialized(),await this.publisher.publish(e,r,i),await this.recordMessageEvent({topic:e,message:r,publishedAt:Date.now(),transportType:at.relay})}async subscribe(e,r){var i;this.isInitialized(),(r==null?void 0:r.transportType)==="relay"&&await this.toEstablishConnection();let n=((i=this.subscriber.topicMap.get(e))==null?void 0:i[0])||"",s;const o=a=>{a.topic===e&&(this.subscriber.off(Qr.created,o),s())};return await Promise.all([new Promise(a=>{s=a,this.subscriber.on(Qr.created,o)}),new Promise(async a=>{n=await this.subscriber.subscribe(e,r)||n,a()})]),n}async unsubscribe(e,r){this.isInitialized(),await this.subscriber.unsubscribe(e,r)}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await Yn(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(r,i)=>{const n=()=>{this.provider.off(xr.disconnect,n),i(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(xr.disconnect,n),await Yn(this.provider.connect(),be.toMiliseconds(be.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(s=>{i(s)}).finally(()=>{clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0}),this.subscriber.start().catch(s=>{this.logger.error(s),this.onDisconnectHandler()}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){this.logger.error(r);const i=r;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(i.message))throw r}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await i0())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const r=e.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.trace(`Batch of ${r.length} message events sorted`);for(const i of r)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n)}this.logger.trace(`Batch of ${r.length} message events processed`)}async onLinkMessageEvent(e,r){const{topic:i}=e;if(!r.sessionExists){const n=xt(be.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(Wt.message,e),await this.recordMessageEvent(e)}startPingTimeout(){var e,r,i,n,s;if(va())try{(r=(e=this.provider)==null?void 0:e.connection)!=null&&r.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o)}}isConnectionStalled(e){return this.staleConnectionErrors.some(r=>e.includes(r))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new XE(new rA(n4({sdkVersion:Ff,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:r,message:i}=e;await this.messages.set(r,i)}async shouldIgnoreMessageEvent(e){const{topic:r,message:i}=e;if(!i||i.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isSubscribed(r))return this.logger.debug(`Ignoring message for non-subscribed topic ${r}`),!0;const n=this.messages.has(r,i);return n&&this.logger.debug(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),Rh(e)){if(!e.method.endsWith(vA))return;const r=e.params,{topic:i,message:n,publishedAt:s,attestation:o}=r.data,a={topic:i,message:n,publishedAt:s,transportType:at.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(xS({type:"event",event:r.id},a)),this.events.emit(r.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else ic(e)&&this.events.emit(Wt.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Wt.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const r=Nh(e.id,!0);await this.provider.connection.send(r)}unregisterProviderListeners(){this.provider.off(xr.payload,this.onPayloadHandler),this.provider.off(xr.connect,this.onConnectHandler),this.provider.off(xr.disconnect,this.onDisconnectHandler),this.provider.off(xr.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await i0();hE(async r=>{e!==r&&(e=r,r?await this.restartTransport().catch(i=>this.logger.error(i)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(Wt.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&(this.reconnectTimeout||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},be.toMiliseconds(mA))))}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const r=setInterval(()=>{this.connected&&(clearInterval(r),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var MS=Object.defineProperty,E0=Object.getOwnPropertySymbols,IS=Object.prototype.hasOwnProperty,DS=Object.prototype.propertyIsEnumerable,A0=(t,e,r)=>e in t?MS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,x0=(t,e)=>{for(var r in e||(e={}))IS.call(e,r)&&A0(t,r,e[r]);if(E0)for(var r of E0(e))DS.call(e,r)&&A0(t,r,e[r]);return t};class Un extends lw{constructor(e,r,i,n=ui,s=void 0){super(e,r,i,n),this.core=e,this.logger=r,this.name=i,this.map=new Map,this.version=yA,this.cached=[],this.initialized=!1,this.storagePrefix=ui,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!or(o)?this.map.set(this.getKey(o),o):q7(o)?this.map.set(o.id,o):z7(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)},this.set=async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())},this.get=o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o)),this.getAll=o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(h=>nA(a[h],o[h]))):this.values),this.update=async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const h=x0(x0({},this.getData(o)),a);this.map.set(o,h),await this.persist()},this.delete=async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())},this.logger=Jt(r,this.name),this.storagePrefix=n,this.getKey=s}get context(){return ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const r=this.map.get(e);if(!r){if(this.recentlyDeleted.includes(e)){const{message:n}=pe("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(n),new Error(n)}const{message:i}=pe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return r}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:r}=pe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class CS{constructor(e,r){this.core=e,this.logger=r,this.name=xA,this.version=SA,this.events=new B0,this.initialized=!1,this.storagePrefix=ui,this.ignoredPayloadTypes=[ki],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]},this.create=async i=>{this.isInitialized();const n=Tf(),s=await this.core.crypto.setSymKey(n),o=xt(be.FIVE_MINUTES),a={protocol:yg},h={topic:s,expiry:o,relay:a,active:!1,methods:i==null?void 0:i.methods},f=Ql({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:a,expiryTimestamp:o,methods:i==null?void 0:i.methods});return this.events.emit(yn.create,h),this.core.expirer.set(s,o),await this.pairings.set(s,h),await this.core.relayer.subscribe(s,{transportType:i==null?void 0:i.transportType}),{topic:s,uri:f}},this.pair=async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i==null?void 0:i.uri,trace:[Wr.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:o,relay:a,expiryTimestamp:h,methods:f}=Jl(i.uri);n.props.properties.topic=s,n.addTrace(Wr.pairing_uri_validation_success),n.addTrace(Wr.pairing_uri_not_expired);let p;if(this.pairings.keys.includes(s)){if(p=this.pairings.get(s),n.addTrace(Wr.existing_pairing),p.active)throw n.setError(Ti.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(Wr.pairing_not_expired)}const v=h||xt(be.FIVE_MINUTES),x={topic:s,relay:a,expiry:v,active:!1,methods:f};this.core.expirer.set(s,v),await this.pairings.set(s,x),n.addTrace(Wr.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(yn.create,x),n.addTrace(Wr.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),n.addTrace(Wr.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(Ti.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(E){throw n.setError(Ti.subscribe_pairing_topic_failure),E}return n.addTrace(Wr.subscribe_pairing_topic_success),x},this.activate=async({topic:i})=>{this.isInitialized();const n=xt(be.THIRTY_DAYS);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})},this.ping=async i=>{this.isInitialized(),await this.isValidPing(i);const{topic:n}=i;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:a,reject:h}=vn();this.events.once(Xe("pairing_ping",s),({error:f})=>{f?h(f):a()}),await o()}},this.updateExpiry=async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})},this.updateMetadata=async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",ct("USER_DISCONNECTED")),await this.deletePairing(n))},this.formatUriFromPairing=i=>{this.isInitialized();const{topic:n,relay:s,expiry:o,methods:a}=i,h=this.core.crypto.keychain.get(n);return Ql({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:h,relay:s,expiryTimestamp:o,methods:a})},this.sendRequest=async(i,n,s)=>{const o=An(n,s),a=await this.core.crypto.encode(i,o),h=qs[n].req;return this.core.history.set(i,o),this.core.relayer.publish(i,a,h),o.id},this.sendResult=async(i,n,s)=>{const o=Nh(i,s),a=await this.core.crypto.encode(n,o),h=await this.core.history.get(n,i),f=qs[h.request.method].res;await this.core.relayer.publish(n,a,f),await this.core.history.resolve(o)},this.sendError=async(i,n,s)=>{const o=Th(i,s),a=await this.core.crypto.encode(n,o),h=await this.core.history.get(n,i),f=qs[h.request.method]?qs[h.request.method].res:qs.unregistered_method.res;await this.core.relayer.publish(n,a,f),await this.core.history.resolve(o)},this.deletePairing=async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,ct("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])},this.cleanup=async()=>{const i=this.pairings.getAll().filter(n=>Gi(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))},this.onRelayEventRequest=i=>{const{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return this.onPairingPingRequest(n,s);case"wc_pairingDelete":return this.onPairingDeleteRequest(n,s);default:return this.onUnknownRpcMethodRequest(n,s)}},this.onRelayEventResponse=async i=>{const{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}},this.onPairingPingRequest=async(i,n)=>{const{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(yn.ping,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onPairingPingResponse=(i,n)=>{const{id:s}=n;setTimeout(()=>{Jr(n)?this.events.emit(Xe("pairing_ping",s),{}):Ir(n)&&this.events.emit(Xe("pairing_ping",s),{error:n.error})},500)},this.onPairingDeleteRequest=async(i,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(yn.delete,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}},this.onUnknownRpcMethodRequest=async(i,n)=>{const{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;const a=ct("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,a),this.logger.error(a)}catch(a){await this.sendError(s,i,a),this.logger.error(a)}},this.onUnknownRpcMethodResponse=i=>{this.registeredMethods.includes(i)||this.logger.error(ct("WC_METHOD_UNSUPPORTED",i))},this.isValidPair=(i,n)=>{var s;if(!nr(i)){const{message:a}=pe("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(Ti.malformed_pairing_uri),new Error(a)}if(!$7(i.uri)){const{message:a}=pe("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(Ti.malformed_pairing_uri),new Error(a)}const o=Jl(i==null?void 0:i.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=pe("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(Ti.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=pe("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(Ti.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&be.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){n.setError(Ti.pairing_expired);const{message:a}=pe("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}},this.isValidPing=async i=>{if(!nr(i)){const{message:s}=pe("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidDisconnect=async i=>{if(!nr(i)){const{message:s}=pe("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)},this.isValidPairingTopic=async i=>{if(!_t(i,!1)){const{message:n}=pe("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=pe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Gi(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=pe("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}},this.core=e,this.logger=Jt(r,this.name),this.pairings=new Un(this.core,this.logger,this.name,this.storagePrefix)}get context(){return ur(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(Wt.message,async e=>{const{topic:r,message:i,transportType:n}=e;if(!this.pairings.keys.includes(r)||n===at.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))return;const s=await this.core.crypto.decode(r,i);try{Rh(s)?(this.core.history.set(r,s),this.onRelayEventRequest({topic:r,payload:s})):ic(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:r,payload:s}),this.core.history.delete(r,s.id))}catch(o){this.logger.error(o)}})}registerExpirerEvents(){this.core.expirer.on(Sr.expired,async e=>{const{topic:r}=wp(e.target);r&&this.pairings.keys.includes(r)&&(await this.deletePairing(r,!0),this.events.emit(yn.expire,{topic:r}))})}}class NS extends cw{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.records=new Map,this.events=new li.EventEmitter,this.name=MA,this.version=IA,this.cached=[],this.initialized=!1,this.storagePrefix=ui,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;const o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s,expiry:xt(be.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(Br.created,o)},this.resolve=async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=Ir(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(Br.updated,n))},this.get=async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n)),this.delete=(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(Br.deleted,s)}}),this.persist()},this.exists=async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1),this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=Jt(r,this.name)}get context(){return ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(r=>{if(typeof r.response<"u")return;const i={topic:r.topic,request:An(r.request.method,r.request.params,r.id),chainId:r.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const r=this.records.get(e);if(!r){const{message:i}=pe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return r}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Br.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:r}=pe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Br.created,e=>{const r=Br.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Br.updated,e=>{const r=Br.updated;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.events.on(Br.deleted,e=>{const r=Br.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,record:e})}),this.core.heartbeat.on(ws.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(r=>{be.toMiliseconds(r.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${r.id}`),this.records.delete(r.id),this.events.emit(Br.deleted,r,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class TS extends pw{constructor(e,r){super(e,r),this.core=e,this.logger=r,this.expirations=new Map,this.events=new li.EventEmitter,this.name=DA,this.version=CA,this.cached=[],this.initialized=!1,this.storagePrefix=ui,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}},this.set=(i,n)=>{this.isInitialized();const s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Sr.created,{target:s,expiration:o})},this.get=i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)},this.del=i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Sr.deleted,{target:n,expiration:s})}},this.on=(i,n)=>{this.events.on(i,n)},this.once=(i,n)=>{this.events.once(i,n)},this.off=(i,n)=>{this.events.off(i,n)},this.removeListener=(i,n)=>{this.events.removeListener(i,n)},this.logger=Jt(r,this.name)}get context(){return ur(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return s4(e);if(typeof e=="number")return o4(e);const{message:r}=pe("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(r)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Sr.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:r}=pe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(r),new Error(r)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const r=this.expirations.get(e);if(!r){const{message:i}=pe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return r}checkExpiry(e,r){const{expiry:i}=r;be.toMiliseconds(i)-Date.now()<=0&&this.expire(e,r)}expire(e,r){this.expirations.delete(e),this.events.emit(Sr.expired,{target:e,expiration:r})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,r)=>this.checkExpiry(r,e))}registerEventListeners(){this.core.heartbeat.on(ws.pulse,()=>this.checkExpirations()),this.events.on(Sr.created,e=>{const r=Sr.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Sr.expired,e=>{const r=Sr.expired;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()}),this.events.on(Sr.deleted,e=>{const r=Sr.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}}var pt={};Object.defineProperty(pt,"__esModule",{value:!0}),pt.getLocalStorage=pt.getLocalStorageOrThrow=pt.getCrypto=pt.getCryptoOrThrow=pt.getLocation=pt.getLocationOrThrow=pt.getNavigator=pt.getNavigatorOrThrow=Rg=pt.getDocument=pt.getDocumentOrThrow=pt.getFromWindowOrThrow=pt.getFromWindow=void 0;function kn(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}pt.getFromWindow=kn;function Ds(t){const e=kn(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}pt.getFromWindowOrThrow=Ds;function RS(){return Ds("document")}pt.getDocumentOrThrow=RS;function OS(){return kn("document")}var Rg=pt.getDocument=OS;function PS(){return Ds("navigator")}pt.getNavigatorOrThrow=PS;function BS(){return kn("navigator")}pt.getNavigator=BS;function FS(){return Ds("location")}pt.getLocationOrThrow=FS;function LS(){return kn("location")}pt.getLocation=LS;function US(){return Ds("crypto")}pt.getCryptoOrThrow=US;function kS(){return kn("crypto")}pt.getCrypto=kS;function $S(){return Ds("localStorage")}pt.getLocalStorageOrThrow=$S;function qS(){return kn("localStorage")}pt.getLocalStorage=qS;class zS extends gw{constructor(e,r,i){super(e,r,i),this.core=e,this.logger=r,this.store=i,this.name=NA,this.verifyUrlV3=RA,this.storagePrefix=ui,this.version=mg,this.init=async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&be.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))},this.register=async n=>{if(!Ao()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=n,h=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const f=Rg(),p=this.startAbortTimer(be.ONE_SECOND*5),v=await new Promise((x,E)=>{const D=()=>{window.removeEventListener("message",F),f.body.removeChild(B),E("attestation aborted")};this.abortController.signal.addEventListener("abort",D);const B=f.createElement("iframe");B.src=h,B.style.display="none",B.addEventListener("error",D,{signal:this.abortController.signal});const F=j=>{if(j.data&&typeof j.data=="string")try{const R=JSON.parse(j.data);if(R.type==="verify_attestation"){if(Ef(R.attestation).payload.id!==o)return;clearInterval(p),f.body.removeChild(B),this.abortController.signal.removeEventListener("abort",D),window.removeEventListener("message",F),x(R.attestation===null?"":R.attestation)}}catch(R){this.logger.warn(R)}};f.body.appendChild(B),window.addEventListener("message",F,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",v),v}catch(f){this.logger.warn(f)}return""},this.resolve=async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Ef(s).payload.id!==a)return;const f=await this.isValidJwtAttestation(s);if(f){if(!f.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return f}}if(!o)return;const h=this.getVerifyUrl(n==null?void 0:n.verifyUrl);return this.fetchAttestation(o,h)},this.fetchAttestation=async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const o=this.startAbortTimer(be.ONE_SECOND*5),a=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0},this.getVerifyUrl=n=>{let s=n||eo;return OA.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${eo}`),s=eo),s},this.fetchPublicKey=async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(be.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}},this.persistPublicKey=async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n},this.removePublicKey=async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0},this.isValidJwtAttestation=async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(n,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}},this.getPublicKey=async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey(),this.fetchAndPersistPublicKey=async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const n=await this.fetchPromise;return this.fetchPromise=void 0,n},this.validateAttestation=(n,s)=>{const o=_7(n,s.publicKey),a={hasExpired:be.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}},this.logger=Jt(r,this.name),this.abortController=new AbortController,this.isDevEnv=wh(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return ur(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),be.toMiliseconds(e))}}class KS extends bw{constructor(e,r){super(e,r),this.projectId=e,this.logger=r,this.context=PA,this.registerDeviceToken=async i=>{const{clientId:n,token:s,notificationType:o,enableEncrypted:a=!1}=i,h=`${BA}/${this.projectId}/clients`;await fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:o,token:s,always_raw:a})})},this.logger=Jt(r,this.context)}}var jS=Object.defineProperty,S0=Object.getOwnPropertySymbols,HS=Object.prototype.hasOwnProperty,VS=Object.prototype.propertyIsEnumerable,M0=(t,e,r)=>e in t?jS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,js=(t,e)=>{for(var r in e||(e={}))HS.call(e,r)&&M0(t,r,e[r]);if(S0)for(var r of S0(e))VS.call(e,r)&&M0(t,r,e[r]);return t};class WS extends vw{constructor(e,r,i=!0){super(e,r,i),this.core=e,this.logger=r,this.context=LA,this.storagePrefix=ui,this.storageVersion=FA,this.events=new Map,this.shouldPersist=!1,this.init=async()=>{if(!wh())try{const n={eventId:gl(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:bp(this.core.relayer.protocol,this.core.relayer.version,Ff)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}},this.createEvent=n=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:h}}=n,f=gl(),p=this.core.projectId||"",v=Date.now(),x=js({eventId:f,timestamp:v,props:{event:s,type:o,properties:{topic:a,trace:h}},bundleId:p,domain:this.getAppDomain()},this.setMethods(f));return this.telemetryEnabled&&(this.events.set(f,x),this.shouldPersist=!0),x},this.getEvent=n=>{const{eventId:s,topic:o}=n;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(h=>h.props.properties.topic===o);if(a)return js(js({},a),this.setMethods(a.eventId))},this.deleteEvent=n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0},this.setEventListeners=()=>{this.core.heartbeat.on(ws.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{be.fromMiliseconds(Date.now())-be.fromMiliseconds(n.timestamp)>UA&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})},this.setMethods=n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)}),this.addTrace=(n,s)=>{const o=this.events.get(n);o&&(o.props.properties.trace.push(s),this.events.set(n,o),this.shouldPersist=!0)},this.setError=(n,s)=>{const o=this.events.get(n);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(n,o),this.shouldPersist=!0)},this.persist=async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1},this.restore=async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,js(js({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}},this.submit=async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,o]of this.events)o.props.type&&n.push(o);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}},this.sendEvent=async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${kA}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Ff}${s}`,{method:"POST",body:JSON.stringify(n)})},this.getAppDomain=()=>gp().url,this.logger=Jt(r,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var GS=Object.defineProperty,I0=Object.getOwnPropertySymbols,YS=Object.prototype.hasOwnProperty,JS=Object.prototype.propertyIsEnumerable,D0=(t,e,r)=>e in t?GS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,C0=(t,e)=>{for(var r in e||(e={}))YS.call(e,r)&&D0(t,r,e[r]);if(I0)for(var r of I0(e))JS.call(e,r)&&D0(t,r,e[r]);return t};class Ph extends aw{constructor(e){var r;super(e),this.protocol=vg,this.version=mg,this.name=Oh,this.events=new li.EventEmitter,this.initialized=!1,this.on=(o,a)=>this.events.on(o,a),this.once=(o,a)=>this.events.once(o,a),this.off=(o,a)=>this.events.off(o,a),this.removeListener=(o,a)=>this.events.removeListener(o,a),this.dispatchEnvelope=({topic:o,message:a,sessionExists:h})=>{if(!o||!a)return;const f={topic:o,message:a,publishedAt:Date.now(),transportType:at.link_mode};this.relayer.onLinkMessageEvent(f,{sessionExists:h})},this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||wg,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=dh({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:sA.logger}),{logger:n,chunkLoggerController:s}=ow({opts:i,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=s,(r=this.logChunkController)!=null&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var o,a;(o=this.logChunkController)!=null&&o.downloadLogsBlobInBrowser&&((a=this.logChunkController)==null||a.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Jt(n,this.name),this.heartbeat=new X6,this.crypto=new uS(this,this.logger,e==null?void 0:e.keychain),this.history=new NS(this,this.logger),this.expirer=new TS(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new Ry(C0(C0({},oA),e==null?void 0:e.storageOptions)),this.relayer=new SS({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new CS(this,this.logger),this.verify=new zS(this,this.logger,this.storage),this.echoClient=new KS(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new WS(this,this.logger,e==null?void 0:e.telemetryEnabled)}static async init(e){const r=new Ph(e);await r.initialize();const i=await r.crypto.getClientId();return await r.storage.setItem(wA,i),r}get context(){return ur(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(u0,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.eventClient.init(),this.linkModeSupportedApps=await this.storage.getItem(u0)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}}const QS=Ph,Og="wc",Pg=2,Bg="client",Bh=`${Og}@${Pg}:${Bg}:`,Qc={name:Bg,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},N0="WALLETCONNECT_DEEPLINK_CHOICE",XS="proposal",ZS="Proposal expired",eM="session",jn=be.SEVEN_DAYS,tM="engine",It={wc_sessionPropose:{req:{ttl:be.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1104},res:{ttl:be.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1106},res:{ttl:be.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:be.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:be.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1112},res:{ttl:be.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:be.ONE_DAY,prompt:!1,tag:1114},res:{ttl:be.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:be.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:be.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:be.FIVE_MINUTES,prompt:!1,tag:1119}}},Xc={min:be.FIVE_MINUTES,max:be.SEVEN_DAYS},Vr={idle:"IDLE",active:"ACTIVE"},rM="request",iM=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],nM="wc",sM="auth",oM="authKeys",aM="pairingTopics",cM="requests",sc=`${nM}@${1.5}:${sM}:`,ra=`${sc}:PUB_KEY`;var fM=Object.defineProperty,hM=Object.defineProperties,uM=Object.getOwnPropertyDescriptors,T0=Object.getOwnPropertySymbols,lM=Object.prototype.hasOwnProperty,dM=Object.prototype.propertyIsEnumerable,R0=(t,e,r)=>e in t?fM(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,vt=(t,e)=>{for(var r in e||(e={}))lM.call(e,r)&&R0(t,r,e[r]);if(T0)for(var r of T0(e))dM.call(e,r)&&R0(t,r,e[r]);return t},Lr=(t,e)=>hM(t,uM(e));class pM extends yw{constructor(e){super(e),this.name=tM,this.events=new B0,this.initialized=!1,this.requestQueue={state:Vr.idle,queue:[]},this.sessionRequestQueue={state:Vr.idle,queue:[]},this.requestQueueDelay=be.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.relayMessageCache=[],this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(It)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},be.toMiliseconds(this.requestQueueDelay)))},this.connect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Lr(vt({},r),{requiredNamespaces:r.requiredNamespaces||{},optionalNamespaces:r.optionalNamespaces||{}});await this.isValidConnect(i);const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,relays:h}=i;let f=n,p,v=!1;try{f&&(v=this.client.core.pairing.pairings.get(f).active)}catch(T){throw this.client.logger.error(`connect() -> pairing.get(${f}) failed`),T}if(!f||!v){const{topic:T,uri:L}=await this.client.core.pairing.create();f=T,p=L}if(!f){const{message:T}=pe("NO_MATCHING_KEY",`connect() pairing topic: ${f}`);throw new Error(T)}const x=await this.client.core.crypto.generateKeyPair(),E=It.wc_sessionPropose.req.ttl||be.FIVE_MINUTES,D=xt(E),B=vt({requiredNamespaces:s,optionalNamespaces:o,relays:h??[{protocol:yg}],proposer:{publicKey:x,metadata:this.client.metadata},expiryTimestamp:D,pairingTopic:f},a&&{sessionProperties:a}),{reject:F,resolve:j,done:R}=vn(E,ZS);this.events.once(Xe("session_connect"),async({error:T,session:L})=>{if(T)F(T);else if(L){L.self.publicKey=x;const q=Lr(vt({},L),{pairingTopic:B.pairingTopic,requiredNamespaces:B.requiredNamespaces,optionalNamespaces:B.optionalNamespaces,transportType:at.relay});await this.client.session.set(L.topic,q),await this.setExpiry(L.topic,L.expiry),f&&await this.client.core.pairing.updateMetadata({topic:f,metadata:L.peer.metadata}),this.cleanupDuplicatePairings(q),j(q)}});const K=await this.sendRequest({topic:f,method:"wc_sessionPropose",params:B,throwOnFailedPublish:!0});return await this.setProposal(K,vt({id:K},B)),{uri:p,approval:R}},this.pair=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(r)}catch(i){throw this.client.logger.error("pair() failed"),i}},this.approve=async r=>{var i,n,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(i=r==null?void 0:r.id)==null?void 0:i.toString(),trace:[Fr.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(P){throw o.setError(gn.no_internet_connection),P}try{await this.isValidProposalId(r==null?void 0:r.id)}catch(P){throw this.client.logger.error(`approve() -> proposal.get(${r==null?void 0:r.id}) failed`),o.setError(gn.proposal_not_found),P}try{await this.isValidApprove(r)}catch(P){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(gn.session_approve_namespace_validation_failure),P}const{id:a,relayProtocol:h,namespaces:f,sessionProperties:p,sessionConfig:v}=r,x=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:E,proposer:D,requiredNamespaces:B,optionalNamespaces:F}=x;let j=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:E});j||(j=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:Fr.session_approve_started,properties:{topic:E,trace:[Fr.session_approve_started,Fr.session_namespaces_validation_success]}}));const R=await this.client.core.crypto.generateKeyPair(),K=D.publicKey,T=await this.client.core.crypto.generateSharedKey(R,K),L=vt(vt({relay:{protocol:h??"irn"},namespaces:f,controller:{publicKey:R,metadata:this.client.metadata},expiry:xt(jn)},p&&{sessionProperties:p}),v&&{sessionConfig:v}),q=at.relay;j.addTrace(Fr.subscribing_session_topic);try{await this.client.core.relayer.subscribe(T,{transportType:q})}catch(P){throw j.setError(gn.subscribe_session_topic_failure),P}j.addTrace(Fr.subscribe_session_topic_success);const y=Lr(vt({},L),{topic:T,requiredNamespaces:B,optionalNamespaces:F,pairingTopic:E,acknowledged:!1,self:L.controller,peer:{publicKey:D.publicKey,metadata:D.metadata},controller:R,transportType:at.relay});await this.client.session.set(T,y),j.addTrace(Fr.store_session);try{j.addTrace(Fr.publishing_session_settle),await this.sendRequest({topic:T,method:"wc_sessionSettle",params:L,throwOnFailedPublish:!0}).catch(P=>{throw j==null||j.setError(gn.session_settle_publish_failure),P}),j.addTrace(Fr.session_settle_publish_success),j.addTrace(Fr.publishing_session_approve),await this.sendResult({id:a,topic:E,result:{relay:{protocol:h??"irn"},responderPublicKey:R},throwOnFailedPublish:!0}).catch(P=>{throw j==null||j.setError(gn.session_approve_publish_failure),P}),j.addTrace(Fr.session_approve_publish_success)}catch(P){throw this.client.logger.error(P),this.client.session.delete(T,ct("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(T),P}return this.client.core.eventClient.deleteEvent({eventId:j.eventId}),await this.client.core.pairing.updateMetadata({topic:E,metadata:D.metadata}),await this.client.proposal.delete(a,ct("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:E}),await this.setExpiry(T,xt(jn)),{topic:T,acknowledged:()=>Promise.resolve(this.client.session.get(T))}},this.reject=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(r)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:i,reason:n}=r;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),o}s&&(await this.sendError({id:i,topic:s,error:n,rpcOpts:It.wc_sessionPropose.reject}),await this.client.proposal.delete(i,ct("USER_DISCONNECTED")))},this.update=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(r)}catch(v){throw this.client.logger.error("update() -> isValidUpdate() failed"),v}const{topic:i,namespaces:n}=r,{done:s,resolve:o,reject:a}=vn(),h=Ji(),f=En().toString(),p=this.client.session.get(i).namespaces;return this.events.once(Xe("session_update",h),({error:v})=>{v?a(v):o()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:h,relayRpcId:f}).catch(v=>{this.client.logger.error(v),this.client.session.update(i,{namespaces:p}),a(v)}),{acknowledged:s}},this.extend=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(r)}catch(h){throw this.client.logger.error("extend() -> isValidExtend() failed"),h}const{topic:i}=r,n=Ji(),{done:s,resolve:o,reject:a}=vn();return this.events.once(Xe("session_extend",n),({error:h})=>{h?a(h):o()}),await this.setExpiry(i,xt(jn)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(h=>{a(h)}),{acknowledged:s}},this.request=async r=>{this.isInitialized();try{await this.isValidRequest(r)}catch(D){throw this.client.logger.error("request() -> isValidRequest() failed"),D}const{chainId:i,request:n,topic:s,expiry:o=It.wc_sessionRequest.req.ttl}=r,a=this.client.session.get(s);(a==null?void 0:a.transportType)===at.relay&&await this.confirmOnlineStateOrThrow();const h=Ji(),f=En().toString(),{done:p,resolve:v,reject:x}=vn(o,"Request expired. Please try again.");this.events.once(Xe("session_request",h),({error:D,result:B})=>{D?x(D):v(B)});const E=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);return E?(await this.sendRequest({clientRpcId:h,relayRpcId:f,topic:s,method:"wc_sessionRequest",params:{request:Lr(vt({},n),{expiryTimestamp:xt(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0,appLink:E}).catch(D=>x(D)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),await p()):await Promise.all([new Promise(async D=>{await this.sendRequest({clientRpcId:h,relayRpcId:f,topic:s,method:"wc_sessionRequest",params:{request:Lr(vt({},n),{expiryTimestamp:xt(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0}).catch(B=>x(B)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:h}),D()}),new Promise(async D=>{var B;if(!((B=a.sessionConfig)!=null&&B.disableDeepLink)){const F=await h4(this.client.core.storage,N0);await c4({id:h,topic:s,wcDeepLink:F})}D()}),p()]).then(D=>D[2])},this.respond=async r=>{this.isInitialized(),await this.isValidRespond(r);const{topic:i,response:n}=r,{id:s}=n,o=this.client.session.get(i);o.transportType===at.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);Jr(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:a}):Ir(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:a}),this.cleanupAfterResponse(r)},this.ping=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(r)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=r;if(this.client.session.keys.includes(i)){const n=Ji(),s=En().toString(),{done:o,resolve:a,reject:h}=vn();this.events.once(Xe("session_ping",n),({error:f})=>{f?h(f):a()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(i)&&await this.client.core.pairing.ping({topic:i})},this.emit=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(r);const{topic:i,event:n,chainId:s}=r,o=En().toString();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:o})},this.disconnect=async r=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(r);const{topic:i}=r;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:ct("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=pe("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}},this.find=r=>(this.isInitialized(),this.client.session.getAll().filter(i=>U7(i,r))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async(r,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(r);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),o=s?at.link_mode:at.relay;o===at.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:h="",uri:f,domain:p,nonce:v,type:x,exp:E,nbf:D,methods:B=[],expiry:F}=r,j=[...r.resources||[]],{topic:R,uri:K}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:R,uri:K}});const T=await this.client.core.crypto.generateKeyPair(),L=ta(T);if(await Promise.all([this.client.auth.authKeys.set(ra,{responseTopic:L,publicKey:T}),this.client.auth.pairingTopics.set(L,{topic:L,pairingTopic:R})]),await this.client.core.relayer.subscribe(L,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${R}`),B.length>0){const{namespace:C}=Tc(a[0]);let _=s7(C,"request",B);ea(j)&&(_=a7(_,j.pop())),j.push(_)}const q=F&&F>It.wc_sessionAuthenticate.req.ttl?F:It.wc_sessionAuthenticate.req.ttl,y={authPayload:{type:x??"caip122",chains:a,statement:h,aud:f,domain:p,version:"1",nonce:v,iat:new Date().toISOString(),exp:E,nbf:D,resources:j},requester:{publicKey:T,metadata:this.client.metadata},expiryTimestamp:xt(q)},P={eip155:{chains:a,methods:[...new Set(["personal_sign",...B])],events:["chainChanged","accountsChanged"]}},Z={requiredNamespaces:{},optionalNamespaces:P,relays:[{protocol:"irn"}],pairingTopic:R,proposer:{publicKey:T,metadata:this.client.metadata},expiryTimestamp:xt(It.wc_sessionPropose.req.ttl)},{done:ne,resolve:U,reject:b}=vn(q,"Request expired"),c=async({error:C,session:_})=>{if(this.events.off(Xe("session_request",g),u),C)b(C);else if(_){_.self.publicKey=T,await this.client.session.set(_.topic,_),await this.setExpiry(_.topic,_.expiry),R&&await this.client.core.pairing.updateMetadata({topic:R,metadata:_.peer.metadata});const l=this.client.session.get(_.topic);await this.deleteProposal(w),U({session:l})}},u=async C=>{var _,l,d;if(await this.deletePendingAuthRequest(g,{message:"fulfilled",code:0}),C.error){const H=ct("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return C.error.code===H.code?void 0:(this.events.off(Xe("session_connect"),c),b(C.error.message))}await this.deleteProposal(w),this.events.off(Xe("session_connect"),c);const{cacaos:N,responder:Y}=C.result,te=[],I=[];for(const H of N){await ql({cacao:H,projectId:this.client.core.projectId})||(this.client.logger.error(H,"Signature verification failed"),b(ct("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:V}=H,m=ea(V.resources),z=[$l(V.iss)],ee=Ea(V.iss);if(m){const ie=zl(m),se=Kl(m);te.push(...ie),z.push(...se)}for(const ie of z)I.push(`${ie}:${ee}`)}const J=await this.client.core.crypto.generateSharedKey(T,Y.publicKey);let k;te.length>0&&(k={topic:J,acknowledged:!0,self:{publicKey:T,metadata:this.client.metadata},peer:Y,controller:Y.publicKey,expiry:xt(jn),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:R,namespaces:Xl([...new Set(te)],[...new Set(I)]),transportType:o},await this.client.core.relayer.subscribe(J,{transportType:o}),await this.client.session.set(J,k),R&&await this.client.core.pairing.updateMetadata({topic:R,metadata:Y.metadata}),k=this.client.session.get(J)),(_=this.client.metadata.redirect)!=null&&_.linkMode&&(l=Y.metadata.redirect)!=null&&l.linkMode&&(d=Y.metadata.redirect)!=null&&d.universal&&i&&(this.client.core.addLinkModeSupportedApp(Y.metadata.redirect.universal),this.client.session.update(J,{transportType:at.link_mode})),U({auths:N,session:k})},g=Ji(),w=Ji();this.events.once(Xe("session_connect"),c),this.events.once(Xe("session_request",g),u);let S;try{if(s){const C=An("wc_sessionAuthenticate",y,g);this.client.core.history.set(R,C);const _=await this.client.core.crypto.encode("",C,{type:Io,encoding:ks});S=Vo(i,R,_)}else await Promise.all([this.sendRequest({topic:R,method:"wc_sessionAuthenticate",params:y,expiry:r.expiry,throwOnFailedPublish:!0,clientRpcId:g}),this.sendRequest({topic:R,method:"wc_sessionPropose",params:Z,expiry:It.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w})])}catch(C){throw this.events.off(Xe("session_connect"),c),this.events.off(Xe("session_request",g),u),C}return await this.setProposal(w,vt({id:w},Z)),await this.setAuthRequest(g,{request:Lr(vt({},y),{verifyContext:{}}),pairingTopic:R,transportType:o}),{uri:S??K,response:ne}},this.approveSessionAuthenticate=async r=>{const{id:i,auths:n}=r,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[bn.authenticated_session_approve_started]}});try{this.isInitialized()}catch(F){throw s.setError(zs.no_internet_connection),F}const o=this.getPendingAuthRequest(i);if(!o)throw s.setError(zs.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const a=o.transportType||at.relay;a===at.relay&&await this.confirmOnlineStateOrThrow();const h=o.requester.publicKey,f=await this.client.core.crypto.generateKeyPair(),p=ta(h),v={type:ki,receiverPublicKey:h,senderPublicKey:f},x=[],E=[];for(const F of n){if(!await ql({cacao:F,projectId:this.client.core.projectId})){s.setError(zs.invalid_cacao);const L=ct("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:p,error:L,encodeOpts:v}),new Error(L.message)}s.addTrace(bn.cacaos_verified);const{p:j}=F,R=ea(j.resources),K=[$l(j.iss)],T=Ea(j.iss);if(R){const L=zl(R),q=Kl(R);x.push(...L),K.push(...q)}for(const L of K)E.push(`${L}:${T}`)}const D=await this.client.core.crypto.generateSharedKey(f,h);s.addTrace(bn.create_authenticated_session_topic);let B;if((x==null?void 0:x.length)>0){B={topic:D,acknowledged:!0,self:{publicKey:f,metadata:this.client.metadata},peer:{publicKey:h,metadata:o.requester.metadata},controller:h,expiry:xt(jn),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Xl([...new Set(x)],[...new Set(E)]),transportType:a},s.addTrace(bn.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(D,{transportType:a})}catch(F){throw s.setError(zs.subscribe_authenticated_session_topic_failure),F}s.addTrace(bn.subscribe_authenticated_session_topic_success),await this.client.session.set(D,B),s.addTrace(bn.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(bn.publishing_authenticated_session_approve);try{await this.sendResult({topic:p,id:i,result:{cacaos:n,responder:{publicKey:f,metadata:this.client.metadata}},encodeOpts:v,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(F){throw s.setError(zs.authenticated_session_approve_publish_failure),F}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:B}},this.rejectSessionAuthenticate=async r=>{this.isInitialized();const{id:i,reason:n}=r,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===at.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),h=ta(o),f={type:ki,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:i,topic:h,error:n,encodeOpts:f,rpcOpts:It.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.client.proposal.delete(i,ct("USER_DISCONNECTED"))},this.formatAuthMessage=r=>{this.isInitialized();const{request:i,iss:n}=r;return ig(i,n)},this.processRelayMessageCache=()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const r=this.relayMessageCache.shift();r&&await this.onRelayMessage(r)}catch(r){this.client.logger.error(r)}},50)},this.cleanupDuplicatePairings=async r=>{if(r.pairingTopic)try{const i=this.client.core.pairing.pairings.get(r.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===r.peer.metadata.url&&s.topic&&s.topic!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}},this.deleteSession=async r=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=r,{self:h}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,ct("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(h.publicKey)&&await this.client.core.crypto.deleteKeyPair(h.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(N0).catch(f=>this.client.logger.warn(f)),this.getPendingSessionRequests().forEach(f=>{f.topic===n&&this.deletePendingSessionRequest(f.id,ct("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=Vr.idle),o&&this.client.events.emit("session_delete",{id:a,topic:n})},this.deleteProposal=async(r,i)=>{if(i)try{const n=this.client.proposal.get(r),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s==null||s.setError(gn.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(r,ct("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"proposal")},this.deletePendingSessionRequest=async(r,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(r,i),n?Promise.resolve():this.client.core.expirer.del(r)]),this.addToRecentlyDeleted(r,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==r),n&&(this.sessionRequestQueue.state=Vr.idle,this.client.events.emit("session_request_expire",{id:r}))},this.deletePendingAuthRequest=async(r,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(r,i),n?Promise.resolve():this.client.core.expirer.del(r)])},this.setExpiry=async(r,i)=>{this.client.session.keys.includes(r)&&(this.client.core.expirer.set(r,i),await this.client.session.update(r,{expiry:i}))},this.setProposal=async(r,i)=>{this.client.core.expirer.set(r,xt(It.wc_sessionPropose.req.ttl)),await this.client.proposal.set(r,i)},this.setAuthRequest=async(r,i)=>{const{request:n,pairingTopic:s,transportType:o=at.relay}=i;this.client.core.expirer.set(r,n.expiryTimestamp),await this.client.auth.requests.set(r,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:r,pairingTopic:s,verifyContext:n.verifyContext,transportType:o})},this.setPendingSessionRequest=async r=>{const{id:i,topic:n,params:s,verifyContext:o}=r,a=s.request.expiryTimestamp||xt(It.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,a),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:o})},this.sendRequest=async r=>{const{topic:i,method:n,params:s,expiry:o,relayRpcId:a,clientRpcId:h,throwOnFailedPublish:f,appLink:p}=r,v=An(n,s,h);let x;const E=!!p;try{const F=E?ks:tn;x=await this.client.core.crypto.encode(i,v,{encoding:F})}catch(F){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),F}let D;if(iM.includes(n)){const F=Oi(JSON.stringify(v)),j=Oi(x);D=await this.client.core.verify.register({id:j,decryptedId:F})}const B=It[n].req;if(B.attestation=D,o&&(B.ttl=o),a&&(B.id=a),this.client.core.history.set(i,v),E){const F=Vo(p,i,x);await global.Linking.openURL(F,this.client.name)}else{const F=It[n].req;o&&(F.ttl=o),a&&(F.id=a),f?(F.internal=Lr(vt({},F.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,x,F)):this.client.core.relayer.publish(i,x,F).catch(j=>this.client.logger.error(j))}return v.id},this.sendResult=async r=>{const{id:i,topic:n,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:h}=r,f=Nh(i,s);let p;const v=h&&typeof(global==null?void 0:global.Linking)<"u";try{const E=v?ks:tn;p=await this.client.core.crypto.encode(n,f,Lr(vt({},a||{}),{encoding:E}))}catch(E){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),E}let x;try{x=await this.client.core.history.get(n,i)}catch(E){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),E}if(v){const E=Vo(h,n,p);await global.Linking.openURL(E,this.client.name)}else{const E=It[x.request.method].res;o?(E.internal=Lr(vt({},E.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,p,E)):this.client.core.relayer.publish(n,p,E).catch(D=>this.client.logger.error(D))}await this.client.core.history.resolve(f)},this.sendError=async r=>{const{id:i,topic:n,error:s,encodeOpts:o,rpcOpts:a,appLink:h}=r,f=Th(i,s);let p;const v=h&&typeof(global==null?void 0:global.Linking)<"u";try{const E=v?ks:tn;p=await this.client.core.crypto.encode(n,f,Lr(vt({},o||{}),{encoding:E}))}catch(E){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),E}let x;try{x=await this.client.core.history.get(n,i)}catch(E){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),E}if(v){const E=Vo(h,n,p);await global.Linking.openURL(E,this.client.name)}else{const E=a||It[x.request.method].res;this.client.core.relayer.publish(n,p,E)}await this.client.core.history.resolve(f)},this.cleanup=async()=>{const r=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;Gi(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&r.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Gi(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...r.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])},this.onRelayEventRequest=async r=>{this.requestQueue.queue.push(r),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===Vr.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=Vr.active;const r=this.requestQueue.queue.shift();if(r)try{await this.processRequest(r)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=Vr.idle},this.processRequest=async r=>{const{topic:i,payload:n,attestation:s,transportType:o,encryptedId:a}=r,h=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:h}))switch(h){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${h}`)}},this.onRelayEventResponse=async r=>{const{topic:i,payload:n,transportType:s}=r,o=(await this.client.core.history.get(i,n.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${o}`)}},this.onRelayEventUnknownPayload=r=>{const{topic:i}=r,{message:n}=pe("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)},this.shouldIgnorePairingRequest=r=>{const{topic:i,requestMethod:n}=r,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async r=>{const{topic:i,payload:n,attestation:s,encryptedId:o}=r,{params:a,id:h}=n;try{const f=this.client.core.eventClient.getEvent({topic:i});this.isValidConnect(vt({},n.params));const p=a.expiryTimestamp||xt(It.wc_sessionPropose.req.ttl),v=vt({id:h,pairingTopic:i,expiryTimestamp:p},a);await this.setProposal(h,v);const x=await this.getVerifyContext({attestationId:s,hash:Oi(JSON.stringify(n)),encryptedId:o,metadata:v.proposer.metadata});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),f==null||f.setError(Ti.proposal_listener_not_found)),f==null||f.addTrace(Wr.emit_session_proposal),this.client.events.emit("session_proposal",{id:h,params:v,verifyContext:x})}catch(f){await this.sendError({id:h,topic:i,error:f,rpcOpts:It.wc_sessionPropose.autoReject}),this.client.logger.error(f)}},this.onSessionProposeResponse=async(r,i,n)=>{const{id:s}=i;if(Jr(i)){const{result:o}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const h=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:h});const f=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:f});const p=await this.client.core.crypto.generateSharedKey(h,f);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:p});const v=await this.client.core.relayer.subscribe(p,{transportType:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:v}),await this.client.core.pairing.activate({topic:r})}else if(Ir(i)){await this.client.proposal.delete(s,ct("USER_DISCONNECTED"));const o=Xe("session_connect");if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(Xe("session_connect"),{error:i.error})}},this.onSessionSettleRequest=async(r,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:h,namespaces:f,sessionProperties:p,sessionConfig:v}=i.params,x=Lr(vt(vt({topic:r,relay:o,expiry:h,namespaces:f,acknowledged:!0,pairingTopic:"",requiredNamespaces:{},optionalNamespaces:{},controller:a.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},p&&{sessionProperties:p}),v&&{sessionConfig:v}),{transportType:at.relay}),E=Xe("session_connect");if(this.events.listenerCount(E)===0)throw new Error(`emitting ${E} without any listeners 997`);this.events.emit(Xe("session_connect"),{session:x}),await this.sendResult({id:i.id,topic:r,result:!0,throwOnFailedPublish:!0})}catch(o){await this.sendError({id:n,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionSettleResponse=async(r,i)=>{const{id:n}=i;Jr(i)?(await this.client.session.update(r,{acknowledged:!0}),this.events.emit(Xe("session_approve",n),{})):Ir(i)&&(await this.client.session.delete(r,ct("USER_DISCONNECTED")),this.events.emit(Xe("session_approve",n),{error:i.error}))},this.onSessionUpdateRequest=async(r,i)=>{const{params:n,id:s}=i;try{const o=`${r}_session_update`,a=$s.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.info(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:r,error:ct("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(vt({topic:r},n));try{$s.set(o,s),await this.client.session.update(r,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:r,result:!0,throwOnFailedPublish:!0})}catch(h){throw $s.delete(o),h}this.client.events.emit("session_update",{id:s,topic:r,params:n})}catch(o){await this.sendError({id:s,topic:r,error:o}),this.client.logger.error(o)}},this.isRequestOutOfSync=(r,i)=>parseInt(i.toString().slice(0,-3))<=parseInt(r.toString().slice(0,-3)),this.onSessionUpdateResponse=(r,i)=>{const{id:n}=i,s=Xe("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Jr(i)?this.events.emit(Xe("session_update",n),{}):Ir(i)&&this.events.emit(Xe("session_update",n),{error:i.error})},this.onSessionExtendRequest=async(r,i)=>{const{id:n}=i;try{this.isValidExtend({topic:r}),await this.setExpiry(r,xt(jn)),await this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:n,topic:r})}catch(s){await this.sendError({id:n,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionExtendResponse=(r,i)=>{const{id:n}=i,s=Xe("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Jr(i)?this.events.emit(Xe("session_extend",n),{}):Ir(i)&&this.events.emit(Xe("session_extend",n),{error:i.error})},this.onSessionPingRequest=async(r,i)=>{const{id:n}=i;try{this.isValidPing({topic:r}),await this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:r})}catch(s){await this.sendError({id:n,topic:r,error:s}),this.client.logger.error(s)}},this.onSessionPingResponse=(r,i)=>{const{id:n}=i,s=Xe("session_ping",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);setTimeout(()=>{Jr(i)?this.events.emit(Xe("session_ping",n),{}):Ir(i)&&this.events.emit(Xe("session_ping",n),{error:i.error})},500)},this.onSessionDeleteRequest=async(r,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:r,reason:i.params}),Promise.all([new Promise(s=>{this.client.core.relayer.once(Wt.publish,async()=>{s(await this.deleteSession({topic:r,id:n}))})}),this.sendResult({id:n,topic:r,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:r,error:ct("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}},this.onSessionRequest=async r=>{var i,n,s;const{topic:o,payload:a,attestation:h,encryptedId:f,transportType:p}=r,{id:v,params:x}=a;try{await this.isValidRequest(vt({topic:o},x));const E=this.client.session.get(o),D=await this.getVerifyContext({attestationId:h,hash:Oi(JSON.stringify(An("wc_sessionRequest",x,v))),encryptedId:f,metadata:E.peer.metadata,transportType:p}),B={id:v,topic:o,params:x,verifyContext:D};await this.setPendingSessionRequest(B),p===at.link_mode&&(i=E.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=E.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(B):(this.addSessionRequestToSessionRequestQueue(B),this.processSessionRequestQueue())}catch(E){await this.sendError({id:v,topic:o,error:E}),this.client.logger.error(E)}},this.onSessionRequestResponse=(r,i)=>{const{id:n}=i,s=Xe("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);Jr(i)?this.events.emit(Xe("session_request",n),{result:i.result}):Ir(i)&&this.events.emit(Xe("session_request",n),{error:i.error})},this.onSessionEventRequest=async(r,i)=>{const{id:n,params:s}=i;try{const o=`${r}_session_event_${s.event.name}`,a=$s.get(o);if(a&&this.isRequestOutOfSync(a,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(vt({topic:r},s)),this.client.events.emit("session_event",{id:n,topic:r,params:s}),$s.set(o,n)}catch(o){await this.sendError({id:n,topic:r,error:o}),this.client.logger.error(o)}},this.onSessionAuthenticateResponse=(r,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:i}),Jr(i)?this.events.emit(Xe("session_request",n),{result:i.result}):Ir(i)&&this.events.emit(Xe("session_request",n),{error:i.error})},this.onSessionAuthenticateRequest=async r=>{var i;const{topic:n,payload:s,attestation:o,encryptedId:a,transportType:h}=r;try{const{requester:f,authPayload:p,expiryTimestamp:v}=s.params,x=await this.getVerifyContext({attestationId:o,hash:Oi(JSON.stringify(s)),encryptedId:a,metadata:f.metadata,transportType:h}),E={requester:f,pairingTopic:n,id:s.id,authPayload:p,verifyContext:x,expiryTimestamp:v};await this.setAuthRequest(s.id,{request:E,pairingTopic:n,transportType:h}),h===at.link_mode&&(i=f.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(f.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:x})}catch(f){this.client.logger.error(f);const p=s.params.requester.publicKey,v=await this.client.core.crypto.generateKeyPair(),x=this.getAppLinkIfEnabled(s.params.requester.metadata,h),E={type:ki,receiverPublicKey:p,senderPublicKey:v};await this.sendError({id:s.id,topic:n,error:f,encodeOpts:E,rpcOpts:It.wc_sessionAuthenticate.autoReject,appLink:x})}},this.addSessionRequestToSessionRequestQueue=r=>{this.sessionRequestQueue.queue.push(r)},this.cleanupAfterResponse=r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=Vr.idle,this.processSessionRequestQueue()},be.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:r,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===r&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=Xe("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(Xe("session_request",s.request.id),{error:i})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===Vr.active){this.client.logger.info("session request queue is already active.");return}const r=this.sessionRequestQueue.queue[0];if(!r){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=Vr.active,this.emitSessionRequest(r)}catch(i){this.client.logger.error(i)}},this.emitSessionRequest=r=>{this.client.events.emit("session_request",r)},this.onPairingCreated=r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===r.topic);i&&this.onSessionProposeRequest({topic:r.topic,payload:An("wc_sessionPropose",{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties},i.id)})},this.isValidConnect=async r=>{if(!nr(r)){const{message:h}=pe("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(r)}`);throw new Error(h)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,relays:a}=r;if(or(i)||await this.isValidPairingTopic(i),!J7(a)){const{message:h}=pe("MISSING_OR_INVALID",`connect() relays: ${a}`);throw new Error(h)}!or(n)&&Aa(n)!==0&&this.validateNamespaces(n,"requiredNamespaces"),!or(s)&&Aa(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),or(o)||this.validateSessionProps(o,"sessionProperties")},this.validateNamespaces=(r,i)=>{const n=Y7(r,"connect()",i);if(n)throw new Error(n.message)},this.isValidApprove=async r=>{if(!nr(r))throw new Error(pe("MISSING_OR_INVALID",`approve() params: ${r}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:o}=r;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const a=this.client.proposal.get(i),h=Wc(n,"approve()");if(h)throw new Error(h.message);const f=t0(a.requiredNamespaces,n,"approve()");if(f)throw new Error(f.message);if(!_t(s,!0)){const{message:p}=pe("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(p)}or(o)||this.validateSessionProps(o,"sessionProperties")},this.isValidReject=async r=>{if(!nr(r)){const{message:s}=pe("MISSING_OR_INVALID",`reject() params: ${r}`);throw new Error(s)}const{id:i,reason:n}=r;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!X7(n)){const{message:s}=pe("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}},this.isValidSessionSettleRequest=r=>{if(!nr(r)){const{message:f}=pe("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(f)}const{relay:i,controller:n,namespaces:s,expiry:o}=r;if(!ug(i)){const{message:f}=pe("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(f)}const a=K7(n,"onSessionSettleRequest()");if(a)throw new Error(a.message);const h=Wc(s,"onSessionSettleRequest()");if(h)throw new Error(h.message);if(Gi(o)){const{message:f}=pe("EXPIRED","onSessionSettleRequest()");throw new Error(f)}},this.isValidUpdate=async r=>{if(!nr(r)){const{message:h}=pe("MISSING_OR_INVALID",`update() params: ${r}`);throw new Error(h)}const{topic:i,namespaces:n}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),o=Wc(n,"update()");if(o)throw new Error(o.message);const a=t0(s.requiredNamespaces,n,"update()");if(a)throw new Error(a.message)},this.isValidExtend=async r=>{if(!nr(r)){const{message:n}=pe("MISSING_OR_INVALID",`extend() params: ${r}`);throw new Error(n)}const{topic:i}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)},this.isValidRequest=async r=>{if(!nr(r)){const{message:h}=pe("MISSING_OR_INVALID",`request() params: ${r}`);throw new Error(h)}const{topic:i,request:n,chainId:s,expiry:o}=r;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!e0(a,s)){const{message:h}=pe("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(h)}if(!Z7(n)){const{message:h}=pe("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(h)}if(!rE(a,s,n.method)){const{message:h}=pe("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(h)}if(o&&!oE(o,Xc)){const{message:h}=pe("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Xc.min} and ${Xc.max}`);throw new Error(h)}},this.isValidRespond=async r=>{var i;if(!nr(r)){const{message:o}=pe("MISSING_OR_INVALID",`respond() params: ${r}`);throw new Error(o)}const{topic:n,response:s}=r;try{await this.isValidSessionTopic(n)}catch(o){throw(i=r==null?void 0:r.response)!=null&&i.id&&this.cleanupAfterResponse(r),o}if(!eE(s)){const{message:o}=pe("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}},this.isValidPing=async r=>{if(!nr(r)){const{message:n}=pe("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(n)}const{topic:i}=r;await this.isValidSessionOrPairingTopic(i)},this.isValidEmit=async r=>{if(!nr(r)){const{message:a}=pe("MISSING_OR_INVALID",`emit() params: ${r}`);throw new Error(a)}const{topic:i,event:n,chainId:s}=r;await this.isValidSessionTopic(i);const{namespaces:o}=this.client.session.get(i);if(!e0(o,s)){const{message:a}=pe("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!tE(n)){const{message:a}=pe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}if(!iE(o,s,n.name)){const{message:a}=pe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(a)}},this.isValidDisconnect=async r=>{if(!nr(r)){const{message:n}=pe("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(n)}const{topic:i}=r;await this.isValidSessionOrPairingTopic(i)},this.isValidAuthenticate=r=>{const{chains:i,uri:n,domain:s,nonce:o}=r;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!_t(n,!1))throw new Error("uri is required parameter");if(!_t(s,!1))throw new Error("domain is required parameter");if(!_t(o,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(h=>Tc(h).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Tc(i[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async r=>{const{attestationId:i,hash:n,encryptedId:s,metadata:o,transportType:a}=r,h={verified:{verifyUrl:o.verifyUrl||eo,validation:"UNKNOWN",origin:o.url||""}};try{if(a===at.link_mode){const p=this.getAppLinkIfEnabled(o,a);return h.verified.validation=p&&new URL(p).origin===new URL(o.url).origin?"VALID":"INVALID",h}const f=await this.client.core.verify.resolve({attestationId:i,hash:n,encryptedId:s,verifyUrl:o.verifyUrl});f&&(h.verified.origin=f.origin,h.verified.isScam=f.isScam,h.verified.validation=f.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(f){this.client.logger.warn(f)}return this.client.logger.debug(`Verify context: ${JSON.stringify(h)}`),h},this.validateSessionProps=(r,i)=>{Object.values(r).forEach(n=>{if(!_t(n,!1)){const{message:s}=pe("MISSING_OR_INVALID",`${i} must be in Record<string, string> format. Received: ${JSON.stringify(n)}`);throw new Error(s)}})},this.getPendingAuthRequest=r=>{const i=this.client.auth.requests.get(r);return typeof i=="object"?i:void 0},this.addToRecentlyDeleted=(r,i)=>{if(this.recentlyDeletedMap.set(r,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(o)}}},this.checkRecentlyDeleted=r=>{const i=this.recentlyDeletedMap.get(r);if(i){const{message:n}=pe("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${r}`);throw new Error(n)}},this.isLinkModeEnabled=(r,i)=>{var n,s,o,a,h,f,p,v,x;return!r||i!==at.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((f=(h=this.client.metadata)==null?void 0:h.redirect)==null?void 0:f.universal)!==""&&((p=r==null?void 0:r.redirect)==null?void 0:p.universal)!==void 0&&((v=r==null?void 0:r.redirect)==null?void 0:v.universal)!==""&&((x=r==null?void 0:r.redirect)==null?void 0:x.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"},this.getAppLinkIfEnabled=(r,i)=>{var n;return this.isLinkModeEnabled(r,i)?(n=r==null?void 0:r.redirect)==null?void 0:n.universal:void 0},this.handleLinkModeMessage=({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const i=pl(r,"topic")||"",n=decodeURIComponent(pl(r,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:at.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})},this.registerLinkModeListeners=async()=>{var r;if(wh()||Es()&&(r=this.client.metadata.redirect)!=null&&r.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}}isInitialized(){if(!this.initialized){const{message:e}=pe("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Wt.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){const{topic:r,message:i,attestation:n,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(ra)?this.client.auth.authKeys.get(ra):{responseTopic:void 0,publicKey:void 0},a=await this.client.core.crypto.decode(r,i,{receiverPublicKey:o,encoding:s===at.link_mode?ks:tn});try{Rh(a)?(this.client.core.history.set(r,a),this.onRelayEventRequest({topic:r,payload:a,attestation:n,transportType:s,encryptedId:Oi(i)})):ic(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:r,payload:a,transportType:s}),this.client.core.history.delete(r,a.id)):this.onRelayEventUnknownPayload({topic:r,payload:a,transportType:s})}catch(h){this.client.logger.error(h)}}registerExpirerEvents(){this.client.core.expirer.on(Sr.expired,async e=>{const{topic:r,id:i}=wp(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,pe("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,pe("EXPIRED"),!0);r?this.client.session.keys.includes(r)&&(await this.deleteSession({topic:r,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:r})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(yn.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(yn.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!_t(e,!1)){const{message:r}=pe("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(r)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:r}=pe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(r)}if(Gi(this.client.core.pairing.pairings.get(e).expiry)){const{message:r}=pe("EXPIRED",`pairing topic: ${e}`);throw new Error(r)}}async isValidSessionTopic(e){if(!_t(e,!1)){const{message:r}=pe("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:r}=pe("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Gi(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:r}=pe("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!this.client.core.crypto.keychain.has(e)){const{message:r}=pe("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(r)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(_t(e,!1)){const{message:r}=pe("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}else{const{message:r}=pe("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}async isValidProposalId(e){if(!Q7(e)){const{message:r}=pe("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!this.client.proposal.keys.includes(e)){const{message:r}=pe("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Gi(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:r}=pe("EXPIRED",`proposal id: ${e}`);throw new Error(r)}}}class gM extends Un{constructor(e,r){super(e,r,XS,Bh),this.core=e,this.logger=r}}class bM extends Un{constructor(e,r){super(e,r,eM,Bh),this.core=e,this.logger=r}}class vM extends Un{constructor(e,r){super(e,r,rM,Bh,i=>i.id),this.core=e,this.logger=r}}class mM extends Un{constructor(e,r){super(e,r,oM,sc,()=>ra),this.core=e,this.logger=r}}class yM extends Un{constructor(e,r){super(e,r,aM,sc),this.core=e,this.logger=r}}class wM extends Un{constructor(e,r){super(e,r,cM,sc,i=>i.id),this.core=e,this.logger=r}}class _M{constructor(e,r){this.core=e,this.logger=r,this.authKeys=new mM(this.core,this.logger),this.pairingTopics=new yM(this.core,this.logger),this.requests=new wM(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class Fh extends mw{constructor(e){super(e),this.protocol=Og,this.version=Pg,this.name=Qc.name,this.events=new li.EventEmitter,this.on=(i,n)=>this.events.on(i,n),this.once=(i,n)=>this.events.once(i,n),this.off=(i,n)=>this.events.off(i,n),this.removeListener=(i,n)=>this.events.removeListener(i,n),this.removeAllListeners=i=>this.events.removeAllListeners(i),this.connect=async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}},this.pair=async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}},this.approve=async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}},this.reject=async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}},this.update=async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}},this.extend=async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}},this.request=async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}},this.respond=async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}},this.ping=async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}},this.emit=async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}},this.disconnect=async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}},this.find=i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}},this.authenticate=async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(s){throw this.logger.error(s.message),s}},this.formatAuthMessage=i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}},this.approveSessionAuthenticate=async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.rejectSessionAuthenticate=async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}},this.name=(e==null?void 0:e.name)||Qc.name,this.metadata=(e==null?void 0:e.metadata)||gp(),this.signConfig=e==null?void 0:e.signConfig;const r=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Ga(dh({level:(e==null?void 0:e.logger)||Qc.logger}));this.core=(e==null?void 0:e.core)||new QS(e),this.logger=Jt(r,this.name),this.session=new bM(this.core,this.logger),this.proposal=new gM(this.core,this.logger),this.pendingRequest=new vM(this.core,this.logger),this.engine=new pM(this),this.auth=new _M(this.core,this.logger)}static async init(e){const r=new Fh(e);return await r.initialize(),r}get context(){return ur(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success"),this.engine.processRelayMessageCache()}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}class wn extends Error{constructor(){super(),Object.setPrototypeOf(this,wn.prototype)}}class Lh extends Error{constructor(){super(),Object.setPrototypeOf(this,Lh.prototype)}}var O0;(function(t){t.Mainnet="solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",t.Devnet="solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"})(O0||(O0={}));var us;(function(t){t.signTransaction="solana_signTransaction",t.signMessage="solana_signMessage"})(us||(us={}));const P0=t=>({requiredNamespaces:{solana:{chains:[t],methods:[us.signTransaction,us.signMessage],events:[]}}}),EM=t=>"version"in t;class $M{constructor(e){this._options=e.options,this._network=e.network}async connect(){const e=this._client??await Fh.init(this._options),r=e.find(P0(this._network)).filter(i=>i.acknowledged);if(r.length)return this._session=r[r.length-1],this._client=e,{publicKey:this.publicKey};{const{uri:i,approval:n}=await e.connect(P0(this._network));return new Promise((s,o)=>{i&&Ru.open(i,()=>{o(new Lh)}),n().then(a=>{this._session=a,this._client=e,s({publicKey:this.publicKey})}).catch(o).finally(()=>{Ru.close()})})}}async disconnect(){if(this._client&&this._session)await this._client.disconnect({topic:this._session.topic,reason:ct("USER_DISCONNECTED")}),this._session=void 0;else throw new wn}get client(){if(this._client)return Object.assign({},this._client,{off:this._client.removeListener});throw new wn}get publicKey(){if(this._client&&this._session){const{address:e}=G8(this._session.namespaces.solana.accounts[0]);return new f2(e)}else throw new wn}async signTransaction(e){if(this._client&&this._session){let r,i;EM(e)?(r=Buffer.from(e.serialize()).toString("base64"),e.version==="legacy"&&(i=h2.from(e.serialize()))):(r=e.serialize({requireAllSignatures:!1,verifySignatures:!1}).toString("base64"),i=e);const{signature:n}=await this._client.request({chainId:this._network,topic:this._session.topic,request:{method:us.signTransaction,params:{...i,transaction:r}}});return e.addSignature(this.publicKey,Buffer.from(ac.decode(n))),e}else throw new wn}async signMessage(e){if(this._client&&this._session){const{signature:r}=await this._client.request({chainId:this._network,topic:this._session.topic,request:{method:us.signMessage,params:{pubkey:this.publicKey.toString(),message:ac.encode(e)}}});return ac.decode(r)}else throw new wn}}export{wn as ClientNotInitializedError,Lh as QRCodeModalError,O0 as WalletConnectChainID,Fh as WalletConnectClient,us as WalletConnectRPCMethods,$M as WalletConnectWallet};