@stakekit/widget 0.0.286 → 0.0.288

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 (89) hide show
  1. package/dist/bundle/Result-D66k67e4.js +3 -0
  2. package/dist/bundle/Schema-CnO1Nnkx.js +2 -0
  3. package/dist/bundle/{cardano-connector-Cg1NVNSz.js → cardano-connector-BdmhtPwK.js} +1 -1
  4. package/dist/{website/assets/configured-chains-C5lih9lm.js → bundle/configured-chains-BVaAJPl7.js} +1 -1
  5. package/dist/bundle/{cosmos-connector-meta-B3hXlZyj.js → cosmos-connector-meta-CsjY5xv_.js} +1 -1
  6. package/dist/bundle/{current-value-stream-sEIwrVMJ.js → current-value-stream-BphKxe9G.js} +1 -1
  7. package/dist/bundle/{esm-B8ixy8Ti.js → esm-BioWy-zm.js} +1 -1
  8. package/dist/bundle/index.bundle.css +1 -1
  9. package/dist/bundle/index.bundle.js +132 -100
  10. package/dist/bundle/{ledger-connector-ScKbHFK2.js → ledger-connector-BeFXqMQm.js} +2 -2
  11. package/dist/bundle/{network-DRjEa3NO.js → network-BR2dx0lQ.js} +1 -1
  12. package/dist/bundle/{polkadot-ledger-transaction-CSI9csNM.js → polkadot-ledger-transaction-CCpzhicj.js} +1 -1
  13. package/dist/bundle/{safe-connector-BuI_vM2N.js → safe-connector-BW8tBAGV.js} +1 -1
  14. package/dist/bundle/{solana-connector-BXIkWGi1.js → solana-connector-CEoNnJWx.js} +1 -1
  15. package/dist/bundle/{stellar-connector-D5G2p6aO.js → stellar-connector-C3GFN35d.js} +1 -1
  16. package/dist/bundle/{substrate-connector-AJ6EWjQP.js → substrate-connector-B7COXHL7.js} +1 -1
  17. package/dist/{website/assets/ton-connector-DWz2WVCw.js → bundle/ton-connector-DnPSYtXm.js} +1 -1
  18. package/dist/bundle/transaction-3CLRKFvX.js +1 -0
  19. package/dist/{website/assets/transaction-BJ3RmuAw.js → bundle/transaction-BDuN1rLk.js} +2 -2
  20. package/dist/bundle/{transaction-NX-vBbnh.js → transaction-DU8AaOQz.js} +1 -1
  21. package/dist/bundle/{tron-connector-nZfhLwx4.js → tron-connector-iA7bb0__.js} +1 -1
  22. package/dist/bundle/{utils-CfBIlQsz.js → utils-llPzGe7v.js} +1 -1
  23. package/dist/bundle/wagmi-connect-result-DOu6hDDM.js +11 -0
  24. package/dist/bundle/{wallet-errors-Bvwwydi9.js → wallet-errors-MrbcJr3I.js} +1 -1
  25. package/dist/bundle/{wallet-manager-C-MB05Qs.js → wallet-manager-D2AeCPRs.js} +2 -2
  26. package/dist/package/{Result-Cem4lYBf.js → Result-BA6lrqKV.js} +117 -49
  27. package/dist/package/{Schema-DFoi51wt.js → Schema-CUut1r-H.js} +1135 -1310
  28. package/dist/package/{cardano-connector-B9UToMFP.js → cardano-connector-ApyBIRYL.js} +3 -3
  29. package/dist/package/{configured-chains-BfQ8ESmR.js → configured-chains-CeRB7Tdy.js} +1 -1
  30. package/dist/package/{cosmos-connector-meta-UMFrkViG.js → cosmos-connector-meta-NNACISY5.js} +1 -1
  31. package/dist/package/{current-value-stream-BPaLLDf4.js → current-value-stream-Cs2IFPhP.js} +1 -1
  32. package/dist/package/{esm-89IrCtWy.js → esm-3BtHXmV9.js} +1 -1
  33. package/dist/package/index.package.css +21 -0
  34. package/dist/package/index.package.js +8469 -3828
  35. package/dist/package/{ledger-connector-B8D8xJOD.js → ledger-connector-ebEnv7IA.js} +9 -9
  36. package/dist/package/{network-DiYap-9L.js → network-Df21Fcdz.js} +1 -1
  37. package/dist/package/{polkadot-ledger-transaction-Bi14PyTF.js → polkadot-ledger-transaction-Cq_ImU8s.js} +1 -1
  38. package/dist/package/{safe-connector-lVCS_bS5.js → safe-connector-CMgopygU.js} +4 -4
  39. package/dist/package/{solana-connector-P-TqgNNC.js → solana-connector-B2Rf5Tyj.js} +3 -3
  40. package/dist/package/{stellar-connector-BMB2Cql4.js → stellar-connector-DdzqZgoG.js} +4 -4
  41. package/dist/package/{substrate-connector-a7SNpKjf.js → substrate-connector-DO7OAvZ9.js} +2 -2
  42. package/dist/package/{ton-connector-CMzOI2bi.js → ton-connector-CUtYVysK.js} +5 -5
  43. package/dist/package/{transaction-CmOScFm6.js → transaction-BjGgdyu0.js} +5 -5
  44. package/dist/package/{transaction-Do9wZHM8.js → transaction-MMiSjtGI.js} +1 -1
  45. package/dist/package/{transaction-C1e6h8J1.js → transaction-fIZimEky.js} +1 -1
  46. package/dist/package/{tron-connector-PLpMhB65.js → tron-connector-DT1NdAaP.js} +2 -2
  47. package/dist/package/{wagmi-connect-result-BJ91_jis.js → wagmi-connect-result-Bh6qH5iI.js} +593 -462
  48. package/dist/package/{wallet-errors-B4cGcGNy.js → wallet-errors-BMdJQ_kv.js} +1 -1
  49. package/dist/package/{wallet-manager-BsDss9DQ.js → wallet-manager-BbL7EBi6.js} +5 -5
  50. package/dist/types/domain/network/network.d.ts +2 -2
  51. package/dist/types/generated/api/legacy-schema.d.ts +3503 -1952
  52. package/dist/types/generated/api/yield-schema.d.ts +1492 -1113
  53. package/dist/types/public-api/types.d.ts +2 -2
  54. package/dist/website/assets/Result-D66k67e4.js +3 -0
  55. package/dist/website/assets/Schema-CnO1Nnkx.js +2 -0
  56. package/dist/website/assets/{cardano-connector-JluaLQJr.js → cardano-connector-DkgQsbib.js} +1 -1
  57. package/dist/{bundle/configured-chains-C5lih9lm.js → website/assets/configured-chains-BVaAJPl7.js} +1 -1
  58. package/dist/website/assets/{cosmos-connector-meta-B3hXlZyj.js → cosmos-connector-meta-CsjY5xv_.js} +1 -1
  59. package/dist/website/assets/{current-value-stream-sEIwrVMJ.js → current-value-stream-BphKxe9G.js} +1 -1
  60. package/dist/website/assets/{esm-DmRWC3up.js → esm-DJUTv1_r.js} +1 -1
  61. package/dist/website/assets/{index-CYwddl65.css → index-B_e-5cjt.css} +1 -1
  62. package/dist/website/assets/index-Ifmhd5nI.js +592 -0
  63. package/dist/website/assets/{ledger-connector-zHWvy_21.js → ledger-connector-CMFH1Z0M.js} +3 -3
  64. package/dist/website/assets/{network-DRjEa3NO.js → network-BR2dx0lQ.js} +1 -1
  65. package/dist/website/assets/{polkadot-ledger-transaction-CSI9csNM.js → polkadot-ledger-transaction-CCpzhicj.js} +1 -1
  66. package/dist/website/assets/{safe-connector-B_IWbdsx.js → safe-connector-BDc3OqKV.js} +1 -1
  67. package/dist/website/assets/{solana-connector-DUrUEFXI.js → solana-connector-Ij-Dm1HM.js} +1 -1
  68. package/dist/website/assets/{stellar-connector-D5G2p6aO.js → stellar-connector-C3GFN35d.js} +1 -1
  69. package/dist/website/assets/{substrate-connector-DxgYUQY4.js → substrate-connector-B-LTNtpz.js} +1 -1
  70. package/dist/{bundle/ton-connector-DWz2WVCw.js → website/assets/ton-connector-DnPSYtXm.js} +1 -1
  71. package/dist/{bundle/transaction-BJ3RmuAw.js → website/assets/transaction-BDuN1rLk.js} +2 -2
  72. package/dist/website/assets/{transaction-BIBBEBi6.js → transaction-Cth5mVGJ.js} +1 -1
  73. package/dist/website/assets/transaction-peV0IJTV.js +1 -0
  74. package/dist/website/assets/{tron-connector-C3nKPxdx.js → tron-connector-D_NeRPfc.js} +1 -1
  75. package/dist/website/assets/{utils-DVCp0qSW.js → utils-DOZR2zEE.js} +1 -1
  76. package/dist/website/assets/wagmi-connect-result-DOu6hDDM.js +11 -0
  77. package/dist/website/assets/{wallet-errors-Bvwwydi9.js → wallet-errors-MrbcJr3I.js} +1 -1
  78. package/dist/website/assets/{wallet-manager-9-XcN6SR.js → wallet-manager-DGQAWJIz.js} +3 -3
  79. package/dist/website/index.html +13 -13
  80. package/package.json +12 -11
  81. package/dist/bundle/Result-3MQjLy1V.js +0 -3
  82. package/dist/bundle/Schema-DgreXIef.js +0 -2
  83. package/dist/bundle/transaction-BnkP6nIP.js +0 -1
  84. package/dist/bundle/wagmi-connect-result-CqXaJhOa.js +0 -11
  85. package/dist/website/assets/Result-3MQjLy1V.js +0 -3
  86. package/dist/website/assets/Schema-DgreXIef.js +0 -2
  87. package/dist/website/assets/index-DtK-tGS5.js +0 -560
  88. package/dist/website/assets/transaction-Sqg4_vo7.js +0 -1
  89. package/dist/website/assets/wagmi-connect-result-CqXaJhOa.js +0 -11
@@ -0,0 +1 @@
1
+ import{u as e}from"./Result-D66k67e4.js";import{On as t,Xt as n,Zt as r,mt as i,pt as a}from"./wagmi-connect-result-DOu6hDDM.js";import{A as o,C as s,F as c,J as l,L as u,M as d,Tt as f,V as p,W as m,Y as h,a as g,at as _,i as v,it as y,j as b,kt as x,l as S,n as C,o as w,r as T,st as E,t as D,v as O,w as k,wt as ee,x as te,yt as A}from"./Schema-CnO1Nnkx.js";import{Sn as ne,gn as j,sn as re}from"./ccip-B_AhQiTz.js";var M=H(),ie=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,N=Math.ceil,P=Math.floor,F=`[BigNumber Error] `,I=0x5af3107a4000,L=14,R=9007199254740991,z=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],B=1e7,V=1e9;function H(e){var t,n,r=/^(-?)0([xbo])(?=[^.])/i,i=/^-?(Infinity|NaN)$/,a=/^\s*\+(?!-)|^\s+|\s+$/g,o=b.prototype={constructor:b,toString:null,valueOf:null},s=new b(1),c=20,l=4,u=-7,d=21,f=-1e7,p=1e7,m=!1,h=!0,g=1,_=0,v={prefix:``,negativeSign:`-`,positiveSign:``,groupSeparator:`,`,groupSize:3,secondaryGroupSize:0,decimalSeparator:`.`,fractionGroupSeparator:``,fractionGroupSize:0,suffix:``},y=`0123456789abcdefghijklmnopqrstuvwxyz`;function b(e,t){var n,o,s,c,l=this;if(!(l instanceof b))return new b(e,t);if(c=typeof e,t==null){if(w(e)){l.s=e.s,!e.c||e.e>p?l.c=l.e=null:e.e<f?l.c=[l.e=0]:(l.e=e.e,l.c=e.c.slice());return}if(c==`number`){if(e*0!=0){l.s=isNaN(e)?null:e<0?-1:1,l.c=l.e=null;return}if(l.s=1/e<0?(e=-e,-1):1,e===~~e){for(n=0,o=e;o>=10;o/=10,n++);n>p?l.c=l.e=null:(l.e=n,l.c=[e]);return}return x(l,String(e))}if(c==`bigint`)return l.s=e<0?(e=-e,-1):1,x(l,String(e));if(c==`string`)s=e;else{if(h)throw Error(F+`BigNumber, string, number, or BigInt expected: `+e);s=String(e)}if(ie.test(s))return l.s=s.charCodeAt(0)==45?(s=s.slice(1),-1):1,x(l,s);if(s=s.replace(a,``),i.test(s)){l.s=isNaN(s)?null:s<0?-1:1,l.c=l.e=null;return}if(s=s.replace(r,function(e,n,r){return t=(r=r.toLowerCase())==`x`?16:r==`b`?2:8,n}),t)return S(l,s,t,e);if(s=s.replace(/(\d)_(?=\d)/g,`$1`),ie.test(s))return l.s=s.charCodeAt(0)==45?(s=s.slice(1),-1):1,x(l,s);if(h)throw Error(F+`Not a number: `+e);l.s=l.c=l.e=null}else{if(c!=`string`){if(h)throw Error(F+`String expected: `+e);e=String(e)}K(t,2,y.length,`Base`),S(l,e.replace(a,``),t,e)}}b.clone=H,b.ROUND_UP=0,b.ROUND_DOWN=1,b.ROUND_CEIL=2,b.ROUND_FLOOR=3,b.ROUND_HALF_UP=4,b.ROUND_HALF_DOWN=5,b.ROUND_HALF_EVEN=6,b.ROUND_HALF_CEIL=7,b.ROUND_HALF_FLOOR=8,b.EUCLID=9,b.config=b.set=function(e){var t,n;if(e!=null){if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(c=K(e[t],0,V,t)),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(l=K(e[t],0,8,t)),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],q(n)?(K(n[0],-V,0,t),K(n[1],0,V,t),u=n[0],d=n[1]):u=-(d=K(n,-V,V,t)<0?-n:n)),e.hasOwnProperty(t=`RANGE`)){if(n=e[t],n)q(n)?(K(n[0],-V,-1,t),K(n[1],1,V,t),f=n[0],p=n[1]):f=-(p=K(n,-V,V,t)<0?-n:n);else throw Error(F+t+` cannot be zero: `+n)}if(e.hasOwnProperty(t=`CRYPTO`)){if(n=e[t],n===!!n){if(n){if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=n;else throw m=!n,Error(F+`crypto unavailable`)}else m=n}else throw Error(F+t+` not true or false: `+n)}if(e.hasOwnProperty(t=`STRICT`)){if(n=e[t],n===!!n)h=n;else throw Error(F+t+` not true or false: `+n)}if(e.hasOwnProperty(t=`MODULO_MODE`)&&(g=K(e[t],0,9,t)),e.hasOwnProperty(t=`POW_PRECISION`)&&(_=K(e[t],0,V,t)),e.hasOwnProperty(t=`FORMAT`)){if(n=e[t],typeof n==`object`)for(t in n)n.hasOwnProperty(t)&&v.hasOwnProperty(t)&&(v[t]=n[t]);else throw Error(F+t+` not an object: `+n)}if(e.hasOwnProperty(t=`ALPHABET`)){if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))y=n;else throw Error(F+t+` invalid: `+n)}}else throw Error(F+`Object expected: `+e)}return{DECIMAL_PLACES:c,ROUNDING_MODE:l,EXPONENTIAL_AT:[u,d],RANGE:[f,p],CRYPTO:m,STRICT:h,MODULO_MODE:g,POW_PRECISION:_,FORMAT:v,ALPHABET:y}},b.fromFormat=function(e,t){if(typeof e!=`string`)throw Error(F+`Not a string: `+e);if(t==null)t=v;else if(typeof t!=`object`)throw Error(F+`Argument not an object: `+t);else t=D(t);var n,r,i,a,o=t.negativeSign||`-`,s=t.positiveSign||``,c=t.prefix||``,l=t.suffix||``,u=t.groupSeparator||``,d=t.decimalSeparator||`.`,f=t.fractionGroupSeparator||``;if(c&&e.indexOf(c)===0&&(e=e.slice(c.length)),l&&e.lastIndexOf(l)===e.length-l.length&&(e=e.slice(0,-l.length)),o&&e.indexOf(o)===0?(e=e.slice(o.length),r=!0):s&&e.indexOf(s)===0&&(e=e.slice(s.length)),n=e.indexOf(d),n<0){if(u)for(;e.indexOf(u)>-1;)e=e.replace(u,``)}else{if(i=e.slice(0,n),a=e.slice(n+d.length),u)for(;i.indexOf(u)>-1;)i=i.replace(u,``);if(f)for(;a.indexOf(f)>-1;)a=a.replace(f,``);e=i+`.`+a}return new b(r?`-`+e:e)},b.isBigNumber=function(e){if(!w(e))return!1;var t,n,r=e.c,i=e.e,a=e.s;if(!q(r))return r===null&&i===null&&(a===null||a===1||a===-1);if(a!==1&&a!==-1||i<-V||i>V||i!==P(i))return!1;if(r[0]===0)return i===0&&r.length===1;if(t=(i+1)%L,t<1&&(t+=L),String(r[0]).length!==t)return!1;for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=I||n!==P(n))return!1;return n!==0},b.maximum=b.max=function(){return T(arguments,-1)},b.minimum=b.min=function(){return T(arguments,1)},b.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return P(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,a,o,l=0,u=[],d=new b(s);if(e=e==null?c:K(e,0,V),a=N(e/L),m){if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(a*=2));l<a;)o=n[l]*131072+(n[l+1]>>>11),o>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(o%0x5af3107a4000),l+=2);l=a/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(a*=7);l<a;)o=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],o>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(o%0x5af3107a4000),l+=7);l=a/7}else throw m=!1,Error(F+`crypto unavailable`)}if(!m)for(;l<a;)o=t(),o<9e15&&(u[l++]=o%0x5af3107a4000);for(a=u[--l],e%=L,a&&e&&(o=z[L-e],u[l]=P(a/o)*o);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=L);for(l=1,o=u[0];o>=10;o/=10,l++);l<L&&(i-=L-l)}return d.e=i,d.c=u,d}})(),b.sum=function(){for(var e=0,t=new b(0);e<arguments.length;)t=t.plus(arguments[e++]);return t};function x(e,t){var n,r,i;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;r++);for(i=t.length;t.charCodeAt(--i)===48;);if(t=t.slice(r,++i)){if(i-=r,n=n-r-1,n>p)e.c=e.e=null;else if(n<f)e.c=[e.e=0];else{if(e.e=n,e.c=[],r=(n+1)%L,n<0&&(r+=L),r<i){for(r&&e.c.push(+t.slice(0,r)),i-=L;r<i;)e.c.push(+t.slice(r,r+=L));r=L-(t=t.slice(r)).length}else r-=i;for(;r--;t+=`0`);e.c.push(+t)}}else e.c=[e.e=0]}function S(e,t,r,i){var a,o,s=y.slice(0,r),c=0,l=``,u=!1,d=!1,f=!1;for(e.s=t.charCodeAt(0)===45?(t=t.slice(1),-1):1,o=t.length;c<o;c++){if(a=t.charAt(c),s.indexOf(a)>=0){l+=a,d=!0;continue}if(a==`_`){if(d&&c+1<o){d=!1;continue}}else if(a==`.`){if(c==0||!u&&d){if(c+1==o)break;c==0&&(l=`0`),l+=a,u=!0,d=!1;continue}}else if(!f&&(t==t.toUpperCase()&&s==s.toLowerCase()&&(t=t.toLowerCase())||t==t.toLowerCase()&&s==s.toUpperCase()&&(t=t.toUpperCase()))){c=-1,l=``,f=!0,u=d=!1;continue}if(h)throw Error(F+`Not a base `+r+` number: `+i);e.s=e.c=e.e=null;return}x(e,n(l,r,10,e.s))}n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,o,s){var u,d,f,p,m,h,g,v,x=r.indexOf(`.`),S=c,C=l;for(x>=0&&(p=_,_=0,r=r.replace(`.`,``),v=new b(i),h=v.pow(r.length-x),_=p,v.c=n(X(W(h.c),h.e,`0`),10,a,e),v.e=v.c.length),g=n(r,i,a,s?(u=y,e):(u=e,y)),f=p=g.length;g[--p]==0;g.pop());if(!g[0])return u.charAt(0);if(x<0?--f:(h.c=g,h.e=f,h.s=o,h=t(h,v,S,C,a),g=h.c,m=h.r,f=h.e),d=f+S+1,x=g[d],p=a/2,m=m||d<0||g[d+1]!=null,m=C<4?(x!=null||m)&&(C==0||C==(h.s<0?3:2)):x>p||x==p&&(C==4||m||C==6&&g[d-1]&1||C==(h.s<0?8:7)),d<1||!g[0])r=m?X(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(d<g.length&&(g.length=d),m)for(--a;++g[--d]>a;)g[d]=0,d||(++f,g=[1].concat(g));for(p=g.length;!g[--p];);for(x=0,r=``;x<=p;r+=u.charAt(g[x++]));r=X(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%B,u=t/B|0;for(e=e.slice();c--;)a=e[c]%B,o=e[c]/B|0,r=u*a+o*l,i=l*a+r%B*B+s,s=(i/n|0)+(r/B|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,v,y,x,S,C,w,T,E=r.s==i.s?1:-1,D=r.c,k=i.c;if(!D||!D[0]||!k||!k[0])return new b(!r.s||!i.s||(D?k&&D[0]==k[0]:!k)?NaN:D&&D[0]==0||!k?E*0:E/0);for(h=new b(E),g=h.c=[],l=r.e-i.e,E=a+l+1,s||(s=I,l=U(r.e/L)-U(i.e/L),E=E/L|0),u=0;k[u]==(D[u]||0);u++);if(k[u]>(D[u]||0)&&l--,E<0)g.push(1),d=!0;else{for(S=D.length,w=k.length,u=0,E+=2,f=P(s/(k[0]+1)),f>1&&(k=e(k,f,s),D=e(D,f,s),w=k.length,S=D.length),x=w,_=D.slice(0,w),v=_.length;v<w;_[v++]=0);T=k.slice(),T=[0].concat(T),C=k[0],k[1]>=s/2&&C++;do{if(f=0,c=t(k,_,w,v),c<0){if(y=_[0],w!=v&&(y=y*s+(_[1]||0)),f=P(y/C),f>1)for(f>=s&&(f=s-1),p=e(k,f,s),m=p.length,v=_.length;t(p,_,m,v)==1;)f--,n(p,w<m?T:k,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=k.slice(),m=p.length;if(m<v&&(p=[0].concat(p)),n(_,p,v,s),v=_.length,c==-1)for(;t(k,_,w,v)<1;)f++,n(_,w<v?T:k,v,s),v=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[v++]=D[x]||0:(_=[D[x]],v=1)}while((x++<S||_[0]!=null)&&E--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==I){for(u=1,E=g[0];E>=10;E/=10,u++);O(h,a+(h.e=u+l*L-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function C(e,t,n,r){var i,a,o,s,c;if(n=n==null?l:K(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)c=W(e.c),c=r==1||r==2&&(o<=u||o>=d)?Y(c,o):X(c,o,`0`);else if(e=O(new b(e),t,n),a=e.e,c=W(e.c),s=c.length,r==1||r==2&&(t<=a||a<=u)){for(;s<t;c+=`0`,s++);c=Y(c,a)}else if(t-=o+(r===2&&a>o),c=X(c,a,`0`),a+1>s){if(--t>0)for(c+=`.`;t--;c+=`0`);}else if(t+=a-s,t>0)for(a+1==s&&(c+=`.`);t--;c+=`0`);return e.s<0&&i?`-`+c:c}function w(e){return e instanceof b||!!e&&e._isBigNumber===!0}function T(e,t){for(var n,r,i=1,a=new b(e[0]);i<e.length;i++)r=new b(e[i]),(!r.s||(n=G(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function E(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*L-1)>p?e.c=e.e=null:n<f?e.c=[e.e=0]:(e.e=n,e.c=t),e}function D(e){var t,n={};for(t in v)v.hasOwnProperty(t)&&(n[t]=e.hasOwnProperty(t)?e[t]:v[t]);return n}function O(e,t,n,r){var i,a,o,s,c,l,u,d=e.c,m=z;if(d){out:{for(i=1,s=d[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=L,o=t,c=d[l=0],u=P(c/m[i-o-1]%10);else if(l=N((a+1)/L),l>=d.length){if(r){for(;d.length<=l;d.push(0));c=u=0,i=1,a%=L,o=a-L+1}else break out}else{for(c=s=d[l],i=1;s>=10;s/=10,i++);a%=L,o=a-L+i,u=o<0?0:P(c/m[i-o-1]%10)}if(r=r||t<0||d[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(u||r)&&(n==0||n==(e.s<0?3:2)):u>5||u==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:d[l-1])%10&1||n==(e.s<0?8:7)),t<1||!d[0])return d.length=0,r?(t-=e.e+1,d[0]=m[(L-t%L)%L],e.e=-t||0):d[0]=e.e=0,e;if(a==0?(d.length=l,s=1,l--):(d.length=l+1,s=m[L-a],d[l]=o>0?P(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=d[0];o>=10;o/=10,a++);for(o=d[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,d[0]==I&&(d[0]=1));break}else{if(d[l]+=s,d[l]!=I)break;d[l--]=0,s=1}for(a=d.length;d[--a]===0;d.pop());}e.e>p?e.c=e.e=null:e.e<f&&(e.c=[e.e=0])}return e}function k(e){var t,n=e.e;return n===null?e.toString():(t=W(e.c),t=n<=u||n>=d?Y(t,n):X(t,n,`0`),e.s<0?`-`+t:t)}return o.absoluteValue=o.abs=function(){var e=new b(this);return e.s<0&&(e.s=1),e},o.comparedTo=function(e,t){return G(this,new b(e,t))},o.decimalPlaces=o.dp=function(e,t){var n,r,i,a=this;if(e!=null)return O(new b(a),K(e,-V,V)+a.e+1,t==null?l:K(t,0,8));if(!(n=a.c))return null;if(r=((i=n.length-1)-U(this.e/L))*L,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},o.dividedBy=o.div=function(e,n){return t(this,new b(e,n),c,l)},o.dividedToIntegerBy=o.idiv=function(e,n){return t(this,new b(e,n),0,1)},o.exponentiatedBy=o.pow=function(e,t){var n,r,i,a,o,c,u,d,f,p=this;if(e=new b(e),e.c&&!e.isInteger())throw Error(F+`Exponent not an integer: `+k(e));if(t!=null&&(t=new b(t)),c=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new b(k(p)**(c?e.s*(2-J(e)):+k(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new b(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||c&&p.c[1]>=24e7:p.c[0]<8e13||c&&p.c[0]<=9999975e7)))return a=p.s<0&&J(e)?-0:0,p.e>-1&&(a=1/a),new b(u?1/a:a);else _&&(a=N(_/L+2));for(c?(n=new b(.5),u&&(e.s=1),d=J(e)):(i=Math.abs(+k(e)),d=i%2),f=new b(s);;){if(d){if(f=f.times(p),!f.c)break;a?f.c.length>a&&(f.c.length=a):r&&(f=f.mod(t))}if(i){if(i=P(i/2),i===0)break;d=i%2}else if(e=e.times(n),O(e,e.e+1,1),e.e>14)d=J(e);else{if(i=+k(e),i===0)break;d=i%2}p=p.times(p),a?p.c&&p.c.length>a&&(p.c.length=a):r&&(p=p.mod(t))}return r?f:(u&&(f=s.div(f)),t?f.mod(t):a?O(f,_,l,o):f)},o.integerValue=function(e){var t=new b(this);return O(t,t.e+1,e==null?l:K(e,0,8))},o.isEqualTo=o.eq=function(e,t){return G(this,new b(e,t))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(e,t){return G(this,new b(e,t))>0},o.isGreaterThanOrEqualTo=o.gte=function(e,t){return(t=G(this,new b(e,t)))===1||t===0},o.isInteger=function(){return!!this.c&&U(this.e/L)>this.c.length-2},o.isLessThan=o.lt=function(e,t){return G(this,new b(e,t))<0},o.isLessThanOrEqualTo=o.lte=function(e,t){return(t=G(this,new b(e,t)))===-1||t===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(e,t){var n,r,i,a,o=this,s=o.s;if(e=new b(e,t),t=e.s,!s||!t)return new b(NaN);if(s!=t)return e.s=-t,o.plus(e);var c=o.e/L,u=e.e/L,d=o.c,f=e.c;if(!c||!u){if(!d||!f)return d?(e.s=-t,e):new b(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new b(d[0]?o:l==3?-0:0)}if(c=U(c),u=U(u),d=d.slice(),s=c-u){for((a=s<0)?(s=-s,i=d):(u=c,i=f),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(r=(a=(s=d.length)<(t=f.length))?s:t,s=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=I-1;r>s;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=I}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?E(e,d,u):(e.s=l==3?-1:1,e.c=[e.e=0],e)},o.modulo=o.mod=function(e,n){var r,i,a=this;return e=new b(e,n),!a.c||!e.s||e.c&&!e.c[0]?new b(NaN):!e.c||a.c&&!a.c[0]?new b(a):(g==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,g),e=a.minus(r.times(e)),!e.c[0]&&g==1&&(e.s=a.s),e)},o.multipliedBy=o.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,v=_.c,y=(e=new b(e,t)).c;if(!v||!y||!v[0]||!y[0])return!_.s||!e.s||v&&!v[0]&&!y||y&&!y[0]&&!v?e.c=e.e=e.s=null:(e.s*=_.s,!v||!y?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=U(_.e/L)+U(e.e/L),e.s*=_.s,c=v.length,d=y.length,c<d&&(m=v,v=y,y=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=I,g=B,i=d;--i>=0;){for(n=0,f=y[i]%g,p=y[i]/g|0,o=c,a=i+o;a>i;)l=v[--o]%g,u=v[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),E(e,m,r)},o.negated=function(){var e=new b(this);return e.s=-e.s||null,e},o.plus=function(e,t){var n,r=this,i=r.s;if(e=new b(e,t),t=e.s,!i||!t)return new b(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/L,o=e.e/L,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new b(i/0);if(!s[0]||!c[0])return c[0]?e:new b(s[0]?r:i*0)}if(a=U(a),o=U(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/I|0,s[t]=I===s[t]?0:s[t]%I;return i&&(s=[i].concat(s),++o),E(e,s,o)},o.precision=o.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return O(new b(a),K(e,1,V),t==null?l:K(t,0,8));if(!(n=a.c))return null;if(i=n.length-1,r=i*L+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},o.shiftedBy=function(e){return this.times(`1e`+K(e,-R,R))},o.squareRoot=o.sqrt=function(){var e,n,r,i,a,o=this,s=o.c,u=o.s,d=o.e,f=c+4,p=new b(`0.5`);if(u!==1||!s||!s[0])return new b(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if(u=Math.sqrt(+k(o)),u==0||u==1/0?(n=W(s),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=U((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new b(n)):r=new b(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(o,a,f,1))),W(a.c).slice(0,u)===(n=W(r.c)).slice(0,u)){if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(O(a,a.e+c+2,0),a.times(a).eq(o))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(O(r,r.e+c+2,1),e=!r.times(r).eq(o));break}}}return O(r,r.e+c+1,l,e)},typeof BigInt==`function`&&(o.toBigInt=function(e){var t=this;return t.c?BigInt(C(t,t.e+1,e)):null}),o.toExponential=function(e,t){return C(this,e==null?e:K(e,0,V)+1,t,1)},o.toFixed=function(e,t){return C(this,e==null?e:K(e,-V,V)+this.e+1,t)},o.toFormat=function(e,t,n){var r,i,a,o,s=this;if(n==null)n=v,e!=null&&(t==null?typeof e==`object`&&!q(e)&&(n=D(e),e=t=null):typeof t==`object`&&(n=D(t),t=null));else if(typeof n!=`object`)throw Error(F+`Argument not an object: `+n);else n=D(n);if(e!=null){if(q(e)&&e.length<=2){if(i=e[0],a=e[1],e=s.dp(),a!=null&&e>K(a,0,V)&&(e=a),i!=null&&K(i,0,V)!==0){if(a!=null&&i>a)throw Error(F+`Minimum must not exceed maximum`);e<i&&(e=i)}}else K(e,-V,V)}if(o=s.toFixed(e,t),r=o.charCodeAt(0)===45,r&&(o=o.slice(1)),s.c){var c,l=o.split(`.`),u=+n.groupSize,d=+n.secondaryGroupSize,f=n.groupSeparator||``,p=l[0],m=l[1],h=p.length;if(d&&(c=u,u=d,d=c,h-=c),u>0&&h>0){for(c=h%u||u,o=p.substr(0,c);c<h;c+=u)o+=f+p.substr(c,u);d>0&&(o+=f+p.slice(c))}else o=p;m&&(c=+n.fractionGroupSize,c&&(m=m.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``))),o+=(n.decimalSeparator||``)+m)}return(n.prefix||``)+(r?n.negativeSign||``:s.s>0&&n.positiveSign||``)+o+(n.suffix||``)},o.toFraction=function(e){var n,r,i,a,o,c,l,u,d,f,m,h,g,_,v=this,y=v.c;if(e!=null&&(l=new b(e),!l.isInteger()&&(l.c||l.s!==1)||l.lt(s)))throw Error(F+`Argument `+(l.isInteger()?`out of range: `:`not an integer: `)+k(l));if(!y)return[new b(v.s||0),new b(0)];for(n=new b(s),d=r=new b(s),i=u=new b(s),h=W(y),o=n.e=h.length-v.e-1,n.c[0]=z[(c=o%L)<0?L+c:c],e=!e||l.comparedTo(n)>0?o>0?n:d:l,c=p,p=1/0,l=new b(h),_=l,g=n,u.c[0]=0;f=t(l,n,0,1),a=r.plus(f.times(i)),a.comparedTo(e)!=1;)r=i,i=a,d=u.plus(f.times(a=d)),u=a,n=l.minus(f.times(a=n)),l=a;return a=t(e.minus(r),i,0,1),u=u.plus(a.times(d)),r=r.plus(a.times(i)),m=d.times(g).minus(_.times(i)).abs().times(r).comparedTo(u.times(g).minus(_.times(r)).abs().times(i))<1?[d,i]:[u,r],m[0].s=v.s,p=c,m},o.toNumber=function(){return+k(this)},o.toObject=function(){var e=this;return{c:e.c?e.c.slice():null,e:e.e,s:e.s}},o.toPrecision=function(e,t){return C(this,e==null?e:K(e,1,V),t,2)},o.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=u||a>=d?Y(W(r.c),a):X(W(r.c),a,`0`):(K(e,2,y.length,`Base`),t=n(X(W(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},o.valueOf=o.toJSON=function(){return k(this)},o._isBigNumber=!0,e!=null&&b.set(e),b}function U(e){var t=e|0;return e>0||e===t?t:t-1}function W(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=L-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function G(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function K(e,t,n,r){if(e<t||e>n||e!==P(e))throw Error(F+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e));return e}function q(e){return{}.toString.call(e)==`[object Array]`}function J(e){var t=e.c.length-1;return U(e.e/L)==t&&e.c[t]%2!=0}function Y(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function X(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}M.config({DECIMAL_PLACES:20,ROUNDING_MODE:M.ROUND_HALF_UP,FORMAT:{prefix:``,decimalSeparator:`.`,groupSeparator:`,`,groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:` `,fractionGroupSize:0,suffix:``}});var ae=e=>M.isBigNumber(e)?e:new M(e),Z=()=>new M(0),oe=e=>e.reduce((e,t)=>e.plus(t),Z()),se=(e,t)=>e.decimalPlaces(t,M.ROUND_DOWN),ce=e=>{if(!e.isFinite()||!e.isInteger())return null;let t=Number(e.toFixed(0));return Number.isSafeInteger(t)?t:null},le=e=>n(`Rejected API response entry`).pipe(a({event:`api_decode_rejection`,operation:e.operation,location:String(e.location),issue:e.issue,...e.identifier?{identifier:e.identifier}:{}})),ue=e=>n(`Ignored invalid optional API response field`).pipe(a({event:`api_decode_field_rejection`,operation:e.operation,field:e.field,issue:e.issue})),de=b([s.check(y()),S]),fe=de.pipe(p(h(M).check(_(e=>e.isFinite()?!0:`expected a finite decimal`)),A({decode:e=>new M(e),encode:e=>e.toFixed()}))),pe=_(e=>e.isGreaterThanOrEqualTo(0)?!0:`expected a finite non-negative decimal`),me=fe.check(pe),he=S.check(_(e=>Number.isSafeInteger(e)?!0:`expected a safe integer Base Unit Amount`)).pipe(p(C,A({decode:e=>BigInt(e),encode:e=>Number(e)}))),ge=b([T,he]),_e=w,ve=(n,r)=>{let a=m(_e)(n);return e(a,{onFailure:()=>ue({...r,issue:`invalid UTC date-time`}).pipe(i(void 0)),onSuccess:e=>t(e)})},ye=e=>d.pipe(p(o(g),{decode:f(n=>n===void 0?t(void 0):ve(n,e)),encode:ee(e=>e===void 0?void 0:x(e))})),be=e=>d.pipe(p(O(g),{decode:f(n=>n===null?t(null):ve(n,e).pipe(r(e=>e??null))),encode:ee(e=>e===null?null:x(e))})),xe={id:`ledgerLive`,name:`Ledger Live`,type:`ledgerLive`},Se=e=>e.id===xe.id,Ce=e=>{let t=Number(e);return Number.isNaN(t)?e:t},we=c(e=>typeof e==`string`&&e.startsWith(`0x`),{expected:`a 0x-prefixed hex string`}),Te=c(e=>typeof e==`string`&&e.startsWith(`0x`),{expected:`a 0x-prefixed address`}),Ee=s.check(_(e=>ne(e)&&e.length>2?!0:`expected a 0x-prefixed hex quantity`)).pipe(p(C,A({decode:e=>re(e),encode:e=>j(e)}))),Q=b([ge,Ee]),De={data:we,to:Te,gasLimit:Q,from:Te,value:E(Q),type:S,gasPrice:E(Q),maxFeePerGas:E(Q),maxPriorityFeePerGas:E(Q),chainId:S},Oe=k({...De,nonce:S}),ke=k({...De,nonce:E(S)}),Ae=Oe,je=ke,Me=l(Oe),Ne=l(ke),Pe=e=>u(Me)(e),Fe=e=>u(Ne)(e),Ie=(e,t)=>({to:e.to,from:t,data:e.data,value:e.value?j(e.value):void 0,gas:j(e.gasLimit),chainId:j(e.chainId),...e.maxFeePerGas?{type:`0x2`,maxFeePerGas:j(e.maxFeePerGas),maxPriorityFeePerGas:e.maxPriorityFeePerGas?j(e.maxPriorityFeePerGas):void 0}:{type:`0x1`,gasPrice:e.gasPrice?j(e.gasPrice):void 0}}),Le=({address:e,tx:t})=>Pe(t).pipe(r(t=>({...Ie(t,e),nonce:j(t.nonce)}))),Re=({address:e,tx:t})=>Fe(t).pipe(r(t=>({...Ie(t,e),...t.nonce===void 0?{}:{nonce:j(t.nonce)}}))),$=c(e=>typeof e==`string`&&e.startsWith(`0x`),{expected:`a 0x-prefixed hex string`}),ze=k({tx:k({address:s,assetId:E($),blockHash:$,blockNumber:$,era:$,genesisHash:$,metadataHash:E($),method:s,mode:E(S),nonce:$,specVersion:$,tip:$,transactionVersion:$,signedExtensions:D(s),version:S,metadataRpc:$}),specName:s,specVersion:S,metadataRpc:$}),Be=k({raw_data:k({contract:D(te(s,d)),ref_block_bytes:s,ref_block_hash:s,expiration:S,timestamp:S,data:E(d),fee_limit:E(d)}),raw_data_hex:s,txID:s,visible:v});export{ce as C,oe as S,M as T,ye as _,Fe as a,ae as b,Ae as c,Se as d,ge as f,be as g,me as h,Le as i,Ce as l,de as m,ze as n,Pe as o,fe as p,Re as r,je as s,Be as t,xe as u,_e as v,se as w,Z as x,le as y};
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-Bi9XWFK_.js","assets/rolldown-runtime-BcKkbAw3.js","assets/preload-helper-Czpn1I53.js","assets/ccip-B_AhQiTz.js","assets/sha3-DTWsE4Uo.js","assets/_u64-DvzUbHl5.js","assets/dist-KkMRwAp9.js","assets/esm-DhvlA6gG.js","assets/events-D2w4OsQJ.js","assets/browser-ponyfill-8IsXQqGl.js","assets/dist-C9i0DjyB.js","assets/dist-D6L6gF64.js","assets/index.es-6FknJabw.js","assets/index.es-B-vaqu71.js","assets/dist-BHChSLxz.js","assets/hmac-DLdeyits.js","assets/sha256-B81eAX-m.js","assets/ed25519-0TVA-MrV.js","assets/_shortw_utils-CJZriuc4.js","assets/blake2-BPYQln8q.js","assets/esm-DZjVTWAH.js","assets/p256-DKsvZ-ph.js","assets/decode-B1mGgaTx.js","assets/secp256k1-BAgBRavp.js","assets/src-BQKX1b8C.js","assets/blakejs-Dx-Zt5zT.js","assets/index.es-T9HFgs0N.js","assets/ErrorUtil-CjEnAyFI.js","assets/ApiController-BRggqGtG.js","assets/_esm-DNvytb5d.js","assets/big-BfyPLUzq.js","assets/utils-AEPG6q4V.js","assets/dist-3rZ7a0-t.js","assets/OnRampController-BTHuxmxh.js","assets/EnsController-DZBT7JrI.js","assets/SIWXUtil-CbZgb35H.js","assets/AlertController-C4QMb9zQ.js","assets/ExchangeUtil-DiG0VUVl.js","assets/exports-CcJGSHE3.js","assets/lit-element-Bu7U205x.js","assets/lit-CGi58pjh.js","assets/ConstantsUtil-svG7evKJ.js","assets/CaipNetworkUtil-C2hZiE_H.js","assets/fallback-hOVnOuYU.js","assets/HelpersUtil-nfG-SHh4.js","assets/dist-ByoS-OZt.js"])))=>i.map(i=>d[i]);
2
- import{r as e,s as t,t as n}from"./rolldown-runtime-BcKkbAw3.js";import{n as r,t as i}from"./dist-C9i0DjyB.js";import{j as a,n as o,t as s}from"./wagmi-connect-result-CqXaJhOa.js";import{n as c,t as l}from"./dist-D6L6gF64.js";import{t as u}from"./preload-helper-Czpn1I53.js";import{a as d,n as f,r as p,t as m}from"./assets-CaBpoNKF.js";import{n as h,r as g,t as _}from"./dist-KkMRwAp9.js";import{t as v}from"./eventemitter3-DqfHna5i.js";import{n as y,t as b}from"./Transport-DCf5RHQn.js";import{o as x}from"./configured-chains-C5lih9lm.js";import{t as S}from"./tron-connector-meta-8UgQa4LI.js";import{a as ee,c as te,i as C,l as ne,n as re,o as w,s as ie,t as ae}from"./sha256-BQ-kmMHy.js";import{t as T}from"./axios-BywHQoip.js";import{n as oe,t as se}from"./bignumber-BbCu7eB7.js";g();var ce={},le={},ue=(e,t)=>{le[e]=t},E=e=>{class t extends Error{cause;constructor(n,r,i){if(super(n||e,i),Object.setPrototypeOf(this,t.prototype),this.name=e,r)for(let e in r)this[e]=r[e];if(i&&de(i)&&`cause`in i&&!this.cause){let e=i.cause;this.cause=e,`stack`in e&&(this.stack=this.stack+`
2
+ import{r as e,s as t,t as n}from"./rolldown-runtime-BcKkbAw3.js";import{n as r,t as i}from"./dist-C9i0DjyB.js";import{j as a,n as o,t as s}from"./wagmi-connect-result-DOu6hDDM.js";import{n as c,t as l}from"./dist-D6L6gF64.js";import{t as u}from"./preload-helper-Czpn1I53.js";import{a as d,n as f,r as p,t as m}from"./assets-CaBpoNKF.js";import{n as h,r as g,t as _}from"./dist-KkMRwAp9.js";import{t as v}from"./eventemitter3-DqfHna5i.js";import{n as y,t as b}from"./Transport-DCf5RHQn.js";import{o as x}from"./configured-chains-BVaAJPl7.js";import{t as S}from"./tron-connector-meta-8UgQa4LI.js";import{a as ee,c as te,i as C,l as ne,n as re,o as w,s as ie,t as ae}from"./sha256-BQ-kmMHy.js";import{t as T}from"./axios-BywHQoip.js";import{n as oe,t as se}from"./bignumber-BbCu7eB7.js";g();var ce={},le={},ue=(e,t)=>{le[e]=t},E=e=>{class t extends Error{cause;constructor(n,r,i){if(super(n||e,i),Object.setPrototypeOf(this,t.prototype),this.name=e,r)for(let e in r)this[e]=r[e];if(i&&de(i)&&`cause`in i&&!this.cause){let e=i.cause;this.cause=e,`stack`in e&&(this.stack=this.stack+`
3
3
  CAUSE: `+e.stack)}}}return ce[e]=t,t};function de(e){return typeof e==`object`}E(`AccountNameRequired`),E(`AccountNotSupported`),E(`AccountAwaitingSendPendingOperations`),E(`AmountRequired`),E(`BluetoothRequired`),E(`BtcUnmatchedApp`),E(`CantOpenDevice`),E(`CashAddrNotSupported`),E(`ClaimRewardsFeesWarning`),E(`CurrencyNotSupported`),E(`DeviceAppVerifyNotSupported`),E(`DeviceGenuineSocketEarlyClose`),E(`DeviceNotGenuine`),E(`DeviceOnDashboardExpected`),E(`DeviceOnDashboardUnexpected`),E(`DeviceInOSUExpected`),E(`DeviceHalted`),E(`DeviceNameInvalid`),E(`DeviceSocketFail`),E(`DeviceSocketNoBulkStatus`),E(`DeviceSocketNoBulkStatus`),E(`UnresponsiveDeviceError`);var fe=E(`DisconnectedDevice`),pe=E(`DisconnectedDeviceDuringOperation`);E(`DeviceExtractOnboardingStateError`),E(`DeviceOnboardingStatePollingError`),E(`EnpointConfig`),E(`EthAppPleaseEnableContractData`),E(`SolAppPleaseEnableContractData`),E(`CeloAppPleaseEnableContractData`),E(`FeeEstimationFailed`),E(`FirmwareNotRecognized`),E(`HardResetFail`),E(`InvalidXRPTag`),E(`InvalidAddress`),E(`InvalidTransactionError`),E(`InvalidNonce`),E(`InvalidAddressBecauseDestinationIsAlsoSource`),E(`LatestMCUInstalledError`),E(`LatestFirmwareVersionRequired`),E(`UnsupportedFeatureError`),E(`NanoSNotSupported`),E(`UnknownMCU`),E(`LedgerAPIError`),E(`LedgerAPIErrorWithMessage`),E(`LedgerAPINotAvailable`),E(`ManagerAppAlreadyInstalled`),E(`ManagerAppRelyOnBTC`),E(`ManagerAppDepInstallRequired`),E(`ManagerAppDepUninstallRequired`),E(`ManagerDeviceLocked`),E(`ManagerFirmwareNotEnoughSpace`),E(`ManagerNotEnoughSpace`),E(`ManagerUninstallBTCDep`),E(`NetworkDown`),E(`NetworkError`),E(`NoAddressesFound`),E(`NotEnoughBalance`),E(`NotEnoughBalanceFees`),E(`NotEnoughBalanceSwap`),E(`NotEnoughBalanceToDelegate`),E(`UnstakeNotEnoughStakedBalanceLeft`),E(`RestakeNotEnoughStakedBalanceLeft`),E(`NotEnoughToRestake`),E(`NotEnoughToUnstake`),E(`NotEnoughBalanceInParentAccount`),E(`NotEnoughSpendableBalance`),E(`NotEnoughBalanceBecauseDestinationNotCreated`),E(`NotEnoughToStake`),E(`NoAccessToCamera`),E(`NotEnoughGas`),E(`NotEnoughGasSwap`),E(`TronEmptyAccount`),E(`MaybeKeepTronAccountAlive`),E(`NotSupportedLegacyAddress`),E(`GasLessThanEstimate`),E(`PriorityFeeTooLow`),E(`PriorityFeeTooHigh`),E(`PriorityFeeHigherThanMaxFee`),E(`MaxFeeTooLow`),E(`PasswordsDontMatch`),E(`PasswordIncorrect`),E(`RecommendSubAccountsToEmpty`),E(`RecommendUndelegation`),E(`TimeoutTagged`),E(`UnexpectedBootloader`),E(`MCUNotGenuineToDashboard`),E(`RecipientRequired`),E(`UnavailableTezosOriginatedAccountReceive`),E(`UnavailableTezosOriginatedAccountSend`),E(`UpdateFetchFileFail`),E(`UpdateIncorrectHash`),E(`UpdateIncorrectSig`),E(`UpdateYourApp`),E(`UserRefusedDeviceNameChange`),E(`UserRefusedAddress`),E(`UserRefusedFirmwareUpdate`),E(`UserRefusedAllowManager`),E(`UserRefusedOnDevice`),E(`PinNotSet`),E(`ExpertModeRequired`);var me=E(`TransportOpenUserCancelled`);E(`TransportInterfaceNotAvailable`),E(`TransportRaceCondition`),E(`TransportWebUSBGestureRequired`),E(`TransactionHasBeenValidatedError`),E(`TransportExchangeTimeoutError`),E(`DeviceShouldStayInApp`),E(`WebsocketConnectionError`),E(`WebsocketConnectionFailed`),E(`WrongDeviceForAccount`),E(`WrongDeviceForAccountPayout`),E(`MissingSwapPayloadParamaters`),E(`WrongDeviceForAccountRefund`),E(`WrongAppForCurrency`),E(`ETHAddressNonEIP`),E(`CantScanQRCode`),E(`FeeNotLoaded`),E(`FeeNotLoadedSwap`),E(`FeeRequired`),E(`FeeTooHigh`),E(`ValAddressRequired`),E(`RedelegateDstValAddressRequired`),E(`PendingOperation`),E(`SyncError`),E(`PairingFailed`),E(`PeerRemovedPairing`),E(`GenuineCheckFailed`),E(`LedgerAPI4xx`),E(`LedgerAPI5xx`),E(`FirmwareOrAppUpdateRequired`),E(`ReplacementTransactionUnderpriced`),E(`OpReturnSizeLimit`),E(`DustLimit`),E(`ConcordiumInsufficientFunds`),E(`ConcordiumMemoTooLong`),E(`ConcordiumPairingExpiredError`),E(`ConcordiumSessionExpiredError`),E(`ConcordiumTrustedMetadataServiceError`),E(`ConcordiumAddressVerificationFailedError`),E(`ConcordiumInvalidMaxFeeError`),E(`LanguageNotFound`),E(`NoDBPathGiven`),E(`DBWrongPassword`),E(`DBNotReset`),E(`SequenceNumberError`),E(`DisabledTransactionBroadcastError`),E(`InvalidParameterError`);var he;(function(e){e.Unknown=`Unknown`,e.LocationServicesDisabled=`LocationServicesDisabled`,e.LocationServicesUnauthorized=`LocationServicesUnauthorized`,e.BluetoothScanStartFailed=`BluetoothScanStartFailed`})(he||={});var ge=class extends Error{id;constructor(e,t){let n=`TransportError`;super(e||n),this.name=n,this.message=e,this.stack=Error(e).stack,this.id=t}};ue(`TransportError`,e=>new ge(e.message,e.id));var _e={ACCESS_CONDITION_NOT_FULFILLED:38916,ALGORITHM_NOT_SUPPORTED:38020,CLA_NOT_SUPPORTED:28160,CLA_NOT_SUPPORTED_BOOTLOADER:28161,CODE_BLOCKED:38976,CODE_NOT_INITIALIZED:38914,COMMAND_INCOMPATIBLE_FILE_STRUCTURE:27009,CONDITIONS_OF_USE_NOT_SATISFIED:27013,CONTRADICTION_INVALIDATION:38928,CONTRADICTION_SECRET_CODE_STATUS:38920,DEVICE_IN_RECOVERY_MODE:26159,CUSTOM_IMAGE_EMPTY:26158,FILE_ALREADY_EXISTS:27273,FILE_NOT_FOUND:37892,GP_AUTH_FAILED:25344,HALTED:28586,INCONSISTENT_FILE:37896,INCORRECT_DATA:27264,INCORRECT_LENGTH:26368,INCORRECT_P1_P2:27392,INS_NOT_SUPPORTED:27904,DEVICE_NOT_ONBOARDED:27911,DEVICE_NOT_ONBOARDED_2:26129,INVALID_KCV:38021,INVALID_OFFSET:37890,LICENSING:28482,LOCKED_DEVICE:21781,MAX_VALUE_REACHED:38992,MEMORY_PROBLEM:37440,MISSING_CRITICAL_PARAMETER:26624,NO_EF_SELECTED:37888,NOT_ENOUGH_MEMORY_SPACE:27268,OK:36864,PIN_REMAINING_ATTEMPTS:25536,REFERENCED_DATA_NOT_FOUND:27272,SECURITY_STATUS_NOT_SATISFIED:27010,TECHNICAL_PROBLEM:28416,UNKNOWN_APDU:27906,USER_REFUSED_ON_DEVICE:21761,NOT_ENOUGH_SPACE:20738,APP_NOT_FOUND_OR_INVALID_CONTEXT:20771,INVALID_APP_NAME_LENGTH:26378,GEN_AES_KEY_FAILED:21529,INTERNAL_CRYPTO_OPERATION_FAILED:21530,INTERNAL_COMPUTE_AES_CMAC_FAILED:21531,ENCRYPT_APP_STORAGE_FAILED:21532,INVALID_BACKUP_STATE:26178,PIN_NOT_SET:21762,INVALID_BACKUP_LENGTH:26419,INVALID_RESTORE_STATE:26179,INVALID_CHUNK_LENGTH:26420,INVALID_BACKUP_HEADER:26698,SW_BAD_STATE:45063};function ve(e){switch(e){case 26368:return`Incorrect length`;case 26624:return`Missing critical parameter`;case 27010:return`Security not satisfied (dongle locked or have invalid access rights)`;case 27013:return`Condition of use not satisfied (denied by the user?)`;case 27264:return`Invalid data received`;case 27392:return`Invalid parameter received`;case 21781:return`Locked device`;case 45063:return`Unexpected state on the device`}if(28416<=e&&e<=28671)return`Internal error, please report`}var ye=class e extends Error{statusCode;statusText;constructor(t,{canBeMappedToChildError:n=!0}={}){let r=Object.keys(_e).find(e=>_e[e]===t)||`UNKNOWN_ERROR`,i=`Ledger device: ${ve(t)||r} (0x${t.toString(16)})`;if(super(i),this.name=`TransportStatusError`,this.statusCode=t,this.statusText=r,Object.setPrototypeOf(this,e.prototype),n&&t===_e.LOCKED_DEVICE)return new be(i)}},be=class e extends ye{constructor(t){super(_e.LOCKED_DEVICE,{canBeMappedToChildError:!1}),t&&(this.message=t),this.name=`LockedDeviceError`,Object.setPrototypeOf(this,e.prototype)}};ue(`TransportStatusError`,e=>new ye(e.statusCode));var xe=class extends re{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ne(e);let n=w(t);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return te(this),this.iHash.update(e),this}digestInto(e){te(this),ie(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Se=(e,t,n)=>new xe(e,t).update(n).digest();Se.create=(e,t)=>new xe(e,t);var Ce=e({abytes:()=>Oe,bitGet:()=>We,bitLen:()=>O,bitMask:()=>Ke,bitSet:()=>Ge,bytesToHex:()=>Ae,bytesToNumberBE:()=>Ie,bytesToNumberLE:()=>Le,concatBytes:()=>D,createHmacDrbg:()=>k,ensureBytes:()=>Ve,equalBytes:()=>He,hexToBytes:()=>Fe,hexToNumber:()=>Me,isBytes:()=>De,numberToBytesBE:()=>Re,numberToBytesLE:()=>ze,numberToHexUnpadded:()=>je,numberToVarBytesBE:()=>Be,utf8ToBytes:()=>Ue,validateObject:()=>Xe}),we=BigInt(0),Te=BigInt(1),Ee=BigInt(2);function De(e){return e instanceof Uint8Array||typeof e==`object`&&!!e&&e.constructor.name===`Uint8Array`}function Oe(e){if(!De(e))throw Error(`Uint8Array expected`)}var ke=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Ae(e){Oe(e);let t=``;for(let n=0;n<e.length;n++)t+=ke[e[n]];return t}function je(e){let t=e.toString(16);return t.length&1?`0${t}`:t}function Me(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return BigInt(e===``?`0`:`0x${e}`)}var Ne={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Pe(e){if(e>=Ne._0&&e<=Ne._9)return e-Ne._0;if(e>=Ne._A&&e<=Ne._F)return e-(Ne._A-10);if(e>=Ne._a&&e<=Ne._f)return e-(Ne._a-10)}function Fe(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);let t=e.length,n=t/2;if(t%2)throw Error(`padded hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=Pe(e.charCodeAt(i)),a=Pe(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw Error(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function Ie(e){return Me(Ae(e))}function Le(e){return Oe(e),Me(Ae(Uint8Array.from(e).reverse()))}function Re(e,t){return Fe(e.toString(16).padStart(t*2,`0`))}function ze(e,t){return Re(e,t).reverse()}function Be(e){return Fe(je(e))}function Ve(e,t,n){let r;if(typeof t==`string`)try{r=Fe(t)}catch(n){throw Error(`${e} must be valid hex string, got "${t}". Cause: ${n}`)}else if(De(t))r=Uint8Array.from(t);else throw Error(`${e} must be hex string or Uint8Array`);let i=r.length;if(typeof n==`number`&&i!==n)throw Error(`${e} expected ${n} bytes, got ${i}`);return r}function D(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];Oe(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}function He(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function Ue(e){if(typeof e!=`string`)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function O(e){let t;for(t=0;e>we;e>>=Te,t+=1);return t}function We(e,t){return e>>BigInt(t)&Te}function Ge(e,t,n){return e|(n?Te:we)<<BigInt(t)}var Ke=e=>(Ee<<BigInt(e-1))-Te,qe=e=>new Uint8Array(e),Je=e=>Uint8Array.from(e);function k(e,t,n){if(typeof e!=`number`||e<2)throw Error(`hashLen must be a number`);if(typeof t!=`number`||t<2)throw Error(`qByteLen must be a number`);if(typeof n!=`function`)throw Error(`hmacFn must be a function`);let r=qe(e),i=qe(e),a=0,o=()=>{r.fill(1),i.fill(0),a=0},s=(...e)=>n(i,r,...e),c=(e=qe())=>{i=s(Je([0]),e),r=s(),e.length!==0&&(i=s(Je([1]),e),r=s())},l=()=>{if(a++>=1e3)throw Error(`drbg: tried 1000 values`);let e=0,n=[];for(;e<t;){r=s();let t=r.slice();n.push(t),e+=r.length}return D(...n)};return(e,t)=>{o(),c(e);let n;for(;!(n=t(l()));)c();return o(),n}}var Ye={bigint:e=>typeof e==`bigint`,function:e=>typeof e==`function`,boolean:e=>typeof e==`boolean`,string:e=>typeof e==`string`,stringOrUint8Array:e=>typeof e==`string`||De(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e==`function`&&Number.isSafeInteger(e.outputLen)};function Xe(e,t,n={}){let r=(t,n,r)=>{let i=Ye[n];if(typeof i!=`function`)throw Error(`Invalid validator "${n}", expected function`);let a=e[t];if(!(r&&a===void 0)&&!i(a,e))throw Error(`Invalid param ${String(t)}=${a} (${typeof a}), expected ${n}`)};for(let[e,n]of Object.entries(t))r(e,n,!1);for(let[e,t]of Object.entries(n))r(e,t,!0);return e}var Ze=BigInt(0),Qe=BigInt(1),$e=BigInt(2),et=BigInt(3),tt=BigInt(4),nt=BigInt(5),rt=BigInt(8),it=BigInt(16);function at(e,t){let n=e%t;return n>=Ze?n:t+n}function ot(e,t,n){if(n<=Ze||t<Ze)throw Error(`Expected power/modulo > 0`);if(n===Qe)return Ze;let r=Qe;for(;t>Ze;)t&Qe&&(r=r*e%n),e=e*e%n,t>>=Qe;return r}function st(e,t,n){let r=e;for(;t-->Ze;)r*=r,r%=n;return r}function ct(e,t){if(e===Ze||t<=Ze)throw Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=at(e,t),r=t,i=Ze,a=Qe,o=Qe,s=Ze;for(;n!==Ze;){let e=r/n,t=r%n,c=i-o*e,l=a-s*e;r=n,n=t,i=o,a=s,o=c,s=l}if(r!==Qe)throw Error(`invert: does not exist`);return at(i,t)}function lt(e){let t=(e-Qe)/$e,n,r,i;for(n=e-Qe,r=0;n%$e===Ze;n/=$e,r++);for(i=$e;i<e&&ot(i,t,e)!==e-Qe;i++);if(r===1){let t=(e+Qe)/tt;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error(`Cannot find square root`);return r}}let a=(n+Qe)/$e;return function(e,o){if(e.pow(o,t)===e.neg(e.ONE))throw Error(`Cannot find square root`);let s=r,c=e.pow(e.mul(e.ONE,i),n),l=e.pow(o,a),u=e.pow(o,n);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(u);t<s&&!e.eql(n,e.ONE);t++)n=e.sqr(n);let n=e.pow(c,Qe<<BigInt(s-t-1));c=e.sqr(n),l=e.mul(l,n),u=e.mul(u,c),s=t}return l}}function ut(e){if(e%tt===et){let t=(e+Qe)/tt;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error(`Cannot find square root`);return r}}if(e%rt===nt){let t=(e-nt)/rt;return function(e,n){let r=e.mul(n,$e),i=e.pow(r,t),a=e.mul(n,i),o=e.mul(e.mul(a,$e),i),s=e.mul(a,e.sub(o,e.ONE));if(!e.eql(e.sqr(s),n))throw Error(`Cannot find square root`);return s}}return e%it,lt(e)}var dt=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function ft(e){return Xe(e,dt.reduce((e,t)=>(e[t]=`function`,e),{ORDER:`bigint`,MASK:`bigint`,BYTES:`isSafeInteger`,BITS:`isSafeInteger`}))}function pt(e,t,n){if(n<Ze)throw Error(`Expected power > 0`);if(n===Ze)return e.ONE;if(n===Qe)return t;let r=e.ONE,i=t;for(;n>Ze;)n&Qe&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Qe;return r}function mt(e,t){let n=Array(t.length),r=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),i=e.inv(r);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),i),n}function ht(e,t){let n=t===void 0?e.toString(2).length:t;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function gt(e,t,n=!1,r={}){if(e<=Ze)throw Error(`Expected Field ORDER > 0, got ${e}`);let{nBitLength:i,nByteLength:a}=ht(e,t);if(a>2048)throw Error(`Field lengths over 2048 bytes are not supported`);let o=ut(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:a,MASK:Ke(i),ZERO:Ze,ONE:Qe,create:t=>at(t,e),isValid:t=>{if(typeof t!=`bigint`)throw Error(`Invalid field element: expected bigint, got ${typeof t}`);return Ze<=t&&t<e},is0:e=>e===Ze,isOdd:e=>(e&Qe)===Qe,neg:t=>at(-t,e),eql:(e,t)=>e===t,sqr:t=>at(t*t,e),add:(t,n)=>at(t+n,e),sub:(t,n)=>at(t-n,e),mul:(t,n)=>at(t*n,e),pow:(e,t)=>pt(s,e,t),div:(t,n)=>at(t*ct(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>ct(t,e),sqrt:r.sqrt||(e=>o(s,e)),invertBatch:e=>mt(s,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?ze(e,a):Re(e,a),fromBytes:e=>{if(e.length!==a)throw Error(`Fp.fromBytes: expected ${a}, got ${e.length}`);return n?Le(e):Ie(e)}});return Object.freeze(s)}function A(e){if(typeof e!=`bigint`)throw Error(`field order must be bigint`);let t=e.toString(2).length;return Math.ceil(t/8)}function j(e){let t=A(e);return t+Math.ceil(t/2)}function _t(e,t,n=!1){let r=e.length,i=A(t),a=j(t);if(r<16||r<a||r>1024)throw Error(`expected ${a}-1024 bytes of input, got ${r}`);let o=at(n?Ie(e):Le(e),t-Qe)+Qe;return n?ze(o,i):Re(o,i)}var vt=BigInt(0),yt=BigInt(1);function M(e,t){let n=(e,t)=>{let n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>vt;)n&yt&&(r=r.add(i)),i=i.double(),n>>=yt;return r},precomputeWindow(e,t){let{windows:n,windowSize:i}=r(t),a=[],o=e,s=o;for(let e=0;e<n;e++){s=o,a.push(s);for(let e=1;e<i;e++)s=s.add(o),a.push(s);o=s.double()}return a},wNAF(t,i,a){let{windows:o,windowSize:s}=r(t),c=e.ZERO,l=e.BASE,u=BigInt(2**t-1),d=2**t,f=BigInt(t);for(let e=0;e<o;e++){let t=e*s,r=Number(a&u);a>>=f,r>s&&(r-=d,a+=yt);let o=t,p=t+Math.abs(r)-1,m=e%2!=0,h=r<0;r===0?l=l.add(n(m,i[o])):c=c.add(n(h,i[p]))}return{p:c,f:l}},wNAFCached(e,t,n,r){let i=e._WINDOW_SIZE||1,a=t.get(e);return a||(a=this.precomputeWindow(e,i),i!==1&&t.set(e,r(a))),this.wNAF(i,a,n)}}}function N(e){return ft(e.Fp),Xe(e,{n:`bigint`,h:`bigint`,Gx:`field`,Gy:`field`},{nBitLength:`isSafeInteger`,nByteLength:`isSafeInteger`}),Object.freeze({...ht(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function bt(e){let t=N(e);Xe(t,{a:`field`,b:`field`},{allowedPrivateKeyLengths:`array`,wrapPrivateKey:`boolean`,isTorsionFree:`function`,clearCofactor:`function`,allowInfinityPoint:`boolean`,fromBytes:`function`,toBytes:`function`});let{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw Error(`Endomorphism can only be defined for Koblitz curves that have a=0`);if(typeof n!=`object`||typeof n.beta!=`bigint`||typeof n.splitScalar!=`function`)throw Error(`Expected endomorphism with beta: bigint and splitScalar: function`)}return Object.freeze({...t})}var{bytesToNumberBE:xt,hexToBytes:St}=Ce,P={Err:class extends Error{constructor(e=``){super(e)}},_parseInt(e){let{Err:t}=P;if(e.length<2||e[0]!==2)throw new t(`Invalid signature integer tag`);let n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t(`Invalid signature integer: wrong length`);if(r[0]&128)throw new t(`Invalid signature integer: negative`);if(r[0]===0&&!(r[1]&128))throw new t(`Invalid signature integer: unnecessary leading zero`);return{d:xt(r),l:e.subarray(n+2)}},toSig(e){let{Err:t}=P,n=typeof e==`string`?St(e):e;Oe(n);let r=n.length;if(r<2||n[0]!=48)throw new t(`Invalid signature tag`);if(n[1]!==r-2)throw new t(`Invalid signature: incorrect length`);let{d:i,l:a}=P._parseInt(n.subarray(2)),{d:o,l:s}=P._parseInt(a);if(s.length)throw new t(`Invalid signature: left bytes after parsing`);return{r:i,s:o}},hexFromSig(e){let t=e=>Number.parseInt(e[0],16)&8?`00`+e:e,n=e=>{let t=e.toString(16);return t.length&1?`0${t}`:t},r=t(n(e.s)),i=t(n(e.r)),a=r.length/2,o=i.length/2,s=n(a),c=n(o);return`30${n(o+a+4)}02${c}${i}02${s}${r}`}},Ct=BigInt(0),wt=BigInt(1),Tt=BigInt(3);function Et(e){let t=bt(e),{Fp:n}=t,r=t.toBytes||((e,t,r)=>{let i=t.toAffine();return D(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=t.fromBytes||(e=>{let t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function a(e){let{a:r,b:i}=t,a=n.sqr(e),o=n.mul(a,e);return n.add(n.add(o,n.mul(e,r)),i)}if(!n.eql(n.sqr(t.Gy),a(t.Gx)))throw Error(`bad generator point: equation left != right`);function o(e){return typeof e==`bigint`&&Ct<e&&e<t.n}function s(e){if(!o(e))throw Error(`Expected valid bigint: 0 < bigint < curve.n`)}function c(e){let{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:i,n:a}=t;if(n&&typeof e!=`bigint`){if(De(e)&&(e=Ae(e)),typeof e!=`string`||!n.includes(e.length))throw Error(`Invalid key`);e=e.padStart(r*2,`0`)}let o;try{o=typeof e==`bigint`?e:Ie(Ve(`private key`,e,r))}catch{throw Error(`private key must be ${r} bytes, hex or bigint, not ${typeof e}`)}return i&&(o=at(o,a)),s(o),o}let l=new Map;function u(e){if(!(e instanceof d))throw Error(`ProjectivePoint expected`)}class d{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,e==null||!n.isValid(e))throw Error(`x required`);if(t==null||!n.isValid(t))throw Error(`y required`);if(r==null||!n.isValid(r))throw Error(`z required`)}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw Error(`invalid affine point`);if(e instanceof d)throw Error(`projective point not allowed`);let i=e=>n.eql(e,n.ZERO);return i(t)&&i(r)?d.ZERO:new d(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(d.fromAffine)}static fromHex(e){let t=d.fromAffine(i(Ve(`pointHex`,e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw Error(`bad point: ZERO`)}let{x:e,y:r}=this.toAffine();if(!n.isValid(e)||!n.isValid(r))throw Error(`bad point: x or y not FE`);let i=n.sqr(r),o=a(e);if(!n.eql(i,o))throw Error(`bad point: equation left != right`);if(!this.isTorsionFree())throw Error(`bad point: not in prime-order subgroup`)}hasEvenY(){let{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw Error(`Field doesn't support isOdd`)}equals(e){u(e);let{px:t,py:r,pz:i}=this,{px:a,py:o,pz:s}=e,c=n.eql(n.mul(t,s),n.mul(a,i)),l=n.eql(n.mul(r,s),n.mul(o,i));return c&&l}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){let{a:e,b:r}=t,i=n.mul(r,Tt),{px:a,py:o,pz:s}=this,c=n.ZERO,l=n.ZERO,u=n.ZERO,f=n.mul(a,a),p=n.mul(o,o),m=n.mul(s,s),h=n.mul(a,o);return h=n.add(h,h),u=n.mul(a,s),u=n.add(u,u),c=n.mul(e,u),l=n.mul(i,m),l=n.add(c,l),c=n.sub(p,l),l=n.add(p,l),l=n.mul(c,l),c=n.mul(h,c),u=n.mul(i,u),m=n.mul(e,m),h=n.sub(f,m),h=n.mul(e,h),h=n.add(h,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,m),f=n.mul(f,h),l=n.add(l,f),m=n.mul(o,s),m=n.add(m,m),f=n.mul(m,h),c=n.sub(c,f),u=n.mul(m,p),u=n.add(u,u),u=n.add(u,u),new d(c,l,u)}add(e){u(e);let{px:r,py:i,pz:a}=this,{px:o,py:s,pz:c}=e,l=n.ZERO,f=n.ZERO,p=n.ZERO,m=t.a,h=n.mul(t.b,Tt),g=n.mul(r,o),_=n.mul(i,s),v=n.mul(a,c),y=n.add(r,i),b=n.add(o,s);y=n.mul(y,b),b=n.add(g,_),y=n.sub(y,b),b=n.add(r,a);let x=n.add(o,c);return b=n.mul(b,x),x=n.add(g,v),b=n.sub(b,x),x=n.add(i,a),l=n.add(s,c),x=n.mul(x,l),l=n.add(_,v),x=n.sub(x,l),p=n.mul(m,b),l=n.mul(h,v),p=n.add(l,p),l=n.sub(_,p),p=n.add(_,p),f=n.mul(l,p),_=n.add(g,g),_=n.add(_,g),v=n.mul(m,v),b=n.mul(h,b),_=n.add(_,v),v=n.sub(g,v),v=n.mul(m,v),b=n.add(b,v),g=n.mul(_,b),f=n.add(f,g),g=n.mul(x,b),l=n.mul(y,l),l=n.sub(l,g),g=n.mul(y,_),p=n.mul(x,p),p=n.add(p,g),new d(l,f,p)}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return p.wNAFCached(this,l,e,e=>{let t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(d.fromAffine)})}multiplyUnsafe(e){let r=d.ZERO;if(e===Ct)return r;if(s(e),e===wt)return this;let{endo:i}=t;if(!i)return p.unsafeLadder(this,e);let{k1neg:a,k1:o,k2neg:c,k2:l}=i.splitScalar(e),u=r,f=r,m=this;for(;o>Ct||l>Ct;)o&wt&&(u=u.add(m)),l&wt&&(f=f.add(m)),m=m.double(),o>>=wt,l>>=wt;return a&&(u=u.negate()),c&&(f=f.negate()),f=new d(n.mul(f.px,i.beta),f.py,f.pz),u.add(f)}multiply(e){s(e);let r=e,i,a,{endo:o}=t;if(o){let{k1neg:e,k1:t,k2neg:s,k2:c}=o.splitScalar(r),{p:l,f:u}=this.wNAF(t),{p:f,f:m}=this.wNAF(c);l=p.constTimeNegate(e,l),f=p.constTimeNegate(s,f),f=new d(n.mul(f.px,o.beta),f.py,f.pz),i=l.add(f),a=u.add(m)}else{let{p:e,f:t}=this.wNAF(r);i=e,a=t}return d.normalizeZ([i,a])[0]}multiplyAndAddUnsafe(e,t,n){let r=d.BASE,i=(e,t)=>t===Ct||t===wt||!e.equals(r)?e.multiplyUnsafe(t):e.multiply(t),a=i(this,t).add(i(e,n));return a.is0()?void 0:a}toAffine(e){let{px:t,py:r,pz:i}=this,a=this.is0();e??=a?n.ONE:n.inv(i);let o=n.mul(t,e),s=n.mul(r,e),c=n.mul(i,e);if(a)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw Error(`invZ was invalid`);return{x:o,y:s}}isTorsionFree(){let{h:e,isTorsionFree:n}=t;if(e===wt)return!0;if(n)return n(d,this);throw Error(`isTorsionFree() has not been declared for the elliptic curve`)}clearCofactor(){let{h:e,clearCofactor:n}=t;return e===wt?this:n?n(d,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),r(d,this,e)}toHex(e=!0){return Ae(this.toRawBytes(e))}}d.BASE=new d(t.Gx,t.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);let f=t.nBitLength,p=M(d,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:o}}function Dt(e){let t=N(e);return Xe(t,{hash:`hash`,hmac:`function`,randomBytes:`function`},{bits2int:`function`,bits2int_modN:`function`,lowS:`boolean`}),Object.freeze({lowS:!0,...t})}function Ot(e){let t=Dt(e),{Fp:n,n:r}=t,i=n.BYTES+1,a=2*n.BYTES+1;function o(e){return Ct<e&&e<n.ORDER}function s(e){return at(e,r)}function c(e){return ct(e,r)}let{ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:d,isWithinCurveOrder:f}=Et({...t,toBytes(e,t,r){let i=t.toAffine(),a=n.toBytes(i.x),o=D;return r?o(Uint8Array.from([t.hasEvenY()?2:3]),a):o(Uint8Array.from([4]),a,n.toBytes(i.y))},fromBytes(e){let t=e.length,r=e[0],s=e.subarray(1);if(t===i&&(r===2||r===3)){let e=Ie(s);if(!o(e))throw Error(`Point is not on curve`);let t=d(e),i;try{i=n.sqrt(t)}catch(e){let t=e instanceof Error?`: `+e.message:``;throw Error(`Point is not on curve`+t)}let a=(i&wt)===wt;return(r&1)==1!==a&&(i=n.neg(i)),{x:e,y:i}}if(t===a&&r===4)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${a} uncompressed bytes`)}}),p=e=>Ae(Re(e,t.nByteLength));function m(e){return e>r>>wt}function h(e){return m(e)?s(-e):e}let g=(e,t,n)=>Ie(e.slice(t,n));class _{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){let n=t.nByteLength;return e=Ve(`compactSignature`,e,n*2),new _(g(e,0,n),g(e,n,2*n))}static fromDER(e){let{r:t,s:n}=P.toSig(Ve(`DER`,e));return new _(t,n)}assertValidity(){if(!f(this.r))throw Error(`r must be 0 < r < CURVE.n`);if(!f(this.s))throw Error(`s must be 0 < s < CURVE.n`)}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(e){let{r,s:i,recovery:a}=this,o=ee(Ve(`msgHash`,e));if(a==null||![0,1,2,3].includes(a))throw Error(`recovery id invalid`);let u=a===2||a===3?r+t.n:r;if(u>=n.ORDER)throw Error(`recovery id 2 or 3 invalid`);let d=a&1?`03`:`02`,f=l.fromHex(d+p(u)),m=c(u),h=s(-o*m),g=s(i*m),_=l.BASE.multiplyAndAddUnsafe(f,h,g);if(!_)throw Error(`point at infinify`);return _.assertValidity(),_}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return Fe(this.toDERHex())}toDERHex(){return P.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Fe(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}let v={isValidPrivateKey(e){try{return u(e),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let e=j(t.n);return _t(t.randomBytes(e),t.n)},precompute(e=8,t=l.BASE){return t._setWindowSize(e),t.multiply(BigInt(3)),t}};function y(e,t=!0){return l.fromPrivateKey(e).toRawBytes(t)}function b(e){let t=De(e),n=typeof e==`string`,r=(t||n)&&e.length;return t?r===i||r===a:n?r===2*i||r===2*a:e instanceof l}function x(e,t,n=!0){if(b(e))throw Error(`first arg must be private key`);if(!b(t))throw Error(`second arg must be public key`);return l.fromHex(t).multiply(u(e)).toRawBytes(n)}let S=t.bits2int||function(e){let n=Ie(e),r=e.length*8-t.nBitLength;return r>0?n>>BigInt(r):n},ee=t.bits2int_modN||function(e){return s(S(e))},te=Ke(t.nBitLength);function C(e){if(typeof e!=`bigint`)throw Error(`bigint expected`);if(!(Ct<=e&&e<te))throw Error(`bigint expected < 2^${t.nBitLength}`);return Re(e,t.nByteLength)}function ne(e,r,i=re){if([`recovered`,`canonical`].some(e=>e in i))throw Error(`sign() legacy options not supported`);let{hash:a,randomBytes:o}=t,{lowS:d,prehash:p,extraEntropy:g}=i;d??=!0,e=Ve(`msgHash`,e),p&&(e=Ve(`prehashed msgHash`,a(e)));let v=ee(e),y=u(r),b=[C(y),C(v)];if(g!=null&&g!==!1){let e=g===!0?o(n.BYTES):g;b.push(Ve(`extraEntropy`,e))}let x=D(...b),te=v;function ne(e){let t=S(e);if(!f(t))return;let n=c(t),r=l.BASE.multiply(t).toAffine(),i=s(r.x);if(i===Ct)return;let a=s(n*s(te+i*y));if(a===Ct)return;let o=(r.x===i?0:2)|Number(r.y&wt),u=a;return d&&m(a)&&(u=h(a),o^=1),new _(i,u,o)}return{seed:x,k2sig:ne}}let re={lowS:t.lowS,prehash:!1},w={lowS:t.lowS,prehash:!1};function ie(e,n,r=re){let{seed:i,k2sig:a}=ne(e,n,r),o=t;return k(o.hash.outputLen,o.nByteLength,o.hmac)(i,a)}l.BASE._setWindowSize(8);function ae(e,n,r,i=w){let a=e;if(n=Ve(`msgHash`,n),r=Ve(`publicKey`,r),`strict`in i)throw Error(`options.strict was renamed to lowS`);let{lowS:o,prehash:u}=i,d,f;try{if(typeof a==`string`||De(a))try{d=_.fromDER(a)}catch(e){if(!(e instanceof P.Err))throw e;d=_.fromCompact(a)}else if(typeof a==`object`&&typeof a.r==`bigint`&&typeof a.s==`bigint`){let{r:e,s:t}=a;d=new _(e,t)}else throw Error(`PARSE`);f=l.fromHex(r)}catch(e){if(e.message===`PARSE`)throw Error(`signature must be Signature instance, Uint8Array or hex string`);return!1}if(o&&d.hasHighS())return!1;u&&(n=t.hash(n));let{r:p,s:m}=d,h=ee(n),g=c(m),v=s(h*g),y=s(p*g),b=l.BASE.multiplyAndAddUnsafe(f,v,y)?.toAffine();return b?s(b.x)===p:!1}return{CURVE:t,getPublicKey:y,getSharedSecret:x,sign:ie,verify:ae,ProjectivePoint:l,Signature:_,utils:v}}function kt(e){return{hash:e,hmac:(t,...n)=>Se(e,t,C(...n)),randomBytes:ee}}function At(e,t){let n=t=>Ot({...e,...kt(t)});return Object.freeze({...n(t),create:n})}var jt=BigInt(`0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f`),Mt=BigInt(`0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141`),Nt=BigInt(1),Pt=BigInt(2),Ft=(e,t)=>(e+t/Pt)/t;function It(e){let t=jt,n=BigInt(3),r=BigInt(6),i=BigInt(11),a=BigInt(22),o=BigInt(23),s=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=st(st(st(u,n,t)*u%t,n,t)*u%t,Pt,t)*l%t,f=st(d,i,t)*d%t,p=st(f,a,t)*f%t,m=st(p,s,t)*p%t,h=st(st(st(st(st(st(m,c,t)*m%t,s,t)*p%t,n,t)*u%t,o,t)*f%t,r,t)*l%t,Pt,t);if(!Lt.eql(Lt.sqr(h),e))throw Error(`Cannot find square root`);return h}var Lt=gt(jt,void 0,void 0,{sqrt:It}),Rt=At({a:BigInt(0),b:BigInt(7),Fp:Lt,n:Mt,Gx:BigInt(`55066263022277343669578718895168534326250603453777594175500187360389116729240`),Gy:BigInt(`32670510020758816978083085130507043184471273380659243275938904335757337482424`),h:BigInt(1),lowS:!0,endo:{beta:BigInt(`0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee`),splitScalar:e=>{let t=Mt,n=BigInt(`0x3086d221a7d46bcde86c90e49284eb15`),r=-Nt*BigInt(`0xe4437ed6010e88286f547fa90abfe4c3`),i=BigInt(`0x114ca50f7a8e2f3f657c1108d9d44cfd8`),a=n,o=BigInt(`0x100000000000000000000000000000000`),s=Ft(a*e,t),c=Ft(-r*e,t),l=at(e-s*n-c*i,t),u=at(-s*r-c*a,t),d=l>o,f=u>o;if(d&&(l=t-l),f&&(u=t-u),l>o||u>o)throw Error(`splitScalar: Endomorphism failed, k=`+e);return{k1neg:d,k1:l,k2neg:f,k2:u}}}},ae);Rt.ProjectivePoint;var zt=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)})),Bt=class extends Error{constructor(e,t){super(e),this.error=t}},Vt=class extends Bt{constructor(e,t){super(e||`The wallet is not found.`,t),this.name=`WalletNotFoundError`}},Ht=class extends Bt{constructor(){super(...arguments),this.name=`WalletDisconnectedError`,this.message=`The wallet is disconnected. Please connect first.`}},Ut=class extends Bt{constructor(){super(...arguments),this.name=`WalletConnectionError`}},Wt=class extends Bt{constructor(){super(...arguments),this.name=`WalletDisconnectionError`}},Gt=class extends Bt{constructor(){super(...arguments),this.name=`WalletSignMessageError`}},Kt=class extends Bt{constructor(){super(...arguments),this.name=`WalletSignTransactionError`}},qt=class extends Bt{constructor(e,t){super(e||`The QR window is closed.`,t),this.name=`WalletWindowClosedError`}},Jt=class extends Bt{constructor(){super(...arguments),this.name=`WalletSwitchChainError`}},Yt=class extends Bt{constructor(){super(...arguments),this.name=`WalletGetNetworkError`}},Xt=class extends Bt{constructor(){super(...arguments),this.name=`WalletSignTypedDataError`}};function Zt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Qt(e){if(!Zt(e))throw new Xt(`typedData must be an object.`);if(!Zt(e.domain))throw new Xt(`typedData.domain must be an object.`);if(!Zt(e.types))throw new Xt(`typedData.types must be an object.`);if(!Zt(e.message))throw new Xt(`typedData.message must be an object.`);let{chainId:t}=e.domain;if(typeof t==`string`){let n=Number(t);if(!Number.isFinite(n))throw new Xt(`Invalid domain.chainId: ${t}.`);return Object.assign(Object.assign({},e),{domain:Object.assign(Object.assign({},e.domain),{chainId:n})})}return e}var $t;(function(e){e.Loading=`Loading`,e.NotFound=`NotFound`,e.Found=`Found`})($t||={});var F;(function(e){e.Loading=`Loading`,e.NotFound=`NotFound`,e.Disconnect=`Disconnected`,e.Connected=`Connected`})(F||={});var en;(function(e){e.Mainnet=`Mainnet`,e.Shasta=`Shasta`,e.Nile=`Nile`,e.Unknown=`Unknown`})(en||={});var tn;(function(e){e.Mainnet=`Mainnet`,e.Shasta=`Shasta`,e.Nile=`Nile`})(tn||={});var nn=`TIP6963:announceProvider`,rn=`TIP6963:requestProvider`,an=t(zt(),1),on=class extends an.default{get connected(){return this.state===F.Connected}disconnect(){return Promise.resolve()}multiSign(e,t={}){return Promise.reject(`The current wallet doesn't support multiSign.`)}signTypedData(e){let t;try{t=Qt(e)}catch(e){return Promise.reject(e)}return this._signTypedData(t)}_signTypedData(e){return Promise.reject(`The current wallet doesn't support signTypedData.`)}switchChain(e){return Promise.reject(`The current wallet doesn't support switch chain.`)}};function sn(){return typeof window<`u`&&typeof document<`u`&&typeof navigator<`u`}function cn(){return typeof navigator<`u`&&navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone/i)}var ln=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},un={onRiskDetected:e=>ln(void 0,void 0,void 0,function*(){}),configUrls:[],enabled:!1,timeout:2e3,retries:0,cacheTTL:6e5};function dn(e){return!!e&&typeof e==`object`&&typeof e.title==`string`&&e.title.length>0&&(e.noticeType===1||e.noticeType===2||e.noticeType===3)}function fn(e){let t={title:e.title,noticeType:e.noticeType};return typeof e.ext==`string`&&(t.ext=e.ext),typeof e.ios==`string`&&(t.ios=e.ios),typeof e.and==`string`&&(t.and=e.and),t}function pn(e){let t=e&&typeof e==`object`?e:{},n={};if(t.wallets&&typeof t.wallets==`object`)for(let[e,r]of Object.entries(t.wallets)){if(!Array.isArray(r))continue;let t=[];for(let e of r)dn(e)&&t.push(fn(e));t.length>0&&(n[e]=t)}return{v:typeof t.v==`string`?t.v:``,ts:typeof t.ts==`number`?t.ts:0,wallets:n}}var mn={};function hn(e){return ln(this,void 0,void 0,function*(){let{configUrls:t=un.configUrls,timeout:n=un.timeout,retries:r=un.retries,onConfigFallback:i,cacheTTL:a=un.cacheTTL}=e,o=Date.now();function s(e){return ln(this,void 0,void 0,function*(){let t=mn[e];if(t&&o-t.timestamp<a)return t.data;function i(){return ln(this,void 0,void 0,function*(){return new Promise((t,r)=>{let i=new AbortController,a=setTimeout(()=>i.abort(),n);fetch(e,{signal:i.signal}).then(e=>{clearTimeout(a),e.ok?e.json().then(e=>t(pn(e)),r):r(Error(`Fetch failed with code: `+e.status))}).catch(e=>{clearTimeout(a),r(e)})})})}for(let t=0;t<=r;t++)try{let t=yield i();return mn[e]={data:t,timestamp:Date.now()},t}catch{}return null})}let c=(yield Promise.all(t.map(s))).filter(e=>e!==null);return c.length>0?c.reduce((e,t)=>{t.ts>e.ts&&(e.v=t.v,e.ts=t.ts);for(let[n,r]of Object.entries(t.wallets))e.wallets[n]=[...e.wallets[n]??[],...r];return e},{v:``,ts:0,wallets:{}}):i?pn(yield i()):{v:``,ts:0,wallets:{}}})}var gn=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},_n=class e extends on{constructor(t){if(super(),this.commonConfig={checkTimeout:2e3,openAppWithDeeplink:!0,openUrlWhenWalletNotFound:!0,securityOptions:un},this._securityCheckCache=null,this.commonConfig=Object.assign(Object.assign({},this.commonConfig),t),typeof this.commonConfig.checkTimeout!=`number`)throw Error(`[WalletAdapter] config.checkTimeout should be a number`);e._validateSecurityOptions(this.commonConfig.securityOptions)}static _validateSecurityOptions(e){let{enabled:t,configUrls:n}=e;if(t&&(!n||n.length===0))throw Error(`[WalletAdapter] config.securityOptions.configUrls is required when securityOptions.enabled is true`)}updateSecurityOptions(t){let n=Object.assign(Object.assign({},this.commonConfig.securityOptions),t);e._validateSecurityOptions(n),this.commonConfig.securityOptions=n,this._securityCheckCache=null}_beforeConnect(){return gn(this,void 0,void 0,function*(){if(this.connected||this.connecting)return!1;if(yield this._checkWallet(),this.readyState===$t.NotFound)throw sn()&&!this._openAppByDeepLinkIfNeed()&&this.commonConfig.openUrlWhenWalletNotFound!==!1&&window.open(this.url,`_blank`),new Vt;return yield this.checkSecurity(),!0})}checkSecurity(){return gn(this,void 0,void 0,function*(){if(!this.commonConfig.securityOptions.enabled)return;let t=this._securityCheckCache;if(t&&(t.settledAt===null||Date.now()-t.settledAt<e.SECURITY_CHECK_CACHE_TTL))return t.promise;let n=gn(this,void 0,void 0,function*(){let e=(yield hn(this.commonConfig.securityOptions)).wallets[this.name];e&&e.length>0&&(yield(this.commonConfig.securityOptions.onRiskDetected||un.onRiskDetected)({risks:e}))}),r={promise:n,settledAt:null};return this._securityCheckCache=r,n.finally(()=>{this._securityCheckCache===r&&(r.settledAt=Date.now())}).catch(()=>{}),n})}};_n.SECURITY_CHECK_CACHE_TTL=5e3;var vn=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function yn(){return sn()&&!!(window.tron&&window.tron.isTronLink)}function bn(){return sn()&&!!(yn()||window.tronLink||window.tronWeb)}function xn(){return sn()&&window.iTron!==void 0}function Sn({dappIcon:e,dappName:t}={dappIcon:``,dappName:``}){if(!bn()&&cn()&&!xn()){let n=``,r=``;try{n=document.title;let e=document.querySelector(`link[rel*="icon"]`);e&&(r=new URL(e.getAttribute(`href`)||``,location.href).toString())}catch{}let{origin:i,pathname:a,search:o,hash:s}=window.location,c=i+a+o+(s.includes(`?`)?s:`${s}?_=1`),l={action:`open`,actionId:Date.now()+``,callbackUrl:`http://someurl.com`,dappIcon:e||r,dappName:t||n,url:c,protocol:`TronLink`,version:`1.0`,chainId:`0x2b6653dc`};return window.location.href=`tronlinkoutside://pull.activity?param=${encodeURIComponent(JSON.stringify(l))}`,!0}return!1}function Cn(e){return vn(this,void 0,void 0,function*(){return new Promise((t,n)=>{let r=setInterval(()=>{e.tronWeb&&(clearInterval(r),clearTimeout(i),t())},50),i=setTimeout(()=>{clearInterval(r),n("`window.tron.tronweb` is not ready.")},2e3)})})}var wn=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Tn={"0x2b6653dc":en.Mainnet,"0x94a9059e":en.Shasta,"0xcd8690dc":en.Nile};function En(e){return wn(this,void 0,void 0,function*(){let{blockID:t=``}=yield e.trx.getBlockByNumber(0),n=`0x${t.slice(-8)}`;return{networkType:Tn[n]||en.Unknown,chainId:n,fullNode:e.fullNode?.host||``,solidityNode:e.solidityNode?.host||``,eventServer:e.eventServer?.host||``}})}var Dn=`TronLink`,On=class extends _n{constructor(e={}){super(e),this.name=Dn,this.url=`https://www.tronlink.org/`,this.icon=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAF0AAABdCAYAAADHcWrDAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAUGVYSWZNTQAqAAAACAACARIAAwAAAAEAAQAAh2kABAAAAAEAAAAmAAAAAAADoAEAAwAAAAEAAQAAoAIABAAAAAEAAABdoAMABAAAAAEAAABdAAAAAMkTBfIAAAFZaVRYdFhNTDpjb20uYWRvYmUueG1wAAAAAAA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJYTVAgQ29yZSA2LjAuMCI+CiAgIDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vdGlmZi8xLjAvIj4KICAgICAgICAgPHRpZmY6T3JpZW50YXRpb24+MTwvdGlmZjpPcmllbnRhdGlvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+Chle4QcAABZhSURBVHgB7V0JlBTVuf6runtWllkA2QeYQQRBZHNFxZjw4jFqMEFxCWIS1yOaTeJ76nk5Lyc5CUZNfCoa0BgUxRh3QD2CJs8lELaIgOCw78sszN4z0131vu/W1NDTfbtneqa7Zx5v/nN6prrq1q2q77//ev9bbUgcNHjm/sya7PIiIxA43TCNUbYEcw3bsOLo4v98U9sWAxSwbbvYI7LDCDZ+dezl847G82BGWxrnzVl/nmF5bhCxviG2FBoen0+Ep9ptOf0UbOPAZlsNhOCYmOYawzaXirfynZLnpla19sAxQc+5ac14jyf9IbHsqw1vute2GoF78P8x2Bo4DVMME2OQqAQDW8W2flv64oQXMCijjsiooOfP3jAXvf0SHfa2A/XsUnXc/ScGAgAfqgfgB18zGqvvKVk69ZCudSTot63z5fvNRw0z7W7bCpB9uvO698VAwPBmAraGzXbQuq5sycSt4U3NljtsA4D/wfBk3I2TugFvCU6bv9mBOigJ71jTY7zd++Z1heEntgA976b1P8YIv9MO+NGuW52EgxXPdzsIlexJK/Ra5uK+d23pEXpuM+h9blo30TS9/6WMZTfgoRi1e5uD1/BmXGBV1j0Y2okD+i9smGDjV2L6smF9Q493b3cQATXiTc/c3BvXjXO7UqD32bn2Itv0TlcN3CPd/xODAAax4UnP8pjmvW6HCnTbNm+B4sd2tx53gUnkfw5mW6wZUOED2K+ZM2djDoLLy+wgAp9uSg4CarRn5Ikpl/ICpinWGfBvBnXr8uTg3dwrIlfkbS5yQLdkPNxEBEndqqUZoGRsqCDTHK1At2yZZnd7LMmAuUWfDsZ236LLV6SbGPXZ3aO8BT7J/OLx98iBSre79UoyUW7RN3Jh/O4ERy2OdH9JNgLdoCcbYU3/3aBrQEn2rm7Qk42wpn+vZl/cuzgTUtvgJMo8piEesNLE/8gZkri7PiVP6DDojUFb5s0YIIPz02TDzhr58oBf9hyrl9KqgGIEZq/ABEOY2UEFQTcjMIw6DHoAoO891iAPfHeg3HxpH4a6cryyUXYfrZdNe+tk055aMKJO9h5vUIyog0ScZASYQGackuM5+kN1GPR0nykrN1XIobIGGZiXpgDt19sn/Jx7ujNhgqhXjlU4jPhiby0YUdfEiHopg0TUNbKYxJUIgwmhU5o6DDo0hhw90Sjvb6yQWy7rqwWLbfrn+NTn/FEnGcHzdh7xyxeQCDKDqmlficOI+iZGeHGyxwNGnELi0GHQiTIBeWNNucz5Wl81YrXIh+3kOQNyfeozdXRPdTQIkThWEZAdh/1QTY5EbD9YB0Y0SFl1QBpOEUYkBPQ0WMm1xTVCgM4YnBkGb9u/0uC6jLhojMMI2gxKxI4j9UoaaCO2HfTLfjCinIwIOKrJC2ng+WRmV6eEgE59XFEblHfWnugQ6DqwCOYgeEb8XHLmSUYcLm+U4kNQTfsc1bTdZURNQBq7OCMSAjrB8gGcd9adkHuv7C9p3uQONzJiSJ809fnaWb0Ur+i6HgEjviIjqJrwISMOQCJO1ASFxykFtA+dLREJBX0zRt16+OqusdSN3GTtI9NdRlzWxAiqHkrEV4coDScl4kCpwwiqrs5gRMJAp7Ptr7fkzdXlnQK6jpmUuIK+aerzjfG9VRN6RXRvt0MiNkMayAxKBxlBFekywrURVJ2JpsSBjjvjQ77/rwp5YOZA6ZWF6u02Ui2YRXvQI9OUcUOz4O/7hA+dDEr3GTL8tHT1+eYElxGWHCxrVOqIqsllxEEyoi4owSaJSBQjEgo6b2oXItGPv6ySKybltBmzrHRTRgCIW5/ardTBqEEZws+4giwZOzRTRg7IkP5wL6lCkkEM8Hh9fi6f6DDCj8iZo9+RCETWYAYN90FISWWtJXRvGcSpOAI6Kh6JMPJnr38LtV9XCSt0E0AM82dNzZdn7x4ed29MFcx5fJd8AqZRaphS4P/cHl6lr88AI84a1sSIgRlyGgIuPnSqiM9GV5UGevM+RyJcRlTVtcIIE+PbDmzLrKufmHDQLSQb83p65ONfj1E+d7yAlFQG1IhnhEsJIDGNQBEPYMNlRB4YMRT6mnHBuIJMSESWnE5G9PaqDGe8121ve6pGMmIbYhSqJTKj+FC9shvVfqgm4KEkwusTjxHcluVPAui8eY6IBbcPk9lIgLWHqv2WzF24R175pEwyAbxuLIczgrqajCjomw5GQCKgms6EaiqCako1I2pw/4yiGSwqGwGvrvhIQI6W1W3zVPsTP9IJcn2jJV+Ht/D6/SO1gG3YVQs9nS49M6MbW7p7//7Cfnnm/WNCndsWnUkpozRQ31IiyIj8ng4jRkMixg/LBCOypLB/uvRFQi6FmkmofpB53bNkU81ZCTWk7qhmWmDNV9XK8FDkw6myNiB3PH1YnoI09I7i5VCX/27OUKXP579xWHkzrYFEMU5TjU7KBrOYzOesxv2QERlppmLEMKim0UOomhwb4TLi5Jnhd92x7z3hmcE58BTu8FO7J544KhkF0g386dX9Iy5wwRk9Zd6f98u1D++QxfeOUAYxohF2sJ8H4X7m9fDIgy8dVCOY0WQ8xBks4Mze1GnAXUqR72c+57Pt1WofJalPL68M65cuY5ptRCa8mQxIROIgYgxA8mSNv/16zCSMSnQtI7unSN14cb4Ku9XVmv4QuEr4vwveOyb/RKLskrG91IgObRO6PWVkDxXgrNxUqRJcBLK9xDO5GIv3QBdUuaHYWQOjR4O4DhH1uxsqlD1Z+kmpLENqYyPUISNbgkYpdg18vPeAnFDlF/vqFySOjWF34IN6oCXfsLtGzgVo4fStybny6NtHZO2OGvnub4vlT/eMgM7NCm/W/H3WRfmSA0N5x4LdSPMGlSvZfLCDG2QEmcC53VCJ4MQLwf5kK5aGolEmRKavKxFQTXRfx8FYD4N/TyPeVkraSOeD0J3KyfLCqDpJqdCbooH7eGu1mk8liO/CRTx7eJbyPkLbhW7TE+Fs1EdfVCKtG0xa1Mpr8v5NVyIwgCgRjvQG1dQjJXTF+hNKIuhlrYB0fL67Vo6CUXQTacTJpFAKBqVy0z7/gqSBzotRJxPQG6BiqDdDicfq4aFQfGncqG64TcOrM77uuUxqXQp1xKiXWcVkpQvc64X+1zICnKjCve/GPDGdBz4D1dJfwAgOJOb/jyH2AAvBNKuy5EjjgoQHR6E3yW26fq/8rKg5vA49fhj5jqn/sVUxhqLt6sxHbhki35sW28ffe7xebvnv3bIGxpC+fFciekkW/gSwBFelC8Ct7Kx0yc+2vyrq0zgh6XfLi76xpkyLyQAktqZh1DYEII8gjtpGyOY9i/bJH5bFfscBgyAyczqSVlRjXYkoxbQRVDE0upRkDqhD5Y3Wxi0NWFWXZKK//dEXVcpF011qxnm5CI8puA7xZvn1wSUH5BdLD6oR4x4L/0+jRpfzuql5qsaGOrerEp/JVYVJB50gMn+98vMKLR4XYy50BCJERpIu4RTlnTz85mH50bP7xI8INxoxqn3mzuFyx7/1k3qkHyjaXZ2SDjoBIJdfX3NCCwjz7tPP7q1m+kPB4jm0/os+OC63Prkb6dTo7yigND2C6PX+7wxU03Ih/AvtstO3OXd74ABNagqIAcVqGDzWuOhoxrm5Su/pBil14mv/KJcbH9sZVUWxT6WSEL3+5nuD8c3Jv+iu1Vn7mI+aMDw77aNFRU44kOwbobpguQTdKR1NKspWkxVumBzehsB/iGiUaQNOksSiuy4/TZ68bZhyUaP1F+v8ZByjoZ8Fu/PKzwp9PTP6pgZ0PgiNyNvIxeiAoHr41uQcVToR7aHpFq7fheh1frHyfaO14/7rEb0+P3eE9M72KJc1VttkHqN9YZr7tun95KnbhkpOthfPUJ4a9cIHY1qAgcK/ELXp6MopOSrjGMsQZiDA4kzNTIx4zi7Fom9i2m3pT4tkENxSTkanmmhX6AqzovnR7w9FROvEIbyPlOh0XggaRvnTb6L8TkejBmXKlJHZrY5MRraMRG94dGdUdeX2z1KQV+eNFE7zcc4zVeTk82351U1D5D+vGxSRt08Z6HxgqpH3EBozoxdO1Ps0qIzkWiNKDb2ZHzyxW174W0nM5pzY/uvPi+QcJN0o6skmqk/maR7/YYHcc8Vp2sulFHTqdaqHT7c5eezwO6LryMlmzgC1RuyLKYZ7Fu2Vx9sSvd5XKNMxm5XM6JUuIeOGZ+8eETONkVLQCSSDIFb46oj1igyW3LSArk3oProBzI2fjF5Dj7bc7tvLJ4t/1BS9wptoXZ5ant/aNw6AfjleWfLjQqF9ikUpB50qhu4fc9U6mnFenvK5dcd0+6iWqG6c6HWvmp/VteM+Fb3ekfjolREzC5heva9ILm4qctXdgw+5GFLKQWdagEU8qwC8jliZywcITQvo2oXuC41ef9ha9IoHf+SWofLzaxITvdJOcPLltXlFmA/Aiv8Y9MHnlf4nH14bSDnovCeC9AZqHnWUA99alxbQtQ3fF0/0+tC1jF6HqC7obbSHaB+oDukhcYIlFj31fqnM/v3O4KaqCqtTQGda4B9IC+yKkhb4NtMCcA3bA4WKXjGz1LbotZ88cWuBpON+dEFbLBAJOHX3Sz8plIEo+YtGfIZf//UQykkOqGnowYMHp1698Oaoh7nkcfl6feZxCtICY4ZkxA2E++BMlLFkm3OvDMhiEWe1nsf8bFujV4JYB8A5yfInRL0s+YtGarnn8/sV6PS2zKYyn04Z6bxJJy1QrgWWAdAVraQFoj2ou58TB8WH69scvb78E0avaTENMUMIJq7mwv9+8raCmFUBrPK68+k98uR7RyUd90KV6lKngU6PgykB1v/p6Kopuarcug2xku50tY8zN270ujxKss09+YIzGL0WoSAoUxtEudVjD84cJL+ZPaR5QsI9P/Q/C5xYCPvS/5RKFgEPPYjtTgOdN8LREC0twDK4yYWtpwXCnifiqxu9fv+JXfLi31uPXumFsGQkNHqloeVInQ+w779GvXAu4jruDnpmsx7ZKcs3nIgqCZ0GOm+SPvsK3JwuSmSJHA1qsCNDvQkJN3qdu7AN0SuqvJCCFa7c4H1RL9OoL7hjmNyO2alYxBLqmfN3IOKuUiOcbWkDLDCNwVPz+xOSVeEV6+bcY6zUYmn0+SizY0F+OLHIk6UM/qb1o+HH4/nOGham3eArKwAuHtOrhZ4N7Ss7w6Nsyh6UVVA9PYew/upzckObRGzTcDMJxwXIzL0Q5AA+XFiWhxqfsQXZMu3MHhWXFHj+GN30RnSbnB0cSfTZv960OCv0KqxxoR/8+uoyNbMUeqw92/SaKF2MXjmpMv/moWrGXtcXo9enMbqpLmLV4fDc5Sg6cqcUaYwL+qE4VdVEOuXaHFDMKUFo0579sNzT6aC7aQGOeBZxhtOM83OjlnCEt23Ldw54ejYLMffKQih6IdHWR9Hnbw1wLiT+++YqFLoOUhVqnGQ/DRIa6q2491UDdUWKfEq3RYr+My2wv7RePmRAc2FexFWnIS1QAD17EMWdFNVEEHtxotcyrKgLyMK7hketHG7tekWos59/sxPZttbWPd6phtS9CVqbaGkBBh80aizBSzQR+FXQ8df+bgfK4mLPvUa7dnvWPHUJ0NPgHdDiR3twTm6kwedOPOwo8+DcKyqHv8PoFSvoUkFdAnQaOOr0d2GQdHQOpvFYrB9vfkTXl26fil6xOIvuXmtzr7rz27rPrbnsEqDzppFzkrf+iWoBTcaPoHBdKmdmkkWMXlmLfj3cvk9bmfSO5x6YNuDrtT74vFp+/86RhpWfHg52uiF1H8AH1DeixGIz0gKsUw+nq87JkceXH1WjXecZhLdvz3d6UiVNr8K6sOkdNPH0Q4BRJKqmJJne4Mo6Lv51Vl6jODbQ2JhvNXYd0AkklzK+vbZcC/oYrHyYWJiFUVitfO14wIinLdO8g/tEBmrhfbC6gKunnYW8dbJlP94xAPeR+yo0b93web0ImiDOSDV5YZ26zCvkONKWr6uQ+64eEFFzTtfy24gK6ROzXTKIGQdmBHXxAq/H1Rer8L4yBTBG8CHU17MqgbaGdsl9rQnzPfxEI6TA7MSsT492hTj2M0fCBa+ri/XVApdPzFEvZNOo/TiuEr0pLUY2vBkuzdERl1Y+gBJuvumDo5q5GQ4Aup60Owz/CX4Msr3Z9bZpW57PDDe7HqN1qg65aQHd9bgs/UKkYNtaLaDrI9Y+JqZyUfrGFEA48VhpVaP0RF6GAKtJidgAt+jC4LsQxa7Y8/y0euSBrA34obsWDTrzC0cOly4yJ60jLiKI41l1XUTdRwlicoqjPZyqMaqZNmhlJIefdvI7QbfNYiTdbNMTSNuCtzOUqrdSnmzSaVvU3fvwNowPN+urBS4d1wtvxEhXa3kSfZMczXyPgM474gt4KvB+ML5Ftb1kiPUZzzWPvTzuKK7yqfvzju3tMLHnOZlHXZ/Ut1wimYyiUI50ZgN1pF5ji9HeLsjBRfzsTq0R9Kxi30qO8GuCLzjpdt3lUr+P1QKMDLmCTkcqLRDDO9Cd09Z9fEWhjo6jOIr5H50U6NqH7jM8aYDXXnX8pQlQL02g9/L1WQZObFQHQ1t30jYl+DheosDl4jriAl6++YhGN5FEQJkP1xEnM9qXhsAotwKWYdiPuf2qkb7n+eF+6PmH8LvJSPi2S4Dc/hL2n7r9LdQ86gqB6KJ1tFpAd6N0+aKpF/rk7Zk5xA8G4rzAKyWLJ3/kXrPZTJf8efJysRueMXyxK5XcE5P9n17MBqQFGIjoiNUCPTJQkJSgwa4CI2Q7+WJmHTEvE7dqwS/x2kH/Pgn65oX22Qw6d5p1mfPwc46r+MuxnU18QL5F4x0kwXQ0Fq+QmjAC1QIJUjHkXTaYyFdh6ehweUN8oKu3uliVhhW8uWzJ+AOhfbYA/firZ1Y3NFqzwJ0PDS+TTp2rahhKc/4xtBzCvXlOHnCymO/2SgTRXeQLf3RTdzx2HKnn0EXGMa9Jwyn2CSMYuKHkxSl/C2/bAnQerHp5cgl+6niGHax7Tsitpl8KDz8xFd8Z9fGF93x5so4un9Rb5Uno6nWU2AdfH5KVHjnSObdZjmBNBZWxLoQGSkvYwS3A8IqSF6GyNRQBOtuULTmvsnTxxB9YVuB6VG1sxW9O4zc1wb24lZrminHsopzRH482lTccc6eszEpEWoDLbmhEdbEPk1p8U5NTxqF5AAxORyUbVWI1PNbQEJhW9uI5n2laql36zE5T6/IXJi7Nu3H1CsO0r4OmmY2M5CT8oGmmw3IMjURZsWh3h/3pGbas3OKXE5hJy4lMs8s1WESwbAMOejwdUoaIVaR/nt6JKK1GoVAQDEF61lG4+Ks2GPRgQbId3InZl7cxQBeWLJ70ZYzHUYdigs4WHPX4txA9L8qfs34UfM7J2B6NFVmDxLB6i92q0KkLtfcPhX0vSqq3H6geC/98RHg/VwL0MW8e/hjvVy/Xim34CVG+21h+ePawjAk4HDG1byFN4q+r/dQH74aaDGOtFvnw4wC+2BJzo8db/XnJc1Njr7EMua7DuJAdXXXTrq8fI2lpUyPvz8LSjjXLjCEXHIw8Ft8eu65sqmTkjok4K+AvNnyZH0Xsb+eO/wWrg46Do/7gYAAAAABJRU5ErkJggg==`,this._readyState=sn()?$t.Loading:$t.NotFound,this._state=sn()?F.Loading:F.NotFound,this._supportNewTronProtocol=!1,this._onChainChanged=e=>{this.emit(`chainChanged`,e)},this._onAccountsChanged=()=>{let e=this.address||``,t=this._wallet?.tronWeb&&this._wallet?.tronWeb.defaultAddress?.base58||``;this.setAddress(t||null),this.setState(this.address?F.Connected:F.Disconnect),this.emit(`accountsChanged`,this.address||``,e),!e&&this.address?this.emit(`connect`,this.address):e&&!this.address&&this.emit(`disconnect`)},this._checkPromise=null,this._updateWallet=()=>wn(this,void 0,void 0,function*(){this._supportNewTronProtocol=!1;let e=this.state,t=this.address;if(cn()){if(this._wallet=window.tronLink?window.tronLink:{ready:!!window.tronWeb?.defaultAddress,tronWeb:window.tronWeb,request:()=>Promise.resolve(!0)},t=this._wallet.tronWeb?.defaultAddress?.base58||null,t){try{yield this.checkSecurity()}catch{this.setAddress(null),this.setState(F.Disconnect);return}e=F.Connected}else e=F.Disconnect}else if(this.isLegacyTronLinkProvider(window.tron)){this._supportNewTronProtocol=!0,this._wallet=window.tron,this._listenTronEvent();try{t=this._wallet?.tronWeb&&this._wallet.tronWeb?.defaultAddress?.base58||null,e=t?F.Connected:F.Disconnect}catch{t=null,e=F.Disconnect,this._readyState=$t.NotFound,this.emit(`readyStateChanged`,this.readyState);return}}else window.tronLink?(this._wallet=window.tronLink,t=this._wallet.tronWeb?.defaultAddress?.base58||null,e=this._wallet.ready?F.Connected:F.Disconnect):(this._wallet=null,t=null,e=F.NotFound);cn()&&e===F.Disconnect&&this.checkForWalletReadyForApp(),this.setAddress(t),this.setState(e)}),this.checkReadyInterval=null;let{checkTimeout:t=5e3,dappIcon:n=``,dappName:r=``,openUrlWhenWalletNotFound:i=!0,openTronLinkAppOnMobile:a=!0,openAppWithDeeplink:o=!0}=e;if(typeof t!=`number`)throw Error(`[TronLinkAdapter] config.checkTimeout should be a number`);if(this.config=Object.assign(Object.assign({},this.commonConfig),{checkTimeout:t,openTronLinkAppOnMobile:a,openAppWithDeeplink:o,openUrlWhenWalletNotFound:i,dappIcon:n,dappName:r}),this._connecting=!1,this._wallet=null,this._address=null,!sn()){this._readyState=$t.NotFound,this.setState(F.NotFound);return}cn()&&(yn()||cn()&&(window.tronLink||window.tronWeb))?(this._readyState=$t.Found,this._updateWallet().then(()=>{this.connected&&this.emit(`connect`,this.address||``)})):this._checkWallet().then(()=>{this.connected&&this.emit(`connect`,this.address||``)})}get address(){return this._address}get state(){return this._state}get readyState(){return this._readyState}get connecting(){return this._connecting}network(){return wn(this,void 0,void 0,function*(){try{if(yield this._checkWallet(),this.state!==F.Connected)throw new Ht;let e=this._wallet?.tronWeb||window.tronWeb;if(!e)throw new Ht;try{return yield En(e)}catch(e){throw new Yt(e?.message,e)}}catch(e){throw this.emit(`error`,e),e}})}connect(){return wn(this,void 0,void 0,function*(){try{if(!(yield this._beforeConnect())||!this._wallet)return;if(this._connecting=!0,this._supportNewTronProtocol){let e=this._wallet;try{let t=(yield e.request({method:`eth_requestAccounts`}))[0];this.setAddress(t),this.setState(F.Connected),this._listenTronEvent(),this._wallet.tronWeb||(yield Cn(this._wallet))}catch(e){let t=e?.message||e||`Connect TronLink wallet failed.`;throw e.code===-32002&&(t=`The same DApp has already initiated a request to connect to TronLink wallet, and the pop-up window has not been closed.`),e.code===4001&&(t=`The user rejected connection.`),new Ut(t,e)}}else if(window.tronLink){let e=this._wallet,t=yield e.request({method:`tron_requestAccounts`});if(!t)throw new Ut(`TronLink wallet is locked or no wallet account is avaliable.`);if(t.code===4e3)throw new Ut(`The same DApp has already initiated a request to connect to TronLink wallet, and the pop-up window has not been closed.`);if(t.code===4001)throw new Ut(`The user rejected connection.`);let n=e.tronWeb.defaultAddress?.base58||``;this.setAddress(n),this.setState(F.Connected)}else if(window.tronWeb){let e=this._wallet.tronWeb.defaultAddress?.base58||``;this.setAddress(e),this.setState(F.Connected)}else throw new Ut(`Cannot connect wallet.`);this.connected&&this.emit(`connect`,this.address||``)}catch(e){let t=e instanceof Bt?e:new Ut(e?.message,e);throw this.emit(`error`,t),t}finally{this._connecting=!1}})}disconnect(){return wn(this,void 0,void 0,function*(){this._supportNewTronProtocol&&this._stopListenTronEvent(),this.state===F.Connected&&(this.setAddress(null),this.setState(F.Disconnect),this.emit(`disconnect`))})}_checkAndSign(e,t){return wn(this,void 0,void 0,function*(){try{let n=yield this.checkAndGetWallet();try{return yield e(n)}catch(e){throw e instanceof Error||typeof e==`object`&&e.message?new t(e.message,e):typeof e==`string`?new t(e,Error(e)):new t(`Unknown error`,e)}}catch(e){throw this.emit(`error`,e),e}})}signTransaction(e){return wn(this,void 0,void 0,function*(){return this._checkAndSign(t=>t.tronWeb.trx.sign(e),Kt)})}multiSign(e){return wn(this,arguments,void 0,function*(e,t={}){return this._checkAndSign(n=>n.tronWeb.trx.multiSign(e,void 0,t.permissionId),Kt)})}signMessage(e){return wn(this,void 0,void 0,function*(){return this._checkAndSign(t=>wn(this,void 0,void 0,function*(){return t.tronWeb.trx.signMessageV2(e)}),Gt)})}_signTypedData(e){return wn(this,void 0,void 0,function*(){return this._checkAndSign(t=>wn(this,void 0,void 0,function*(){return t.tronWeb.trx._signTypedData(e.domain,e.types,e.message)}),Xt)})}switchChain(e){return wn(this,void 0,void 0,function*(){try{if(yield this._checkWallet(),this.state===F.NotFound)throw this.config.openUrlWhenWalletNotFound!==!1&&sn()&&window.open(this.url,`_blank`),new Vt;if(!this._supportNewTronProtocol)throw new Jt(`Current version of TronLink doesn't support switch chain operation.`);let t=this._wallet;try{yield t.request({method:`wallet_switchEthereumChain`,params:[{chainId:e}]})}catch(e){throw new Jt(e?.message||e,e instanceof Error?e:Error(e))}}catch(e){throw this.emit(`error`,e),e}})}checkAndGetWallet(){return wn(this,void 0,void 0,function*(){if(this._openAppByDeepLinkIfNeed())throw new Vt;if(yield this._checkWallet(),this.state!==F.Connected)throw new Ht;let e=this._wallet;if(!e||!e.tronWeb)throw new Ht;return e})}_openAppByDeepLinkIfNeed(){if(this.config.openAppWithDeeplink===!1||this.config.openTronLinkAppOnMobile===!1)return!1;let{dappName:e=``,dappIcon:t=``}=this.config;return Sn({dappIcon:t,dappName:e})}_listenTronEvent(){var e,t;this._stopListenTronEvent();let n=this._wallet;(e=n.on)==null||e.call(n,`chainChanged`,this._onChainChanged),(t=n.on)==null||t.call(n,`accountsChanged`,this._onAccountsChanged)}_stopListenTronEvent(){var e,t;let n=this._wallet;(e=n.removeListener)==null||e.call(n,`chainChanged`,this._onChainChanged),(t=n.removeListener)==null||t.call(n,`accountsChanged`,this._onAccountsChanged)}isLegacyTronLinkProvider(e){return!!e?.isTronLink}hasDesktopLegacyTronLinkProvider(){return this.isLegacyTronLinkProvider(window.tron)||!!window.tronLink}_checkWallet(){if(this.readyState===$t.Found)return Promise.resolve(!0);if(this._checkPromise)return this._checkPromise;if(sn()&&!cn())return this._checkPromise=new Promise(e=>{let t=!1,n=null,r=null,i=null,a=()=>{r&&=(clearInterval(r),null),n&&=(clearTimeout(n),null),typeof window<`u`&&i&&window.removeEventListener(nn,i)};n=setTimeout(()=>{if(t)return;if(t=!0,a(),typeof window>`u`){e(!1);return}this._updateWallet();let n=this.state!==F.NotFound;this._readyState=n?$t.Found:$t.NotFound,this.emit(`readyStateChanged`,this._readyState),e(n)},this.config.checkTimeout),i=n=>wn(this,void 0,void 0,function*(){if(t)return;let{info:r,provider:i}=n.detail;if(r.name===`TronLink`){t=!0,this._supportNewTronProtocol=!0,this._wallet=i;try{yield this.checkSecurity()}catch{this.setAddress(null),this.setState(F.Disconnect),this._readyState=$t.Found,this.emit(`readyStateChanged`,this.readyState),e(!0);return}this._listenTronEvent(),this._readyState=$t.Found;let n=this._wallet?.tronWeb&&this._wallet.tronWeb.defaultAddress?.base58||null,r=n?F.Connected:F.Disconnect;this.setAddress(n),this.setState(r),this.emit(`readyStateChanged`,this.readyState),a(),e(!0)}}),window.addEventListener(nn,i),window.dispatchEvent(new Event(rn))}),this._checkPromise;let e=Math.floor(this.config.checkTimeout/100),t=0,n;return this._checkPromise=new Promise(r=>{let i=()=>{t++,this._updateWallet();let i=!!(cn()&&(window.tronLink||window.tronWeb));(i||t>e)&&(n&&clearInterval(n),this._readyState=i?$t.Found:$t.NotFound,this.emit(`readyStateChanged`,this.readyState),r(i))};n=setInterval(i,100),i()}),this._checkPromise}checkForWalletReadyForApp(){if(this.checkReadyInterval)return;let e=0,t=Math.floor(this.config.checkTimeout/200),n=()=>{(window.tronLink?window.tronLink.tronWeb?.defaultAddress:window.tronWeb?.defaultAddress)?(this.checkReadyInterval&&clearInterval(this.checkReadyInterval),this.checkReadyInterval=null,this._updateWallet(),this.emit(`connect`,this.address||``)):e>t?(this.checkReadyInterval&&clearInterval(this.checkReadyInterval),this.checkReadyInterval=null):e++};this.checkReadyInterval=setInterval(n,200)}setAddress(e){this._address=e}setState(e){e!==this.state&&(this._state=e,this.emit(`stateChanged`,e))}};function kn(){return!!window.tronLink&&window.isBitKeep}function An(){if(cn()&&!kn()){let{origin:e,pathname:t,search:n,hash:r}=window.location,i=e+t+n+r;return location.href=`https://bkcode.vip?action=dapp&url=${encodeURIComponent(i)}`,!0}return!1}var jn=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Mn=`Bitget Wallet`,Nn=class extends _n{constructor(e={}){if(super(e),this.name=Mn,this.url=`https://web3.bitget.com`,this.icon=`data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTEyIiBoZWlnaHQ9IjUxMiIgdmlld0JveD0iMCAwIDUxMiA1MTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiBmaWxsPSIjMDAxRjI5Ii8+CjxwYXRoIGQ9Ik0yMTkuOTQ4IDk1LjcwMjJDMjAxLjYyMyA5NS42OTI5IDE4My4zMyA5NS42ODM1IDE2NC45NDEgOTUuNzExNkMxNTMuODIyIDk1LjcxMTYgMTQ5LjY1MSAxMDkuNjcxIDE1Ny45MjEgMTE3LjkzOUwyODMuMDk4IDI0My4xMTdDMjg3LjAwNCAyNDYuNjkgMjg5LjQ0MSAyNTAuNTc0IDI4OS41MyAyNTUuNjkzQzI4OS40NDEgMjYwLjgxMiAyODcuMDA0IDI2NC42OTYgMjgzLjA5OCAyNjguMjY5TDE1Ny45MjEgMzkzLjQ0NkMxNDkuNjUxIDQwMS43MTUgMTUzLjgyMiA0MTUuNjc0IDE2NC45NDEgNDE1LjY3NEMxODMuMzMgNDE1LjcwMiAyMDEuNjIzIDQxNS42OTMgMjE5Ljk0OCA0MTUuNjgzQzIyOS4xMjIgNDE1LjY3OSAyMzguMzA1IDQxNS42NzQgMjQ3LjUxMSA0MTUuNjc0QzI1OS41NTUgNDE1LjY3NCAyNjYuNzIgNDA5LjI0IDI3My4xNTQgNDAyLjgwNUwzODYuMDQ3IDI4OS45MTJDMzk1LjA1NyAyODAuOTAyIDQwMy4xMTkgMjY4LjkzOSA0MDMuMDA5IDI1NS42OTNDNDAzLjExOSAyNDIuNDQ3IDM5NS4wNTcgMjMwLjQ4NCAzODYuMDQ3IDIyMS40NzRMMjczLjE1NCAxMDguNThDMjY2LjcyIDEwMi4xNDYgMjU5LjU1NSA5NS43MTE2IDI0Ny41MTEgOTUuNzExNkMyMzguMzA1IDk1LjcxMTYgMjI5LjEyMiA5NS43MDY5IDIxOS45NDggOTUuNzAyMloiIGZpbGw9IiMwMEYwRkYiLz4KPC9zdmc+Cg==`,this._readyState=$t.Loading,this._state=F.Loading,this.checkReadyInterval=null,this._checkPromise=null,this._updateWallet=()=>jn(this,void 0,void 0,function*(){let e=this.state,t=this.address;if(kn()){if(cn()){let e=window.bitkeep?.tronLink;this._wallet={tron:e,tronWeb:e?.tronWeb}}else{let e=window.bitkeep?.tronWeb;this._wallet={tron:window.bitkeep.tronLink,tronWeb:e}}let n=this._wallet.tron?.ready;if(t=n?this._wallet.tronWeb.defaultAddress?.base58||null:``,n){try{yield this.checkSecurity()}catch{this.setAddress(null),this.setState(F.Disconnect);return}e=F.Connected}else e=F.Disconnect,this.checkForWalletReady()}else this._wallet=null,t=null,e=F.NotFound;this.setAddress(t),this.setState(e)}),this.config=Object.assign({},this.commonConfig),this._connecting=!1,this._wallet=null,this._address=null,!sn()){this._readyState=$t.NotFound,this.setState(F.NotFound);return}kn()?(this._readyState=$t.Found,this._updateWallet().then(()=>{this.connected&&this.emit(`connect`,this.address||``)})):this._checkWallet().then(()=>{this.connected&&this.emit(`connect`,this.address||``)})}get address(){return this._address}get state(){return this._state}get readyState(){return this._readyState}get connecting(){return this._connecting}network(){return jn(this,void 0,void 0,function*(){try{if(yield this._checkWallet(),this.state!==F.Connected)throw new Ht;let e=this._wallet;if(!e||!e.tronWeb)throw new Ht;try{return yield En(e.tronWeb)}catch(e){throw new Yt(e?.message,e)}}catch(e){throw this.emit(`error`,e),e}})}connect(){return jn(this,void 0,void 0,function*(){try{if(!(yield this._beforeConnect()))return;let e=this._wallet;if(!e)return;if(!cn()){this._connecting=!0;let t=yield e.tron.request({method:`tron_requestAccounts`});if(t?.code!==200)throw new Ut(t?.code===40001?`The connection request is canceled by user.`:t?.message)}let t=e?.tronWeb.defaultAddress?.base58||window.bitkeep?.tronWeb?.defaultAddress?.base58||``;this.setAddress(t),this.setState(F.Connected),this.emit(`connect`,this.address||``)}catch(e){let t=e instanceof Bt?e:new Ut(e?.message,e);throw this.emit(`error`,t),t}finally{this._connecting=!1}})}disconnect(){return jn(this,void 0,void 0,function*(){this.state===F.Connected&&(this.setAddress(null),this.setState(F.Disconnect),this.emit(`disconnect`))})}signTransaction(e){return jn(this,void 0,void 0,function*(){try{let t=yield this.checkAndGetWallet();try{return yield t.tronWeb.trx.sign(e)}catch(e){throw e instanceof Error?new Kt(e.message,e):new Kt(e,Error(e))}}catch(e){throw this.emit(`error`,e),e}})}multiSign(e){return jn(this,arguments,void 0,function*(e,t={}){try{let n=yield this.checkAndGetWallet();try{return yield n.tronWeb.trx.multiSign(e,void 0,t.permissionId)}catch(e){throw e instanceof Error?new Kt(e.message,e):new Kt(e,Error(e))}}catch(e){throw this.emit(`error`,e),e}})}signMessage(e){return jn(this,void 0,void 0,function*(){try{let t=yield this.checkAndGetWallet();try{return yield t.tronWeb.trx.signMessageV2(e)}catch(e){throw e instanceof Error?new Gt(e.message,e):new Gt(e,Error(e))}}catch(e){throw this.emit(`error`,e),e}})}checkAndGetWallet(){return jn(this,void 0,void 0,function*(){if(this.checkIfOpenApp(),yield this._checkWallet(),!this.connected)throw new Ht;let e=this._wallet;if(!e||!e.tronWeb)throw new Ht;return e})}checkForWalletReady(){if(this.checkReadyInterval)return;let e=0,t=Math.floor(this.config.checkTimeout/200),n=()=>jn(this,void 0,void 0,function*(){this._wallet&&this._wallet?.tron.ready?(this.checkReadyInterval&&clearInterval(this.checkReadyInterval),this.checkReadyInterval=null,yield this._updateWallet(),this.emit(`connect`,this.address||``)):e>t?(this.checkReadyInterval&&clearInterval(this.checkReadyInterval),this.checkReadyInterval=null):e++});this.checkReadyInterval=setInterval(n,200)}_checkWallet(){if(this.readyState===$t.Found)return Promise.resolve(!0);if(this._checkPromise)return this._checkPromise;let e=Math.floor(this.config.checkTimeout/100),t=0,n;return this._checkPromise=new Promise(r=>{let i=()=>jn(this,void 0,void 0,function*(){t++;let i=kn();(i||t>e)&&(n&&clearInterval(n),this._readyState=i?$t.Found:$t.NotFound,yield this._updateWallet(),this.emit(`readyStateChanged`,this.readyState),r(i))});n=setInterval(i,100),i()}),this._checkPromise}checkIfOpenApp(){if(this.config.openAppWithDeeplink!==!1&&An())throw new Vt}setAddress(e){this._address=e}setState(e){e!==this.state&&(this._state=e,this.emit(`stateChanged`,e))}_openAppByDeepLinkIfNeed(){return this.config.openAppWithDeeplink!==!1&&An()}};typeof window<`u`&&window.Buffer===void 0&&(window.Buffer=h);var Pn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,Fn=class{encode(e){let t=``,n,r,i,a,o,s,c,l=0;for(;l<e.length;)n=e.charCodeAt(l++),r=e.charCodeAt(l++),i=e.charCodeAt(l++),a=n>>2,o=(n&3)<<4|r>>4,s=(r&15)<<2|i>>6,c=i&63,isNaN(r)?s=c=64:isNaN(i)&&(c=64),t=t+Pn.charAt(a)+Pn.charAt(o)+Pn.charAt(s)+Pn.charAt(c);return t}encodeIgnoreUtf8(e){let t=``,n,r,i,a,o,s,c,l=0;for(;l<e.length;)n=e[l++],r=e[l++],i=e[l++],a=n>>2,o=(n&3)<<4|r>>4,s=(r&15)<<2|i>>6,c=i&63,isNaN(r)?s=c=64:isNaN(i)&&(c=64),t=t+Pn.charAt(a)+Pn.charAt(o)+Pn.charAt(s)+Pn.charAt(c);return t}decode(e){let t=``,n,r,i,a,o,s,c,l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,``);l<e.length;)a=Pn.indexOf(e.charAt(l++)),o=Pn.indexOf(e.charAt(l++)),s=Pn.indexOf(e.charAt(l++)),c=Pn.indexOf(e.charAt(l++)),n=a<<2|o>>4,r=(o&15)<<4|s>>2,i=(s&3)<<6|c,t+=String.fromCharCode(n),s!=64&&(t+=String.fromCharCode(r)),c!=64&&(t+=String.fromCharCode(i));return this._utf8_decode(t)}decodeToByteArray(e){let t=``,n,r,i,a,o,s,c,l=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,``);l<e.length;)a=Pn.indexOf(e.charAt(l++)),o=Pn.indexOf(e.charAt(l++)),s=Pn.indexOf(e.charAt(l++)),c=Pn.indexOf(e.charAt(l++)),n=a<<2|o>>4,r=(o&15)<<4|s>>2,i=(s&3)<<6|c,t+=String.fromCharCode(n),s!=64&&(t+=String.fromCharCode(r)),c!=64&&(t+=String.fromCharCode(i));return this._out2ByteArray(t)}_out2ByteArray(e){let t=Array(e.length),n=0,r=0;for(;n<e.length;)r=e.charCodeAt(n),t[n]=r,n++;return t}_utf8_encode(e){e=e.replace(/\r\n/g,`
4
4
  `);let t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t+=String.fromCharCode(r):r>127&&r<2048?(t+=String.fromCharCode(r>>6|192),t+=String.fromCharCode(r&63|128)):(t+=String.fromCharCode(r>>12|224),t+=String.fromCharCode(r>>6&63|128),t+=String.fromCharCode(r&63|128))}return t}_utf8_decode(e){let t=``,n=0,r=0,i=0,a=0;for(;n<e.length;)r=e.charCodeAt(n),r<128?(t+=String.fromCharCode(r),n++):r>191&&r<224?(i=e.charCodeAt(n+1),t+=String.fromCharCode((r&31)<<6|i&63),n+=2):(i=e.charCodeAt(n+1),a=e.charCodeAt(n+2),t+=String.fromCharCode((r&15)<<12|(i&63)<<6|a&63),n+=3);return t}},In=e({base64DecodeFromString:()=>Bn,base64EncodeToString:()=>Vn,byte2hexStr:()=>Ln,byteArray2hexStr:()=>I,bytesToString:()=>Rn,hextoString:()=>zn});function Ln(e){if(e<0||e>255)throw Error(`Input must be a byte`);let t=`0123456789ABCDEF`,n=``;return n+=t.charAt(e>>4),n+=t.charAt(e&15),n}function Rn(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n].toString(2),i=r.match(/^1+?(?=0)/);if(i&&r.length===8){let r=i[0].length,a=e[n].toString(2).slice(7-r);for(let t=1;t<r;t++)a+=e[t+n].toString(2).slice(2);t+=String.fromCharCode(parseInt(a,2)),n+=r-1}else t+=String.fromCharCode(e[n])}return t}function zn(e){let t=e.replace(/^0x/,``).split(``),n=``;for(let e=0;e<t.length/2;e++){let r=`0x${t[e*2]}${t[e*2+1]}`;n+=String.fromCharCode(parseInt(r))}return n}function I(e){let t=``;for(let n=0;n<e.length;n++)t+=Ln(e[n]);return t}function Bn(e){return new Fn().decodeToByteArray(e)}function Vn(e){return new Fn().encodeIgnoreUtf8(e)}var Hn=e({ADDRESS_PREFIX:()=>`41`,ADDRESS_PREFIX_BYTE:()=>65,ADDRESS_PREFIX_REGEX:()=>Un,ADDRESS_SIZE:()=>34,TRON_BIP39_PATH_INDEX_0:()=>Gn,TRON_BIP39_PATH_PREFIX:()=>Wn}),Un=/^(41)/,Wn=`m/44'/195'`,Gn=`m/44'/195'/0'/0/0`,Kn=e({arrayEquals:()=>Jn,base64DecodeFromString:()=>Bn,base64EncodeToString:()=>Vn,bin2String:()=>qn,byte2hexStr:()=>Ln,byteArray2hexStr:()=>I,bytesToString:()=>Rn,getStringType:()=>tr,hexChar2byte:()=>Xn,hexStr2byteArray:()=>Qn,hextoString:()=>zn,isHexChar:()=>Zn,isNumber:()=>er,strToDate:()=>$n,stringToBytes:()=>Yn});function qn(e){return Rn(e)}function Jn(e,t,n=!1){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(n){if(e[r]!=t[r])return!1}else if(JSON.stringify(e[r])!=JSON.stringify(t[r]))return!1;return!0}function Yn(e){let t=[],n=e.length,r;for(let i=0;i<n;i++)r=e.charCodeAt(i),r>=65536&&r<=1114111?(t.push(r>>18&7|240),t.push(r>>12&63|128),t.push(r>>6&63|128),t.push(r&63|128)):r>=2048&&r<=65535?(t.push(r>>12&15|224),t.push(r>>6&63|128),t.push(r&63|128)):r>=128&&r<=2047?(t.push(r>>6&31|192),t.push(r&63|128)):t.push(r&255);return t}function Xn(e){let t;if(e>=`A`&&e<=`F`?t=e.charCodeAt(0)-65+10:e>=`a`&&e<=`f`?t=e.charCodeAt(0)-97+10:e>=`0`&&e<=`9`&&(t=e.charCodeAt(0)-48),typeof t==`number`)return t;throw Error(`The passed hex char is not a valid hex char`)}function Zn(e){return+(e>=`A`&&e<=`F`||e>=`a`&&e<=`f`||e>=`0`&&e<=`9`)}function Qn(e,t=!1){let n=e.length;t&&n%2&&(e=`0${e}`,n++);let r=[],i=0,a=0,o=0;for(let t=0;t<n;t++){let n=e.charAt(t);if(Zn(n))i<<=4,i+=Xn(n),a++,a%2==0&&(r[o++]=i,i=0);else throw Error(`The passed hex char is not a valid hex string`)}return r}function $n(e){if(!/^\d{4}-\d{2}-\d{2}( \d{2}-\d{2}-\d{2}|)/.test(e))throw Error(`The passed date string is not valid`);let t=e.split(` `),n=t[0].split(`-`),r=parseInt(n[0],10),i=parseInt(n[1],10)-1,a=parseInt(n[2],10);if(t.length>1){let e=t[1].split(`-`),n=parseInt(e[0],10),o=parseInt(e[1],10),s=parseInt(e[2],10);return new Date(r,i,a,n,o,s)}return new Date(r,i,a)}function er(e){return+(e>=`0`&&e<=`9`)}function tr(e){if(e==null||e.length==0||e==``)return-1;let t=0;if(e.length==40)for(;t<40&&Zn(e.charAt(t));t++);if(t==40)return 1;for(t=0;t<e.length&&er(e.charAt(t));t++);if(t==e.length)return 2;for(t=0;t<e.length;t++)if(e.charAt(t)>` `)return 3;return-1}var nr=e({decode58:()=>sr,encode58:()=>or}),rr=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,ir={};for(let e=0;e<58;e++)ir[rr.charAt(e)]=e;var ar=58;function or(e){if(e.length===0)return``;let t,n,r=[0];for(t=0;t<e.length;t++){for(n=0;n<r.length;n++)r[n]<<=8;r[0]+=e[t];let i=0;for(n=0;n<r.length;++n)r[n]+=i,i=r[n]/ar|0,r[n]%=ar;for(;i;)r.push(i%ar),i=i/ar|0}for(t=0;e[t]===0&&t<e.length-1;t++)r.push(0);return r.reverse().map(e=>rr[e]).join(``)}function sr(e){if(e.length===0)return[];let t,n,r=[0];for(t=0;t<e.length;t++){let i=e[t];if(!(i in ir))throw Error(`Non-base58 character`);for(n=0;n<r.length;n++)r[n]*=ar;r[0]+=ir[i];let a=0;for(n=0;n<r.length;++n)r[n]+=a,a=r[n]>>8,r[n]&=255;for(;a;)r.push(a&255),a>>=8}for(t=0;e[t]===`1`&&t<e.length-1;t++)r.push(0);return r.reverse()}var cr=`6.13.5`;function lr(e,t,n){let r=t.split(`|`).map(e=>e.trim());for(let n=0;n<r.length;n++)switch(t){case`any`:return;case`bigint`:case`boolean`:case`number`:case`string`:if(typeof e===t)return}let i=Error(`invalid value for type ${t}`);throw i.code=`INVALID_ARGUMENT`,i.argument=`value.${n}`,i.value=e,i}async function ur(e){let t=Object.keys(e);return(await Promise.all(t.map(t=>Promise.resolve(e[t])))).reduce((e,n,r)=>(e[t[r]]=n,e),{})}function L(e,t,n){for(let r in t){let i=t[r],a=n?n[r]:null;a&&lr(i,a,r),Object.defineProperty(e,r,{enumerable:!0,value:i,writable:!1})}}function dr(e){if(e==null)return`null`;if(Array.isArray(e))return`[ `+e.map(dr).join(`, `)+` ]`;if(e instanceof Uint8Array){let t=`0123456789abcdef`,n=`0x`;for(let r=0;r<e.length;r++)n+=t[e[r]>>4],n+=t[e[r]&15];return n}if(typeof e==`object`&&typeof e.toJSON==`function`)return dr(e.toJSON());switch(typeof e){case`boolean`:case`symbol`:return e.toString();case`bigint`:return BigInt(e).toString();case`number`:return e.toString();case`string`:return JSON.stringify(e);case`object`:{let t=Object.keys(e);return t.sort(),`{ `+t.map(t=>`${dr(t)}: ${dr(e[t])}`).join(`, `)+` }`}}return`[ COULD NOT SERIALIZE ]`}function fr(e,t){return e&&e.code===t}function pr(e,t,n){let r=e;{let r=[];if(n){if(`message`in n||`code`in n||`name`in n)throw Error(`value will overwrite populated values: ${dr(n)}`);for(let e in n){if(e===`shortMessage`)continue;let t=n[e];r.push(e+`=`+dr(t))}}r.push(`code=${t}`),r.push(`version=${cr}`),r.length&&(e+=` (`+r.join(`, `)+`)`)}let i;switch(t){case`INVALID_ARGUMENT`:i=TypeError(e);break;case`NUMERIC_FAULT`:case`BUFFER_OVERRUN`:i=RangeError(e);break;default:i=Error(e)}return L(i,{code:t}),n&&Object.assign(i,n),i.shortMessage??L(i,{shortMessage:r}),i}function R(e,t,n,r){if(!e)throw pr(t,n,r)}function z(e,t,n,r){R(e,t,`INVALID_ARGUMENT`,{argument:n,value:r})}function mr(e,t,n){n??=``,n&&=`: `+n,R(e>=t,`missing argument`+n,`MISSING_ARGUMENT`,{count:e,expectedCount:t}),R(e<=t,`too many arguments`+n,`UNEXPECTED_ARGUMENT`,{count:e,expectedCount:t})}var hr=[`NFD`,`NFC`,`NFKD`,`NFKC`].reduce((e,t)=>{try{if(`test`.normalize(t)!==`test`)throw Error(`bad`);if(t===`NFD`&&`é`.normalize(`NFD`)!==`é`)throw Error(`broken`);e.push(t)}catch{}return e},[]);function gr(e){R(hr.indexOf(e)>=0,`platform missing String.prototype.normalize`,`UNSUPPORTED_OPERATION`,{operation:`String.prototype.normalize`,info:{form:e}})}function _r(e,t,n){if(n??=``,e!==t){let e=n,t=`new`;n&&(e+=`.`,t+=` `+n),R(!1,`private constructor; use ${e}from* methods`,`UNSUPPORTED_OPERATION`,{operation:t})}}function vr(e,t,n){if(e instanceof Uint8Array)return n?new Uint8Array(e):e;if(typeof e==`string`&&e.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){let t=new Uint8Array((e.length-2)/2),n=2;for(let r=0;r<t.length;r++)t[r]=parseInt(e.substring(n,n+2),16),n+=2;return t}z(!1,`invalid BytesLike value`,t||`value`,e)}function B(e,t){return vr(e,t,!1)}function yr(e,t){return vr(e,t,!0)}function br(e,t){return!(typeof e!=`string`||!e.match(/^0x[0-9A-Fa-f]*$/)||typeof t==`number`&&e.length!==2+2*t||t===!0&&e.length%2!=0)}function xr(e){return br(e,!0)||e instanceof Uint8Array}var Sr=`0123456789abcdef`;function V(e){let t=B(e),n=`0x`;for(let e=0;e<t.length;e++){let r=t[e];n+=Sr[(r&240)>>4]+Sr[r&15]}return n}function Cr(e){return`0x`+e.map(e=>V(e).substring(2)).join(``)}function wr(e){return br(e,!0)?(e.length-2)/2:B(e).length}function Tr(e,t,n){let r=B(e);return n!=null&&n>r.length&&R(!1,`cannot slice beyond data bounds`,`BUFFER_OVERRUN`,{buffer:r,length:r.length,offset:n}),V(r.slice(t??0,n??r.length))}function Er(e,t,n){let r=B(e);R(t>=r.length,`padding exceeds data length`,`BUFFER_OVERRUN`,{buffer:new Uint8Array(r),length:t,offset:t+1});let i=new Uint8Array(t);return i.fill(0),n?i.set(r,t-r.length):i.set(r,0),V(i)}function Dr(e,t){return Er(e,t,!0)}var Or=BigInt(0),kr=BigInt(1),Ar=9007199254740991;function jr(e,t){let n=Fr(e,`value`),r=BigInt(Rr(t,`width`));if(R(n>>r===Or,`overflow`,`NUMERIC_FAULT`,{operation:`fromTwos`,fault:`overflow`,value:e}),n>>r-kr){let e=(kr<<r)-kr;return-((~n&e)+kr)}return n}function Mr(e,t){let n=Pr(e,`value`),r=BigInt(Rr(t,`width`)),i=kr<<r-kr;if(n<Or){n=-n,R(n<=i,`too low`,`NUMERIC_FAULT`,{operation:`toTwos`,fault:`overflow`,value:e});let t=(kr<<r)-kr;return(~n&t)+kr}return R(n<i,`too high`,`NUMERIC_FAULT`,{operation:`toTwos`,fault:`overflow`,value:e}),n}function Nr(e,t){return Fr(e,`value`)&(kr<<BigInt(Rr(t,`bits`)))-kr}function Pr(e,t){switch(typeof e){case`bigint`:return e;case`number`:return z(Number.isInteger(e),`underflow`,t||`value`,e),z(e>=-9007199254740991&&e<=Ar,`overflow`,t||`value`,e),BigInt(e);case`string`:try{if(e===``)throw Error(`empty string`);return e[0]===`-`&&e[1]!==`-`?-BigInt(e.substring(1)):BigInt(e)}catch(n){z(!1,`invalid BigNumberish string: ${n.message}`,t||`value`,e)}}z(!1,`invalid BigNumberish value`,t||`value`,e)}function Fr(e,t){let n=Pr(e,t);return R(n>=Or,`unsigned value cannot be negative`,`NUMERIC_FAULT`,{fault:`overflow`,operation:`getUint`,value:e}),n}var Ir=`0123456789abcdef`;function Lr(e){if(e instanceof Uint8Array){let t=`0x0`;for(let n of e)t+=Ir[n>>4],t+=Ir[n&15];return BigInt(t)}return Pr(e)}function Rr(e,t){switch(typeof e){case`bigint`:return z(e>=-9007199254740991&&e<=Ar,`overflow`,t||`value`,e),Number(e);case`number`:return z(Number.isInteger(e),`underflow`,t||`value`,e),z(e>=-9007199254740991&&e<=Ar,`overflow`,t||`value`,e),e;case`string`:try{if(e===``)throw Error(`empty string`);return Rr(BigInt(e),t)}catch(n){z(!1,`invalid numeric string: ${n.message}`,t||`value`,e)}}z(!1,`invalid numeric value`,t||`value`,e)}function zr(e){return Rr(Lr(e))}function Br(e,t){let n=Fr(e,`value`).toString(16);if(t==null)n.length%2&&(n=`0`+n);else{let r=Rr(t,`width`);for(R(r*2>=n.length,`value exceeds width (${r} bytes)`,`NUMERIC_FAULT`,{operation:`toBeHex`,fault:`overflow`,value:e});n.length<r*2;)n=`0`+n}return`0x`+n}function Vr(e){let t=Fr(e,`value`);if(t===Or)return new Uint8Array([]);let n=t.toString(16);n.length%2&&(n=`0`+n);let r=new Uint8Array(n.length/2);for(let e=0;e<r.length;e++){let t=e*2;r[e]=parseInt(n.substring(t,t+2),16)}return r}function Hr(e){let t=V(xr(e)?e:Vr(e)).substring(2);for(;t.startsWith(`0`);)t=t.substring(1);return t===``&&(t=`0`),`0x`+t}var Ur=`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`,Wr=null;function Gr(e){if(Wr==null){Wr={};for(let e=0;e<58;e++)Wr[Ur[e]]=BigInt(e)}let t=Wr[e];return z(t!=null,`invalid base58 value`,`letter`,e),t}var Kr=BigInt(0),qr=BigInt(58);function Jr(e){let t=B(e),n=Lr(t),r=``;for(;n;)r=Ur[Number(n%qr)]+r,n/=qr;for(let e=0;e<t.length&&!t[e];e++)r=Ur[0]+r;return r}function Yr(e){let t=Kr;for(let n=0;n<e.length;n++)t*=qr,t+=Gr(e[n]);return t}function Xr(e,t,n,r,i){z(!1,`invalid codepoint at offset ${t}; ${e}`,`bytes`,n)}function Zr(e,t,n,r,i){if(e===`BAD_PREFIX`||e===`UNEXPECTED_CONTINUE`){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return e===`OVERRUN`?n.length-t-1:0}function Qr(e,t,n,r,i){return e===`OVERLONG`?(z(typeof i==`number`,`invalid bad code point for replacement`,`badCodepoint`,i),r.push(i),0):(r.push(65533),Zr(e,t,n,r,i))}var $r=Object.freeze({error:Xr,ignore:Zr,replace:Qr});function ei(e,t){t??=$r.error;let n=B(e,`bytes`),r=[],i=0;for(;i<n.length;){let e=n[i++];if(!(e>>7)){r.push(e);continue}let a=null,o=null;if((e&224)==192)a=1,o=127;else if((e&240)==224)a=2,o=2047;else if((e&248)==240)a=3,o=65535;else{(e&192)==128?i+=t(`UNEXPECTED_CONTINUE`,i-1,n,r):i+=t(`BAD_PREFIX`,i-1,n,r);continue}if(i-1+a>=n.length){i+=t(`OVERRUN`,i-1,n,r);continue}let s=e&(1<<8-a-1)-1;for(let e=0;e<a;e++){let e=n[i];if((e&192)!=128){i+=t(`MISSING_CONTINUE`,i,n,r),s=null;break}s=s<<6|e&63,i++}if(s!==null){if(s>1114111){i+=t(`OUT_OF_RANGE`,i-1-a,n,r,s);continue}if(s>=55296&&s<=57343){i+=t(`UTF16_SURROGATE`,i-1-a,n,r,s);continue}if(s<=o){i+=t(`OVERLONG`,i-1-a,n,r,s);continue}r.push(s)}}return r}function ti(e,t){z(typeof e==`string`,`invalid string value`,`str`,e),t!=null&&(gr(t),e=e.normalize(t));let n=[];for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(r&63|128);else if((r&64512)==55296){t++;let i=e.charCodeAt(t);z(t<e.length&&(i&64512)==56320,`invalid surrogate pair`,`str`,e);let a=65536+((r&1023)<<10)+(i&1023);n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(a&63|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(r&63|128)}return new Uint8Array(n)}function ni(e){return e.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join(``)}function ri(e,t){return ni(ei(e,t))}function ii(e){let t=e.toString(16);for(;t.length<2;)t=`0`+t;return`0x`+t}function ai(e,t,n){let r=0;for(let i=0;i<n;i++)r=r*256+e[t+i];return r}function oi(e,t,n,r){let i=[];for(;n<t+1+r;){let a=si(e,n);i.push(a.result),n+=a.consumed,R(n<=t+1+r,`child data too short`,`BUFFER_OVERRUN`,{buffer:e,length:r,offset:t})}return{consumed:1+r,result:i}}function si(e,t){R(e.length!==0,`data too short`,`BUFFER_OVERRUN`,{buffer:e,length:0,offset:1});let n=t=>{R(t<=e.length,`data short segment too short`,`BUFFER_OVERRUN`,{buffer:e,length:e.length,offset:t})};if(e[t]>=248){let r=e[t]-247;n(t+1+r);let i=ai(e,t+1,r);return n(t+1+r+i),oi(e,t,t+1+r,r+i)}if(e[t]>=192){let r=e[t]-192;return n(t+1+r),oi(e,t,t+1,r)}if(e[t]>=184){let r=e[t]-183;n(t+1+r);let i=ai(e,t+1,r);n(t+1+r+i);let a=V(e.slice(t+1+r,t+1+r+i));return{consumed:1+r+i,result:a}}if(e[t]>=128){let r=e[t]-128;n(t+1+r);let i=V(e.slice(t+1,t+1+r));return{consumed:1+r,result:i}}return{consumed:1,result:ii(e[t])}}function ci(e){let t=B(e,`data`),n=si(t,0);return z(n.consumed===t.length,`unexpected junk after rlp payload`,`data`,e),n.result}function li(e){let t=[];for(;e;)t.unshift(e&255),e>>=8;return t}function ui(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(ui(e))}),t.length<=55)return t.unshift(192+t.length),t;let n=li(t.length);return n.unshift(247+n.length),n.concat(t)}let t=Array.prototype.slice.call(B(e,`object`));if(t.length===1&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;let n=li(t.length);return n.unshift(183+n.length),n.concat(t)}var di=`0123456789abcdef`;function fi(e){let t=`0x`;for(let n of ui(e))t+=di[n>>4],t+=di[n&15];return t}function pi(e){let t=B(e,`randomBytes`);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=V(t);return[n.substring(2,10),n.substring(10,14),n.substring(14,18),n.substring(18,22),n.substring(22,34)].join(`-`)}var mi=new Uint8Array(32),hi=[`then`],gi={},_i=new WeakMap;function vi(e){return _i.get(e)}function yi(e,t){_i.set(e,t)}function bi(e,t){let n=Error(`deferred error during ABI decoding triggered accessing ${e}`);throw n.error=t,n}function xi(e,t,n){return e.indexOf(null)>=0?t.map((e,t)=>e instanceof Si?xi(vi(e),e,n):e):e.reduce((e,r,i)=>{let a=t.getValue(r);return r in e||(n&&a instanceof Si&&(a=xi(vi(a),a,n)),e[r]=a),e},{})}var Si=class e extends Array{#e;constructor(...e){let t=e[0],n=e[1],r=(e[2]||[]).slice(),i=!0;t!==gi&&(n=e,r=[],i=!1),super(n.length),n.forEach((e,t)=>{this[t]=e});let a=r.reduce((e,t)=>(typeof t==`string`&&e.set(t,(e.get(t)||0)+1),e),new Map);if(yi(this,Object.freeze(n.map((e,t)=>{let n=r[t];return n!=null&&a.get(n)===1?n:null}))),this.#e=[],this.#e??this.#e,!i)return;Object.freeze(this);let o=new Proxy(this,{get:(e,t,n)=>{if(typeof t==`string`){if(t.match(/^[0-9]+$/)){let n=Rr(t,`%index`);if(n<0||n>=this.length)throw RangeError(`out of result range`);let r=e[n];return r instanceof Error&&bi(`index ${n}`,r),r}if(hi.indexOf(t)>=0)return Reflect.get(e,t,n);let r=e[t];if(r instanceof Function)return function(...t){return r.apply(this===n?e:this,t)};if(!(t in e))return e.getValue.apply(this===n?e:this,[t])}return Reflect.get(e,t,n)}});return yi(o,vi(this)),o}toArray(t){let n=[];return this.forEach((r,i)=>{r instanceof Error&&bi(`index ${i}`,r),t&&r instanceof e&&(r=r.toArray(t)),n.push(r)}),n}toObject(e){let t=vi(this);return t.reduce((n,r,i)=>(R(r!=null,`value at index ${i} unnamed`,`UNSUPPORTED_OPERATION`,{operation:`toObject()`}),xi(t,this,e)),{})}slice(t,n){t??=0,t<0&&(t+=this.length,t<0&&(t=0)),n??=this.length,n<0&&(n+=this.length,n<0&&(n=0)),n>this.length&&(n=this.length);let r=vi(this),i=[],a=[];for(let e=t;e<n;e++)i.push(this[e]),a.push(r[e]);return new e(gi,i,a)}filter(t,n){let r=vi(this),i=[],a=[];for(let e=0;e<this.length;e++){let o=this[e];o instanceof Error&&bi(`index ${e}`,o),t.call(n,o,e,this)&&(i.push(o),a.push(r[e]))}return new e(gi,i,a)}map(e,t){let n=[];for(let r=0;r<this.length;r++){let i=this[r];i instanceof Error&&bi(`index ${r}`,i),n.push(e.call(t,i,r,this))}return n}getValue(e){let t=vi(this).indexOf(e);if(t===-1)return;let n=this[t];return n instanceof Error&&bi(`property ${JSON.stringify(e)}`,n.error),n}static fromItems(t,n){return new e(gi,t,n)}};function Ci(e){let t=Vr(e);return R(t.length<=32,`value out-of-bounds`,`BUFFER_OVERRUN`,{buffer:t,length:32,offset:t.length}),t.length!==32&&(t=yr(Cr([mi.slice(t.length%32),t]))),t}var wi=class{name;type;localName;dynamic;constructor(e,t,n,r){L(this,{name:e,type:t,localName:n,dynamic:r},{name:`string`,type:`string`,localName:`string`,dynamic:`boolean`})}_throwError(e,t){z(!1,e,this.localName,t)}},Ti=class{#e;#t;constructor(){this.#e=[],this.#t=0}get data(){return Cr(this.#e)}get length(){return this.#t}#n(e){return this.#e.push(e),this.#t+=e.length,e.length}appendWriter(e){return this.#n(yr(e.data))}writeBytes(e){let t=yr(e),n=t.length%32;return n&&(t=yr(Cr([t,mi.slice(n)]))),this.#n(t)}writeValue(e){return this.#n(Ci(e))}writeUpdatableValue(){let e=this.#e.length;return this.#e.push(mi),this.#t+=32,t=>{this.#e[e]=Ci(t)}}},Ei=class e{allowLoose;#e;#t;#n;#r;#i;constructor(e,t,n){L(this,{allowLoose:!!t}),this.#e=yr(e),this.#n=0,this.#r=null,this.#i=n??1024,this.#t=0}get data(){return V(this.#e)}get dataLength(){return this.#e.length}get consumed(){return this.#t}get bytes(){return new Uint8Array(this.#e)}#a(e){if(this.#r)return this.#r.#a(e);this.#n+=e,R(this.#i<1||this.#n<=this.#i*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#i} ( see: https:/\/github.com/ethers-io/ethers.js/issues/4537 )`,`BUFFER_OVERRUN`,{buffer:yr(this.#e),offset:this.#t,length:e,info:{bytesRead:this.#n,dataLength:this.dataLength}})}#o(e,t,n){let r=Math.ceil(t/32)*32;return this.#t+r>this.#e.length&&(this.allowLoose&&n&&this.#t+t<=this.#e.length?r=t:R(!1,`data out-of-bounds`,`BUFFER_OVERRUN`,{buffer:yr(this.#e),length:this.#e.length,offset:this.#t+r})),this.#e.slice(this.#t,this.#t+r)}subReader(t){let n=new e(this.#e.slice(this.#t+t),this.allowLoose,this.#i);return n.#r=this,n}readBytes(e,t){let n=this.#o(0,e,!!t);return this.#a(e),this.#t+=n.length,n.slice(0,e)}readValue(){return Lr(this.readBytes(32))}readIndex(){return zr(this.readBytes(32))}};function Di(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`Wrong positive integer: ${e}`)}function Oi(e,...t){if(!(e instanceof Uint8Array))throw Error(`Expected Uint8Array`);if(t.length>0&&!t.includes(e.length))throw Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function ki(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.wrapConstructor`);Di(e.outputLen),Di(e.blockLen)}function Ai(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function ji(e,t){Oi(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least ${n}`)}var Mi=typeof globalThis==`object`&&`crypto`in globalThis?globalThis.crypto:void 0,Ni=e=>e instanceof Uint8Array,Pi=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Fi=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ii=(e,t)=>e<<32-t|e>>>t;if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw Error(`Non little-endian hardware is not supported`);var Li=async()=>{};async function Ri(e,t,n){let r=Date.now();for(let i=0;i<e;i++){n(i);let e=Date.now()-r;e>=0&&e<t||(await Li(),r+=e)}}function zi(e){if(typeof e!=`string`)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Bi(e){if(typeof e==`string`&&(e=zi(e)),!Ni(e))throw Error(`expected Uint8Array, got ${typeof e}`);return e}function Vi(...e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;return e.forEach(e=>{if(!Ni(e))throw Error(`Uint8Array expected`);t.set(e,n),n+=e.length}),t}var Hi=class{clone(){return this._cloneInto()}},Ui={}.toString;function Wi(e,t){if(t!==void 0&&Ui.call(t)!==`[object Object]`)throw Error(`Options should be object or undefined`);return Object.assign(e,t)}function Gi(e){let t=t=>e().update(Bi(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ki(e=32){if(Mi&&typeof Mi.getRandomValues==`function`)return Mi.getRandomValues(new Uint8Array(e));throw Error(`crypto.getRandomValues must be defined`)}var qi=class extends Hi{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ki(e);let n=Bi(t);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return Ai(this),this.iHash.update(e),this}digestInto(e){Ai(this),Oi(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Ji=(e,t,n)=>new qi(e,t).update(n).digest();Ji.create=(e,t)=>new qi(e,t);function Yi(e,t,n,r){ki(e);let{c:i,dkLen:a,asyncTick:o}=Wi({dkLen:32,asyncTick:10},r);if(Di(i),Di(a),Di(o),i<1)throw Error(`PBKDF2: iterations (c) should be >= 1`);let s=Bi(t),c=Bi(n),l=new Uint8Array(a),u=Ji.create(e,s);return{c:i,dkLen:a,asyncTick:o,DK:l,PRF:u,PRFSalt:u._cloneInto().update(c)}}function Xi(e,t,n,r,i){return e.destroy(),t.destroy(),r&&r.destroy(),i.fill(0),n}function Zi(e,t,n,r){let{c:i,dkLen:a,DK:o,PRF:s,PRFSalt:c}=Yi(e,t,n,r),l,u=new Uint8Array(4),d=Fi(u),f=new Uint8Array(s.outputLen);for(let e=1,t=0;t<a;e++,t+=s.outputLen){let n=o.subarray(t,t+s.outputLen);d.setInt32(0,e,!1),(l=c._cloneInto(l)).update(u).digestInto(f),n.set(f.subarray(0,n.length));for(let e=1;e<i;e++){s._cloneInto(l).update(f).digestInto(f);for(let e=0;e<n.length;e++)n[e]^=f[e]}}return Xi(s,c,o,l,f)}function Qi(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}var $i=class extends Hi{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Fi(this.buffer)}update(e){Ai(this);let{view:t,buffer:n,blockLen:r}=this;e=Bi(e);let i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=Fi(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ai(this),ji(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;Qi(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=Fi(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.length=r,e.pos=o,e.finished=i,e.destroyed=a,r%t&&e.buffer.set(n),e}},ea=(e,t,n)=>e&t^~e&n,ta=(e,t,n)=>e&t^e&n^t&n,na=new Uint32Array([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]),ra=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ia=new Uint32Array(64),aa=class extends $i{constructor(){super(64,32,8,!1),this.A=ra[0]|0,this.B=ra[1]|0,this.C=ra[2]|0,this.D=ra[3]|0,this.E=ra[4]|0,this.F=ra[5]|0,this.G=ra[6]|0,this.H=ra[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)ia[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=ia[e-15],n=ia[e-2],r=Ii(t,7)^Ii(t,18)^t>>>3,i=Ii(n,17)^Ii(n,19)^n>>>10;ia[e]=i+ia[e-7]+r+ia[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=Ii(o,6)^Ii(o,11)^Ii(o,25),u=l+t+ea(o,s,c)+na[e]+ia[e]|0,d=(Ii(n,2)^Ii(n,13)^Ii(n,22))+ta(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){ia.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},oa=Gi(()=>new aa),sa=BigInt(2**32-1),ca=BigInt(32);function la(e,t=!1){return t?{h:Number(e&sa),l:Number(e>>ca&sa)}:{h:Number(e>>ca&sa)|0,l:Number(e&sa)|0}}function ua(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:a,l:o}=la(e[i],t);[n[i],r[i]]=[a,o]}return[n,r]}var da=(e,t)=>BigInt(e>>>0)<<ca|BigInt(t>>>0),fa=(e,t,n)=>e>>>n,pa=(e,t,n)=>e<<32-n|t>>>n,ma=(e,t,n)=>e>>>n|t<<32-n,ha=(e,t,n)=>e<<32-n|t>>>n,ga=(e,t,n)=>e<<64-n|t>>>n-32,_a=(e,t,n)=>e>>>n-32|t<<64-n,va=(e,t)=>t,ya=(e,t)=>e,ba=(e,t,n)=>e<<n|t>>>32-n,xa=(e,t,n)=>t<<n|e>>>32-n,Sa=(e,t,n)=>t<<n-32|e>>>64-n,Ca=(e,t,n)=>e<<n-32|t>>>64-n;function wa(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var H={fromBig:la,split:ua,toBig:da,shrSH:fa,shrSL:pa,rotrSH:ma,rotrSL:ha,rotrBH:ga,rotrBL:_a,rotr32H:va,rotr32L:ya,rotlSH:ba,rotlSL:xa,rotlBH:Sa,rotlBL:Ca,add:wa,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5H:(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0,add5L:(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[Ta,Ea]=H.split(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e))),Da=new Uint32Array(80),Oa=new Uint32Array(80),ka=class extends $i{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}process(e,t){for(let n=0;n<16;n++,t+=4)Da[n]=e.getUint32(t),Oa[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=Da[e-15]|0,n=Oa[e-15]|0,r=H.rotrSH(t,n,1)^H.rotrSH(t,n,8)^H.shrSH(t,n,7),i=H.rotrSL(t,n,1)^H.rotrSL(t,n,8)^H.shrSL(t,n,7),a=Da[e-2]|0,o=Oa[e-2]|0,s=H.rotrSH(a,o,19)^H.rotrBH(a,o,61)^H.shrSH(a,o,6),c=H.rotrSL(a,o,19)^H.rotrBL(a,o,61)^H.shrSL(a,o,6),l=H.add4L(i,c,Oa[e-7],Oa[e-16]),u=H.add4H(l,r,s,Da[e-7],Da[e-16]);Da[e]=u|0,Oa[e]=l|0}let{Ah:n,Al:r,Bh:i,Bl:a,Ch:o,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:h,Hh:g,Hl:_}=this;for(let e=0;e<80;e++){let t=H.rotrSH(u,d,14)^H.rotrSH(u,d,18)^H.rotrBH(u,d,41),v=H.rotrSL(u,d,14)^H.rotrSL(u,d,18)^H.rotrBL(u,d,41),y=u&f^~u&m,b=d&p^~d&h,x=H.add5L(_,v,b,Ea[e],Oa[e]),S=H.add5H(x,g,t,y,Ta[e],Da[e]),ee=x|0,te=H.rotrSH(n,r,28)^H.rotrBH(n,r,34)^H.rotrBH(n,r,39),C=H.rotrSL(n,r,28)^H.rotrBL(n,r,34)^H.rotrBL(n,r,39),ne=n&i^n&o^i&o,re=r&a^r&s^a&s;g=m|0,_=h|0,m=f|0,h=p|0,f=u|0,p=d|0,{h:u,l:d}=H.add(c|0,l|0,S|0,ee|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let w=H.add3L(ee,C,re);n=H.add3H(w,S,te,ne),r=w|0}({h:n,l:r}=H.add(this.Ah|0,this.Al|0,n|0,r|0)),{h:i,l:a}=H.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:s}=H.add(this.Ch|0,this.Cl|0,o|0,s|0),{h:c,l}=H.add(this.Dh|0,this.Dl|0,c|0,l|0),{h:u,l:d}=H.add(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=H.add(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:h}=H.add(this.Gh|0,this.Gl|0,m|0,h|0),{h:g,l:_}=H.add(this.Hh|0,this.Hl|0,g|0,_|0),this.set(n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)}roundClean(){Da.fill(0),Oa.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Aa=Gi(()=>new ka);c();function ja(){if(typeof self<`u`)return self;if(typeof window<`u`)return window;if(l!==void 0)return l;throw Error(`unable to locate global object`)}var Ma=ja(),Na=Ma.crypto||Ma.msCrypto;function Pa(e){switch(e){case`sha256`:return oa.create();case`sha512`:return Aa.create()}z(!1,`invalid hashing algorithm name`,`algorithm`,e)}function Fa(e,t){let n={sha256:oa,sha512:Aa}[e];return z(n!=null,`invalid hmac algorithm`,`algorithm`,e),Ji.create(n,t)}function Ia(e,t,n,r,i){let a={sha256:oa,sha512:Aa}[i];return z(a!=null,`invalid pbkdf2 algorithm`,`algorithm`,i),Zi(a,e,t,{c:n,dkLen:r})}function La(e){R(Na!=null,`platform does not support secure random numbers`,`UNSUPPORTED_OPERATION`,{operation:`randomBytes`}),z(Number.isInteger(e)&&e>0&&e<=1024,`invalid length`,`length`,e);let t=new Uint8Array(e);return Na.getRandomValues(t),t}var Ra=!1,za=function(e,t,n){return Fa(e,t).update(n).digest()},Ba=za;function Va(e,t,n){let r=B(t,`key`),i=B(n,`data`);return V(Ba(e,r,i))}Va._=za,Va.lock=function(){Ra=!0},Va.register=function(e){if(Ra)throw Error(`computeHmac is locked`);Ba=e},Object.freeze(Va);var[Ha,Ua,Wa]=[[],[],[]],Ga=BigInt(0),Ka=BigInt(1),qa=BigInt(2),Ja=BigInt(7),Ya=BigInt(256),Xa=BigInt(113);for(let e=0,t=Ka,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Ha.push(2*(5*r+n)),Ua.push((e+1)*(e+2)/2%64);let i=Ga;for(let e=0;e<7;e++)t=(t<<Ka^(t>>Ja)*Xa)%Ya,t&qa&&(i^=Ka<<(Ka<<BigInt(e))-Ka);Wa.push(i)}var[Za,Qa]=ua(Wa,!0),$a=(e,t,n)=>n>32?Sa(e,t,n):ba(e,t,n),eo=(e,t,n)=>n>32?Ca(e,t,n):xa(e,t,n);function to(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=$a(a,o,1)^n[r],c=eo(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=Ua[n],a=$a(t,i,r),o=eo(t,i,r),s=Ha[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=Za[r],e[1]^=Qa[r]}n.fill(0)}var no=class e extends Hi{constructor(e,t,n,r=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Di(n),0>=this.blockLen||this.blockLen>=200)throw Error(`Sha3 supports only keccak-f1600 function`);this.state=new Uint8Array(200),this.state32=Pi(this.state)}keccak(){to(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Ai(this);let{blockLen:t,state:n}=this;e=Bi(e);let r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Ai(this,!1),Oi(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return Di(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ji(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}},ro=((e,t,n)=>Gi(()=>new no(t,e,n)))(1,136,32),io=!1,ao=function(e){return ro(e)},oo=ao;function U(e){let t=B(e,`data`);return V(oo(t))}U._=ao,U.lock=function(){io=!0},U.register=function(e){if(io)throw TypeError(`keccak256 is locked`);oo=e},Object.freeze(U);var so=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),co=Uint8Array.from({length:16},(e,t)=>t),lo=co.map(e=>(9*e+5)%16),uo=[co],fo=[lo];for(let e=0;e<4;e++)for(let t of[uo,fo])t.push(t[e].map(e=>so[e]));var po=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),mo=uo.map((e,t)=>e.map(e=>po[t][e])),ho=fo.map((e,t)=>e.map(e=>po[t][e])),go=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),_o=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),vo=(e,t)=>e<<t|e>>>32-t;function yo(e,t,n,r){return e===0?t^n^r:e===1?t&n|~t&r:e===2?(t|~n)^r:e===3?t&r|n&~r:t^(n|~r)}var bo=new Uint32Array(16),xo=class extends $i{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:e,h1:t,h2:n,h3:r,h4:i}=this;return[e,t,n,r,i]}set(e,t,n,r,i){this.h0=e|0,this.h1=t|0,this.h2=n|0,this.h3=r|0,this.h4=i|0}process(e,t){for(let n=0;n<16;n++,t+=4)bo[n]=e.getUint32(t,!0);let n=this.h0|0,r=n,i=this.h1|0,a=i,o=this.h2|0,s=o,c=this.h3|0,l=c,u=this.h4|0,d=u;for(let e=0;e<5;e++){let t=4-e,f=go[e],p=_o[e],m=uo[e],h=fo[e],g=mo[e],_=ho[e];for(let t=0;t<16;t++){let r=vo(n+yo(e,i,o,c)+bo[m[t]]+f,g[t])+u|0;n=u,u=c,c=vo(o,10)|0,o=i,i=r}for(let e=0;e<16;e++){let n=vo(r+yo(t,a,s,l)+bo[h[e]]+p,_[e])+d|0;r=d,d=l,l=vo(s,10)|0,s=a,a=n}}this.set(this.h1+o+l|0,this.h2+c+d|0,this.h3+u+r|0,this.h4+n+a|0,this.h0+i+s|0)}roundClean(){bo.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},So=Gi(()=>new xo),Co=!1,wo=function(e){return So(e)},To=wo;function Eo(e){let t=B(e,`data`);return V(To(t))}Eo._=wo,Eo.lock=function(){Co=!0},Eo.register=function(e){if(Co)throw TypeError(`ripemd160 is locked`);To=e},Object.freeze(Eo);var Do=!1,Oo=function(e,t,n,r,i){return Ia(e,t,n,r,i)},ko=Oo;function Ao(e,t,n,r,i){let a=B(e,`password`),o=B(t,`salt`);return V(ko(a,o,n,r,i))}Ao._=Oo,Ao.lock=function(){Do=!0},Ao.register=function(e){if(Do)throw Error(`pbkdf2 is locked`);ko=e},Object.freeze(Ao);var jo=!1,Mo=function(e){return new Uint8Array(La(e))},No=Mo;function Po(e){return No(e)}Po._=Mo,Po.lock=function(){jo=!0},Po.register=function(e){if(jo)throw Error(`randomBytes is locked`);No=e},Object.freeze(Po);var Fo=(e,t)=>e<<t|e>>>32-t;function Io(e,t,n,r,i,a){let o=e[t++]^n[r++],s=e[t++]^n[r++],c=e[t++]^n[r++],l=e[t++]^n[r++],u=e[t++]^n[r++],d=e[t++]^n[r++],f=e[t++]^n[r++],p=e[t++]^n[r++],m=e[t++]^n[r++],h=e[t++]^n[r++],g=e[t++]^n[r++],_=e[t++]^n[r++],v=e[t++]^n[r++],y=e[t++]^n[r++],b=e[t++]^n[r++],x=e[t++]^n[r++],S=o,ee=s,te=c,C=l,ne=u,re=d,w=f,ie=p,ae=m,T=h,oe=g,se=_,ce=v,le=y,ue=b,E=x;for(let e=0;e<8;e+=2)ne^=Fo(S+ce|0,7),ae^=Fo(ne+S|0,9),ce^=Fo(ae+ne|0,13),S^=Fo(ce+ae|0,18),T^=Fo(re+ee|0,7),le^=Fo(T+re|0,9),ee^=Fo(le+T|0,13),re^=Fo(ee+le|0,18),ue^=Fo(oe+w|0,7),te^=Fo(ue+oe|0,9),w^=Fo(te+ue|0,13),oe^=Fo(w+te|0,18),C^=Fo(E+se|0,7),ie^=Fo(C+E|0,9),se^=Fo(ie+C|0,13),E^=Fo(se+ie|0,18),ee^=Fo(S+C|0,7),te^=Fo(ee+S|0,9),C^=Fo(te+ee|0,13),S^=Fo(C+te|0,18),w^=Fo(re+ne|0,7),ie^=Fo(w+re|0,9),ne^=Fo(ie+w|0,13),re^=Fo(ne+ie|0,18),se^=Fo(oe+T|0,7),ae^=Fo(se+oe|0,9),T^=Fo(ae+se|0,13),oe^=Fo(T+ae|0,18),ce^=Fo(E+ue|0,7),le^=Fo(ce+E|0,9),ue^=Fo(le+ce|0,13),E^=Fo(ue+le|0,18);i[a++]=o+S|0,i[a++]=s+ee|0,i[a++]=c+te|0,i[a++]=l+C|0,i[a++]=u+ne|0,i[a++]=d+re|0,i[a++]=f+w|0,i[a++]=p+ie|0,i[a++]=m+ae|0,i[a++]=h+T|0,i[a++]=g+oe|0,i[a++]=_+se|0,i[a++]=v+ce|0,i[a++]=y+le|0,i[a++]=b+ue|0,i[a++]=x+E|0}function Lo(e,t,n,r,i){let a=r+0,o=r+16*i;for(let r=0;r<16;r++)n[o+r]=e[t+(2*i-1)*16+r];for(let r=0;r<i;r++,a+=16,t+=16)Io(n,o,e,t,n,a),r>0&&(o+=16),Io(n,a,e,t+=16,n,o)}function Ro(e,t,n){let{N:r,r:i,p:a,dkLen:o,asyncTick:s,maxmem:c,onProgress:l}=Wi({dkLen:32,asyncTick:10,maxmem:1024**3+1024},n);if(Di(r),Di(i),Di(a),Di(o),Di(s),Di(c),l!==void 0&&typeof l!=`function`)throw Error(`progressCb should be function`);let u=128*i,d=u/4;if(r<=1||r&r-1||r>=2**(u/8)||r>2**32)throw Error(`Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32`);if(a<0||a>(2**32-1)*32/u)throw Error(`Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)`);if(o<0||o>(2**32-1)*32)throw Error(`Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32`);let f=u*(r+a);if(f>c)throw Error(`Scrypt: parameters too large, ${f} (128 * r * (N + p)) > ${c} (maxmem)`);let p=Zi(oa,e,t,{c:1,dkLen:u*a}),m=Pi(p),h=Pi(new Uint8Array(u*r)),g=Pi(new Uint8Array(u)),_=()=>{};if(l){let e=2*r*a,t=Math.max(Math.floor(e/1e4),1),n=0;_=()=>{n++,l&&(!(n%t)||n===e)&&l(n/e)}}return{N:r,r:i,p:a,dkLen:o,blockSize32:d,V:h,B32:m,B:p,tmp:g,blockMixCb:_,asyncTick:s}}function zo(e,t,n,r,i){let a=Zi(oa,e,n,{c:1,dkLen:t});return n.fill(0),r.fill(0),i.fill(0),a}function Bo(e,t,n){let{N:r,r:i,p:a,dkLen:o,blockSize32:s,V:c,B32:l,B:u,tmp:d,blockMixCb:f}=Ro(e,t,n);for(let e=0;e<a;e++){let t=s*e;for(let e=0;e<s;e++)c[e]=l[t+e];for(let e=0,t=0;e<r-1;e++)Lo(c,t,c,t+=s,i),f();Lo(c,(r-1)*s,l,t,i),f();for(let e=0;e<r;e++){let e=l[t+s-16]%r;for(let n=0;n<s;n++)d[n]=l[t+n]^c[e*s+n];Lo(d,0,l,t,i),f()}}return zo(e,o,u,c,d)}async function Vo(e,t,n){let{N:r,r:i,p:a,dkLen:o,blockSize32:s,V:c,B32:l,B:u,tmp:d,blockMixCb:f,asyncTick:p}=Ro(e,t,n);for(let e=0;e<a;e++){let t=s*e;for(let e=0;e<s;e++)c[e]=l[t+e];let n=0;await Ri(r-1,p,()=>{Lo(c,n,c,n+=s,i),f()}),Lo(c,(r-1)*s,l,t,i),f(),await Ri(r,p,()=>{let e=l[t+s-16]%r;for(let n=0;n<s;n++)d[n]=l[t+n]^c[e*s+n];Lo(d,0,l,t,i),f()})}return zo(e,o,u,c,d)}var Ho=!1,Uo=!1,Wo=async function(e,t,n,r,i,a,o){return await Vo(e,t,{N:n,r,p:i,dkLen:a,onProgress:o})},Go=function(e,t,n,r,i,a){return Bo(e,t,{N:n,r,p:i,dkLen:a})},Ko=Wo,qo=Go;async function Jo(e,t,n,r,i,a,o){let s=B(e,`passwd`),c=B(t,`salt`);return V(await Ko(s,c,n,r,i,a,o))}Jo._=Wo,Jo.lock=function(){Uo=!0},Jo.register=function(e){if(Uo)throw Error(`scrypt is locked`);Ko=e},Object.freeze(Jo);function Yo(e,t,n,r,i,a){let o=B(e,`passwd`),s=B(t,`salt`);return V(qo(o,s,n,r,i,a))}Yo._=Go,Yo.lock=function(){Ho=!0},Yo.register=function(e){if(Ho)throw Error(`scryptSync is locked`);qo=e},Object.freeze(Yo);var Xo=function(e){return Pa(`sha256`).update(e).digest()},Zo=function(e){return Pa(`sha512`).update(e).digest()},Qo=Xo,$o=Zo,es=!1,ts=!1;function ns(e){let t=B(e,`data`);return V(Qo(t))}ns._=Xo,ns.lock=function(){es=!0},ns.register=function(e){if(es)throw Error(`sha256 is locked`);Qo=e},Object.freeze(ns);function rs(e){let t=B(e,`data`);return V($o(t))}rs._=Zo,rs.lock=function(){ts=!0},rs.register=function(e){if(ts)throw Error(`sha512 is locked`);$o=e},Object.freeze(ns);var is=e({bitGet:()=>ws,bitLen:()=>Cs,bitMask:()=>Es,bitSet:()=>Ts,bytesToHex:()=>us,bytesToNumberBE:()=>ms,bytesToNumberLE:()=>hs,concatBytes:()=>bs,createHmacDrbg:()=>ks,ensureBytes:()=>ys,equalBytes:()=>xs,hexToBytes:()=>ps,hexToNumber:()=>fs,numberToBytesBE:()=>gs,numberToBytesLE:()=>_s,numberToHexUnpadded:()=>ds,numberToVarBytesBE:()=>vs,utf8ToBytes:()=>Ss,validateObject:()=>js}),as=BigInt(0),os=BigInt(1),ss=BigInt(2),cs=e=>e instanceof Uint8Array,ls=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function us(e){if(!cs(e))throw Error(`Uint8Array expected`);let t=``;for(let n=0;n<e.length;n++)t+=ls[e[n]];return t}function ds(e){let t=e.toString(16);return t.length&1?`0${t}`:t}function fs(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return BigInt(e===``?`0`:`0x${e}`)}function ps(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);let t=e.length;if(t%2)throw Error(`padded hex string expected, got unpadded hex of length `+t);let n=new Uint8Array(t/2);for(let t=0;t<n.length;t++){let r=t*2,i=e.slice(r,r+2),a=Number.parseInt(i,16);if(Number.isNaN(a)||a<0)throw Error(`Invalid byte sequence`);n[t]=a}return n}function ms(e){return fs(us(e))}function hs(e){if(!cs(e))throw Error(`Uint8Array expected`);return fs(us(Uint8Array.from(e).reverse()))}function gs(e,t){return ps(e.toString(16).padStart(t*2,`0`))}function _s(e,t){return gs(e,t).reverse()}function vs(e){return ps(ds(e))}function ys(e,t,n){let r;if(typeof t==`string`)try{r=ps(t)}catch(n){throw Error(`${e} must be valid hex string, got "${t}". Cause: ${n}`)}else if(cs(t))r=Uint8Array.from(t);else throw Error(`${e} must be hex string or Uint8Array`);let i=r.length;if(typeof n==`number`&&i!==n)throw Error(`${e} expected ${n} bytes, got ${i}`);return r}function bs(...e){let t=new Uint8Array(e.reduce((e,t)=>e+t.length,0)),n=0;return e.forEach(e=>{if(!cs(e))throw Error(`Uint8Array expected`);t.set(e,n),n+=e.length}),t}function xs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Ss(e){if(typeof e!=`string`)throw Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Cs(e){let t;for(t=0;e>as;e>>=os,t+=1);return t}function ws(e,t){return e>>BigInt(t)&os}var Ts=(e,t,n)=>e|(n?os:as)<<BigInt(t),Es=e=>(ss<<BigInt(e-1))-os,Ds=e=>new Uint8Array(e),Os=e=>Uint8Array.from(e);function ks(e,t,n){if(typeof e!=`number`||e<2)throw Error(`hashLen must be a number`);if(typeof t!=`number`||t<2)throw Error(`qByteLen must be a number`);if(typeof n!=`function`)throw Error(`hmacFn must be a function`);let r=Ds(e),i=Ds(e),a=0,o=()=>{r.fill(1),i.fill(0),a=0},s=(...e)=>n(i,r,...e),c=(e=Ds())=>{i=s(Os([0]),e),r=s(),e.length!==0&&(i=s(Os([1]),e),r=s())},l=()=>{if(a++>=1e3)throw Error(`drbg: tried 1000 values`);let e=0,n=[];for(;e<t;){r=s();let t=r.slice();n.push(t),e+=r.length}return bs(...n)};return(e,t)=>{o(),c(e);let n;for(;!(n=t(l()));)c();return o(),n}}var As={bigint:e=>typeof e==`bigint`,function:e=>typeof e==`function`,boolean:e=>typeof e==`boolean`,string:e=>typeof e==`string`,stringOrUint8Array:e=>typeof e==`string`||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e==`function`&&Number.isSafeInteger(e.outputLen)};function js(e,t,n={}){let r=(t,n,r)=>{let i=As[n];if(typeof i!=`function`)throw Error(`Invalid validator "${n}", expected function`);let a=e[t];if(!(r&&a===void 0)&&!i(a,e))throw Error(`Invalid param ${String(t)}=${a} (${typeof a}), expected ${n}`)};for(let[e,n]of Object.entries(t))r(e,n,!1);for(let[e,t]of Object.entries(n))r(e,t,!0);return e}var Ms=BigInt(0),Ns=BigInt(1),Ps=BigInt(2),Fs=BigInt(3),Is=BigInt(4),Ls=BigInt(5),Rs=BigInt(8),zs=BigInt(16);function Bs(e,t){let n=e%t;return n>=Ms?n:t+n}function Vs(e,t,n){if(n<=Ms||t<Ms)throw Error(`Expected power/modulo > 0`);if(n===Ns)return Ms;let r=Ns;for(;t>Ms;)t&Ns&&(r=r*e%n),e=e*e%n,t>>=Ns;return r}function Hs(e,t,n){let r=e;for(;t-->Ms;)r*=r,r%=n;return r}function Us(e,t){if(e===Ms||t<=Ms)throw Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=Bs(e,t),r=t,i=Ms,a=Ns,o=Ns,s=Ms;for(;n!==Ms;){let e=r/n,t=r%n,c=i-o*e,l=a-s*e;r=n,n=t,i=o,a=s,o=c,s=l}if(r!==Ns)throw Error(`invert: does not exist`);return Bs(i,t)}function Ws(e){let t=(e-Ns)/Ps,n,r,i;for(n=e-Ns,r=0;n%Ps===Ms;n/=Ps,r++);for(i=Ps;i<e&&Vs(i,t,e)!==e-Ns;i++);if(r===1){let t=(e+Ns)/Is;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error(`Cannot find square root`);return r}}let a=(n+Ns)/Ps;return function(e,o){if(e.pow(o,t)===e.neg(e.ONE))throw Error(`Cannot find square root`);let s=r,c=e.pow(e.mul(e.ONE,i),n),l=e.pow(o,a),u=e.pow(o,n);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(u);t<s&&!e.eql(n,e.ONE);t++)n=e.sqr(n);let n=e.pow(c,Ns<<BigInt(s-t-1));c=e.sqr(n),l=e.mul(l,n),u=e.mul(u,c),s=t}return l}}function Gs(e){if(e%Is===Fs){let t=(e+Ns)/Is;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error(`Cannot find square root`);return r}}if(e%Rs===Ls){let t=(e-Ls)/Rs;return function(e,n){let r=e.mul(n,Ps),i=e.pow(r,t),a=e.mul(n,i),o=e.mul(e.mul(a,Ps),i),s=e.mul(a,e.sub(o,e.ONE));if(!e.eql(e.sqr(s),n))throw Error(`Cannot find square root`);return s}}return e%zs,Ws(e)}var Ks=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function qs(e){return js(e,Ks.reduce((e,t)=>(e[t]=`function`,e),{ORDER:`bigint`,MASK:`bigint`,BYTES:`isSafeInteger`,BITS:`isSafeInteger`}))}function Js(e,t,n){if(n<Ms)throw Error(`Expected power > 0`);if(n===Ms)return e.ONE;if(n===Ns)return t;let r=e.ONE,i=t;for(;n>Ms;)n&Ns&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Ns;return r}function Ys(e,t){let n=Array(t.length),r=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),i=e.inv(r);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),i),n}function Xs(e,t){let n=t===void 0?e.toString(2).length:t;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Zs(e,t,n=!1,r={}){if(e<=Ms)throw Error(`Expected Field ORDER > 0, got ${e}`);let{nBitLength:i,nByteLength:a}=Xs(e,t);if(a>2048)throw Error(`Field lengths over 2048 bytes are not supported`);let o=Gs(e),s=Object.freeze({ORDER:e,BITS:i,BYTES:a,MASK:Es(i),ZERO:Ms,ONE:Ns,create:t=>Bs(t,e),isValid:t=>{if(typeof t!=`bigint`)throw Error(`Invalid field element: expected bigint, got ${typeof t}`);return Ms<=t&&t<e},is0:e=>e===Ms,isOdd:e=>(e&Ns)===Ns,neg:t=>Bs(-t,e),eql:(e,t)=>e===t,sqr:t=>Bs(t*t,e),add:(t,n)=>Bs(t+n,e),sub:(t,n)=>Bs(t-n,e),mul:(t,n)=>Bs(t*n,e),pow:(e,t)=>Js(s,e,t),div:(t,n)=>Bs(t*Us(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>Us(t,e),sqrt:r.sqrt||(e=>o(s,e)),invertBatch:e=>Ys(s,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?_s(e,a):gs(e,a),fromBytes:e=>{if(e.length!==a)throw Error(`Fp.fromBytes: expected ${a}, got ${e.length}`);return n?hs(e):ms(e)}});return Object.freeze(s)}function Qs(e){if(typeof e!=`bigint`)throw Error(`field order must be bigint`);let t=e.toString(2).length;return Math.ceil(t/8)}function $s(e){let t=Qs(e);return t+Math.ceil(t/2)}function ec(e,t,n=!1){let r=e.length,i=Qs(t),a=$s(t);if(r<16||r<a||r>1024)throw Error(`expected ${a}-1024 bytes of input, got ${r}`);let o=Bs(n?ms(e):hs(e),t-Ns)+Ns;return n?_s(o,i):gs(o,i)}var tc=BigInt(0),nc=BigInt(1);function rc(e,t){let n=(e,t)=>{let n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,i=t;for(;n>tc;)n&nc&&(r=r.add(i)),i=i.double(),n>>=nc;return r},precomputeWindow(e,t){let{windows:n,windowSize:i}=r(t),a=[],o=e,s=o;for(let e=0;e<n;e++){s=o,a.push(s);for(let e=1;e<i;e++)s=s.add(o),a.push(s);o=s.double()}return a},wNAF(t,i,a){let{windows:o,windowSize:s}=r(t),c=e.ZERO,l=e.BASE,u=BigInt(2**t-1),d=2**t,f=BigInt(t);for(let e=0;e<o;e++){let t=e*s,r=Number(a&u);a>>=f,r>s&&(r-=d,a+=nc);let o=t,p=t+Math.abs(r)-1,m=e%2!=0,h=r<0;r===0?l=l.add(n(m,i[o])):c=c.add(n(h,i[p]))}return{p:c,f:l}},wNAFCached(e,t,n,r){let i=e._WINDOW_SIZE||1,a=t.get(e);return a||(a=this.precomputeWindow(e,i),i!==1&&t.set(e,r(a))),this.wNAF(i,a,n)}}}function ic(e){return qs(e.Fp),js(e,{n:`bigint`,h:`bigint`,Gx:`field`,Gy:`field`},{nBitLength:`isSafeInteger`,nByteLength:`isSafeInteger`}),Object.freeze({...Xs(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function ac(e){let t=ic(e);js(t,{a:`field`,b:`field`},{allowedPrivateKeyLengths:`array`,wrapPrivateKey:`boolean`,isTorsionFree:`function`,clearCofactor:`function`,allowInfinityPoint:`boolean`,fromBytes:`function`,toBytes:`function`});let{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw Error(`Endomorphism can only be defined for Koblitz curves that have a=0`);if(typeof n!=`object`||typeof n.beta!=`bigint`||typeof n.splitScalar!=`function`)throw Error(`Expected endomorphism with beta: bigint and splitScalar: function`)}return Object.freeze({...t})}var{bytesToNumberBE:oc,hexToBytes:sc}=is,cc={Err:class extends Error{constructor(e=``){super(e)}},_parseInt(e){let{Err:t}=cc;if(e.length<2||e[0]!==2)throw new t(`Invalid signature integer tag`);let n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t(`Invalid signature integer: wrong length`);if(r[0]&128)throw new t(`Invalid signature integer: negative`);if(r[0]===0&&!(r[1]&128))throw new t(`Invalid signature integer: unnecessary leading zero`);return{d:oc(r),l:e.subarray(n+2)}},toSig(e){let{Err:t}=cc,n=typeof e==`string`?sc(e):e;if(!(n instanceof Uint8Array))throw Error(`ui8a expected`);let r=n.length;if(r<2||n[0]!=48)throw new t(`Invalid signature tag`);if(n[1]!==r-2)throw new t(`Invalid signature: incorrect length`);let{d:i,l:a}=cc._parseInt(n.subarray(2)),{d:o,l:s}=cc._parseInt(a);if(s.length)throw new t(`Invalid signature: left bytes after parsing`);return{r:i,s:o}},hexFromSig(e){let t=e=>Number.parseInt(e[0],16)&8?`00`+e:e,n=e=>{let t=e.toString(16);return t.length&1?`0${t}`:t},r=t(n(e.s)),i=t(n(e.r)),a=r.length/2,o=i.length/2,s=n(a),c=n(o);return`30${n(o+a+4)}02${c}${i}02${s}${r}`}},lc=BigInt(0),uc=BigInt(1),dc=BigInt(3);function fc(e){let t=ac(e),{Fp:n}=t,r=t.toBytes||((e,t,r)=>{let i=t.toAffine();return bs(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),i=t.fromBytes||(e=>{let t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function a(e){let{a:r,b:i}=t,a=n.sqr(e),o=n.mul(a,e);return n.add(n.add(o,n.mul(e,r)),i)}if(!n.eql(n.sqr(t.Gy),a(t.Gx)))throw Error(`bad generator point: equation left != right`);function o(e){return typeof e==`bigint`&&lc<e&&e<t.n}function s(e){if(!o(e))throw Error(`Expected valid bigint: 0 < bigint < curve.n`)}function c(e){let{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:i,n:a}=t;if(n&&typeof e!=`bigint`){if(e instanceof Uint8Array&&(e=us(e)),typeof e!=`string`||!n.includes(e.length))throw Error(`Invalid key`);e=e.padStart(r*2,`0`)}let o;try{o=typeof e==`bigint`?e:ms(ys(`private key`,e,r))}catch{throw Error(`private key must be ${r} bytes, hex or bigint, not ${typeof e}`)}return i&&(o=Bs(o,a)),s(o),o}let l=new Map;function u(e){if(!(e instanceof d))throw Error(`ProjectivePoint expected`)}class d{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,e==null||!n.isValid(e))throw Error(`x required`);if(t==null||!n.isValid(t))throw Error(`y required`);if(r==null||!n.isValid(r))throw Error(`z required`)}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw Error(`invalid affine point`);if(e instanceof d)throw Error(`projective point not allowed`);let i=e=>n.eql(e,n.ZERO);return i(t)&&i(r)?d.ZERO:new d(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(d.fromAffine)}static fromHex(e){let t=d.fromAffine(i(ys(`pointHex`,e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw Error(`bad point: ZERO`)}let{x:e,y:r}=this.toAffine();if(!n.isValid(e)||!n.isValid(r))throw Error(`bad point: x or y not FE`);let i=n.sqr(r),o=a(e);if(!n.eql(i,o))throw Error(`bad point: equation left != right`);if(!this.isTorsionFree())throw Error(`bad point: not in prime-order subgroup`)}hasEvenY(){let{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw Error(`Field doesn't support isOdd`)}equals(e){u(e);let{px:t,py:r,pz:i}=this,{px:a,py:o,pz:s}=e,c=n.eql(n.mul(t,s),n.mul(a,i)),l=n.eql(n.mul(r,s),n.mul(o,i));return c&&l}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){let{a:e,b:r}=t,i=n.mul(r,dc),{px:a,py:o,pz:s}=this,c=n.ZERO,l=n.ZERO,u=n.ZERO,f=n.mul(a,a),p=n.mul(o,o),m=n.mul(s,s),h=n.mul(a,o);return h=n.add(h,h),u=n.mul(a,s),u=n.add(u,u),c=n.mul(e,u),l=n.mul(i,m),l=n.add(c,l),c=n.sub(p,l),l=n.add(p,l),l=n.mul(c,l),c=n.mul(h,c),u=n.mul(i,u),m=n.mul(e,m),h=n.sub(f,m),h=n.mul(e,h),h=n.add(h,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,m),f=n.mul(f,h),l=n.add(l,f),m=n.mul(o,s),m=n.add(m,m),f=n.mul(m,h),c=n.sub(c,f),u=n.mul(m,p),u=n.add(u,u),u=n.add(u,u),new d(c,l,u)}add(e){u(e);let{px:r,py:i,pz:a}=this,{px:o,py:s,pz:c}=e,l=n.ZERO,f=n.ZERO,p=n.ZERO,m=t.a,h=n.mul(t.b,dc),g=n.mul(r,o),_=n.mul(i,s),v=n.mul(a,c),y=n.add(r,i),b=n.add(o,s);y=n.mul(y,b),b=n.add(g,_),y=n.sub(y,b),b=n.add(r,a);let x=n.add(o,c);return b=n.mul(b,x),x=n.add(g,v),b=n.sub(b,x),x=n.add(i,a),l=n.add(s,c),x=n.mul(x,l),l=n.add(_,v),x=n.sub(x,l),p=n.mul(m,b),l=n.mul(h,v),p=n.add(l,p),l=n.sub(_,p),p=n.add(_,p),f=n.mul(l,p),_=n.add(g,g),_=n.add(_,g),v=n.mul(m,v),b=n.mul(h,b),_=n.add(_,v),v=n.sub(g,v),v=n.mul(m,v),b=n.add(b,v),g=n.mul(_,b),f=n.add(f,g),g=n.mul(x,b),l=n.mul(y,l),l=n.sub(l,g),g=n.mul(y,_),p=n.mul(x,p),p=n.add(p,g),new d(l,f,p)}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return p.wNAFCached(this,l,e,e=>{let t=n.invertBatch(e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(d.fromAffine)})}multiplyUnsafe(e){let r=d.ZERO;if(e===lc)return r;if(s(e),e===uc)return this;let{endo:i}=t;if(!i)return p.unsafeLadder(this,e);let{k1neg:a,k1:o,k2neg:c,k2:l}=i.splitScalar(e),u=r,f=r,m=this;for(;o>lc||l>lc;)o&uc&&(u=u.add(m)),l&uc&&(f=f.add(m)),m=m.double(),o>>=uc,l>>=uc;return a&&(u=u.negate()),c&&(f=f.negate()),f=new d(n.mul(f.px,i.beta),f.py,f.pz),u.add(f)}multiply(e){s(e);let r=e,i,a,{endo:o}=t;if(o){let{k1neg:e,k1:t,k2neg:s,k2:c}=o.splitScalar(r),{p:l,f:u}=this.wNAF(t),{p:f,f:m}=this.wNAF(c);l=p.constTimeNegate(e,l),f=p.constTimeNegate(s,f),f=new d(n.mul(f.px,o.beta),f.py,f.pz),i=l.add(f),a=u.add(m)}else{let{p:e,f:t}=this.wNAF(r);i=e,a=t}return d.normalizeZ([i,a])[0]}multiplyAndAddUnsafe(e,t,n){let r=d.BASE,i=(e,t)=>t===lc||t===uc||!e.equals(r)?e.multiplyUnsafe(t):e.multiply(t),a=i(this,t).add(i(e,n));return a.is0()?void 0:a}toAffine(e){let{px:t,py:r,pz:i}=this,a=this.is0();e??=a?n.ONE:n.inv(i);let o=n.mul(t,e),s=n.mul(r,e),c=n.mul(i,e);if(a)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw Error(`invZ was invalid`);return{x:o,y:s}}isTorsionFree(){let{h:e,isTorsionFree:n}=t;if(e===uc)return!0;if(n)return n(d,this);throw Error(`isTorsionFree() has not been declared for the elliptic curve`)}clearCofactor(){let{h:e,clearCofactor:n}=t;return e===uc?this:n?n(d,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),r(d,this,e)}toHex(e=!0){return us(this.toRawBytes(e))}}d.BASE=new d(t.Gx,t.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);let f=t.nBitLength,p=rc(d,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:o}}function pc(e){let t=ic(e);return js(t,{hash:`hash`,hmac:`function`,randomBytes:`function`},{bits2int:`function`,bits2int_modN:`function`,lowS:`boolean`}),Object.freeze({lowS:!0,...t})}function mc(e){let t=pc(e),{Fp:n,n:r}=t,i=n.BYTES+1,a=2*n.BYTES+1;function o(e){return lc<e&&e<n.ORDER}function s(e){return Bs(e,r)}function c(e){return Us(e,r)}let{ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:d,isWithinCurveOrder:f}=fc({...t,toBytes(e,t,r){let i=t.toAffine(),a=n.toBytes(i.x),o=bs;return r?o(Uint8Array.from([t.hasEvenY()?2:3]),a):o(Uint8Array.from([4]),a,n.toBytes(i.y))},fromBytes(e){let t=e.length,r=e[0],s=e.subarray(1);if(t===i&&(r===2||r===3)){let e=ms(s);if(!o(e))throw Error(`Point is not on curve`);let t=d(e),i=n.sqrt(t),a=(i&uc)===uc;return(r&1)==1!==a&&(i=n.neg(i)),{x:e,y:i}}if(t===a&&r===4)return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))};throw Error(`Point of length ${t} was invalid. Expected ${i} compressed bytes or ${a} uncompressed bytes`)}}),p=e=>us(gs(e,t.nByteLength));function m(e){return e>r>>uc}function h(e){return m(e)?s(-e):e}let g=(e,t,n)=>ms(e.slice(t,n));class _{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){let n=t.nByteLength;return e=ys(`compactSignature`,e,n*2),new _(g(e,0,n),g(e,n,2*n))}static fromDER(e){let{r:t,s:n}=cc.toSig(ys(`DER`,e));return new _(t,n)}assertValidity(){if(!f(this.r))throw Error(`r must be 0 < r < CURVE.n`);if(!f(this.s))throw Error(`s must be 0 < s < CURVE.n`)}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(e){let{r,s:i,recovery:a}=this,o=ee(ys(`msgHash`,e));if(a==null||![0,1,2,3].includes(a))throw Error(`recovery id invalid`);let u=a===2||a===3?r+t.n:r;if(u>=n.ORDER)throw Error(`recovery id 2 or 3 invalid`);let d=a&1?`03`:`02`,f=l.fromHex(d+p(u)),m=c(u),h=s(-o*m),g=s(i*m),_=l.BASE.multiplyAndAddUnsafe(f,h,g);if(!_)throw Error(`point at infinify`);return _.assertValidity(),_}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return ps(this.toDERHex())}toDERHex(){return cc.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ps(this.toCompactHex())}toCompactHex(){return p(this.r)+p(this.s)}}let v={isValidPrivateKey(e){try{return u(e),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let e=$s(t.n);return ec(t.randomBytes(e),t.n)},precompute(e=8,t=l.BASE){return t._setWindowSize(e),t.multiply(BigInt(3)),t}};function y(e,t=!0){return l.fromPrivateKey(e).toRawBytes(t)}function b(e){let t=e instanceof Uint8Array,n=typeof e==`string`,r=(t||n)&&e.length;return t?r===i||r===a:n?r===2*i||r===2*a:e instanceof l}function x(e,t,n=!0){if(b(e))throw Error(`first arg must be private key`);if(!b(t))throw Error(`second arg must be public key`);return l.fromHex(t).multiply(u(e)).toRawBytes(n)}let S=t.bits2int||function(e){let n=ms(e),r=e.length*8-t.nBitLength;return r>0?n>>BigInt(r):n},ee=t.bits2int_modN||function(e){return s(S(e))},te=Es(t.nBitLength);function C(e){if(typeof e!=`bigint`)throw Error(`bigint expected`);if(!(lc<=e&&e<te))throw Error(`bigint expected < 2^${t.nBitLength}`);return gs(e,t.nByteLength)}function ne(e,r,i=re){if([`recovered`,`canonical`].some(e=>e in i))throw Error(`sign() legacy options not supported`);let{hash:a,randomBytes:o}=t,{lowS:d,prehash:p,extraEntropy:g}=i;d??=!0,e=ys(`msgHash`,e),p&&(e=ys(`prehashed msgHash`,a(e)));let v=ee(e),y=u(r),b=[C(y),C(v)];if(g!=null){let e=g===!0?o(n.BYTES):g;b.push(ys(`extraEntropy`,e))}let x=bs(...b),te=v;function ne(e){let t=S(e);if(!f(t))return;let n=c(t),r=l.BASE.multiply(t).toAffine(),i=s(r.x);if(i===lc)return;let a=s(n*s(te+i*y));if(a===lc)return;let o=(r.x===i?0:2)|Number(r.y&uc),u=a;return d&&m(a)&&(u=h(a),o^=1),new _(i,u,o)}return{seed:x,k2sig:ne}}let re={lowS:t.lowS,prehash:!1},w={lowS:t.lowS,prehash:!1};function ie(e,n,r=re){let{seed:i,k2sig:a}=ne(e,n,r),o=t;return ks(o.hash.outputLen,o.nByteLength,o.hmac)(i,a)}l.BASE._setWindowSize(8);function ae(e,n,r,i=w){let a=e;if(n=ys(`msgHash`,n),r=ys(`publicKey`,r),`strict`in i)throw Error(`options.strict was renamed to lowS`);let{lowS:o,prehash:u}=i,d,f;try{if(typeof a==`string`||a instanceof Uint8Array)try{d=_.fromDER(a)}catch(e){if(!(e instanceof cc.Err))throw e;d=_.fromCompact(a)}else if(typeof a==`object`&&typeof a.r==`bigint`&&typeof a.s==`bigint`){let{r:e,s:t}=a;d=new _(e,t)}else throw Error(`PARSE`);f=l.fromHex(r)}catch(e){if(e.message===`PARSE`)throw Error(`signature must be Signature instance, Uint8Array or hex string`);return!1}if(o&&d.hasHighS())return!1;u&&(n=t.hash(n));let{r:p,s:m}=d,h=ee(n),g=c(m),v=s(h*g),y=s(p*g),b=l.BASE.multiplyAndAddUnsafe(f,v,y)?.toAffine();return b?s(b.x)===p:!1}return{CURVE:t,getPublicKey:y,getSharedSecret:x,sign:ie,verify:ae,ProjectivePoint:l,Signature:_,utils:v}}function hc(e){return{hash:e,hmac:(t,...n)=>Ji(e,t,Vi(...n)),randomBytes:Ki}}function gc(e,t){let n=t=>mc({...e,...hc(t)});return Object.freeze({...n(t),create:n})}var _c=BigInt(`0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f`),vc=BigInt(`0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141`),yc=BigInt(1),bc=BigInt(2),xc=(e,t)=>(e+t/bc)/t;function Sc(e){let t=_c,n=BigInt(3),r=BigInt(6),i=BigInt(11),a=BigInt(22),o=BigInt(23),s=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=Hs(Hs(Hs(u,n,t)*u%t,n,t)*u%t,bc,t)*l%t,f=Hs(d,i,t)*d%t,p=Hs(f,a,t)*f%t,m=Hs(p,s,t)*p%t,h=Hs(Hs(Hs(Hs(Hs(Hs(m,c,t)*m%t,s,t)*p%t,n,t)*u%t,o,t)*f%t,r,t)*l%t,bc,t);if(!Cc.eql(Cc.sqr(h),e))throw Error(`Cannot find square root`);return h}var Cc=Zs(_c,void 0,void 0,{sqrt:Sc}),wc=gc({a:BigInt(0),b:BigInt(7),Fp:Cc,n:vc,Gx:BigInt(`55066263022277343669578718895168534326250603453777594175500187360389116729240`),Gy:BigInt(`32670510020758816978083085130507043184471273380659243275938904335757337482424`),h:BigInt(1),lowS:!0,endo:{beta:BigInt(`0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee`),splitScalar:e=>{let t=vc,n=BigInt(`0x3086d221a7d46bcde86c90e49284eb15`),r=-yc*BigInt(`0xe4437ed6010e88286f547fa90abfe4c3`),i=BigInt(`0x114ca50f7a8e2f3f657c1108d9d44cfd8`),a=n,o=BigInt(`0x100000000000000000000000000000000`),s=xc(a*e,t),c=xc(-r*e,t),l=Bs(e-s*n-c*i,t),u=Bs(-s*r-c*a,t),d=l>o,f=u>o;if(d&&(l=t-l),f&&(u=t-u),l>o||u>o)throw Error(`splitScalar: Endomorphism failed, k=`+e);return{k1neg:d,k1:l,k2neg:f,k2:u}}}},oa);wc.ProjectivePoint;var Tc=`0x0000000000000000000000000000000000000000`,Ec=`0x0000000000000000000000000000000000000000000000000000000000000000`,Dc=`Ethereum Signed Message:
5
5
  `,Oc=BigInt(0),kc=BigInt(1),Ac=BigInt(2),jc=BigInt(27),Mc=BigInt(28),Nc=BigInt(35),Pc={};function Fc(e){return Dr(Vr(e),32)}var Ic=class e{#e;#t;#n;#r;get r(){return this.#e}set r(e){z(wr(e)===32,`invalid r`,`value`,e),this.#e=V(e)}get s(){return this.#t}set s(e){z(wr(e)===32,`invalid s`,`value`,e);let t=V(e);z(parseInt(t.substring(0,3))<8,`non-canonical s`,`value`,t),this.#t=t}get v(){return this.#n}set v(e){let t=Rr(e,`value`);z(t===27||t===28,`invalid v`,`v`,e),this.#n=t}get networkV(){return this.#r}get legacyChainId(){let t=this.networkV;return t==null?null:e.getChainId(t)}get yParity(){return this.v===27?0:1}get yParityAndS(){let e=B(this.s);return this.yParity&&(e[0]|=128),V(e)}get compactSerialized(){return Cr([this.r,this.yParityAndS])}get serialized(){return Cr([this.r,this.s,this.yParity?`0x1c`:`0x1b`])}constructor(e,t,n,r){_r(e,Pc,`Signature`),this.#e=t,this.#t=n,this.#n=r,this.#r=null}[Symbol.for(`nodejs.util.inspect.custom`)](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){let t=new e(Pc,this.r,this.s,this.v);return this.networkV&&(t.#r=this.networkV),t}toJSON(){let e=this.networkV;return{_type:`signature`,networkV:e==null?null:e.toString(),r:this.r,s:this.s,v:this.v}}static getChainId(e){let t=Pr(e,`v`);return t==jc||t==Mc?Oc:(z(t>=Nc,`invalid EIP-155 v`,`v`,e),(t-Nc)/Ac)}static getChainIdV(e,t){return Pr(e)*Ac+BigInt(35+t-27)}static getNormalizedV(e){let t=Pr(e);return t===Oc||t===jc?27:t===kc||t===Mc?28:(z(t>=Nc,`invalid v`,`v`,e),t&kc?27:28)}static from(t){function n(e,n){z(e,n,`signature`,t)}if(t==null)return new e(Pc,Ec,Ec,27);if(typeof t==`string`){let r=B(t,`signature`);if(r.length===64){let t=V(r.slice(0,32)),n=r.slice(32,64),i=n[0]&128?28:27;return n[0]&=127,new e(Pc,t,V(n),i)}if(r.length===65){let t=V(r.slice(0,32)),i=r.slice(32,64);n(!(i[0]&128),`non-canonical s`);let a=e.getNormalizedV(r[64]);return new e(Pc,t,V(i),a)}n(!1,`invalid raw signature length`)}if(t instanceof e)return t.clone();let r=t.r;n(r!=null,`missing r`);let i=Fc(r),a=(function(e,t){if(e!=null)return Fc(e);if(t!=null){n(br(t,32),`invalid yParityAndS`);let e=B(t);return e[0]&=127,V(e)}n(!1,`missing s`)})(t.s,t.yParityAndS);n(!(B(a)[0]&128),`non-canonical s`);let{networkV:o,v:s}=(function(t,r,i){if(t!=null){let n=Pr(t);return{networkV:n>=Nc?n:void 0,v:e.getNormalizedV(n)}}if(r!=null)return n(br(r,32),`invalid yParityAndS`),{v:B(r)[0]&128?28:27};if(i!=null){switch(Rr(i,`sig.yParity`)){case 0:return{v:27};case 1:return{v:28}}n(!1,`invalid yParity`)}n(!1,`missing v`)})(t.v,t.yParityAndS,t.yParity),c=new e(Pc,i,a,s);return o&&(c.#r=o),n(t.yParity==null||Rr(t.yParity,`sig.yParity`)===c.yParity,`yParity mismatch`),n(t.yParityAndS==null||t.yParityAndS===c.yParityAndS,`yParityAndS mismatch`),c}},Lc=class e{#e;constructor(e){z(wr(e)===32,`invalid private key`,`privateKey`,`[REDACTED]`),this.#e=V(e)}get privateKey(){return this.#e}get publicKey(){return e.computePublicKey(this.#e)}get compressedPublicKey(){return e.computePublicKey(this.#e,!0)}sign(e){z(wr(e)===32,`invalid digest length`,`digest`,e);let t=wc.sign(yr(e),yr(this.#e),{lowS:!0});return Ic.from({r:Br(t.r,32),s:Br(t.s,32),v:t.recovery?28:27})}computeSharedSecret(t){let n=e.computePublicKey(t);return V(wc.getSharedSecret(yr(this.#e),B(n),!1))}static computePublicKey(e,t){let n=B(e,`key`);if(n.length===32)return V(wc.getPublicKey(n,!!t));if(n.length===64){let e=new Uint8Array(65);e[0]=4,e.set(n,1),n=e}return V(wc.ProjectivePoint.fromHex(n).toRawBytes(t))}static recoverPublicKey(e,t){z(wr(e)===32,`invalid digest length`,`digest`,e);let n=Ic.from(t),r=wc.Signature.fromCompact(yr(Cr([n.r,n.s])));r=r.addRecoveryBit(n.yParity);let i=r.recoverPublicKey(yr(e));return z(i!=null,`invalid signautre for digest`,`signature`,t),`0x`+i.toHex(!1)}static addPoints(t,n,r){let i=wc.ProjectivePoint.fromHex(e.computePublicKey(t).substring(2)),a=wc.ProjectivePoint.fromHex(e.computePublicKey(n).substring(2));return`0x`+i.add(a).toHex(!!r)}},Rc=BigInt(0),zc=BigInt(36);function Bc(e){e=e.toLowerCase();let t=e.substring(2).split(``),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);let r=B(U(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(r[e>>1]&15)>=8&&(t[e+1]=t[e+1].toUpperCase());return`0x`+t.join(``)}var Vc={};for(let e=0;e<10;e++)Vc[String(e)]=String(e);for(let e=0;e<26;e++)Vc[String.fromCharCode(65+e)]=String(10+e);var Hc=15;function Uc(e){e=e.toUpperCase(),e=e.substring(4)+e.substring(0,2)+`00`;let t=e.split(``).map(e=>Vc[e]).join(``);for(;t.length>=Hc;){let e=t.substring(0,Hc);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n=`0`+n;return n}var Wc=(function(){let e={};for(let t=0;t<36;t++){let n=`0123456789abcdefghijklmnopqrstuvwxyz`[t];e[n]=BigInt(t)}return e})();function Gc(e){e=e.toLowerCase();let t=Rc;for(let n=0;n<e.length;n++)t=t*zc+Wc[e[n]];return t}function Kc(e){if(z(typeof e==`string`,`invalid address`,`address`,e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith(`0x`)||(e=`0x`+e);let t=Bc(e);return z(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===e,`bad address checksum`,`address`,e),t}if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){z(e.substring(2,4)===Uc(e),`bad icap checksum`,`address`,e);let t=Gc(e.substring(4)).toString(16);for(;t.length<40;)t=`0`+t;return Bc(`0x`+t)}z(!1,`invalid address`,`address`,e)}function qc(e){return e&&typeof e.getAddress==`function`}async function Jc(e,t){let n=await t;return(n==null||n===`0x0000000000000000000000000000000000000000`)&&(R(typeof e!=`string`,`unconfigured name`,`UNCONFIGURED_NAME`,{value:e}),z(!1,`invalid AddressLike value; did not resolve to a value address`,`target`,e)),Kc(n)}function Yc(e,t){if(typeof e==`string`)return e.match(/^0x[0-9a-f]{40}$/i)?Kc(e):(R(t!=null,`ENS resolution requires a provider`,`UNSUPPORTED_OPERATION`,{operation:`resolveName`}),Jc(e,t.resolveName(e)));if(qc(e))return Jc(e,e.getAddress());if(e&&typeof e.then==`function`)return Jc(e,e);z(!1,`unsupported addressable value`,`target`,e)}var Xc={};function W(e,t){let n=!1;return t<0&&(n=!0,t*=-1),new $c(Xc,`${n?``:`u`}int${t}`,e,{signed:n,width:t})}function Zc(e,t){return new $c(Xc,`bytes${t||``}`,e,{size:t})}var Qc=Symbol.for(`_ethers_typed`),$c=class e{type;value;#e;_typedSymbol;constructor(e,t,n,r){r??=null,_r(Xc,e,`Typed`),L(this,{_typedSymbol:Qc,type:t,value:n}),this.#e=r,this.format()}format(){if(this.type===`array`||this.type===`dynamicArray`)throw Error(``);return this.type===`tuple`?`tuple(${this.value.map(e=>e.format()).join(`,`)})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith(`bytes`)}isString(){return this.type===`string`}get tupleName(){if(this.type!==`tuple`)throw TypeError(`not a tuple`);return this.#e}get arrayLength(){if(this.type!==`array`)throw TypeError(`not an array`);return this.#e===!0?-1:this.#e===!1?this.value.length:null}static from(t,n){return new e(Xc,t,n)}static uint8(e){return W(e,8)}static uint16(e){return W(e,16)}static uint24(e){return W(e,24)}static uint32(e){return W(e,32)}static uint40(e){return W(e,40)}static uint48(e){return W(e,48)}static uint56(e){return W(e,56)}static uint64(e){return W(e,64)}static uint72(e){return W(e,72)}static uint80(e){return W(e,80)}static uint88(e){return W(e,88)}static uint96(e){return W(e,96)}static uint104(e){return W(e,104)}static uint112(e){return W(e,112)}static uint120(e){return W(e,120)}static uint128(e){return W(e,128)}static uint136(e){return W(e,136)}static uint144(e){return W(e,144)}static uint152(e){return W(e,152)}static uint160(e){return W(e,160)}static uint168(e){return W(e,168)}static uint176(e){return W(e,176)}static uint184(e){return W(e,184)}static uint192(e){return W(e,192)}static uint200(e){return W(e,200)}static uint208(e){return W(e,208)}static uint216(e){return W(e,216)}static uint224(e){return W(e,224)}static uint232(e){return W(e,232)}static uint240(e){return W(e,240)}static uint248(e){return W(e,248)}static uint256(e){return W(e,256)}static uint(e){return W(e,256)}static int8(e){return W(e,-8)}static int16(e){return W(e,-16)}static int24(e){return W(e,-24)}static int32(e){return W(e,-32)}static int40(e){return W(e,-40)}static int48(e){return W(e,-48)}static int56(e){return W(e,-56)}static int64(e){return W(e,-64)}static int72(e){return W(e,-72)}static int80(e){return W(e,-80)}static int88(e){return W(e,-88)}static int96(e){return W(e,-96)}static int104(e){return W(e,-104)}static int112(e){return W(e,-112)}static int120(e){return W(e,-120)}static int128(e){return W(e,-128)}static int136(e){return W(e,-136)}static int144(e){return W(e,-144)}static int152(e){return W(e,-152)}static int160(e){return W(e,-160)}static int168(e){return W(e,-168)}static int176(e){return W(e,-176)}static int184(e){return W(e,-184)}static int192(e){return W(e,-192)}static int200(e){return W(e,-200)}static int208(e){return W(e,-208)}static int216(e){return W(e,-216)}static int224(e){return W(e,-224)}static int232(e){return W(e,-232)}static int240(e){return W(e,-240)}static int248(e){return W(e,-248)}static int256(e){return W(e,-256)}static int(e){return W(e,-256)}static bytes1(e){return Zc(e,1)}static bytes2(e){return Zc(e,2)}static bytes3(e){return Zc(e,3)}static bytes4(e){return Zc(e,4)}static bytes5(e){return Zc(e,5)}static bytes6(e){return Zc(e,6)}static bytes7(e){return Zc(e,7)}static bytes8(e){return Zc(e,8)}static bytes9(e){return Zc(e,9)}static bytes10(e){return Zc(e,10)}static bytes11(e){return Zc(e,11)}static bytes12(e){return Zc(e,12)}static bytes13(e){return Zc(e,13)}static bytes14(e){return Zc(e,14)}static bytes15(e){return Zc(e,15)}static bytes16(e){return Zc(e,16)}static bytes17(e){return Zc(e,17)}static bytes18(e){return Zc(e,18)}static bytes19(e){return Zc(e,19)}static bytes20(e){return Zc(e,20)}static bytes21(e){return Zc(e,21)}static bytes22(e){return Zc(e,22)}static bytes23(e){return Zc(e,23)}static bytes24(e){return Zc(e,24)}static bytes25(e){return Zc(e,25)}static bytes26(e){return Zc(e,26)}static bytes27(e){return Zc(e,27)}static bytes28(e){return Zc(e,28)}static bytes29(e){return Zc(e,29)}static bytes30(e){return Zc(e,30)}static bytes31(e){return Zc(e,31)}static bytes32(e){return Zc(e,32)}static address(t){return new e(Xc,`address`,t)}static bool(t){return new e(Xc,`bool`,!!t)}static bytes(t){return new e(Xc,`bytes`,t)}static string(t){return new e(Xc,`string`,t)}static array(e,t){throw Error(`not implemented yet`)}static tuple(e,t){throw Error(`not implemented yet`)}static overrides(t){return new e(Xc,`overrides`,Object.assign({},t))}static isTyped(e){return e&&typeof e==`object`&&`_typedSymbol`in e&&e._typedSymbol===Qc}static dereference(t,n){if(e.isTyped(t)){if(t.type!==n)throw Error(`invalid type: expecetd ${n}, got ${t.type}`);return t.value}return t}},el=class extends wi{constructor(e){super(`address`,`address`,e,!1)}defaultValue(){return`0x0000000000000000000000000000000000000000`}encode(e,t){let n=$c.dereference(t,`string`);try{n=Kc(n)}catch(e){return this._throwError(e.message,t)}return e.writeValue(n)}decode(e){return Kc(Br(e.readValue(),20))}},tl=class extends wi{coder;constructor(e){super(e.name,e.type,`_`,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}};function nl(e,t,n){let r=[];if(Array.isArray(n))r=n;else if(n&&typeof n==`object`){let e={};r=t.map(t=>{let r=t.localName;return R(r,`cannot encode object for signature with missing names`,`INVALID_ARGUMENT`,{argument:`values`,info:{coder:t},value:n}),R(!e[r],`cannot encode object for signature with duplicate names`,`INVALID_ARGUMENT`,{argument:`values`,info:{coder:t},value:n}),e[r]=!0,n[r]})}else z(!1,`invalid tuple value`,`tuple`,n);z(t.length===r.length,`types/value length mismatch`,`tuple`,n);let i=new Ti,a=new Ti,o=[];t.forEach((e,t)=>{let n=r[t];if(e.dynamic){let t=a.length;e.encode(a,n);let r=i.writeUpdatableValue();o.push(e=>{r(e+t)})}else e.encode(i,n)}),o.forEach(e=>{e(i.length)});let s=e.appendWriter(i);return s+=e.appendWriter(a),s}function rl(e,t){let n=[],r=[],i=e.subReader(0);return t.forEach(t=>{let a=null;if(t.dynamic){let n=e.readIndex(),r=i.subReader(n);try{a=t.decode(r)}catch(e){if(fr(e,`BUFFER_OVERRUN`))throw e;a=e,a.baseType=t.name,a.name=t.localName,a.type=t.type}}else try{a=t.decode(e)}catch(e){if(fr(e,`BUFFER_OVERRUN`))throw e;a=e,a.baseType=t.name,a.name=t.localName,a.type=t.type}if(a==null)throw Error(`investigate`);n.push(a),r.push(t.localName||null)}),Si.fromItems(n,r)}var il=class extends wi{coder;length;constructor(e,t,n){let r=e.type+`[`+(t>=0?t:``)+`]`,i=t===-1||e.dynamic;super(`array`,r,n,i),L(this,{coder:e,length:t})}defaultValue(){let e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){let n=$c.dereference(t,`array`);Array.isArray(n)||this._throwError(`expected array value`,n);let r=this.length;r===-1&&(r=n.length,e.writeValue(n.length)),mr(n.length,r,`coder array`+(this.localName?` `+this.localName:``));let i=[];for(let e=0;e<n.length;e++)i.push(this.coder);return nl(e,i,n)}decode(e){let t=this.length;t===-1&&(t=e.readIndex(),R(t*32<=e.dataLength,`insufficient data length`,`BUFFER_OVERRUN`,{buffer:e.bytes,offset:t*32,length:e.dataLength}));let n=[];for(let e=0;e<t;e++)n.push(new tl(this.coder));return rl(e,n)}},al=class extends wi{constructor(e){super(`bool`,`bool`,e,!1)}defaultValue(){return!1}encode(e,t){let n=$c.dereference(t,`bool`);return e.writeValue(+!!n)}decode(e){return!!e.readValue()}},ol=class extends wi{constructor(e,t){super(e,e,t,!0)}defaultValue(){return`0x`}encode(e,t){t=yr(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readIndex(),!0)}},sl=class extends ol{constructor(e){super(`bytes`,e)}decode(e){return V(super.decode(e))}},cl=class extends wi{size;constructor(e,t){let n=`bytes`+String(e);super(n,n,t,!1),L(this,{size:e},{size:`number`})}defaultValue(){return`0x0000000000000000000000000000000000000000000000000000000000000000`.substring(0,2+this.size*2)}encode(e,t){let n=yr($c.dereference(t,this.type));return n.length!==this.size&&this._throwError(`incorrect data length`,t),e.writeBytes(n)}decode(e){return V(e.readBytes(this.size))}},ll=new Uint8Array([]),ul=class extends wi{constructor(e){super(`null`,``,e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError(`not null`,t),e.writeBytes(ll)}decode(e){return e.readBytes(0),null}},dl=BigInt(0),fl=BigInt(1),pl=BigInt(`0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`),ml=class extends wi{size;signed;constructor(e,t,n){let r=(t?`int`:`uint`)+e*8;super(r,r,n,!1),L(this,{size:e,signed:t},{size:`number`,signed:`boolean`})}defaultValue(){return 0}encode(e,t){let n=Pr($c.dereference(t,this.type)),r=Nr(pl,256);if(this.signed){let e=Nr(r,this.size*8-1);(n>e||n<-(e+fl))&&this._throwError(`value out-of-bounds`,t),n=Mr(n,256)}else(n<dl||n>Nr(r,this.size*8))&&this._throwError(`value out-of-bounds`,t);return e.writeValue(n)}decode(e){let t=Nr(e.readValue(),this.size*8);return this.signed&&(t=jr(t,this.size*8)),t}},hl=class extends ol{constructor(e){super(`string`,e)}defaultValue(){return``}encode(e,t){return super.encode(e,ti($c.dereference(t,`string`)))}decode(e){return ri(super.decode(e))}},gl=class extends wi{coders;constructor(e,t){let n=!1,r=[];e.forEach(e=>{e.dynamic&&(n=!0),r.push(e.type)});let i=`tuple(`+r.join(`,`)+`)`;super(`tuple`,i,t,n),L(this,{coders:Object.freeze(e.slice())})}defaultValue(){let e=[];this.coders.forEach(t=>{e.push(t.defaultValue())});let t=this.coders.reduce((e,t)=>{let n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e},{});return this.coders.forEach((n,r)=>{let i=n.localName;!i||t[i]!==1||(i===`length`&&(i=`_length`),e[i]??(e[i]=e[r]))}),Object.freeze(e)}encode(e,t){let n=$c.dereference(t,`tuple`);return nl(e,this.coders,n)}decode(e){return rl(e,this.coders)}};function _l(e){return U(ti(e))}function vl(e,t){return{address:Kc(e),storageKeys:t.map((e,t)=>(z(br(e,32),`invalid slot`,`storageKeys[${t}]`,e),e.toLowerCase()))}}function yl(e){if(Array.isArray(e))return e.map((t,n)=>Array.isArray(t)?(z(t.length===2,`invalid slot set`,`value[${n}]`,t),vl(t[0],t[1])):(z(typeof t==`object`&&!!t,`invalid address-slot set`,`value`,e),vl(t.address,t.storageKeys)));z(typeof e==`object`&&!!e,`invalid access list`,`value`,e);let t=Object.keys(e).map(t=>{let n=e[t].reduce((e,t)=>(e[t]=!0,e),{});return vl(t,Object.keys(n).sort())});return t.sort((e,t)=>e.address.localeCompare(t.address)),t}function bl(e){let t;return t=typeof e==`string`?Lc.computePublicKey(e,!1):e.publicKey,Kc(U(`0x`+t.substring(4)).substring(26))}function xl(e,t){return bl(Lc.recoverPublicKey(e,t))}var Sl=BigInt(0),Cl=BigInt(2),wl=BigInt(27),Tl=BigInt(28),El=BigInt(35),Dl=BigInt(`0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`),Ol=131072;function kl(e,t){let n=e.toString(16);for(;n.length<2;)n=`0`+n;return n+=ns(t).substring(4),`0x`+n}function Al(e){return e===`0x`?null:Kc(e)}function jl(e,t){try{return yl(e)}catch(n){z(!1,n.message,t,e)}}function Ml(e,t){return e===`0x`?0:Rr(e,t)}function Nl(e,t){if(e===`0x`)return Sl;let n=Pr(e,t);return z(n<=Dl,`value exceeds uint size`,t,n),n}function Pl(e,t){let n=Pr(e,`value`),r=Vr(n);return z(r.length<=32,`value too large`,`tx.${t}`,n),r}function Fl(e){return yl(e).map(e=>[e.address,e.storageKeys])}function Il(e,t){z(Array.isArray(e),`invalid ${t}`,`value`,e);for(let t=0;t<e.length;t++)z(br(e[t],32),"invalid ${ param } hash",`value[${t}]`,e[t]);return e}function Ll(e){let t=ci(e);z(Array.isArray(t)&&(t.length===9||t.length===6),`invalid field count for legacy transaction`,`data`,e);let n={type:0,nonce:Ml(t[0],`nonce`),gasPrice:Nl(t[1],`gasPrice`),gasLimit:Nl(t[2],`gasLimit`),to:Al(t[3]),value:Nl(t[4],`value`),data:V(t[5]),chainId:Sl};if(t.length===6)return n;let r=Nl(t[6],`v`),i=Nl(t[7],`r`),a=Nl(t[8],`s`);if(i===Sl&&a===Sl)n.chainId=r;else{let e=(r-El)/Cl;e<Sl&&(e=Sl),n.chainId=e,z(e!==Sl||r===wl||r===Tl,`non-canonical legacy v`,`v`,t[6]),n.signature=Ic.from({r:Dr(t[7],32),s:Dr(t[8],32),v:r})}return n}function Rl(e,t){let n=[Pl(e.nonce,`nonce`),Pl(e.gasPrice||0,`gasPrice`),Pl(e.gasLimit,`gasLimit`),e.to||`0x`,Pl(e.value,`value`),e.data],r=Sl;if(e.chainId!=Sl)r=Pr(e.chainId,`tx.chainId`),z(!t||t.networkV==null||t.legacyChainId===r,`tx.chainId/sig.v mismatch`,`sig`,t);else if(e.signature){let t=e.signature.legacyChainId;t!=null&&(r=t)}if(!t)return r!==Sl&&(n.push(Vr(r)),n.push(`0x`),n.push(`0x`)),fi(n);let i=BigInt(27+t.yParity);return r===Sl?BigInt(t.v)!==i&&z(!1,`tx.chainId/sig.v mismatch`,`sig`,t):i=Ic.getChainIdV(r,t.v),n.push(Vr(i)),n.push(Vr(t.r)),n.push(Vr(t.s)),fi(n)}function zl(e,t){let n;try{if(n=Ml(t[0],`yParity`),n!==0&&n!==1)throw Error(`bad yParity`)}catch{z(!1,`invalid yParity`,`yParity`,t[0])}let r=Dr(t[1],32),i=Dr(t[2],32);e.signature=Ic.from({r,s:i,yParity:n})}function Bl(e){let t=ci(B(e).slice(1));z(Array.isArray(t)&&(t.length===9||t.length===12),`invalid field count for transaction type: 2`,`data`,V(e));let n={type:2,chainId:Nl(t[0],`chainId`),nonce:Ml(t[1],`nonce`),maxPriorityFeePerGas:Nl(t[2],`maxPriorityFeePerGas`),maxFeePerGas:Nl(t[3],`maxFeePerGas`),gasPrice:null,gasLimit:Nl(t[4],`gasLimit`),to:Al(t[5]),value:Nl(t[6],`value`),data:V(t[7]),accessList:jl(t[8],`accessList`)};return t.length===9||zl(n,t.slice(9)),n}function Vl(e,t){let n=[Pl(e.chainId,`chainId`),Pl(e.nonce,`nonce`),Pl(e.maxPriorityFeePerGas||0,`maxPriorityFeePerGas`),Pl(e.maxFeePerGas||0,`maxFeePerGas`),Pl(e.gasLimit,`gasLimit`),e.to||`0x`,Pl(e.value,`value`),e.data,Fl(e.accessList||[])];return t&&(n.push(Pl(t.yParity,`yParity`)),n.push(Vr(t.r)),n.push(Vr(t.s))),Cr([`0x02`,fi(n)])}function Hl(e){let t=ci(B(e).slice(1));z(Array.isArray(t)&&(t.length===8||t.length===11),`invalid field count for transaction type: 1`,`data`,V(e));let n={type:1,chainId:Nl(t[0],`chainId`),nonce:Ml(t[1],`nonce`),gasPrice:Nl(t[2],`gasPrice`),gasLimit:Nl(t[3],`gasLimit`),to:Al(t[4]),value:Nl(t[5],`value`),data:V(t[6]),accessList:jl(t[7],`accessList`)};return t.length===8||zl(n,t.slice(8)),n}function Ul(e,t){let n=[Pl(e.chainId,`chainId`),Pl(e.nonce,`nonce`),Pl(e.gasPrice||0,`gasPrice`),Pl(e.gasLimit,`gasLimit`),e.to||`0x`,Pl(e.value,`value`),e.data,Fl(e.accessList||[])];return t&&(n.push(Pl(t.yParity,`recoveryParam`)),n.push(Vr(t.r)),n.push(Vr(t.s))),Cr([`0x01`,fi(n)])}function Wl(e){let t=ci(B(e).slice(1)),n=`3`,r=null;if(t.length===4&&Array.isArray(t[0])){n=`3 (network format)`;let e=t[1],i=t[2],a=t[3];z(Array.isArray(e),`invalid network format: blobs not an array`,`fields[1]`,e),z(Array.isArray(i),`invalid network format: commitments not an array`,`fields[2]`,i),z(Array.isArray(a),`invalid network format: proofs not an array`,`fields[3]`,a),z(e.length===i.length,`invalid network format: blobs/commitments length mismatch`,`fields`,t),z(e.length===a.length,`invalid network format: blobs/proofs length mismatch`,`fields`,t),r=[];for(let n=0;n<t[1].length;n++)r.push({data:e[n],commitment:i[n],proof:a[n]});t=t[0]}z(Array.isArray(t)&&(t.length===11||t.length===14),`invalid field count for transaction type: ${n}`,`data`,V(e));let i={type:3,chainId:Nl(t[0],`chainId`),nonce:Ml(t[1],`nonce`),maxPriorityFeePerGas:Nl(t[2],`maxPriorityFeePerGas`),maxFeePerGas:Nl(t[3],`maxFeePerGas`),gasPrice:null,gasLimit:Nl(t[4],`gasLimit`),to:Al(t[5]),value:Nl(t[6],`value`),data:V(t[7]),accessList:jl(t[8],`accessList`),maxFeePerBlobGas:Nl(t[9],`maxFeePerBlobGas`),blobVersionedHashes:t[10]};r&&(i.blobs=r),z(i.to!=null,`invalid address for transaction type: ${n}`,`data`,e),z(Array.isArray(i.blobVersionedHashes),`invalid blobVersionedHashes: must be an array`,`data`,e);for(let t=0;t<i.blobVersionedHashes.length;t++)z(br(i.blobVersionedHashes[t],32),`invalid blobVersionedHash at index ${t}: must be length 32`,`data`,e);return t.length===11||zl(i,t.slice(11)),i}function Gl(e,t,n){let r=[Pl(e.chainId,`chainId`),Pl(e.nonce,`nonce`),Pl(e.maxPriorityFeePerGas||0,`maxPriorityFeePerGas`),Pl(e.maxFeePerGas||0,`maxFeePerGas`),Pl(e.gasLimit,`gasLimit`),e.to||`0x0000000000000000000000000000000000000000`,Pl(e.value,`value`),e.data,Fl(e.accessList||[]),Pl(e.maxFeePerBlobGas||0,`maxFeePerBlobGas`),Il(e.blobVersionedHashes||[],`blobVersionedHashes`)];return t&&(r.push(Pl(t.yParity,`yParity`)),r.push(Vr(t.r)),r.push(Vr(t.s)),n)?Cr([`0x03`,fi([r,n.map(e=>e.data),n.map(e=>e.commitment),n.map(e=>e.proof)])]):Cr([`0x03`,fi(r)])}var Kl=class e{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m;#h;get type(){return this.#e}set type(e){switch(e){case null:this.#e=null;break;case 0:case`legacy`:this.#e=0;break;case 1:case`berlin`:case`eip-2930`:this.#e=1;break;case 2:case`london`:case`eip-1559`:this.#e=2;break;case 3:case`cancun`:case`eip-4844`:this.#e=3;break;default:z(!1,`unsupported transaction type`,`type`,e)}}get typeName(){switch(this.type){case 0:return`legacy`;case 1:return`eip-2930`;case 2:return`eip-1559`;case 3:return`eip-4844`}return null}get to(){let e=this.#t;return e==null&&this.type===3?Tc:e}set to(e){this.#t=e==null?null:Kc(e)}get nonce(){return this.#r}set nonce(e){this.#r=Rr(e,`value`)}get gasLimit(){return this.#i}set gasLimit(e){this.#i=Pr(e)}get gasPrice(){let e=this.#a;return e==null&&(this.type===0||this.type===1)?Sl:e}set gasPrice(e){this.#a=e==null?null:Pr(e,`gasPrice`)}get maxPriorityFeePerGas(){return this.#o??(this.type===2||this.type===3?Sl:null)}set maxPriorityFeePerGas(e){this.#o=e==null?null:Pr(e,`maxPriorityFeePerGas`)}get maxFeePerGas(){return this.#s??(this.type===2||this.type===3?Sl:null)}set maxFeePerGas(e){this.#s=e==null?null:Pr(e,`maxFeePerGas`)}get data(){return this.#n}set data(e){this.#n=V(e)}get value(){return this.#c}set value(e){this.#c=Pr(e,`value`)}get chainId(){return this.#l}set chainId(e){this.#l=Pr(e)}get signature(){return this.#u||null}set signature(e){this.#u=e==null?null:Ic.from(e)}get accessList(){return(this.#d||null)??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){this.#d=e==null?null:yl(e)}get maxFeePerBlobGas(){let e=this.#f;return e==null&&this.type===3?Sl:e}set maxFeePerBlobGas(e){this.#f=e==null?null:Pr(e,`maxFeePerBlobGas`)}get blobVersionedHashes(){let e=this.#p;return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){z(Array.isArray(e),`blobVersionedHashes must be an Array`,`value`,e),e=e.slice();for(let t=0;t<e.length;t++)z(br(e[t],32),`invalid blobVersionedHash`,`value[${t}]`,e[t])}this.#p=e}get blobs(){return this.#h==null?null:this.#h.map(e=>Object.assign({},e))}set blobs(e){if(e==null){this.#h=null;return}let t=[],n=[];for(let r=0;r<e.length;r++){let i=e[r];if(xr(i)){R(this.#m,`adding a raw blob requires a KZG library`,`UNSUPPORTED_OPERATION`,{operation:`set blobs()`});let e=B(i);if(z(e.length<=Ol,`blob is too large`,`blobs[${r}]`,i),e.length!==Ol){let t=new Uint8Array(Ol);t.set(e),e=t}let a=this.#m.blobToKzgCommitment(e),o=V(this.#m.computeBlobKzgProof(e,a));t.push({data:V(e),commitment:V(a),proof:o}),n.push(kl(1,a))}else{let e=V(i.commitment);t.push({data:V(i.data),commitment:e,proof:V(i.proof)}),n.push(kl(1,e))}}this.#h=t,this.#p=n}get kzg(){return this.#m}set kzg(e){this.#m=e}constructor(){this.#e=null,this.#t=null,this.#r=0,this.#i=Sl,this.#a=null,this.#o=null,this.#s=null,this.#n=`0x`,this.#c=Sl,this.#l=Sl,this.#u=null,this.#d=null,this.#f=null,this.#p=null,this.#h=null,this.#m=null}get hash(){return this.signature==null?null:U(this.#g(!0,!1))}get unsignedHash(){return U(this.unsignedSerialized)}get from(){return this.signature==null?null:xl(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Lc.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}#g(e,t){R(!e||this.signature!=null,`cannot serialize unsigned transaction; maybe you meant .unsignedSerialized`,`UNSUPPORTED_OPERATION`,{operation:`.serialized`});let n=e?this.signature:null;switch(this.inferType()){case 0:return Rl(this,n);case 1:return Ul(this,n);case 2:return Vl(this,n);case 3:return Gl(this,n,t?this.blobs:null)}R(!1,`unsupported transaction type`,`UNSUPPORTED_OPERATION`,{operation:`.serialized`})}get serialized(){return this.#g(!0,!0)}get unsignedSerialized(){return this.#g(!1,!1)}inferType(){let e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){let e=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,n=this.accessList!=null,r=this.#f!=null||this.#p;this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&R(this.maxFeePerGas>=this.maxPriorityFeePerGas,`priorityFee cannot be more than maxFee`,`BAD_DATA`,{value:this}),R(!t||this.type!==0&&this.type!==1,`transaction type cannot have maxFeePerGas or maxPriorityFeePerGas`,`BAD_DATA`,{value:this}),R(this.type!==0||!n,`legacy transaction cannot have accessList`,`BAD_DATA`,{value:this});let i=[];return this.type==null?t?i.push(2):e?(i.push(1),n||i.push(0)):n?(i.push(1),i.push(2)):r&&this.to?i.push(3):(i.push(0),i.push(1),i.push(2),i.push(3)):i.push(this.type),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return e.from(this)}toJSON(){let e=e=>e==null?null:e.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(t){if(t==null)return new e;if(typeof t==`string`){let n=B(t);if(n[0]>=127)return e.from(Ll(n));switch(n[0]){case 1:return e.from(Hl(n));case 2:return e.from(Bl(n));case 3:return e.from(Wl(n))}R(!1,`unsupported transaction type`,`UNSUPPORTED_OPERATION`,{operation:`from`})}let n=new e;return t.type!=null&&(n.type=t.type),t.to!=null&&(n.to=t.to),t.nonce!=null&&(n.nonce=t.nonce),t.gasLimit!=null&&(n.gasLimit=t.gasLimit),t.gasPrice!=null&&(n.gasPrice=t.gasPrice),t.maxPriorityFeePerGas!=null&&(n.maxPriorityFeePerGas=t.maxPriorityFeePerGas),t.maxFeePerGas!=null&&(n.maxFeePerGas=t.maxFeePerGas),t.maxFeePerBlobGas!=null&&(n.maxFeePerBlobGas=t.maxFeePerBlobGas),t.data!=null&&(n.data=t.data),t.value!=null&&(n.value=t.value),t.chainId!=null&&(n.chainId=t.chainId),t.signature!=null&&(n.signature=Ic.from(t.signature)),t.accessList!=null&&(n.accessList=t.accessList),t.blobVersionedHashes!=null&&(n.blobVersionedHashes=t.blobVersionedHashes),t.kzg!=null&&(n.kzg=t.kzg),t.blobs!=null&&(n.blobs=t.blobs),t.hash!=null&&(z(n.isSigned(),`unsigned transaction cannot define '.hash'`,`tx`,t),z(n.hash===t.hash,`hash mismatch`,`tx`,t)),t.from!=null&&(z(n.isSigned(),`unsigned transaction cannot define '.from'`,`tx`,t),z(n.from.toLowerCase()===(t.from||``).toLowerCase(),`from mismatch`,`tx`,t)),n}};function ql(e){return typeof e==`string`&&(e=ti(e)),U(Cr([ti(Dc),ti(String(e.length)),e]))}var Jl=new Uint8Array(32);Jl.fill(0);var Yl=BigInt(-1),Xl=BigInt(0),Zl=BigInt(1),Ql=BigInt(`0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff`);function $l(e){let t=B(e),n=t.length%32;return n?Cr([t,Jl.slice(n)]):V(t)}var eu=Br(Zl,32),tu=Br(Xl,32),nu={name:`string`,version:`string`,chainId:`uint256`,verifyingContract:`address`,salt:`bytes32`},ru=[`name`,`version`,`chainId`,`verifyingContract`,`salt`];function iu(e){return function(t){return z(typeof t==`string`,`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}var au={name:iu(`name`),version:iu(`version`),chainId:function(e){let t=Pr(e,`domain.chainId`);return z(t>=0,`invalid chain ID`,`domain.chainId`,e),Number.isSafeInteger(t)?Number(t):Hr(t)},verifyingContract:function(e){try{return Kc(e).toLowerCase()}catch{}z(!1,`invalid domain value "verifyingContract"`,`domain.verifyingContract`,e)},salt:function(e){let t=B(e,`domain.salt`);return z(t.length===32,`invalid domain value "salt"`,`domain.salt`,e),V(t)}};function ou(e){{let t=e.match(/^(u?)int(\d+)$/);if(t){let n=t[1]===``,r=parseInt(t[2]);z(r%8==0&&r!==0&&r<=256&&t[2]===String(r),`invalid numeric width`,`type`,e);let i=Nr(Ql,n?r-1:r),a=n?(i+Zl)*Yl:Xl;return function(t){let r=Pr(t,`value`);return z(r>=a&&r<=i,`value out-of-bounds for ${e}`,`value`,r),Br(n?Mr(r,256):r,32)}}}{let t=e.match(/^bytes(\d+)$/);if(t){let n=parseInt(t[1]);return z(n!==0&&n<=32&&t[1]===String(n),`invalid bytes width`,`type`,e),function(t){return z(B(t).length===n,`invalid length for ${e}`,`value`,t),$l(t)}}}switch(e){case`address`:return function(e){return Dr(Kc(e),32)};case`bool`:return function(e){return e?eu:tu};case`bytes`:return function(e){return U(e)};case`string`:return function(e){return _l(e)}}return null}function su(e,t){return`${e}(${t.map(({name:e,type:t})=>t+` `+e).join(`,`)})`}function cu(e){let t=e.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return t?{base:t[1],index:t[2]+t[4],array:{base:t[1],prefix:t[1]+t[2],count:t[5]?parseInt(t[5]):-1}}:{base:e}}var lu=class e{primaryType;#e;get types(){return JSON.parse(this.#e)}#t;#n;constructor(e){this.#t=new Map,this.#n=new Map;let t=new Map,n=new Map,r=new Map,i={};Object.keys(e).forEach(a=>{i[a]=e[a].map(({name:t,type:n})=>{let{base:r,index:i}=cu(n);return r===`int`&&!e.int&&(r=`int256`),r===`uint`&&!e.uint&&(r=`uint256`),{name:t,type:r+(i||``)}}),t.set(a,new Set),n.set(a,[]),r.set(a,new Set)}),this.#e=JSON.stringify(i);for(let r in i){let a=new Set;for(let o of i[r]){z(!a.has(o.name),`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,`types`,e),a.add(o.name);let i=cu(o.type).base;z(i!==r,`circular type reference to ${JSON.stringify(i)}`,`types`,e),!ou(i)&&(z(n.has(i),`unknown type ${JSON.stringify(i)}`,`types`,e),n.get(i).push(r),t.get(r).add(i))}}let a=Array.from(n.keys()).filter(e=>n.get(e).length===0);z(a.length!==0,`missing primary type`,`types`,e),z(a.length===1,`ambiguous primary types or unused types: ${a.map(e=>JSON.stringify(e)).join(`, `)}`,`types`,e),L(this,{primaryType:a[0]});function o(i,a){z(!a.has(i),`circular type reference to ${JSON.stringify(i)}`,`types`,e),a.add(i);for(let e of t.get(i))if(n.has(e)){o(e,a);for(let t of a)r.get(t).add(e)}a.delete(i)}o(this.primaryType,new Set);for(let[e,t]of r){let n=Array.from(t);n.sort(),this.#t.set(e,su(e,i[e])+n.map(e=>su(e,i[e])).join(``))}}getEncoder(e){let t=this.#n.get(e);return t||(t=this.#r(e),this.#n.set(e,t)),t}#r(e){{let t=ou(e);if(t)return t}let t=cu(e).array;if(t){let e=t.prefix,n=this.getEncoder(e);return r=>{z(t.count===-1||t.count===r.length,`array length mismatch; expected length ${t.count}`,`value`,r);let i=r.map(n);return this.#t.has(e)&&(i=i.map(U)),U(Cr(i))}}let n=this.types[e];if(n){let t=_l(this.#t.get(e));return e=>{let r=n.map(({name:t,type:n})=>{let r=this.getEncoder(n)(e[t]);return this.#t.has(n)?U(r):r});return r.unshift(t),Cr(r)}}z(!1,`unknown type: ${e}`,`type`,e)}encodeType(e){let t=this.#t.get(e);return z(t,`unknown type: ${JSON.stringify(e)}`,`name`,e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return U(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,n){if(ou(e))return n(e,t);let r=cu(e).array;if(r)return z(r.count===-1||r.count===t.length,`array length mismatch; expected length ${r.count}`,`value`,t),t.map(e=>this._visit(r.prefix,e,n));let i=this.types[e];if(i)return i.reduce((e,{name:r,type:i})=>(e[r]=this._visit(i,t[r],n),e),{});z(!1,`unknown type: ${e}`,`type`,e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(t){return new e(t)}static getPrimaryType(t){return e.from(t).primaryType}static hashStruct(t,n,r){return e.from(n).hashStruct(t,r)}static hashDomain(t){let n=[];for(let e in t){if(t[e]==null)continue;let r=nu[e];z(r,`invalid typed-data domain key: ${JSON.stringify(e)}`,`domain`,t),n.push({name:e,type:r})}return n.sort((e,t)=>ru.indexOf(e.name)-ru.indexOf(t.name)),e.hashStruct(`EIP712Domain`,{EIP712Domain:n},t)}static encode(t,n,r){return Cr([`0x1901`,e.hashDomain(t),e.from(n).hash(r)])}static hash(t,n,r){return U(e.encode(t,n,r))}static async resolveNames(t,n,r,i){t=Object.assign({},t);for(let e in t)t[e]??delete t[e];let a={};t.verifyingContract&&!br(t.verifyingContract,20)&&(a[t.verifyingContract]=`0x`);let o=e.from(n);o.visit(r,(e,t)=>(e===`address`&&!br(t,20)&&(a[t]=`0x`),t));for(let e in a)a[e]=await i(e);return t.verifyingContract&&a[t.verifyingContract]&&(t.verifyingContract=a[t.verifyingContract]),r=o.visit(r,(e,t)=>e===`address`&&a[t]?a[t]:t),{domain:t,value:r}}static getPayload(t,n,r){e.hashDomain(t);let i={},a=[];ru.forEach(e=>{let n=t[e];n!=null&&(i[e]=au[e](n),a.push({name:e,type:nu[e]}))});let o=e.from(n);n=o.types;let s=Object.assign({},n);return z(s.EIP712Domain==null,`types must not contain EIP712Domain type`,`types.EIP712Domain`,n),s.EIP712Domain=a,o.encode(r),{types:s,domain:i,primaryType:o.primaryType,message:o.visit(r,(e,t)=>{if(e.match(/^bytes(\d*)/))return V(B(t));if(e.match(/^u?int/))return Pr(t).toString();switch(e){case`address`:return t.toLowerCase();case`bool`:return!!t;case`string`:return z(typeof t==`string`,`invalid string`,`value`,t),t}z(!1,`unsupported type`,`type`,e)})}}};function uu(e){let t=new Set;return e.forEach(e=>t.add(e)),Object.freeze(t)}uu(`external public payable override`.split(` `));var du=`constant external internal payable private public pure view override`;uu(du.split(` `));var fu=`constructor error event fallback function receive struct`;uu(fu.split(` `));var pu=`calldata memory storage payable indexed`,mu=uu(pu.split(` `)),hu=uu([fu,pu,`tuple returns`,du].join(` `).split(` `)),gu={"(":`OPEN_PAREN`,")":`CLOSE_PAREN`,"[":`OPEN_BRACKET`,"]":`CLOSE_BRACKET`,",":`COMMA`,"@":`AT`},_u=RegExp(`^(\\s*)`),vu=RegExp(`^([0-9]+)`),yu=RegExp(`^([a-zA-Z$_][a-zA-Z0-9$_]*)`),bu=RegExp(`^([a-zA-Z$_][a-zA-Z0-9$_]*)$`),xu=RegExp(`^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$`),Su=class e{#e;#t;get offset(){return this.#e}get length(){return this.#t.length-this.#e}constructor(e){this.#e=0,this.#t=e.slice()}clone(){return new e(this.#t)}reset(){this.#e=0}#n(t=0,n=0){return new e(this.#t.slice(t,n).map(e=>Object.freeze(Object.assign({},e,{match:e.match-t,linkBack:e.linkBack-t,linkNext:e.linkNext-t}))))}popKeyword(e){let t=this.peek();if(t.type!==`KEYWORD`||!e.has(t.text))throw Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){let t=this.peek();throw Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){let e=this.peek();if(e.type!==`OPEN_PAREN`)throw Error(`bad start`);let t=this.#n(this.#e+1,e.match+1);return this.#e=e.match+1,t}popParams(){let e=this.peek();if(e.type!==`OPEN_PAREN`)throw Error(`bad start`);let t=[];for(;this.#e<e.match-1;){let e=this.peek().linkNext;t.push(this.#n(this.#e+1,e)),this.#e=e}return this.#e=e.match+1,t}peek(){if(this.#e>=this.#t.length)throw Error(`out-of-bounds`);return this.#t[this.#e]}peekKeyword(e){let t=this.peekType(`KEYWORD`);return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;let t=this.peek();return t.type===e?t.text:null}pop(){let e=this.peek();return this.#e++,e}toString(){let e=[];for(let t=this.#e;t<this.#t.length;t++){let n=this.#t[t];e.push(`${n.type}:${n.text}`)}return`<TokenString ${e.join(` `)}>`}};function Cu(e){let t=[],n=t=>{let n=a<e.length?JSON.stringify(e[a]):`$EOI`;throw Error(`invalid token ${n} at ${a}: ${t}`)},r=[],i=[],a=0;for(;a<e.length;){let o=e.substring(a),s=o.match(_u);s&&(a+=s[1].length,o=e.substring(a));let c={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:``,text:``,offset:a,value:-1};t.push(c);let l=gu[o[0]]||``;if(l){if(c.type=l,c.text=o[0],a++,l===`OPEN_PAREN`)r.push(t.length-1),i.push(t.length-1);else if(l==`CLOSE_PAREN`)r.length===0&&n(`no matching open bracket`),c.match=r.pop(),t[c.match].match=t.length-1,c.depth--,c.linkBack=i.pop(),t[c.linkBack].linkNext=t.length-1;else if(l===`COMMA`)c.linkBack=i.pop(),t[c.linkBack].linkNext=t.length-1,i.push(t.length-1);else if(l===`OPEN_BRACKET`)c.type=`BRACKET`;else if(l===`CLOSE_BRACKET`){let e=t.pop().text;if(t.length>0&&t[t.length-1].type===`NUMBER`){let n=t.pop().text;e=n+e,t[t.length-1].value=Rr(n)}if(t.length===0||t[t.length-1].type!==`BRACKET`)throw Error(`missing opening bracket`);t[t.length-1].text+=e}continue}if(s=o.match(yu),s){if(c.text=s[1],a+=c.text.length,hu.has(c.text)){c.type=`KEYWORD`;continue}if(c.text.match(xu)){c.type=`TYPE`;continue}c.type=`ID`;continue}if(s=o.match(vu),s){c.text=s[1],c.type=`NUMBER`,a+=c.text.length;continue}throw Error(`unexpected token ${JSON.stringify(o[0])} at position ${a}`)}return new Su(t.map(e=>Object.freeze(e)))}function wu(e,t){let n=new Set;for(;;){let r=e.peekType(`KEYWORD`);if(r==null||t&&!t.has(r))break;if(e.pop(),n.has(r))throw Error(`duplicate keywords: ${JSON.stringify(r)}`);n.add(r)}return Object.freeze(n)}var Tu=new RegExp(/^(.*)\[([0-9]*)\]$/);function Eu(e){let t=e.match(xu);if(z(t,`invalid type`,`type`,e),e===`uint`)return`uint256`;if(e===`int`)return`int256`;if(t[2]){let n=parseInt(t[2]);z(n!==0&&n<=32,`invalid bytes length`,`type`,e)}else if(t[3]){let n=parseInt(t[3]);z(n!==0&&n<=256&&n%8==0,`invalid numeric width`,`type`,e)}return e}var Du={},Ou=Symbol.for(`_ethers_internal`),ku=`_ParamTypeInternal`,Au=class e{name;type;baseType;indexed;components;arrayLength;arrayChildren;constructor(e,t,n,r,i,a,o,s){if(_r(e,Du,`ParamType`),Object.defineProperty(this,Ou,{value:ku}),a&&=Object.freeze(a.slice()),r===`array`){if(o==null||s==null)throw Error(``)}else if(o!=null||s!=null)throw Error(``);if(r===`tuple`){if(a==null)throw Error(``)}else if(a!=null)throw Error(``);L(this,{name:t,type:n,baseType:r,indexed:i,components:a,arrayLength:o,arrayChildren:s})}format(e){if(e??=`sighash`,e===`json`){let t=this.name||``;if(this.isArray()){let e=JSON.parse(this.arrayChildren.format(`json`));return e.name=t,e.type+=`[${this.arrayLength<0?``:String(this.arrayLength)}]`,JSON.stringify(e)}let n={type:this.baseType===`tuple`?`tuple`:this.type,name:t};return typeof this.indexed==`boolean`&&(n.indexed=this.indexed),this.isTuple()&&(n.components=this.components.map(t=>JSON.parse(t.format(e)))),JSON.stringify(n)}let t=``;return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?``:String(this.arrayLength)}]`):this.isTuple()?t+=`(`+this.components.map(t=>t.format(e)).join(e===`full`?`, `:`,`)+`)`:t+=this.type,e!==`sighash`&&(this.indexed===!0&&(t+=` indexed`),e===`full`&&this.name&&(t+=` `+this.name)),t}isArray(){return this.baseType===`array`}isTuple(){return this.baseType===`tuple`}isIndexable(){return this.indexed!=null}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw Error(`invalid array value`);if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw Error(`array is wrong length`);let n=this;return e.map(e=>n.arrayChildren.walk(e,t))}if(this.isTuple()){if(!Array.isArray(e))throw Error(`invalid tuple value`);if(e.length!==this.components.length)throw Error(`array is wrong length`);let n=this;return e.map((e,r)=>n.components[r].walk(e,t))}return t(this.type,e)}#e(e,t,n,r){if(this.isArray()){if(!Array.isArray(t))throw Error(`invalid array value`);if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw Error(`array is wrong length`);let i=this.arrayChildren,a=t.slice();a.forEach((t,r)=>{i.#e(e,t,n,e=>{a[r]=e})}),r(a);return}if(this.isTuple()){let i=this.components,a;if(Array.isArray(t))a=t.slice();else{if(typeof t!=`object`||!t)throw Error(`invalid tuple value`);a=i.map(e=>{if(!e.name)throw Error(`cannot use object value with unnamed components`);if(!(e.name in t))throw Error(`missing value for component ${e.name}`);return t[e.name]})}if(a.length!==this.components.length)throw Error(`array is wrong length`);a.forEach((t,r)=>{i[r].#e(e,t,n,e=>{a[r]=e})}),r(a);return}let i=n(this.type,t);i.then?e.push((async function(){r(await i)})()):r(i)}async walkAsync(e,t){let n=[],r=[e];return this.#e(n,e,t,e=>{r[0]=e}),n.length&&await Promise.all(n),r[0]}static from(t,n){if(e.isParamType(t))return t;if(typeof t==`string`)try{return e.from(Cu(t),n)}catch{z(!1,`invalid param type`,`obj`,t)}else if(t instanceof Su){let r=``,i=``,a=null;wu(t,uu([`tuple`])).has(`tuple`)||t.peekType(`OPEN_PAREN`)?(i=`tuple`,a=t.popParams().map(t=>e.from(t)),r=`tuple(${a.map(e=>e.format()).join(`,`)})`):(r=Eu(t.popType(`TYPE`)),i=r);let o=null,s=null;for(;t.length&&t.peekType(`BRACKET`);){let n=t.pop();o=new e(Du,``,r,i,null,a,s,o),s=n.value,r+=n.text,i=`array`,a=null}let c=null;if(wu(t,mu).has(`indexed`)){if(!n)throw Error(``);c=!0}let l=t.peekType(`ID`)?t.pop().text:``;if(t.length)throw Error(`leftover tokens`);return new e(Du,l,r,i,c,a,s,o)}let r=t.name;z(!r||typeof r==`string`&&r.match(bu),`invalid name`,`obj.name`,r);let i=t.indexed;i!=null&&(z(n,`parameter cannot be indexed`,`obj.indexed`,t.indexed),i=!!i);let a=t.type,o=a.match(Tu);if(o){let n=parseInt(o[2]||`-1`),s=e.from({type:o[1],components:t.components});return new e(Du,r||``,a,`array`,i,null,n,s)}if(a===`tuple`||a.startsWith(`tuple(`)||a.startsWith(`(`)){let n=t.components==null?null:t.components.map(t=>e.from(t));return new e(Du,r||``,a,`tuple`,i,n,null,null)}return a=Eu(t.type),new e(Du,r||``,a,a,i,null,null,null)}static isParamType(e){return e&&e[Ou]===ku}},ju=new Map;ju.set(0,`GENERIC_PANIC`),ju.set(1,`ASSERT_FALSE`),ju.set(17,`OVERFLOW`),ju.set(18,`DIVIDE_BY_ZERO`),ju.set(33,`ENUM_RANGE_ERROR`),ju.set(34,`BAD_STORAGE_DATA`),ju.set(49,`STACK_UNDERFLOW`),ju.set(50,`ARRAY_RANGE_ERROR`),ju.set(65,`OUT_OF_MEMORY`),ju.set(81,`UNINITIALIZED_FUNCTION_CALL`);var Mu=new RegExp(/^bytes([0-9]*)$/),Nu=new RegExp(/^(u?int)([0-9]*)$/),Pu=null,Fu=1024;function Iu(e,t,n,r){let i=`missing revert data`,a=null,o=null;if(n){i=`execution reverted`;let e=B(n);if(n=V(n),e.length===0)i+=` (no data present; likely require(false) occurred`,a=`require(false)`;else if(e.length%32!=4)i+=` (could not decode reason; invalid data length)`;else if(V(e.slice(0,4))===`0x08c379a0`)try{a=r.decode([`string`],e.slice(4))[0],o={signature:`Error(string)`,name:`Error`,args:[a]},i+=`: ${JSON.stringify(a)}`}catch{i+=` (could not decode reason; invalid string data)`}else if(V(e.slice(0,4))===`0x4e487b71`)try{let t=Number(r.decode([`uint256`],e.slice(4))[0]);o={signature:`Panic(uint256)`,name:`Panic`,args:[t]},a=`Panic due to ${ju.get(t)||`UNKNOWN`}(${t})`,i+=`: ${a}`}catch{i+=` (could not decode panic code)`}else i+=` (unknown custom error)`}let s={to:t.to?Kc(t.to):null,data:t.data||`0x`};return t.from&&(s.from=Kc(t.from)),pr(i,`CALL_EXCEPTION`,{action:e,data:n,reason:a,transaction:s,invocation:null,revert:o})}var Lu=class e{#e(e){if(e.isArray())return new il(this.#e(e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new gl(e.components.map(e=>this.#e(e)),e.name);switch(e.baseType){case`address`:return new el(e.name);case`bool`:return new al(e.name);case`string`:return new hl(e.name);case`bytes`:return new sl(e.name);case``:return new ul(e.name)}let t=e.type.match(Nu);if(t){let n=parseInt(t[2]||`256`);return z(n!==0&&n<=256&&n%8==0,`invalid `+t[1]+` bit length`,`param`,e),new ml(n/8,t[1]===`int`,e.name)}if(t=e.type.match(Mu),t){let n=parseInt(t[1]);return z(n!==0&&n<=32,`invalid bytes length`,`param`,e),new cl(n,e.name)}z(!1,`invalid type`,`type`,e.type)}getDefaultValue(e){return new gl(e.map(e=>this.#e(Au.from(e))),`_`).defaultValue()}encode(e,t){mr(t.length,e.length,`types/values length mismatch`);let n=new gl(e.map(e=>this.#e(Au.from(e))),`_`),r=new Ti;return n.encode(r,t),r.data}decode(e,t,n){return new gl(e.map(e=>this.#e(Au.from(e))),`_`).decode(new Ei(t,n,Fu))}static _setDefaultMaxInflation(e){z(typeof e==`number`&&Number.isInteger(e),`invalid defaultMaxInflation factor`,`value`,e),Fu=e}static defaultAbiCoder(){return Pu??=new e,Pu}static getBuiltinCallException(t,n,r){return Iu(t,n,r,e.defaultAbiCoder())}};function Ru(e){let t={};e.to&&(t.to=e.to),e.from&&(t.from=e.from),e.data&&(t.data=V(e.data));let n=`chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value`.split(/,/);for(let r of n)!(r in e)||e[r]==null||(t[r]=Pr(e[r],`request.${r}`));let r=`type,nonce`.split(/,/);for(let n of r)!(n in e)||e[n]==null||(t[n]=Rr(e[n],`request.${n}`));return e.accessList&&(t.accessList=yl(e.accessList)),`blockTag`in e&&(t.blockTag=e.blockTag),`enableCcipRead`in e&&(t.enableCcipRead=!!e.enableCcipRead),`customData`in e&&(t.customData=e.customData),`blobVersionedHashes`in e&&e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.slice()),`kzg`in e&&(t.kzg=e.kzg),`blobs`in e&&e.blobs&&(t.blobs=e.blobs.map(e=>xr(e)?V(e):Object.assign({},e))),t}function zu(e,t){if(e.provider)return e.provider;R(!1,`missing provider`,`UNSUPPORTED_OPERATION`,{operation:t})}async function Bu(e,t){let n=Ru(t);if(n.to!=null&&(n.to=Yc(n.to,e)),n.from!=null){let t=n.from;n.from=Promise.all([e.getAddress(),Yc(t,e)]).then(([e,t])=>(z(e.toLowerCase()===t.toLowerCase(),`transaction from mismatch`,`tx.from`,t),e))}else n.from=e.getAddress();return await ur(n)}var Vu=class{provider;constructor(e){L(this,{provider:e||null})}async getNonce(e){return zu(this,`getTransactionCount`).getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Bu(this,e)}async populateTransaction(e){let t=zu(this,`populateTransaction`),n=await Bu(this,e);n.nonce??=await this.getNonce(`pending`),n.gasLimit??=await this.estimateGas(n);let r=await this.provider.getNetwork();n.chainId==null?n.chainId=r.chainId:z(Pr(n.chainId)===r.chainId,`transaction chainId mismatch`,`tx.chainId`,e.chainId);let i=n.maxFeePerGas!=null||n.maxPriorityFeePerGas!=null;if(n.gasPrice!=null&&(n.type===2||i)?z(!1,`eip-1559 transaction do not support gasPrice`,`tx`,e):(n.type===0||n.type===1)&&i&&z(!1,`pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas`,`tx`,e),(n.type===2||n.type==null)&&n.maxFeePerGas!=null&&n.maxPriorityFeePerGas!=null)n.type=2;else if(n.type===0||n.type===1){let e=await t.getFeeData();R(e.gasPrice!=null,`network does not support gasPrice`,`UNSUPPORTED_OPERATION`,{operation:`getGasPrice`}),n.gasPrice??=e.gasPrice}else{let e=await t.getFeeData();if(n.type==null){if(e.maxFeePerGas!=null&&e.maxPriorityFeePerGas!=null){if(n.type=2,n.gasPrice!=null){let e=n.gasPrice;delete n.gasPrice,n.maxFeePerGas=e,n.maxPriorityFeePerGas=e}else n.maxFeePerGas??=e.maxFeePerGas,n.maxPriorityFeePerGas??=e.maxPriorityFeePerGas}else e.gasPrice==null?R(!1,`failed to get consistent fee data`,`UNSUPPORTED_OPERATION`,{operation:`signer.getFeeData`}):(R(!i,`network does not support EIP-1559`,`UNSUPPORTED_OPERATION`,{operation:`populateTransaction`}),n.gasPrice??=e.gasPrice,n.type=0)}else(n.type===2||n.type===3)&&(n.maxFeePerGas??=e.maxFeePerGas,n.maxPriorityFeePerGas??=e.maxPriorityFeePerGas)}return await ur(n)}async estimateGas(e){return zu(this,`estimateGas`).estimateGas(await this.populateCall(e))}async call(e){return zu(this,`call`).call(await this.populateCall(e))}async resolveName(e){return await zu(this,`resolveName`).resolveName(e)}async sendTransaction(e){let t=zu(this,`sendTransaction`),n=await this.populateTransaction(e);delete n.from;let r=Kl.from(n);return await t.broadcastTransaction(await this.signTransaction(r))}},Hu=class e extends Vu{address;constructor(e,t){super(t),L(this,{address:e})}async getAddress(){return this.address}connect(t){return new e(this.address,t)}#e(e,t){R(!1,`VoidSigner cannot sign ${e}`,`UNSUPPORTED_OPERATION`,{operation:t})}async signTransaction(e){this.#e(`transactions`,`signTransaction`)}async signMessage(e){this.#e(`messages`,`signMessage`)}async signTypedData(e,t,n){this.#e(`typed-data`,`signTypedData`)}},Uu=class e extends Vu{address;#e;constructor(e,t){super(t),z(e&&typeof e.sign==`function`,`invalid private key`,`privateKey`,`[ REDACTED ]`),this.#e=e;let n=bl(this.signingKey.publicKey);L(this,{address:n})}get signingKey(){return this.#e}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(t){return new e(this.#e,t)}async signTransaction(e){e=Ru(e);let{to:t,from:n}=await ur({to:e.to?Yc(e.to,this.provider):void 0,from:e.from?Yc(e.from,this.provider):void 0});t!=null&&(e.to=t),n!=null&&(e.from=n),e.from!=null&&(z(Kc(e.from)===this.address,`transaction from address mismatch`,`tx.from`,e.from),delete e.from);let r=Kl.from(e);return r.signature=this.signingKey.sign(r.unsignedHash),r.serialized}async signMessage(e){return this.signMessageSync(e)}signMessageSync(e){return this.signingKey.sign(ql(e)).serialized}async signTypedData(e,t,n){let r=await lu.resolveNames(e,t,n,async e=>{R(this.provider!=null,`cannot resolve ENS names without a provider`,`UNSUPPORTED_OPERATION`,{operation:`resolveName`,info:{name:e}});let t=await this.provider.resolveName(e);return R(t!=null,`unconfigured ENS name`,`UNCONFIGURED_NAME`,{value:e}),t});return this.signingKey.sign(lu.hash(r.domain,t,r.value)).serialized}},Wu=" !#$%&'()*+,-./<=>?@[]^_`{|}~",Gu=/^[a-z]*$/i;function Ku(e,t){let n=97;return e.reduce((e,r)=>(r===t?n++:r.match(Gu)?e.push(String.fromCharCode(n)+r):(n=97,e.push(r)),e),[])}function qu(e,t){for(let n=28;n>=0;n--)e=e.split(Wu[n]).join(t.substring(2*n,2*n+2));let n=[],r=e.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(e,t,r,i)=>{if(r)for(let e=parseInt(r);e>=0;e--)n.push(`;`);else n.push(t.toLowerCase());return``});if(r)throw Error(`leftovers: ${JSON.stringify(r)}`);return Ku(Ku(n,`;`),`:`)}function Ju(e){return z(e[0]===`0`,`unsupported auwl data`,`data`,e),qu(e.substring(59),e.substring(1,59))}var Yu=class{locale;constructor(e){L(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(` `)}},Xu=class extends Yu{#e;#t;constructor(e,t,n){super(e),this.#e=t,this.#t=n,this.#n=null}get _data(){return this.#e}_decodeWords(){return Ju(this.#e)}#n;#r(){if(this.#n==null){let e=this._decodeWords();if(_l(e.join(`
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-BcKkbAw3.js";import{t}from"./axios-BywHQoip.js";import{n,r,t as i}from"./wallet-manager-9-XcN6SR.js";var a=async(e,t,n)=>await s(e,t,!1,n)===!1?Promise.reject(`Invalid endpoint.`):e,o=async(e,t,n)=>{try{let r=await Promise.any(e.map(e=>a(e,t,n)));return n?.debug(`rpcEndpoint won the race:`,r),r}catch(e){return Promise.reject(e)}},s=async(e,n,r,i)=>{if(r)return i?.debug(`Skipping test of accessibility for`,e),!0;i?.debug(`Testing accessibility of`,e);try{let r;if(r=typeof e==`string`?n===`rest`?await t.get(`${e}/cosmos/base/tendermint/v1beta1/node_info`):await t.post(e):n===`rest`?await t.get(`${e.url}/cosmos/base/tendermint/v1beta1/node_info`,{headers:e.headers}):await t.post(e.url,{headers:e.headers}),r.status==200)return i?.debug(`Access successfully.`),!0}catch(e){i?.debug(`${e.name}: ${e.message}`)}return i?.debug(`Access failed.`),!1},c=(e,t,n,r,i)=>r===void 0?n===void 0?t===void 0?e!==void 0&&e:t:n:r,l=Error(`Client Not Exist!`),u=Error(`Request Rejected!`),d=Error(`Expired!`),f=class extends Error{walletName;constructor(e){super(`Wallet ${e} is not provided.`),this.walletName=e}},p=class extends Error{name=`ConnectError`;constructor(e){super(e)}},m;(function(e){e.Init=`Init`,e.Pending=`Pending`,e.Done=`Done`,e.Error=`Error`})(m||={});var h;(function(e){e.WalletList=`WalletList`,e.Connecting=`Connecting`,e.Connected=`Connected`,e.Error=`Error`,e.NotExist=`NotExist`,e.Rejected=`Rejected`,e.QRCode=`QRCode`})(h||={});var g;(function(e){e.Disconnected=`Disconnected`,e.Connecting=`Connecting`,e.Connected=`Connected`,e.NotExist=`NotExist`,e.Rejected=`Rejected`,e.Error=`Error`})(g||={});var _=(e,t)=>{switch(e){case`Pending`:return g.Connecting;case`Done`:return g.Connected;case`Error`:switch(t){case l.message:return g.NotExist;case u.message:return g.Rejected;default:return g.Error}case`Init`:return g.Disconnected;default:return g.Disconnected}},v=[{name:`icns`,contract:`osmo1xk0s8xgktn9x5vwcgtjdxqzadg88fgn33p8u9cnpdxwemvxscvast52cdd`,chainName:`osmosis`,getQueryMsg:e=>({icns_names:{address:e}}),slip173:`osmo`},{name:`stargaze`,contract:`stars1fx74nkqkw2748av8j7ew7r3xt9cgjqduwn8m0ur5lhe49uhlsasszc5fhr`,chainName:`stargaze`,getQueryMsg:e=>({name:{address:e}}),slip173:`stars`}],y=e=>{let t=v.find(t=>t.chainName===e);if(!t)throw Error(`No such name service registered with chain `+e);return t},b=e=>v.find(t=>t.name===e),x=e({ClientNotExistError:()=>l,ConnectError:()=>p,ExpiredError:()=>d,Logger:()=>n,RejectedError:()=>u,Session:()=>i,WalletNotProvidedError:()=>f,convertChain:()=>r,getFastestEndpoint:()=>o,getIsLazy:()=>c,getNameServiceRegistryFromChainName:()=>y,getNameServiceRegistryFromName:()=>b,getWalletStatusFromState:()=>_,isValidEndpoint:()=>s});export{l as a,u as c,m as i,f as l,_ as n,p as o,g as r,d as s,x as t,c as u};
1
+ import{r as e}from"./rolldown-runtime-BcKkbAw3.js";import{t}from"./axios-BywHQoip.js";import{n,r,t as i}from"./wallet-manager-DGQAWJIz.js";var a=async(e,t,n)=>await s(e,t,!1,n)===!1?Promise.reject(`Invalid endpoint.`):e,o=async(e,t,n)=>{try{let r=await Promise.any(e.map(e=>a(e,t,n)));return n?.debug(`rpcEndpoint won the race:`,r),r}catch(e){return Promise.reject(e)}},s=async(e,n,r,i)=>{if(r)return i?.debug(`Skipping test of accessibility for`,e),!0;i?.debug(`Testing accessibility of`,e);try{let r;if(r=typeof e==`string`?n===`rest`?await t.get(`${e}/cosmos/base/tendermint/v1beta1/node_info`):await t.post(e):n===`rest`?await t.get(`${e.url}/cosmos/base/tendermint/v1beta1/node_info`,{headers:e.headers}):await t.post(e.url,{headers:e.headers}),r.status==200)return i?.debug(`Access successfully.`),!0}catch(e){i?.debug(`${e.name}: ${e.message}`)}return i?.debug(`Access failed.`),!1},c=(e,t,n,r,i)=>r===void 0?n===void 0?t===void 0?e!==void 0&&e:t:n:r,l=Error(`Client Not Exist!`),u=Error(`Request Rejected!`),d=Error(`Expired!`),f=class extends Error{walletName;constructor(e){super(`Wallet ${e} is not provided.`),this.walletName=e}},p=class extends Error{name=`ConnectError`;constructor(e){super(e)}},m;(function(e){e.Init=`Init`,e.Pending=`Pending`,e.Done=`Done`,e.Error=`Error`})(m||={});var h;(function(e){e.WalletList=`WalletList`,e.Connecting=`Connecting`,e.Connected=`Connected`,e.Error=`Error`,e.NotExist=`NotExist`,e.Rejected=`Rejected`,e.QRCode=`QRCode`})(h||={});var g;(function(e){e.Disconnected=`Disconnected`,e.Connecting=`Connecting`,e.Connected=`Connected`,e.NotExist=`NotExist`,e.Rejected=`Rejected`,e.Error=`Error`})(g||={});var _=(e,t)=>{switch(e){case`Pending`:return g.Connecting;case`Done`:return g.Connected;case`Error`:switch(t){case l.message:return g.NotExist;case u.message:return g.Rejected;default:return g.Error}case`Init`:return g.Disconnected;default:return g.Disconnected}},v=[{name:`icns`,contract:`osmo1xk0s8xgktn9x5vwcgtjdxqzadg88fgn33p8u9cnpdxwemvxscvast52cdd`,chainName:`osmosis`,getQueryMsg:e=>({icns_names:{address:e}}),slip173:`osmo`},{name:`stargaze`,contract:`stars1fx74nkqkw2748av8j7ew7r3xt9cgjqduwn8m0ur5lhe49uhlsasszc5fhr`,chainName:`stargaze`,getQueryMsg:e=>({name:{address:e}}),slip173:`stars`}],y=e=>{let t=v.find(t=>t.chainName===e);if(!t)throw Error(`No such name service registered with chain `+e);return t},b=e=>v.find(t=>t.name===e),x=e({ClientNotExistError:()=>l,ConnectError:()=>p,ExpiredError:()=>d,Logger:()=>n,RejectedError:()=>u,Session:()=>i,WalletNotProvidedError:()=>f,convertChain:()=>r,getFastestEndpoint:()=>o,getIsLazy:()=>c,getNameServiceRegistryFromChainName:()=>y,getNameServiceRegistryFromName:()=>b,getWalletStatusFromState:()=>_,isValidEndpoint:()=>s});export{l as a,u as c,m as i,f as l,_ as n,p as o,g as r,d as s,x as t,c as u};